|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PostfixSyntaxInterface
The PostfixSyntaxInterface interface should be implemented by any class which provides a piece of postfix syntax. Postfix syntax is that which specifically follows the expression it operates on, but it may also preceed an additional expression. e.g. explode syntax vs. append syntax.
Postfix syntax also has the concept of precedence, which allows the parser to
utomatically glue syntax together. e.g. in the following:
x := arg.func + 7;
means assign the result of adding 7 to the result of calling
func with argument arg to variable x.
The parser can automatically interpret this becuase . has a
higher precedence than +, which in turn has a higher precedence
than :=.
| Method Summary | |
|---|---|
int |
getPrecedence()
Returns the precedence of this piece of postfix syntax. |
Expr |
postfix(java.lang.String sym,
int prec,
Expr lhs,
Parser parser)
Parse the syntax for the specified symbol, using the specified Parser. |
| Method Detail |
|---|
int getPrecedence()
Expr postfix(java.lang.String sym,
int prec,
Expr lhs,
Parser parser)
Parser. The symbol is specified because different symbols
may share the same syntax, but result in slightly different expressions.
The Parser is supplied as the source to parse from. As this
is postfix syntax, we are also supplied the expression on the left hand
side of the symbol along with the current precedence we should parse to.
sym - the symbol to parse this syntax forprec - the current precedence we should parse tolhs - the expression on the left hand side of the specified
symbolparser - Parser to parse from, i.e. the source to parse from
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||