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 otherOPToken
instances. It will defer calls to thenud(OPParser)
andled(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 Summary
Fields Modifier and Type Field Description protected Map<String,OPToken>
f_mapTokens
-
Fields inherited from class com.tangosol.coherence.dsltools.precedence.OPToken
BINARY_OPERATOR_NODE, BINDING_NODE, CALL_NODE, DEREF_NODE, FIELD_LIST, IDENTIFIER_NODE, LIST_NODE, LITERAL_NODE, m_nBindingPower, m_sLedASTName, m_sNudASTName, m_sValue, PRECEDENCE_ASSIGNMENT, PRECEDENCE_BITWISE, PRECEDENCE_EXPONENT, PRECEDENCE_IDENTIFIER, PRECEDENCE_KEYWORD, PRECEDENCE_LOGICAL, PRECEDENCE_LOGICAL_BITWISE, PRECEDENCE_PARENTHESES, PRECEDENCE_PRODUCT, PRECEDENCE_RELATIONAL, PRECEDENCE_SUM, PRECEDENCE_UNARY, PRECEDENCE_UNARY_POST, UNARY_OPERATOR_NODE
-
-
Constructor Summary
Constructors Constructor Description PeekOPToken(String sId, int nBindingPower, OPToken... tokens)
Construct a new PeekOPToken with the given parameters.PeekOPToken(String sId, int nBindingPower, String sASTName, OPToken... tokens)
Construct a new PeekOPToken with the given parameters.PeekOPToken(String sId, int nBindingPower, String sLedASTName, String sNudASTName, OPToken... aTokens)
Construct a new PeekOPToken with the given parameters.PeekOPToken(String sId, OPToken... tokens)
Construct a new PeekOPToken with the given parameters.PeekOPToken(String sId, String sASTName, OPToken... tokens)
Construct a new PeekOPToken with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOPToken(OPToken token)
void
addOPToken(String id, OPToken token)
protected Term
defaultLed(OPParser parser, Term leftNode)
The default led method that will be called if there is noOPToken
mapped for the token parsed from the token stream.protected Term
defaultNud(OPParser parser)
The default nud method that will be called if there is noOPToken
mapped for the token parsed from the token stream.protected OPToken
findMatchingOPToken(OPParser parser)
OPToken
getOPToken(String sId)
Obtain theOPToken
that is mapped to the specified identifier.Term
led(OPParser parser, Term leftNode)
Process this token and possibly the given leftNodein the context of a parser with the left denotation.Term
nud(OPParser parser)
Process this token in the context of parser p with the null denotation.-
Methods inherited from class com.tangosol.coherence.dsltools.precedence.OPToken
equals, getBindingPower, getId, getLedASTName, getNudASTName, getValue, hashCode, leftBindingPower, newAST, newAST, newAST, newAST, newAST, setBindingPower, setId, setLedASTName, setNudASTName, setValue, toString
-
-
-
-
Constructor Detail
-
PeekOPToken
public PeekOPToken(String sId, OPToken... tokens)
Construct a new PeekOPToken with the given parameters.- Parameters:
sId
- string representation of the tokentokens
- 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 tokennBindingPower
- the precedence binding power of this tokentokens
- 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 tokensASTName
- the type code for this tokentokens
- 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 tokennBindingPower
- the precedence binding power of this tokensASTName
- the type code for this tokentokens
- 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 tokennBindingPower
- the precedence binding power of this tokensLedASTName
- the name for this tokens ASTsNudASTName
- the name for this tokens ASTaTokens
- the tokens to defer to
-
-
Method Detail
-
addOPToken
public void addOPToken(OPToken token)
-
addOPToken
public void addOPToken(String id, OPToken token)
Add the specifiedOPToken
to theMap
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 streamtoken
- theOPToken
to call if the next token in the stream matches the specified identifier
-
getOPToken
public OPToken getOPToken(String sId)
Obtain theOPToken
that is mapped to the specified identifier.
-
defaultNud
protected Term defaultNud(OPParser parser)
The default nud method that will be called if there is noOPToken
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 noOPToken
mapped for the token parsed from the token stream. This method may be overridden in sub-classes that require different default processing to the defaultOPToken.led(OPParser, Term)
method.- Parameters:
parser
- the current token stream's parserleftNode
- 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
-
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
-
-