Package | Description |
---|---|
jfun.parsec |
Provides classes and interfaces for parser combinator logic and basic parsers.
|
Modifier and Type | Method and Description |
---|---|
static <T> ToParser<T,T> |
Parsers.bindAll(java.lang.String name,
ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser.
|
static <T> ToParser<T,T> |
Parsers.bindAll(ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser.
|
static <x> ToParser<x,?> |
Parsers.toOne()
Returns a ToParser that ignores the value passed in and simply returns
one().
|
static <x> ToParser<x,?> |
Parsers.toOne(java.lang.String name)
Returns a ToParser that ignores the value passed in and simply returns
one().
|
static <x,R> ToParser<x,R> |
Parsers.toParser(Parser<R> parser)
Creates a ToParser object by always returning the same Parser object.
|
static <T> ToParser<T,T> |
Parsers.toReturn()
Returns a ToParser instance that simply returns the previous return value.
|
static <T> ToParser<T,T> |
Parsers.toReturn(java.lang.String name)
Returns a ToParser instance that simply returns the previous return value.
|
static <x,y> ToParser<x,y> |
Parsers.toZero()
Returns a ToParser that ignores the value passed in and simply returns
zero().
|
static <x,y> ToParser<x,y> |
Parsers.toZero(java.lang.String name)
Returns a ToParser that ignores the value passed in and simply returns
zero().
|
Modifier and Type | Method and Description |
---|---|
static <From,To> Parser<To> |
Parsers.bind(java.lang.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.
|
<To> Parser<To> |
Parser.bind(java.lang.String name,
ToParser<? super Type,To> tp)
if this parser succeeds, the returned value gets passed on to tp.
|
<To> Parser<To> |
Parser.bind(ToParser<? super Type,To> tp)
if this parser succeeds, the returned value gets passed on to tp.
|
static <T> ToParser<T,T> |
Parsers.bindAll(java.lang.String name,
ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser.
|
static <T> ToParser<T,T> |
Parsers.bindAll(ToParser<T,T>... binders)
Threads an array of ToParser into a single ToParser.
|
static <C,R> Parser<R> |
Parsers.ifelse(java.lang.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.
|
<R> Parser<R> |
Parser.ifelse(java.lang.String name,
ToParser<? super Type,R> yes,
Parser<R> no)
run yes if this succeeds, no if this fails without consuming input;
fails otherwise.
|
<R> Parser<R> |
Parser.ifelse(ToParser<? super Type,R> yes,
Parser<R> no)
run yes if this succeeds, no if this fails without consuming input;
fails otherwise.
|