mes: Fix for pmatch on bootstrappable syntax-rules.

* module/mes/pmatch.scm (ppat): Do not use let.
* tests/pmatch.test ("pmatch nyacc minimal", "pmatch nyacc"): Test it.
This commit is contained in:
Jan Nieuwenhuizen 2017-12-09 15:04:32 +01:00
parent 49de95fe5d
commit 2aafee0163
2 changed files with 30 additions and 22 deletions

View file

@ -77,6 +77,7 @@
((_ v (x . y) kt kf)
(if (pair? v)
(let ((vx (car v)) (vy (cdr v)))
(ppat vx x (ppat vy y kt kf) kf))
;;(ppat vx x (ppat vy y kt kf) kf) ;; FIXME: broken with syntax.scm
(ppat (car v) x (ppat (cdr v) y kt kf) kf))
kf))
((_ v lit kt kf) (if (eq? v (quote lit)) kt kf))))

View file

@ -41,7 +41,14 @@ exit $?
(pmatch o
(_ o))))
(pass-if-equal "pmatch" "main"
(pass-if-equal "pmatch nyacc minimal" "main"
(let* ((ast '(("main") PARAM-LIST))
(mets (pmatch ast
(((,name) _) name))))
;;(format (current-error-port) "mets: ~s\n" mets)
mets))
(pass-if-equal "pmatch nyacc" "main"
(let ((ast '(fctn-defn
(decl-spec-list (type-spec (fixed-type "int")))
(ftn-declr