polyglot.ast
Class Precedence

java.lang.Object
  extended by polyglot.util.Enum
      extended by polyglot.ast.Precedence
All Implemented Interfaces:
java.io.Serializable

public class Precedence
extends Enum

Constants defining the precedence of an expression. Higher values denote higher precedence (i.e., tighter binding).

See Also:
Serialized Form

Field Summary
static Precedence ADD
          The precedence of a + when applied to numbers, and the precedence of -.
static Precedence ASSIGN
          The precedence of assignment expressions.
static Precedence BIT_AND
          The precedence of bitwise AND (&) expressions.
static Precedence BIT_OR
          The precedence of bitwise OR (|) expressions.
static Precedence BIT_XOR
          The precedence of bitwise XOR (^) expressions.
static Precedence CAST
          The precedence of a cast expression.
static Precedence COND_AND
          The precedence of conditional AND (&&) expressions.
static Precedence COND_OR
          The precedence of conditional OR (||) expressions.
static Precedence CONDITIONAL
          The precedence of ternary conditional expressions.
static Precedence EQUAL
          The precedence of equality operators.
static Precedence INSTANCEOF
          The precedence of instanceof expressions.
static Precedence LITERAL
          The precedence of a literal
static Precedence MUL
          The precedence of a *, /, or % expression.
static Precedence RELATIONAL
          The precedence of the relational expressions <, >, <=, and >=.
static Precedence SHIFT
          The precedence of the shift expressions <<, >>, and >>>.
static Precedence STRING_ADD
          The precedence of a + when applied to Strings.
static Precedence UNARY
          The precedence of a unary expression.
static Precedence UNKNOWN
          The precedence of all other expressions.
 
Constructor Summary
Precedence(java.lang.String name, int value)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if this and p have the same precedence.
 boolean equals(Precedence p)
          Returns true if this and p have the same precedence.
 int hashCode()
           
 boolean isTighter(Precedence p)
          Returns true if this binds tighter than p.
 
Methods inherited from class polyglot.util.Enum
intern, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LITERAL

public static final Precedence LITERAL
The precedence of a literal


UNARY

public static final Precedence UNARY
The precedence of a unary expression.


CAST

public static final Precedence CAST
The precedence of a cast expression.


MUL

public static final Precedence MUL
The precedence of a *, /, or % expression.


STRING_ADD

public static final Precedence STRING_ADD
The precedence of a + when applied to Strings. This is of higher precedence than + applied to numbers.


ADD

public static final Precedence ADD
The precedence of a + when applied to numbers, and the precedence of -.


SHIFT

public static final Precedence SHIFT
The precedence of the shift expressions <<, >>, and >>>.


RELATIONAL

public static final Precedence RELATIONAL
The precedence of the relational expressions <, >, <=, and >=.


INSTANCEOF

public static final Precedence INSTANCEOF
The precedence of instanceof expressions.


EQUAL

public static final Precedence EQUAL
The precedence of equality operators. That is, precedence of == and != expressions.


BIT_AND

public static final Precedence BIT_AND
The precedence of bitwise AND (&) expressions.


BIT_XOR

public static final Precedence BIT_XOR
The precedence of bitwise XOR (^) expressions.


BIT_OR

public static final Precedence BIT_OR
The precedence of bitwise OR (|) expressions.


COND_AND

public static final Precedence COND_AND
The precedence of conditional AND (&&) expressions.


COND_OR

public static final Precedence COND_OR
The precedence of conditional OR (||) expressions.


CONDITIONAL

public static final Precedence CONDITIONAL
The precedence of ternary conditional expressions.


ASSIGN

public static final Precedence ASSIGN
The precedence of assignment expressions.


UNKNOWN

public static final Precedence UNKNOWN
The precedence of all other expressions. This has the lowest precedence to ensure the expression is parenthesized on output.

Constructor Detail

Precedence

public Precedence(java.lang.String name,
                  int value)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Enum

equals

public boolean equals(java.lang.Object o)
Returns true if this and p have the same precedence.

Overrides:
equals in class Enum

equals

public boolean equals(Precedence p)
Returns true if this and p have the same precedence.


isTighter

public boolean isTighter(Precedence p)
Returns true if this binds tighter than p.