This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-14
Channels
- # announcements (3)
- # asami (22)
- # babashka (9)
- # beginners (92)
- # calva (7)
- # clj-kondo (8)
- # clojure (61)
- # clojure-australia (3)
- # clojure-boston (1)
- # clojure-dev (3)
- # clojure-europe (24)
- # clojure-nl (3)
- # clojure-spec (4)
- # clojure-uk (14)
- # clojurescript (5)
- # conjure (12)
- # core-async (44)
- # cryogen (8)
- # crypto (2)
- # cursive (24)
- # data-science (5)
- # events (1)
- # fulcro (10)
- # garden (2)
- # graalvm (19)
- # helix (4)
- # instaparse (13)
- # lsp (13)
- # luminus (1)
- # malli (5)
- # meander (22)
- # off-topic (22)
- # polylith (8)
- # re-frame (69)
- # react (1)
- # reagent (2)
- # releases (2)
- # shadow-cljs (52)
- # sql (7)
- # test-check (3)
- # timbre (2)
- # tools-deps (9)
Does instaparse support round tripping? I have a string-based language that I want to manipulate. I'd like to parse it, manipulate the parse tree using meander and then generate a new string from the parse tree
I think it's possible. I don't know what meander is...
there isn’t a way to “unparse” though that’s been requested a few times
you could write your own “unparser” that leverages insta/transform
and implements a different string-reconstruction logic for each tag in your grammar
assuming you don’t use the “hide” rule (`<>`), those implementations would basically just be str
thanks. I may be signing myself up for a world of hurt but my current approach is to use clojure spec to generate the parse tree and then unform to "unparse" it
instaparse will almost certainly be a better fit than clojure spec to do the initial parse, though I see why you’d want to use a library that gives you an “undo” function
yeah, i feel like this is a no-win situation
I don’t think writing your own un-parser would be too challenging
You were right. Using parse options :unhide :all
, I can easily use meander to unparse the parse tree
Thank you!
since it’s mostly putting strings back together from a recursive tree
hm. thanks. I'll give it a try