Hi Terje, This is how the parsing works in Cursive. I have a classical lexer/parser split because IntelliJ forces me to do that. That said, I like it that way, and I believe it makes things more flexible. I've been able to make a couple of special-case parsers easily on top of the lexer - I'm about to start work on another one for Parinfer support.
I can't speak to why the Clojure reader works the way it does, but what you suggest is definitely possible and works well. Cheers, Colin On 8 February 2016 at 20:12, Terje Dahl <te...@terjedahl.no> wrote: > > > I have been studying and and implementing my own version of LispReader / > tool.reader - for the purpose of syntax highlighting and visual token > manipulation. > My question is this: > Why not split this into 2 steps? > > 1. Reads the input (from PushbackReader et al) and emits a stream of > tokens, preserving information about location in source, and applying > typing to tokens, if possible. > 2. Consumes the stream from step one, descending recursively, applying > reader-macros, resolving symbols in name-spaces, etc. > > This would allow for easier configuration of each step, such as: > > - turning exceptions on/off (useful for syntax highlighting) > - custom reader-macros and custom classes of reader-macros > - static analysis of code by controlling the namespacing/context > > Is there any reason not to do this? > (Other than: This is the way it has always been done. This is the way > lisp-readers are aways implemented.) > > Perhaps such a development is already underway? > > Finally, if I wanted to implement such a solution, would it be to do it in > Java or Clojure? Why? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.