You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<rule: list_opt>
<list>? # entire list may be missing
<rule: list> # as before...
<item> <separator> <list> # recursive definition
| <item> # base case
# Or, more efficiently, but less prettily:
<rule: list>
<[item]> (?: <separator> <[item]> )* # one-or-more
<rule: list_opt>
(?: <[item]> (?: <separator> <[item]> )* )? # zero-or-more
The same is true for parsimonious. Separated lists currently require the hacky syntax above. Beyond cleaner syntax, the benefit of separator syntax is that it unifies common match terms. Rather than handling items multiple times (or recursively) and duplicating code, separator syntax collects the items.
The text was updated successfully, but these errors were encountered:
Because separated lists are such a common component of grammars, Perl's Regexp::Grammars provides special syntax to specify them:
Without separator syntax, separated lists become:
The same is true for parsimonious. Separated lists currently require the hacky syntax above. Beyond cleaner syntax, the benefit of separator syntax is that it unifies common match terms. Rather than handling items multiple times (or recursively) and duplicating code, separator syntax collects the items.
The text was updated successfully, but these errors were encountered: