|
|
|
@ -203,10 +203,10 @@
|
|
|
|
|
(define (fix-error stack tok val start-pos end-pos get-token)
|
|
|
|
|
(when debug? (pretty-print stack))
|
|
|
|
|
(local ((define (remove-input tok val start-pos end-pos)
|
|
|
|
|
(if (memq tok ends)
|
|
|
|
|
(when (memq tok ends)
|
|
|
|
|
(raise-read-error "parser: Cannot continue after error"
|
|
|
|
|
#f #f #f #f #f)
|
|
|
|
|
(let ([a (find-action stack tok val start-pos end-pos)])
|
|
|
|
|
#f #f #f #f #f))
|
|
|
|
|
(define a (find-action stack tok val start-pos end-pos))
|
|
|
|
|
(cond
|
|
|
|
|
[(runtime-shift? a)
|
|
|
|
|
(cons (stack-frame (runtime-shift-state a)
|
|
|
|
@ -215,7 +215,7 @@
|
|
|
|
|
end-pos)
|
|
|
|
|
stack)]
|
|
|
|
|
[else
|
|
|
|
|
(call-with-values (λ () (extract (get-token))) remove-input)])))))
|
|
|
|
|
(call-with-values (λ () (extract (get-token))) remove-input)])))
|
|
|
|
|
(let remove-states ()
|
|
|
|
|
(define a (find-action stack 'error #f start-pos end-pos))
|
|
|
|
|
(cond
|
|
|
|
@ -228,14 +228,12 @@
|
|
|
|
|
end-pos)
|
|
|
|
|
stack))
|
|
|
|
|
(remove-input tok val start-pos end-pos)]
|
|
|
|
|
[else
|
|
|
|
|
(cond
|
|
|
|
|
[(< (length stack) 2)
|
|
|
|
|
(raise-read-error "parser: Cannot continue after error"
|
|
|
|
|
#f #f #f #f #f)]
|
|
|
|
|
[else
|
|
|
|
|
(set! stack (cdr stack))
|
|
|
|
|
(remove-states)])]))))
|
|
|
|
|
(remove-states)]))))
|
|
|
|
|
|
|
|
|
|
(define (find-action stack tok val start-pos end-pos)
|
|
|
|
|
(unless (hash-ref all-term-syms tok #f)
|
|
|
|
|