1 ;;; test-lr-no-clause.scm --
4 (load "common-test.scm")
6 (define (doit . tokens)
7 (let ((parser (lalr-parser (expect: 0)
10 (lines (lines line) : (list $2)
12 (line (NEWLINE) : #\newline
14 ;;this is a rule with no semantic action
15 (COMMA NUMBER NEWLINE)))))
16 (parser (make-lexer tokens) error-handler)))
20 (doit (make-lexical-token 'NUMBER #f 1)
21 (make-lexical-token 'NEWLINE #f #\newline))
25 ;;correct input with comma, which is a rule with no client form
26 (doit (make-lexical-token 'COMMA #f #\,)
27 (make-lexical-token 'NUMBER #f 1)
28 (make-lexical-token 'NEWLINE #f #\newline))
29 => '(#(line-3 #\, 1 #\newline)))
32 ;;correct input with comma, which is a rule with no client form
33 (doit (make-lexical-token 'NUMBER #f 1)
34 (make-lexical-token 'NEWLINE #f #\newline)
35 (make-lexical-token 'COMMA #f #\,)
36 (make-lexical-token 'NUMBER #f 2)
37 (make-lexical-token 'NEWLINE #f #\newline))
38 => '(#(line-3 #\, 2 #\newline)))