Package net.sourceforge.pmd.lang.vm.ast
Class VmParserImpl
- java.lang.Object
-
- net.sourceforge.pmd.lang.vm.ast.VmParserImpl
-
public class VmParserImpl extends Object
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.- Version:
- $Id$
- Author:
- Jason van Zyl, Geir Magnusson Jr., Henning P. Schmiedehausen
-
-
Field Summary
Fields Modifier and Type Field Description JavaccTokenjj_ntNext token.static intJJTADDNODEstatic intJJTANDNODEstatic intJJTASSIGNMENTstatic intJJTBLOCKstatic intJJTCOMMENTstatic intJJTDIRECTIVEstatic intJJTDIVNODEstatic intJJTELSEIFSTATEMENTstatic intJJTELSESTATEMENTstatic intJJTEQNODEstatic intJJTESCAPEstatic intJJTESCAPEDDIRECTIVEstatic intJJTEXPRESSIONstatic intJJTFALSEstatic intJJTFLOATINGPOINTLITERALstatic intJJTFOREACHSTATEMENTstatic intJJTGENODEstatic intJJTGTNODEstatic intJJTIDENTIFIERstatic intJJTIFSTATEMENTstatic intJJTINDEXstatic intJJTINTEGERLITERALstatic intJJTINTEGERRANGEstatic intJJTLENODEstatic intJJTLTNODEstatic intJJTMAPstatic intJJTMETHODstatic intJJTMODNODEstatic intJJTMULNODEstatic intJJTNENODEstatic String[]jjtNodeNamestatic intJJTNOTNODEstatic intJJTOBJECTARRAYstatic intJJTORNODEprotected static JjtreeBuilder<net.sourceforge.pmd.lang.vm.ast.AbstractVmNode>jjtreestatic intJJTREFERENCEstatic intJJTSETDIRECTIVEstatic intJJTSTRINGLITERALstatic intJJTSUBTRACTNODEstatic intJJTTEMPLATEstatic intJJTTEXTstatic intJJTTEXTBLOCKstatic intJJTTRUEstatic intJJTVOIDstatic intJJTWORDJavaccTokentokenCurrent token.net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManagertoken_sourceGenerated net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken Manager.
-
Constructor Summary
Constructors Constructor Description VmParserImpl(CharStream stream)Constructor with user supplied net.sourceforge.pmd.lang.ast.impl.javacc.CharStream.VmParserImpl(net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManager tm)Constructor with generated net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAdditiveExpression()voidAssignment()voidComment()voidConditionalAndExpression()voidConditionalOrExpression()VmNodeDirective()Supports the Pluggable Directives #foo( arg+ )voidDirectiveArg()Supports the arguments for the Pluggable Directivesvoiddisable_tracing()Disable tracing.voidElseIfStatement()voidElseStatement()voidenable_tracing()Enable tracing.voidEqualityExpression()voidEscape()Used to catch and process escape sequences in grammatical constructs as escapes outside of VTL are just characters.voidEscapedDirective()used to separate the notion of a valid directive that has been escaped, versus something that looks like a directive and is just schmoo.voidExpression()voidFalse()voidFloatingPointLiteral()voidForeachStatement()ParseExceptiongenerateParseException()Generate net.sourceforge.pmd.lang.ast.ParseException.JavaccTokengetNextToken()Get the next net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken.JavaccTokengetToken(int index)Get the specific net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken.voidIdentifier()This method corresponds to variable references in Velocity templates.voidIfStatement()voidIndex()voidIndexParameter()A Simplified parameter more suitable for an index position: $foo[$index]voidIntegerLiteral()voidIntegerRange()supports the [n..m] vector generator for use in the #foreach() to generate measured ranges w/o needing explicit support from the app/servletvoidMap()for creating a map in a #set #set($foo = {$foo : $bar, $blargh : $thingy})voidMethod()This method has yet to be fully implemented but will allow arbitrarily nested method callsvoidMultiplicativeExpression()voidObjectArray()voidParameter()This method has yet to be fully implemented but will allow arbitrarily nested method callsvoidPrimaryExpression()voidReference()voidReInit(CharStream stream)Reinitialise.voidReInit(net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManager tm)Reinitialise.voidRelationalExpression()voidSetDirective()Currently support both types of set : #set( expr ) #set exprvoidStatement()These are the types of statements that are acceptable in Velocity templates.voidStringLiteral()ASTTemplateTemplate()This method is what starts the whole parsing process.voidText()This method is responsible for allowing all non-grammar text to pass through unscathed.voidTextblock()voidTrue()voidUnaryExpression()voidWord()
-
-
-
Field Detail
-
jjtree
protected static JjtreeBuilder<net.sourceforge.pmd.lang.vm.ast.AbstractVmNode> jjtree
-
token_source
public net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManager token_source
Generated net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken Manager.
-
token
public JavaccToken token
Current token.
-
jj_nt
public JavaccToken jj_nt
Next token.
-
JJTTEMPLATE
public static final int JJTTEMPLATE
- See Also:
- Constant Field Values
-
JJTVOID
public static final int JJTVOID
- See Also:
- Constant Field Values
-
JJTESCAPEDDIRECTIVE
public static final int JJTESCAPEDDIRECTIVE
- See Also:
- Constant Field Values
-
JJTESCAPE
public static final int JJTESCAPE
- See Also:
- Constant Field Values
-
JJTCOMMENT
public static final int JJTCOMMENT
- See Also:
- Constant Field Values
-
JJTTEXTBLOCK
public static final int JJTTEXTBLOCK
- See Also:
- Constant Field Values
-
JJTFLOATINGPOINTLITERAL
public static final int JJTFLOATINGPOINTLITERAL
- See Also:
- Constant Field Values
-
JJTINTEGERLITERAL
public static final int JJTINTEGERLITERAL
- See Also:
- Constant Field Values
-
JJTSTRINGLITERAL
public static final int JJTSTRINGLITERAL
- See Also:
- Constant Field Values
-
JJTIDENTIFIER
public static final int JJTIDENTIFIER
- See Also:
- Constant Field Values
-
JJTWORD
public static final int JJTWORD
- See Also:
- Constant Field Values
-
JJTDIRECTIVE
public static final int JJTDIRECTIVE
- See Also:
- Constant Field Values
-
JJTBLOCK
public static final int JJTBLOCK
- See Also:
- Constant Field Values
-
JJTMAP
public static final int JJTMAP
- See Also:
- Constant Field Values
-
JJTOBJECTARRAY
public static final int JJTOBJECTARRAY
- See Also:
- Constant Field Values
-
JJTINTEGERRANGE
public static final int JJTINTEGERRANGE
- See Also:
- Constant Field Values
-
JJTMETHOD
public static final int JJTMETHOD
- See Also:
- Constant Field Values
-
JJTINDEX
public static final int JJTINDEX
- See Also:
- Constant Field Values
-
JJTREFERENCE
public static final int JJTREFERENCE
- See Also:
- Constant Field Values
-
JJTTRUE
public static final int JJTTRUE
- See Also:
- Constant Field Values
-
JJTFALSE
public static final int JJTFALSE
- See Also:
- Constant Field Values
-
JJTTEXT
public static final int JJTTEXT
- See Also:
- Constant Field Values
-
JJTFOREACHSTATEMENT
public static final int JJTFOREACHSTATEMENT
- See Also:
- Constant Field Values
-
JJTIFSTATEMENT
public static final int JJTIFSTATEMENT
- See Also:
- Constant Field Values
-
JJTELSESTATEMENT
public static final int JJTELSESTATEMENT
- See Also:
- Constant Field Values
-
JJTELSEIFSTATEMENT
public static final int JJTELSEIFSTATEMENT
- See Also:
- Constant Field Values
-
JJTSETDIRECTIVE
public static final int JJTSETDIRECTIVE
- See Also:
- Constant Field Values
-
JJTEXPRESSION
public static final int JJTEXPRESSION
- See Also:
- Constant Field Values
-
JJTASSIGNMENT
public static final int JJTASSIGNMENT
- See Also:
- Constant Field Values
-
JJTORNODE
public static final int JJTORNODE
- See Also:
- Constant Field Values
-
JJTANDNODE
public static final int JJTANDNODE
- See Also:
- Constant Field Values
-
JJTEQNODE
public static final int JJTEQNODE
- See Also:
- Constant Field Values
-
JJTNENODE
public static final int JJTNENODE
- See Also:
- Constant Field Values
-
JJTLTNODE
public static final int JJTLTNODE
- See Also:
- Constant Field Values
-
JJTGTNODE
public static final int JJTGTNODE
- See Also:
- Constant Field Values
-
JJTLENODE
public static final int JJTLENODE
- See Also:
- Constant Field Values
-
JJTGENODE
public static final int JJTGENODE
- See Also:
- Constant Field Values
-
JJTADDNODE
public static final int JJTADDNODE
- See Also:
- Constant Field Values
-
JJTSUBTRACTNODE
public static final int JJTSUBTRACTNODE
- See Also:
- Constant Field Values
-
JJTMULNODE
public static final int JJTMULNODE
- See Also:
- Constant Field Values
-
JJTDIVNODE
public static final int JJTDIVNODE
- See Also:
- Constant Field Values
-
JJTMODNODE
public static final int JJTMODNODE
- See Also:
- Constant Field Values
-
JJTNOTNODE
public static final int JJTNOTNODE
- See Also:
- Constant Field Values
-
jjtNodeName
public static final String[] jjtNodeName
-
-
Constructor Detail
-
VmParserImpl
public VmParserImpl(CharStream stream)
Constructor with user supplied net.sourceforge.pmd.lang.ast.impl.javacc.CharStream.
-
VmParserImpl
public VmParserImpl(net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManager tm)
Constructor with generated net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken Manager.
-
-
Method Detail
-
Template
public final ASTTemplate Template() throws ParseException
This method is what starts the whole parsing process. After the parsing is complete and the template has been turned into an AST, this method returns the root of AST which can subsequently be traversed by a visitor which implements the ParserVisitor interface which is generated automatically by JavaCC- Throws:
ParseException
-
Statement
public final void Statement() throws ParseExceptionThese are the types of statements that are acceptable in Velocity templates.- Throws:
ParseException
-
EscapedDirective
public final void EscapedDirective() throws ParseExceptionused to separate the notion of a valid directive that has been escaped, versus something that looks like a directive and is just schmoo. This is important to do as a separate production that creates a node, because we want this, in either case, to stop the further parsing of the Directive() tree.- Throws:
ParseException
-
Escape
public final void Escape() throws ParseExceptionUsed to catch and process escape sequences in grammatical constructs as escapes outside of VTL are just characters. Right now we have both this and the EscapeDirective() construction because in the EscapeDirective() case, we want to suck in the #<directive> and here we don't. We just want the escapes to render correctly- Throws:
ParseException
-
Comment
public final void Comment() throws ParseException- Throws:
ParseException
-
Textblock
public final void Textblock() throws ParseException- Throws:
ParseException
-
FloatingPointLiteral
public final void FloatingPointLiteral() throws ParseException- Throws:
ParseException
-
IntegerLiteral
public final void IntegerLiteral() throws ParseException- Throws:
ParseException
-
StringLiteral
public final void StringLiteral() throws ParseException- Throws:
ParseException
-
Identifier
public final void Identifier() throws ParseExceptionThis method corresponds to variable references in Velocity templates. The following are examples of variable references that may be found in a template: $foo $bar- Throws:
ParseException
-
Word
public final void Word() throws ParseException- Throws:
ParseException
-
DirectiveArg
public final void DirectiveArg() throws ParseExceptionSupports the arguments for the Pluggable Directives- Throws:
ParseException
-
Directive
public final VmNode Directive() throws ParseException
Supports the Pluggable Directives #foo( arg+ )- Throws:
ParseException
-
Map
public final void Map() throws ParseExceptionfor creating a map in a #set #set($foo = {$foo : $bar, $blargh : $thingy})- Throws:
ParseException
-
ObjectArray
public final void ObjectArray() throws ParseException- Throws:
ParseException
-
IntegerRange
public final void IntegerRange() throws ParseExceptionsupports the [n..m] vector generator for use in the #foreach() to generate measured ranges w/o needing explicit support from the app/servlet- Throws:
ParseException
-
IndexParameter
public final void IndexParameter() throws ParseExceptionA Simplified parameter more suitable for an index position: $foo[$index]- Throws:
ParseException
-
Parameter
public final void Parameter() throws ParseExceptionThis method has yet to be fully implemented but will allow arbitrarily nested method calls- Throws:
ParseException
-
Method
public final void Method() throws ParseExceptionThis method has yet to be fully implemented but will allow arbitrarily nested method calls- Throws:
ParseException
-
Index
public final void Index() throws ParseException- Throws:
ParseException
-
Reference
public final void Reference() throws ParseException- Throws:
ParseException
-
True
public final void True() throws ParseException- Throws:
ParseException
-
False
public final void False() throws ParseException- Throws:
ParseException
-
Text
public final void Text() throws ParseExceptionThis method is responsible for allowing all non-grammar text to pass through unscathed.- Throws:
ParseException
-
ForeachStatement
public final void ForeachStatement() throws ParseException- Throws:
ParseException
-
IfStatement
public final void IfStatement() throws ParseException- Throws:
ParseException
-
ElseStatement
public final void ElseStatement() throws ParseException- Throws:
ParseException
-
ElseIfStatement
public final void ElseIfStatement() throws ParseException- Throws:
ParseException
-
SetDirective
public final void SetDirective() throws ParseExceptionCurrently support both types of set : #set( expr ) #set expr- Throws:
ParseException
-
Expression
public final void Expression() throws ParseException- Throws:
ParseException
-
Assignment
public final void Assignment() throws ParseException- Throws:
ParseException
-
ConditionalOrExpression
public final void ConditionalOrExpression() throws ParseException- Throws:
ParseException
-
ConditionalAndExpression
public final void ConditionalAndExpression() throws ParseException- Throws:
ParseException
-
EqualityExpression
public final void EqualityExpression() throws ParseException- Throws:
ParseException
-
RelationalExpression
public final void RelationalExpression() throws ParseException- Throws:
ParseException
-
AdditiveExpression
public final void AdditiveExpression() throws ParseException- Throws:
ParseException
-
MultiplicativeExpression
public final void MultiplicativeExpression() throws ParseException- Throws:
ParseException
-
UnaryExpression
public final void UnaryExpression() throws ParseException- Throws:
ParseException
-
PrimaryExpression
public final void PrimaryExpression() throws ParseException- Throws:
ParseException
-
ReInit
public void ReInit(CharStream stream)
Reinitialise.
-
ReInit
public void ReInit(net.sourceforge.pmd.lang.vm.ast.VmParserImplTokenManager tm)
Reinitialise.
-
getNextToken
public final JavaccToken getNextToken()
Get the next net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken.
-
getToken
public final JavaccToken getToken(int index)
Get the specific net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken.
-
generateParseException
public ParseException generateParseException()
Generate net.sourceforge.pmd.lang.ast.ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-