Explorar el Código

Fixed a small bug in parser error reporting

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.1
Erez Shinan hace 7 años
padre
commit
56f68655ca
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. +5
    -1
      lark/parser.py

+ 5
- 1
lark/parser.py Ver fichero

@@ -23,7 +23,11 @@ class Parser(object):
except KeyError:
expected = states_idx[state].keys()
context = ' '.join(['%r(%s)' % (t.value, t.type) for t in seq[i:i+5]])
token = seq[i]
try:
token = seq[i]
except IndexError:
assert key == '$end'
token = seq[-1]
raise ParseError("Unexpected input %r at line %d, column %d.\n"
"Expected: %s\n"
"Context: %s" % (token.value, token.line, token.column, expected, context))


Cargando…
Cancelar
Guardar