sdkagent

lark API reference

59 public APIs from lark (lark-parser/lark) — 31 classes, 6 functions, 22 methods. Signatures extracted by static analysis of the actual source.

Repository: lark-parser/lark

KindCount
Classes31
Functions6
Methods22

API list

classlark.exceptions.UnexpectedInput
UnexpectedInput Error.
classlark.lark.Lark
Main interface for the library.
methodlark.lark.Lark.get_terminal(name:str) -> TerminalDef
Get information about a terminal
methodlark.lark.Lark.lex(text:TextOrSlice, dont_ignore:bool=False) -> Iterator[Token]
Only lex (and postlex) the text, without parsing it.
methodlark.lark.Lark.parse_interactive(text:Optional[LarkInput]=None, start:Optional[str]=None) -> 'InteractiveParser'
Start an interactive parsing session.
classlark.lark.LarkOptions
Specifies the options for Lark
methodlark.lexer.Lexer.make_lexer_state(text:str)
Deprecated
classlark.lexer.LineCounter
A utility class for keeping track of line & column information
methodlark.lexer.LineCounter.from_text_slice(text_slice:TextSlice) -> 'LineCounter'
Build a counter positioned at ``text_slice.start``.
classlark.lexer.Pattern
An abstraction over regular expressions.
methodlark.lexer.Scanner.search(text:TextSlice, pos:int) -> Optional[int]
Find the position of the earliest match, starting at pos
classlark.lexer.TerminalDef
A definition of a terminal
classlark.lexer.Token
A string with meta-information, that is produced by the lexer.
classlark.load_grammar.PrepareAnonTerminals
Create a unique list of anonymous terminals.
funclark.load_grammar.nr_deepcopy_tree(t)
Deepcopy tree `t` without recursion
classlark.parser_frontends.ScanMatch
A non-overlapping match found by ``Lark.scan()``.
classlark.parsers.cyk.CnfWrapper
CNF wrapper for grammar.
classlark.parsers.cyk.Grammar
Context-free grammar.
classlark.parsers.cyk.Parser
Parser wrapper.
classlark.parsers.cyk.Rule
Context-free grammar rule.
classlark.parsers.cyk.RuleNode
A node in the parse tree, which also contains the full rhs rule.
funclark.parsers.earley.Parser.scan(i, token, to_scan)
The core Earley Scanner.
classlark.parsers.earley_common.Item
An Earley Item, the atom of the algorithm.
classlark.parsers.earley_forest.ForestSumVisitor
A visitor for prioritizing ambiguous parts of the Forest.
classlark.parsers.earley_forest.ForestToPyDotVisitor
A Forest visitor which writes the SPPF to a PNG.
classlark.parsers.earley_forest.ForestTransformer
The base class for a bottom-up forest transformation.
methodlark.parsers.earley_forest.ForestTransformer.transform(root)
Perform a transformation on an SPPF.
methodlark.parsers.earley_forest.ForestTransformer.transform_packed_node(node, data)
Transform a packed node.
methodlark.parsers.earley_forest.ForestTransformer.transform_symbol_node(node, data)
Transform a symbol node.
methodlark.parsers.earley_forest.ForestTransformer.transform_token_node(node)
Transform a ``Token``.
classlark.parsers.earley_forest.ForestVisitor
An abstract base class for building forest visitors.
classlark.parsers.earley_forest.PackedNode
A Packed Node represents a single derivation in a symbol node.
classlark.parsers.earley_forest.SymbolNode
A Symbol Node represents a symbol (or Intermediate LR0).
funclark.parsers.grammar_analysis.calculate_sets(rules)
Calculate FOLLOW sets.
classlark.parsers.lalr_analysis.IntParseTable
Parse-table whose key is int.
classlark.parsers.lalr_analysis.ParseTable
Parse-table whose key is State, i.e.
funclark.parsers.xearley.Parser.scan(i, to_scan)
The core Earley Scanner.
classlark.tree.Tree
The main tree class.
methodlark.tree.Tree.find_data(data:str) -> 'Iterator[Tree[_Leaf_T]]'
Returns all nodes of the tree whose data equals the given data.
methodlark.tree.Tree.find_pred(pred:'Callable[[Tree[_Leaf_T]], bool]') -> 'Iterator[Tree[_Leaf_T]]'
Returns all nodes of the tree that evaluate pred(node) as true.
methodlark.tree.Tree.find_token(token_type:str) -> Iterator[_Leaf_T]
Returns all tokens whose type equals the given token_type.
methodlark.tree.Tree.iter_subtrees() -> 'Iterator[Tree[_Leaf_T]]'
Depth-first iteration.
methodlark.tree.Tree.iter_subtrees_topdown()
Breadth-first iteration.
methodlark.tree.Tree.pretty(indent_str:str=' ') -> str
Returns an indented string representation of the tree.
methodlark.tree.Tree.scan_values(pred:'Callable[[Branch[_Leaf_T]], bool]') -> Iterator[_Leaf_T]
Return all values in the tree that evaluate pred(value) as true.
methodlark.tree_matcher.TreeMatcher.match_tree(tree:Tree, rulename:str) -> Tree
Match the elements of `tree` to the symbols of rule `rulename`.
methodlark.tree_templates.Template.apply_vars(vars:Mapping[str, Tree[str]]) -> Tree[str]
Apply vars to the template tree
methodlark.tree_templates.Template.match(tree:TreeOrCode) -> Optional[MatchResult]
Match a tree template to a tree.
classlark.tree_templates.TemplateTranslator
Utility class for translating a collection of patterns
classlark.utils.OrderedSet
A minimal OrderedSet implementation, using a dictionary.
classlark.utils.SerializeMemoizer
A version of serialize that memoizes objects to reduce space
funclark.utils.small_factors(n:int, max_factor:int) -> List[Tuple[int, int]]
Splits n up into smaller factors and summands <= max_factor.
classlark.visitors.Interpreter
Interpreter walks the tree starting at the root.
methodlark.visitors.Interpreter.visit_children(tree:Tree[_Leaf_T]) -> List
Visit all the children of this tree and return the results as a list.
methodlark.visitors.Transformer.transform(tree:Tree[_Leaf_T]) -> _Return_T
Transform the given tree, and return the final result
classlark.visitors.Transformer_NonRecursive
Same as Transformer but non-recursive.
classlark.visitors.Visitor
Tree visitor, non-recursive (can handle huge trees).
classlark.visitors.Visitor_Recursive
Bottom-up visitor, recursive.
funclark.visitors.visit_children_decor(func:_InterMethod) -> _InterMethod
A wrapper around Interpreter methods.

About this data

These signatures were extracted from the public source of lark-parser/lark using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries