Class PeekOPToken
java.lang.Object
com.tangosol.coherence.dsltools.precedence.OPToken
com.tangosol.coherence.dsltools.precedence.PeekOPToken
- Direct Known Subclasses:
SQLPeekOPToken
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 Summary
Modifier and TypeFieldDescriptionFields 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
ConstructorDescriptionPeekOPToken
(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
Modifier and TypeMethodDescriptionvoid
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) getOPToken
(String sId) Obtain theOPToken
that is mapped to the specified identifier.Process this token and possibly the given leftNodein the context of a parser with the left denotation.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
-
Field Details
-
f_mapTokens
-
-
Constructor Details
-
PeekOPToken
Construct a new PeekOPToken with the given parameters.- Parameters:
sId
- string representation of the tokentokens
- the tokens to defer to
-
PeekOPToken
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
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
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 Details
-
addOPToken
-
addOPToken
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
Obtain theOPToken
that is mapped to the specified identifier. -
defaultNud
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
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
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
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 -
findMatchingOPToken
- 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.
-