|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttools.blend.expression.ExpressionParser
public final class ExpressionParser
These functions scan and parse a textual representation of a logic equation expressed in a C-like notation. The equation may consist of logic operation AND (&&), OR (||), and NOT (!) along with comparison operations like ">" and "<=". Parenthesis may be used to group the order of operation. The functions here are a two-step process. In the first step an expression (example shown below) is scanned into functional tokens. The scanning handles quotes and escaped characters. The scanning recognizes operators and parenthesis. In the second step the sub-expressions are grown into a tree of tokens ready for processing at even higher levels. Example expression: A==3 && (B==0x4 || !(C!='\n' && D>6)) (1) Scanned into tokens (separated here by spaces) A == 3 && ( B == 0x4 || ! ( C != '\n' && D > 6 ) ) (2) Parsed into a tree of tokens A == 3 && * B == 0x4 || !* C != '\n' && D>6
| Constructor Summary | |
|---|---|
ExpressionParser()
|
|
| Method Summary | |
|---|---|
static void |
parseExpressionTree(java.util.List<ParseToken> parseTokens)
This function grows the flat list of parse tokens into a tree of parse tokens. |
static java.util.List<ParseToken> |
scanExpression(CodeLineInputStream clis)
This function scans an expression into a list of parse tokens. |
static java.util.List<ParseToken> |
scanExpression(java.lang.String expression,
java.lang.String filename,
int lineNumber)
This function scans an expression into a list of parse tokens. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExpressionParser()
| Method Detail |
|---|
public static void parseExpressionTree(java.util.List<ParseToken> parseTokens)
throws ExpressionException
parseTokens - the list to grow (input and output to function)
ExpressionException - if there is a syntax error
public static java.util.List<ParseToken> scanExpression(java.lang.String expression,
java.lang.String filename,
int lineNumber)
throws ExpressionException
expression - the expression all in a stringfilename - the filename to use in ExpressionExceptionslineNumber - the line number to use in ExpressionExceptions
ExpressionException - if there is a syntax error
public static java.util.List<ParseToken> scanExpression(CodeLineInputStream clis)
throws ExpressionException
clis - the input stream of CodeLines
ExpressionException - if there is a syntax error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||