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 intprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPattern(String aName, String aPattern, boolean isLiteral) Adds a pattern.voidaddPatterns(ParseRule aRule) Adds patterns to this tokenizer for given rule.charcharAt(int anIndex) CharSequence method.protected TokencreateToken(String aName, String aPattern, int aStart, int anEnd, Token aSpclTkn) Creates a new token.chargetChar()Returns the current parse char.intReturns the current parse char location.intReturns the current column index in the current line.intReturns 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.intReturns the current line index.intReturns the current line number.intReturns 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 voidGobble input characters until next non-whitespace or input end.intlength()CharSequence method.voidsetInput(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.
-