|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.runtime.parser.Parser
public class Parser
This class is responsible for parsing a Velocity template. This class was generated by JavaCC using the JJTree extension to produce an Abstract Syntax Tree (AST) of the template. Please look at the Parser.jjt file which is what controls the generation of this class.
Field Summary | |
---|---|
String |
currentTemplateName
Name of current template we are parsing. |
Token |
jj_nt
Next token. |
protected JJTParserState |
jjtree
|
Token |
token
Current token. |
ParserTokenManager |
token_source
Generated Token Manager. |
Fields inherited from interface org.apache.velocity.runtime.parser.ParserTreeConstants |
---|
JJTADDNODE, JJTANDNODE, JJTASSIGNMENT, JJTBLOCK, JJTCOMMENT, JJTDIRECTIVE, JJTDIVNODE, JJTELSEIFSTATEMENT, JJTELSESTATEMENT, JJTEQNODE, JJTESCAPE, JJTESCAPEDDIRECTIVE, JJTEXPRESSION, JJTFALSE, JJTFLOATINGPOINTLITERAL, JJTGENODE, JJTGTNODE, JJTIDENTIFIER, JJTIFSTATEMENT, JJTINTEGERLITERAL, JJTINTEGERRANGE, JJTLENODE, JJTLTNODE, JJTMAP, JJTMETHOD, JJTMODNODE, JJTMULNODE, JJTNENODE, jjtNodeName, JJTNOTNODE, JJTOBJECTARRAY, JJTORNODE, JJTPROCESS, JJTREFERENCE, JJTSETDIRECTIVE, JJTSTOP, JJTSTRINGLITERAL, JJTSUBTRACTNODE, JJTTEXT, JJTTRUE, JJTVOID, JJTWORD |
Constructor Summary | |
---|---|
Parser(CharStream stream)
Constructor with user supplied CharStream. |
|
Parser(ParserTokenManager tm)
Constructor with generated Token Manager. |
|
Parser(RuntimeServices rs)
This constructor was added to allow the re-use of parsers. |
Method Summary | |
---|---|
void |
AdditiveExpression()
|
void |
Assignment()
|
void |
Comment()
|
void |
ConditionalAndExpression()
|
void |
ConditionalOrExpression()
|
SimpleNode |
Directive()
Supports the Pluggable Directives #foo( arg+ ) |
int |
DirectiveArg()
Supports the arguments for the Pluggable Directives |
void |
disable_tracing()
Disable tracing. |
void |
ElseIfStatement()
|
void |
ElseStatement()
|
void |
enable_tracing()
Enable tracing. |
void |
EqualityExpression()
|
void |
Escape()
Used to catch and process escape sequences in grammatical constructs as escapes outside of VTL are just characters. |
void |
EscapedDirective()
used to separate the notion of a valid directive that has been escaped, versus something that looks like a directive and is just schmoo. |
void |
Expression()
|
void |
False()
|
void |
FloatingPointLiteral()
|
ParseException |
generateParseException()
Generate ParseException. |
Directive |
getDirective(String directive)
This method gets a Directive from the directives Hashtable |
Token |
getNextToken()
Get the next Token. |
Token |
getToken(int index)
Get the specific Token. |
void |
Identifier()
This method corresponds to variable references in Velocity templates. |
void |
IfStatement()
|
void |
IntegerLiteral()
|
void |
IntegerRange()
supports the [n..m] vector generator for use in the #foreach() to generate measured ranges w/o needing explicit support from the app/servlet |
boolean |
isDirective(String directive)
This method finds out of the directive exists in the directives Hashtable. |
void |
Map()
for creating a map in a #set #set($foo = {$foo : $bar, $blargh : $thingy}) |
void |
Method()
This method has yet to be fully implemented but will allow arbitrarily nested method calls |
void |
MultiplicativeExpression()
|
void |
ObjectArray()
|
void |
Parameter()
This method has yet to be fully implemented but will allow arbitrarily nested method calls |
SimpleNode |
parse(Reader reader,
String templateName)
This was also added to allow parsers to be re-usable. |
void |
PrimaryExpression()
|
SimpleNode |
process()
This method is what starts the whole parsing process. |
void |
Reference()
|
void |
ReInit(CharStream stream)
Reinitialise. |
void |
ReInit(ParserTokenManager tm)
Reinitialise. |
void |
RelationalExpression()
|
void |
SetDirective()
Currently support both types of set : #set( expr ) #set expr |
void |
setDirectives(Hashtable directives)
This method sets the directives Hashtable |
void |
Statement()
These are the types of statements that are acceptable in Velocity templates. |
void |
StopStatement()
This method corresponds to the #stop directive which just simulates and EOF so that parsing stops. |
void |
StringLiteral()
|
void |
Text()
This method is responsible for allowing all non-grammar text to pass through unscathed. |
void |
True()
|
void |
UnaryExpression()
|
void |
Word()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JJTParserState jjtree
public String currentTemplateName
public ParserTokenManager token_source
public Token token
public Token jj_nt
Constructor Detail |
---|
public Parser(RuntimeServices rs)
public Parser(CharStream stream)
public Parser(ParserTokenManager tm)
Method Detail |
---|
public SimpleNode parse(Reader reader, String templateName) throws ParseException
ParseException
public void setDirectives(Hashtable directives)
public Directive getDirective(String directive)
public boolean isDirective(String directive)
public final SimpleNode process() throws ParseException
ParseException
public final void Statement() throws ParseException
ParseException
public final void EscapedDirective() throws ParseException
ParseException
public final void Escape() throws ParseException
ParseException
public final void Comment() throws ParseException
ParseException
public final void FloatingPointLiteral() throws ParseException
ParseException
public final void IntegerLiteral() throws ParseException
ParseException
public final void StringLiteral() throws ParseException
ParseException
public final void Identifier() throws ParseException
ParseException
public final void Word() throws ParseException
ParseException
public final int DirectiveArg() throws ParseException
ParseException
public final SimpleNode Directive() throws ParseException
ParseException
public final void Map() throws ParseException
ParseException
public final void ObjectArray() throws ParseException
ParseException
public final void IntegerRange() throws ParseException
ParseException
public final void Parameter() throws ParseException
ParseException
public final void Method() throws ParseException
ParseException
public final void Reference() throws ParseException
ParseException
public final void True() throws ParseException
ParseException
public final void False() throws ParseException
ParseException
public final void Text() throws ParseException
ParseException
public final void IfStatement() throws ParseException
ParseException
public final void ElseStatement() throws ParseException
ParseException
public final void ElseIfStatement() throws ParseException
ParseException
public final void SetDirective() throws ParseException
ParseException
public final void StopStatement() throws ParseException
ParseException
public final void Expression() throws ParseException
ParseException
public final void Assignment() throws ParseException
ParseException
public final void ConditionalOrExpression() throws ParseException
ParseException
public final void ConditionalAndExpression() throws ParseException
ParseException
public final void EqualityExpression() throws ParseException
ParseException
public final void RelationalExpression() throws ParseException
ParseException
public final void AdditiveExpression() throws ParseException
ParseException
public final void MultiplicativeExpression() throws ParseException
ParseException
public final void UnaryExpression() throws ParseException
ParseException
public final void PrimaryExpression() throws ParseException
ParseException
public void ReInit(CharStream stream)
public void ReInit(ParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |