/**
* Parses an index expression as it is valid to access elements in a php
* string or array.
*
* @param \PDepend\Source\AST\ASTNode $node The context source node.
* @param \PDepend\Source\AST\ASTExpression $expr The concrete index expression.
* @param integer $open The open token type.
* @param integer $close The close token type.
*
* @return \PDepend\Source\AST\ASTNode
* @since 0.9.12
*/
private function parseIndexExpression(\PDepend\Source\AST\ASTNode $node, \PDepend\Source\AST\ASTExpression $expr, $open, $close)
{
$this->consumeToken($open);
if (($child = $this->parseOptionalExpression()) != null) {
$expr->addChild($child);
}
$token = $this->consumeToken($close);
$expr->configureLinesAndColumns($node->getStartLine(), $token->endLine, $node->getStartColumn(), $token->endColumn);
return $this->parseOptionalIndexExpression($expr);
}