예제 #1
0
파일: Parser.php 프로젝트: rouffj/pdepend
 /**
  * Parses a variable or any other valid member expression that is prefixed
  * with PHP's reference operator.
  *
  * <code>
  * //                  -----------
  * foreach ( $array as &$this->foo ) {}
  * //                  -----------
  *
  * //     ----------
  * $foo = &$bar->baz;
  * //     ----------
  * </code>
  *
  * @return PHP_Depend_Code_ASTUnaryExpression
  * @since 0.9.18
  */
 private function _parseVariableOrMemberByReference()
 {
     $this->_tokenStack->push();
     $token = $this->consumeToken(self::T_BITWISE_AND);
     $this->consumeComments();
     $expr = $this->builder->buildASTUnaryExpression($token->image);
     $expr->addChild($this->_parseVariableOrConstantOrPrimaryPrefix());
     return $this->_setNodePositionsAndReturn($expr);
 }
예제 #2
0
 /**
  * Parses a unary expression which represents php's by reference operator,
  * that is followed by a variable node.
  *
  * @return PHP_Depend_Code_ASTUnaryExpression
  * @since 0.9.11
  */
 private function _parseVariableByReference()
 {
     $this->_tokenStack->push();
     $token = $this->_consumeToken(self::T_BITWISE_AND);
     $this->_consumeComments();
     $variable = $this->_parseCompoundVariableOrVariableVariableOrVariable();
     $expression = $this->_builder->buildASTUnaryExpression($token->image);
     $expression->addChild($variable);
     return $this->_setNodePositionsAndReturn($expression);
 }