public class LexerCore extends StringTokenizer
Modifier and Type | Field and Description |
---|---|
static int |
ALPHA |
static int |
AND |
static int |
AT |
static int |
BACK_QUOTE |
static int |
BACKSLASH |
static int |
BAR |
static int |
COLON |
protected Map<String,Integer> |
currentLexer |
protected String |
currentLexerName |
protected Token |
currentMatch |
static int |
DIGIT |
static int |
DOLLAR |
static int |
DOT |
static int |
DOUBLEQUOTE |
static int |
END |
static int |
EQUALS |
static int |
EXCLAMATION |
protected static ConcurrentHashMap<Integer,String> |
globalSymbolTable |
static int |
GREATER_THAN |
static int |
HAT |
static int |
HT |
static int |
ID |
static int |
ID_NO_WHITESPACE |
static int |
IPV6 |
static int |
L_CURLY |
static int |
L_SQUARE_BRACKET |
static int |
LESS_THAN |
protected static ConcurrentHashMap<String,ConcurrentHashMap<String,Integer>> |
lexerTables |
static int |
LPAREN |
static int |
MINUS |
static int |
NULL |
static int |
PERCENT |
static int |
PLUS |
static int |
POUND |
static int |
QUESTION |
static int |
QUOTE |
static int |
R_CURLY |
static int |
R_SQUARE_BRACKET |
static int |
RPAREN |
static int |
SAFE |
static int |
SEMICOLON |
static int |
SLASH |
static int |
SP |
static int |
STAR |
static int |
START |
static int |
TILDE |
static int |
UNDERSCORE |
static int |
WHITESPACE |
buffer, bufferLen, ptr, savedPtr
Modifier | Constructor and Description |
---|---|
protected |
LexerCore() |
|
LexerCore(String lexerName,
String buffer)
Initialize the lexer with a buffer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addKeyword(String name,
int value) |
String |
byteStringNoComma()
Return a substring containing no commas
|
String |
byteStringNoSemicolon()
Return a substring containing no semicolons.
|
String |
byteStringNoSlash()
Scan until you see a slash or an EOL.
|
static String |
charAsString(char ch) |
String |
charAsString(int nchars)
Lookahead in the inputBuffer for n chars and return as a string.
|
String |
comment()
Parse a comment string cursor is at a "(".
|
void |
consumeValidChars(char[] validChars) |
ParseException |
createParseException()
Create a parse exception.
|
String |
getBuffer()
Get the buffer.
|
String |
getNextId()
Get the next id.
|
String |
getNextIdNoWhiteSpace() |
String |
getNextIp()
Get the next ip.
|
Token |
getNextToken() |
int |
getPtr()
Get the read pointer.
|
String |
getRest()
Get the rest of the String
|
String |
getString(char c)
Get the sub-String until the character is encountered
|
static boolean |
isTokenChar(char c)
JvB: utility function added to validate tokens
|
String |
lookupToken(int value) |
int |
markInputPosition()
Mark the position for backtracking.
|
Token |
match(int tok)
Match the given token or throw an exception if no such token
can be matched.
|
String |
number()
Get and consume the next number.
|
String |
peekNextId()
Peek the next id but dont move the buffer pointer forward.
|
Token |
peekNextToken()
Look ahead for one token.
|
Token[] |
peekNextToken(int ntokens) |
String |
quotedString()
Parse a comment string cursor is at a ".
|
void |
rewindInputPosition(int position)
Rewind the input ptr to the marked position.
|
void |
selectLexer(String lexerName) |
void |
SPorHT() |
boolean |
startsId() |
boolean |
startsIdNoWhiteSpace() |
boolean |
startsSafeToken() |
String |
tIpv6address() |
String |
ttoken() |
String |
ttokenNoWhiteSpace() |
String |
ttokenSafe() |
consume, consume, getLine, getLines, getNextChar, getNextToken, getSDPFieldName, hasMoreChars, isAlpha, isAlphaDigit, isDigit, isHexDigit, lookAhead, lookAhead, nextToken, peekLine
public static final int START
public static final int END
public static final int ID_NO_WHITESPACE
public static final int ID
public static final int SAFE
public static final int WHITESPACE
public static final int DIGIT
public static final int ALPHA
public static final int IPV6
public static final int BACKSLASH
public static final int QUOTE
public static final int AT
public static final int SP
public static final int HT
public static final int COLON
public static final int STAR
public static final int DOLLAR
public static final int PLUS
public static final int POUND
public static final int MINUS
public static final int DOUBLEQUOTE
public static final int TILDE
public static final int BACK_QUOTE
public static final int NULL
public static final int EQUALS
public static final int SEMICOLON
public static final int SLASH
public static final int L_SQUARE_BRACKET
public static final int R_SQUARE_BRACKET
public static final int R_CURLY
public static final int L_CURLY
public static final int HAT
public static final int BAR
public static final int DOT
public static final int EXCLAMATION
public static final int LPAREN
public static final int RPAREN
public static final int GREATER_THAN
public static final int LESS_THAN
public static final int PERCENT
public static final int QUESTION
public static final int AND
public static final int UNDERSCORE
protected static final ConcurrentHashMap<Integer,String> globalSymbolTable
protected static final ConcurrentHashMap<String,ConcurrentHashMap<String,Integer>> lexerTables
protected String currentLexerName
protected Token currentMatch
protected void addKeyword(String name, int value)
public String lookupToken(int value)
public void selectLexer(String lexerName)
public String peekNextId()
public String getNextId()
public String getNextIp()
public String getNextIdNoWhiteSpace()
public Token getNextToken()
public Token peekNextToken() throws ParseException
ParseException
public Token[] peekNextToken(int ntokens) throws ParseException
ParseException
public Token match(int tok) throws ParseException
ParseException
public void SPorHT()
public static final boolean isTokenChar(char c)
c
- - character to checksection 25.1:
token = 1*(alphanum / "-" / "." / "!" / "%" / "*"
/ "_" / "+" / "`" / "'" / "~" )
public boolean startsId()
public boolean startsIdNoWhiteSpace()
public boolean startsSafeToken()
public String ttoken()
public String tIpv6address()
public String ttokenNoWhiteSpace()
public String ttokenSafe()
public void consumeValidChars(char[] validChars)
public String quotedString() throws ParseException
ParseException
public String comment() throws ParseException
ParseException
public String byteStringNoSemicolon()
public String byteStringNoSlash()
public String byteStringNoComma()
public static String charAsString(char ch)
public String charAsString(int nchars)
public String number() throws ParseException
ParseException
public int markInputPosition()
public void rewindInputPosition(int position)
position
- - the position to rewind the parser to.public String getRest()
public String getString(char c) throws ParseException
c
- the character to matchParseException
public int getPtr()
public String getBuffer()
public ParseException createParseException()
Copyright © 2016. All Rights Reserved.