public class Translet extends Object
The application to a track of a timescape model is done by calling a utility
function from Util
.
The static factory methods in this class realize combinators for
the construction of parsers. Some specialized basic parsers can be found in
TransletLib
; instructive examples can be found in
MaWiCM
etc.; see also the
user documentation.
Implementation:
Parsing is done in brute-force breadth-first, which is feasible thanks to
relatively small input sizes.
Error diagnosis is included as first-class resident by collecting all
failed attempts, in parallel to the successful.
This is realized by all functions operating on a SET of Translet.State
, each
representing such a parsing hypothesis.
The type parameter of any Translet.Parser
is the type of its result.
This type is the fundamental means to direct or reject all combinator applications.
It is extensively checked by all static combinator methods, including
the store operations which deliver the final conversion results for further
processing. This strategy heavily contributes to the overall type safety of
the resulting network.
Furthermore, types are mostly inferred when using the static constructor methods,
which increases compactness and elegance of notation.
The Translet.State
object duplicates the type parameter of the related parser.
Modifier and Type | Class and Description |
---|---|
static class |
Translet._CAT<R>
Implements a greedy longest prefix match from a collection of strings.
|
static class |
Translet._CONST<R>
Parser for a simple string constant which must appear verbatim, as is.
|
static class |
Translet._REGEX
Parser for text input following a regular expression.
|
protected static class |
Translet.Alternative
Realizes a protocol tree of alternatives to the parsing results.
|
static class |
Translet.CoTupleParser<A,B,C,D>
Common superclass for Parsers which accept one of many alternatives
and return a
CoTuple (ORn and PRIORn). |
(package private) static class |
Translet.disj_flavour
Kinds of disjunctive parser combinators.
|
static class |
Translet.FormatPrinter_memo
Format printer which puts maximally one ParserFormat to each screen column
and memorizes this for later alignment of consumed char data.
|
static class |
Translet.FramedParser<A>
Accepts a sequence "A,B,C", where only the middle parsing/processing result is
stored as result in the
Translet.State object, discarding the frame. |
static class |
Translet.HeadParser<A>
Accepts a sequence "A,B,..", where only the very first parsing/processing result is
stored as result in the
Translet.State object, discarding all the tail. |
static class |
Translet.LimesParser<A>
Common superclass for Parsers which accept one of many alternatives
and return the upper limit of the different result classes (OR1 and PRIOR1).
|
static class |
Translet.OptionParser<D>
Option parser, in greedy and non-deterministic variant, with or without default value.
|
static class |
Translet.OrCoTupleParser<A,B,C,D>
Realizes disjunction which is nondeterministic and returns a CoTuple.
|
static class |
Translet.OrLimesParser<A>
Realizes disjunction which is nondeterministic and returns an upper limit class.
|
static interface |
Translet.Parseable<D>
Used to retrieve a
Translet.Parser in a particular (human) language,
to plug it into the tscore parsing process. |
static class |
Translet.Parser<R>
Base class for all parser classes, contains most of the working methods.
|
static class |
Translet.ParserFormat
Specialized Format which refers to a Parser for alignment of char data.
|
static class |
Translet.PermutationParser<R,A,B,C,D,E,F,G,H>
Variant of
Translet.ProductParser which accepts all permutations of sub-parsers. |
static class |
Translet.PlusParser<D>
Repetition parser which does not allow allow empty list as result.
|
static class |
Translet.PriorCoTupleParser<A,B,C,D>
Realizes disjunction which is priorized and returns a CoTuple.
|
static class |
Translet.PriorLimesParser<A>
Realizes disjunction which is priorized and returns an upper limit class.
|
static class |
Translet.ProductParser<R,A,B,C,D,E,F,G,H>
Common superclass for Parsers which produce a product type as their result.
|
static class |
Translet.Recursive<R>
A placeholder which can be formandum into a parser construct, and
later be assigned the complete parser as a whole, for recursive use.
|
static class |
Translet.RepParser<D>
Common superclass for
Translet.StarParser and Translet.PlusParser . |
static class |
Translet.SequParser<R,A,B,C,D,E,F,G,H>
Variant of
Translet.ProductParser which accepts a certain sequence of sub-parsers. |
static class |
Translet.StarParser<D>
Repetition parser which allows empty list as result.
|
static class |
Translet.State<R>
Central data type for parser operation.
|
static class |
Translet.StorageWrapper<S>
Common superclass of the storing oeprators.
|
static class |
Translet.Store_1<S>
Storing operator which only one(1) value per key.
|
static class |
Translet.Store_M<S>
Storing operator which can store multiple (>1) values per key.
|
Modifier and Type | Field and Description |
---|---|
protected static LocationMap<Object,XMLDocumentIdentifier> |
dummyLocationMap
Maps the zero-th line of an "Object" type location to the zero-th line of an
"XMLDocumentIdentifier" type location.
|
static char |
endChar
Appended to any input string as final delimiter.
|
static String |
eoInput
Appended to any input string as final delimiter.
|
(package private) static Translet.Parser<String> |
eps
A parser matching an empty character sequecen in the input.
|
static Format |
format_brclose
Format containing an closing parenthesis.
|
static Format |
format_bropen
Format containing an opening square bracket.
|
static Format |
format_comma
Format containing a comma.
|
static Format |
format_commaSp
Format containing a comma and a space.
|
static Format |
format_dq
Format containing a double quote.
|
static Format |
format_greedy
Format to indicate "greediness" when building the name of a repetition
or option parser.
|
static int |
format_indent
Default indetation depth for nested format.
|
static Format |
format_pclose
Format containing an closing parenthesis.
|
static Format |
format_popen
Format containing an opening parenthesis.
|
static int |
MESSAGEWIDTH |
static eu.bandm.tscore.base.Translet.NA |
na
One instance of NA is enough (all parser terms are algebraic) and can
be used everywhere.
|
static eu.bandm.tscore.base.Translet.NonGreedy |
nonGreedy
Marker object to distinguish greedy and non-greedy (=non-deterministic) variants.
|
static Location<Object> |
startOfString
Constant location at column number 0.
|
Constructor and Description |
---|
Translet() |
Modifier and Type | Method and Description |
---|---|
protected static <R> Set<Translet.State<R>> |
__SET_CAST(Set<? extends Translet.State<?>> set)
Aux function for casting a "Set
|
static Translet._CAT<String> |
CAT(Collection<String> s)
Factory method for a catalog parser with a list of inputs texts = result objects.
|
static Translet._CAT<String> |
CAT(List<String> s)
Factory method for a catalog parser with a list of inputs texts = result objects.
|
static <R> Translet._CAT<R> |
CAT(Map<String,R> results)
Factory method for a catalog parser with a map of inputs texts to result objects.
|
static Translet._CAT<String> |
CAT(String... s)
Factory method for a catalog parser with a list of inputs texts = result objects.
|
static Translet._CONST<String> |
CONST(String s)
Factory method for a const parser where the accepted string is the parsing result.
|
static <X> Translet._CONST<X> |
CONST(String s,
X x)
Factory method for a const parser with explicit parsing result.
|
protected static void |
disj_makeAlternative(Translet.disj_flavour flavour,
Translet.State<?> inState,
Set<Translet.Alternative> alternatives,
List<Translet.Parser<?>> notHit,
Set<Translet.Alternative> subAlts)
Constructs a new disjunction parser of the given kind with all failed
sub-parser, to add this new expression to alternatives.
|
protected static Format |
disj_makeName(String operator,
boolean full,
Map<Translet.Recursive,String> names,
Translet.Parser<?> p1,
Translet.Parser<?> p2,
Translet.Parser<?> p3,
Translet.Parser<?> p4)
Construct the pretty-print name for a disjunctive parser.
|
protected static <R,S> void |
disj_testOneBranch(Translet.Parser<S> disj_parser,
Translet.Parser<R> parser,
List<Translet.Parser<?>> notHit,
int index,
Translet.State<?> inState,
Set<Translet.State<S>> outStates,
Set<Translet.Alternative> alternatives)
Tests one of the branch-parsers (with the given index) of the disj_parser,
with the given start state.
|
static <R> void |
displayBindings(CatalogByString cat,
List<String> prefs,
PrintStream ps,
int width,
boolean full,
Object locationtext,
Translet.Parser<?> parser,
Set<Translet.State<R>> results,
@Opt Translet.State<R> selected,
@Opt Set<Translet.State<R>> rests,
@Opt Set<Translet.Alternative> alts,
Modifiers modifiers,
boolean showAlts,
boolean showRests)
Presents all collected prefixes of possible parse trees to the user for error diagnosis.
|
static <R> void |
displayBindings(CatalogByString cat,
List<String> prefs,
PrintWriter pw,
int width,
boolean full,
@Opt Object locationtext,
Translet.Parser<?> parser,
@Opt Set<Translet.State<R>> results,
@Opt Translet.State<R> selected,
Set<Translet.State<R>> rests,
Set<Translet.Alternative> alts,
Modifiers modifiers,
boolean showAlts,
boolean showRests)
Show complete parsing situation on a PrintStream, possibly multi-lingual.
|
static int |
displayOneBinding(PrintWriter pw,
Translet.FormatPrinter_memo positions,
@Opt Translet.State<?> result,
Modifiers modifiers)
Prints one prefix of a parse tree, i.e.
|
static <T> eu.bandm.tscore.base.Translet.Fail<T> |
FAIL()
One instance of NA is enough (all parser terms are algebraic) and can
be used everywhere.
|
protected static Object |
findResult_untyp(Translet.State<?> start,
Set<? extends Translet.State<?>> set)
Provide "deflt=null" for
findResult_untyp(State, Set, Object) . |
protected static @Opt Object |
findResult_untyp(Translet.State<?> start,
Set<? extends Translet.State<?>> set,
@Opt Object deflt)
|
protected static <R> R |
findResult(Translet.State<?> start,
Set<Translet.State<R>> set)
Provide "deflt=null" for
findResult(State, Set, Object) . |
protected static <R> R |
findResult(Translet.State<?> start,
Set<Translet.State<R>> set,
R deflt)
Search the chain of all predecessors starting with "start" and return
the ".result" value of the first state which is contained in "set".
|
static Format |
formatApplication(String op,
Iterable<Format> data)
Makes a format for one operator and an argument list using an "append" Format.
|
static Format |
formatArgList(Iterable<Format> data)
Makes a "list" format: "block"/"append" is outer/inner combinator;
commma and space the delimiters; all together in a pair of parentheses and indented.
|
static <D> Translet.FramedParser<D> |
FRAME(Translet.Parser<?> p0,
Translet.Parser<D> sub,
Translet.Parser<?> p1)
Factors method to create one frame parser.
|
protected static Translet.Parser<?> |
getSubOrNa(List<Translet.Parser<?>> subs,
int size,
int idx)
Return the element number "idx" (zero based!) from the list, or
na ,
it the index is too large. |
static <D> Translet.HeadParser<D> |
HEAD(Translet.Parser<D> sub,
Translet.Parser<?>... subs)
Factors method to create one head parser.
|
protected static MessageFormatter.Formandum |
locationIndication(@Opt String paramName,
@Opt String voiceName,
String data,
Modifiers modifiers)
Synthesizes a multi-lingual verbal description of parameter input text location,
namely voicename, paramname, and the text itself.
|
protected static void |
nonNull(Object o,
String t)
Throws exception with given text if object reference is null.
|
static <D> Translet.OptionParser<D> |
OPT(boolean greedy,
D deflt,
Translet.Parser<D> sub)
Factory method for an option with the given default value and greediness.
|
static <D> Translet.OptionParser<D> |
OPT(Translet.Parser<D> sub)
Factory method for a non-greey option without default.
|
static <A> Translet.OrLimesParser<A> |
OR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2)
Factory method for a nondeterministic disjunction returning the limes type.
|
static <A> Translet.OrLimesParser<A> |
OR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2,
Translet.Parser<? extends A> p3)
Factory method for a nondeterministic disjunction returning the limes type.
|
static <A> Translet.OrLimesParser<A> |
OR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2,
Translet.Parser<? extends A> p3,
Translet.Parser<? extends A> p4)
Factory method for a nondeterministic disjunction returning the limes type.
|
static <A,B> Translet.OrCoTupleParser<A,B,Object,Object> |
ORn(Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a nondeterministic disjunction returning a co-tuple.
|
static <A,B,C> Translet.OrCoTupleParser<A,B,C,Object> |
ORn(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a nondeterministic disjunction returning a co-tuple.
|
static <A,B,C,D> Translet.OrCoTupleParser<A,B,C,D> |
ORn(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a nondeterministic disjunction returning a co-tuple.
|
static <R> R |
parseAndDiagnosis(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
PrintStream displayStream,
CatalogByString cat,
List<String> prefs,
LocationMap<Object,XMLDocumentIdentifier> locationMap,
@Opt String paramName,
@Opt String voiceName,
Event storageKey,
String data,
Translet.Parser<R> parser,
Modifiers modifiers)
Central entry point for parsing one(1) text input for one(1) event and
one(1) parameter name.
|
static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> |
PERM(BiFunction<A,B,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a permutation of two, applying the given function to get the result.
|
static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a permutation of two, applying a constructor for the given class
to get the result.
|
static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a permutation of three, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a permutation of four, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a permutation of five, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a permutation of six, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F,G> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a permutation of seven, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F,G,H> |
PERM(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a permutation of eight, applying a constructor for the given class
to get the result.
|
static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> |
PERM(Function3<A,B,C,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a permutation of three, applying the given function to get the result.
|
static <R,A,B,C,D> |
PERM(Function4<A,B,C,D,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a permutation of four, applying the given function to get the result.
|
static <R,A,B,C,D,E> |
PERM(Function5<A,B,C,D,E,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a permutation of five, applying the given function to get the result.
|
static <R,A,B,C,D,E,F> |
PERM(Function6<A,B,C,D,E,F,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a permutation of six, applying the given function to get the result.
|
static <R,A,B,C,D,E,F,G> |
PERM(Function7<A,B,C,D,E,F,G,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a permutation of seven, applying the given function to get the result.
|
static <R,A,B,C,D,E,F,G,H> |
PERM(Function8<A,B,C,D,E,F,G,H,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a permutation of eight, applying the given function to get the result.
|
static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a permutation of two, creating no result.
|
static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a permutation of three, creating no result.
|
static <R,A,B,C,D> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a permutation of four, creating no result.
|
static <R,A,B,C,D,E> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a permutation of five, creating no result.
|
static <R,A,B,C,D,E,F> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a permutation of six, creating no result.
|
static <R,A,B,C,D,E,F,G> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a permutation of seven, creating no result.
|
static <R,A,B,C,D,E,F,G,H> |
PERM(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a permutation of eight, creating no result.
|
static <D> Translet.PlusParser<D> |
PLUS(boolean greedy,
Translet.Parser<D> sub)
Factory method for repetitions which may not be empty; greediness set by paraemter.
|
static <D> Translet.PlusParser<D> |
PLUS(boolean greedy,
Translet.Parser<D> sub,
@Opt Translet.Parser<?> sep)
Factory method for repetitions which may not be empty, need the separator between
repetitions and are greedy according to the parameter value.
|
static <D> Translet.PlusParser<D> |
PLUS(eu.bandm.tscore.base.Translet.NonGreedy nonGreedy,
Translet.Parser<D> sub)
Factory method for repetitions which may not be empty and parse non-greedily.
|
static <D> Translet.PlusParser<D> |
PLUS(Translet.Parser<D> sub)
Factory method for repetitions which may not be empty and parse greedily.
|
static <A> Translet.PriorLimesParser<A> |
PRIOR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2)
Factory method for a first-wins disjunction returning the limes type.
|
static <A> Translet.PriorLimesParser<A> |
PRIOR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2,
Translet.Parser<? extends A> p3)
Factory method for a first-wins disjunction returning the limes type.
|
static <A> Translet.PriorLimesParser<A> |
PRIOR1(Translet.Parser<? extends A> p1,
Translet.Parser<? extends A> p2,
Translet.Parser<? extends A> p3,
Translet.Parser<? extends A> p4)
Factory method for a first-wins disjunction returning the limes type.
|
static <A,B> Translet.PriorCoTupleParser<A,B,Object,Object> |
PRIORn(Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a first-wins disjunction returning a co-tuple.
|
static <A,B,C> Translet.PriorCoTupleParser<A,B,C,Object> |
PRIORn(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a first-wins disjunction returning a co-tuple.
|
static <A,B,C,D> Translet.PriorCoTupleParser<A,B,C,D> |
PRIORn(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a first-wins disjunction returning a co-tuple.
|
static <R> Translet.Recursive<R> |
RECURSIVE()
Factory method for a Parser with a synthetic name in all print-outs.
|
static <R> Translet.Recursive<R> |
RECURSIVE(String name)
Factory method for a Parser with the given name in all print-outs.
|
static Translet._REGEX |
REGEX(String s)
Factory method for a parser which accepts all strings matched by the Java regex pattern.
|
static <R,A,B> Translet.SequParser<R,A,B,Object,Object,Object,Object,Object,Object> |
SEQU(BiFunction<A,B,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a sequence of two, applying the given function to get the result.
|
static <R,A> Translet.SequParser<R,A,Object,Object,Object,Object,Object,Object,Object> |
SEQU(Class<R> cons,
Translet.Parser<A> p1)
Factory method for a singleton sequence, applying a constructor for the given class
to get the result.
|
static <R,A,B> Translet.SequParser<R,A,B,Object,Object,Object,Object,Object,Object> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a sequence of two, applying a constructor for the given class
to get the result.
|
static <R,A,B,C> Translet.SequParser<R,A,B,C,Object,Object,Object,Object,Object> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a sequence of three, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a sequence of four, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a sequence of five, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a sequence of six, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F,G> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a sequence of seven, applying a constructor for the given class
to get the result.
|
static <R,A,B,C,D,E,F,G,H> |
SEQU(Class<R> cons,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a sequence of eight, applying a constructor for the given class
to get the result.
|
static <R,A> Translet.SequParser<R,A,Object,Object,Object,Object,Object,Object,Object> |
SEQU(Function<A,R> f,
Translet.Parser<A> p1)
Factory method for a singleton sequence, applying the given function to get the
result.
|
static <R,A,B,C> Translet.SequParser<R,A,B,C,Object,Object,Object,Object,Object> |
SEQU(Function3<A,B,C,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a sequence of three, applying the given function to get the result.
|
static <R,A,B,C,D> |
SEQU(Function4<A,B,C,D,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a sequence of four, applying the given function to get the result.
|
static <R,A,B,C,D,E> |
SEQU(Function5<A,B,C,D,E,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a sequence of five, applying the given function to get the result.
|
static <R,A,B,C,D,E,F> |
SEQU(Function6<A,B,C,D,E,F,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a sequence of six, applying the given function to get the result.
|
static <R,A,B,C,D,E,F,G> |
SEQU(Function7<A,B,C,D,E,F,G,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a sequence of seven, applying the given function to get the result.
|
static <R,A,B,C,D,E,F,G,H> |
SEQU(Function8<A,B,C,D,E,F,G,H,R> f,
Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a sequence of eight, applying the given function to get the result.
|
static <A,B> Translet.SequParser<Object,A,B,Object,Object,Object,Object,Object,Object> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2)
Factory method for a sequence of two, creating no result.
|
static <A,B,C> Translet.SequParser<Object,A,B,C,Object,Object,Object,Object,Object> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3)
Factory method for a sequence of three, creating no result.
|
static <A,B,C,D> Translet.SequParser<Object,A,B,C,D,Object,Object,Object,Object> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4)
Factory method for a sequence of four, creating no result.
|
static <A,B,C,D,E> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5)
Factory method for a sequence of five, creating no result.
|
static <A,B,C,D,E,F> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6)
Factory method for a sequence of six, creating no result.
|
static <A,B,C,D,E,F,G> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7)
Factory method for a sequence of seven, creating no result.
|
static <A,B,C,D,E,F,G,H> |
SEQU(Translet.Parser<A> p1,
Translet.Parser<B> p2,
Translet.Parser<C> p3,
Translet.Parser<D> p4,
Translet.Parser<E> p5,
Translet.Parser<F> p6,
Translet.Parser<G> p7,
Translet.Parser<H> p8)
Factory method for a sequence of eight, creating no result.
|
protected static boolean |
significantAltsExist(int index,
Set<Translet.Alternative> alts)
Find whether an alternative exists which started AFTER having consumed
some input > epsilon.
|
static <D> Translet.StarParser<D> |
STAR(boolean greedy,
Translet.Parser<D> sub)
Factory method for repetitions which may be empty; greediness set by paraemter.
|
static <D> Translet.StarParser<D> |
STAR(boolean greedy,
Translet.Parser<D> sub,
@Opt Translet.Parser<?> sep)
Factory method for repetitions which may be empty, need the separator between
repetitions and are greedy accroding to the parameer value.
|
static <D> Translet.StarParser<D> |
STAR(eu.bandm.tscore.base.Translet.NonGreedy nonGreedy,
Translet.Parser<D> sub)
Factory method for repetitions which may be empty and parse non-greedily.
|
static <D> Translet.StarParser<D> |
STAR(Translet.Parser<D> sub)
Factory method for repetitions which may be empty and parse greedily.
|
static <D> Translet.Store_1<D> |
STORE(Map<Event,? super D> store,
Translet.Parser<D> sub)
Factory MessageReceiver for a store with single values per key.
|
static <D> Translet.Store_M<D> |
STORE(Multimap<Event,? super D> store,
Translet.Parser<D> sub)
Factory MessageReceiver for a store with multiple values per key.
|
static <R> R |
testParse(String data,
Translet.Parser<R> parser,
boolean verbose,
boolean showParser)
Same as
testParse(String,Parser,MessageReceiver,boolean,boolean) ,
but sends all error messages to a MessagePrinter to System.err, without localization. |
static <R> R |
testParse(String data,
Translet.Parser<R> parser,
MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
boolean verbose,
boolean showParser)
Test method for a given parser and a given text input.
|
protected static String |
translate(CatalogByString cat,
List<String> prefs,
String text,
Object... args)
Translates the text and formats the arguments ("printf") un-translated.
|
protected static Translet.Parser<?> |
wrapSequ(List<Translet.Parser<?>> subs)
Wrap a list of parsers into one(1) top-level sequence parser, iff longer
than one (>1).
|
public static final int MESSAGEWIDTH
public static final int format_indent
public static final Format format_dq
public static final Format format_popen
public static final Format format_pclose
public static final Format format_bropen
public static final Format format_brclose
public static final Format format_comma
public static final Format format_commaSp
public static final Format format_greedy
public static final eu.bandm.tscore.base.Translet.NA na
static final Translet.Parser<String> eps
public static final String eoInput
endChar
,
Constant Field Valuespublic static final char endChar
eoInput
,
Constant Field Valuespublic static final Location<Object> startOfString
protected static LocationMap<Object,XMLDocumentIdentifier> dummyLocationMap
public static eu.bandm.tscore.base.Translet.NonGreedy nonGreedy
public static Format formatApplication(String op, Iterable<Format> data)
formatArgList(Iterable)
.public static Format formatArgList(Iterable<Format> data)
protected static Translet.Parser<?> getSubOrNa(List<Translet.Parser<?>> subs, int size, int idx)
na
,
it the index is too large.protected static Translet.Parser<?> wrapSequ(List<Translet.Parser<?>> subs)
protected static String translate(CatalogByString cat, List<String> prefs, String text, Object... args)
public static <R> void displayBindings(CatalogByString cat, List<String> prefs, PrintStream ps, int width, boolean full, Object locationtext, Translet.Parser<?> parser, Set<Translet.State<R>> results, @Opt @Opt Translet.State<R> selected, @Opt @Opt Set<Translet.State<R>> rests, @Opt @Opt Set<Translet.Alternative> alts, Modifiers modifiers, boolean showAlts, boolean showRests)
ps
- drain for a print writer in the system's default encoding.displayBindings(CatalogByString, List, PrintWriter, int, boolean, Object, Parser,
Set, State, Set, Set, Modifiers, boolean, boolean)
public static <R> void displayBindings(CatalogByString cat, List<String> prefs, PrintWriter pw, int width, boolean full, @Opt @Opt Object locationtext, Translet.Parser<?> parser, @Opt @Opt Set<Translet.State<R>> results, @Opt @Opt Translet.State<R> selected, Set<Translet.State<R>> rests, Set<Translet.Alternative> alts, Modifiers modifiers, boolean showAlts, boolean showRests)
Frame
,
first print formatted the grammar expression, and then all consumed terminal
symbols horizontally aligned with the corresponding grammar symbol
(which is form Translet._CAT
or Translet._CONST
or Translet._REGEX
).
A typical example is
kdf_vii.tscore:6:34 No parsing result for "C*2uX" grammar rule for this input is Parser all = OR1(SEQU(OR1(SEQU(CAT("I", "II", "III", "IV")), CAT("D", "C")?), SEQU( "", CAT("D", "C"))), | PERM((">")?, ( "u")?, ("r")?, | OR1(SEQU( "/",REGEX("[2-9]")), | SEQU( "*", REGEX("[2-9]"))), | ) | || ), SEQU(REGEX( "[1-9]"), PERM(( ">")?, ("u")?, ("r")?)), "X", "%" | || | ) | || | After having parsed ... | || | | || "C" "*" |"2" "u" there could follow input according to ... PERM( ">"?, "r"?) There are unparsable rest characters "X" at position 5
(See Lepper,Trancón "Translets", Bad Honnef 2018, pgs.113-130)
cat
- Translations for the constant explanation texts.
(Since this output is directed to domain experts, it is multi lingual.)prefs
- Language preferences of translationpw
- drain for the printed textswidth
- column number of the outputfull
- FIXMElocationtext
- leading information text where this display belongs to
(is redundant if this display follows an error message or warning.)parser
- the complete syntax expression which rules the parsing and print out.results
- states which represent different successful parsingsselected
- one state which has been chosen from "results" by some oraclerests
- FIXMEalts
- FIXMEmodifiers
- the ubiquituous configuration object for parsingshowAlts
- whether the alternatives shall be printedshowRests
- whether the alternatives with unparsed rests shall be printedpublic static int displayOneBinding(PrintWriter pw, Translet.FormatPrinter_memo positions, @Opt @Opt Translet.State<?> result, Modifiers modifiers)
pw
- drain of the outputpositions
- maps terminal parsers to output columnsresult
- the final state of the parsing tree to be printedmodifiers
- general modifiers for parsingprotected static void nonNull(Object o, String t)
public static final <T> eu.bandm.tscore.base.Translet.Fail<T> FAIL()
public static <R> Translet.Recursive<R> RECURSIVE()
public static <R> Translet.Recursive<R> RECURSIVE(String name)
@Opt public static <R> R testParse(String data, Translet.Parser<R> parser, boolean verbose, boolean showParser)
testParse(String,Parser,MessageReceiver,boolean,boolean)
,
but sends all error messages to a MessagePrinter to System.err, without localization.@Opt public static <R> R testParse(String data, Translet.Parser<R> parser, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, boolean verbose, boolean showParser)
data
- the text to parseparser
- the parser to applymsg
- drain of all messagesverbose
- whether diagnosis information shall be printedshowParser
- whether the synthesized parser name shall be shonw
in the start message. (This may appear clumsy when nesting is complicated.)protected static MessageFormatter.Formandum locationIndication(@Opt @Opt String paramName, @Opt @Opt String voiceName, String data, Modifiers modifiers)
voiceName
- the name of the voice (maybe ==null, if not related to a voice)paramName
- the name of the parameter (maybe ==null if the main parameter is meant)data
- the source input textmodifiers
- only used to quote the source input textpublic static <R> R parseAndDiagnosis(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, PrintStream displayStream, CatalogByString cat, List<String> prefs, LocationMap<Object,XMLDocumentIdentifier> locationMap, @Opt @Opt String paramName, @Opt @Opt String voiceName, Event storageKey, String data, Translet.Parser<R> parser, Modifiers modifiers)
Util.parseParamTrack(MessageReceiver,Vox,String,String,Translet.Parser,Modifiers)
msg
- drain of all messagescat
- FIXME RAUS ???prefs
- FIXME RAUS ???locationMap
- maps the positions relative to the input string to the original
source file, if any.paramName
- maybe null, iff local parsing situation of source text is NOT related
to a score OR main parameter is meant. (will be translated)voiceName
- maybe null, iff local parsing situation of source text is NOT related
to a score.storageKey
- under which all storage operations formandum in the parser will
finally store the resultsdata
- input to parseparser
- to applymodifiers
- define the parsing conditionspublic static Translet._CONST<String> CONST(String s)
public static <X> Translet._CONST<X> CONST(String s, X x)
public static Translet._REGEX REGEX(String s)
public static Translet._CAT<String> CAT(String... s)
public static Translet._CAT<String> CAT(List<String> s)
public static Translet._CAT<String> CAT(Collection<String> s)
public static <R> Translet._CAT<R> CAT(Map<String,R> results)
public static <D> Translet.Store_1<D> STORE(Map<Event,? super D> store, Translet.Parser<D> sub)
public static <D> Translet.Store_M<D> STORE(Multimap<Event,? super D> store, Translet.Parser<D> sub)
protected static Object findResult_untyp(Translet.State<?> start, Set<? extends Translet.State<?>> set)
findResult_untyp(State, Set, Object)
.@Opt protected static @Opt Object findResult_untyp(Translet.State<?> start, Set<? extends Translet.State<?>> set, @Opt @Opt Object deflt)
findResult(State, Set, Object)
.
This untyped variant is needed for stepping by index
through a sub-result-array
which contains function arguments of different types.findResult(State, Set, Object)
protected static <R> R findResult(Translet.State<?> start, Set<Translet.State<R>> set)
findResult(State, Set, Object)
.@Opt protected static <R> R findResult(Translet.State<?> start, Set<Translet.State<R>> set, @Opt R deflt)
protected static boolean significantAltsExist(int index, Set<Translet.Alternative> alts)
public static <D> Translet.HeadParser<D> HEAD(Translet.Parser<D> sub, Translet.Parser<?>... subs)
public static <D> Translet.FramedParser<D> FRAME(Translet.Parser<?> p0, Translet.Parser<D> sub, Translet.Parser<?> p1)
protected static <R> Set<Translet.State<R>> __SET_CAST(Set<? extends Translet.State<?>> set)
public static <R,A> Translet.SequParser<R,A,Object,Object,Object,Object,Object,Object,Object> SEQU(Function<A,R> f, Translet.Parser<A> p1)
public static <R,A> Translet.SequParser<R,A,Object,Object,Object,Object,Object,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1)
public static <A,B> Translet.SequParser<Object,A,B,Object,Object,Object,Object,Object,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <R,A,B> Translet.SequParser<R,A,B,Object,Object,Object,Object,Object,Object> SEQU(BiFunction<A,B,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <R,A,B> Translet.SequParser<R,A,B,Object,Object,Object,Object,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <A,B,C> Translet.SequParser<Object,A,B,C,Object,Object,Object,Object,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <R,A,B,C> Translet.SequParser<R,A,B,C,Object,Object,Object,Object,Object> SEQU(Function3<A,B,C,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <R,A,B,C> Translet.SequParser<R,A,B,C,Object,Object,Object,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <A,B,C,D> Translet.SequParser<Object,A,B,C,D,Object,Object,Object,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <R,A,B,C,D> Translet.SequParser<R,A,B,C,D,Object,Object,Object,Object> SEQU(Function4<A,B,C,D,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <R,A,B,C,D> Translet.SequParser<R,A,B,C,D,Object,Object,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <A,B,C,D,E> Translet.SequParser<Object,A,B,C,D,E,Object,Object,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <R,A,B,C,D,E> Translet.SequParser<R,A,B,C,D,E,Object,Object,Object> SEQU(Function5<A,B,C,D,E,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <R,A,B,C,D,E> Translet.SequParser<R,A,B,C,D,E,Object,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <A,B,C,D,E,F> Translet.SequParser<Object,A,B,C,D,E,F,Object,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <R,A,B,C,D,E,F> Translet.SequParser<R,A,B,C,D,E,F,Object,Object> SEQU(Function6<A,B,C,D,E,F,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <R,A,B,C,D,E,F> Translet.SequParser<R,A,B,C,D,E,F,Object,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <A,B,C,D,E,F,G> Translet.SequParser<Object,A,B,C,D,E,F,G,Object> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <R,A,B,C,D,E,F,G> Translet.SequParser<R,A,B,C,D,E,F,G,Object> SEQU(Function7<A,B,C,D,E,F,G,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <R,A,B,C,D,E,F,G> Translet.SequParser<R,A,B,C,D,E,F,G,Object> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <A,B,C,D,E,F,G,H> Translet.SequParser<Object,A,B,C,D,E,F,G,H> SEQU(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
public static <R,A,B,C,D,E,F,G,H> Translet.SequParser<R,A,B,C,D,E,F,G,H> SEQU(Function8<A,B,C,D,E,F,G,H,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
public static <R,A,B,C,D,E,F,G,H> Translet.SequParser<R,A,B,C,D,E,F,G,H> SEQU(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
public static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> PERM(BiFunction<A,B,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <R,A,B> Translet.PermutationParser<R,A,B,Object,Object,Object,Object,Object,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> PERM(Function3<A,B,C,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <R,A,B,C> Translet.PermutationParser<R,A,B,C,Object,Object,Object,Object,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <R,A,B,C,D> Translet.PermutationParser<R,A,B,C,D,Object,Object,Object,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <R,A,B,C,D> Translet.PermutationParser<R,A,B,C,D,Object,Object,Object,Object> PERM(Function4<A,B,C,D,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <R,A,B,C,D> Translet.PermutationParser<R,A,B,C,D,Object,Object,Object,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <R,A,B,C,D,E> Translet.PermutationParser<R,A,B,C,D,E,Object,Object,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <R,A,B,C,D,E> Translet.PermutationParser<R,A,B,C,D,E,Object,Object,Object> PERM(Function5<A,B,C,D,E,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <R,A,B,C,D,E> Translet.PermutationParser<R,A,B,C,D,E,Object,Object,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5)
public static <R,A,B,C,D,E,F> Translet.PermutationParser<R,A,B,C,D,E,F,Object,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <R,A,B,C,D,E,F> Translet.PermutationParser<R,A,B,C,D,E,F,Object,Object> PERM(Function6<A,B,C,D,E,F,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <R,A,B,C,D,E,F> Translet.PermutationParser<R,A,B,C,D,E,F,Object,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6)
public static <R,A,B,C,D,E,F,G> Translet.PermutationParser<R,A,B,C,D,E,F,G,Object> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <R,A,B,C,D,E,F,G> Translet.PermutationParser<R,A,B,C,D,E,F,G,Object> PERM(Function7<A,B,C,D,E,F,G,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <R,A,B,C,D,E,F,G> Translet.PermutationParser<R,A,B,C,D,E,F,G,Object> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7)
public static <R,A,B,C,D,E,F,G,H> Translet.PermutationParser<R,A,B,C,D,E,F,G,H> PERM(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
public static <R,A,B,C,D,E,F,G,H> Translet.PermutationParser<R,A,B,C,D,E,F,G,H> PERM(Function8<A,B,C,D,E,F,G,H,R> f, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
public static <R,A,B,C,D,E,F,G,H> Translet.PermutationParser<R,A,B,C,D,E,F,G,H> PERM(Class<R> cons, Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4, Translet.Parser<E> p5, Translet.Parser<F> p6, Translet.Parser<G> p7, Translet.Parser<H> p8)
protected static Format disj_makeName(String operator, boolean full, Map<Translet.Recursive,String> names, Translet.Parser<?> p1, Translet.Parser<?> p2, Translet.Parser<?> p3, Translet.Parser<?> p4)
Translet.CoTupleParser
and Translet.LimesParser
, but
cannot be abstracted by inheritance since
Java does not support multiple inheritance and CoTupleParser and LimesParser
have different type signature.operator
- the operator text to be printed at the head of the representationfull
- whether to include storage operators, see Translet.Parser.name(boolean)
.names
- map to deal with recursionp1
- sub-parserp2
- sub-parserp3
- sub-parserp4
- sub-parserprotected static void disj_makeAlternative(Translet.disj_flavour flavour, Translet.State<?> inState, Set<Translet.Alternative> alternatives, List<Translet.Parser<?>> notHit, Set<Translet.Alternative> subAlts)
flavour
- the kind of parser to constructinState
- the state after which the sub-parsers failedalternative
- where to put the resultnotHit
- the parsers which did not succeeedsubAlts
- alternatives found by the succeeding sub-parsersprotected static <R,S> void disj_testOneBranch(Translet.Parser<S> disj_parser, Translet.Parser<R> parser, List<Translet.Parser<?>> notHit, int index, Translet.State<?> inState, Set<Translet.State<S>> outStates, Set<Translet.Alternative> alternatives)
Translet.CoTupleParser
and Translet.LimesParser
, but
Java does not support multiple inheritance.public static <A,B> Translet.OrCoTupleParser<A,B,Object,Object> ORn(Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <A,B,C> Translet.OrCoTupleParser<A,B,C,Object> ORn(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <A,B,C,D> Translet.OrCoTupleParser<A,B,C,D> ORn(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <A> Translet.OrLimesParser<A> OR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2)
public static <A> Translet.OrLimesParser<A> OR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2, Translet.Parser<? extends A> p3)
public static <A> Translet.OrLimesParser<A> OR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2, Translet.Parser<? extends A> p3, Translet.Parser<? extends A> p4)
public static <A,B> Translet.PriorCoTupleParser<A,B,Object,Object> PRIORn(Translet.Parser<A> p1, Translet.Parser<B> p2)
public static <A,B,C> Translet.PriorCoTupleParser<A,B,C,Object> PRIORn(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3)
public static <A,B,C,D> Translet.PriorCoTupleParser<A,B,C,D> PRIORn(Translet.Parser<A> p1, Translet.Parser<B> p2, Translet.Parser<C> p3, Translet.Parser<D> p4)
public static <A> Translet.PriorLimesParser<A> PRIOR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2)
public static <A> Translet.PriorLimesParser<A> PRIOR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2, Translet.Parser<? extends A> p3)
public static <A> Translet.PriorLimesParser<A> PRIOR1(Translet.Parser<? extends A> p1, Translet.Parser<? extends A> p2, Translet.Parser<? extends A> p3, Translet.Parser<? extends A> p4)
public static <D> Translet.PlusParser<D> PLUS(Translet.Parser<D> sub)
public static <D> Translet.PlusParser<D> PLUS(boolean greedy, Translet.Parser<D> sub)
public static <D> Translet.PlusParser<D> PLUS(eu.bandm.tscore.base.Translet.NonGreedy nonGreedy, Translet.Parser<D> sub)
public static <D> Translet.PlusParser<D> PLUS(boolean greedy, Translet.Parser<D> sub, @Opt @Opt Translet.Parser<?> sep)
public static <D> Translet.StarParser<D> STAR(Translet.Parser<D> sub)
public static <D> Translet.StarParser<D> STAR(boolean greedy, Translet.Parser<D> sub)
public static <D> Translet.StarParser<D> STAR(eu.bandm.tscore.base.Translet.NonGreedy nonGreedy, Translet.Parser<D> sub)
public static <D> Translet.StarParser<D> STAR(boolean greedy, Translet.Parser<D> sub, @Opt @Opt Translet.Parser<?> sep)
public static <D> Translet.OptionParser<D> OPT(Translet.Parser<D> sub)
public static <D> Translet.OptionParser<D> OPT(boolean greedy, @Opt D deflt, Translet.Parser<D> sub)