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 abstract class JexlParser
extends StringParser

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


Constructor Summary
JexlParser()
           
 
Method Summary
 void allowRegisters(boolean registers)
          Internal, for debug purpose only.
 String checkVariable(ASTIdentifier identifier, String image)
          Checks whether an identifier is a local variable or argument, ie a symbol, stored in a register.
 void declareParameter(String identifier)
          Declares a local parameter.
 void declarePragma(String key, Object value)
          Adds a pragma declaration.
 void declareVariable(ASTVar identifier, String image)
          Declares a local variable.
 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 popFrame()
          Pops back to previous local variable frame.
 void pushFrame()
          Create a new local variable frame and push it as current scope.
 void setFrame(Scope theFrame)
          Sets the frame to use by this parser.
protected  void throwParsingException(JexlNode node)
          Throws a parsing exception.
 
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
 

Constructor Detail

JexlParser

public JexlParser()
Method Detail

allowRegisters

public void allowRegisters(boolean registers)
Internal, for debug purpose only.


setFrame

public void setFrame(Scope theFrame)
Sets the frame to use by this parser.

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

Parameters:
theFrame - the register map

getFrame

public Scope getFrame()
Gets the frame used by this parser.

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

Returns:
the named register map

pushFrame

public void pushFrame()
Create a new local variable frame and push it as current scope.


popFrame

public void popFrame()
Pops back to previous local variable frame.


checkVariable

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

Parameters:
identifier - the identifier used to declare
image - the variable name

declarePragma

public void declarePragma(String key,
                          Object value)
Adds a pragma declaration.

Parameters:
key - the pragma key
value - the pragma value

declareParameter

public void declareParameter(String identifier)
Declares a local parameter.

This method creates an new entry in the symbol map.

Parameters:
identifier - the parameter 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)

throwParsingException

protected void throwParsingException(JexlNode node)
Throws a parsing exception.

Parameters:
node - the node that caused it


Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.