Class AssemblyParseActionGotoTable
java.lang.Object
ghidra.app.plugin.assembler.sleigh.parse.AssemblyParseActionGotoTable
The Action/Goto table for a LALR(1) parser
This table is unconventional in that it permits a single cell to be populated by more than one action. Typically, such a situation would indicate ambiguity, or the need for a longer look-ahead value. Because we do not presume to control the grammar (which was automatically derived from another source), the parsing algorithm will simply branch, eventually trying both options.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An ACCEPT (acc) entrystatic class
An action in the Action/Goto tablestatic class
A GOTO (Gn) entrystatic class
A REDUCE (Rn) entrystatic class
A SHIFT (Sn) entry -
Field Summary
Modifier and TypeFieldDescriptionprotected final org.apache.commons.collections4.MultiValuedMap
<TableEntryKey, AssemblyParseActionGotoTable.Action> protected final org.apache.commons.collections4.MultiValuedMap
<Integer, AssemblyTerminal> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(int fromState, AssemblySymbol next) Get all entries in a given cellgetExpected
(int fromState) Get the terminals that are expected, i.e., have entries for the given stateboolean
put
(int fromState, AssemblySymbol next, AssemblyParseActionGotoTable.Action action) Add an action entry to the given cellboolean
putAccept
(int fromState) Add an ACCEPT entry for the given state at the end of inputboolean
putGoto
(int fromState, AssemblyNonTerminal next, int newState) Add a GOTO entry to the given cellboolean
putReduce
(int fromState, AssemblyTerminal next, AssemblyProduction prod) Add a REDUCE (Rn) entry to the given cellboolean
putShift
(int fromState, AssemblyTerminal next, int newState) Add a SHIFT (Sn) entry to the given cell
-
Field Details
-
map
protected final org.apache.commons.collections4.MultiValuedMap<TableEntryKey,AssemblyParseActionGotoTable.Action> map -
possibleTerms
protected final org.apache.commons.collections4.MultiValuedMap<Integer,AssemblyTerminal> possibleTerms
-
-
Constructor Details
-
AssemblyParseActionGotoTable
public AssemblyParseActionGotoTable()
-
-
Method Details
-
put
Add an action entry to the given cell- Parameters:
fromState
- the state (row) in the tablenext
- the symbol (column) in the tableaction
- the entry to add to the cell- Returns:
- true, if the given entry was not already present
-
putShift
Add a SHIFT (Sn) entry to the given cell- Parameters:
fromState
- the state (row) in the tablenext
- the symbol (column) in the tablenewState
- the state (n) after the shift is applied- Returns:
- true, if the given entry was not already present
-
putReduce
Add a REDUCE (Rn) entry to the given cell- Parameters:
fromState
- the state (row) in the tablenext
- the symbol (column) in the tableprod
- the production (having index n) associated with the reduction- Returns:
- true, if the given entry was not already present
-
putGoto
Add a GOTO entry to the given cell- Parameters:
fromState
- the state (row) in the tablenext
- the symbol (column) in the tablenewState
- the target state- Returns:
- true, if the given entry was not already present
-
putAccept
public boolean putAccept(int fromState) Add an ACCEPT entry for the given state at the end of input- Parameters:
fromState
- the state (row) in the table- Returns:
- true, if the state does not already accept on end of input
-
getExpected
Get the terminals that are expected, i.e., have entries for the given state- Parameters:
fromState
- the state (row) in the table- Returns:
- the collection of populated columns (terminals) for the given state
-
get
Get all entries in a given cell- Parameters:
fromState
- the state (row) in the tablenext
- the symbol (column) in the table- Returns:
- all action entries in the given cell
-