Chris@13: Fixup for precedence and some special syntax Chris@13: ----- Chris@13: expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: // The parens here are "correct", because add is left assoc Chris@13: $stmts[1]->expr->right = new Expr\BinaryOp\Plus(new Expr\Variable('b'), new Expr\Variable('c')); Chris@13: // No parens necessary Chris@13: $stmts[2]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: // Parens for RHS not strictly necessary due to assign speciality Chris@13: $stmts[3]->expr->cond = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[3]->expr->if = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[3]->expr->else = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: // Already has parens Chris@13: $stmts[4]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[5]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: ----- Chris@13: bar; Chris@13: $foo -> bar; Chris@13: $foo -> bar; Chris@13: $foo -> bar; Chris@13: $foo -> bar; Chris@13: self :: $foo; Chris@13: self :: $foo; Chris@13: ----- Chris@13: $stmts[0]->expr->name = new Expr\Variable('a'); Chris@13: $stmts[1]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[2]->expr->var = new Expr\Variable('bar'); Chris@13: $stmts[3]->expr->var = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[4]->expr->name = new Node\Identifier('foo'); Chris@13: // In this case the braces are not strictly necessary. However, on PHP 5 they may be required Chris@13: // depending on where the property fetch node itself occurs. Chris@13: $stmts[5]->expr->name = new Expr\Variable('bar'); Chris@13: $stmts[6]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: $stmts[7]->expr->name = new Node\VarLikeIdentifier('bar'); Chris@13: $stmts[8]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b')); Chris@13: ----- Chris@13: bar; Chris@13: ($a . $b) -> bar; Chris@13: $foo -> foo; Chris@13: $foo -> {$bar}; Chris@13: $foo -> {$a . $b}; Chris@13: self :: $bar; Chris@13: self :: ${$a . $b};