Format an error stack of sorts

This commit is contained in:
Reid 'arrdem' McKenzie 2020-07-18 21:59:41 -06:00
parent 669ded5d14
commit 2b0d863531

View file

@ -265,8 +265,12 @@ class Parser(SexpParser):
acc = []
while f.peek() != closec:
if not f.peek():
raise SyntaxError(f"Got end of file ({f.pos()}) while parsing {openc!r}...{closec!r} starting at {pos}")
acc.append(cls.parse(rtb))
raise SyntaxError(f"Got end of file while parsing {openc!r}...{closec!r} starting at {pos}")
try:
acc.append(cls.parse(rtb))
except SyntaxError as e:
raise SyntaxError(f"While parsing {openc!r}...{closec!r} starting at {pos},\n{e}")
assert rtb.read() == closec # Discard the trailing delimeter
return ctor(acc, str(rtb), pos)