Class JexlParser

  • Direct Known Subclasses:
    Parser

    public class JexlParser
    extends StringParser
    The base class for parsing, manages the parameter/local variable frame.
    Author:
    henri
    • 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.
    • 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 identifier
        image - 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 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