public class LineToParse
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Token[] |
dbaseStmt
dbase statement as a sequence of tokens
|
int |
lineno
lineno is the line number of the string, toParse
|
java.util.LinkedList<java.lang.String> |
parseList
parselist is a linkedList of tokens (strings) that capture the essence of a parse
|
static Token[] |
subTableStmt
subTableStatement statement as a sequence of tokens
|
static Token[] |
tableStmt
table statement as a sequence of tokens
|
java.lang.String |
token
token is the most recently parsed (and to be remembered) token
Some tokens (whose values we know) need not be remembered
|
java.lang.String |
toParse
toParse is the string that is to be parsed
|
static Token[] |
tupleStmt
tuple statement as a sequence of tokens
|
Constructor and Description |
---|
LineToParse(java.lang.String lineContents,
int lineNumber)
A phrase is really a lineContents to be parsed, defined by a String
lineContents and its lineNumber
|
Modifier and Type | Method and Description |
---|---|
void |
AssertThereIsMoreToParse()
is there more to parse to parse? If not, throw ParseException
|
boolean |
isDigit(char c)
is c a digit?
|
boolean |
isDot(char c)
is c a dot?
|
boolean |
isDoubleQuote(char c)
is c a double-quote?
|
boolean |
isLetter(char c)
is c a letter?
|
boolean |
isLetterOrDigitOrUnderScore(char c)
is c a letter or digit or underscore?
|
boolean |
isLowercaseLetter(char c)
is c a lowercase letter?
|
boolean |
isNegative(char c)
is c a minus (negative) sign?
|
boolean |
isSingleQuote(char c)
is c a single quote?
|
boolean |
isUnderScore(char c)
is c an underscore?
|
boolean |
parseChar(char k)
is the next character k?
|
boolean |
parser(Token[] statement)
parse a statement (a sequence of tokens); return true
|
void |
parseSkip(boolean b,
java.lang.String emsg)
if b is false (meaning that the requested parsing step cannot
be done), throw a ParseException with the given error message emsg;
otherwise do nothing (nothing to remember on parseList).
|
void |
parseStep(boolean b,
java.lang.String emsg)
if b is false (meaning that the requested parsing step cannot
be done), throw a ParseException with the given error message emsg;
otherwise add the parsed token to the parseList.
|
char |
peek()
look at next character to parse
|
boolean |
returnResult(int i)
advance toParse by the length i of a parsed "token" and
set token to the length i string that has been removed;
this is the "result" of parsing.
|
boolean |
returnSkip(int i)
advance toParse by the length i of a parsed "token"; no
token is returned; return true.
|
public static Token[] dbaseStmt
public static Token[] tableStmt
public static Token[] tupleStmt
public static Token[] subTableStmt
public java.lang.String toParse
public java.lang.String token
public java.util.LinkedList<java.lang.String> parseList
public int lineno
public LineToParse(java.lang.String lineContents, int lineNumber)
lineContents
- -- string contents of a linelineNumber
- -- line number associated with this stringpublic char peek()
public boolean parseChar(char k)
k
- -- ideally the next character to parsepublic void AssertThereIsMoreToParse()
public boolean returnResult(int i)
i
- -- length of parsed "token" stringpublic boolean returnSkip(int i)
i
- -- length of parsed tokenpublic void parseStep(boolean b, java.lang.String emsg)
b
- -- boolean whether requested parsing step can be doneemsg
- -- error message given when b is falsepublic void parseSkip(boolean b, java.lang.String emsg)
b
- -- boolean whether requested parsing step can be doneemsg
- -- error message given when b is falsepublic boolean parser(Token[] statement)
statement
- -- sequence of tokens/statement expectedpublic boolean isDigit(char c)
c
- -- character to examinepublic boolean isDoubleQuote(char c)
c
- -- character to examinepublic boolean isLetter(char c)
c
- -- character to examinepublic boolean isLetterOrDigitOrUnderScore(char c)
c
- -- character to examinepublic boolean isNegative(char c)
c
- -- character to examinepublic boolean isSingleQuote(char c)
c
- -- character to examinepublic boolean isLowercaseLetter(char c)
c
- -- character to examinepublic boolean isDot(char c)
c
- -- character to examinepublic boolean isUnderScore(char c)
c
- -- character to examine