Nadrieril/dhall-rust

Conversions to Pest of 0-repetition ABNF rules fail

eggyal opened this issue · 1 comments

Some ABNF rules, such as the path-empty rule defined in RFC3896§3.3, resolve to the empty string via repetitions of exactly 0 occurrences:

path-empty    = 0<pchar>

Alas, repetitions of exactly 0 occurrences are (currently) invalid in pest.

Perhaps abnf_to_pest could check for such a condition, then output an empty property value as described in "A thoughtful introduction to the pest parser" under Writing the grammar:

Section names and property keys must not be empty, but property values may be empty (as in the line ip= above).

Edit: Realised that the above refers to the sample INI format being parsed in that example, not the grammar of Pest itself. I guess support for 0-repetitions will be required in Pest?

Yeah, we could make that work. I'm sure there's a way to ask pest to match the empty string