-
Notifications
You must be signed in to change notification settings - Fork 2k
compilation error with attribute access #3560
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
Comments
obj= console.log obj['a']['b']['c'] works fine for me on coffee 1.7.1 On Tue, Jul 29, 2014 at 12:31 PM, loveencounterflow <
|
i believe i found the culprit—it's a non-breaking space character that i had inadvertently inserted by hitting Altgr-Space instead of Space on my keyboard. you may verify that by copying and inspecting the i still think it's a bug, because
this behavior is problematic because
i suggest to either
i favor the second solution: outside of string literals, indentation and spacing between tokens should only consist of U+0020; otherwise, an compile-time error with a message like 'illegal whitespace character found on line...' should be raised. |
On a side note, if you're a vim user you could emphasise these guilty chars with something like : |
It is possible to match only valid JavaScript identifiers with a really long regex (like coco and CoffeeScriptRedux does), but CoffeeScript uses a much simpler one, which allows a bit too much. Quoting jashkenas#1718 #issuecomment-2152464 @jashkenas: > But it still seems very much across the "worth it" line. You'll get the > SyntaxError as soon as it hits JS, and performance aside -- even the increase > in filesize for our browser coffee-script.js lib seems too much, considering > this is something no one ever does, apart from experimentation. In short, CoffeeScript treats any non-ASCII character as part of an identifier. However, unicode spaces should be excluded since having blank characters as part of a _word_ is very confusing. This commit does so, while still keeping the regex really simple.
Fixed by #3774. |
@Delapouite definitely helps, i found out using syntax hiliting in the editor. |
i'm feeling a little bit stupid here but i really tried hard to make sure i'm not reporting a ghost. thing is, when i write
i get (using coffeescript 1.7.1 and
coffee -c foo.coffee
)when i do the same on http://www.compileonline.com/try_coffeescript_online.php i get
even worse,
gives the same error. what's going on here?
The text was updated successfully, but these errors were encountered: