Class AbstractTokenizer
java.lang.Object
org.pipservices3.expressions.tokenizers.AbstractTokenizer
- All Implemented Interfaces:
ITokenizer
- Direct Known Subclasses:
CsvTokenizer,ExpressionTokenizer,GenericTokenizer,MustacheTokenizer
Implements an abstract tokenizer class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetCharacterState(int symbol) A token state to process comments.Decodes quoted strings.Merges whitespaces.A token state to process numbers.A token state to process quoted strings.The stream scanner to tokenize.Skips comments.Skips End-Of-File token at the end of stream.Skip unknown charactersSkips whitespaces.A token state to process symbols (single like "=" or muti-character like "<>")Unifies numbers: "Integers" and "Floats" makes just "Numbers"A token state to process white space delimiters.A token state to process words or indentificators.Checks if there is the next token exist.Gets the next token from the scanner.protected TokenvoidsetCharacterState(int fromSymbol, int toSymbol, ITokenizerState state) voidsetCommentState(ICommentState value) A token state to process comments.voidsetDecodeStrings(boolean value) Decodes quoted strings.voidsetMergeWhitespaces(boolean value) Merges whitespaces.voidsetNumberState(INumberState value) A token state to process numbers.voidsetQuoteState(IQuoteState value) A token state to process quoted strings.voidsetScanner(IScanner value) The stream scanner to tokenize.voidsetSkipComments(boolean value) Skips comments.voidsetSkipEof(boolean value) Skips End-Of-File token at the end of stream.voidsetSkipUnknown(boolean value) Skip unknown charactersvoidsetSkipWhitespaces(boolean value) Skips whitespaces.voidsetSymbolState(ISymbolState value) A token state to process symbols (single like "=" or muti-character like "<>")voidsetUnifyNumbers(boolean value) Unifies numbers: "Integers" and "Floats" makes just "Numbers"voidA token state to process white space delimiters.voidsetWordState(IWordState value) A token state to process words or indentificators.tokenizeBuffer(String buffer) Tokenizes a string buffer into a list of tokens structures.tokenizeBufferToStrings(String buffer) Tokenizes a string buffer into a list of strings.tokenizeStream(IScanner scanner) Tokenizes a textual stream into a list of token structures.tokenizeStreamToStrings(IScanner scanner) Tokenizes a textual stream into a list of strings.
-
Field Details
-
_scanner
-
_nextToken
-
_lastTokenType
-
-
Constructor Details
-
AbstractTokenizer
public AbstractTokenizer()
-
-
Method Details
-
getSkipUnknown
Description copied from interface:ITokenizerSkip unknown characters- Specified by:
getSkipUnknownin interfaceITokenizer
-
setSkipUnknown
public void setSkipUnknown(boolean value) Description copied from interface:ITokenizerSkip unknown characters- Specified by:
setSkipUnknownin interfaceITokenizer
-
getSkipWhitespaces
Description copied from interface:ITokenizerSkips whitespaces.- Specified by:
getSkipWhitespacesin interfaceITokenizer
-
setSkipWhitespaces
public void setSkipWhitespaces(boolean value) Description copied from interface:ITokenizerSkips whitespaces.- Specified by:
setSkipWhitespacesin interfaceITokenizer
-
getSkipComments
Description copied from interface:ITokenizerSkips comments.- Specified by:
getSkipCommentsin interfaceITokenizer
-
setSkipComments
public void setSkipComments(boolean value) Description copied from interface:ITokenizerSkips comments.- Specified by:
setSkipCommentsin interfaceITokenizer
-
getSkipEof
Description copied from interface:ITokenizerSkips End-Of-File token at the end of stream.- Specified by:
getSkipEofin interfaceITokenizer
-
setSkipEof
public void setSkipEof(boolean value) Description copied from interface:ITokenizerSkips End-Of-File token at the end of stream.- Specified by:
setSkipEofin interfaceITokenizer
-
getMergeWhitespaces
Description copied from interface:ITokenizerMerges whitespaces.- Specified by:
getMergeWhitespacesin interfaceITokenizer
-
setMergeWhitespaces
public void setMergeWhitespaces(boolean value) Description copied from interface:ITokenizerMerges whitespaces.- Specified by:
setMergeWhitespacesin interfaceITokenizer
-
getUnifyNumbers
Description copied from interface:ITokenizerUnifies numbers: "Integers" and "Floats" makes just "Numbers"- Specified by:
getUnifyNumbersin interfaceITokenizer
-
setUnifyNumbers
public void setUnifyNumbers(boolean value) Description copied from interface:ITokenizerUnifies numbers: "Integers" and "Floats" makes just "Numbers"- Specified by:
setUnifyNumbersin interfaceITokenizer
-
getDecodeStrings
Description copied from interface:ITokenizerDecodes quoted strings.- Specified by:
getDecodeStringsin interfaceITokenizer
-
setDecodeStrings
public void setDecodeStrings(boolean value) Description copied from interface:ITokenizerDecodes quoted strings.- Specified by:
setDecodeStringsin interfaceITokenizer
-
getCommentState
Description copied from interface:ITokenizerA token state to process comments.- Specified by:
getCommentStatein interfaceITokenizer
-
setCommentState
Description copied from interface:ITokenizerA token state to process comments.- Specified by:
setCommentStatein interfaceITokenizer
-
getNumberState
Description copied from interface:ITokenizerA token state to process numbers.- Specified by:
getNumberStatein interfaceITokenizer
-
setNumberState
Description copied from interface:ITokenizerA token state to process numbers.- Specified by:
setNumberStatein interfaceITokenizer
-
getQuoteState
Description copied from interface:ITokenizerA token state to process quoted strings.- Specified by:
getQuoteStatein interfaceITokenizer
-
setQuoteState
Description copied from interface:ITokenizerA token state to process quoted strings.- Specified by:
setQuoteStatein interfaceITokenizer
-
getSymbolState
Description copied from interface:ITokenizerA token state to process symbols (single like "=" or muti-character like "<>")- Specified by:
getSymbolStatein interfaceITokenizer
-
setSymbolState
Description copied from interface:ITokenizerA token state to process symbols (single like "=" or muti-character like "<>")- Specified by:
setSymbolStatein interfaceITokenizer
-
getWhitespaceState
Description copied from interface:ITokenizerA token state to process white space delimiters.- Specified by:
getWhitespaceStatein interfaceITokenizer
-
setWhitespaceState
Description copied from interface:ITokenizerA token state to process white space delimiters.- Specified by:
setWhitespaceStatein interfaceITokenizer
-
getWordState
Description copied from interface:ITokenizerA token state to process words or indentificators.- Specified by:
getWordStatein interfaceITokenizer
-
setWordState
Description copied from interface:ITokenizerA token state to process words or indentificators.- Specified by:
setWordStatein interfaceITokenizer
-
getScanner
Description copied from interface:ITokenizerThe stream scanner to tokenize.- Specified by:
getScannerin interfaceITokenizer
-
setScanner
Description copied from interface:ITokenizerThe stream scanner to tokenize.- Specified by:
setScannerin interfaceITokenizer
-
getCharacterState
-
setCharacterState
- Throws:
Exception
-
clearCharacterStates
public void clearCharacterStates() -
hasNextToken
Description copied from interface:ITokenizerChecks if there is the next token exist.- Specified by:
hasNextTokenin interfaceITokenizer- Returns:
trueif scanner has the next token.- Throws:
Exception
-
nextToken
Description copied from interface:ITokenizerGets the next token from the scanner.- Specified by:
nextTokenin interfaceITokenizer- Returns:
- Next token of
nullif there are no more tokens left. - Throws:
Exception
-
readNextToken
- Throws:
Exception
-
tokenizeStream
Description copied from interface:ITokenizerTokenizes a textual stream into a list of token structures.- Specified by:
tokenizeStreamin interfaceITokenizer- Parameters:
scanner- A textual stream to be tokenized.- Returns:
- A list of token structures.
- Throws:
Exception
-
tokenizeBuffer
Description copied from interface:ITokenizerTokenizes a string buffer into a list of tokens structures.- Specified by:
tokenizeBufferin interfaceITokenizer- Parameters:
buffer- A string buffer to be tokenized.- Returns:
- A list of token structures.
- Throws:
Exception
-
tokenizeStreamToStrings
Description copied from interface:ITokenizerTokenizes a textual stream into a list of strings.- Specified by:
tokenizeStreamToStringsin interfaceITokenizer- Parameters:
scanner- A textual stream to be tokenized.- Returns:
- A list of token strings.
- Throws:
Exception
-
tokenizeBufferToStrings
Description copied from interface:ITokenizerTokenizes a string buffer into a list of strings.- Specified by:
tokenizeBufferToStringsin interfaceITokenizer- Parameters:
buffer- A string buffer to be tokenized.- Returns:
- A list of token strings.
- Throws:
Exception
-