A common idiom for bash is is to use \ to escape the newline at the end of the line,
If a
\<newline>pair appears, and the backslash is not itself quoted, the\<newline>is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).
Such that
FOO \
BAR
is the same as,
FOO BAR
How would I write this grammar into pest.rs? Note this means that NEWLINE is significant in my grammar, and I can't merely ignore it.
One method is to set your
WHITESPACE = { ( " "* ~ "\\" ~ NEWLINE ~ " "* ) }
This keeps regular newlines significant unless they're prefixed by \.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With