コード例 #1
0
ファイル: Parser.php プロジェクト: CobaltBlueDW/oddsandends
 /**
  * This method will parse a class field declaration with all it's variables.
  *
  * <code>
  * // Simple field declaration
  * class Foo {
  *     protected $foo;
  * }
  *
  * // Field declaration with multiple properties
  * class Foo {
  *     protected $foo = 23
  *               $bar = 42,
  *               $baz = null;
  * }
  * </code>
  *
  * @return PHP_Depend_Code_ASTFieldDeclaration
  * @since 0.9.6
  */
 private function parseFieldDeclaration()
 {
     $declaration = $this->builder->buildAstFieldDeclaration();
     $declaration->setComment($this->docComment);
     $type = $this->parseFieldDeclarationType();
     if ($type !== null) {
         $declaration->addChild($type);
     }
     $this->consumeComments();
     $tokenType = $this->tokenizer->peek();
     while ($tokenType !== self::T_EOF) {
         $declaration->addChild($this->parseVariableDeclarator());
         $this->consumeComments();
         $tokenType = $this->tokenizer->peek();
         if ($tokenType !== self::T_COMMA) {
             break;
         }
         $this->consumeToken(self::T_COMMA);
         $this->consumeComments();
         $tokenType = $this->tokenizer->peek();
     }
     $this->setNodePositionsAndReturn($declaration);
     $this->consumeToken(self::T_SEMICOLON);
     return $declaration;
 }