| 3430 | |
| 3431 | @dataclass |
| 3432 | class DisassemblyTextLine: |
| 3433 | tokens: List['InstructionTextToken'] |
| 3434 | highlight: '_highlight.HighlightColor' |
| 3435 | address: Optional[int] |
| 3436 | il_instruction: Optional[ILInstructionType] |
| 3437 | tags: List['binaryview.Tag'] |
| 3438 | type_info: Optional[DisassemblyTextLineTypeInfo] |
| 3439 | |
| 3440 | def __init__( |
| 3441 | self, |
| 3442 | tokens: List['InstructionTextToken'], |
| 3443 | address: Optional[int] = None, |
| 3444 | il_instr: Optional[ILInstructionType] = None, |
| 3445 | color: Optional[Union['_highlight.HighlightColor', HighlightStandardColor]] = None, |
| 3446 | tags: Optional[List['binaryview.Tag']] = None, |
| 3447 | type_info: Optional[DisassemblyTextLineTypeInfo] = None, |
| 3448 | ): |
| 3449 | self.address = address |
| 3450 | self.tokens = tokens |
| 3451 | self.il_instruction = il_instr |
| 3452 | self.address = address |
| 3453 | if color is None: |
| 3454 | self.highlight = _highlight.HighlightColor() |
| 3455 | else: |
| 3456 | if not isinstance(color, HighlightStandardColor) and not isinstance(color, _highlight.HighlightColor): |
| 3457 | raise ValueError("Specified color is not one of HighlightStandardColor, _highlight.HighlightColor") |
| 3458 | if isinstance(color, HighlightStandardColor): |
| 3459 | self.highlight = _highlight.HighlightColor(color) |
| 3460 | else: |
| 3461 | self.highlight = color |
| 3462 | if tags is None: |
| 3463 | tags = [] |
| 3464 | self.tags = tags |
| 3465 | self.type_info = type_info |
| 3466 | |
| 3467 | def __str__(self): |
| 3468 | return "".join(map(str, self.tokens)) |
| 3469 | |
| 3470 | def __repr__(self): |
| 3471 | if self.address is None: |
| 3472 | return f"<disassemblyTextLine {self}>" |
| 3473 | return f"<disassemblyTextLine {self.address:#x}: {self}>" |
| 3474 | |
| 3475 | @property |
| 3476 | def total_width(self): |
| 3477 | return sum(token.width for token in self.tokens) |
| 3478 | |
| 3479 | def _find_address_and_indentation_tokens(self, callback): |
| 3480 | start_token = 0 |
| 3481 | for i in range(len(self.tokens)): |
| 3482 | if self.tokens[i].type == InstructionTextTokenType.AddressSeparatorToken: |
| 3483 | start_token = i + 1 |
| 3484 | break |
| 3485 | |
| 3486 | for token in self.tokens[:start_token]: |
| 3487 | callback(token) |
| 3488 | |
| 3489 | for token in self.tokens[start_token:]: |
no outgoing calls
no test coverage detected