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, JJTWORDALPHA_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, waitblockComment, lineCommentprotected 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 Parserpublic SimpleNode parse(Reader reader, Template template) throws ParseException
parse in interface ParserParseExceptionpublic Directive getDirective(String directive)
getDirective in interface Parserpublic boolean isDirective(String directive)
isDirective in interface Parserpublic Template getCurrentTemplate()
getCurrentTemplate in interface Parserpublic void resetCurrentTemplate()
resetCurrentTemplate in interface Parserpublic final SimpleNode process() throws ParseException
ParseExceptionpublic final boolean Statement(boolean afterNewline)
throws ParseException
ParseExceptionpublic final void EndingZeroWidthWhitespace()
throws ParseException
ParseExceptionpublic final void EscapedDirective()
throws ParseException
ParseExceptionpublic final void Escape()
throws ParseException
ParseExceptionpublic final boolean Comment()
throws ParseException
ParseExceptionpublic final void Textblock()
throws ParseException
ParseExceptionpublic final void FloatingPointLiteral()
throws ParseException
ParseExceptionpublic final void IntegerLiteral()
throws ParseException
ParseExceptionpublic final void StringLiteral()
throws ParseException
ParseExceptionpublic final void Identifier()
throws ParseException
ParseExceptionpublic final void Word()
throws ParseException
ParseExceptionpublic final int DirectiveArg()
throws ParseException
ParseExceptionpublic final void DirectiveAssign()
throws ParseException
ParseExceptionpublic final boolean Directive(boolean afterNewline)
throws ParseException
ParseExceptionpublic final void Map()
throws ParseException
ParseExceptionpublic final void ObjectArray()
throws ParseException
ParseExceptionpublic final void IntegerRange()
throws ParseException
ParseExceptionpublic final void IndexParameter()
throws ParseException
ParseExceptionpublic final void Parameter()
throws ParseException
ParseExceptionpublic final void Method()
throws ParseException
ParseExceptionpublic final void Index()
throws ParseException
ParseExceptionpublic final void Reference()
throws ParseException
ParseExceptionpublic final void True()
throws ParseException
ParseExceptionpublic final void False()
throws ParseException
ParseExceptionpublic final boolean Text()
throws ParseException
ParseExceptionpublic final boolean IfStatement(boolean afterNewline)
throws ParseException
ParseExceptionpublic final ASTBlock ElseStatement(ASTBlock previousBlock, boolean afterNewline) throws ParseException
ParseExceptionpublic final ASTBlock ElseIfStatement(ASTBlock previousBlock, boolean afterNewline) throws ParseException
ParseExceptionpublic final boolean SetDirective(boolean afterNewline)
throws ParseException
ParseExceptionpublic final void Expression()
throws ParseException
ParseExceptionpublic final void Assignment()
throws ParseException
ParseExceptionpublic final void ConditionalOrExpression()
throws ParseException
ParseExceptionpublic final void ConditionalAndExpression()
throws ParseException
ParseExceptionpublic final void EqualityExpression()
throws ParseException
ParseExceptionpublic final void RelationalExpression()
throws ParseException
ParseExceptionpublic final void AdditiveExpression()
throws ParseException
ParseExceptionpublic final void MultiplicativeExpression()
throws ParseException
ParseExceptionpublic final void UnaryExpression()
throws ParseException
ParseExceptionpublic final void PrimaryExpression()
throws ParseException
ParseExceptionpublic 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.