~pepe/jlnt.kak

d3b04cafe9275afb8ab0cbc755344c6529b6380c — Josef Pospíšil 8 months ago f63b23b
Continue match
1 files changed, 14 insertions(+), 10 deletions(-)

M jlnt
M jlnt => jlnt +14 -10
@@ 18,21 18,25 @@
      (emit l c "error" (:error p)))
    (unless com
      (def- importers {'import true 'import* true 'dofile true 'require true})
      (:eof p)
      (def macros @[])
      (while (:has-more p)
        (pp (:where p))
        (def pr (:produce p))
        (def cr (compile pr))
        (if (function? cr)
          (match (tracev pr)
            ['tracev _]
            (if (= (tuple/type pr) :parens)
              (emit lines 1 "warning" "Tracev"))
            [(i (importers i)) _] (cr)
            ['defmacro m _] (do
                              (array/push macros m)
                              (cr))
            [(m (find |(= $ m) macros)) _] (cr))
          (match pr
            [(s (= 'tracev s))] (emit ;(:where p) "warning" "Tracev")
            [(i (importers i))] (cr)
            [(m (= 'defmacro m))]
            (do
              (array/push macros m)
              (cr))
            [(m (find |(= $ m) macros)) _] (cr)
            [(w (= 'when w)) _ (b (< (length b) 2))]
            (emit ;(:where p) "warning" "When with only one form, use if")
            [(w (= 'unless w)) _ (b (< (length b) 2))]
            (emit ;(:where p) "warning"
                  "Unless with only one form, use if not"))
          (do
            (var {:line l :column c :error e} cr)
            (unless (pos? l) (set l 1) (set c 1))