public class Lexer extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FAILURE
An index which indicates that no further tokens were found.
|
(package private) CharSequence |
input |
(package private) Matcher[] |
matchers |
(package private) int |
matchingIndex |
(package private) int |
position |
(package private) String[] |
regexps |
Constructor and Description |
---|
Lexer(CharSequence input,
String[] regexps)
Builds a Lexer for the given input with the provided regular expressions.
|
Modifier and Type | Method and Description |
---|---|
int |
getMatchingIndex()
Returns the index of the regular expression which matched the most recent token.
|
int |
getMatchingPosition()
Returns the position in the String just beyond the most recent token.
|
String |
getMatchingRule()
Returns the regular expression which matched the most recent token.
|
String |
nextToken()
Returns the next token as a string.
|
String |
nextToken(boolean trim)
Returns the next token as a string.
|
public static final int FAILURE
CharSequence input
int position
Matcher[] matchers
String[] regexps
int matchingIndex
public Lexer(CharSequence input, String[] regexps)
public String nextToken(boolean trim)
public String nextToken()
public int getMatchingIndex()
public String getMatchingRule()
public int getMatchingPosition()
Copyright © 2019. All rights reserved.