ariya/esprima — pull request #65 by jdiamond (2012-06-03 17:25:57+00:00)
Title: Harmony - Parse import declarations.

I've added two new syntax elements: ImportDeclaration and
ImportSpecifier. I also use the Glob element added by Yusuke.

Some examples:

import * from foo

becomes:

{
type: 'ImportDeclaration',
specifiers: [{
type: 'Glob'
}],
from: {
type: 'Path',
body: [...]
}
}

and:

import { foo: bar } from baz

becomes:

{
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'foo'
},
from: {
type: 'Path',
body: [...]
}
}],
from: { ... }
}

The specifiers don't have to be doubly nested the way export
specifiers do because the syntax on the wiki doesn't allow for
multiple imports in the same declaration.

There are two variants on the wiki. I've only implemented this syntax
(listed in both):

ImportDeclaration ::= "import" ImportSpecifierSet "from" ModuleSpecifier ";"

http://code.google.com/p/esprima/issues/detail?id=265