Package org.apache.commons.jexl2.parser
Class JexlParser
- java.lang.Object
-
- org.apache.commons.jexl2.parser.StringParser
-
- org.apache.commons.jexl2.parser.JexlParser
-
- Direct Known Subclasses:
Parser
public class JexlParser extends StringParser
The base class for parsing, manages the parameter/local variable frame.- Author:
- henri
-
-
Field Summary
Fields Modifier and Type Field Description protected JexlEngine.Scope
frame
The map of named registers aka script parameters.
-
Constructor Summary
Constructors Constructor Description JexlParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
checkVariable(ASTIdentifier identifier, java.lang.String image)
Checks whether an identifier is a local variable or argument, ie stored in a register.void
declareVariable(ASTVar identifier, java.lang.String image)
Declares a local variable.JexlEngine.Scope
getFrame()
Gets the frame used by this parser.Token
getToken(int index)
void
Identifier()
void
Identifier(boolean top)
Default implementation does nothing but is overriden by generated code.void
setFrame(JexlEngine.Scope theFrame)
Sets the frame to use bythis parser.-
Methods inherited from class org.apache.commons.jexl2.parser.StringParser
buildString, escapeString, readString
-
-
-
-
Field Detail
-
frame
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
-
JexlParser
public JexlParser()
-
-
Method Detail
-
setFrame
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
- the register map
-
getFrame
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:
- the named register map
-
checkVariable
public java.lang.String checkVariable(ASTIdentifier identifier, java.lang.String image)
Checks whether an identifier is a local variable or argument, ie stored in a register.- Parameters:
identifier
- the identifierimage
- the identifier image- Returns:
- the image
-
declareVariable
public void declareVariable(ASTVar identifier, java.lang.String image)
Declares a local variable.This method creates an new entry in the named register map.
- Parameters:
identifier
- the identifier used to declareimage
- the variable name
-
Identifier
public void Identifier(boolean top) throws ParseException
Default implementation does nothing but is overriden by generated code.- Parameters:
top
- whether the identifier is beginning an l/r value- Throws:
ParseException
- subclasses may throw this
-
Identifier
public final void Identifier() throws ParseException
- Throws:
ParseException
-
-