public class SLogoParser
extends java.lang.Object
slogo.expression
,
slogo.instruction
,
InstructionParser
Modifier and Type | Field and Description |
---|---|
private Context |
myContext |
private Token |
myToken |
private java.io.StreamTokenizer |
myTokenizer |
Constructor and Description |
---|
SLogoParser(Context c) |
Modifier and Type | Method and Description |
---|---|
void |
error(Token t) |
Token |
getToken()
returns the current token, doesn't fetch a new one
|
static void |
main(java.lang.String[] args)
Basic driver for SLogoParser
|
Token |
match(Token rhs)
try to match a token, if unsuccessful throw an exception, otherwise match
succeeds, and next token is obtained and returned
|
protected Token |
nextToken()
get the next token and store it for retrieval by getToken()
|
void |
parse(java.io.Reader r)
parses an expression and prints the result of evaluating the expression.
|
private java.io.StreamTokenizer myTokenizer
private Token myToken
private Context myContext
public SLogoParser(Context c)
public void parse(java.io.Reader r)
r
- the reader that will be tokenizedprotected Token nextToken()
public Token getToken()
public Token match(Token rhs)
rhs
- token being matchedParseException
- if match failspublic void error(Token t)
t
- token where error occurreda
- ParseException labeled by tpublic static void main(java.lang.String[] args)
args
-