pobs.parser
Class PRepeat
java.lang.Object
pobs.PParser
pobs.parser.PRepeat
- All Implemented Interfaces:
- PObject
- Direct Known Subclasses:
- PKleene, PMultiple
- public class PRepeat
- extends PParser
Non-terminal parser which matches the same parser multiple times, optionally
limited. Uses skip directive. BNF: this := parser[min, max]
(where min
is the minimum number of repeats required and
max
is the maximum number of repeats allowed)
- Author:
- Martijn W. van der Lee
Field Summary |
static long |
INFINITE
Repeat upto any number of times. |
Constructor Summary |
PRepeat(PObject parser)
Stub constructor specifying one-or-more repetitions. |
PRepeat(PObject parser,
long count)
Stub constructor allow specification an exact number of repetitions. |
PRepeat(PObject parser,
long min,
long max)
Constructor allowing specification of a lower and upper boundary to the
number of repetitions. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INFINITE
public static final long INFINITE
- Repeat upto any number of times. Though this field specifies a fixed
number of repetitions, it is for all practical purposes infinite.
- See Also:
- Constant Field Values
PRepeat
public PRepeat(PObject parser)
- Stub constructor specifying one-or-more repetitions.
PRepeat
public PRepeat(PObject parser,
long count)
- Stub constructor allow specification an exact number of repetitions.
- Parameters:
parser
- the parser to be repeatedcount
- the exact number of repetitions required.
PRepeat
public PRepeat(PObject parser,
long min,
long max)
- Constructor allowing specification of a lower and upper boundary to the
number of repetitions.
- Parameters:
parser
- the parser to be repeatedmin
- the minimum number of repetitions required.max
- the maximum number of repetitions required.
parse
public PMatch parse(PScanner input,
long begin,
PContext context)
- Parameters:
input
- Input to be parsed.begin
- Index of first character of input
to be parsed.context
- Parsing context.
- Returns:
- Parsing result.