Package ghidra.app.plugin.assembler.sleigh.parse

# Class AssemblyParseActionGotoTable

java.lang.Object
ghidra.app.plugin.assembler.sleigh.parse.AssemblyParseActionGotoTable

public class AssemblyParseActionGotoTable extends 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 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) entry
  `static class`
  `AssemblyParseActionGotoTable.Action`
  An action in the Action/Goto table
  `static class`
  `AssemblyParseActionGotoTable.GotoAction`
  A GOTO (Gn) entry
  `static class`
  `AssemblyParseActionGotoTable.ReduceAction`
  A REDUCE (Rn) entry
  `static class`
  `AssemblyParseActionGotoTable.ShiftAction`
  A SHIFT (Sn) entry

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final org.apache.commons.collections4.MultiValuedMap<TableEntryKey,AssemblyParseActionGotoTable.Action>`
  `map`
  `protected final org.apache.commons.collections4.MultiValuedMap<Integer,AssemblyTerminal>`
  `possibleTerms`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AssemblyParseActionGotoTable()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<AssemblyParseActionGotoTable.Action>`
  `get(int fromState, AssemblySymbol next)`
  Get all entries in a given cell
  `Collection<AssemblyTerminal>`
  `getExpected(int fromState)`
  Get the terminals that are expected, i.e., have entries for the given state
  `boolean`
  `put(int fromState, AssemblySymbol next, AssemblyParseActionGotoTable.Action action)`
  Add an action entry to the given cell
  `boolean`
  `putAccept(int fromState)`
  Add an ACCEPT entry for the given state at the end of input
  `boolean`
  `putGoto(int fromState, AssemblyNonTerminal next, int newState)`
  Add a GOTO entry to the given cell
  `boolean`
  `putReduce(int fromState, AssemblyTerminal next, AssemblyProduction prod)`
  Add a REDUCE (Rn) entry to the given cell
  `boolean`
  `putShift(int fromState, AssemblyTerminal next, int newState)`
  Add a SHIFT (Sn) entry to the given cell

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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

    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 table
      `next` - the symbol (column) in the table
      `action` - 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 table
      `next` - the symbol (column) in the table
      `newState` - 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 table
      `next` - the symbol (column) in the table
      `prod` - 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 table
      `next` - the symbol (column) in the table
      `newState` - 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 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 Collection<AssemblyParseActionGotoTable.Action> get(int fromState, AssemblySymbol next)
    Get all entries in a given cell
    Parameters:
      `fromState` - the state (row) in the table
      `next` - the symbol (column) in the table
    Returns:
      all action entries in the given cell