diff --git a/lark/exceptions.py b/lark/exceptions.py index 0dfb659..6f7d32d 100644 --- a/lark/exceptions.py +++ b/lark/exceptions.py @@ -12,7 +12,7 @@ class ConfigurationError(LarkError, ValueError): pass -def assert_config(value, options, msg='Got %r, expected one of %s'): +def assert_config(value, options: list, msg='Got %r, expected one of %s'): if value not in options: raise ConfigurationError(msg % (value, options)) diff --git a/lark/lexer.py b/lark/lexer.py index a017001..36ed6bc 100644 --- a/lark/lexer.py +++ b/lark/lexer.py @@ -130,7 +130,7 @@ class Token(str): inst = super(Token, cls).__new__(cls, value) inst.type = type_ - inst.start_pos = start_pos if start_pos is not None else pos_in_stream + inst.start_pos = start_pos inst.value = value inst.line = line inst.column = column @@ -287,7 +287,7 @@ class Scanner: return m.group(0), type_from_index[m.lastindex] -def _regexp_has_newline(r): +def _regexp_has_newline(r: str): r"""Expressions that may indicate newlines in a regexp: - newlines (\n) - escaped newline (\\n)