Parse an interface declaration.
@return Node
501093
private function interfaceDeclaration() {
    $node = new InterfaceNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_INTERFACE, $node);
    $name_node = new NameNode();
    $this->mustMatch(T_STRING, $name_node, NULL, TRUE);
    $node->addChild($name_node, 'name');
    if ($this->tryMatch(T_EXTENDS, $node)) {
      $extends = new CommaListNode();
      do {
        $extends->addChild($this->name());
      } while ($this->tryMatch(',', $extends));
      $node->addChild($extends, 'extends');
    }
    $this->matchHidden($node);
    $statement_block = new StatementBlockNode();
    $this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
    while ($this->currentType !== NULL && $this->currentType !== '}') {
      $this->matchHidden($statement_block);
      if ($this->currentType === T_CONST) {
        $statement_block->addChild($this->_const());
      }
      else {
        $statement_block->addChild($this->interfaceMethod());
      }
    }
    $this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
    $node->addChild($statement_block, 'statements');
    return $node;
  }
761466
private function getDateNode(): NodeDefinition
    {
        $treeBuilder = new TreeBuilder('date');

        return $treeBuilder
            ->getRootNode()
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('format')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode(DateLength::DATE)
                            ->info('Format of date without time')
                            ->defaultValue('d.m.Y')
                        ->end()
                        ->scalarNode(DateLength::DATETIME)
                            ->info('Format of date with time')
                            ->defaultValue('d.m.Y H:i')
                        ->end()
                        ->scalarNode(DateLength::TIME)
                            ->info('Format of time without date')
                            ->defaultValue('H:i')
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
640936
public function getNodeType()
	{
		if ( is_null( $this->domNode ) ) return null;
		return isset(  DOMXPathNavigator::$nodeTypeMap[ $this->domNode->nodeType ] )
			? DOMXPathNavigator::$nodeTypeMap[ $this->domNode->nodeType ]
			: XPathNodeType::Element;
	}
1345267
private function _declare() {
    $node = new DeclareNode();
    $this->mustMatch(T_DECLARE, $node);
    $this->mustMatch('(', $node, 'openParen');
    $directives = new CommaListNode();
    $node->addChild($directives, 'directives');
    if (!$this->tryMatch(')', $node, 'closeParen', FALSE, TRUE)) {
      do {
        $declare_directive = new DeclareDirectiveNode();
        $this->tryMatch(T_STRING, $declare_directive, 'name');
        if ($this->tryMatch('=', $declare_directive)) {
          $declare_directive->addChild($this->staticScalar(), 'value');
        }
        $directives->addChild($declare_directive);
      } while ($this->tryMatch(',', $directives));
      $this->mustMatch(')', $node, 'closeParen', FALSE, TRUE);
    }
    if ($this->tryMatch(':', $node, NULL, FALSE, TRUE)) {
      $node->addChild($this->innerStatementListNode(T_ENDDECLARE), 'body');
      $this->mustMatch(T_ENDDECLARE, $node);
      $this->endStatement($node);
      return $node;
    }
    else {
      $node->addChild($this->statement(), 'body');
      return $node;
    }
  }
1195336
protected function parse()
    {
        $lines = explode("\n", $this->comment);

        $current_annotation = null;
        $value = null;
        foreach ($lines as $line)
        {
            $line = trim(ltrim($line, "/* \t"));

            if (preg_match("/^@(\w+)( (.*))?$/", $line, $matches) === 1)
            {
                if (!empty($value))
                    $this->annotations[$current_annotation][] = $value;

                $current_annotation = $matches[1];
                $value = $matches[3] ?? '';
            }
            elseif ($current_annotation !== null)
            {
                $value .= "\n" . $line;
            }
            else
            {
                $this->preamble[] = $line;
            }
        }

        if (!empty($value))
            $this->annotations[$current_annotation][] = rtrim($value);
    }
1246077
private function doWhile() {
    $node = new DoWhileNode();
    $this->mustMatch(T_DO, $node, NULL, FALSE, TRUE);
    $node->addChild($this->statement(), 'body');
    $this->mustMatch(T_WHILE, $node, 'whileKeyword');
    $this->condition($node, 'condition');
    $this->endStatement($node);
    return $node;
  }
932691
public function parseDelimiter()
    {
        $idx = 0;

        while ($idx < $this->delimiterLen && $this->last + $idx < $this->len) {
            if ($this->delimiter[$idx] !== $this->str[$this->last + $idx]) {
                return null;
            }
            ++$idx;
        }

        $this->last += $this->delimiterLen - 1;

        return new Token($this->delimiter, Token::TYPE_DELIMITER);
    }
1114226
public function parse(){
		$where = $order = $group = $limit = $q = '';
		$source = $this->parseSource();

		if($this->stmt->getConditions())
			$where = $this->parseWhere();
		if($this->stmt instanceof Result && $this->stmt->getGrouping())
			$group = $this->parseGrouping();
		if($this->stmt->getSorting())
			$order = $this->parseSorting();

		$this->clauses = array($source, $where, $group, $order);

		if($this->stmt->getType() === Manager::STMT_SELECT)
			$q = $this->parseSelectStmt();
		elseif($this->stmt->getType() === Manager::STMT_INSERT)
			$q = $this->parseInsertStmt();
		elseif($this->stmt->getType() === Manager::STMT_UPDATE)
			$q = $this->parseUpdateStmt();
		elseif($this->stmt->getType() === Manager::STMT_DELETE)
			$q = $this->parseDeleteStmt();

		return trim($q);
	}
514333
public function getTypeHint()
    {
        $typeHint = $this->node->type;
        if ($typeHint instanceof Node\Name) {
            $typeHint = (string) $typeHint;
        }
        return $typeHint;
    }
1344824
public function getDocumentationFromNode($node)
    {
        // Any NamespaceDefinition comments likely apply to the file, not the declaration itself.
        if ($node instanceof Node\Statement\NamespaceDefinition) {
            return null;
        }

        // For properties and constants, set the node to the declaration node, rather than the individual property.
        // This is because they get defined as part of a list.
        $constOrPropertyDeclaration = ParserHelpers\tryGetPropertyDeclaration($node) ?? ParserHelpers\tryGetConstOrClassConstDeclaration($node);
        if ($constOrPropertyDeclaration !== null) {
            $node = $constOrPropertyDeclaration;
        }

        // For parameters, parse the function-like declaration to get documentation for a parameter
        if ($node instanceof Node\Parameter) {
            $variableName = $node->getName();

            $functionLikeDeclaration = ParserHelpers\getFunctionLikeDeclarationFromParameter($node);
            $docBlock = $this->getDocBlock($functionLikeDeclaration);

            $parameterDocBlockTag = $this->tryGetDocBlockTagForParameter($docBlock, $variableName);
            return $parameterDocBlockTag !== null ? $parameterDocBlockTag->getDescription()->render() : null;
        }

        // For everything else, get the doc block summary corresponding to the current node.
        $docBlock = $this->getDocBlock($node);
        if ($docBlock !== null) {
            // check whether we have a description, when true, add a new paragraph
            // with the description
            $description = $docBlock->getDescription()->render();

            if (empty($description)) {
                return $docBlock->getSummary();
            }

            return $docBlock->getSummary() . "\n\n" . $description;
        }
        return null;
    }
238671
protected function getContextNode()
    {
        $baseNode = null;
        $view = $this->viewHelperVariableContainer->getView();
        if ($view instanceof FusionAwareViewInterface) {
            $fusionObject = $view->getFusionObject();
            $currentContext = $fusionObject->getRuntime()->getCurrentContext();
            if (isset($currentContext['node'])) {
                $baseNode = $currentContext['node'];
            }
        }

        return $baseNode;
    }
619940
private function parseClass()
    {
        // check which interfaces are implemented
        $interfaces = [];
        foreach ($this->parentClasses as $pc) {
            $interfaces = array_merge($interfaces,
                $pc->getInterfaceNames()); // returns only the interfaces that the current class implements
        }
        $interfaces = array_unique($interfaces);

        foreach ($interfaces as $i) {
            if ($i == AccessInterface::class) {
                $this->parsedClass->accessInterface = true;
            }

            if ($i == CacheKeyInterface::class) {
                $this->parsedClass->cacheKeyInterface = true;
            }
        }
    }
889751
private function _const() {
    $node = new ConstantDeclarationStatementNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_CONST, $node);
    $declarations = new CommaListNode();
    do {
      $declarations->addChild($this->constDeclaration());
    } while ($this->tryMatch(',', $declarations));
    $node->addChild($declarations, 'declarations');
    $this->endStatement($node);
    return $node;
  }
1286442
protected function parse()
    {
        // Parse Nodes user agent
        if (!preg_match('|Nodes/(.*)\s\((.*)\)|s', $this->userAgent, $match)) {
            return;
        }

        // Put matches into their own variables
        list($version, $parameters) = array_slice($match, 1);

        // Split comma-separated parameters
        $parameters = explode(',', $parameters);

        // Set version if available
        if (!empty($version)) {
            $this->setVersion($version);
        }

        // Set parameters if available
        if (!empty($parameters)) {
            $this->setParameters($parameters);
        }

        // Mark parsing as successful
        $this->successful = true;
    }
1015113
public function getNodeTypeName()
    {
        return $this->nodeTypeName ?:
            (is_null($this->getNodeType()) ? null : $this->getNodeType()->getName());
    }
670277
protected function parseItem()
    {
        if (null === ($primary = $this->parse('Primary', null))) {
            return $this;
        }
        
        switch ($this->type) {
            case '?':
            case '*':
            case '+':
                return new AST\Item($primary, $this->consume());
        }
        
        return $primary;
    }
540583
protected function lexTypeSystemExtension(): TypeSystemExtensionNodeInterface
    {
        $token = $this->lexer->lookahead();

        if (TokenKindEnum::NAME === $token->getKind()) {
            switch ($token->getValue()) {
                case KeywordEnum::SCHEMA:
                    return $this->lexSchemaExtension();
                case KeywordEnum::SCALAR:
                    return $this->lexScalarTypeExtension(false);
                case KeywordEnum::TYPE:
                    return $this->lexObjectTypeExtension();
                case KeywordEnum::INTERFACE:
                    return $this->lexInterfaceTypeExtension();
                case KeywordEnum::UNION:
                    return $this->lexUnionTypeExtension();
                case KeywordEnum::ENUM:
                    return $this->lexEnumTypeExtension();
                case KeywordEnum::INPUT:
                    return $this->lexInputObjectTypeExtension();
            }
        }

        throw $this->unexpected($token);
    }