KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > Seq3Parser


1 /**
2  *
3  */

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