parinfer

dominicm 2020-09-16T06:47:08.021700Z

I keep meaning to check that out.

dominicm 2020-09-16T06:48:06.022400Z

I suppose it's not been used for general editors, only your clojure ones?

2020-09-16T07:33:45.023100Z

didn't know this: > Acts as a general purpose clojure parser, because its parse function returns the code a hiccup-style data structure, not merely a string. In fact, adjusting parens/indentation is just an optional step

2020-09-16T07:34:44.023600Z

so i'll ask dominicm's question before he does -- how does it handle metadata?

2020-09-16T08:22:49.024900Z

(parse "^{:a 1} [:b :c]")
#_ [[:special-char "^"]
    [:collection
     [:delimiter "{"] [:keyword ":a"] [:whitespace " "]
     [:number "1"] [:delimiter "}"]]
    [:whitespace " "]
    [:collection
     [:delimiter "["] [:keyword ":b"] [:whitespace " "]
     [:keyword ":c"] [:delimiter "]"]]]
so it looks like it doesn't do what rewrite-clj or parcera does, which i think makes going through the results easier.

2020-09-16T08:23:35.025600Z

as in, one doesn't have to descend into something that wraps what the metadata applies to.

sekao 2020-09-16T08:32:21.027100Z

@dominicm it's written in clojure (cljc) so it depends on what the editor is written in. i made it for paravim in particular but any editor written in clojure could use it

sekao 2020-09-16T08:40:31.028700Z

@sogaiu yeah it's not a full-blown reader like tools.reader so it doesn't actually know what metadata is, it just parses the literal syntax. for this purpose i think that's the way to go. i used to use tools.reader for this kind of stuff and had all kinds of problems

2020-09-16T08:43:04.029600Z

@sekao right -- parcera doesn't do the reader thing either. i think it makes sense.

2020-09-16T08:48:13.030600Z

fwiw: https://github.com/carocad/parcera/commit/bcad8cf10bdea4435294e6b010b80ee7a0e37634 i've not looked into this but found it interesting that parcera used to use vectors.