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.
author: Jason van Zyl author: Geir Magnusson Jr. author: Henning P. Schmiedehausen version: $Id: Parser.java 463419 2006-10-12 20:39:49Z henning $
Parser(RuntimeServices rs) This constructor was added to allow the re-use of parsers.
The normal constructor takes a single argument which
an InputStream.
Escape() Used to catch and process escape sequences in grammatical constructs
as escapes outside of VTL are just characters.
final public 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.
This constructor was added to allow the re-use of parsers.
The normal constructor takes a single argument which
an InputStream. This simply creates a re-usable parser
object, we satisfy the requirement of an InputStream
by using a newline character as an input stream.
Used 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 # and here we don't. We just want
the escapes to render correctly
used 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.
This method corresponds to variable
references in Velocity templates.
The following are examples of variable
references that may be found in a
template:
$foo
$bar
This method corresponds to the #stop
directive which just simulates and EOF
so that parsing stops. The #stop directive
is useful for end-user debugging
purposes.
This was also added to allow parsers to be
re-usable. Normal JavaCC use entails passing an
input stream to the constructor and the parsing
process is carried out once. We want to be able
to re-use parsers: we do this by adding this
method and re-initializing the lexer with
the new stream that we want parsed.
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