The provided source text could not be parsed correctly.
| 14 | |
| 15 | |
| 16 | class ParserSyntaxError(Exception): |
| 17 | """The provided source text could not be parsed correctly.""" |
| 18 | |
| 19 | def __init__( |
| 20 | self, |
| 21 | message: str, |
| 22 | *, |
| 23 | source: str, |
| 24 | span: Tuple[int, int], |
| 25 | ) -> None: |
| 26 | self.span = span |
| 27 | self.message = message |
| 28 | self.source = source |
| 29 | |
| 30 | super().__init__() |
| 31 | |
| 32 | def __str__(self) -> str: |
| 33 | marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" |
| 34 | return "\n ".join([self.message, self.source, marker]) |
| 35 | |
| 36 | |
| 37 | DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = { |