Package ghidra.app.plugin.assembler.sleigh.grammars

# Class AssemblySentential<NT extends AssemblyNonTerminal>

java.lang.Object
ghidra.app.plugin.assembler.sleigh.grammars.AssemblySentential<NT>

Type Parameters:
  `NT` - the type of non-terminals

All Implemented Interfaces:
  `Comparable<AssemblySentential<NT>>`, `Iterable<AssemblySymbol>`

public class AssemblySentential<NT extends AssemblyNonTerminal> extends Object implements Comparable<AssemblySentential<NT>>, Iterable<AssemblySymbol>
A "string" of symbols

To avoid overloading the word "string", we call this a "sentential". Technically, to be a "sentential" in the classic sense, it must be a possible element in the derivation of a sentence in the grammar starting with the start symbol. We ignore that if only for the sake of naming.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `AssemblySentential.TruncatedWhiteSpaceParseToken`
  The token consumed by a whitespace terminal when it anticipates the end of input
  `static class`
  `AssemblySentential.WhiteSpaceParseToken`
  The token consumed by a whitespace terminal

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final AssemblyStringTerminal`
  `WHITE_SPACE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AssemblySentential()`
  Construct a blank string This is suitable as a blank start, to add new symbols, or to use directly as the RHS, effectively creating an "epsilon" production.
  `AssemblySentential(AssemblySymbol... syms)`
  Construct a string from any number of symbols
  `AssemblySentential(List<? extends AssemblySymbol> symbols)`
  Construct a string from the given list of symbols

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCommaWS()`
  Add a comma followed by optional whitespace.
  `void`
  `addSeparatorPart(String str)`
  Add a syntactic terminal element, but with consideration for optional whitespace surrounding special characters
  `void`
  `addSeparators(String str)`
  Add a syntactic terminal element, but considering that commas contained within may be followed by optional whitespace
  `boolean`
  `addSymbol(AssemblySymbol symbol)`
  Add a symbol to the right of this sentential
  `boolean`
  `addWS()`
  Add optional whitespace, if not already preceded by whitespace
  `int`
  `compareTo(AssemblySentential<NT> that)`
  `void`
  `finish()`
  Trim leading and trailing whitespace, and make the sentential immutable
  `AssemblySymbol`
  `getSymbol(int pos)`
  `List<AssemblySymbol>`
  `getSymbols()`
  Get the symbols in this sentential
  `int`
  `hashCode()`
  `Iterator<AssemblySymbol>`
  `iterator()`
  `int`
  `size()`
  Get the number of symbols, including whitespace, in this sentential
  `AssemblySentential<NT>`
  `sub(int fromIndex, int toIndex)`
  `String`
  `toString()`

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

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

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Field Details

  - ### WHITE_SPACE

    public static final AssemblyStringTerminal WHITE_SPACE

- ## Constructor Details

  - ### AssemblySentential

    public AssemblySentential(List<? extends AssemblySymbol> symbols)
    Construct a string from the given list of symbols
    Parameters:
      `symbols` -

  - ### AssemblySentential

    public AssemblySentential()
    Construct a blank string This is suitable as a blank start, to add new symbols, or to use directly as the RHS, effectively creating an "epsilon" production.

  - ### AssemblySentential

    public AssemblySentential(AssemblySymbol... syms)
    Construct a string from any number of symbols
    Parameters:
      `syms` -

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### compareTo

    public int compareTo(AssemblySentential<NT> that)
    Specified by:
      `compareTo` in interface `Comparable<NT extends AssemblyNonTerminal>`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### addSymbol

    public boolean addSymbol(AssemblySymbol symbol)
    Add a symbol to the right of this sentential
    Parameters:
      `symbol` - the symbol to add
    Returns:
      true

  - ### addWS

    public boolean addWS()
    Add optional whitespace, if not already preceded by whitespace
    Returns:
      true if whitespace was added

  - ### addCommaWS

    public void addCommaWS()
    Add a comma followed by optional whitespace.

  - ### addSeparatorPart

    public void addSeparatorPart(String str)
    Add a syntactic terminal element, but with consideration for optional whitespace surrounding special characters
    Parameters:
      `str` - the expected terminal

  - ### getSymbols

    public List<AssemblySymbol> getSymbols()
    Get the symbols in this sentential
    Returns:
      the symbols;

  - ### getSymbol

    public AssemblySymbol getSymbol(int pos)

  - ### addSeparators

    public void addSeparators(String str)
    Add a syntactic terminal element, but considering that commas contained within may be followed by optional whitespace
    Parameters:
      `str` - the expected terminal

  - ### finish

    public void finish()
    Trim leading and trailing whitespace, and make the sentential immutable

  - ### iterator

    public Iterator<AssemblySymbol> iterator()
    Specified by:
      `iterator` in interface `Iterable<NT extends AssemblyNonTerminal>`

  - ### sub

    public AssemblySentential<NT> sub(int fromIndex, int toIndex)

  - ### size

    public int size()
    Get the number of symbols, including whitespace, in this sentential
    Returns:
      the number of symbols