Let's say I have a rule like,
key = { ASCII_ALPHA ~ ( ASCII_ALPHA | "_" )+ } value = { (!NEWLINE ~ ANY)+ } keyvalue = { key ~ "=" ~ value? } option = { key } This supports a
K=V K= K Which is want to set/unset a key, and to specify an option, what I don't like is the syntax for option which produces an AST like this,
rule: option, span: Span { str: "check_local_user", start: 302, end: 318, }, inner: [ Pair { rule: key, span: Span { str: "check_local_user", start: 302, end: 318, }, inner: [], }, ], I don't like that my option has inner with key. I'm just wanting to the option to have the same grammar as a key. Is there any method in Pest.rs to write the grammar such that
inner { myStuff } outer = { inner } gets flattened to
outer = { myStuff } https://stackoverflow.com/questions/66701614/how-can-i-tell-pest-rs-to-flatten-grammar March 19, 2021 at 10:07AM
没有评论:
发表评论