Class AssemblyTerminal
- java.lang.Object
-
- ghidra.app.plugin.assembler.sleigh.symbol.AssemblySymbol
-
- ghidra.app.plugin.assembler.sleigh.symbol.AssemblyTerminal
-
- All Implemented Interfaces:
java.lang.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:
AssemblyGrammar
-
-
Field Summary
-
Fields inherited from class ghidra.app.plugin.assembler.sleigh.symbol.AssemblySymbol
name
-
-
Constructor Summary
Constructors Constructor Description AssemblyTerminal(java.lang.String name)
Construct a terminal having the give name
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract java.util.Collection<java.lang.String>
getSuggestions(java.lang.String got, java.util.Map<java.lang.String,java.lang.Long> labels)
Provide a collection of strings that this terminal would have acceptedabstract java.util.Collection<? extends AssemblyParseToken>
match(java.lang.String buffer, int pos, AssemblyGrammar grammar, java.util.Map<java.lang.String,java.lang.Long> labels)
Attempt to match a token from the input buffer starting at a given position-
Methods inherited from class ghidra.app.plugin.assembler.sleigh.symbol.AssemblySymbol
compareTo, equals, getName, hashCode, takesOperandIndex, toString
-
-
-
-
Method Detail
-
match
public abstract java.util.Collection<? extends AssemblyParseToken> match(java.lang.String buffer, int pos, AssemblyGrammar grammar, java.util.Map<java.lang.String,java.lang.Long> labels)
Attempt to match a token from the input buffer starting at a given position- Parameters:
buffer
- the input bufferpos
- the cursor position in the buffergrammar
- the grammar containing this terminallabels
- the program labels, if applicable- Returns:
- the matched token, or null
-
getSuggestions
public abstract java.util.Collection<java.lang.String> getSuggestions(java.lang.String got, java.util.Map<java.lang.String,java.lang.Long> labels)
Provide a collection of strings that this terminal would have accepted- Parameters:
got
- the remaining contents of the input bufferlabels
- the program labels, if applicable- Returns:
- a, possibly empty, collection of suggestions
-
-