Beispiel #1
0
 /**
  * @param InputStream $stream
  * @param string      $endToken
  * @param string      $_
  *
  * @return NodeInterface|null
  *
  * @SuppressWarnings(PHPMD.CamelCaseParameterName)
  * @SuppressWarnings(PHPMD.ShortVariable)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function parseUntil(InputStream $stream, $endToken, $_ = null)
 {
     $endTokens = func_get_args();
     array_shift($endTokens);
     $node = null;
     while (true) {
         $token = $stream->next();
         if ($token->is(InputToken::TOKEN_SEPARATOR)) {
             continue;
         }
         if (in_array($token->getType(), $endTokens)) {
             $stream->undo($token);
             return $node;
         }
         if ($token->is(InputToken::TOKEN_SEPARATOR)) {
             continue;
         }
         if ($node) {
             $node = $this->parseConjunction($token, $stream, $node);
         } else {
             $node = $this->parseNode($token, $stream);
         }
     }
     return $node;
 }