forked from alex-eg/sex
parenthesise a conditional without a helper to do it for
This commit is contained in:
@@ -909,10 +909,9 @@
|
||||
;; It groups to the right, so its else arm is written at
|
||||
;; `conditional-else', just looser: a chain there stays bare,
|
||||
;; `a ? x : b ? y : z', and an assignment does not.
|
||||
(define (c-if/expr . args)
|
||||
(c-maybe-paren '? (apply c-if/expr/aux args)))
|
||||
|
||||
(define (c-if/expr/aux c p . rest)
|
||||
(define (c-if/expr c p . rest)
|
||||
(c-maybe-paren
|
||||
'?
|
||||
(let lp ((c c) (p p) (ls rest))
|
||||
(cond
|
||||
((or (eq? c 'else) (eq? c #t))
|
||||
@@ -926,7 +925,7 @@
|
||||
(lp (car ls) (cadr ls) (cddr ls))
|
||||
(lp 'else (car ls) '())))))
|
||||
(else
|
||||
(c-or (c-in-test (c-expr c)) (c-expr p))))))
|
||||
(c-or (c-in-test (c-expr c)) (c-expr p)))))))
|
||||
|
||||
(define (c-if . args)
|
||||
(fmt-if fmt-expression?
|
||||
|
||||
Reference in New Issue
Block a user