php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

pretty printer: group operations by precedence

Open z7zmey opened this issue 6 years ago • 0 comments

[*binary.Mul]
    "Left":
    [*binary.Plus]
        "Left":
        [*expr.Variable]
            "VarName":
            [*node.Identifier]
                "Value": a;
        "Right":
        [*expr.Variable]
            "VarName":
            [*node.Identifier]
                "Value": b;
    "Right":
    [*expr.Variable]
        "VarName":
        [*node.Identifier]
            "Value": c;

Currently, above AST is printed incorrectly: $a + $b * $c. It must group Plus expression and print ($a + $b) * $c

z7zmey avatar Apr 14 '18 21:04 z7zmey