diff options
| author | Sean <sean.deaton@me.com> | 2022-06-03 09:12:45 -0400 |
|---|---|---|
| committer | Jordan <github@psifertex.com> | 2022-06-16 13:17:15 -0400 |
| commit | 4c375e18a4f464a049a1ac1457cb6359c0b27596 (patch) | |
| tree | b5cdb492ead23660623dd74f1d094a8ba14fdee4 /python | |
| parent | 32ff28ec2abfc81557c0c0b3334022f24118d84a (diff) | |
Implement .tokens property in HLIL.
LLIL and MLIL instructions both have this property. HLIL has
.lines which functions similarly, but returns a a generator of
DisassemblyTextLines. The .tokens property flattens those lines to
return a list of InstructionTestTokens in line with LLIL and MLIL
instructions. This enables plugins to work consistently regardless
of instruction type and makes the API more consistent.
Diffstat (limited to 'python')
| -rw-r--r-- | python/highlevelil.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py index cd073df6..c80354b7 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -44,6 +44,7 @@ from .commonil import ( Loop, ControlFlow, Memory, Constant, Arithmetic, DoublePrecision, Terminal, FloatingPoint, Intrinsic, Return ) +TokenList = List['function.InstructionTextToken'] LinesType = Generator['function.DisassemblyTextLine', None, None] ExpressionIndex = NewType('ExpressionIndex', int) InstructionIndex = NewType('InstructionIndex', int) @@ -366,6 +367,11 @@ class HighLevelILInstruction(BaseILInstruction): return hash((self.function, self.expr_index)) @property + def tokens(self) -> TokenList: + """HLIL tokens taken from the HLIL text lines(read-only)""" + return [token for line in self.lines for token in line.tokens] + + @property def lines(self) -> LinesType: """HLIL text lines (read-only)""" count = ctypes.c_ulonglong() |
