Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package is a reserved word #235

Closed
jackspaniel opened this issue Mar 30, 2015 · 3 comments
Closed

package is a reserved word #235

jackspaniel opened this issue Mar 30, 2015 · 3 comments

Comments

@jackspaniel
Copy link

Did something recently change to make this crash? We use jade, which uses with, which uses acorn. Without updating anything, our code started breaking in our test environments, where we do a fresh install every time. Or local dev environments were fine. Finally I tried deleting jade and doing a fresh install and then I was able to see the error on my local. The world of subdependencies can be very hard to debug.

SyntaxError: The keyword 'package' is reserved (740:10)
    at Parser.pp.raise (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1021:13)
    at Parser.pp.parseIdent (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:732:240)
    at Parser.pp.parseBindingAtom (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1136:19)
    at Parser.pp.parseVar (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1987:20)
    at Parser.pp.parseVarStatement (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1883:8)
    at Parser.pp.parseStatement (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1683:19)
    at Parser.pp.parseBlock (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1938:21)
    at Parser.pp.parseStatement (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1689:19)
    at Parser.pp.parseFor (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1961:20)
    at Parser.pp.parseForStatement (/app/node/app/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1770:17)
@marijnh
Copy link
Member

marijnh commented Mar 31, 2015

In both ES3 and in ES5+ strict mode, package is indeed a reserved word. How are you invoking acorn.parse and which language version are you trying to parse? And what value are you passing the allowReserved option?

@jackspaniel
Copy link
Author

Yeah the obvious fix is to change package to pkg, which we did.

We are using jade, which is using with (https://github.com/ForbesLindesay/with), which is using acorn. I see from the link above that this is from with using the latest version of acorn.

@RReverser
Copy link
Member

@jackspaniel It was because of this commit - pugjs/with@0ef234b - where @ForbesLindesay sets sourceType: module so that code is treated as ES6 Module Code which is always strict.

Closing this as not issue of Acorn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants