KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > ManyMinParser


1 /**
2  *
3  */

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