public class Parser extends java.lang.Object implements ParserTreeConstants, ParserConstants
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Parser.JJCalls |
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
currentTemplateName
Name of current template we are parsing.
|
private java.util.Hashtable |
directives
This Hashtable contains a list of all of the dynamic directives.
|
private Parser.JJCalls[] |
jj_2_rtns |
private int |
jj_endpos |
private java.util.Vector |
jj_expentries |
private int[] |
jj_expentry |
private int |
jj_gc |
private int |
jj_gen |
private int |
jj_kind |
private int |
jj_la |
private int[] |
jj_la1 |
private int[] |
jj_la1_0 |
private int[] |
jj_la1_1 |
private Token |
jj_lastpos |
private int[] |
jj_lasttokens |
Token |
jj_nt |
private int |
jj_ntk |
private boolean |
jj_rescan |
private Token |
jj_scanpos |
private boolean |
jj_semLA |
protected JJTParserState |
jjtree |
boolean |
lookingAhead |
private RuntimeServices |
rsvc |
Token |
token |
ParserTokenManager |
token_source |
(package private) VelocityCharStream |
velcharstream |
JJTADDNODE, JJTANDNODE, JJTASSIGNMENT, JJTBLOCK, JJTCOMMENT, JJTDIRECTIVE, JJTDIVNODE, JJTELSEIFSTATEMENT, JJTELSESTATEMENT, JJTEQNODE, JJTESCAPE, JJTESCAPEDDIRECTIVE, JJTEXPRESSION, JJTFALSE, JJTGENODE, JJTGTNODE, JJTIDENTIFIER, JJTIFSTATEMENT, JJTINTEGERRANGE, JJTLENODE, JJTLTNODE, JJTMETHOD, JJTMODNODE, JJTMULNODE, JJTNENODE, jjtNodeName, JJTNOTNODE, JJTNUMBERLITERAL, JJTOBJECTARRAY, JJTORNODE, JJTPROCESS, JJTREFERENCE, JJTSETDIRECTIVE, JJTSTRINGLITERAL, JJTSUBTRACTNODE, JJTTEXT, JJTTRUE, JJTVOID, JJTWORD
ALPHA_CHAR, ALPHANUM_CHAR, COMMA, DEFAULT, DIGIT, DIRECTIVE, DIRECTIVE_CHAR, DIRECTIVE_TERMINATOR, DIVIDE, DOLLAR, DOLLARBANG, DOT, DOUBLE_ESCAPE, DOUBLEDOT, ELSE_DIRECTIVE, ELSEIF_DIRECTIVE, END, EOF, EQUALS, ESCAPE, ESCAPE_DIRECTIVE, FALSE, FORMAL_COMMENT, HASH, IDENTIFIER, IDENTIFIER_CHAR, IF_DIRECTIVE, IN_FORMAL_COMMENT, IN_MULTI_LINE_COMMENT, IN_SINGLE_LINE_COMMENT, LBRACKET, LCURLY, LETTER, LOGICAL_AND, LOGICAL_EQUALS, LOGICAL_GE, LOGICAL_GT, LOGICAL_LE, LOGICAL_LT, LOGICAL_NOT, LOGICAL_NOT_EQUALS, LOGICAL_OR, LPAREN, MINUS, MODULUS, MULTI_LINE_COMMENT, MULTIPLY, NEWLINE, NUMBER_LITERAL, PLUS, PRE_DIRECTIVE, RBRACKET, RCURLY, REFERENCE, REFERENCE_TERMINATOR, REFMOD2, REFMOD2_RPAREN, REFMODIFIER, RPAREN, SET_DIRECTIVE, SINGLE_LINE_COMMENT, STOP_DIRECTIVE, STRING_LITERAL, TEXT, tokenImage, TRUE, WHITESPACE, WORD
Constructor and Description |
---|
Parser(CharStream stream) |
Parser(ParserTokenManager tm) |
Parser(RuntimeServices rs)
This constructor was added to allow the re-use of parsers.
|
Modifier and Type | Method and Description |
---|---|
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
We add whitespace in here as a token so the VMs can
easily reconstruct a macro body from the token stream
See Directive()
|
void |
disable_tracing() |
void |
ElseIfStatement() |
void |
ElseStatement() |
void |
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.
|
private java.lang.String |
escapedDirective(java.lang.String strImage)
Produces a processed output for an escaped control or
pluggable directive
|
void |
Expression() |
void |
False() |
ParseException |
generateParseException() |
Directive |
getDirective(java.lang.String directive)
This method gets a Directive from the directives Hashtable
|
Token |
getNextToken() |
Token |
getToken(int index) |
void |
Identifier()
This method corresponds to variable
references in Velocity templates.
|
void |
IfStatement() |
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(java.lang.String directive)
This method finds out of the directive exists in the directives
Hashtable.
|
private boolean |
jj_2_1(int xla) |
private boolean |
jj_2_10(int xla) |
private boolean |
jj_2_11(int xla) |
private boolean |
jj_2_2(int xla) |
private boolean |
jj_2_3(int xla) |
private boolean |
jj_2_4(int xla) |
private boolean |
jj_2_5(int xla) |
private boolean |
jj_2_6(int xla) |
private boolean |
jj_2_7(int xla) |
private boolean |
jj_2_8(int xla) |
private boolean |
jj_2_9(int xla) |
private boolean |
jj_3_1() |
private boolean |
jj_3_10() |
private boolean |
jj_3_11() |
private boolean |
jj_3_2() |
private boolean |
jj_3_3() |
private boolean |
jj_3_4() |
private boolean |
jj_3_5() |
private boolean |
jj_3_6() |
private boolean |
jj_3_7() |
private boolean |
jj_3_8() |
private boolean |
jj_3_9() |
private boolean |
jj_3R_19() |
private boolean |
jj_3R_20() |
private boolean |
jj_3R_21() |
private boolean |
jj_3R_22() |
private boolean |
jj_3R_23() |
private boolean |
jj_3R_24() |
private boolean |
jj_3R_25() |
private boolean |
jj_3R_26() |
private boolean |
jj_3R_27() |
private boolean |
jj_3R_28() |
private boolean |
jj_3R_29() |
private boolean |
jj_3R_30() |
private boolean |
jj_3R_31() |
private boolean |
jj_3R_32() |
private boolean |
jj_3R_33() |
private boolean |
jj_3R_34() |
private boolean |
jj_3R_35() |
private boolean |
jj_3R_36() |
private boolean |
jj_3R_37() |
private boolean |
jj_3R_38() |
private boolean |
jj_3R_39() |
private boolean |
jj_3R_40() |
private boolean |
jj_3R_41() |
private boolean |
jj_3R_42() |
private boolean |
jj_3R_43() |
private boolean |
jj_3R_44() |
private boolean |
jj_3R_45() |
private boolean |
jj_3R_46() |
private boolean |
jj_3R_47() |
private boolean |
jj_3R_48() |
private boolean |
jj_3R_49() |
private boolean |
jj_3R_50() |
private boolean |
jj_3R_51() |
private boolean |
jj_3R_52() |
private boolean |
jj_3R_53() |
private boolean |
jj_3R_54() |
private boolean |
jj_3R_55() |
private boolean |
jj_3R_56() |
private boolean |
jj_3R_57() |
private boolean |
jj_3R_58() |
private boolean |
jj_3R_59() |
private boolean |
jj_3R_60() |
private boolean |
jj_3R_61() |
private boolean |
jj_3R_62() |
private boolean |
jj_3R_63() |
private boolean |
jj_3R_64() |
private boolean |
jj_3R_65() |
private boolean |
jj_3R_66() |
private boolean |
jj_3R_67() |
private boolean |
jj_3R_68() |
private boolean |
jj_3R_69() |
private boolean |
jj_3R_70() |
private boolean |
jj_3R_71() |
private boolean |
jj_3R_72() |
private boolean |
jj_3R_73() |
private boolean |
jj_3R_74() |
private boolean |
jj_3R_75() |
private boolean |
jj_3R_76() |
private boolean |
jj_3R_77() |
private boolean |
jj_3R_78() |
private boolean |
jj_3R_79() |
private boolean |
jj_3R_80() |
private boolean |
jj_3R_81() |
private boolean |
jj_3R_82() |
private boolean |
jj_3R_83() |
private boolean |
jj_3R_84() |
private boolean |
jj_3R_85() |
private boolean |
jj_3R_86() |
private boolean |
jj_3R_87() |
private boolean |
jj_3R_88() |
private boolean |
jj_3R_89() |
private void |
jj_add_error_token(int kind,
int pos) |
private Token |
jj_consume_token(int kind) |
private int |
jj_ntk() |
private void |
jj_rescan_token() |
private void |
jj_save(int index,
int xla) |
private boolean |
jj_scan_token(int kind) |
void |
Method()
This method has yet to be fully implemented
but will allow arbitrarily nested method
calls
|
void |
MultiplicativeExpression() |
void |
NumberLiteral() |
void |
ObjectArray() |
void |
Parameter()
This method has yet to be fully implemented
but will allow arbitrarily nested method
calls
|
SimpleNode |
parse(java.io.Reader reader,
java.lang.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) |
void |
ReInit(ParserTokenManager tm) |
void |
RelationalExpression() |
void |
SetDirective()
Currently support both types of set :
#set( expr )
#set expr
|
void |
setDirectives(java.util.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() |
protected JJTParserState jjtree
private java.util.Hashtable directives
java.lang.String currentTemplateName
VelocityCharStream velcharstream
private RuntimeServices rsvc
public ParserTokenManager token_source
public Token token
public Token jj_nt
private int jj_ntk
private Token jj_scanpos
private Token jj_lastpos
private int jj_la
public boolean lookingAhead
private boolean jj_semLA
private int jj_gen
private final int[] jj_la1
private final int[] jj_la1_0
private final int[] jj_la1_1
private final Parser.JJCalls[] jj_2_rtns
private boolean jj_rescan
private int jj_gc
private java.util.Vector jj_expentries
private int[] jj_expentry
private int jj_kind
private int[] jj_lasttokens
private int jj_endpos
public Parser(RuntimeServices rs)
public Parser(CharStream stream)
public Parser(ParserTokenManager tm)
public SimpleNode parse(java.io.Reader reader, java.lang.String templateName) throws ParseException
ParseException
public void setDirectives(java.util.Hashtable directives)
public Directive getDirective(java.lang.String directive)
public boolean isDirective(java.lang.String directive)
private java.lang.String escapedDirective(java.lang.String strImage)
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 NumberLiteral() 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 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
private final boolean jj_2_1(int xla)
private final boolean jj_2_2(int xla)
private final boolean jj_2_3(int xla)
private final boolean jj_2_4(int xla)
private final boolean jj_2_5(int xla)
private final boolean jj_2_6(int xla)
private final boolean jj_2_7(int xla)
private final boolean jj_2_8(int xla)
private final boolean jj_2_9(int xla)
private final boolean jj_2_10(int xla)
private final boolean jj_2_11(int xla)
private final boolean jj_3R_54()
private final boolean jj_3R_24()
private final boolean jj_3R_41()
private final boolean jj_3_4()
private final boolean jj_3R_38()
private final boolean jj_3R_29()
private final boolean jj_3R_32()
private final boolean jj_3R_30()
private final boolean jj_3R_37()
private final boolean jj_3_2()
private final boolean jj_3R_28()
private final boolean jj_3R_36()
private final boolean jj_3_9()
private final boolean jj_3R_82()
private final boolean jj_3R_23()
private final boolean jj_3_7()
private final boolean jj_3R_27()
private final boolean jj_3R_58()
private final boolean jj_3R_35()
private final boolean jj_3R_57()
private final boolean jj_3_8()
private final boolean jj_3R_51()
private final boolean jj_3_6()
private final boolean jj_3R_40()
private final boolean jj_3R_22()
private final boolean jj_3_11()
private final boolean jj_3R_26()
private final boolean jj_3R_39()
private final boolean jj_3_1()
private final boolean jj_3R_81()
private final boolean jj_3R_19()
private final boolean jj_3R_80()
private final boolean jj_3R_33()
private final boolean jj_3R_79()
private final boolean jj_3R_78()
private final boolean jj_3R_77()
private final boolean jj_3R_76()
private final boolean jj_3R_21()
private final boolean jj_3_5()
private final boolean jj_3R_75()
private final boolean jj_3R_31()
private final boolean jj_3R_74()
private final boolean jj_3R_73()
private final boolean jj_3R_60()
private final boolean jj_3R_85()
private final boolean jj_3R_72()
private final boolean jj_3R_71()
private final boolean jj_3R_83()
private final boolean jj_3R_70()
private final boolean jj_3R_69()
private final boolean jj_3R_34()
private final boolean jj_3_10()
private final boolean jj_3R_52()
private final boolean jj_3R_68()
private final boolean jj_3R_67()
private final boolean jj_3R_66()
private final boolean jj_3R_20()
private final boolean jj_3R_87()
private final boolean jj_3R_89()
private final boolean jj_3R_63()
private final boolean jj_3R_65()
private final boolean jj_3R_59()
private final boolean jj_3R_61()
private final boolean jj_3_3()
private final boolean jj_3R_49()
private final boolean jj_3R_88()
private final boolean jj_3R_86()
private final boolean jj_3R_48()
private final boolean jj_3R_84()
private final boolean jj_3R_62()
private final boolean jj_3R_64()
private final boolean jj_3R_47()
private final boolean jj_3R_55()
private final boolean jj_3R_46()
private final boolean jj_3R_45()
private final boolean jj_3R_56()
private final boolean jj_3R_44()
private final boolean jj_3R_43()
private final boolean jj_3R_42()
private final boolean jj_3R_25()
private final boolean jj_3R_53()
private final boolean jj_3R_50()
public void ReInit(CharStream stream)
public void ReInit(ParserTokenManager tm)
private final Token jj_consume_token(int kind) throws ParseException
ParseException
private final boolean jj_scan_token(int kind)
public final Token getNextToken()
public final Token getToken(int index)
private final int jj_ntk()
private void jj_add_error_token(int kind, int pos)
public final ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
private final void jj_rescan_token()
private final void jj_save(int index, int xla)
Copyright ? 2002 Apache Software Foundation. All Rights Reserved.