Skip to content

Commit

Permalink
Fixes according to review notes (more accurate type for tree_class)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Sep 25, 2023
1 parent b8b69c7 commit 41c28d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lark/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LarkOptions(Serialize):
regex: bool
g_regex_flags: int
keep_all_tokens: bool
tree_class: Optional[Callable[[str, Sequence], Any]]
tree_class: Optional[Callable[[str, List], Any]]
parser: _ParserArgType
lexer: _LexerArgType
ambiguity: 'Literal["auto", "resolve", "explicit", "forest"]'
Expand Down
4 changes: 2 additions & 2 deletions lark/parsers/earley.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
is explained here: https://lark-parser.readthedocs.io/en/latest/_static/sppf/sppf.html
"""

from typing import TYPE_CHECKING, Callable, Optional, Sequence, Any
from typing import TYPE_CHECKING, Callable, Optional, List, Any
from collections import deque

from ..lexer import Token
Expand All @@ -31,7 +31,7 @@ class Parser:

def __init__(self, lexer_conf: 'LexerConf', parser_conf: 'ParserConf', term_matcher: Callable,
resolve_ambiguity: bool=True, debug: bool=False,
tree_class: Optional[type]=Tree, ordered_sets: bool=True):
tree_class: Optional[Callable[[str, List], Any]]=Tree, ordered_sets: bool=True):
analysis = GrammarAnalyzer(parser_conf)
self.lexer_conf = lexer_conf
self.parser_conf = parser_conf
Expand Down
4 changes: 2 additions & 2 deletions lark/parsers/xearley.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Earley's power in parsing any CFG.
"""

from typing import TYPE_CHECKING, Callable, Optional, Sequence, Any
from typing import TYPE_CHECKING, Callable, Optional, List, Any
from collections import defaultdict

from ..tree import Tree
Expand All @@ -30,7 +30,7 @@
class Parser(BaseParser):
def __init__(self, lexer_conf: 'LexerConf', parser_conf: 'ParserConf', term_matcher: Callable,
resolve_ambiguity: bool=True, complete_lex: bool=False, debug: bool=False,
tree_class: Optional[type]=Tree, ordered_sets: bool=True):
tree_class: Optional[Callable[[str, List], Any]]=Tree, ordered_sets: bool=True):
BaseParser.__init__(self, lexer_conf, parser_conf, term_matcher, resolve_ambiguity,
debug, tree_class, ordered_sets)
self.ignore = [Terminal(t) for t in lexer_conf.ignore]
Expand Down

0 comments on commit 41c28d4

Please sign in to comment.