|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.voytechs.jnetstream.npl.ExpressionParser
public class ExpressionParser
Express parser.
A standard C-Like expression will be parsed into an expression tree.
The expression tree then can be traversed and evaluated via a number of methods.
The expression parser is called using the parseExpression() method and passing it a String
containing the expression to be parsed.
The parser has the following operators defined:
| Field Summary | |
|---|---|
static java.util.Map |
context
|
protected java.lang.String |
expression
|
protected java.util.Stack |
s1
|
protected java.util.Stack |
s2
|
| Constructor Summary | |
|---|---|
ExpressionParser()
Initialize the parser. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Test function for ExpressionParser |
Node |
parse(java.io.Reader input)
Returns the root node of the parse tree or Glyths. |
Node |
parse(java.lang.String exp)
Returns the root node of the parse tree or Glyths. |
protected Node |
parseExpression(ExpTokenizer tokens)
Returns the root node of the parsed tree or Glyths. |
protected void |
processBuiltinStatement(ExpTokenizer tokens,
Token token,
Token peek)
Processes tokens that are builtin statement or variables. |
protected void |
processOpNodes()
Processes all of the OP nodes found on the stack until the stack is emptied. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Stack s1
protected java.util.Stack s2
protected java.lang.String expression
public static java.util.Map context
| Constructor Detail |
|---|
public ExpressionParser()
| Method Detail |
|---|
public Node parse(java.lang.String exp)
throws SyntaxError
exp - Expression string to be parsed into the expression tree.
SyntaxError
public Node parse(java.io.Reader input)
throws SyntaxError
exp - Input Reader stream to be parsed into the expression tree.
SyntaxError
protected Node parseExpression(ExpTokenizer tokens)
throws SyntaxError
tokens - Tokenizer object initialized with the express string or stream.
SyntaxError
protected void processBuiltinStatement(ExpTokenizer tokens,
Token token,
Token peek)
protected void processOpNodes()
public static void main(java.lang.String[] args)
args - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||