예제 #1
0
파일: Parser.php 프로젝트: rouffj/pdepend
 /**
  * This method parses a PHP 5.3 closure or lambda function.
  *
  * @return PHP_Depend_Code_ASTClosure
  * @since 0.9.5
  */
 private function _parseClosureDeclaration()
 {
     $this->_tokenStack->push();
     if (self::T_FUNCTION === $this->tokenizer->peek()) {
         $this->consumeToken(self::T_FUNCTION);
     }
     $closure = $this->builder->buildASTClosure();
     $closure->setReturnsByReference($this->_parseOptionalByReference());
     $closure->addChild($this->_parseFormalParameters());
     $closure = $this->_parseOptionalBoundVariables($closure);
     $closure->addChild($this->_parseScope());
     return $this->_setNodePositionsAndReturn($closure);
 }
예제 #2
0
 /**
  * Parses an ast closure node.
  *
  * @return PHP_Depend_Code_ASTClosure
  * @since 0.9.12
  */
 private function _parseClosure()
 {
     $this->_tokenStack->push();
     // TODO: Refactor this temporary closure solution.
     $temp = $this->_parseFunctionOrClosureDeclaration();
     $expr = $this->_builder->buildASTClosure();
     foreach ($temp->getChildren() as $child) {
         $expr->addChild($child);
     }
     return $this->_setNodePositionsAndReturn($expr);
 }