Class Lexer.Kernel
java.lang.Object
net.mtrop.doom.struct.Lexer.Kernel
- Enclosing class:
- Lexer
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intReserved token type: Comment.static final intReserved token type: End of lexer.static final intReserved token type: End of stream.static final intReserved token type: Identifier.static final intReserved token type: Illegal token.static final intReserved token type: Line Comment.static final intReserved token type: New line character.static final intReserved token type: Number.static final intReserved token type: Space.static final intReserved token type: String.static final intReserved token type: Tab.static final intReserved token type: Unknown token.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCaseInsensitiveKeyword(String keyword, int type) Adds a keyword to the Lexer, case-insensitive.voidaddCommentDelimiter(String delimiterStart, String delimiterEnd) Adds a comment-starting (and ending) delimiter to this lexer.voidaddCommentLineDelimiter(String delimiter) Adds a line comment delimiter to this lexer.voidaddDelimiter(String delimiter, int type) Adds a delimiter to this lexer.voidaddKeyword(String keyword, int type) Adds a keyword to the Lexer, case-sensitive.voidaddRawStringDelimiter(char delimiterStart, char delimiterEnd) Adds a raw string delimiter to this lexer along with its ending character.voidaddStringDelimiter(char delimiterStart, char delimiterEnd) Adds a string delimiter to this lexer along with its ending character.charGets the current decimal separator character.voidsetDecimalSeparator(char c) Sets the current decimal separator character.voidsetEmitComments(boolean emitComments) Sets if this lexer emits comment tokens.voidsetEmitNewlines(boolean includeNewlines) Sets if this lexer emits newline tokens.voidsetEmitSpaces(boolean includeSpaces) Sets if this lexer emits space tokens?voidsetEmitStreamBreak(boolean emitStreamBreak) Sets if this lexer emits stream break tokens.voidsetEmitTabs(boolean includeTabs) Sets if this lexer emits tab tokens.booleanChecks if this lexer emits comment tokens.booleanChecks if this lexer emits newline tokens.booleanChecks if this lexer emits space tokens.booleanChecks if this lexer emits stream break tokens.booleanChecks if this lexer emits tab tokens.
- 
Field Details- 
TYPE_END_OF_LEXERpublic static final int TYPE_END_OF_LEXERReserved token type: End of lexer.- See Also:
 
- 
TYPE_END_OF_STREAMpublic static final int TYPE_END_OF_STREAMReserved token type: End of stream.- See Also:
 
- 
TYPE_UNKNOWNpublic static final int TYPE_UNKNOWNReserved token type: Unknown token.- See Also:
 
- 
TYPE_NUMBERpublic static final int TYPE_NUMBERReserved token type: Number.- See Also:
 
- 
TYPE_SPACEpublic static final int TYPE_SPACEReserved token type: Space.- See Also:
 
- 
TYPE_TABpublic static final int TYPE_TABReserved token type: Tab.- See Also:
 
- 
TYPE_NEWLINEpublic static final int TYPE_NEWLINEReserved token type: New line character.- See Also:
 
- 
TYPE_IDENTIFIERpublic static final int TYPE_IDENTIFIERReserved token type: Identifier.- See Also:
 
- 
TYPE_ILLEGALpublic static final int TYPE_ILLEGALReserved token type: Illegal token.- See Also:
 
- 
TYPE_COMMENTpublic static final int TYPE_COMMENTReserved token type: Comment.- See Also:
 
- 
TYPE_LINE_COMMENTpublic static final int TYPE_LINE_COMMENTReserved token type: Line Comment.- See Also:
 
- 
TYPE_STRINGpublic static final int TYPE_STRINGReserved token type: String.- See Also:
 
 
- 
- 
Constructor Details- 
Kernelpublic Kernel()Creates a new, blank LexerKernel with default settings.
 
- 
- 
Method Details- 
addDelimiterAdds a delimiter to this lexer.- Parameters:
- delimiter- the delimiter lexeme.
- type- the type id.
- Throws:
- IllegalArgumentException- if type is < 0 or delimiter is null or empty.
 
- 
addStringDelimiterpublic void addStringDelimiter(char delimiterStart, char delimiterEnd) Adds a string delimiter to this lexer along with its ending character.- Parameters:
- delimiterStart- the starting delimiter.
- delimiterEnd- the ending delimiter.
 
- 
addRawStringDelimiterpublic void addRawStringDelimiter(char delimiterStart, char delimiterEnd) Adds a raw string delimiter to this lexer along with its ending character.- Parameters:
- delimiterStart- the starting delimiter.
- delimiterEnd- the ending delimiter.
 
- 
addCommentDelimiter
- 
addCommentLineDelimiterAdds a line comment delimiter to this lexer.- Parameters:
- delimiter- the delimiter lexeme.
- Throws:
- IllegalArgumentException- if type is < 0 or delimiter is null or empty.
 
- 
addKeywordAdds a keyword to the Lexer, case-sensitive. When this identifier is read in, its token type is specified type.- Parameters:
- keyword- the keyword identifier.
- type- the type id.
 
- 
addCaseInsensitiveKeywordAdds a keyword to the Lexer, case-insensitive. When this identifier is read in, its token type is specified type.- Parameters:
- keyword- the keyword identifier.
- type- the type id.
 
- 
willEmitSpacespublic boolean willEmitSpaces()Checks if this lexer emits space tokens.- Returns:
- true if so, false if not.
 
- 
setEmitSpacespublic void setEmitSpaces(boolean includeSpaces) Sets if this lexer emits space tokens?- Parameters:
- includeSpaces- true if so, false if not.
 
- 
willEmitTabspublic boolean willEmitTabs()Checks if this lexer emits tab tokens.- Returns:
- true if so, false if not.
 
- 
setEmitTabspublic void setEmitTabs(boolean includeTabs) Sets if this lexer emits tab tokens.- Parameters:
- includeTabs- true if so, false if not.
 
- 
willEmitNewlinespublic boolean willEmitNewlines()Checks if this lexer emits newline tokens.- Returns:
- true if so, false if not.
 
- 
setEmitNewlinespublic void setEmitNewlines(boolean includeNewlines) Sets if this lexer emits newline tokens.- Parameters:
- includeNewlines- true if so, false if not.
 
- 
willEmitStreamBreakpublic boolean willEmitStreamBreak()Checks if this lexer emits stream break tokens.- Returns:
- true if so, false if not.
 
- 
setEmitStreamBreakpublic void setEmitStreamBreak(boolean emitStreamBreak) Sets if this lexer emits stream break tokens.- Parameters:
- emitStreamBreak- true if so, false if not.
 
- 
willEmitCommentspublic boolean willEmitComments()Checks if this lexer emits comment tokens.- Returns:
- true if so, false if not.
 
- 
setEmitCommentspublic void setEmitComments(boolean emitComments) Sets if this lexer emits comment tokens.- Parameters:
- emitComments- true if so, false if not.
 
- 
setDecimalSeparatorpublic void setDecimalSeparator(char c) Sets the current decimal separator character. By default, this is the current locale's decimal separator character.- Parameters:
- c- the character to set.
 
- 
getDecimalSeparatorpublic char getDecimalSeparator()Gets the current decimal separator character. By default, this is the current locale's decimal separator character.- Returns:
- the separator character.
 
 
-