soasme / PeppaPEG

PEG Parser in ANSI C
https://soasme.com/PeppaPEG
MIT License
55 stars 7 forks source link

[Feature Request] Back reference can be used in nested expressions. #127

Closed soasme closed 3 years ago

soasme commented 3 years ago

Is your feature request related to a problem? Please describe. Consider an HCL2 heredoc template,

a = <<EOT
something
EOT

We will need to determine if inner lines of Heredoc template is not started with EOT, hence

HeredocTemplate = "<<" Heredoc (!(\1 Newline) .)* \1 Newline;

As of v1.16.0, there is no way to get a back reference inside (...)* as it's under its own Sequence scope. See https://github.com/soasme/PeppaPEG/blob/main/configs/hcl2.peg.

Describe the solution you'd like

Describe alternatives you've considered N/A

Additional context N/A

soasme commented 3 years ago

\M.N is unnecessary as users can always use \N in a named rule sequence.