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

"use strict" => Parse error on line 1: Unexpected 'STRING' #2284

Closed
domenic opened this issue Apr 25, 2012 · 6 comments
Closed

"use strict" => Parse error on line 1: Unexpected 'STRING' #2284

domenic opened this issue Apr 25, 2012 · 6 comments
Labels

Comments

@domenic
Copy link
Contributor

domenic commented Apr 25, 2012

Reproduce by creating a .coffee file with the single line "use strict". Optionally add other lines after it.

Compile or run that file.

Instant parse error.

Tested against 1.3.1 and against master.

A file containing

do ->
    "use strict"

    # other stuff

works. But top-level, it does not, so we cannot use CoffeeScript in our Node.js modules.

@michaelficarra
Copy link
Collaborator

Hmm. Works for me.

$ coffee -ec '"use strict"'
// Generated by CoffeeScript 1.3.1
(function() {
  "use strict";



}).call(this);
$ coffee -bec '"use strict"'
// Generated by CoffeeScript 1.3.1
"use strict";
$ coffee -e '"use strict"'
$

@jashkenas
Copy link
Owner

Works fine for me.

~/Desktop/Projects/coffee-script(master) > bin/coffee -pe '"use strict"'
(function() {
  "use strict";

}).call(this);

@domenic
Copy link
Contributor Author

domenic commented Apr 25, 2012

It works with -e, not with -c.

@domenic
Copy link
Contributor Author

domenic commented Apr 25, 2012

I wonder if I have BOM issues.

@jashkenas
Copy link
Owner

Works fine for me with -c as well. Maybe something's screwy with your install?

@domenic
Copy link
Contributor Author

domenic commented Apr 25, 2012

False alarm, stupid BOM.

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

No branches or pull requests

3 participants