/** * Parses an assingment expression node. * * @param \PDepend\Source\AST\ASTNode $left The left part of the assignment * expression that will be parsed by this method. * * @return \PDepend\Source\AST\ASTAssignmentExpression * @since 0.9.12 */ private function parseAssignmentExpression(\PDepend\Source\AST\ASTNode $left) { $token = $this->consumeToken($this->tokenizer->peek()); $node = $this->builder->buildAstAssignmentExpression($token->image); $node->addChild($left); $node->setStartLine($left->getStartLine()); $node->setStartColumn($left->getStartColumn()); // TODO: Change this into a mandatory expression in later versions if (($expr = $this->parseOptionalExpression()) != null) { $node->addChild($expr); $node->setEndLine($expr->getEndLine()); $node->setEndColumn($expr->getEndColumn()); } else { $node->setEndLine($left->getEndLine()); $node->setEndColumn($left->getEndColumn()); } return $node; }
/** * Parses an assingment expression node. * * @param \PDepend\Source\AST\ASTNode $left The left part of the assignment * expression that will be parsed by this method. * * @return \PDepend\Source\AST\ASTAssignmentExpression * @since 0.9.12 */ protected function parseAssignmentExpression(ASTNode $left) { $token = $this->consumeToken($this->tokenizer->peek()); $node = $this->builder->buildAstAssignmentExpression($token->image); $node->addChild($left); // TODO: Change this into a mandatory expression in later versions if (($expr = $this->parseOptionalExpression()) != null) { $node->addChild($expr); } else { $expr = $left; } $node->configureLinesAndColumns($left->getStartLine(), $expr->getEndLine(), $left->getStartColumn(), $expr->getEndColumn()); return $node; }