Class InfixOPToken

  • Direct Known Subclasses:
    LikeOPToken

    public class InfixOPToken
    extends OPToken
    InfixOPToken is used to implement infix operators. If enabled it will also do the right thing for unary operators such as + and - which are typically overloaded.
    Author:
    djl 2009.03.14
    • Field Detail

      • m_fPrefixAllowed

        protected boolean m_fPrefixAllowed
        Flag that control whether the operator can be used as a prefix.
    • Constructor Detail

      • InfixOPToken

        public InfixOPToken​(String sId,
                            int nBp)
        Construct a new InfixOPToken with the given parameters.
        Parameters:
        sId - string identifier for this token
        nBp - the binding power for this token
      • InfixOPToken

        public InfixOPToken​(String sId,
                            int nBp,
                            String sASTName)
        Construct a new InfixOPToken with the given parameters.
        Parameters:
        sId - string representation of the token
        nBp - the binding power for this token
        sASTName - the name for this tokens AST
      • InfixOPToken

        public InfixOPToken​(String sId,
                            int nBP,
                            String sLedASTName,
                            String sNudASTName)
        Construct a new InfixOPToken with the given parameters.
        Parameters:
        sId - string representation of the token
        nBP - the binding power for this token
        sLedASTName - the name for this tokens AST
        sNudASTName - the name for this tokens AST
    • Method Detail

      • led

        public Term led​(OPParser p,
                        Term leftNode)
        Process this token and possibly the given leftNodein the context of a parser with the left denotation. A led method typically will be interested t in the token to the left. The processing results in an Abstract Syntax Tree Node that captures the meaning
        Overrides:
        led in class OPToken
        Parameters:
        p - the parser that is the context for parsing
        leftNode - an ast Term that the token is possibly interested in
        Returns:
        an AstNode
      • nud

        public Term nud​(OPParser p)
        Process this token in the context of parser p with the null denotation. A nud method typically will have no interest in the token to the left. The processing results in an Abstract Syntax Tree Node that captures the meaning
        Overrides:
        nud in class OPToken
        Parameters:
        p - the parser that is the context for parsing
        Returns:
        an AstNode
      • isPrefixAllowed

        public boolean isPrefixAllowed()
        Get the flag that control whether the operator can be used as a prefix.
        Returns:
        the string representation
      • setPrefixAllowed

        public void setPrefixAllowed​(boolean fIsPrefix)
        Set the flag that control whether the operator may be used as a prefix.
        Parameters:
        fIsPrefix - the string representation for the token