Interface LexicalAnalyzer
- All Known Implementing Classes:
AntlrLexicalAnalyzer
@NotThreadSafe
public interface LexicalAnalyzer
Lexical analyzer.
It is not meant to be thread-safe. Before using, make sure the lexer is reset.
-
Method Summary
Modifier and TypeMethodDescriptionAnalyze an entire source snapshot and return immutable tokens.default String[]Line comment opening and optional closing text, or null if unsupported.booleanhasNext()Determines if a next token is available on the input at the current lexer position.next()Parse next token.voidreset(char[] array, int offset, int length) Reset this lexical analyzer with new input.
-
Method Details
-
next
Token next()Parse next token.- Returns:
- next token, or Token.EOF if no token is available on the input
-
hasNext
boolean hasNext()Determines if a next token is available on the input at the current lexer position.- Returns:
- true if the lexer has a next token to be parsed
-
reset
void reset(char[] array, int offset, int length) Reset this lexical analyzer with new input.- Parameters:
array- new program source codeoffset- the index of the first character to readlength- length of how much to read
-
getLineCommentStartAndEnd
Line comment opening and optional closing text, or null if unsupported. -
analyze
-