Class AssemblyParseStateItem
java.lang.Object
ghidra.app.plugin.assembler.sleigh.parse.AssemblyParseStateItem
- All Implemented Interfaces:
Comparable<AssemblyParseStateItem>
An item in the state of an LR(0) parser
An item is a production with a dot indicating a position while parsing
-
Constructor Summary
ConstructorDescriptionConstruct a new item starting at the far left of the given productionAssemblyParseStateItem
(AssemblyProduction prod, int pos) Construct a new item starting immediately before the symbol at the given position in the given production -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Check if this item is completedboolean
getClosure
(AssemblyGrammar grammar) "Fill" one step out to close a state containing this itemgetNext()
Get the symbol immediately to the right of the dotint
getPos()
Get the position of the dotGet the production associated with this itemint
hashCode()
read()
Advance the dot by one position, producing a new itemtoString()
-
Constructor Details
-
AssemblyParseStateItem
Construct a new item starting at the far left of the given production- Parameters:
prod
- the production
-
AssemblyParseStateItem
Construct a new item starting immediately before the symbol at the given position in the given production- Parameters:
prod
- the productionpos
- the position of the dot
-
-
Method Details
-
read
Advance the dot by one position, producing a new item- Returns:
- the new item
-
getNext
Get the symbol immediately to the right of the dotThis is the symbol which must be matched to advance the dot.
- Returns:
- the symbol, or null if the item is completed, i.e., the dot is at the far right
-
getClosure
"Fill" one step out to close a state containing this itemTo compute the full closure, you must continue stepping out until no new items are generated
- Parameters:
grammar
- the grammar containing the production- Returns:
- a subset of items in the closure of a state containing this item
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AssemblyParseStateItem>
-
hashCode
public int hashCode() -
toString
-
completed
public boolean completed()Check if this item is completedThe item is completed if all symbols have been matched, i.e., the dot is at the far right of the production.
- Returns:
- true iff the item is completed
-
getPos
public int getPos()Get the position of the dotThe position is the number of symbols to the left of the dot.
- Returns:
-
getProduction
Get the production associated with this item- Returns:
- the production
-