Merge pull request #302 from arthurmaciel/correct-semi-colon-bug

Previous try to correct semi-colon bug failed
This commit is contained in:
Justin Ethier 2019-01-27 21:13:15 -05:00 committed by GitHub
commit 070a9924d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,10 +334,16 @@
(append (c:allocs cp1) (c:allocs cp2)))) (append (c:allocs cp1) (c:allocs cp2))))
(define (c:serialize cp prefix) (define (c:serialize cp prefix)
(let* ((body (c:body cp))
(blen (string-length body)))
(string-append (string-append
(c:allocs->str (c:allocs cp) prefix) (c:allocs->str (c:allocs cp) prefix)
prefix prefix
(c:body cp))) body
(if (and (> blen 0)
(not (eq? #\; (string-ref body (- blen 1))))) ; last char
";"
""))))
;; c-compile-program : exp -> string ;; c-compile-program : exp -> string
(define (c-compile-program exp src-file) (define (c-compile-program exp src-file)
@ -348,8 +354,7 @@
;; (write `(DEBUG ,body)) ;; (write `(DEBUG ,body))
(string-append (string-append
preamble preamble
(c:serialize body " ") (c:serialize body " "))))
" ;\n")))
;; c-compile-exp : exp (string -> void) -> string ;; c-compile-exp : exp (string -> void) -> string
;; ;;