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 ClassesChangeModifier and TypeClassDescriptionstatic classThe token consumed by a whitespace terminal when it anticipates the end of inputstatic classThe token consumed by a whitespace terminal -
Field Summary
Fields -
Constructor Summary
ConstructorsChangeConstructorDescriptionConstruct 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 symbolsAssemblySentential(List<? extends AssemblySymbol> symbols) Construct a string from the given list of symbols -
Method Summary
ChangeModifier and TypeMethodDescriptionNEWvoidAdd a comma followed by optional whitespace.NEWvoidaddSeparatorPart(String str) Add a syntactic terminal element, but with consideration for optional whitespace surrounding special charactersNEWvoidaddSeparators(String str) Add a syntactic terminal element, but considering that commas contained within may be followed by optional whitespaceNEWbooleanaddSymbol(AssemblySymbol symbol) Add a symbol to the right of this sententialbooleanaddWS()Add optional whitespace, if not already preceded by whitespaceintcompareTo(AssemblySentential<NT> that) voidfinish()Trim leading and trailing whitespace, and make the sentential immutableNEWgetSymbol(int pos) NEWGet the symbols in this sententialinthashCode()NEWiterator()NEWintsize()Get the number of symbols, including whitespace, in this sententialNEWsub(int fromIndex, int toIndex) toString()REMOVEDList<AssemblySymbol>RemovedREMOVEDAssemblySentential<NT>subList(int fromIndex, int toIndex) RemovedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
WHITE_SPACE
-
-
Constructor Details
-
AssemblySentential
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
Construct a string from any number of symbols- Parameters:
syms-
-
-
Method Details
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<NT extends AssemblyNonTerminal>
-
hashCode
public int hashCode() -
addSymbol NEW
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 NEW
public void addCommaWS()Add a comma followed by optional whitespace. -
addSeparatorPart NEW
Add a syntactic terminal element, but with consideration for optional whitespace surrounding special characters- Parameters:
str- the expected terminal
-
getSymbols NEW
Get the symbols in this sentential- Returns:
- the symbols;
-
getSymbol NEW
-
addSeparators NEW
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 NEW
- Specified by:
iteratorin interfaceIterable<NT extends AssemblyNonTerminal>
-
sub NEW
-
size NEW
public int size()Get the number of symbols, including whitespace, in this sentential- Returns:
- the number of symbols
-