This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

62 líneas
1.2 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 GrammarError(LarkError):
  9. pass
  10. class ParseError(LarkError):
  11. pass
  12. class LexError(LarkError):
  13. pass
  14. T = TypeVar('T')
  15. class UnexpectedEOF(ParseError):
  16. expected: List[Token]
  17. class UnexpectedInput(LarkError):
  18. line: int
  19. column: int
  20. pos_in_stream: int
  21. state: Any
  22. def get_context(self, text: str, span: int = ...):
  23. ...
  24. def match_examples(
  25. self,
  26. parse_fn: Callable[[str], Tree],
  27. examples: Union[Dict[T, Iterable[str]], Iterable[Tuple[T, Iterable[str]]]],
  28. token_type_match_fallback: bool = False,
  29. use_accepts: bool = False,
  30. ) -> T:
  31. ...
  32. class UnexpectedToken(ParseError, UnexpectedInput):
  33. expected: Set[str]
  34. considered_rules: Set[str]
  35. puppet: ParserPuppet
  36. accepts: Set[str]
  37. class UnexpectedCharacters(LexError, UnexpectedInput):
  38. allowed: Set[str]
  39. considered_tokens: Set[Any]
  40. class VisitError(LarkError):
  41. obj: Union[Tree, Token]
  42. orig_exc: Exception