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\SyntaxCode
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;
}