Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::parseImportClause

Parses an import clause

Return value

array|null

1 call to Parser::parseImportClause()
Parser::parseImportDeclaration in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses an import declaration

File

vendor/mck89/peast/lib/Peast/Syntax/Parser.php, line 2239

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseImportClause() {
    if ($spec = $this->parseNameSpaceImport()) {
        return array(
            $spec,
        );
    }
    elseif (($specs = $this->parseNamedImports()) !== null) {
        return $specs;
    }
    elseif ($spec = $this->parseIdentifier(static::$importedBinding)) {
        $node = $this->createNode("ImportDefaultSpecifier", $spec);
        $node->setLocal($spec);
        $ret = array(
            $this->completeNode($node),
        );
        if ($this->scanner
            ->consume(",")) {
            if ($spec = $this->parseNameSpaceImport()) {
                $ret[] = $spec;
                return $ret;
            }
            elseif (($specs = $this->parseNamedImports()) !== null) {
                return array_merge($ret, $specs);
            }
            $this->error();
        }
        else {
            return $ret;
        }
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal