KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > Seq5Parser


1 /**
2  *
3  */

4 package jfun.parsec;
5
6 final class Seq5Parser<R> extends Parser<R> {
7   private final Parser<?> p1;
8
9   private final Parser<?> p3;
10
11   private final Parser<R> p5;
12
13   private final Parser<?> p4;
14
15   private final Parser<?> p2;
16
17   Seq5Parser(String JavaDoc n, Parser<?> p1, Parser<?> p3, Parser<R> p5, Parser<?> p4, Parser<?> p2) {
18     super(n);
19     this.p1 = p1;
20     this.p3 = p3;
21     this.p5 = p5;
22     this.p4 = p4;
23     this.p2 = p2;
24   }
25
26   boolean apply(final ParseContext ctxt) {
27     if (!p1.parse(ctxt))
28       return false;
29     if (!p2.parse(ctxt))
30       return false;
31     if (!p3.parse(ctxt))
32       return false;
33     if (!p4.parse(ctxt))
34       return false;
35     return p5.parse(ctxt);
36   }
37 }
Popular Tags