|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.lastbamboo.common.sdp.StringTokenizer
org.lastbamboo.common.sdp.LexerCore
public class LexerCore
A lexical analyzer that is used by all parsers in our implementation.
| Field Summary | |
|---|---|
static int |
ALPHA
|
static int |
AND
|
static int |
AT
|
static int |
BACK_QUOTE
|
static int |
BACKSLASH
|
static int |
BAR
|
static int |
COLON
|
protected Hashtable |
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 Hashtable |
globalSymbolTable
|
static int |
GREATER_THAN
|
static int |
HAT
|
static int |
HT
|
static int |
ID
|
static int |
L_CURLY
|
static int |
L_SQUARE_BRACKET
|
static int |
LESS_THAN
|
protected static Hashtable |
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
|
| Fields inherited from class org.lastbamboo.common.sdp.StringTokenizer |
|---|
buffer, ptr, savedPtr |
| Constructor Summary | |
|---|---|
protected |
LexerCore()
|
|
LexerCore(String lexerName)
|
|
LexerCore(String lexerName,
String buffer)
Initialize the lexer with a buffer. |
| Method Summary | |
|---|---|
protected void |
addKeyword(String name,
int value)
|
protected Hashtable |
addLexer(String lexerName)
|
String |
byteStringNoComma()
Return a substring containing no commas |
String |
byteStringNoSemicolon()
Return a substring containing no semicolons. |
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 "(". |
ParseException |
createParseException()
Create a parse exception. |
String |
getBuffer()
Get the buffer. |
String |
getNextId()
Get the next id. |
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 |
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. |
Vector |
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 |
startsSafeToken()
|
String |
ttoken()
|
String |
ttokenAllowSpace()
|
String |
ttokenSafe()
|
| Methods inherited from class org.lastbamboo.common.sdp.StringTokenizer |
|---|
consume, consume, getLine, getLines, getNextChar, getNextToken, getSDPFieldName, hasMoreChars, isAlpha, isDigit, isHexDigit, lookAhead, lookAhead, nextToken, peekLine |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int START
public static final int END
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 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 Hashtable globalSymbolTable
protected static Hashtable lexerTables
protected Hashtable currentLexer
protected String currentLexerName
protected Token currentMatch
| Constructor Detail |
|---|
protected LexerCore()
public LexerCore(String lexerName)
public LexerCore(String lexerName,
String buffer)
| Method Detail |
|---|
protected void addKeyword(String name,
int value)
public String lookupToken(int value)
protected Hashtable addLexer(String lexerName)
public void selectLexer(String lexerName)
public String peekNextId()
public String getNextId()
public Token getNextToken()
public Token peekNextToken()
throws ParseException
ParseException
public Vector peekNextToken(int ntokens)
throws ParseException
ParseException
public Token match(int tok)
throws ParseException
ParseExceptionpublic void SPorHT()
public boolean startsId()
public boolean startsSafeToken()
public String ttoken()
public String ttokenAllowSpace()
public String ttokenSafe()
public String quotedString()
throws ParseException
ParseException
public String comment()
throws ParseException
ParseExceptionpublic String byteStringNoSemicolon()
public String byteStringNoComma()
public static String charAsString(char ch)
public String charAsString(int nchars)
public String number()
throws ParseException
ParseExceptionpublic 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 match
ParseExceptionpublic int getPtr()
public String getBuffer()
public ParseException createParseException()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||