mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
empty applications are now a syntax error
This commit is contained in:
parent
bab88c01b4
commit
205008d7ce
2 changed files with 7 additions and 6 deletions
7
eval.c
7
eval.c
|
@ -826,10 +826,9 @@ static sexp analyze (sexp ctx, sexp object) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (! (sexp_truep(sexp_listp(ctx, sexp_car(x)))
|
||||
if (! (sexp_pairp(sexp_car(x))
|
||||
|| (sexp_synclop(sexp_car(x))
|
||||
&& sexp_truep(sexp_listp(ctx,
|
||||
sexp_synclo_expr(sexp_car(x)))))))
|
||||
&& sexp_pairp(sexp_synclo_expr(sexp_car(x))))))
|
||||
sexp_warn(ctx, "invalid operand in application: ", x);
|
||||
res = analyze_app(ctx, x);
|
||||
}
|
||||
|
@ -843,6 +842,8 @@ static sexp analyze (sexp ctx, sexp object) {
|
|||
sexp_context_fv(tmp));
|
||||
x = sexp_synclo_expr(x);
|
||||
res = analyze(tmp, x);
|
||||
} else if (sexp_nullp(x)) {
|
||||
res = sexp_compile_error(ctx, "empty application in source", x);
|
||||
} else {
|
||||
res = x;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;; init.scm -- R5RS library procedures
|
||||
;; Copyright (c) 2009 Alex Shinn. All rights reserved.
|
||||
;; Copyright (c) 2009-2011 Alex Shinn. All rights reserved.
|
||||
;; BSD-style license: http://synthcode.com/license.txt
|
||||
|
||||
;; provide c[ad]{2,4}r
|
||||
|
@ -201,7 +201,7 @@
|
|||
(else
|
||||
(list (rename 'cons) (qq (car x) d) (qq (cdr x) d)))))
|
||||
((vector? x) (list (rename 'list->vector) (qq (vector->list x) d)))
|
||||
((symbol? x) (list (rename 'quote) x))
|
||||
((if (symbol? x) #t (null? x)) (list (rename 'quote) x))
|
||||
(else x)))
|
||||
(qq (cadr expr) 0))))
|
||||
|
||||
|
@ -702,7 +702,7 @@
|
|||
(list
|
||||
_let
|
||||
_lp (cons (list w v)
|
||||
(map (lambda (x) (list x '())) ls-vars))
|
||||
(map (lambda (x) (list x (list _quote '()))) ls-vars))
|
||||
(list _if (list _null? w)
|
||||
(list _let (map (lambda (x l)
|
||||
(list (car x) (list _reverse l)))
|
||||
|
|
Loading…
Add table
Reference in a new issue