Class PeekOPToken

java.lang.Object
com.tangosol.coherence.dsltools.precedence.OPToken
com.tangosol.coherence.dsltools.precedence.PeekOPToken
Direct Known Subclasses:
SQLPeekOPToken

public class PeekOPToken extends OPToken
A PeekOPToken is a token that contains other OPToken instances. It will defer calls to the nud(OPParser) and led(OPParser, Term) methods to these other tokens. The exact instance of the OPToken deferred to will be determined by looking ahead at the next token in the token stream and calling the contained OPToken with that id.
Since:
Coherence 12.2.1
Author:
jk 2014.02.12
  • Field Details

    • f_mapTokens

      protected final Map<String,OPToken> f_mapTokens
      The Map of OPToken instances that will be called depending on the value of the next token in the stream.
  • Constructor Details

    • PeekOPToken

      public PeekOPToken(String sId, OPToken... tokens)
      Construct a new PeekOPToken with the given parameters.
      Parameters:
      sId - string representation of the token
      tokens - the tokens to defer to
    • PeekOPToken

      public PeekOPToken(String sId, int nBindingPower, OPToken... tokens)
      Construct a new PeekOPToken with the given parameters.
      Parameters:
      sId - string representation of the token
      nBindingPower - the precedence binding power of this token
      tokens - the tokens to defer to
    • PeekOPToken

      public PeekOPToken(String sId, String sASTName, OPToken... tokens)
      Construct a new PeekOPToken with the given parameters.
      Parameters:
      sId - string representation of the token
      sASTName - the type code for this token
      tokens - the tokens to defer to
    • PeekOPToken

      public PeekOPToken(String sId, int nBindingPower, String sASTName, OPToken... tokens)
      Construct a new PeekOPToken with the given parameters.
      Parameters:
      sId - string representation of the token
      nBindingPower - the precedence binding power of this token
      sASTName - the type code for this token
      tokens - the tokens to defer to
    • PeekOPToken

      public PeekOPToken(String sId, int nBindingPower, String sLedASTName, String sNudASTName, OPToken... aTokens)
      Construct a new PeekOPToken with the given parameters.
      Parameters:
      sId - string representation of the token
      nBindingPower - the precedence binding power of this token
      sLedASTName - the name for this tokens AST
      sNudASTName - the name for this tokens AST
      aTokens - the tokens to defer to
  • Method Details

    • addOPToken

      public void addOPToken(OPToken token)
      Add the specified OPToken to the Map of tokens that will be called depending on the next token parsed from the token stream.
      Parameters:
      token - the OPToken to call if the next token in the stream matches the specified OPTokens identifier
    • addOPToken

      public void addOPToken(String id, OPToken token)
      Add the specified OPToken to the Map of tokens that will be called depending on the next token parsed from the token stream.
      Parameters:
      id - the identifier to match with the next token in the stream
      token - the OPToken to call if the next token in the stream matches the specified identifier
    • getOPToken

      public OPToken getOPToken(String sId)
      Obtain the OPToken that is mapped to the specified identifier.
      Parameters:
      sId - the identifier to obtain the mapped OPToken for
      Returns:
      the OPToken mapped to the specified identifier
    • defaultNud

      protected Term defaultNud(OPParser parser)
      The default nud method that will be called if there is no OPToken mapped for the token parsed from the token stream.

      This method may be overridden in sub-classes that require different default processing to the default OPToken.nud(OPParser) method.

      Parameters:
      parser - the current token stream's parser
      Returns:
      the result of calling the default nud method
    • defaultLed

      protected Term defaultLed(OPParser parser, Term leftNode)
      The default led method that will be called if there is no OPToken mapped for the token parsed from the token stream. This method may be overridden in sub-classes that require different default processing to the default OPToken.led(OPParser, Term) method.
      Parameters:
      parser - the current token stream's parser
      leftNode - the left node of the current AST
      Returns:
      the result of calling the default led method
    • nud

      public Term nud(OPParser parser)
      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:
      parser - the parser that is the context for parsing
      Returns:
      an AstNode
    • led

      public Term led(OPParser parser, 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:
      parser - the parser that is the context for parsing
      leftNode - an ast Term that the token is possibly interested in
      Returns:
      an AstNode
    • findMatchingOPToken

      protected OPToken findMatchingOPToken(OPParser parser)
      Return the OPToken mapped to the next token in the OPParser's token stream.
      Parameters:
      parser - the OPParser providing the token stream
      Returns:
      the OPToken matching the next token in the stream or null if there is no OPToken mapped to the next token in the stream.