Integer numeral — concrete integer value with extraction methods.
| 552 | |
| 553 | |
| 554 | class IntNumRef(ArithRef): |
| 555 | """Integer numeral — concrete integer value with extraction methods.""" |
| 556 | |
| 557 | __slots__ = () |
| 558 | |
| 559 | def as_long(self) -> int: |
| 560 | """Return the integer value as a Python int.""" |
| 561 | if isinstance(self._ast, IntLit): |
| 562 | return self._ast.val |
| 563 | if isinstance(self._ast, NatLit): |
| 564 | return self._ast.val |
| 565 | raise TypeError("Not an integer literal") |
| 566 | |
| 567 | def as_string(self) -> str: |
| 568 | return str(self.as_long()) |
| 569 | |
| 570 | |
| 571 | class RatNumRef(ArithRef): |
no outgoing calls
no test coverage detected