org.millscript.millscript.syntax
Interface PostfixSyntaxInterface

All Known Implementing Classes:
AndAbsentSyntax, AndSyntax, AppendSyntax, ArithSyntax, AssignSyntax, BothfixSyntax, CommaSyntax, DotSyntax, ExplodeSyntax, IndexSyntax, InfixSyntax, MapletSyntax, OrAbsentSyntax, OrSyntax, ParenSyntax, PostfixSyntax, QualifiedNameSyntax, RelationalOperationSyntax, SimplePostfixSyntax, XMLElementSyntax

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

getPrecedence

int getPrecedence()
Returns the precedence of this piece of postfix syntax. Higher values represent more tightly bound syntax.

Returns:
the precedence of this postfix syntax

postfix

Expr postfix(java.lang.String sym,
             int prec,
             Expr lhs,
             Parser parser)
Parse the syntax for the specified symbol, using the specified 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.

Parameters:
sym - the symbol to parse this syntax for
prec - the current precedence we should parse to
lhs - the expression on the left hand side of the specified symbol
parser - Parser to parse from, i.e. the source to parse from
Returns:
an expression for this syntax


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.