lark/lark-stubs/tree.pyi

73 lines
1.4 KiB
Python
Raw Normal View History

2020-02-13 14:34:05 +00:00
# -*- coding: utf-8 -*-
2020-02-16 06:09:53 +00:00
from typing import List, Callable, Iterator, Union, Optional, Literal
from .lexer import TerminalDef
2020-02-13 14:34:05 +00:00
2020-02-16 06:09:53 +00:00
class Meta:
empty: bool
line: int
column: int
start_pos: int
end_line: int
end_column: int
end_pos: int
orig_expansion: List[TerminalDef]
match_tree: bool
2020-02-13 14:34:05 +00:00
2020-02-16 06:09:53 +00:00
class Tree:
2020-02-13 14:34:05 +00:00
data: str
children: List[Union[str, Tree]]
2020-02-16 06:09:53 +00:00
meta: Meta
2020-02-13 14:34:05 +00:00
2020-02-16 06:09:53 +00:00
def __init__(
self,
data: str,
children: List[Union[str, Tree]],
meta: Optional[Meta] = None
):
2020-02-13 14:34:05 +00:00
...
def pretty(self, indent_str: str = ...) -> str:
...
def find_pred(self, pred: Callable[[Tree], bool]) -> Iterator[Tree]:
...
def find_data(self, data: str) -> Iterator[Tree]:
...
2020-02-16 06:09:53 +00:00
def expand_kids_by_index(self, *indices: int) -> None:
...
def scan_values(self, pred: Callable[[Union[str, Tree]], bool]):
...
2020-02-13 14:34:05 +00:00
def iter_subtrees(self) -> Iterator[Tree]:
...
def iter_subtrees_topdown(self) -> Iterator[Tree]:
...
2020-02-16 06:09:53 +00:00
def copy(self) -> Tree:
...
def set(self, data: str, children: List[Union[str, Tree]]) -> None:
2020-02-13 14:34:05 +00:00
...
def __hash__(self) -> int:
...
class SlottedTree(Tree):
pass
2020-02-16 06:09:53 +00:00
def pydot__tree_to_png(
tree: Tree,
filename: str,
rankdir: Literal["TB", "LR", "BT", "RL"] = ...,
**kwargs
) -> None:
...