Package eu.bandm.tscore.base
Class Translet.SequParser<R,A,B,C,D,E,F,G,H>
java.lang.Object
eu.bandm.tscore.base.Translet.Parser<R>
eu.bandm.tscore.base.Translet.ProductParser<R,A,B,C,D,E,F,G,H>
eu.bandm.tscore.base.Translet.SequParser<R,A,B,C,D,E,F,G,H>
- Enclosing class:
- Translet
public static class Translet.SequParser<R,A,B,C,D,E,F,G,H>
extends Translet.ProductParser<R,A,B,C,D,E,F,G,H>
Variant of
Translet.ProductParser
which accepts a certain sequence of sub-parsers.-
Field Summary
Fields inherited from class eu.bandm.tscore.base.Translet.ProductParser
arity, cons, constructors, f, p0, p1, p2, p3, p4, p5, p6, p7, separator, subParsers
-
Constructor Summary
ConstructorDescriptionSequParser
(int arity, @Opt Object f, @Opt Class<R> cons, Translet.Parser<A> p0, Translet.Parser<B> p1, Translet.Parser<C> p2, Translet.Parser<D> p3, Translet.Parser<E> p4, Translet.Parser<F> p5, Translet.Parser<G> p6, Translet.Parser<H> p7) This constructor is called by the static factory methods and should normally not be called directly. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object[]
collectResults
(Translet.State<?> s, List<Set<? extends Translet.State<?>>> afterSubRess) Returns the arguments for function application for one particular resultTranslet.State
by searching the chain of predecessor states and cutting them with those related to the sub-parsers in the different positions in "afterSubRess".name
(boolean full, Map<Translet.Recursive, String> names) Returns a user-readable text representation.parseOneState
(Translet.State<?> inState, Set<Translet.Alternative> alternatives) Parse breadth-first the list of sub-parsers and memorize all resulting states for later result retrieval.Reverse the parsing process (as far as possible) and deliver a string representation which when parsed delivered the parse result.Methods inherited from class eu.bandm.tscore.base.Translet.ProductParser
applyConstructor, name_0, withSeparator, withSeparator
Methods inherited from class eu.bandm.tscore.base.Translet.Parser
executeStoring, isTerminal, mparse, name, parseEpsilon, stripOpt, toString, toString
-
Constructor Details
-
SequParser
public SequParser(int arity, @Opt @Opt Object f, @Opt @Opt Class<R> cons, Translet.Parser<A> p0, Translet.Parser<B> p1, Translet.Parser<C> p2, Translet.Parser<D> p3, Translet.Parser<E> p4, Translet.Parser<F> p5, Translet.Parser<G> p6, Translet.Parser<H> p7) This constructor is called by the static factory methods and should normally not be called directly. The "arity" value, the arity of "f" and the parsers must be in sync. All parsers must be !=null and set toTranslet.na
if not required. Either a function can given by "f" or a class by "cons". A function may return any value, including null, which are taken as success. To reject acceptance, the function must throw any exception, e.g. via aMessageThrower
. If neither, the results are discarded.
-
-
Method Details
-
unparse
Description copied from class:Translet.Parser
Reverse the parsing process (as far as possible) and deliver a string representation which when parsed delivered the parse result.- Specified by:
unparse
in classTranslet.Parser<R>
-
collectResults
protected Object[] collectResults(Translet.State<?> s, List<Set<? extends Translet.State<?>>> afterSubRess) Returns the arguments for function application for one particular resultTranslet.State
by searching the chain of predecessor states and cutting them with those related to the sub-parsers in the different positions in "afterSubRess". -
parseOneState
public Set<Translet.State<R>> parseOneState(Translet.State<?> inState, Set<Translet.Alternative> alternatives) Parse breadth-first the list of sub-parsers and memorize all resulting states for later result retrieval. Whenever the "arity" is reached, collect the results of these states and apply the function/constructor.- Specified by:
parseOneState
in classTranslet.Parser<R>
-
name
Description copied from class:Translet.Parser
Returns a user-readable text representation. This is in most cases, but not always, source text to construct the parser.- Specified by:
name
in classTranslet.Parser<R>
- Parameters:
full
- whether storage constructs do appear in the rendering.names
- a map for managing the renderings of recursive calls
-