This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
785 B

  1. # -*- coding: utf-8 -*-
  2. from typing import Dict, Iterable, Callable, Union
  3. from .tree import Tree
  4. from .lexer import Token
  5. class LarkError(Exception):
  6. pass
  7. class GrammarError(LarkError):
  8. pass
  9. class ParseError(LarkError):
  10. pass
  11. class LexError(LarkError):
  12. pass
  13. class UnexpectedInput(LarkError):
  14. pos_in_stream: int
  15. def get_context(self, text: str, span: int = ...):
  16. ...
  17. def match_examples(
  18. self,
  19. parse_fn: Callable[[str], Tree],
  20. examples: Dict[str, Iterable[str]]
  21. ):
  22. ...
  23. class UnexpectedToken(ParseError, UnexpectedInput):
  24. pass
  25. class UnexpectedCharacters(LexError, UnexpectedInput):
  26. line: int
  27. column: int
  28. class VisitError(LarkError):
  29. obj: Union[Tree, Token]
  30. orig_exc: Exception