Format an error stack of sorts
This commit is contained in:
parent
669ded5d14
commit
2b0d863531
1 changed files with 6 additions and 2 deletions
|
@ -265,8 +265,12 @@ class Parser(SexpParser):
|
||||||
acc = []
|
acc = []
|
||||||
while f.peek() != closec:
|
while f.peek() != closec:
|
||||||
if not f.peek():
|
if not f.peek():
|
||||||
raise SyntaxError(f"Got end of file ({f.pos()}) while parsing {openc!r}...{closec!r} starting at {pos}")
|
raise SyntaxError(f"Got end of file while parsing {openc!r}...{closec!r} starting at {pos}")
|
||||||
|
try:
|
||||||
acc.append(cls.parse(rtb))
|
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
|
assert rtb.read() == closec # Discard the trailing delimeter
|
||||||
return ctor(acc, str(rtb), pos)
|
return ctor(acc, str(rtb), pos)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue