org.apache.commons.jexl3.parser
Class JexlParser

java.lang.Object
  extended by org.apache.commons.jexl3.parser.StringParser
      extended by org.apache.commons.jexl3.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
protected  JexlEngine.Scope frame
          The map of named registers aka script parameters.
 
Constructor Summary
JexlParser()
           
 
Method Summary
 String checkVariable(ASTIdentifier identifier, String image)
          Checks whether an identifier is a local variable or argument, ie stored in a register.
 void declareVariable(ASTVar identifier, 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.jexl3.parser.StringParser
buildString, escapeString, readString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 String checkVariable(ASTIdentifier identifier,
                            String image)
Checks whether an identifier is a local variable or argument, ie stored in a register.

Parameters:
identifier - the identifier
image - the identifier image
Returns:
the image

declareVariable

public void declareVariable(ASTVar identifier,
                            String image)
Declares a local variable.

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

Parameters:
identifier - the identifier used to declare
image - 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

getToken

public Token getToken(int index)


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.