| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public static final 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. |
| public static final int | EOT
End of Token is like EOF for lexer rules. |
| public static final int | |
| public static final String | |
| public static final int | |
| 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 |
| public static final int | |
| public static final 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. |
| public static final int | |
| public static final int | MIN_TOKEN_TYPE
tokens and char range overlap; tokens are MIN_TOKEN_TYPE..n |
| public static final 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. |
| public static final int | SEMPRED
label is a semantic predicate; implies label is epsilon also |
| public static final int | SET
label is a set of tokens or char |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Object | |
| public int | compareTo(Label
the object to be compared. o)Implements java. |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public int | |
| public SemanticContext | |
| public IntSet | |
| public int | |
| public static boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | |
| public String | toString()
Overrides java. |
| public String |
| ACTION | back to summary |
|---|---|
| public static final int ACTION | |
| DOWN | back to summary |
|---|---|
| public static final int DOWN | |
| EOF | back to summary |
|---|---|
| public static final int EOF | |
| EOR_TOKEN_TYPE | back to summary |
|---|---|
| public static final 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. During error recovery, the local FOLLOW of a token reference may go beyond the end of the rule and have to use FOLLOW(rule). I have to just shift the token types to 2..n rather than 1..n to accommodate this imaginary token in my bitsets. If I didn't use a bitset implementation for runtime sets, I wouldn't need this. EOF is another candidate for a run time token type for parsers. Follow sets are not computed for lexers so we do not have this issue. | |
| EOT | back to summary |
|---|---|
| public static final int EOT End of Token is like EOF for lexer rules. It implies that no more characters are available and that NFA conversion should terminate for this path. For example A : 'a' 'b' | 'a' ; yields a DFA predictor: o-a->o-b->1 predict alt 1 | |-EOT->o predict alt 2 To generate code for EOT, treat it as the "default" path, which implies there is no way to mismatch a char for the state from which the EOT emanates. | |
| EPSILON | back to summary |
|---|---|
| public static final int EPSILON | |
| EPSILON_STR | back to summary |
|---|---|
| public static final String EPSILON_STR | |
| INVALID | back to summary |
|---|---|
| public static final int INVALID | |
| label | back to summary |
|---|---|
| protected int label The token type or character value; or, signifies special label. | |
| labelSet | back to summary |
|---|---|
| protected IntSet labelSet A set of token types or character codes if label==SET | |
| MAX_CHAR_VALUE | back to summary |
|---|---|
| public static final int MAX_CHAR_VALUE | |
| MIN_ATOM_VALUE | back to summary |
|---|---|
| public static final 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. | |
| MIN_CHAR_VALUE | back to summary |
|---|---|
| public static final int MIN_CHAR_VALUE | |
| MIN_TOKEN_TYPE | back to summary |
|---|---|
| public static final int MIN_TOKEN_TYPE tokens and char range overlap; tokens are MIN_TOKEN_TYPE..n | |
| NUM_FAUX_LABELS | back to summary |
|---|---|
| public static final 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. If real token type is i, then array index would be NUM_FAUX_LABELS + i. | |
| SEMPRED | back to summary |
|---|---|
| public static final int SEMPRED label is a semantic predicate; implies label is epsilon also | |
| SET | back to summary |
|---|---|
| public static final int SET label is a set of tokens or char | |
| UP | back to summary |
|---|---|
| public static final int UP | |
| Label | back to summary |
|---|---|
| public Label(int label) | |
| Label | back to summary |
|---|---|
| public Label(IntSet labelSet) Make a set label | |
| add | back to summary |
|---|---|
| public void add(Label a) | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by | |
| compareTo | back to summary |
|---|---|
| public int compareTo(Label o) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getAtom | back to summary |
|---|---|
| public int getAtom() return the single atom label or INVALID if not a single atom | |
| getSemanticContext | back to summary |
|---|---|
| public SemanticContext getSemanticContext() | |
| getSet | back to summary |
|---|---|
| public IntSet getSet() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| intersect | back to summary |
|---|---|
| public static boolean intersect(Label label, Label edgeLabel) | |
| isAction | back to summary |
|---|---|
| public boolean isAction() | |
| isAtom | back to summary |
|---|---|
| public boolean isAtom() | |
| isEpsilon | back to summary |
|---|---|
| public boolean isEpsilon() | |
| isSemanticPredicate | back to summary |
|---|---|
| public boolean isSemanticPredicate() | |
| isSet | back to summary |
|---|---|
| public boolean isSet() | |
| matches | back to summary |
|---|---|
| public boolean matches(int atom) | |
| matches | back to summary |
|---|---|
| public boolean matches(IntSet set) | |
| matches | back to summary |
|---|---|
| public boolean matches(Label other) | |
| setSet | back to summary |
|---|---|
| public void setSet(IntSet set) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. 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. I must compare the text of all the predicates to truly answer whether {p1,p2} .equals {p1,p2}. Unfortunately, I cannot rely on the AST.equals() to work properly so I must do a brute force O(n^2) nested traversal of the Set doing a String compare. At this point, Labels are not compared for equals when they are predicates, but here's the code for future use.
| |
| toString | back to summary |
|---|---|
| public String toString(Grammar g) | |