Implements: ITokenizer
Description
The AbstractTokenizer class defines a general tokenizer.
Fields
Properties
scanner
Scanner
protectedIScanner _scanner
Instance methods
clearCharacterStates
Clears all character states.
publicvoid clearCharacterStates()
getCharacterState
Gest the state for a given character.
publicITokenizerState getCharacterState(int symbol)
- symbol: int - symbol
- returns: ITokenizerState - tokenizer state
hasNextToken
Finds out if the tokenizer has a next token.
publicBoolean hasNextToken() throws Exception
- returns: Boolean - true if it has a next token, false otherwise.
nextToken
Gets the next token.
publicToken nextToken() throws Exception
- returns: Token - next token
readNextToken
Reads the next token.
protectedToken readNextToken() throws Exception
- returns: Token - next token
setCharacterState
Sets the characters' state.
publicvoid setCharacterState(int fromSymbol, int toSymbol, ITokenizerState state) throws Exception
- fromSymbol: int - first symbol
- toSymbol: int - last symbol
- state: ITokenizerState - tokenizer state
tokenizeBuffer
Provides a token for a string buffer.
publicList<Token[]> tokenizeBuffer(String buffer) throws Exception
- buffer: String - buffer
- returns: Token[] - token
tokenizeBufferToStrings
Creates a list of token values.
publicListtokenizeBufferToStrings(String buffer) throws Exception
- buffer: String - buffer
- returns: List
- list of token values
tokenizeStream
Creates a list of tokens
publicList<Token[]> tokenizeStream(IScanner scanner) throws Exception
tokenizeStreamToStrings
Creates a list of token values.
publicListtokenizeStreamToStrings(IScanner scanner) throws Exception
- scanner: IScanner - scanner
- returns: List
- list of token values