Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
Commits on Oct 02, 2016
@shreeve shreeve strip \r (if present) before final \n 7c7bc8e
Commits on Oct 04, 2016
@lydell lydell Merge pull request #4329 from shreeve/strip-cr-if-present
strip \r (if present) before final \n
11561dd
Commits on Oct 07, 2016
@alangpierce alangpierce Change OUTDENT tokens to be positioned at the end of the previous token
This commit adds another post-processing step after normal lexing that sets the
locationData on all OUTDENT tokens to be at the last character of the previous
token. This does feel like a little bit of a hack. Ideally the location data
would be set correctly in the first place and not in a post-processing step, but
I tried that and some temporary intermediate tokens were causing problems, so I
decided to set the location data once those intermediate tokens were removed.
Also, having this as a separate processing step makes it more robust and
isolated.

This fixes the problem in decaffeinate/decaffeinate#371 .
In that issue, the CoffeeScript tokens had three OUTDENT tokens in a row, and
the last two overlapped with the `]`. Since at least one of those OUTDENT tokens
was considered part of the function body, the function expression had an ending
position just after the end of the `]`.

OUTDENT tokens are sort of a weird case in the lexer anyway, since they often
don't correspond to an actual location in the source code. It seems like the
code in `lexer.coffee` makes an attempt at finding a good place for them, but in
some cases, it has a bad result. This seems hard to avoid in the general case.
For example, in this code:
```coffee
[->
  a]
```
There must be an OUTDENT between the `a` and the `]`, but CoffeeScript tokens
have an inclusive start and end, so they must always be at least one character
wide (I think). In this case, the lexer was choosing the `]` as the location,
and the parser ended up generating correct location data, I believe because
it ignores the outermost INDENT and OUTDENT tokens. However, with multiple
OUTDENT tokens in a row, the parser ends up producing location data that is
wrong.

It seems to me like there isn't a solid answer to "what location do OUTDENT
tokens have", since it hasn't mattered much, but for this commit, I'm defining
it: they always have the location of the last character of the previous token.
This should hopefully be fairly safe because tokens are still in the same order
relative to each other. Also, it's worth noting that this makes the start
location for OUTDENT tokens awkward. However, OUTDENT tokens are always used to
mark the end of something, so their `last_line` and `last_column` values are
always what matter when determining AST node bounds, so it is most important for
those to be correct.
ce971b7
@alangpierce alangpierce Fix location data for implicit CALL_END tokens
Fixes decaffeinate/decaffeinate#446

In addition to OUTDENT tokens, CALL_END tokens can also be virtual tokens
without a real location, and sometimes they end up with a location that's
incorrect.
88693e4
Commits on Oct 09, 2016
@alangpierce alangpierce Define proper operator precedence for bitwise/logical operators
This is an upstream port for the patch decaffeinate#8

See decaffeinate/decaffeinate#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.
e14946b
Commits on Oct 10, 2016
@lydell lydell Merge pull request #4335 from alangpierce/fix-operator-precedence
Define proper operator precedence for bitwise/logical operators
a75fe28
@lydell lydell Merge pull request #4296 from alangpierce/move-outdents-to-previous-t…
…oken

Change OUTDENT tokens to be positioned at the end of the previous token
0853b41
Commits on Oct 16, 2016
@GeoffreyBooth GeoffreyBooth The CoffeeScript compiler should error on trying to export anonymous …
…classes (previously we were outputting invalid JavaScript that the runtime was erroring on)
48e00d8
@lydell lydell Merge pull request #4339 from GeoffreyBooth/fix-export-anonymous-class
Disallow exporting anonymous classes
4d3d735
Commits on Oct 19, 2016
@GeoffreyBooth GeoffreyBooth Node 7-nightly throws deprecation warnings when calling `fs` non-`Syn…
…c` functions without callbacks; but we always want the synchronous versions, so we should just call those in the first place
be44ebd
@lydell lydell Merge pull request #4340 from GeoffreyBooth/node-deprecations
Call synchronous `fs` methods using the `Sync` variants
3c42b40
Commits on Oct 23, 2016
@GeoffreyBooth GeoffreyBooth Fix typo 0521c35
@alangpierce alangpierce Properly set location for string tokens ending in a newline (#4344)
This is an upstream port of decaffeinate#9

The existing logic for computing the end location of a string was to take the
end of the string contents, then add the delimiter length to last_column. For
example, `"""abc"""` would have an end position three characters after the `c`.
However, if a string ended in a newline, then the end location for the string
contents would be one line above the end location for the string, so the proper
fix is to move the end location to the next line, not just to shift it to the
right.

This avoids a bug where the location data would sometimes reference a
non-existent location (one past the end of its line). It fixes the AST location
data, although as far as I know, it never has caused correctness issues in the
CoffeeScript output.
6087c2c
Commits on Oct 24, 2016
@GeoffreyBooth GeoffreyBooth Merge branch 'master' of github.com:jashkenas/coffeescript 887052d
Commits on Oct 26, 2016
@GabrielRatener GabrielRatener Selectively ignore CS-only keywords in ES imports and exports (#4347) 26ad6d4
@GeoffreyBooth GeoffreyBooth Resolve conflicts with `2` branch 0d13231
Commits on Oct 31, 2016
@alangpierce alangpierce Include generated } tokens when fixing closing token positions
This is an upstream port of decaffeinate#10
See that PR for links to the issues that this fixes.

Just like OUTDENT and CALL_END tokens, close-curly-brace tokens can be generated
without having a real location, and if that position overlaps with a later
token, it can cause the AST to have bad location data. Just like the other two
token types, we now give `}` tokens the position of the previous real token,
which makes all AST nodes have reasonable locations.
c5afb4e
@lydell lydell Merge pull request #4350 from alangpierce/upstream-fix-generated-clos…
…e-curly-location

Include generated } tokens when fixing closing token positions
aca72f9
Commits on Nov 08, 2016
@GeoffreyBooth GeoffreyBooth Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355)
* Added support for for-from loop, see #3832

* for-from: remove extra newline and add support for ranges

* for-from: tidy up the lexer

* for-from: add support for patterns

* for-from: fix bad alignment

* for-from: add two more tests

* for-from: fix test "for-from loops over generators"

See explanation here: #4306 (comment)

* for-from: delete leftover console.log

* Refactor the big `if` block in the lexer to be as minimal a change from `master` as we can get away with

* Cleanup to make more idiomatic, remove trailing whitespace, minor performance improvements

* for-from: move code from one file to another

* for-from: clean up whitespace

* for-from: lexer bikeshedding

* Move "own is not supported in for-from loops" test into error_messages.coffee; improve error message so that "own" is underlined

* Revert unnecessary changes, to minimize the lines of code modified by this PR
b3896d0
Commits on Nov 15, 2016
@GeoffreyBooth GeoffreyBooth Update dev dependencies; update template rendering to use new Undersc…
…ore syntax
6f09d36
Commits on Nov 16, 2016
@GeoffreyBooth GeoffreyBooth Use Google-hosted jQuery 3b0b002
@GeoffreyBooth GeoffreyBooth Move v1 documentation under `docs/v1`, with `docs/index.html` symlink…
…ing to `docs/v1/index.html` (with `.nojekyll` file to hopefully make the symlink work)
3739954
@GeoffreyBooth GeoffreyBooth Update `cake doc:source` to output to new `docs/v{1|2}/annotated-sour…
…ce`; collapse `doc:underscore` into it and generate missing underscore.html (closes #4295)
eb46975
@GeoffreyBooth GeoffreyBooth Update `cake build:browser` to reflect new path to coffee-script.js 3736b0f
@GeoffreyBooth GeoffreyBooth Even 1.x doesn’t need to limit generators tests to --harmony mode any…
…more; minor cleanup
846c0e4
@GeoffreyBooth GeoffreyBooth coffeescript.org goes HTTPS! a95d986
@GeoffreyBooth GeoffreyBooth Fix links to annotated source 7bc5b73
@GeoffreyBooth GeoffreyBooth Fix missing hunk 4ab6fbc
@GeoffreyBooth GeoffreyBooth Revert unintended changes to generated index.html bebc581
Commits on Nov 17, 2016
@jashkenas Merge pull request #4360 from GeoffreyBooth/branch-docs
Reorganize docs for v1/v2 split
f32740c
@jashkenas move CNAME
24033eb
@GeoffreyBooth GeoffreyBooth Revert to http://coffeescript.org until GitHub pages supports HTTPS f…
…or custom domains (#4363)
a49c5c5
Commits on Nov 18, 2016
@greghuc greghuc CS1 tagged template literals (and CS2 interpolated strings as templat…
…e literals) (#4352)

* Add initial support for template literals with no
interpolation

* Change ‘unexpected string’ error message tests to
use number not identifier prefix.

Identifer prefixes are now valid as tagged
template literals

* Test tagged template literals for non-interpolated
strings and tag function.

* Tagged template literals work for pure Strings.

Pull tagged template definition up to Invocation
level in grammar, enabling chained invocation calls.

We can view a tagged template is a special form
of function call.

* Readying for StringWithInterpolations work.

* Tweaks.

* Fix style

* Pass StringWithInterpolations parameter straight
into Call constructor.

StringWithInterpolations will be output as
template literal, so already in correct form for
outputting tagged template literal.

* Strip down compileNode for StringWithInterpolations

* Done StringLiteral case for interpolated Strings

* Remove need for TemplateLiteral

* Simplify code.

* Small code tidy

* Interpolated strings now outputting as template literals.

Still needs comprehensive testing.

* Move error message tests into error_messages.coffee; remove test that is testing for a Node runtime error

* Split up tests that were testing multiple things per test, so that each test tests only one thing

* Edge cases: tagged template literals containing interpolated strings or even internal tagged template literals

* Make more concise, more idiomatic style

* Pull back extreme indentation

* Restore and fix commented-out tests

* Edge case: tagged template literal with empty string

* Only use new ES2015 interpolated string syntax if we’re inside a tagged template literal; this keeps this PR safe to merge into CoffeeScript 1.x. Remove the code from this commit to make all interpolated strings use ES2015 syntax, for CoffeeScript 2.

* Compiler now _doesn’t_ use template literals.

* Expand tagged template literal tests

* Move ‘Unexpected string’ error message tests into
tagged template literal section.

‘Unexpected string’ is not reported in these test
scenarios anymore. Instead, we error that the
prefixing literal is not a function.

* Don’t unwrap StringWithInterpolations.

Saw bug with program consisting of “#{2}” not
compiling with template literals. Root cause was
that Block.compileNode was unwrapping interpolated
string and so didn’t use compileNode logic at
StringWithInterpolations level.

* No need to bracket interpolated strings any more.

When interpolated string looks like `hello ${2}`,
no extract brackets are needed, as the `s mark the
beginning and end.

* Show html templating with tagged template literals

* Multiline should match multiline

* Comment out unnecessary `unwrap`, which is only needed for CoffeeScript 2 all-ES2015 syntax output
78e1f43
Commits on Nov 19, 2016
@GeoffreyBooth GeoffreyBooth Triple backticks to allow creation of JavaScript blocks (#4357)
* Support JavaScript code blocks set apart by triple backticks (``` ... ```)

* Add test for escaped backticks

* Remove TODOs for things we’re never going to support

* Convert escaped backticks to backticks; update tests

* Block inline JavaScript can end with an escaped backtick character

* Updated JavaScript token regexes per @lydell

* In JavaScript blocks, escape backslashes when they immediately precede backticks; additional tests

* Test that we don’t break backslash escaping in JavaScript literals
073e147
Commits on Nov 21, 2016
@GeoffreyBooth GeoffreyBooth Docs improvements (#4367)
* The generated JavaScript for the examples in the docs ends up within index.html, so we don’t need the intermediate generated .js files committed in the repo; also, even while .gitignored they should be under `docs`, with the rest of the generated files, not under `documentation`, where the source files are.

* Add “Existential Operator” to the table of contents. Closes #4361

* Updated output due to newer version of highlight.js

* Generated the JavaScript for the docs examples should be synchronous, so that index.html isn’t generated before the JavaScript is

* In “Try CoffeeScript,” if you press the tab key it should type a tab character. Closes #3342.

* Rename doc example folders from `js` and `coffee` to just `examples`

* Add missing `yield` to the list of keywords to highlight until highlight.js catches up; update the class used to match highlight.js’ `keyword`

* `cake doc:site` should watch the example files too, not just index.html.js

* Remove examples folder, including underscore.coffee; remove link to annotated underscore.coffee
cc3be71
@danielbayley danielbayley Docs shorthand object notation (#4356)
* Docs shorthand object notation

A simple but slightly more imaginative example of shorthand object notation.

Closes #1808.

Signed-off-by: Daniel Bayley <[email protected]>

* Update for new documentation folder structure

* Fix typo
6c759d4
Commits on Nov 22, 2016
@GeoffreyBooth GeoffreyBooth Docs for `for…from` (#4368)
* Documentation of `for...from` for iterating over generator functions

* Add note that the CoffeeScript compiler does not, in fact, generate JavaScript that runs in every JavaScript runtime 😢
56482a3
Commits on Nov 23, 2016
@GeoffreyBooth GeoffreyBooth Update Bower.json per latest spec (#4371)
* Remove moot `version` property from bower.json

Per bower/spec@a325da3

* No need for bower to know about dev dependencies, and this is one less thing to keep in sync
8ea67ff
@GeoffreyBooth GeoffreyBooth Docs for triple-backticks and escaping backticks (#4369)
* Documentation for triple backticks and escaping backticks

* Better explanation of escaped backticks within triple-backticks block
992eb49
Commits on Nov 27, 2016
@greghuc greghuc Docs for tagged template literals (#4372)
* Correct tagged template literal test.

Should use Coffeescript form of interpolated
strings, not Javascript!

* First pass at docs for tagged template literals.

* Correct alerted variable.

* Add note re checking runtime for tagged template literals

* Fixed broken example.

* Consistent style

* Clarify that CoffeeScript isn’t handling the tagged template literal, the runtime is; fix CoffeeScript spelling

* Collapse notes about generator functions and tagged template literals into the same sentence

* Make tagged template literals example into a function

* Make text less clunky.

* More clarity on what CoffeeScript is doing versus what the runtime is doing, and emphasize runtimes vs Babel/Traceur
555e47d
Commits on Nov 28, 2016
@GeoffreyBooth GeoffreyBooth Fix path to browser compiler (#4374)
02c5641
@GeoffreyBooth GeoffreyBooth Add `for…from` to list of ES2015 exceptions in the introduction (#4373)
5c765f4
@GeoffreyBooth GeoffreyBooth Browser compiler should convert the string to load to UTF-8, in case …
…it is UTF-16 like the contents of a <script> block generally are (#4375)
ac20f66
Commits on Nov 29, 2016
@GeoffreyBooth GeoffreyBooth Replace Uglify.js with Google Closure Compiler, JS version; let NPM f…
…inally reformat package.json the way it likes (#4376)
ac26360
Geoffrey Booth Organize Cakefile: move helper functions that are only used by `doc:s…
…ite` into the `doc:site` task
a401f58
Geoffrey Booth Standardize on .html file extension; move test.html into its new home 6d29086
Commits on Nov 30, 2016
Geoffrey Booth Refactor test.html to be part of the docs output, with the tests embe…
…dded inside it; update test.html styles; move UTF-8 comment test out of test.html and into test/comments.coffee where it belongs
06b3180
Geoffrey Booth Add test description to error message 8c8ebf8
Geoffrey Booth Run literate faab933
@GeoffreyBooth GeoffreyBooth Abstract the `eq` and `arrayEq` functions, shared by Cakefile and tes…
…t.html, into one file that can be included into both
729fec2
@GeoffreyBooth GeoffreyBooth test.html: better test failure output; add inexplicably missing `test…
…ingBrowser`
831d3c9
@GeoffreyBooth GeoffreyBooth Polyfill missing helper functions from Node’s assert, one with CDN-ho…
…sted Underscore; handle .litcoffee correctly
1ea753d
@GeoffreyBooth GeoffreyBooth Exclude error messages from browser-based tests; watch test files cf3a272
@GeoffreyBooth GeoffreyBooth Refactor the way test.html runs tests to be similar to how Cakefile r…
…uns them; most importantly, tests fail when the `test` function throws an exception, not when `ok` does (which happens intentionally a few times in the classes tests); this also produces a more accurate count of tests run
d99ae0e
@jashkenas Merge pull request #4378 from GeoffreyBooth/fix-browser-tests
Fix browser tests
5588658
Commits on Dec 01, 2016
@GeoffreyBooth GeoffreyBooth Bump version to 1.12.0; pass through as a variable to index.html 6d507b4
@GeoffreyBooth GeoffreyBooth 1.11.1 to 1.12.0 change log a15bf3d
@GeoffreyBooth GeoffreyBooth Convert eligible HTML entities to unicode characters (a recommended p…
…ractice: http://stackoverflow.com/a/436637/223225) and convert straight quotes to curly quotes
d0d2ef9
@GeoffreyBooth GeoffreyBooth Update size of browser compiler f187440
@GeoffreyBooth GeoffreyBooth Docs examples with quotation marks were broken. Properly escape the q… 7d6a3b5
@GeoffreyBooth GeoffreyBooth Updated `lib` for 1.12.0 68938cd
@GeoffreyBooth GeoffreyBooth Updated output docs for 1.12.0, including new browser compiler e6b1218
@GeoffreyBooth GeoffreyBooth Update annotated source for 1.12.0 4efd27e
@GeoffreyBooth GeoffreyBooth Add link to browser tests c48f5ce
Geoffrey Booth Escape backticks and `${` within template literals; fixes #4380 47c0a5c
Commits on Dec 02, 2016
@GeoffreyBooth GeoffreyBooth Add Trix to list of examples; closes #4227 075e48d
@GeoffreyBooth GeoffreyBooth Wrap HTML in comments in backticks, so as not to fool docco when gene…
…rating the annotated source
abe746b
@GeoffreyBooth GeoffreyBooth Remove change log updates related to documentation and the compiler b…
…uild system
1a69493
@GeoffreyBooth GeoffreyBooth Regenerate docs 98bf335
Commits on Dec 03, 2016
Geoffrey Booth Handle tagged template literals (and future CS2 interpolated strings)…
… with “invalidly escaped” backticks or `${`—one backslash instead of two
d8abfae
@GeoffreyBooth GeoffreyBooth Improve tests and comments d45d780
@lydell lydell Merge pull request #4383 from GeoffreyBooth/escape-template-literals
Escape backticks and `${` within template literals; fixes #4380
c9de5be
Commits on Dec 04, 2016
@GeoffreyBooth GeoffreyBooth Merge branch 'master' of github.com:jashkenas/coffeescript into 1.12 026d9d6
@GeoffreyBooth GeoffreyBooth Improve comments formatting for better output in annotated source 2f72d03
@GeoffreyBooth GeoffreyBooth Rebuild c5121c8
@GeoffreyBooth GeoffreyBooth Update 1.12.0 release date 2ca0f44
@GeoffreyBooth GeoffreyBooth Update broken links b7dbee2
@lydell lydell Merge pull request #4381 from GeoffreyBooth/1.12
[WIP] 1.12.0
fb0639f