Remove sometimes-inappropriate error recovery on unexpected semicolon. Closes #5

This commit is contained in:
Tony Garnock-Jones 2023-12-31 18:14:14 +01:00
parent 3904c626c9
commit 46bafa9501
1 changed files with 1 additions and 14 deletions

View File

@ -134,23 +134,10 @@ export class LaxReader implements IterableIterator<Item> {
case TokenType.SPACE:
case TokenType.NEWLINE:
case TokenType.ATOM:
this.drop();
if (g === null) {
this.drop();
return t;
}
if (t.text === ';') {
while ('(['.indexOf(g.open.text) >= 0) {
this.stack.pop();
const outer = this.stackTop();
if (outer === null) {
// do not drop the semicolon here
return finishGroup(g, t.start);
}
outer.items.push(finishGroup(g, t.start));
g = outer;
}
}
this.drop();
g.items.push(t);
break;