Closed belkadan closed 12 years ago
Not sure what you really want from parslet here. I understand the following: You would like to be able to skip invalid input, but haven't figured out the syntax for it yet, nor the exact mechanism. And you would like to be able to override Parslet::Source, but there is a bug in #parse.
I will consider this to be a bug report for the latter and start thinking about the former when I get to it.
No, not really. The problem is that parse
will fail if there is any unconsumed input. If I want to handle things line-by-line, though, I currently have to split the input stream ahead of time. I'd like to be able to say parse
and have it not error if there's a successful prefix parse.
Valid requests, hope these commits help with your problem.
Perfect, thanks!
I'm trying to use Parslet to repeatedly parse statements in an input stream. For better error recovery, I don't want to just use
repeat
; if one statement is malformed, I want to be able to recover by, say, throwing away all characters up to a delimiter, then resuming my normal "next statement" mode.There seems to be no good way to do this without replicating most of
apply
(orVM::run
). Even just a flag to not error on unconsumed input would be nice, but something more fully-formed would probably include reusing aParslet::Source
(which you can't do just by passing it toparse
, because it will try to wrap it in anotherParslet::Source
instance).