Compare commits

...

3 Commits

Author SHA1 Message Date
CrossNox ac76aa626c agregar test agregar ptocoma 3 years ago
CrossNox 91c5d80df3 improve listar 3 years ago
CrossNox 824182d12c Fix de CAL 3 years ago
  1. 14
      src/rustint/core.clj
  2. 11
      test/rustint/core_test.clj

@ -2084,7 +2084,7 @@
argval (second fetched),
next_cont_prg argval,
reg-act-to-add (get mapa-regs argval),
retdir (inc argval)
retdir (inc cont-prg)
]
(recur cod (conj regs-de-act reg-act-to-add) next_cont_prg (conj pila retdir) mapa-regs)
)
@ -2124,15 +2124,19 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn flistar [ilevel t nxt]
(let [
preceding_space (clojure.string/join (repeat (* ilevel 2) " ")),
bracket_prec_space (clojure.string/join (repeat (* (- ilevel 1) 2) " "))
]
(cond
(string? t) (format "\"%s\" " t)
(= t (symbol "{")) (clojure.string/join
(cons "\n{\n" (repeat (* ilevel 2) " "))
)
(= t (symbol "}")) "\n}"
(= t (symbol "{")) (format "\n%s{\n%s" bracket_prec_space preceding_space)
(= t (symbol "}")) (format "\n%s}" bracket_prec_space)
(= t (symbol ";")) (format ";\n%s" preceding_space)
(and (not= nxt (symbol "{")) (not= nxt (symbol "}"))) (format "%s " t)
:else (format "%s" t)
)
)
)
(defn listar [l]

@ -957,3 +957,14 @@
))
)
)
(deftest test-agregar-ptocoma-02
(testing "Test main 02 agregar-ptocoma"
(is (=
(agregar-ptocoma
(list 'fn 'main (symbol "(") (symbol ")") 'if 'x '< '0 (symbol "{") 'x '= '- 'x (symbol ";") 'x_cambio '= 'true (symbol ";") (symbol "}") 'print! (symbol "(") "y: " (symbol ")") (symbol ";") (symbol "}") )
)
(list 'fn 'main (symbol "(") (symbol ")") 'if 'x '< '0 (symbol "{") 'x '= '- 'x (symbol ";") 'x_cambio '= 'true (symbol ";") (symbol "}") (symbol ";") 'print! (symbol "(") "y: " (symbol ")") (symbol ";") (symbol "}") )
))
)
)

Loading…
Cancel
Save