Class AssemblyParseActionGotoTable
- java.lang.Object
-
- ghidra.app.plugin.assembler.sleigh.parse.AssemblyParseActionGotoTable
-
public class AssemblyParseActionGotoTable extends java.lang.Object
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 an 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
Nested Classes Modifier and Type Class Description static class
AssemblyParseActionGotoTable.AcceptAction
An ACCEPT (acc) entrystatic class
AssemblyParseActionGotoTable.Action
An action in the Action/Goto tablestatic class
AssemblyParseActionGotoTable.GotoAction
A GOTO (Gn) entrystatic class
AssemblyParseActionGotoTable.ReduceAction
A REDUCE (Rn) entrystatic class
AssemblyParseActionGotoTable.ShiftAction
A SHIFT (Sn) entry
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.collections4.MultiValuedMap<TableEntryKey,AssemblyParseActionGotoTable.Action>
map
protected org.apache.commons.collections4.MultiValuedMap<java.lang.Integer,AssemblyTerminal>
possibleTerms
-
Constructor Summary
Constructors Constructor Description AssemblyParseActionGotoTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<AssemblyParseActionGotoTable.Action>
get(int fromState, AssemblySymbol next)
Get all entries in a given celljava.util.Collection<AssemblyTerminal>
getExpected(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 Detail
-
map
protected final org.apache.commons.collections4.MultiValuedMap<TableEntryKey,AssemblyParseActionGotoTable.Action> map
-
possibleTerms
protected final org.apache.commons.collections4.MultiValuedMap<java.lang.Integer,AssemblyTerminal> possibleTerms
-
-
Method Detail
-
put
public boolean put(int fromState, AssemblySymbol next, AssemblyParseActionGotoTable.Action action)
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
public boolean putShift(int fromState, AssemblyTerminal next, int newState)
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
public boolean putReduce(int fromState, AssemblyTerminal next, AssemblyProduction prod)
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
public boolean putGoto(int fromState, AssemblyNonTerminal next, int newState)
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
public java.util.Collection<AssemblyTerminal> getExpected(int fromState)
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
public java.util.Collection<AssemblyParseActionGotoTable.Action> get(int fromState, AssemblySymbol next)
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
-
-