instaparse
instaparse copied to clipboard
specify transformation with multimethod
I don't like constructing a map for transform. I want to write like this.
(defmulti trans (fn [tag & _] tag))
(defmethod trans :a
[tag & xs]
;; body
)
(defmethod trans :b
[tag & xs]
;; body
)
(defmethod trans :default
[tag & xs]
;; body
)
(insta/transform' trans parsed)
Currently hiccup tag is not passed to transform function. I'm thinking about adding transform' and hiccup-transform' to transform.cljc. Any ideas?