/**
  * Returns the tokens for the next value.
  *
  * @return array The tokens.
  */
 private function getValue()
 {
     $glimpse = $this->lexer->glimpse();
     // check if it's an assigned value: @example(assigned="value")
     if (DocLexer::T_EQUALS === $glimpse['type']) {
         return $this->getAssignedValue();
     }
     return $this->getPlainValue();
 }
示例#2
0
 /**
  * ArrayEntry ::= Value | KeyValuePair
  * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant
  * Key ::= string | integer | Constant
  *
  * @return array
  */
 private function ArrayEntry()
 {
     $peek = $this->lexer->glimpse();
     if (DocLexer::T_EQUALS === $peek['type'] || DocLexer::T_COLON === $peek['type']) {
         if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) {
             $key = $this->Constant();
         } else {
             $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING));
             $key = $this->lexer->token['value'];
         }
         $this->matchAny(array(DocLexer::T_EQUALS, DocLexer::T_COLON));
         return array($key, $this->PlainValue());
     }
     return array(null, $this->Value());
 }
示例#3
0
 /**
  * @group 44
  */
 public function testWithinDoubleQuotesVeryVeryLongStringWillNotOverflowPregSplitStackLimit()
 {
     $lexer = new DocLexer();
     $lexer->setInput('"' . str_repeat('.', 20240) . '"');
     $this->assertInternalType('array', $lexer->glimpse());
 }