public enum Operator extends Enum<Operator>
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
Operator.Associativity
Enum for an operator's associativity.
|
static class |
Operator.Operand
A syntax element for an operand.
|
static class |
Operator.Spacer
A syntax element for a space character.
|
static interface |
Operator.SyntaxElement
Represents a syntax element (used in a syntax specification for an operator).
|
static class |
Operator.Token
A syntax element for a token.
|
| Enum Constant and Description |
|---|
AND |
CONDITIONAL |
DIVIDE_BY |
EQUAL |
GREATER_THAN |
GREATER_THAN_OR_EQUAL |
LESS_THAN |
LESS_THAN_OR_EQUAL |
MINUS |
MOD |
NEGATIVE |
NOT |
NOT_EQUAL |
NULL_COALESCING |
OR |
PLUS |
TIMES |
| Modifier and Type | Method and Description |
|---|---|
abstract ExprNode.OperatorNode |
createNode(SourceLocation location)
Creates a node representing this operator.
|
ExprNode.OperatorNode |
createNode(SourceLocation location,
ExprNode... children)
Creates a node representing this operator, with the given children.
|
static ExprNode.OperatorNode |
createOperatorNode(SourceLocation location,
String op,
int prec,
ExprNode... children)
Create an operator node, given the token, precedence, and list of children (arguments).
|
Operator.Associativity |
getAssociativity()
Returns this operator's associativity.
|
String |
getDescription()
Returns a short description of this operator (usually just the token string).
|
int |
getNumOperands()
Returns the number of operands that this operator takes.
|
int |
getPrecedence()
Returns this operator's precedence level.
|
List<Operator.SyntaxElement> |
getSyntax()
Returns the canonical syntax for this operator, including spacing.
|
String |
getTokenString()
Returns this operator's token.
|
static Operator |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Operator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Operator NEGATIVE
public static final Operator NOT
public static final Operator TIMES
public static final Operator DIVIDE_BY
public static final Operator MOD
public static final Operator PLUS
public static final Operator MINUS
public static final Operator LESS_THAN
public static final Operator GREATER_THAN
public static final Operator LESS_THAN_OR_EQUAL
public static final Operator GREATER_THAN_OR_EQUAL
public static final Operator EQUAL
public static final Operator NOT_EQUAL
public static final Operator AND
public static final Operator OR
public static final Operator NULL_COALESCING
public static final Operator CONDITIONAL
public static Operator[] values()
for (Operator c : Operator.values()) System.out.println(c);
public static Operator valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static final ExprNode.OperatorNode createOperatorNode(SourceLocation location, String op, int prec, ExprNode... children)
op - A string listing the operator token. If multiple tokens (e.g. the ternary conditional
operator), separate them using a space.prec - The precedence of an operator. Must match the precedence specified by op.children - The list of children (arguments) for the operator.IllegalArgumentException - If there is no Soy operator matching the given data.public List<Operator.SyntaxElement> getSyntax()
public String getTokenString()
public int getNumOperands()
public int getPrecedence()
public Operator.Associativity getAssociativity()
public String getDescription()
public abstract ExprNode.OperatorNode createNode(SourceLocation location)
public final ExprNode.OperatorNode createNode(SourceLocation location, ExprNode... children)