public class lr_item_core extends Object
A ::= B * C d EThis represents a point in a parse where the parser is trying to match the given production, and has succeeded in matching everything before the "dot" (and hence is expecting to see the symbols after the dot next). See lalr_item, lalr_item_set, and lalr_start for full details on the meaning and use of items.
lalr_item
,
lalr_item_set
,
lalr_state
Modifier and Type | Field and Description |
---|---|
protected int |
_core_hash_cache
Cache of the hash code.
|
protected int |
_dot_pos
The position of the "dot" -- this indicates the part of the production
that the marker is before, so 0 indicates a dot at the beginning of
the RHS.
|
protected symbol |
_symbol_after_dot
Cache of symbol after the dot.
|
protected production |
_the_production
The production for the item.
|
Constructor and Description |
---|
lr_item_core(production prod)
Constructor for dot at start of right hand side.
|
lr_item_core(production prod,
int pos)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
core_equals(lr_item_core other)
Equality comparison for the core only.
|
int |
core_hashCode()
Hash code for the core (separated so we keep non overridden version).
|
boolean |
dot_at_end()
Is the dot at the end of the production?
|
non_terminal |
dot_before_nt()
Determine if we have a dot before a non terminal, and if so which one
(return null or the non terminal).
|
int |
dot_pos()
The position of the "dot" -- this indicates the part of the production
that the marker is before, so 0 indicates a dot at the beginning of
the RHS.
|
boolean |
equals(lr_item_core other)
Equality comparison.
|
boolean |
equals(Object other)
Generic equality comparison.
|
int |
hashCode()
Hash code for the item.
|
protected int |
obj_hash()
Return the hash code that object would have provided for us so we have
a (nearly) unique id for debugging.
|
lr_item_core |
shift_core()
Produce a new lr_item_core that results from shifting the dot one
position to the right.
|
symbol |
symbol_after_dot()
Return the symbol after the dot.
|
production |
the_production()
The production for the item.
|
String |
to_simple_string()
Convert to a string (separated out from toString() so we can call it
from subclass that overrides toString()).
|
String |
toString()
Convert to a string
|
protected production _the_production
protected int _dot_pos
protected int _core_hash_cache
protected symbol _symbol_after_dot
public lr_item_core(production prod, int pos) throws internal_error
prod
- production this item uses.pos
- position of the "dot" within the item.internal_error
public lr_item_core(production prod) throws internal_error
prod
- production this item uses.internal_error
public production the_production()
public int dot_pos()
public boolean dot_at_end()
public symbol symbol_after_dot()
public non_terminal dot_before_nt()
public lr_item_core shift_core() throws internal_error
internal_error
public boolean core_equals(lr_item_core other)
public boolean equals(lr_item_core other)
public boolean equals(Object other)
public int core_hashCode()
protected int obj_hash()
public String to_simple_string() throws internal_error
internal_error
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.