aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/lark-stubs/visitors.pyi
blob: 3a934eec27765e6b08929edd18ef708774723f91 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- coding: utf-8 -*-

from typing import TypeVar, Tuple, List, Callable, Generic, Type, Union
from abc import ABC
from .tree import Tree

_T = TypeVar('_T')
_R = TypeVar('_R')
_FUNC = Callable[..., _T]
_DECORATED = Union[_FUNC, type]


class Transformer(ABC, Generic[_T]):

    def __init__(self, visit_tokens: bool = True) -> None:
        ...

    def transform(self, tree: Tree) -> _T:
        ...

    def __mul__(self, other: Transformer[_T]) -> TransformerChain[_T]:
        ...


class TransformerChain(Generic[_T]):
    transformers: Tuple[Transformer[_T], ...]

    def __init__(self, *transformers: Transformer[_T]) -> None:
        ...

    def transform(self, tree: Tree) -> _T:
        ...

    def __mul__(self, other: Transformer[_T]) -> TransformerChain[_T]:
        ...


class Transformer_InPlace(Transformer):
    pass


class Transformer_NonRecursive(Transformer):
    pass


class Transformer_InPlaceRecursive(Transformer):
    pass


class VisitorBase:
    pass


class Visitor(VisitorBase, ABC, Generic[_T]):

    def visit(self, tree: Tree) -> Tree:
        ...

    def visit_topdown(self, tree: Tree) -> Tree:
        ...


class Visitor_Recursive(VisitorBase):

    def visit(self, tree: Tree) -> Tree:
        ...

    def visit_topdown(self, tree: Tree) -> Tree:
        ...


class Interpreter(ABC, Generic[_T]):

    def visit(self, tree: Tree) -> _T:
        ...

    def visit_children(self, tree: Tree) -> List[_T]:
        ...


_InterMethod = Callable[[Type[Interpreter], _T], _R]


def v_args(
        inline: bool = False,
        meta: bool = False,
        tree: bool = False,
        wrapper: Callable = None
) -> Callable[[_DECORATED], _DECORATED]:
    ...


def visit_children_decor(func: _InterMethod) -> _InterMethod:
    ...


class Discard(Exception):
    pass


# Deprecated
class InlineTransformer:
    pass


# Deprecated
def inline_args(obj: _FUNC) -> _FUNC:
    ...