Subject: | Regexp::Grammars: <minimize:> not working with <nocontext:> |
Given the following Grammars fragment:
<grammar: Expression>
<nocontext:>
<rule: Expression>
<[expr=Expression1]>+ % <[ops=BinaryOp1]>
<minimize:>
[...]
A single Expression1 will not be minimized with Regexp::Grammars v1.021.
Looking into the code, the suspicious line is Grammars.pm:1024
if (1 == grep { $_ ne '!' && $_ ne '@' } keys %MATCH) { # ...single
alnum key
However, looking into %MATCH within that rule reveals the following keys:
'expr', '@', '!', '~'
with '~' being referred to as the "context marker" in the code.