Skip to content

Commit

Permalink
further work on #25: fix logic mistake introduced in parser kernel in…
Browse files Browse the repository at this point in the history
… the preceeding commits: `action === 0` is the error parse state and that one, when it is discovered during error **recovery** in the inner slow parse loop, is handed back to the outer loop to prevent undue code duplication. Handing back means the outer loop will have to process that state, not exit on it immediately!
  • Loading branch information
GerHobbelt committed Oct 29, 2017
1 parent c3255fd commit 2109eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/jison-parser-kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,9 @@ function parse(input, parseParams) {
// *or* did we hit an unsupported parse state, to be handled
// in the `switch/default` code further below?
ASSERT(action !== 2);
if (action !== 1) {
break;
if (action === 0 || action === 1) {
continue;
}
continue;
}

//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules
Expand Down
5 changes: 2 additions & 3 deletions lib/jison.js
Original file line number Diff line number Diff line change
Expand Up @@ -7829,10 +7829,9 @@ parser.parse = `function parse(input, parseParams) {
// *or* did we hit an unsupported parse state, to be handled
// in the \`switch/default\` code further below?
ASSERT(action !== 2);
if (action !== 1) {
break;
if (action === 0 || action === 1) {
continue;
}
continue;
}
//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules
Expand Down

0 comments on commit 2109eed

Please sign in to comment.