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.

33 lines
924 B

  1. # -*- coding: utf-8 -*-
  2. from typing import List, Dict, IO, Callable, Union, Optional, Literal
  3. from .visitors import Transformer
  4. from .lexer import Lexer, Token
  5. from .tree import Tree
  6. _Start = Union[None, str, List[str]]
  7. class Lark:
  8. def __init__(
  9. self,
  10. grammar: Union[str, IO[str]],
  11. *,
  12. start: _Start = ...,
  13. parser: Literal["earley", "lalr", "cyk"] = ...,
  14. lexer: Optional[Lexer] = ...,
  15. transformer: Optional[Transformer] = ...,
  16. postlex: Optional[Literal["standard", "contextual"]] = ...,
  17. ambiguity: Literal["explicit", "resolve"] = ...,
  18. debug: bool = False,
  19. keep_all_tokens: bool = False,
  20. propagate_positions: bool = False,
  21. maybe_placeholders: bool = False,
  22. lexer_callbacks: Dict[str, Callable[[Token], Token]]
  23. ):
  24. ...
  25. def parse(self, text: str, start: _Start = None) -> Tree:
  26. ...