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.

40 rivejä
881 B

  1. # -*- coding: utf-8 -*-
  2. from typing import List, Dict, Union, Callable, Iterable
  3. from .grammar import Symbol
  4. from .lark import Lark
  5. from .tree import Tree
  6. from .visitors import Transformer_InPlace
  7. from .lexer import TerminalDef
  8. class WriteTokensTransformer(Transformer_InPlace):
  9. def __init__(self, tokens: Dict[str, TerminalDef], Dict[str, Callable[[Symbol], str]] = ...):
  10. ...
  11. class MatchTree(Tree):
  12. pass
  13. class MakeMatchTree:
  14. name: str
  15. expansion: List[TerminalDef]
  16. def __init__(self, name: str, expansion: List[TerminalDef]):
  17. ...
  18. def __call__(self, args: List[Union[str, Tree]]):
  19. ...
  20. class Reconstructor:
  21. def __init__(self, parser: Lark, term_subs: Dict[str, Callable[[Symbol], str]] = ...):
  22. ...
  23. def reconstruct(self, tree: Tree, postproc: Callable[[Iterable[str]], Iterable[str]]) -> str:
  24. ...