Skip to content

Commit

Permalink
Store an error node when restarting the parser
Browse files Browse the repository at this point in the history
FIX: The parser will now emit an error node when it reaches the end of the top rule
but not the end of the input, and restarts parsing the top rule.

See https://discuss.codemirror.net/t/why-does-this-input-generate-no-error/7147
  • Loading branch information
marijnh committed Sep 27, 2023
1 parent ebd499d commit ed970e5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export class Stack {
/// when this.stack.length == 3 (state is directly below the top
/// state). @internal
restart() {
this.storeNode(Term.Err, this.pos, this.pos, 4, true)
this.state = this.stack[0]
this.stack.length = 0
}
Expand Down

0 comments on commit ed970e5

Please sign in to comment.