KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > SequenceParser


1 /**
2  *
3  */

4 package jfun.parsec;
5
6 final class SequenceParser extends Parser<Object JavaDoc> {
7   private final Parser<?>[] ps;
8
9   SequenceParser(String JavaDoc n, Parser<?>[] ps) {
10     super(n);
11     this.ps = ps;
12   }
13
14   boolean apply(ParseContext ctxt) {
15     for (int i = 0; i < ps.length; i++) {
16       final Parser p = ps[i];
17       if (!p.parse(ctxt))
18         return false;
19     }
20     return true;
21   }
22 }
Popular Tags