| Modifier and Type | Method and Description |
|---|---|
static IdlTokenizer |
create(java.lang.CharSequence model)
Create a tokenizer for the given model.
|
static IdlTokenizer |
create(java.lang.String filename,
java.lang.CharSequence model)
Create a tokenizer for the given filename and model.
|
default IdlToken |
expect(IdlToken... tokens)
Assert that the current token is one of
tokens. |
default void |
expect(IdlToken token)
Assert that the current token is
token. |
int |
getColumn()
Get the current column number of the tokenizer, starting at 1.
|
IdlToken |
getCurrentToken()
Get the current
IdlToken. |
int |
getCurrentTokenColumn()
Get the column of the current token.
|
int |
getCurrentTokenEnd()
Get the end position of the curren token.
|
java.lang.String |
getCurrentTokenError()
If the current token is an error, get the error message associated with the token.
|
default java.lang.CharSequence |
getCurrentTokenLexeme()
Get the lexeme of the current token.
|
int |
getCurrentTokenLine()
Get the line of the current token.
|
default SourceLocation |
getCurrentTokenLocation()
Get the source location of the current token.
|
java.lang.Number |
getCurrentTokenNumberValue()
If the current token is a number, get the associated parsed number.
|
default int |
getCurrentTokenSpan()
Get the length of the current token.
|
int |
getCurrentTokenStart()
Get the start position of the current token.
|
java.lang.CharSequence |
getCurrentTokenStringSlice()
If the current token is a string or text block, get the parsed content as a CharSequence.
|
int |
getLine()
Get the current line number of the tokenizer, starting at 1.
|
java.lang.CharSequence |
getModel()
Get the model being tokenized.
|
default java.lang.CharSequence |
getModel(int start,
int end)
Get a borrowed slice of the model being tokenized.
|
int |
getPosition()
Get the current position of the tokenizer.
|
java.lang.String |
getSourceFilename()
Get the filename of the content being tokenized.
|
default boolean |
isCurrentLexeme(java.lang.CharSequence chars)
Test if the current token lexeme is equal to the give
chars. |
static IdlTokenizer create(java.lang.CharSequence model)
model - IDL model contents to parse.static IdlTokenizer create(java.lang.String filename, java.lang.CharSequence model)
filename - Filename being parsed.model - IDL model contents to parse.java.lang.String getSourceFilename()
java.lang.CharSequence getModel()
default java.lang.CharSequence getModel(int start,
int end)
start - Start position to get, inclusive.end - End position to stop at, exclusive.int getPosition()
int getLine()
int getColumn()
IdlToken getCurrentToken()
IdlToken.int getCurrentTokenLine()
int getCurrentTokenColumn()
int getCurrentTokenStart()
int getCurrentTokenEnd()
default int getCurrentTokenSpan()
default SourceLocation getCurrentTokenLocation()
default java.lang.CharSequence getCurrentTokenLexeme()
java.lang.CharSequence getCurrentTokenStringSlice()
ModelSyntaxException - if the current token is not a string, text block, or identifier.java.lang.Number getCurrentTokenNumberValue()
ModelSyntaxException - if the current token is not a number.java.lang.String getCurrentTokenError()
ModelSyntaxException - if the current token is not an error.default void expect(IdlToken token)
token.
The tokenizer is not advanced after validating the current token.
token - Token to expect.ModelSyntaxException - if the current token is unexpected.default IdlToken expect(IdlToken... tokens)
tokens.
The tokenizer is not advanced after validating the current token.
tokens - Assert that the current token is one of these tokens.ModelSyntaxException - if the current token is unexpected.default boolean isCurrentLexeme(java.lang.CharSequence chars)
chars.chars - Characters to compare the current lexeme against.chars.