|
|
|
|
|
|
|
|
|
|
|
|
|
(load "common-test.scm") |
|
|
|
(define (doit . tokens) |
|
(let* ((lexer (make-lexer tokens)) |
|
(parser (lalr-parser (expect: 0) |
|
(A) |
|
(e (A) : $1)))) |
|
(parser lexer error-handler))) |
|
|
|
(check |
|
(doit (make-lexical-token 'A #f 1)) |
|
=> 1) |
|
|
|
(check |
|
(let ((r (doit))) |
|
(cons r *error*)) |
|
=> '(#f (error-handler "Syntax error: unexpected end of input"))) |
|
|
|
(check |
|
|
|
|
|
|
|
|
|
(let ((r (doit (make-lexical-token 'A #f 1) |
|
(make-lexical-token 'A #f 2) |
|
(make-lexical-token 'A #f 3)))) |
|
(cons r *error*)) |
|
=> '(#f |
|
(error-handler "Syntax error: unexpected end of input") |
|
(error-handler "Syntax error: unexpected token : " . A))) |
|
|
|
|
|
|