| 113 | return tuple(p_orig + p_uniq), tuple(n_orig + n_uniq) |
| 114 | |
| 115 | def to_c(self) -> str: |
| 116 | symbol_offset = "" |
| 117 | for item in self.negative: |
| 118 | symbol_offset += f" - {maybe_parenthesize(item)}" |
| 119 | for item in self.positive: |
| 120 | symbol_offset += f" + {maybe_parenthesize(item)}" |
| 121 | if symbol_offset and self.numeric == 0: |
| 122 | res = symbol_offset |
| 123 | else: |
| 124 | res = f"{self.numeric}{symbol_offset}" |
| 125 | if res.startswith(" + "): |
| 126 | res = res[3:] |
| 127 | if res.startswith(" - "): |
| 128 | res = "-" + res[3:] |
| 129 | return res |
| 130 | |
| 131 | def as_int(self) -> int | None: |
| 132 | if self.positive or self.negative: |