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 }
Using the Atomic Parsing Token
@, I could accomplish this.It's documented as,