diff --git a/lark/lexer.py b/lark/lexer.py index 36ed6bc..fc50b57 100644 --- a/lark/lexer.py +++ b/lark/lexer.py @@ -184,7 +184,7 @@ class LineCounter: return self.char_pos == other.char_pos and self.newline_char == other.newline_char - def feed(self, token, test_newline=True): + def feed(self, token: Token, test_newline=True): """Consume a token and calculate the new line & column. As an optional optimization, set test_newline=False if token doesn't contain a newline. diff --git a/lark/parse_tree_builder.py b/lark/parse_tree_builder.py index fa418a9..4342b24 100644 --- a/lark/parse_tree_builder.py +++ b/lark/parse_tree_builder.py @@ -1,3 +1,5 @@ +from typing import List + from .exceptions import GrammarError, ConfigurationError from .lexer import Token from .tree import Tree @@ -151,7 +153,7 @@ def _should_expand(sym): return not sym.is_term and sym.name.startswith('_') -def maybe_create_child_filter(expansion, keep_all_tokens, ambiguous, _empty_indices: list): +def maybe_create_child_filter(expansion, keep_all_tokens, ambiguous, _empty_indices: List[bool]): # Prepare empty_indices as: How many Nones to insert at each index? if _empty_indices: assert _empty_indices.count(False) == len(expansion)