instaparse

If you're not trampolining your parser, why bother getting up in the morning?
seylerius 2016-08-19T02:47:59.000008Z

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.

seylerius 2016-08-19T02:49:32.000009Z

When I try to make the content token reluctant (adding a ? to the *), it fails to match when the content section begins.

dave 2016-08-19T14:11:55.000010Z

@seylerius you could use ordered choice https://github.com/Engelberg/instaparse#ordered-choice

1
dave 2016-08-19T14:12:28.000012Z

define a rule that could be one or the other, using / instead of |, and put the one you prefer first

1
dave 2016-08-19T14:13:32.000013Z

although, it looks like your title rule is probably consuming everything

dave 2016-08-19T14:13:45.000014Z

#'.*'

dave 2016-08-19T14:13:50.000015Z

that will consume everything

seylerius 2016-08-19T14:14:05.000016Z

Nope, it's not eating newlines.

seylerius 2016-08-19T14:14:15.000017Z

This looks like it's going to do it.

dave 2016-08-19T14:14:18.000018Z

oh, you're right!

😜 1
aengelberg 2016-08-19T16:45:34.000019Z

@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