|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Selector |
Class Summary | |
---|---|
ArraySubscript | |
ExprActions | Actions for ExprParser and IncludeParser . |
Expression | Contains static methods to evaluate an expression within a template statement. |
ExprLexer | Splits a string into tokens. |
ExprLexer.Token | Represents a token returned by the enclosing ExprLexer . |
ExprParser | Parses an expression. |
MethodCall |
Lexes and parses an expression.
This package is responsible for lexing and parsing an expression used in
some template tags. An expression is a complicated structure to parse, so this
task is offloaded from the TemplateLexer
and the tokens into this package. The main entry point of this package is
the Expression
class.
The heart of this package is the expr.yacc source file (available in the source
download, in src/net/sourceforge/templat/expr/expr.yacc). This is a standard
yacc file, except it contains Java source instead of C source. This file is processed
by BYACC/J, an open-source yacc implementation
that produces parsers written in Java instead of parsers written in C. The output of this process is
the ExprParser
Java source file.
An expression is primarily just a variable, literal number, or class name, possibly with method calls and/or array subscripts. The expr.yacc file defines the exact grammar.
The parser (produced from the expr.yacc file) calls ExprLexer
to get a
stream of tokens representing the entire input expression string being parsed. Then each applicable rule
in the expr.yacc grammar is applied; these rules call actions defined in the ExprActions
class. The two actions of method call and array subscript are handled by the classes
MethodCall
and ArraySubscript
.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |