|
|
@ -118,7 +118,9 @@
|
|
|
|
(lambda ()
|
|
|
|
(lambda ()
|
|
|
|
,(if src-pos
|
|
|
|
,(if src-pos
|
|
|
|
`(err #t (token-name tok) (token-value tok) (cadr ip) (caddr ip))
|
|
|
|
`(err #t (token-name tok) (token-value tok) (cadr ip) (caddr ip))
|
|
|
|
`(err #t (token-name tok) (token-value tok)))))))))
|
|
|
|
`(err #t (token-name tok) (token-value tok)))
|
|
|
|
|
|
|
|
(raise-read-error (format "parser: got token of unknown type ~a" (token-name tok)))))))))
|
|
|
|
|
|
|
|
|
|
|
|
(lambda (get-token)
|
|
|
|
(lambda (get-token)
|
|
|
|
(let parsing-loop ((stack (list 0))
|
|
|
|
(let parsing-loop ((stack (list 0))
|
|
|
|
(ip (get-token)))
|
|
|
|
(ip (get-token)))
|
|
|
@ -141,7 +143,7 @@
|
|
|
|
((symbol? ip) (make-token ip #f))
|
|
|
|
((symbol? ip) (make-token ip #f))
|
|
|
|
((token? ip) ip)
|
|
|
|
((token? ip) ip)
|
|
|
|
(else (raise-type-error 'parser "token or symbol" 0 ip)))))
|
|
|
|
(else (raise-type-error 'parser "token or symbol" 0 ip)))))
|
|
|
|
(action (find-action stack tok) ,@(if src-pos `(ip) `())))
|
|
|
|
(action (find-action stack tok ,@(if src-pos `(ip) `()))))
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
((shift? action)
|
|
|
|
((shift? action)
|
|
|
|
;; (printf "shift:~a~n" (shift-state action))
|
|
|
|
;; (printf "shift:~a~n" (shift-state action))
|
|
|
|