summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>2021-07-29 13:47:05 +0200
committerMarc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>2021-08-03 17:05:37 +0200
commit1f9b4796d6d772160f91a737fed0076e3d489ac1 (patch)
treee0c28b49408698b894e2ce203ea6f7eeb4ba54b4
parent1f508fbdb5f14c04058a4a0e62048aa37e0ef45f (diff)
Parse syntax-rules more strictlysyntax-rules-parser
See issue #767.
-rw-r--r--lib/init-7.scm6
-rwxr-xr-xtools/chibi-ffi5
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/init-7.scm b/lib/init-7.scm
index 035bb36c..4a4c5321 100644
--- a/lib/init-7.scm
+++ b/lib/init-7.scm
@@ -1105,7 +1105,11 @@
_or
(append
(map
- (lambda (clause) (expand-pattern (car clause) (cadr clause)))
+ (lambda (clause)
+ (if (and (list? clause) (= (length clause) 2))
+ (expand-pattern (car clause) (cadr clause))
+ (error "invalid syntax-rules clause, which must be of the form (pattern template) (note fenders are not supported)"
+ clause)))
forms)
(list
(list _cons
diff --git a/tools/chibi-ffi b/tools/chibi-ffi
index bc728ac2..cd3f9ac9 100755
--- a/tools/chibi-ffi
+++ b/tools/chibi-ffi
@@ -195,8 +195,7 @@
(syntax-rules ()
((define-c-int-type type)
(if (not (memq 'type *c-int-types*))
- (set! *c-int-types* (cons 'type *c-int-types*)))
- #f)))
+ (set! *c-int-types* (cons 'type *c-int-types*))))))
(define-syntax define-c-enum
;; TODO: support conversion to/from symbolic names
@@ -640,7 +639,7 @@
(let ((e (x->string errno)))
(string-append " case " e ": return \"" e "\";\n")))
errnos)
-
+
" }
snprintf(buf, 64, \"unknown error: %d\", err);
return buf;