KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > Seq4Parser


1 /**
2  *
3  */

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