Parsing expression grammar: Difference between revisions

Content deleted Content added
Definition: Moved one example to after the syntax section
More examples: Simplified Pascal comment example
Line 136:
</syntaxhighlight>
 
The following recursive rule matches Pascal-style nested comment syntax, {{code|(* which can (* nest *) like this *)}}. TheRecall commentthat symbols{{code|.|peg}} appearmatches inany single quotes to distinguish them from PEG operatorscharacter.
<syntaxhighlight lang="peg">
NCCBegin /N* (!Begin !End Z)
Begin ← '(*'
End ← '*)'
CNBeginC N*/ (!Begin !End .)
N ← C / (!Begin !End Z)
Z ← any single character
</syntaxhighlight>