类 Combinators
java.lang.Object
proguard.classfile.attribute.signature.parsing.Combinators
Wrapper class containing parser combinators. Tools to chain together multiple parsers into more
complex parsers.
-
嵌套类概要
嵌套类 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <A,B, R> Parser<R> chain(Parser<A> aParser, Parser<B> bParser, Combinators.BiCombinator<A, B, R> combinator) Take two parsers and return a new one, which will pass iff both parsers succeed when running one after the other.static <A,B, C, R> Parser<R> chain(Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Combinators.TerCombinator<A, B, C, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 3 parsers.static <A,B, C, D, R>
Parser<R>chain(Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Parser<D> dParser, Combinators.QuaterCombinator<A, B, C, D, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 4 parsers.static <A,B, C, D, E, R>
Parser<R>chain(Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Parser<D> dParser, Parser<E> eParser, Combinators.PentaCombinator<A, B, C, D, E, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 5 parsers.static <T> Parser<T>Given a list of parsers of the same type, return a result of the first one that succeeds.Return a parser which succeeds even in cases when it can't parse anything.Construct a new parser, that will try to run the given one repeatedly and return a list.
-
构造器详细资料
-
Combinators
public Combinators()
-
-
方法详细资料
-
chain
public static <A,B, Parser<R> chainR> (Parser<A> aParser, Parser<B> bParser, Combinators.BiCombinator<A, B, R> combinator) Take two parsers and return a new one, which will pass iff both parsers succeed when running one after the other.- 类型参数:
A- Return type of the first parser.B- Return type of the second parser.R- The new return type.- 参数:
aParser- The parser that should run first.bParser- The second parser.combinator- A function to combine the result of both parsers into one object.- 返回:
- A new parser which succeeds only when both input parsers succeed.
-
chain
public static <A,B, Parser<R> chainC, R> (Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Combinators.TerCombinator<A, B, C, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 3 parsers. -
chain
public static <A,B, Parser<R> chainC, D, R> (Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Parser<D> dParser, Combinators.QuaterCombinator<A, B, C, D, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 4 parsers. -
chain
public static <A,B, Parser<R> chainC, D, E, R> (Parser<A> aParser, Parser<B> bParser, Parser<C> cParser, Parser<D> dParser, Parser<E> eParser, Combinators.PentaCombinator<A, B, C, D, E, R> combinator) Same aschain(Parser, Parser, BiCombinator), just with 5 parsers. -
repeat
Construct a new parser, that will try to run the given one repeatedly and return a list.Note: This parser always succeeds, because if it won't match anything, it will still return an empty list.
- 类型参数:
T- Return type of the input parser.- 参数:
parser- The parser to repeatedly run.- 返回:
- The new parser.
-
optional
Return a parser which succeeds even in cases when it can't parse anything.- 类型参数:
T- The return type of the parser.- 参数:
parser- A parser to wrap with an optional check.- 返回:
- A new parser that doesn't fail when no input is successfully parsed.
-
oneOf
Given a list of parsers of the same type, return a result of the first one that succeeds. Or null if none succeed.- 类型参数:
T- The return type of all the parsers involved.- 参数:
parsers- The input parsers to all try.- 返回:
- A new parser that tries all the given parsers.
-