public class StandardParser extends Object implements StandardParserTreeConstants, Parser, StandardParserConstants
Modifier and Type | Field and Description |
---|---|
Template |
currentTemplate
Current template we are parsing.
|
boolean |
hyphenAllowedInIdentifiers
Set to true if the propoerty
RuntimeConstants.PARSER_HYPHEN_ALLOWED is set to true
|
Token |
jj_nt
Next token.
|
protected JJTStandardParserState |
jjtree |
boolean |
strictEscape
Set to true if the property
RuntimeConstants.RUNTIME_REFERENCES_STRICT_ESCAPE is set to true
|
Token |
token
Current token.
|
StandardParserTokenManager |
token_source
Generated Token Manager.
|
JJTADDNODE, JJTANDNODE, JJTASSIGNMENT, JJTBLOCK, JJTCOMMENT, JJTDIRECTIVE, JJTDIRECTIVEASSIGN, JJTDIVNODE, JJTELSEIFSTATEMENT, JJTELSESTATEMENT, JJTEQNODE, JJTESCAPE, JJTESCAPEDDIRECTIVE, JJTEXPRESSION, JJTFALSE, JJTFLOATINGPOINTLITERAL, JJTGENODE, JJTGTNODE, JJTIDENTIFIER, JJTIFSTATEMENT, JJTINDEX, JJTINTEGERLITERAL, JJTINTEGERRANGE, JJTLENODE, JJTLTNODE, JJTMAP, JJTMETHOD, JJTMODNODE, JJTMULNODE, JJTNEGATENODE, JJTNENODE, jjtNodeName, JJTNOTNODE, JJTOBJECTARRAY, JJTORNODE, JJTPROCESS, JJTREFERENCE, JJTSETDIRECTIVE, JJTSTRINGLITERAL, JJTSUBTRACTNODE, JJTTEXT, JJTTEXTBLOCK, JJTTRUE, JJTVOID, JJTWORD
ALPHA_CHAR, ALT_VAL, BRACKETED_WORD, COLON, COMMA, DEFAULT, DIGIT, DIRECTIVE, DIRECTIVE_CHAR, DIRECTIVE_TERMINATOR, DIVIDE, DOLLAR, DOLLARBANG, DOT, DOUBLE_ESCAPE, DOUBLEDOT, ELSE, ELSEIF, EMPTY_INDEX, END, EOF, EQUALS, ESCAPE, ESCAPE_DIRECTIVE, EXPONENT, FALSE, FLOATING_POINT_LITERAL, FORMAL_COMMENT, HASH, IDENTIFIER, IDENTIFIER_CHAR, IF_DIRECTIVE, IN_FORMAL_COMMENT, IN_MULTI_LINE_COMMENT, IN_MULTILINE_COMMENT, IN_SINGLE_LINE_COMMENT, IN_TEXTBLOCK, INDEX_LBRACKET, INDEX_RBRACKET, INLINE_TEXT, INTEGER_LITERAL, LBRACKET, LCURLY, LEFT_CURLEY, LETTER, LOGICAL_AND, LOGICAL_EQUALS, LOGICAL_GE, LOGICAL_GT, LOGICAL_LE, LOGICAL_LT, LOGICAL_NOT, LOGICAL_NOT_EQUALS, LOGICAL_OR, LOGICAL_OR_2, LONE_SYMBOL, LPAREN, MINUS, MODULUS, MULTI_LINE_COMMENT, MULTIPLY, NEWLINE, OLD_ALPHA_CHAR, OLD_IDENTIFIER, OLD_IDENTIFIER_CHAR, OLD_REFMODIFIER, PIPE, PLUS, PRE_DIRECTIVE, PRE_OLD_REFERENCE, PRE_REFERENCE, RBRACKET, RCURLY, REFERENCE, REFERENCE_TERMINATOR, REFINDEX, REFMOD, REFMOD2, REFMOD2_RPAREN, REFMOD3, REFMODIFIER, RIGHT_CURLEY, RPAREN, SET_DIRECTIVE, SINGLE_LINE_COMMENT, SINGLE_LINE_COMMENT_START, STRING_LITERAL, SUFFIX, TEXT, TEXTBLOCK, tokenImage, TRUE, WHITESPACE, WORD, ZERO_WIDTH_WHITESPACE
Constructor and Description |
---|
StandardParser(CharStream stream)
Constructor with user supplied CharStream.
|
StandardParser(RuntimeServices rs)
This constructor was added to allow the re-use of parsers.
|
StandardParser(StandardParserTokenManager tm)
Constructor with generated Token Manager.
|
Modifier and Type | Method and Description |
---|---|
void |
AdditiveExpression() |
void |
Assignment() |
char |
asterisk() |
char |
at() |
boolean |
Comment() |
void |
ConditionalAndExpression() |
void |
ConditionalOrExpression() |
boolean |
Directive(boolean afterNewline)
Supports the Pluggable Directives
#foo( arg+ )
|
int |
DirectiveArg()
Supports the arguments for the Pluggable Directives
|
void |
DirectiveAssign() |
void |
disable_tracing()
Disable tracing.
|
char |
dollar() |
ASTBlock |
ElseIfStatement(ASTBlock previousBlock,
boolean afterNewline) |
ASTBlock |
ElseStatement(ASTBlock previousBlock,
boolean afterNewline) |
void |
enable_tracing()
Enable tracing.
|
void |
EndingZeroWidthWhitespace() |
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.
|
Template |
getCurrentTemplate() |
Directive |
getDirective(String directive)
This method gets a Directive from the directives Hashtable
|
Token |
getNextToken()
Get the next Token.
|
RuntimeServices |
getRuntimeServices() |
Token |
getToken(int index)
Get the specific Token.
|
char |
hash() |
void |
Identifier()
This method corresponds to variable
references in Velocity templates.
|
boolean |
IfStatement(boolean afterNewline) |
void |
Index() |
void |
IndexParameter()
A Simplified parameter more suitable for an index position: $foo[$index]
|
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 Map.
|
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,
Template template)
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(StandardParserTokenManager tm)
Reinitialise.
|
void |
RelationalExpression() |
void |
resetCurrentTemplate() |
boolean |
SetDirective(boolean afterNewline)
Currently support both types of set :
#set( expr )
#set expr
|
boolean |
Statement(boolean afterNewline)
These are the types of statements that
are acceptable in Velocity templates.
|
void |
StringLiteral() |
boolean |
Text()
This method is responsible for allowing
all non-grammar text to pass through
unscathed.
|
void |
Textblock() |
static void |
trace(String message)
Our own trace method.
|
void |
True() |
void |
UnaryExpression() |
void |
Word() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
blockComment, lineComment
protected JJTStandardParserState jjtree
public Template currentTemplate
public boolean strictEscape
public boolean hyphenAllowedInIdentifiers
public StandardParserTokenManager token_source
public Token token
public Token jj_nt
public StandardParser(RuntimeServices rs)
public StandardParser(CharStream stream)
public StandardParser(StandardParserTokenManager tm)
public static void trace(String message)
public RuntimeServices getRuntimeServices()
getRuntimeServices
in interface Parser
public SimpleNode parse(Reader reader, Template template) throws ParseException
parse
in interface Parser
ParseException
public Directive getDirective(String directive)
getDirective
in interface Parser
public boolean isDirective(String directive)
isDirective
in interface Parser
public Template getCurrentTemplate()
getCurrentTemplate
in interface Parser
public void resetCurrentTemplate()
resetCurrentTemplate
in interface Parser
public final SimpleNode process() throws ParseException
ParseException
public final boolean Statement(boolean afterNewline) throws ParseException
ParseException
public final void EndingZeroWidthWhitespace() throws ParseException
ParseException
public final void EscapedDirective() throws ParseException
ParseException
public final void Escape() throws ParseException
ParseException
public final boolean Comment() throws ParseException
ParseException
public final void Textblock() 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 void DirectiveAssign() throws ParseException
ParseException
public final boolean Directive(boolean afterNewline) 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 IndexParameter() throws ParseException
ParseException
public final void Parameter() throws ParseException
ParseException
public final void Method() throws ParseException
ParseException
public final void Index() 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 boolean Text() throws ParseException
ParseException
public final boolean IfStatement(boolean afterNewline) throws ParseException
ParseException
public final ASTBlock ElseStatement(ASTBlock previousBlock, boolean afterNewline) throws ParseException
ParseException
public final ASTBlock ElseIfStatement(ASTBlock previousBlock, boolean afterNewline) throws ParseException
ParseException
public final boolean SetDirective(boolean afterNewline) 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(StandardParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
Copyright © 2000–2021 The Apache Software Foundation. All rights reserved.