D
- the type of source document identifierspublic class LLJavaLexer<D> extends Object implements Supplier<LLJavaLexer.Token<D>>
Modifier and Type | Class and Description |
---|---|
static class |
LLJavaLexer.Token<D>
Immutable LLJava tokens.
|
static class |
LLJavaLexer.TokenType
Enumeration of LLJava token types.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FIRST_COLUMN
The default number of the first column of each line in the input document.
|
static int |
DEFAULT_FIRST_LINE
The default number of the first line in the input document.
|
Constructor and Description |
---|
LLJavaLexer(D documentId,
Reader in)
DOCUMENT ME
|
Modifier and Type | Method and Description |
---|---|
Supplier<LLJavaLexer.Token<D>> |
discard(LLJavaLexer.TokenType first,
LLJavaLexer.TokenType... rest)
Returns a functional object that supplies the tokens of this
lexer, except for those of the given types.
|
Supplier<LLJavaLexer.Token<D>> |
discard(Set<LLJavaLexer.TokenType> types)
Returns a functional object that supplies the tokens of this
lexer, except for the given types.
|
LLJavaLexer.Token<D> |
get() |
static Optional<LLJavaLexer.TokenType> |
getKeywordType(String text)
Returns the token type associated with a keyword if defined.
|
void |
setFirstColumn(int firstColumn)
Sets the number of the first column of each line in the input document.
|
void |
setFirstLine(int firstLine)
Sets the number of the first line in the input document.
|
Stream<LLJavaLexer.Token<D>> |
stream()
Returns a sequential token stream with this lexer as its source.
|
public static final int DEFAULT_FIRST_LINE
public static final int DEFAULT_FIRST_COLUMN
public void setFirstLine(int firstLine)
If this method is not invoked, the default value is DEFAULT_FIRST_LINE
(1).
To avoid inconsistencies, this method should only be invoked before the first token is produced.
firstLine
- the number of the first line in the input
documentpublic void setFirstColumn(int firstColumn)
If this method is not invoked, the default value is DEFAULT_FIRST_COLUMN
(1).
To avoid inconsistencies, this method should only be invoked before the first token is produced.
firstColumn
- the number of the first column of each line in
the input documentpublic LLJavaLexer.Token<D> get()
get
in interface Supplier<LLJavaLexer.Token<D>>
UncheckedIOException
- if the input cannot be read.public Stream<LLJavaLexer.Token<D>> stream()
public Supplier<LLJavaLexer.Token<D>> discard(LLJavaLexer.TokenType first, LLJavaLexer.TokenType... rest)
first
- a token type to discardrest
- an array of more token types to discardIllegalArgumentException
- if LLJavaLexer.TokenType.EOF
is
specified to be discarded.public Supplier<LLJavaLexer.Token<D>> discard(Set<LLJavaLexer.TokenType> types)
types
- a set of token types to discardIllegalArgumentException
- if LLJavaLexer.TokenType.EOF
is
specified to be discarded.public static Optional<LLJavaLexer.TokenType> getKeywordType(String text)
text
- a string that may or may not be a keywordOptional.empty()
if undefined.see also the complete user documentation .