KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > SeqParser


1 /**
2  *
3  */

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