Преглед на файлове

A few more type annotations, reduce use of inline flags

gm/2021-09-23T00Z/github.com--lark-parser-lark/1.0b
Erez Sh преди 3 години
родител
ревизия
3f507fc073
променени са 3 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. +2
    -2
      lark/grammars/python.lark
  2. +4
    -0
      lark/indenter.py
  3. +1
    -1
      lark/parse_tree_builder.py

+ 2
- 2
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)


+ 4
- 0
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


+ 1
- 1
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)


Зареждане…
Отказ
Запис