 
 (defn- nml-add [tree parent child match proxy]
   (let [missing  (fn [children] (not-any? #(= (nml-name %) match) children))
-        vnew    #(parse proxy :start child)
+        vnew    #(nml-parse proxy child)
         f        (fn [& children] (if (missing children)
                                     (into [parent (vnew)] children)
                                     (into [parent       ] children)))]

  (:require [clojure.tools.cli :as cli   ])
  (:gen-class))

(declare nml-get nml-name nml-set nml-str)

; defs

(def debug false)

(def msgs
  {0 "-i/--in-place has no effect when no input file is specified."
   1 "Input file required for get operations."
   2 "-n/--no-prefix has no effect on set operations."
   3 "Do not mix get and set operations."
   4 "-i/--in-place has no effect on get operations."})

(def parse (insta/parser (clojure.java.io/resource "grammar")))


        match  (if sub (string/lower-case key) (string/lower-case nml))
        parent (if sub :nvseq :s)
        proxy  (if sub (str match "=0") (str "&" match " /"))
        vnew   (if sub (fn [tree] (nml-parse val :values)) #(nml-set % nml key val true))
        f      (fn
                 ([k v] (if (= (nml-str k) match) [child k (vnew v  )] [child k v]))
                 ([k  ] (if (= (nml-str k) match) [child k (vnew nil)] [child k  ])))]
    (insta/transform {child f} (nml-add tree parent child match proxy))))

(defn nml-tree [s]
  (let [tree  (nml-parse s :s)
        child :nvseq
        f     (fn [& v] (into [child] (nml-uniq v)))]
      (insta/transform {child f} tree)))

;; main

