~bouncepaw/agidel-stdlib

23f23b1d93c3b6bfaed4229bc2a0a1a6501b411b — Timur Ismagilov 5 years ago 0548d6d
Add support of optional semicolons to Agidel/C
1 files changed, 12 insertions(+), 3 deletions(-)

M c.scm
M c.scm => c.scm +12 -3
@@ 10,11 10,20 @@
         (only chicken.syntax expand)
         (prefix srfi-13 -)
         format)

 (define should-use-semicolon? #t)
 (define-syntax no-scln
   (syntax-rules (should-use-semicolon?)
     ((_ expr)
      (-let ((sclnbuf should-use-semicolon?)
             (resbuf ""))
            (set! should-use-semicolon? #f)
            (set! resbuf expr)
            (set! should-use-semicolon? sclnbuf)
            resbuf))))
 (define scln
   (-match-lambda*
    (() ";\n")
    ((o) (format "~A;\n" o))))
    (() (scln ""))
    ((o) (format "~A~A" o (-if should-use-semicolon? ";\n" "")))))
 (define (eval-if-list expr)
   (-->string (-if (-symbol? expr) expr (-eval expr))))