Class Tokenizer
java.lang.Object
com.inductiveautomation.snap.parse.Tokenizer
- Direct Known Subclasses:
JavaTokenizer
A class to extract tokens from a char sequence.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPattern
(String aName, String aPattern, boolean isLiteral) Adds a pattern.void
addPatterns
(ParseRule aRule) Adds patterns to this tokenizer for given rule.char
charAt
(int anIndex) CharSequence method.protected Token
createToken
(String aName, String aPattern, int aStart, int anEnd, Token aSpclTkn) Creates a new token.char
getChar()
Returns the current parse char.int
Returns the current parse char location.int
Returns the current column index in the current line.int
Returns the current column number.getInput()
Returns the current tokenizer input.getInput
(int aStart, int anEnd) Returns the input subsequence for the given range of characters in input.int
Returns the current line index.int
Returns the current line number.int
Returns the current line start index.Regex[]
getMatchers
(char aChar) Returns list of matchers for a char.Processes and returns next special token.Returns the next token.protected Regex[]
Returns the array of regexes (creating it if missing).protected void
Gobble input characters until next non-whitespace or input end.int
length()
CharSequence method.void
setInput
(CharSequence anInput) Sets the current tokenizer input.
-
Field Details
-
_charIndex
protected int _charIndex -
_lineIndex
protected int _lineIndex -
_lineStart
protected int _lineStart
-
-
Constructor Details
-
Tokenizer
public Tokenizer()
-
-
Method Details
-
getInput
Returns the current tokenizer input. -
setInput
Sets the current tokenizer input. -
getInput
Returns the input subsequence for the given range of characters in input. -
addPattern
Adds a pattern. -
addPatterns
Adds patterns to this tokenizer for given rule. -
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
Returns the next token. -
getMatchers
Returns list of matchers for a char. -
createToken
Creates a new token. -
getNextSpecialToken
Processes and returns next special token. -
goobleWhiteSpace
protected void goobleWhiteSpace()Gobble input characters until next non-whitespace or input end.
-