KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > SomeMaxParser


1 /**
2  *
3  */

4 package jfun.parsec;
5
6 final class SomeMaxParser extends Parser<_> {
7   private final int max;
8
9   private final Parser<?> p;
10
11   SomeMaxParser(String JavaDoc n, int max, Parser<?> p) {
12     super(n);
13     this.max = max;
14     this.p = p;
15   }
16
17   boolean apply(final ParseContext ctxt) {
18     if (ParserInternals.run_some(max, p, ctxt))
19       return ParserInternals.returnValue(null, ctxt);
20     else
21       return false;
22   }
23 }
Popular Tags