Browse Source

Style improvements to errors

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.7.1
Erez Shinan 6 years ago
parent
commit
4b915a9f78
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      lark/lexer.py
  2. +1
    -1
      lark/parsers/xearley.py

+ 1
- 1
lark/lexer.py View File

@@ -171,7 +171,7 @@ class _Lex:

break
else:
allowed = [v for m, tfi in lexer.mres for v in tfi.values()]
allowed = {v for m, tfi in lexer.mres for v in tfi.values()}
raise UnexpectedCharacters(stream, line_ctr.char_pos, line_ctr.line, line_ctr.column, allowed=allowed, state=self.state)




+ 1
- 1
lark/parsers/xearley.py View File

@@ -111,7 +111,7 @@ class Parser(BaseParser):
del delayed_matches[i+1] # No longer needed, so unburden memory

if not next_set and not delayed_matches and not next_to_scan:
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect for item in to_scan}, set(to_scan))
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan}, set(to_scan))

return next_to_scan



Loading…
Cancel
Save