print: avoid triggering deprecation warnings when printing weak vectors.
[bpt/guile.git] / test-suite / lalr / test-glr-basics-01.scm
1 ;;; test-lr-basics-01.scm --
2 ;;
3 ;;A grammar that only accept a single terminal as input. It refuses the
4 ;;end-of-input as first token.
5 ;;
6
7 (load "common-test.scm")
8
9 (define (doit . tokens)
10 (let* ((lexer (make-lexer tokens))
11 (parser (lalr-parser (expect: 0)
12 (driver: glr)
13 (A)
14 (e (A) : $1))))
15 (parser lexer error-handler)))
16
17 (check
18 (doit (make-lexical-token 'A #f 1))
19 => '(1))
20
21 (check
22 (doit)
23 => '())
24
25 (check
26 ;;Parse correctly the first A and reduce it. The second A triggers
27 ;;an error which empties the stack and consumes all the input
28 ;;tokens. Finally, an unexpected end-of-input error is returned
29 ;;because EOI is invalid as first token after the start.
30 (doit (make-lexical-token 'A #f 1)
31 (make-lexical-token 'A #f 2)
32 (make-lexical-token 'A #f 3))
33 => '())
34
35 ;;; end of file