public class lalr_item extends lr_item_core
    [A ::= B * C d E  , {a,b,c}]
  
  indicates that the parser is in the middle of parsing the production 
    A ::= B C d E
  
  that B has already been parsed, and that we will expect to see a lookahead 
  of either a, b, or c once the complete RHS of this production has been 
  found.Items may initially be missing some items from their lookahead sets. Links are maintained from each item to the set of items that would need to be updated if symbols are added to its lookahead set. During "lookahead propagation", we add symbols to various lookahead sets and propagate these changes across these dependency links as needed.
lalr_item_set, 
lalr_state| Modifier and Type | Field and Description | 
|---|---|
| protected terminal_set | _lookaheadThe lookahead symbols of the item. | 
| protected Stack<lalr_item> | _propagate_itemsLinks to items that the lookahead needs to be propagated to. | 
| protected boolean | needs_propagationFlag to indicate that this item needs to propagate its lookahead 
  (whether it has changed or not). | 
_core_hash_cache, _dot_pos, _symbol_after_dot, _the_production| Constructor and Description | 
|---|
| lalr_item(production prod)Constructor with default position and empty lookahead set. | 
| lalr_item(production prod,
         int pos,
         terminal_set look)Full constructor. | 
| lalr_item(production prod,
         terminal_set look)Constructor with default position (dot at start). | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add_propagate(lalr_item prop_to)Add a new item to the set of items we propagate to. | 
| terminal_set | calc_lookahead(terminal_set lookahead_after)Calculate lookahead representing symbols that could appear after the
   symbol that the dot is currently in front of. | 
| boolean | equals(lalr_item other)Equality comparison -- here we only require the cores to be equal since
   we need to do sets of items based only on core equality (ignoring 
   lookahead sets). | 
| boolean | equals(Object other)Generic equality comparison. | 
| int | hashCode()Return a hash code -- here we only hash the core since we only test core
  matching in LALR items. | 
| boolean | lookahead_visible()Determine if everything from the symbol one beyond the dot all the 
  way to the  end of the right hand side is nullable. | 
| terminal_set | lookahead()The lookahead symbols of the item. | 
| Stack<lalr_item> | propagate_items()Links to items that the lookahead needs to be propagated to | 
| void | propagate_lookaheads(terminal_set incoming)Propagate incoming lookaheads through this item to others need to 
  be changed. | 
| lalr_item | shift()Produce the new lalr_item that results from shifting the dot one position
  to the right. | 
| String | toString()Convert to string. | 
core_equals, core_hashCode, dot_at_end, dot_before_nt, dot_pos, equals, obj_hash, shift_core, symbol_after_dot, the_production, to_simple_stringprotected terminal_set _lookahead
protected Stack<lalr_item> _propagate_items
protected boolean needs_propagation
public lalr_item(production prod, int pos, terminal_set look) throws internal_error
prod - the production for the item.pos - the position of the "dot" within the production.look - the set of lookahead symbols.internal_errorpublic lalr_item(production prod, terminal_set look) throws internal_error
prod - the production for the item.look - the set of lookahead symbols.internal_errorpublic lalr_item(production prod) throws internal_error
prod - the production for the item.internal_errorpublic terminal_set lookahead()
public Stack<lalr_item> propagate_items()
public void add_propagate(lalr_item prop_to)
public void propagate_lookaheads(terminal_set incoming) throws internal_error
internal_errorpublic lalr_item shift() throws internal_error
internal_errorpublic terminal_set calc_lookahead(terminal_set lookahead_after) throws internal_error
internal_errorpublic boolean lookahead_visible()
                          throws internal_error
internal_errorpublic boolean equals(lalr_item other)
public boolean equals(Object other)
equals in class lr_item_corepublic int hashCode()
hashCode in class lr_item_corepublic String toString()
toString in class lr_item_coreCopyright © 2003–2016 Community Z Tools Project. All rights reserved.