Engelberg/instaparse — pull request #80 by scgilardi (2014-09-10 20:35:53+00:00)
Title: Text as CharSequence

Thanks for all the fun with parsing!

I'm using Instaparse to parse a text header from a file that may contain binary data after the header. My strategy is to read lines in from the file using line-seq and stop and parse after I've reached the last of the header lines. I'm accumulating the lines in a StringBuilder and I noticed that my instaparse parser failed when I asked it to operate on the StringBuilder (a CharSequence) directly. I was able to work around that by converting the StringBuilder to a String before parsing.

I remembered reading in the Instaparse source that Java regexes operate on CharSequences so I thought it would be cool if Instaparse parsers could do that too. I guessed that Instaparse wasn't far from being able to do that already based on the Segment implementation. That turned out to be correct.

Please consider accepting this change into Instaparse. If it needs some fixes before being acceptable, I'll be happy to work on that.

Thanks!