Hi, instaparse does not support readers and it cannot at the moment mainly because it uses JDK RegEx which do not support readers (thanks to Mark Engelbert for supplying this info). IMHO you cannot greedyly consume a reader and then decide that a match was not found due to the side-effect of the mutating/destructive consumption.
Reading (i.e. consuming) the reader until I find the terminal character is the way to go. But the "embedded language" could also contain the terminal char. So the "solution" I came up with consumes the reader until it finds the terminal char, tries to successfully find a complete parse of this "head" and continues if it does not find such a parse (this is not elegent but in practice it works for me). So if/when I find a parseable head the "tail" is still in the reader and can be consumed by someone else (e.g. the caller of my function which I do not control). This scheme is a "non-greedy-parse". I'm using "]" as the terminal char. So the Grammar/embeded language should have "balanced [...]". Otherwise the non-greddy-parse might miss a parseable head that is still ahead of the first head that we find. I'll post my solution hopefully next week and put it on github. Stay tuned. Regards, Henrik -- 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.