mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
e14946b3e68da8b48c153c28c06842ffd5190345
This is an upstream port for the patch https://github.com/decaffeinate/coffeescript/pull/8 See https://github.com/decaffeinate/decaffeinate/issues/291 for the bug that this fixed. For the most part, CoffeeScript and JavaScript have the same precedence rules, but in some cases, the intermediate AST format didn't represent the actual evaluation order. For example, in the expression `a or b and c`, the `and` is evaluated first, but the parser treated the two operators with equal precedence. This was still correct end-to-end because CoffeeScript simply emitted the result without parens, but any intermediate tools using the CoffeeScript parser could become confused. Here are the JS operator precedence rules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence For the most part, CoffeeScript already follows these. `COMPARE` operators already behave differently due to chained comparisons, so I think we don't need to worry about following JS precedence for those. So I think the only case where it was behaving differently in an important way was for the binary/bitwise operators that are being changed here. As part of this change, I also introduced a new token tag, `BIN?`, for the binary form of the `?` operator.
Moved src/*.coffee under src/coffee-script/ so that lib can be added to $NODE_PATH and only expose the top-level coffee-script namespace. Fixes #1246
{
} } {
{ { } }
} }{ {
{ }{ } } _____ __ __
{ }{ }{ { } / ____| / _|/ _|
.- { { } { }} -. | | ___ | |_| |_ ___ ___
( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \
|`-..________ ..-'| | |___| (_) | | | || __/ __/
| | \_____\___/|_| |_| \___|\___|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|
CoffeeScript is a little language that compiles into JavaScript.
Installation
If you have the node package manager, npm, installed:
npm install -g coffee-script
Leave off the -g if you don't wish to install globally. If you don't wish to use npm:
git clone https://github.com/jashkenas/coffeescript.git
sudo coffeescript/bin/cake install
Getting Started
Execute a script:
coffee /path/to/script.coffee
Compile a script:
coffee -c /path/to/script.coffee
For documentation, usage, and examples, see: http://coffeescript.org/
To suggest a feature or report a bug: http://github.com/jashkenas/coffeescript/issues
If you'd like to chat, drop by #coffeescript on Freenode IRC.
The source repository: https://github.com/jashkenas/coffeescript.git
Changelog: http://coffeescript.org/#changelog
Our lovely and talented contributors are listed here: http://github.com/jashkenas/coffeescript/contributors
Languages
CoffeeScript
64.6%
JavaScript
35.4%