コード例 #1
0
ファイル: Parser.php プロジェクト: CobaltBlueDW/oddsandends
 /**
  * Parses a single constant definition with one or more constant declarators.
  *
  * <code>
  * class Foo
  * {
  * //  ------------------------
  *     const FOO = 42, BAR = 23;
  * //  ------------------------
  * }
  * </code>
  *
  * @return PHP_Depend_Code_ASTConstantDefinition
  * @since 0.9.6
  */
 private function parseConstantDefinition()
 {
     $this->tokenStack->push();
     $token = $this->consumeToken(self::T_CONST);
     $definition = $this->builder->buildAstConstantDefinition($token->image);
     $definition->setComment($this->docComment);
     do {
         $definition->addChild($this->parseConstantDeclarator());
         $this->consumeComments();
         $tokenType = $this->tokenizer->peek();
         if ($tokenType === self::T_SEMICOLON) {
             break;
         }
         $this->consumeToken(self::T_COMMA);
     } while ($tokenType !== self::T_EOF);
     $definition = $this->setNodePositionsAndReturn($definition);
     $this->consumeToken(self::T_SEMICOLON);
     return $definition;
 }