コード例 #1
0
ファイル: Parser.php プロジェクト: CobaltBlueDW/oddsandends
 /**
  * Parses a single array element.
  *
  * An array element can have a simple value, a key/value pair, a value by
  * reference or a key/value pair with a referenced value.
  *
  * @return PHP_Depend_Code_ASTArrayElement
  * @since 1.0.0
  */
 protected function parseArrayElement()
 {
     $this->consumeComments();
     $this->tokenStack->push();
     $element = $this->builder->buildAstArrayElement();
     if ($this->parseOptionalByReference()) {
         $element->setByReference();
     }
     $element->addChild($this->parseExpression());
     $this->consumeComments();
     if (self::T_DOUBLE_ARROW === $this->tokenizer->peek()) {
         $this->consumeToken(self::T_DOUBLE_ARROW);
         $this->consumeComments();
         if ($this->parseOptionalByReference()) {
             $element->setByReference();
         }
         $element->addChild($this->parseExpression());
     }
     return $this->setNodePositionsAndReturn($element);
 }
コード例 #2
0
ファイル: Parser.php プロジェクト: KingNoosh/Teknik
 /**
  * Parses a single array element.
  *
  * An array element can have a simple value, a key/value pair, a value by
  * reference or a key/value pair with a referenced value.
  *
  * @param boolean $static
  * @return PHP_Depend_Code_ASTArrayElement
  * @since 1.0.0
  */
 protected function parseArrayElement($static = false)
 {
     $this->consumeComments();
     $this->tokenStack->push();
     $element = $this->builder->buildAstArrayElement();
     if ($this->parseOptionalByReference()) {
         if ($static) {
             $tokens = $this->tokenStack->pop();
             throw new PHP_Depend_Parser_UnexpectedTokenException(end($tokens), $this->sourceFile->getFileName());
         }
         $element->setByReference();
     }
     $this->consumeComments();
     if ($this->isKeyword($this->tokenizer->peek())) {
         throw new PHP_Depend_Parser_UnexpectedTokenException($this->tokenizer->next(), $this->sourceFile->getFileName());
     }
     $element->addChild($this->parseExpression());
     $this->consumeComments();
     if (self::T_DOUBLE_ARROW === $this->tokenizer->peek()) {
         $this->consumeToken(self::T_DOUBLE_ARROW);
         $this->consumeComments();
         if ($this->parseOptionalByReference()) {
             $element->setByReference();
         }
         $element->addChild($this->parseExpression());
     }
     return $this->setNodePositionsAndReturn($element);
 }