Class AssemblyTerminal

java.lang.Object
ghidra.app.plugin.assembler.sleigh.symbol.AssemblySymbol
ghidra.app.plugin.assembler.sleigh.symbol.AssemblyTerminal
All Implemented Interfaces:
Comparable<AssemblySymbol>
Direct Known Subclasses:
AssemblyEOI, AssemblyNumericTerminal, AssemblyStringMapTerminal, AssemblyStringTerminal

public abstract class AssemblyTerminal extends AssemblySymbol
The type of terminal for an assembly grammar

Unlike classical parsing, each terminal provides its own tokenizer. If multiple tokenizers yield a token, the parser branches, possibly creating multiple, ambiguous trees.

See Also:
  • Constructor Details

    • AssemblyTerminal

      public AssemblyTerminal(String name)
      Construct a terminal having the give name
      Parameters:
      name -
  • Method Details

    • match

      public abstract Collection<? extends AssemblyParseToken> match(String buffer, int pos, AssemblyGrammar grammar, AssemblyNumericSymbols symbols)
      Attempt to match a token from the input buffer starting at a given position
      Parameters:
      buffer - the input buffer
      pos - the cursor position in the buffer
      grammar - the grammar containing this terminal
      symbols - symbols from the program, suitable for use as numeric terminals
      Returns:
      the matched token, or null
    • getSuggestions

      public abstract Collection<String> getSuggestions(String got, AssemblyNumericSymbols symbols)
      Provide a collection of strings that this terminal would have accepted
      Parameters:
      got - the remaining contents of the input buffer
      symbols - the program symbols, if applicable
      Returns:
      a, possibly empty, collection of suggestions