This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

66 wiersze
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. from typing import Dict, Iterable, Callable, Union, TypeVar, Tuple, Any, List, Set
  3. from .tree import Tree
  4. from .lexer import Token
  5. from .parsers.lalr_puppet import ParserPuppet
  6. class LarkError(Exception):
  7. pass
  8. class ConfigurationError(LarkError, ValueError):
  9. pass
  10. class GrammarError(LarkError):
  11. pass
  12. class ParseError(LarkError):
  13. pass
  14. class LexError(LarkError):
  15. pass
  16. T = TypeVar('T')
  17. class UnexpectedEOF(ParseError):
  18. expected: List[Token]
  19. class UnexpectedInput(LarkError):
  20. line: int
  21. column: int
  22. pos_in_stream: int
  23. state: Any
  24. def get_context(self, text: str, span: int = ...) -> str:
  25. ...
  26. def match_examples(
  27. self,
  28. parse_fn: Callable[[str], Tree],
  29. examples: Union[Dict[T, Iterable[str]], Iterable[Tuple[T, Iterable[str]]]],
  30. token_type_match_fallback: bool = False,
  31. use_accepts: bool = False,
  32. ) -> T:
  33. ...
  34. class UnexpectedToken(ParseError, UnexpectedInput):
  35. expected: Set[str]
  36. considered_rules: Set[str]
  37. puppet: ParserPuppet
  38. accepts: Set[str]
  39. class UnexpectedCharacters(LexError, UnexpectedInput):
  40. allowed: Set[str]
  41. considered_tokens: Set[Any]
  42. class VisitError(LarkError):
  43. obj: Union[Tree, Token]
  44. orig_exc: Exception