From 2109eed5ec26dc730321bfe45596fbbe07c31b94 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Oct 2017 00:51:30 +0100 Subject: [PATCH] further work on https://github.com/GerHobbelt/jison/issues/25: fix logic mistake introduced in parser kernel in 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! --- lib/jison-parser-kernel.js | 5 ++--- lib/jison.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/jison-parser-kernel.js b/lib/jison-parser-kernel.js index 35e1f538c..1a79b1fdd 100644 --- a/lib/jison-parser-kernel.js +++ b/lib/jison-parser-kernel.js @@ -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 diff --git a/lib/jison.js b/lib/jison.js index eb07ba966..3859c1b34 100755 --- a/lib/jison.js +++ b/lib/jison.js @@ -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