public class Label extends Object implements Comparable<Label>, Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
ACTION |
static int |
DOWN |
static int |
EOF |
static int |
EOR_TOKEN_TYPE
End of rule token type; imaginary token type used only for
local, partial FOLLOW sets to indicate that the local FOLLOW
hit the end of rule.
|
static int |
EOT
End of Token is like EOF for lexer rules.
|
static int |
EPSILON |
static String |
EPSILON_STR |
static int |
INVALID |
protected int |
label
The token type or character value; or, signifies special label.
|
protected IntSet |
labelSet
A set of token types or character codes if label==SET
|
static int |
MAX_CHAR_VALUE |
static int |
MIN_ATOM_VALUE
Anything at this value or larger can be considered a simple atom int
for easy comparison during analysis only; faux labels are not used
during parse time for real token types or char values.
|
static int |
MIN_CHAR_VALUE |
static int |
MIN_TOKEN_TYPE
tokens and char range overlap; tokens are MIN_TOKEN_TYPE..n
|
static int |
NUM_FAUX_LABELS
We have labels like EPSILON that are below 0; it's hard to
store them in an array with negative index so use this
constant as an index shift when accessing arrays based upon
token type.
|
static int |
SEMPRED
label is a semantic predicate; implies label is epsilon also
|
static int |
SET
label is a set of tokens or char
|
static int |
UP |
Constructor and Description |
---|
Label(int label) |
Label(IntSet labelSet)
Make a set label
|
Modifier and Type | Method and Description |
---|---|
void |
add(Label a) |
Object |
clone() |
int |
compareTo(Label o) |
boolean |
equals(Object o) |
int |
getAtom()
return the single atom label or INVALID if not a single atom
|
SemanticContext |
getSemanticContext() |
IntSet |
getSet() |
int |
hashCode() |
static boolean |
intersect(Label label,
Label edgeLabel) |
boolean |
isAction() |
boolean |
isAtom() |
boolean |
isEpsilon() |
boolean |
isSemanticPredicate() |
boolean |
isSet() |
boolean |
matches(int atom) |
boolean |
matches(IntSet set) |
boolean |
matches(Label other) |
void |
setSet(IntSet set) |
String |
toString()
Predicates are lists of AST nodes from the NFA created from the
grammar, but the same predicate could be cut/paste into multiple
places in the grammar.
|
String |
toString(Grammar g) |
public static final int INVALID
public static final int ACTION
public static final int EPSILON
public static final String EPSILON_STR
public static final int SEMPRED
public static final int SET
public static final int EOT
public static final int EOF
public static final int NUM_FAUX_LABELS
public static final int MIN_ATOM_VALUE
public static final int MIN_CHAR_VALUE
public static final int MAX_CHAR_VALUE
public static final int EOR_TOKEN_TYPE
public static final int DOWN
public static final int UP
public static final int MIN_TOKEN_TYPE
protected int label
protected IntSet labelSet
public Label(int label)
public Label(IntSet labelSet)
public void add(Label a)
public boolean isAtom()
public boolean isEpsilon()
public boolean isSemanticPredicate()
public boolean isAction()
public boolean isSet()
public int getAtom()
public IntSet getSet()
public void setSet(IntSet set)
public SemanticContext getSemanticContext()
public boolean matches(int atom)
public boolean matches(IntSet set)
public boolean matches(Label other)
public int compareTo(Label o)
compareTo
in interface Comparable<Label>
public String toString()
Copyright © 1992–2015 ANTLR. All rights reserved.