pobs.parser
Class PList
java.lang.Object
pobs.PParser
pobs.parser.PList
- All Implemented Interfaces:
- PObject
- public class PList
- extends PParser
Matches a delimited list of items within the specified number of items. The
user is responsible for making sure the item parser does not swollow the
delimiter parser.
- Author:
- Martijn W. van der Lee
Constructor Summary |
PList(PObject item,
PObject delimiter)
Stub constructor taking the item and delimiter parser and assuming one-
or-more iterations. |
PList(PObject item,
PObject delimiter,
long count)
Stub constructor taking the item and delimiter parser and the exact
number of items in the list. |
PList(PObject item,
PObject delimiter,
long min,
long max)
Constructor taking the item and delimiter parser and the minimum and
maximum number of items in the list. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INFINITE
public static final long INFINITE
- See Also:
- Constant Field Values
PList
public PList(PObject item,
PObject delimiter)
- Stub constructor taking the item and delimiter parser and assuming one-
or-more iterations.
- Parameters:
item
- parser which matches the items in the listdelimiter
- parser which matches the delimiters interleaving the items
PList
public PList(PObject item,
PObject delimiter,
long count)
- Stub constructor taking the item and delimiter parser and the exact
number of items in the list.
- Parameters:
item
- parser which matches the items in the listdelimiter
- parser which matches the delimiters interleaving the itemscount
- exact number of items required
PList
public PList(PObject item,
PObject delimiter,
long min,
long max)
- Constructor taking the item and delimiter parser and the minimum and
maximum number of items in the list. Current implementation constructs a
POBS parser, future implementations may use dedicated code for better
performance.
- Parameters:
item
- parser which matches the items in the listdelimiter
- parser which matches the delimiters interleaving the itemsmin
- minimum number of items requiredmax
- maximum number of items parsed
parse
public PMatch parse(PScanner input,
long begin,
PContext context)
- Matches the specified number of items in a delimited list. Each two items
in the list must be separated by exactly one delimiter unless items are
optional.
- Parameters:
input
- Input to be parsed.begin
- Index of first character of input
to be parsed.context
- Parsing context.
- Returns:
- Parsing result.