Top Description Fields Constructors Methods
org.apache.commons.jexl2.parser

public Class JexlParser

extends StringParser
Class Inheritance
Known Direct Subclasses
org.apache.commons.jexl2.parser.Parser
Imports
org.apache.commons.jexl2.DebugInfo, .JexlEngine, .JexlException

The base class for parsing, manages the parameter/local variable frame.
Author
henri

Field Summary

Modifier and TypeField and Description
protected JexlEngine.Scope
frame

The map of named registers aka script parameters.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the image
checkVariable
(ASTIdentifier
the identifier
identifier
,
String
the identifier image
image
)

Checks whether an identifier is a local variable or argument, ie stored in a register.

public void
declareVariable(ASTVar
the identifier used to declare
identifier
,
String
the variable name
image
)

Declares a local variable.

public JexlEngine.Scope

Returns:

the named register map
getFrame
()

Gets the frame used by this parser.

public Token
getToken(int index)

public void
Identifier(boolean
whether the identifier is beginning an l/r value
top
)

Default implementation does nothing but is overriden by generated code.

public final void
pack-priv void
jjtreeCloseNodeScope(JexlNode
the node
n
)

Ambiguous statement detector.

pack-priv void
public void
setFrame(JexlEngine.Scope
the register map
theFrame
)

Sets the frame to use bythis parser.

Inherited from org.apache.commons.jexl2.parser.StringParser:
buildStringescapeStringreadString

Field Detail

frameback to summary
protected JexlEngine.Scope frame

The map of named registers aka script parameters. Each parameter is associated to a register and is materialized as an offset in the registers array used during evaluation.

Constructor Detail

JexlParserback to summary
public JexlParser()

Method Detail

checkVariableback to summary
public String checkVariable(ASTIdentifier identifier, String image)

Checks whether an identifier is a local variable or argument, ie stored in a register.

Parameters
identifier:ASTIdentifier

the identifier

image:String

the identifier image

Returns:String

the image

declareVariableback to summary
public void declareVariable(ASTVar identifier, String image)

Declares a local variable.

This method creates an new entry in the named register map.

Parameters
identifier:ASTVar

the identifier used to declare

image:String

the variable name

getFrameback to summary
public JexlEngine.Scope getFrame()

Gets the frame used by this parser.

Since local variables create new named registers, it is important to regain access after parsing to known which / how-many registers are needed.

Returns:JexlEngine.Scope

the named register map

getTokenback to summary
public Token getToken(int index)
Identifierback to summary
public void Identifier(boolean top) throws ParseException

Default implementation does nothing but is overriden by generated code.

Parameters
top:boolean

whether the identifier is beginning an l/r value

Exceptions
ParseException:
subclasses may throw this
Identifierback to summary
public final void Identifier() throws ParseException
jjtreeCloseNodeScopeback to summary
pack-priv void jjtreeCloseNodeScope(JexlNode n) throws ParseException

Ambiguous statement detector.

Parameters
n:JexlNode

the node

jjtreeOpenNodeScopeback to summary
pack-priv void jjtreeOpenNodeScope(JexlNode n)
setFrameback to summary
public void setFrame(JexlEngine.Scope theFrame)

Sets the frame to use bythis parser.

This is used to allow parameters to be declared before parsing.

Parameters
theFrame:JexlEngine.Scope

the register map