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 Details

    • GenericWhitespaceState

      public GenericWhitespaceState() throws Exception
      Constructs a whitespace state with a default idea of what characters are, in fact, whitespace.
      Throws:
      Exception
  • Method Details

    • 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:
      nextToken in interface ITokenizerState
      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 Exception
      Establish the given characters as whitespace to ignore.
      Specified by:
      setWhitespaceChars in interface IWhitespaceState
      Parameters:
      fromSymbol - First character index of the interval.
      toSymbol - Last character index of the interval.
      enable - true if this state should ignore characters in the given range.
      Throws:
      Exception
    • clearWhitespaceChars

      public void clearWhitespaceChars()
      Clears definitions of whitespace characters.
      Specified by:
      clearWhitespaceChars in interface IWhitespaceState