jfun.parsec
public final class Parsers extends Object
This class provides general parser combinators that work on both character level and token level.
A parser can work on character level or token level.
For each Parser combinator, we write the signature in a haskellish sytax.
A Parser object is safely covariant about the type parameter. Jparsec tries its best to support covariance in the API since java 5 generics has no covariance support. It is always safe to use the convert() method to explicitly force covariance whenever necessary.
A parser has a user state that can be set and retrieved. Only setState, getState, transformState combinators are user state related.
We denote a user state concerned parser as Parser u a, where u is the user state type and a is the return type.
An array of element type t, is denoted as [t].
Method Summary | |
---|---|
static <T> Parser<T> | alt(String name, Parser<T>... alternatives)
To create a Parser that runs an array of Parser objects
until one succeeds. |
static <T> Parser<T> | alt(Parser<T>... alternatives)
To create a Parser that runs an array of Parser objects
until one succeeds. |
static Parser<Tok> | anyToken()
Consumes a token. |
static Parser<Tok> | anyToken(String name)
Consumes a token. |
static <R> Parser<R> | atomize(String name, Parser<R> p)
Backout input consumption if p fails. |
static <R> Parser<R> | between(Parser<?> open, Parser<?> close, Parser<R> p)
Runs a Parser that is between a pair of parsers. |
static <R> Parser<R> | between(String name, Parser<?> open, Parser<?> close, Parser<R> p)
runs a Parser that is between a pair of parsers. |
static <From,To> Parser<To> | bind(String name, Parser<From> p, ToParser<? super From,To> f)
First run p, if it succeeds, run ToParser f with the value returned from p.
|
static <T> ToParser<T,T> | bindAll(ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser. |
static <T> ToParser<T,T> | bindAll(String name, ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser. |
static Parser<_> | endBy(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static Parser<_> | endBy(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy(Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy(String name, ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static Parser<_> | endBy1(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static Parser<_> | endBy1(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy1(Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy1(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy1(String name, ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static <R> Parser<R[]> | endBy1(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern ended by Parser sep pattern.
|
static Parser<?> | eof()
Asserts eof is met. |
static Parser<?> | eof(String msg)
Asserts eof is met. |
static Parser<?> | eof(String name, String msg)
Asserts eof is met. |
static <x> Parser<x> | expect(String name, String lbl)
Create a Parser object that reports a "something expected" error. |
static <x> Parser<x> | expect(String lbl)
Create a Parser object that reports a "something expected" error. |
static <R> Parser<R> | fail(String msg)
A parser that always fail with the given error message.
|
static <R> Parser<R> | fail(String name, String msg)
A parser that always fail with the given error message.
|
static <R> Parser<R> | followedBy(String name, Parser<?> sep, Parser<R> p)
First run Parser p, then run Parser sep. |
static Parser<Integer> | getIndex()
Retrieves the current index in the source.
|
static Parser<Integer> | getIndex(String name)
Retrieves the current index in the source.
|
static <C,R> Parser<R> | ifelse(String name, Parser<C> p, ToParser<? super C,R> yes, Parser<? extends R> no)
First run Parser p, if it succeeds, thread the return value to ToParser
yes; if it fails and no input is consumed, run Parser no; fails if p fails
and some input is consumed.
|
static <C,R> Parser<R> | ifelse(String name, Parser<C> p, Parser<R> yes, Parser<? extends R> no)
First run Parser p, if it succeeds, run Parser yes; if it fails and no
input is consumed, run Parser no; fails if p fails and some input is
consumed.
|
static <T> Parser<T> | infixl(Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> p)
Left associative infix operator. |
static <T> Parser<T> | infixl(String name, Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> p)
Left associative infix operator. |
static <T> Parser<T> | infixn(Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> operand)
Non-associative infix operator. |
static <T> Parser<T> | infixn(String name, Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> operand)
Non-associative infix operator. |
static <T> Parser<T> | infixr(Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> p)
Right associative infix operator. |
static <T> Parser<T> | infixr(String name, Parser<? extends Map2<? super T,? super T,T>> op, Parser<? extends T> p)
Right associative infix operator. |
static <R> Parser<R> | isConsumed(Parser<R> p)
First run the Parser p, if it succeeds with input consumed, isConsumed()
succeeds; if it fails or did not consume input, isConsumed() fails.
|
static <R> Parser<R> | isConsumed(Parser<R> p, String err)
First run the Parser p, if it succeeds with input consumed, isConsumed()
succeeds; if it fails or did not consume input, isConsumed() fails.
|
static <R> Parser<R> | isConsumed(String name, Parser<R> p)
First run the Parser p, if it succeeds with input consumed, isConsumed()
succeeds; if it fails or did not consume input, isConsumed() fails.
|
static <R> Parser<R> | isConsumed(String name, Parser<R> p, String err)
First run the Parser p, if it succeeds with input consumed, isConsumed()
succeeds; if it fails or did not consume input, isConsumed() fails.
|
static boolean | isDebugEnabled()
Is debugging enabled? |
static <R> Parser<R> | isReturn(String name, ObjectPredicate<R> op)
Fails if the return value of the previous parser does not satisify the
given predicate. |
static <R> Parser<R> | isReturn(String name, Parser<R> p, ObjectPredicate<? super R> op)
The created Parser object will first run parser p, if the return value of
parser p does not satisify the given predicate, it fails and the input
consumption of parser p is undone. |
static <R> Parser<R> | isReturn(String name, Parser<R> p, ObjectPredicate<? super R> op, String expecting)
The created Parser object will first run parser p, if the return value of
parser p does not satisify the given predicate, it fails and the input
consumption of parser p is undone. |
static <R> Parser<R> | label(String name, String lbl, Parser<R> p)
if Parser p fails and does not consume input, reports an expecting error
with the given label.
|
static <R> Parser<R> | lazy(ParserEval<R> p)
Create a lazy evaluated Parser. the ParserEval object is evaluated only
when the Parser is actually executed.
|
static <R> Parser<R> | lazy(Parser<R>[] placeholder, int pos)
Create a lazy evaluated parser.
|
static <R> Parser<R> | lazy(Parser<R>[] placeholder)
Create a lazy evaluated parser.
|
static <R> Parser<R> | lazy(String name, ParserEval<R> p)
Create a lazy evaluated Parser. the ParserEval object is evaluated only
when the Parser is actually executed.
|
static <R> Parser<R> | longer(String name, Parser<R> p1, Parser<R> p2)
Runs two alternative parsers. |
static <R> Parser<R> | longer(Parser<R> p1, Parser<R> p2)
Runs two alternative parsers. |
static <R> Parser<R> | longest(String name, Parser<R>... ps)
Runs an array of alternative parsers. |
static <R> Parser<R> | longest(Parser<R>... ps)
Runs an array of alternative parsers. |
static <R> Parser<R> | lookahead(String name, int toknum, Parser<R> p)
By default, ifelse, plus, sum will not try to run the next branch if the
previous branch failed and consumed some input. this is because the default
look-ahead token is 1. |
static <R> Parser<_> | many(String name, int min, Parser<?> p)
Greedily runs Parser p repeatedly for at least min times and discard the
results.
|
static Parser<_> | many(String name, Parser<?> p)
Greedily runs Parser p repeatedly and discard the results.
|
static <R> Parser<R[]> | many(String name, Class<R> etype, int min, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at least min times and collect the
result in an array whose element type is etype.
|
static <R> Parser<R[]> | many(String name, Class<R> etype, Parser<? extends R> p)
Greedily runs Parser p repeatedly and collect the result in an array whose
element type is etype.
|
static <R> Parser<R[]> | many(String name, ArrayFactory<R> af, int min, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at least min times and collect the
result in an array created by ArrayFactory object.
|
static <R> Parser<R[]> | many(String name, ArrayFactory<R> af, Parser<? extends R> p)
Greedily runs Parser p repeatedly and collect the result in an array
created by ArrayFactory object.
|
static <From,A extends From,R,To extends R> Parser<R> | manyAccum(String name, Accumulatable<From,To> accm, int min, Parser<A> p)
Greedily runs Parser p repeatedly for at least min times and collect the
result with the Accumulator object created by Accumulatable. |
static <From,A extends From,R,To extends R> Parser<R> | manyAccum(String name, Accumulatable<From,To> accm, Parser<A> p)
Greedily runs Parser p repeatedly for 0 or more times. and collect the
result with the Accumulator object created by Accumulatable. |
static <R,From> Parser<R> | map(String name, Parser<From> p, Map<? super From,R> m)
Transform the return value of Parser p to a different value.
|
static <A,B,R> Parser<R> | map2(Parser<A> p1, Parser<B> p2, Map2<? super A,? super B,R> m2)
Run 2 Parsers sequentially and transform the return values to a new value.
|
static <A,B,R> Parser<R> | map2(String name, Parser<A> p1, Parser<B> p2, Map2<? super A,? super B,R> m2)
Run 2 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,R> Parser<R> | map3(Parser<A> p1, Parser<B> p2, Parser<C> p3, Map3<? super A,? super B,? super C,R> m3)
Run 3 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,R> Parser<R> | map3(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3, Map3<? super A,? super B,? super C,R> m3)
Run 3 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,D,R> Parser<R> | map4(Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Map4<? super A,? super B,? super C,? super D,R> m4)
Run 4 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,D,R> Parser<R> | map4(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Map4<? super A,? super B,? super C,? super D,R> m4)
Run 4 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,D,E,R> Parser<R> | map5(Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Parser<E> p5, Map5<? super A,? super B,? super C,? super D,? super E,R> m5)
Run 5 Parsers sequentially and transform the return values to a new value.
|
static <A,B,C,D,E,R> Parser<R> | map5(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Parser<E> p5, Map5<? super A,? super B,? super C,? super D,? super E,R> m5)
Run 5 Parsers sequentially and transform the return values to a new value.
|
static <R> Parser<R> | mapn(Parser<?>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static <R> Parser<R> | mapn(String name, Parser<?>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static <E,R> Parser<R> | mapn(Class<? super E> etype, Parser<E>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static <E,R> Parser<R> | mapn(String name, Class<? super E> etype, Parser<E>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static <E,R> Parser<R> | mapn(ArrayFactory<?> af, Parser<?>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static <R> Parser<R> | mapn(String name, ArrayFactory<?> af, Parser<?>[] ps, Mapn<R> mn)
Sequencing of an array of Parser objects. |
static Parser<?> | not(String name, Parser<?> p)
Succeeds if Parser p fails; Fails otherwise. |
static Parser<?> | not(String name, Parser<?> p, String errmsg)
Succeeds if Parser p fails; Fails otherwise. |
static <R> Parser<R> | notConsumed(Parser<R> p)
First run the Parser p, if it succeeds with no input consumed,
notConsumed() succeeds; if it fails, notConsumed() fails; if it succeeds
and consumes input, the input consumption is undone and notConsumed()
fails.
|
static <R> Parser<R> | notConsumed(Parser<R> p, String err)
First run the Parser p, if it succeeds with no input consumed,
notConsumed() succeeds; if it fails, notConsumed() fails; if it succeeds
and consumes input, the input consumption is undone and notConsumed()
fails.
|
static <R> Parser<R> | notConsumed(String name, Parser<R> p)
First run the Parser p, if it succeeds with no input consumed,
notConsumed() succeeds; if it fails, notConsumed() fails; if it succeeds
and consumes input, the input consumption is undone and notConsumed()
fails.
|
static <R> Parser<R> | notConsumed(String name, Parser<R> p, String err)
First run the Parser p, if it succeeds with no input consumed,
notConsumed() succeeds; if it fails, notConsumed() fails; if it succeeds
and consumes input, the input consumption is undone and notConsumed()
fails.
|
static Parser<?> | one()
The parser that always succeed. |
static Parser<?> | one(String name)
The parser that always succeed. |
static <R> Parser<R> | option(R v, Parser<R> p)
Runs Parser p, if it fails with no input consumed, return default value v
instead. |
static <R> Parser<R> | option(String name, R v, Parser<R> p)
Runs Parser p, if it fails with no input consumed, return default value v
instead. |
static <R> Parser<R> | optional(Parser<R> p)
Runs Parser p, if it fails with no input consumed, succeed anyway with null as the result. |
static <R> Parser<R> | optional(String name, Parser<R> p)
Runs Parser p, if it fails with no input consumed, succeed anyway with null as result. |
static Parser<Object> | or(String name, Parser<?>... alternatives)
To create a Parser that runs an array of Parser objects
until one succeeds. |
static Parser<Object> | or(Parser<?>... alternatives)
To create a Parser that runs an array of Parser objects
until one succeeds. |
static <A,B> Parser<Pair<A,B>> | pair(Parser<A> p1, Parser<B> p2)
Sequentially run 2 parser objects and collect the results in a Pair object. |
static <A,B> Parser<Pair<A,B>> | pair(String name, Parser<A> p1, Parser<B> p2)
Sequentially run 2 parser objects and collect the results in a Pair object. |
static <R> Parser<R> | parseTokens(Parser<Tok[]> lexer, Parser<R> p, String module)
The created parser object will take as input the array of Tok
returned from the lexer object, feed it into the Parser object p and run
it, return the result from parser p. |
static <R> Parser<R> | parseTokens(String name, Parser<Tok[]> lexer, Parser<R> p, String module)
The created parser object will take as input the array of Tok
returned from the lexer object, feed it into the Parser object p and run
it, return the result from parser p. |
static <R> Parser<R> | parseTokens(String eof_title, ShowToken show, Parser<Tok[]> lexer, Parser<R> p, String module)
The created parser object will take as input the array of Tok
returned from the lexer object, feed it into the Parser object p and run
it, return the result from parser p. |
static <R> Parser<R> | parseTokens(String name, String eof_title, ShowToken show, Parser<Tok[]> lexer, Parser<R> p, String module)
The created parser object will take as input the array of Tok
returned from the lexer object, feed it into the Parser object p and run
it, return the result from parser p. |
static <R> Parser<R> | peek(String name, Parser<R> p)
Look ahead with Parser p. |
static <R> Parser<R> | plus(Parser<R> p1, Parser<? extends R> p2)
2 alternative parser objects.
|
static <R> Parser<R> | plus(String name, Parser<R> p1, Parser<? extends R> p2)
2 alternative parser objects.
|
static <R> Parser<R> | plus(Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3)
3 alternative parser objects.
|
static <R> Parser<R> | plus(String name, Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3)
3 alternative parser objects.
|
static <R> Parser<R> | plus(Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3, Parser<? extends R> p4)
4 alternative parser objects.
|
static <R> Parser<R> | plus(String name, Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3, Parser<? extends R> p4)
4 alternative parser objects.
|
static <R> Parser<R> | plus(Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3, Parser<? extends R> p4, Parser<? extends R> p5)
5 alternative parser objects.
|
static <R> Parser<R> | plus(String name, Parser<R> p1, Parser<? extends R> p2, Parser<? extends R> p3, Parser<? extends R> p4, Parser<? extends R> p5)
5 alternative parser objects.
|
static <R> Parser<R> | plus(String name, Parser<R>... ps)
combine alternative parser objects. |
static <R> Parser<R> | plus(Parser<R>... ps)
combine alternative parser objects. |
static <T> Parser<T> | postfix(Parser<? extends Map<? super T,T>> op, Parser<? extends T> p)
Runs Parser p and then run Parser op for 0 or more times greedily. |
static <T> Parser<T> | postfix(String name, Parser<? extends Map<? super T,T>> op, Parser<? extends T> p)
Runs Parser p and then run Parser op for 0 or more times greedily. |
static <T> Parser<T> | prefix(Parser<? extends Map<? super T,T>> op, Parser<? extends T> p)
Runs Parser op for 0 or more times greedily. |
static <T> Parser<T> | prefix(String name, Parser<? extends Map<? super T,T>> op, Parser<? extends T> p)
Runs Parser op for 0 or more times greedily. |
static <R> Parser<R> | raise(Object e)
throws a pseudo-exception.
|
static <R> Parser<R> | raise(String name, Object e)
throws a pseudo-exception.
|
static Parser<_> | repeat(String name, int n, Parser<?> p)
Runs Parser p for n times. |
static <R> Parser<R[]> | repeat(String name, Class<R> etype, int n, Parser<? extends R> p)
Runs Parser p for n times, collect the return values in an array whose
element type is etype.
|
static <R> Parser<R[]> | repeat(String name, ArrayFactory<R> af, int n, Parser<? extends R> p)
Runs Parser p for n times, collect the return values in an array created by
the ArrayFactory object.
|
static <R> Parser<R> | retn(R r)
The parser that returns value v. |
static <R> Parser<R> | retn(String name, R r)
The parser that returns value v. |
static Parser<?> | runnable(String name, Runnable runnable)
To create a Parser that always succeeds and causes a certain side effect
using a Runnable object.
|
static Parser<?> | runnable(Runnable runnable)
To create a Parser that always succeeds and causes a certain side effect
using a Runnable object.
|
static <R> R | runParser(CharSequence src, Parser<R> p, PositionMap pmap, String module)
Runs a character level parser with a CharSequence input.
|
static <R> R | runParser(CharSequence src, Parser<R> p, String module)
Runs a character level parser with a CharSequence input.
|
static <R> R | runParser(Tok[] toks, int end_index, Parser<R> p, ShowToken show, String eof_title, PositionMap pmap, String module)
Runs a token level Parser object with an array of tokens.
|
static Parser<_> | sepBy(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static Parser<_> | sepBy(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R> Parser<R[]> | sepBy(Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R> Parser<R[]> | sepBy(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R> Parser<R[]> | sepBy(String name, ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R> Parser<R[]> | sepBy(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static Parser<_> | sepBy1(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static Parser<_> | sepBy1(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R> Parser<R[]> | sepBy1(Class<R> etype, Parser<?> sep, Parser<? extends R> p) Class -> Parser a -> Parser [Object]. |
static <R> Parser<R[]> | sepBy1(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p) Class -> Parser a -> Parser [Object]. |
static <R> Parser<R[]> | sepBy1(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static <R,A extends R> Parser<R[]> | sepBy1(String name, ArrayFactory<R> af, Parser<?> sep, Parser<A> p)
run a series of Parser p pattern that is seperated by Parser sep pattern.
|
static Parser<_> | sepEndBy(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy(Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static Parser<_> | sepEndBy(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy(String name, ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static Parser<_> | sepEndBy1(Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static Parser<_> | sepEndBy1(String name, Parser<?> sep, Parser<?> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy1(Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy1(ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy1(String name, Class<R> etype, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R[]> | sepEndBy1(String name, ArrayFactory<R> af, Parser<?> sep, Parser<? extends R> p)
run a series of Parser p pattern that is seperated and optionally ended by
Parser sep pattern.
|
static <R> Parser<R> | seq(Parser<?> p1, Parser<R> p2)
Sequencing 2 parser objects. |
static <R> Parser<R> | seq(String name, Parser<?> p1, Parser<R> p2)
Sequencing 2 parser objects. |
static <R> Parser<R> | seq(Parser<?> p1, Parser<?> p2, Parser<R> p3)
Sequencing 3 parser objects.
|
static <R> Parser<R> | seq(String name, Parser<?> p1, Parser<?> p2, Parser<R> p3)
Sequencing 3 parser objects.
|
static <R> Parser<R> | seq(Parser<?> p1, Parser<?> p2, Parser<?> p3, Parser<R> p4)
Sequencing 4 parser objects.
|
static <R> Parser<R> | seq(String name, Parser<?> p1, Parser<?> p2, Parser<?> p3, Parser<R> p4)
Sequencing 4 parser objects.
|
static <R> Parser<R> | seq(Parser<?> p1, Parser<?> p2, Parser<?> p3, Parser<?> p4, Parser<R> p5)
Sequencing 5 parser objects.
|
static <R> Parser<R> | seq(String name, Parser<?> p1, Parser<?> p2, Parser<?> p3, Parser<?> p4, Parser<R> p5)
Sequencing 5 parser objects.
|
static Parser<Object> | seqAll(Parser<?>[] ps)
Sequencing of an array of Parser objects. |
static Parser<Object> | seqAll(String name, Parser<?>[] ps)
Sequencing of an array of Parser objects. |
static Parser<?> | sequence(Parser<?>... ps)
Sequencing of an array of Parser objects. |
static Parser<?> | sequence(String name, Parser<?>... ps)
Sequencing of an array of Parser objects. |
static void | setDebug(boolean debugged)
enable or disable debugging. |
static <R> Parser<R> | shorter(String name, Parser<R> p1, Parser<R> p2)
Runs two alternative parsers. |
static <R> Parser<R> | shorter(Parser<R> p1, Parser<R> p2)
Runs two alternative parsers. |
static <R> Parser<R> | shortest(String name, Parser<R>... ps)
Runs an array of alternative parsers. |
static <R> Parser<R> | shortest(Parser<R>... ps)
Runs an array of alternative parsers. |
static <R> Parser<_> | some(String name, int min, int max, Parser<?> p)
Greedily runs Parser p repeatedly for at least min times and at most max
time. |
static Parser<_> | some(String name, int max, Parser<?> p)
Greedily runs Parser p repeatedly for at most max time. |
static <R> Parser<R[]> | some(String name, ArrayFactory<R> af, int min, int max, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at least min times and at most max
time. |
static <R> Parser<R[]> | some(String name, ArrayFactory<R> af, int max, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at most max time. |
static <R> Parser<R[]> | some(String name, Class<R> etype, int min, int max, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at least min times and at most max
times. |
static <R> Parser<R[]> | some(String name, Class<R> etype, int max, Parser<? extends R> p)
Greedily runs Parser p repeatedly for at most max times. |
static <From,A extends From,R,To extends R> Parser<R> | someAccum(String name, Accumulatable<From,To> accm, int min, int max, Parser<A> p)
Greedily runs Parser p repeatedly for at least min times and at most max
times, collect the result with the Accumulator object created by
Accumulatable. |
static <From,A extends From,R,To extends R> Parser<R> | someAccum(String name, Accumulatable<From,To> accm, int max, Parser<A> p)
Greedily runs Parser p repeatedly for at most max times, collect the result
with the Accumulator object created by Accumulatable. |
static <R> Parser<R> | step(String name, int n, Parser<R> p)
lookahead looks at logical steps. step(String, int, Parser) runs this
parser and sets the number of logical steps.
|
static Parser<Object> | sum(Parser<?>... ps)
An array of alternative Parser objects. zero() is returned if the array is
empty. the returned Parser object will try the Parser objects in the array
one by one, until one of the following conditioins are met: the Parser
succeeds, (sum() succeeds) the Parser fails with input consumed (sum() fails with input consumed) the end of array is encountered. (sum() fails with no input consumed). |
static Parser<Object> | sum(String name, Parser<?>... ps)
An array of alternative Parser objects. zero() is returned if the array is
empty. the returned Parser object will try the Parser objects in the array
one by one, until one of the following conditioins are met: the Parser
succeeds, (sum() succeeds) the Parser fails with input consumed (sum() fails with input consumed) the end of array is encountered. (sum() fails with no input consumed). |
static <R> Parser<R> | token(FromToken<R> ft)
Token level parser. checks the current token with the FromToken object. |
static <R> Parser<R> | token(String name, FromToken<R> ft)
Token level parser. checks the current token with the FromToken object. |
static Parser<Tok> | token(Object t)
Token level parser. checks to see if the current token is token t. (using
==). |
static Parser<Tok> | token(String name, Object t)
Token level parser. checks to see if the current token is token t. (using
==). |
static <x> ToParser<x,?> | toOne()
Returns a ToParser that ignores the value passed in and simply returns
one().
|
static <x> ToParser<x,?> | toOne(String name)
Returns a ToParser that ignores the value passed in and simply returns
one().
|
static <x,R> ToParser<x,R> | toParser(Parser<R> parser)
Creates a ToParser object by always returning the same Parser object. |
static <T> ToParser<T,T> | toReturn()
Returns a ToParser instance that simply returns the previous return value.
|
static <T> ToParser<T,T> | toReturn(String name)
Returns a ToParser instance that simply returns the previous return value.
|
static <x,y> ToParser<x,y> | toZero()
Returns a ToParser that ignores the value passed in and simply returns
zero().
|
static <x,y> ToParser<x,y> | toZero(String name)
Returns a ToParser that ignores the value passed in and simply returns
zero().
|
static <R> Parser<R> | tryParser(Parser<R> p, Catch<? extends R> hdl)
if Parser p throws an exception, it is handled by Catch hdl.
|
static <R> Parser<R> | tryParser(String name, Parser<R> p, Catch<? extends R> hdl)
if Parser p throws an exception, it is handled by Catch hdl.
|
static <A,B,C> Parser<Tuple3<A,B,C>> | tuple(Parser<A> p1, Parser<B> p2, Parser<C> p3)
Sequentially run 3 parser objects and collect the results in a Tuple3 object. |
static <A,B,C,D> Parser<Tuple4<A,B,C,D>> | tuple(Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4)
Sequentially run 4 parser objects and collect the results in a Tuple4 object. |
static <A,B,C,D,E> Parser<Tuple5<A,B,C,D,E>> | tuple(Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Parser<E> p5)
Sequentially run 5 parser objects and collect the results in a Tuple5 object. |
static <A,B,C> Parser<Tuple3<A,B,C>> | tuple(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3)
Sequentially run 3 parser objects and collect the results in a Tuple3 object. |
static <A,B,C,D> Parser<Tuple4<A,B,C,D>> | tuple(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4)
Sequentially run 4 parser objects and collect the results in a Tuple4 object. |
static <A,B,C,D,E> Parser<Tuple5<A,B,C,D,E>> | tuple(String name, Parser<A> p1, Parser<B> p2, Parser<C> p3, Parser<D> p4, Parser<E> p5)
Sequentially run 5 parser objects and collect the results in a Tuple5 object. |
static <x> Parser<x> | unexpected(String msg)
Reports an unexpected error.
|
static <x> Parser<x> | unexpected(String name, String msg)
Reports an unexpected error.
|
static <x> Parser<x> | zero()
The parser that always fails. |
static <x> Parser<x> | zero(String name)
The parser that always fails. |
Parameters: name the new parser name. alternatives the alternative parsers.
Returns: the new Parser object.
Parameters: alternatives the alternative parsers.
Returns: the new Parser object.
Parser Token
Returns: the Parser object.
Parser Tok
Parameters: name the name of the Parser object.
Returns: the Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. p the Parser object.
Returns: the new Parser object.
Parser ? -> Parser a -> Parser ? -> Parser a
Parameters: open the opening parser. close the closing parser. p the Parser object.
Returns: the new Parser object.
Parser ? -> Parser ? -> Parser a -> Parser a
Parameters: name the name of the new Parser object. open the opening parser. close the closing parser. p the Parser object.
Returns: the new Parser object.
Parser a -> (a->Parser b) -> Parser b
Parameters: name the name of the Parser. p the first Parser object. f the ToParser object to run if the first succeeds.
Returns: the Parser object.
[(a->Parser a)] -> a -> Parser a
Parameters: binders all the ToParser objects.
Returns: the new ToParser.
[(a->Parser a)] -> a -> Parser a
Parameters: binders all the ToParser objects. name the name of the Parser created by the result ToParser.
Returns: the new ToParser.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are discarded.
Class -> Parser ? -> Parser _
Parameters: sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: etype array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are discarded.
ArrayFactory a -> Parser ? -> Parser a -> Parser a[]
Parameters: af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: etype array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy1(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy1(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed for at least once.
For example: pattern "token; token; token; token;" is endBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser ?
Returns: the Parser object.
Parser ?
Parameters: msg the error message if eof is not met.
Returns: the Parser object.
Parser ?
Parameters: name the name of the new Parser object. msg the error message if eof is not met.
Returns: the Parser object.
Parameters:
Returns: the Parser object.
Since: version 0.6
Parameters:
Returns: the Parser object.
Since: version 0.6
Parser *
Parameters: msg the error message.
Returns: the Parser object.
Parser *
Parameters: name the Parser object name. msg the error message.
Returns: the Parser object.
Parser ? -> Parser a -> Parser a
Parameters: name the name of the new Parser object. sep the following parser. p the Parser object.
Returns: the new Parser object.
Parser Integer
Returns: the Parser object.
Parser Integer
Parameters: name the name of the Parser object.
Returns: the Parser object.
Parser a -> (a->Parser b) -> Parser b -> Parser b
Parameters: name the name of the new Parser object. p the Parser object to test. yes the true branch. no the false branch.
Returns: the new Parser object.
Parser x -> Parser b -> Parser b -> Parser b
Parameters: name the name of the new Parser object. p the Parser object to test. yes the true branch. no the false branch.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: name the name of the new Parser object. op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: op the operator. operand the operand.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: name the name of the new Parser object. op the operator. operand the operand.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a->a) -> Parser a -> Parser a
Parameters: name the name of the new Parser object. op the operator. p the operand.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the Parser object to test.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the Parser object to test. err the error message when p succeeds with no input consumed.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. p the Parser object to test.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser. p the Parser object to test. err the error message when p succeeds with no input consumed.
Returns: the new Parser object.
Since: version 1.1
Parameters: name the name of the new Parser object. op the predicate object.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. p the parser object to test the return value of. op the predicate object.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. p the parser object to test the return value of. op the predicate object. expecting the "expected" error message.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. lbl the label text. p the Parser object to label.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the ParserEval object.
Returns: the Parser object.
Parameters: placeholder the array that contains parser object. pos the position (0-based) of the parser to lazily evaluate.
Returns: the lazy parser.
Parameters: placeholder the array whose first object is the lazily evaluated parser object.
Returns: the lazy parser.
Parser a -> Parser a
Parameters: name the name of the Parser object. p the ParserEval object.
Returns: the Parser object.
Parameters: name the name of the new Parser object. p1 the 1st alternative parser. p2 the 2nd alternative parser.
Returns: the new Parser object.
Parameters: p1 the 1st alternative parser. p2 the 2nd alternative parser.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. ps the array of alternative parsers.
Returns: the new Parser object.
Parameters: ps the array of alternative parsers.
Returns: the new Parser object.
lookahead only affects one nesting level. Parsers.plus(p1,p2).ifelse(yes,no).lookahead(3) will not affect the Parsers.plus(p1,p2) nested within ifelse.
lookahead directly on top of lookahead will override the previous
lookahead. Parsers.plus(p1,p2).lookahead(3).lookahead(1) is equivalent as
Parsers.plus(p1, p2).lookahead(1).
lookahead looks at logical step. by default, each terminal is one logical
step. atomize() combinator ensures at most 1 logical step for a parser. Use
step() combinator to fine control logical steps.
Parameters: name the name of the new Parser object. toknum the number of tokens to look ahead.
Returns: the new Parser object.
int -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. min the minimal times to run. p the Parser object.
Returns: the new Parser object.
Parser ? -> Parser _
Parameters: name the name of the new Parser object. p the Parser object.
Returns: the new Parser object.
Class [a] -> int -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. etype the array element type. min the maximal times to run. p the Parser object.
Returns: the new Parser object.
Class [a] -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. etype the array element type. p the Parser object.
Returns: the new Parser object.
ArrayFactory a -> int -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. min the maximal times to run. p the Parser object.
Returns: the new Parser object.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. p the Parser object.
Returns: the new Parser object.
Accumulatable a r -> int -> int -> Parser a -> Parser r
Parameters: name the name of the new Parser object. accm the Accumulatable object. min the minimum times to repeat. p the Parser object.
Returns: the new Parser object.
Accumulatable a r -> int -> int -> Parser a -> Parser r
Parameters: name the name of the new Parser object. accm the Accumulatable object. p the Parser object.
Returns: the new Parser object.
Parser a -> (a->b) -> Parser b
Parameters: name the name of the new Parser object. p the Parser object. m the Map object.
Returns: the new Parser object.
Parser a->Parser b->(a->b->r)->Parser r
Parameters: p1 1st parser. p2 2nd parser. m2 the transformer.
Returns: the new Parser object.
Parser a->Parser b->(a->b->r)->Parser r
Parameters: name the name of the new Parser object. p1 1st parser. p2 2nd parser. m2 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->(a->b->c->r)->Parser r
Parameters: p1 1st parser. p2 2nd parser. p3 3rd parser. m3 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->(a->b->c->r)->Parser r
Parameters: name the name of the new Parser object. p1 1st parser. p2 2nd parser. p3 3rd parser. m3 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->Parser d->(a->b->c->d->r)->Parser r
Parameters: p1 1st parser. p2 2nd parser. p3 3rd parser. p4 4th parser. m4 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->Parser d->(a->b->c->d->r)->Parser r
Parameters: name the name of the new Parser object. p1 1st parser. p2 2nd parser. p3 3rd parser. p4 4th parser. m4 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->Parser d->Parser e->(a->b->c->d->e->r)->Parser r
Parameters: p1 1st parser. p2 2nd parser. p3 3rd parser. p4 4th parser. p5 5th parser. m5 the transformer.
Returns: the new Parser object.
Parser a->Parser b->Parser c->Parser d->Parser e->(a->b->c->d->e->r)->Parser r
Parameters: name the name of the new Parser object. p1 1st parser. p2 2nd parser. p3 3rd parser. p4 4th parser. p5 5th parser. m5 the transformer.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: name the name of the new Parser. ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: etype the element type of the return value array. ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: name the name of the new Parser. etype the element type of the return value array. ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: af the ArrayFactory object. ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
[Parser a] -> ([a]->r) -> Parser r
Parameters: name the name of the new Parser. af the ArrayFactory object. ps the array of Parser objects. mn the Mapn object.
Returns: the new Parser object.
Parser ? -> Parser ?
Parameters: name the name of the new Parser object. p the Parser to 'not'
Returns: the new Parser object.
Parser ? -> Parser ?
Parameters: name the name of the new Parser object. p the Parser to 'not' errmsg the error message if Parser p succeeds.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the Parser object to test.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the Parser object to test. err the error message when p succeeds and consumes some input.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser. p the Parser object to test.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser. p the Parser object to test. err the error message when p succeeds and consumes some input.
Returns: the new Parser object.
Parser ?
Returns: the Parser object.
Parser ?
Parameters: name the name of the Parser.
Returns: the Parser object.
a -> Parser a -> Parser a
Parameters: v the default value. p the Parser object.
Returns: the new Parser object.
a -> Parser a -> Parser a
Parameters: name the name of the new Parser object. v the default value. p the Parser object.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: p the Parser object.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. p the Parser object.
Returns: the new Parser object.
Parameters: name the new parser name. alternatives the alternative parsers.
Returns: the new Parser object.
Parameters: alternatives the alternative parsers.
Returns: the new Parser object.
Parameters: p1 the first parser. p2 the second parser.
Returns: the result parser.
Parameters: name the result parser name. p1 the first parser. p2 the second parser.
Returns: the result parser.
Parameters: lexer the lexer object that returns an array of Tok objects. p the token level parser object. module the module name. Use any name that's meaningful. that will parse the array of Tok objects.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. lexer the lexer object that returns an array of Tok objects. p the token level parser object. module the module name. Use any name that's meaningful. that will parse the array of Tok objects.
Returns: the new Parser object.
Parameters: eof_title the name of "end of input" show the object to transform a token to a string. lexer the lexer object that returns an array of Tok objects. p the token level parser object. module the module name. Use any name that's meaningful. that will parse the array of Tok objects.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. eof_title the name of "end of input" show the object to transform a token to a string. lexer the lexer object that returns an array of Tok objects. p the token level parser object module the module name. Use any name that's meaningful. that will parse the array of Tok objects.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. p the Parser object.
Returns: the new Parser object.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a
Parameters: p1 1st Parser. p2 2nd Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a -> Parser a
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a -> Parser a
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a -> Parser a -> Parser a
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser. p5 5th Parser.
Returns: the new Parser.
For backwward compatibility with java 1.4. Use the vararg version in java 5.
Parser a -> Parser a -> Parser a -> Parser a -> Parser a -> Parser a
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser. p5 5th Parser.
Returns: the new Parser.
Parameters: name the name of the created parser. ps the Parser objects.
Returns: the new Parser.
Parameters: ps the Parser objects.
Returns: the new Parser.
Parser (a->a) -> Parser a -> Parser a
Parameters: op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a) -> Parser a -> Parser a
Parameters: name the name of the new Parser object. op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a) -> Parser a -> Parser a
Parameters: op the operator. p the operand.
Returns: the new Parser object.
Parser (a->a) -> Parser a -> Parser a
Parameters: name the name of the new Parser object. op the operator. p the operand.
Returns: the new Parser object.
Parser *
Parameters: e the exception object.
Returns: the Parser object.
Parser *
Parameters: name the name of the new Parser object. e the exception object.
Returns: the Parser object.
int -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. n the number of times to run. p the Parser object.
Returns: the new Parser object.
Class -> int -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. n the number of times to run. p the Parser object.
Returns: the new Parser object.
ArrayFactory a -> int -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFactory object. n the number of times to run. p the Parser object.
Returns: the new Parser object.
a -> Parser a
Parameters: r the value to be returned by the parser.
Returns: the Parser object.
a -> Parser a
Parameters: name the name of the Parser. r the value to be returned by the parser.
Returns: the Parser object.
Parameters: name the parser name. runnable the Runnable object.
Returns: the Parser object.
Parameters: runnable the Runnable object.
Returns: the Parser object.
Parameters: src the input source. p the parser object to run. pmap the PositionMap object used to map a character index to line/column number. module the module name. Use any name that's meaningful.
Returns: the result object.
Parameters: src the input source. p the parser object to run. module the module name. This name apears in error message.
Returns: the result object.
[Tok] -> int -> Parser a -> ShowToken -> String -> PositionMap -> a
Parameters: toks the input tokens end_index the index after the last character in the source. p the parser object. show the object to show the tokens. eof_title the name of "end of file". module the module name. Use any name that's meaningful. This value will be shown in any EOF related messages. pmap the PositionMap object to map a character index to the line/column number.
Returns: the return value of the Parser object. (returned by retn() function)
Throws: ParserException when parsing fails.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: etype the array element type. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: af the ArrayFacory object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p can succeed 0 or more times.
For example: pattern "token, token, token, token" is sepBy(comma, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Class -> Parser a -> Parser [Object].
run a series of Parser p pattern that is seperated by Parser sep pattern.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are collected in an array whose element type is etype.
Parameters: etype the array element type. sep the seperator. p the Parser object.
Returns: the new Parser object.
Class -> Parser a -> Parser [Object].
run a series of Parser p pattern that is seperated by Parser sep pattern.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are collected in an array whose element type is etype.
Parameters: name the name of the new Parser object. etype the array element type. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: af the ArrayFacory object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p has to succeed at least once.
For example: pattern "token, token, token, token" is sepBy1(comma, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: etype the array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p may succeed 0 or more times.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy(semicolon, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are discarded.
Parser ? -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: etype the array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser a -> Parser [a]
Parameters: af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are collected in an array whose element type is etype.
Class -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser p should succeed at least once.
For example: patterns "token; token; token; token" and "token;" are both
sepEndBy1(semicolon, token).
The return values are collected in an array created by the ArrayFactory
object af.
ArrayFactory a -> Parser ? -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. sep the end seperator. p the Parser object.
Returns: the new Parser object.
Parser ? -> Parser b -> Parser b
Parameters: p1 1st Parser. p2 2nd Parser.
Returns: the new Parser.
Parser ? -> Parser b -> Parser b
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c -> Parser d -> Parser d
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c -> Parser d -> Parser d
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c -> Parser d -> Parser e -> Parser e
Parameters: p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser. p5 5th Parser.
Returns: the new Parser.
Parser a -> Parser b -> Parser c -> Parser c -> Parser d -> Parser e -> Parser e
Parameters: name the name of the new Parser object. p1 1st Parser. p2 2nd Parser. p3 3rd Parser. p4 4th Parser. p5 5th Parser.
Returns: the new Parser.
[Parser ?] -> Parser Object
Parameters: ps the array of Parser objects.
Returns: the new Parser object.
[Parser ?] -> Parser Object
Parameters: name the name of the new Parser. ps the array of Parser objects.
Returns: the new Parser object.
[Parser ?] -> Parser ?
Parameters: ps the array of Parser objects.
Returns: the new Parser object.
Since: version 1.0
[Parser ?] -> Parser ?
Parameters: name the name of the new Parser. ps the array of Parser objects.
Returns: the new Parser object.
Since: version 1.0
Parameters: debugged true if debugging is enabled, false otherwise.
Since: version 1.1
Parameters: name the name of the new Parser object. p1 the 1st alternative parser. p2 the 2nd alternative parser.
Returns: the new Parser object.
Parameters: p1 the 1st alternative parser. p2 the 2nd alternative parser.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. ps the array of alternative parsers.
Returns: the new Parser object.
Parameters: ps the array of alternative parsers.
Returns: the new Parser object.
int -> int -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. min the minimal number of times to run. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
int -> Parser ? -> Parser _
Parameters: name the name of the new Parser object. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
ArrayFactory a -> int -> int -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. min the minimal number of times to run. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
ArrayFactory a -> int -> Parser a -> Parser [a]
Parameters: name the name of the new Parser object. af the ArrayFacory object. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
Class -> int -> int -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. min the minimal number of times to run. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
Class -> int -> Parser a -> Parser [Object]
Parameters: name the name of the new Parser object. etype the array element type. max the maximal number of times to run. p the Parser object.
Returns: the new Parser object.
Accumulatable a r -> int -> int -> Parser a -> Parser r
Parameters: name the name of the new Parser object. accm the Accumulatable object. min the minimum times to repeat. max the maximum times to repeat. p the Parser object.
Returns: the new Parser object.
Accumulatable a r -> int -> int -> Parser a -> Parser r
Parameters: name the name of the new Parser object. accm the Accumulatable object. max the maximum times to repeat. p the Parser object.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. n the number logical steps. n>=0 has to be true. p the Parser object.
Returns: the new Parser object.
[Parser a] -> Parser a
Parameters: ps the array of alternative Parser objects.
Returns: the new Parser object.
[Parser a] -> Parser a
Parameters: name the name of the new Parser object. ps the array of alternative Parser objects.
Returns: the new Parser object.
(SourcePos->Token->a) -> Parser a
Parameters: ft the FromToken object.
Returns: the new Parser object.
(SourcePos->Object->a) -> Parser a
Parameters: name the name of the new Parser object. ft the FromToken object.
Returns: the new Parser object.
Object -> Parser SourcePos
Parameters: t the expected Token object.
Returns: the new Parser object.
Token -> Parser SourcePos
Parameters: name the name of the new Parser object. t the expected Token object.
Returns: the new Parser object.
x -> Parser ?
Returns: the ToParser object.
x -> Parser ?
Parameters: name the name of the Parser that ToParser returns.
Returns: the ToParser object.
Parameters:
Returns: the ToParser object.
Since: version 0.4.1
a -> Parser a
Returns: The ToParser object.
a -> Parser a
Returns: The ToParser object.
_ -> Parser *
Returns: the ToParser object.
_ -> Parser *
Parameters: name the name of the Parser that ToParser returns.
Returns: the ToParser object.
Parser a -> Parser a
Parameters: p the Parser object. hdl the exception handler.
Returns: the new Parser object.
Parser a -> Parser a
Parameters: name the name of the new Parser object. p the Parser object. hdl the exception handler.
Returns: the new Parser object.
Parameters: p1 the first parser. p2 the second parser. p3 the 3rd parser.
Returns: the result parser
Parameters: p1 the first parser. p2 the second parser. p3 the 3rd parser. p4 the 4th parser.
Returns: the result parser
Parameters: p1 the first parser. p2 the second parser. p3 the 3rd parser. p4 the 4th parser. p5 the 5th parser.
Returns: the result parser
Parameters: name the result parser name. p1 the first parser. p2 the second parser. p3 the 3rd parser.
Returns: the result parser
Parameters: name the result parser name. p1 the first parser. p2 the second parser. p3 the 3rd parser. p4 the 4th parser.
Returns: the result parser
Parameters: name the result parser name. p1 the first parser. p2 the second parser. p3 the 3rd parser. p4 the 4th parser. p5 the 5th parser.
Returns: the result parser
Parser *
Parameters: msg the error message.
Returns: the new Parser object.
Parser *
Parameters: name the name of the new Parser object. msg the error message.
Returns: the new Parser object.
Parser *
Returns: the Parser object.
Parser *
Parameters: name the name of the Parser.
Returns: the Parser object.