Re: Properly parse clojure source code?

2015-01-15 Thread Reid McKenzie
If what you want is a parser not a reader, I reworked this [1] recently and to the limits of my testing it's "correct" in that it parses every reader construct I thought of to throw at it. You could improve it, I believe that #() nesting is supported by this grammar, but I was trying not to com

Re: Properly parse clojure source code?

2015-01-15 Thread Andy Fingerhut
I agree that tools.reader is probably the best way to go. The following note is off the top of my head without double-checking the details, so please take it with a bit of "needs verification of details" thought. Even with tools.reader, I believe you either need to eval ns forms, or do your own p

Re: Properly parse clojure source code?

2015-01-15 Thread Thomas Heller
https://github.com/clojure/tools.reader is probably your best bet. On Friday, January 16, 2015 at 12:13:22 AM UTC+1, zirkonit wrote: > > I'm thoroughly confused. If I want to parse clojure code from string > without evaluating or caring a lot about its context, I'm out of luck. > > EDN tools chok

Properly parse clojure source code?

2015-01-15 Thread zirkonit
I'm thoroughly confused. If I want to parse clojure code from string without evaluating or caring a lot about its context, I'm out of luck. EDN tools choke on reader macros ( #(blah % blah) is not valid EDN ), yet more context-aware tools like read-string with *read-eval* set to false choke on