Class Tokenizer

java.lang.Object
com.inductiveautomation.snap.parse.Tokenizer
Direct Known Subclasses:
JavaTokenizer

public class Tokenizer extends Object
A class to extract tokens from a char sequence.
  • Field Details

    • _charIndex

      protected int _charIndex
    • _lineIndex

      protected int _lineIndex
    • _lineStart

      protected int _lineStart
  • Constructor Details

    • Tokenizer

      public Tokenizer()
  • Method Details

    • getInput

      public CharSequence getInput()
      Returns the current tokenizer input.
    • setInput

      public void setInput(CharSequence anInput)
      Sets the current tokenizer input.
    • getInput

      public CharSequence getInput(int aStart, int anEnd)
      Returns the input subsequence for the given range of characters in input.
    • addPattern

      public void addPattern(String aName, String aPattern, boolean isLiteral)
      Adds a pattern.
    • addPatterns

      public void addPatterns(ParseRule aRule)
      Adds patterns to this tokenizer for given rule.
    • getRegexes

      protected Regex[] getRegexes()
      Returns the array of regexes (creating it if missing).
    • charAt

      public char charAt(int anIndex)
      CharSequence method.
    • length

      public int length()
      CharSequence method.
    • getChar

      public char getChar()
      Returns the current parse char.
    • getCharIndex

      public int getCharIndex()
      Returns the current parse char location.
    • getLineIndex

      public int getLineIndex()
      Returns the current line index.
    • getLineStart

      public int getLineStart()
      Returns the current line start index.
    • getColumnIndex

      public int getColumnIndex()
      Returns the current column index in the current line.
    • getLineNumber

      public int getLineNumber()
      Returns the current line number.
    • getColumnNumber

      public int getColumnNumber()
      Returns the current column number.
    • getNextToken

      public Token getNextToken()
      Returns the next token.
    • getMatchers

      public Regex[] getMatchers(char aChar)
      Returns list of matchers for a char.
    • createToken

      protected Token createToken(String aName, String aPattern, int aStart, int anEnd, Token aSpclTkn)
      Creates a new token.
    • getNextSpecialToken

      public Token getNextSpecialToken()
      Processes and returns next special token.
    • goobleWhiteSpace

      protected void goobleWhiteSpace()
      Gobble input characters until next non-whitespace or input end.