Class AntlrLexicalAnalyzer
java.lang.Object
net.emustudio.emulib.plugin.compiler.antlr.AntlrLexicalAnalyzer
- All Implemented Interfaces:
LexicalAnalyzer
Lexical analyzer backed by ANTLR lexer. ANTLR token types are mapped to emuLib
Token types.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAntlrLexicalAnalyzer(org.antlr.v4.runtime.Lexer lexer, int[] tokenMap, String lineCommentStart) -
Method Summary
Modifier and TypeMethodDescriptionString[]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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LexicalAnalyzer
analyze
-
Field Details
-
lexer
protected final org.antlr.v4.runtime.Lexer lexer
-
-
Constructor Details
-
AntlrLexicalAnalyzer
-
-
Method Details
-
getLineCommentStartAndEnd
Description copied from interface:LexicalAnalyzerLine comment opening and optional closing text, or null if unsupported.- Specified by:
getLineCommentStartAndEndin interfaceLexicalAnalyzer
-
next
Description copied from interface:LexicalAnalyzerParse next token.- Specified by:
nextin interfaceLexicalAnalyzer- Returns:
- next token, or Token.EOF if no token is available on the input
-
hasNext
public boolean hasNext()Description copied from interface:LexicalAnalyzerDetermines if a next token is available on the input at the current lexer position.- Specified by:
hasNextin interfaceLexicalAnalyzer- Returns:
- true if the lexer has a next token to be parsed
-
reset
public void reset(char[] array, int offset, int length) Description copied from interface:LexicalAnalyzerReset this lexical analyzer with new input.- Specified by:
resetin interfaceLexicalAnalyzer- Parameters:
array- new program source codeoffset- the index of the first character to readlength- length of how much to read
-