Package nz.org.riskscape.dsl
Class Lexer<T extends TokenType>
java.lang.Object
nz.org.riskscape.dsl.Lexer<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLexer.Tokens<T extends TokenType>Meta-class object for token type enumeration. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Lexer
-
-
Method Details
-
next
- Returns:
- the next
TokenorLexer.Tokens.eofTokenif parsing as reached the end. - Throws:
LexerException
-
remaining
- Returns:
- the remaining source String that still needs to be parsed. This can be useful for error reporting, i.e. show the user the unadulterated string that we were trying to parse next. Note that you may want to truncate this string in error messages, when parsing a large file.
-
peek
- Returns:
- the
Tokenthat will be returned from theLexerwhen you callnext(), without consuming it. - Throws:
LexerException
-
isEOF
- Returns:
- true if the
Lexeris at the end of the source - Throws:
LexerException
-
peekType
- Returns:
- shortcut for peek().getTokenType()
-
rewind
- Parameters:
backTo-
-
expect
-
expect
-
tryThese
-
consumeIf
-
consumeIf
-