Hrm. Is there a way to make some tokens higher priority than others? This parser (http://sprunge.us/hFCU) eats the entire input file, failing to break out the initial metadata.
When I try to make the content
token reluctant (adding a ?
to the *
), it fails to match when the content section begins.
@seylerius you could use ordered choice https://github.com/Engelberg/instaparse#ordered-choice
define a rule that could be one or the other, using /
instead of |
, and put the one you prefer first
although, it looks like your title rule is probably consuming everything
#'.*'
that will consume everything
Nope, it's not eating newlines.
This looks like it's going to do it.
oh, you're right!
@uwo: instaparse doesn't print anything when a failure occurs. It returns a instaparse.Failure
object which happens to print in a special way at the REPL