Disassembler: parentheses
flip111 opened this issue · 3 comments
flip111 commented
Hi, the disassembler does not produce the original rule back in some cases. But adds unnecessary parentheses. Consider the following code:
<?php
$hoaDisassembler = new Hoa\Ruler\Visitor\Disassembly();
$model = Ruler::interprete('2 = 3');
$rule = $hoaDisassembler->visit($model);
echo $rule;
This outputs (2 = 3)
where the 2 = 3
without parentheses should be sufficient (as the original rule).
Hywan commented
Hello :-),
It's a normal and expected behavior since we do not have this information on the model (the parenthesis are skipped during the parsing).
flip111 commented
Why can the Ruler not read from the PP grammar definition that ( ) are not needed?
Hywan commented
Because it's a useless information :-).