Package org.jparsec
Class Lexicon
java.lang.Object
org.jparsec.Lexicon
- Direct Known Subclasses:
Terminals
A
Lexicon
is a group of lexical words that can be tokenized by a single tokenizer.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <F,
T> Function <F, T> Returns aFunction
that delegates tofunction
and falls back todefaultFunction
for null return values.Parser
<?> AParser
that recognizes a sequence of tokens identified bytokenNames
, as an atomic step.AParser
that recognizes the token identified bytokenName
.AParser
that recognizes a token identified by any oftokenNames
.Parser
<?> Returns the tokenizer that tokenizes all terminals (operators, keywords, identifiers etc.) managed in this instance.(package private) Lexicon
(package private) Object
Gets the token value identified by the token text.
-
Field Details
-
words
Maps lexical word name to token value. -
tokenizer
The scanner that recognizes any of the lexical word.
-
-
Constructor Details
-
Lexicon
-
-
Method Details
-
tokenizer
Returns the tokenizer that tokenizes all terminals (operators, keywords, identifiers etc.) managed in this instance. -
phrase
AParser
that recognizes a sequence of tokens identified bytokenNames
, as an atomic step. -
token
AParser
that recognizes a token identified by any oftokenNames
. -
token
AParser
that recognizes the token identified bytokenName
. -
word
Gets the token value identified by the token text. This text is the operator or the keyword.- Parameters:
name
- the token text.- Returns:
- the token object.
- Throws:
IllegalArgumentException
- if the token object does not exist.
-
union
-
fallback
static <F,T> Function<F,T> fallback(Function<F, T> function, Function<? super F, ? extends T> defaultFunction) Returns aFunction
that delegates tofunction
and falls back todefaultFunction
for null return values.
-