(item: StackItem)
| 54 | |
| 55 | @staticmethod |
| 56 | def from_item(item: StackItem) -> "PointerOffset": |
| 57 | if not item.size: |
| 58 | return PointerOffset(1, (), ()) |
| 59 | txt = item.size.strip() |
| 60 | n: tuple[str, ...] = () |
| 61 | p: tuple[str, ...] = () |
| 62 | try: |
| 63 | i = int(txt) |
| 64 | except ValueError: |
| 65 | i = 0 |
| 66 | if txt[0] == "+": |
| 67 | txt = txt[1:] |
| 68 | if txt[0] == "-": |
| 69 | n = (txt[1:],) |
| 70 | else: |
| 71 | p = (txt,) |
| 72 | return PointerOffset(i, p, n) |
| 73 | |
| 74 | @staticmethod |
| 75 | def create(numeric: int, positive: tuple[str, ...], negative: tuple[str, ...]) -> "PointerOffset": |
no test coverage detected