| |
|
| java.lang.Object java_cup.lalr_item_set
lalr_item_set | public class lalr_item_set (Code) | | This class represents a set of LALR items. For purposes of building
these sets, items are considered unique only if they have unique cores
(i.e., ignoring differences in their lookahead sets).
This class provides fairly conventional set oriented operations (union,
sub/super-set tests, etc.), as well as an LALR "closure" operation (see
compute_closure()).
See Also: java_cup.lalr_item See Also: java_cup.lalr_state version: last updated: 3/6/96 author: Scott Hudson |
_all | protected Hashtable _all(Code) | | A hash table to implement the set. We store the items using themselves
as keys.
|
hashcode_cache | protected Integer hashcode_cache(Code) | | Cached hashcode for this set.
|
lalr_item_set | public lalr_item_set()(Code) | | Constructor for an empty set.
|
lalr_item_set | public lalr_item_set(lalr_item_set other) throws internal_error(Code) | | Constructor for cloning from another set.
Parameters: other - indicates set we should copy from. |
add | public lalr_item add(lalr_item itm) throws internal_error(Code) | | Add a singleton item, merging lookahead sets if the item is already
part of the set. returns the element of the set that was added or
merged into.
Parameters: itm - the item being added. |
add | public void add(lalr_item_set other) throws internal_error(Code) | | Add a complete set, merging lookaheads where items are already in
the set
Parameters: other - the set to be added. |
compute_closure | public void compute_closure() throws internal_error(Code) | | Compute the closure of the set using the LALR closure rules. Basically
for every item of the form:
[L ::= a *N alpha, l]
(where N is a a non terminal and alpha is a string of symbols) make
sure there are also items of the form:
[N ::= *beta, first(alpha l)]
corresponding to each production of N. Items with identical cores but
differing lookahead sets are merged by creating a new item with the same
core and the union of the lookahead sets (the LA in LALR stands for
"lookahead merged" and this is where the merger is). This routine
assumes that nullability and first sets have been computed for all
productions before it is called.
|
contains | public boolean contains(lalr_item itm)(Code) | | Does the set contain a particular item?
Parameters: itm - the item in question. |
equals | public boolean equals(Object other)(Code) | | Generic equality comparison.
|
find | public lalr_item find(lalr_item itm)(Code) | | Return the item in the set matching a particular item (or null if not
found)
Parameters: itm - the item we are looking for. |
hashCode | public int hashCode()(Code) | | Return hash code.
|
is_subset_of | public boolean is_subset_of(lalr_item_set other) throws internal_error(Code) | | Is this set an (improper) subset of another?
Parameters: other - the other set in question. |
is_superset_of | public boolean is_superset_of(lalr_item_set other) throws internal_error(Code) | | Is this set an (improper) superset of another?
Parameters: other - the other set in question. |
not_null | protected void not_null(Object obj) throws internal_error(Code) | | Helper function for null test. Throws an interal_error exception if its
parameter is null.
Parameters: obj - the object we are testing. |
remove | public void remove(lalr_item itm) throws internal_error(Code) | | Remove a single item if it is in the set.
Parameters: itm - the item to remove. |
size | public int size()(Code) | | Size of the set
|
|
|
|