freemarker.core

Class FMParser

Implemented Interfaces:
freemarker.core.FMParserConstants

public class FMParser
extends java.lang.Object
implements freemarker.core.FMParserConstants

This class is generated by JavaCC from a grammar file.

Field Summary

freemarker.core.Token
jj_nt
Next token.
freemarker.core.Token
token
Current token.
freemarker.core.FMParserTokenManager
token_source
Generated Token Manager.

Fields inherited from interface freemarker.core.FMParserConstants

AND, AS, ASSIGN, ATTEMPT, BLANK, BREAK, BUILT_IN, CALL, CASE, CLOSE_BRACE, CLOSE_BRACKET, CLOSE_PAREN, CLOSE_TAG1, CLOSE_TAG2, COLON, COMMA, COMMENT, COMPRESS, DECIMAL, DEFAUL, DEFAULT, DIGIT, DIRECTIVE_END, DIVIDE, DOT, DOT_DOT, DOUBLE_EQUALS, DOUBLE_STAR, ELLIPSIS, ELSE, ELSE_IF, EMPTY_DIRECTIVE_END, END_ASSIGN, END_ATTEMPT, END_COMPRESS, END_ESCAPE, END_FOREACH, END_FUNCTION, END_GLOBAL, END_IF, END_LIST, END_LOCAL, END_MACRO, END_NOESCAPE, END_RECOVER, END_SWITCH, END_TAG, END_TRANSFORM, EOF, EQUALS, ESCAPE, ESCAPED_CHAR, ESCAPED_GT, ESCAPED_GTE, EXCLAM, EXISTS, EXPRESSION_COMMENT, FALLBACK, FALSE, FALSE_ALERT, FLUSH, FM_EXPRESSION, FOREACH, FTL_HEADER, FUNCTION, GLOBALASSIGN, HALT, ID, IF, IMPORT, IN, INCLUDE, INTEGER, IN_PAREN, KEEP_GOING, LESS_THAN, LESS_THAN_EQUALS, LETTER, LIST, LOCALASSIGN, LONE_LESS_THAN_OR_DASH, LTRIM, MACRO, MAYBE_END, MINUS, NAMED_PARAMETER_EXPRESSION, NATURAL_GT, NATURAL_GTE, NESTED, NODIRECTIVE, NOESCAPE, NOPARSE, NOTRIM, NOT_EQUALS, NO_PARSE, NO_SPACE_EXPRESSION, NUMERICAL_ESCAPE, OPEN_BRACE, OPEN_BRACKET, OPEN_PAREN, OR, OUTPUT_ESCAPE, PERCENT, PLUS, PRINTABLE_CHARS, RAW_STRING, RECOVER, RECURSE, RETURN, RTRIM, SEMICOLON, SETTING, SIMPLE_NESTED, SIMPLE_RECURSE, SIMPLE_RETURN, START_TAG, STOP, STRING_LITERAL, SWITCH, TERMINATING_EXCLAM, TERMINATING_WHITESPACE, TERSE_COMMENT, TERSE_COMMENT_END, TIMES, TRANSFORM, TRIM, TRIVIAL_FTL_HEADER, TRUE, UNIFIED_CALL, UNIFIED_CALL_END, UNKNOWN_DIRECTIVE, USING, VISIT, WHITESPACE, tokenImage

Constructor Summary

FMParser(String template)
FMParser(freemarker.core.FMParserTokenManager tm)
Constructor with generated Token Manager.
FMParser(Template template, Reader reader, boolean strictEscapeSyntax, boolean stripWhitespace)
Constructs a new parser object.
FMParser(Template template, Reader reader, boolean strictEscapeSyntax, boolean stripWhitespace, int tagSyntax)
FMParser(java.io.InputStream stream)
Constructor with InputStream.
FMParser(java.io.InputStream stream, String encoding)
Constructor with InputStream and supplied encoding
FMParser(java.io.Reader stream)
Constructor.

Method Summary

Expression
AddSubExpression(Expression exp)
Production that builds up an expression using the dot or dynamic key name or the args list if this is a method invocation.
Expression
AdditiveExpression()
Expression
AndExpression()
TemplateElement
Assign()
freemarker.core.AttemptBlock
Attempt()
Expression
BooleanLiteral()
freemarker.core.BreakInstruction
Break()
Production used to break out of a loop or a switch block.
Expression
BuiltIn(Expression exp)
freemarker.core.BuiltinVariable
BuiltinVariable()
TemplateElement
Call()
freemarker.core.Case
Case()
Comment
Comment()
freemarker.core.CompressedBlock
Compress()
TemplateElement
Content()
Expression
DefaultTo(Expression exp)
Expression
DotVariable(Expression exp)
production for when a key is specified by + keyname
Expression
DynamicKey(Expression exp)
production for when the key is specified in brackets.
Expression
EqualityExpression()
freemarker.core.EscapeBlock
Escape()
Expression
Exists(Expression exp)
Expression
Expression()
This is the same as OrExpression, since the OR is the operator with the lowest precedence.
freemarker.core.FallbackInstruction
FallBack()
TemplateElement
Flush()
freemarker.core.IteratorBlock
ForEach()
TemplateElement
FreeMarkerText()
A production freemarker text that may contain ${...} and #{...} but no directives.
TemplateElement
FreemarkerDirective()
A production for FreeMarker directives.
freemarker.core.HashLiteral
HashLiteral()
void
HeaderElement()
freemarker.core.Identifier
Identifier()
Expression
IdentifierOrStringLiteral()
TemplateElement
If()
LibraryLoad
Import()
freemarker.core.Include
Include()
freemarker.core.IteratorBlock
List()
freemarker.core.ListLiteral
ListLiteral()
freemarker.core.Token
LooseDirectiveEnd()
Production to terminate potentially empty elements.
Macro
Macro()
freemarker.core.MethodCall
MethodArgs(Expression exp)
production for an arglist part of a method invocation.
Expression
MultiplicativeExpression()
A unary expression followed by zero or more unary expressions with operators in between.
HashMap
NamedArgs()
TemplateElement
Nested()
freemarker.core.NoEscapeBlock
NoEscape()
TextBlock
NoParse()
Expression
NotExpression()
Expression
NumberLiteral()
freemarker.core.NumericalOutput
NumericalOutput()
TemplateElement
OptionalBlock()
A production for a block of optional content.
Expression
OrExpression()
TextBlock
PCData()
Production for a block of raw text i.e.
Map
ParamList()
Expression
Parenthesis()
ArrayList
PositionalArgs()
Expression
PrimaryExpression()
Lowest level expression, a literal, a variable, or a possibly more complex expression bounded by parentheses.
Expression
RangeExpression()
void
ReInit(freemarker.core.FMParserTokenManager tm)
Reinitialise.
void
ReInit(java.io.InputStream stream)
Reinitialise.
void
ReInit(java.io.InputStream stream, String encoding)
Reinitialise.
void
ReInit(java.io.Reader stream)
Reinitialise.
freemarker.core.RecoveryBlock
Recover()
freemarker.core.RecurseNode
Recurse()
Expression
RelationalExpression()
ReturnInstruction
Return()
Production used to jump out of a macro.
TemplateElement
Root()
Root production to be used when parsing an entire file.
freemarker.core.PropertySetting
Setting()
freemarker.core.StopInstruction
Stop()
freemarker.core.StringLiteral
StringLiteral(boolean interpolate)
freemarker.core.DollarVariable
StringOutput()
A production representing the ${...} that outputs a variable.
freemarker.core.SwitchBlock
Switch()
freemarker.core.TransformBlock
Transform()
TemplateElement
Trim()
Expression
UnaryExpression()
A primary expression preceded by zero or more unary operators.
Expression
UnaryPlusMinusExpression()
TemplateElement
UnifiedMacroTransform()
freemarker.core.Token
UnparsedContent(StringBuffer buf)
Production for dealing with unparsed content, i.e.
freemarker.core.VisitNode
Visit()
static FMParser
createExpressionParser(String s)
Create an FM expression parser using a string.
void
disable_tracing()
Disable tracing.
void
enable_tracing()
Enable tracing.
ParseException
generateParseException()
Generate ParseException.
freemarker.core.Token
getNextToken()
Get the next Token.
freemarker.core.Token
getToken(int index)
Get the specific Token.

Field Details

jj_nt

public freemarker.core.Token jj_nt
Next token.

token

public freemarker.core.Token token
Current token.

token_source

public freemarker.core.FMParserTokenManager token_source
Generated Token Manager.

Constructor Details

FMParser

public FMParser(String template)

FMParser

public FMParser(freemarker.core.FMParserTokenManager tm)
Constructor with generated Token Manager.

FMParser

public FMParser(Template template,
                Reader reader,
                boolean strictEscapeSyntax,
                boolean stripWhitespace)
Constructs a new parser object.
Parameters:
template - The template associated with this parser.
reader - The character stream to use as input
strictEscapeSyntax - Whether FreeMarker directives must start with a #

FMParser

public FMParser(Template template,
                Reader reader,
                boolean strictEscapeSyntax,
                boolean stripWhitespace,
                int tagSyntax)

FMParser

public FMParser(java.io.InputStream stream)
Constructor with InputStream.

FMParser

public FMParser(java.io.InputStream stream,
                String encoding)
Constructor with InputStream and supplied encoding

FMParser

public FMParser(java.io.Reader stream)
Constructor.

Method Details

AddSubExpression

public final Expression AddSubExpression(Expression exp)
            throws ParseException
Production that builds up an expression using the dot or dynamic key name or the args list if this is a method invocation.

AdditiveExpression

public final Expression AdditiveExpression()
            throws ParseException

AndExpression

public final Expression AndExpression()
            throws ParseException

Assign

public final TemplateElement Assign()
            throws ParseException

Attempt

public final freemarker.core.AttemptBlock Attempt()
            throws ParseException

BooleanLiteral

public final Expression BooleanLiteral()
            throws ParseException

Break

public final freemarker.core.BreakInstruction Break()
            throws ParseException
Production used to break out of a loop or a switch block.

BuiltIn

public final Expression BuiltIn(Expression exp)
            throws ParseException

BuiltinVariable

public final freemarker.core.BuiltinVariable BuiltinVariable()
            throws ParseException

Call

public final TemplateElement Call()
            throws ParseException

Case

public final freemarker.core.Case Case()
            throws ParseException

Comment

public final Comment Comment()
            throws ParseException

Compress

public final freemarker.core.CompressedBlock Compress()
            throws ParseException

Content

public final TemplateElement Content()
            throws ParseException

DefaultTo

public final Expression DefaultTo(Expression exp)
            throws ParseException

DotVariable

public final Expression DotVariable(Expression exp)
            throws ParseException
production for when a key is specified by + keyname

DynamicKey

public final Expression DynamicKey(Expression exp)
            throws ParseException
production for when the key is specified in brackets.

EqualityExpression

public final Expression EqualityExpression()
            throws ParseException

Escape

public final freemarker.core.EscapeBlock Escape()
            throws ParseException

Exists

public final Expression Exists(Expression exp)
            throws ParseException

Expression

public final Expression Expression()
            throws ParseException
This is the same as OrExpression, since the OR is the operator with the lowest precedence.

FallBack

public final freemarker.core.FallbackInstruction FallBack()
            throws ParseException

Flush

public final TemplateElement Flush()
            throws ParseException

ForEach

public final freemarker.core.IteratorBlock ForEach()
            throws ParseException

FreeMarkerText

public final TemplateElement FreeMarkerText()
            throws ParseException
A production freemarker text that may contain ${...} and #{...} but no directives.

FreemarkerDirective

public final TemplateElement FreemarkerDirective()
            throws ParseException
A production for FreeMarker directives.

HashLiteral

public final freemarker.core.HashLiteral HashLiteral()
            throws ParseException

HeaderElement

public final void HeaderElement()
            throws ParseException

Identifier

public final freemarker.core.Identifier Identifier()
            throws ParseException

IdentifierOrStringLiteral

public final Expression IdentifierOrStringLiteral()
            throws ParseException

If

public final TemplateElement If()
            throws ParseException

Import

public final LibraryLoad Import()
            throws ParseException

Include

public final freemarker.core.Include Include()
            throws ParseException

List

public final freemarker.core.IteratorBlock List()
            throws ParseException

ListLiteral

public final freemarker.core.ListLiteral ListLiteral()
            throws ParseException

LooseDirectiveEnd

public final freemarker.core.Token LooseDirectiveEnd()
            throws ParseException
Production to terminate potentially empty elements. Either a ">" or "/>"

Macro

public final Macro Macro()
            throws ParseException

MethodArgs

public final freemarker.core.MethodCall MethodArgs(Expression exp)
            throws ParseException
production for an arglist part of a method invocation.

MultiplicativeExpression

public final Expression MultiplicativeExpression()
            throws ParseException
A unary expression followed by zero or more unary expressions with operators in between.

NamedArgs

public final HashMap NamedArgs()
            throws ParseException

Nested

public final TemplateElement Nested()
            throws ParseException

NoEscape

public final freemarker.core.NoEscapeBlock NoEscape()
            throws ParseException

NoParse

public final TextBlock NoParse()
            throws ParseException

NotExpression

public final Expression NotExpression()
            throws ParseException

NumberLiteral

public final Expression NumberLiteral()
            throws ParseException

NumericalOutput

public final freemarker.core.NumericalOutput NumericalOutput()
            throws ParseException

OptionalBlock

public final TemplateElement OptionalBlock()
            throws ParseException
A production for a block of optional content. Returns an empty Text block if there is no content.

OrExpression

public final Expression OrExpression()
            throws ParseException

PCData

public final TextBlock PCData()
            throws ParseException
Production for a block of raw text i.e. text that contains no FreeMarker directives.

ParamList

public final Map ParamList()
            throws ParseException

Parenthesis

public final Expression Parenthesis()
            throws ParseException

PositionalArgs

public final ArrayList PositionalArgs()
            throws ParseException

PrimaryExpression

public final Expression PrimaryExpression()
            throws ParseException
Lowest level expression, a literal, a variable, or a possibly more complex expression bounded by parentheses.

RangeExpression

public final Expression RangeExpression()
            throws ParseException

ReInit

public void ReInit(freemarker.core.FMParserTokenManager tm)
Reinitialise.

ReInit

public void ReInit(java.io.InputStream stream)
Reinitialise.

ReInit

public void ReInit(java.io.InputStream stream,
                   String encoding)
Reinitialise.

ReInit

public void ReInit(java.io.Reader stream)
Reinitialise.

Recover

public final freemarker.core.RecoveryBlock Recover()
            throws ParseException

Recurse

public final freemarker.core.RecurseNode Recurse()
            throws ParseException

RelationalExpression

public final Expression RelationalExpression()
            throws ParseException

Return

public final ReturnInstruction Return()
            throws ParseException
Production used to jump out of a macro. The stop instruction terminates the rendering of the template.

Root

public final TemplateElement Root()
            throws ParseException
Root production to be used when parsing an entire file.

Setting

public final freemarker.core.PropertySetting Setting()
            throws ParseException

Stop

public final freemarker.core.StopInstruction Stop()
            throws ParseException

StringLiteral

public final freemarker.core.StringLiteral StringLiteral(boolean interpolate)
            throws ParseException

StringOutput

public final freemarker.core.DollarVariable StringOutput()
            throws ParseException
A production representing the ${...} that outputs a variable.

Switch

public final freemarker.core.SwitchBlock Switch()
            throws ParseException

Transform

public final freemarker.core.TransformBlock Transform()
            throws ParseException

Trim

public final TemplateElement Trim()
            throws ParseException

UnaryExpression

public final Expression UnaryExpression()
            throws ParseException
A primary expression preceded by zero or more unary operators. (The only unary operator we currently have is the NOT.)

UnaryPlusMinusExpression

public final Expression UnaryPlusMinusExpression()
            throws ParseException

UnifiedMacroTransform

public final TemplateElement UnifiedMacroTransform()
            throws ParseException

UnparsedContent

public final freemarker.core.Token UnparsedContent(StringBuffer buf)
            throws ParseException
Production for dealing with unparsed content, i.e. what is inside a comment or noparse tag. It returns the ending token. The content of the tag is put in buf.

Visit

public final freemarker.core.VisitNode Visit()
            throws ParseException

createExpressionParser

public static FMParser createExpressionParser(String s)
Create an FM expression parser using a string.

disable_tracing

public final void disable_tracing()
Disable tracing.

enable_tracing

public final void enable_tracing()
Enable tracing.

generateParseException

public ParseException generateParseException()
Generate ParseException.

getNextToken

public final freemarker.core.Token getNextToken()
Get the next Token.

getToken

public final freemarker.core.Token getToken(int index)
Get the specific Token.