diff --git a/lark/grammars/python.lark b/lark/grammars/python.lark index 684193d..e73362d 100644 --- a/lark/grammars/python.lark +++ b/lark/grammars/python.lark @@ -10,8 +10,8 @@ DEC_NUMBER: /0|[1-9][\d_]*/i HEX_NUMBER.2: /0x[\da-f]*/i OCT_NUMBER.2: /0o[0-7]*/i BIN_NUMBER.2 : /0b[0-1]*/i -FLOAT_NUMBER.2: /((\d+\.[\d_]*|\.[\d_]+)(e[-+]?\d+)?|\d+(e[-+]?\d+))/i -IMAG_NUMBER.2: /\d+j/i | FLOAT_NUMBER "j"i +FLOAT_NUMBER.2: /((\d+\.[\d_]*|\.[\d_]+)([Ee][-+]?\d+)?|\d+([Ee][-+]?\d+))/ +IMAG_NUMBER.2: /\d+[Jj]/ | FLOAT_NUMBER /[Jj]/ // Comma-separated list (with an optional trailing comma) diff --git a/lark/indenter.py b/lark/indenter.py index 7e1263d..f5a1895 100644 --- a/lark/indenter.py +++ b/lark/indenter.py @@ -9,6 +9,10 @@ class DedentError(LarkError): pass class Indenter(PostLex): + OPEN_PAREN_types: list + CLOSE_PAREN_types: list + DEDENT_type: str + def __init__(self): self.paren_level = None self.indent_level = None diff --git a/lark/parse_tree_builder.py b/lark/parse_tree_builder.py index e95003a..fa418a9 100644 --- a/lark/parse_tree_builder.py +++ b/lark/parse_tree_builder.py @@ -151,7 +151,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): +def maybe_create_child_filter(expansion, keep_all_tokens, ambiguous, _empty_indices: list): # Prepare empty_indices as: How many Nones to insert at each index? if _empty_indices: assert _empty_indices.count(False) == len(expansion)