marijnh/acorn — pull request #154 by Rich-Harris (2014-11-05 17:15:44+00:00)
Title: allow `export { default } from "foo"`

I ran into this while trying to transpile ES6 modules - parsing a statement like this...

```js
export { default } from 'foo';
```

...causes an `Unexpected token (1:9)` error. My understanding (from [this esprima PR](https://github.com/ariya/esprima/pull/287), via [this es6-module-transpiler test case](https://github.com/esnext/es6-module-transpiler/blob/master/test/examples/export-from-default/second.js)) is that `default` should be treated just like any other identifier in this context, but `parseIdent()` throws because it is a reserved word.

This PR is a bit naive - it simply changes `parseIdent()` to `parseIdent(true)` so that reserved words are allowed, but that means you can do e.g. `export { typeof } from 'foo'` which is clearly wrong. I'd be happy to update the PR if someone could point me in the direction of a more correct fix - in the meantime I thought it would be worth submitting this so there's at least a test case. Thanks