jaclang 0.7.18__py3-none-any.whl → 0.7.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/cli/cli.py +2 -2
- jaclang/compiler/absyntree.py +1 -1
- jaclang/compiler/parser.py +1 -1
- jaclang/compiler/passes/ir_pass.py +2 -0
- jaclang/compiler/passes/main/__init__.py +1 -1
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +50 -13
- jaclang/compiler/passes/main/import_pass.py +29 -1
- jaclang/compiler/passes/main/py_collect_dep_pass.py +8 -0
- jaclang/compiler/passes/main/registry_pass.py +4 -0
- jaclang/compiler/passes/main/sym_tab_build_pass.py +0 -18
- jaclang/compiler/passes/main/tests/fixtures/mod_type_assign.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/pygame_mock/__init__.pyi +3 -0
- jaclang/compiler/passes/main/tests/test_import_pass.py +10 -10
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +1 -1
- jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +23 -1
- jaclang/compiler/passes/main/type_check_pass.py +4 -4
- jaclang/compiler/passes/tool/jac_formatter_pass.py +58 -30
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/line_spacing.jac +57 -0
- jaclang/compiler/semtable.py +4 -4
- jaclang/compiler/symtable.py +5 -0
- jaclang/langserve/engine.py +68 -7
- jaclang/langserve/tests/test_server.py +3 -3
- jaclang/langserve/utils.py +0 -113
- jaclang/plugin/tests/test_jaseci.py +23 -4
- jaclang/runtimelib/importer.py +3 -0
- jaclang/runtimelib/machine.py +45 -3
- jaclang/runtimelib/memory.py +1 -1
- jaclang/settings.py +4 -0
- jaclang/stubs/jaclang/__init__.pyi +5 -0
- jaclang/stubs/jaclang/cli/__init__.pyi +0 -0
- jaclang/stubs/jaclang/cli/cli.pyi +58 -0
- jaclang/stubs/jaclang/cli/cmdreg.pyi +32 -0
- jaclang/stubs/jaclang/compiler/__init__.pyi +6 -0
- jaclang/stubs/jaclang/compiler/absyntree.pyi +1248 -0
- jaclang/stubs/jaclang/compiler/codeloc.pyi +45 -0
- jaclang/stubs/jaclang/compiler/compile.pyi +29 -0
- jaclang/stubs/jaclang/compiler/constant.pyi +287 -0
- jaclang/stubs/jaclang/compiler/generated/__init__.pyi +0 -0
- jaclang/stubs/jaclang/compiler/generated/jac_parser.pyi +898 -0
- jaclang/stubs/jaclang/compiler/parser.pyi +266 -0
- jaclang/stubs/jaclang/compiler/passes/__init__.pyi +3 -0
- jaclang/stubs/jaclang/compiler/passes/ir_pass.pyi +40 -0
- jaclang/stubs/jaclang/compiler/passes/main/__init__.pyi +27 -0
- jaclang/stubs/jaclang/compiler/passes/main/access_modifier_pass.pyi +23 -0
- jaclang/stubs/jaclang/compiler/passes/main/def_impl_match_pass.pyi +12 -0
- jaclang/stubs/jaclang/compiler/passes/main/def_use_pass.pyi +31 -0
- jaclang/stubs/jaclang/compiler/passes/main/fuse_typeinfo_pass.pyi +66 -0
- jaclang/stubs/jaclang/compiler/passes/main/import_pass.pyi +34 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyast_gen_pass.pyi +178 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyast_load_pass.pyi +135 -0
- jaclang/stubs/jaclang/compiler/passes/main/pybc_gen_pass.pyi +6 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyjac_ast_link_pass.pyi +22 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyout_pass.pyi +9 -0
- jaclang/stubs/jaclang/compiler/passes/main/registry_pass.pyi +15 -0
- jaclang/stubs/jaclang/compiler/passes/main/schedules.pyi +19 -0
- jaclang/stubs/jaclang/compiler/passes/main/sub_node_tab_pass.pyi +6 -0
- jaclang/stubs/jaclang/compiler/passes/main/sym_tab_build_pass.pyi +147 -0
- jaclang/stubs/jaclang/compiler/passes/main/type_check_pass.pyi +11 -0
- jaclang/stubs/jaclang/compiler/passes/tool/__init__.pyi +4 -0
- jaclang/stubs/jaclang/compiler/passes/tool/fuse_comments_pass.pyi +12 -0
- jaclang/stubs/jaclang/compiler/passes/tool/jac_formatter_pass.pyi +134 -0
- jaclang/stubs/jaclang/compiler/passes/tool/schedules.pyi +11 -0
- jaclang/stubs/jaclang/compiler/passes/transform.pyi +28 -0
- jaclang/stubs/jaclang/compiler/passes/utils/__init__.pyi +0 -0
- jaclang/stubs/jaclang/compiler/passes/utils/mypy_ast_build.pyi +151 -0
- jaclang/stubs/jaclang/compiler/semtable.pyi +35 -0
- jaclang/stubs/jaclang/compiler/symtable.pyi +65 -0
- jaclang/stubs/jaclang/langserve/__init__.pyi +0 -0
- jaclang/stubs/jaclang/langserve/engine.pyi +73 -0
- jaclang/stubs/jaclang/langserve/sem_manager.pyi +89 -0
- jaclang/stubs/jaclang/langserve/server.pyi +38 -0
- jaclang/stubs/jaclang/langserve/utils.pyi +55 -0
- jaclang/stubs/jaclang/plugin/__init__.pyi +3 -0
- jaclang/stubs/jaclang/plugin/builtin.pyi +12 -0
- jaclang/stubs/jaclang/plugin/default.pyi +202 -0
- jaclang/stubs/jaclang/plugin/feature.pyi +176 -0
- jaclang/stubs/jaclang/plugin/spec.pyi +181 -0
- jaclang/stubs/jaclang/runtimelib/__init__.pyi +0 -0
- jaclang/stubs/jaclang/runtimelib/architype.pyi +133 -0
- jaclang/stubs/jaclang/runtimelib/constructs.pyi +41 -0
- jaclang/stubs/jaclang/runtimelib/context.pyi +48 -0
- jaclang/stubs/jaclang/runtimelib/importer.pyi +104 -0
- jaclang/stubs/jaclang/runtimelib/machine.pyi +6 -0
- jaclang/stubs/jaclang/runtimelib/memory.pyi +26 -0
- jaclang/stubs/jaclang/runtimelib/utils.pyi +35 -0
- jaclang/stubs/jaclang/settings.pyi +35 -0
- jaclang/stubs/jaclang/utils/__init__.pyi +0 -0
- jaclang/stubs/jaclang/utils/helpers.pyi +18 -0
- jaclang/stubs/jaclang/utils/lang_tools.pyi +43 -0
- jaclang/stubs/jaclang/utils/log.pyi +3 -0
- jaclang/stubs/jaclang/utils/treeprinter.pyi +47 -0
- jaclang/tests/fixtures/bar.jac +1 -1
- jaclang/tests/fixtures/builtins_test.jac +16 -0
- jaclang/tests/fixtures/foo.jac +0 -1
- jaclang/tests/fixtures/match_multi_ex.jac +12 -0
- jaclang/tests/fixtures/walker_update.jac +19 -0
- jaclang/tests/test_cli.py +29 -2
- jaclang/tests/test_language.py +70 -2
- jaclang/utils/treeprinter.py +1 -1
- {jaclang-0.7.18.dist-info → jaclang-0.7.20.dist-info}/METADATA +4 -2
- {jaclang-0.7.18.dist-info → jaclang-0.7.20.dist-info}/RECORD +103 -34
- {jaclang-0.7.18.dist-info → jaclang-0.7.20.dist-info}/WHEEL +0 -0
- {jaclang-0.7.18.dist-info → jaclang-0.7.20.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import logging
|
|
3
|
+
from _typeshed import Incomplete
|
|
4
|
+
from abc import ABC, abstractmethod
|
|
5
|
+
from collections.abc import Generator
|
|
6
|
+
from types import ModuleType
|
|
7
|
+
from typing import (
|
|
8
|
+
Any,
|
|
9
|
+
Callable,
|
|
10
|
+
ClassVar,
|
|
11
|
+
Collection,
|
|
12
|
+
Generic,
|
|
13
|
+
IO,
|
|
14
|
+
Iterable,
|
|
15
|
+
Iterator,
|
|
16
|
+
Mapping,
|
|
17
|
+
Sequence,
|
|
18
|
+
TypeVar,
|
|
19
|
+
overload,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__version__: str
|
|
23
|
+
|
|
24
|
+
class LarkError(Exception): ...
|
|
25
|
+
class ConfigurationError(LarkError, ValueError): ...
|
|
26
|
+
|
|
27
|
+
def assert_config(
|
|
28
|
+
value, options: Collection, msg: str = "Got %r, expected one of %s"
|
|
29
|
+
): ...
|
|
30
|
+
|
|
31
|
+
class GrammarError(LarkError): ...
|
|
32
|
+
class ParseError(LarkError): ...
|
|
33
|
+
class LexError(LarkError): ...
|
|
34
|
+
|
|
35
|
+
T = TypeVar("T")
|
|
36
|
+
|
|
37
|
+
class UnexpectedInput(LarkError):
|
|
38
|
+
line: int
|
|
39
|
+
column: int
|
|
40
|
+
pos_in_stream: Incomplete
|
|
41
|
+
state: Any
|
|
42
|
+
interactive_parser: InteractiveParser
|
|
43
|
+
def get_context(self, text: str, span: int = 40) -> str: ...
|
|
44
|
+
def match_examples(
|
|
45
|
+
self,
|
|
46
|
+
parse_fn: Callable[[str], Tree],
|
|
47
|
+
examples: Mapping[T, Iterable[str]] | Iterable[tuple[T, Iterable[str]]],
|
|
48
|
+
token_type_match_fallback: bool = False,
|
|
49
|
+
use_accepts: bool = True,
|
|
50
|
+
) -> T | None: ...
|
|
51
|
+
|
|
52
|
+
class UnexpectedEOF(ParseError, UnexpectedInput):
|
|
53
|
+
expected: list[Token]
|
|
54
|
+
state: Incomplete
|
|
55
|
+
token: Incomplete
|
|
56
|
+
pos_in_stream: int
|
|
57
|
+
line: int
|
|
58
|
+
column: int
|
|
59
|
+
def __init__(
|
|
60
|
+
self,
|
|
61
|
+
expected,
|
|
62
|
+
state: Incomplete | None = None,
|
|
63
|
+
terminals_by_name: Incomplete | None = None,
|
|
64
|
+
) -> None: ...
|
|
65
|
+
|
|
66
|
+
class UnexpectedCharacters(LexError, UnexpectedInput):
|
|
67
|
+
allowed: set[str]
|
|
68
|
+
considered_tokens: set[Any]
|
|
69
|
+
line: Incomplete
|
|
70
|
+
column: Incomplete
|
|
71
|
+
pos_in_stream: Incomplete
|
|
72
|
+
state: Incomplete
|
|
73
|
+
considered_rules: Incomplete
|
|
74
|
+
token_history: Incomplete
|
|
75
|
+
char: Incomplete
|
|
76
|
+
def __init__(
|
|
77
|
+
self,
|
|
78
|
+
seq,
|
|
79
|
+
lex_pos,
|
|
80
|
+
line,
|
|
81
|
+
column,
|
|
82
|
+
allowed: Incomplete | None = None,
|
|
83
|
+
considered_tokens: Incomplete | None = None,
|
|
84
|
+
state: Incomplete | None = None,
|
|
85
|
+
token_history: Incomplete | None = None,
|
|
86
|
+
terminals_by_name: Incomplete | None = None,
|
|
87
|
+
considered_rules: Incomplete | None = None,
|
|
88
|
+
) -> None: ...
|
|
89
|
+
|
|
90
|
+
class UnexpectedToken(ParseError, UnexpectedInput):
|
|
91
|
+
expected: set[str]
|
|
92
|
+
considered_rules: set[str]
|
|
93
|
+
line: Incomplete
|
|
94
|
+
column: Incomplete
|
|
95
|
+
pos_in_stream: Incomplete
|
|
96
|
+
state: Incomplete
|
|
97
|
+
token: Incomplete
|
|
98
|
+
interactive_parser: Incomplete
|
|
99
|
+
token_history: Incomplete
|
|
100
|
+
def __init__(
|
|
101
|
+
self,
|
|
102
|
+
token,
|
|
103
|
+
expected,
|
|
104
|
+
considered_rules: Incomplete | None = None,
|
|
105
|
+
state: Incomplete | None = None,
|
|
106
|
+
interactive_parser: Incomplete | None = None,
|
|
107
|
+
terminals_by_name: Incomplete | None = None,
|
|
108
|
+
token_history: Incomplete | None = None,
|
|
109
|
+
) -> None: ...
|
|
110
|
+
@property
|
|
111
|
+
def accepts(self) -> set[str]: ...
|
|
112
|
+
|
|
113
|
+
class VisitError(LarkError):
|
|
114
|
+
obj: Tree | Token
|
|
115
|
+
orig_exc: Exception
|
|
116
|
+
rule: Incomplete
|
|
117
|
+
def __init__(self, rule, obj, orig_exc) -> None: ...
|
|
118
|
+
|
|
119
|
+
class MissingVariableError(LarkError): ...
|
|
120
|
+
|
|
121
|
+
logger: logging.Logger
|
|
122
|
+
NO_VALUE: Incomplete
|
|
123
|
+
T = TypeVar("T")
|
|
124
|
+
|
|
125
|
+
def classify(
|
|
126
|
+
seq: Iterable, key: Callable | None = None, value: Callable | None = None
|
|
127
|
+
) -> dict: ...
|
|
128
|
+
|
|
129
|
+
class Serialize:
|
|
130
|
+
def memo_serialize(self, types_to_memoize: list) -> Any: ...
|
|
131
|
+
def serialize(self, memo: Incomplete | None = None) -> dict[str, Any]: ...
|
|
132
|
+
@classmethod
|
|
133
|
+
def deserialize(cls, data: dict[str, Any], memo: dict[int, Any]) -> _T: ...
|
|
134
|
+
|
|
135
|
+
class SerializeMemoizer(Serialize):
|
|
136
|
+
__serialize_fields__: Incomplete
|
|
137
|
+
types_to_memoize: Incomplete
|
|
138
|
+
memoized: Incomplete
|
|
139
|
+
def __init__(self, types_to_memoize: list) -> None: ...
|
|
140
|
+
def in_types(self, value: Serialize) -> bool: ...
|
|
141
|
+
def serialize(self) -> dict[int, Any]: ...
|
|
142
|
+
@classmethod
|
|
143
|
+
def deserialize(
|
|
144
|
+
cls, data: dict[int, Any], namespace: dict[str, Any], memo: dict[Any, Any]
|
|
145
|
+
) -> dict[int, Any]: ...
|
|
146
|
+
|
|
147
|
+
categ_pattern: Incomplete
|
|
148
|
+
|
|
149
|
+
def get_regexp_width(expr: str) -> tuple[int, int] | list[int]: ...
|
|
150
|
+
|
|
151
|
+
class Meta:
|
|
152
|
+
empty: bool
|
|
153
|
+
line: int
|
|
154
|
+
column: int
|
|
155
|
+
start_pos: int
|
|
156
|
+
end_line: int
|
|
157
|
+
end_column: int
|
|
158
|
+
end_pos: int
|
|
159
|
+
orig_expansion: list[TerminalDef]
|
|
160
|
+
match_tree: bool
|
|
161
|
+
def __init__(self) -> None: ...
|
|
162
|
+
|
|
163
|
+
Branch: Incomplete
|
|
164
|
+
|
|
165
|
+
class Tree(Generic[_Leaf_T]):
|
|
166
|
+
data: str
|
|
167
|
+
children: list[Branch[_Leaf_T]]
|
|
168
|
+
def __init__(
|
|
169
|
+
self, data: str, children: list[Branch[_Leaf_T]], meta: Meta | None = None
|
|
170
|
+
) -> None: ...
|
|
171
|
+
@property
|
|
172
|
+
def meta(self) -> Meta: ...
|
|
173
|
+
def pretty(self, indent_str: str = " ") -> str: ...
|
|
174
|
+
def __rich__(self, parent: rich.tree.Tree | None = None) -> rich.tree.Tree: ...
|
|
175
|
+
def __eq__(self, other): ...
|
|
176
|
+
def __ne__(self, other): ...
|
|
177
|
+
def __hash__(self) -> int: ...
|
|
178
|
+
def iter_subtrees(self) -> Iterator[Tree[_Leaf_T]]: ...
|
|
179
|
+
def iter_subtrees_topdown(self) -> Generator[Incomplete, None, None]: ...
|
|
180
|
+
def find_pred(
|
|
181
|
+
self, pred: Callable[[Tree[_Leaf_T]], bool]
|
|
182
|
+
) -> Iterator[Tree[_Leaf_T]]: ...
|
|
183
|
+
def find_data(self, data: str) -> Iterator[Tree[_Leaf_T]]: ...
|
|
184
|
+
|
|
185
|
+
class _DiscardType: ...
|
|
186
|
+
|
|
187
|
+
Discard: Incomplete
|
|
188
|
+
|
|
189
|
+
class _Decoratable:
|
|
190
|
+
def __class_getitem__(cls, _): ...
|
|
191
|
+
|
|
192
|
+
class Transformer(_Decoratable, ABC, Generic[_Leaf_T, _Return_T]):
|
|
193
|
+
__visit_tokens__: bool
|
|
194
|
+
def __init__(self, visit_tokens: bool = True) -> None: ...
|
|
195
|
+
def transform(self, tree: Tree[_Leaf_T]) -> _Return_T: ...
|
|
196
|
+
def __mul__(
|
|
197
|
+
self,
|
|
198
|
+
other: Transformer[_Leaf_U, _Return_V] | TransformerChain[_Leaf_U, _Return_V],
|
|
199
|
+
) -> TransformerChain[_Leaf_T, _Return_V]: ...
|
|
200
|
+
def __default__(self, data, children, meta): ...
|
|
201
|
+
def __default_token__(self, token): ...
|
|
202
|
+
|
|
203
|
+
def merge_transformers(
|
|
204
|
+
base_transformer: Incomplete | None = None, **transformers_to_merge
|
|
205
|
+
): ...
|
|
206
|
+
|
|
207
|
+
class InlineTransformer(Transformer): ...
|
|
208
|
+
|
|
209
|
+
class TransformerChain(Generic[_Leaf_T, _Return_T]):
|
|
210
|
+
transformers: tuple[Transformer | TransformerChain, ...]
|
|
211
|
+
def __init__(self, *transformers: Transformer | TransformerChain) -> None: ...
|
|
212
|
+
def transform(self, tree: Tree[_Leaf_T]) -> _Return_T: ...
|
|
213
|
+
def __mul__(
|
|
214
|
+
self,
|
|
215
|
+
other: Transformer[_Leaf_U, _Return_V] | TransformerChain[_Leaf_U, _Return_V],
|
|
216
|
+
) -> TransformerChain[_Leaf_T, _Return_V]: ...
|
|
217
|
+
|
|
218
|
+
class Transformer_InPlace(Transformer[_Leaf_T, _Return_T]):
|
|
219
|
+
def transform(self, tree: Tree[_Leaf_T]) -> _Return_T: ...
|
|
220
|
+
|
|
221
|
+
class Transformer_NonRecursive(Transformer[_Leaf_T, _Return_T]):
|
|
222
|
+
def transform(self, tree: Tree[_Leaf_T]) -> _Return_T: ...
|
|
223
|
+
|
|
224
|
+
class Transformer_InPlaceRecursive(Transformer): ...
|
|
225
|
+
|
|
226
|
+
class VisitorBase:
|
|
227
|
+
def __default__(self, tree): ...
|
|
228
|
+
def __class_getitem__(cls, _): ...
|
|
229
|
+
|
|
230
|
+
class Visitor(VisitorBase, ABC, Generic[_Leaf_T]):
|
|
231
|
+
def visit(self, tree: Tree[_Leaf_T]) -> Tree[_Leaf_T]: ...
|
|
232
|
+
def visit_topdown(self, tree: Tree[_Leaf_T]) -> Tree[_Leaf_T]: ...
|
|
233
|
+
|
|
234
|
+
class Visitor_Recursive(VisitorBase, Generic[_Leaf_T]):
|
|
235
|
+
def visit(self, tree: Tree[_Leaf_T]) -> Tree[_Leaf_T]: ...
|
|
236
|
+
def visit_topdown(self, tree: Tree[_Leaf_T]) -> Tree[_Leaf_T]: ...
|
|
237
|
+
|
|
238
|
+
class Interpreter(_Decoratable, ABC, Generic[_Leaf_T, _Return_T]):
|
|
239
|
+
def visit(self, tree: Tree[_Leaf_T]) -> _Return_T: ...
|
|
240
|
+
def visit_children(self, tree: Tree[_Leaf_T]) -> list: ...
|
|
241
|
+
def __getattr__(self, name): ...
|
|
242
|
+
def __default__(self, tree): ...
|
|
243
|
+
|
|
244
|
+
def visit_children_decor(func: _InterMethod) -> _InterMethod: ...
|
|
245
|
+
|
|
246
|
+
class _VArgsWrapper:
|
|
247
|
+
base_func: Callable
|
|
248
|
+
visit_wrapper: Incomplete
|
|
249
|
+
def __init__(
|
|
250
|
+
self, func: Callable, visit_wrapper: Callable[[Callable, str, list, Any], Any]
|
|
251
|
+
) -> None: ...
|
|
252
|
+
def __call__(self, *args, **kwargs): ...
|
|
253
|
+
def __get__(self, instance, owner: Incomplete | None = None): ...
|
|
254
|
+
def __set_name__(self, owner, name) -> None: ...
|
|
255
|
+
|
|
256
|
+
def v_args(
|
|
257
|
+
inline: bool = False,
|
|
258
|
+
meta: bool = False,
|
|
259
|
+
tree: bool = False,
|
|
260
|
+
wrapper: Callable | None = None,
|
|
261
|
+
) -> Callable[[_DECORATED], _DECORATED]: ...
|
|
262
|
+
|
|
263
|
+
TOKEN_DEFAULT_PRIORITY: int
|
|
264
|
+
|
|
265
|
+
class Symbol(Serialize):
|
|
266
|
+
name: str
|
|
267
|
+
is_term: ClassVar[bool]
|
|
268
|
+
def __init__(self, name: str) -> None: ...
|
|
269
|
+
def __eq__(self, other): ...
|
|
270
|
+
def __ne__(self, other): ...
|
|
271
|
+
def __hash__(self): ...
|
|
272
|
+
fullrepr: Incomplete
|
|
273
|
+
def renamed(self, f): ...
|
|
274
|
+
|
|
275
|
+
class Terminal(Symbol):
|
|
276
|
+
__serialize_fields__: Incomplete
|
|
277
|
+
is_term: ClassVar[bool]
|
|
278
|
+
name: Incomplete
|
|
279
|
+
filter_out: Incomplete
|
|
280
|
+
def __init__(self, name, filter_out: bool = False) -> None: ...
|
|
281
|
+
@property
|
|
282
|
+
def fullrepr(self): ...
|
|
283
|
+
def renamed(self, f): ...
|
|
284
|
+
|
|
285
|
+
class NonTerminal(Symbol):
|
|
286
|
+
__serialize_fields__: Incomplete
|
|
287
|
+
is_term: ClassVar[bool]
|
|
288
|
+
|
|
289
|
+
class RuleOptions(Serialize):
|
|
290
|
+
__serialize_fields__: Incomplete
|
|
291
|
+
keep_all_tokens: bool
|
|
292
|
+
expand1: bool
|
|
293
|
+
priority: int | None
|
|
294
|
+
template_source: str | None
|
|
295
|
+
empty_indices: tuple[bool, ...]
|
|
296
|
+
def __init__(
|
|
297
|
+
self,
|
|
298
|
+
keep_all_tokens: bool = False,
|
|
299
|
+
expand1: bool = False,
|
|
300
|
+
priority: int | None = None,
|
|
301
|
+
template_source: str | None = None,
|
|
302
|
+
empty_indices: tuple[bool, ...] = (),
|
|
303
|
+
) -> None: ...
|
|
304
|
+
|
|
305
|
+
class Rule(Serialize):
|
|
306
|
+
__serialize_fields__: Incomplete
|
|
307
|
+
__serialize_namespace__: Incomplete
|
|
308
|
+
origin: NonTerminal
|
|
309
|
+
expansion: Sequence[Symbol]
|
|
310
|
+
order: int
|
|
311
|
+
alias: str | None
|
|
312
|
+
options: RuleOptions
|
|
313
|
+
def __init__(
|
|
314
|
+
self,
|
|
315
|
+
origin: NonTerminal,
|
|
316
|
+
expansion: Sequence[Symbol],
|
|
317
|
+
order: int = 0,
|
|
318
|
+
alias: str | None = None,
|
|
319
|
+
options: RuleOptions | None = None,
|
|
320
|
+
) -> None: ...
|
|
321
|
+
def __hash__(self): ...
|
|
322
|
+
def __eq__(self, other): ...
|
|
323
|
+
|
|
324
|
+
has_interegular: Incomplete
|
|
325
|
+
|
|
326
|
+
class Pattern(Serialize, ABC, metaclass=abc.ABCMeta):
|
|
327
|
+
value: str
|
|
328
|
+
flags: Collection[str]
|
|
329
|
+
raw: str | None
|
|
330
|
+
type: ClassVar[str]
|
|
331
|
+
def __init__(
|
|
332
|
+
self, value: str, flags: Collection[str] = (), raw: str | None = None
|
|
333
|
+
) -> None: ...
|
|
334
|
+
def __hash__(self): ...
|
|
335
|
+
def __eq__(self, other): ...
|
|
336
|
+
@abstractmethod
|
|
337
|
+
def to_regexp(self) -> str: ...
|
|
338
|
+
@property
|
|
339
|
+
@abstractmethod
|
|
340
|
+
def min_width(self) -> int: ...
|
|
341
|
+
@property
|
|
342
|
+
@abstractmethod
|
|
343
|
+
def max_width(self) -> int: ...
|
|
344
|
+
|
|
345
|
+
class PatternStr(Pattern):
|
|
346
|
+
__serialize_fields__: Incomplete
|
|
347
|
+
type: ClassVar[str]
|
|
348
|
+
def to_regexp(self) -> str: ...
|
|
349
|
+
@property
|
|
350
|
+
def min_width(self) -> int: ...
|
|
351
|
+
@property
|
|
352
|
+
def max_width(self) -> int: ...
|
|
353
|
+
|
|
354
|
+
class PatternRE(Pattern):
|
|
355
|
+
__serialize_fields__: Incomplete
|
|
356
|
+
type: ClassVar[str]
|
|
357
|
+
def to_regexp(self) -> str: ...
|
|
358
|
+
@property
|
|
359
|
+
def min_width(self) -> int: ...
|
|
360
|
+
@property
|
|
361
|
+
def max_width(self) -> int: ...
|
|
362
|
+
|
|
363
|
+
class TerminalDef(Serialize):
|
|
364
|
+
__serialize_fields__: Incomplete
|
|
365
|
+
__serialize_namespace__: Incomplete
|
|
366
|
+
name: str
|
|
367
|
+
pattern: Pattern
|
|
368
|
+
priority: int
|
|
369
|
+
def __init__(self, name: str, pattern: Pattern, priority: int = ...) -> None: ...
|
|
370
|
+
def user_repr(self) -> str: ...
|
|
371
|
+
|
|
372
|
+
class Token(str):
|
|
373
|
+
__match_args__: Incomplete
|
|
374
|
+
type: str
|
|
375
|
+
start_pos: int | None
|
|
376
|
+
value: Any
|
|
377
|
+
line: int | None
|
|
378
|
+
column: int | None
|
|
379
|
+
end_line: int | None
|
|
380
|
+
end_column: int | None
|
|
381
|
+
end_pos: int | None
|
|
382
|
+
@overload
|
|
383
|
+
def __new__(
|
|
384
|
+
cls,
|
|
385
|
+
type: str,
|
|
386
|
+
value: Any,
|
|
387
|
+
start_pos: int | None = None,
|
|
388
|
+
line: int | None = None,
|
|
389
|
+
column: int | None = None,
|
|
390
|
+
end_line: int | None = None,
|
|
391
|
+
end_column: int | None = None,
|
|
392
|
+
end_pos: int | None = None,
|
|
393
|
+
) -> Token: ...
|
|
394
|
+
@overload
|
|
395
|
+
def __new__(
|
|
396
|
+
cls,
|
|
397
|
+
type_: str,
|
|
398
|
+
value: Any,
|
|
399
|
+
start_pos: int | None = None,
|
|
400
|
+
line: int | None = None,
|
|
401
|
+
column: int | None = None,
|
|
402
|
+
end_line: int | None = None,
|
|
403
|
+
end_column: int | None = None,
|
|
404
|
+
end_pos: int | None = None,
|
|
405
|
+
) -> Token: ...
|
|
406
|
+
@overload
|
|
407
|
+
def update(self, type: str | None = None, value: Any | None = None) -> Token: ...
|
|
408
|
+
@overload
|
|
409
|
+
def update(self, type_: str | None = None, value: Any | None = None) -> Token: ...
|
|
410
|
+
@classmethod
|
|
411
|
+
def new_borrow_pos(cls, type_: str, value: Any, borrow_t: Token) -> _T: ...
|
|
412
|
+
def __reduce__(self): ...
|
|
413
|
+
def __deepcopy__(self, memo): ...
|
|
414
|
+
def __eq__(self, other): ...
|
|
415
|
+
__hash__: Incomplete
|
|
416
|
+
|
|
417
|
+
class LineCounter:
|
|
418
|
+
newline_char: Incomplete
|
|
419
|
+
char_pos: int
|
|
420
|
+
line: int
|
|
421
|
+
column: int
|
|
422
|
+
line_start_pos: int
|
|
423
|
+
def __init__(self, newline_char) -> None: ...
|
|
424
|
+
def __eq__(self, other): ...
|
|
425
|
+
def feed(self, token: Token, test_newline: bool = True): ...
|
|
426
|
+
|
|
427
|
+
class UnlessCallback:
|
|
428
|
+
scanner: Incomplete
|
|
429
|
+
def __init__(self, scanner) -> None: ...
|
|
430
|
+
def __call__(self, t): ...
|
|
431
|
+
|
|
432
|
+
class CallChain:
|
|
433
|
+
callback1: Incomplete
|
|
434
|
+
callback2: Incomplete
|
|
435
|
+
cond: Incomplete
|
|
436
|
+
def __init__(self, callback1, callback2, cond) -> None: ...
|
|
437
|
+
def __call__(self, t): ...
|
|
438
|
+
|
|
439
|
+
class Scanner:
|
|
440
|
+
terminals: Incomplete
|
|
441
|
+
g_regex_flags: Incomplete
|
|
442
|
+
re_: Incomplete
|
|
443
|
+
use_bytes: Incomplete
|
|
444
|
+
match_whole: Incomplete
|
|
445
|
+
allowed_types: Incomplete
|
|
446
|
+
def __init__(
|
|
447
|
+
self, terminals, g_regex_flags, re_, use_bytes, match_whole: bool = False
|
|
448
|
+
) -> None: ...
|
|
449
|
+
def match(self, text, pos): ...
|
|
450
|
+
|
|
451
|
+
class LexerState:
|
|
452
|
+
text: str
|
|
453
|
+
line_ctr: LineCounter
|
|
454
|
+
last_token: Token | None
|
|
455
|
+
def __init__(
|
|
456
|
+
self,
|
|
457
|
+
text: str,
|
|
458
|
+
line_ctr: LineCounter | None = None,
|
|
459
|
+
last_token: Token | None = None,
|
|
460
|
+
) -> None: ...
|
|
461
|
+
def __eq__(self, other): ...
|
|
462
|
+
def __copy__(self): ...
|
|
463
|
+
|
|
464
|
+
class LexerThread:
|
|
465
|
+
lexer: Incomplete
|
|
466
|
+
state: Incomplete
|
|
467
|
+
def __init__(self, lexer: Lexer, lexer_state: LexerState) -> None: ...
|
|
468
|
+
@classmethod
|
|
469
|
+
def from_text(cls, lexer: Lexer, text: str) -> LexerThread: ...
|
|
470
|
+
def lex(self, parser_state): ...
|
|
471
|
+
def __copy__(self): ...
|
|
472
|
+
|
|
473
|
+
class Lexer(ABC, metaclass=abc.ABCMeta):
|
|
474
|
+
@abstractmethod
|
|
475
|
+
def lex(self, lexer_state: LexerState, parser_state: Any) -> Iterator[Token]: ...
|
|
476
|
+
def make_lexer_state(self, text): ...
|
|
477
|
+
|
|
478
|
+
class AbstractBasicLexer(Lexer, metaclass=abc.ABCMeta):
|
|
479
|
+
terminals_by_name: dict[str, TerminalDef]
|
|
480
|
+
@abstractmethod
|
|
481
|
+
def __init__(self, conf: LexerConf, comparator: Incomplete | None = None): ...
|
|
482
|
+
@abstractmethod
|
|
483
|
+
def next_token(self, lex_state: LexerState, parser_state: Any = None) -> Token: ...
|
|
484
|
+
def lex(self, state: LexerState, parser_state: Any) -> Iterator[Token]: ...
|
|
485
|
+
|
|
486
|
+
class BasicLexer(AbstractBasicLexer):
|
|
487
|
+
terminals: Collection[TerminalDef]
|
|
488
|
+
ignore_types: frozenset[str]
|
|
489
|
+
newline_types: frozenset[str]
|
|
490
|
+
user_callbacks: dict[str, _Callback]
|
|
491
|
+
callback: dict[str, _Callback]
|
|
492
|
+
re: ModuleType
|
|
493
|
+
g_regex_flags: Incomplete
|
|
494
|
+
use_bytes: Incomplete
|
|
495
|
+
terminals_by_name: Incomplete
|
|
496
|
+
def __init__(
|
|
497
|
+
self, conf: LexerConf, comparator: Incomplete | None = None
|
|
498
|
+
) -> None: ...
|
|
499
|
+
@property
|
|
500
|
+
def scanner(self): ...
|
|
501
|
+
def match(self, text, pos): ...
|
|
502
|
+
def next_token(self, lex_state: LexerState, parser_state: Any = None) -> Token: ...
|
|
503
|
+
|
|
504
|
+
class ContextualLexer(Lexer):
|
|
505
|
+
lexers: dict[int, AbstractBasicLexer]
|
|
506
|
+
root_lexer: AbstractBasicLexer
|
|
507
|
+
BasicLexer: type[AbstractBasicLexer]
|
|
508
|
+
def __init__(
|
|
509
|
+
self,
|
|
510
|
+
conf: LexerConf,
|
|
511
|
+
states: dict[int, Collection[str]],
|
|
512
|
+
always_accept: Collection[str] = (),
|
|
513
|
+
) -> None: ...
|
|
514
|
+
def lex(
|
|
515
|
+
self, lexer_state: LexerState, parser_state: ParserState
|
|
516
|
+
) -> Iterator[Token]: ...
|
|
517
|
+
|
|
518
|
+
ParserCallbacks = dict[str, Callable]
|
|
519
|
+
|
|
520
|
+
class LexerConf(Serialize):
|
|
521
|
+
__serialize_fields__: Incomplete
|
|
522
|
+
__serialize_namespace__: Incomplete
|
|
523
|
+
terminals: Collection[TerminalDef]
|
|
524
|
+
re_module: ModuleType
|
|
525
|
+
ignore: Collection[str]
|
|
526
|
+
postlex: PostLex | None
|
|
527
|
+
callbacks: dict[str, _LexerCallback]
|
|
528
|
+
g_regex_flags: int
|
|
529
|
+
skip_validation: bool
|
|
530
|
+
use_bytes: bool
|
|
531
|
+
lexer_type: _LexerArgType | None
|
|
532
|
+
strict: bool
|
|
533
|
+
terminals_by_name: Incomplete
|
|
534
|
+
def __init__(
|
|
535
|
+
self,
|
|
536
|
+
terminals: Collection[TerminalDef],
|
|
537
|
+
re_module: ModuleType,
|
|
538
|
+
ignore: Collection[str] = (),
|
|
539
|
+
postlex: PostLex | None = None,
|
|
540
|
+
callbacks: dict[str, _LexerCallback] | None = None,
|
|
541
|
+
g_regex_flags: int = 0,
|
|
542
|
+
skip_validation: bool = False,
|
|
543
|
+
use_bytes: bool = False,
|
|
544
|
+
strict: bool = False,
|
|
545
|
+
) -> None: ...
|
|
546
|
+
def __deepcopy__(self, memo: Incomplete | None = None): ...
|
|
547
|
+
|
|
548
|
+
class ParserConf(Serialize):
|
|
549
|
+
__serialize_fields__: Incomplete
|
|
550
|
+
rules: list["Rule"]
|
|
551
|
+
callbacks: ParserCallbacks
|
|
552
|
+
start: list[str]
|
|
553
|
+
parser_type: _ParserArgType
|
|
554
|
+
def __init__(
|
|
555
|
+
self, rules: list["Rule"], callbacks: ParserCallbacks, start: list[str]
|
|
556
|
+
) -> None: ...
|
|
557
|
+
|
|
558
|
+
class ExpandSingleChild:
|
|
559
|
+
node_builder: Incomplete
|
|
560
|
+
def __init__(self, node_builder) -> None: ...
|
|
561
|
+
def __call__(self, children): ...
|
|
562
|
+
|
|
563
|
+
class PropagatePositions:
|
|
564
|
+
node_builder: Incomplete
|
|
565
|
+
node_filter: Incomplete
|
|
566
|
+
def __init__(self, node_builder, node_filter: Incomplete | None = None) -> None: ...
|
|
567
|
+
def __call__(self, children): ...
|
|
568
|
+
|
|
569
|
+
def make_propagate_positions(option): ...
|
|
570
|
+
|
|
571
|
+
class ChildFilter:
|
|
572
|
+
node_builder: Incomplete
|
|
573
|
+
to_include: Incomplete
|
|
574
|
+
append_none: Incomplete
|
|
575
|
+
def __init__(self, to_include, append_none, node_builder) -> None: ...
|
|
576
|
+
def __call__(self, children): ...
|
|
577
|
+
|
|
578
|
+
class ChildFilterLALR(ChildFilter):
|
|
579
|
+
def __call__(self, children): ...
|
|
580
|
+
|
|
581
|
+
class ChildFilterLALR_NoPlaceholders(ChildFilter):
|
|
582
|
+
node_builder: Incomplete
|
|
583
|
+
to_include: Incomplete
|
|
584
|
+
def __init__(self, to_include, node_builder) -> None: ...
|
|
585
|
+
def __call__(self, children): ...
|
|
586
|
+
|
|
587
|
+
def maybe_create_child_filter(
|
|
588
|
+
expansion, keep_all_tokens, ambiguous, _empty_indices: list[bool]
|
|
589
|
+
): ...
|
|
590
|
+
|
|
591
|
+
class AmbiguousExpander:
|
|
592
|
+
node_builder: Incomplete
|
|
593
|
+
tree_class: Incomplete
|
|
594
|
+
to_expand: Incomplete
|
|
595
|
+
def __init__(self, to_expand, tree_class, node_builder) -> None: ...
|
|
596
|
+
def __call__(self, children): ...
|
|
597
|
+
|
|
598
|
+
def maybe_create_ambiguous_expander(tree_class, expansion, keep_all_tokens): ...
|
|
599
|
+
|
|
600
|
+
class AmbiguousIntermediateExpander:
|
|
601
|
+
node_builder: Incomplete
|
|
602
|
+
tree_class: Incomplete
|
|
603
|
+
def __init__(self, tree_class, node_builder) -> None: ...
|
|
604
|
+
def __call__(self, children): ...
|
|
605
|
+
|
|
606
|
+
def inplace_transformer(func): ...
|
|
607
|
+
def apply_visit_wrapper(func, name, wrapper): ...
|
|
608
|
+
|
|
609
|
+
class ParseTreeBuilder:
|
|
610
|
+
tree_class: Incomplete
|
|
611
|
+
propagate_positions: Incomplete
|
|
612
|
+
ambiguous: Incomplete
|
|
613
|
+
maybe_placeholders: Incomplete
|
|
614
|
+
rule_builders: Incomplete
|
|
615
|
+
def __init__(
|
|
616
|
+
self,
|
|
617
|
+
rules,
|
|
618
|
+
tree_class,
|
|
619
|
+
propagate_positions: bool = False,
|
|
620
|
+
ambiguous: bool = False,
|
|
621
|
+
maybe_placeholders: bool = False,
|
|
622
|
+
) -> None: ...
|
|
623
|
+
def create_callback(self, transformer: Incomplete | None = None): ...
|
|
624
|
+
|
|
625
|
+
class Action:
|
|
626
|
+
name: Incomplete
|
|
627
|
+
def __init__(self, name) -> None: ...
|
|
628
|
+
|
|
629
|
+
Shift: Incomplete
|
|
630
|
+
Reduce: Incomplete
|
|
631
|
+
StateT = TypeVar("StateT")
|
|
632
|
+
|
|
633
|
+
class ParseTableBase(Generic[StateT]):
|
|
634
|
+
states: dict[StateT, dict[str, tuple]]
|
|
635
|
+
start_states: dict[str, StateT]
|
|
636
|
+
end_states: dict[str, StateT]
|
|
637
|
+
def __init__(self, states, start_states, end_states) -> None: ...
|
|
638
|
+
def serialize(self, memo): ...
|
|
639
|
+
@classmethod
|
|
640
|
+
def deserialize(cls, data, memo): ...
|
|
641
|
+
|
|
642
|
+
class ParseTable(ParseTableBase["State"]): ...
|
|
643
|
+
|
|
644
|
+
class IntParseTable(ParseTableBase[int]):
|
|
645
|
+
@classmethod
|
|
646
|
+
def from_ParseTable(cls, parse_table: ParseTable): ...
|
|
647
|
+
|
|
648
|
+
class ParseConf(Generic[StateT]):
|
|
649
|
+
parse_table: ParseTableBase[StateT]
|
|
650
|
+
callbacks: ParserCallbacks
|
|
651
|
+
start: str
|
|
652
|
+
start_state: StateT
|
|
653
|
+
end_state: StateT
|
|
654
|
+
states: dict[StateT, dict[str, tuple]]
|
|
655
|
+
def __init__(
|
|
656
|
+
self,
|
|
657
|
+
parse_table: ParseTableBase[StateT],
|
|
658
|
+
callbacks: ParserCallbacks,
|
|
659
|
+
start: str,
|
|
660
|
+
) -> None: ...
|
|
661
|
+
|
|
662
|
+
class ParserState(Generic[StateT]):
|
|
663
|
+
parse_conf: ParseConf[StateT]
|
|
664
|
+
lexer: LexerThread
|
|
665
|
+
state_stack: list[StateT]
|
|
666
|
+
value_stack: list
|
|
667
|
+
def __init__(
|
|
668
|
+
self,
|
|
669
|
+
parse_conf: ParseConf[StateT],
|
|
670
|
+
lexer: LexerThread,
|
|
671
|
+
state_stack: Incomplete | None = None,
|
|
672
|
+
value_stack: Incomplete | None = None,
|
|
673
|
+
) -> None: ...
|
|
674
|
+
@property
|
|
675
|
+
def position(self) -> StateT: ...
|
|
676
|
+
def __eq__(self, other) -> bool: ...
|
|
677
|
+
def __copy__(self): ...
|
|
678
|
+
def copy(self) -> ParserState[StateT]: ...
|
|
679
|
+
def feed_token(self, token: Token, is_end: bool = False) -> Any: ...
|
|
680
|
+
|
|
681
|
+
class LALR_Parser(Serialize):
|
|
682
|
+
parser_conf: Incomplete
|
|
683
|
+
parser: Incomplete
|
|
684
|
+
def __init__(
|
|
685
|
+
self, parser_conf: ParserConf, debug: bool = False, strict: bool = False
|
|
686
|
+
) -> None: ...
|
|
687
|
+
@classmethod
|
|
688
|
+
def deserialize(cls, data, memo, callbacks, debug: bool = False): ...
|
|
689
|
+
def serialize(self, memo: Any = None) -> dict[str, Any]: ...
|
|
690
|
+
def parse_interactive(self, lexer: LexerThread, start: str): ...
|
|
691
|
+
def parse(self, lexer, start, on_error: Incomplete | None = None): ...
|
|
692
|
+
|
|
693
|
+
class _Parser:
|
|
694
|
+
parse_table: ParseTableBase
|
|
695
|
+
callbacks: ParserCallbacks
|
|
696
|
+
debug: bool
|
|
697
|
+
def __init__(
|
|
698
|
+
self,
|
|
699
|
+
parse_table: ParseTableBase,
|
|
700
|
+
callbacks: ParserCallbacks,
|
|
701
|
+
debug: bool = False,
|
|
702
|
+
) -> None: ...
|
|
703
|
+
def parse(
|
|
704
|
+
self,
|
|
705
|
+
lexer: LexerThread,
|
|
706
|
+
start: str,
|
|
707
|
+
value_stack: Incomplete | None = None,
|
|
708
|
+
state_stack: Incomplete | None = None,
|
|
709
|
+
start_interactive: bool = False,
|
|
710
|
+
): ...
|
|
711
|
+
def parse_from_state(self, state: ParserState, last_token: Token | None = None): ...
|
|
712
|
+
|
|
713
|
+
class InteractiveParser:
|
|
714
|
+
parser: Incomplete
|
|
715
|
+
parser_state: Incomplete
|
|
716
|
+
lexer_thread: Incomplete
|
|
717
|
+
result: Incomplete
|
|
718
|
+
def __init__(self, parser, parser_state, lexer_thread: LexerThread) -> None: ...
|
|
719
|
+
@property
|
|
720
|
+
def lexer_state(self) -> LexerThread: ...
|
|
721
|
+
def feed_token(self, token: Token): ...
|
|
722
|
+
def iter_parse(self) -> Iterator[Token]: ...
|
|
723
|
+
def exhaust_lexer(self) -> list[Token]: ...
|
|
724
|
+
def feed_eof(self, last_token: Incomplete | None = None): ...
|
|
725
|
+
def __copy__(self): ...
|
|
726
|
+
def copy(self): ...
|
|
727
|
+
def __eq__(self, other): ...
|
|
728
|
+
def as_immutable(self): ...
|
|
729
|
+
def pretty(self): ...
|
|
730
|
+
def choices(self): ...
|
|
731
|
+
def accepts(self): ...
|
|
732
|
+
def resume_parse(self): ...
|
|
733
|
+
|
|
734
|
+
class ImmutableInteractiveParser(InteractiveParser):
|
|
735
|
+
result: Incomplete
|
|
736
|
+
def __hash__(self): ...
|
|
737
|
+
def feed_token(self, token): ...
|
|
738
|
+
def exhaust_lexer(self): ...
|
|
739
|
+
def as_mutable(self): ...
|
|
740
|
+
|
|
741
|
+
class ParsingFrontend(Serialize):
|
|
742
|
+
__serialize_fields__: Incomplete
|
|
743
|
+
lexer_conf: LexerConf
|
|
744
|
+
parser_conf: ParserConf
|
|
745
|
+
options: Any
|
|
746
|
+
parser: Incomplete
|
|
747
|
+
skip_lexer: bool
|
|
748
|
+
lexer: Incomplete
|
|
749
|
+
def __init__(
|
|
750
|
+
self,
|
|
751
|
+
lexer_conf: LexerConf,
|
|
752
|
+
parser_conf: ParserConf,
|
|
753
|
+
options,
|
|
754
|
+
parser: Incomplete | None = None,
|
|
755
|
+
) -> None: ...
|
|
756
|
+
def parse(
|
|
757
|
+
self,
|
|
758
|
+
text: str,
|
|
759
|
+
start: Incomplete | None = None,
|
|
760
|
+
on_error: Incomplete | None = None,
|
|
761
|
+
): ...
|
|
762
|
+
def parse_interactive(
|
|
763
|
+
self, text: str | None = None, start: Incomplete | None = None
|
|
764
|
+
): ...
|
|
765
|
+
|
|
766
|
+
class PostLexConnector:
|
|
767
|
+
lexer: Incomplete
|
|
768
|
+
postlexer: Incomplete
|
|
769
|
+
def __init__(self, lexer, postlexer) -> None: ...
|
|
770
|
+
def lex(self, lexer_state, parser_state): ...
|
|
771
|
+
|
|
772
|
+
def create_basic_lexer(lexer_conf, parser, postlex, options) -> BasicLexer: ...
|
|
773
|
+
def create_contextual_lexer(
|
|
774
|
+
lexer_conf: LexerConf, parser, postlex, options
|
|
775
|
+
) -> ContextualLexer: ...
|
|
776
|
+
def create_lalr_parser(
|
|
777
|
+
lexer_conf: LexerConf, parser_conf: ParserConf, options: Incomplete | None = None
|
|
778
|
+
) -> LALR_Parser: ...
|
|
779
|
+
|
|
780
|
+
class PostLex(ABC, metaclass=abc.ABCMeta):
|
|
781
|
+
@abstractmethod
|
|
782
|
+
def process(self, stream: Iterator[Token]) -> Iterator[Token]: ...
|
|
783
|
+
always_accept: Iterable[str]
|
|
784
|
+
|
|
785
|
+
class LarkOptions(Serialize):
|
|
786
|
+
start: list[str]
|
|
787
|
+
debug: bool
|
|
788
|
+
strict: bool
|
|
789
|
+
transformer: Transformer | None
|
|
790
|
+
propagate_positions: bool | str
|
|
791
|
+
maybe_placeholders: bool
|
|
792
|
+
cache: bool | str
|
|
793
|
+
regex: bool
|
|
794
|
+
g_regex_flags: int
|
|
795
|
+
keep_all_tokens: bool
|
|
796
|
+
tree_class: Callable[[str, list], Any] | None
|
|
797
|
+
parser: _ParserArgType
|
|
798
|
+
lexer: _LexerArgType
|
|
799
|
+
ambiguity: Literal["auto", "resolve", "explicit", "forest"]
|
|
800
|
+
postlex: PostLex | None
|
|
801
|
+
priority: Literal["auto", "normal", "invert"] | None
|
|
802
|
+
lexer_callbacks: dict[str, Callable[[Token], Token]]
|
|
803
|
+
use_bytes: bool
|
|
804
|
+
ordered_sets: bool
|
|
805
|
+
edit_terminals: Callable[[TerminalDef], TerminalDef] | None
|
|
806
|
+
import_paths: list[
|
|
807
|
+
str | Callable[[None | str | PackageResource, str], tuple[str, str]]
|
|
808
|
+
]
|
|
809
|
+
source_path: str | None
|
|
810
|
+
OPTIONS_DOC: str
|
|
811
|
+
def __init__(self, options_dict: dict[str, Any]) -> None: ...
|
|
812
|
+
def __getattr__(self, name: str) -> Any: ...
|
|
813
|
+
def __setattr__(self, name: str, value: str) -> None: ...
|
|
814
|
+
def serialize(self, memo: Incomplete | None = None) -> dict[str, Any]: ...
|
|
815
|
+
@classmethod
|
|
816
|
+
def deserialize(
|
|
817
|
+
cls, data: dict[str, Any], memo: dict[int, TerminalDef | Rule]
|
|
818
|
+
) -> LarkOptions: ...
|
|
819
|
+
|
|
820
|
+
class Lark(Serialize):
|
|
821
|
+
source_path: str
|
|
822
|
+
source_grammar: str
|
|
823
|
+
grammar: Grammar
|
|
824
|
+
options: LarkOptions
|
|
825
|
+
lexer: Lexer
|
|
826
|
+
parser: ParsingFrontend
|
|
827
|
+
terminals: Collection[TerminalDef]
|
|
828
|
+
lexer_conf: Incomplete
|
|
829
|
+
def __init__(self, grammar: Grammar | str | IO[str], **options) -> None: ...
|
|
830
|
+
__serialize_fields__: Incomplete
|
|
831
|
+
def save(self, f, exclude_options: Collection[str] = ()) -> None: ...
|
|
832
|
+
@classmethod
|
|
833
|
+
def load(cls, f) -> _T: ...
|
|
834
|
+
@classmethod
|
|
835
|
+
def open(
|
|
836
|
+
cls, grammar_filename: str, rel_to: str | None = None, **options
|
|
837
|
+
) -> _T: ...
|
|
838
|
+
@classmethod
|
|
839
|
+
def open_from_package(
|
|
840
|
+
cls,
|
|
841
|
+
package: str,
|
|
842
|
+
grammar_path: str,
|
|
843
|
+
search_paths: Sequence[str] = [""],
|
|
844
|
+
**options
|
|
845
|
+
) -> _T: ...
|
|
846
|
+
def lex(self, text: str, dont_ignore: bool = False) -> Iterator[Token]: ...
|
|
847
|
+
def get_terminal(self, name: str) -> TerminalDef: ...
|
|
848
|
+
def parse_interactive(
|
|
849
|
+
self, text: str | None = None, start: str | None = None
|
|
850
|
+
) -> InteractiveParser: ...
|
|
851
|
+
def parse(
|
|
852
|
+
self,
|
|
853
|
+
text: str,
|
|
854
|
+
start: str | None = None,
|
|
855
|
+
on_error: Callable[[UnexpectedInput], bool] | None = None,
|
|
856
|
+
) -> ParseTree: ...
|
|
857
|
+
|
|
858
|
+
class DedentError(LarkError): ...
|
|
859
|
+
|
|
860
|
+
class Indenter(PostLex, ABC, metaclass=abc.ABCMeta):
|
|
861
|
+
paren_level: int
|
|
862
|
+
indent_level: list[int]
|
|
863
|
+
def __init__(self) -> None: ...
|
|
864
|
+
def handle_NL(self, token: Token) -> Iterator[Token]: ...
|
|
865
|
+
def process(self, stream): ...
|
|
866
|
+
@property
|
|
867
|
+
def always_accept(self): ...
|
|
868
|
+
@property
|
|
869
|
+
@abstractmethod
|
|
870
|
+
def NL_type(self) -> str: ...
|
|
871
|
+
@property
|
|
872
|
+
@abstractmethod
|
|
873
|
+
def OPEN_PAREN_types(self) -> list[str]: ...
|
|
874
|
+
@property
|
|
875
|
+
@abstractmethod
|
|
876
|
+
def CLOSE_PAREN_types(self) -> list[str]: ...
|
|
877
|
+
@property
|
|
878
|
+
@abstractmethod
|
|
879
|
+
def INDENT_type(self) -> str: ...
|
|
880
|
+
@property
|
|
881
|
+
@abstractmethod
|
|
882
|
+
def DEDENT_type(self) -> str: ...
|
|
883
|
+
@property
|
|
884
|
+
@abstractmethod
|
|
885
|
+
def tab_len(self) -> int: ...
|
|
886
|
+
|
|
887
|
+
class PythonIndenter(Indenter):
|
|
888
|
+
NL_type: str
|
|
889
|
+
OPEN_PAREN_types: Incomplete
|
|
890
|
+
CLOSE_PAREN_types: Incomplete
|
|
891
|
+
INDENT_type: str
|
|
892
|
+
DEDENT_type: str
|
|
893
|
+
tab_len: int
|
|
894
|
+
|
|
895
|
+
DATA: bytes
|
|
896
|
+
MEMO: bytes
|
|
897
|
+
|
|
898
|
+
def Lark_StandAlone(**kwargs): ...
|