Class GenericWhitespaceState
- java.lang.Object
-
- org.pipservices3.expressions.tokenizers.generic.GenericWhitespaceState
-
- All Implemented Interfaces:
ITokenizerState,IWhitespaceState
public class GenericWhitespaceState extends Object implements IWhitespaceState
A whitespace state ignores whitespace (such as blanks and tabs), and returns the tokenizer's next token. By default, all characters from 0 to 32 are whitespace.
-
-
Constructor Summary
Constructors Constructor Description GenericWhitespaceState()Constructs a whitespace state with a default idea of what characters are, in fact, whitespace.
-
Method Summary
Modifier and Type Method Description voidclearWhitespaceChars()Clears definitions of whitespace characters.TokennextToken(IScanner scanner, ITokenizer tokenizer)Ignore whitespace (such as blanks and tabs), and return the tokenizer's next token.voidsetWhitespaceChars(int fromSymbol, int toSymbol, boolean enable)Establish the given characters as whitespace to ignore.
-
-
-
Method Detail
-
nextToken
public Token nextToken(IScanner scanner, ITokenizer tokenizer) throws Exception
Ignore whitespace (such as blanks and tabs), and return the tokenizer's next token.- Specified by:
nextTokenin interfaceITokenizerState- Parameters:
scanner- A textual string to be tokenized.tokenizer- A tokenizer class that controls the process.- Returns:
- The next token from the top of the stream.
- Throws:
Exception
-
setWhitespaceChars
public void setWhitespaceChars(int fromSymbol, int toSymbol, boolean enable) throws ExceptionEstablish the given characters as whitespace to ignore.- Specified by:
setWhitespaceCharsin interfaceIWhitespaceState- Parameters:
fromSymbol- First character index of the interval.toSymbol- Last character index of the interval.enable-trueif this state should ignore characters in the given range.- Throws:
Exception
-
clearWhitespaceChars
public void clearWhitespaceChars()
Clears definitions of whitespace characters.- Specified by:
clearWhitespaceCharsin interfaceIWhitespaceState
-
-