X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/26c5ecfef79e0158c3ea38e9c32ad1fe3e85be3e..450a4be6a6d832ce1e54169d9cc7740f5a04dc89:/src/lexer-impl.lisp?ds=sidebyside diff --git a/src/lexer-impl.lisp b/src/lexer-impl.lisp index 821849b..f00994a 100644 --- a/src/lexer-impl.lisp +++ b/src/lexer-impl.lisp @@ -59,7 +59,8 @@ (return (values token-types nil consumedp))) (scanner-step scanner))) -(defun parse-error-recover (scanner parser recover &key ignore-unconsumed) +(defun parse-error-recover (scanner parser recover + &key ignore-unconsumed force-progress) "This is the implementation of the `error' parser." (multiple-value-bind (result win consumedp) (funcall parser) (cond ((or win @@ -84,8 +85,8 @@ ;; current token. Finally, if we are at EOF then our best bet is ;; simply to propagate the current failure back to the caller, but ;; we handled that case above. - (syntax-error scanner result :continuep t) - (unless consumedp (scanner-step scanner)) + (syntax-error scanner result) + (when (and force-progress (not consumedp)) (scanner-step scanner)) (funcall recover))))) ;;;--------------------------------------------------------------------------