Compare commits

...

3770 Commits

Author SHA1 Message Date
Geoffrey Booth
d756bd6851 [CS2] 2.0.0-beta2 (#4550)
* Breaking changes note about bound class methods

* Changelog for 2.0.0-beta2, including renaming “Change Log” to “Changelog” (the preferred spelling per Wikipedia)

* Update version to 2.0.0-beta2

* 2.0.0-beta2 generated output
2017-05-16 11:53:22 -07:00
Geoffrey Booth
8c9e24841e Merge branch 'master' into 2
# Conflicts:
#	bin/cake
#	bin/coffee
#	documentation/sections/changelog.md
#	documentation/sections/installation.md
#	documentation/sections/introduction.md
#	lib/coffee-script/index.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/sourcemap.js
#	lib/coffeescript/browser.js
#	lib/coffeescript/cake.js
#	lib/coffeescript/coffeescript.js
#	lib/coffeescript/command.js
#	lib/coffeescript/grammar.js
#	lib/coffeescript/helpers.js
#	lib/coffeescript/lexer.js
#	lib/coffeescript/optparse.js
#	lib/coffeescript/register.js
#	lib/coffeescript/repl.js
#	lib/coffeescript/scope.js
#	package.json
2017-05-14 22:05:37 -07:00
Geoffrey Booth
f0e9837dca 1.12.6 missing updated output 2017-05-14 21:22:48 -07:00
Geoffrey Booth
b449e1be60 Comments and style fixes 2017-05-14 12:30:49 -07:00
Geoffrey Booth
f661f91323 1.12.6 (#4548)
* Un-prefer global (#4543)

* 1.12.6 changelog; update NPM module in documentation to be `coffeescript` instead of `coffee-script`; update installation to add note about global vs local `coffee` command

* Update packages

* Updated output

* Simplify changelog
2017-05-14 11:12:50 -07:00
Geoffrey Booth
7134856df2 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/rewriter.js
2017-05-13 21:23:05 -07:00
AKFish
8407dd885a [CS2] Module should be require-able in non-Node environments like Webpack and Browserify (#4546)
* Add webpack support

* Move Node.js-only code from src/coffee-script.coffee to src/index.coffee
* Use lib/coffee-script/index.js as npm package's "main" script
* Export CoffeeScript from src/browser.coffee
* Set package.json's "browser" field to lib/coffee-script/browser.js (used by webpack as entry point)
* Use lib/coffee-script/browser.js as bower package's "main" script

* Use NOP moduleMain when generating parser with Jison

* Remove legacy debug code from browser.coffee

* Improve comments, style

* Fix path

* Remove stub that was only to avoid breaking browser tests; compensate for the lack of stub when running the browser tests in Node

* Update output

* Add test:webpack task to Cakefile

* Update output files

* Run browser tests against webpack build

* Fix newline at end of file

* Export webpack test bundle as CommonJS module

* Remove build:webpack task

* Save webpack build to tmpdir; suppress build output unless it fails
2017-05-13 21:20:36 -07:00
Michal Srb
e00fa5d5f8 Fix #4533: chained calls incorrectly wrapping enclosing implicit objects (#4534) 2017-05-12 06:12:06 -07:00
Geoffrey Booth
993347bb8a [CS2] Un-prefer global (#4543)
* Don’t prefer global installation; the `coffee` or `cake` commands should try to run the locally-installed module if it exists, or the global version otherwise

* Style
2017-05-08 23:35:11 -07:00
Geoffrey Booth
e381e48a79 Fix typo; closes #4187 (#4539) 2017-05-06 06:11:21 -07:00
Geoffrey Booth
22d0cc1012 Fix #4020: No need for break; after a switch case that throws (#4538) 2017-05-06 01:38:20 -07:00
Geoffrey Booth
b28e398396 [CS2] Docs updates (#4536)
* Docs: named functions and function declarations

* No more prototypal `extends`; update docs and example

* More comprehensive documentation of the existential operator; closes #1631

* Better document operators, including `from`

* No fat arrow class methods anymore

* Destructuring shouldn’t say that default values are applied in case of undefined or null

* Spinoff generator and async functions into their own sections; reorder things so that the sections on functions come just before classes, and destructuring goes next to the operators (which discuss assignment)

* Rewrite “CoffeeScript 2” section, making it less practical and more explanatory; move practical info into “Usage”

* Update “Variable Scoping and Lexical Safety” section to remove incorrect reference to Ruby (fixes #2360), add missing details about the safety wrapper, add note about `let`/`const`.

* Updated browser compiler

* Updated docs

* Rewrite Literate CoffeeScript breaking changes

* Split apart the “Breaking Changes” and “Unsupported Features” sections into separate sidebar items and files

* Add example of `not in`, closes #3281

* Fix words in bold that should be in backticks

* Consolidate some breaking changes sections

* Add Node API documentation; closes #3551

* Move the chaining documentation out of the changelog into its own section
2017-05-05 19:44:11 -07:00
Geoffrey Booth
eba271db5b Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/rewriter.js
#	lib/coffeescript/lexer.js
2017-05-02 23:03:37 -07:00
Michal Srb
51c06574a0 Fix #4150: Correctly outdent ternary followed by method call (#4535) 2017-05-02 23:00:21 -07:00
Geoffrey Booth
26cb24acc8 return and export default can now accept implicit objects (#4532) 2017-05-01 19:34:19 -07:00
Geoffrey Booth
2f9ab1d328 [CS2] return and export default can now accept implicit objects (#4532)
* Start with the test I want to pass: return an implicit (braces-less) object

* Update Rewriter class to follow pattern of nodes.coffee; move debugging snippet to where it’ll work in CS2

* Allow export default implicit object

* `return` assumes a continuation onto the next line *if* the next line is indented

* Fix comment; improve test
2017-05-01 19:26:24 -07:00
Chris Connelly
3e70d31e5d Remove support for bound instance methods (#4530)
Bound methods are implemented as assignments to `this` in the
constructor. In derived classes, where `this` is unavailable until
after `super` has been called, the binding is applied and assigned after
the `super` call. This means that any references to 'bound' methods
reachable from the parent constructor will actually point to the unbound
prototype methods.

This can lead to very subtle bugs where a method that is thought to be
bound is handed off and later called with an incorrect context, and the
only defence is for users to be vigilant about referencing bound methods
in constructors.
2017-04-27 23:03:01 -07:00
Geoffrey Booth
277975e33a [CS2] Replace Closure Compiler with Babili, transform browser compiler into ES5-ish (#4523)
* Swap Google Closure Compiler for Babili

* Browser compiler, minified by Babili

* Use Babel to transform, not just to minify; add process.env.TRANSFORM to disable transforming if we only want to minify. Unfortunately several browser tests fail when transformed . . .

* Move `super()` calls so that the Babel-transformed browser compiler passes all the browser tests (in Node, at least)

* Updated browser build

* Update browser tests
2017-04-26 16:21:29 -07:00
Julian Rosse
7ef5cb4a1f Keep unicode code point escapes as is when possible (#4520) 2017-04-25 19:15:08 +02:00
Geoffrey Booth
07ae1edb44 [CS2] Remove unnecessary utility helper functions (#4526)
* Uncomment module test that was waiting for classes to be supported

* Rely on native indexOf

* Replace `bind` helper with native `bind` (no shortcut necessary)

* Update output

* Update modules class tests

* Remove helper for prototype extends

* Update docs to reflect removed extends operator

* Add shortcut for splice, like we have for slice
2017-04-25 07:10:42 -07:00
Geoffrey Booth
7e35c2c3da We no longer need to wrap in quotes JavaScript reserved words used as properties (#4527) 2017-04-24 09:23:42 -07:00
Geoffrey Booth
5651b8b14b [CS2] Fix non-bare get set when called with @ argument (#4525)
* Fixes #4524: `get` and `set` should be usable without parentheses when accessed via a period

* More get/set tests
2017-04-23 11:23:36 -07:00
Julian Rosse
ac1b2b5c30 Iss4248 unicode code point escapes (cleanup) (#4522)
* Fix #4248: Unicode code point escapes

* rewrite unicode code point escapes as unicode escapes

* smarter defaults

* and resimplify

* correct surrogate pairs

* fixes from code review

* handle adjacent code point escapes

* smarter regex

* fix from code review

* refactor toJS() to shared test helper
2017-04-22 11:10:10 -07:00
Geoffrey Booth
3058eedf47 Merge pull request #4521 from helixbass/2_merged_master
merge `master` into `2`
2017-04-20 14:54:07 -07:00
Julian Rosse
89db842c3d merge master 2017-04-20 14:41:28 -05:00
Julian Rosse
96b6c5f65a Fix #4248: Unicode code point escapes (#4498) 2017-04-20 08:03:06 +02:00
Geoffrey Booth
bfce05438b Fix parenthesized conditions in if-else assignment (#4519)
* Fix parenthesized conditions in if-else assignment

* Add compiled output

* Use ‘is’ instead of ‘==‘; ‘right’ is a poor name when you mean ‘correct,’ not the right-hand side of the assignments in this test
2017-04-19 00:10:20 -07:00
Geoffrey Booth
ff60e6a6ce fix 'future reserved words' test (#4518)
Added the missing '#'s for correct string interpolation. Seems like this went unnoticed because in these test cases, the `check` function tests if the compilation fails, which it does either way.
2017-04-19 08:48:02 +02:00
jessaustin
e215a2d280 Write .coffee_history in $XDG_CACHE_HOME (#4472)
* Write .coffee_history in $XDG_CACHE_HOME

Previously, if the $HOME environmental variable was set, the
.coffee_history file was written there. This is still the case, but
first we check if $XDG_CACHE_HOME is set, and if so we write it
there instead. This allows users who want to follow the XDG Base
Directory Specification [0] to do so. Actually, this helps out *all*
users who want to keep their home directory a bit cleaner. It seems
that using this standardized environmental variable is the cleanest
way to do this, rather than involving configuration files or command
line flags or anything else.

Fixes #3705.

[0] https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

* Stylistic corrections

Corrected some style deficiencies, thanks to helpful advice from
@GeoffreyBooth.
2017-04-18 10:52:02 -07:00
Geoffrey Booth
0e8feb7ee9 [CS2] Literate CoffeeScript without dependencies (#4509)
* Reimplement `invertLiterate` without any dependency, tracking indentation levels (including inside lists); update literate test files to also check that no tests are skipped

* Drop Literate CoffeeScript’s support for executable code blocks inside list items (and also for second paragraphs or blockquotes in list items)

* Update Literate CoffeeScript docs to reflect current supported syntax
2017-04-17 23:30:40 -07:00
Geoffrey Booth
ae096a331a Merge branch 'master' into 2
# Conflicts:
#	Cakefile
#	documentation/sections/changelog.md
#	documentation/sections/classes.md
#	documentation/sections/fat_arrow.md
#	documentation/sections/installation.md
#	documentation/sections/introduction.md
#	documentation/sections/resources.md
#	documentation/sections/scripts.md
#	lib/coffeescript/repl.js
#	src/lexer.coffee
2017-04-17 19:52:34 -07:00
Geoffrey Booth
d7e096aeee [CS2] Fix links in v2 docs (#4506)
* Update 2.0.0-beta1 docs

* Fix broken links, update redirected links

* Rebuild v2 docs with updated links

* A few more fixed links
2017-04-17 19:43:22 -07:00
Geoffrey Booth
0da9d711c5 Fix broken links, update redirected links (#4505)
* Fix broken links, update redirected links

* A few more fixed links

* Update v2 docs
2017-04-17 19:43:10 -07:00
Geoffrey Booth
fecdbac291 A particular REPL test is broken in Node 4.8.2 because of a regression that was fixed in Node 5.11.0; just disable the test for Node < 6. Fixes #4502. (#4510) 2017-04-17 12:49:30 -07:00
Simon Lydell
473e8a1841 Merge pull request #4507 from GeoffreyBooth/tests-exit-code
Failing tests exit code; separate building and testing browser compiler
2017-04-16 09:40:08 +02:00
Geoffrey Booth
faf6d179be cake build:browser should just assemble the browser build, not also test it; add cake build:browser:full to additionally run the tests 2017-04-15 13:51:11 -07:00
Geoffrey Booth
d141d5c9ae If the tests fail, return a non-zero exit code 2017-04-15 13:44:14 -07:00
Geoffrey Booth
a36b45434f Merge branch 'master' of github.com:jashkenas/coffeescript 2017-04-13 20:40:24 -07:00
Geoffrey Booth
2ec1a1851d Update 2.0.0-beta1 docs 2017-04-13 20:37:55 -07:00
Geoffrey Booth
db216ec384 [CS2] 2.0.0-beta1 (#4499)
* Fix browser build to incorporate Markdown-It, not Marked

* Update Google Closure Compiler; recompile browser build but with MINIFY=false, because Closure Compiler throws an error on our current code; see https://github.com/google/closure-compiler-js/issues/59

* Bump version to 2.0.0-beta1; do release build, with updated docs and annotated source
2017-04-13 10:42:32 -07:00
Geoffrey Booth
9b77371ea8 Merge commit '72cf485dceb6a88abb3b83493032734409c3591a' into 2
# Conflicts:
#	Cakefile
#	docs/v1/index.html
#	documentation/sections/changelog.md
#	documentation/sections/installation.md
#	documentation/sections/introduction.md
#	lib/coffee-script/nodes.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/sourcemap.js
#	lib/coffeescript/browser.js
#	lib/coffeescript/cake.js
#	lib/coffeescript/coffeescript.js
#	lib/coffeescript/command.js
#	lib/coffeescript/grammar.js
#	lib/coffeescript/helpers.js
#	lib/coffeescript/index.js
#	lib/coffeescript/lexer.js
#	lib/coffeescript/optparse.js
#	lib/coffeescript/register.js
#	lib/coffeescript/repl.js
#	lib/coffeescript/scope.js
#	package.json
2017-04-12 20:27:57 -07:00
Geoffrey Booth
72cf485dce 1.12.5 (#4495)
* Use Markdown-It instead of Marked for generating the docs; update package versions

* Fix links to v2 docs

* Bump version to 1.12.5; update changelog and compiled docs output

* Update compiled output for 1.12.5

* Improve styling for tables
2017-04-10 09:30:36 -07:00
Geoffrey Booth
d20f54967e [CS2] 2.0.0-beta1 docs (#4494)
* Update package versions; remove marked

* Revise docs to use Markdown-It: tables are now GitHub-Flavored Markdown tables, avoid hack of blockquoted code blocks

* Add anchors for sub-sections

* Add syntax highlighting to uneducable code blocks; fix missing italics variant for comments font

* Update docs about breaking changes in Literate CoffeeScript, move Breaking Changes section below Literate CoffeeScript section

* Update docs regarding destructuring default values breaking change

* Update changelog, with spitball release date for beta1

* Fix highlight function return statement
2017-04-09 23:07:58 -07:00
Julian Rosse
fb60070647 Fix #4491: import- and export-specific lexing should stop (#4492)
* Fix #4491: import- and export-specific lexing should stop

* split up tests

* fixes from code review
2017-04-09 02:53:43 -07:00
Geoffrey Booth
be7c1be75f Merge branch 'get-set-warning' into 2 2017-04-08 21:59:53 -07:00
Geoffrey Booth
8292d25d29 [CS2] Throw an error for ambiguous get or set keywords or function calls (#4484)
* Throw an error for ambiguous `get` or `set` function calls or ES5 getter/setter keywords, to warn the user to use parentheses if they intend a function call (or to inform them that `get` or `set` cannot be used as a keyword)

* Code golf

* Catch get or set keyword before static method

* DRY up getting the previous token

* Throw an error if get or set are used as keywords before what looks like a function or method with an interpolated/dynamic name

* Allow `get` or `set` parentheses-less function calls when first argument is a string without a colon (so a plain string, not a property accessor)

* Revert "Allow `get` or `set` parentheses-less function calls when first argument is a string without a colon (so a plain string, not a property accessor)"

This reverts commit 2d1addf5a4.

* Optimization

* No longer throw an error on `get` or `set` function calls to objects with dynamic property names (introduces a way to circumvent our check for trying to avoid the `get` or `set` keywords, but not worth the complications for this tiny edge case)
2017-04-08 21:59:09 -07:00
Julian Rosse
76945ab458 Fix #4487: Outdentation bug (#4488) 2017-04-08 13:12:55 -07:00
Simon Lydell
90ec761f95 Merge pull request #4490 from helixbass/iss4489_regex_octal_escape_sequence_bug
Fix #4489: Regex octal escape sequence bug
2017-04-07 10:40:11 +02:00
Julian Rosse
050aaa40f8 Fix #4489: Regex octal escape sequence bug 2017-04-06 19:39:13 -04:00
Geoffrey Booth
0576eb3a10 No longer throw an error on get or set function calls to objects with dynamic property names (introduces a way to circumvent our check for trying to avoid the get or set keywords, but not worth the complications for this tiny edge case) 2017-04-06 15:23:14 -07:00
Geoffrey Booth
7129f8347e Merge branch '2' into get-set-warning
# Conflicts:
#	lib/coffeescript/lexer.js
2017-04-06 10:12:46 -07:00
Geoffrey Booth
4d25907155 Optimization 2017-04-06 10:11:29 -07:00
Geoffrey Booth
b192e215a5 [CS2] Destructuring (#4478)
* Output simple array destructuring assignments to ES2015

* Output simple object destructured assignments to ES2015

* Compile shorthand object properties to ES2015 shorthand properties

This dramatically improves the appearance of destructured imports.

* Compile default values in destructured assignment to ES2015

* Rename `wrapInBraces` to `wrapInParentheses`, and `compilePatternMatch` to `compileDestructuring`, for clarity; style improvements (no `==` or `!=`, etc.)

* Don’t confuse the syntax highlighter

* Comment Assign::compilePatternMatch a bit

* Assignment expressions in conditionals are a bad practice

* Optional check for existence that only checks `!== undefined`, not `!= null`, to follow ES convention that default values only apply when a variable is undefined, not falsy

* Add comments; remove unnecessary array splats in function tests

* The fallback destructuring code should apply default values only if `undefined`, not falsy, to follow ES spec

* Support destructuring in function parameters (first pass); catch destructured reserved words

* Destructured variables in function parameter lists shouldn’t be added to the function body with `var` declarations; treat splat array function parameters the legacy way to avoid rethinking #4005

* Remove redundancy in undefined-only check for existence; fix passing option to check

* Fix undefined redundancy

* Simplify getting the variable name

* Reimplement “check for existence if not undefined” without creating a new operator

* `Obj::isAssignable` should not mutate; pass `lhs` property in from `Assign` or `Code` to child arrays and objects so that those child nodes are set as allowable for destructuring

* Revert changes to tests

* Restore revised test for empty destructuring assignment
2017-04-06 10:06:45 -07:00
Geoffrey Booth
5e1d978946 [CS2] Fix handling of tabbed code blocks in .litcoffee files (#4485)
* Add tabbed literate test; modernize Markdown title heading

* Better parsing of Literate CoffeeScript files, including now correct parsing of tabbed .litcoffee files; and more accurate stack traces (assuming you don’t do your own word wrapping within list items)

* Swap Marked for MarkdownIt for parsing the Markdown of Literate CoffeeScript files; use MarkdownIt’s `map` property to preserve correct line numbers

* Literate CoffeeScript tests: remove trailing whitespace, fix spelling

* Literate CoffeeScript tests: add block quote test

* Literate CoffeeScript (tabbed, at least) seems to need a consistent starting indentation

* Restore test

* Reference links work now in MarkdownIt

* Breaking change in Literate CoffeeScript: code blocks within HTML tags must be unindented

* Breaking change in Literate CoffeeScript: code blocks within lists need a blank line separating them from the list item text
2017-04-06 09:59:11 -07:00
Geoffrey Booth
a7447d5bba Revert "Allow get or set parentheses-less function calls when first argument is a string without a colon (so a plain string, not a property accessor)"
This reverts commit 2d1addf5a4.
2017-04-06 09:28:23 -07:00
Geoffrey Booth
2d1addf5a4 Allow get or set parentheses-less function calls when first argument is a string without a colon (so a plain string, not a property accessor) 2017-04-06 00:47:06 -07:00
Geoffrey Booth
962374aec1 Throw an error if get or set are used as keywords before what looks like a function or method with an interpolated/dynamic name 2017-04-04 17:03:11 -07:00
Geoffrey Booth
ed4c8286a2 DRY up getting the previous token 2017-04-04 17:00:43 -07:00
Geoffrey Booth
fcf7ddaf45 Catch get or set keyword before static method 2017-04-04 16:31:52 -07:00
Geoffrey Booth
725fe8e018 Code golf 2017-04-04 00:05:14 -07:00
Geoffrey Booth
5596dac5e1 Throw an error for ambiguous get or set function calls or ES5 getter/setter keywords, to warn the user to use parentheses if they intend a function call (or to inform them that get or set cannot be used as a keyword) 2017-04-03 22:43:50 -07:00
Geoffrey Booth
57c0b16eeb Merge pull request #4469 from mrmowgli/2-docs
[CS2] An explanation of why we don’t currently support certain features
2017-04-03 22:40:56 -07:00
Geoffrey Booth
0c06fb2b9f Merge branch '2' into 2-docs 2017-04-02 23:13:00 -07:00
Geoffrey Booth
cfdec64958 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/parser.js
#	lib/coffeescript/lexer.js
2017-04-02 23:10:31 -07:00
Geoffrey Booth
d0c6e53b83 Merge branch '2' into 2-docs
# Conflicts:
#	documentation/sections/coffeescript_2.md
2017-04-02 22:55:31 -07:00
Geoffrey Booth
27caf62322 Merge discussion of CoffeeScript’s benefits into expanded CoffeeScript 2 section and revised Contributing section 2017-04-02 22:53:18 -07:00
Geoffrey Booth
b8df321058 Merge unsupported let/const and get/set sections, shorten 2017-04-02 22:52:37 -07:00
Simon Lydell
c1e3c02d13 Merge pull request #4483 from GeoffreyBooth/fix-export-default
Fix #4451 and 4481: `default` in `export` statements
2017-04-03 07:42:50 +02:00
Geoffrey Booth
06f6efa6d5 Bump minimum Node version to 7.6, which has non-harmony support for async/await; make async tests always enabled, not just for harmony mode 2017-04-02 22:05:09 -07:00
7anshuai
c035d53fb0 Fix broken links in 2 docs (#4480)
Thanks!
2017-04-02 20:09:13 -07:00
Geoffrey Booth
dde7b0d98a Fix #4481: Export an imported member named default 2017-04-02 17:56:51 -07:00
Geoffrey Booth
98d1644c5b Fix #4451: Treat default as a keyword in an export statement only when it follows export or as 2017-04-02 17:36:25 -07:00
mrmowgli
5888ac56d8 Added example, simplified text via suggestion from GeoffreyBooth 2017-03-22 05:16:55 -04:00
mrmowgli
a6bf72a791 Remove language and add link to Wiki article- In the Wild. 2017-03-22 01:51:07 -04:00
mrmowgli
3aa177c88f Reduced overall size per section, cleaned up some style issues and fixed some spelling issues. 2017-03-21 04:59:25 -04:00
mrmowgli
608799f5d0 Looking for comments, Documentation of unsupported features, and suggested menu locations. Separated Why Coffeescript out. Yes I know I need to trim let/const down. 2017-03-19 06:33:15 -04:00
mrmowgli
97aef9b30d An explanation of why we don't currently support certain features within CS2. First draft. 2017-03-16 07:05:30 -04:00
Geoffrey Booth
ca0fd229e1 Update v2 NPM installation instructions 2017-02-22 10:58:10 -08:00
Jeremy Ashkenas
a9bd53d77f Merge pull request #4448 from GeoffreyBooth/2-docs-on-master
2 docs on master
2017-02-22 13:16:44 -05:00
Geoffrey
ccbf3152af Update NPM installation instructions 2017-02-21 21:12:40 -08:00
Geoffrey
f8ce1a8183 Teaser for CoffeeScript 2, link to 2 docs 2017-02-21 20:58:31 -08:00
Geoffrey Booth
cee1076e1d Copy the generated output CS2 docs onto master so that GitHub pages can publish them 2017-02-21 08:35:58 -08:00
Geoffrey Booth
f8c150f201 Merge pull request #4439 from GeoffreyBooth/2.0.0-alpha1
[CS2] 2.0.0-alpha1
2017-02-21 07:04:18 -08:00
Geoffrey Booth
a5cb8cd7c3 Rebuild release 2017-02-20 16:07:44 -08:00
Geoffrey Booth
32799ad732 Make test compatible with Firefox (though it still fails there while it passes in Node and Chrome) 2017-02-20 15:59:59 -08:00
Geoffrey Booth
d47f90599e Bump date 2017-02-20 15:59:59 -08:00
Geoffrey Booth
5817aeb837 Fix browser test.html to work with async tests 2017-02-20 15:59:58 -08:00
Geoffrey Booth
7de06c3dcb Ensure unique source maps’ sourceURL; closes #4126 2017-02-20 15:46:48 -08:00
Geoffrey Booth
6f0f173795 Update changelog for 1.12.4 2017-02-20 15:31:28 -08:00
Geoffrey Booth
221a8720fe Merge branch '2' into 2.0.0-alpha1
# Conflicts:
#	Cakefile
#	README.md
#	documentation/sections/changelog.md
2017-02-18 18:36:15 -05:00
Alan Pierce
ff56533e0b Fix CS2 build after merge pulled in a bare super call (#4447)
[CS2] Fix CS2 build after merge pulled in a bare super call
2017-02-18 18:14:47 -05:00
Geoffrey Booth
e88619a3bb Merge branch 'master' into 2
# Conflicts:
#	documentation/sections/resources.md
#	lib/coffee-script/browser.js
#	lib/coffee-script/cake.js
#	lib/coffee-script/coffee-script.js
#	lib/coffee-script/command.js
#	lib/coffee-script/grammar.js
#	lib/coffee-script/helpers.js
#	lib/coffee-script/index.js
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/register.js
#	lib/coffee-script/repl.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	package.json
2017-02-18 10:52:55 -05:00
Simon Lydell
91e3f7255c Merge pull request #4441 from GeoffreyBooth/1.12.4
1.12.4
2017-02-18 09:47:25 +01:00
Geoffrey Booth
664c7a4743 Update compiled output 2017-02-18 02:54:41 -05:00
Geoffrey Booth
f018e94be9 Update changelog 2017-02-18 02:54:15 -05:00
Geoffrey Booth
79d38cc30b Bump dependency version 2017-02-18 02:53:56 -05:00
Geoffrey Booth
ee8f022317 Merge branch 'master' of github.com:jashkenas/coffeescript into 1.12.4
# Conflicts:
#	Cakefile
2017-02-18 02:48:57 -05:00
Geoffrey Booth
98c1a3a045 Refactor Cake tasks (#4440)
* Node comes with NPM nowadays, so there’s not really a reason to install CoffeeScript the non-NPM way

* The cake documentation tasks should each have build and watch modes following the same form

* Refactor the build tasks to be more foolproof, including the parser unless it’s explicitly excluded

* Abstract out testing built code, to prepare for watching the build task

* Cake task to cut a new release

* cake build:watch, based on https://github.com/GeoffreyBooth/coffeescript-gulp

* Coding style

* Tests shouldn’t write files in a watched folder

* Don’t crash if the REPL test history file is already gone by the time we try to delete it
2017-02-18 02:47:02 -05:00
Simon Lydell
d84c94dc6d Merge pull request #4445 from alangpierce/upstream-fix-new-location-data
Properly update location data when setting a call to use `new`
2017-02-17 18:21:23 +01:00
Simon Lydell
4f714cc7f9 Merge pull request #4444 from alangpierce/upstream-fix-heregex-end-location
Place ending heregex tokens one index earlier
2017-02-17 18:21:08 +01:00
Alan Pierce
fbc77f7445 Properly update location data when setting a call to use new
This is an upstream port of https://github.com/decaffeinate/coffeescript/pull/24

In a case like `new A().b(c)`, the jison structure ends up being different from
the resulting AST. To the jison parser, this is the `new` unary operator applied
to the expression `A().b(c)`. When the unary operator is applied, the
`Call.prototype.newInstance` function traverses into the leftmost function call
and sets the `isNew` flag to true, and the `Op` constructor returns the `Call`
node so that the call is used in place of the unary operator. However, the code
wasn't updating the node location data, so this commit fixes that.

It's sort of hard to get the location data in `newInstance`, so we set a flag on
every affected node in `newInstance` and override `updateLocationDataIfMissing`
(which is called with the location data after the fact) so that it updates just
the starting position.
2017-02-16 20:43:19 -08:00
Alan Pierce
f757614334 Place ending heregex tokens one index earlier
This is an upstream port of https://github.com/decaffeinate/coffeescript/pull/17

The lexer generates fake tokens for interpolated heregexes, and the ending
tokens were being placed where the start (inclusive) and end (inclusive) index
were one past the end of the heregex. This meant that in a case like
`[a ///#{b}///]`, the end tokens of the heregex and also the implicit function
call end were all being placed at the `]`, so the AST location data would say
that the function call ends at the end of the `]`.

To fix, I can just subtract 1 from the position of those ending heregex tokens
so that their end lines up with the end of the heregex itself. This is similar
to previous fixes that changed `OUTDENT` and `CALL_END` tokens so that the end
of the token lines up with the end of the AST node.
2017-02-16 20:32:41 -08:00
Geoffrey Booth
94023d88ca Updated compiled output for 1.12.4 2017-02-14 23:30:32 -08:00
Geoffrey Booth
4547cbac3a Bump version to 1.12.4 and update changelog 2017-02-14 23:30:10 -08:00
Geoffrey Booth
856bf5e68c cake build:watch, based on https://github.com/GeoffreyBooth/coffeescript-gulp 2017-02-14 19:13:41 -08:00
Geoffrey
f4a1172b6f Cake task to cut a new release 2017-02-13 21:58:23 -08:00
Geoffrey
9866224dba Abstract out testing built code, to prepare for watching the build task 2017-02-13 21:49:04 -08:00
Geoffrey
8a271995c7 Refactor the build tasks to be more foolproof, including the parser unless it’s explicitly excluded 2017-02-13 21:05:12 -08:00
Geoffrey
c06a0584ff The cake documentation tasks should each have build and watch modes following the same form 2017-02-13 21:04:14 -08:00
Geoffrey
37e6513c02 Node comes with NPM nowadays, so there’s not really a reason to install CoffeeScript the non-NPM way 2017-02-13 20:31:58 -08:00
Geoffrey
4cc701a9da Remove hyphen in coffee-script 2017-02-12 17:00:05 -08:00
Geoffrey
d2e94c6ebd Fix Try CoffeeScript for mobile 2017-02-12 16:36:52 -08:00
Geoffrey Booth
d7d32cf0b6 Prepare for new module name on NPM 2017-02-10 11:38:43 -08:00
Geoffrey Booth
ebe32d35e2 Add breaking changes link to changelog; bump date 2017-02-10 11:36:35 -08:00
Geoffrey Booth
ecafe7ce0f Update changelog for 2.0.0-alpha1 2017-02-09 13:33:35 -08:00
Geoffrey Booth
41a229e22e Update browser-based tests output 2017-02-09 13:29:23 -08:00
Geoffrey Booth
d9194b2670 Update annotated source for 2.0.0-alpha1 2017-02-09 13:29:12 -08:00
Geoffrey Booth
365d1968e9 Bump CoffeeScript version to 2.0.0-alpha1 2017-02-09 13:28:22 -08:00
Geoffrey Booth
eebc432efb Fix link to browser-based tests 2017-02-09 13:27:24 -08:00
Geoffrey Booth
dd5aa2b7a4 Bump version of Closure Compiler, update browser compiler 2017-02-09 13:26:46 -08:00
Geoffrey Booth
d1d2c16fdd Update docs for classes, breaking changes (#4438)
* Update classes docs for CS2

* Port breaking changes from https://github.com/jashkenas/coffeescript/wiki/%5BWIP%5D-Breaking-changes-in-CoffeeScript-2 into new docs section

* Update browser compiler

* Update re @connec’s notes; split classes section into two sections for classes and working with prototypes; make breaking changes examples editable whenever possible
2017-02-09 08:50:11 -08:00
Geoffrey
ef1898ba42 Merge commit '3d0d04efe286fdbd9b1b1841112a6b9c991e9698' into 2 2017-02-07 20:20:51 -08:00
Ruben Rodriguez
3d0d04efe2 getSourceMap needs to pass literate flag to compile() (#4435) 2017-02-04 19:33:09 -08:00
Geoffrey Booth
81cbca5bb8 Update async test to use new super syntax 2017-02-04 17:05:18 -08:00
Geoffrey
da3db1be39 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/nodes.js
#	lib/coffee-script/scope.js
2017-02-04 12:36:49 -08:00
Chris Connelly
396bd4f2f2 [CS2] Compile all super calls to ES2015 super (#4424)
* Compile all super calls to ES2015 super

This breaks using `super` in non-methods, meaning several tests are
failing. Self-compilation still works.

* Use bound functions for IIFEs containing `super`

`super` can only be called directly in a method, or in an arrow
function.

* Fix handling of `class @A extends A`

This behaviour worked 'for free' when the parent reference was being
cached by the executable class body wrapper. There now needs to be
special handling in place to check if the parent name matches the class
name, and if so to cache the parent reference.

* Fix tests broken by compiling ES2015 `super`

* Disallow bare super

This removes syntax support for 'bare' super calls, e.g.:

    class B extends A
      constructor: -> super

`super` must now always be followed with arguments like a regular
function call. This also removes the capability of implicitly forwarding
arguments. The above can be equivalently be written as:

    class B extends A
      constructor: -> super arguments...

* Support super with accessors

`super` with following accessor(s) is now compiled to ES2015
equivalents. In particular, expressions such as `super.name`,
`super[name]`, and also `super.name.prop` are all now valid, and can be
used as expected as calls (i.e. `super.name()`) or in expressions (i.e.
`if super.name? ...`).

`super` without accessors is compiled to a constructor super call in a
constructor, and otherwise, as before, to a super call to the method of
the same name, i.e.

    speak: -> super()

...is equivalent to

    speak: -> super.speak()

A neat side-effect of the changes is that existential calls now work
properly with super, meaning `super?()` will only call if the super
property exists (and is a function). This is not valid for super in
constructors.

* Prevent calling `super` methods with `new`

This fixes a bug in the previous super handling whereby using the `new`
operator with a `super` call would silently drop the `new`. This is now
an explicit compiler error, as it is invalid JS at runtime.

* Clean up some old super handling code

This was mostly code for tracking the source classes and variables for
methods, which were needed to build the old lookups on `__super__`.

* Add TODO to improve bare super parse error

* Add some TODOs to improve some of the class tests
2017-02-04 12:03:17 -08:00
Geoffrey Booth
cbea7b5d1c [CS2] Fix handling of parameters that are complex (#4430)
* Add failing test per #4406

* If a parameter is a function call, define it in an expression within the function body

* Remove the space between `function` and `*` for generator functions, to follow usual ES idiom

* We can collapse `isCall` into `isComplex`

* Don’t need existence check here

* Correct destructured parameter default evaluation order with an incrementing variable (or more generally any complicated parameter that isComplex)

* Try to pull complex parameters out of the parameter list if their order of execution matters; but don’t pull _all_ complex parameters out of the parameter list, so that we don’t lose parameter default values

* Add lots of comments about node special properties

* Err on the side of caution in deciding whether a complex parameter is allowable in a function parameter list rather than the function body (there are lots more detections we could add to find additional “safe” parameters)

* Follow the ES and CS2 convention of assigning parameter default values only when undefined, not when null or undefined

* Along with arrays and empty objects, also let values whose bases are not complex be allowed in the function parameter list (like `obj.prop`)

* Better way to check for undefined parameters when declaring them in a function body

* Once we’ve put a complex parameter in the function body, all following complex parameters go into the function body; no need to create lots of exceptions of when to choose whether to put a complex param in the body

* Rename `isComplex` to `shouldCache` for clarity
2017-02-01 06:54:42 -08:00
Simon Lydell
87e537c917 Merge pull request #4432 from connec/fix-export-declarations
Fix "export" squashing variable declarations
2017-01-26 16:58:43 +01:00
Chris Connelly
b61324058d Fix "export" squashing variable declarations
Exports that referenced variables assigned in the module would prevent
the referenced variables from being declared, resulting in
ReferenceErrors at run time.

Fixes #4394.
2017-01-26 15:27:41 +00:00
Geoffrey Booth
3e7973e08d Merge branch 'master' into 2
# Conflicts:
#	lib/coffee-script/browser.js
#	lib/coffee-script/cake.js
#	lib/coffee-script/coffee-script.js
#	lib/coffee-script/command.js
#	lib/coffee-script/grammar.js
#	lib/coffee-script/helpers.js
#	lib/coffee-script/index.js
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/register.js
#	lib/coffee-script/repl.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	package.json
2017-01-24 18:54:55 -08:00
Simon Lydell
635e207f3f Update release date for 1.12.3 2017-01-24 18:53:18 +01:00
Simon Lydell
e87d5749bd Merge pull request #4429 from GeoffreyBooth/1.12.3
1.12.3
2017-01-24 18:50:29 +01:00
Geoffrey Booth
ec5adf53a7 Fix CodeMirror cursor in CoffeeScript input columns; update generated documentation 2017-01-22 20:05:12 -08:00
Geoffrey Booth
48eb173bcd Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/nodes.js
#	test/error_messages.coffee
2017-01-22 16:32:38 -08:00
Geoffrey Booth
b89dd043d3 Add other 1.12.3 updates to changelog 2017-01-22 16:13:53 -08:00
Geoffrey Booth
8ce7c30c49 Update generated docs for 1.12.3 2017-01-22 13:30:38 -08:00
Geoffrey Booth
45d0a7d01f Update browser compiler for 1.12.3 2017-01-22 13:30:04 -08:00
Geoffrey Booth
729127735b Bump version 2017-01-22 13:28:08 -08:00
Geoffrey Booth
6d27277ef6 Update documentation for 1.12.3. 2017-01-22 13:27:22 -08:00
Geoffrey Booth
3108244c20 Fix stack trace (#4428)
* Revert aee27fbff0

* Patch Jison’s output so that it requires `fs` only if we’re truly in a CommonJS/Node environment, not a browser environment that may happen to have globals named `require` and `exports` (as would be the case if require.js is being used). Fixes #4391.

* Temporary fix for exceptions getting thrown when trying to generate a stack trace for a file that has been deleted since compilation; fixes #3890, but not well. A better solution would not try to recompile the file when trying to retrieve its stack trace.

* Save the test REPL history in the system temp folder, not in the CoffeeScript project folder

* Rewrite `getSourceMap` to never read a file from disk, and therefore not throw IO-related exceptions; source maps are either retrieved from memory, or the related source code is retrieved from memory to generate a new source map. Fixes #3890 the proper way.

* Add test to verify that stack traces reference the correct line number. Closes #4418.

* Get the parser working in the browser compiler again; rather than detecting a CommonJS environment generally, just check for `fs` before trying to use it

* Follow Node’s standard of 4-space indentation of stack trace data

* Better .gitignore

* Fix caching of compiled code and source maps; add more tests to verify correct line numbers in stack traces

* Better fallback value for the parser source

* Fix the stack traces and tests when running in a browser

* Update the browser compiler so that @murrayju doesn’t have any extra work to do to test this branch
2017-01-22 13:20:18 -08:00
Geoffrey Booth
69a07dfa6d [CS2] Fix handling of parameters that are function calls (#4427)
* Add failing test per #4406

* If a parameter is a function call, define it in an expression within the function body

* Remove the space between `function` and `*` for generator functions, to follow usual ES idiom

* We can collapse `isCall` into `isComplex`

* Don’t need existence check here
2017-01-22 04:40:33 -08:00
Simon Lydell
800116d859 Merge pull request #4426 from connec/class-dynamic-key-scope
[CS2] Fix scope of assignments in dynamic class keys
2017-01-21 09:55:33 +01:00
Chris Connelly
4f6073f283 Fix scope of assignments in dynamic class keys
Dynamic class keys were using the method scope for compilation,
resulting in missing declarations and runtime errors.
2017-01-19 21:47:25 +00:00
Jeremy Ashkenas
d0ed2dee60 Merge pull request #4420 from GeoffreyBooth/backport-2-doc-changes
Backport documentation edits
2017-01-13 09:54:58 -05:00
Geoffrey Booth
a61429c947 Updated output 2017-01-12 22:24:14 -08:00
Geoffrey Booth
fbdfa65734 Apply SVG fill color through CSS 2017-01-12 22:24:06 -08:00
Geoffrey Booth
02198eb967 Fix link to Try CoffeeScript 2017-01-12 22:21:05 -08:00
Geoffrey Booth
cd8be896c4 Trim the installation and usage sections; can backport to v1 2017-01-12 22:11:20 -08:00
Geoffrey Booth
b398c8809a Fix releaseHeader for the initial release; should backport to v1 2017-01-12 22:11:08 -08:00
Geoffrey Booth
9e13100f58 Allow copying JavaScript from examples 2017-01-12 22:08:11 -08:00
Geoffrey Booth
52bc1dab0b Update docs per #4354 2017-01-12 21:59:54 -08:00
Geoffrey Booth
ff9f078a89 Merge branch '2' into 2-docs 2017-01-12 21:57:16 -08:00
Chris Connelly
8d81804fee [CS2] Compile class constructors to ES2015 classes (#4354)
* Compile classes to ES2015 classes

Rather than compiling classes to named functions with prototype and
class assignments, they are now compiled to ES2015 class declarations.

Backwards compatibility has been maintained by compiling ES2015-
incompatible properties as prototype or class assignments. `super`
continues to be compiled as before.

Where possible, classes will be compiled "bare", without an enclosing
IIFE. This is possible when the class contains only ES2015 compatible
expressions (methods and static methods), and has no parent (this last
constraint is a result of the legacy `super` compilation, and could be
removed once ES2015 `super` is being used). Classes are still assigned
to variables to maintain compatibility for assigned class expressions.

There are a few changes to existing functionality that could break
backwards compatibility:

- Derived constructors that deliberately don't call `super` are no
  longer possible. ES2015 derived classes can't use `this` unless the
  parent constructor has been called, so it's now called implicitly when
  not present.

- As a consequence of the above, derived constructors with @ parameters
  or bound methods and explicit `super` calls are not allowed. The
  implicit `super` must be used in these cases.

* Add tests to verify class interoperability with ES

* Refactor class nodes to separate executable body logic

Logic has been redistributed amongst the class nodes so that:

- `Class` contains the logic necessary to compile an ES class
  declaration.
- `ExecutableClassBody` contains the logic necessary to compile CS'
  class extensions that require an executable class body.

`Class` still necessarily contains logic to determine whether an
expression is valid in an ES class initializer or not. If any invalid
expressions are found then `Class` will wrap itself in an
`ExecutableClassBody` when compiling.

* Rename `Code#static` to `Code#isStatic`

This naming is more consistent with other `Code` flags.

* Output anonymous classes when possible

Anonymous classes can be output when:

- The class has no parent. The current super compilation needs a class
  variable to reference. This condition will go away when ES2015 super
  is in use.
- The class contains no bound static methods. Bound static methods have
  their context set to the class name.

* Throw errors at compile time for async or generator constructors

* Improve handling of anonymous classes

Anonymous classes are now always anonymous. If a name is required (e.g.
for bound static methods or derived classes) then the class is compiled
in an `ExecutableClassBody` which will give the anonymous class a stable
reference.

* Add a `replaceInContext` method to `Node`

`replaceInContext` will traverse children looking for a node for which
`match` returns true. Once found, the matching node will be replaced by
the result of calling `replacement`.

* Separate `this` assignments from function parameters

This change has been made to simplify two future changes:

1. Outputting `@`-param assignments after a `super` call.
   In this case it is necessary that non-`@` parameters are available
   before `super` is called, so destructuring has to happen before
   `this` assignment.
2. Compiling destructured assignment to ES6
   In this case also destructuring has to happen before `this`,
   as destructuring can happen in the arguments list, but `this`
   assignment can not.

A bonus side-effect is that default values for `@` params are now output
as ES6 default parameters, e.g.

    (@a = 1) ->

becomes

    function a (a = 1) {
      this.a = a;
    }

* Change `super` handling in class constructors

Inside an ES derived constructor (a constructor for a class that extends
another class), it is impossible to access `this` until `super` has been
called. This conflicts with CoffeeScript's `@`-param and bound method
features, which compile to `this` references at the top of a function
body. For example:

    class B extends A
      constructor: (@param) -> super
      method: =>

This would compile to something like:

    class B extends A {
      constructor (param) {
        this.param = param;
        this.method = bind(this.method, this);
        super(...arguments);
      }
    }

This would break in an ES-compliant runtime as there are `this`
references before the call to `super`. Before this commit we were
dealing with this by injecting an implicit `super` call into derived
constructors that do not already have an explicit `super` call.
Furthermore, we would disallow explicit `super` calls in derived
constructors that used bound methods or `@`-params, meaning the above
example would need to be rewritten as:

    class B extends A
      constructor: (@param) ->
      method: =>

This would result in a call to `super(...arguments)` being generated as
the first expression in `B#constructor`.

Whilst this approach seems to work pretty well, and is arguably more
convenient than having to manually call `super` when you don't
particularly care about the arguments, it does introduce some 'magic'
and separation from ES, and would likely be a pain point in a project
that made use of significant constructor overriding.

This commit introduces a mechanism through which `super` in constructors
is 'expanded' to include any generated `this` assignments, whilst
retaining the same semantics of a super call. The first example above
now compiles to something like:

    class B extends A {
      constructor (param) {
        var ref
        ref = super(...arguments), this.param = param, this.method = bind(this.method, this), ref;
      }
   }

* Improve `super` handling in constructors

Rather than functions expanding their `super` calls, the `SuperCall`
node can now be given a list of `thisAssignments` to apply when it is
compiled.

This allows us to use the normal compiler machinery to determine whether
the `super` result needs to be cached, whether it appears inline or not,
etc.

* Fix anonymous classes at the top level

Anonymous classes in ES are only valid within expressions. If an
anonymous class is at the top level it will now be wrapped in
parenthses to force it into an expression.

* Re-add Parens wrapper around executable class bodies

This was lost in the refactoring, but it necessary to ensure
`new class ...` works as expected when there's an executable body.

* Throw compiler errors for badly configured derived constructors

Rather than letting them become runtime errors, the following checks are
now performed when compiling a derived constructor:

- The constructor **must** include a call to `super`.
- The constructor **must not** reference `this` in the function body
  before `super` has been called.

* Add some tests exercising new class behaviour

- async methods in classes
- `this` access after `super` in extended classes
- constructor super in arrow functions
- constructor functions can't be async
- constructor functions can't be generators
- derived constructors must call super
- derived constructors can't reference `this` before calling super
- generator methods in classes
- 'new' target

* Improve constructor `super` errors

Add a check for `super` in non-extended class constructors, and
explicitly mention derived constructors in the "can't reference this
before super" error.

* Fix compilation of multiple `super` paths in derived constructors

`super` can only be called once, but it can be called conditionally from
multiple locations. The chosen fix is to add the `this` assignments to
every super call.

* Additional class tests, added as a separate file to simplify testing and merging.
Some methods are commented out because they currently throw and I'm not sure how
to test for compilation errors like those.

There is also one test which I deliberately left without passing, `super` in an external prototype override.
This test should 'pass' but is really a variation on the failing `super only allowed in an instance method`
tests above it.

* Changes to the tests. Found bug in super in prototype method. fixed.

* Added failing test back in, dealing with bound functions in external prototype overrides.

* Located a bug in the compiler relating to assertions and escaped ES6 classes.

* Move tests from classes-additional.coffee into classes.coffee; comment out console.log

* Cleaned up tests and made changes based on feedback.  Test at the end still has issues, but it's commented out for now.

* Make HoistTarget.expand recursive

It's possible that a hoisted node may itself contain hoisted nodes (e.g.
a class method inside a class method). For this to work the hoisted
fragments need to be expanded recursively.

* Uncomment final test in classes.coffee

The test case now compiles, however another issue is affecting the test
due to the error for `this` before `super` triggering based on source
order rather than execution order. These have been commented out for
now.

* Fixed last test TODOs in test/classes.coffee

Turns out an expression like `this.foo = super()` won't run in JS as it
attempts to lookup `this` before evaluating `super` (i.e. throws "this
is not defined").

* Added more tests for compatability checks, statics, prototypes and ES6 expectations.  Cleaned test "nested classes with super".

* Changes to reflect feedback and to comment out issues that will be addressed seperately.

* Clean up test/classes.coffee

- Trim trailing whitespace.
- Rephrase a condition to be more idiomatic.

* Remove check for `super` in derived constructors

In order to be usable at runtime, an extended ES class must call `super`
OR return an alternative object. This check prevented the latter case,
and checking for an alternative return can't be completed statically
without control flow analysis.

* Disallow 'super' in constructor parameter defaults

There are many edge cases when combining 'super' in parameter defaults
with @-parameters and bound functions (and potentially property
initializers in the future).

Rather than attempting to resolve these edge cases, 'super' is now
explicitly disallowed in constructor parameter defaults.

* Disallow @-params in derived constructors without 'super'

@-parameters can't be assigned unless 'super' is called.
2017-01-12 21:55:30 -08:00
Jeremy Ashkenas
f4353fa797 Merge pull request #4417 from BrianRossmajer/patch-1
Show a simple object extraction before complex one
2017-01-04 16:24:54 -05:00
Brian Rossmajer
e6f5b930bc Show a simple object extraction before complex one 2017-01-04 16:06:25 -05:00
Jeremy Ashkenas
87e70ee78b Merge pull request #4416 from isabellatea/copyright-year
Update copyright range to 2017
2017-01-04 11:05:04 -05:00
Bella
fc1d4edbfd Update copyright range to 2017 2017-01-04 00:34:28 -08:00
Jeremy Ashkenas
5f00ccc362 Merge pull request #4415 from connec/@indices-in-loops
Allow `@` values as indices in `for` expressions
2016-12-29 14:24:36 -05:00
Chris Connelly
1143ac0268 Allow @ values as indices in for expressions
This loosens the compilation of `for` expressions to allow the index
variable to be an `@` value, e.g.

    do @visit for @node, @index in nodes

Within `@visit`, the index of the current node (`@node`) would be
available as `@index`.

Fixes #4411.
2016-12-29 19:00:00 +00:00
Geoffrey Booth
0fc625d7e9 Try CoffeeScript add play and link buttons 2016-12-27 22:53:52 -05:00
Geoffrey Booth
ef1005b920 Try CoffeeScript first draft 2016-12-27 21:35:43 -05:00
Geoffrey Booth
5cf8256d2e Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2016-12-26 21:17:20 -05:00
Valentine Valyaeff
0a6aeef0c9 Fix //= operator (#4410) 2016-12-23 14:37:11 +01:00
Jeremy Ashkenas
ebb56e08ca Merge pull request #4407 from connec/improve-test-with-whitespace
Trivial: Remove trailing whitespace in test/error_messages.coffee
2016-12-21 12:49:48 -05:00
Chris Connelly
27e0914a0d Remove trailing whitespace in test/error_messages.coffee
Trailing whitespace is generally considered 'bad style' and is often
linted against or even simply removed by text editors.

One of the tests in test/error_messages.coffee depended on trailing
whitespace, making the file tricky to work with for people whose
editor is configured to remove trailing whitespace. The alternative is
to use a literal "\n" and escape the line break.
2016-12-21 08:24:05 +00:00
Geoffrey Booth
f0e884dc4e Update output 2016-12-19 22:32:51 -08:00
Geoffrey Booth
24bef3a1f5 Merge branch '2' into 2-docs
# Conflicts:
#	docs/v1/index.html
#	docs/v1/test.html
#	documentation/sections/changelog.md
#	documentation/sections/chat.md
#	documentation/sections/fat_arrow.md
#	documentation/sections/functions.md
#	documentation/sections/installation.md
#	documentation/sections/introduction.md
#	documentation/sections/language.md
#	documentation/sections/literate.md
#	documentation/sections/operators.md
#	documentation/sections/overview.md
#	documentation/sections/resources.md
#	documentation/sections/scripts.md
#	documentation/sections/source_maps.md
#	documentation/sections/strings.md
#	documentation/sections/tagged_template_literals.md
#	documentation/sections/usage.md
2016-12-19 22:32:07 -08:00
Geoffrey Booth
5d557a54e1 Updated v2 docs generated output 2016-12-19 22:27:42 -08:00
Geoffrey Booth
3379f233e8 Modernize various sections as relevant to v2; improve presentation of tables 2016-12-19 22:27:32 -08:00
Geoffrey Booth
26b1584fd8 Trim the installation and usage sections; can backport to v1 2016-12-19 22:10:32 -08:00
Geoffrey Booth
5fa91e7b95 Fix scrollspy for Resources 2016-12-19 21:59:19 -08:00
Geoffrey Booth
d8bd2b7fd0 Embedded JavaScript should really be the last item in the language reference 2016-12-19 21:55:44 -08:00
Geoffrey Booth
d02376c4c6 Convert async docs text to markdown, add to sidebar 2016-12-19 21:50:30 -08:00
Geoffrey Booth
69fbb361f2 Merge branch '2-docs' into async-docs
# Conflicts:
#	documentation/index.html.js
2016-12-19 21:41:22 -08:00
Geoffrey Booth
4468ca69c0 Add some v1-style ribbing 2016-12-19 21:29:03 -08:00
Geoffrey Booth
a4b3a3ba39 Updated output v2 docs 2016-12-18 23:40:30 -08:00
Geoffrey Booth
ad90f4ad99 Update introduction for CoffeeScript 2 2016-12-18 23:25:01 -08:00
Geoffrey Booth
cc8dd150f5 Fix filename style 2016-12-18 23:24:43 -08:00
Geoffrey Booth
7ced071934 Add some links to header navbar; fix sidebar to work at various breakpoints, including navigating to anchors 2016-12-18 23:03:17 -08:00
Geoffrey Booth
28d077c08a Style blockquotes 2016-12-18 18:29:36 -08:00
Geoffrey Booth
31ff5e4194 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/browser.js
#	lib/coffee-script/cake.js
#	lib/coffee-script/coffee-script.js
#	lib/coffee-script/command.js
#	lib/coffee-script/grammar.js
#	lib/coffee-script/helpers.js
#	lib/coffee-script/index.js
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/register.js
#	lib/coffee-script/repl.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	package.json
2016-12-18 18:16:18 -08:00
Geoffrey Booth
ea269104bd Refactor docs resources section; reorganize outline; other minor corrections 2016-12-18 18:13:59 -08:00
Geoffrey Booth
78b21c2483 Fix releaseHeader for the initial release; should backport to v1 2016-12-18 15:57:04 -08:00
Geoffrey Booth
fc42b3ed24 Remove out-of-date info and dead link from Literate CoffeeScript section of the docs 2016-12-18 15:21:41 -08:00
Geoffrey Booth
c8a3c1a6fd Improvements to strings and comments docs; could be back-ported to v1 docs 2016-12-18 15:13:54 -08:00
Geoffrey Booth
58f9428c58 Colors 2016-12-18 03:54:57 -08:00
Geoffrey Booth
3c6e235b32 Show header bar on all breakpoints 2016-12-18 02:43:41 -08:00
Geoffrey Booth
35cfba06b4 Add fonts 2016-12-18 02:20:10 -08:00
Geoffrey Booth
f01dcd3894 Line spacing notes 2016-12-18 00:07:10 -08:00
Simon Lydell
de180dc81a Merge pull request #4405 from GeoffreyBooth/1.12.2
1.12.2
2016-12-16 09:46:26 +01:00
Geoffrey Booth
e48fea1892 Fix sidebar scrolling on mobile 2016-12-16 00:17:11 -08:00
Geoffrey Booth
47bd5aca58 Fix menu button on regular browsers sized narrowly 2016-12-16 00:05:24 -08:00
Geoffrey Booth
0aa3166709 Updated compiled output 2016-12-15 23:59:11 -08:00
Geoffrey Booth
51aaef3d76 Add logo to top of content pane 2016-12-15 23:58:59 -08:00
Geoffrey Booth
d62f7adc9b Animated sidebar menu toggle button 2016-12-15 23:58:40 -08:00
Geoffrey Booth
853dd456a8 On mobile, the code examples are stacked 2016-12-15 23:19:50 -08:00
Geoffrey Booth
462a60da7b Mobile off canvas sidebar nav that slides in 2016-12-15 23:19:34 -08:00
Geoffrey Booth
4abd0fa06d Mobile header nav with menu button 2016-12-15 23:18:40 -08:00
Geoffrey Booth
e2a3a5b993 Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
Geoffrey Booth
8c81c4ad39 1.12.2 changelog entry and version bump 2016-12-15 21:24:16 -08:00
Geoffrey Booth
b1313962a7 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	Cakefile
#	lib/coffee-script/coffee-script.js
#	src/coffee-script.coffee
2016-12-15 21:13:52 -08:00
Geoffrey Booth
e620434a2e Docs improvements: content in Markdown, organization into subtemplates, fixed tests (#4401)
* Replace tiny bitmaps with base64-encoded URIs

* Optimize SVGs; replace logo PNG with SVG

* Modernize favicon

* Embed CSS; a bit unorthodox, but we’re a single page so there’s no point in separate .css files and their separate HTTP requests

* Documentation is now markdown, converted to HTML on compilation

* Render the examples when we’re rendering index.html; they compile so quickly that there’s no need to pre-render them and save the intermediate .js files

* Split apart index.html into components that Cakefile assembles, so that we can add in logic to include different files for v1 versus v2

* Split building index.html and building test.html into two tasks; collapse the parts of `releaseHeader` into one compact function

* Move include logic into templates

* Get error messages tests to work in the browser

* Update output index.html

* Split body into nav and body

* Watch subtemplates

* Revert "Split body into nav and body"

This reverts commit ec9e559ec0.

* Add marked

* Update gitignore

* Use idiomatic markdown output for code blocks (<pre><code>)

* Handle ids within the template, not in the Cakefile; remove marked’s auto-generated and conflicting ids

* Move the `codeFor` function into versioned folders, so that v1 and v2 docs can have different example code blocks/editors

* Update packages, including new highlight.js which supports our newer keywords and triple backticks (docs output is unchanged)
2016-12-15 21:05:44 -08:00
Geoffrey Booth
2a862d533f Merge branch 'master' of github.com:jashkenas/coffeescript into 2-docs
# Conflicts:
#	Cakefile
#	lib/coffee-script/coffee-script.js
#	src/coffee-script.coffee
2016-12-15 21:01:52 -08:00
Geoffrey Booth
be0f1cb8db DRY on the version number: it should be in package.json and nowhere else (#4400) 2016-12-15 20:52:31 -08:00
mdcb
07d6eb6af5 Fix command completion under nodejs v6.9.1 (#4402)
* Fix command completion under nodejs v6.9.1
Closes #4397

* Commit updated compiled version
2016-12-15 20:50:54 -08:00
Geoffrey Booth
a825336ba9 Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2016-12-15 20:36:53 -08:00
Jan
81174187f5 Fix empty source file when building with MINIFY=false, closes #4403 (#4404) 2016-12-15 20:35:10 -08:00
Geoffrey Booth
a55dbc0c37 Merge branch 'improve-docs' into 2-docs 2016-12-14 00:06:39 -08:00
Geoffrey Booth
818d262843 Update packages, including new highlight.js which supports our newer keywords and triple backticks (docs output is unchanged) 2016-12-14 00:06:20 -08:00
Geoffrey Booth
e05a4e9000 Merge branch 'improve-docs' into 2-docs
# Conflicts:
#	documentation/v1/code.coffee
2016-12-13 23:50:41 -08:00
Geoffrey Booth
c3b3af8746 Fix margin 2016-12-13 23:49:26 -08:00
Geoffrey Booth
4889109b8d 2 docs output, first draft 2016-12-13 23:15:33 -08:00
Geoffrey Booth
93f1f3777c Wire up the buttons that run the code examples 2016-12-13 23:14:21 -08:00
Geoffrey Booth
14382abc2d Move code example HTML into a template where it belongs 2016-12-13 23:13:38 -08:00
Jeremy Ashkenas
aee27fbff0 Merge pull request #4399 from murrayju/issue4391
Add a try/catch in the Error.prepareStackTrace implementation
2016-12-13 14:28:29 -05:00
Justin Murray
28585439d1 Remove Error.prepareStackTrace and the related source map code. Fixes jashkenas/coffeescript#4391 2016-12-13 11:31:12 -05:00
Geoffrey Booth
85b3be9ce3 Move the codeFor function into versioned folders, so that v1 and v2 docs can have different example code blocks/editors 2016-12-12 23:42:33 -08:00
Geoffrey Booth
512b580820 Add CodeMirror for editable code examples; recompile CoffeeScript into JavaScript on change (WIP) 2016-12-12 22:56:31 -08:00
Geoffrey Booth
e90cf16965 Merge branch 'improve-docs' into 2-docs 2016-12-12 22:52:14 -08:00
Geoffrey Booth
59001f2fe3 Move the codeFor function into versioned folders, so that v1 and v2 docs can have different example code blocks/editors 2016-12-12 22:50:30 -08:00
Geoffrey Booth
db055bb916 V2 docs starting point: jQuery, Bootstrap, basic layout, nav with scrollspy 2016-12-11 20:33:54 -08:00
Geoffrey Booth
80fdc6ecc3 Merge branch 'improve-docs' into 2-docs 2016-12-11 20:29:35 -08:00
Geoffrey Booth
ff1725b367 Handle ids within the template, not in the Cakefile; remove marked’s auto-generated and conflicting ids 2016-12-11 20:29:08 -08:00
Geoffrey Booth
d278c730ea Merge branch 'improve-docs' into 2-docs 2016-12-11 17:12:53 -08:00
Geoffrey Booth
4aa0130a92 Use idiomatic markdown output for code blocks (<pre><code>) 2016-12-11 17:12:29 -08:00
Geoffrey Booth
c7ad70731a Merge branch 'improve-docs' into 2-docs 2016-12-11 16:55:12 -08:00
Geoffrey Booth
16dda9c496 Use idiomatic markdown output for code blocks (<pre><code>) 2016-12-11 15:46:38 -08:00
Geoffrey Booth
b2e10e597f Merge branch 'improve-docs' into 2-docs 2016-12-11 01:12:47 -08:00
Geoffrey Booth
b2bf505e4c Update gitignore 2016-12-11 01:06:21 -08:00
Geoffrey Booth
9c9058ebb4 Add marked 2016-12-11 01:06:11 -08:00
Geoffrey Booth
ece610d682 Revert "Split body into nav and body"
This reverts commit ec9e559ec0.
2016-12-11 00:18:46 -08:00
Geoffrey Booth
d61d4272ce Watch subtemplates 2016-12-11 00:13:53 -08:00
Geoffrey Booth
618e851cd6 Watch subtemplates 2016-12-11 00:13:44 -08:00
Geoffrey Booth
2167a7ab2e Merge branch 'improve-docs' into 2-docs 2016-12-11 00:03:24 -08:00
Geoffrey Booth
ec9e559ec0 Split body into nav and body 2016-12-11 00:02:38 -08:00
Geoffrey Booth
07e4047b7f Merge branch 'improve-docs' into 2-docs 2016-12-10 23:42:57 -08:00
Geoffrey Booth
7bb5ccfd80 Update output index.html 2016-12-10 23:35:18 -08:00
Geoffrey Booth
eb36d6e7a2 Get error messages tests to work in the browser 2016-12-10 23:25:20 -08:00
Geoffrey Booth
000dc03360 Move include logic into templates 2016-12-10 22:21:12 -08:00
Geoffrey Booth
0dd727e6eb Split building index.html and building test.html into two tasks; collapse the parts of releaseHeader into one compact function 2016-12-10 19:13:37 -08:00
Geoffrey Booth
6a845aa4f6 Split apart index.html into components that Cakefile assembles, so that we can add in logic to include different files for v1 versus v2 2016-12-10 18:53:58 -08:00
Geoffrey
9eb7c63158 Render the examples when we’re rendering index.html; they compile so quickly that there’s no need to pre-render them and save the intermediate .js files 2016-12-10 11:52:42 -08:00
Geoffrey
0f10082a21 Merge branch 'master' of github.com:jashkenas/coffeescript into improve-docs
# Conflicts:
#	documentation/index.html
2016-12-10 11:40:25 -08:00
Geoffrey
6bd087ebb2 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	lib/coffee-script/browser.js
#	lib/coffee-script/cake.js
#	lib/coffee-script/coffee-script.js
#	lib/coffee-script/command.js
#	lib/coffee-script/grammar.js
#	lib/coffee-script/helpers.js
#	lib/coffee-script/index.js
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/register.js
#	lib/coffee-script/repl.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	package.json
#	src/coffee-script.coffee
2016-12-10 11:06:14 -08:00
Justin Murray
7704cf571e Add a try/catch in the Error.prepareStackTrace implementation to make sure that it never throws. Resolves jashkenas/coffeescript#4391. 2016-12-09 11:25:55 -05:00
Simon Lydell
26cfd19862 Update 1.12.1 release date 2016-12-08 19:18:35 +01:00
Simon Lydell
6a678f23a5 Merge pull request #4395 from GeoffreyBooth/1.12.1
1.12.1
2016-12-08 19:17:31 +01:00
Geoffrey Booth
c7539e3310 Documentation is now markdown, converted to HTML on compilation 2016-12-08 00:20:52 -08:00
Geoffrey Booth
e139d59896 Merge branch 'master' of github.com:jashkenas/coffeescript into improve-docs 2016-12-08 00:20:41 -08:00
Geoffrey Booth
b481bd1f73 Merge branch 'master' into 2 2016-12-07 20:35:30 -08:00
Geoffrey Booth
04961afa36 Fix link to logo; closes #4382 2016-12-07 19:30:55 -08:00
Geoffrey Booth
6fc9e338a5 Bump date 2016-12-07 14:27:51 -08:00
Geoffrey Booth
df5dd7e383 Merge branch 'master' of github.com:jashkenas/coffeescript into 1.12.1 2016-12-07 14:25:27 -08:00
Geoffrey Booth
8fbe095e94 Improve docs (#4396)
* Replace tiny bitmaps with base64-encoded URIs

* Optimize SVGs; replace logo PNG with SVG

* Modernize favicon

* Embed CSS; a bit unorthodox, but we’re a single page so there’s no point in separate .css files and their separate HTTP requests
2016-12-07 14:23:05 -08:00
Geoffrey Booth
2392a91033 Embed CSS; a bit unorthodox, but we’re a single page so there’s no point in separate .css files and their separate HTTP requests 2016-12-06 22:27:08 -08:00
Geoffrey Booth
0145bf397a Modernize favicon 2016-12-06 22:21:58 -08:00
Geoffrey Booth
d524dc8ad0 Optimize SVGs; replace logo PNG with SVG 2016-12-06 22:13:47 -08:00
Geoffrey Booth
d2fb1b5ce8 Replace tiny bitmaps with base64-encoded URIs 2016-12-06 21:54:30 -08:00
Geoffrey Booth
a80d74a672 1.12.1, includes #4393 and #4388. 2016-12-06 21:15:04 -08:00
Geoffrey Booth
286eec74f9 Merge branch 'master' into 2
# Conflicts:
#	lib/coffee-script/lexer.js
#	lib/coffee-script/parser.js
2016-12-06 20:59:21 -08:00
Geoffrey Booth
88f2bf9fa5 Detect when from in a for loop declaration is an identifier (#4393)
* Try to detect when `from` in a `for` loop declaration is an identifier, not a keyword

* Handle destructured arrays

* from as a destructured, aliased object variable name in a for loop declaration
2016-12-06 12:29:02 -08:00
Simon Lydell
3ea0481bbe Merge pull request #4388 from GeoffreyBooth/import-member-named-default
Allow imported module members to be named `default`
2016-12-05 07:15:03 +01:00
Geoffrey Booth
03eceeb615 Allow imported module members to be named default 2016-12-04 18:44:07 -08:00
Mitar
81b9fe34ff Runtime should support for...of (#4385)
[Docs] Runtime should support for…of
2016-12-04 17:29:46 -08:00
Geoffrey Booth
fb3e1a8e65 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	docs/v1/browser-compiler/coffee-script.js
#	lib/coffee-script/browser.js
#	lib/coffee-script/cake.js
#	lib/coffee-script/coffee-script.js
#	lib/coffee-script/command.js
#	lib/coffee-script/grammar.js
#	lib/coffee-script/helpers.js
#	lib/coffee-script/index.js
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/register.js
#	lib/coffee-script/repl.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	package.json
#	src/coffee-script.coffee
#	src/nodes.coffee
2016-12-04 12:52:23 -08:00
Simon Lydell
fb0639fa38 Merge pull request #4381 from GeoffreyBooth/1.12
[WIP] 1.12.0
2016-12-04 20:32:45 +01:00
Geoffrey Booth
b7dbee2402 Update broken links 2016-12-03 23:49:44 -08:00
Geoffrey Booth
2ca0f44cc8 Update 1.12.0 release date 2016-12-03 23:14:08 -08:00
Geoffrey Booth
c5121c8c4e Rebuild 2016-12-03 22:06:07 -08:00
Geoffrey Booth
2f72d0394f Improve comments formatting for better output in annotated source 2016-12-03 21:53:43 -08:00
Geoffrey Booth
026d9d6ccd Merge branch 'master' of github.com:jashkenas/coffeescript into 1.12 2016-12-03 20:24:28 -08:00
Simon Lydell
c9de5be966 Merge pull request #4383 from GeoffreyBooth/escape-template-literals
Escape backticks and `${` within template literals; fixes #4380
2016-12-03 20:41:25 +01:00
Geoffrey Booth
d45d780869 Improve tests and comments 2016-12-03 10:16:41 -08:00
Geoffrey Booth
d8abfae457 Handle tagged template literals (and future CS2 interpolated strings) with “invalidly escaped” backticks or ${—one backslash instead of two 2016-12-02 16:54:31 -08:00
Geoffrey Booth
98bf335777 Regenerate docs 2016-12-01 21:42:17 -08:00
Geoffrey Booth
1a69493f87 Remove change log updates related to documentation and the compiler build system 2016-12-01 21:40:18 -08:00
Geoffrey Booth
abe746bf53 Wrap HTML in comments in backticks, so as not to fool docco when generating the annotated source 2016-12-01 21:36:15 -08:00
Geoffrey Booth
075e48df95 Add Trix to list of examples; closes #4227 2016-12-01 21:28:42 -08:00
Geoffrey Booth
47c0a5cbef Escape backticks and ${ within template literals; fixes #4380 2016-12-01 13:10:03 -08:00
Geoffrey Booth
c48f5ce30f Add link to browser tests 2016-11-30 22:51:25 -08:00
Geoffrey Booth
4efd27ed28 Update annotated source for 1.12.0 2016-11-30 22:38:14 -08:00
Geoffrey Booth
e6b1218ae1 Updated output docs for 1.12.0, including new browser compiler 2016-11-30 22:33:20 -08:00
Geoffrey Booth
68938cda30 Updated lib for 1.12.0 2016-11-30 22:27:32 -08:00
Geoffrey Booth
7d6a3b5fa4 Docs examples with quotation marks were broken. Properly escape the quotes. http://stackoverflow.com/a/1082558/223225 2016-11-30 22:23:51 -08:00
Geoffrey Booth
f187440bb8 Update size of browser compiler 2016-11-30 22:06:22 -08:00
Geoffrey Booth
d0d2ef9f77 Convert eligible HTML entities to unicode characters (a recommended practice: http://stackoverflow.com/a/436637/223225) and convert straight quotes to curly quotes 2016-11-30 21:55:24 -08:00
Geoffrey Booth
a15bf3d336 1.11.1 to 1.12.0 change log 2016-11-30 20:48:58 -08:00
Geoffrey Booth
6d507b46d3 Bump version to 1.12.0; pass through as a variable to index.html 2016-11-30 20:48:06 -08:00
Geoffrey Booth
ba3411a1ac Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2016-11-30 19:51:55 -08:00
Jeremy Ashkenas
5588658641 Merge pull request #4378 from GeoffreyBooth/fix-browser-tests
Fix browser tests
2016-11-30 10:22:42 -05:00
Geoffrey Booth
d99ae0e7ef Refactor the way test.html runs tests to be similar to how Cakefile runs 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 2016-11-30 00:34:07 -08:00
Geoffrey Booth
cf3a27259a Exclude error messages from browser-based tests; watch test files 2016-11-30 00:31:18 -08:00
Geoffrey Booth
1ea753d19f Polyfill missing helper functions from Node’s assert, one with CDN-hosted Underscore; handle .litcoffee correctly 2016-11-30 00:02:45 -08:00
Geoffrey Booth
831d3c9341 test.html: better test failure output; add inexplicably missing testingBrowser 2016-11-29 21:37:54 -08:00
Geoffrey Booth
729fec2947 Abstract the eq and arrayEq functions, shared by Cakefile and test.html, into one file that can be included into both 2016-11-29 21:19:11 -08:00
Geoffrey Booth
faab9330e9 Run literate 2016-11-29 18:33:18 -08:00
Geoffrey Booth
8c8ebf874a Add test description to error message 2016-11-29 18:27:34 -08:00
Geoffrey Booth
06b3180223 Refactor test.html to be part of the docs output, with the tests embedded inside it; update test.html styles; move UTF-8 comment test out of test.html and into test/comments.coffee where it belongs 2016-11-29 18:13:12 -08:00
Geoffrey Booth
6d29086519 Standardize on .html file extension; move test.html into its new home 2016-11-29 08:45:46 -08:00
Geoffrey Booth
a401f587c3 Organize Cakefile: move helper functions that are only used by doc:site into the doc:site task 2016-11-29 08:39:00 -08:00
Geoffrey Booth
6685771255 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	package.json
2016-11-29 08:26:49 -08:00
Geoffrey Booth
ac26360fdc Replace Uglify.js with Google Closure Compiler, JS version; let NPM finally reformat package.json the way it likes (#4376) 2016-11-28 23:10:17 -08:00
Geoffrey Booth
e38866b2bf Merge branch '2' of github.com:jashkenas/coffeescript into 2 2016-11-28 20:18:54 -08:00
Geoffrey Booth
6f6df0e48d Merge branch 'master' into 2 2016-11-28 20:18:43 -08:00
Gregory Huczynski
33e6242f6f [CS2] Output interpolated strings as template literals (#4365)
* Output interpolated strings as template literals.

* Update comments to use Markdown, so the annotated source reads well; remove TODOs per @lydell’s explanations
2016-11-28 06:05:51 -08:00
Geoffrey Booth
ac20f6634a 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) 2016-11-27 23:05:49 -08:00
Geoffrey Booth
5c765f4cc7 Add for…from to list of ES2015 exceptions in the introduction (#4373) 2016-11-27 23:05:05 -08:00
Geoffrey Booth
aff191fc53 Merge branch 'master' into 2 2016-11-27 20:49:22 -08:00
Geoffrey Booth
02c5641b32 Fix path to browser compiler (#4374) 2016-11-27 20:47:54 -08:00
Geoffrey Booth
dd0a4f33ee Async example should follow its introduction 2016-11-27 19:38:41 -08:00
Geoffrey Booth
4d4839011b Merge branch '2' into async-docs 2016-11-27 19:06:24 -08:00
Geoffrey
0ef9eef87d Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2016-11-27 10:50:31 -08:00
Gregory Huczynski
555e47dbb9 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
2016-11-26 19:28:43 -08:00
Geoffrey Booth
14a63149f4 Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts:
#	bower.json
2016-11-22 22:13:13 -08:00
Geoffrey Booth
992eb49e92 Docs for triple-backticks and escaping backticks (#4369)
* Documentation for triple backticks and escaping backticks

* Better explanation of escaped backticks within triple-backticks block
2016-11-22 22:09:35 -08:00
Geoffrey Booth
8ea67ff3e9 Update Bower.json per latest spec (#4371)
* Remove moot `version` property from bower.json

Per bower/bower.json-spec@a325da3

* No need for bower to know about dev dependencies, and this is one less thing to keep in sync
2016-11-22 22:00:51 -08:00
Geoffrey Booth
ceca091816 Relocate example per new folder structure; update per final notes 2016-11-22 21:53:03 -08:00
Geoffrey Booth
56482a3166 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 😢
2016-11-22 09:30:39 -08:00
Daniel Bayley
6c759d49bd 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 <daniel.bayley@me.com>

* Update for new documentation folder structure

* Fix typo
2016-11-20 23:04:49 -08:00
Geoffrey Booth
bc471da960 Merge branch '2' into async-docs 2016-11-20 17:20:42 -08:00
Geoffrey Booth
6f595f8fd3 Merge branch 'master' into 2 2016-11-20 17:19:59 -08:00
Geoffrey Booth
cc3be717a0 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
2016-11-20 17:05:19 -08:00
Geoffrey Booth
42a10ba39e Merge branch '2' into async-docs
# Conflicts:
#	Cakefile
2016-11-19 18:52:00 -08:00
Geoffrey Booth
a21ce38fdf Merge branch 'ma'ter' into 2
# Conflicts:
#	lib/coffee-script/lexer.js
2016-11-19 11:19:50 -08:00
Geoffrey Booth
073e14746e 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
2016-11-19 11:13:30 -08:00
Geoffrey Booth
f8fa52a5d7 Merge branch 'master' of github.com:GeoffreyBooth/coffeescript into 2
# Conflicts:
#	lib/coffee-script/nodes.js
#	lib/coffee-script/parser.js
2016-11-18 10:34:13 -08:00
Gregory Huczynski
78e1f43b24 CS1 tagged template literals (and CS2 interpolated strings as template 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
2016-11-18 10:25:03 -08:00
Geoffrey Booth
57ffe14fab Merge branch 'master' into 2
# Conflicts:
#	Cakefile
#	package.json
2016-11-17 22:00:36 -08:00
Geoffrey Booth
a49c5c5150 Revert to http://coffeescript.org until GitHub pages supports HTTPS for custom domains (#4363) 2016-11-17 09:57:03 -08:00
Jeremy Ashkenas
24033eb11a move CNAME 2016-11-17 12:02:30 -05:00
Jeremy Ashkenas
f32740c032 Merge pull request #4360 from GeoffreyBooth/branch-docs
Reorganize docs for v1/v2 split
2016-11-17 11:59:37 -05:00
Geoffrey Booth
bebc5812e5 Revert unintended changes to generated index.html 2016-11-15 22:08:27 -08:00
Geoffrey Booth
4ab6fbca72 Fix missing hunk 2016-11-15 21:55:19 -08:00
Geoffrey Booth
7bc5b73db1 Fix links to annotated source 2016-11-15 21:37:41 -08:00
Geoffrey Booth
a95d986055 coffeescript.org goes HTTPS! 2016-11-15 21:31:53 -08:00
Geoffrey Booth
846c0e4c51 Even 1.x doesn’t need to limit generators tests to --harmony mode anymore; minor cleanup 2016-11-15 21:28:35 -08:00
Geoffrey Booth
3736b0fed1 Update cake build:browser to reflect new path to coffee-script.js 2016-11-15 21:19:43 -08:00
Geoffrey Booth
eb46975d87 Update cake doc:source to output to new docs/v{1|2}/annotated-source; collapse doc:underscore into it and generate missing underscore.html (closes #4295) 2016-11-15 21:16:13 -08:00
Geoffrey Booth
3739954de6 Move v1 documentation under docs/v1, with docs/index.html symlinking to docs/v1/index.html (with .nojekyll file to hopefully make the symlink work) 2016-11-15 20:54:30 -08:00
Geoffrey Booth
3b0b002f29 Use Google-hosted jQuery 2016-11-15 20:37:11 -08:00
Geoffrey Booth
6f09d36ec8 Update dev dependencies; update template rendering to use new Underscore syntax 2016-11-14 21:39:25 -08:00
Geoffrey Booth
9524159e68 Merge branch 'master' into 2
# Conflicts:
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	src/nodes.coffee
#	test/classes.coffee
#	test/comments.coffee
#	test/error_messages.coffee
2016-11-10 22:51:39 -08:00
Geoffrey Booth
b3896d08e8 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: https://github.com/jashkenas/coffeescript/pull/4306#issuecomment-257066877

* 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
2016-11-07 23:40:01 -08:00
Gabe
dc25f462a9 keeping it simple 2016-11-06 11:26:34 -08:00
Chris Connelly
663595ba94 Compile splats in arrays and function calls to ES2015 splats (#4353)
Rather than compiling splats to arrays built using `Array#concat`, splats
are now compiled directly to ES2015 splats, e.g.

    f foo, arguments..., bar

    [ foo, arguments..., bar ]

Which used to be compiled to:

    f.apply(null, [foo].concat(slice.call(arguments), [bar]));

    [foo].concat(slice.call(arguments), [bar]);

Is now compiled to:

    f(foo, ...arguments, bar);

    [ foo, ...arguments, bar ];
2016-11-06 08:30:04 -08:00
Gabe
8b1c109b9c eliminate utterance queuing 2016-11-06 02:40:24 -08:00
Gabe
ea3f044816 refine sound example 2016-11-06 02:30:01 -08:00
Gabe
993f459880 switch to interactive sound example 2016-11-05 13:57:22 -07:00
Gabe
43e580321a change async code snippet 2016-11-05 02:54:48 -07:00
Gabe
327395d793 change async code snippet 2016-11-05 02:54:18 -07:00
Gabe
acb3c8d79c changed wording 2016-11-04 16:23:18 -07:00
Gabe
ad4a6c4877 doc fixes and updates 2016-11-04 14:20:27 -07:00
geebo
496fd5d3d3 Add Implicit Async Functions (#3757)
* changed jison acceptable versions

* added await support

* wrong function bug fix

* added tests for async/await

* invalid to have await, yield(from) in same function

* changed error handling and tests

* bug fix

* made error handling test more rigorous

* consolidated harmony test files

* added async constructor support and tests

* removed .orig files

* Fixed browser testing issue

* Minor cleanup

* Async test-suite and Cake support, simplified/removed funky tests

* Skip async/await tests when not supported in runtime

* cleanup

* Replaced polyfill with native JS async/await

* Oops

* Make 'async' reserved word

* Remove all async polyfills

* fix merge conflict

* make async testing opt-in

* restore test, remove confusing polyfill language

* Revert changes to test runners

* Only run async tests where async/await is supported (Node 7+ with --harmony, for now)

* remove 'async' from JS reserved words

* The async tests should use their own special async-capable version of `global.test`, which is only loaded for the async tests and only loaded by async-capable environments

* Reverting rename of `async`, it’s not a reserved word so there’s no longer a need for this change

* async test refactoring and additions

* oops

* sync

* better error reporting for `await`

* more stuff geoffrey wants

* fixed litcoffee tests

* change test title
2016-11-02 08:51:26 -07:00
Simon Lydell
aca72f9b91 Merge pull request #4350 from alangpierce/upstream-fix-generated-close-curly-location
Include generated } tokens when fixing closing token positions
2016-10-31 07:54:24 +01:00
Alan Pierce
c5afb4e2fd Include generated } tokens when fixing closing token positions
This is an upstream port of https://github.com/decaffeinate/coffeescript/pull/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.
2016-10-30 21:39:54 -07:00
Geoffrey Booth
a1bcf7f1d9 Merge branch 'master' into 2 2016-10-26 09:06:58 -07:00
Geoffrey Booth
0d132318ce Resolve conflicts with 2 branch 2016-10-26 09:05:35 -07:00
Geoffrey Booth
9e0a4f844a Merge branch 'master' into 2
# Conflicts:
#	test/error_messages.coffee
2016-10-26 08:59:43 -07:00
geebo
26ad6d4670 Selectively ignore CS-only keywords in ES imports and exports (#4347) 2016-10-26 14:37:19 +02:00
Geoffrey Booth
fb2be8e1e3 [CS2] Output ES2015 arrow functions, default parameters, rest parameters (#4311)
* Eliminate wrapper around “bound” (arrow) functions; output `=>` for such functions

* Remove irrelevant (and breaking) tests

* Minor cleanup

* When a function parameter is a splat (i.e., it uses the ES2015 rest parameter syntax) output that parameter as ES2015

* Rearrange function parameters when one of the parameters is a splat and isn’t the last parameter (very WIP)

* Handle params like `@param`, adding assignment expressions for them when they appear; ensure splat parameter is last

* Add parameter names (not a text like `'\nValue IdentifierLiteral: a'`) to the scope, so that parameters can’t be deleted; move body-related lines together; more explanation of what’s going on

* For parameters with a default value, correctly add the parameter name to the function scope

* Handle expansions in function parameters: when an expansion is found, set the parameters to only be the original parameters left of the expansion, then an `...args` parameter; and in the function body define variables for the parameters to the right of the expansion, including setting default values

* Handle splat parameters the same way we handle expansions: if a splat parameter is found, it becomes the last parameter in the function definition, and all following parameters get declared in the function body. Fix the splat/rest parameter values after the post-splat parameters have been extracted from it. Clean up `Code.compileNode` so that we loop through the parameters only once, and we create all expressions using calls like `new IdentifierLiteral` rather than `@makeCode`.

* Fix parameter name when a parameter is a splat attached to `this` (e.g. `@param...`)

* Rather than assigning post-splat parameters based on index, use slice; passes test “Functions with splats being called with too few arguments”

* Dial back our w00t indentation

* Better parsing of parameter names (WIP)

* Refactor processing of splat/expansion parameters

* Fix assignment of default parameters for parameters that come after a splat

* Better check for whether a param is attached to `this`

* More understandable variable names

* For parameters after a splat or expansion, assign them similar to the 1.x destructuring method of using `arguments`, except only concern ourselves with the post-splat parameters instead of all parameters; and use the splat/expansion parameter name, since `arguments` in ES fat arrow functions refers to the parent function’s `arguments` rather than the fat arrow function’s arguments/parameters

* Don’t add unnamed parameters (like `[]` as a parameter) to the function scope

* Disallow multiple splat/expansion parameters in function definitions; disallow lone expansion parameters

* Fix `this` params not getting assigned if the parameter is after a splat parameter

* Allow names of function parameters attached to `this` to be reserved words

* Always add a statement to the function body defining a variable with its default value, if it has one, if the variable `== null`; this covers the case when ES doesn’t apply the default value when `null` is passed in as a value, but CoffeeScript expects `null` and `undefined` to act interchangeably

* Aftermath of having both `undefined` and `null` trigger the use of default values for parameters with default values

* More careful parsing of destructured parameters

* Fall back to processing destructured parameters in the function body, to account for `this` or default values within destructured objects

* Clean up comments

* Restore new bare function test, minus the arrow function part of it

* Test that bound/arrow functions aren’t overwriting the `arguments` object, which should refer to the parent scope’s `arguments` (like `this`)

* Follow ES2015 spec for parameter default values: `null` gets assigned as as `null`, not the default value

* Mimic ES default parameters behavior for parameters after a splat or expansion parameter

* Bound functions cannot be generators: remove no-longer-relevant test, add check to throw error if `yield` appears inside a bound (arrow) function

* Error for bound generator functions should underline the `yield`
2016-10-25 22:26:13 -07:00
Geoffrey Booth
c04c3850ec Merge branch 'master' into 2 2016-10-23 17:08:48 -07:00
Geoffrey Booth
887052de07 Merge branch 'master' of github.com:jashkenas/coffeescript 2016-10-23 17:06:13 -07:00
Chris Connelly
f14e8b279c [CS2] Compile computed properties to ES2015 equivalent (#4338)
* Add missing compiled files

* Compile computed properties to ES2015 equivalent

This is a fairly small change that simplifies the code generation for computed
properties as they're now generated in the object initializer like regular
properties.
2016-10-23 17:00:51 -07:00
Geoffrey Booth
70a7265f35 Fix tabbed Literate CoffeeScript (#4345)
* failing test case

* add markdown parser for literate coffeescript

this should help to handle ligitimate markdown with indentation correctly

* Update generated code

* Update package.json

* Add `marked` dependency to browser version of CoffeeScript

* Update invertLiterate to use a randomly-generated token that we check for uniqueness, rather than a magic number that we hope might not occur in the code

* Fix typos
2016-10-23 08:37:51 -07:00
Alan Pierce
6087c2c8fc Properly set location for string tokens ending in a newline (#4344)
This is an upstream port of https://github.com/decaffeinate/coffeescript/pull/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.
2016-10-23 09:41:46 +02:00
Geoffrey Booth
0521c3582c Fix typo 2016-10-22 23:11:04 -07:00
Geoffrey Booth
b35bb20a18 Upgrade dependencies 2016-10-22 11:54:05 -07:00
Geoffrey Booth
def685a4e1 Commit generated files that should've been committed as part of #4313 merge 2016-10-22 11:51:41 -07:00
Geoffrey Booth
8647e50941 Bump version in other files (but not documentation) 2016-10-22 11:50:44 -07:00
Geoffrey Booth
8b50fd0461 [CS2] Require Node 6.9.1+ (#4341)
* Node 6 deprecated `new Buffer` in favor of `Buffer.from` and `Buffer.alloc`; update our calls, and set the required version of Node to be >= 6.9.0, and set this to be 2.0.0-alpha for now

* Bump to Node version 6.9.1
2016-10-21 09:56:25 -07:00
Geoffrey Booth
01890cd415 Merge branch 'master' into 2 2016-10-18 23:10:00 -07:00
Simon Lydell
3c42b400a1 Merge pull request #4340 from GeoffreyBooth/node-deprecations
Call synchronous `fs` methods using the `Sync` variants
2016-10-19 08:05:20 +02:00
Geoffrey Booth
be44ebd2cd Node 7-nightly throws deprecation warnings when calling fs non-Sync functions without callbacks; but we always want the synchronous versions, so we should just call those in the first place 2016-10-18 21:49:15 -07:00
Geoffrey Booth
a1809277a0 Merge branch 'master' into 2 2016-10-17 21:22:28 -07:00
Simon Lydell
4d3d7352f1 Merge pull request #4339 from GeoffreyBooth/fix-export-anonymous-class
Disallow exporting anonymous classes
2016-10-16 10:23:37 +02:00
Geoffrey Booth
48e00d81a9 The CoffeeScript compiler should error on trying to export anonymous classes (previously we were outputting invalid JavaScript that the runtime was erroring on) 2016-10-15 21:32:06 -07:00
Simon Lydell
0853b412c6 Merge pull request #4296 from alangpierce/move-outdents-to-previous-token
Change OUTDENT tokens to be positioned at the end of the previous token
2016-10-10 19:08:35 +02:00
Simon Lydell
a75fe280f2 Merge pull request #4335 from alangpierce/fix-operator-precedence
Define proper operator precedence for bitwise/logical operators
2016-10-10 16:09:09 +02:00
Alan Pierce
e14946b3e6 Define proper operator precedence for bitwise/logical operators
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.
2016-10-09 14:45:25 -07:00
Alan Pierce
88693e420d Fix location data for implicit CALL_END tokens
Fixes https://github.com/decaffeinate/decaffeinate/issues/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.
2016-10-06 19:46:41 -07:00
Alan Pierce
ce971b766f 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 https://github.com/decaffeinate/decaffeinate/issues/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.
2016-10-06 19:39:31 -07:00
Simon Lydell
11561dddcf Merge pull request #4329 from shreeve/strip-cr-if-present
strip \r (if present) before final \n
2016-10-04 07:39:52 +02:00
Steve Shreeve
7c7bc8ee2f strip \r (if present) before final \n 2016-10-02 15:17:54 -04:00
Simon Lydell
7b9fbf2c76 Merge pull request #4327 from lydell/1.11.1
1.11.1
2016-10-02 18:21:28 +02:00
Simon Lydell
8623792bcd CoffeeScript 1.11.1 2016-10-01 20:58:53 +02:00
Simon Lydell
809634ba39 Add changelog for version 1.11.1 2016-10-01 20:55:23 +02:00
Geoffrey Booth
8138c663a8 Merge branch 'master' into 2 2016-10-01 11:21:07 -07:00
Simon Lydell
46841d916d Fix shorthands after interpolated key in objects
Fixes #4324.
2016-09-29 19:02:00 +02:00
Jeremy Ashkenas
c5c4d7c8f8 Merge pull request #4313 from eelco/no-whitespace-mixing-strict
Don’t allow mixing spaces and tabs for indentation
2016-09-27 10:24:20 -04:00
Jeremy Ashkenas
f8b0c8049c Merge pull request #4318 from GeoffreyBooth/octal-and-binaries-as-is
Pass through octal and binary literals as-is
2016-09-27 10:22:23 -04:00
Geoffrey Booth
1d230fe055 Minor cleanup 2016-09-26 20:52:23 -07:00
Simon Lydell
0b2d852f67 Merge pull request #4322 from fliptheweb/patch-1
Fix minor typo in changelog for 1.11.0
2016-09-26 20:04:33 +02:00
Artur Kornakov
964a588e29 Fix minor typo in changelog for 1.11.0 2016-09-26 20:37:37 +03:00
Alexander Pánek
329b2d1cb2 Pass through octal and binary literals as-is
See https://github.com/coffeescript6/discuss/issues/45
2016-09-26 18:04:12 +02:00
Simon Lydell
568a0c7b4e Fix indentation-stripping in """ strings
`"""` (and `"`) strings are lexed into an array of tokens, consisting of
strings and interpolations. Previously, the minimum indententation
inside `"""` strings was stripped from the beginning of _all_ of those
string tokens. Usually, the indentation is longer than any other
sequence of spaces in a `"""` string, so the problem didn't occur in
most cases. This commit makes sure to only strip indentation after
newlines.

Fixes #4314.
2016-09-26 17:14:31 +02:00
Simon Lydell
57f5297714 Handle very large hexadecimal number literals correctly
Very large decimal number literals, binary number literals and octal
literals are lexed into an INFINITY token (instead of a NUMBER token)
and compiled into `2e308`. That is is supposed to be the case for very
large hexdecimal dumber literals as well, but previously wasn't.

Before:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    NUMBER

After:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    INFINITY

This commit also cleans up `numberToken` in lexer.coffee a bit.
2016-09-26 16:33:57 +02:00
Simon Lydell
32041806ae Fix isLiteralArguments
`isLiteralArguments` mistakenly looked at `Literal`s instead of
`IdentifierLiteral`s.

This also gets rid of the ugly `.asKey` hack in nodes.coffee.

Fixes #4320.
2016-09-26 15:33:44 +02:00
Simon Lydell
b0d8fca245 Update the changelog for 1.11.0
Fixes #4321.
2016-09-26 15:09:53 +02:00
Simon Lydell
c3f5b8db86 Replace .npmignore with "files": [...] in package.json 2016-09-24 14:26:46 +02:00
Simon Lydell
2923e88207 Merge pull request #4315 from lydell/1.11.0 2016-09-24 14:18:33 +02:00
Simon Lydell
66b5203689 CoffeeScript 1.11.0 2016-09-24 14:16:00 +02:00
Simon Lydell
e908fd4a91 Styling fixes for the documentation 2016-09-24 14:15:54 +02:00
Simon Lydell
ab97e2224e Add changelog for version 1.11.0 2016-09-24 14:15:54 +02:00
Simon Lydell
f6bc4b4c32 Update CLI flags documentation 2016-09-24 14:01:41 +02:00
Eelco Lempsink
bb40b1188c Don’t allow mixing different types of whitespace for indentation, per line. 2016-09-20 23:33:19 +02:00
Eelco Lempsink
98068611b1 Make sure the indentation is consistent with the previous level.
This prevents mixing spaces and tabs in the same ‘block’ of code.

Mixing is still allowed if each line uses the same mix and if the indentation level returns to 0.

This breaks the literate coffeescript test that mixes spaces and tabs.
2016-09-20 23:06:44 +02:00
Geoffrey Booth
a8b77fb4e7 Add modules documentation (#4309) 2016-09-18 20:54:44 +02:00
Simon Lydell
7667cb2370 Merge pull request #4308 from GeoffreyBooth/import-export
Be much more careful about parsing `*` in import and export statements
2016-09-15 17:20:07 +02:00
Geoffrey Booth
51f24e0641 Be much more careful about parsing * in import and export statements; handle export expressions that use * on the same line as export 2016-09-14 23:30:58 -07:00
Simon Lydell
9ae377b481 Fix source maps for errors thrown from .coffee.md files
Before:

```
$ cat tmp.coffee.md
test

    a
$ ./bin/coffee tmp.coffee.md
ReferenceError: a is not defined
  at Object.<anonymous> (/src/coffee-script/tmp.coffee.md:2:3)
  ...
```

Note how the line and column numbers (2 and 3, respectively) are not
correct.

After:

```
$ ./bin/coffee tmp.coffee.md
ReferenceError: a is not defined
  at Object.<anonymous> (/home/lydell/forks/coffee-script/tmp.coffee.md:3:5)
  ...
```

Line 3, column 5 is the actual position of the `a` in tmp.coffee.md.

Supersedes and fixes #4204.
2016-09-14 21:45:06 +02:00
Simon Lydell
0e0e8f87e1 Fix CLI crash when null is thrown
Before:

```
$ ./bin/coffee -e 'throw null'
/src/coffee-script/lib/coffee-script/command.js:251
      message = err.stack || ("" + err);
                   ^

TypeError: Cannot read property 'stack' of null
  at compileScript ...
```

After:

```
$ ./bin/coffee -e 'throw null'
null
```

Supersedes and closes #4135.
2016-09-14 21:33:36 +02:00
Simon Lydell
ec9c4d8594 Merge pull request #4291 from alangpierce/fix-outdent-location-data
Fix incorrect location data in OUTDENT nodes
2016-09-14 21:21:25 +02:00
Geoffrey Booth
66ac8af678 Support import and export of ES2015 modules (#4300)
This pull request adds support for ES2015 modules, by recognizing `import` and `export` statements. The following syntaxes are supported, based on the MDN [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) and [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) pages:

```js
import "module-name"
import defaultMember from "module-name"
import * as name from "module-name"
import { } from "module-name"
import { member } from "module-name"
import { member as alias } from "module-name"
import { member1, member2 as alias2, … } from "module-name"
import defaultMember, * as name from "module-name"
import defaultMember, { … } from "module-name"

export default expression
export class name
export { }
export { name }
export { name as exportedName }
export { name as default }
export { name1, name2 as exportedName2, name3 as default, … }

export * from "module-name"
export { … } from "module-name"
```

As a subsitute for ECMAScript’s `export var name = …` and `export function name {}`, CoffeeScript also supports:
```js
export name = …
```

CoffeeScript also supports optional commas within `{ … }`.

This PR converts the supported `import` and `export` statements into ES2015 `import` and `export` statements; it **does not resolve the modules**. So any CoffeeScript with `import` or `export` statements will be output as ES2015, and will need to be transpiled by another tool such as Babel before it can be used in a browser. We will need to add a warning to the documentation explaining this.

This should be fully backwards-compatible, as `import` and `export` were previously reserved keywords. No flags are used.

There are extensive tests included, though because no current JavaScript runtime supports `import` or `export`, the tests compare strings of what the compiled CoffeeScript output is against what the expected ES2015 should be. I also conducted two more elaborate tests:

* I forked the [ember-piqu](https://github.com/pauc/piqu-ember) project, which was an Ember CLI app that used ember-cli-coffeescript and [ember-cli-coffees6](https://github.com/alexspeller/ember-cli-coffees6) (which adds “support” for `import`/`export` by wrapping such statements in backticks before passing the result to the CoffeeScript compiler). I removed `ember-cli-coffees6` and replaced the CoffeeScript compiler used in the build chain with this code, and the app built without errors. [Demo here.](https://github.com/GeoffreyBooth/coffeescript-modules-test-piqu)
* I also forked the [CoffeeScript version of Meteor’s Todos example app](https://github.com/meteor/todos/tree/coffeescript), and replaced all of its `require` statements with the `import` and `export` statements from the original ES2015 version of the app on its `master` branch. I then updated the `coffeescript` Meteor package in the app to use this new code, and again the app builds without errors. [Demo here.](https://github.com/GeoffreyBooth/coffeescript-modules-test-meteor-todos)

The discussion history for this work started [here](https://github.com/jashkenas/coffeescript/pull/4160) and continued [here](https://github.com/GeoffreyBooth/coffeescript/pull/2). @lydell provided guidance, and @JimPanic and @rattrayalex contributed essential code.
2016-09-14 20:46:05 +02:00
Alan Pierce
feb42e5128 Add a test that tokens have locations that are in order 2016-08-01 20:28:56 -07:00
Alan Pierce
bd0024a9c2 Fix incorrect location data in OUTDENT nodes
In f609036bee, a line was changed from
`if length > 0 then (length - 1) else 0` to `Math.max 0, length - 1`. However,
in some cases, the `length` variable can be `undefined`. The previous code would
correctly compute `lastCharacter` as 0, but the new code would compute it as
`NaN`. This would cause trouble later on: the end location would just be the end
of the current chunk, which would be incorrect.

Here's a specific case where the parser was behaving incorrectly:
```
a {
  b: ->
    return c d,
      if e
        f
}
g
```

The OUTDENT tokens after the `f` had an undefined length, so the `NaN` made it
so the end location was at the end of the file. That meant that various nodes in
the AST, like the `return` node, would incorrectly have an end location at the
end of the file.

To fix, I just reverted the change to that particular line.
2016-07-29 20:42:08 -07:00
Simon Lydell
133fadd36a Merge pull request #4289 from GeoffreyBooth/fix-typos
Fix misspellings
2016-07-25 09:42:19 +02:00
Geoffrey Booth
a5980247dc Fix misspellings 2016-07-24 20:37:37 -07:00
Simon Lydell
ec333a061b Merge pull request #4274 from lydell/for-variables
Improve naming of generated 'i-variables'
2016-06-19 12:00:33 +02:00
Simon Lydell
0247b135f8 Improve naming of generated 'i-variables'
In for example `for` loops, a variable called `i` is generated (for the
loop index). If that name is unavailable, `j` is used instead, then `k`,
`l`, etc. all the way to `z`. Then, `aa`, `ab`, `ac` etc. are used.

This meant that, eventually, `do` would be used, but that's not a valid
variable name since `do` is a JavaScript keyword.

This logic was also inefficiently implemented. For example, going from
`aa` to `ab` or from `az` to `ba` required lots of loop iterations.

This commit changes the variable naming convention. Now, `i`, `j`, `k`,
etc. to `z` are used like before. Then comes `i1`, `j1`, `k1`, etc. Then
`i2`, `j2`, `k2` and so on. This is simpler, efficient and easier to
understand. `i1` is more obvious to be a loop index than `aa`.

Fixes #4267.
2016-06-10 08:58:18 +02:00
Simon Lydell
d7e752bc5d Fix failing source map tests
This should have been done in commit 841b3cd2, but I forgot to. Since
that commit, `SourceMap::generate` returns an object instead of
`JSON.stringify()` of that object, but the tests still compared strings.

Fixes #4269.

Note: `SourceMap::generate` is only used internally, so its change in
return type is not a breaking change. The "public API" is unchanged.
2016-06-02 09:04:58 +02:00
Ben Buckman
7c2f348a63 Fix 'Error: EBADF: bad file descriptor, write' on .exit in REPL
Fixes issue #4252.
2016-04-14 09:24:21 -07:00
Michael Ficarra
88192c197a Merge pull request #4226 from eventualbuddha/patch-1
Fix typo.
2016-03-09 09:39:56 -08:00
Brian Donovan
d7385ece46 Fix typo. 2016-03-09 09:30:20 -08:00
Michael Ficarra
e318469cb0 Merge pull request #4219 from lydell/infinity-nan
Treat Infinity and NaN as reserved words
2016-03-07 09:04:51 -08:00
Michael Ficarra
6291b53492 Merge pull request #4223 from lydell/inline-maps
Improve inline source maps generation
2016-03-06 07:33:10 -08:00
Simon Lydell
841b3cd2ad Improve inline source maps generation
- Inline source maps are now shorter by not using pretty-printed JSON.
- `.register()`ed files are now given more information in their inline source
  maps: The name and contents of the source file.
- Some code cleanup.

If you decode the inline source map generated (when using `.register()`) for a
file test.coffee with the contents `console.log "it works!"`, here is the
output:

Before:

    {
      "version": 3,
      "file": "",
      "sourceRoot": "",
      "sources": [
        ""
      ],
      "names": [],
      "mappings": "AAAA;EAAA,OAAO,CAAC,GAAR,CAAY,eAAZ;AAAA"
    }

After:

    {"version":3,"file":"","sourceRoot":"","sources":["test.coffee"],"names":[],"mappings":"AAAA;EAAA,OAAO,CAAC,GAAR,CAAY,WAAZ;AAAA","sourcesContent":["console.log \"it works!\"\n"]}

Related: #4214.
2016-03-06 14:41:26 +01:00
Simon Lydell
9a0babf5b1 Treat Infinity and NaN as reserved words
Fixes #4218.
2016-03-06 11:41:48 +01:00
Simon Lydell
cbc72a29bf Merge pull request #4220 from lydell/propertyliteral
Split out properties from identifiers
2016-03-06 10:57:31 +01:00
Simon Lydell
e42fc47747 Split out properties from identifiers
- Split out a PROPERTY token from the IDENTIFIER token.
- Split out Property from the Identifier in the grammar.
- Split out PropertyLiteral from IdentifierLiteral.
2016-03-06 10:53:01 +01:00
Michael Ficarra
5b7ac32905 Merge pull request #4221 from lydell/assignment-errors
Unify, simplify and fixup assignment errors
2016-03-06 01:41:51 -08:00
Simon Lydell
4d8cd03298 Unify, simplify and fixup assignment errors
- Show the same type of error message for compound assignment as for `=`
  assignment when the LHS is invalid.
- Show the same type of error message when trying to assign to a CoffeeScript
  keyword as when trying to assign to a JavaScript keyword.
- Now longer treat `&& =` as `&&=`. The same goes for `and=`, `||=` and `or=`.
- Unify the error message to: `<optional type> '<value>' can't be assigned`.
2016-03-06 10:33:30 +01:00
Michael Ficarra
585932cf5b compile InfinityLiterals to 2e308 2016-03-05 08:35:26 -08:00
Michael Ficarra
8afb7cc95b Merge pull request #4198 from lydell/node-types
Refactor `Literal` into several subtypes
2016-03-05 08:20:19 -08:00
Simon Lydell
021d2e4376 Refactor Literal into several subtypes
Previously, the parser created `Literal` nodes for many things. This resulted in
information loss. Instead of being able to check the node type, we had to use
regexes to tell the different types of `Literal`s apart. That was a bit like
parsing literals twice: Once in the lexer, and once (or more) in the compiler.
It also caused problems, such as `` `this` `` and `this` being indistinguishable
(fixes #2009).

Instead returning `new Literal` in the grammar, subtypes of it are now returned
instead, such as `NumberLiteral`, `StringLiteral` and `IdentifierLiteral`. `new
Literal` by itself is only used to represent code chunks that fit no category.
(While mentioning `NumberLiteral`, there's also `InfinityLiteral` now, which is
a subtype of `NumberLiteral`.)

`StringWithInterpolations` has been added as a subtype of `Parens`, and
`RegexWithInterpolations` as a subtype of `Call`. This makes it easier for other
programs to make use of CoffeeScript's "AST" (nodes). For example, it is now
possible to distinguish between `"a #{b} c"` and `"a " + b + " c"`. Fixes #4192.

`SuperCall` has been added as a subtype of `Call`.

Note, though, that some information is still lost, especially in the lexer. For
example, there is no way to distinguish a heredoc from a regular string, or a
heregex without interpolations from a regular regex. Binary and octal number
literals are indistinguishable from hexadecimal literals.

After the new subtypes were added, they were taken advantage of, removing most
regexes in nodes.coffee. `SIMPLENUM` (which matches non-hex integers) had to be
kept, though, because such numbers need special handling in JavaScript (for
example in `1..toString()`).

An especially nice hack to get rid of was using `new String()` for the token
value for reserved identifiers (to be able to set a property on them which could
survive through the parser). Now it's a good old regular string.

In range literals, slices, splices and for loop steps when number literals
are involved, CoffeeScript can do some optimizations, such as precomputing the
value of, say, `5 - 3` (outputting `2` instead of `5 - 3` literally). As a side
bonus, this now also works with hexadecimal number literals, such as `0x02`.

Finally, this also improves the output of `coffee --nodes`:

    # Before:
    $ bin/coffee -ne 'while true
      "#{a}"
      break'
    Block
      While
        Value
          Bool
        Block
          Value
            Parens
              Block
                Op +
                  Value """"
                  Value
                    Parens
                      Block
                        Value "a" "break"

    # After:
    $ bin/coffee -ne 'while true
      "#{a}"
      break'
    Block
      While
        Value BooleanLiteral: true
        Block
          Value
            StringWithInterpolations
              Block
                Op +
                  Value StringLiteral: ""
                  Value
                    Parens
                      Block
                        Value IdentifierLiteral: a
          StatementLiteral: break
2016-03-05 17:08:11 +01:00
Michael Ficarra
87216ea5b6 Merge pull request #4212 from nvignola/issue4042
Change a bad link in documentation issue#4042
2016-03-01 06:57:54 -08:00
nvignola
f80a8a5120 Change a bad link in documentation 2016-02-29 23:00:27 +00:00
Michael Ficarra
9590ad7622 Merge pull request #4199 from pra85/patch-1
Fix minor typo
2016-02-02 21:51:03 -08:00
Prayag Verma
402133a50e Fix minor typo
Remove extra `the`
2016-02-03 10:52:15 +05:30
Simon Lydell
34b4311544 Fix broken CoffeeScript.register() and commit build
Commit 347a6255 is a bit problematic:

- It doesn't include the built .js files.
- It breaks `CoffeeScript.register()`. This can be seen by running the tests;
  four of them fails. The error is that `CoffeeScript.register()` calls
  `CoffeeScript._compileFile()` with the `sourceMap` option enabled, which
  returns an object while the code expected a string.

This commit fixes the broken `CoffeeScript.register()`, by setting the
`sourceMap` option to `false` (but still keeping the `inlineMap` option enabled,
which was the intention of commit 347a6255). It also commits the built .js
files. The tests now pass.
2016-01-31 19:48:40 +01:00
Michael Ficarra
65c35e05a1 Merge pull request #4193 from DylanPiercey/master
Allow for external and inline sourcemap generation separately
2016-01-30 20:13:47 -08:00
Dylan Piercey
f7277c9de5 Allow for external and inline sourcemap generation separately 2016-01-30 21:09:19 -07:00
Jeremy Ashkenas
08129d0f1f Merge pull request #4111 from DylanPiercey/master
Add inline sourcemap support
2016-01-30 23:00:06 -03:00
Dylan Piercey
347a625525 Add inline sourcemap support 2016-01-23 12:58:22 -07:00
Michael Ficarra
2df011f378 Merge pull request #4180 from zhanzhenzhen/master
Fix #4178: an issue of processing Unicode characters in stdin
2016-01-12 08:54:45 -08:00
Zhenzhen Zhan
97882b8e49 Build for #4178 2016-01-13 00:49:45 +08:00
Zhenzhen Zhan
67b0f95d4d Fix #4178: an issue of processing Unicode characters in stdin 2016-01-12 19:16:19 +08:00
Simon Lydell
ce84924101 Fix invalid JS in one of the docs examples
Fixes #4175.
2016-01-07 08:22:59 +01:00
Simon Lydell
ae72dbb379 Fix scoping error in coffee-script.coffee
Closes #4167.
2016-01-07 07:53:53 +01:00
Michael Ficarra
b8403bfa97 Merge pull request #4146 from mvj3/minor-document-typos
Fixed minor document typos
2015-11-17 16:04:59 -08:00
David Chen
f179b20e6e Fixed minor document typos 2015-11-18 08:00:58 +08:00
Michael Ficarra
0995ba361c Merge pull request #4140 from lydell/issue-4137
Fix #4137: Caught errors named `undefined`
2015-11-01 23:18:47 -08:00
Simon Lydell
89921c0667 Fix #4137: Caught errors named undefined
Previously, `catch`-less `try`s named the caught error `undefined`, instead of
`error` like usual.
2015-11-02 08:05:35 +01:00
Michael Ficarra
87a854afb4 Merge pull request #4131 from lydell/issue-4130
Fix #4130: Unassignable param destructuring crash
2015-10-22 10:14:39 -07:00
Simon Lydell
1dd5795960 Fix #4130: Unassignable param destructuring crash 2015-10-22 19:11:23 +02:00
Michael Ficarra
968f94f782 Merge pull request #4112 from lydell/renamed-destrucured-params-with-defaults
Fix compiler crash with renamed destrucured params with defaults
2015-10-03 15:33:14 -07:00
Simon Lydell
4b4675de30 Fix compiler crash with renamed destrucured params with defaults
`({a = 1}) ->` and `({a: b}) ->` worked, but not the combination of the two:
`({a: b = 1}) ->`. That destrucuring worked for normal assignments, though:
`{a: b = 1} = c`. This commit fixes the param case.
2015-09-27 15:54:44 +02:00
Jeremy Ashkenas
36e80d7f5c Merge pull request #4099 from lydell/yield-return
Only allow `yield return` as a statement
2015-09-17 12:41:17 -04:00
ven
2536bfd75c Merge pull request #4102 from casidiablo/patch-1
Fixed link to Groovy doc link
2015-09-17 17:43:31 +02:00
Cristian
4acafad07b Fixed link to Groovy doc link 2015-09-17 08:22:56 -07:00
Michael Ficarra
73b05a55b6 Merge pull request #4101 from mjhassanpur/fix-doc-typos
Fix documentation typos
2015-09-16 23:27:32 -07:00
mjhassanpur
de2db48474 Fix documentation typos 2015-09-16 21:24:53 -07:00
Simon Lydell
4ceb6a6818 Only allow yield return as a statement
Fixes #4097. Also happens to fix #4096. I also took the liberty to simplify the
error message for invalid use of `yield`.
2015-09-16 17:39:59 +02:00
Jeremy Ashkenas
d6ff91a454 Merge pull request #4095 from alubbe/standaloneyieldd
Add support for standalone yield
2015-09-14 10:55:39 -04:00
Jeremy Ashkenas
da23a2f702 Merge pull request #4093 from alubbe/betteryieldcompilation
Remove unnecessary brackets and empty spaces around yield
2015-09-14 10:54:35 -04:00
Jeremy Ashkenas
d1c6db476b Merge pull request #4094 from alubbe/removeuncaughterrorvars
Remove uncaught error vars
2015-09-14 10:54:07 -04:00
Andreas Lubbe
b1ef5a9996 Remove unnecessary brackets and empty spaces around yield
This removes unnecessary brackets and empty spaces around yield when not needed. We still need brackets for if(a === (yield)).
2015-09-13 13:11:10 +02:00
Andreas Lubbe
c1a9cfa044 Add support for standalone yield
This breaks compatibility with
->
  yield for i in [1..3]
    i * 2
and
->
  yield
    i * 2

yield's behaviour now mirrors that of return in that it can be used stand alone as well as with expressions. Thus, it currently also inherits the above limitations.
2015-09-13 12:30:59 +02:00
Andreas Lubbe
d3cff9082f Remove uncaught error vars 2015-09-13 12:27:07 +02:00
Jeremy Ashkenas
1739c9d720 Merge pull request #4089 from lydell/issue-4088
Fix #4088: Don't declare caught variables
2015-09-10 13:16:53 -04:00
Simon Lydell
75a4c01e17 Fix #4088: Don't declare caught variables 2015-09-10 18:59:01 +02:00
Michael Ficarra
8711da03a2 Merge pull request #4080 from lydell/single-newline-at-eof
Ensure that all source files end with a single `\n`
2015-09-03 20:57:39 -07:00
Jeremy Ashkenas
eb6baf2d9b Merge pull request #4083 from lydell/remove-unnecessary-files
Remove unnecessary .js files
2015-09-03 16:51:00 -04:00
Jeremy Ashkenas
d742a7dd1f Merge pull request #4082 from lydell/changelog-fix
Update date and fix formatting error in 1.10.0 changelog
2015-09-03 16:50:27 -04:00
Simon Lydell
ae65875c8b Remove unnecessary .js files
The example code in documentation/coffee/*.coffee accidentally had duplicate
compiled .js versions committed: Both as documentation/js/*.js and as
documentation/coffee/*.js.

The former is generated when running `cake doc:site`, while the latter has no
cake task to be generated. Removing the former and then re-compiling index.html
results in all the code examples being missing in the resulting HTML, while
removing the latter makes no difference.

In conclusion, documentation/coffee/*.js must be the unnecessary duplicates.
They are removed by this commit.
2015-09-03 22:15:45 +02:00
Simon Lydell
fcf5924dae Update date and fix formatting error in 1.10.0 changelog 2015-09-03 22:08:34 +02:00
Jeremy Ashkenas
f26d33d418 Merge pull request #4079 from lydell/v1.10.0
CoffeeScript 1.10.0
2015-09-03 15:45:13 -04:00
Simon Lydell
cea773ec81 CoffeeScript 1.10.0 2015-09-03 20:10:18 +02:00
Simon Lydell
6c6c8d48bf Ensure that all source files end with a single \n
This was done by first checking all files in the repository root by hand, and
then by doing the following:

    $ npm i get-stdin@4
    $ cat clean.coffee
    fs = require 'fs'
    stdin = require 'get-stdin'

    stdin (text) ->
      for file in text.trim().split('\n')
        contents = fs.readFileSync file
          .toString().replace /\s*$/, '\n'
        fs.writeFileSync file, contents
      return
    $ ls !(node_modules)/**/*.coffee | coffee clean.coffee
2015-09-03 19:20:12 +02:00
Jeremy Ashkenas
98dd1bf8e8 Merge pull request #4073 from lydell/issue-3926
Fix #3926: Disallow implicit objects as parameter destructuring
2015-09-01 15:03:29 -04:00
Jeremy Ashkenas
56d75baac7 Merge pull request #4075 from lydell/documentation-improvements
Documentation improvements
2015-09-01 13:16:55 -04:00
Simon Lydell
0872c3d13d Git rid of the deprecated <tt> tag in the docs
Replaced with `<code>` tags.
2015-08-30 12:41:47 +02:00
Simon Lydell
5095e02b62 Remove unnecessary blank lines at EOF in examples
On less wide screens, where the CoffeeScript is above the JavaScript, those
lines resulted in an unnecessarily high box of CoffeeScript code.
2015-08-30 12:41:47 +02:00
Simon Lydell
874628b1d0 Improve the documentation site on smaller screens
"Smaller screens" means screens smaller than 820px wide. That's the smallest
width that the current design looks good at.

I tried to not change the current design in any way and to make as few changes
as possible.

This is what happens on smaller screens:

- The navigation bar is no longer fixed to the viewport, but always at the top
  of the page.
- The navigation bar is vertical rather than horizontal.
- CoffeeScript code is above the compiled JavaScript rather than having them
  side by side.

This allows for a larger text size, which is more compfortable to read, and no
horizontal scrolling, which many find difficult to use.
2015-08-30 12:41:36 +02:00
Michael Ficarra
ff9d5117f9 Merge pull request #4074 from lydell/destructuring-defaults-docs
Document destructuring defaults
2015-08-29 10:33:44 -07:00
Simon Lydell
10aca2a38e Document destructuring defaults 2015-08-29 19:18:44 +02:00
Simon Lydell
2c4d437e98 Fix #3926: Disallow implicit objects as parameter destructuring 2015-08-28 23:11:47 +02:00
Jeremy Ashkenas
c0c13c1977 Merge pull request #4069 from lydell/destructuring-defaults
Implement ES2015-like destructuring defaults
2015-08-27 17:50:33 -04:00
Simon Lydell
6d9553a016 Implement ES2015-like destructuring defaults
This let's you do things like:

    fullName = ({first = 'John', last = 'Doe'}) -> "#{first} #{last}"

Note: CoffeeScrits treats `undefined` and `null` the same, and that's true in
the case of destructuring defaults as well, as opposed to ES2015 which only uses
the default value if the target is `undefined`. A similar ES2015 difference
already exists for function parameter defaults. It is important for CoffeeScript
to be consistent with itself.

    fullName2 = (first = 'John', last = 'Doe') -> "#{first} #{last}"
    assert fullName('Bob', null) is fullName2(first: 'Bob', last: null)

Fixes #1558, #3288 and #4005.
2015-08-27 22:16:13 +02:00
Jeremy Ashkenas
66716cd730 Merge pull request #4071 from lydell/lone-expansion
Fix #4070: Improve error message for lone expansion
2015-08-27 13:09:54 -04:00
Simon Lydell
f588ecb288 Fix #4070: Improve error message for lone expansion 2015-08-26 22:30:55 +02:00
Michael Ficarra
dc3e177811 Merge pull request #4068 from lydell/issue-1192
Fix #1192: Assignment starting with object literals
2015-08-22 07:24:23 -07:00
Simon Lydell
2eef667916 Fix #1192: Assignment starting with object literals 2015-08-22 16:21:35 +02:00
Jeremy Ashkenas
617a932e89 Merge pull request #4059 from BrunoBernardino/hotfix/4036-try-variable-improvement
Closes #4036: "Try catch" optimisation
2015-08-19 14:33:11 -04:00
Bruno Bernardino
beac56d4d5 Updated compile 2015-08-16 21:34:22 +01:00
Bruno Bernardino
cc98e99070 Removing unnecessary assignment 2015-08-16 21:33:58 +01:00
Bruno Bernardino
93e4eeafed Removing the unnecessary underscore now :) 2015-08-16 21:32:16 +01:00
Bruno Bernardino
efdc67241a Improved the tests and removed the hardcoded variable, according to suggestions. 2015-08-16 21:27:28 +01:00
Bruno Bernardino
24e8f1c98f Closes #4036: "Try catch" optimisation
Let me know if there's something I should be doing differently as this is my first contribution to coffeescript.
I fixed the reported issue where a generated variable could clash with a user-defined one in a try/catch block.
I added a test for a few scenarios with different variable names for a try/catch, to confirm the fix and avoid regressions.
2015-08-16 20:47:04 +01:00
Michael Ficarra
2d1a6fa6ec Merge pull request #4029 from yjerem/reset-seenfor
Reset @seenFor in lexer before tokenizing
2015-07-07 21:31:23 -07:00
Jeremy Ruten
3d7d68a766 Reset @seenFor in lexer before tokenizing 2015-07-07 22:23:26 -06:00
Michael Ficarra
342b395b0a Merge pull request #4019 from rvagg/master
Don't copy arguments or caller from require
2015-06-22 06:33:07 -07:00
Rod Vagg
75ae45e2bb don't copy arguments or caller from require
causes an error in io.js where strict-mode is set on internal modules

Fixes: https://github.com/jashkenas/coffeescript/issues/3810
2015-06-22 22:51:39 +10:00
Michael Ficarra
1f197fcc1b Merge pull request #3985 from ide/array-check
Replace "instanceof Array" in transformer with "[object Array]" comparison
2015-06-05 09:40:02 -07:00
Jeremy Ashkenas
e339f5f2da correct release date 2015-05-27 13:04:12 -04:00
Jeremy Ashkenas
c37f284771 redoc 2015-05-27 11:57:31 -04:00
Jeremy Ashkenas
585298dc17 Merge pull request #3980 from lydell/v1.9.3
CoffeeScript 1.9.3
2015-05-27 11:51:32 -04:00
James Ide
2087923163 Replace "instanceof Array" in transformer with "[object Array]" comparison
Testing with `'[object Array]' is Object::toString.call element` allows arrays from another JS context to be properly handled. The specific use case here is to support jest, which sets up JS contexts using Node/io.js's "vm" module. This approach works in ES3 environments in contrast with ES5's `Array.isArray`.
2015-05-20 21:06:36 -07:00
Simon Lydell
b58772e8a7 CoffeeScript 1.9.3 2015-05-14 11:24:39 +02:00
Michael Ficarra
769f02ec05 Merge pull request #3979 from lydell/herecomments-formatting
Fix formatting of `#`-only lines in herecomments
2015-05-13 09:02:34 -07:00
Simon Lydell
52b1749d57 Fix formatting of #-only lines in herecomments
Before:

    $ ./bin/coffee -bpe '###
    > # paragraph 1
    > #
    > # paragraph 2
    > ###'
    /*
     * paragraph 1
    #
     * paragraph 2
     */

After:

    $ ./bin/coffee -bpe '###
    # paragraph 1
    #
    # paragraph 2
    ###'
    /*
     * paragraph 1
     *
     * paragraph 2
     */

This does not re-break #3638:

    $ ./bin/coffee -bpe '###
    > #/
    > ###'
    /*
    #/
     */
2015-05-13 17:50:09 +02:00
Simon Lydell
ba85a38cb0 Commit compiled code that should have been in commit 378a04e4 2015-05-13 17:50:02 +02:00
Michael Ficarra
c0d44b1abd Merge pull request #3966 from davidbau/simplesourcemaps
Fix #3965, sourcemaps for bare programs.
2015-05-08 07:52:58 -07:00
Michael Ficarra
0262322400 Merge pull request #3974 from carlsmith/issue3958
Improved try/catch/finally to explain the options better.
2015-05-02 09:06:49 -07:00
Carl Smith
8e8f6d13bd Improved try/catch/finally to explain the options better. 2015-05-01 22:38:25 +01:00
Michael Ficarra
b6667f0735 Merge pull request #3970 from lydell/docs
Document a few undocumented things
2015-05-01 08:12:53 -07:00
Simon Lydell
99ea1c7a39 Document a for [b..c] 2015-05-01 17:01:05 +02:00
Simon Lydell
27fd65390a Document yield from and yield return
Fixes #3825.
2015-05-01 17:01:05 +02:00
Simon Lydell
79a6d89849 Document interpolation in object keys
Fixes #3962.
2015-05-01 17:01:05 +02:00
Simon Lydell
6fb5833843 Improve modulo documentation
Fixes #3959.
2015-05-01 17:00:58 +02:00
Simon Lydell
5494ac13ee Document extra try/catch features
Fixes #3958.
2015-05-01 16:59:34 +02:00
Michael Ficarra
300faf401c Merge pull request #3968 from lydell/nodes-tokens-errors
Fix `CoffeeScript.nodes(tokens)`; fix the repl
2015-05-01 07:51:17 -07:00
Michael Ficarra
f2c6066103 Merge pull request #3967 from lydell/implicit-call-implicit-obj
Fix #3935: Implicit calls + obj key interpolation
2015-05-01 07:48:59 -07:00
Michael Ficarra
2a5320fd2b Merge pull request #3969 from lydell/alias-origin
Save alias names in the origin of tokens
2015-05-01 07:41:14 -07:00
Simon Lydell
36695540fc Save alias names in the origin of tokens
... and use it for "reserved word can't be assigned" errors. Fixes #2306.
2015-05-01 14:33:11 +02:00
Simon Lydell
fc0c4fdd5f Fix CoffeeScript.nodes(tokens); fix the repl
If you passed an array of tokens (as opposed to a string of code) to
`CoffeeScript.nodes`, its attempts to prettify error messages would break. Now
it does not attempt to prettify error messages in that case anymore (because it
is not possible to prettify the errors without a string of code).

The repl was affected by the above bug.

Fixes #3887.
2015-05-01 13:43:04 +02:00
Simon Lydell
ebc172d1ee Fix #3935: Implicit calls + obj key interpolation
Allow implicit calls when the first key of an implicit object has interpolation.
2015-05-01 12:02:03 +02:00
Simon Lydell
4e6b6678f7 Add tests for implicit calls with implicit object 2015-05-01 11:53:37 +02:00
David Bau
378a04e48c Fix #3965, sourcemaps for bare programs.
Instead of mapping all generated spaces and semicolons and newlines
to the source position (0,0), we avoid generating sourcemap information
for generated space-or-semicolon-only fragments.

(In addition to shortening sourcemaps, this fixes a correctness issue
where an empty fragment at the beginning of each line maps from (0,0),
but in a bare program, that position at the begining of the line
should map from the actual source line.  When this conflict occurred,
(0,0) would win, resulting in an incorrect sourcemap, where each
top-level function call mapped to (0,0).)
2015-04-30 22:08:26 -04:00
Michael Ficarra
1e62781759 Merge pull request #3953 from sixmen/fix_repl_fd_leak
fix history file descriptor leak
2015-04-23 06:46:50 -07:00
Michael Ficarra
234adef20c Merge pull request #3952 from sixmen/fix_write_after_fin
fix write after FIN error when using repl via socket
2015-04-23 06:45:04 -07:00
Sangmin Yoon
8b463cd3ad fix history file descriptor leak 2015-04-22 15:26:44 +09:00
Sangmin Yoon
ce10a463f3 fix write after FIN error when using repl via socket
if repl.outputStream is a socket, it is closed when 'exit' event
occurred, so write throws an exception
2015-04-22 15:11:56 +09:00
Jeremy Ashkenas
140a73dca7 adding new packt book at their request 2015-04-15 12:03:22 -04:00
Jeremy Ashkenas
46d16b5c49 #3942 -- revising changelog 2015-04-15 11:49:14 -04:00
Jeremy Ashkenas
d16cf19c15 Merge pull request #3942 from alubbe/master
1.9.2
2015-04-15 11:44:48 -04:00
Andreas Lubbe
edbb9a77e7 build & docs for 1.9.2 2015-04-15 17:26:30 +02:00
Andreas Lubbe
cc4c3b2606 added 1.9.2 changelog 2015-04-15 17:26:06 +02:00
Andreas Lubbe
3a2888f97a bumped version to 1.9.2 2015-04-15 17:25:49 +02:00
Jeremy Ashkenas
bd17cc9b3c Merge pull request #3892 from matthieubulte/master
Added checking on process.stdout to be compatible with browserify
2015-03-09 09:42:27 -04:00
Jeremy Ashkenas
0a3e3639dc Merge pull request #3706 from imcotton/script-data-src
Optionally to read data-src out from <script>
2015-03-09 09:41:32 -04:00
Cotton Hou
008bacf5d5 add compiled lib/browser.js 2015-03-09 15:59:10 +08:00
Cotton Hou
cc1b056b03 optionally to read data-src out from <script> 2015-03-09 15:37:09 +08:00
Matthieu Bulté
3548b4883e Added checking on process.stdout to be compatible with browserify 2015-03-09 08:30:01 +01:00
Michael Ficarra
37a376497c Merge pull request #3893 from josh/escape-literal-bracket-regexp
Escape literal ] in regexp
2015-03-08 22:18:16 -07:00
Joshua Peek
83744917b0 Escape literal ] in REGEX
] is not allowed in the PatternCharacter set
2015-03-08 21:59:09 -07:00
Jeremy Ashkenas
a548b70e8c Merge pull request #3661 from dtaniwaki/fix-deprecated-option
Use stdio option instead of customFds
2015-03-06 09:58:33 -05:00
Jeremy Ashkenas
c8147c046a Reverts #3758, Fixes #3863 -- kills the broken warning 2015-03-03 14:30:52 -05:00
Jeremy Ashkenas
4a7497b451 Merge pull request #3886 from jashkenas/revert-3885-escape-literal-bracket-regexp
Revert "Escape literal [ in regexp"
2015-02-26 16:05:25 -05:00
Jeremy Ashkenas
06aa329596 Revert "Escape literal [ in regexp" 2015-02-26 16:05:12 -05:00
Jeremy Ashkenas
9becb0e937 Merge pull request #3885 from josh/escape-literal-bracket-regexp
Escape literal [ in regexp
2015-02-26 14:49:24 -05:00
Joshua Peek
7f7765546f Escape literal [ in regexp
Improves compatibility with strict ES5 regexp syntax
2015-02-26 12:37:27 -06:00
Jeremy Ashkenas
c7a365b6f1 Merge pull request #3883 from alubbe/master
yield now behaves as expected around 'this'
2015-02-26 11:41:42 -05:00
Andreas Lubbe
84c125a71b yield now behaves as expected around 'this' - fixes https://github.com/jashkenas/coffeescript/issues/3882 2015-02-26 13:01:12 +01:00
Jeremy Ashkenas
06b74591e7 Merge pull request #3877 from gilesbowkett/ocd-test-description-details
added descriptions to tests which only had Issue numbers
2015-02-23 23:18:22 -05:00
Giles Bowkett
6645fbb895 added descriptions to tests which only had Issue numbers 2015-02-23 16:39:05 -07:00
Jeremy Ashkenas
c2758da9eb Merge pull request #3873 from Taritsyn/master
Fix getting of character at index
2015-02-23 10:36:47 -05:00
Jeremy Ashkenas
7a1c8fef0a Merge pull request #3872 from banyan/add-link-of-changelog
Update README.md and remove README
2015-02-23 10:36:01 -05:00
Andrey Taritsyn
71c59dddcc Fix getting of character at index 2015-02-22 19:08:15 +03:00
Kohei Hasegawa
ef6f90753a Delete README 2015-02-21 14:12:19 -05:00
Kohei Hasegawa
50fff63252 Add link of changelog 2015-02-21 13:59:35 -05:00
Jeremy Ashkenas
8f5c77c3ce Merge pull request #3871 from jcrben/doc_tweak
Replace references to jQuery's 'bind' with 'on'
2015-02-20 17:16:32 -05:00
Ben Creasy
88529bc339 Replace references to jQuery's 'bind' with 'on' 2015-02-20 14:02:47 -08:00
Jeremy Ashkenas
f37f9d1eda Merge pull request #3867 from sgentle/require-option
add -r/--require command line option
2015-02-19 14:06:51 -05:00
Sam Gentle
836175baab add -r/--require command line option 2015-02-20 02:58:10 +11:00
Jeremy Ashkenas
7395ac1d4f variable names 2015-02-18 15:48:45 -05:00
Jeremy Ashkenas
61988fe361 #3862 changelog 2015-02-18 15:46:14 -05:00
Jeremy Ashkenas
533ad8afe9 CoffeeScript 1.9.1 2015-02-18 15:43:33 -05:00
Jeremy Ashkenas
1961f06e08 Merge pull request #3861 from lydell/heredoc-undefined
Fix single-line heredocs starting with "undefined"
2015-02-18 14:06:09 -05:00
Simon Lydell
4503e2716e Fix single-line heredocs starting with "undefined" 2015-02-18 17:40:40 +01:00
Jeremy Ashkenas
e4d81005be Merge pull request #3854 from alubbe/fixyieldreturn
fixed yield return producing incorrect output when used outside of the last line
2015-02-17 15:47:24 -05:00
Andreas Lubbe
b6012c4617 improved yield return test 2015-02-17 19:11:06 +01:00
Andreas Lubbe
feee6954a6 fixed yield return producing incorrect output when used outside of the last line 2015-02-17 19:11:06 +01:00
Jeremy Ashkenas
fea058c53a Merge pull request #3858 from alubbe/master
fixed overly fragile repl test to work with 0.12
2015-02-17 10:49:43 -05:00
Andreas Lubbe
25d97aa136 fixed overly fragile repl test to work with 0.12, see https://github.com/jashkenas/coffeescript/issues/3855 2015-02-17 11:36:24 +01:00
Michael Ficarra
7c8849cc21 Merge pull request #3852 from alubbe/moretests
added a lot of ES6 generator tests
2015-02-15 11:46:10 -08:00
Andreas Lubbe
b362bd672c added a lot of ES6 generator tests 2015-02-15 20:35:22 +01:00
Michael Ficarra
a4f510501c Merge pull request #3853 from alubbe/fixyieldthrow
fixed being unable to use 'yield throw'
2015-02-15 10:55:17 -08:00
Andreas Lubbe
e3f6e19950 fixed being unable to use 'yield throw' 2015-02-15 19:01:00 +01:00
Jeremy Ashkenas
b49b41320e Merge pull request #3758 from DiThi/master
Prevent writing the same file several times (fixes #3753)
2015-02-12 14:27:06 -05:00
Alberto Torres Ruiz
6bc3157793 Prevent writing the same file several times (fixes #3753) 2015-02-12 20:20:35 +01:00
Jeremy Ashkenas
dc8a2b17d0 Merge pull request #3849 from lydell/regex-end-invalid-escape
Fix error message for invalid escape at end of regex
2015-02-12 13:55:10 -05:00
Jeremy Ashkenas
c3ae2328af Merge pull request #3850 from lydell/implicit-object-start-token
Fix #3846: Fix odd start token of implicit objects
2015-02-12 13:54:38 -05:00
Simon Lydell
57846ea5c0 Fix #3846: Fix odd start token of implicit objects
Now the same hack as for reserved identifier tokens in the lexer is used
instead.
2015-02-12 19:41:12 +01:00
Simon Lydell
3da88b9b3f Fix error message for invalid escape at end of regex 2015-02-12 19:26:41 +01:00
Jeremy Ashkenas
8130e63e43 Merge pull request #3802 from mapmeld/multiline_comment_fix
Allow multiline comment at end of an object definition [Fixes #3761]
2015-02-10 23:56:01 -05:00
Nick Doiron
dc44ebbdaa allow multiline comment inside of an object definition [Fixes #3761]
use more CoffeeScript syntax
2015-02-10 23:35:39 -05:00
Jeremy Ashkenas
88ad059d54 Merge pull request #3840 from lydell/dynakeys
Fix #3597: Allow interpolations in object keys
2015-02-10 10:43:26 -05:00
Simon Lydell
76c076db55 Fix #3597: Allow interpolations in object keys
The following is now allowed:

    o =
      a: 1
      b: 2
      "#{'c'}": 3
      "#{'d'}": 4
      e: 5
      "#{'f'}": 6
      g: 7

It compiles to:

    o = (
      obj = {
        a: 1,
        b: 2
      },
      obj["" + 'c'] = 3,
      obj["" + 'd'] = 4,
      obj.e = 5,
      obj["" + 'f'] = 6,
      obj.g = 7,
      obj
    );

- Closes #3039. Empty interpolations in object keys are now _supposed_ to be
  allowed.
- Closes #1131. No need to improve error messages for attempted key
  interpolation anymore.
- Implementing this required fixing the following bug: `("" + a): 1` used to
  error out on the colon, saying "unexpected colon". But really, it is the
  attempted object key that is unexpected. Now the error is on the opening
  parenthesis instead.
- However, the above fix broke some error message tests for regexes. The easiest
  way to fix this was to make a seemingly unrelated change: The error messages
  for unexpected identifiers, numbers, strings and regexes now say for example
  'unexpected string' instead of 'unexpected """some #{really long} string"""'.
  In other words, the tag _name_ is used instead of the tag _value_.
  This was way easier to implement, and is more helpful to the user. Using the
  tag value is good for operators, reserved words and the like, but not for
  tokens which can contain any text. For example, 'unexpected identifier' is
  better than 'unexpected expected' (if a variable called 'expected' was used
  erraneously).
- While writing tests for the above point I found a few minor bugs with string
  locations which have been fixed.
2015-02-09 17:32:37 +01:00
Michael Ficarra
5698e6c72a Merge pull request #3842 from arianf/master
Fixed copyright range to be updated to 2015
2015-02-08 13:56:05 -08:00
Arian Faurtosh
e0e4967ad8 Fixed copyright range to be updated to 2015 2015-02-08 11:28:51 -08:00
Michael Ficarra
53c7891599 Merge pull request #3841 from lydell/last
Replace `last array` helper with `[..., last] = array`
2015-02-08 10:22:09 -08:00
Simon Lydell
94a17cb74a Replace last array helper with [..., last] = array 2015-02-07 21:50:41 +01:00
Jeremy Ashkenas
5d139596f8 Merge pull request #3834 from lydell/better-lexer-errors
Improve lexer error messages
2015-02-06 12:17:26 -05:00
Simon Lydell
213225418a Improve lexer error messages
- Erraneous tokens are now fully underlined with ^:s.
- The error messages are now a bit more consistent.
2015-02-06 10:52:02 +01:00
Jeremy Ashkenas
3b3e52097a Merge pull request #3833 from lydell/escapes
Fix #3795: Never generate invalid strings and regexes
2015-02-05 11:32:00 -05:00
Simon Lydell
72ceec5680 Fix #3795: Never generate invalid strings and regexes
- Invalid `\x` and `\u` escapes now throw errors.
- U+2028 and U+2029 (which JavaScript treats as newline characters) are now
  escaped to `\u2028` and `\u2029`, respectively.
- Octal escapes are now forbidden not only in strings, but in regexes as well.
- `\0` escapes are now escaped if needed (so that they do not form an octal
  literal by mistake). Note that `\01` is an octal escape in a regex, while `\1`
  is a backreference. (Added a test for backreferences while at it.)
- Fixed a bug where newlines in strings weren't removed if preceded by an
  escaped character.
2015-02-05 17:23:03 +01:00
Michael Ficarra
5a220d4e13 Merge pull request #3830 from swang/fix_incorrect_token
Fix incorrect token representation
2015-02-04 21:40:45 -08:00
Shuan Wang
92e5ab2857 Fix incorrect token representation
The third element in a token should just be an object containing line
number and column info. This PR fixes the problem with one of the tokens
being set incorrectly.
2015-02-04 21:02:44 -08:00
Jeremy Ashkenas
64632e3332 Merge pull request #3827 from lydell/unexpected-regex
Improve error messages for unexpected regexes
2015-02-03 15:10:29 -05:00
Jeremy Ashkenas
c0e1f23f23 Merge pull request #3785 from lydell/super
Allow super in methods with dynamic names
2015-02-03 15:09:31 -05:00
Simon Lydell
ee8f889cbd Allow super in methods with dynamic names
As discussed in https://github.com/jashkenas/coffeescript/issues/3039#issuecomment-68916918.
This is the first step to implement dynamic object literal keys (see #3597).

This also fixes #1392.

In short, `super` is now allowed:

    # in class definitions:
    class A
      instanceMethod: -> super
      @staticMethod: -> super
      @staticMethod2 = -> super

    # in assignment where the next to last access is 'prototype':
    A::m = -> super
    A.prototype.m = -> super
    a.b()[5]::m = -> super
    A::[x()] = -> super
    class B
      @::m = -> super
2015-02-03 20:46:37 +01:00
Simon Lydell
ffa25aae77 Improve error messages for unexpected regexes 2015-02-03 20:42:50 +01:00
Jeremy Ashkenas
04b30a6cc4 Merge pull request #3786 from lydell/loop-safety
Fix #3778: Make for loops more consistent
2015-02-03 13:08:33 -05:00
Simon Lydell
996a171a4e Fix #3778: Make for loops more consistent
The following two lines might seem equivalent:

    for n in [1, 2, 3] by  a then a = 4; n
    for n in [1, 2, 3] by +a then a = 4; n

But they used not to be, because `+a` was cached into a `ref`, while the plain
`a` wasn’t. Now even simple identifiers are cached, making the two lines
equivalent as expected.
2015-02-03 19:05:07 +01:00
Jeremy Ashkenas
17a271af06 Merge pull request #3826 from lydell/string-locations
Fix #3822: Include delimiters in string/regex locations
2015-02-03 12:58:46 -05:00
Simon Lydell
f8c366c479 Fix #3822: Include delimiters in string/regex locations 2015-02-03 18:55:38 +01:00
Jeremy Ashkenas
934bd2acc7 Merge branch 'master' of github.com:jashkenas/coffeescript 2015-02-03 11:31:44 -05:00
Jeremy Ashkenas
dd0ec84ebe redoc 2015-02-03 11:31:43 -05:00
Jeremy Ashkenas
e9a372dff5 Merge pull request #3821 from lydell/no-underscore
Name generated variables without leading underscore
2015-01-30 14:56:22 -05:00
Simon Lydell
4d7a0d2470 Name generated variables without leading underscore
For example, `ref` not `_ref`. It's cleaner.

This also fixes #3816.
2015-01-30 20:33:03 +01:00
Jeremy Ashkenas
c2abe253a1 Revert "move changelog"
This reverts commit 3ddd3115eb.
2015-01-30 13:44:42 -05:00
Jeremy Ashkenas
3ddd3115eb move changelog 2015-01-30 11:43:05 -05:00
Jeremy Ashkenas
a3096eab91 #3819 changelog docs 2015-01-30 11:14:03 -05:00
Jeremy Ashkenas
3fd004b852 Fixes #3816 -- prettier internal variable names. 2015-01-29 16:24:30 -05:00
Jeremy Ashkenas
0a9c7a3257 docs 2015-01-29 14:58:49 -05:00
Jeremy Ashkenas
f7692c92ce more text tweaks 2015-01-29 12:25:25 -05:00
Jeremy Ashkenas
cdf69eb5bc Merge branch 'gh-pages' 2015-01-29 12:22:26 -05:00
Jeremy Ashkenas
9aeecf582b text tweak 2015-01-29 12:22:16 -05:00
Jeremy Ashkenas
e0ec8a51e4 CoffeeScript 1.9.0 2015-01-29 12:20:46 -05:00
Jeremy Ashkenas
a62e49311e removing the mkdirp test 2015-01-29 11:39:18 -05:00
Jeremy Ashkenas
9a38486d08 Merge pull request #3800 from ysmood/decouple_mkdirp
Decouple "mkdirp".
2015-01-29 11:38:27 -05:00
Jeremy Ashkenas
06e8be5d94 rebuilt browser just for testing 2015-01-29 11:16:01 -05:00
Yad Smood
90a1cbac49 Optimize the mkdirp test 2015-01-29 03:49:40 +08:00
Yad Smood
3d58b4cda1 Add test for mkdirp 2015-01-29 00:44:28 +08:00
Michael Ficarra
2f0724f0ad Merge pull request #3812 from xfq/patch-1
Update index.html.js
2015-01-27 20:39:47 -08:00
Xue Fuqiao
f288d20409 Update index.html.js
Node comes with npm installed and "npm" is not an abbreviation for "Node Package Manager".
2015-01-28 08:52:08 +08:00
Michael Ficarra
dca915af60 Merge pull request #3808 from lydell/api-break-fix
Fix broken CoffeeScript APIs
2015-01-26 09:43:04 -08:00
Simon Lydell
54a4560340 Fix broken CoffeeScript APIs
As evidenced in #3804, commit 8ab15d7 broke the CoffeeScript API. The REPL uses
those APIs, but wasn't updated in that commit. Still, that shouldn't have
_broken_ the REPL. The reason it broke is because the added _option_
'referencedVars' wasn't actually _optional;_ if it was omitted code that relies
on it being set broke. This commit defaults that option to an empty array, which
makes things behave exactly like before when the 'referencedVars' option is
omitted.
2015-01-26 18:21:02 +01:00
Michael Ficarra
518d7c16b7 Merge pull request #3807 from lydell/repl-fix
Fix #3804: Provide list of referenced vars to REPL
2015-01-26 08:35:38 -08:00
Simon Lydell
8ed691e266 Fix #3804: Provide list of referenced vars to REPL
Supersedes #3805. Here is a comparison of master, #3805 and this commit:

    # master
    $ bin/coffee
    coffee> 1 %% 2
    TypeError: Array.prototype.indexOf called on null or undefined

    # #3805
    $ bin/coffee
    coffee> 1 %% 2
    1
    coffee> (_results = null; i) for i in [1, 2, 3]
    TypeError: Cannot call method 'push' of null

    # this commit
    $ bin/coffee
    coffee> 1 %% 2
    1
    coffee> (_results = null; i) for i in [1, 2, 3]
    [ 1, 2, 3 ]
2015-01-26 17:18:35 +01:00
Yad Smood
74fc7128ab Decouple "mkdirp"
Make coffee completely independent.
2015-01-22 04:20:34 +08:00
Michael Ficarra
68c0e2dc0f Merge pull request #3798 from ogennadi/patch-1
Fixed broken link
2015-01-20 18:21:55 -08:00
Oge Nnadi
42dde38842 Fixed broken link 2015-01-20 12:45:27 -08:00
Michael Ficarra
7d6f6174d5 Merge pull request #3787 from lydell/single-token-interpolation
Fix #1316: Interpolate interpolations safely
2015-01-16 08:43:05 -08:00
Simon Lydell
05b3707506 Fix #1316: Interpolate interpolations safely
Instead of compiling to `"" + + (+"-");`, `"#{+}-"'` now gives an appropriate
error message:

    [stdin]:1:5: error: unexpected end of interpolation
    "#{+}-"
        ^

This is done by _always_ (instead of just sometimes) wrapping the interpolations
in parentheses in the lexer. Unnecessary parentheses won't be output anyway.

I got tired of updating the tests in test/location.coffee (which I had enough of
in #3770), which relies on implementation details (the exact amount of tokens
generated for a given string of code) to do their testing, so I refactored them
to be less fragile.
2015-01-16 17:19:42 +01:00
Michael Ficarra
5d1d1b7999 Merge pull request #3792 from lydell/issue-3194
Fix #3194: Make strings always uncallable
2015-01-15 22:34:57 -08:00
Simon Lydell
3db029f2c1 Make regexes always uncallable
No matter if they have interpolations or not.
2015-01-15 19:44:14 +01:00
Michael Ficarra
67aaa8b57f Merge pull request #3794 from lydell/jison-update
Make CoffeeScript work with jison 0.4.14+
2015-01-15 09:03:27 -08:00
Simon Lydell
28c07d30cb Make CoffeeScript work with jison 0.4.14+
Since zaach/jison commit 3548861b, `parser.lexer` is never modified anymore (a
copy of it is made, and that copy is modified instead). CoffeeScript itself
modifies `parser.lexer` and then accesses those modifications in the custom
`parser.yy.parseError` function, but that of course does not work anymore. This
commit puts the data that `parser.yy.parseError` needs directly on the `parser`
so that it is not lost.

Supersedes #3603. Fixes #3608 and zaach/jison#243.
2015-01-15 17:47:07 +01:00
Simon Lydell
fce502ac98 Fix #3194: Make strings always uncallable
No matter if they have interpolations or not.
2015-01-14 21:27:24 +01:00
Michael Ficarra
669e7fed10 Merge pull request #3791 from lydell/issue-3502
Fix #3502: Define param variables when expansion
2015-01-13 20:00:32 -08:00
Michael Ficarra
4bf45ff894 Merge pull request #3790 from lydell/scope-root
Get rid of `Scope.root` hack
2015-01-13 12:53:03 -08:00
Simon Lydell
4c2c472e07 Fix #3502: Define param variables when expansion 2015-01-13 21:26:11 +01:00
Simon Lydell
22f19522ff Get rid of Scope.root hack
Using the static property `Scope.root` for the top-level scope of a file is a
hack, which makes it impossible to have several independent `Scope` instances
at the same time (should we ever need that).

This commit makes every instance have a reference to its root instead.
2015-01-13 20:21:45 +01:00
Michael Ficarra
9fa77af576 Merge pull request #3784 from lydell/unique-generated-vars
Unique generated vars
2015-01-12 21:14:44 -08:00
Michael Ficarra
efd7ebb066 Merge pull request #3788 from lydell/unexpected-call-end
Better error message for unexpected CALL_END
2015-01-12 20:55:25 -08:00
Simon Lydell
62712060c0 Better error message for unexpected CALL_END 2015-01-12 20:40:59 +01:00
Simon Lydell
a46978640b Allow variables named like helper functions 2015-01-11 12:12:40 +01:00
Simon Lydell
8ab15d7372 Fix #1500, #1574, #3318: Name generated vars uniquely
Any variables generated by CoffeeScript are now made sure to be named to
something not present in the source code being compiled. This way you can no
longer interfere with them, either on purpose or by mistake. (#1500, #1574)

For example, `({a}, _arg) ->` now compiles correctly. (#1574)

As opposed to the somewhat complex implementations discussed in #1500, this
commit takes a very simple approach by saving all used variables names using a
single pass over the token stream. Any generated variables are then made sure
not to exist in that list.

`(@a) -> a` used to be equivalent to `(@a) -> @a`, but now throws a runtime
`ReferenceError` instead (unless `a` exists in an upper scope of course). (#3318)

`(@a) ->` used to compile to `(function(a) { this.a = a; })`. Now it compiles to
`(function(_at_a) { this.a = _at_a; })`. (But you cannot access `_at_a` either,
of course.)

Because of the above, `(@a, a) ->` is now valid; `@a` and `a` are not duplicate
parameters.

Duplicate this-parameters with a reserved word, such as `(@case, @case) ->`,
used to compile but now throws, just like regular duplicate parameters.
2015-01-10 23:25:01 +01:00
Joshua Peek
23a691ae87 Add test for reserved keywords as parameters 2015-01-10 23:23:26 +01:00
Michael Ficarra
bec8f27e8a Merge pull request #3782 from lydell/regex
Fix #3410, #3182: Allow regex to start with space or =
2015-01-10 07:52:02 -08:00
Michael Ficarra
ac2e540e1b Merge pull request #3777 from lydell/unary-plus-minus-refs
Fix #3598: Make unary + and - generate _refs
2015-01-09 18:12:52 -08:00
Michael Ficarra
e0ad0d795d Merge pull request #3783 from lydell/issue-3671
Fix #3671: Allow step in optimized range comprehensions
2015-01-09 17:54:55 -08:00
Simon Lydell
a63009fccb Fix #3671: Allow step in optimized range comprehensions
Allow the `by c` part in `for [a..b] by c then`.

Continue disallowing a `when d` part, since it makes no sense having a guard
that isn't given access to anything that changes on every iteration.
2015-01-10 02:31:56 +01:00
Simon Lydell
8fd6258a46 Fix #3410, #3182: Allow regex to start with space or =
A regex may not follow a specific set of tokens. These were already known before
in the `NOT_REGEX` and `NOT_SPACED_REGEX` arrays. (However, I've refactored them
to be more correct and to add a few missing tokens). In all other cases (except
after a spaced callable) a slash is the start of a regex, and may now start with
a space or an equals sign. It’s really that simple!

A slash after a spaced callable is the only ambigous case. We cannot know if
that's division or function application with a regex as the argument. The
spacing determines which is which:

Space on both sides:
- `a / b/i`  -> `a / b / i`
- `a /= b/i` -> `a /= b / i`

No spaces:
- `a/b/i`    -> `a / b / i`
- `a/=b/i`   -> `a /= b / i`

Space on the right side:
- `a/ b/i`   -> `a / b / i`
- `a/= b/i`  -> `a /= b / i`

Space on the left side:
- `a /b/i`   -> `a(/b/i)`
- `a /=b/i`  -> `a(/=b/i)`

The last case used to compile to `a /= b / i`, but that has been changed to be
consistent with the `/` operator. The last case really looks like a regex, so it
should be parsed as one.

Moreover, you may now also space the `/` and `/=` operators with other
whitespace characters than a space (such as tabs and non-breaking spaces) for
consistency.

Lastly, unclosed regexes are now reported as such, instead of generating some
other confusing error message.

It should perhaps also be noted that apart from escaping (such as `a /\ b/`) you
may now also use parentheses to disambiguate division and regex: `a (/ b/)`. See
https://github.com/jashkenas/coffeescript/issues/3182#issuecomment-26688427.
2015-01-10 01:48:00 +01:00
Simon Lydell
24398774fc Fix #3598: Make unary + and - generate _refs
Before commit c056c93e `Op::isComplex()` used to return true always. As far as I
understand, that commit attempts to exclude code such as `+1` and `-2` from
being marked as complex (and thus getting cached into `_ref` variables
sometimes). CoffeeScript is supposed to generate readable output so that choice
is understandable. However, it also excludes code such as `+a` (by mistake I
believe), which can cause `a` to be coerced multiple times. This commit fixes
this by only excluding unary + and - ops followed by a number.
2015-01-09 18:12:10 +01:00
Jeremy Ashkenas
e769423d52 Merge pull request #3774 from lydell/unicode-spaces
Fix #2516, #3560: Unicode space handling
2015-01-06 16:10:59 -05:00
Simon Lydell
9ec427ba80 Fix #2516, #3560: Unicode space handling
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/coffeescript#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.
2015-01-06 21:32:14 +01:00
Jeremy Ashkenas
c478f283f4 Merge pull request #3771 from mbrio/master
Fix issue #3498
2015-01-05 15:51:26 -05:00
Michael Diolosa
8e299b09cc Fix issue #3498 2015-01-05 15:40:04 -05:00
Michael Ficarra
b70f6571bd Merge pull request #3770 from lydell/interpolations
Refactor interpolation (and string and regex) handling in lexer
2015-01-04 12:12:56 -08:00
Simon Lydell
ae6df88c5c Point "missing )/}/]" errors to the unclosed (/{/[
Previously such errors pointed at the end of the input, which wasn't very
helpful. This is also consistent with unclosed strings, where the errors point
at the opening quote.

Note that this includes unclosed #{ (interpolations).
2015-01-04 07:51:53 +01:00
Simon Lydell
0dcff507fb Refactor interpolation (and string and regex) handling in lexer
- Fix #3394: Unclosed single-quoted strings (both regular ones and heredocs)
  used to pass through the lexer, causing a parsing error later, while
  double-quoted strings caused an error already in the lexing phase. Now both
  single and double-quoted unclosed strings error out in the lexer (which is the
  more logical option) with consistent error messages. This also fixes the last
  comment by @satyr in #3301.

- Similar to the above, unclosed heregexes also used to pass through the lexer
  and not error until in the parsing phase, which resulted in confusing error
  messages. This has been fixed, too.

- Fix #3348, by adding passing tests.

- Fix #3529: If a string starts with an interpolation, an empty string is no
  longer emitted before the interpolation (unless it is needed to coerce the
  interpolation into a string).

- Block comments cannot contain `*/`. Now the error message also shows exactly
  where the offending `*/`. This improvement might seem unrelated, but I had to
  touch that code anyway to refactor string and regex related code, and the
  change was very trivial. Moreover, it's consistent with the next two points.

- Regexes cannot start with `*`. Now the error message also shows exactly where
  the offending `*` is. (It might actually not be exatly at the start in
  heregexes.) It is a very minor improvement, but it was trivial to add.

- Octal escapes in strings are forbidden in CoffeeScript (just like in
  JavaScript strict mode). However, this used to be the case only for regular
  strings. Now they are also forbidden in heredocs. Moreover, the errors now
  point at the offending octal escape.

- Invalid regex flags are no longer allowed. This includes repeated modifiers
  and unknown ones. Moreover, invalid modifiers do not stop a heregex from
  being matched, which results in better error messages.

- Fix #3621: `///a#{1}///` compiles to `RegExp("a" + 1)`. So does
  `RegExp("a#{1}")`. Still, those two code snippets used to generate different
  tokens, which is a bit weird, but more importantly causes problems for
  coffeelint (see clutchski/coffeelint#340). This required lots of tests in
  test/location.coffee to be updated. Note that some updates to those tests are
  unrelated to this point; some have been updated to be more consistent (I
  discovered this because the refactored code happened to be seemingly more
  correct).

- Regular regex literals used to erraneously allow newlines to be escaped,
  causing invalid JavaScript output. This has been fixed.

- Heregexes may now be completely empty (`//////`), instead of erroring out with
  a confusing message.

- Fix #2388: Heredocs and heregexes used to be lexed simply, which meant that
  you couldn't nest a heredoc within a heredoc (double-quoted, that is) or a
  heregex inside a heregex.

- Fix #2321: If you used division inside interpolation and then a slash later in
  the string containing that interpolation, the division slash and the latter
  slash was erraneously matched as a regex. This has been fixed.

- Indentation inside interpolations in heredocs no longer affect how much
  indentation is removed from each line of the heredoc (which is more
  intuitive).

- Whitespace is now correctly trimmed from the start and end of strings in a few
  edge cases.

- Last but not least, the lexing of interpolated strings now seems to be more
  efficient. For a regular double-quoted string, we used to use a custom
  function to find the end of it (taking interpolations and interpolations
  within interpolations etc. into account). Then we used to re-find the
  interpolations and recursively lex their contents. In effect, the same string
  was processed twice, or even more in the case of deeper nesting of
  interpolations. Now the same string is processed just once.

- Code duplication between regular strings, heredocs, regular regexes and
  heregexes has been reduced.

- The above two points should result in more easily read code, too.
2015-01-04 07:47:09 +01:00
Jeremy Ashkenas
8e4fb1b937 Merge pull request #3748 from sscotth/master
Include logo .svg files
2014-12-03 10:20:32 -05:00
Scott
931b74e449 include logo .svg files 2014-12-02 18:33:07 -06:00
Jeremy Ashkenas
4199f4f325 Merge pull request #3734 from alubbe/master
fixed yield keyword not working in switch & for loop expressions
2014-11-21 18:38:11 -05:00
alubbe
5950d6328d added tests for yield in switch & for loop expressions 2014-11-21 23:14:53 +01:00
alubbe
a9fbf14adf fixed yield keyword not working in switch & for loop expressions 2014-11-21 22:52:09 +01:00
Jeremy Ashkenas
485aa8efcf add Die Alternative to books section 2014-11-17 13:43:41 -05:00
Jeremy Ashkenas
a563e8f8fe Merge pull request #3703 from bigtunacan/master
Add bower.json configuration
2014-10-29 17:05:25 -04:00
Joiey Seeley
4035e7caab Removed "mkdirp": "~0.3.5" from bower.json 2014-10-29 15:10:57 -05:00
Joiey Seeley
2c6e6ca870 Added an initial bower.json configuration file 2014-10-29 14:23:31 -05:00
Jeremy Ashkenas
f2a3f7507e Merge pull request #3521 from gscottolson/master
Retina favicon.ico
2014-10-27 17:18:33 -04:00
Jeremy Ashkenas
4f82e5912e Merge pull request #3677 from alubbe/master
implemented proper precedence for 'yield'
2014-10-13 11:41:36 -04:00
alubbe
dd5da7f5f2 implemented proper precedence for 'yield' 2014-10-13 03:32:02 +02:00
Anatoly Ressin
ec44aba71a Improved test readability + fixed integer divison 2014-10-12 22:32:02 +03:00
Anatoly Ressin
e8a4e93a72 Added failing test case for the yield precedence 2014-10-12 20:08:28 +03:00
dtaniwaki
1301390087 Use stdio option instead of customFds 2014-10-04 12:54:07 +09:00
Jeremy Ashkenas
158ca0d869 Merge pull request #3638 from lbeschastny/issue3638
Invalid block comments compilation
2014-09-23 14:52:03 -04:00
Jeremy Ashkenas
a78cbe78a1 Merge pull request #3240 from alubbe/master
using 'yield' automatically turns functions into generators
2014-09-19 16:38:41 -04:00
Leonid Beschastny
77d5b95260 Added test for jashkenas/coffee-script#3638 2014-09-17 15:02:18 +04:00
Leonid Beschastny
55e3b6b3c3 Fixed jashkenas/coffeescript#3638 - invalid block comments compilation 2014-09-17 15:02:10 +04:00
Andreas Lubbe
efca2861a6 added tests for yield, yield from, yield return and yield in if statements 2014-09-06 17:25:44 +02:00
Andreas Lubbe
781ea22d57 always wrap 'yield' in () to allow composability with all other operators 2014-09-06 17:12:25 +02:00
Andreas Lubbe
437b9ed65c added 'yield return' 2014-09-06 15:40:53 +02:00
Andreas Lubbe
c72556619f added 'yield from' 2014-09-06 13:53:21 +02:00
Andreas Lubbe
565d78f00b removed support for '->*" and '=>*' 2014-09-06 13:38:04 +02:00
Andreas Lubbe
75900660fd Merge remote-tracking branch 'A/master' 2014-09-06 11:32:25 +02:00
Michael Ficarra
b407a59baf Merge pull request #3618 from josh/update-site-example-projects
Refresh site Examples section
2014-08-28 00:40:35 -04:00
Joshua Peek
9dfd71b0e4 Add Atom to Examples 2014-08-27 21:24:42 -07:00
Joshua Peek
872092f6de Remove josh/nack from Examples 2014-08-27 21:21:25 -07:00
Michael Ficarra
8b066f125d Merge pull request #3616 from epmatsw/spelling
Quick spelling fixes
2014-08-26 19:46:34 -07:00
Will Stamper
94c467b520 Quick spelling fixes 2014-08-26 20:41:32 -05:00
Jeremy Ashkenas
53aa50f785 merged 2014-08-26 12:28:39 -04:00
Jeremy Ashkenas
81047d45ee CoffeeScript 1.8.0 2014-08-26 12:24:29 -04:00
Jeremy Ashkenas
9177676979 Merge pull request #3611 from lydell/release-1.8.0
Release 1.8.0
2014-08-26 12:20:18 -04:00
Simon Lydell
7cfba37f7c Update changelog for 1.8.0 2014-08-25 19:39:27 +02:00
Simon Lydell
ee8d105194 Rebuild docs 2014-08-23 16:08:39 +02:00
Michael Ficarra
6929441cb7 Merge pull request #3592 from mmotorny/master
Exit with an error code 1 if could not write a compiled JavaScript file ...
2014-08-17 22:07:07 -07:00
Maksym Motornyy
b5734028d9 Exit with an error code 1 if could not write a compiled JavaScript file or a source map
Currently CoffeeScript reports a success even if it failed to write a
compiled file to disk. This behavior confuses automated tools such as
test runners which may return false positives if a test failed to
compile because of a file lock.
2014-08-17 20:42:30 -07:00
Michael Ficarra
ab6f69c741 Merge pull request #3561 from yjo/js-map-file-ext
Use '.js.map' as file extension for created map files
2014-07-29 10:52:59 -07:00
Joe Lee-Moyet
2ec6e7e944 Use '.js.map' as file extension for created map files
Addresses jashkenas/coffeescript#3297
2014-07-29 17:28:08 +01:00
Nami-Doc
e8c96de269 Fix the "Examples" link on coffeescript.org
It now points to the "Trending repositories" of the month.
2014-07-23 22:21:14 +02:00
Nami-Doc
fbbda3f85f Fix the "Examples" link on coffeescript.org
It now points to the "Trending repositories" of the month.
2014-07-23 22:17:00 +02:00
Michael Ficarra
f96ab11feb Merge pull request #3545 from jordanbtucker/patch-1
`bin/cake` will be in `coffeescript`
2014-07-17 16:23:47 -07:00
jordanbtucker
5c1daf966a bin/cake will be in coffeescript
Since the name change, `bin/cake` will be in `coffeescript`, not `coffee-script`.
2014-07-17 15:04:40 -07:00
Michael Ficarra
df8529fbfb Merge pull request #3543 from ysmood/err_info_issue
Fixed an error formatting issue
2014-07-16 07:36:48 -07:00
Yad Smood
3465e7554d Fixed an error formatting issue f7b36054fc
When using tab for code indent, the error marker
will be wrongly positioned.
2014-07-16 17:56:07 +08:00
Yad Smood
f7b36054fc Add a test case for compiler error formatting.
Error formatting with mixed tab and space.
2014-07-16 17:50:15 +08:00
Michael Ficarra
3ec10df4a1 Merge pull request #3539 from minodisk/fix-heregex-interpolation
Fix wrong location issue in heregex interpolation
2014-07-13 21:10:03 -07:00
minodisk
deead4bfad Fix wrong location issue in heregex interpolation 2014-07-13 16:39:41 +09:00
Michael Ficarra
302aa6a457 Merge pull request #3533 from minodisk/fix-string-interpolation
Fix wrong location issue in "string" interpolation
2014-07-02 21:49:24 -07:00
minodisk
5920939e23 Fix wrong location issue in "string" interpolation 2014-07-03 13:11:20 +09:00
Michael Ficarra
2bab1b6aa1 Merge pull request #3524 from minodisk/master
Fix location data bug for string interpolations
2014-07-01 07:35:57 -07:00
minodisk
2b539ebea8 Fix wrong location issue in string interpolation starting with line break 2014-07-01 11:28:21 +09:00
dabbler0
159d562230 Fix off-by-one issue with string interpolation in lexer 2014-07-01 10:55:17 +09:00
Nami-Doc
eb030a2c73 Update link to "CoffeeScript Ristretto", fixes #3489 2014-06-26 17:10:11 +02:00
Nami-Doc
1157b32413 Update link to "CoffeeScript Ristretto", fixes #3489 2014-06-26 17:08:31 +02:00
G. Scott Olson
ba4157b5e2 Retina favicon.ico 2014-06-23 11:11:54 -04:00
Michael Ficarra
5a54d8ba6d Merge pull request #3509 from aviflax/patch-1
Remove sudo from install command in introduction
2014-06-09 08:21:27 -07:00
Avi Flax
f619416492 Remove typo
No idea how that got in there.
2014-06-06 13:46:41 -04:00
Avi Flax
2dd1ec3314 Remove sudo from install command in introduction
1. It just seems like a bad practice to encourage people to run npm with `sudo`
2. The doc wasn’t consistent with itself — down below in the full “Installation” section the same command did *not* include `sudo`
2014-06-06 09:26:18 -04:00
Michael Ficarra
4ad625a265 Merge pull request #3508 from bwin/patch-1
remove docco as dependency (still a devDependency)
2014-06-05 21:51:26 -07:00
Benjamin Winkler
df2b79fa56 remove docco as dependency (still a devDependency)
also changed version requirement notation for from `n.n.x` to `~n.n.n` like the others
2014-06-06 04:33:19 +02:00
Michael Ficarra
c4f9c3abf5 Merge pull request #3503 from datenreisender/handle-dotless-commands
Handle dotless commands in the REPL.
2014-06-03 23:22:15 -07:00
Marko Schulz
9410216b02 Make getCommandId() more readable. 2014-06-03 22:50:25 +02:00
Marko Schulz
233055a7ab Implement changes recommended in the pull request. 2014-06-03 11:29:03 +02:00
Marko Schulz
edf3c12fcc Handle dotless commands in the REPL.
Node 0.11 switched to storing the REPL commands dotless internally.
This fixes the problem brought up in #3450.
2014-06-02 13:24:57 +02:00
Michael Ficarra
1bb3c843e1 Merge pull request #3450 from ehuss/node11repl
Fix repl for Node 0.11.12.
2014-05-28 07:56:15 -07:00
Nami-Doc
48f2c2d0d2 Merge pull request #3494 from ELLIOTTCABLE/patch-1
Fix “list of open-source CoffeeScript on GitHub”
2014-05-24 10:57:17 +02:00
ELLIOTTCABLE
7e01672479 Fix “list of open-source CoffeeScript on GitHub”
Link's been broken with the recent GitHub re-arrangement. This is the closest thing I could find to what that link used to lead to.
2014-05-24 01:22:27 -05:00
Michael Ficarra
ddc023b28b Merge pull request #3492 from forty/master
Do not rely on properties order in scope tests
2014-05-21 07:49:39 -07:00
Quentin Barbe
c65f584112 Do not rely on properties order in scope tests 2014-05-21 16:40:44 +02:00
Jeremy Ashkenas
70a9a341ac Merge pull request #3491 from forty/master
Add tests to check that the FOR variable is defined after the loop
2014-05-20 17:48:26 -04:00
forty
c608901d5a Add tests to check that the FOR variable is defined after the loop 2014-05-20 23:37:33 +02:00
Jeremy Ashkenas
a5a1ea9157 Merge pull request #3477 from davidchambers/deprecate-join
command: deprecate --join
2014-05-12 10:59:17 -04:00
David Chambers
1cd48a9f5d command: deprecate --join 2014-05-11 22:41:39 -07:00
Jeremy Ashkenas
d8b7a55eb9 Merge pull request #3448 from leedm777/export-repl
Export the CoffeeScript REPL.
2014-05-08 16:08:45 -04:00
Jeremy Ashkenas
6ae21ae461 merged 2014-05-08 15:09:40 -04:00
Jeremy Ashkenas
f0764096e9 now that github supports renames, coffeescript, not coffee-script 2014-05-08 15:07:42 -04:00
Michael Ficarra
ade9620351 Merge pull request #3460 from datenreisender/correct-repl-help
Fix help for .load
2014-05-01 07:48:58 -07:00
Marko Schulz
3fdc3a4758 Fix help for .load 2014-05-01 14:54:43 +02:00
Eric Huss
03705c674f Fix repl for Node 0.11.12.
Node changed their repl so that it inherits from readline.Interface.
This means that `prompt` is now the rli function and not the original
prompt string.  This may be a little hacky, but I figure it would give
someone a start if they want to do a better fix.

The commit that changed this in Node is joyent/node@3ae0b17c76

This bug was mentioned in Issue #3395.
2014-04-19 01:18:21 -07:00
David M. Lee
576fe44ef8 Export the CoffeeScript REPL.
This is done by adding a root level wrapper script for
lib/coffee-script/repl, similar to how the register script is wrapped.
This allows user programs to embed a CoffeeScript REPL without digging
into CoffeeScript's internals.
2014-04-18 08:26:51 -05:00
Michael Ficarra
e02c8abb1a Merge pull request #3425 from charlierudolph/compile_errors
Display compile errors - rebase from @jeremybanks
2014-03-18 08:11:29 -05:00
Michael Ficarra
2723f1afe9 Merge pull request #3424 from charlierudolph/fix_index
Fix errors on index
2014-03-17 21:57:38 -05:00
Jeremy Banks
6114751d21 Display compile errors - rebase from @jeremybanks 2014-03-17 17:09:05 -07:00
charlierudolph
15b64addbf Fix errors on index
Extra quotations resulted in subtracting two strings and then a
javascript syntax error
2014-03-17 16:15:31 -07:00
Nami-Doc
4547612e50 Merge pull request #3418 from fcolas6013/patch-2
fix spell mistake on index.html.js
2014-03-15 22:24:54 +01:00
Fabrice Colas
9c15b13a96 fix spell mistake on index.html.js 2014-03-15 14:23:46 -07:00
Jeremy Ashkenas
63acf6a5ff Merge pull request #3355 from aroben/kill-isUndefined
Remove reference to never-defined .isUndefined property
2014-03-15 16:37:59 -04:00
Jeremy Ashkenas
3339c2f228 Merge pull request #3415 from matt-hickford/patch-1
Package with preferGlobal as appropriate for command-line application
2014-03-14 23:36:28 -04:00
Matt Hickford
c2db81d892 Package with preferGlobal as appropriate for command-line application
Per https://www.npmjs.org/doc/json.html#preferGlobal

> If your package is primarily a command-line application that should be installed globally, then set this value to true to provide a warning if it is installed locally.
>
> It doesn't actually prevent users from installing it locally, but it does help prevent some confusion if it doesn't work as expected.
2014-03-15 00:44:38 +00:00
Nami-Doc
8b15d8218d Merge pull request #3401 from sailxjx/master
fix a spell mistake in cakefile
2014-03-11 09:09:00 +01:00
sailxjx
bfc9d4d594 fix a spell mistake in cakefile 2014-03-11 15:11:02 +08:00
Michael Ficarra
ab5728c030 fix cake install; related: #3395, #3393 2014-03-03 13:24:20 -06:00
Michael Ficarra
dcf1556ffc Update README.md 2014-02-28 13:18:54 -06:00
Jeremy Ashkenas
53c53bd3e6 Update README.md 2014-02-28 07:59:24 -05:00
Jeremy Ashkenas
c2e1ab589c Delete README 2014-02-28 07:58:14 -05:00
Jeremy Ashkenas
75207a08ad Merge pull request #3393 from christianbundy/markdown-readme
Convert README to Markdown
2014-02-28 07:57:41 -05:00
Christian Bundy
a2dbfdc2f4 Convert README to Markdown 2014-02-27 22:19:04 -08:00
Michael Ficarra
0a82ac7d69 remove editorialisation 2014-02-22 23:20:06 -06:00
Michael Ficarra
a489006afb typo: mult-dot => multi-dot 2014-02-22 23:20:06 -06:00
Michael Ficarra
af08cfd37f add newlines to end of files 2014-02-22 23:20:06 -06:00
Michael Ficarra
9dc3a3df13 Merge pull request #3386 from blmarket/deprecate_warning
Fixes issue #3349, prints deprecation warning
2014-02-22 22:33:25 -06:00
Jeong, Heon
a82aecc008 Improved coding convention and messages. 2014-02-23 13:03:42 +09:00
Jeong, Heon
36a3e03048 Fixes issue #3349, prints deprecation warning
This patch fixes issue #3349, by prints deprecation warning for
users who depends on old(<1.7.0) implicit module registration.
2014-02-23 11:48:16 +09:00
Jeremy Ashkenas
fc8e9fd92a Merge pull request #3382 from davidchambers/time-elements
changelog: use time elements for release dates
2014-02-18 12:18:45 -05:00
David Chambers
c9e87f3044 changelog: use time elements for release dates 2014-02-18 08:49:46 -08:00
Michael Ficarra
bb319e2add Merge pull request #3381 from davidchambers/inline-css
changelog: replace inline CSS
2014-02-18 08:08:03 -06:00
David Chambers
81e2253a55 changelog: replace inline CSS 2014-02-17 21:45:49 -08:00
Michael Ficarra
c41a14f447 Merge pull request #3380 from madprgmr/master
Rudimentary fix for jashkenas/coffee-script#3379.
2014-02-17 17:56:36 -06:00
Sean Hussey
a323160d14 Rudimentary fix for jashkenas/coffee-script#3379. 2014-02-17 18:37:10 -05:00
Jeremy Ashkenas
a216f93b54 Merge pull request #3376 from davidchambers/anchors
change log improvements
2014-02-17 14:14:13 -05:00
David Chambers
551cf56ceb changelog: add missing compare view URLs 2014-02-16 18:09:17 -08:00
David Chambers
09446ad515 changelog: add anchor to each section
Add releaseHeader helper to avoid repetition.
2014-02-16 18:08:35 -08:00
Michael Ficarra
b31951980e Merge pull request #3368 from ricardobeat/cake-register-by-default
Cakefile: register .coffee extension by default
2014-02-09 22:19:41 -06:00
Ricardo Tomasi
e7ba29514d Register .coffee extension by default on Cakefile 2014-02-10 01:16:14 -02:00
Michael Ficarra
a2c0106b3f fixes #3363: modulo operator evaluation order 2014-02-08 20:56:34 -06:00
Michael Ficarra
4dfc75dede Merge pull request #3362 from epidemian/fix-modulo-coercion
Fix #3361, make %% coerce right operand only once
2014-02-08 10:38:58 -06:00
Demian Ferreiro
0ad30e9b3f Fix #3361, make %% coerce right operand only once
Force coercion of right operand once before doing arithmetic with it in the `__modulo` utility function.
2014-02-08 13:24:39 -03:00
Jeremy Ashkenas
46f55d1bb4 Merge pull request #3360 from lydell/install-docs
Improve installation documentation
2014-02-07 10:53:51 -05:00
Simon Lydell
27f1976159 Improve installation documentation
- Simplify the command to install latest master.

- Promote using `--save` when installing locally, since it automatically
  locks the minor version, protecting users from accidentally installing
  breaking updates.
2014-02-07 16:30:52 +01:00
Michael Ficarra
816241d9a1 Merge pull request #3359 from lydell/v8-consistent-stacktraces
Make patched stack traces’ prelude consistent with V8
2014-02-07 09:00:45 -06:00
Simon Lydell
4bbd63c883 Make patched stack traces’ prelude consistent with V8
In V8, the `stack` property of errors contains a prelude and then the
stack trace. The contents of the prelude depends on whether the error
has a message or not.

If the error has _not_ got a message, the prelude contains the name of the
error and a newline.

If the error _has_ got a message, the prelude contains the name of the
error, a colon, a space, the message and a newline.

In other words, the prelude consists of `error.toString() + "\n"`

Before, coffee-script’s patched stack traces worked exactly like that,
except that it _always_ added a colon and a space after the name of the
error.

This fix is important because it allows for easy and consistent
consumption of the stack trace only:

`stack = error.stack[error.toString().length..]`
2014-02-07 13:01:01 +01:00
Adam Roben
e9a0512663 Remove reference to never-defined .isUndefined property
This was added in f4a7cca075 to fix #1038
for CoffeeScript 1.0.1. `.isUndefined` was removed in
caf3da2f66 but this code was never
updated. That actually caused the behavior of this code to change
(trailing `undefined` and `return undefined` statements no longer got
optimized away) when CoffeeScript 1.3.2 was released, but the new
behavior was deemed correct in
https://github.com/jashkenas/coffee-script/issues/1038#issuecomment-14427560.
2014-02-06 09:23:16 -05:00
Adam Roben
8980647f32 Add tests for the optimization of trailing return statements
This documents current behavior. When #1038 was fixed, we also optimized
away trailing "undefined" and "return undefined", but that is no longer
the case.
2014-02-06 09:21:35 -05:00
Michael Ficarra
eda4f0c55b Merge remote-tracking branch 'origin/gh-pages' 2014-02-01 21:07:10 -06:00
Michael Ficarra
ed928928f6 use npm-installed docco rather than relying on globally installed docco 2014-02-01 21:06:21 -06:00
Michael Ficarra
5f28319cb1 update "latest version" documentation link to 1.7.1 2014-01-29 23:24:06 -06:00
Michael Ficarra
6b0ee127da recompile documentation with 1.7.1 2014-01-29 23:21:44 -06:00
Michael Ficarra
5e31672793 Merge branch 'master' into gh-pages 2014-01-29 23:21:00 -06:00
Michael Ficarra
4ab8503e5a CoffeeScript 1.7.1 2014-01-29 23:19:36 -06:00
Michael Ficarra
cc4cc8e652 update changelog for 1.7.1 2014-01-29 23:07:27 -06:00
Michael Ficarra
52b89d5b03 rebuild annotated source documentation 2014-01-29 22:54:00 -06:00
Michael Ficarra
094a0cbe95 add docco as npm dependency so it doesn't have to be installed globally 2014-01-29 22:52:49 -06:00
Michael Ficarra
f8eca2e822 Merge branch 'master' into gh-pages 2014-01-29 22:51:23 -06:00
Jeremy Ashkenas
114eccb459 Merge pull request #3340 from benbria/master
Fix a typo causing module.paths to be always set as the cwd.
2014-01-29 10:29:55 -08:00
Geoffry Song
38bd879a9a Fix a typo causing module.paths to be always set as the cwd.
`options.fileName` was used instead of `options.filename`.
2014-01-29 13:23:19 -05:00
Jeremy Ashkenas
a73a6e24a6 Merge pull request #3337 from roryokane/fix-operator-docs-commas
In docs, move commas out of code
2014-01-28 18:45:17 -08:00
Rory O’Kane
b4d35f13a4 In docs, move commas, part 2
I had missed that the next line had comma-separated operators, too.
2014-01-28 21:09:08 -05:00
Rory O’Kane
3fcaebb007 In docs, move commas out of code
The commas separating these three keywords are not code themselves – not what the user would write – so they should be outside of the `<tt>` tags.

Edits the table in the section [Operators and Aliases](http://coffeescript.org/#operators).
2014-01-28 21:01:22 -05:00
Jeremy Ashkenas
3357b6cf2c index.html 2014-01-28 20:49:26 -05:00
Rory O’Kane
6df8d92499 Fix markup in math operator documentation
In the documentation, surround the new operators with `<tt>` tags instead of Markdown-style backticks, since this is HTML.
2014-01-28 20:49:20 -05:00
Jeremy Ashkenas
e543eb5101 index.html 2014-01-28 20:49:09 -05:00
Jeremy Ashkenas
7c4f842501 Merge pull request #3336 from roryokane/fix-math-operator-docs-markup
Fix markup in math operator documentation
2014-01-28 17:47:32 -08:00
Rory O’Kane
a5fef52751 Fix markup in math operator documentation
In the documentation, surround the new operators with `<tt>` tags instead of Markdown-style backticks, since this is HTML.
2014-01-28 18:56:43 -05:00
dannguyen
ef7b3a75e0 Just a small typo in 1.7.0 changelog 2014-01-28 16:47:42 -05:00
Jeremy Ashkenas
734fcedc06 Merge pull request #3334 from dannguyen/patch-1
Just a small typo in 1.7.0 changelog
2014-01-28 13:46:39 -08:00
dannguyen
e4c8bcf8f6 Just a small typo in 1.7.0 changelog 2014-01-28 16:36:04 -05:00
Jeremy Ashkenas
a3ae0c5c75 CoffeeScript 1.7.0 2014-01-28 14:05:38 -05:00
Jeremy Ashkenas
46895419b3 Merge pull request #3333 from xixixao/release1.7.0
Implement #3332
2014-01-28 10:59:22 -08:00
xixixao
4f6a4bab30 Removed idle styles 2014-01-28 18:57:37 +00:00
xixixao
9e5ffaea69 Use actual _.template instead of custom one 2014-01-28 18:56:43 +00:00
xixixao
928d2d7f4a Extras compiled with 1.7.0 2014-01-28 03:35:09 +00:00
xixixao
10293df1f9 Recompile source with 1.7.0 version 2014-01-28 03:34:00 +00:00
xixixao
41c4c822ba Recompile documentation js files with 1.7.0 version 2014-01-28 03:33:03 +00:00
xixixao
6030ac3a23 Fixes in documentation 2014-01-28 03:30:06 +00:00
xixixao
f42329ca0a Use Node instead of Ruby for documentation 2014-01-28 03:17:12 +00:00
Jeremy Ashkenas
570529f526 Fixing tests for browser. 2014-01-27 11:55:20 -05:00
Jeremy Ashkenas
8b8436d794 Merge pull request #3326 from xixixao/release1.7.0
Prepare 1.7.0 release
2014-01-27 08:42:58 -08:00
Jeremy Ashkenas
b0594aad3e Merge pull request #3331 from xixixao/inlineobjectchain
Fixes chaining after inline implicit objects
2014-01-26 14:15:09 -08:00
xixixao
04b0b94a8c Fixes chaining after inline implicit objects 2014-01-26 22:11:10 +00:00
xixixao
e1f46cfb9b Prepare 1.7.0 release 2014-01-26 18:32:12 +00:00
Michael Ficarra
cc1b74f11b Merge pull request #3329 from xixixao/issue3325
Fixes #3325: implicit indendation error messages
2014-01-25 22:00:24 -08:00
xixixao
104b4666fe Fix indendation error messages 2014-01-26 05:25:13 +00:00
Michael Ficarra
835fc84330 Merge pull request #3328 from xixixao/issue3216
Fixes #3216 for declarations in object literals
2014-01-25 21:05:34 -08:00
Michael Ficarra
a5d6285cfd forgotten compilation from parent commit 2014-01-25 22:54:25 -06:00
xixixao
c2727d964c Fix for declarations in object literals 2014-01-26 04:41:30 +00:00
Andreas Lubbe
f375394381 Merge https://github.com/jashkenas/coffee-script
Conflicts:
	lib/coffee-script/lexer.js
	lib/coffee-script/parser.js
	lib/coffee-script/rewriter.js
	src/lexer.coffee
	src/rewriter.coffee
2014-01-25 19:37:35 -08:00
Michael Ficarra
d687d52f9e Merge pull request #2887 from epidemian/more-math-operators
Add new mathematical operators
2014-01-24 13:18:29 -08:00
Demian Ferreiro
6a43de789f Simplify modulo tests 2014-01-24 17:55:50 -03:00
Demian Ferreiro
1288786fdc Make modulo operator convert arguments to numbers 2014-01-24 16:08:39 -03:00
Demian Ferreiro
2b4421fca1 Merge branch 'master' into more-math-operators
Conflicts:
	lib/coffee-script/grammar.js
	lib/coffee-script/lexer.js
	lib/coffee-script/nodes.js
	lib/coffee-script/parser.js
	test/regexps.coffee
2014-01-24 15:40:28 -03:00
Jeremy Ashkenas
6bdd52733e Merge pull request #3327 from xixixao/forexpansion
Fix expansion in destructuring inside comprehensions
2014-01-24 10:24:51 -08:00
xixixao
bd6b4142fe Fix expansion in destructuring inside comprehensions 2014-01-24 18:20:45 +00:00
Jeremy Ashkenas
daa6ad5470 Merge pull request #3268 from xixixao/issue156
Implement #156, Added expansion to destructuring
2014-01-24 08:33:42 -08:00
xixixao
369e0545c0 Added expansion to destructuring 2014-01-24 16:00:34 +00:00
Michael Ficarra
5f31a3d60e Merge pull request #3324 from xixixao/issue1871
Fixes #1871, close implicit objects in implicit returns
2014-01-23 15:24:10 -08:00
xixixao
8b976acac1 Fixes #1871, close implicit objects in implicit returns 2014-01-23 23:12:12 +00:00
Jeremy Ashkenas
b00962db1a Merge pull request #3322 from xixixao/issue1099
Fix #1099, remove in empty array optimization
2014-01-23 07:16:00 -08:00
xixixao
26dcf025f4 Remove in empty array optimization 2014-01-23 15:09:25 +00:00
Jeremy Ashkenas
d2f90d2236 Merge pull request #3320 from xixixao/issue1275
Fix #1275
2014-01-22 10:54:18 -08:00
xixixao
c3391e1dd8 Fix 1275 2014-01-22 18:33:44 +00:00
Jeremy Ashkenas
b3463a1378 Merge pull request #3319 from xixixao/issue1096
Fix 1096, 1131, 1828: Improve error messages for generated tokens
2014-01-22 05:29:03 -08:00
xixixao
f0463e9981 Improve error messages for generated tokens 2014-01-22 02:54:09 +00:00
Jeremy Ashkenas
1cc583b382 Merge pull request #3317 from xixixao/chainafteroutdent
Chaining semantics after arguments with outdent
2014-01-21 14:27:32 -08:00
xixixao
39cb8815f7 Fixed chaining semantics after outdent 2014-01-21 22:00:57 +00:00
Michael Ficarra
21db08a23d add missing implicit object literal test
ref michaelficarra/CoffeeScriptRedux#266 and 670a1f5f78 (diff-2)
2014-01-12 11:16:27 -06:00
Michael Ficarra
1f301d8c07 Merge pull request #3292 from marchaefner/CLI
`coffee DIR` executes `DIR/index.coffee`
2013-12-29 14:24:02 -08:00
Andreas Lubbe
1e377ed59b 'yield*' now works as expected 2013-12-27 22:12:04 -08:00
Andreas Lubbe
64e78a2bec updated lexer to allow 'yield*' 2013-12-26 01:16:02 -08:00
Jeremy Ashkenas
35f185440f Merge pull request #3293 from marchaefner/master
Fix `child_process.fork` patch
2013-12-23 22:19:55 -08:00
Michael Ficarra
5ce0c84907 Merge pull request #3284 from xixixao/issue3056
Fix multiple postfix conditionals
2013-12-23 22:08:34 -08:00
Andreas Lubbe
25b1eee293 first attempt at including 'yield*' 2013-12-23 19:32:25 -08:00
Marc Häfner
a6891e4feb Fix child_process.fork patch
* Preserve `options` when called without `args`
  * Don't use `coffee` script as `execPath` (Fixes #2919)
2013-12-24 02:05:53 +01:00
Marc Häfner
8a3ebb9181 CLI: Run index.coffee when called on a directory 2013-12-24 01:53:27 +01:00
Andreas Lubbe
dab4ae9416 '->*' and '=>*' now produce generators 2013-12-19 18:08:25 -08:00
Andreas Lubbe
56b04a58dc first attempt at using '->*" and '=>*' for generators 2013-12-19 14:21:14 -08:00
Michael Ficarra
308299fe04 Merge pull request #3285 from xixixao/formatutils
Format utilities using single quoted literals
2013-12-16 20:08:05 -08:00
xixixao
1cc8463b9c Formatted utilities using single quoted literals 2013-12-17 03:36:49 +01:00
xixixao
d7862647d9 Fix multiple postfix conditionals 2013-12-17 03:31:19 +01:00
Nami-Doc
6c786f0fb7 Merge pull request #3283 from Fritz-Lium/patch-1
the page lists only top 100 contributors
2013-12-14 03:31:43 -08:00
Fritz-Lium
cc345def46 the page list only top 100 contributors 2013-12-14 19:31:04 +08:00
Michael Ficarra
818983b6a4 Merge pull request #3280 from xixixao/issue3271
Examples: Back to non-naked constructor, @, preincrement, comprehension bracketing...
2013-12-09 14:31:23 -08:00
xixixao
b859d92d2c Back to non-naked constructor, @, preincrement, comprehension bracketing, idioms: calls, comprehensions, interpolations 2013-12-09 22:28:34 +00:00
Jeremy Ashkenas
8cd9ba168d Merge pull request #3279 from michaelficarra/fix-require.extensions-registration
fix require.extensions registration
2013-12-08 13:26:15 -08:00
Michael Ficarra
08a57898a7 add CoffeeScript.register method for require.extensions registration 2013-12-08 14:21:18 -06:00
Michael Ficarra
ba4743cc83 fix auto and manual require.extensions registration; ref #3141
You can now `require('coffee-script/register')` to manually register,
and the compiler auto-registers when directly running a coffee file.
2013-12-08 14:19:10 -06:00
Jeremy Ashkenas
94e22ab819 Merge pull request #3275 from marchaefner/CLI
Fix --watch handling of deleted sources
2013-12-07 22:28:19 -08:00
Michael Ficarra
c1b46f777f Merge pull request #3277 from boundvariable/master
Add CoffeeScript in Action book link
2013-12-06 08:04:46 -08:00
Patrick Lee
81cf9ca00f Add CoffeeScript in Action book link 2013-12-07 00:58:43 +11:00
Nami-Doc
96f087ca6b Merge pull request #3276 from xixixao/issue1495fixup
Fixup #3263: Prevent loop collection in endAllImplicitCalls
2013-12-05 13:55:38 -08:00
xixixao
bc975e556e Prevent loop collection in endAllImplicitCalls 2013-12-05 21:53:42 +00:00
Andreas Lubbe
e1000205fd Merge github.com:jashkenas/coffee-script 2013-12-05 11:56:34 -08:00
Andreas Lubbe
c02a403f2e fixed misspelling in Cakefile 2013-12-04 21:49:17 -08:00
Marc Häfner
6804c1065b Fix: EPERM when deleting watched dirs in Windows
* Suppress `EPERM` from watchers
  * Suppress `EPERM` from `fs.unlink`
2013-12-04 17:12:24 +01:00
Marc Häfner
74cf54a84f Prettify watch 2013-12-04 14:50:36 +01:00
Andreas Lubbe
f4b850d59c further improved readability of cakefile generator check 2013-12-02 23:33:16 -08:00
Marc Häfner
73af30b5d8 Fixes #3267 -- Remove source maps of deleted source files 2013-12-01 12:03:22 +01:00
Marc Häfner
54633aee3f Remove unnecessary parameter 2013-12-01 11:35:03 +01:00
Andreas Lubbe
85c7fffd1a improved readability of cakefile generator check 2013-11-30 20:51:53 -08:00
Andreas Lubbe
9d29a830df entire generator test file is now ignored if generators are not available 2013-11-30 12:26:32 -08:00
Andreas Lubbe
74a92db173 improved readability of generator test 2013-11-30 11:45:19 -08:00
Andreas Lubbe
d712a6c0f4 npm run-script test-harmony executes generator tests 2013-11-29 20:59:22 -08:00
Andreas Lubbe
7906a2b6c1 removed yield from the reserved words 2013-11-29 20:58:43 -08:00
Andreas Lubbe
f11ca9888f added a test for generators 2013-11-29 20:58:26 -08:00
Marc Häfner
26200f4640 Improve HEREDOC regexp
* Exclude trailing blank line from the match group
  * Fix backslash handling
2013-11-28 16:46:00 +01:00
Marc Häfner
13f205404c Merge pull request #3261 from xixixao/issue1273
Fix #1273, Handle backslashes at the end of heredocs
2013-11-28 07:32:20 -08:00
Jeremy Ashkenas
563f14b178 Merge pull request #3263 from xixixao/issue1495
Implement #1495,  Method call chaining
2013-11-27 22:58:46 -08:00
xixixao
5e4cca90a3 Fix #3264, missing leading whitespace before interpolation in heredoc 2013-11-27 20:53:20 +00:00
xixixao
a61b6ee925 Fixed leading whitespace before interpolation in simple strings 2013-11-27 20:29:45 +00:00
xixixao
b11d956d53 Added compilation regression test 2013-11-27 12:58:14 +00:00
xixixao
ee9febe399 Handle nested calls and function oneliners when chaining 2013-11-27 04:57:44 +00:00
xixixao
15a70f863c Implemented method call chaining 2013-11-27 03:41:52 +00:00
Michael Ficarra
4eee9c318e Merge pull request #3262 from xixixao/issue1766
Fix #1766, Add negative slice end index into docs
2013-11-26 19:10:46 -08:00
xixixao
ac6a76ee10 Add negative slice end index into docs 2013-11-27 01:01:32 +00:00
xixixao
42aa8d256c Handle backslashes at the end of heredocs 2013-11-26 19:29:13 +00:00
Marc Häfner
873ed071d4 Fixes #3259 -- Use placeholders when adding params to scope
Don't register nested variables of complex parameters as parameters of the compiled function. Use the computed placeholder name instead.
2013-11-26 14:23:20 +01:00
Jeremy Ashkenas
210376f7a9 Merge pull request #3256 from xixixao/issue3249
Implements #3249, #1994 Escape newlines in heredocs with backslashes
2013-11-24 10:54:53 -08:00
xixixao
35d327a304 Escape newlines in heredocs with backslashes 2013-11-24 18:37:11 +00:00
Jeremy Ashkenas
e3e8b1c501 Merge pull request #3255 from marchaefner/CLI
CLI fixes and refactoring
2013-11-23 18:31:27 -08:00
Marc Häfner
52a54a7681 Fix and simplify management of sources in CLI
* Move all source path filtering to `compilePath`
  * Restrict modification of `sources` to
    * `compilePath` for adding
    * `removeSource` for removing
  * Don't add unfiltered paths to `sources` (and remove them later on)
2013-11-23 07:54:35 +01:00
Marc Häfner
1fe28c1fc9 Simplify and rename unwatchDir (to removeSourceDir) 2013-11-23 06:55:57 +01:00
Marc Häfner
89efd05a3f Make timeout callback in watchDir synchronous 2013-11-23 06:49:41 +01:00
Marc Häfner
caafafcf4d Simplify removeSource and make it synchronous 2013-11-23 06:49:13 +01:00
Marc Häfner
81d8224b9a Remove path.exists* as fallback for fs.exists* 2013-11-23 06:42:39 +01:00
Marc Häfner
22c85e216f Use absolute paths in CLI
* Use absolute paths for source files and target paths
  * Memorize and explicitly check for watched directories
  * Make path comparison and construction more precise and clear
  * Remove now unnecessary check for special relative paths
2013-11-23 06:41:08 +01:00
Michael Ficarra
f047ba52b2 Merge pull request #3250 from xixixao/issue3229
Fix multiple escaped backslashes in literal strings
2013-11-19 20:32:41 -08:00
xixixao
130899a39f Fix multiple escaped backslashes in literal strings 2013-11-19 23:44:39 +00:00
Jeremy Ashkenas
6847400ccb Merge pull request #3246 from xixixao/issue3229
Implements #3229 - Changed multiline string literals
2013-11-18 16:42:10 -08:00
xixixao
1102567b0c Handle escaped backslashes 2013-11-19 00:04:17 +00:00
xixixao
8c6647849b Don't rely on multiline in other tests 2013-11-18 16:26:48 +00:00
xixixao
de42ad0e1c More test cases 2013-11-18 15:25:11 +00:00
xixixao
073d025fac Better method name and fixed regexps for IE 2013-11-18 15:13:40 +00:00
xixixao
efe8c68c75 Changed multiline string literals 2013-11-18 04:32:15 +00:00
Andreas Lubbe
9941050120 using 'yield' automatically turns functions into generators 2013-11-15 22:19:31 +01:00
Andreas Lubbe
dafc7bdea5 added 'yield' to the unary keywords 2013-11-15 22:16:28 +01:00
Andreas Lubbe
f51cbd7117 removed 'yield' from the reserved keywords 2013-11-15 22:15:31 +01:00
Jeremy Ashkenas
45d97b3dfe Remove old Node pre-0.6 warning. 2013-11-15 14:26:47 -05:00
Jeremy Ashkenas
fcc88ca472 Revert "add: Stat polling support while fs.watch doesn't work."
This reverts commit 2853e718f2.
2013-11-15 14:26:16 -05:00
Jeremy Ashkenas
187ebd0374 Revert "mov: Change the option name --polling to --watch-polling, and only leaves the long option name."
This reverts commit 08f6c65c3b.
2013-11-15 14:26:05 -05:00
Jeremy Ashkenas
c4999efda7 Revert "fix: opts.polling changed to opts[watch-polling]"
This reverts commit 52789f5b19.
2013-11-15 14:25:55 -05:00
Jeremy Ashkenas
b6231e50c3 Merge pull request #3212 from ysmood/issue3210
add: Stat polling support while `fs.watch` doesn't work.
2013-11-15 11:09:50 -08:00
Marc Häfner
592aa33577 Fixes #2367 -- super in for-loop 2013-11-15 06:35:04 +01:00
Marc Häfner
544c99a9ad Fix error location for illegal pure statements 2013-11-15 05:37:34 +01:00
Jeremy Ashkenas
de0e3baf1f Merge pull request #3237 from marchaefner/fixSuper
Fix super-related tagging of `Code` nodes
2013-11-14 19:25:50 -08:00
Marc Häfner
aea0f2533b Fixes #3232 -- Tag all class properties static
(and remove duplicate `context` assigment)
2013-11-15 03:44:26 +01:00
Marc Häfner
138c25fe5f Cleanup and extend METHOD_DEF
* Fixes #2949: Detect reserved names (not only for instance methods)
  * Don't assign names which might result in incorrect `super` calls
2013-11-12 16:53:09 +01:00
Jeremy Ashkenas
e0195756dc Merge pull request #3234 from marchaefner/issue3087
Fixes #3087 -- Use `fs.*Sync` for CLI compilation
2013-11-10 04:19:49 -08:00
Marc Häfner
96ae98fade Fixes #3087 -- Use fs.*Sync for CLI compilation
* Make `compilePath` synchronous
 * Remove unused variable
2013-11-10 08:36:29 +01:00
Nami-Doc
efb9809d3b Merge pull request #3233 from xixixao/issue2953cleanup
Clean up `Method calls on splice endpoints`
2013-11-09 16:20:13 -08:00
xixixao
0dada3dd27 Remove unnecessary type conversions to Number 2013-11-10 00:13:52 +00:00
xixixao
849c8e8ef4 Remove unnecessary existential check 2013-11-10 00:13:14 +00:00
Jeremy Ashkenas
9e9c83f788 Merge pull request #3228 from marchaefner/fixClassCompilation
Avoid unnecessary wrapping of some bound functions
2013-11-05 18:47:01 -08:00
Marc Häfner
d41d87a874 Avoid unnecessary wrapping of some bound functions 2013-11-03 03:14:13 +01:00
Jeremy Ashkenas
ab40571ffc Merge pull request #3227 from marchaefner/fixClassCompilation
Fix scope of external constructor reference / Refactor `Closure`
2013-11-01 13:08:27 -07:00
Marc Häfner
5d13d14de9 Closes #3008 -- Fix scope of constructor reference
* Make scope of `Code` nodes accessible (prior to `compileNode`)
* Use correct scope for reference of external constructor.
* Remove unreachable code.
2013-11-01 01:13:10 +01:00
Marc Häfner
1df8abf1cb Refactor closure compilation
* Break up `Closure` and merge `Closure.wrap` into `Base.compileClosure`
* Construct class closure directly in `Class.compileNode`
* Reuse `isLiteralArguments` in `Range.compileArray`
* Move all helpers to bottom of file
* Add test for #3063
2013-10-31 23:25:11 +01:00
Jeremy Ashkenas
45b60c9a52 Merge pull request #3224 from marchaefner/fixClassCompilation
Minor fixes for class compilation
2013-10-28 17:51:23 -07:00
Marc Häfner
091bc56a96 Code cleanup in Class
* Don't insert unnecessary `_ref` (in the wrong scope)
* Improve code prettiness. (Reverts most of 903e9c99)
2013-10-29 00:01:20 +01:00
Yad Smood
52789f5b19 fix: opts.polling changed to opts[watch-polling] 2013-10-27 01:04:03 +08:00
Marc Häfner
9ba1d41ec8 Fix: __extends helper above directive prologue 2013-10-26 06:54:54 +02:00
Jeremy Ashkenas
5456bd5f89 Merge pull request #3218 from marchaefner/issue3059
Escapable linebreaks in heregexes
2013-10-23 16:03:32 -07:00
Marc Häfner
0d662c3ad2 Missing parentheses 2013-10-24 00:43:29 +02:00
Marc Häfner
fa76e2dd21 Escapable linebreaks in heregexes 2013-10-24 00:36:46 +02:00
Yad Smood
08f6c65c3b mov: Change the option name --polling to --watch-polling, and only leaves the long option name.
opt: Optimize the comment of the `--watch-polling` option.
2013-10-23 00:52:40 +08:00
Jeremy Ashkenas
54840c0cbf Merge pull request #3214 from marchaefner/issue3059
Escaped whitespace and slashes in Heregexes
2013-10-22 09:35:00 -07:00
Marc Häfner
91ac3fa031 Escaped whitespace and slashes in Heregexes
* Resolves #3059: Don't remove escaped whitespace.
* Fixes #2238: Prevent escaping slashes that are already escaped.
* Fix detection of end of heregex with escaped slashes.
2013-10-22 18:08:17 +02:00
Yad Smood
2853e718f2 add: Stat polling support while fs.watch doesn't work.
Add a new cli option: -g --polling [SPAN]

    If state polling mode is enabled, use it.
    Else use the native api.

    This is useful while watching remote directory.
    Such as the `fs.watch` won't catch the SMB server's file change event.
2013-10-21 15:26:20 +08:00
Jeremy Ashkenas
c22707cd53 Fixes #2941 -- don't destroy extensionless filenames for --join 2013-10-20 19:09:55 -03:00
Jeremy Ashkenas
351c875576 merged in stricter noncallables 2013-10-20 18:49:30 -03:00
Jeremy Ashkenas
35b64d7f18 Merge pull request #3211 from marchaefner/issue2181
Fix compilation for conditional assignment
2013-10-20 14:16:38 -07:00
Jeremy Ashkenas
db87d817e8 Merge pull request #3012 from imcotton/parallel-loading
Script loading parallelized in browser
2013-10-20 14:10:40 -07:00
Jeremy Ashkenas
f3c5cc6774 Fixes #3019 - Documentation tweak to default argument meaning. 2013-10-20 18:08:28 -03:00
Marc Häfner
4cc2c305a4 Fixes #2181 -- conditional assignment as subexpression
* Parenthesize compilation of `||=` and `&&=` (when needed).
* Fix variable caching for `?=`
2013-10-20 22:59:01 +02:00
Jeremy Ashkenas
a5513c45d0 Fixes #3047 -- Fixes module.paths when running directly with no explicit passed-in files. 2013-10-20 17:50:13 -03:00
Jeremy Ashkenas
c820e0241e Fixes #3053 - error for mismatched own/for-in without an index. 2013-10-20 17:40:50 -03:00
Jeremy Ashkenas
eb2ac2c64d Fixes #3063 -- wait a moment so that an error can be raised. 2013-10-20 17:04:52 -03:00
Jeremy Ashkenas
59cf19fd1c Fixes #3072 -- tweak process.argv to match when running REPL 2013-10-20 16:53:08 -03:00
Jeremy Ashkenas
d5a25d138d Fixes #3089 -- don't mutate options passed in to compile() 2013-10-20 16:21:06 -03:00
Jeremy Ashkenas
a7ecd80c92 Merge pull request #3096 from marchaefner/issue2994
Disallow single-line `IF expr ELSE` without `THEN`
2013-10-20 12:13:39 -07:00
Jeremy Ashkenas
465cffc675 Merge pull request #3113 from mklement0/make-repl-use-global-context
Make the REPL *CLI* use the global context to be consistent with the node REPL *CLI*.
2013-10-20 09:17:07 -07:00
Jeremy Ashkenas
302a46d093 Merge pull request #3132 from caitp/issue-3132
Format block-comments better
2013-10-20 09:08:40 -07:00
Jeremy Ashkenas
392767a04e Fixes #3143 -- Potential memory leaks caused by use of fat arrow next to other (non-fat-arrow-using) long-lived closures. 2013-10-20 12:53:18 -03:00
Jeremy Ashkenas
928f949761 Fixes #3160 -- a missing bit of locationData 2013-10-20 12:15:15 -03:00
Jeremy Ashkenas
8bb833d858 Merge pull request #3165 from grschafer/master
Fix constructor_destructuring docs example to alert a defined value
2013-10-20 08:04:44 -07:00
Jeremy Ashkenas
2b03fa9077 Fixes #3166 -- add a (simpler) flag to suppress the generated header. 2013-10-20 12:03:37 -03:00
Jeremy Ashkenas
cfdb774da9 CoffeeScript REPL should be able to require coffeescript files. 2013-10-20 11:22:23 -03:00
Jeremy Ashkenas
b173a377a6 Fixes #3208. You now have to require 'coffee-script/extensions' in order to be able to auto-require CoffeeScript files. 2013-10-20 11:08:13 -03:00
Jeremy Ashkenas
581af4540a Merge pull request #3193 from celwell/master
fixed ascii art inconsistencies in coffee's water vapor
2013-10-04 04:04:10 -07:00
Christopher Elwell
18e5b6b199 fixed ascii art inconsistencies in coffee's water vapor 2013-10-03 19:02:28 -07:00
Michael Ficarra
6da2306fe2 Merge pull request #3189 from mal/issue3186
Fixes #3186
2013-09-29 07:42:36 -07:00
Mal Graty
a8e4b78803 Fixes #3186 2013-09-29 15:28:58 +01:00
Nami-Doc
a3be1f6e48 Merge pull request #3174 from a3gis/master
Accept all format of numbers in ranges
2013-09-24 11:20:57 -07:00
a3gis
89ef3d4117 accept all format of numbers in ranges 2013-09-24 19:15:31 +01:00
Jeremy Ashkenas
4cf75ec027 Forgot to update the .erb as well. 2013-09-24 09:52:00 -03:00
Jeremy Ashkenas
830c294aea Add new Packt book. 2013-09-22 14:56:33 -03:00
a3gis
bb86e54ece accept all format of numbers in ranges 2013-09-21 00:51:12 +01:00
Caitlin Potter
359e17277f Merge pull request #1 from sjorek/issue-3132
Enhancement: Add more block-comment related tests
2013-09-17 10:12:31 -07:00
Stephan Jorek
89f5f9d59d added more block-comment related tests for single-line block-comments and jsdoc-like @doctags-comments. 2013-09-17 18:09:15 +02:00
Greg Schafer
26c0f7ca2d Fix constructor_destructuring example to alert a defined value 2013-09-14 14:34:53 -05:00
Michael Ficarra
40c1086efa Merge pull request #3151 from kchmck/master
Fix some inconsistent indentation
2013-09-03 16:33:27 -07:00
Mick Koch
999a3db499 Fix some inconsistent indentation
Some places used 4 spaces instead of 2
2013-09-03 19:02:18 -04:00
Michael Klement
50e13f62f2 Merge branch 'make-repl-use-global-context' of https://github.com/mklement0/coffee-script into make-repl-use-global-context 2013-09-03 18:35:21 -04:00
Michael Klement
fceff1729c Make the REPL *CLI* use the global context so as to be consistent with the node REPL CLI.
Make the REPL *CLI* use the global context so as to (a) be consistent
with the `node` REPL CLI and, therefore, (b) make packages that modify
native prototypes (such as 'colors' and 'sugar') work as expected.

Note that, by contrast, programmatic use (`require 'repl'`) will
continue to default to a NON-global context - again, consistent with
node's behavior.
2013-09-03 18:19:43 -04:00
Michael Ficarra
1765a7ae0c Merge pull request #3150 from mklement0/fix-repl-module-global-context-support
Fix: support for consumers of the REPL *module* being able to opt into using the global context ...
2013-09-03 14:47:22 -07:00
Michael Klement
ae79ff9fa3 Merge branch 'make-repl-use-global-context' of https://github.com/mklement0/coffee-script into make-repl-use-global-context 2013-09-03 17:28:03 -04:00
Michael Klement
3e9d01d6c6 Make the REPL *CLI* use the global context so as to be consistent with the node REPL CLI.
Make the REPL *CLI* use the global context so as to (a) be consistent
with the `node` REPL CLI and, therefore, (b) make packages that modify
native prototypes (such as 'colors' and 'sugar') work as expected.

Note that, by contrast, programmatic use (`require 'repl'`) will
continue to default to a NON-global context - again, consistent with
node's behavior.
2013-09-03 17:27:13 -04:00
Michael Klement
ae4535d639 Fix: support for consumers of the REPL *module* being able to opt into using the global context via option .useGlobal.
Note that, at least for now, CoffeeScript's own REPL *CLI* still uses a
non-global context, rendering modules such as `color`, which attempt to
modify the prototypes of JavaScript primitives, ineffective. By
contrast, node's own CLI does use the global context.
2013-09-03 16:41:27 -04:00
a3gis
c5120c7980 fix exit code when using --nodejs option 2013-09-02 16:11:22 -05:00
Jeremy Ashkenas
92e83489fc Merge pull request #3146 from phillipalexander/fix-underscore-docs
Fix broken formatting in underscore.coffee docs
2013-09-02 13:33:26 -07:00
Caitlin Potter
1b7491d63d Fixes #3132 - Improve rendering of block-comments 2013-08-23 20:53:18 -04:00
Phillip Alexander
ce14ad764a Fix formatting issues in underscore.coffee documentation (generated html)
Use docco to regenerate documentation for underscore.coffee.
2013-08-20 09:57:52 -07:00
Jeremy Ashkenas
96e807c677 Improve license part of package.json ;) 2013-08-19 16:10:25 +02:00
Michael Klement
70994d4b50 Refactored inline-if into more readable multi-line statement. 2013-08-07 11:40:11 -04:00
Michael Klement
675095efbe Amended - Make the REPL *CLI* use the global context so as to be consistent with the node REPL CLI.
(My apologies: In the previous commit I accidentally made `useGlobal:
yes` the default for _programmatic_ use also, but the intent was to
only do it for the stand-alone *CLI*.)

Make the REPL *CLI* use the global context so as to (a) be consistent
with the `node` REPL CLI and, therefore, (b) make packages that modify
native prototypes (such as 'colors' and 'sugar') work as expected.

Note that, by contrast, programmatic use (`require 'repl'`) will
continue to default to a NON-global context - again, consistent with
node's behavior.
2013-08-07 08:59:27 -04:00
Michael Klement
0235d12927 Make the REPL use the global context to be consistent with the node REPL.
This will make packages that modify prototypes - e.g. 'colors', 'sugar'
- work as expected.

To verify that the `node` REPL uses the global context, execute `global
=== module.exports.repl.context`.

Note: Tests pass, except `cluster.coffee`, which, however, failed even
before these modifications.
2013-08-06 21:28:34 -04:00
Michael Ficarra
9d24a3420d Merge pull request #3111 from benbria/master
Issue #3092: Fix column numbers in sourcemaps to not be essentially random.
2013-08-06 13:52:52 -07:00
Jason Walton
3ad332d5d4 Issue #3092: Fix column numbers in sourcemaps to not be essentially random. 2013-08-06 16:25:23 -04:00
Michael Ficarra
15517df417 Merge pull request #3107 from mal/issue2957
Fork with binary of coffee-script in use, rather than global
2013-08-02 15:44:55 -07:00
Mal Graty
3c2f0d174e Use coffee binary of coffee that overrode fork
This solves two potential problems when it comes to forking:

    1) Forking will now work correctly even when `coffee` is not installed
       globally.
    2) Forking when using a locally installed version of `coffee` will fork
       using that version, and not fallback to a globally installed version.

Fixes #2957
2013-08-02 23:10:45 +01:00
Jeremy Ashkenas
8cf6f62ea4 Merge pull request #3100 from epidemian/issue3023
Fix #3023, Change how error messages are shown
2013-08-02 13:05:37 -07:00
Demian Ferreiro
9e716b310d Avoid using a getter for the compiler error's "stack" property
Instead, set the "stack" property manually when the error gets updated on re-throws.
2013-08-02 01:52:36 -03:00
Michael Ficarra
e44bf9ae81 Merge pull request #3104 from davidchambers/recompile
recompile
2013-08-01 14:17:14 -07:00
David Chambers
f5f99b3022 recompile 2013-08-01 14:14:12 -07:00
Jeremy Ashkenas
dc3d70e696 cleaning up mkdirp bit. 2013-08-01 11:12:41 -04:00
Jeremy Ashkenas
77fded3c5e Merge pull request #3101 from FredyC/master
Fixed deep directory creation for command line utility
2013-08-01 08:11:07 -07:00
FredyC
e644f7244d Using original existence check with mkdirp call on failure 2013-08-01 17:03:32 +02:00
FredyC
457cdfde26 Fixed deep directory creation for command line utility 2013-08-01 11:17:27 +02:00
Marc Häfner
910e38749c Merge removeMidExpressionNewlines into addImplicitIndentation
and rename it to `normalizeLines`
2013-07-31 22:12:44 +02:00
Demian Ferreiro
2b4a37296f Override the SyntaxError's "stack" property instead of deleting it
This makes the "stack" property more useful when it's shown on other Node.js applications that compile CoffeeScript (e.g. testing libraries) and should fix #3023. A minimal example:

    $ node -e 'require("coffee-script").compile("class class")'

    /usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:41
            throw err;
                  ^
    [stdin]:1:7: error: unexpected CLASS
    class class
          ^^^^^
2013-07-31 09:24:43 -03:00
Demian Ferreiro
3f9cdcf1fa Change how error messages are shown
Instead of throwing the syntax errors with their source file location and needing to then catch them and call a `prettyErrorMessage` function in order to get the formatted error message, now syntax errors know how to pretty-print themselves (their `toString` method gets overridden).

An intermediate `catch` & re-`throw` is needed at the level of `CoffeeScript.compile` and friends. But the benefit of this approach is that now libraries that use the `CoffeeScript` object directly don't need to bother catching the possible compilation errors and calling a special function in order to get the nice error messages; they can just print the error itself (or let it bubble up) and the error will know how to pretty-print itself.
2013-07-31 08:27:49 -03:00
Marc Häfner
4342bedd2f Fix multi-line if-else in single-line expression.
* When searching for the closing token of a single-line expression, ignore TERMINATORS that will subsequently be removed.
* Add a test.
2013-07-31 12:18:50 +02:00
Marc Häfner
fdd5796f5e Disallow single-line IF expr ELSE without THEN
* Supplement missing block before `ELSE` token only for multi-line `if`.
* Don't prematurely remove `TERMINATOR` before `ELSE` (so we can  differentiate single- and multi-line forms).
* Cleanup: Remove `WHEN` from `EXPRESSION_CLOSE`. (Only `LEADING_WHEN` tokens are preceded by a `TERMINATOR`.)
* Cleanup: Remove really old, inapplicable text from comment.
2013-07-30 19:31:46 +02:00
Jeremy Ashkenas
f48aa44386 Merge pull request #3094 from epidemian/compile-js
Update compiled JS
2013-07-29 23:17:38 -07:00
Demian Ferreiro
51c625205b Update compiled JS 2013-07-30 01:06:41 -03:00
Michael Ficarra
e581f7d2f0 Merge pull request #3051 from CaseyLeask/source-map-syntax-update
Updated the Source Maps syntax
2013-07-04 07:03:00 -07:00
Cotton Hou
3aa646e425 rebuild for PR #3012 2013-06-28 09:40:22 +08:00
Cotton Hou
92208fec44 simplify logic and changing less from before 2013-06-28 09:28:20 +08:00
Cotton Hou
cdc603c794 remove logic redundancy 2013-06-28 09:28:20 +08:00
Cotton Hou
46d8902004 parallelized script loading in browser, yet order remain 2013-06-28 09:28:20 +08:00
Casey Leask
34c1704286 Removed multi-line comment wrapping 2013-06-26 13:11:13 +00:00
Casey Leask
19767a0f10 Updated the Source Maps syntax 2013-06-26 12:34:21 +00:00
Nami-Doc
0c9f0fd099 Merge pull request #3049 from dpatti/extensions-scope
Avoid variable scope collision with extensions
2013-06-24 15:14:01 -07:00
Doug Patti
7f1088054c Avoid variable scope collision with extensions
In #3031, an extensions variable was introduced with file-level scope
that defined the filetypes that CoffeeScript can compile. However, the
Module::load patching calls findExtension() which uses a local variable
called "extensions", which was overriding the outer level one and
causing getSourceMap() to fail.
2013-06-24 18:13:04 -04:00
Nami-Doc
ef5f58e30e Merge pull request #3045 from marchaefner/master
Fix path separator issues in tests.
2013-06-22 06:04:46 -07:00
Marc Häfner
13024e6911 Fix path separator issues in tests. 2013-06-22 14:57:23 +02:00
Nami-Doc
32e8e562ea Merge pull request #3043 from imcotton/reference-check
check existence of "path" for browser execution
2013-06-21 10:08:49 -07:00
Cotton Hou
7fdac5c3b9 check existence of "path" for browser execution 2013-06-22 00:58:30 +08:00
Jeremy Ashkenas
b68fd9d76e Merge pull request #3042 from marchaefner/issue2844
Avoid excessive AST traversal in `updateLocationDataIfMissing`.
2013-06-20 22:33:50 -07:00
Marc Häfner
25c6001a6c Speed up updateLocationDataIfMissing.
* Avoid excessive search for missing `locationData`
  * Fix `locationData` for `ELSE IF`.
2013-06-21 02:47:29 +02:00
Jeremy Ashkenas
7250fdd576 Merge pull request #3031 from alexgorbatchev/stack-trace-patch-optimizations-2
Stack trace patch optimizations
2013-06-16 02:37:33 -07:00
Jeremy Ashkenas
b7f8443052 Merge pull request #3034 from marchaefner/baseIndent
Better handling of initial indent at file start.
2013-06-16 02:35:06 -07:00
Marc Häfner
4fd5e9a3ab Better handling of initial indent at file start.
* Detect initial indentation before the first token and enforce it.
  * Don't add `INDENT` token (or the matching `OUTDENT, TERMINATOR`).
2013-06-14 00:28:45 +02:00
Alex Gorbatchev
3785996c44 Made stack patch test less brittle. 2013-06-13 13:50:05 -07:00
Alex Gorbatchev
eb0a222eea Using more standard convention for patched stack line numbers. 2013-06-13 12:58:04 -07:00
Alex Gorbatchev
3d761e73e3 Removed unnecessary source map generation during require() and made stack line number patching on by default. 2013-06-13 12:54:20 -07:00
Alex Gorbatchev
cc3b4e8080 Removed not used variable. 2013-06-13 12:23:06 -07:00
Michael Ficarra
ba7cb3ab69 fix #3029 2013-06-13 13:38:13 -05:00
Michael Ficarra
054443c46e rebuild #3029 2013-06-13 13:35:40 -05:00
Jeremy Ashkenas
c8dae22cb0 Merge pull request #3029 from wangxian/master
fix block comment format "\n"
2013-06-13 10:55:52 -07:00
木頭
183ec48308 fix block comment 2013-06-13 07:44:17 +08:00
Jeremy Ashkenas
13187b0199 Merge pull request #2856 from epidemian/issue2849
Fixes #2849: use correct filename and code in require()d sources
2013-06-09 00:40:18 -07:00
Demian Ferreiro
3c880bf601 Move a try/catch from compile to loadFile
This try/catch should only be necessary for dynamically loaded files. Also added a lengthier explanation of why this try/catch is needed.
2013-06-09 02:54:34 -03:00
Demian Ferreiro
8e90aaefc1 Merge branch 'master' into issue2849
Conflicts:
	lib/coffee-script/coffee-script.js
	src/coffee-script.coffee
2013-06-09 02:40:53 -03:00
Michael Ficarra
426ae97e49 Merge pull request #3014 from mset/master
base path for compilation can be './' as well as '.'
2013-06-03 06:27:38 -07:00
Marek Setnicka
f277a43645 Bug fix. When coffee is invoked with the -c parameter and './' value, first two characters of the directory into which the compiled files are stored get chopped off.
Example: if compilation invoked like this: 'coffee -o ../lib/ -cw ./', then
Source file: ./OutputFolder/file.coffee, compiled output: ./../lib/tputFolder/
The code only expected '.' to mark the local folder. However, './' is equally valid.
2013-06-03 13:51:26 +01:00
Jeremy Ashkenas
2e408648aa renaming import test files to avoid risking the disfavor of .gitignore 2013-06-02 10:57:18 +04:00
Jeremy Ashkenas
f2f10e85a8 Revert "remove cake build:ultraviolet"
This reverts commit 2e6a781014.
2013-06-02 09:45:11 +04:00
Jeremy Ashkenas
84b8b5ccee CoffeeScript 1.6.3 2013-06-02 09:37:45 +04:00
Jeremy Ashkenas
7b14a6aad2 Fixing browser build boilerplate. 2013-06-02 09:21:36 +04:00
Jeremy Ashkenas
342306587c Removing out of date testing cruft 2013-06-02 09:13:16 +04:00
Jeremy Ashkenas
3298c9caad merge 2013-06-02 09:10:16 +04:00
Jeremy Ashkenas
7089b02a74 Merging in a monkey-patching of Module::load, unfortunately. 2013-06-02 09:03:54 +04:00
Jeremy Ashkenas
bd451800bf Merge pull request #3000 from sgentle/require-extensions
Patch module.prototype.load to enable multiple extensions like .coffee.md
2013-06-01 21:44:02 -07:00
Jeremy Ashkenas
5e06f7e859 Removing Ultraviolet workaround 2013-06-02 07:50:03 +04:00
Michael Ficarra
0f5ae54014 Merge pull request #2930 from marchaefner/Issue1057
Fixes #1057: Allow catch/finally in single line functions.
2013-05-31 14:56:04 -07:00
Michael Ficarra
5496a189bc fixes #2934 2013-05-31 16:51:30 -05:00
Michael Ficarra
2e6a781014 remove cake build:ultraviolet 2013-05-31 15:49:48 -05:00
Michael Ficarra
b85cf5355f Merge pull request #2085 from stepheneb/ruby-1-9-generate-coffeescript-syntax
rake task creates/installs coffeescript.syntax
2013-05-31 13:48:22 -07:00
Jeremy Ashkenas
f038d0514a Merge pull request #2984 from xixixao/literatetest
Fixes tabbed code test in literate
2013-05-26 04:08:01 -07:00
Jeremy Ashkenas
7c4128ee3b Merge pull request #3002 from Nami-Doc/issue3001
Disallowed `for own in`
2013-05-26 03:43:22 -07:00
Sam Gentle
012e3c019c fix style problems part 3 2013-05-26 15:59:49 +10:00
Nami-Doc
b3ffd25339 Disallowed for own in 2013-05-26 00:29:26 +02:00
Sam Gentle
46a0dc6dce Didn't mean to commit testsymlink 2013-05-26 02:33:11 +10:00
Sam Gentle
30b2af820a Early exit + refactor findExtension 2013-05-26 02:17:34 +10:00
Sam Gentle
e7d01b903f New tests for module importing 2013-05-26 02:09:52 +10:00
Sam Gentle
e4407dd73c fix style problems part 2 2013-05-26 00:50:18 +10:00
Sam Gentle
2fd956d8d4 fix style problems 2013-05-26 00:10:07 +10:00
Sam Gentle
c0aac8e598 use helpers.isCoffee in test runner 2013-05-26 00:04:18 +10:00
Sam Gentle
d46a44ac48 Patch node module loader to handle multiple extensions - fixes #2928 & #2855 2013-05-25 23:22:27 +10:00
Sam Gentle
9b1bdd4b36 Add test for .coffee.md loading 2013-05-25 23:06:44 +10:00
Michal Srb
fd47920c63 Fixes tabbed code test in literate 2013-05-15 10:30:20 +01:00
Michael Ficarra
088b8b3ec5 Merge pull request #2978 from pushrax/master
Fix 'propeties' typo in docs
2013-05-08 17:44:53 -07:00
Justin Li
afd9b44dea Fix 'propeties' typo in docs 2013-05-08 15:57:46 -04:00
In-Ho Yi
b54db2ea07 keep track of source map information for require()d coffee files 2013-04-29 17:06:22 +10:00
Michael Ficarra
3650d6eb4e Merge pull request #2933 from marchaefner/master
Fix implicit calls with preceding herecomment
2013-04-28 21:07:52 -07:00
Marc Häfner
05b74f3743 Merge remote-tracking branch 'refs/remotes/upstream/master' 2013-04-29 05:27:13 +02:00
Michael Ficarra
174cd7eaa0 rebuild for some unneccessary parentheses changes
rebuild of 3921e3db34
2013-04-28 22:09:46 -05:00
Nami-Doc
3921e3db34 Merge pull request #2965 from Nami-Doc/style-cleanup1
Style cleanup
2013-04-28 16:20:53 -07:00
Nami-Doc
63bc7fe354 final style edits 2013-04-29 01:19:24 +02:00
Nami-Doc
ba01e36cc2 partly revert 7be996c 2013-04-28 22:34:56 +02:00
Marc Häfner
40d2761bd8 Fixes #2916 -- implicit calls with preceding herecomment 2013-04-28 10:30:03 +02:00
Nami-Doc
4ff7fef3bb remove jsl config file and the doc line about it 2013-04-28 00:58:34 +02:00
Nami-Doc
7be996c010 code cleanup 2013-04-28 00:56:44 +02:00
Michael Ficarra
f4332475b5 Merge pull request #2963 from Nami-Doc/lint-flag-removal
Lint flag removal
2013-04-27 15:13:38 -07:00
Nami-Doc
4da00e8296 Fix docs : modify source file instead of built file 2013-04-27 20:55:37 +02:00
Nami-Doc
e8fae286be remove --lint. #2894 : rebuild and fix docs 2013-04-27 19:35:32 +02:00
Nami-Doc
f451bb5f61 Merge pull request #2894 from billymoon/master
Literate flag
2013-04-27 10:29:03 -07:00
Billy Moon
d8d7495767 give the -l flag to literate
remove `-l` from lint, allowing it to be used for literate
2013-04-27 10:42:10 +03:00
Michal Srb
e7ebdce60f Fix #2953. Method calls on splice endpoints 2013-04-23 05:42:37 +02:00
Michal Srb
fd61476106 Fix #1069. Non-callable literals shouldn't compile 2013-04-23 04:28:45 +02:00
Michael Ficarra
4b4f6ac222 Merge pull request #2951 from xixixao/issue1437
Fix #1437. Unneeded ref in existential assignment.
2013-04-22 13:04:32 -07:00
Michal Srb
7b9699c5fa Fix #1437. Unneeded ref in existential assignment. 2013-04-22 21:58:49 +02:00
Jeremy Ashkenas
8a59558e2d Merge pull request #2946 from Nami-Doc/issue2944
Fix #2944
2013-04-21 08:15:15 -07:00
Nami-Doc
5162472f16 Fix REPL when env.HOME isn't available - #2945 2013-04-21 16:03:30 +02:00
Nami-Doc
1917bb69ed Fix #2944 2013-04-21 12:33:00 +02:00
Michael Ficarra
3b38153759 Merge pull request #2940 from jiangmiao/issue2908
Fixes #2908, add "\n" between pure literal header and function body.
2013-04-20 12:03:25 -07:00
Michael Ficarra
e06a17d929 Merge pull request #2943 from bobbydavid/master
fix warning in REPL tests about memory leak.
2013-04-20 12:00:37 -07:00
Robert Martin
71aea4b862 Fix bug in REPL where history file was closed late.
The history file was set to close on process exit, when it
should close on REPL exit. Listening to the process exit
event causes a warning when more than 10 CoffeeScript REPL
instances are opened in the same program, which happens in
the test.
2013-04-20 14:49:54 -04:00
Nami-Doc
4b4818d819 Fix missing ` `` - #2926 2013-04-20 00:11:29 +02:00
Michael Ficarra
c785e00a15 Merge pull request #2929 from lucasb-eyer/master
Keep a single-line herecomment as a single-line js comment.
2013-04-15 13:12:43 -07:00
Michael Ficarra
c6398e16b1 Merge pull request #2925 from marchaefner/master
Fix error reporting for invalid object key.
2013-04-15 13:07:16 -07:00
lucasb-eyer
ccc7c4404d Keep the js comment on a single line if the herecomment is on a single line. 2013-04-15 21:45:55 +02:00
Marc Häfner
69d66a1d4d Fixes #1057: Allow catch/finally in single line functions.
* Don't end single-line functions at `catch` or `finally`.
* Remove unused `IMPLICIT_BLOCK` and superfluous test for `IF`.
2013-04-15 20:20:52 +02:00
Marc Häfner
af81f6de70 Fix error reporting for invalid object key. 2013-04-12 18:10:26 +02:00
Jeremy Ashkenas
f21dc7a96e Merge pull request #2924 from marchaefner/master
Parameter-less catch clause.
2013-04-12 08:57:01 -07:00
Marc Häfner
cf07fcb4b1 #2900 -- parameter-less catch clause.
Plus some minor cleanup after f8c6b494aa
2013-04-12 17:50:45 +02:00
Jeremy Ashkenas
740a7bcb45 Merge pull request #2914 from danielgtaylor/repl-history
repl history implementation improvements
2013-04-07 21:47:16 -07:00
Daniel G. Taylor
0e2d2ea637 Move lastLine setter into conditional block to prevent .commands and blank lines from setting lastLine 2013-04-07 11:28:59 -07:00
Daniel G. Taylor
feaea49eac Replace large comprehension with much simpler code; fix comment to reference maxSize instead of previous 10KB limit; only pop a history entry if the file size is actually bigger than maxSize; only add items to the history if they are different from the last item by storing the last line and loading it on startup. 2013-04-06 22:10:08 -07:00
Jeremy Ashkenas
170f311101 Merge branch 'master' of https://github.com/jashkenas/coffee-script 2013-04-06 09:31:30 +08:00
Jeremy Ashkenas
0cadcdc097 Fix regression with executable class bodies and prototypal attachment. 2013-04-06 09:31:24 +08:00
Miao Jiang
337ebd3ce9 Fixes #2908, add "\n" between pure literal header and function body. 2013-04-05 13:20:59 +08:00
Billy Moon
5d5920c5d0 Literate flag
Add `-L` or `--literate` command line flags (lowercase `l` is already taken) to allow literate coffee script to be read in from `stdio`
2013-03-28 10:28:12 +03:00
Jeremy Ashkenas
8be65dee93 Merge pull request #2886 from danielgtaylor/repl-history
Add history to the coffee interactive interpreter that persists between ...
2013-03-27 15:55:15 -07:00
Daniel G. Taylor
4dbd9dc264 Pop off partial line if input history file was truncated; make maximum input history file size configurable via repl start options 2013-03-25 20:50:56 -07:00
Daniel G. Taylor
2d0e45c46d Use string interpolation for .history command; rename out variable to history an store the history in it as an array in the proper order so that printing it is just a join operation 2013-03-25 20:34:04 -07:00
Demian Ferreiro
d57b1aab10 Add power operator to the list of tokens that force a line continuation if they appear at the end of a line 2013-03-25 20:41:14 -03:00
Michael Ficarra
cc84d6ea67 Merge pull request #2890 from Nami-Doc/issue2846
fix #2846
2013-03-25 11:14:07 -07:00
Nami-Doc
53a5f26430 fix #2846 2013-03-25 18:56:24 +01:00
Daniel G. Taylor
a1ff4ae7b8 Use separate variable for fd used to read history file; use string interpolation to print code lines; do not use unit test to remove temporary file and instead use a process exit event handler 2013-03-25 09:49:59 -07:00
Daniel G. Taylor
3251efa9c6 Add unit test to read and run a line from the interpreter history file and remove the dummy history file after tests have completed. 2013-03-25 08:47:34 -07:00
Daniel G. Taylor
17a1cdb2cf Make history file optional and configurable via the opts passed to repl.start 2013-03-25 08:46:40 -07:00
Daniel G. Taylor
1643f7df7a Remove explicit catch that did nothing 2013-03-25 07:49:25 -07:00
Daniel G. Taylor
3c0344b954 Rebuild to remove debugging log statement 2013-03-25 07:28:55 -07:00
Demian Ferreiro
22e8856b4d Add floor division // and modulo %% operators, and compound forms of the new operators
Also kill the empty regex :(
2013-03-25 03:19:05 -03:00
Daniel G. Taylor
9bfafb88cb Add history to the coffee interactive interpreter that persists between sessions using a ~/.coffee_history file in a similar way to bash. Code based on repl.history and Node pull request 3178 with modifications. 2013-03-24 22:44:35 -07:00
Demian Ferreiro
08b59aef8a Make power operator have higher precedence than unary operators: +, -, ~, ! 2013-03-25 00:05:04 -03:00
Demian Ferreiro
fbc019171c Make power operator compilation use proper AST nodes 2013-03-25 00:02:21 -03:00
Demian Ferreiro
e237abff84 Merge branch 'power-operator' of git://github.com/charliesome/coffee-script into more-math-operators
Conflicts:
	src/nodes.coffee
	test/operators.coffee
2013-03-24 22:47:46 -03:00
Michael Ficarra
718224f99a Merge pull request #2867 from hden/2853
encode unicode src, test added
2013-03-24 12:17:10 -07:00
Demian Ferreiro
c0d1f22487 Add test for compiler errors on require()d files 2013-03-21 03:11:31 -03:00
Hao-kang Den
b2d6997eff encode unicode src, test added 2013-03-21 09:04:23 +08:00
Michael Ficarra
e26f982c24 Merge pull request #2869 from marchaefner/master
Fix Windows path separator issue in `baseFileName`.
2013-03-20 17:25:54 -07:00
Marc Häfner
1b2fe69a18 Fix Windows path separator issue in baseFileName.
Windows accepts forward and backward slashes as path separator.
2013-03-20 22:38:29 +01:00
Jeremy Ashkenas
c159a64b58 Merge pull request #2865 from hden/inline
quick-fix
2013-03-20 00:46:32 -07:00
Hao-kang Den
e091c9d6b4 quick-fix with a different approach 2013-03-20 15:23:33 +08:00
Demian Ferreiro
67fd84fc1d Fixes #2849: now the compilation errors thrown by CoffeeScript.compile will include the correct filename and source code information 2013-03-19 04:27:34 -03:00
Jeremy Ashkenas
57d3cfd67f Merge pull request #2851 from toots/master
More explicit window context.
2013-03-18 18:52:31 -07:00
Romain Beauxis
6dd61626d2 Rebuild. 2013-03-18 14:16:05 -05:00
Romain Beauxis
1e99f887e7 More explicit window context in src/browser.coffee. 2013-03-18 11:16:26 -05:00
Jeremy Ashkenas
78d10f30a0 removing sourceColumn reset 2013-03-18 21:50:40 +08:00
Jeremy Ashkenas
7f0610d0bd better docs for source maps 2013-03-18 19:46:43 +08:00
Jeremy Ashkenas
4bef435e0e better docs for source maps 2013-03-18 19:46:30 +08:00
Jeremy Ashkenas
194baa0bd7 better docs for source maps 2013-03-18 19:46:19 +08:00
Jeremy Ashkenas
c8b8beb500 slimming SourceMap slightly further 2013-03-18 19:36:34 +08:00
Jeremy Ashkenas
6786bab2ba Big refactor of SourceMap class. Literate CoffeeScript. Purdy. 2013-03-18 19:23:05 +08:00
Jeremy Ashkenas
566a7dabb2 Fixing erroneous whitespace fix in generated JS 2013-03-18 17:47:55 +08:00
Jeremy Ashkenas
a3e8de338a CoffeeScript 1.6.2 2013-03-18 13:06:33 +08:00
Jeremy Ashkenas
4f815ea978 Fixes #2737, fix fork() for both .js and .coffee, revised. 2013-03-18 11:46:54 +08:00
Michael Ficarra
417008a030 be a little more descriptive, as per @epidemian's suggestion 2013-03-17 21:53:46 -05:00
Michael Ficarra
84c44c0099 small stylistic change and optimisation to code from #2847 2013-03-17 21:50:20 -05:00
Jeremy Ashkenas
2d6a856d61 Merge pull request #2847 from hden/browser-source-map
Browser source map
2013-03-17 19:39:36 -07:00
Hao-kang Den
011d7dc245 better naming by @michaelficarra 2013-03-18 10:23:33 +08:00
Hao-kang Den
b2aa1798b1 safer browser check 2013-03-18 09:31:12 +08:00
Hao-kang Den
5fb047930e fixed lineno 2013-03-18 09:31:12 +08:00
Hao-kang Den
c24e957f17 use btoa as base64 encoder, inspired by @ashtuchkin 2013-03-18 09:31:12 +08:00
Jeremy Ashkenas
fd0b1ffc4d Fixes #2478 -- mention js2coffee in docs 2013-03-17 19:34:00 +08:00
Jeremy Ashkenas
0bfe6394a4 whitespace 2013-03-17 19:31:06 +08:00
Jeremy Ashkenas
9d025df9e3 Merge pull request #2827 from hden/lineno
Lineno
2013-03-17 04:29:44 -07:00
Jeremy Ashkenas
2f5b11b295 Fixes #2555 2013-03-17 19:27:16 +08:00
Jeremy Ashkenas
c44826acc7 Merge pull request #2838 from marchaefner/master
Improve literal mode.
2013-03-17 03:49:06 -07:00
Jeremy Ashkenas
4386f2abc7 Merge pull request #2840 from MattKunze/windows_paths
fix path handling on Windows
2013-03-17 03:09:28 -07:00
Matt Kunze
f217a10721 fix path handling on Windows 2013-03-15 16:13:04 -06:00
Marc Häfner
b8d695a4e1 Compiled JavaScript files for improved literal mode. 2013-03-15 03:26:12 +01:00
Marc Häfner
44c2b4aa7f Test case for literal mode: Code blocks must be preceded by blank line. 2013-03-15 03:23:09 +01:00
Marc Häfner
52ca531b7c Improve literate mode.
* Expect a blank line as delimiter between text and code (#2821).
* Don't change indentation of code. It is not necessary and leads to
  erroneous locationData. (#2835)
* Don't modify blank lines and reverse the change in the lexer.
* Don't ignore indentation with mixed whitespace.
2013-03-15 00:17:10 +01:00
Hao-kang Den
d4254a40a9 Apply modifications by @jwalton 2013-03-14 08:36:07 +08:00
Hao-kang Den
052e3cc8eb found a linear shift of lineno, dirty patch for now
It seems that js -> coffee line mapping has a linear shifting.
Dirty patch by applying linear correction.
Dumb, but maybe a hint.
2013-03-14 08:36:07 +08:00
Jeremy Ashkenas
56413ba3b4 Merge pull request #2817 from epidemian/keep-repl-running
Keep REPL running on runtime errors
2013-03-13 01:56:33 -07:00
Jeremy Ashkenas
71bb6108fb Merge pull request #2819 from hden/fix-path
Quick fix for node v0.10 path
2013-03-13 01:03:57 -07:00
Hao-kang Den
7d08dbb86c build 2013-03-13 16:00:57 +08:00
Hao-kang Den
a8b65565dd roll back to options.filename 2013-03-13 15:58:39 +08:00
Jeremy Ashkenas
54258e441d Merge pull request #2826 from epidemian/bump-engines-node
Bump engines.node version on package.json to 0.8
2013-03-13 00:40:56 -07:00
Michael Ficarra
4ac223b684 minor cleanup of parent commit 2013-03-12 21:11:48 -05:00
Michael Ficarra
707655daef Merge pull request #2824 from iamwilhelm/master
added warning that repl needs node.js >= 0.8
2013-03-12 18:46:19 -07:00
Wil Chung
70e83030a7 added warning that we need node 0.8+ to run repl
remove unnecessary parens and else statement in repl

we do this by convention of the main coffee source

fix: exit should be process.exit

compiled and build full
2013-03-12 18:28:48 -07:00
Demian Ferreiro
9787ce543d Bump engines.node version on package.json to 0.8 2013-03-12 21:46:48 -03:00
Hao-kang Den
22595424a8 manually add the newline at EOF 2013-03-12 21:28:48 +08:00
Hao-kang Den
601189ea2d Merge branch 'fix-path' of https://github.com/hden/coffee-script into fix-path 2013-03-12 20:54:12 +08:00
Hao-kang Den
d3263dc35b fix node v0.10 path 2013-03-12 20:53:13 +08:00
Jeremy Ashkenas
e1c6b083f8 Merge pull request #2820 from hden/source-maps-in-node
Source maps in node
2013-03-12 05:35:39 -07:00
Michael Ficarra
f56f5f234e @epidemian typo 2013-03-12 15:32:52 +08:00
Demian Ferreiro
4ca6da4a95 Add REPL scoping tests 2013-03-12 15:32:52 +08:00
Demian Ferreiro
b0cbd90e64 Fixes #1829. Preserve variable scope in the REPL 2013-03-12 15:32:52 +08:00
Hao-kang Den
9b6772a390 accept override 2013-03-12 15:29:13 +08:00
Hao-kang Den
b7f0653a0e port patchStackTrace from Redux 2013-03-12 15:29:13 +08:00
Demian Ferreiro
45bcd9fa2f Keep REPL running on runtime errors 2013-03-11 23:58:00 -03:00
Michael Ficarra
20d98c7106 @epidemian typo 2013-03-11 21:48:21 -05:00
Michael Ficarra
5ec658c55d Merge remote-tracking branch 'epidemian/issue1829' 2013-03-11 21:47:19 -05:00
Hao-kang Den
64301d0d08 fix node v0.10 path 2013-03-12 09:09:07 +08:00
Demian Ferreiro
119ec16e5e Add REPL scoping tests 2013-03-11 20:16:48 -03:00
Jeremy Ashkenas
decc0f18fc Merge pull request #2814 from epidemian/issue1829
Fixes #1829. Preserve variable scope in the REPL
2013-03-11 16:15:34 -07:00
Demian Ferreiro
5a004425ca Fixes #1829. Preserve variable scope in the REPL 2013-03-11 19:52:18 -03:00
Jeremy Ashkenas
69f6500ba9 rebuilt source code documentation with new version of Docco. 2013-03-11 11:37:22 +08:00
Jeremy Ashkenas
97980ffc7f Merge pull request #2723 from epidemian/improved-error-messages
Improved error messages
2013-03-10 16:46:25 -07:00
Demian Ferreiro
f0fcf4aee0 Merge branch 'master' of git://github.com/jashkenas/coffee-script into improved-error-messages
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/command.js
	lib/coffee-script/helpers.js
	lib/coffee-script/lexer.js
	lib/coffee-script/nodes.js
	lib/coffee-script/repl.js
	src/coffee-script.coffee
	src/command.coffee
	src/helpers.coffee
	src/lexer.coffee
	src/nodes.coffee
	test/helpers.coffee
2013-03-10 20:29:36 -03:00
Michael Ficarra
838e5e1163 Merge pull request #2810 from SonicHedgehog/master
Fix typo in documentation
2013-03-10 11:58:01 -07:00
Jakob Krigovsky
af0bdae675 Fix typo in documentation 2013-03-10 19:09:03 +01:00
Jeremy Ashkenas
0d45287057 Fixes #2808. Remove --require flag. 2013-03-10 17:17:04 +08:00
Demian Ferreiro
09f8df9640 Add check for end of input on parseError handler 2013-03-10 00:30:27 -03:00
Jeremy Ashkenas
dbb99f31a7 Reverting #2490 2013-03-10 07:21:00 +08:00
Jeremy Ashkenas
c7da623d4b #2490. A bit more of the style. 2013-03-10 06:55:52 +08:00
Jeremy Ashkenas
b44435ab8a #2490 -- implementing a conditional in terms of the guard style. 2013-03-10 06:44:45 +08:00
Jeremy Ashkenas
c53df12ec1 disallow multiple else blocks in if/guard syntax 2013-03-09 15:44:45 +08:00
Jeremy Ashkenas
13fae12f69 Fixes #2490 -- adding guard-style if blocks 2013-03-09 10:40:37 +08:00
Jeremy Ashkenas
0120db0efc Merge pull request #2803 from benbria/master
Rework source map files and paths
2013-03-08 07:19:48 -08:00
Jason Walton
c4f50b52d7 Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/coffee-script/helpers.js
	test/helpers.coffee
2013-03-08 10:17:47 -05:00
Jason Walton
242f397bfa Remove dead variables. 2013-03-07 21:30:04 -05:00
Jason Walton
f85d19b459 Rework API for sourcemap filenames and paths. 2013-03-07 21:26:09 -05:00
Jeremy Ashkenas
8f7f3627e0 Fixes #2796, by adding a test for it. 2013-03-07 23:13:22 +13:00
Jeremy Ashkenas
8b134cf348 Add an additonal test, courtesy @matehat 2013-03-07 23:10:39 +13:00
Jeremy Ashkenas
67de35ff29 Fixes #2781, fixes #2782. Reverting to old method of instance method binding. 2013-03-07 23:09:32 +13:00
Jeremy Ashkenas
774ee6a554 merge 2013-03-07 22:59:23 +13:00
Jeremy Ashkenas
4be4ea3623 Merge pull request #2795 from fahad19/master
Fix: compiling `coffee.coffee` produces `.js` file.
2013-03-07 01:30:07 -08:00
Fahad Ibnay Heylaal
18fec7e202 tests for baseFileName helper for files with only coffee-script extensions as the file name. 2013-03-07 10:23:36 +06:00
Fahad Ibnay Heylaal
072df5ecc9 more test coverage for baseFileName helper. 2013-03-07 10:15:01 +06:00
Fahad Ibnay Heylaal
4d7151aa5d fix: compiling coffee.coffee produces .js file. 2013-03-07 03:41:34 +06:00
Jason Walton
185b2ce632 Code inspect fixes from the inimitable Nami-Doc 2013-03-06 16:26:34 -05:00
Jason Walton
ce6772f2be Better fix for sourceRoot and relative path for .coffee files in source maps. 2013-03-06 15:45:47 -05:00
Jason Walton
d6e1a979e4 Fix sourceRoot and relative path for .coffee files in generated source maps. 2013-03-06 11:05:57 -05:00
Jeremy Ashkenas
de8ec2beb0 Fixes #1066 -- interpolated strings are not implicit funcs 2013-03-05 21:28:29 +13:00
Demian Ferreiro
342a796cc0 Remove column number from online editor error box 2013-03-05 05:16:29 -03:00
Jeremy Ashkenas
355754ed20 Fixes #1055 -- disallow invalid keys in object literals ... but allow them where the implicit object is being used as a class defn' or a destructuring 2013-03-05 21:10:56 +13:00
Jeremy Ashkenas
fbe07f1fce Removing debugging source location output from --nodes. It shouldn't have snuck in there. 2013-03-05 20:50:03 +13:00
Jeremy Ashkenas
304432c197 Merge pull request #2417 from gabehollombe/doc_for_switch_with_no_control_expression
Documentation for switch statements with no control expression
2013-03-04 22:27:38 -08:00
Demian Ferreiro
5da7f6a488 Get rid of CompilationError and instead have a couple of functions on helpers.coffee 2013-03-05 01:13:46 -03:00
Jeremy Ashkenas
f8c6b494aa Fixes #2422 -- Catch clause scoping plus old IE 2013-03-05 16:13:22 +13:00
Jeremy Ashkenas
1b573412d3 cleaning up the previous merge -- moving it out to helpers.invertLiterate 2013-03-05 15:45:57 +13:00
Demian Ferreiro
b400047045 Merge branch 'master' of git://github.com/jashkenas/coffee-script into improved-error-messages
Conflicts:
	Cakefile
	lib/coffee-script/coffee-script.js
	lib/coffee-script/command.js
	lib/coffee-script/nodes.js
	lib/coffee-script/repl.js
	src/coffee-script.coffee
	src/helpers.coffee
	src/nodes.coffee
	src/repl.coffee
2013-03-04 23:42:47 -03:00
Jeremy Ashkenas
51b1affbc5 Merge pull request #2776 from mintplant/fix-2768
Fix #2768: support --join'ing mixed literate and non-literate CoffeeScript source files
2013-03-04 18:39:30 -08:00
Jeremy Ashkenas
903e9c994c Fixes #2773 -- tricky dependency ordering when overriding bound functions. 2013-03-05 15:35:02 +13:00
Michael Smith
fca68717ff Fix #2768: rewrite literate code before the join 2013-03-04 18:30:24 -08:00
Michael Ficarra
22d6a4b255 Merge pull request #2770 from benbria/master
Move sourceMappingURL to bottom of generated JavaScript file.
2013-03-04 17:45:16 -08:00
Jeremy Ashkenas
26102a0970 Merge pull request #2772 from marchaefner/master
Minor improvements for locationData of tokens and some clean up.
2013-03-04 17:43:09 -08:00
Jason Walton
add84bfddc Add multiline horrible kludge for IE 2013-03-04 19:08:33 -05:00
Marc Häfner
dcd74d3e59 Clean up unused parameter. 2013-03-05 01:02:16 +01:00
Jason Walton
2684737b66 Move sourceMappingURL line to bottom of file 2013-03-04 18:43:49 -05:00
Marc Häfner
74181c0ec0 Improve locationData of implicit object braces.
Set location of generated left brace to start of content, so the corresponding AST nodes don't span preceding spaces, blank lines or comments.
2013-03-05 00:12:51 +01:00
Marc Häfner
ebff9fbc31 Exclude preceding newlines from INDENT tokens.
Produces more meanignful locationData.
2013-03-05 00:03:08 +01:00
Marc Häfner
97a41adf0c Fix location of tokens with no length
by actually using the computed offset.
2013-03-05 00:01:17 +01:00
Jeremy Ashkenas
eef83a9fcb CoffeeScript 1.6.1 2013-03-05 11:07:16 +13:00
Jeremy Ashkenas
b62a90d54c Fixes #2765 -- incorrect line number in mappings 2013-03-05 10:49:47 +13:00
Jeremy Ashkenas
b2ef77d92e refactoring to a baseFileName that can work in the browser, for later 2013-03-05 10:40:39 +13:00
Jeremy Ashkenas
b2b801a78b Fixes #2766 -- incompatible line number API 2013-03-05 10:19:21 +13:00
Jeremy Ashkenas
b4c12f6746 Fixing lingering brain fart. Inexcusable. 2013-03-05 09:23:50 +13:00
Jeremy Ashkenas
a4cc15c95c Merge pull request #2763 from matthewwithanm/source-map-fix
Fix Source Map Generation for 1.6.0
2013-03-04 12:09:26 -08:00
Matthew Tretter
3c42a8e01c Update compiled version 2013-03-04 15:07:20 -05:00
Matthew Tretter
4a94a9fbd1 Fix source map generation
Small typo fix (:
2013-03-04 14:57:56 -05:00
Jeremy Ashkenas
9f614fedec CoffeeScript 1.6.0 2013-03-05 08:19:08 +13:00
Demian Ferreiro
9ea4268b92 Make duplicate param name errors mark the actual duplicate parameter
Before:

    coffee> foo = (bar, baz, bar, qux) ->
    repl:1:7: error: multiple parameters named 'bar'
    foo = (bar, baz, bar, qux) ->
          ^^^^^^^^^^^^^^^^^^^^^^^

Now:

    coffee> foo = (bar, baz, bar, qux) ->
    repl:1:18: error: multiple parameters named 'bar'
    foo = (bar, baz, bar, qux) ->
                     ^^^

Also works with destructuring parameters and what have you.
2013-03-04 15:39:03 -03:00
Jeremy Ashkenas
e417a0ca6f Reverts 56fe211b79 2013-03-05 07:38:41 +13:00
Jeremy Ashkenas
75769503ff Renaming --maps option to --map for consistency. 2013-03-05 07:29:46 +13:00
Demian Ferreiro
589d67d8b7 Remove a couple of TODOs (WONTDOs really) 2013-03-04 13:11:34 -03:00
Demian Ferreiro
3127e76f4b Integrate error messages on the site editor
Nothing really fancy here; mostly preserves the old format. Maybe if we had a more full-fledged test editor we could show the errors in-line =D

  Also, i couldn't get the `rake doc` task running properly, so i mostly test this editing the index.html directly (ups!).
2013-03-04 13:00:25 -03:00
Jason Walton
979e110a84 Minor API changes. 2013-03-04 09:45:25 -05:00
Jason Walton
96785872cd Merge remote-tracking branch 'upstream/master' into sourcemaps
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/command.js
	lib/coffee-script/nodes.js
	src/coffee-script.coffee
	src/command.coffee
	src/nodes.coffee
2013-03-04 09:25:55 -05:00
Jason Walton
ee71b9143f Remove PARANOID flag. 2013-03-04 09:11:34 -05:00
Troels Nielsen
37a6ea63b1 #2757, Allow non-significant commas at end of nested implicit objects 2013-03-04 12:55:15 +01:00
Jeremy Ashkenas
56fe211b79 Fixes #2455 -- condition should know what variables the body has declared. 2013-03-04 23:33:50 +13:00
Jeremy Ashkenas
cf11a570e9 Fixes #2489, fixes #1819, fixes #1821 -- remove the __bind helper. 2013-03-04 23:11:38 +13:00
Jeremy Ashkenas
9fe0e711d6 Fixes #2502 -- improper compilation with parenthesized inner value of instance properties in a class body. 2013-03-04 22:26:55 +13:00
Jeremy Ashkenas
b3452c1276 Fixes #2508 -- existential access of the prototype. 2013-03-04 22:07:47 +13:00
Jeremy Ashkenas
47f0ea69b8 Fixes #2749. Restricting to instance methods in class bodies, where it actually has a chance in hell of calling the correct thing. 2013-03-04 21:26:01 +13:00
Jeremy Ashkenas
667b96b495 Fixes #2750 -- clarify error message 2013-03-04 21:17:26 +13:00
Jeremy Ashkenas
3b25aea168 When printing out --tokens, hide the location data. 2013-03-04 20:54:45 +13:00
Demian Ferreiro
0affb4f936 Integrate error messages on the REPL 2013-03-03 22:08:41 -03:00
Michael Ficarra
8435df29c6 Merge pull request #2752 from marchaefner/master
Fix line number mismatch when first line is indented.
2013-03-03 16:21:49 -08:00
Demian Ferreiro
55c99dfaec Show colorized error messages 2013-03-01 22:42:26 -03:00
Michael Smith
c98fae59fc Patch child_process.fork to run .coffee files 2013-03-01 16:19:05 -08:00
Marc Häfner
3c38a34ab2 Fix line numbers when first line is indented.
* Offset @chunkLine for inserted line break.
* Avoid line break insertion for blank lines.
2013-03-01 21:30:07 +01:00
Jason Walton
ad7dcbc797 Change some more "!"s to "not"s. Make spacing consistent after periods in commnets. 2013-03-01 11:36:48 -05:00
Jason Walton
ad0306b00c Change compileWithSourceMap() so it returns an object instead of an Array, and return the SourceMap object. 2013-03-01 11:34:39 -05:00
Jason Walton
d626e70287 Fix from code inspect: Use "not" instead of "!". 2013-03-01 11:19:22 -05:00
Demian Ferreiro
3182475207 Make error messages show only first line on multi-line errors 2013-03-01 13:10:04 -03:00
Jason Walton
ea86e3e7b1 Optionally allow replacement of existing mappings in SourceMap#addMapping(). 2013-03-01 10:18:37 -05:00
Jason Walton
844549954a Minor API clean up, and make it so sourcemaps are pretty-printed to the .map file. 2013-03-01 10:12:10 -05:00
Jason Walton
51fe417d58 Fix generated file name in v3 source map 2013-03-01 08:56:17 -05:00
Jason Walton
0e718f0968 Merge branch 'sourcemaps' of https://github.com/surjikal/coffee-script into sourcemaps 2013-03-01 08:47:42 -05:00
Jason Walton
0d6d479d77 Merge branch 'master' into sourcemaps
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/nodes.js
	src/nodes.coffee
2013-03-01 08:47:16 -05:00
Nicolas Porter
88e02322e5 Fixed key name in source map, added coffee file to map sources
These are the modifications I had to do in order to get source maps working
in 27.0.1425.2 (Official Build 185250) canary. I haven't tested other
browsers.

I first looked at the V3 spec and a few examples, and I saw that the
`source` key of the source map should be called `sources`.

After doing the `source` to `sources` change, the coffee source and for
some odd reason the javascript file would not show up in the browser
dev tools (it was being fetched but not evaluated).

To fix this, I had to add the coffee source to the `sources` list in the
source map file.
2013-03-01 05:58:26 -05:00
Jeremy Ashkenas
5dea70b82e Fixes #2721 -- show error message for naked super 2013-03-01 13:25:49 +13:00
Jeremy Ashkenas
6b79af2b7c Fixes #2721, super outside of classes with extends for instance methods. 2013-03-01 13:17:07 +13:00
Jeremy Ashkenas
68718b6938 Moving path dependency back into 'command' 2013-03-01 12:50:42 +13:00
Jeremy Ashkenas
d70d71f574 Merging in .coffee.md support alongside .litcoffee ... I think we'll keep .litcoffee as the canonical, however. 2013-03-01 12:46:40 +13:00
Jeremy Ashkenas
f33517368e Removing duplicate 'CATCH' 2013-03-01 12:38:41 +13:00
Jeremy Ashkenas
a48ca260bd Merge pull request #2746 from troels/implicit-calls-with-overhang-on-first-argument-only-on-implicit-object
Disallow implicit calls in cases like:
2013-02-28 14:55:45 -08:00
Troels Nielsen
71e04d9839 Disallow implicit calls in cases like:
f
  a

and only allow cases like:

f
  a: 1
2013-02-28 23:20:42 +01:00
Jeremy Ashkenas
2970d59395 Merge pull request #2743 from epidemian/revert-2599
Revert #2599
2013-02-28 13:53:34 -08:00
Jason Walton
7073d18f23 Add source map support 2013-02-28 15:51:29 -05:00
Jeremy Ashkenas
23d8cd6c2a Merge branch 'master' of https://github.com/jashkenas/coffee-script 2013-03-01 07:46:04 +13:00
Jeremy Ashkenas
e70dd156b0 Fixing heredocs in literate coffeescript 2013-03-01 07:42:12 +13:00
Demian Ferreiro
4469d062e1 Add a couple of tests to document the behaviour of other typed constructors 2013-02-28 10:37:47 -03:00
Demian Ferreiro
bf70b4660e Revert #2599 2013-02-28 10:37:30 -03:00
Jeremy Ashkenas
c0e07013e8 Merge pull request #2741 from troels/implicit-call-try-catch-finally
Fix implicit calls with try/catch/finally as arguments
2013-02-28 03:00:49 -08:00
Jeremy Ashkenas
c6f30935a8 (Aside: For historical reasons we do make the filename extension optional, which is a deeply regrettable accident of history that I would not repeat, given the chance.) 2013-02-28 23:54:19 +13:00
Troels Nielsen
cb187fd900 Fix implicit calls with try/catch/finally as arguments 2013-02-28 11:53:04 +01:00
Jeremy Ashkenas
3f23be2854 Merge pull request #2718 from sbp/sbp-literate
Add support for text/literate-coffeescript in the browser
2013-02-28 02:47:43 -08:00
Sean B. Palmer
881ae5528d Add support for text/literate-coffeescript in the browser 2013-02-28 10:15:20 +00:00
Michael Smith
1a8354482a Modify extension handling to allow for .coffee.md
Move filename processing to a `parseFileName` function in
helpers.coffee.

Map `.coffee.md` as a Literate CoffeeScript extension.

Also, make .litcoffee and .coffee.md files executable without their file
extension - eg. `coffee test` would work for a file called
`test.litcoffee`.
2013-02-27 22:49:24 -08:00
Jeremy Ashkenas
32eb1bf58f Merge pull request #2740 from mintplant/hoist-build
Hoist build function to top level of Cakefile
2013-02-27 22:27:01 -08:00
Michael Smith
b2e17c3045 Hoist build function to top level of Cakefile 2013-02-27 22:21:10 -08:00
Jeremy Ashkenas
ac2c5f0201 Merge pull request #2712 from troels/implicit-object-implicit-call-stuff
Implicit object/implicit call interaction handling
2013-02-27 17:32:31 -08:00
Troels Nielsen
1666716c31 Improve the handling of implicit object and implicit call combinations
by handling them together.
2013-02-27 08:15:38 +01:00
Demian Ferreiro
5115fcb162 Add CompilationError.fromLocationData 2013-02-26 23:03:33 -03:00
Jason Walton
541ab8334d Compile to an array of CodeFragments instead of to a giant string. 2013-02-26 13:34:27 -05:00
Demian Ferreiro
1db89d1589 Optimized repeat and its tests 2013-02-26 14:41:01 -03:00
Michael Ficarra
965237e0da Merge pull request #2725 from mintplant/repl-fix
Fix REPL crashing on execution error
2013-02-26 08:20:36 -08:00
Michael Smith
5698e425fd Use blank line regex from Redux 2013-02-26 08:08:47 -08:00
Demian Ferreiro
fbc8417263 Fix failing parser error message test 2013-02-26 05:55:09 -03:00
Michael Smith
ff1ddd0284 Fix repl handling of blank line
Since the move to the nodeREPL package, input lines to be evaluated are
now wrapped in parentheses; that is:

    'foo'

would become:

    ('foo'
    )

The old way of detecting empty lines was to see if the input string was
either totally empty, or whitespace-only. The addition of these
parentheses breaks that.

In order to fix this, we simply tweak the regex a little to ignore these
added parentheses if they're present. As an added bonus, the regex
should match empty inputs even if they aren't.

This also makes the "empty command evaluates to undefined" test pass,
for the right reasons (i.e. not because of the broken error behavior
from before).
2013-02-25 22:09:50 -08:00
Michael Smith
deaa31dca5 Prevent repl from crashing on error [Fixes #2716]
Move execution of the compiled code inside the try/catch block:

    try
      js = CoffeeScript.compile "_=(#{input}\n)", {filename, bare: yes}
    catch err
      cb err
>   cb null, vm.runInContext(js, context, filename)

    try
      js = CoffeeScript.compile "_=(#{input}\n)", {filename, bare: yes}
>     cb null, vm.runInContext(js, context, filename)
    catch err
      cb err
2013-02-25 22:08:01 -08:00
Demian Ferreiro
44e3a76881 Add some error formatting tests
Thanks to them i discovered that the parser errors where indicating the wrong token ¬¬
2013-02-26 01:30:23 -03:00
Demian Ferreiro
f2efada0d4 Improved compiler error messages 2013-02-25 23:37:30 -03:00
Demian Ferreiro
5f00d6478a Remove redundant filename in error message 2013-02-25 19:20:37 -03:00
Michael Ficarra
8b0dd9d224 Merge pull request #2719 from epidemian/minor-embellishments
Minor embellishments
2013-02-25 10:35:25 -08:00
Demian Ferreiro
7e5f1b14a3 Pass 0-based indexes to CompilerError 2013-02-25 15:12:25 -03:00
Demian Ferreiro
caacd892cc Improved parser error messages 2013-02-25 15:09:42 -03:00
Demian Ferreiro
25091fb2a0 Improved lexer error messages 2013-02-25 14:41:34 -03:00
Demian Ferreiro
dcdfe9bc34 Fix indentation on test 2013-02-25 14:15:24 -03:00
Demian Ferreiro
f609036bee Remove unnecessary returns and use default parameters 2013-02-25 10:44:56 -03:00
Jeremy Ashkenas
c39723c053 expanding literate explanation 2013-02-25 22:29:42 +13:00
Jeremy Ashkenas
d2f400944d Adding a negative array loop example to the docs 2013-02-25 22:27:06 +13:00
Jeremy Ashkenas
673125e64a Merge branch 'master' into gh-pages 2013-02-25 21:23:24 +13:00
Jeremy Ashkenas
e1592890cb Retina-ifying the CoffeeScript logo 2013-02-25 21:23:08 +13:00
Jeremy Ashkenas
f1b5f81eaf merged 2013-02-25 21:13:39 +13:00
Jeremy Ashkenas
af53c230a1 CoffeeScript 1.5.0 2013-02-25 21:12:22 +13:00
Jeremy Ashkenas
ac9d0e17e4 Merging in location data in the AST. Yee-hah. 2013-02-25 17:51:05 +13:00
Jeremy Ashkenas
5e498ca395 merged 2013-02-25 17:41:27 +13:00
Jeremy Ashkenas
5c3acfefeb Removing Riak JS 2013-02-25 17:36:56 +13:00
Jeremy Ashkenas
9b63e806dd #2702 -- remove more dead code 2013-02-25 17:34:14 +13:00
Jeremy Ashkenas
bd842241a6 #2702 -- remove dead code 2013-02-25 17:33:27 +13:00
Jeremy Ashkenas
3815f0a132 #2702 -- remove old code 2013-02-25 17:32:51 +13:00
Jeremy Ashkenas
d43b50b1ca Merge branch 'master' of https://github.com/jashkenas/coffee-script 2013-02-25 17:17:07 +13:00
Jeremy Ashkenas
14c2a16833 Reverted b31cc70 -- putting Generated comment back up top. Why? Why not? 2013-02-25 17:17:01 +13:00
Michael Ficarra
5ae9c5d947 compile a320e1e535 2013-02-24 21:12:57 -06:00
Michael Ficarra
2402f9774a Revert "Moving the 'generated by coffeescript version X' comment to the bottom, to get it out of the way"
This reverts commit b31cc70235.
2013-02-24 21:11:43 -06:00
Michael Ficarra
3d3fe0df34 Merge pull request #2711 from troels/fix-1435
Fix #1435 by amending away sign reversal.
2013-02-24 11:58:41 -08:00
Troels Nielsen
a320e1e535 Fix #1435 by amending away sign reversal. 2013-02-24 20:33:58 +01:00
Michael Ficarra
8f0a7774f9 Merge pull request #2710 from troels/fix-full-build-tests
Build:full sometimes uses old code when running tests.
2013-02-24 11:33:54 -08:00
Troels Nielsen
7f8b56eadd Use the newly compiled code when running tests under build:full 2013-02-24 18:08:54 +01:00
Michael Ficarra
385d93e332 Merge pull request #2709 from epidemian/minor-embellishments
Minor embellishments
2013-02-23 03:39:34 -08:00
Demian Ferreiro
9ed804d9b1 Simplify Value::unfoldSoak momoization code (only a bit...) 2013-02-23 08:26:10 -03:00
Demian Ferreiro
03cfe23493 Remove unnecessary if statement 2013-02-23 08:24:04 -03:00
Demian Ferreiro
a97c23a4bd Make it more explicit that 'this' is the only possible value for tag in Value's constructor. 2013-02-23 06:34:11 -03:00
Jason Walton
e1a2e11de4 Fix merge problem, and rebuild parser.js 2013-02-21 20:17:06 -05:00
Jason Walton
5e49df8ed4 Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/coffee-script/grammar.js
	src/grammar.coffee
2013-02-14 14:21:46 -05:00
Jeremy Ashkenas
fa1ffa66d3 Fixes #2359 -- tweak grammar to use new name 2013-02-14 16:34:32 +13:00
Jeremy Ashkenas
1aa57bf24f moving book link to the proper place to be rebuilt 2013-02-13 10:35:21 +13:00
Jeremy Ashkenas
31dd0b75af Merge pull request #2480 from jamierumbelow/patch-1
Adding Testing with CoffeeScript to books list
2013-02-12 13:33:55 -08:00
Reg Braithwaite
46ecfd3c1a CLoses #2700
Signed-off-by: Reg Braithwaite <reg@braythwayt.com>
2013-02-13 10:33:11 +13:00
Jason Walton
c31bc6deb7 Update js files. 2013-02-06 10:40:48 -05:00
Jason Walton
fe45f1bf35 Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/coffee-script/grammar.js
	lib/coffee-script/rewriter.js
	src/grammar.coffee
	src/rewriter.coffee
2013-02-06 10:29:19 -05:00
Jeremy Ashkenas
fc7f4ed904 Fixes #2523 -- remove resetting of process.execPath 2013-02-02 12:40:50 +11:00
Jeremy Ashkenas
33553839e2 Fixes #2690 -- tweak cake bench to handle literate coffeescript 2013-02-02 12:36:05 +11:00
Jeremy Ashkenas
1818e74f42 Fixes #2525, #1187, #1208, #1758, and many more -- allow looping over an array downwards 2013-02-02 12:23:14 +11:00
Jeremy Ashkenas
d72daca7bd simpler implementation of the previous commit 2013-02-02 11:19:29 +11:00
Jeremy Ashkenas
c37202ecb9 Removing variable indirection for simple steps 2013-02-02 11:16:17 +11:00
Jeremy Ashkenas
1f5b19b81c slightly better conditions for range steps 2013-02-02 11:02:40 +11:00
Jeremy Ashkenas
8a98cb380e Fixes #2531. Allow colors where Node says that colors are available. 2013-02-02 10:50:32 +11:00
Jeremy Ashkenas
de5e2c60ae require a file name before checking for a fallback 2013-02-02 10:46:17 +11:00
Jeremy Ashkenas
b31cc70235 Moving the 'generated by coffeescript version X' comment to the bottom, to get it out of the way 2013-02-02 10:42:46 +11:00
Jeremy Ashkenas
78891a0ccc Merging in @epedemian's fix for #2359 -- disallow other-typed constructors 2013-02-01 22:30:22 +11:00
Jeremy Ashkenas
0b1d4d374a Adding a test for #2613 2013-02-01 22:07:19 +11:00
Jeremy Ashkenas
ac398998a2 Fixes #2613 -- bug with over-optimization of parentheses on LHS of destructuring 2013-02-01 22:05:55 +11:00
Jeremy Ashkenas
21d69e3e6e Fixes #2617 -- implicit object call getting out of control. 2013-02-01 21:59:48 +11:00
Jeremy Ashkenas
33140259b8 Fixes #2681 -- removes old --require hook. 2013-02-01 21:25:57 +11:00
Jeremy Ashkenas
723907464a Merge pull request #2685 from jordimassaguerpla/master
add license information to the gemspec
2013-01-29 04:24:47 -08:00
Jordi Massaguer Pla
bf4d91dd38 fix spacing in Rakefile
previous commit was not following the right indentation when adding the
license field.
2013-01-29 12:11:45 +01:00
Jordi Massaguer Pla
64fe56a9e1 add license information to gemspec
this way you can get this info from the rubygems.org API
2013-01-28 13:53:29 +01:00
Jeremy Ashkenas
39a05b7e4f Merge branch 'master' into gh-pages 2013-01-28 20:06:25 +10:00
Jeremy Ashkenas
e7f72c9555 Adding new coffeescript book per request 2013-01-28 20:06:07 +10:00
Jeremy Ashkenas
a106fb451b Merge pull request #2682 from jashkenas/repl-rewrite
REPL rewrite
2013-01-26 02:26:52 -08:00
Michael Ficarra
b1300bdd79 fix typo; thanks @Nami-Doc 2013-01-26 02:29:16 -06:00
Michael Ficarra
be9707f8d2 final tweaks to REPL rewrite
We can still use some more extensive tests, but it's already much better
tested than the current REPL.
2013-01-26 02:07:56 -06:00
Alon Salant
702071553f Remove testing TODO 2013-01-25 21:53:35 -08:00
Alon Salant
47bd05e9a0 REPL tests based on direct interaction with input and output stream. Includes multiline tests. 2013-01-21 21:56:34 -08:00
Michael Ficarra
537c5f4b70 fix some issues pointed out in 041033a51a 2013-01-21 10:27:52 -06:00
Michael Ficarra
041033a51a finish multiline support for REPL rewrite 2013-01-21 00:43:08 -06:00
Michael Ficarra
2e191dc0e7 Merge branch 'node_repl_multiline' of https://github.com/asalant/coffee-script into repl-rewrite 2013-01-18 21:16:39 -06:00
Alon Salant
4a52814a79 Multiline WIP 2013-01-18 11:33:04 -08:00
Alon Salant
69d80e2ded Single quotes 2013-01-16 11:48:50 -08:00
Alon Salant
d84cd9466e empty command evaluates to undefined 2013-01-15 22:40:41 -08:00
Alon Salant
627b921bca Initial commit of REPL based on node's REPLServer 2013-01-15 22:40:40 -08:00
Jeremy Ashkenas
955afe0c9f Merge branch 'master' of github.com:jashkenas/coffee-script 2013-01-16 17:34:04 +11:00
Jeremy Ashkenas
316d5e5e77 fixing missing file finding logic for litcoffee 2013-01-16 17:33:54 +11:00
Alon Salant
1f051e6e14 Merge branch 'repl-tests' of https://github.com/lihanli/coffee-script into node_repl 2013-01-14 20:50:06 -08:00
Jason Walton
f67da27d2f Add unit tests, fix last_column reporting. 2013-01-14 17:11:07 -05:00
Jason Walton
923739ebb4 Remove files committed by accident. 2013-01-14 17:10:49 -05:00
Jason Walton
97bc9f4730 Add quick unit test for location data. 2013-01-14 15:20:47 -05:00
Jason Walton
bbbf612f29 Put location data in token[2] instead of in token.locationData 2013-01-14 15:20:35 -05:00
Jeremy Ashkenas
d11fa573e6 do not try to compile traces of coffee within node_modules 2013-01-14 11:45:02 -08:00
Jeremy Ashkenas
6becd8fb13 Reverting the unthrow of the error. 2013-01-14 11:44:15 -08:00
Jason Walton
a1ba0a89f8 Merge remote-tracking branch 'origin/master'
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/lexer.js
	lib/coffee-script/parser.js
	src/lexer.coffee
2013-01-14 14:26:06 -05:00
Jason Walton
a9aa52dc6a Use .explicit when deciding whether or not to add location data. 2013-01-14 13:38:31 -05:00
satyr
9595b30d6f fix tabbed literate code 2013-01-10 06:24:12 +09:00
Michael Ficarra
f672e0cdb5 fix 'litcoffee' extension support
As pointed out by @satyr in 27551b23f3
2013-01-07 22:35:20 -06:00
Michael Ficarra
66bbef4ce0 revert broken parts of cdde576182
Thanks @alagopus.
2013-01-07 22:32:39 -06:00
Michael Ficarra
dfe91d1766 rebuilding after cdde576182 2013-01-07 22:27:02 -06:00
Jeremy Ashkenas
cdde576182 Syntax errors no longer report full stack traces ... just the error, please 2013-01-06 19:12:23 -10:00
Jeremy Ashkenas
82aeb70380 Fixes #2630 -- Class bodies shouldn't be able to reference arguments. 2013-01-06 19:08:32 -10:00
Jeremy Ashkenas
69ef1abdf6 Fixes #2389 -- strip the BOM for once and for all 2013-01-06 18:56:58 -10:00
Jeremy Ashkenas
cc6f0451e7 Fixes #2621 -- buggy function parameter name detection with complex destructuring in param list. 2013-01-05 18:32:57 -10:00
Jeremy Ashkenas
2c20ac6aa9 Fixes #2622 -- better document how --nodejs flag works 2013-01-05 18:18:08 -10:00
Jeremy Ashkenas
f8c751b3a4 adding one more compound operator test for #2627 2013-01-05 18:14:05 -10:00
Jeremy Ashkenas
547a271cee Merge pull request #2627 from int3/master
Parse compound assignment operator followed by a terminator. Closes #2532.
2013-01-05 20:10:32 -08:00
Jeremy Ashkenas
cd2444e546 Fixes #2645 -- block comments should always be closed 2013-01-05 18:04:16 -10:00
Jeremy Ashkenas
6f1fb0352c doing the Scope in literate coffee ... just for kicks. 2013-01-05 12:05:09 -10:00
Jeremy Ashkenas
4bf2c6b2e9 Merge branch 'master' of github.com:jashkenas/coffee-script into literate 2013-01-05 11:34:48 -10:00
Jeremy Ashkenas
025b0be31b Correct line numbers in literate coffeescript syntax errors 2013-01-04 17:23:18 -10:00
Jeremy Ashkenas
27551b23f3 add litcoffee to supported file formats 2013-01-04 10:03:49 -10:00
Jeremy Ashkenas
ba08a21d21 bumping version to 1.5.0-pre 2013-01-04 09:35:20 -10:00
Jeremy Ashkenas
48d625816c Merge branch 'master' into literate 2013-01-04 09:07:09 -10:00
Jason Walton
cee4f4ab6e Location test. 2012-12-24 08:34:16 -05:00
Jeremy Ashkenas
de29613d91 Merge pull request #2632 from caseywebdev/update-uglify
gh-2631 Update to uglifyjs's new API
2012-11-29 10:08:42 -08:00
Casey Foster
9e3d43193d gh-2631 Update to uglifyjs's new API 2012-11-29 09:45:31 -08:00
Jez Ng
847ab4d18e Parse compound assignment followed by a terminator.
Closes #2532.
2012-11-27 20:11:01 -05:00
Jason Walton
183e124077 Fix broken case for generated explicit indentation. 2012-11-22 14:22:38 -05:00
Jason Walton
3142b237f5 Hook up new token location data to parser. 2012-11-21 16:57:30 -05:00
Jason Walton
969e45a599 Fix TODO in interpolateString. 2012-11-20 12:05:59 -05:00
Jason Walton
df6c497ab0 Clean up TODOs 2012-11-19 17:37:46 -05:00
Jason Walton
12625cc00c Add location data to tokens generated by the rewriter. 2012-11-19 11:34:09 -05:00
Jason Walton
bb94e02fad Lexer now adds location data, including first/last line/column to all generated tokens. 2012-11-16 19:09:56 -05:00
Jason Walton
25126e2f99 Add location data to nodes without passing it in constructors. 2012-11-15 15:35:01 -05:00
Jason Walton
d5d772d55e Remove debug logging from Cakefile. 2012-11-15 15:18:52 -05:00
Jason Walton
bdcd77d8e6 Use 1-based line numbers instead of 0-based line numbers in nodes toString(). 2012-11-14 16:32:35 -05:00
Jason Walton
b9ebcbf555 Add more descriptive line numbers to node toString() 2012-11-14 16:20:25 -05:00
Jason Walton
c407a0bf19 Fix reporting of errors in 'cake test' 2012-11-14 16:19:17 -05:00
Jason Walton
7c77a5d3c8 Fix line numbers for TERMINATOR tokens. 2012-11-14 14:38:02 -05:00
Jason Walton
ce2bf36aae Parser passes location data to each node in tree 2012-11-14 11:50:43 -05:00
lihan
3284f6af18 tests for the repl: ignoring comments, output in inspect mode, variable saving 2012-10-31 00:09:59 -04:00
Demian Ferreiro
52b0f76eb2 Prevent constructors from returning values 2012-10-28 08:55:48 -03:00
Demian Ferreiro
e46b129c4f Remove return statement on auto-generated constructors 2012-10-28 08:55:02 -03:00
Jeremy Ashkenas
35787ef79b Fixes #2567 -- optimize generated code with an existential is directly negated. 2012-10-23 18:17:53 -04:00
Jeremy Ashkenas
f029695db8 Fixing wonky spacing at top level. 2012-10-23 18:08:29 -04:00
Jeremy Ashkenas
0ba628159f Fixes #2580 -- Try/Catch is allowed to destructure the error object. 2012-10-23 17:57:22 -04:00
Jeremy Ashkenas
be65807370 Merge branch 'master' into gh-pages 2012-10-23 16:45:50 -04:00
Jeremy Ashkenas
158d37215a CoffeeScript 1.4.0 2012-10-23 16:45:31 -04:00
Jeremy Ashkenas
7ad25c90fa rebuilding nodes 2012-10-23 15:51:13 -04:00
Jeremy Ashkenas
b06a326c7d Merge pull request #2587 from sstur/pullreq
Simplify Call.prototype.compileSplat based on how Traceur does it
2012-10-16 10:03:49 -07:00
Simon Sturmer
25bdde85a9 Simplify Call.prototype.compileSplat based on how Traceur does it 2012-10-16 21:05:31 +07:00
Gabe Hollombe
334dcbd162 Updated example using @epidemian's suggestion 2012-10-16 16:41:14 +11:00
Jeremy Ashkenas
caed958455 Fixes #2577 -- better instructions for installing master 2012-10-08 10:08:33 -04:00
Jeremy Ashkenas
d8905e2f87 Fixes #2577 -- better instructions for installing master 2012-10-08 10:08:23 -04:00
Jeremy Ashkenas
b4e13b294d pretty decent initial test. 2012-09-25 19:37:54 -05:00
Jeremy Ashkenas
4fb3a312b0 fixing block comment indentation 2012-09-25 19:35:02 -05:00
Jeremy Ashkenas
82fadea1ed first working version of literate coffeescript 2012-09-25 19:15:40 -05:00
Jeremy Ashkenas
bb194dc6c6 start with comments... 2012-09-25 18:10:43 -05:00
Jeremy Ashkenas
9167b3aca1 removing export of RESERVED ... more progress. 2012-09-25 18:01:16 -05:00
Jeremy Ashkenas
76a25dc797 ignore litcoffee files 2012-09-25 17:50:04 -05:00
Jeremy Ashkenas
97de09c8f1 rebuilding 2012-09-25 17:16:10 -05:00
Jeremy Ashkenas
7595cb689a Adding a CONTRIBUTING to CoffeeScript. 2012-09-17 13:16:41 -04:00
Jeremy Ashkenas
2b86470665 Merge pull request #2535 from philikon/issue2534
Fix #2534: Don't pass a string argument to the XMLHttpRequest constructor
2012-09-07 13:41:45 -07:00
Philipp von Weitershausen
78423e9a14 Fix #2534: Address @jashkenas review comment. 2012-09-07 12:53:37 -07:00
Philipp von Weitershausen
ec59a626f2 Fix #2534: Don't pass a string argument to the XMLHttpRequest constructor. 2012-09-05 00:09:18 -07:00
Michael Ficarra
1b14c035e7 fixes #2521: line numbers in errors affected by newlines in backticks 2012-08-29 12:54:50 -05:00
Michael Ficarra
ba34f8d389 updated compiled output 2012-08-29 12:54:16 -05:00
Jeremy Ashkenas
b74e73058c Merge pull request #2484 from paulyoung/remove-register-extension
Fixes #2441: Remove (deprecated) registerExtension support.
2012-08-10 07:24:55 -07:00
Paul Young
c29597b3bc Fixes #2441: Remove (deprecated) registerExtension support. 2012-08-08 20:01:07 -04:00
Jamie Rumbelow
7c53d8c120 Adding Testing with CoffeeScript to books list 2012-08-07 15:22:06 +03:00
Michael Ficarra
5d7a83468a fixed broken compilation due to pull #2430
cc @jashkenas, @domenic, @yyfearth
2012-07-11 10:24:58 -05:00
Michael Ficarra
a396837fa4 building #2430 2012-07-10 23:08:14 -05:00
Jeremy Ashkenas
1fa3da68ba Merge pull request #2430 from domenic/bom
Strip UTF-8 BOM when require'ing .coffee modules.
2012-07-09 08:25:48 -07:00
Jeremy Ashkenas
219726a9c5 Merge pull request #2431 from domenic/npm-test
Add test script to package.json.
2012-07-09 08:24:49 -07:00
Domenic Denicola
81c0964e48 Add test script to package.json.
Allows one to run the tests using `npm test`.
2012-07-08 22:55:43 -04:00
Domenic Denicola
c9388ce767 Strip UTF-8 BOM when require'ing .coffee modules.
Allows people to author their .coffee files with UTF-8 BOMs at the start, because sometimes that happens. Fixes #798.
2012-07-08 22:52:13 -04:00
Gabe Hollombe
7065538224 add documentation for using switch without a control expression 2012-07-04 11:57:20 +07:00
Michael Smith
2a56f0cdf7 Correct incorrect line in blocks.coffee 2012-07-02 08:36:00 -07:00
Michael Smith
ace4837365 Migrate from path.exists to fs.exists
Compatibility is kept for path.exists. Versions of node that have
made the change will use fs.exists, while older versions will fall
back to path.exists. The same goes for path.existsSync.
2012-07-02 00:20:13 -07:00
Michael Ficarra
6417cf4d1b removed duplicate "let" in RESERVED list
thanks @phleet for finding it:
161e9a6559 (commitcomment-1448952)
2012-06-12 15:16:50 -05:00
Gabe Hollombe
7fdd21b26d Add example of destructuring assignment in class constructors for options 2012-06-10 11:19:54 +07:00
Michael Ficarra
1731f7d321 rebuild after merging #2371 2012-06-06 19:39:17 -05:00
Michael Ficarra
8d39c1cc79 Merge pull request #2371 from takkaw/del_unused
dead code removal
2012-06-06 17:38:22 -07:00
takkaw
bc7e0cf09a delete unused sentence 2012-06-06 23:05:10 +09:00
Michael Ficarra
7c29ea4d38 removing code that restricts duplicate key names and associated tests 2012-05-21 13:49:00 -04:00
Michael Ficarra
6c6c8bd454 typo in test case for #2333 2012-05-21 13:28:18 -04:00
Michael Ficarra
81f780f1fb finally put #2333 to rest by resorting to using indirect eval
related: #1772, #1776; we're relying on the underlying engine having the
string escaping behaviour we want instead of implementing it manually.
2012-05-21 13:26:29 -04:00
Jeremy Ashkenas
6838bae36e Merge pull request #2347 from heyLu/fix-repl
fix repl completion and navigation
2012-05-21 06:22:04 -07:00
Michael Ficarra
972a5299d5 correct spacing around operators in slice output 2012-05-20 16:32:10 -04:00
Michael Ficarra
b8149812cd fixes #2349: inclusive slicing to numeric strings 2012-05-20 16:22:25 -04:00
Lucas Stadler
01d4e87f57 fix repl completion and navigation
The readline interface of node has changed in [aad12d0][] and because of
that the autocompletion and key movement didn't work anymore. This
commit fixes this by checking whether stdin is in raw mode (i.e. invoked
as a script) or not (as a repl).

[aad12d0]: https://github.com/joyent/node/commit/aad12d0
2012-05-20 11:38:50 +02:00
Michael Ficarra
f938a213fe trying to commit built files again; here goes nothing 2012-05-16 15:50:34 -04:00
Michael Ficarra
df54c63b1b yet another small cleanup and obscure bugfix related to #2333 2012-05-16 15:29:00 -04:00
Michael Ficarra
1810d9f318 object key dupe checking again: support newlines and \a in strings 2012-05-16 12:53:28 -04:00
Michael Ficarra
29b9c3bb29 correcting broken fix for #2333 regarding string escape sequences
Sorry for all the commits! It should really be done this time.
2012-05-16 10:36:00 -04:00
Michael Ficarra
da2298988a Merge pull request #2334 from michaelficarra/issue2333
fixes #2333: fix prohibition of duplicate object properties
2012-05-16 05:55:28 -07:00
Michael Ficarra
f31ff7774a fix escaping in test for #2333 2012-05-16 08:19:06 -04:00
Michael Ficarra
c6fafa1bc9 renaming any helper to some, reflecting Array::some 2012-05-16 07:58:14 -04:00
Michael Ficarra
e8a8209a2b Finally rid eval from fix for #2333. I feel comfortable with it now. 2012-05-16 07:41:00 -04:00
Michael Ficarra
fa82859814 another refactoring for #2333 2012-05-16 07:02:16 -04:00
Michael Ficarra
55e1386503 issue #2333: removed gratuitous test, refactored 2012-05-16 02:07:35 -04:00
Michael Ficarra
dc9565f54a fix to #2333 greatly improved, but still depends on eval :( 2012-05-16 02:03:02 -04:00
Michael Ficarra
c264bf04cc fixes #2333: fix prohibition of duplicate object properties 2012-05-16 01:07:10 -04:00
Michael Ficarra
5c66e552d7 corrected some SIGINT/EOT logic in REPL 2012-05-15 13:15:23 -04:00
Michael Ficarra
c4ebe352a4 more changes to REPL autocompletion as suggested in 8dcbe54e55 2012-05-15 12:48:02 -04:00
Jeremy Ashkenas
1cba2e2339 Merge branch 'master' into gh-pages 2012-05-15 12:36:12 -04:00
Jeremy Ashkenas
79492aab36 CoffeeScript 1.3.3 2012-05-15 12:35:40 -04:00
Jeremy Ashkenas
e3454ed7fb Fixes #2331 -- bound 'super' regression 2012-05-15 12:30:51 -04:00
Michael Ficarra
8dcbe54e55 Fixes broken autocompletion from 8bc6001d27
8bc6001d27 removed autocompletions of
non-enumerable own-properties in trying to add enumerable prototype
properties to the autocompletions. This commit adds them back and unions
them with the enumerable prototype properties.
2012-05-15 02:25:28 -04:00
Michael Ficarra
dac24a3d8a small refactoring of 66c751be11 2012-05-14 21:07:54 -04:00
Michael Ficarra
5c8eef2ab5 package.json: changing license URL to new github raw URL format 2012-05-14 17:50:04 -04:00
Michael Ficarra
66c751be11 fixed REPL to allow streamed input from stdin 2012-05-14 15:55:51 -04:00
Jeremy Ashkenas
b4af24b7e2 Merge branch 'master' into gh-pages 2012-05-14 14:45:35 -04:00
Jeremy Ashkenas
7792a3a6e3 CoffeeScript 1.3.2 2012-05-14 14:45:20 -04:00
Michael Ficarra
e57a5de33e added bugs to package.json
satyr/coco@d15ca300ca
2012-05-14 12:35:50 -04:00
Michael Ficarra
ed705403ad Merge pull request #2299 from geraldalewis/2213-no-method-is-array
Wraps up #2211 -- addresses invocations within destructured params
2012-05-12 17:30:48 -07:00
Colin Ross
fa899ab810 Fix typo in test name 2012-05-12 06:34:12 +01:00
Jeremy Ashkenas
3fc0e6be90 adding a rel=canonical 2012-05-10 17:42:40 -04:00
Jeremy Ashkenas
fdcd99dfef adding a rel=canonical 2012-05-10 17:42:27 -04:00
Michael Ficarra
d5ddd0f783 removing redundant cases in lexer; thanks @satyr 2012-05-08 16:42:09 -04:00
Michael Ficarra
848d10594b reverting premature start of solution to #2306 2012-05-08 16:22:26 -04:00
Michael Ficarra
caf3da2f66 lexer/parser: split out null and undefined from BOOL token
also made explicit AST nodes `Bool`, `Null`, and `Undefined`
2012-05-08 16:14:28 -04:00
Gerald Lewis
f1b286469a Wraps up #2211 -- addresses invocations within destructured params 2012-05-02 18:03:32 -04:00
Jeremy Ashkenas
46065199cd Fixes #2287 -- tweak extends to make jshint easier 2012-04-25 17:33:21 -04:00
Jeremy Ashkenas
879fe3976d Fixes #2197 -- uncached double existential 2012-04-25 15:04:15 -04:00
Jeremy Ashkenas
c1309e12f7 Fixes #2209 -- document heredocs as 'block strings' 2012-04-25 14:37:05 -04:00
Jeremy Ashkenas
6bcc798a76 Fixes #2207 -- unambiguous immediate implicit closes don't close implicit objects 2012-04-25 14:14:00 -04:00
Maxwell Krohn
3e95d7f2d0 Reapply the removed patch from bugfix_1183 in PR 2252. Include a test
case to show it's required.

What's going on: inside of Coffee-generated closures, calling `super()`
is implicitly making use of `this` (or explicitly doing so if you look
at the output code), so we have to pass `this` through closures as if
`@` is being accessed within the closure.  So, just add one more
condition to the list in `Closure::literalThis`
2012-04-24 21:48:18 -04:00
Jeremy Ashkenas
c3159e48c8 Merge pull request #2219 from matt-hickford/build-windows-alternative
build on Windows - fix spawn command by calling node explicitly
2012-04-24 14:59:30 -07:00
Jeremy Ashkenas
34be878257 Fixes #1183, Refactors #2252, super calls in inner functions 2012-04-24 17:23:37 -04:00
Jeremy Ashkenas
87257ea6b3 Fixes #2258 -- allow parameter lists in the vertical style. 2012-04-24 16:56:39 -04:00
Jeremy Ashkenas
8bc6001d27 Fixes #2280 -- add enumerable prototypal properties to autocompletion. 2012-04-24 16:26:07 -04:00
Jeremy Ashkenas
e433098eb2 Adding a test for #2273 2012-04-24 15:39:22 -04:00
Jeremy Ashkenas
afdcdcfd54 Fixes #2273, reverts #643 -- no special variable treatment for loop variables. 2012-04-24 15:37:26 -04:00
Jeremy Ashkenas
4fc9a345bb Fixes #2274 -- allow @variables as loop variables 2012-04-24 12:21:47 -04:00
Jeremy Ashkenas
9d4dc094a1 adding a link to the high-rez logo 2012-04-24 12:12:32 -04:00
Jeremy Ashkenas
c06487c13b Merge branch 'master' of github.com:jashkenas/coffee-script 2012-04-24 12:12:12 -04:00
Jeremy Ashkenas
7a80661ad5 adding a link to the high-rez logo 2012-04-24 12:12:09 -04:00
Jeremy Ashkenas
2fb527a63f Merge pull request #2277 from geraldalewis/2213-dup-destructured-params
Destructured assignment params incorrectly identified as duplicates.
2012-04-24 08:48:06 -07:00
Gerald Lewis
99394e1011 Fixes issue where destructured assignment params were incorrectly identified as duplicates. 2012-04-23 20:41:56 -04:00
Trevor Burnham
3b1a566117 Hidden files no longer queued for --join (fixes #2263) 2012-04-23 13:59:42 -04:00
Trevor Burnham
d58da49cee Intermediate version bump to 1.3.2-pre 2012-04-23 13:34:04 -04:00
Jeremy Ashkenas
0fada5109a Merge pull request #2213 from geraldalewis/2211-destructed-splats
Issue #2211 -- splats in destructured parameters
2012-04-23 09:00:22 -07:00
Michael Ficarra
46ff7705ee corrections for octal escape sequences; allows "\0" alone; see #1547
Relevant sections of the spec:
* http://es5.github.com/#C
* http://es5.github.com/#B.1.2
* http://es5.github.com/#x7.8.4
2012-04-20 18:29:40 -04:00
Michael Ficarra
eabcb2c8b0 Merge pull request #2261 from josher19/patch-2 2012-04-12 22:17:13 -07:00
josher19
ea60dfa44d See issue #2620 2012-04-13 12:54:36 +08:00
Michael Ficarra
53a82da3f3 fixes #2255: global leak with splatted @-params 2012-04-12 23:46:28 -04:00
Maxwell Krohn
b03bea14fa Code and commentary diverged in that short time. Fix. 2012-04-11 19:35:14 -04:00
Maxwell Krohn
2f13fae6f0 restore proper error messages 2012-04-11 19:32:40 -04:00
Maxwell Krohn
a92af02ae8 Add some commentary. 2012-04-11 19:17:55 -04:00
Michael Ficarra
4043124135 tests for fix to #2052, f3a1f46679 2012-04-11 18:35:51 -04:00
Maxwell Krohn
7b66e22bc6 now it works for all of #1183. This should do it. 2012-04-11 18:22:52 -04:00
Maxwell Krohn
5542e00b80 sart work on a bugfix, but we're not covering the exact case in issue #1183 2012-04-11 18:05:33 -04:00
Michael Ficarra
f3a1f46679 fixes #2052: don't manually assign constructors' name property
I'm not sure how we would test this, so... no tests.
2012-04-11 12:14:44 -04:00
Michael Ficarra
08673261b1 comments in the REPL should have no output, not undefined 2012-04-11 11:43:31 -04:00
Jeremy Ashkenas
60c9b94656 CoffeeScript 1.3.1 (quick bugfix for compound assignment to a global variable 2012-04-10 17:26:23 -04:00
Jeremy Ashkenas
f0e17fc20f fixing compound assignments to global variables. oof. 2012-04-10 17:07:38 -04:00
Jeremy Ashkenas
de511e0348 resolving merge 2012-04-10 14:58:59 -04:00
Jeremy Ashkenas
ed8d94f69c CoffeeScript 1.3.0 2012-04-10 14:57:45 -04:00
Jeremy Ashkenas
1b3af684cb Merge pull request #2070 from clutchski/slice-docs
Documenting default slice indexes.
2012-04-10 07:56:44 -07:00
Michael Ficarra
53fe10e4ad REPL once again permits indented expressions 2012-04-05 21:33:15 -04:00
Michael Ficarra
b4e1e54cf7 fixes #2239: REPL didn't accept expressions that were just comments 2012-04-05 18:10:05 -04:00
Michael Ficarra
22db7ae85a Octal and binary literals are more appropriately converted to hex 2012-03-27 21:31:48 -04:00
Michael Ficarra
6a88ce7d1e fixes #2224: various issues related to number lexing
This was... embarrassing. I'm just really glad we didn't cut a release
before this got fixed.
2012-03-27 21:31:20 -04:00
Matt Hickford
7e32c32057 build on Windows - fix spawn command by calling node explicitly 2012-03-25 11:17:46 +01:00
Gerald Lewis
c5737764b5 Issue #2211 -- splats in destructured parameters 2012-03-23 13:20:15 -04:00
Michael Ficarra
ddd6e9a48b abb11c80d1 didn't consider objects with [[Call]] 2012-03-10 11:54:31 -05:00
Michael Ficarra
d6fbfa55b6 number literal error messages: more consistent, removed pluralisation 2012-03-08 14:44:47 -05:00
Michael Ficarra
abb11c80d1 splatted constructors returning null should produce the new instance 2012-03-07 18:19:53 -05:00
Trevor Burnham
ef0cb46b9b Following symlinks when setting module.paths (fixes #2175) 2012-03-05 15:00:20 -05:00
Trevor Burnham
209a0f5a79 Rebuilding browser lib 2012-03-03 13:52:43 -05:00
Michael Ficarra
44e1ccec7e eval's options argument should default to {}, even in the browser 2012-03-02 22:51:38 -05:00
Jeremy Ashkenas
7c1f4b38f4 start with 1, then 2 for reused vars. 2012-02-29 23:46:03 -05:00
Jeremy Ashkenas
b9cfb5a7d8 Fixes #2155 -- existential assignment to a closure 2012-02-29 23:41:57 -05:00
Jeremy Ashkenas
1c8411f628 merging in early error for compound assignment to undeclared variables. 2012-02-28 10:42:11 -05:00
Trevor Burnham
de9970412a Making bare the default for eval in the browser (fixes #2148) 2012-02-27 12:13:46 -05:00
Jeremy Ashkenas
a0e3a8b420 Merge pull request #2117 from AdleyEskridge/master
Improve documentation section about heregexes
2012-02-26 09:10:20 -08:00
Jeremy Ashkenas
bc2ca1ef73 building missed commit change. 2012-02-26 11:48:33 -05:00
Jeremy Ashkenas
9a955859fd link typo 2012-02-23 22:05:41 -05:00
Jeremy Ashkenas
ecfe49adca Merge branch 'master' of github.com:jashkenas/coffee-script 2012-02-23 22:05:39 -05:00
Jeremy Ashkenas
7a75b2b8d0 link typo 2012-02-23 22:05:00 -05:00
Michael Ficarra
127653b7d4 fixes #1537: ignore hidden files/directories in watched directories 2012-02-22 12:19:30 -05:00
Jeremy Ashkenas
b7f2681007 Merge pull request #2121 from jashkenas/issue2120
add --help indicator for passing arguments to scripts run with `coffee`
2012-02-14 11:19:43 -08:00
Michael Ficarra
12d6461bbe added help indicator for passing arguments to scripts run with coffee 2012-02-14 12:25:14 -05:00
Michael Ficarra
28a1101b91 merging/improving @rolftimmermans fix/tests for #2007 2012-02-13 19:47:21 -05:00
Michael Ficarra
8248601b72 Merge branch 'object_literals_in_compr' of https://github.com/rolftimmermans/coffee-script into rolftimmermans-object_literals_in_compr
Conflicts:
	test/objects.coffee
2012-02-13 19:41:47 -05:00
Adley Eskridge
2e78508016 Improve section on heregexes
Currently, the only mention of heregexes' support for interpolation is
in the change log. This feature is useful enough to warrant a mention in
the heregex section itself.

I also felt that the heregex section was a bit less clear than it could
be, so I slightly reworded it.
2012-02-12 10:58:53 -06:00
Michael Ficarra
d9120b8365 Merge pull request #2116 from fawek/illegal-parameter-name-error-message
Fix a confusing error message for '(arguments) ->'
2012-02-12 08:46:05 -08:00
Jakub Wieczorek
eb8e20c3ef Fix a confusing error message for '(arguments) ->' 2012-02-12 15:38:42 +01:00
Ken Gregson
cb0003d894 Issue #2105 refined
Fix updated as suggested by michaelficarra
2012-02-05 19:40:29 -05:00
Ken Gregson
7becf808c7 Issue #2105
Make REPL continuation work better. Check for trailing "\" fails when
run function is called with buffer terminated by newline. Chomp'ing
buffer to remove newline fixes this issue.
2012-02-05 19:12:33 -05:00
Michael Ficarra
13f8348568 Merge pull request #2102 from Nitrodist/master
Fix inherited spelling in documentation
2012-02-03 17:32:14 -08:00
Mark Campbell
d6e2ae292e Fix inherited spelling in documentation 2012-02-03 19:07:48 -06:00
Michael Ficarra
e42f96b76d Merge pull request #2101 from clutchski/style-fixes
Style fixes
2012-02-03 16:40:23 -08:00
clutchski
40a9196c7f Removing tab indentation. 2012-02-03 19:33:03 -05:00
clutchski
0ca255b7b8 Whitespace clean-up. 2012-02-03 19:31:26 -05:00
clutchski
8ade4f1077 Indentation fix. 2012-02-03 19:08:45 -05:00
Stephen Bannasch
deae3e53f5 rake task creates/installs coffeescript.syntax
The ultraviolet gem doesn't work with Ruby 1.9, instead
we need to use the updated 'spox' versions of ultraviolet
and plist:

  spox-ultraviolet, spox-plist

This new rake task: install_coffeescript_syntax loads
either the original gems if running Ruby < 1.9 or the
'spox' versions if running on Ruby >= 1.9.

Load CoffeeScript.tmLanguage directly from the github repo
for the TextMate bundle.

Parse and write the yaml-format syntax file directly
into the correct location in the ultraviolet gem.
2012-01-31 17:15:46 -05:00
clutchski
d74c909930 Documenting default slice indexes. 2012-01-26 15:57:27 -05:00
Michael Ficarra
c0dac45fe1 OptionParser and related tests needed a cleanup
The object returned from OptionParser::parse no longer has a `literals`
property. It was pretty arbitrary, anyway.
2012-01-25 19:47:03 -05:00
Michael Ficarra
eb5c4057a1 Merge branch 'uppercase_radix_prefixes' of git://github.com/geraldalewis/coffee-script 2012-01-21 11:40:20 -05:00
Gerald Lewis
a080bd40fb Issue #2060 cleanup 2012-01-21 11:21:03 -05:00
Jeremy Ashkenas
b7b92eddbd Merge pull request #2062 from clutchski/lint-fixes
Lint fixes
2012-01-20 19:47:46 -08:00
Jeremy Ashkenas
e0ec397046 Merge pull request #2061 from geraldalewis/uppercase_radix_prefixes
Issue #2060 Disallow uppercase radix prefixes and exponential notation
2012-01-20 19:47:09 -08:00
Gerald Lewis
34e517de09 Issue #2060 Disallow uppercase radix prefixes and exponential notation 2012-01-20 17:23:50 -05:00
clutchski
f40ba672db Fixing indentation, trailing whitespace. 2012-01-20 15:18:50 -05:00
Jeremy Ashkenas
8ac440fd52 Merge pull request #2057 from geraldalewis/2054_{arguments}
Issue #2054 "{arguments}"
2012-01-19 17:49:52 -08:00
Gerald Lewis
c3a8a4f81f Issue #2054 "{arguments}"
Fixes error message: SyntaxError: variable name may not be "true"

Permits assigning to "arguments" and "eval" properties in
object literals.
2012-01-19 11:33:43 -05:00
Michael Ficarra
7c56da26f6 fixes #2055: destructuring assignment with new 2012-01-18 23:12:50 -05:00
Michael Ficarra
97cd2dbc41 committing compiled command.js 2012-01-18 23:12:08 -05:00
Jeremy Ashkenas
8affc297fc Merge pull request #2049 from jawj/6d69812046942ae8faacdfb7d715b5bb5e51855c
Hex-escaped bell char for error on --watched compilation
2012-01-17 09:10:38 -08:00
George MacKerron
6d69812046 Oops -- changed bell char from still-octal to hex 2012-01-17 16:50:56 +00:00
Jeremy Ashkenas
de8d16f5e7 Merge pull request #2048 from jawj/beep-on-compile-error
Changed octal to decimal for escaped bell character
2012-01-17 08:40:16 -08:00
George MacKerron
b4712c6a93 Changed octal to decimal for escaped bell character 2012-01-17 16:34:09 +00:00
Jeremy Ashkenas
3fc4f10248 Merge pull request #1953 from jawj/beep-on-compile-error
Added --beep option to command, to warn user on compilation failure with --watch
2012-01-17 07:12:36 -08:00
George MacKerron
ec55335092 Beep on all --watched compile errors 2012-01-17 15:11:06 +00:00
George MacKerron
af51300887 Made --beep the standard watch behaviour, and debounced it 2012-01-17 11:37:47 +00:00
Michael Ficarra
233cd27d70 rebuilding REPL with newest CS compiler 2012-01-16 19:22:31 -05:00
Michael Ficarra
c1f7db8275 typo 2012-01-16 19:20:24 -05:00
Michael Ficarra
0bf488ea49 fixes #2001: spoof a REPL readline interface to handle piped REPL input 2012-01-16 19:20:24 -05:00
Gerald Lewis
bf8e0aa1ea Issue #1547 'use strict' style tweaks, cleanup, and compiled output 2012-01-16 17:35:21 -05:00
Gerald Lewis
4372138fdd Issue #1547 'use strict' Python-style octal literal notation 0o777
Allows octals in the form '0o777' and '0O777'

Case insensitive

Disallows decimals prefixed with '0'
2012-01-16 17:22:19 -05:00
Gerald Lewis
8b179fb391 Issue #1547 'use strict' eval and arguments use restricted 2012-01-16 17:20:55 -05:00
Gerald Lewis
0b7cfba94a Issue #1547 'use strict' future reserved keywords as identifiers prohibited 2012-01-16 17:20:11 -05:00
Gerald Lewis
f43ec97e30 Issue #1547 'use strict' delete operands restricted 2012-01-16 17:20:02 -05:00
Gerald Lewis
7521068ba3 Issue #1547 'use strict' duplicate formal parameter are prohibited
updated error message (thanks @davidchambers)

code style fixes
2012-01-16 17:19:14 -05:00
Gerald Lewis
a2ef66f197 Issue #1547 'use strict' duplicate property definitions in obj literals prohibited 2012-01-16 17:18:53 -05:00
Gerald Lewis
3a694d7dfa Issue #1547 'use strict' octal escape sequences prohibited
RegExp updated (thanks @michaelficarra)
and hex escapes for colors in Cakefile

tests updated (thanks @satyr)

error message conforms to existing Lexer SyntaxErrors
2012-01-16 17:18:13 -05:00
Gerald Lewis
cad108eca0 Issue #1547 'use strict' octal literals prohibited 2012-01-16 17:18:02 -05:00
Gerald Lewis
66eb186a74 Issue #1547 'use strict' tests 2012-01-16 17:17:48 -05:00
Michael Ficarra
6e1e77d46d Merging #2033; fixes #1534 2012-01-16 15:55:59 -05:00
Michael Ficarra
e207c983c1 cleaned up trailing whitespace; merging @geraldalewis's #2033 2012-01-16 15:50:09 -05:00
Michael Ficarra
9a23511965 adding test for #2037; should've included it in the first place 2012-01-16 15:38:00 -05:00
Michael Ficarra
df7ab264ab fixes #2037: line terminators are incorrectly added after herecomments
thanks @geraldalewis for finding the relevant line and making this fix
way too easy for me
2012-01-16 15:38:00 -05:00
Michael Ficarra
9e1d418d7a CoffeeScript.run should be able to safely omit options 2012-01-16 15:38:00 -05:00
Gerald Lewis
ee9311c025 #1534 class then "use strict": modified strict error condition 2012-01-16 14:09:06 -05:00
Gerald Lewis
2ec4c38433 #1534 class then "use strict": multiple directives support 2012-01-14 15:07:32 -05:00
Michael Ficarra
b6310d0365 adding test for #2037; should've included it in the first place 2012-01-14 11:32:09 -05:00
Michael Ficarra
77670b0f3e fixes #2037: line terminators are incorrectly added after herecomments
thanks @geraldalewis for finding the relevant line and making this fix
way too easy for me
2012-01-14 10:40:15 -05:00
Gerald Lewis
fd1fa7d551 #1534 class then "use strict": herecomments fix 2012-01-13 13:59:24 -05:00
Michael Ficarra
0c5726d3ab CoffeeScript.run should be able to safely omit options 2012-01-12 19:25:51 -05:00
Gerald Lewis
5816de39ba #1534 class then "use strict" compiled output 2012-01-12 18:35:04 -05:00
Gerald Lewis
80677a9d2b #1534 class then "use strict" tests 2012-01-12 18:34:50 -05:00
Gerald Lewis
8d952c245f #1534 class then "use strict" 2012-01-12 18:34:34 -05:00
Michael Ficarra
6d33a2e1a0 allowing capital B in binary literals; see #2021; thanks @BrendanEich 2012-01-12 13:21:29 -05:00
charliesome
3bd4dea305 fix the precedence test so it's actually meaningful 2012-01-11 21:37:06 +11:00
charliesome
a4249fd573 power operator + tests 2012-01-11 17:14:23 +11:00
Michael Ficarra
ff05575b78 fixes #1973: redefining Array/Object constructors shouldn't break helpers 2012-01-10 17:01:27 -05:00
Trevor Burnham
16e297ab61 Adding test to ensure that header is disabled by default 2012-01-10 14:03:48 -05:00
Trevor Burnham
447ce82721 Merge pull request #1793 from TrevorBurnham/header
Adding header to generated JS (#1778)
2012-01-10 11:01:16 -08:00
Trevor Burnham
86e4d79ffb Early return from CoffeeScript.compile when header not enabled 2012-01-10 14:00:29 -05:00
Trevor Burnham
11342ef97b Rebuilding -> our JS files now include the generated header 2012-01-10 12:55:41 -05:00
Trevor Burnham
48c17e2c3d Adding header to files compiled with command.coffee 2012-01-10 12:54:48 -05:00
Trevor Burnham
36a69864e3 Adding support for a header with version number to CoffeeScript.compile (#1778) 2012-01-10 12:54:21 -05:00
Rolf Timmermans
64b0e50609 Fix error that prevented object literals from being properly returned from comprehensions. 2012-01-09 09:08:58 +01:00
Jeremy Ashkenas
806df9bc1e Merge pull request #2011 from zzen/patch-1
Cake::printTasks broken in node v0.4
2012-01-05 10:43:35 -08:00
Jakub Nešetřil
f98c613ecc Fixed cake::printTasks to be backward compatible with node v0.4 2012-01-05 19:40:13 +01:00
Michael Ficarra
642fcbbbfe Last commit accidentally broke autocompletion. Fixed. 2012-01-03 18:21:26 -05:00
Michael Ficarra
58bb6725e4 fixes #1979: add multiline support to the REPL; press Ctrl-v to activate 2012-01-03 14:56:17 -05:00
Jeremy Banks
3484ca5e64 Merge remote-tracking branch 'jashkenas/master' into fix-conditional-assignment
Conflicts:
	test/assignment.coffee
2012-01-03 03:09:46 -05:00
Jeremy Ashkenas
0b1b7c36d2 removing out of date Windows instructions -- nothing extra needed now. 2011-12-30 09:07:26 -05:00
Jeremy Ashkenas
8eb04cd80b removing out of date Windows instructions -- nothing extra needed now. 2011-12-30 09:07:10 -05:00
Jeremy Ashkenas
8dfec65034 Fixes #1980 2011-12-27 16:54:14 -08:00
Jeremy Ashkenas
4a0e8139ea Merge pull request #1970 from michaelficarra/issue1966
fixes #1966: external constructors should produce their return value
2011-12-27 09:33:56 -08:00
Michael Ficarra
c8059a752f fixes #1976: minor REPL tab completion bug fixes 2011-12-27 00:45:29 -05:00
Jeremy Ashkenas
62a331a3dc Fixes #1961, Fixes #1974, compound assignments to an implicit object. 2011-12-26 09:45:48 -08:00
Michael Ficarra
90e0ce97e4 unnecessary 2011-12-24 15:44:51 -05:00
Trevor Burnham
3b3c069c3b Moving rewatch to end of function for scoping (thanks, satyr) 2011-12-24 11:00:09 -08:00
Michael Ficarra
46b34d4b43 whitespace cleanup 2011-12-24 07:04:34 -05:00
Michael Ficarra
080ed2e8dd fixes #1966: external constructors should produce their return value 2011-12-24 06:51:14 -05:00
Michael Ficarra
0c4cb309b0 getting rid of excessive spaces after Class.name = "Class" assignment 2011-12-24 06:49:21 -05:00
Michael Ficarra
8d5f800e2f literals need newlines after them 2011-12-24 06:46:09 -05:00
Michael Ficarra
e2a205ab22 making use of slicing syntax 2011-12-24 06:04:05 -05:00
Trevor Burnham
21a499c726 Merge branch 'rewatch2' 2011-12-22 12:02:52 -08:00
Trevor Burnham
e5f3750de2 Removing rewatchTimer (see discussion at #1964) 2011-12-22 12:02:25 -08:00
Jeremy Ashkenas
4944fba3f7 Merge pull request #1964 from TrevorBurnham/rewatch2
Rewatch files on change event (redo)
2011-12-22 11:43:22 -08:00
Trevor Burnham
65d21766b7 Rewatching files more liberally and consistently 2011-12-22 11:30:12 -08:00
Trevor Burnham
2a0521fba6 Freeing compilation from 250ms delay 2011-12-22 11:03:39 -08:00
Trevor Burnham
97cd7cc1c9 Rewatching on every file event, be it change or rename 2011-12-22 10:58:30 -08:00
Trevor Burnham
d3f60599e8 Removing duplicate watchErr declaration (my bad) 2011-12-22 10:50:10 -08:00
Jeremy Ashkenas
8728706237 Merge pull request #1959 from jashkenas/issue1910
fixes #1910: loop index should be mutable within a loop iteration and immutable between loop iterations
2011-12-21 11:42:04 -08:00
Michael Ficarra
c6c527e830 appeasing Jeremy: switching prefix increments out for postfix equivalent 2011-12-21 14:37:38 -05:00
Michael Ficarra
fc0a169a9a fixes #1910: loop index should be mutable within a loop iteration and immutable between loop iterations 2011-12-21 14:06:34 -05:00
Jeremy Ashkenas
5b7366583d Merge pull request #1956 from Gregg/master
Seperated Books and Screencasts and added Code School course
2011-12-20 20:03:16 -08:00
Gregg Pollack
01e03ae2d8 Seperated Books and Screencasts and added Code School course 2011-12-20 22:51:39 -05:00
Jeremy Ashkenas
8a1deee8d8 Merge pull request #1955 from clutchski/implicit-slice
Allowing both end-points of slices to be implicit.
2011-12-20 17:29:30 -08:00
clutchski
2e06316e31 Allowing both end-points of slices to be implicit. 2011-12-20 19:21:26 -05:00
George MacKerron
6870af36b7 Added --beep option to command, to warn user on compilation failure with --watch 2011-12-20 15:27:02 +00:00
Trevor Burnham
0f1dbffa40 Adding test case: do (x = y) -> overrides existing x value 2011-12-19 11:33:52 -05:00
Trevor Burnham
cfb9cb6fe9 Exiting when users try to use --watch and fs.watch is undefined 2011-12-19 11:23:27 -05:00
Jeremy Ashkenas
9de0d886eb bringing back an ol' line of docco. 2011-12-18 23:01:20 -05:00
Jeremy Ashkenas
5c24b80367 Amending new do test. 2011-12-18 21:24:29 -05:00
Jeremy Ashkenas
a477880edc Fixes #960 -- 'do' is now more efficient and permissive about undefined values. 2011-12-18 20:53:30 -05:00
Jeremy Ashkenas
00f5f54b77 removing unused DO from grammar 2011-12-18 20:32:09 -05:00
Jeremy Ashkenas
1018c51359 Fixes #494: Forcing named classes in CoffeeScript (named functions) ... even in IE. 2011-12-18 20:00:09 -05:00
Jeremy Ashkenas
8d8c345216 removing unused @name 2011-12-18 19:37:11 -05:00
Jeremy Ashkenas
dd25ac03e4 fixing the borked previous merge 2011-12-18 18:53:34 -05:00
Jeremy Ashkenas
3ff194dd61 merging in Matt's generated tag for coffeelint. 2011-12-18 18:44:56 -05:00
Jeremy Ashkenas
215979c9e0 bumping to 1.2.1-pre 2011-12-18 15:31:17 -05:00
Jeremy Ashkenas
6d3acdcd2f Merge branch 'master' into gh-pages 2011-12-18 15:29:29 -05:00
Jeremy Ashkenas
9abe614ea8 CoffeeScript 1.2.0 2011-12-18 15:29:02 -05:00
Jeremy Ashkenas
36c171d78e style in command watch 2011-12-18 15:27:08 -05:00
Jeremy Ashkenas
c75c4421a7 merged 2011-12-18 15:23:42 -05:00
Trevor Burnham
55998f7481 Fixing bug that was causing directory deletes to be ignored 2011-12-18 15:21:50 -05:00
Trevor Burnham
d5acd7f338 Fixing bug that was causing file deletes to be ignored, debouncing compileJoin 2011-12-18 15:19:08 -05:00
Trevor Burnham
d3cc05bdfc Preventing compileJoins when directory events do not affect source files 2011-12-18 14:42:16 -05:00
Trevor Burnham
07ccd91022 More ENOENT-catching 2011-12-18 14:39:19 -05:00
Trevor Burnham
edd0b661f3 Avoiding duplicate compileJoins on directory deletion 2011-12-18 14:35:32 -05:00
Jeremy Ashkenas
4b0fabd7cb pushing this waypoint... 2011-12-18 14:26:23 -05:00
Jeremy Ashkenas
55e794dbe5 Merge branch 'issue1941' of git://github.com/TrevorBurnham/coffee-script 2011-12-18 14:21:35 -05:00
Trevor Burnham
988dedd08d Removing remaining ENOENT throws 2011-12-18 14:15:33 -05:00
Jeremy Ashkenas
f66564273c Merge pull request #1944 from TrevorBurnham/issue1941
Misc fixes for --watch
2011-12-18 11:13:22 -08:00
Trevor Burnham
dfc602159e Limiting watched file compilation to once every 25ms 2011-12-18 14:05:18 -05:00
Trevor Burnham
9fde794858 Handling all ENOENTs potentially thrown by fs.watch (hopefully) 2011-12-18 14:01:13 -05:00
Trevor Burnham
ed1ddbce50 Preventing fs.stat from throwing ENOENT errors 2011-12-18 13:50:04 -05:00
Jeremy Ashkenas
cda95afd3e tweaking documentation 2011-12-18 13:41:33 -05:00
Jeremy Ashkenas
0e40feb9af prepping for 1.2.0 2011-12-18 13:21:00 -05:00
Jeremy Ashkenas
846306f85e Fixes #1771: Fixing the indexOf shim. 2011-12-18 13:02:27 -05:00
Jeremy Ashkenas
a0aa090f2c Fixes #1859 -- postfix if preceding an unparenthesized single-line function body 2011-12-18 12:55:21 -05:00
Jeremy Ashkenas
460b5d6edb Got --watch with directory watching and addition / removal of inner subdirectories working... 2011-12-18 12:26:04 -05:00
Jeremy Ashkenas
b9805f3f80 More work on watching / joining ... Fixes #1941, fixes #365. Watched files may now be added and removed, including with --join 2011-12-18 11:27:02 -05:00
Jeremy Ashkenas
0069c4901f reverting the closure wrapper removal again. 2011-12-18 10:35:42 -05:00
Jeremy Ashkenas
93b118bfa2 Revert "reverting to 26a28abcb5 behaviour"
This reverts commit 38b6a43e26.
2011-12-18 10:27:32 -05:00
Jeremy Ashkenas
7c6bc95a84 Correcting and cleaning up --join ... now it works in conjunction with --watch 2011-12-18 10:27:22 -05:00
Jeremy Ashkenas
ee8a1a3b68 style fixes to command.coffee 2011-12-18 09:17:01 -05:00
Jeremy Ashkenas
5bca978444 Fixes #1853 -- fs.watch trouble. 2011-12-18 09:05:42 -05:00
clutchski
347409e354 Code review tweaks. 2011-12-17 19:18:24 -05:00
clutchski
c284f3f226 Mark implicit parens generated. 2011-12-17 18:45:48 -05:00
clutchski
cdd3c13ce9 Marking indentation tokens generated with helper. 2011-12-17 18:40:50 -05:00
clutchski
f6dbaa7c31 Adding generated token helper function. 2011-12-17 18:25:51 -05:00
clutchski
a4553c970c Delete trailing whitespace. 2011-12-17 18:04:50 -05:00
Michael Ficarra
38b6a43e26 reverting to 26a28abcb5 behaviour
This is only slightly problematic for the most pathological of cases
where a prelude is followed by a set of statements, none of which
generate top-level variables or attempt to return. In these cases, the
non-prelude statements will be indented. See related discussion at
e4b3e838e2.
2011-12-15 22:11:42 -05:00
Jeremy Ashkenas
121009dec4 Fixes #1813 2011-12-15 16:03:01 -05:00
Jeremy Ashkenas
510fb59e29 Fixes #1871, allows single-line implicit ends to close implicit objects. 2011-12-15 15:43:38 -05:00
Jeremy Ashkenas
e4b3e838e2 removing the closure-wrapping-removal optimization, because it was incorrectly formatting the code it optimized. 2011-12-15 15:21:58 -05:00
Jeremy Ashkenas
4b70a16cf9 refactoring rewriter to make the methods read consistently. 2011-12-15 13:33:47 -05:00
Jeremy Ashkenas
af0ee70ea3 Fixes #1903 2011-12-15 12:29:03 -05:00
Jeremy Ashkenas
ad39150565 Fixing crappy JS AMD code. 2011-12-15 11:21:38 -05:00
Jeremy Ashkenas
686ef9e7f4 Fixes #1838 2011-12-14 18:31:20 -05:00
Jeremy Ashkenas
fac615108c Fixes #1861 2011-12-14 12:44:27 -05:00
Jeremy Ashkenas
ddfe89d916 cleaning up super assignment. 2011-12-14 12:38:19 -05:00
Jeremy Ashkenas
b0948f81dd Fixes #1876 2011-12-14 12:17:21 -05:00
Jeremy Ashkenas
00f9e244f2 Fixes #1922 2011-12-14 11:32:40 -05:00
Jeremy Ashkenas
eb55f2d8f4 style 2011-12-14 11:26:25 -05:00
Jeremy Ashkenas
b50315d8a0 Adding a more comprehensive test case for the previous commit. 2011-12-14 11:06:01 -05:00
Jeremy Ashkenas
85286b8ca5 Fixes #1842 2011-12-14 11:02:10 -05:00
Jeremy Ashkenas
74944da211 fixing extra newline in the prelude 2011-12-14 10:41:17 -05:00
Jeremy Ashkenas
c9a0a33fa2 reverting 63ab88 2011-12-14 10:39:20 -05:00
Jeremy Ashkenas
b12be3188f tweaking dev dependencies 2011-12-14 10:37:05 -05:00
Michael Ficarra
26a28abcb5 fixes #1509: compile initial comments/literals outside of safety wrapper 2011-12-12 02:49:21 -05:00
Michael Ficarra
5f1314cd66 Merge pull request #1927 from clutchski/traverse-children
Documentation fix: s/traverse/traverseChildren/
2011-12-11 22:03:23 -08:00
clutchski
0ad9d4bf16 Documentation fix: s/traverse/traverseChildren/ 2011-12-12 00:57:17 -05:00
Michael Ficarra
621e5648e3 fixed #1858 for real now 2011-12-10 22:40:08 -05:00
Michael Ficarra
f0728fcf8f fixes #1858: top-level returns should force safety wrapper 2011-12-10 22:06:38 -05:00
Michael Ficarra
63ab886e9f removed excessive spacing 2011-12-10 21:19:59 -05:00
Michael Ficarra
7b4f1b165d fixes #1924: CoffeeScript.compile shouldn't modify options object 2011-12-10 21:00:28 -05:00
Michael Ficarra
8855eede5f Merge pull request #1697 from showell/doc-usage
split out Usage section
2011-12-07 08:38:00 -08:00
Michael Ficarra
69d49e137a more correct jison requirement 2011-12-07 11:13:51 -05:00
Jeremy Ashkenas
94e17e0d88 Merge pull request #1916 from ded/patch-1
jison 0.2.11 requires node v0.4 - v0.5
2011-12-06 15:41:34 -08:00
Dustin Diaz
5debc3c903 jison 0.2.11 requires node v0.4 - v0.5, which in turns makes coffee-script incompatible with node v0.6 2011-12-06 15:03:02 -08:00
Michael Ficarra
0ce332edca fixes #1911: remove spacing around initial skipped comments/JS 2011-12-04 16:43:26 -05:00
Jeremy Ashkenas
b122406683 huh. 2011-11-25 08:49:51 -05:00
Jeremy Ashkenas
35dc56d785 making debugger an expression. 2011-11-25 08:35:20 -05:00
Jeremy Ashkenas
6cb13f4c44 Merge pull request #1892 from marijnh/master
Two tiny fixes
2011-11-25 05:01:56 -08:00
Marijn Haverbeke
26d5c99570 Fix bug in lexer's reserved word error message 2011-11-25 12:46:40 +01:00
Marijn Haverbeke
24836ccf6d Stop treating debugger statements as jumps
Since in most debuggers you can continue past them.

No tests added, since I wasn't sure how to test code with `debugger`
in it.
2011-11-25 12:46:39 +01:00
Jeremy Ashkenas
7d22a011ab amending the previous test 2011-11-24 09:58:04 -05:00
Jeremy Ashkenas
e9e5ae119f adding a test case for throw-as-an-expression. 2011-11-24 09:57:34 -05:00
Jeremy Ashkenas
2c92904109 Reverting conclusion of #1001 -- Throw should be able to be used as part of an expression. 2011-11-24 09:36:16 -05:00
Jeremy Ashkenas
2fb6d0beb9 Revert "Closes #1001. Throw cannot be directly used as an expression with parens, but can appear as a statement in an expression."
This reverts commit 96b22a16eb.
2011-11-24 09:33:45 -05:00
Jeremy Ashkenas
b9c17cab3c Merge pull request #1888 from joliss/fat-arrow-doc
Document fat arrow in class definitions.
2011-11-23 09:18:00 -08:00
Jo Liss
d2c3b79617 Document fat arrow in class definitions.
This pleasently surprised but also confused me when it worked. Now it's
documented. No example (yet), alas, but better than nothing.

Originally added in/around 07e66dd2.
2011-11-23 18:15:50 +01:00
Jeremy Ashkenas
03b8222c9e Merge pull request #1887 from joliss/index-doc
Use "index" for index variable in for loop
2011-11-23 07:33:10 -08:00
Jo Liss
57e109ff11 Use "index" for index variable in for loop
This confused me every time I Ctrl+F'ed the home page for "index" and only got
this cryptic statement:

"Comprehensions replace (and compile into) for loops, with optional guard clauses
and the value of the current array index."

Now I can see how the index is used in the code.
2011-11-23 16:25:21 +01:00
Michael Ficarra
30614c5721 I'd rather have a long line than an orphan. 2011-11-18 15:17:26 -05:00
Jeremy Ashkenas
55521a2f4c Merge pull request #1868 from geraldalewis/1840_invocation_prototype_prop_access
#1840 Invocation Prototype Prop Access
2011-11-14 09:59:58 -08:00
Gerald Lewis
8762e37e58 Merge branch '1840' into 1840_invocation_prototype_prop_access 2011-11-14 11:43:30 -05:00
Gerald Lewis
fba69f5651 tests for 1840 2011-11-14 11:37:16 -05:00
Gerald Lewis
bde1c6282e rebuilt jison parser for 1840 2011-11-14 11:36:58 -05:00
Gerald Lewis
a24451b6d3 fixes #1840: invocations followed by prototype property access now correctly compile 2011-11-14 11:35:54 -05:00
Michael Ficarra
d0b8cded6b 1e25c9da306f38ddf7bd3c63ed7c9540b75384e0#commitcomment-719177 2011-11-14 11:18:45 -05:00
Jeremy Ashkenas
1e25c9da30 Merge pull request #1851 from michaelficarra/issue1844
fixes #1844: bound functions in nested comprehensions causing empty var statements
2011-11-14 07:49:51 -08:00
Trevor Burnham
fe78e65b16 Merging pull req #1826 2011-11-13 20:42:02 -05:00
Trevor Burnham
9e1d1f57f0 Merge pull request #1866 from TrevorBurnham/issue1862
Interface enhancements for cake (#1862)
2011-11-13 17:32:53 -08:00
Trevor Burnham
73acfa18a3 Just showing the error thrown by OptionParser rather than parsing it 2011-11-13 16:20:51 -05:00
Trevor Burnham
266d97f8f5 On second thought, just saying 'run cake' on error rather than listing all options 2011-11-13 15:28:56 -05:00
Trevor Burnham
a70753e6d3 Prefacing task list with the relative Cakefile path 2011-11-13 15:13:05 -05:00
Trevor Burnham
97dbb7bb49 Showing task list on error 2011-11-13 15:12:12 -05:00
Trevor Burnham
79945ad473 Using console.error for errors instead of console.log 2011-11-13 15:11:26 -05:00
Trevor Burnham
1d7a3b4d0f Adding 'No such option' output to parallel 'No such task' (fixes #1862) 2011-11-13 14:53:41 -05:00
satyr
5bf8b422f8 nodes: added missing jump-guard in While::makeReturn, fixing #1850 2011-11-11 06:56:49 +09:00
Trevor Burnham
9633816d7a Warning when fs.watch is unavailable, rather than throwing errors 2011-11-10 15:11:27 +01:00
Trevor Burnham
cc8708493e Forgot to build on previous commit 2011-11-10 15:04:33 +01:00
Trevor Burnham
51b25fb3d8 Bumping version to 1.1.4-pre 2011-11-10 14:54:46 +01:00
Trevor Burnham
b41a69da2d Merge pull request #1847 from TrevorBurnham/rewatch
Re-fs.watching files on rename event (fixes #1803)
2011-11-10 05:49:38 -08:00
Trevor Burnham
1ce92d1aeb Ignoring exception thrown when trying to re-watch a file after rename 2011-11-10 14:44:48 +01:00
Michael Ficarra
496978abdd tiny cleanup in /src/scope.coffee 2011-11-10 03:34:58 -05:00
Michael Ficarra
424bb17224 cleaning up tab calculation in last commit 2011-11-10 03:14:41 -05:00
Michael Ficarra
6d6a5f609a fixes #1844: bound functions in nested comprehensions
causing empty var statements
2011-11-10 03:08:38 -05:00
Michael Ficarra
a296957771 fixes #1848: line number reported as NaN in interpolation parse errors 2011-11-10 01:09:43 -05:00
Michael Ficarra
fbe84e376c forgot to build 11544f2717 2011-11-10 01:09:21 -05:00
Trevor Burnham
d30aa6d621 Ensuring that fs.watch duplication does not occur 2011-11-09 19:54:43 +01:00
Trevor Burnham
966063db0c "Re-fs.watching files on rename event"
See discussion at #1803, #1846, and at
https://github.com/joyent/node/issues/2062
2011-11-09 19:49:14 +01:00
Jeremy Ashkenas
13717e2e65 Merge branch 'master' into gh-pages 2011-11-09 12:53:27 -05:00
Jeremy Ashkenas
7aaaac42bc Merge pull request #1845 from joliss/master
update link
2011-11-09 09:51:25 -08:00
Jo Liss
65930224ee update link 2011-11-09 18:41:09 +01:00
Jeremy Ashkenas
97d1eedd5a Merge pull request #1839 from michaelficarra/issue1832
fixes #1832: speed up `CoffeeScript.eval` in browser script
2011-11-08 19:26:37 -08:00
Michael Ficarra
11544f2717 fixes #1832: speed up CoffeeScript.eval in browser script 2011-11-08 19:56:00 -05:00
Jeremy Ashkenas
590bd3dec9 Merge branch 'master' into gh-pages 2011-11-08 18:13:07 -05:00
Jeremy Ashkenas
74501f643c whoops. 2011-11-08 18:12:58 -05:00
Jeremy Ashkenas
cebfe394ad change_log -> changelog 2011-11-08 18:11:33 -05:00
Jeremy Ashkenas
2e037dcb93 updating gh-pages 2011-11-08 18:08:19 -05:00
Jeremy Ashkenas
3e41659095 CoffeeScript 1.1.3 2011-11-08 18:01:45 -05:00
Jeremy Ashkenas
d592d2c9cb Fixes #1803 -- use fs.watch instead of fs.watchFile ... more of a PITA, but hey. 2011-11-08 16:13:45 -05:00
Jeremy Ashkenas
78491b3a58 fixing relative path to jsl.conf 2011-11-08 16:04:10 -05:00
Jeremy Ashkenas
426f51db21 removing another process.binding() private snafu 2011-11-08 15:58:48 -05:00
Sam Day
8a41ee95c7 Adding updated extras/coffee-script.js 2011-11-06 11:18:18 +10:00
Michael Ficarra
5ae4e06770 cake test: change eq to use egal semantics, paralleling arrayEq 2011-11-05 11:14:09 -04:00
Michael Ficarra
683b3afbc1 cake test: count number of complete tests that pass, not assertions 2011-11-05 11:12:50 -04:00
Michael Ficarra
1c86aee7a4 joyent/node#1914: REPL no longer hides undefined results 2011-11-05 10:35:27 -04:00
Michael Ficarra
11f048c368 compiling @jashkenas' last commit: f0043468a0 2011-11-05 10:34:44 -04:00
Jeremy Ashkenas
f0043468a0 removing process.ARGV from command.coffee, as it is gone in 0.6.0 2011-11-05 07:46:58 -04:00
Sam Day
3564f51fb5 Added AMD support. 2011-11-05 20:44:19 +10:00
Jeremy Ashkenas
df641261d6 trying with just the .org 2011-10-31 22:54:32 -04:00
Jeremy Ashkenas
f3486499ac adding a CNAME file for github pages. 2011-10-31 20:52:31 -04:00
Jeremy Ashkenas
a6081caf50 Merge pull request #1807 from TrevorBurnham/console_io
fixes #1798: using process.stderr in command.coffee
2011-10-27 08:42:17 -07:00
Trevor Burnham
c77f7737a5 Using process.stderr in command.coffee (fixes #1798) 2011-10-27 11:23:03 -04:00
Jeremy Ashkenas
91cb433b66 Revert "Merge branch 'console_io' of git://github.com/TrevorBurnham/coffee-script"
This reverts commit 2cb42b502c, reversing
changes made to 64bd4b3f74.
2011-10-24 16:19:15 -04:00
Jeremy Ashkenas
2cb42b502c Merge branch 'console_io' of git://github.com/TrevorBurnham/coffee-script 2011-10-24 14:56:20 -04:00
Jeremy Ashkenas
64bd4b3f74 rebuilding lexer.js 2011-10-24 14:51:41 -04:00
Trevor Burnham
41f2d2f789 Using console.log and console.error in command.coffee (fixes #1798) 2011-10-24 14:39:55 -04:00
Jeremy Ashkenas
913171f708 Merge pull request #1787 from revence27/binary
Binary notation integers (0b100 as 4).
2011-10-24 07:07:36 -07:00
Trevor Burnham
3f4daaf2ad Whoops, mergefail; corrected 2011-10-23 22:45:32 -04:00
Trevor Burnham
cf32ba0149 Merge pull request #1661 from TrevorBurnham/master
Allow user-added globals on the REPL (fixes #1654)
2011-10-23 19:34:07 -07:00
Trevor Burnham
6bec372684 Merging current master 2011-10-23 22:23:29 -04:00
Revence Kalibwani
620d8ce9ed Cleaner style. 2011-10-22 10:40:26 +03:00
Revence Kalibwani
bf8062ce7f Unindent. :-o 2011-10-21 22:49:47 +03:00
Revence Kalibwani
350e50600d Neater numberToken function. 2011-10-21 22:33:03 +03:00
Revence Kalibwani
938abae4b5 One test; viz., for binary literal. 2011-10-21 22:27:08 +03:00
Revence Kalibwani
264f881a81 Binary notation integers (0b100 as 4). 2011-10-21 21:44:56 +03:00
Michael Ficarra
d359764fba fixes #1774: generate safety wrapper only when necessary. awesome. 2011-10-17 16:12:09 -04:00
Jeremy Ashkenas
4a937ec3b8 Merge pull request #1757 from disnet/nocolor
Add flag to surpress color in cake output
2011-10-10 08:45:27 -07:00
Tim Disney
0ded5b3ff3 removing old changes 2011-10-06 21:39:24 -07:00
Tim Disney
c20a8ff53d using NODE_DISABLE_COLORS instead of flag 2011-10-06 18:43:53 -07:00
Tim Disney
2f38ed5e69 adding flag to surpress color in cake output 2011-10-06 16:17:36 -07:00
Michael Ficarra
054fe34434 fixes #1754: support filenames starting with - by using -- arg 2011-10-06 14:51:27 -04:00
Michael Ficarra
e686e3f6e9 fixes #1752: passing POSIX-style arguments to scripts through the CLI 2011-10-06 04:11:41 -04:00
Jeremy Banks
a768f167cf Improved tests for #1627. 2011-10-04 22:26:50 -04:00
Michael Ficarra
cf996d2c4a quick fix to part of new issue in #1099:
`not in []` unconditionally compiled to `false`
2011-10-03 06:43:00 -04:00
Michael Ficarra
9fef66ffcf empty regular expressions with flags still need to be compiled to /(?:)/ 2011-10-03 03:49:59 -04:00
Michael Ficarra
1627922060 unless is useful outside of single-line statements 2011-10-02 21:03:36 -03:00
Jeremy Ashkenas
981db17b8f Adopting coco-style efficient bound functions for the common case ... but not for class/prototypes. 2011-09-25 21:44:23 -04:00
Jeremy Banks
03a8340a85 Add tests for conditional assignment of variable in parent scope. 2011-09-23 00:45:33 -04:00
Jeremy Banks
036197fac3 Prohibiting conditional assignment of undefined variables for #1627. 2011-09-23 00:45:33 -04:00
Michael Ficarra
52dd348289 fixes #1724 for heregexen
TODO: DRY up that regex handling code so we don't have a duplicate test/error
2011-09-22 04:39:13 -04:00
Michael Ficarra
f4c1b20ec2 fixes #1724: regular expressions beginning with *
also normalised capitalisation in a few error messages
2011-09-22 04:09:58 -04:00
Michael Ficarra
08762a101c fixes #1723: operator precedence in unbounded splice compilation 2011-09-22 02:14:07 -04:00
Michael Ficarra
3b5c889040 fixes #1722: operator precedence in unbounded slice compilation 2011-09-21 18:56:20 -04:00
Jeremy Ashkenas
0171204e50 Merge pull request #1719 from jeremybanks/master
Upgrade jQuery in documentation from v1.4.2 to v1.6.4
2011-09-20 21:42:36 -07:00
Jeremy Banks
dd82b15b78 Upgrade jQuery in documentation from 1.4.2 to 1.6.4. 2011-09-21 00:27:32 -04:00
Jeremy Ashkenas
3d91b10927 Fixes #1714 2011-09-20 23:21:46 -05:00
Jeremy Ashkenas
65b3bf0d4c merging in the try coffeescript linking patch from Jeremy Banks, and regen-ing source. The newline patch makes a *huge* difference on the documentation page. 2011-09-20 22:42:19 -05:00
Jeremy Ashkenas
4c0b2372c7 Merge branch 'master' of https://github.com/jeremybanks/coffee-script 2011-09-20 22:33:35 -05:00
Jeremy Ashkenas
54110c98d9 Issue #1714 ... broken 'in' after raw range 'for' 2011-09-20 22:28:07 -05:00
Michael Ficarra
a2c593bc2c too many newlines after errors in the REPL 2011-09-19 02:18:42 -04:00
Jeremy Banks
de0122dc17 Moving [Link] button's inline style to stylesheet. 2011-09-18 21:53:08 -04:00
Jeremy Banks
2c43a9d209 Pulled Try CoffeeScript fragment prefix into a variable, other minor improvements. 2011-09-18 21:43:10 -04:00
Jeremy Ashkenas
6da70168a6 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-09-18 20:16:14 -05:00
Jeremy Ashkenas
0199515cef experimental change -- comments wanted. writing out helper functions and assignments as a single line, to minimize clutter. 2011-09-18 17:29:01 -05:00
Jeremy Ashkenas
37705e712b removing the extra newline that block comments take 2011-09-18 17:19:09 -05:00
Jeremy Ashkenas
d2b0404188 big whitespace / readability change. join top level block with extra newlines, and class definitions as well. 2011-09-18 17:16:39 -05:00
Jeremy Banks
80f9a20bfd Adds [Link] button to Try CoffeeScript interface. 2011-09-18 17:56:09 -04:00
Michael Ficarra
94a9551ffa fixes #1699 2011-09-18 00:52:30 -03:00
Jeremy Ashkenas
4419f7ca0f Issue #1703, - --x 2011-09-17 22:21:47 -04:00
Jeremy Ashkenas
19f77cfff5 Unified error handling in the lexer. 2011-09-17 21:39:24 -04:00
satyr
3cdee749c6 rewriter: followed up d03d288 2011-09-17 09:18:14 +09:00
satyr
d03d288a98 fixed #1299: overhauled token pairings 2011-09-17 08:26:04 +09:00
Steve Howell
b8d60a9cf1 split out Usage section 2011-09-12 22:58:08 -07:00
Jeremy Ashkenas
c5dbb1c933 Issue #1687. Keeping a reference to __originalDirname in Cake tasks, after Node's __dirname 2011-09-11 23:41:50 -04:00
Jeremy Ashkenas
85342f1e31 Issue #1682, futher refinements to command-line help. 2011-09-11 22:43:28 -04:00
Jeremy Ashkenas
c1f9ae8208 style tweaks for #1687 2011-09-11 22:25:27 -04:00
Jeremy Ashkenas
bd1672621c Merge pull request #1687 from fortes/1686_cakefile_parent_dirs
Check parent directories for Cakefiles
2011-09-11 19:17:20 -07:00
Michael Ficarra
2d6cda7f32 sorting options in coffee --help 2011-09-11 22:04:44 -04:00
Jeremy Ashkenas
2c8690ee39 Merge pull request #1691 from willbailey/master
I didn't see an example of how to do this and thought it might be helpful for others.
2011-09-11 18:11:14 -07:00
Filipe Fortes
6c98480a1e Remove extra call to path.exists when finding Cakefile 2011-09-11 20:50:27 -04:00
Will Bailey
98cc7eb149 [docs] examples of using guards and indices in array comprehensions 2011-09-11 12:43:39 -07:00
Filipe Fortes
6278930aef Check parent directories for Cakefiles. Closes #1686 2011-09-10 20:46:25 -04:00
Jeremy Ashkenas
0b57b3136c Edited src/command.coffee via GitHub 2011-09-09 23:44:34 -03:00
Michael Ficarra
46b7a2d17c Merge branch '1643_splatted_access' of https://github.com/geraldalewis/coffee-script 2011-09-09 22:07:58 -04:00
Trevor Burnham
588af1f6af Merge pull request #1673 from codelahoma/watch-help
clarify --watch option in "coffee -h" output
2011-09-09 18:50:13 -07:00
Gerald Lewis
34f99c4a79 #1643: Bugfix in heredoc in test for 1643 2011-09-09 21:30:00 -04:00
Jeremy Ashkenas
a0d4242da4 Merge pull request #1666 from geraldalewis/1643_splatted_access
#1643 splatted access
2011-09-09 16:17:24 -07:00
Gerald Lewis
447c3639e7 #1643: compiled JS 2011-09-09 19:03:40 -04:00
Gerald Lewis
f0e276c63a #1643: Remove superfluous assignable check from destructured Splats 2011-09-09 19:03:12 -04:00
Gerald Lewis
7d4e693d20 #1643: Updated tests 2011-09-09 18:59:35 -04:00
Gerald Lewis
03372c9b29 #1643: Tag subpatterns in Assign#compilePatternMatch to prevent appending reference to RHS 2011-09-09 18:58:59 -04:00
Gerald Lewis
6d0ba4b3bd #1643: Clean up Assign#compile and Assign#compilePatternMatch 2011-09-09 18:57:57 -04:00
Gerald Lewis
6622f015ab #1643: Add unwrap method to Splat 2011-09-09 18:55:08 -04:00
Rod Knowlton
d6ec5e40cc tiny edit 2011-09-09 15:24:56 -05:00
Rod Knowlton
c44b80b6b6 build to update lib 2011-09-08 20:02:12 -05:00
Rod Knowlton
9db814f70d change phrasing of watch help text 2011-09-08 18:04:59 -05:00
Rod Knowlton
d7f9054108 change phrasing of watch help text 2011-09-08 18:02:23 -05:00
Rod Knowlton
2df9204104 change phrasing of watch help text 2011-09-08 17:59:39 -05:00
Michael Ficarra
b02ac3a733 removed a gratuitous comma 2011-09-08 02:06:58 -03:00
Rod Knowlton
ed4f7046d3 clarify --watch option in "coffee -h" output 2011-09-07 20:19:14 -05:00
satyr
ad1bc1e0b8 closes #1669; loop results are now collected in the same way as auto-returns are generated 2011-09-07 12:13:23 +09:00
Trevor Burnham
70a5402509 Merge pull request #1625 from codelahoma/gh-pages
Clarify `--watch` option on homepage.
2011-09-06 13:31:34 -07:00
satyr
2ea51b02cc fixed #1102; lexer: cleaned up unfinished 2011-09-07 02:56:14 +09:00
Jeremy Ashkenas
036fc561a2 Merge pull request #1662 from geraldalewis/1195_trailing_semicolons
#1195 Ignore trailing semicolons
2011-09-06 06:15:13 -07:00
Jeremy Ashkenas
a8185407fa Merge pull request #1663 from TrevorBurnham/node_version
Bump node dependency from 0.2.5 to 0.4.0
2011-09-05 12:48:49 -07:00
Trevor Burnham
1cc85aad64 Adding tests for CoffeeScript.eval 2011-09-04 13:57:09 -04:00
Trevor Burnham
067cd4b4fe Allowing eval with a sandbox, but defaulting to global context 2011-09-04 13:53:44 -04:00
Trevor Burnham
6d68b1f5ad Bumping node dependency from 0.2.5 to 0.4.0 2011-09-04 13:32:57 -04:00
Trevor Burnham
e8b3e2f248 Restoring the ability to CoffeeScript.eval code in a sandbox 2011-09-04 12:38:59 -04:00
Trevor Burnham
d5aad39b3f Bumping node dependency to 0.4.0 (see discussion at #1661) 2011-09-04 12:27:38 -04:00
Trevor Burnham
cce9ac28c9 Taking an axe to the sandbox (see discussion at #1661) 2011-09-04 12:26:39 -04:00
Gerald Lewis
49e3a91d67 tests for #1195: lex out semicolons before newlines and at end of program 2011-09-04 12:18:38 -04:00
Gerald Lewis
76b6a1771b fixes #1195: lex out semicolons before newlines and at end of program 2011-09-04 12:18:22 -04:00
Michael Ficarra
c88cb5c8b5 Another attempt to fix #1580... still haven't come up with a good way to
test it, though. Hopefully the third time is... the one that works.
2011-09-04 12:16:04 -04:00
Trevor Burnham
efd503f84a Reloading globals after every REPL command (actually fixes #1654) 2011-09-04 10:05:26 -04:00
Trevor Burnham
7ba52ae729 Blacklisting certain globals from REPL rather than whitelisting (fixes #1654) 2011-09-04 09:54:13 -04:00
Gerald Lewis
8ebda7ac02 tests for #1643: splatted accesses in destructuring assignments no longer create obj.key var declarations 2011-09-01 14:47:30 -04:00
Gerald Lewis
43a8b46203 fixes #1643: splatted accesses in destructuring assignments no longer create obj.key var declarations 2011-09-01 14:47:10 -04:00
Jeremy Ashkenas
d1af5163eb Merge pull request #1647 from dget/patch-1
Adding a link to the change log to the current version on the webpage
2011-08-31 15:23:39 -07:00
dget
ee6eccbfe1 Adding a link to the change log to the current version, to make it easier to see what's changed. 2011-08-31 16:10:06 -03:00
Jeremy Ashkenas
d37cfc69d9 Merge pull request #1641 from geraldalewis/1591_splats_in_destructuring
1591 Splatted Expressions in Destructuring Assignment Must Be Assignable
2011-08-30 08:23:26 -07:00
Gerald Lewis
3a6c8c92b3 tests for #1591: splatted expressions in destructuring assignment must be assignable 2011-08-30 11:12:39 -04:00
Gerald Lewis
e17b67e6f2 fixes #1591: splatted expressions in destructuring assignment must be assignable 2011-08-30 11:12:25 -04:00
Jeremy Ashkenas
c0e0ede09f Merge pull request #1636 from mineo/patch-1
alert(html) in the heredoc example
2011-08-29 20:35:23 -07:00
Wieland Hoffmann
a4425471fd alert(html) in the heredoc example 2011-08-30 10:42:34 +03:00
Michael Ficarra
b4e2240ede fixes #1633: error output when using coffee -e 2011-08-27 13:21:03 -04:00
Michael Ficarra
539b872e02 compiled src/coffee-script.coffee 2011-08-27 13:20:29 -04:00
Michael Ficarra
2ff6c4c3fc fixes #1630: in should check indices of the right operand when it can
pass a `hasOwnProperty` check for them
2011-08-26 15:44:00 -04:00
Rod Knowlton
f2c0ea7fa4 Clarify --watch option on homepage. 2011-08-22 22:47:00 -05:00
Jeremy Ashkenas
8686e31271 Merge pull request #1624 from johnyanarella/master
--join fails silently with no resulting output file
2011-08-22 10:39:47 -07:00
John Yanarella
0bf0f6d721 Resolved an issue that could occur while compiling with the --join option which would cause the compiler to silently fail with no resulting output file.
While recursively traversing a source directory, if a directory was encountered containing either no .coffee files (ex. an .svn metadata directory) or where the last file processed in that directory was not a .coffee file, compileJoin() might never be called.

This issue was originally introduced by a (well-needed) optimization in commit dc272a680b.

In join mode, anytime the 'unprocessed' count is decremented, the remaining file count should be evaluated to determine if it is time to run compileJoin().  Previously, compileJoin() would only ever be called in one of the four possible terminating branches of this recursive asynchronous operation.
2011-08-22 13:32:54 -04:00
Michael Ficarra
3ef0c1c88a reverting stylistic change from parent commit 2011-08-16 10:53:08 -03:00
Michael Ficarra
5b115ddb74 (probably) expressing Jeremy's intentions
edited via Github, so no changes to /lib/coffee-script.js
2011-08-16 08:53:15 -03:00
Jeremy Ashkenas
604e39b413 Merge pull request #1605 from geraldalewis/1513_obj_front_ops
#1513 Top level bare obj literals with unary and exist ops
2011-08-15 08:55:24 -07:00
Gerald Lewis
f3253f4f5c tests for #1513 2011-08-15 11:06:53 -04:00
Gerald Lewis
2fb2ddb9b4 fixes #1513 -- top level bare obj literals now wrapped in parens for unary and exists operations 2011-08-15 11:06:36 -04:00
Jeremy Ashkenas
7e4d6198d4 #1568, new super in a function body. 2011-08-14 17:24:19 -04:00
Jeremy Ashkenas
8c31f2ee44 Adding a test for #1595 2011-08-14 17:08:12 -04:00
Jeremy Ashkenas
9a026e51bd Issue #1595, reusing a variable in a catch leads to missing declaration. 2011-08-14 17:04:54 -04:00
Jeremy Ashkenas
50982b668b Issue #1598 -- enabling super() calls in static functions in class bodies. 2011-08-14 16:51:59 -04:00
Jeremy Ashkenas
c6c988ae28 Revert "Ensure test failures get fully outputted."
This reverts commit 41b8b3256d.
2011-08-14 16:39:38 -04:00
Jeremy Ashkenas
306d84828d Merge branch 'super' of https://github.com/aseemk/coffee-script 2011-08-14 16:39:12 -04:00
Jeremy Ashkenas
216ad777de clarifying Cake on the homepage. 2011-08-14 16:24:42 -04:00
Jeremy Ashkenas
4710e744dc clarifying Cake on the homepage. 2011-08-14 16:24:26 -04:00
Aseem Kishore
0b3029dd3f Add test for static super calls.
Tests jashkenas/coffee-script#1598. Fails currently as expected.
2011-08-12 15:10:19 -07:00
Aseem Kishore
41b8b3256d Ensure test failures get fully outputted.
Node's console.log() is non-blocking, so I was seeing test failure output get
cut off since it was happening on process exit. No more!
2011-08-12 14:56:33 -07:00
Jeremy Ashkenas
42f2bd926b Merge pull request #1590 from geraldalewis/proto_access
#1234 Protoype Access in :: Operator
2011-08-12 11:21:46 -07:00
Gerald Lewis
197d07cc85 revised tests for #1234 thanks to @michaelficarra 2011-08-12 14:11:44 -04:00
Gerald Lewis
c9fd0659c2 revised patch for #1234; consolidated Value#push and Value#concat into Value#add; removed unnecessary INDEX_PROTO 2011-08-12 13:38:34 -04:00
Michael Ficarra
fa2fbf0c60 minor enhancements to tests for #1005 2011-08-11 02:17:48 -04:00
Michael Ficarra
c3fe29455b finishing up fix for #1009: class @do; it's a little bit ugly, but it
makes sense to do it this way
2011-08-11 01:52:10 -04:00
Michael Ficarra
df5aca9348 fixes #1005: invalid identifiers allowed on LHS of destructuring
assignment
2011-08-11 01:11:33 -04:00
Gerald Lewis
ab0b36a53f test for #1234 2011-08-10 22:01:47 -04:00
Gerald Lewis
29a44b84d5 fixes #1234 ... :: now creates an intermediary "prototype" Access node before any additional property accesses 2011-08-10 22:01:47 -04:00
Michael Ficarra
e5b77b180a fixes #580 by deleteing the compiler from require.cache and requireing it again 2011-08-10 21:26:16 -04:00
Michael Ficarra
fc1cdfc913 Merge pull request #1584 from MichaelBlume/grammar_path
fix path to grammar file
2011-08-08 22:43:08 -07:00
Mike Blume
8c5027abb9 fix the output path too 2011-08-08 22:37:48 -07:00
Mike Blume
333daf33a3 fix path to grammar file 2011-08-08 22:34:09 -07:00
Michael Ficarra
064f2b5787 README: corrected compilation instruction; added execution instruction 2011-08-09 00:23:55 -03:00
Michael Ficarra
13ac72239a repl: allowing tab completion of an empty line and masking __X
reserved helpers from tab completion; fixes #1583
2011-08-08 18:26:50 -04:00
Michael Ficarra
818216374c Merge branch 'restructuring' of github.com:jashkenas/coffee-script 2011-08-08 13:21:58 -04:00
Michael Ficarra
5a9cf5722f conditional compilation update as per discussion in
a5ba0c27ae
2011-08-08 12:55:22 -04:00
Michael Ficarra
a5ba0c27ae breaking long lines created by 803a7d06e3 2011-08-08 12:27:53 -04:00
Jeremy Ashkenas
f6d3953bc6 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-08-08 10:04:31 -04:00
Jeremy Ashkenas
c9a5135e23 Merge branch 'gh-pages' 2011-08-08 10:04:09 -04:00
Jeremy Ashkenas
ab326aea4c removing errant line from changelog 2011-08-08 10:03:41 -04:00
Michael Ficarra
7cf5988099 allowing classes to extend expressions; fixes #1482 2011-08-07 05:02:01 -04:00
Michael Ficarra
35a30fbd6d cleaned up block comment output; fixes #1186 2011-08-07 03:51:51 -04:00
Michael Ficarra
6608a7aa98 fixes #1100: precedence in or-test compilation of in 2011-08-07 03:43:41 -04:00
Michael Ficarra
803a7d06e3 output formatting cleanup; fixes #1254: improve when compilation; also
causes single-line, single-statement conditional bodies to sit next to
their conditions
2011-08-07 02:59:37 -04:00
Michael Ficarra
be4685589a fixes #1009: classes with reserved words as determined names 2011-08-07 01:48:27 -04:00
Michael Ficarra
bf7d62affb avoiding require.paths poison pill from newer node releases in
`CoffeeScript.eval`
2011-08-06 18:12:55 -04:00
Michael Ficarra
718b73a0ba removed some unnecessary assignment; related: #1491 2011-08-06 13:31:14 -04:00
Michael Ficarra
c2a43f70f2 moved src/coffee-script/*.coffee to src as per discussion in #1246 2011-08-05 18:39:55 -04:00
Michael Ficarra
c222da9dd6 Merge branch 'restructure' of https://github.com/gfxmonk/coffee-script into restructuring
Conflicts:
	Cakefile
2011-08-05 17:47:54 -04:00
Jeremy Ashkenas
55e366f29c Merge pull request #1571 from MichaelBlume/fix-ternary
shorten one of the ternaries
2011-08-04 21:02:16 -07:00
Jeremy Ashkenas
4e71aad124 Merge pull request #1573 from geraldalewis/1464_bound_static_methods
1464 bound static methods
2011-08-04 21:00:46 -07:00
Jeremy Ashkenas
a03f2fe937 Jison goes to 11 2011-08-04 23:59:46 -04:00
Jeremy Ashkenas
5710992156 Merge pull request #1576 from sstephenson/dev-dependencies
Add uglify-js and jison as development dependencies
2011-08-04 20:58:40 -07:00
Jeremy Ashkenas
0ed9be4665 rebuilding the browser js with a new Jison-generated parser. 2011-08-04 23:57:40 -04:00
Sam Stephenson
d665c3a75f Add uglify-js and jison as development dependencies 2011-08-04 22:55:53 -05:00
Jeremy Ashkenas
48f3c70013 bumping version to 1.1.3-pre for Trevor's sake ;) 2011-08-04 23:52:27 -04:00
Jeremy Ashkenas
8a4ec8f562 Adding books + screencasts to the homepage 2011-08-04 23:45:38 -04:00
Jeremy Ashkenas
1a652a9736 CoffeeScript 1.1.2 2011-08-04 23:17:23 -04:00
Mike Blume
15fed8d17f fix another long ternary in the lib 2011-08-04 19:58:27 -07:00
Mike Blume
396f9b3a12 eliminate unnecessary assignment
there's no need to assign this entire if statement to condpart
when condpart is assigned at every endpoint
2011-08-04 19:58:27 -07:00
Michael Ficarra
1f69200d06 Merge pull request #1542 from MichaelBlume/master
Check for existence of this.context. Avoid build error.
2011-08-04 13:23:33 -07:00
Gerald Lewis
0e0d625adb test for #1464 ... bound class methods now keep context 2011-08-04 13:54:26 -04:00
Gerald Lewis
638dbbecbc fixes issue #1464 ... bound class methods now keep context 2011-08-04 13:54:26 -04:00
Michael Ficarra
9f89a83c27 formatting and rewording a test 2011-08-01 17:28:52 -04:00
Mike Blume
178af9de56 check existence of this.context. Avoid build error
https://github.com/jashkenas/coffee-script/issues/1541

with thanks to analyst74 whose bug report made the fix trivial =)
2011-07-31 18:45:30 +00:00
Michael Ficarra
e7854bec09 changed uses of the slice method to CS slices in nodes.coffee 2011-07-31 13:25:57 -04:00
satyr
9b9612e09c fixed #1322; block comments no longer get out of implicitly called implicit objects 2011-07-27 18:49:48 +09:00
Michael Ficarra
d2d02bf91d Cakefile: build:full exits unsuccessfully when tests or builds fail;
test failures now print full stack trace
2011-07-18 17:47:31 -04:00
Jeremy Ashkenas
860c5030d2 Merge pull request #1527 from breckinloggins/fix_1446
Fix for issue #1446: Compiler fails with unrelated exception on file permissions problems
2011-07-18 12:38:23 -07:00
Breckin Loggins
2d54fea90c Fix for issue #1446: Compiler crashes on permissions error instead of giving meaningful error message 2011-07-18 14:29:45 -05:00
Breckin Loggins
5ee0254ce5 Merge branch 'master' of git://github.com/jashkenas/coffee-script 2011-07-18 14:21:09 -05:00
Jeremy Ashkenas
37019dab1c Merge pull request #1522 from breckinloggins/fix_1470
Issue #1470: Command line compiler now assumes ".coffee" extension if left off of file names
2011-07-18 06:12:44 -07:00
Breckin Loggins
2b31f28f8f Replacing heredoc in test with simple string 2011-07-17 15:50:42 -05:00
Michael Ficarra
8931e31991 improving test for #1492 2011-07-17 16:43:50 -04:00
Jeremy Ashkenas
813efbe1d3 Merge pull request #1517 from breckinloggins/master
Patch for issue #1492 (consecutive semicolons in compiled output)
2011-07-17 13:31:32 -07:00
Jeremy Ashkenas
7790df0df6 Merge pull request #1518 from taku0/fix_pluckDirectCall
Removed a garbage code in `pluckDirectCall`.
2011-07-17 09:21:29 -07:00
Jeremy Ashkenas
c2b32df22b Merge pull request #1460 from yyyc514/fix_print_with_join
compileJoin should happen once after all files are read
2011-07-17 09:11:32 -07:00
Breckin Loggins
479a2e0383 Using string interpolation when adding extension 2011-07-16 14:44:26 -05:00
Breckin Loggins
471cf1d51a Issue #1470: Cleaning up logic on extension detection 2011-07-16 14:42:45 -05:00
taku0
ecdaad2fd6 Removed a garbage code in pluckDirectCall.
`args` are removed at 094b876a38.
2011-07-17 02:31:50 +09:00
Breckin Loggins
3e20622bd5 Test implementation of issue #1470. Assuming '.coffee' extension if file not found 2011-07-16 10:44:37 -05:00
Breckin Loggins
8a4a28bd33 Fixing issue #1492: Consecutive semicolons in compiled output in some situations 2011-07-16 09:34:46 -05:00
Jeremy Ashkenas
8fe59ed888 Fixing funkiness introduced in #1498. 2011-07-12 13:13:46 -04:00
Jeremy Ashkenas
1927213174 Merge pull request #1498 from breckinloggins/master
Some typo corrections and minor documentation edits
2011-07-12 09:07:48 -07:00
Michael Ficarra
cb8e147212 arranged and formatted nonContextGlobals list in REPL 2011-07-11 13:08:47 -04:00
Michael Ficarra
07baed89ed Added globals to the REPL that are (for a reason currently unknown to
me) not provided by `vm.Script.createContext`
2011-07-11 12:55:29 -04:00
Michael Ficarra
af1cf3400e fixes tab completion in the REPL 2011-07-10 14:26:31 -04:00
breckinloggins
eb53670676 Changing sentance structure in a grammar rule explanation 2011-07-09 18:33:19 -05:00
breckinloggins
709dc73c27 Removing 'the' from the CoffeeScript Compiler for Windows link 2011-07-09 11:52:02 -05:00
breckinloggins
14e09d2ca8 One more minor correction to main documentation 2011-07-09 10:03:04 -05:00
breckinloggins
0353b0ddd3 Small typo fixes in several files. Completed some missing documentation in nodes.coffee 2011-07-09 09:58:17 -05:00
breckinloggins
f2ba08f77f Minor edits to the main documentation. Added a reference to @alisey's CoffeeScript Compiler for Windows. 2011-07-08 22:22:28 -05:00
Michael Ficarra
1d7d8cb4d2 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-07-06 22:16:30 -04:00
Michael Ficarra
6e9cfd8a33 allow Ctrl-C to escape an unwanted continuation prompt 2011-07-06 22:15:35 -04:00
Michael Ficarra
2a9fd34a03 Made line continuations in the REPL much, much nicer and moved all of
the REPL-specific code out of CoffeeScript.eval and into the REPL
function (thanks for the suggestion, @TrevorBurnham)
2011-07-06 22:15:35 -04:00
Jeremy Ashkenas
b1111c96ca fixes issue #1490 ... jsl.conf is incorrectly npmignored. 2011-07-06 22:15:35 -04:00
Michael Ficarra
55383155e5 More accurately emulating node's REPL behaviour with regard to _
assignment. Also addresses `i for i in [1..3]` regression introduced by
fff4c9c672 and noticed by @satyr
2011-07-06 22:15:35 -04:00
Michael Ficarra
bb1502a9d7 output a newline before exiting REPL 2011-07-06 22:15:35 -04:00
Michael Ficarra
40ee30ecde Fixes #1035, #1425, and #1444: (another) overhaul of REPL and
CoffeeScript.eval. Instead of writing about all the changes and why I
made those decisions, I'll just answer any questions in the commit
comments, so add a commit comment if you want to question anything.
Thanks to @TrevorBurnham and @satyr for their help/contributions. Also,
closes #1487. And still no REPL tests...
2011-07-06 22:15:35 -04:00
Jeremy Ashkenas
4ff00359b6 fixes #1478, documentation. 2011-07-06 22:15:35 -04:00
Michael Ficarra
f433fa4187 improved test for #1436 2011-07-06 22:15:35 -04:00
Michael Ficarra
594ead00e8 improved tests for #1416, fixed accidental scope leak in test for #1420 2011-07-06 22:15:35 -04:00
Timothy Jones
5adf3b8865 Fixes #1461. Existential assignment now correctly reports if it is a statement. 2011-07-06 22:15:35 -04:00
Timothy Jones
4fc52cd08e Fixes #1467. Catch now introduces its parameter to scope. 2011-07-06 22:15:35 -04:00
Jann Horn
4af47f0c26 second part of fixing #1416 2011-07-06 22:15:35 -04:00
Jann Horn
9d3510a1e4 added another test for #1416 2011-07-06 22:15:35 -04:00
Jann Horn
18f6ad9583 fixes #1416: don't omit one 'new' when compiling 'new new' 2011-07-06 22:15:35 -04:00
Jann Horn
4c70ea5e09 test for #1416: don't omit one 'new' when compiling 'new new' 2011-07-06 22:15:35 -04:00
Jann Horn
d32c060e05 fixed #1436 2011-07-06 22:15:35 -04:00
Jann Horn
caa3d1ab5d added a test for #1436, for etc. should work as normal property names 2011-07-06 22:15:34 -04:00
Michael Ficarra
d3e809da38 subliminally promoting the use of interpolation in the documentation 2011-07-06 22:15:34 -04:00
Jeremy Ashkenas
5ab892d009 Merge pull request #1426 from jashkenas/documentationInterpolations
promote the use of interpolation in the documentation
2011-07-06 17:52:32 -07:00
Michael Ficarra
54dbc0fdf8 allow Ctrl-C to escape an unwanted continuation prompt 2011-07-06 17:00:13 -04:00
Michael Ficarra
003f91d43d Made line continuations in the REPL much, much nicer and moved all of
the REPL-specific code out of CoffeeScript.eval and into the REPL
function (thanks for the suggestion, @TrevorBurnham)
2011-07-06 16:36:07 -04:00
Jeremy Ashkenas
83806a4d77 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-07-06 16:06:47 -04:00
Jeremy Ashkenas
c4324f1db2 fixes issue #1490 ... jsl.conf is incorrectly npmignored. 2011-07-06 16:06:17 -04:00
Michael Ficarra
b9c3e0e640 More accurately emulating node's REPL behaviour with regard to _
assignment. Also addresses `i for i in [1..3]` regression introduced by
fff4c9c672 and noticed by @satyr
2011-07-06 13:06:18 -04:00
Michael Ficarra
60e51a238d output a newline before exiting REPL 2011-07-06 13:05:07 -04:00
Michael Ficarra
fff4c9c672 Fixes #1035, #1425, and #1444: (another) overhaul of REPL and
CoffeeScript.eval. Instead of writing about all the changes and why I
made those decisions, I'll just answer any questions in the commit
comments, so add a commit comment if you want to question anything.
Thanks to @TrevorBurnham and @satyr for their help/contributions. Also,
closes #1487. And still no REPL tests...
2011-07-06 03:54:36 -04:00
gfxmonk
ab17f41652 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 2011-07-05 21:58:04 +10:00
Jeremy Ashkenas
18ab569b2d Merge branch 'master' of github.com:jashkenas/coffee-script 2011-07-01 08:30:38 -04:00
Jeremy Ashkenas
2951d34dc0 fixes #1478, documentation. 2011-07-01 08:30:12 -04:00
Michael Ficarra
0cc5379caa improved test for #1436 2011-06-30 12:15:00 -04:00
Michael Ficarra
f6fcfa831c Merge branch 'bugfix-1436' of git://github.com/thejh/coffee-script into thejh_1448 2011-06-30 11:53:24 -04:00
Michael Ficarra
c93fc3ec76 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-06-30 11:46:32 -04:00
Michael Ficarra
7b5f012f79 improved tests for #1416, fixed accidental scope leak in test for #1420 2011-06-30 11:35:29 -04:00
Timothy Jones
22cee5d2d6 Fixes #1461. Existential assignment now correctly reports if it is a statement. 2011-06-29 18:54:23 -04:00
Timothy Jones
0f18dff464 Fixes #1467. Catch now introduces its parameter to scope. 2011-06-29 18:54:23 -04:00
Timothy Jones
e38aeefb5c Fixes #1461. Existential assignment now correctly reports if it is a statement. 2011-06-26 03:08:38 +12:00
Timothy Jones
baa983ac33 Fixes #1467. Catch now introduces its parameter to scope. 2011-06-26 02:34:52 +12:00
Josh Goebel
cd65c66cf9 combine conditions 2011-06-23 06:54:06 -04:00
Josh Goebel
dc272a680b compileJoin should happen once after all files are read 2011-06-23 04:42:12 -04:00
ngn
6f64fc266d added one more test for #1150 2011-06-22 19:42:07 +03:00
Jann Horn
73af3b17b1 second part of fixing #1416 2011-06-21 16:42:53 +02:00
Jann Horn
8b2884e40f added another test for #1416 2011-06-21 16:42:20 +02:00
Jann Horn
f0c22f390d fixes #1416: don't omit one 'new' when compiling 'new new' 2011-06-20 18:38:29 +02:00
Jann Horn
11f2cd4515 test for #1416: don't omit one 'new' when compiling 'new new' 2011-06-20 18:38:07 +02:00
ngn
5ce7984a2b Another attempt to fix #1150
Here's how the algorithm in balancedString() was modified.  When we
encounter a slash in an interpolation, we:

    * try to find a heregex right after it; if found---skip it.  Three
      slashes always terminate a heregex, no matter if there is an open
      "#{" before them or not, so we don't have to bother about
      sub-interpolations inside the heregex.

    * try to find a regex right after it; if found---skip it.  Simple
      regexen can't contain interpolations.

    * otherwise, assume that the slash means division and carry on.
2011-06-19 20:05:38 +03:00
Jann Horn
9699059226 fixed #1436 2011-06-19 10:49:41 +02:00
Jann Horn
9941c3f045 added a test for #1436, for etc. should work as normal property names 2011-06-19 10:49:19 +02:00
Michael Ficarra
25e7eeac8f Revert "Merge https://github.com/ngn/coffee-script"
This reverts commit 277e82bd03, reversing
changes made to 0f523de212.
2011-06-17 11:53:48 -04:00
Michael Ficarra
277e82bd03 Merge https://github.com/ngn/coffee-script 2011-06-17 11:32:08 -04:00
Michael Ficarra
a1f1afe3ed fixes #1442: javascript literals should increase line count when they
contain newlines
2011-06-17 11:26:39 -04:00
ngn
0f523de212 Fix for #1150: String interpolation regression 2011-06-15 20:34:12 +03:00
Michael Ficarra
47f12c453a subliminally promoting the use of interpolation in the documentation 2011-06-08 19:38:12 -04:00
Michael Ficarra
dfcff3f0fc adding regression test for #1420; also cleaned up a little trailing
whitespace in the function invocation tests
2011-06-07 04:10:40 -04:00
Michael Ficarra
522f2ee3b3 fixes #1420: (fn() ->) by causing the Lexer::tagParameters method to
give up looking for a parameter list when it saw a `CALL_START` token.
2011-06-07 03:58:36 -04:00
Michael Ficarra
8ce1fdb5bb enhancement for fix to #1409: when compiling as an array, ranges can't
have been given steps (would be a SyntaxError) ... yet
2011-06-02 09:28:13 -04:00
Michael Ficarra
a0efdac8ce removed trailing whitespace in source files 2011-06-02 02:00:47 -04:00
Michael Ficarra
22bc54f974 fixes #1409: creating large ranges outside of a function body 2011-06-02 01:50:31 -04:00
Michael Ficarra
e240621a72 test for #1409 2011-06-02 01:49:28 -04:00
Michael Ficarra
35c2a72ad2 REPL blank line fix 2011-06-02 01:34:55 -04:00
Michael Ficarra
10ec1a659f fixes #1398: comments in the REPL 2011-05-28 22:39:27 -04:00
Jeremy Ashkenas
1fb34e42a6 Revert "fixed condext during construction of bound functions; now using native"
This reverts commit 8d6e33c2cf.
2011-05-28 18:58:48 -04:00
Jeremy Ashkenas
7082000e66 Revert "switched to canonical two-space indentation in __bind helper"
This reverts commit 6a40807330.
2011-05-28 18:58:38 -04:00
Jeremy Ashkenas
79fff367c2 Revert "__bind helper: caching ctor"
This reverts commit 9cbf2a82ec.
2011-05-28 18:58:28 -04:00
Michael Ficarra
9cbf2a82ec __bind helper: caching ctor 2011-05-27 18:41:31 -04:00
Michael Ficarra
6a40807330 switched to canonical two-space indentation in __bind helper 2011-05-27 18:18:22 -04:00
Michael Ficarra
8d6e33c2cf fixed condext during construction of bound functions; now using native
Function::bind when it is available. related: #1363
2011-05-27 18:03:57 -04:00
Michael Ficarra
085874d5f3 hopefully the last enhancement for my #1380 fix 2011-05-25 12:57:45 -04:00
Michael Ficarra
94fb7e32ea removing accidentally-committed console.log 2011-05-25 04:22:03 -04:00
Michael Ficarra
042f7ec791 enhancement for #1380 fix 2011-05-25 04:10:50 -04:00
Michael Ficarra
e4f47a05f6 merging @TrevorBurnham's pull request #1314, enhancing CS.eval; closes #1314 2011-05-25 03:53:51 -04:00
Michael Ficarra
bbf37e5229 Merge pull request #1388 from johnyanarella/master
'coffee' silently fails with no output when the --join option is specified and the source files specified include directories
2011-05-25 00:47:05 -07:00
Michael Ficarra
454aa8433b fixes #1390: persistence of non-enumerable global properties in the REPL 2011-05-25 03:43:10 -04:00
Michael Ficarra
bbf1c6a8df fixes #1380: super with reserved names 2011-05-25 03:22:26 -04:00
Michael Ficarra
8e5eff5e1e test for #1380 2011-05-25 03:22:06 -04:00
Michael Ficarra
e64fa71185 fixes #1372: bound class methods with reserved names 2011-05-24 16:49:45 -04:00
Michael Ficarra
c8845643e5 fixes #1385: property access on parenthesized number literals 2011-05-24 16:27:07 -04:00
John Yanarella
371ff5e726 Fixed silently failing command line --join functionality when directories are specified for compilation. 2011-05-24 15:01:35 -04:00
Michael Ficarra
19520d8d35 merging in @fjakobs's heregex line number fix; closes #1374 2011-05-19 13:59:58 -04:00
Fabian Jakobs
abb11a7c0e fix line numbers after heregexps 2011-05-16 19:56:29 +02:00
Michael Ficarra
2ac74356bd cleaned up and optimized fix for #1354 (d91ccd4003) 2011-05-15 21:46:35 -04:00
Jeremy Ashkenas
004f13f0fc Merge pull request #1346 from adam-f/fixedsplatscope
Fixed improper scoping of siblings to the splat argument.
2011-05-15 17:13:50 -07:00
Adam Freidin
395a97ef07 removing unimportant changes for easy pull. 2011-05-15 17:11:02 -07:00
Jeremy Ashkenas
01b0cfc8ab Merge pull request #1324 from TrevorBurnham/node-modules
Use `require.main` instead of loop to get main module
2011-05-15 17:04:40 -07:00
Jeremy Ashkenas
f3758e4af0 Fixes #1328 2011-05-15 19:59:52 -04:00
Jeremy Ashkenas
2563324ed8 merging #1353 2011-05-15 18:56:11 -04:00
Jeremy Ashkenas
d91ccd4003 Issue #1354, 'in' with splatted arrays. 2011-05-15 18:50:04 -04:00
Jeremy Ashkenas
15ddb8e2ea simplifying some string interpolation in Range#compileNode 2011-05-15 17:07:59 -04:00
Jeremy Ashkenas
c056c93e19 Issue #1356 ... range comprehension optimization when a step is present. 2011-05-15 17:05:05 -04:00
Jeremy Ashkenas
9e32a5bfa1 fixing implicit invocations against inline try/catch. 2011-05-15 15:04:29 -04:00
Jeremy Ashkenas
cd5c41f351 Issue #1364, implicit calls against control structures. 2011-05-15 10:41:41 -04:00
Jeremy Ashkenas
b780d707ab fixing over whitespace-ing from the previous commit. 2011-05-15 10:16:46 -04:00
Jeremy Ashkenas
84ae563368 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-05-15 10:08:55 -04:00
Jeremy Ashkenas
dddc7c6edb Issue #1368, block comment formatting. 2011-05-15 10:08:31 -04:00
Gerald Lewis
bd8d82809b Updated tests for #1216 and pull #1348 2011-05-11 09:11:41 -04:00
Gerald Lewis
51b7142805 Fix for #1216 and pull #1348; preserves original semantics while prettying the compiled output 2011-05-11 09:10:58 -04:00
Michael Ficarra
6c9ef76b95 fixed behavioural change accidentally introduced by #1348, thanks @satyr 2011-05-11 00:08:24 -04:00
Michael Ficarra
a024ec5b27 reverting tests from @geraldalewis's fix for #1216 2011-05-10 23:23:31 -04:00
Gerald Lewis
2212e959ac Fix for #1216 ?= compilation 2011-05-10 19:33:30 -04:00
Jeremy Ashkenas
d4d027159f rebuilding browser/source 2011-05-10 10:04:25 -04:00
Jeremy Ashkenas
a8a581acae Never return from a constructor. 2011-05-10 10:03:22 -04:00
Jeremy Ashkenas
9e4fa02cdb CoffeeScript 1.1.1 2011-05-10 09:27:19 -04:00
Jeremy Ashkenas
6d6e07604e Fixing external constructors / order of execution for once and for all ... knock on wood. 2011-05-10 09:24:20 -04:00
Adam Freidin
dc499089e9 fixed name of simple destructuring test. 2011-05-08 15:00:27 -07:00
Michael Ficarra
f4b8e19c7f adding another failing test case related to #1182 2011-05-08 17:16:45 -04:00
Adam Freidin
1809c0e675 fixed 2nd scoping problem
x = 10
([x]) -> # used to not declare var x

this is one fix, the other way to fix
it is to remove the entire if ... olen is 1 ....
block... not sure if that's a good idea or not.
2011-05-08 04:59:44 -07:00
Adam Freidin
d11d69958f Removed extra index variable left from code thrash 2011-05-08 04:32:47 -07:00
Adam Freidin
6d2733405d Fixed splat sibling variable scope leak. 2011-05-07 20:46:08 -07:00
Adam Freidin
2dc2d162bc variadic arguments breaking out of scope (test) 2011-05-07 16:55:27 -07:00
Michael Ficarra
56b2b02637 some cleanup, renaming temporary variable from _by to _step 2011-05-06 23:10:46 -04:00
Michael Ficarra
d031c26229 Merge git://github.com/geraldalewis/coffee-script into geraldalewis_issue1326 2011-05-06 22:53:26 -04:00
Michael Ficarra
4046fcf971 adding failing test case for #1182 execution order bug mentioned by
@satyr
2011-05-06 09:48:12 -04:00
Michael Ficarra
7a4fd2ec01 slightly improved fix for #1182 and #1313 2011-05-06 09:47:40 -04:00
Michael Ficarra
73731ba155 Merge branch 'issue1313' 2011-05-06 01:10:27 -04:00
Michael Ficarra
8781a148db issues #1313 and #1182: better class compilation in presence of
externally defined constructors and inheritence via `extends`. Thanks to
@stephank for the suggested approach.
2011-05-06 01:00:35 -04:00
Gerald Lewis
0e978a0d99 Merge branch 'issue_1326' 2011-05-04 13:14:46 -04:00
Gerald Lewis
ac46ede170 Fix for #1326 by value is uncached 2011-05-04 13:12:05 -04:00
Satoshi Murakami
ad669fc23a command: JSLint => JavaScript Lint 2011-05-04 10:04:17 -07:00
Trevor Burnham
b9d3bc5b44 x = {} if x -> x and= {}, per Michael's suggestion
https://github.com/jashkenas/coffee-script/pull/1324/files#r25463
2011-05-03 17:06:34 -04:00
Trevor Burnham
fa2ed81485 Renaming root to mainModule in run method 2011-05-03 15:53:10 -04:00
Trevor Burnham
ea4a723379 Simpler method of getting the root module 2011-05-03 15:47:39 -04:00
Jeremy Ashkenas
71bcdb91c8 fixing changelog -- it was a regression from an earlier commit, not a true fix. 2011-05-01 14:29:48 -04:00
Jeremy Ashkenas
08294dc4d6 s/process.mainModule/require.main 2011-05-01 13:45:47 -04:00
Jeremy Ashkenas
09712603c4 coffee-script 1.1.0 2011-05-01 12:08:15 -04:00
Jeremy Ashkenas
2fb7ccc8f0 Revert "Fix for #1304 ... but disallows an alternative syntax."
This reverts commit 31bfe50831.
2011-05-01 10:43:50 -04:00
Jeremy Ashkenas
31bfe50831 Fix for #1304 ... but disallows an alternative syntax. 2011-05-01 10:16:04 -04:00
Jeremy Ashkenas
9aa3b5b78c showing line number information for failed tests. 2011-05-01 10:11:56 -04:00
Jeremy Ashkenas
7480f55e53 making end implicit tokens generated 2011-05-01 10:03:50 -04:00
Jeremy Ashkenas
5fd82e829b fixing test.html 2011-05-01 08:28:00 -04:00
Jeremy Ashkenas
43ebec1812 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-05-01 08:12:27 -04:00
Michael Ficarra
5cdf02f840 Merge pull request #1309 from TrevorBurnham/sandbox.
Fixing unavailability of `global` properties on REPL
2011-04-30 23:26:25 -07:00
Trevor Burnham
824e081005 Fixing unavailability of global properties on REPL 2011-05-01 01:45:14 -04:00
Trevor Burnham
fc992ba380 Using process.mainModule.filename instead of passing __filename 2011-04-30 23:01:36 -04:00
Trevor Burnham
264070bfc7 Making process.execPath point to coffee when running .coffee files
Related: #1303 set `process.argv[0]` to `coffee`. This makes
`process.execPath` consistent with that change.
2011-04-30 19:45:32 -04:00
Jeremy Ashkenas
a91509ba72 reintroducing a variant of kit's in-order script loading fix. 2011-04-30 13:48:54 -04:00
Jeremy Ashkenas
0dfe2429bc reverted @kitgoncharov's commits that broke the browser runner. 2011-04-30 13:33:28 -04:00
Jeremy Ashkenas
f1ad2e1fae Revert "Fix a typo in browser.coffee."
This reverts commit 6793eb383c.
2011-04-30 13:32:26 -04:00
Jeremy Ashkenas
c51679810a fixing unfoldSoak performance my memoizing. #1033 2011-04-30 13:13:09 -04:00
Jeremy Ashkenas
468ad1a2d5 Updating README and website with -g instructions. 2011-04-30 11:10:37 -04:00
Jeremy Ashkenas
bf8fbc2c0e Fixing process.argv[0] ... #1303 2011-04-30 10:59:55 -04:00
Jeremy Ashkenas
0ed8ae28e7 merging #1303 ... setting process.argv[0] to coffee for coffee's run. 2011-04-30 10:39:28 -04:00
Jeremy Ashkenas
f76ad8912c Merge pull request #1305 from benatkin/patch-1.
Updated for npm 1.0: the -g option installs to the global npm bin directory
2011-04-30 07:36:43 -07:00
Jeremy Ashkenas
83e7d442fb slightly less sketchy fix for #1106. 2011-04-30 10:35:56 -04:00
Jeremy Ashkenas
76252659fd Merge pull request #1300 from michaelficarra/issue1106.
fixes issue #1106
2011-04-30 07:29:41 -07:00
Ben Atkin
19036348a5 Updated for npm 1.0: the -g option installs to the global npm bin directory.
Without -g, the bin is in node-modules/.bin/coffee.
2011-04-29 19:57:18 -07:00
Michael Ficarra
7efea4bb23 removed "globals" option of CoffeeScript.compile and enhanced fix from
previous commits
2011-04-29 15:53:30 -04:00
Michael Ficarra
63ce244359 Better fixes for problem mentioned in last 3 commits. Also adds _
special value (as in node's REPL) that always holds return value of last
executed expression. Finally, fixes #1109
2011-04-29 13:59:59 -04:00
Michael Ficarra
0bdf9538d0 Recently discussed problem has been understood. Adding relevant values
to the global scope upon `eval` in REPL.

See bcf1e178a1 (commitcomment-362493)
2011-04-29 09:29:25 -04:00
Michael Ficarra
b88e23892f Fixes broken require from last commit. We're not actually sure yet
*why* `require` and only `require` was affected. All other globals that
I tried were unaffected: `console`, `parseInt`, `process`, `global`,
`Array`, `Object`, `Buffer`, `setTimeout`, ...
2011-04-29 09:18:47 -04:00
Michael Ficarra
bcf1e178a1 Fixes error in REPL where any variable defined in
`src/coffee-script.coffee` is shared with the REPL scope. Example: try
`lexer` or `@VERSION` pre-commit.
2011-04-29 02:32:16 -04:00
Trevor Burnham
fe889b8428 Setting process.argv[0] to 'coffee' in the REPL (aesthetic) 2011-04-28 18:35:42 -04:00
Trevor Burnham
cde7498c8e Setting process.argv[0] to 'coffee' in 'coffee foo.coffee'
See #1301 et al.
2011-04-28 18:27:40 -04:00
Jeremy Ashkenas
a27feb4157 Making the naming of the --join'd coffeescript mandatory. Issue #1076. 2011-04-27 23:06:58 -04:00
Jeremy Ashkenas
a93c835557 Issue #1006, infinite loop in addImplicitParentheses. 2011-04-27 22:49:42 -04:00
Michael Ficarra
5cd5821c18 #1106 test case: making sure __proto__ exists in case v8 ever removes it 2011-04-27 18:57:22 -07:00
Jeremy Ashkenas
3912e29eb7 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-04-27 21:56:31 -04:00
Jeremy Ashkenas
0bad04d374 Issue #1182 -- subclasses with external constructor functions. 2011-04-27 21:56:08 -04:00
Michael Ficarra
50c3a64553 fixes #1106; __proto__ compilation 2011-04-27 21:39:30 -04:00
Michael Ficarra
cd8492dd7b test for #1106 2011-04-27 21:36:29 -04:00
Jeremy Ashkenas
79e160a46b Edited documentation/index.html.erb via GitHub 2011-04-27 06:51:05 -07:00
Timothy Jones
761b3b3646 Merged pull request #1298 from pjaspers/patch-1.
Typo error, s/synax/syntax
2011-04-27 03:18:32 -07:00
Piet Jaspers
937f027f3c Typo error, s/synax/syntax 2011-04-27 00:57:37 -07:00
Jeremy Ashkenas
da14538299 Issue #1272 documentation 2011-04-26 21:47:48 -04:00
Jeremy Ashkenas
02fbf766ad removing erroneous tabs from nodes.coffee. 2011-04-26 21:23:51 -04:00
Jeremy Ashkenas
b13bef7f45 #1256, documentation typo 2011-04-26 20:46:07 -04:00
Jeremy Ashkenas
5e1aadba80 expanding on the sentence that talks about standalone extends ... Issue #1258 2011-04-26 20:42:24 -04:00
Jeremy Ashkenas
44e0bbf342 Issue #1262, print filename in error messages for require module scripts. 2011-04-26 20:35:30 -04:00
Jeremy Ashkenas
a7ed3379df merging in kit's in-order execution patch. 2011-04-23 13:40:40 -04:00
Jeremy Ashkenas
19849e66d4 renaming wordy test titles. 2011-04-23 13:35:15 -04:00
Jeremy Ashkenas
e9dac2fddc Fixes #1280, regex and compound division mixup. 2011-04-23 13:33:35 -04:00
Jeremy Ashkenas
e61fe48b4d Issue #1294, throw the error for a bad symlink reference when compiling a file. 2011-04-23 13:21:58 -04:00
Jeremy Ashkenas
7e8b52ad70 be more consistent about === 2011-04-20 23:43:41 -04:00
Jeremy Ashkenas
d5a5f9572e be consistent about triple-equals-equality. 2011-04-20 23:24:59 -04:00
Jeremy Ashkenas
fe4f7f8b0f Merge branch 'gh-pages' of https://github.com/willmoffat/coffee-script 2011-04-20 23:16:27 -04:00
Jeremy Ashkenas
4e3f80749f merging issue #1127 2011-04-20 23:12:05 -04:00
Jeremy Ashkenas
ff8c340330 Merge branch 'keyboard' of https://github.com/willmoffat/coffee-script 2011-04-20 23:10:48 -04:00
Jeremy Ashkenas
039109ed56 Removing resources section from the homepage, in favor of linking to the Wiki. #1137 2011-04-20 23:08:21 -04:00
Jeremy Ashkenas
f3f34e9ef5 Fixes #1188, scope for self-referencing functions. 2011-04-20 22:16:56 -04:00
Jeremy Ashkenas
2f39102026 merging fix for #1124 2011-04-18 20:44:27 -04:00
Kit Goncharov
6793eb383c Fix a typo in browser.coffee. 2011-04-11 13:50:27 -06:00
Kit Goncharov
2caceda8c4 Enforce script execution order in browser.coffee. 2011-04-11 13:38:38 -06:00
Jeremy Ashkenas
238dc3a5b6 merging in #1268 ... michaelficarra's colored REPL. 2011-04-09 17:42:03 -07:00
Jeremy Ashkenas
390ff30690 Merge branch 'stable' 2011-04-09 17:39:55 -07:00
Jeremy Ashkenas
e1cf187cfe Merge branch 'bugfix-1157' of https://github.com/thejh/coffee-script into stable 2011-04-09 16:11:21 -07:00
Jeremy Ashkenas
8c01df7828 Merge branch 'stable' 2011-04-09 16:02:10 -07:00
Jeremy Ashkenas
ff8faa4cd7 Merge branch 'stable' of github.com:jashkenas/coffee-script into stable 2011-04-09 16:01:20 -07:00
Jeremy Ashkenas
b9aa64fd25 merging in Josh's patch for Node 0.4.x module lookup changes. 2011-04-09 16:00:57 -07:00
Jeremy Ashkenas
8dfd53620c Merge branch 'module-loading' of https://github.com/josh/coffee-script into stable 2011-04-09 16:00:17 -07:00
Michael Ficarra
0090aee0e5 full revert of 4ce374be25 2011-04-09 10:48:14 -04:00
Michael Ficarra
230dea1243 fixes #1274: {}=a() and []=a() compile to false instead of a() 2011-04-09 09:54:45 -04:00
Michael Ficarra
3453bfa513 regression tests for #1274 2011-04-09 09:53:04 -04:00
Michael Ficarra
d0f047dfe7 improved fix for #1266 2011-04-07 19:40:45 -04:00
Michael Ficarra
8e7c454de0 disabling colours for win32 and in presence of NODE_DISABLE_COLORS
environment variable
2011-04-05 20:51:28 -04:00
Michael Ficarra
68c75c7eb1 pretty node-like output in the REPL 2011-04-05 20:40:54 -04:00
Michael Ficarra
31ae260282 unnecessarily strict {in,}equality in existence checks 2011-03-29 17:25:09 -04:00
Jann Horn
8b443b94ea added a test 2011-03-28 23:16:49 +02:00
Jann Horn
6ec9c844e4 fixes #1124 (and uglifies generated JS) 2011-03-28 23:12:27 +02:00
Jeremy Ashkenas
3d3b03e1e4 Merge branch 'stable' of github.com:jashkenas/coffee-script into stable 2011-03-28 08:37:15 -04:00
Jeremy Ashkenas
4d194cb50c rebuilt parser with Jison 0.2.4 2011-03-28 08:36:42 -04:00
Michael Ficarra
b0d2bf4afe Merge branch 'improvedRangeCompilation' of github.com:michaelficarra/coffee-script into michaelficarra-improvedRangeCompilation 2011-03-28 00:51:42 -04:00
Michael Ficarra
8f73bc3b4c Merge branch 'bugfix-1108' of https://github.com/thejh/coffee-script into thejh-bugfix-1108 2011-03-27 23:54:46 -04:00
Michael Ficarra
90495b614f Merge branch 'thejh-bugfix-1099' into stable 2011-03-27 23:47:01 -04:00
Michael Ficarra
f03bcc24ad enhanced tests for #1099 fix 2011-03-27 23:42:49 -04:00
Jann Horn
6646155712 fixes #1157: when compiling multiple scripts, compile them if at least one of them isn't empty 2011-03-27 23:30:55 +02:00
Jann Horn
9d72208d9e added a test (issue #1099) 2011-03-27 21:35:29 +02:00
Jann Horn
e84e703211 fixes bug mentioned by @satyr in #1108
"[v] = a ? b" must compile to
v = (typeof a != "undefined" && a !== null ? a : b)[0];
and not to:
v = typeof a != "undefined" && a !== null ? a : b[0];
2011-03-27 21:22:09 +02:00
Jann Horn
0497c0742f fixes #1099: instead of nothing, compile to false
"if a in []"
2011-03-27 19:46:44 +02:00
Joshua Peek
573e2b0012 Assign module.paths for node_module loading 2011-03-25 15:36:48 -05:00
Michael Ficarra
c4b72fcc79 improved range compilation 2011-03-23 13:49:15 -04:00
Jeremy Ashkenas
a2d7716331 Adding CoffeeScript.mode 2011-03-20 17:40:20 -04:00
Will Moffat
67b5ebdb76 Bind not required for evalJS. 2011-03-19 16:03:53 -07:00
Will Moffat
4c2ce2b45b Merge branch 'master' of https://github.com/jashkenas/coffee-script into keyboard 2011-03-19 15:28:50 -07:00
Jeremy Ashkenas
3b2bade2f2 Use the newer Node.js binding for 'vm'. 2011-03-16 05:47:58 -05:00
Jeremy Ashkenas
cdeb28a793 missing space. 2011-03-16 05:45:17 -05:00
Jeremy Ashkenas
61918a1efa merging stable 2011-03-12 07:41:58 -06:00
Jeremy Ashkenas
963adb5230 merging jcoglan's splat declaration patch. 2011-03-12 07:41:14 -06:00
Jeremy Ashkenas
8f8a1ecf18 Merge branch 'master' of github.com:jashkenas/coffee-script 2011-03-12 07:38:34 -06:00
James Coglan
b9343b458f Fix scoping of splat parameters in argument lists. 2011-03-12 11:46:07 +00:00
Jeremy Ashkenas
ac85fa2fc3 merged stable 2011-03-11 22:44:18 -05:00
Jeremy Ashkenas
b7855857b5 stop trimming all trailing whitespace. 2011-03-11 22:39:32 -05:00
Jeremy Ashkenas
d957c4373b test-ified function_invocation 2011-03-11 22:18:22 -05:00
Jeremy Ashkenas
f485d8f548 test-ified control_flow 2011-03-11 22:09:33 -05:00
Jeremy Ashkenas
b994e235f3 test-ified comprehensions.coffee 2011-03-11 22:05:52 -05:00
Jeremy Ashkenas
2b1aea80ed testified compilation.coffee, removed empty command.coffee 2011-03-11 21:59:17 -05:00
Jeremy Ashkenas
53d8083343 removing empty test file for cake.coffee 2011-03-11 21:55:43 -05:00
Jeremy Ashkenas
d30c125ab7 continuing with the ol' refactorTests 2011-03-11 21:55:26 -05:00
Jeremy Ashkenas
9e2c75b548 removing over-hash-comment 2011-03-11 21:41:12 -05:00
Michael Ficarra
aa54b23713 fixes #1168: leading floating point suppresses newline (thanks, satyr) 2011-02-27 02:11:35 -05:00
Michael Ficarra
dc8e955c4f test for #1168 2011-02-27 02:11:12 -05:00
Timothy Jones
96b22a16eb Closes #1001. Throw cannot be directly used as an expression with parens, but can appear as a statement in an expression. 2011-02-23 15:50:28 +13:00
Timothy Jones
5fbbfbcbe3 Closes #1082. Puts back use of function calls in parameter lists. 2011-02-23 13:20:01 +13:00
Jeremy Ashkenas
faf98dacf6 stricter array splat tests. 2011-02-18 07:15:40 -05:00
Jeremy Ashkenas
86b47a528a adding an array splat test. 2011-02-17 21:56:28 -05:00
Jeremy Ashkenas
cf6c21a0d2 merging in aeosynth's tweaks to package.json 2011-02-17 21:21:31 -05:00
James Campos
b1d900210a add repository to package.json 2011-02-10 18:17:53 -08:00
James Campos
963fc4cebc add homepage to package.json 2011-02-10 17:54:00 -08:00
Will Moffat
80adaa700c Console keyboard shortcuts
Cmd/Ctrl-Enter to run code
Escape to dismiss console
2011-02-10 08:40:53 -08:00
Will Moffat
dfead460ca Disable spellcheck in the code editor.
Firefox highlights all the camelCase variable names in the examples and even WebKit highligts words like 'bitlist'.
2011-02-09 15:52:35 -08:00
Jeremy Ashkenas
6f21f8a402 merging stable 2011-02-01 22:02:57 -05:00
Trevor Burnham
abfc99308d Setting process.argv[1] to equal the filename of the script being run (issue 1087) 2011-02-01 21:41:20 -05:00
Jeremy Ashkenas
955c87ef30 Bumping version to 1.0.2-pre 2011-02-01 21:32:58 -05:00
Jeremy Ashkenas
b4df62bec1 #1085, adding CoffeeScript.mode to the docs. 2011-02-01 21:31:54 -05:00
Jeremy Ashkenas
14d2fa3895 #1085, adding CoffeeScript.mode to the docs. 2011-02-01 21:30:33 -05:00
Jeremy Ashkenas
005c5309c4 Merging in stable at 1.0.1 2011-01-31 23:34:34 -05:00
Jeremy Ashkenas
c44d9ae923 CoffeeScript 1.0.1 2011-01-31 22:39:12 -05:00
Jeremy Ashkenas
a487259e8e Backporting the REPL fix for Node 0.3.7 and Coffee 1.0-stable 2011-01-31 22:27:56 -05:00
Jeremy Ashkenas
37308e6760 Issue #1071, parenthesizing undefined literals when accessed. 2011-01-30 21:16:39 -05:00
Jeremy Ashkenas
4ce374be25 Issue #870 ... placeholders in destructuring assignment. 2011-01-30 20:49:02 -05:00
Jeremy Ashkenas
8b8e8a94ff Issue #997 ... Maloptimized break suppression. 2011-01-30 20:28:11 -05:00
Jeremy Ashkenas
3c9fdde24b resolved merge 2011-01-30 19:40:59 -05:00
Jeremy Ashkenas
578a46fbda Issue #875 -- console.log in the REPL 2011-01-30 19:32:07 -05:00
Jeremy Ashkenas
6fb2088d5f changed 'when' example. 2011-01-30 19:25:36 -05:00
Jeremy Ashkenas
49d9eb687d documenting 'when', a bit. 2011-01-30 17:10:50 -05:00
Jeremy Ashkenas
654c933e30 fixing version number to 1.1.0-pre ... to make it installable with npm. 2011-01-30 17:00:07 -05:00
Timothy Jones
83a86aacb5 Closes #1068. Don't know why CALL_START was in that file. 2011-01-24 19:57:31 +13:00
Timothy Jones
f231809e22 Swapping == with <, just in case. 2011-01-23 00:54:43 +13:00
Timothy Jones
2c8e0a6914 Merge branch 'readline0.3.6' of https://github.com/agnoster/coffee-script into agnoster 2011-01-23 00:43:18 +13:00
Isaac Wolkerstorfer
496816acff Add backwards compatibility for older readline
Check the readline.createInterface for arity. If it is 3,
assume the newer interface requiring separate stdin and stdout.
Otherwise, use the older calling style.
2011-01-22 12:30:22 +01:00
Isaac Wolkerstorfer
78b52f5716 Replace stdio with stdin/stdout pair for readline
On Node.js v0.3.6, the readline interface expects (in, out, complete).
This change makes the coffee-script repl conform to that expectation.
2011-01-22 11:40:25 +01:00
Timothy Jones
2ca108820f Closes #973. New is more careful around the do construct. 2011-01-22 23:26:38 +13:00
Timothy Jones
dc6bd715b2 Closes #970. Statements that use new are wrapped in parens to avoid the closure being used. 2011-01-22 23:12:39 +13:00
Timothy Jones
18a1e01d64 Closes #971. Existensial slices now supported. 2011-01-22 19:56:14 +13:00
Timothy Jones
15e1078d01 I suppose there's no reason to ever call a prototype like a function. 2011-01-22 19:34:30 +13:00
Timothy Jones
06b0c7e928 Closes #1064. Dot accesses force the next token to be an identifier. 2011-01-22 19:29:07 +13:00
Jeremy Ashkenas
3924c2f2bd First draft of fixing shorthand objects mixed with regulars within arrays. 2011-01-19 22:36:30 -05:00
Jeremy Ashkenas
7625d900d3 toTimeString -> toLocaleTimeString 2011-01-19 22:17:53 -05:00
Jeremy Ashkenas
53dc1f2055 Merging in donjones' implicit object fix, hooray. 2011-01-18 23:46:55 -05:00
Jeremy Ashkenas
e706fa4a58 Merge branch 'master' of https://github.com/donjones/coffee-script 2011-01-18 23:38:22 -05:00
Jeremy Ashkenas
65e81e4034 Merge branch '1.0-stable' 2011-01-18 23:29:44 -05:00
Jeremy Ashkenas
1f2f55bea3 merging in chetan51's Node 0.2.5 compatibility patch. Homebrew timestamps. 2011-01-18 23:28:37 -05:00
Jeremy Ashkenas
4b78790096 Making #1050 a syntax error. 2011-01-18 23:10:09 -05:00
Jonas Dohse
236e129e7a Tests for call parameters after implicit objects 2011-01-19 00:32:59 +01:00
Jonas Dohse
d200619774 Check for invalid implicit values 2011-01-18 23:31:50 +01:00
Chetan Surpur
f35ea486a7 Removed dependency on the util module in the coffee source files 2011-01-18 10:19:00 -08:00
Chetan Surpur
a48cd7cb1d Removed dependency on util to extend support to node v0.2.5 2011-01-18 09:45:58 -08:00
Jonas Dohse
d0f13223bc No assignment shortcut in implicit braces
Let

    f a: b, c

compile to

    f({
      a: b
    }, c);
2011-01-18 15:42:59 +01:00
Jeremy Ashkenas
7ae284f432 Allowing an environment variable of MINIFY=false to disable minification of the build:browser cake task. 2011-01-15 15:20:01 -05:00
Jeremy Ashkenas
df872b8223 Merge branch '1.0-stable' 2011-01-15 15:15:33 -05:00
Jeremy Ashkenas
150a8a12a0 A bit more explanation of what's actually going on with build:browser 2011-01-15 15:12:47 -05:00
Jeremy Ashkenas
d8823ed45e Implemented continuable lines in the REPL. Use a trailing slash. Multiline functions are now possible. 2011-01-15 15:06:51 -05:00
Jeremy Ashkenas
9a63b3147f First implementation of autocomplete. 2011-01-15 14:53:07 -05:00
Jeremy Ashkenas
3f586ff4ab Merge branch 'master' into 1.1-pre 2011-01-15 14:50:44 -05:00
Jeremy Ashkenas
c4d4cfe9dc Merge branch 'master' of https://github.com/ryszard/coffee-script into 1.1-pre 2011-01-15 14:50:41 -05:00
Jeremy Ashkenas
08cd112585 trailing comment. 2011-01-15 14:20:45 -05:00
Jeremy Ashkenas
566087b518 Expressions -> Block 2011-01-15 14:19:35 -05:00
Jeremy Ashkenas
f4a7cca075 Issue #1038 ... optimize away trailing return / and return undefined 2011-01-15 14:14:11 -05:00
Jeremy Ashkenas
d9d50fdf54 Leave out the 'Available Options' bit. 2011-01-15 11:04:50 -05:00
Jeremy Ashkenas
4c18ddf549 Fixing issue #1046. 2011-01-15 10:57:50 -05:00
Jeremy Ashkenas
7c7b9a4be1 Merging in 1035 fix. fileName -> filename ... a bit of refactoring. 2011-01-15 10:46:53 -05:00
Jeremy Ashkenas
9faedbf516 bump version to 1.1-pre 2011-01-15 10:28:26 -05:00
Trevor Burnham
ba45dedbd5 Decoupling --require flag processing from file compilation
This change allows files to be `--require`d before entering the REPL. It's also
an opimization, since files are `--require`d only once, rather than being
required again every time a file is compiled.

A secondary change is that `module.filename` is temporarily modified. This is
somewhat less aesthetically appealing than the old approach of using
fs.realpathSync, but it allows you to run `coffee -r ./foo` rather than having
to write `coffee -r ./foo.coffee`, since Node does not accept absolute paths
without a file extension.
2011-01-13 14:50:00 -05:00
Trevor Burnham
7815138386 Fixing require './foo' under --eval and REPL; issue 1035 2011-01-13 14:20:11 -05:00
Jeremy Ashkenas
47e4f4dae1 Merge branch 'issue1011' of http://github.com/michaelficarra/coffee-script 2011-01-10 23:25:28 -05:00
Jeremy Ashkenas
9b3197c6e8 #1026 2011-01-10 23:19:31 -05:00
Jeremy Ashkenas
44355f8eef Issue #1024. 2011-01-10 23:09:21 -05:00
Jeremy Ashkenas
45058dfa79 Adding jEdit highlighter. 2011-01-10 22:03:52 -05:00
Jeremy Ashkenas
83f9cb88cf Issue #1027 ... leading indentation. 2011-01-10 21:58:35 -05:00
Jeremy Ashkenas
c851ed9d60 Removing Roast (deleted) 2011-01-10 21:07:19 -05:00
Michael Ficarra
5f19f65ef2 obeying coffeescript convention of a single space after every comma 2011-01-07 03:20:48 -05:00
Michael Ficarra
8ca8cd046f mismatched issue number in test case for #1012 2011-01-06 23:55:50 -05:00
Michael Ficarra
6832dda2fa improving/minimizing the provided test cases for #1014 2011-01-06 23:47:03 -05:00
Gerald Lewis
782bc6c03a fix for issue 1014 - arguments object in ranged array - apply(this,arguments) instead of call(this) 2011-01-06 21:51:04 -05:00
Michael Ficarra
b158f1cbe6 fix for #1011 2011-01-06 12:38:54 -05:00
Michael Ficarra
944a114400 tests for #1011 2011-01-06 12:38:40 -05:00
Jeremy Ashkenas
5a7120e163 merging in refactorTests. 2011-01-05 21:52:53 -05:00
Michael Ficarra
1f58232e87 adding tests for trailing commas and semicolons 2011-01-03 12:20:35 -05:00
Michael Ficarra
0d3827989d removed global ?= window hack by actually giving tests a global
reference to global
2011-01-03 11:50:54 -05:00
Michael Ficarra
07ff3020cf Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2011-01-03 04:46:58 -05:00
Michael Ficarra
af4748d92b Fixing browser test suite for new filenames after reorganization.
Also added `global ?= window` where necessary. Firefox seems to be
complaining about an unexpected lambda still, though.
2011-01-03 04:37:29 -05:00
Michael Ficarra
240a0b9c93 made sure all files were properly commented 2011-01-03 04:28:47 -05:00
Michael Ficarra
6421c865f5 finished reorganizing test suite 2011-01-03 04:17:00 -05:00
Jeremy Ashkenas
06de5c7ffe joliss, vertical-align top 2011-01-02 21:43:53 -05:00
Michael Ficarra
ccae9ea6a8 final waypoint; remaining files to be sorted:
* _test_existence.coffee
  * _test_pattern_matching.coffee
2011-01-01 23:35:05 -05:00
Michael Ficarra
8692a5fd06 Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-30 22:52:16 -05:00
Michael Ficarra
dcbe62b9b9 test reorganization waypoint 3 2010-12-30 22:48:31 -05:00
Jeremy Ashkenas
9bed99482a Consistently using == instead of === in conjunction with typeof. 2010-12-30 21:15:50 -05:00
Michael Ficarra
fb201976b8 test reorganization waypoint #2 2010-12-29 14:06:57 -05:00
Ryszard Szopa
bb745a8036 Basic REPL autocomplete.
It sort of works, but the tests could are incomplete.
2010-12-29 12:59:23 +01:00
Michael Ficarra
a330eda4b6 Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-29 00:51:26 -05:00
Michael Ficarra
dcfdd144d8 test reorganization waypoint 2010-12-29 00:48:54 -05:00
Michael Ficarra
0fd3ed593c adding new (empty) classifications for tests 2010-12-28 23:33:13 -05:00
Jeremy Ashkenas
83d424f2f4 Issue #985. 2010-12-28 17:46:54 -08:00
Jeremy Ashkenas
c16c90c00a Issue #986 ... Unicode identifiers. 2010-12-28 17:42:20 -08:00
Michael Ficarra
8087a5914c coffee-script/test$ for file in .; do git mv "$file" "_$file"; done 2010-12-28 18:07:15 -05:00
Jeremy Ashkenas
03eccd4958 New favicon.ico 2010-12-27 10:12:42 -08:00
Jeremy Ashkenas
6d3f272551 ln -sfn ... part of Issue #971 2010-12-26 17:34:26 -08:00
Jeremy Ashkenas
7ffb7c19fd Issue #980 ... improperly truncated --help. 2010-12-26 17:15:55 -08:00
Jeremy Ashkenas
f545f18c2d Bumping to version 1.0.1-pre 2010-12-26 16:28:18 -08:00
Jeremy Ashkenas
33d2577fb5 CoffeeScript 1.0.0 2010-12-24 11:02:10 -08:00
Jeremy Ashkenas
3be22bd43b Documenting and testing 'do' 2010-12-24 09:22:27 -08:00
Jeremy Ashkenas
094b876a38 Scoped comprehensions are back out, Do is back in. 2010-12-24 08:59:30 -08:00
Jeremy Ashkenas
97f8e9ce1c reserving __bind and __indexOf 2010-12-23 22:24:14 -08:00
Jeremy Ashkenas
385be63126 disallowing --watch and --join together for the time being. 2010-12-23 22:22:34 -08:00
Jeremy Ashkenas
7710528f01 Adding a test for the previous commit. 2010-12-23 17:58:22 -08:00
Jeremy Ashkenas
c25462d924 Fixing for a in b() -> ... 2010-12-23 17:57:29 -08:00
Jeremy Ashkenas
9b45d240bb splice literals should evaluate to their right hand side, like any other type of assignment. 2010-12-23 14:46:34 -08:00
Jeremy Ashkenas
8bd27db727 Fixing issue #965 -- first character of '.' prefixed folder. 2010-12-23 14:34:50 -08:00
Jeremy Ashkenas
83a7985a97 more work on site, down to arrays and objects. 2010-12-23 14:26:10 -08:00
Jeremy Ashkenas
2d54a45a80 splicing to the end of a one-time expression. 2010-12-23 14:02:46 -08:00
Jeremy Ashkenas
813a5f1e1f documentation waypoint 2010-12-23 13:44:12 -08:00
Jeremy Ashkenas
c7d7757dbd Fixing the asKey setting in Obj. 2010-12-23 13:38:20 -08:00
Jeremy Ashkenas
d7b6996bcf Documentation tweaks, up to Language Reference. 2010-12-23 13:30:35 -08:00
Jeremy Ashkenas
61705e4d22 Issue #964. Super should trigger an implicit call. 2010-12-23 12:57:27 -08:00
Jeremy Ashkenas
6a1730956e slightly less parentheticals. 2010-12-23 12:41:42 -08:00
Jeremy Ashkenas
df8a6529ac tagging more nodes as keys. 2010-12-23 12:14:47 -08:00
Jeremy Ashkenas
97a29f9c50 fixing mentionsArgs for accesses. 2010-12-23 12:00:23 -08:00
Jeremy Ashkenas
9395d58669 Remove seenFor in favor of a safe scanLineBack. 2010-12-23 11:22:01 -08:00
Jeremy Ashkenas
f9a0bbbc20 safer paren-wrapping for closures. 2010-12-23 10:50:52 -08:00
Jeremy Ashkenas
ccfd369a77 Fixing class extends this in a non-class context. 2010-12-23 10:22:52 -08:00
Jeremy Ashkenas
2ec1c3b56c reinstating makeReturn for statement literals. 2010-12-23 10:09:05 -08:00
Jeremy Ashkenas
dbeb626f32 switch with debugger in a case should still break, afterwards. 2010-12-23 09:38:57 -08:00
Jeremy Ashkenas
8fd78d3819 Fixing literals that should be statements, and adding failed compilation tests. 2010-12-23 09:33:12 -08:00
Jeremy Ashkenas
b56b08387d Comprehensions over break and continue 2010-12-23 08:50:34 -08:00
Jeremy Ashkenas
34b16699fa Merge branch 'refactorTests' of http://github.com/michaelficarra/coffee-script 2010-12-23 08:16:42 -08:00
Jeremy Ashkenas
75dfa5af7e forgot to inherit For::jumps from While::jumps 2010-12-23 08:14:00 -08:00
Jeremy Ashkenas
e983032762 more docs... scoped loops, --join. 2010-12-22 22:43:13 -08:00
Jeremy Ashkenas
f5c5709cd9 trailing file, uncompiled. 2010-12-22 21:46:06 -08:00
Jeremy Ashkenas
fb874e1d65 fixing test_literals 2010-12-22 21:32:48 -08:00
Jeremy Ashkenas
6495508194 First draft of --join. 2010-12-22 21:26:15 -08:00
Jeremy Ashkenas
482626b9b8 Fixing issue #924 ... static methods of nested classes. 2010-12-22 19:01:32 -08:00
Jeremy Ashkenas
9f01040d46 fixing arrayEq and arrayEqual in test.html 2010-12-22 18:34:36 -08:00
Jeremy Ashkenas
cdf298bafb Updating test.html 2010-12-22 17:10:21 -08:00
Jeremy Ashkenas
a2f9f9320b Adding a comprehension/jump test. 2010-12-22 09:44:59 -08:00
Jeremy Ashkenas
0a48f613ec Removed the last bits of pureStatements 2010-12-22 12:23:08 -05:00
Jeremy Ashkenas
19f2d69be8 removing containsPureStatement 2010-12-22 12:10:52 -05:00
Jeremy Ashkenas
241de27c75 waypoint 2010-12-22 12:09:05 -05:00
Jeremy Ashkenas
df8dafc5ca starting to move over isPureStatement to Coco style jumps() 2010-12-22 12:00:46 -05:00
Jeremy Ashkenas
d01b7ac682 last logo tweak (I promise) 2010-12-22 10:24:12 -05:00
Jeremy Ashkenas
3161723c8b change logo 2010-12-22 06:25:30 -05:00
Michael Ficarra
a907811b22 just finishing up ranges_slices_and_splices.coffee 2010-12-22 01:39:58 -05:00
Jeremy Ashkenas
f1d298450d intro. 2010-12-21 22:34:53 -05:00
Jeremy Ashkenas
53eb66e5c4 trying to shorten the table of contents. 2010-12-21 22:24:24 -05:00
Jeremy Ashkenas
907f576010 sprucing up the error messages. 2010-12-21 22:02:53 -05:00
Jeremy Ashkenas
f24c2146e0 blackening the logo. 2010-12-21 21:53:49 -05:00
Jeremy Ashkenas
c342b58a87 The load button now includes the snippet from the 'run' button, at the end (homepage) 2010-12-21 21:51:39 -05:00
Jeremy Ashkenas
be8feb7ee8 Accurate positioning of the repl_bridge, hopefully. 2010-12-21 21:35:43 -05:00
Jeremy Ashkenas
b32eb2bfc1 new logo, credit to rampall. 2010-12-21 21:28:31 -05:00
Jeremy Ashkenas
4375a03f38 Fiddling with For#compileNode. 2010-12-21 21:03:52 -05:00
Jeremy Ashkenas
ad9b7d700a Fiddling with For#compileNode. 2010-12-21 20:59:58 -05:00
Jeremy Ashkenas
460272291f Some Try CoffeeScript tweaks ... scrolling left-hand, opt-out load buttons, correct cursor. 2010-12-21 20:43:13 -05:00
Jeremy Ashkenas
f567dafe62 being stricter about body-less scoped loops. 2010-12-21 20:28:48 -05:00
Jeremy Ashkenas
3c86c57765 some cleanups for hasPure 2010-12-21 20:01:30 -05:00
Jeremy Ashkenas
dc2f77e019 Allowing the fat arrow to be used in scoped loops. 2010-12-21 19:14:53 -05:00
Jeremy Ashkenas
80693d8338 Updating documentation for has own key, value 2010-12-21 18:57:23 -05:00
Jeremy Ashkenas
72e5c4300c Removing 'do', in favor of a trailing -> 2010-12-21 18:54:36 -05:00
Jeremy Ashkenas
6e7168b3e9 first re-implementation of 'do' 2010-12-21 16:12:30 -05:00
Jeremy Ashkenas
31892e1d68 Issue #959 (and countless others) Removing the loop-block-scoped magic for once and for all. 2010-12-21 15:45:46 -05:00
Jeremy Ashkenas
aa3099ce09 Adding notes about Ubuntu and Windows installation. 2010-12-21 14:25:28 -05:00
Jeremy Ashkenas
c6b90b9068 Congo -> coffee-mongo 2010-12-21 12:08:04 -05:00
Jeremy Ashkenas
47fe5c201c more existential. 2010-12-21 00:48:54 -05:00
Jeremy Ashkenas
f7d19f5a3a drying up compileSplice 2010-12-21 00:46:31 -05:00
Jeremy Ashkenas
d42f7daef7 Issue #943 -- splices with expressions. 2010-12-20 23:41:58 -05:00
Jeremy Ashkenas
53363e6b80 Issue #958. Removing UNLESS tokens to make them just inverted IFs. 2010-12-20 22:50:49 -05:00
Jeremy Ashkenas
7ba0573702 More tweaks to Slice#compileNode 2010-12-20 08:13:07 -05:00
Jeremy Ashkenas
777a99fe07 tweaks to Slice#compileNode 2010-12-19 20:19:50 -05:00
Jeremy Ashkenas
3b392b2dd9 rebuilt parser with Jison 0.2.0 2010-12-19 20:04:49 -05:00
Jeremy Ashkenas
6009929a3b Merge branch 'master' of https://github.com/grayrest/coffee-script 2010-12-18 18:28:16 -05:00
Jeremy Ashkenas
c1c9de4546 utils -> util (again) 2010-12-18 17:44:28 -05:00
Karl Guertin
c08ae001a6 Add additional test cases for implicit object calls 2010-12-18 16:06:07 -05:00
Joshua Peek
6c2c4d4428 Exclude docs, examples, and tests from npm package 2010-12-18 14:27:31 -06:00
Karl Guertin
e692e7cd9e Take out object call rewriter condition 2010-12-18 15:27:19 -05:00
Michael Ficarra
f0a62e83c8 Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-18 15:05:39 -05:00
Michael Ficarra
a01225db39 moving global identity function back into just the files in which it is
used
2010-12-18 15:04:47 -05:00
Jeremy Ashkenas
b36f6b67e6 removing start from balancedString. 2010-12-18 14:48:44 -05:00
Michael Ficarra
782de8743f updated comment for arrayEqual function, mentioning that it tests for
functional equivalence
2010-12-18 14:48:43 -05:00
Michael Ficarra
c42ac967ea changed arrayEqual to arrayEq, added global identity function id 2010-12-18 14:45:32 -05:00
Jeremy Ashkenas
e379fcf2cf unterminated -> missing. 2010-12-18 14:40:22 -05:00
Jeremy Ashkenas
89678fca47 unterminated -> missing. 2010-12-18 14:38:55 -05:00
Michael Ficarra
e378f79d2b moving splats.coffee back to test_splats.coffee while it's in development 2010-12-18 14:24:40 -05:00
Jeremy Ashkenas
fba165408c #923 ... correct interpolation. 2010-12-18 13:20:14 -05:00
Jeremy Ashkenas
dd168373a1 1.0.0-pre, that is. 2010-12-18 12:14:40 -05:00
Michael Ficarra
076e60378a begun working on refactoring test_splats.coffee 2010-12-18 11:57:27 -05:00
Jeremy Ashkenas
526af777d4 Adding 'by' to the documentation. 2010-12-18 11:54:40 -05:00
Jeremy Ashkenas
f121558668 Starting to use development versions. This one is '1.0-pre' 2010-12-18 10:53:08 -05:00
Jeremy Ashkenas
640ba7d69e Issue #948. A plucked direct call should not have shared scope. (kinda defeats the whole point.) 2010-12-18 10:41:44 -05:00
Jeremy Ashkenas
bc4498e018 Issue #910. Adding support for a --nodejs flag to forward arguments. 2010-12-18 09:29:04 -05:00
Michael Ficarra
805d03125b added --node flag for passing options through directly to node 2010-12-17 02:39:39 -05:00
Michael Ficarra
7499f0811b bugfix for previous fix to #930 and added (almost) all tests to
ranges_slices_and_splices.coffee
2010-12-16 20:21:29 -05:00
Michael Ficarra
37e0566957 Merge branch 'master' of git://github.com/jashkenas/coffee-script into refactorTests 2010-12-16 12:41:55 -05:00
Michael Ficarra
1fbaff9f81 using 9e9 over 1/0 for compatibility 2010-12-16 12:18:53 -05:00
Jeremy Ashkenas
c3943d21d0 Pulling out a lastNonComment method. 2010-12-16 11:35:51 -05:00
Jeremy Ashkenas
a7158ec69c fixing trailing herecomments with 'break' 2010-12-16 08:23:34 -05:00
Michael Ficarra
f66906d54d finished converting tests to newer, cleaner format in
test_ranges_slices_and_splices.coffee, just need to add some new ones
2010-12-16 05:14:57 -05:00
Michael Ficarra
85afef9981 crap, forgot to remove a piece of temporary code 2010-12-16 04:43:32 -05:00
Michael Ficarra
bd463a038c overhaul of last fix for #930, much better this time 2010-12-16 04:39:17 -05:00
Michael Ficarra
eeb1a284a8 Fixing #930 so I can work on testing ranges, slices, and splices.
Regression tests for this will come with the other refactored slicing
tests in a future commit.
2010-12-16 03:25:54 -05:00
Michael Ficarra
b38cc75f17 refactored test_if.coffee, renamed to conditionals.coffee 2010-12-16 01:06:40 -05:00
Michael Ficarra
dd11528160 changed occurrences of deepEqual to new, self-defined arrayEqual for
recursively walking arrays and testing if their values are equal
2010-12-16 00:12:11 -05:00
Michael Ficarra
912d6f442a Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-15 23:57:15 -05:00
Jeremy Ashkenas
346621ed21 Fix for #926 2010-12-15 23:38:27 -05:00
Jeremy Ashkenas
941f5a8ecb tagged -> stable 2010-12-15 23:20:32 -05:00
Jeremy Ashkenas
76e11e6f64 Fixing #934 (at least partially). 2010-12-15 22:59:28 -05:00
Jeremy Ashkenas
3c558ebbee pulling jQuery in locally, rebuilding docs with variable scope patch 2010-12-15 21:11:43 -05:00
Michael Ficarra
eba7b16ccf Merge branch 'master' of git://github.com/jashkenas/coffee-script into refactorTests
Conflicts:
	test/importing.coffee
2010-12-14 03:23:44 -05:00
Jeremy Ashkenas
466cd43277 Pulling in variable declarations closer to inner scope (after Coco). 2010-12-13 21:24:32 -05:00
Michael Ficarra
47acbefa57 forgot to rename test_helpers.coffee to helpers.coffee 2010-12-13 06:34:42 -05:00
Michael Ficarra
d9cf34ab8c Refactored test_helpers.coffee. Added now-needed deepEqual to browser
test page; warning: was unable to test it, so it might be completely
broken!
2010-12-13 06:28:17 -05:00
Michael Ficarra
9dc7d2a081 CoffeeScript.helpers.count now handles empty strings properly instead of
going into an infinite loop
2010-12-13 05:51:57 -05:00
Michael Ficarra
438708ea15 using deepEqual where I would have like to before, if I had known about
it
2010-12-13 05:03:11 -05:00
Michael Ficarra
835840e8da minor enhancements to test/exception_handling.coffee 2010-12-13 01:27:22 -05:00
Michael Ficarra
d13e0762d3 fixed error introduced when testingBrowser global was added to
cakefile and test/importing.coffee. `testingBrowser` did not exist when
running the test suite through cake:test.
2010-12-13 00:27:41 -05:00
Michael Ficarra
ae8f6a6db5 Merge branch 'master' of git://github.com/jashkenas/coffee-script into refactorTests 2010-12-12 23:28:14 -05:00
Michael Ficarra
608c5fd516 Merge branch 'master' of github.com:michaelficarra/coffee-script into refactorTests 2010-12-12 23:28:04 -05:00
Jeremy Ashkenas
b5bd58b2b6 fixing some site bugs. 2010-12-12 21:53:17 -05:00
Jeremy Ashkenas
9785fd0333 Bumping site. 2010-12-12 21:41:04 -05:00
Michael Ficarra
b02a1ee037 just fixing a single test in test_functions.coffee for now, so I don't
forget my suggested fix
2010-12-12 18:35:41 -05:00
Michael Ficarra
5de43fca4e added try-catch around script eval so that errors that are NOT inside
`test` calls (or syntax errors) are caught, and the test suite can
continue on
2010-12-12 18:34:44 -05:00
Jeremy Ashkenas
46fdbd629d prettifying coffeescript.org, part 3. Next up, Try CoffeeScript 2010-12-12 15:02:27 -05:00
Jeremy Ashkenas
2f4902a478 prettifying coffeescript.org, part 2 2010-12-12 14:34:33 -05:00
Jeremy Ashkenas
7e58c5009e first round of prettifications to coffeescript.org 2010-12-12 14:11:33 -05:00
Jeremy Ashkenas
39009dcfb9 Fixing Issue #916. Overoptimization leading to empty var; 2010-12-12 12:16:27 -05:00
Michael Ficarra
a19ea4b662 refactored test_regexps.coffee 2010-12-12 05:04:48 -05:00
Michael Ficarra
63bc12d3f1 refactored test_importing.coffee 2010-12-12 01:13:02 -05:00
Jeremy Ashkenas
b9c2236885 Merging in MichaelFicarra's refactorTests branch. 2010-12-11 20:30:48 -05:00
Jeremy Ashkenas
450ae723cb Merge branch 'refactorTests' of http://github.com/michaelficarra/coffee-script 2010-12-11 19:47:35 -05:00
Jeremy Ashkenas
2ac5ee4062 Adding an existential infix operator example. 2010-12-11 19:44:11 -05:00
Michael Ficarra
0d436b5f11 updated comments.coffee to make use of new micro-framework 2010-12-11 15:51:48 -05:00
Michael Ficarra
ca6983139e Merge branch 'master' of git://github.com/jashkenas/coffee-script into refactorTests 2010-12-11 15:02:37 -05:00
Jeremy Ashkenas
9f56c92497 Issue #853. Normalizing values of ARGV and argv with Node.js 2010-12-11 13:50:59 -05:00
Michael Ficarra
113cecc4f0 updated all completed test files except comments.coffee to the new
testing mini-framework
2010-12-10 00:23:37 -05:00
Michael Ficarra
7ac1176120 a little extra enhancement to cake test 2010-12-10 00:16:25 -05:00
Michael Ficarra
09c23a564d majorly enhanced test output 2010-12-09 23:59:50 -05:00
Michael Ficarra
a969d3ff1d Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-09 22:49:58 -05:00
Jeremy Ashkenas
b6324d0007 Fixing issue #902 ... collected comprehension when no comprehension is necessary. 2010-12-09 22:16:32 -05:00
Jeremy Ashkenas
ba27b4be69 Fixing Issue #904. Destructuring parameters need to reserve their variable names as if they were true parameters. 2010-12-09 21:34:52 -05:00
Jeremy Ashkenas
7c3ef56332 LEVEL_PAREN -> LEVEL_LIST 2010-12-09 21:12:24 -05:00
Jeremy Ashkenas
7b9286b2c2 Issue #905. Fixing soaked-value-as-a-comprehension-subject ... incorrect LEVEL_TOP. 2010-12-09 21:03:41 -05:00
Michael Ficarra
50d2b4e0b5 Merge branch 'master' of git://github.com/jashkenas/coffee-script into refactorTests 2010-12-08 01:29:40 -05:00
Michael Ficarra
f1988a9e20 refactored test_try_catch.coffee 2010-12-08 01:27:29 -05:00
Jeremy Ashkenas
a24a3c565e Merge branch 'fixSplices' of http://github.com/michaelficarra/coffee-script 2010-12-07 22:24:17 -05:00
Jeremy Ashkenas
20d87297b2 merging in 909 2010-12-07 22:16:27 -05:00
Michael Ficarra
049df99afc consistency: eq(expected,actual), formatting, etc. 2010-12-07 22:04:16 -05:00
Michael Ficarra
6dcdf4ff45 refactored test_comments.coffee 2010-12-07 21:01:58 -05:00
Michael Ficarra
00fd33b635 fixes (temporarily) issue #908; line 1232 of src/nodes.coffee still
needs a rewrite though
2010-12-07 19:44:47 -05:00
Michael Ficarra
f2dc526fc8 Fixing compileSplice broken by c7a9801d because " + 1" is now evaluated
as NaN by node. Removed that implicit cast entirely.
2010-12-07 14:27:44 -05:00
Michael Ficarra
e5491198f6 Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests
Conflicts:
	lib/coffee-script.js
2010-12-07 12:27:03 -05:00
Jeremy Ashkenas
4cab45c759 mention dynakey removal in the changelog 2010-12-07 11:08:16 -05:00
Jeremy Ashkenas
fa53a4c057 CoffeeScript 0.9.6 2010-12-07 00:21:34 -05:00
Jeremy Ashkenas
edd0c5af5a no-op. 2010-12-06 23:39:06 -05:00
Jeremy Ashkenas
2fb269a938 refactoring Scope. 2010-12-06 23:32:32 -05:00
Jeremy Ashkenas
3eac6aeb99 rebuilding browser coffee-script.js ... all tests pass. 2010-12-06 23:21:55 -05:00
Jeremy Ashkenas
ec64646fee Issue #901 ... allow constructor functions to maintain their position in the class body. 2010-12-06 01:01:57 -05:00
Michael Ficarra
5371268f8f Merge branch 'master' of http://github.com/jashkenas/coffee-script into refactorTests 2010-12-05 22:31:28 -05:00
Jeremy Ashkenas
2decb30d4e Issue #897 ... fixed leaking direct-call-plucked comprehension variables, due to shared scope. 2010-12-05 21:18:30 -05:00
Jeremy Ashkenas
c0bbc609be Fixing direct construction splats. 2010-12-05 20:44:32 -05:00
Jeremy Ashkenas
f6be426aa0 utils -> util. 2010-12-05 17:51:52 -05:00
Jeremy Ashkenas
17b5c8ac6f Issue #887 and #893. Adding timestamps to --watch --compile. 2010-12-05 16:06:13 -05:00
Jeremy Ashkenas
b18d0d75fd adding newlines after error stacktrace in REPL. 2010-12-05 15:46:04 -05:00
Jeremy Ashkenas
77e13e459b Fixing the repl so that errors print properly, and async exceptions are logged instead of killing the session. 2010-12-05 15:40:49 -05:00
Jeremy Ashkenas
06647bdd0a Adding warning about accidentally-comprehended-functions. Issue #896. 2010-12-05 15:29:28 -05:00
Jeremy Ashkenas
24183d9a39 Issue #894: Strange interaction between class instantiation and splats 2010-12-05 15:08:41 -05:00
Michael Ficarra
1e080cc258 Merge branch 'master' of github.com:michaelficarra/coffee-script into refactorTests 2010-12-05 13:37:34 -05:00
Michael Ficarra
dc5854689b fix for bug introduced in 63cbb643 2010-12-05 13:10:14 -05:00
Michael Ficarra
ed70b9d4d0 test for bug introduced in 63cbb643
discussion: 63cbb64341 (commitcomment-209643)
2010-12-05 13:08:14 -05:00
Jeremy Ashkenas
c7a9801db7 simplifying generated output for common-case splices. 2010-12-04 15:06:21 -05:00
Jeremy Ashkenas
85521f88b2 typo 2010-12-04 12:55:46 -05:00
Jeremy Ashkenas
75ca0f23ac redocumenting slices/splices ... issue #833 2010-12-04 12:52:51 -05:00
Michael Ficarra
eba73f6844 refactored test_break.coffee 2010-12-04 01:44:08 -05:00
Michael Ficarra
cf45da33f6 refactored test_assignment.coffee 2010-12-03 18:21:09 -05:00
Michael Ficarra
fb7498a8ec made reserved words available as CoffeeScript.RESERVED 2010-12-03 18:07:36 -05:00
Michael Ficarra
574f9afa3d using nonces more where applicable, also added tests for default
arguments
2010-12-03 17:10:36 -05:00
Michael Ficarra
3751ac1784 refactored test_arguments.coffee 2010-12-03 16:24:22 -05:00
Michael Ficarra
af759dcf42 test_operations: removed the top-level closures that symbolized
sections
2010-12-03 14:49:21 -05:00
Michael Ficarra
47426c28e1 test_operations: using eq instead of ok wherever possible, as per
satyr's suggestion
2010-12-03 14:43:45 -05:00
Michael Ficarra
49f7775d2d refactored test_operations.coffee 2010-12-03 13:01:13 -05:00
Jeremy Ashkenas
67c20c0715 style tweaks to previous patch. 2010-12-03 01:23:54 -05:00
Michael Ficarra
c50cb65019 Chained comparisons now properly apply DeMorgan's Laws. I couldn't
believe there wasn't a test to remind me to toggle the
{dis,con}junctions. Added that test.
2010-12-03 00:07:30 -05:00
Michael Ficarra
23b4d2fd1d Finally got !== and === back to inverting again (instead of wrapping in
`!()`)

Also, removed the `@inverted` kludge. It was gross to begin with, but I
didn't know the proper way to do it.
2010-12-02 23:03:21 -05:00
Michael Ficarra
dd18703b50 Issue #891: cannot safely invert < and > to >= and <= (or the
other way around). Proper fix this time.
2010-12-02 20:55:19 -05:00
Michael Ficarra
b1ba298ffc Reverted previous change to what was believed to be an errant test case.
Also added a test for NaN safety
2010-12-02 20:54:15 -05:00
Michael Ficarra
992324b425 fix for #891: incorrect inversion of chained comparisons 2010-12-02 12:55:53 -05:00
Michael Ficarra
56e10f9bce added test for #891: incorrect inversion of chained comparisons; fixed a
faulty test case in test/test_switch.coffee
2010-12-02 12:55:28 -05:00
Jeremy Ashkenas
69664a1bb3 Adding precedence change note to changelog 2010-12-01 14:17:10 -05:00
Jeremy Ashkenas
1f5727fe9d Coco 38aa762: rewriter: made addImplicitBraces consume multiple leading comments 2010-11-28 17:54:00 -08:00
Jeremy Ashkenas
b52a1ed60a disallow index mentions for range loops. 2010-11-28 15:54:39 -08:00
Jeremy Ashkenas
c3f1820ebc Issue #856. Invert 2010-11-28 15:33:43 -08:00
Jeremy Ashkenas
4afa6a2887 Issue #860. Nested classes. 2010-11-28 14:56:07 -08:00
Jeremy Ashkenas
1254efaddb Issue #878. Namespaced classes should not leak their function name. 2010-11-28 10:08:49 -08:00
Jeremy Ashkenas
adeace8f62 Merge branch 'issue/875' of git://github.com/StanAngeloff/coffee-script 2010-11-28 09:55:54 -08:00
Jeremy Ashkenas
4447180d5a Removing dynamic keys from objects. 2010-11-28 09:42:43 -08:00
Jeremy Ashkenas
41beccbe3c reverting Scope#temporary simplification. 2010-11-28 09:28:46 -08:00
Jeremy Ashkenas
a4958e76c1 whitespace 2010-11-28 09:27:06 -08:00
Stan Angeloff
a9e264dd84 console.{log,warn} → print{Line,Warn} 2010-11-28 16:04:52 +02:00
Jeremy Ashkenas
51988dba09 Removing unused garbage collection from Scope. 2010-11-27 18:04:40 -08:00
Jeremy Ashkenas
39c4c23200 nested shared scopes don't clobber variables. 2010-11-27 17:52:52 -08:00
Michael Ficarra
63cbb64341 fixes #855; fix partially inspired by satyr/coco 3e37cf32 2010-11-26 02:08:25 -05:00
Michael Ficarra
c0cb0c35e2 adding tests for #855 2010-11-26 02:06:10 -05:00
Jeremy Ashkenas
9db6d6f4ef Updating rake task to pull version number and date. 2010-11-21 22:33:27 -05:00
Jeremy Ashkenas
57bd6bc2cd Adding the coffee-script-source gem publisher to the Rakefile. 2010-11-21 21:42:15 -05:00
Jeremy Ashkenas
e5deb2b3c3 CoffeeScript 0.9.5 2010-11-21 21:21:07 -05:00
Jeremy Ashkenas
fc64fa49ac Switching default arguments to use an if instead of an and, more documentation. 2010-11-21 21:12:59 -05:00
Jeremy Ashkenas
5dfd36af6a removing some extra parens. 2010-11-21 19:59:22 -05:00
Jeremy Ashkenas
1778177195 continuing to document the homepage for 0.9.5 ... removing an optimization for local variables within loops. 2010-11-21 19:53:31 -05:00
Jeremy Ashkenas
ac9d36e444 adding Lucida Sans Unicode back in. 2010-11-21 12:59:21 -05:00
Jeremy Ashkenas
fcda00c3d8 tweaking coffeescript.org styles 2010-11-21 12:51:03 -05:00
Jeremy Ashkenas
28d5db3bca preparing documentation for 0.9.5 2010-11-21 12:38:27 -05:00
Jeremy Ashkenas
8fcd67e82f Updating examples for 0.9.5 2010-11-21 11:41:24 -05:00
Jeremy Ashkenas
710290ad1d Revert "Coco 5622aef: grammar: POST_IF now has the same precedence as FOR/WHILE, making work as expected"
This reverts commit aa262ecf0e.
2010-11-20 21:09:13 -05:00
Jeremy Ashkenas
aa262ecf0e Coco 5622aef: grammar: POST_IF now has the same precedence as FOR/WHILE, making work as expected 2010-11-20 20:59:38 -05:00
Jeremy Ashkenas
338e6d7f72 Coco 9a917bb: nodes: removed NUMBER 2010-11-20 20:51:43 -05:00
Jeremy Ashkenas
4ef9470466 Coco 16dcb4a: parenthesized expressions can now be indented 2010-11-20 20:47:43 -05:00
Jeremy Ashkenas
0e4d589d80 Coco ce2d08a: removed _argN temporaries for readability/consistency 2010-11-20 20:39:35 -05:00
Jeremy Ashkenas
835244f92d slight reformats to cake bench 2010-11-20 20:28:45 -05:00
Jeremy Ashkenas
2f498162b0 Coco f10291f: parens can now take a sequence of expressions: a = (b; c) 2010-11-20 20:22:05 -05:00
Jeremy Ashkenas
93cf3bd922 Coco ecd6aa4: Accessor -> Access 2010-11-20 20:09:36 -05:00
Jeremy Ashkenas
d3ae3525b8 reordering __extends. Issue #848 2010-11-20 19:17:09 -05:00
Jeremy Ashkenas
c8a2a78319 Issue #843. If a for-body ends in a pure-statement, no need to try and return results. 2010-11-20 19:12:39 -05:00
Jeremy Ashkenas
1f12642af2 Slice and Splice tests are back on master. 2010-11-20 18:49:17 -05:00
Jeremy Ashkenas
9111c2e702 All tests passing again. 2010-11-20 18:38:56 -05:00
Jeremy Ashkenas
0e388fd21c making empty loops compile newlineless 2010-11-20 18:37:19 -05:00
Jeremy Ashkenas
41c6364f6c removing an accidental double-method 2010-11-20 18:21:31 -05:00
Jeremy Ashkenas
12134d2043 Using pluckDirectCalls again 2010-11-20 18:14:05 -05:00
Jeremy Ashkenas
83c41c69be CoffeeScript lints cleanly again. 2010-11-20 17:46:44 -05:00
Jeremy Ashkenas
31f4214b5d first draft of range literals back... 2010-11-20 17:40:46 -05:00
Jeremy Ashkenas
9f708ad0c8 Merge branch 'master' of https://github.com/andrewschaaf/coffee-script 2010-11-20 14:32:19 -05:00
Jeremy Ashkenas
a2760c6ca3 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-11-20 14:22:44 -05:00
Jeremy Ashkenas
98a362136b rebuilding source docs with new version of Docco. 2010-11-20 14:22:28 -05:00
satyr
bcbf9f7dfd "cake bench" now shows total time spent 2010-11-18 21:33:56 +09:00
satyr
1a9a48c5f2 rewrote "cake bench" to time per parsing stage 2010-11-18 01:34:23 +09:00
satyr
32bd1dfd53 rewrote "cake bench" to see more consistent results 2010-11-17 23:53:39 +09:00
Andrew Schaaf
77cf992224 "sudo npm" -> "npm". npm calls "sudo npm"ing "HOLY COW NOT RECOMMENDED!!" 2010-11-16 14:44:24 -05:00
Jeremy Ashkenas
0c11267045 coco fd028a0: closes #13; leading comments/literals are now placed before variable declarations 2010-11-16 00:11:52 -05:00
Jeremy Ashkenas
ee6f24b48a coco c6cf38a: lexer: refactored @balancedString 2010-11-15 23:59:52 -05:00
Jeremy Ashkenas
eb959b3879 coco: cc71308 (partial) break continue debugger -> STATEMENT 2010-11-14 15:15:13 -05:00
Jeremy Ashkenas
f31798bbb4 coco 31ad9f0: nodes: made Op::invert more accurate 2010-11-14 15:07:43 -05:00
Jeremy Ashkenas
a1aaa4495c fixing Lexer#ASSIGNED 2010-11-14 15:00:20 -05:00
Jeremy Ashkenas
be17b8215c constructor: prefix is back for classes. punto. 2010-11-14 14:21:55 -05:00
Jeremy Ashkenas
15bdcf79e6 coco 63d607f: made deep destructuring compile nicer 2010-11-14 09:47:06 -05:00
Jeremy Ashkenas
09aa9e2a04 coco 19474b4: nodes: removed Base::collectChildren 2010-11-14 09:44:40 -05:00
Jeremy Ashkenas
c98fa8168b making levels start at one. 2010-11-13 21:08:42 -05:00
Jeremy Ashkenas
32a9c2ce49 moving up constructor definitions. 2010-11-13 21:05:59 -05:00
Jeremy Ashkenas
c7cd72c682 coco 02ee77c: nodes: fixed parenthesization in Op::compileNode 2010-11-13 18:27:05 -05:00
Jeremy Ashkenas
144b66c4da coco 2419207: coffee#840: fixed post-for precedence 2010-11-13 18:23:46 -05:00
Jeremy Ashkenas
7c7eccf1f2 removing an unused rule in Root. 2010-11-13 18:13:09 -05:00
Jeremy Ashkenas
5de73f6c25 coco 7222551: crushed __bind 2010-11-13 18:08:02 -05:00
Jeremy Ashkenas
6f47364392 done refactoring Class for now... 2010-11-13 18:02:50 -05:00
Jeremy Ashkenas
9a5546c8e9 further refactors to Class 2010-11-13 17:05:54 -05:00
Jeremy Ashkenas
f1972ff336 waypoint: part way through refactoring Class 2010-11-13 16:53:55 -05:00
Jeremy Ashkenas
cb6793f56b adding back '@static: value' syntax for classes 2010-11-13 15:52:30 -05:00
Jeremy Ashkenas
2aedbc2e42 Back to naked constructors. 2010-11-13 15:22:18 -05:00
Jeremy Ashkenas
f0b73dc9f5 Building with latest version of Jison. 2010-11-13 15:10:12 -05:00
Jeremy Ashkenas
354708dbc2 Putting 'constructor' back. Improving constructor definitions. 2010-11-13 12:17:09 -05:00
Jeremy Ashkenas
3059db8515 Merge branch 'master' into executable 2010-11-13 11:28:22 -05:00
Jason Davies
498e8124f6 Fix spelling 2010-11-13 10:37:55 +00:00
Jeremy Ashkenas
18afd2d84f merging in master 2010-11-12 20:18:52 -05:00
Jeremy Ashkenas
6d3e9df89f coco c39edf: braceless objects can now have trailing herecomments 2010-11-12 20:16:08 -05:00
Jeremy Ashkenas
d08cb20376 removing extended in favor of static method inheritance. 2010-11-12 00:20:08 -05:00
Jeremy Ashkenas
c778ef1004 merge 2010-11-12 00:07:32 -05:00
Jeremy Ashkenas
50c2226dd3 first draft of metaprogramming in class defn's. 2010-11-12 00:05:30 -05:00
satyr
9fa973debe dynakeys: work again on JScript 2010-11-11 23:10:32 -05:00
Jeremy Ashkenas
07e66dd2b4 Added back instance-bound functions to classes ... all tests pass again. 2010-11-11 23:04:58 -05:00
Jeremy Ashkenas
4d8434d1b6 a little further with the tests 2010-11-11 22:02:53 -05:00
Jeremy Ashkenas
ce4bf4aca5 a little further with the tests 2010-11-11 22:02:06 -05:00
Jeremy Ashkenas
21111755cf resolving merge 2010-11-11 21:55:20 -05:00
Jeremy Ashkenas
7fda0cd7d9 first draft of coco's executable class bodies ... cleanups and tests to follow. 2010-11-11 21:48:08 -05:00
satyr
a2d33112b8 dynakeys: work again on JScript 2010-11-11 16:17:56 +09:00
Jeremy Ashkenas
2c7f6d8bfe switching to UglifyJS for browser version of CoffeeScript. 2010-11-10 23:06:26 -05:00
Jeremy Ashkenas
5ec7e885f1 coco 8a8cc53: meta-heregex 2010-11-10 22:43:06 -05:00
Jeremy Ashkenas
3338cd073d better slash-w. 2010-11-10 22:41:14 -05:00
Jeremy Ashkenas
9a71bb17fd Adding IDENTIFIER and STRING to NOT_SPACED_REGEX 2010-11-09 22:46:37 -05:00
Jeremy Ashkenas
841463da8e Hewing closer to JS' syntactic resynchronization for regexp lexing. 2010-11-09 22:39:15 -05:00
Jeremy Ashkenas
71db1fc142 making REGEXP a bit stricter. 2010-11-09 22:22:02 -05:00
Jeremy Ashkenas
bc0cc34420 coco 03a9ac0: made tab characters consistent. 2010-11-09 08:25:48 -05:00
Jeremy Ashkenas
611174b0af Revert "coco b8039b9: merged @closeOpenCalls and @closeOpenIndexes into @closeOpenPairs"
This reverts commit a151ceccc6.
2010-11-09 08:20:09 -05:00
Jeremy Ashkenas
9c76c3ef8e Merge branch 'master' of github.com:jashkenas/coffee-script 2010-11-09 08:06:59 -05:00
Jeremy Ashkenas
8f8c4b44f1 it's attr, not css. 2010-11-09 08:06:54 -05:00
satyr
3ae818860b fixed a bug where postfix ? was incorrectly unwrapping its operand 2010-11-09 16:27:21 +09:00
Jeremy Ashkenas
188ad03c17 coco b615379: optimized @ensureBalance 2010-11-09 00:36:13 -05:00
Jeremy Ashkenas
a151ceccc6 coco b8039b9: merged @closeOpenCalls and @closeOpenIndexes into @closeOpenPairs 2010-11-09 00:31:11 -05:00
Jeremy Ashkenas
cb81f86434 coco 98271e6: made 'extends' chainable 2010-11-09 00:26:31 -05:00
Jeremy Ashkenas
d7f1193f22 coco 607fded: reinforced Op::INVERSIONS 2010-11-09 00:21:42 -05:00
Jeremy Ashkenas
9017b1ad3d _result -> _results 2010-11-09 00:17:08 -05:00
Jeremy Ashkenas
14f86043cf coco e8563db: tiny optimizations 2010-11-08 23:48:38 -05:00
Jeremy Ashkenas
042af51751 combination of satyr's three comment patches ... comments are now statements, not expressions... 2010-11-08 23:39:21 -05:00
Federico Builes
936abc381b Remove trailing whitespace from README. 2010-11-08 23:25:15 -05:00
Jeremy Ashkenas
e882af9f8d coco b82de20: removed Base::idt 2010-11-08 23:20:11 -05:00
Jeremy Ashkenas
9c5eca9131 coco dc8945c: less ternaries, more returns-from-ifs. More readable. 2010-11-08 23:07:51 -05:00
Jeremy Ashkenas
919596aba4 coco a503190 ... made postfix invertible 2010-11-08 22:47:13 -05:00
Jeremy Ashkenas
eb3a32e853 fixing coffee -s ... (jannehietamaki) 2010-11-08 21:58:13 -05:00
Janne Hietamäki
3af34d61d3 Do not pass invalid filename 'stdio' to compileScript when compiling from stdin because it breaks fs.realpathSync at run.
It would be nice to have a test for this but wasn't sure if there is a way to test stdin from cake.
2010-11-06 15:21:45 +02:00
Jeremy Ashkenas
bc8022f49f lexer refactors 2010-11-05 00:04:52 -04:00
Jeremy Ashkenas
4eee750d4c removing unused utilities.js 2010-11-04 23:15:58 -04:00
Jeremy Ashkenas
f6a8d4c074 round 2, light refactors. 2010-11-04 23:05:04 -04:00
Jeremy Ashkenas
bb05e07e4e light refactors + tweaks 2010-11-04 22:53:07 -04:00
Jeremy Ashkenas
8d30feaf88 Fixing jsl.conf to lint cleanly again (don't mind our void 0s) 2010-11-04 22:39:50 -04:00
Jeremy Ashkenas
76685e6e51 first draft of safe range comprehensions, upwards and downwards. 2010-11-04 21:53:23 -04:00
Jeremy Ashkenas
09b243e689 loosening the restrictions on functions that can be lifted out -- more tests. 2010-11-03 22:51:17 -04:00
Jeremy Ashkenas
a8b36b231c Adding back in the closed-comprehensions tests. 2010-11-03 22:29:05 -04:00
Jeremy Ashkenas
d5f639fc50 fixing unsafe unwrapAll in previous commit. 2010-11-03 22:11:38 -04:00
Jeremy Ashkenas
9fc3f8593e First draft at loop block scoping again ... works for functions that mention 'this' 2010-11-03 22:05:24 -04:00
Jeremy Ashkenas
58cac0ca39 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-11-03 21:40:11 -04:00
Jeremy Ashkenas
304a120429 satyr 4e39e2e -- efficient closures in loops -- pulling them out. 2010-11-03 21:39:54 -04:00
satyr
c418bca461 nodes: filled in missing LEVEL_* in In::compile*Test 2010-11-02 23:28:18 +09:00
satyr
0441d4a5d1 rewriter: no longer tries to include dynamic keys into braceless objects 2010-11-02 23:22:41 +09:00
Jeremy Ashkenas
5eb255a649 modified satyr: allowed temporary variables to share names with ones on upper scopes 2010-11-02 00:31:42 -04:00
Jeremy Ashkenas
605f362ab6 BY now closes implicit calls. 2010-11-02 00:25:04 -04:00
Jeremy Ashkenas
a257f5993a tweak to parser.lexer 2010-11-02 00:05:06 -04:00
Jeremy Ashkenas
987aaa0e19 modified satyr -- when now closes implicit calls. 2010-11-02 00:00:26 -04:00
Jeremy Ashkenas
b0e7c3e3e7 modified satyr -- made temp vars be declared later. 2010-11-01 23:58:03 -04:00
Jeremy Ashkenas
5aa21c363d satyr 1612b04 ... enabled break/continue in comprehensions. 2010-11-01 23:53:49 -04:00
Jeremy Ashkenas
6aaa2eb4d0 safer splats with __slice where necessary. 2010-11-01 23:41:05 -04:00
Jeremy Ashkenas
6163215bbe More indentation, less one-liners. 2010-11-01 23:29:54 -04:00
Jeremy Ashkenas
4788f842c0 satyr commit b2cf91 ... no more @tags 2010-11-01 23:25:28 -04:00
Jeremy Ashkenas
b94c15bdcc not-or to is-and ... positive side. 2010-11-01 23:11:25 -04:00
Jeremy Ashkenas
ebbe0babdb reverting ?= optimization, for the repl's sake. 2010-11-01 22:32:04 -04:00
Jeremy Ashkenas
187cda0c39 Using default arguments in one more spot. 2010-11-01 22:07:34 -04:00
Jeremy Ashkenas
f13e363a87 Now that ?= is optimized, reverting the expansion. 2010-11-01 22:04:22 -04:00
Jeremy Ashkenas
83e6955dce Optimizing default arguments and existential assignment. 2010-11-01 22:01:52 -04:00
Jeremy Ashkenas
749e056618 reindenting grammar.coffee to the shared column, as much as possible. 2010-11-01 21:37:42 -04:00
Jeremy Ashkenas
c17efcf422 merging satyr/defarg 2010-11-01 21:33:07 -04:00
Jeremy Ashkenas
3ede624759 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-11-01 20:57:45 -04:00
Jeremy Ashkenas
67f1e04f3b merging in Trevor's --no-wrap deprecation 2010-11-01 20:57:43 -04:00
Jeremy Ashkenas
a4be3bceec Merge branch 'master' of git://github.com/TrevorBurnham/coffee-script 2010-11-01 20:53:49 -04:00
satyr
56391df345 dynakeys: optimized and fixed a bug in caching 2010-11-02 02:51:46 +09:00
satyr
4f4032c053 fixed a bug that compound assignments were declaring variables 2010-11-01 10:42:42 +09:00
Jeremy Ashkenas
195ca70278 tweaks to eval-fix 2010-10-30 17:35:54 -04:00
Trevor Burnham
776b1b723e Fixing --eval; see issue 820 2010-10-28 22:18:11 -04:00
Trevor Burnham
baef719908 Accepting --no-wrap, with a warning 2010-10-28 12:22:33 -04:00
Jeremy Ashkenas
6d8126e498 Removing the last Jison hack. (Jison 0.1.25) 2010-10-28 01:39:35 -04:00
Jeremy Ashkenas
6b4e437c93 CoffeeScript now compiled 'undefined' as 'void 0' 2010-10-27 22:50:20 -04:00
Jeremy Ashkenas
853d28860a Issue #801 -- Empty catch statements immediately preceding outdents. 2010-10-27 22:21:47 -04:00
Jeremy Ashkenas
62a1824400 Removing one of the Jison patches, no longer needed with 0.1.24 2010-10-27 22:14:00 -04:00
Jeremy Ashkenas
b3a4ce4e98 merging in parity checks. 2010-10-27 22:07:21 -04:00
Jeremy Ashkenas
42812a8dc0 Merge branch 'master' of http://github.com/michaelficarra/coffee-script 2010-10-27 22:06:55 -04:00
Jeremy Ashkenas
6e9cb27e46 Patching Jison (again) to fix 'Unexpected 1' -> 'Unexpected EOF' 2010-10-27 22:04:32 -04:00
satyr
1aba75e3e8 destructuring within arguments is now allowed as in SpiderMonkey 2010-10-27 05:23:35 +09:00
Michael Ficarra
0f577e0c94 good practice for parity checks 2010-10-26 11:35:23 -04:00
Jeremy Ashkenas
7170536021 Revert "aligned up some ifelses using leading then"
This reverts commit b84063bc3f.
2010-10-26 08:42:31 -04:00
satyr
1cb6464948 optimized splatting assignment 2010-10-26 20:51:02 +09:00
satyr
e36746d367 made [a..., b...] = c throw syntax error 2010-10-26 19:32:59 +09:00
satyr
371282fe7a defarg: (options = {}) where possible 2010-10-26 19:14:03 +09:00
satyr
96f74f9da8 grammar: refactored Param 2010-10-26 19:08:01 +09:00
satyr
4eeab947dd defarg: removed Splat::compileParam in favor of using the normal array destructuring against arguments 2010-10-26 18:57:32 +09:00
satyr
e7cc4e4faf implemented default arguments 2010-10-26 13:34:56 +09:00
satyr
ecd4722b7c removed a redundancy in splatted assignment 2010-10-26 13:33:03 +09:00
satyr
5a92b339a4 lexer: removed unused UNARY tokens 2010-10-26 09:29:13 +09:00
satyr
cb5642945a test: merged "expressions" into "chaining" and "returns" 2010-10-26 09:08:16 +09:00
satyr
b84063bc3f aligned up some ifelses using leading then 2010-10-26 06:02:38 +09:00
satyr
426d71cb4f leading then is now valid 2010-10-26 05:36:32 +09:00
satyr
b2be475f93 tidied up formatting I broke at ad79e142 2010-10-26 04:57:20 +09:00
satyr
ad79e142ca refactored operator parsing 2010-10-26 03:58:11 +09:00
satyr
0d6d221568 dynakeys: {(x), y} now compiles correctly 2010-10-26 01:40:07 +09:00
satyr
863f3f6b47 rewriter: (a): (b): (c) is now allowed 2010-10-26 00:56:03 +09:00
satyr
ff82c59903 rewriter: a: b: c is now valid 2010-10-26 00:38:28 +09:00
satyr
27cdafb2d0 nodes: @soakNode -> @soak 2010-10-25 22:31:52 +09:00
satyr
2aa093b65c removed extra lines from the compilation of trailing then with if/switch 2010-10-25 22:19:02 +09:00
satyr
1e984e78ca grammar: improved formatting consistency, using single quotes unless interpolated and wrapping lines that are too long 2010-10-25 21:37:08 +09:00
Jeremy Ashkenas
520d6a9d93 Comments are statements also, not just pure statements. 2010-10-24 21:53:48 -04:00
Jeremy Ashkenas
00220a9f2c replacing mistakenly-deleted nodes.coffee 2010-10-24 21:52:18 -04:00
Jeremy Ashkenas
6faff7c344 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-24 21:50:37 -04:00
Jeremy Ashkenas
0e5dd3d557 First draft of recompiling examples for 0.9.9 2010-10-24 21:50:34 -04:00
Timothy Jones
2ddae698bb Using a typeof check in scope. 2010-10-25 14:42:37 +13:00
Jeremy Ashkenas
99c06b5cda All examples now compile and lint cleanly. 2010-10-24 21:37:27 -04:00
Jeremy Ashkenas
343c0fdef7 top-level examples now compile and lint cleanly. 2010-10-24 21:34:40 -04:00
Jeremy Ashkenas
017e3a156e Removing breaks from the last switch case, and just disabling the lint warning instead. 2010-10-24 21:30:26 -04:00
Jeremy Ashkenas
12b217c8ec Adding break to default switch clauses to pass lint. 2010-10-24 21:26:24 -04:00
Jeremy Ashkenas
6a9c4380f3 Fixing scope.coffee -- we can't use a JS object as a hash that has to contain the word 'hasOwnProperty' 2010-10-24 21:23:32 -04:00
Jeremy Ashkenas
a75368e2e8 Fixing the REPL. 2010-10-24 21:15:20 -04:00
Jeremy Ashkenas
13f6b037e2 Working towards new versions of the examples. 2010-10-24 21:11:15 -04:00
Jeremy Ashkenas
c2da8c2d54 Removing extraneous semicolon, adding back in final break -- src now lints cleanly. 2010-10-24 20:51:55 -04:00
Jeremy Ashkenas
5b16d4790c Removing/Reverting do -> 2010-10-24 20:34:50 -04:00
satyr
101a044219 nodes: reformatted 2010-10-25 08:55:42 +09:00
satyr
7bfb2e3a78 nodes: removed Value.wrap 2010-10-25 08:13:58 +09:00
satyr
ab2050dc59 nodes: added Base::unwrapAll 2010-10-25 08:00:12 +09:00
satyr
98d22f9510 assigning to bizarre things like [a()] = b now causes syntax error 2010-10-25 07:33:41 +09:00
satyr
e146b539f5 optimized switch compilation 2010-10-25 06:20:45 +09:00
Jeremy Ashkenas
d1094e11a0 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-24 15:50:22 -04:00
Jeremy Ashkenas
02e94cdb1c removing forgotten print's 2010-10-24 15:50:18 -04:00
satyr
c8d994a97d invalid destructuring assignments like {0} = x now causes syntax error 2010-10-25 04:46:28 +09:00
Jeremy Ashkenas
e007f69c71 Adding xqjs, CUP, and Congo to the resources section. 2010-10-24 14:29:47 -04:00
Jeremy Ashkenas
08527075b7 Expanding __filename and __dirname when running with the coffee command -- Issue #771 2010-10-24 14:19:47 -04:00
Jeremy Ashkenas
6347849cd0 Switching parenthesized side in comprehensions. 2010-10-24 14:11:09 -04:00
Jeremy Ashkenas
b32a75858a further reduce predecence levels. 2010-10-24 14:04:06 -04:00
Jeremy Ashkenas
d6d46697d0 Issue #795 -- clean up low precedence levels 2010-10-24 14:02:59 -04:00
Jeremy Ashkenas
3a64e6a711 Removing -> and => from precendece-having operators. 2010-10-24 13:55:47 -04:00
Jeremy Ashkenas
ca90af4fa5 Removing duplicate 'UNLESS' 2010-10-24 13:54:29 -04:00
Jeremy Ashkenas
e822b2d43b Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-24 13:38:03 -04:00
Jeremy Ashkenas
3a16677ebf typo 2010-10-24 13:38:00 -04:00
satyr
d60aa9a80c removed extra lines from trailing then compilations 2010-10-25 01:58:00 +09:00
Jeremy Ashkenas
26a115adcf Removing the mixed-in sys/util module. Switching from 'puts' to console.log 2010-10-24 12:48:42 -04:00
satyr
aed0e8790e nodes: continue while .. over while .. then 2010-10-25 01:05:37 +09:00
Jeremy Ashkenas
cecae0f965 ObjectLiteral -> Obj, ArrayLiteral -> Arr 2010-10-24 11:35:47 -04:00
Jeremy Ashkenas
55bf6450e7 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-24 11:32:29 -04:00
Jeremy Ashkenas
95be4a61ec Merging in dynakeys 2010-10-24 11:32:23 -04:00
satyr
abef3f59be rebuilt parser and rewrote the asserts wrapping loop in Cakefile using do => 2010-10-25 00:14:58 +09:00
Timothy Jones
9619fa66eb Altered bound functions with do to just use call(this) rather than binding. 2010-10-25 00:18:54 +13:00
Timothy Jones
d096f69c78 Implemented rescoping with the do keyword. 2010-10-25 00:02:39 +13:00
Timothy Jones
f52ef98cee Removing unnecessary parens and removing the sudo recommendation for npm in the readme. 2010-10-24 23:45:47 +13:00
satyr
a458c4a905 dynakeys: can now do destructuring assignments 2010-10-24 17:56:34 +09:00
satyr
85c8a6780a dynakeys: can now be braceless 2010-10-24 15:39:11 +09:00
Timothy Jones
99deb8c670 Wrapping only the last line of comprehensions, allowing pure statements anywhere in between. 2010-10-24 18:36:23 +13:00
satyr
331036f86d 786: implemented dynamic object keys 2010-10-24 14:20:20 +09:00
Timothy Jones
291f377d40 Correcting version regex. 2010-10-24 15:05:11 +13:00
Michael Ficarra
4d4e758bf3 node 0.3 compliance 2010-10-23 21:48:58 -04:00
satyr
bfc236fca3 grammar: removed a remnant of Slice 2010-10-24 05:35:35 +09:00
satyr
b648b392b6 removed an extra garbage 2010-10-24 04:16:49 +09:00
satyr
89516e6ee1 added/fixed/tweaked a few tests and merged test_compound_assignment into test_assignment 2010-10-24 04:09:13 +09:00
satyr
0c3093f331 quit using __temp__ as placeholder name for anon class 2010-10-24 03:43:06 +09:00
satyr
ebdcfb5227 merged == and != into COMPARE 2010-10-24 03:30:16 +09:00
Timothy Jones
fc332bcfbd Easing leniency on pure statements. 2010-10-24 06:53:10 +13:00
Jeremy Ashkenas
e96cdbf67c resolving merge conflict. 2010-10-23 11:11:49 -04:00
Jeremy Ashkenas
2287b06aeb Reverting LEVEL object. 2010-10-23 11:10:28 -04:00
satyr
1335aee54b 783: corrected chained comparison precedence 2010-10-24 00:01:30 +09:00
Jeremy Ashkenas
6058910b49 Making the LEVEL constants a bit more readable. 2010-10-23 10:34:22 -04:00
Timothy Jones
b60afdb619 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-24 02:17:44 +13:00
Timothy Jones
3834e7bc33 Revert "Passing the arguments object directly when generating a closure."
This reverts commit 7b887f065d.
2010-10-24 02:15:01 +13:00
satyr
0942071517 fixed a regression that for-in was failing to cache the source value 2010-10-23 22:04:58 +09:00
Timothy Jones
7b887f065d Passing the arguments object directly when generating a closure. 2010-10-24 01:20:16 +13:00
Timothy Jones
e6fb3bcffb Spacing only + and - and only in a row. 2010-10-24 00:13:48 +13:00
Timothy Jones
9448a477d2 Spacing multiple operators. 2010-10-24 00:01:26 +13:00
satyr
2bc2c4717e nodes: refactored and removed the notion of o.top in favor of LVL_TOP 2010-10-23 19:18:04 +09:00
satyr
b82f495ec7 nodes: introduced a notion of levels that streamlines parenthesizations 2010-10-23 19:17:56 +09:00
satyr
1130f4fef5 refactored and added a test for a8da321 2010-10-23 03:00:09 +09:00
satyr
a8da321883 fixed a bug where multiple trailing comments prevented returnification 2010-10-23 02:30:38 +09:00
satyr
32e63cd130 nodes: removed some redundancies and unused methods 2010-10-23 01:47:28 +09:00
satyr
3df28a8a6a reverted "lexer: simplified tokenizers' responsibility" with magic numbers removed
This reverts commit 10442239f1.
2010-10-22 23:50:44 +09:00
Jeremy Ashkenas
10442239f1 Revert "lexer: simplified tokenizers' responsibility"
This reverts commit a9e95fa43b.
2010-10-22 08:13:40 -04:00
satyr
a9e95fa43b lexer: simplified tokenizers' responsibility 2010-10-22 14:56:51 +09:00
Jeremy Ashkenas
c92fd79f35 normalizing loop declarations towards common JS practice. 2010-10-21 21:51:06 -04:00
Jeremy Ashkenas
0342b0a89f merging the range-killer to master 2010-10-21 21:27:45 -04:00
satyr
341de42692 removed extra parens around simple values 2010-10-22 09:35:15 +09:00
Timothy Jones
f43ee4075d Removing empty parens from the grammar. 2010-10-22 11:29:03 +13:00
satyr
79148d2940 refactored loop variable caching 2010-10-22 02:07:00 +09:00
satyr
bd10c2f828 implemented for-from-to and removed dotted ranges 2010-10-21 23:06:50 +09:00
satyr
2f7c076a50 fixed a bug where in malfunctioned in commaed lists 2010-10-21 22:13:59 +09:00
Timothy Jones
880c5c8083 Fixing destructor in magicked for. Also making destructors in range loops syntax errors. 2010-10-22 00:34:51 +13:00
Jeremy Ashkenas
7596e3a157 putting back arguments. 2010-10-21 00:07:21 -04:00
satyr
cb9683a7fd fixed/removed broken/redundant tests 2010-10-21 12:45:50 +09:00
Jeremy Ashkenas
0d4d7e0880 indentation 2010-10-20 23:16:46 -04:00
Jeremy Ashkenas
bb080130b9 tweaks to scope 2010-10-20 23:09:06 -04:00
Timothy Jones
f229f791a9 Proper testing, this time. 2010-10-21 14:37:58 +13:00
Timothy Jones
e694b41a94 Operators now respect new lines as being spaced. 2010-10-21 14:27:25 +13:00
satyr
31746ce692 made In node invertible 2010-10-21 09:19:52 +09:00
satyr
53fbfc7d15 removed extra parens from in/return compilations 2010-10-21 07:19:08 +09:00
satyr
78835073db removed extra parens from array/index compilations 2010-10-21 06:07:58 +09:00
satyr
c11ca94870 removed extra parens from soak compilations 2010-10-21 04:51:11 +09:00
satyr
c1dc74fc8b removed extra parens from compilations with assignments or conditional operators 2010-10-21 02:29:06 +09:00
satyr
e2a6f292a2 nodes: refactored to reduce parens 2010-10-20 19:53:41 +09:00
satyr
b0a4b7ab85 scope: refactored 2010-10-20 17:13:43 +09:00
Timothy Jones
8d6b909b93 Removing the utterly pointless splice in scope for the much more reasonable assignment. 2010-10-20 19:51:53 +13:00
Jeremy Ashkenas
303be86291 resolving merge conflict. 2010-10-19 23:31:19 -04:00
Jeremy Ashkenas
113d7ce98f let's try to merge these indexOf patches. 2010-10-19 23:27:15 -04:00
satyr
2c84f3ed1f removed helpers.{indexOf,include} in favor of in operator 2010-10-20 12:20:10 +09:00
Jeremy Ashkenas
c1d24944dc inArray -> indexOf ... 2010-10-19 23:06:51 -04:00
Jeremy Ashkenas
35b6a70724 going back to the Closure Compiler. 2010-10-19 21:59:13 -04:00
Jeremy Ashkenas
54d9b283fa Merge branch 'master' of http://github.com/stephank/coffee-script 2010-10-19 21:52:39 -04:00
satyr
90a13bd791 compound assignments are now represented as Assign nodes (rather than Op) and have the same precedence as = 2010-10-20 09:50:42 +09:00
Timothy Jones
15cfe8ebf1 Restoring garbage collection. 2010-10-20 12:58:59 +13:00
Timothy Jones
8c4a48d9d0 Adjusting refactor to better emulate map. 2010-10-20 12:51:34 +13:00
Timothy Jones
8fff6e9baf Refactoring scope to use an array instead of an object, to make the IE bugfix significantly tidier. 2010-10-20 12:36:50 +13:00
Timothy Jones
7342058e64 Comment fix. 2010-10-20 12:05:34 +13:00
Timothy Jones
083fc61dfb Fixing IE DontEnum bug in Scope. Ignoring everywhere else. 2010-10-20 12:02:38 +13:00
Timothy Jones
502d444ebd Reversing evaluation order of __inArray to reflect the ordering of the in operator. 2010-10-20 09:52:11 +13:00
Timothy Jones
c3582d4058 One character fix, for the sake of consistency. 2010-10-20 08:57:23 +13:00
Timothy Jones
37d9204ad9 Tidying inArray utility. 2010-10-20 08:47:34 +13:00
Timothy Jones
a3500e807a Avoids unnecessary temporary in comprehensions with pure statements in them. 2010-10-20 07:57:40 +13:00
Timothy Jones
1442262376 Merge branch 'master' of http://github.com/TrevorBurnham/coffee-script into trevor 2010-10-20 07:43:07 +13:00
Trevor Burnham
33ac70aec3 Whitespace fix for unstepPart (thanks, Tesco) 2010-10-19 14:24:38 -04:00
Trevor Burnham
5005cb606f Fixing inconsistencies for index variables
See the tests added to test_comprehensions.coffee. Previously, after
`for i in [1..3]`, i was 4. Also, index variables were never set to
any value in comprehensions containing both a closure and a break or
return.
2010-10-19 14:09:16 -04:00
Stéphan Kochen
c458346593 In compileScripts, run base through path.join.
Allows `path.join` to do some processing on the base path
that was also happening on the full path.
Fixes: `coffee -o ./ ./`
Still broken: `coffee -o . .`
2010-10-19 18:36:27 +02:00
Timothy Jones
c64e8d4b53 Added the __inArray helper to clean up code and speed up searches. 2010-10-20 05:34:03 +13:00
Stéphan Kochen
e5dfa19ec9 Report errors when writing files in coffee. 2010-10-19 18:30:29 +02:00
Timothy Jones
0e395569ee Fixing #761. p -1 now translates to p(-1), not p - 1. Same with +. 2010-10-20 04:52:07 +13:00
Timothy Jones
262d796356 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-20 04:11:25 +13:00
Timothy Jones
cf5a086263 Removing accidental superfluous temp variables. 2010-10-20 04:07:10 +13:00
Timothy Jones
d14ba6ac53 Fixed comprehension magic's scoping. 2010-10-20 03:59:01 +13:00
Timothy Jones
7b1902183c Just catch alls for inner scoping now. 2010-10-20 03:53:38 +13:00
Timothy Jones
cb6be74851 Fixing for magic scoping issues. Small steps at a time. 2010-10-20 02:51:52 +13:00
Jeremy Ashkenas
9e03c66529 Merge branch 'master' of git://github.com/Tesco/coffee-script 2010-10-19 09:13:41 -04:00
Jeremy Ashkenas
f6b190bb5a Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-19 09:13:21 -04:00
Jeremy Ashkenas
3f89fea65a fixing resig link 2010-10-19 09:13:09 -04:00
Timothy Jones
c8b9c5a54e Fixing #774. Strict equality operator, which wasn't supported in the grammar anyway, is removed from the lexer. 2010-10-19 20:56:55 +13:00
Timothy Jones
fd268a0479 Fixed #763. SimpleAssignables are now the only possible recepients of ++, -- and compound assignments. 2010-10-19 20:48:39 +13:00
Timothy Jones
648d6432eb Fixing #700. Block comment for constructor now appears above the constructor declaration. 2010-10-19 20:39:58 +13:00
Timothy Jones
df46fb8c68 Fixing #600. JS statements that must be expressions but contain pure statements cause syntax errors. 2010-10-19 20:02:21 +13:00
Timothy Jones
d9cd75c426 Fixing #773. Statements cannot be wrapped in parens (as in JS). 2010-10-19 19:32:23 +13:00
satyr
87560d943c lexer: made REGEX more efficient 2010-10-18 07:43:29 +09:00
satyr
8d0a0e8ab1 nodes: Value.unfoldSoak -> If.unfoldSoak 2010-10-17 13:53:02 +09:00
satyr
55794d9534 nodes: soaking Call now converts to If using the same logic as soaking Accessor 2010-10-17 13:19:51 +09:00
Jeremy Ashkenas
84dcd6fe2f Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-14 17:17:42 -04:00
satyr
88cc1ee35d 765: -b/--bare <- --no-wrap 2010-10-14 04:09:56 +09:00
Michael Ficarra
6e89ad3401 test case for #768 2010-10-13 12:12:24 -04:00
Michael Ficarra
1ea38d2f93 fixing #768, preserving execution order of in arguments when compiled
to an `or`.
2010-10-13 12:10:36 -04:00
satyr
1d4d7e96fa quit using sp?licing ranges 2010-10-13 05:47:45 +09:00
satyr
67eb966a75 stripped a line from __extends 2010-10-13 04:57:11 +09:00
Daniel J. Pritchett
ceef24834c spelling tweak to index.html 2010-10-12 14:54:02 -05:00
satyr
cb2a7f0820 simplified splatting new compilation 2010-10-12 21:48:25 +09:00
satyr
8f29574b16 764: made boolean/number/regex indexable 2010-10-12 19:30:10 +09:00
satyr
c0ec479e60 browser: exposed require for debugging 2010-10-12 17:10:39 +09:00
satyr
54101a1c9b lexer: reorganized JS_KEYWORDS 2010-10-12 16:25:33 +09:00
satyr
43613498db Merge branch '542' 2010-10-12 11:29:33 +09:00
satyr
ac841ca4e9 nodes: object literals are now parenthesized based on @tags.front (which indicates if the node leads an expression statement), fixing #542 2010-10-12 11:26:55 +09:00
satyr
95d86758ee test.html: string_interpolation -> strings 2010-10-12 10:34:31 +09:00
satyr
ed79715841 stripped out strings/regexes from test_literals; test_string_interpolation is now test_string 2010-10-12 09:35:59 +09:00
satyr
b01d7db409 merged test_blocks into test_functions 2010-10-12 08:54:36 +09:00
satyr
e5fe145f80 destructuring assignment no longer uses a temporary variable for simple LHS 2010-10-12 07:58:11 +09:00
Jeremy Ashkenas
2642fde0f8 merging in the browser test suite. 2010-10-11 18:22:01 -04:00
satyr
f682bf642f followup to #717; made new => actually work 2010-10-12 07:02:04 +09:00
satyr
5ed69a5a58 added test.html that runs most of test/*.coffee in browsers 2010-10-12 06:53:20 +09:00
Jeremy Ashkenas
a4b6b2464c merging in sstephenson's test:browser 2010-10-11 16:55:17 -04:00
Jeremy Ashkenas
4f89245570 NEXT_ELLPSIS.test 2010-10-11 16:34:16 -04:00
Sam Stephenson
5236bb279d Remove the window hack in test:browser. 2010-10-11 12:27:05 -05:00
Sam Stephenson
967fec2ae5 Merge branch 'master' into newline-splat
Conflicts:
	lib/lexer.js
	lib/parser.js
	src/lexer.coffee
2010-10-11 12:12:13 -05:00
Jeremy Ashkenas
d7052d09ff tweaking compileWithDeclarations 2010-10-11 12:27:57 -04:00
Jeremy Ashkenas
acc06d772a Back four commits ... Fixing named function expressions -> function declarations for IE. (grumble grumble) 2010-10-11 12:13:01 -04:00
Sam Stephenson
f360fba47f Add test:browser task for running the test suite against the merged browser script. 2010-10-11 09:42:13 -05:00
Jeremy Ashkenas
de0b93381c switching to YUI compressor for the time being... ticket #575 2010-10-11 08:40:15 -04:00
Jeremy Ashkenas
42d39d59dd rebuilding browser.js 2010-10-11 08:13:59 -04:00
Jeremy Ashkenas
bfed78a996 rebuilding lexer 2010-10-11 08:06:27 -04:00
satyr
9c55bd59a1 fixed a bug where while condition was compiling as statement 2010-10-11 20:29:08 +09:00
satyr
e89d7a7756 lexer: fixed a regression where assignmentError wasn't fired 2010-10-11 19:10:30 +09:00
satyr
41cd0c272b grouped TRUE/FALSE/NULL into BOOL 2010-10-11 17:05:50 +09:00
satyr
6506f6d99e grammar: removed extra arrays 2010-10-11 16:06:29 +09:00
satyr
fffa01933d fixed misdentation in a?.b = c 2010-10-11 12:31:54 +09:00
satyr
acafb1b53a nodes: no longer uses helpers.indexOf 2010-10-11 09:40:41 +09:00
satyr
c437f0b14b made until less parenful as well 2010-10-11 07:29:38 +09:00
Sam Stephenson
20a07c174c Fixing splats after newlines - #754. 2010-10-10 11:34:22 -05:00
Sam Stephenson
6e6165796c noWrap: true -> wrap: false 2010-10-10 11:55:01 -04:00
Jeremy Ashkenas
f6ca5d814c Issue #748 -- trailing reserved idenitifer. 2010-10-10 11:42:25 -04:00
Jeremy Ashkenas
45ed62931b #749 -- adding CoffeeApp mention 2010-10-10 11:33:03 -04:00
Jeremy Ashkenas
9c54291d04 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-10 11:29:29 -04:00
Jeremy Ashkenas
e8d592cdc6 Fixing issue #751 ... implicit number arguments within implicit object literals. 2010-10-10 11:29:14 -04:00
satyr
24a0015148 lexer: made REGEX more accurate 2010-10-10 07:32:49 +09:00
satyr
b0e34edf99 soak accesses no longer consume corresponding operators 2010-10-10 07:10:20 +09:00
satyr
c5f922c5db coffee-script: tokens/nodes can now take options as well 2010-10-09 04:27:05 +09:00
satyr
ebdd57a2fe rewriter: detectEnd no longer passes undefined as token, fixing #750 2010-10-09 04:00:07 +09:00
Jeremy Ashkenas
b21057d166 fixing issue #745 ... precedence of huh operator. 2010-10-07 22:22:33 -04:00
satyr
4f486bc444 removed YES/NO/ON/OFF from rewriter/parser 2010-10-08 00:56:01 +09:00
satyr
9447796d8e made unless less parenfull 2010-10-07 20:05:22 +09:00
satyr
c7157ca90c quit caching v in for all k of v 2010-10-07 15:31:40 +09:00
satyr
250ec12646 Parenthetical -> Parens 2010-10-07 12:59:36 +09:00
satyr
2d9cff3af6 nodes: removed literal helper 2010-10-07 12:41:09 +09:00
satyr
95bc4c5eeb reenabled stricter caching on For compilation as well as reduced a line from it 2010-10-07 12:31:05 +09:00
Jeremy Ashkenas
30a18fdaeb Removed the silly 'Node' suffix from everything. 2010-10-06 22:44:32 -04:00
Jeremy Ashkenas
13774cf48a empty returns no longer return null 2010-10-06 22:24:52 -04:00
Jeremy Ashkenas
69d2048ccc Re-enabling garbage collection of tempvars, only at function boundaries. 2010-10-06 21:19:05 -04:00
Jeremy Ashkenas
d4dac214ab optimizing comprehensions source references 2010-10-06 21:13:11 -04:00
Jeremy Ashkenas
5605ba32e3 merge conflict 2010-10-06 20:54:48 -04:00
Jeremy Ashkenas
59d6e59f97 Fixing Issue 730 -- and removing garbage collection of tempvars (which was totally unsafe.) 2010-10-06 20:54:08 -04:00
satyr
f90f1ef8e0 nodes: re{name,formatt}ed things 2010-10-07 09:28:53 +09:00
Jeremy Ashkenas
69b901a5b6 Fixing Issue #744 -- you can now use reserved words as static properties of a class. 2010-10-06 20:07:19 -04:00
Jeremy Ashkenas
af2e866947 rebuilding documentation 2010-10-05 21:05:57 -04:00
Jeremy Ashkenas
17eaf63c6d Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-05 21:02:05 -04:00
Jeremy Ashkenas
e2176a6521 whitespace 2010-10-05 21:02:03 -04:00
satyr
2e6b50335f lexer now distinguishes between IN/OF and FORIN/FOROF to help grammar, fixing #737 2010-10-06 04:46:17 +09:00
satyr
380bee97dd nagated relational operators are now grouped into NOT_RELATED, fixing #720 2010-10-06 00:43:44 +09:00
satyr
1e60c4c4d2 lexer: had some aligning fun 2010-10-05 23:31:48 +09:00
Jeremy Ashkenas
be0051ee69 s/lookahead/non-capturing 2010-10-05 00:34:49 -04:00
Jeremy Ashkenas
c79a7b5055 removing dollar-prefixed local vars (let's keep 'em for globals only) 2010-10-05 00:23:04 -04:00
Jeremy Ashkenas
08388fea5a testing issue 584 2010-10-05 00:16:55 -04:00
Jeremy Ashkenas
8bc706a94e Merging in heregexes 2010-10-05 00:11:28 -04:00
Jeremy Ashkenas
6f9ac01e71 redo-ing nodes.coffee with named classes. 2010-10-04 23:24:46 -04:00
Jeremy Ashkenas
19a92a4493 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-04 23:21:22 -04:00
Jeremy Ashkenas
2b66d5d6c0 First draft of named classes. 2010-10-04 23:21:16 -04:00
satyr
0ada1dfc3f follow-up to d1bca636; fixed unrolling of the single case ({@a} = o -> @a = o.a) 2010-10-05 12:04:44 +09:00
Timothy Jones
645075f910 All classes now named. 2010-10-05 15:52:33 +13:00
Jeremy Ashkenas
9fd031c896 tweaking the previous commit's test. 2010-10-04 22:12:30 -04:00
Jeremy Ashkenas
e14737dd88 tweaking the previous commit's test. 2010-10-04 22:12:22 -04:00
Jeremy Ashkenas
d1bca6364a Enchancing pattern matching with @vars ... issue #721 2010-10-04 22:10:10 -04:00
Jeremy Ashkenas
8eb283df2c Merge branch 'catchless' of http://github.com/satyr/coffee-script 2010-10-04 20:45:38 -04:00
Jeremy Ashkenas
b4d40c7501 Merge branch 'master' of github.com:jashkenas/coffee-script 2010-10-04 20:25:45 -04:00
Jeremy Ashkenas
ee8f53dd77 fixing @property = value typo. 2010-10-04 20:25:32 -04:00
satyr
d85910c17f made catch optional 2010-10-05 05:53:32 +09:00
satyr
42a91219cb fixed over-escaping in here documents and addressed Stan's comments 2010-10-05 03:47:50 +09:00
satyr
cdd033ffb0 disabled interpolations in normal regexes 2010-10-04 21:51:04 +09:00
satyr
493fa7d8fe heregex: now allows bare slashes and empty body 2010-10-04 11:55:49 +09:00
satyr
c605b3e232 first stub at heregex 2010-10-04 08:22:42 +09:00
satyr
ae55c70ac5 647: fixed quote/newline escaping in here documents 2010-10-03 07:50:41 +09:00
satyr
769870b493 [x] = [y] = [1] works again 2010-10-02 21:49:21 +09:00
satyr
765f57b658 refactored rewriter 2010-10-02 21:21:10 +09:00
satyr
a59d056ad2 [v] = a now compiles to v = a[0] 2010-10-02 20:53:29 +09:00
satyr
f7e6dabf6b fixed a regression where destructuring for miscompiles 2010-10-02 20:19:37 +09:00
Jeremy Ashkenas
baaec57d5c Fixing Issue #738 -- rewriter skips a token. 2010-10-01 21:02:48 -04:00
Jeremy Ashkenas
26de26f88f conditionals with no alternative now evaluate to 'undefined' instead of 'null' 2010-10-01 20:52:23 -04:00
satyr
4fd878447e nodes: removed o.chainRoot which went unused 2010-10-02 08:33:57 +09:00
satyr
8cdee9c0f4 ensured arguments in each scope 2010-10-02 08:21:34 +09:00
satyr
dafe6b09c5 removed remnant of 341f511b 2010-10-02 07:47:28 +09:00
satyr
2ea549ce5f made ForNode avoid needless cachings 2010-10-02 07:26:37 +09:00
satyr
341f511bbd #733: streamlined soak compilations and improved reference cachings 2010-10-02 07:17:35 +09:00
satyr
54f162e523 made --nodes output soak-aware 2010-09-30 05:29:20 +09:00
satyr
b5261abb6b nodes: made ExistenceNode omit typeof for known variables 2010-09-29 11:30:05 +09:00
satyr
9bc613e4a7 nodes: added THIS 2010-09-29 11:29:17 +09:00
Jeremy Ashkenas
5967b48348 Correcting contributor link in readme 2010-09-28 20:17:23 -04:00
Jeremy Ashkenas
b0f49be19e Can't rely on Array.isArray ... 2010-09-28 20:12:37 -04:00
Jeremy Ashkenas
35f395a0e4 Merge branch 'master' of http://github.com/stephank/coffee-script 2010-09-28 20:08:27 -04:00
Jeremy Ashkenas
61852aaddc Turning off a couple more warnings we'd like to ignore in JavaScriptLint. 2010-09-28 20:04:10 -04:00
satyr
7450df8104 #713: destructuring assignment is no longer statement and correctly returns RHS value 2010-09-29 05:47:12 +09:00
Stéphan Kochen
52e7d9a672 Fixing #723; switch cases not iterated by eachChild. 2010-09-28 20:28:05 +02:00
Stéphan Kochen
8f96f5f20f Added a (failing) test that reproduces #723. 2010-09-28 20:27:37 +02:00
satyr
b2313beaf4 added last to helpers 2010-09-29 00:10:03 +09:00
Jeremy Ashkenas
c064c90ee9 Issue #706 -- enchancing empty anonymous classes. 2010-09-27 23:59:47 -04:00
Jeremy Ashkenas
2e3f575f9c Fixing issue #276 -- unsoaked cached indexes. 2010-09-27 23:23:08 -04:00
Jeremy Ashkenas
dc0b03e54e linking to *all* the contributors in the readme. 2010-09-27 22:56:49 -04:00
Jeremy Ashkenas
bd08d06de3 Merge branch 'unary-new' of http://github.com/satyr/coffee-script 2010-09-27 22:52:40 -04:00
Jeremy Ashkenas
8568441221 merging in satyr's fix for #653 2010-09-27 22:17:46 -04:00
Jeremy Ashkenas
a3adc9c1b6 Merge branch '653' of http://github.com/satyr/coffee-script 2010-09-27 22:13:15 -04:00
Jeremy Ashkenas
e3ec325619 rebuilt the site with some IE fixes. 2010-09-27 15:21:45 -04:00
Jeremy Ashkenas
3c848736a7 Removing 'where' from COFFEE_KEYWORDS, and adding a missing equals sign to a test. 2010-09-27 10:16:34 -04:00
satyr
3bba51d5d9 made nodes cache more aggressively, fixing #653 2010-09-27 17:56:56 +09:00
satyr
72c83f5e43 updated tests toward fixing #653 2010-09-27 16:34:00 +09:00
satyr
159150c319 "cake test" now wraps all of the "assert" module to update test counts 2010-09-27 14:17:05 +09:00
satyr
bc87d9ed3d made --nodes output prettier 2010-09-27 04:47:52 +09:00
satyr
e188b9ff41 unary-new: built parser and new => now works 2010-09-27 02:16:41 +09:00
satyr
db531495b8 unary-new: merged master 2010-09-27 01:22:33 +09:00
Jeremy Ashkenas
ecb23d15c4 Merging in satyr's rewrite-lexer.coffee 2010-09-26 10:57:03 -04:00
Jeremy Ashkenas
bd047cbb4f Merge branch 'lexer-refactor' of http://github.com/satyr/coffee-script 2010-09-26 10:40:49 -04:00
Jeremy Ashkenas
008d2ba0d3 adding a cake:bench task 2010-09-26 10:38:28 -04:00
Jeremy Ashkenas
45bd0854b6 Merging in satyr's helpers-refactor 2010-09-26 10:28:48 -04:00
satyr
3e0c35bd0f lexer: enabled multiline interpolations 2010-09-26 07:06:14 +09:00
satyr
7945178f3a lexer: unrolled @extractNextToken/@match 2010-09-26 07:01:24 +09:00
satyr
19f08888e8 lexer: more regexes fixes 2010-09-26 06:57:23 +09:00
satyr
c515aaac5a lexer: fixed ASSIGNED 2010-09-25 23:37:33 +09:00
satyr
0b3b0ab68b unary-new: added tests 2010-09-25 18:13:37 +09:00
satyr
c24e1eacb9 (experimental) made new a unary operator 2010-09-25 17:39:19 +09:00
satyr
9a3b736174 lexer: fixed broken logics (due to f051d088) and a snakecased variable 2010-09-25 16:18:31 +09:00
satyr
e0ed254252 helpers: now directly exported 2010-09-25 09:29:44 +09:00
satyr
9005682cf1 helpers: refactored and fixed comments 2010-09-25 09:18:47 +09:00
satyr
3df82a757d helpers: added test 2010-09-25 09:15:47 +09:00
satyr
3fd7f9efdd added a test for JS literal 2010-09-24 23:06:49 +09:00
satyr
d457423c24 made simple strings shortcut 2010-09-24 22:38:28 +09:00
satyr
f051d0880e lexer: improved logics 2010-09-23 14:14:18 +09:00
satyr
ed501ea37e lexer: improved consistency, preferring charAt, slice and single quotes 2010-09-23 14:11:31 +09:00
satyr
20dae3758a lexer: optimized regexes 2010-09-23 14:05:30 +09:00
Jeremy Ashkenas
a04e17c4ea Merge branch 'master' of http://github.com/sstephenson/coffee-script 2010-09-22 23:32:56 -04:00
Jeremy Ashkenas
fc149fdada merging in satyr/for-of-diet 2010-09-22 23:26:11 -04:00
Jeremy Ashkenas
19dfe4b01d merging Tim's filename branch. 2010-09-22 22:44:42 -04:00
Tim-Smart
c4a3e170e2 Support for older revisions of Node.js for CoffeeScript.run() 2010-09-23 14:41:38 +12:00
Tim-Smart
dfd6025d04 Remove (compiled) from filenames, to keep __filename accurate 2010-09-23 11:55:05 +12:00
Sam Stephenson
01c14bc640 Heredoc indentation detector ignores blank lines without trailing whitespace. 2010-09-22 08:47:43 -05:00
Jeremy Ashkenas
c435647589 removing the ability to force an if/else chain to be compiled as a statement. Ternaries will now be used as much as possible. 2010-09-22 00:41:17 -04:00
Jeremy Ashkenas
c50cf23b7b CoffeeScript 0.9.4 2010-09-21 23:58:05 -04:00
satyr
540783a6dd removed useless property accesses from for-of 2010-09-22 12:55:19 +09:00
Jeremy Ashkenas
25c8b4b34f Using the Array spaces trick to generate padding and indentation. 2010-09-21 23:17:43 -04:00
Jeremy Ashkenas
c0a89a7988 Fixing issue #700, block comment after first line of class definition. 2010-09-21 23:13:46 -04:00
Jeremy Ashkenas
07d9e9b71e fixing up block comment indentation boondoggle. 2010-09-21 22:59:28 -04:00
Jeremy Ashkenas
269f4e8da8 Tweaks to browser.coffee 2010-09-21 22:31:59 -04:00
satyr
481c3d536b made browser.coffee override Node dependent exported methods 2010-09-22 01:05:00 +09:00
Jeremy Ashkenas
7e5db250d3 Merge branch 'master' of git://github.com/StanAngeloff/coffee-script 2010-09-21 08:06:12 -04:00
Jeremy Ashkenas
970bfbe151 Merge branch 'repl' of git://github.com/Tim-Smart/coffee-script 2010-09-21 08:05:03 -04:00
Jeremy Ashkenas
7d98bb216a merged in satyr's leakless branch. 2010-09-21 08:02:22 -04:00
satyr
e4b7d06f35 removed browser specific hacks from src/* by making "rake browser" provide fake require and exports 2010-09-21 18:37:44 +09:00
satyr
b19c004680 made wrapper function keep current this 2010-09-21 16:53:58 +09:00
satyr
7bc91bf6c6 removed global dependency from grammer 2010-09-21 16:50:32 +09:00
Tim-Smart
c49cd02365 Fix REPL. Add CoffeeScript.eval method as run doesn't return result. 2010-09-21 17:36:23 +12:00
Stan Angeloff
992f4192bf Re-compiling core with new temporary variable names, all tests pass. 2010-09-21 07:55:08 +03:00
Stan Angeloff
921ab3ce68 Using old temporary variable name generation for single-letter types
(e.g., i, j, k, and so on).
2010-09-21 07:53:52 +03:00
Jeremy Ashkenas
69942c9a81 commenting out the failing test for the time being, to be fixed later. 2010-09-21 00:14:22 -04:00
Jeremy Ashkenas
fb5158630a fixing herecomment newlines. 2010-09-21 00:06:03 -04:00
Tim-Smart
34c29b3406 Cleaner stack traces.
- Improves run() function
- Re-sets the module.filename to add (compiled)
2010-09-21 15:32:37 +12:00
Jeremy Ashkenas
c0796da7b9 hacking around Jison patch to remove module dependency. 2010-09-20 23:13:02 -04:00
Jeremy Ashkenas
83651a7d6a merging in Tim's registerExtension fix for the latest Node master. 2010-09-20 22:27:04 -04:00
Jeremy Ashkenas
10d57705a0 Merge branch 'registerExtension' of git://github.com/Tim-Smart/coffee-script 2010-09-20 22:24:19 -04:00
Jeremy Ashkenas
71998e06cf Merge branch 'master' of http://github.com/leobm/coffee-script 2010-09-20 22:14:41 -04:00
Jeremy Ashkenas
a16594ed7b Merging in Stan's temporary_junk improvements. 2010-09-20 22:13:08 -04:00
Jeremy Ashkenas
f7fce3cd68 tweaking compiled tempvar names to satisfaction. 2010-09-20 21:56:18 -04:00
Tim-Smart
ba850790ed Add require.extensions support. 2010-09-21 13:23:45 +12:00
Jan-Felix Wittmann
abc1e83319 fix invalid testcase 2010-09-20 12:02:16 +02:00
Stan Angeloff
99a06ce4ea Updating name for cached length temporary variables to '_length', 'length2', and
so on.
2010-09-20 08:42:31 +03:00
Stan Angeloff
31441868e0 Allowing temporary variables to be reused. 2010-09-19 19:34:27 +03:00
Jeremy Ashkenas
5d82dddfb1 merging in Stan's temporary variables. 2010-09-19 12:00:16 -04:00
Stan Angeloff
d568b56c5e First attempt at allowing temporary variables to be reused. 2010-09-19 17:47:26 +03:00
Stan Angeloff
3ab0c12bf1 Don't store tempVars as we can get the next available one from scope. 2010-09-19 17:03:45 +03:00
Stan Angeloff
ed74f42323 Refactoring temporary name generation in a separate method, no
functional changes.
2010-09-19 16:18:01 +03:00
Jeremy Ashkenas
15d84dbb4e Fixing issue #694. Destructuring assignment as first line of implicitly called block -- regression. 2010-09-19 09:04:38 -04:00
Stan Angeloff
65fa0411b4 Part of previous commit: updating how temporary variables are generated.
We no longer need to store the name of the last generated variable,
instead we store the index.
2010-09-19 15:50:17 +03:00
Stan Angeloff
408833daef Removing code added during the migration. freeVariable(..) is called with
a `type` at all times.
2010-09-19 15:37:26 +03:00
Stan Angeloff
bb35b3e3b2 Re-compiling core with new changes. All tests pass. 2010-09-19 15:29:15 +03:00
Stan Angeloff
4a3e1fb0cb Updating nodes.coffee to make use of new temporary variables code
generators.
2010-09-19 15:28:22 +03:00
Stan Angeloff
fe68261bc2 Added generator for custom free variable types, e.g., '_cache',
'_cache2', and so on.
2010-09-19 14:55:19 +03:00
Stan Angeloff
1f2c6c77fd s/tempVars/tempVars.general/ This should allow us to store more than one
category of temporary variables.
2010-09-19 14:36:37 +03:00
Jeremy Ashkenas
08e1101c1f fixing static class properties that are implicit objects. 2010-09-18 22:25:45 -04:00
Jeremy Ashkenas
72847b9b26 tweak to block indentation test. 2010-09-18 13:20:32 -04:00
Jeremy Ashkenas
4b2d40d3b5 Merging in Stephank's fix for #692. 2010-09-18 10:36:48 -04:00
Stéphan Kochen
72d7fe2f7a Function soaks should preserve this. Fixes issue #692. 2010-09-18 12:27:14 +02:00
Jeremy Ashkenas
43f7f6c355 documenting 'invoke' in Cakefiles a little bit. 2010-09-17 20:24:10 -04:00
Jeremy Ashkenas
a53c104db1 simpler default Try CoffeeScript scriptlet. 2010-09-16 00:41:13 -04:00
Jeremy Ashkenas
2a0bd1adc7 silencing another JavaScriptLint extraneous warning. 2010-09-16 00:36:46 -04:00
Jeremy Ashkenas
a2631759c0 CoffeeScript 0.9.3 2010-09-16 00:32:57 -04:00
Jeremy Ashkenas
2b87cabbb4 removing now-unused logic from the IfNode, that used to handle switch statements. 2010-09-15 23:48:20 -04:00
Jeremy Ashkenas
d8465ce767 First draft of real switch statements for CoffeeScript switch statements. 2010-09-15 23:46:01 -04:00
Jeremy Ashkenas
60f80e2698 Fixing the double-implicit-call-into-implicit-object problem. 2010-09-15 22:29:03 -04:00
Jeremy Ashkenas
c782c2ec1c Fix for issue #685. Over-aggressize heredoc cleanup when there is no leading indentation. 2010-09-15 22:08:13 -04:00
Jeremy Ashkenas
f0d778ce49 moving addImplicitBraces and addImplicitParentheses next to each other ... perhaps they should interleave. 2010-09-14 22:57:01 -04:00
Jeremy Ashkenas
a3c224e57a Fixing issue #676, chained accesses against the super() keyword. 2010-09-12 16:33:38 -04:00
Jeremy Ashkenas
b727245834 better error for external super() call. 2010-09-12 16:25:00 -04:00
Jeremy Ashkenas
6b19e61bd0 simplifying previous commit 2010-09-12 16:20:01 -04:00
Jeremy Ashkenas
38ce0cfd9a running cacheindexes on soaks that need them. 2010-09-12 16:18:05 -04:00
Jeremy Ashkenas
61a39e04fc Issue #680. @::prop versus this::prop, fixed lexing regex. 2010-09-12 15:48:31 -04:00
Jeremy Ashkenas
ea3aa6803a using @containsType. 2010-09-12 14:44:03 -04:00
Jeremy Ashkenas
3a20d7dacb Partial fix for 653. 2010-09-12 11:08:05 -04:00
Timothy Jones
e5837b4ee9 Actually caching the splatted constructor this time. 2010-09-12 01:49:25 +12:00
Timothy Jones
d1f31c5143 Ensuring constructors invoked with splats behave correctly, along with caching. 2010-09-12 01:28:22 +12:00
Jeremy Ashkenas
4af41e9bfb Fixing issue #678 -- missing parentheses in a mixed operation(call(soak)) 2010-09-11 08:39:14 -04:00
Jeremy Ashkenas
121110a485 Adding Roast to the Resources. 2010-09-10 15:41:35 -04:00
Jeremy Ashkenas
d41a414b5c Complexifying the indebt test, one more level. 2010-09-08 22:48:28 -04:00
Jeremy Ashkenas
9bd3cca7c4 Introducing the notion of 'indebt' to mirror 'outdebt', but for suppressed indentation with trailing operators etc. Issue #639. 2010-09-08 22:46:13 -04:00
Jeremy Ashkenas
18cbddff6a Fix for Issue #655. Leading empty commas in ArgLists are now disallowed. 2010-09-08 21:39:51 -04:00
Jeremy Ashkenas
df414dab02 Issue #665. Recompile on --watch when file changes size, or mtime changes. 2010-09-08 21:08:17 -04:00
Jeremy Ashkenas
904207ba8f throwing errs from fs.readFile in watch mode. 2010-09-08 20:55:34 -04:00
Jeremy Ashkenas
44618d5765 Adding a test for Issue #669 2010-09-08 20:25:17 -04:00
Jeremy Ashkenas
70cfd54ad4 Issue #670. 'THIS' tokens should trigger an implicit call. 2010-09-08 20:15:16 -04:00
Jeremy Ashkenas
62bf0a2bc9 Merge branch 'master' of git://github.com/StanAngeloff/coffee-script 2010-09-08 09:03:42 -04:00
Jeremy Ashkenas
c9289155b4 Merge branch 'master' of git://github.com/chrislloyd/coffee-script 2010-09-08 09:03:03 -04:00
Chris Lloyd
cd67ec6e69 Bad variable name clobbers correct path in compile event. 2010-09-08 14:51:59 +02:00
Stan Angeloff
cd6261d477 Fixed #669: Wrapper arguments 2010-09-08 15:18:08 +03:00
Jeremy Ashkenas
3b60aad487 simplifying RangeNode grammar a bit. 2010-09-04 06:48:20 -04:00
Jeremy Ashkenas
493780efab separate out browser.coffee from the core coffee-script module. 2010-09-04 06:39:01 -04:00
Jeremy Ashkenas
9290e508c6 fix broken simplenum regex for rangenodes... 2010-09-01 21:20:23 -04:00
Jeremy Ashkenas
a1ebb14495 fixing broken doc link (satyr) 2010-08-31 21:52:15 -04:00
Jeremy Ashkenas
eb9a524ea1 Adding unmatched 'then' to the list of things that closes a single-line implicit call early. Issue #611. 2010-08-30 22:04:13 -04:00
Jeremy Ashkenas
0caa731291 re-enabling the mis-dented call case. Issue #657 2010-08-30 20:59:16 -04:00
Jeremy Ashkenas
704fbf499b Merging in Tesco and rofrankel's soaks for function calls. A soaked check that fails will return undefined. 2010-08-28 09:00:04 -04:00
Jeremy Ashkenas
04fd24e068 Treat 'debugger' as a pure-statement keyword, not and identifier. 2010-08-28 08:26:47 -04:00
Richard Frankel
dc6a83c030 built Tesco's fix for function soaks 2010-08-25 18:59:21 -04:00
Richard Frankel
bcecbd051b added some tests for function soak 2010-08-25 18:54:42 -04:00
Timothy Jones
6607224493 Wrapping existence tests on functions. 2010-08-26 09:03:10 +12:00
Timothy Jones
6224edd6ce Existence checks on functions now supported. 2010-08-26 07:39:30 +12:00
Timothy Jones
9598b11c77 Existence functions now parsing. 2010-08-26 06:31:56 +12:00
Jeremy Ashkenas
fa95f743f3 Fixing Issue #643. Be a little bit safer about declaring block variables as close to the block scope as possible. 2010-08-24 22:19:53 -04:00
Jeremy Ashkenas
e2c46d14f0 CoffeeScript 0.9.2 2010-08-23 22:08:33 -04:00
Jeremy Ashkenas
bd3471b3d1 Issue #641. Rename __superClass__ to __super__ 2010-08-23 21:19:43 -04:00
Jeremy Ashkenas
1b88d18d61 more tweaks and futzes to block comments. 2010-08-23 21:00:47 -04:00
Jeremy Ashkenas
b4de17d504 more tweaks to the herecomment regex. 2010-08-23 20:33:18 -04:00
Jeremy Ashkenas
f90fac0e55 Issue #572. Flexible JavaScript block comments, compatible with JSDoc, YUI-compressor, and Google Closure compiler preservation syntax. 2010-08-23 20:27:34 -04:00
Jeremy Ashkenas
9fd92bf884 updating package.json for newer NPM. 2010-08-23 11:39:06 -04:00
Jeremy Ashkenas
117204a784 Revert "Issue #619. 'new' operator misbehavior."
This reverts commit e7834de929.
2010-08-21 19:16:02 -04:00
Jeremy Ashkenas
e7834de929 Issue #619. 'new' operator misbehavior. 2010-08-21 18:54:24 -04:00
Jeremy Ashkenas
d5d5de55ae Fixing the longstanding and important Issue #637. I'm glad this one got got. 2010-08-21 12:13:43 -04:00
Jeremy Ashkenas
143c4d5efc Issue #572. Block comments now compile to // for aesthetic reasons. 2010-08-21 09:30:25 -04:00
Jeremy Ashkenas
13adc44867 Issue #633. 'not instanceof' 2010-08-21 08:56:25 -04:00
Jeremy Ashkenas
87693d84cb Updating Underscore to 1.1.0, fixing a hasOwnProperty glitch in Scope, and a double-semicolon bug in ParentheticalNode. 2010-08-21 08:30:22 -04:00
Jeremy Ashkenas
6ed33fcc6d Updating contributors in README. 2010-08-20 17:53:45 -04:00
Jeremy Ashkenas
2e59cc4807 Using unbounded ranges in a couple spots in the compiler. 2010-08-18 22:08:09 -04:00
Jeremy Ashkenas
4ddd65a4c4 Issue #621. Added the ability to leave the start and end index off of arrays. list[5..] is now valid CoffeeScript, slicing to the end of the array. 2010-08-18 21:51:44 -04:00
Jeremy Ashkenas
bf6bafa3ac Disallowing Splats outside of ParamLists and ArgLists ... where they belong. This is in anticipation of the next commit... 2010-08-18 21:27:10 -04:00
Jeremy Ashkenas
24f1174b16 Adding a test for issue #631. 2010-08-18 20:42:23 -04:00
Jeremy Ashkenas
098caa9979 Revert "Fixes Issue #618. Close implicit arguments in the middle of param lists."
This reverts commit 474c372b17.
2010-08-18 20:39:55 -04:00
Jeremy Ashkenas
b608d4a5ea Issue #626. Making the isInvertible check a little stricter. 2010-08-17 21:46:00 -04:00
Jeremy Ashkenas
4d32c47bee Merge branch 'remote_script' of http://github.com/satyr/coffee-script 2010-08-17 21:35:00 -04:00
Jeremy Ashkenas
ec54b50c67 allowing empty parens. 2010-08-17 21:31:32 -04:00
satyr
387c690530 removed noWrap (setTimeout evaluates on global) 2010-08-18 10:29:13 +09:00
Jeremy Ashkenas
536e24b024 Merge branch 'remote_script' of http://github.com/satyr/coffee-script 2010-08-17 21:15:41 -04:00
Jeremy Ashkenas
1b05cd81f0 Enabling bound functions as static members of classes... Issue #627 2010-08-17 21:07:36 -04:00
satyr
db181e2a36 enabled remote scripts in browsers 2010-08-18 09:35:52 +09:00
Jeremy Ashkenas
f41ca2e5e8 a touch of safety from trailing catches falling off the end of the rewriter. 2010-08-17 20:04:34 -04:00
Jeremy Ashkenas
a8c6a641d7 stop supressing left-hand whitespace in newline'd strings. Make 'em more literal. 2010-08-16 22:02:37 -04:00
Jeremy Ashkenas
474c372b17 Fixes Issue #618. Close implicit arguments in the middle of param lists. 2010-08-16 21:19:34 -04:00
Jeremy Ashkenas
5b9b45814f Fixing Issue #622 with a light refactor to start using a 'tags' property on all nodes. 2010-08-16 20:18:42 -04:00
Stan Angeloff
01cd5476a0 '-r' should work with $NODE_PATH as well (where previously it was an absolute/relative path) 2010-08-16 17:36:55 +03:00
Jeremy Ashkenas
027b9e9dc3 simplifying generated output for unless/is to (a isnt b) instead of not (a is b). Ticket #617 2010-08-15 15:13:33 -04:00
Jeremy Ashkenas
197f576cab Merged in Stan's patch that allows -r scripts to modify input and output. 2010-08-15 08:32:09 -04:00
Jeremy Ashkenas
0b8facc66f Merge branch 'master' of git://github.com/StanAngeloff/coffee-script 2010-08-15 08:20:50 -04:00
Jeremy Ashkenas
7a0d95c612 Issue #575. Allowing implicit objects to force implicit calls. 2010-08-14 19:56:00 -04:00
Jeremy Ashkenas
975b82f09b Issue #609. Slightly faster implementation of ||= and &&= 2010-08-14 18:02:07 -04:00
Jeremy Ashkenas
f496cc229b Further reducing amount of redundant parentheses. 2010-08-14 17:52:37 -04:00
Jeremy Ashkenas
9894eeb8e9 Improving double-parentheses suppression. Issue #587 2010-08-14 17:43:58 -04:00
Jeremy Ashkenas
129e950c59 Fixing naked chained existential checks -- the associativity recently got reversed. 2010-08-14 16:33:20 -04:00
Jeremy Ashkenas
c90a75ebc5 Fixing first part of #614 -- improperly cached existential operator, when first operand is a function call. 2010-08-14 16:24:05 -04:00
Jeremy Ashkenas
1d6eca76f8 disabling javascriptlint's 'test for equality mistyped as assignment', because it's not relevant to coffeescript. 2010-08-14 16:05:14 -04:00
Jeremy Ashkenas
6555d86328 Adding a jsl.conf configuration file for JavaScript lint, and switching to == null for soaks, accordingly. 2010-08-14 16:02:01 -04:00
Jeremy Ashkenas
c71f2794eb Fixing compound assignment as a right-hand sub expression of a larger operation. Invalid in JS, valid in Coffee. 2010-08-14 14:43:25 -04:00
Jeremy Ashkenas
ca18f1fad6 Core Compiler is JSLint-free again, after removing a couple extra semicolons that snuck in when if statements compiled at the top level. 2010-08-14 11:42:19 -04:00
Jeremy Ashkenas
ead9b1041c tweaking existential compilation. 2010-08-14 11:29:10 -04:00
Jeremy Ashkenas
1eebbfe2bc allowing more flexible whitespace-started regexes. You have to wrap 'em in parens or assign to 'em, but it's better than nothing. 2010-08-12 20:24:53 -04:00
Stan Angeloff
d30c8b321c Allow required files to change the input and output of compiled files. 2010-08-13 01:28:38 +03:00
Jeremy Ashkenas
083500fc0e fixing string interpolation docco. 2010-08-12 00:00:28 -04:00
Jeremy Ashkenas
fd6e9a1e66 Adding support for compound assignment to indented implicit objects. 2010-08-11 23:14:50 -04:00
Jeremy Ashkenas
8c45aa480b Reduced the time it takes to build the grammar from 80 seconds to 15, by consolidating Operation terminals by precedence level. 2010-08-11 23:04:33 -04:00
Jeremy Ashkenas
d704afa0e9 Fixes Issue #574 ... number keys in implicit object literals. 2010-08-11 21:49:18 -04:00
Jeremy Ashkenas
2ec857ef8d Fixing implicit object literals with leading string keys. 2010-08-11 21:41:29 -04:00
Jeremy Ashkenas
ba02ebc3dc Fixes Issue #603 -- a longstanding precedence issue involving prefix vs postfix if and unless, involving using the entire single-line if statment as an expression. 2010-08-11 21:28:22 -04:00
Jeremy Ashkenas
ac752a46bc removing bound functions from the Rewriter. 2010-08-11 21:07:47 -04:00
Jeremy Ashkenas
398ec3be5a Issue #602. Adding JS's Bitwise Assignment operators. 2010-08-11 19:24:59 -04:00
Jeremy Ashkenas
6c997978bc CoffeeScript 0.9.1 is on the books. 2010-08-11 00:40:15 -04:00
Jeremy Ashkenas
642e7fada5 adding other implicit indentation/call/object test. 2010-08-11 00:27:01 -04:00
Jeremy Ashkenas
12493779b9 fixing Issue #545 ... whitespace-only heredocs. 2010-08-11 00:02:49 -04:00
Jeremy Ashkenas
7142131f3d adding herecomment in class definition test. 2010-08-10 23:06:06 -04:00
Jeremy Ashkenas
5bdf78d5ec Fixes Issue #573. Herecomments inside of class literals. 2010-08-10 23:02:24 -04:00
Jeremy Ashkenas
60a4138d50 refactor to simplify scanTokens method in Rewriter. 2010-08-10 22:56:21 -04:00
Jeremy Ashkenas
cb52be6475 adding a top-level object literal test for Issue #542 2010-08-10 22:18:15 -04:00
Jeremy Ashkenas
c2ec40e6ce Fixes Issue #542. Ensure that top-level objects are parenthesized. It's not valid code, but we might as well not SyntaxError out. 2010-08-10 22:16:51 -04:00
Jeremy Ashkenas
87fd05afb0 New implementation of Rewriter#addImplicitIndentation, using Rewriter#detectEnd 2010-08-10 22:05:01 -04:00
Jeremy Ashkenas
45b5bae7d7 New implementation of Rewriter#addImplicitParentheses, using Rewriter#detectEnd 2010-08-10 21:46:46 -04:00
Jeremy Ashkenas
d0b918e083 New implementation of Rewriter#addImplicitBraces -- uses detectEnd.. 2010-08-10 21:13:30 -04:00
Jeremy Ashkenas
0231f8da1b adding options argument to cake documentation. 2010-08-09 09:20:35 -04:00
Jeremy Ashkenas
3eda5a2e85 prefer the include() helper to 'in', except for array literals. 2010-08-08 17:41:10 -04:00
Jeremy Ashkenas
18d6fd72de First step of the general rewriter refactor. Added a generic 'detectEnd' function which is expression-pair sensitive. Use it to reimplement closeOpenCallsAndIndexes 2010-08-08 17:37:28 -04:00
Jeremy Ashkenas
d286b33601 Fixing closures-generated-within-comprehensions to preserve block local scope for range comprehensions 2010-08-08 10:52:59 -04:00
Jeremy Ashkenas
a749d43897 Use fs.realpathSync instead of something hacky. 2010-08-08 10:05:44 -04:00
Jeremy Ashkenas
08506f160d Adding CoffeeScript as a globally-available object, when invoked from the coffee command-line, only. 2010-08-08 09:54:45 -04:00
Jeremy Ashkenas
b902377304 Fixing Issue #589. Compound assignment to an operation should have lower precedence. 2010-08-08 00:07:00 -04:00
Jeremy Ashkenas
1c903450c8 Merging in Stan's patch for a --require flag that allows you to hook into CoffeeScript compiler events for on 'compile', 'success', and 'failure' ... a better way to extend the language or do growlnotify stuff. Issue #590 2010-08-07 23:33:35 -04:00
Jeremy Ashkenas
f950e282a6 Merge branch 'hooks' of git://github.com/StanAngeloff/coffee-script 2010-08-07 22:52:08 -04:00
Jeremy Ashkenas
4da982b253 Merge branch 'master' of http://github.com/brodyberg/coffee-script 2010-08-07 22:49:08 -04:00
Stan Angeloff
b1b78dca47 Add command-line compiler hooks. To invoke, pass a file after -r and listen for any of these events: 'compile', 'success' and 'exception'. Example:
coffee -e -r ./snarl 'Hello!'

Contents of 'snarl.coffee' in the working directory:

    http = require 'http'
    CoffeeScript.on 'exception', (err) ->
      client  = http.createClient 9889, 'localhost'
      request = client.request 'GET', '/?d={"action":1,"applicationName":"CoffeeScript","title":' + JSON.stringify(err.message) + ',"description":' + JSON.stringify(err.stack) + ',"priority":3}'
      request.end()
      err.handled = yes

To examine arguments available for each event (for debugging and getting started), use `puts JSON.stringify arguments`.

See http://nodejs.org/api.html#modules-309 and NODE_PATH for more details on how -r looks for files.
2010-08-07 20:24:37 +03:00
Jeremy Ashkenas
0ada5a7734 Issue #587 ... Removing the Attempted Removal of Erroneous Double Parens. 2010-08-07 08:13:36 -04:00
Jeremy Ashkenas
cc10641f38 Forbidding #interp-style interpolation ... Issue #581 2010-08-07 08:07:44 -04:00
Jeremy Ashkenas
9df3e6a538 first step towards requiring #{ ... } interpolation -- removing naked interps from the compiler. 2010-08-07 08:02:16 -04:00
Brody Berg
133aa7be4a Fix typo 2010-08-04 23:23:46 -07:00
Brody Berg
6555659e82 Fix typo 2010-08-04 22:53:45 -07:00
Jeremy Ashkenas
b1f7d5e33b compile empty coffee files to js anyway. 2010-08-04 23:42:46 -04:00
Jeremy Ashkenas
17bf3b7115 be more flexible about trailing commas in implicit object literals. 2010-08-04 23:25:30 -04:00
Jeremy Ashkenas
ff9af83358 CoffeeScript 0.9.0 2010-08-04 23:14:34 -04:00
Jeremy Ashkenas
5f2326e911 fixing Issue #569. Compiling empty source files to disk with --no-wrap on. 2010-08-04 21:36:03 -04:00
Brody Berg
4d2dd337f6 Fix typo 2010-08-03 22:59:17 -07:00
Jeremy Ashkenas
f43c79c101 more additions to the documentation for 0.9.0 2010-08-03 01:13:31 -04:00
Jeremy Ashkenas
b42045f3f7 regenerating large swathes of the docs 2010-08-03 00:06:34 -04:00
Jeremy Ashkenas
3301738b84 git-go 2010-07-31 07:44:49 -04:00
Jeremy Ashkenas
d4ac11cd4f fixing up compout assignment for ?=, which was using a sligtly different path. 2010-07-31 00:42:57 -04:00
Jeremy Ashkenas
8b953bbde6 Fixing Issue #509. Double-evaluation for function calls within IndexNodes as the left-hand-assignment part of a compound-assignment operation. 2010-07-30 23:37:13 -04:00
Jeremy Ashkenas
acd69b1c70 Fixing issue #544. Needed to special case implicit-object-closing for outdents -- it's different than a single-line implicit object with a terminator. 2010-07-30 22:50:35 -04:00
Jeremy Ashkenas
f3caa9292f Fixing Issue #552, Indentation bug with chained calls with nested object literals... 2010-07-30 22:06:22 -04:00
Jeremy Ashkenas
071b527b66 Issue #559, renaming {source} option to {fileName}, on CoffeeScript.compile 2010-07-30 20:37:12 -04:00
Jeremy Ashkenas
ebad1ec552 using double-quotes for auto-quoted object keys and hash accesses. JSON-style. Issue #556 2010-07-30 20:29:05 -04:00
Jeremy Ashkenas
af451bc530 tiny thing. 2010-07-29 21:59:12 -04:00
Jeremy Ashkenas
d1b17df38c better output when trying to force a pure statment to become a return 2010-07-29 21:33:35 -04:00
Jeremy Ashkenas
b18d7fb550 removing the last traces of half-assignments. Issue #541. 2010-07-29 21:23:49 -04:00
Jeremy Ashkenas
980a663c19 ported and regenerated examples. 2010-07-29 00:51:35 -04:00
Jeremy Ashkenas
65c107fc5d finished porting over the examples. 2010-07-29 00:17:48 -04:00
Jeremy Ashkenas
da6ea27454 most of the examples converted to symbology. 2010-07-29 00:03:42 -04:00
Jeremy Ashkenas
58a5d93214 adding a test for Issue #550. 2010-07-28 20:43:39 -04:00
Jeremy Ashkenas
5b848fbc47 Merge branch 'master' of git://github.com/Tesco/coffee-script 2010-07-28 20:39:25 -04:00
Jeremy Ashkenas
8522a11bcb getting the whole codebase passing jslint again. 2010-07-28 20:38:16 -04:00
Timothy Jones
d944f81163 Prevented parameter contents from causing unexpected returns in the body. 2010-07-29 12:35:59 +12:00
Jeremy Ashkenas
c67e7fbcea moving nodes.coffee over to use Tesco's new auto-setter style. 2010-07-28 19:34:02 -04:00
Jeremy Ashkenas
a80d8d55c4 merging tesco's branch for issue #535 2010-07-28 07:34:28 -04:00
Timothy Jones
9026069f79 Support for @-prefixed splats. 2010-07-28 18:17:50 +12:00
Timothy Jones
c9421cbfcd Implement @-prefixed parameters. 2010-07-28 17:54:36 +12:00
Jeremy Ashkenas
5399b989c0 Removing now unnecessary braces from the grammar. Still compiles to identical JS. 2010-07-28 00:35:57 -04:00
Jeremy Ashkenas
9d1fd38b69 removing extraneous tempvar declarations from range generation by re-ordering... 2010-07-27 23:39:28 -04:00
Jeremy Ashkenas
a4156b71fa fixing broken range literal expansions. 2010-07-27 23:06:11 -04:00
Jeremy Ashkenas
fa4871574a one more range literal expansion test 2010-07-27 23:02:26 -04:00
Jeremy Ashkenas
a59df2cf74 merged in evilpie's fix for faster small range comprehensions 2010-07-27 23:00:26 -04:00
Jeremy Ashkenas
051a863ff5 adding slightly optimized syntax for range comprehensions that could care less about the index variable. Issue #547 2010-07-27 22:38:38 -04:00
Jeremy Ashkenas
8d544ce80b Adding anonymous class support (gets a temporary variable for a name.) Issue #548 2010-07-27 22:05:55 -04:00
Jeremy Ashkenas
cc7b0f2e8f Allowing classes to be better decorated with implicit calls. Issue #548 2010-07-27 07:03:44 -04:00
Jeremy Ashkenas
b4ef4a9e28 make the compiler use 'obj = or default' for default values. 2010-07-26 23:58:06 -04:00
Jeremy Ashkenas
9be1453886 bringing back half assignments, but just for 'a = or b' and 'a = and b' 2010-07-26 23:53:03 -04:00
Jeremy Ashkenas
89cd25ab15 finished moving over string and regex interpolation to use '#' instead of '$', Issue #544 2010-07-26 23:31:55 -04:00
Jeremy Ashkenas
d624310be1 waypoint commit with both # and $ performing interpolation. Issue #544 2010-07-26 23:08:09 -04:00
Jeremy Ashkenas
9c8a22832c merging in symbology 2010-07-26 22:08:09 -04:00
Jeremy Ashkenas
55a0e1d2ff making inline implicit objects more flexible ... can be used with trailing blocks. 2010-07-26 21:39:43 -04:00
Jeremy Ashkenas
e638de5c7c a couple more implicit objects in the source. 2010-07-26 20:54:07 -04:00
Jeremy Ashkenas
0aa36899a8 fixing test for {} + {} 2010-07-26 07:40:18 -04:00
Jeremy Ashkenas
ac2f814eb4 fixing issue 542. Parse error with leading object literal as part of operation. 2010-07-25 20:59:28 -07:00
Jeremy Ashkenas
27e5c42023 fixing some implicit object parses for issue #541 2010-07-25 17:46:08 -07:00
Jeremy Ashkenas
6b0418a74a merging master changes into symbology 2010-07-25 00:15:12 -07:00
Jeremy Ashkenas
a0b2b78962 adding nice support for fancy implicit hashes 2010-07-24 23:52:02 -07:00
Jeremy Ashkenas
d1ffffab04 Using an experimental version of new optional-brace object literals. 2010-07-24 23:42:37 -07:00
Jeremy Ashkenas
f9dff6ffc4 added and= and or= to the language. 2010-07-24 22:36:50 -07:00
Jeremy Ashkenas
88847df70b tests are now passing on symbology 2010-07-24 22:23:37 -07:00
Jeremy Ashkenas
492ee57b8f finished basic port to equality of the compiler 2010-07-24 21:36:21 -07:00
Jeremy Ashkenas
5c85bf22bb converted nodes.coffee. a big step 2010-07-24 18:21:25 -07:00
Tom
527af3b69f simplfy generated code for static ranges 2010-07-25 00:49:15 +02:00
Jeremy Ashkenas
6b6beb588c optimizing the output of compiled splat arguments. 2010-07-24 12:40:36 -07:00
Jeremy Ashkenas
dc1288d319 slightly optimizing return values of AssignNodes. Issue #539 2010-07-24 12:27:11 -07:00
Jeremy Ashkenas
87226b6f44 fixing bound functions with an __bind helper. 2010-07-24 12:12:26 -07:00
Jeremy Ashkenas
3b6f020f8a Making the spacing of symbols on function declaration consistent. No-space when single-line. Spaced when block. (StanAngeloff) 2010-07-24 08:31:43 -07:00
Jeremy Ashkenas
93d77e2354 _this to __this, for consistency. (StanAngeloff) 2010-07-24 08:11:42 -07:00
Jeremy Ashkenas
85ed376748 adding correct semicolons to bound functions 2010-07-24 00:45:00 -07:00
Jeremy Ashkenas
bfc7704ca1 first bit of equals for symbology ... barely started on lexer.coffee 2010-07-24 00:31:04 -07:00
Jeremy Ashkenas
e41abe2d83 Changing implementation of bound functions to mirror sethaurus' suggestion for cleaner output. Issue #530. Tests pass. 2010-07-23 22:34:56 -07:00
Jeremy Ashkenas
de9fb7777b fixing If/else-to-ternary with instanceof as an unparenthesized condition. JS operator precedence. 2010-07-23 20:44:56 -07:00
Jeremy Ashkenas
24a5adc898 updating package.json to work better with NPM. Issue #522 2010-07-23 11:06:17 -07:00
Jeremy Ashkenas
0a3f6c49f8 updating documentation with correct variable names. 2010-07-23 09:34:54 -07:00
Jeremy Ashkenas
8262070f5c fixing extra spaces in nested empty functions. Issue #527 2010-07-22 14:08:07 -07:00
Jeremy Ashkenas
9c4164e7a3 removing unnecessary parens from the setup part of a range comprehension. Issue #528 2010-07-22 10:37:13 -07:00
Jeremy Ashkenas
1dab47176b switching interpolateString's method signature to take on options hash. 2010-07-22 09:38:26 -07:00
Jeremy Ashkenas
dfa50c90b3 Fixes Issue #525 -- String interpolation bug due to conflict with Heredoc interpolation. 2010-07-21 15:45:25 -07:00
Jeremy Ashkenas
ff88482034 fixing regex-interpolation-sans-flags issue. 2010-07-21 10:32:36 -07:00
Jeremy Ashkenas
7e225688cb making the 'cake loc' task reflect the lines of code in the compiler only. 2010-07-21 07:26:44 -07:00
Sam Stephenson
5678bf10fd class B extends A calls A.extended(B) 2010-07-18 14:22:26 -05:00
Jeremy Ashkenas
989d539af3 adding no-argument super calls. 2010-07-18 14:46:21 -04:00
Jeremy Ashkenas
d017a8f9f7 Moving from '.addListener' to '.on' for Node v0.1.101 2010-07-18 07:54:44 -04:00
Jeremy Ashkenas
5a34f53689 enhancements to range comprehensions, back to being safe -- and usable downwards without a 'by' clause, and optimized when working with integer literals. 2010-07-17 18:45:29 -04:00
Jeremy Ashkenas
96f076983e Reserving __hasProp and friends, for safety's sake. 2010-07-17 17:30:10 -04:00
Jeremy Ashkenas
a322b3ad68 renamed #strings sectiong to #heredocs 2010-07-17 10:33:32 -04:00
Jeremy Ashkenas
9814fc2e1c Updating documentation with endtime's suggestions. 2010-07-17 10:28:06 -04:00
Jeremy Ashkenas
ec2d358ae3 updating docco to better reflect lack of explicit ternaries. Issue #510 2010-07-16 22:44:07 -04:00
Jeremy Ashkenas
6c8eab7af5 michaelficarra's suggestion to make object comprehensions' hasOwnProperty check a continue, instead of a wrapped if. 2010-07-16 22:31:36 -04:00
Jeremy Ashkenas
b810d10e80 Fixing Issue #506. existential chains should force parentheses in the presense of a compiled ternary operator. 2010-07-15 21:38:35 -04:00
Jeremy Ashkenas
72c4efbc39 adding a new comprehension 'for all key, value of object', which compiles to the naked JS for..in, including enumerable properties inherited from prototypes. 2010-07-15 21:18:35 -04:00
Jeremy Ashkenas
2a932597e4 fixing existential chains directly against a 'new Func()' call. Issue #503 2010-07-15 09:08:51 -04:00
Jeremy Ashkenas
4eed514e37 Fixing (at least partially) Issue #502. Trailing block comment parse. 2010-07-15 08:50:49 -04:00
Jeremy Ashkenas
0337dc23c3 Fix for Issue number 501 ... 2010-07-14 09:40:07 -04:00
Jeremy Ashkenas
2b3b03c3c6 adding 0.7.2 changelog to the docco, as per request. 2010-07-13 23:39:58 -04:00
Jeremy Ashkenas
6a059bfab7 fixing issue #497 try/catch/finally all empty. 2010-07-13 23:33:59 -04:00
Jeremy Ashkenas
0b87387fab slightly nicer implementation of SplatNode.compileSplattedArray 2010-07-13 22:16:19 -04:00
Jeremy Ashkenas
8c34aff1c5 Fixing issue #495 ... options wasn't being passed down in ArrayNode#compileSplatLiteral 2010-07-13 21:51:27 -04:00
Jeremy Ashkenas
cc827b139d Turning --compile on when --output is set, because it's probably what was intended. 2010-07-13 21:04:32 -04:00
Jeremy Ashkenas
c6e1a96882 adding an instanceof test for constructors-called-with-splats 2010-07-13 08:57:42 -04:00
Jeremy Ashkenas
c3410e722e (cosmetic) removing occasional extra linebreaks in JS generated from class definitions. 2010-07-12 22:51:10 -04:00
Jeremy Ashkenas
534e2a25de enabling a variable number of arguments to be passed to constructor functions. 2010-07-12 22:42:21 -04:00
Jeremy Ashkenas
d2c820b5d7 removing sudo from the npm install script. 2010-07-12 21:50:29 -04:00
Jeremy Ashkenas
ff7e729b84 bumping version to 0.7.2 for --options patch. 2010-07-12 08:17:26 -04:00
Jeremy Ashkenas
a21606e348 toFixed() seems to be non-portable. Trying a different number test. 2010-07-11 20:39:54 -04:00
Jeremy Ashkenas
4bd657160d fixing bug in option parsing with flagged arguments and cake. 2010-07-11 17:55:22 -04:00
Jeremy Ashkenas
be8d812919 removing an errant mention of named functions. 2010-07-11 10:44:33 -04:00
Jeremy Ashkenas
e40d25e4bd rebuilding docs and compressed version for CoffeeScript 0.7.1 2010-07-11 10:40:44 -04:00
Jeremy Ashkenas
2a7a26482a fixing optparse to behave nicely in the presence of hashbangs -- stop parsing after the first non-option argument, and pass the rest along -- and adding an OptionParser test. 2010-07-11 09:57:42 -04:00
Jeremy Ashkenas
3d6cdfa636 making it possible to pass in command-line arguments to a hash-banged coffee script. Ticket #473 2010-07-10 15:36:54 -04:00
Jeremy Ashkenas
15a2b7d69a Fixing issue number #486 (which is debatable). Allowing an unparenthesized if/else ternary as a trailing parameter to a call. 2010-07-10 14:52:54 -04:00
Jeremy Ashkenas
9ff8433f21 fixing previously-escaped-inner-quotes-in-double-quoted-heredoc-interpolations. Issue #479 2010-07-10 11:54:59 -04:00
Jeremy Ashkenas
1c7d51a2c4 fixing issue #485, unary minus following an existential operator. 2010-07-10 11:27:43 -04:00
Jeremy Ashkenas
49020208f9 better printing for OpNodes with running with --nodes 2010-07-10 11:17:44 -04:00
Jeremy Ashkenas
6f32fe27f8 better formatting for top-level closured-values. 2010-07-10 09:49:01 -04:00
Jeremy Ashkenas
7a16db9ad3 fixing inline-loop object-in-array tests for instance variables. Issue #481 2010-07-10 09:01:22 -04:00
Jeremy Ashkenas
2f8a29b5a0 fixing a comment/block-comment combination lexing regex issue. Ticket #478 2010-07-10 08:44:30 -04:00
Jeremy Ashkenas
64b5ccc524 Fixes issue #477, missing global helpers in REPL. 2010-07-09 01:01:31 -04:00
Jeremy Ashkenas
4fc4edc7a0 adding wavded's gedit-coffeescript to the resources section of the docs 2010-07-08 10:18:18 -04:00
Jeremy Ashkenas
358edfb21f fixing return node squashing the possiblity of a ternary, when there should be one. Issue #475 2010-07-06 23:04:35 -04:00
Jeremy Ashkenas
577daf5457 fixing herecomment/indentation bugaboo ... issue #474 2010-07-06 22:20:42 -04:00
Jeremy Ashkenas
afa3bb4191 added dsc's coffeecup to the resources section. 2010-07-05 08:51:45 -04:00
Jeremy Ashkenas
e81810d845 fixing issue #427 -- incorrect stringification of reserved word 2010-07-04 20:55:21 -04:00
Jeremy Ashkenas
c57ebffe6f fixing Lexer::OPERATOR regex for non-spaced + unary arithmetic. Issue #471 2010-07-04 13:29:22 -04:00
Jeremy Ashkenas
e281133f12 fixing empty catch clauses ... Issue #470 2010-07-04 12:50:04 -04:00
Jeremy Ashkenas
92878558c6 fixing improper formatting in range-to-array expansion. 2010-07-03 17:00:30 -04:00
Jeremy Ashkenas
ec449158c6 fixing improperly-formatted-output of pattern matching within comprehension arguments. 2010-07-03 15:09:21 -04:00
Jeremy Ashkenas
eefa004b8f fixing the block comment test to use defined variables. 2010-07-01 21:51:28 -04:00
Jeremy Ashkenas
77a75ed365 adding passed-through block comments back to the grammar/lexer/rewriter/nodes ... thanks, Trevor Burnham. 2010-07-01 21:26:33 -04:00
Jeremy Ashkenas
364ec2a694 better syntax errors for tokens-not-in-the-grammar. Coming soon to a Jison near you (hopefully) 2010-07-01 20:40:08 -04:00
Jeremy Ashkenas
9a8a707016 throw a syntax error if you try to use the fat arrow to define a class constructor. 2010-06-30 22:03:20 -04:00
Jeremy Ashkenas
7a5f014014 fixing closurenode wrapping of bodies with bound function declarations inside -- this doesn't have to be mentioned explicitly. 2010-06-30 21:54:16 -04:00
Jeremy Ashkenas
5ca5a504a4 allowing empty bodies in try blocks and in catch blocks 2010-06-30 20:53:09 -04:00
Jeremy Ashkenas
cb45c8feac fixing html entity in the changelog 2010-06-30 19:51:49 -04:00
Jeremy Ashkenas
7d79d73b58 allowing paren-less instance creation, a la 'new Class' 2010-06-29 21:03:50 -04:00
Jeremy Ashkenas
7c426db36a fixing range literals (which had gone untested) oops. 2010-06-28 20:26:31 -04:00
Jeremy Ashkenas
744638ed08 adding a one-line exception test. 2010-06-28 08:52:13 -04:00
Jeremy Ashkenas
9bc7cd7904 adding a one-line exception test. 2010-06-28 08:50:44 -04:00
Jeremy Ashkenas
d83bbfb1d5 updating readme with NPM install. 2010-06-28 01:19:04 -04:00
Jeremy Ashkenas
4ad9e82f50 docs for the NPM install 2010-06-28 01:06:53 -04:00
Jeremy Ashkenas
677c7edf3f CoffeeScript 0.7.0 is on the books. 2010-06-28 01:00:53 -04:00
Jeremy Ashkenas
e56af4967c removing our vendor'd copy of Jison ... you should install it from NPM now. 2010-06-28 00:26:45 -04:00
Jeremy Ashkenas
1f7af35368 getting ready for a 0.7.0. cleanups and doc revisions, not quite there yet. 2010-06-28 00:19:58 -04:00
Jeremy Ashkenas
08ab4abd43 removing obvious redundant parentheses. 2010-06-27 23:55:18 -04:00
Jeremy Ashkenas
a810eb29db slightly simpler comment regex. 2010-06-27 22:26:59 -04:00
Jeremy Ashkenas
3881324007 cleaning up the grammar rule for Super 2010-06-27 16:50:31 -04:00
Jeremy Ashkenas
af3b356d70 fixing an improper-js-output bug when using a loop-compiled inarray clause as part of a larger expression 2010-06-27 13:27:51 -04:00
Jeremy Ashkenas
24676eea71 Fixing commented-out if-clauses or empty if-clauses. 2010-06-27 13:19:23 -04:00
Jeremy Ashkenas
7e2eb997a8 adding a test for trailing-comments-preceding-outdents 2010-06-27 13:02:47 -04:00
Jeremy Ashkenas
ec570c46bf Big commit. First draft of stripping comments from generated JS output. Issue #41 2010-06-27 12:59:54 -04:00
Jeremy Ashkenas
8eedfe4bc6 slight simplification of the if-else grammar rules 2010-06-27 11:46:30 -04:00
Jeremy Ashkenas
800fb81d1b Re-ordering lexer rules for fewer regex matches / slightly faster lexing. 2010-06-27 10:58:08 -04:00
Jeremy Ashkenas
e020f5849c adding a test for #454 2010-06-26 17:21:30 -04:00
Jeremy Ashkenas
698784e103 fixing issue #454 single-line function with single-line if/else 2010-06-26 17:20:13 -04:00
Jeremy Ashkenas
f7345ffaac removing extensions from CoffeeScript 2010-06-26 13:36:31 -04:00
Jeremy Ashkenas
b7faa4a7f2 using the new in-tests for the Rewriter. 2010-06-21 23:54:43 -04:00
Jeremy Ashkenas
0fcfb80be4 switching 'a in b' to 'a of b', and adding an array presence check for 'a in b'. 2010-06-21 23:51:12 -04:00
Jeremy Ashkenas
38a9b7166b Adding TrevorBurnham's suggestion for 'a not in b' 2010-06-21 22:25:28 -04:00
Jeremy Ashkenas
3b28f52ff7 adding non-ASCII characters to test_literals.coffee for Node v0.1.99 2010-06-21 20:47:58 -04:00
Jeremy Ashkenas
7725fe338e Merge branch 'npm' of git://github.com/Tim-Smart/coffee-script 2010-06-21 18:57:17 -04:00
Tim-Smart
2ed66f6e8b Update package.json to allow for npm publishing and installation 2010-06-22 10:48:49 +12:00
Jeremy Ashkenas
9aaf789c21 changing a couple repetitions to DRY objects ... doesn't change the compiled output. 2010-06-20 11:19:50 -04:00
Jeremy Ashkenas
d5cf339b83 adding a test for holmsand's patch for Object.prototype-named variables. 2010-06-16 07:24:17 -04:00
Dan Holmsand
6bc7b56e6e Make sure variables named e.g. "constructor" are declared with var 2010-06-16 12:54:53 +02:00
Jeremy Ashkenas
e4db6d47c2 Updated Cakefile from Tim_Smart with colorized, explained 'cake install' 2010-06-15 21:33:53 -04:00
Jeremy Ashkenas
ce4e00e5ae mistaken camelCase 'nodeLibraries' from the great under_score purge ... now fixed. 2010-06-15 20:40:10 -04:00
Jeremy Ashkenas
06ca2ef726 more streamlined code generation for instance-bound methods ... keep the prototype method around, and just bind it in the constructor. 2010-06-15 02:21:01 -04:00
Jeremy Ashkenas
8d853a6d58 adding the ability to have classes with functions pre-bound to the instance, using the fat arrow, and the constructor-function-definition pattern, avoiding prototypes. 2010-06-15 01:28:30 -04:00
Jeremy Ashkenas
de768aefc3 a bit more work on keywords-in-object-literals... 2010-06-15 01:03:14 -04:00
Jeremy Ashkenas
4b284f6687 first draft at ticket #437 ... automatic quoting of reserved words and keywords. 2010-06-15 00:54:02 -04:00
Jeremy Ashkenas
d0948e5586 fixing comprehensions to also close over the index variable, if used in an inner function... 2010-06-13 21:43:04 -04:00
Jeremy Ashkenas
b0a45e5b93 Ticket #423. When functions are generated within comprehensions ... the comprehensions should close over the element instead of sharing it. 2010-06-13 21:21:30 -04:00
Jeremy Ashkenas
6f91331626 slight refactor to IfNode::ensureExpressions 2010-06-13 18:04:09 -04:00
Jeremy Ashkenas
4ecb1bb2ed switching to 'Compiled' messages after the code has finished compiling on --watch ... 2010-06-13 14:21:02 -04:00
Jeremy Ashkenas
3bcca99cba adding another statement/expression/return test. 2010-06-13 01:19:31 -04:00
Jeremy Ashkenas
5612a59b30 allowing implicit returns to be pushed down into each branch of computation, even when there's an explicit return nested more deeply. Issue #401 2010-06-13 01:13:52 -04:00
Jeremy Ashkenas
88ea66b4c9 allowing a regex literal to be the last token in a file ... Lexer bug. 2010-06-13 00:56:42 -04:00
Jeremy Ashkenas
b61399fbde fixing issue #396 ... issue with nested if/elses getting mis-nested. 2010-06-12 19:38:14 -04:00
Jeremy Ashkenas
a8db2bcf10 fixing a mistaken camelCase in the Cakefile 2010-06-12 19:10:10 -04:00
Jeremy Ashkenas
e14f4c5db1 First draft of switching the CoffeeScript Compiler over to camelCase. Pour one on the ground for underscores... 2010-06-12 19:05:13 -04:00
Jeremy Ashkenas
1948b0c7c7 linebreaks in the rewriter ... cosmetic. 2010-06-12 18:09:07 -04:00
Jeremy Ashkenas
4b4b0e630e yet another rewriter-based comment fix, this time for issue #403 2010-06-12 18:06:33 -04:00
Jeremy Ashkenas
d9071a80a0 Unsatisfactory patch that fixes Issue #394 ... comments that prefix spaced out if/else clauses. 2010-06-12 17:41:46 -04:00
Jeremy Ashkenas
969740a263 slight simplification to if/else in the grammar. 2010-06-12 13:53:11 -04:00
Jeremy Ashkenas
0222d90fa3 adding a 'loop' keyword to CoffeeScript. Takes an expression or a block. Runs it until you break or return out. 2010-06-12 12:15:53 -04:00
Jeremy Ashkenas
a133e018cc Making the REPL the default behaviour of 'coffee', when called with no arguments, a-la Node and Python. 2010-06-12 11:09:30 -04:00
Jeremy Ashkenas
c2d1ae06c5 removing the <- bind operator from CoffeeScript... 2010-06-12 11:00:56 -04:00
Jeremy Ashkenas
59e41f195b simpler 'cake loc' task. 2010-06-11 18:53:12 -04:00
Jeremy Ashkenas
7987d4e5ce adding a cake task to check loc 2010-06-11 18:47:48 -04:00
Jeremy Ashkenas
a8e331a778 new improved REPL, using Node's new 'readline' module... 2010-06-11 18:36:18 -04:00
Jeremy Ashkenas
eb97652537 adding a sentence about parentheses wrapping. 2010-06-11 17:28:18 -04:00
Jeremy Ashkenas
0a4fe7ed97 fixing the lexer so that leading commas surpress newlines 2010-06-11 08:29:16 -04:00
Jeremy Ashkenas
676e893c14 reworking parser for more permissive non-comma-separated array elements. 2010-06-09 00:37:23 -04:00
Jeremy Ashkenas
e37056192b Fix for issue #414 -- apostrophes in heredocs. 2010-06-02 19:53:03 -04:00
Jeremy Ashkenas
8321f6bfe3 making block comments require their own lines for delimiters. Issue 379. 2010-06-02 00:03:07 -04:00
Jeremy Ashkenas
b3d1c238eb fixing block comments at the top of function blocks, and in other locations ... Issue #379 2010-06-01 23:56:10 -04:00
Jeremy Ashkenas
61d9bd7e5e making the lexer more sophisticated about incorrect outdents ... a little safer for everyone. 2010-06-01 23:32:46 -04:00
Jeremy Ashkenas
1fbb6e8734 adding copying header to extras/coffee-script.js 2010-06-01 22:09:00 -04:00
Jeremy Ashkenas
59de6b505a ahh, finally. switched up our Jison configuration to provide better syntax errors. Now you get the unexpected token, instead of the expected one. 2010-06-01 20:21:12 -04:00
Jeremy Ashkenas
ea1411cd07 removing call to deprecated sys.p() in the REPL, now it's 'puts inspect value' 2010-06-01 19:24:48 -04:00
Jeremy Ashkenas
c5fd64c72a allowing direct calls against numbers. 2010-05-31 22:56:51 -04:00
Jeremy Ashkenas
45f442bd73 allowing Klass::['dynamic-property'] syntax. Issue #392 2010-05-31 22:32:43 -04:00
Jeremy Ashkenas
b8a4adbdc7 whitespace adjustments 2010-05-31 19:54:28 -04:00
Jeremy Ashkenas
47fdcebb01 one more range comprehension vs range literal test, for thoroughness. 2010-05-31 19:43:30 -04:00
Jeremy Ashkenas
8cdd8de360 adding a negative range comprehension test. 2010-05-31 19:41:02 -04:00
Jeremy Ashkenas
7402aea9f2 cleaner generated code for range comprehensions, but you have to use an explicit step to go downwards. Forked the code path for cleaner range literals as well. 2010-05-31 19:38:45 -04:00
Jeremy Ashkenas
300c711af1 enabling compilation of non-.coffee-extension files passed directly to the coffee command (Issue #391) 2010-05-31 15:36:41 -04:00
Jeremy Ashkenas
39b8bbc39b Moving all of the 'test_issues' tests from 'hiatus' to their proper locations... 2010-05-31 15:13:48 -04:00
Jeremy Ashkenas
90f96af720 Simpler stab at a fix for issue #397. Allow CoffeeScript-only keywords to be used as accessors, or in assignment. 2010-05-31 14:42:30 -04:00
Jeremy Ashkenas
710b2b5fdc moving issue #381 test to the proper spot. 2010-05-31 14:03:07 -04:00
Jeremy Ashkenas
a577b81eb3 reworking fix for Issue #383 with a more sensitive regex. (decimals without a leading zero) 2010-05-31 13:40:03 -04:00
Jeremy Ashkenas
a5478b0712 refactoring name_access_type into tag_accessor 2010-05-31 13:25:06 -04:00
Jeremy Ashkenas
12587d8295 reworking Stan's nodes.coffee type/children work a bit for issue 386 2010-05-31 10:36:50 -04:00
Stan Angeloff
e17bb4ff11 FIXES #397: Can't use @variable in switch in instance method 2010-05-26 21:58:11 +03:00
Stan Angeloff
aba19841ee FIXES #390: super() calls in constructor of classes that are defined as object properties 2010-05-25 09:15:46 +03:00
Stan Angeloff
0288dba46c Whoops, forgot the extra condition before we perform the rewrite 2010-05-23 12:52:49 +03:00
Stan Angeloff
5a306785ba Tests to ensure reserver words and operators can be used as object keys 2010-05-23 12:44:40 +03:00
Stan Angeloff
c200b95f6a Allowing operators as object keys 2010-05-23 12:42:15 +03:00
Stan Angeloff
2cccd621ea First steps in allowing reserved words as object keys 2010-05-23 12:21:31 +03:00
Stan Angeloff
385b18f588 FIXES #383: Numbers that start with . not recognized 2010-05-20 00:20:33 +03:00
Stan Angeloff
bf1f9f4b95 FIXES #380: problem with @ and instanceof 2010-05-19 23:51:53 +03:00
Stan Angeloff
4c3271728d OOP love for nodes.coffee 2010-05-19 23:24:55 +03:00
Stan Angeloff
57231ae75d Merging type, children and statement functions 2010-05-19 22:53:05 +03:00
Stan Angeloff
97c2a70593 Baby steps fixing #386 2010-05-19 22:37:42 +03:00
Jeremy Ashkenas
485346f0e5 CoffeeScript 0.6.2 2010-05-15 01:18:05 -04:00
Jeremy Ashkenas
a8d4c3a567 sprinkling toString() throughout, for Node.js 0.1.95 compatibility. 2010-05-15 00:34:14 -04:00
Jeremy Ashkenas
dfb3a13246 Fixed lingering CoffeeScript Compiler running live in Internet Explorer bugs. Implemented helpers.index_of and removed named functions. Ticket #366 2010-05-14 23:40:04 -04:00
Jeremy Ashkenas
f84eb9ed47 fixing heredoc indentation from herecomment tweaks 2010-05-14 21:50:17 -04:00
Jeremy Ashkenas
8136c5f3de making regexes stricter about their flags. 2010-05-14 09:14:41 -04:00
Jeremy Ashkenas
45669e08c6 better indentation handling for far-left heredocs and herecomments 2010-05-12 21:49:46 -04:00
Jeremy Ashkenas
a5db69e1af better indentation handling for far-left heredocs and herecomments 2010-05-12 21:47:31 -04:00
Jeremy Ashkenas
8aceef20e1 Adding initial implementation of here-comments (block comments) Issue #368 2010-05-12 20:56:44 -04:00
Jeremy Ashkenas
7e3c71ed19 Allowing more flexible linebreaks/indentation within object literals. 2010-05-12 18:28:40 -04:00
Jeremy Ashkenas
9d09bee6fb better test for sans-condition switch... 2010-05-11 09:32:16 -04:00
Jeremy Ashkenas
cd6ee373ff enabling condition-less switches. 2010-05-10 22:57:51 -04:00
Jeremy Ashkenas
4d0acc9b02 fixing andreyvit's issue with parentheses not being applied to multi-operators as the condition clause of a switch... 2010-05-10 22:50:11 -04:00
Jeremy Ashkenas
393fbf1b66 merging in gfxmonk's cleanup to how children of nodes are determined. Removing some (so far) unused portions. 2010-05-10 22:41:18 -04:00
gfxmonk
3324b03a5d Merge remote branch 'upstream/master'
Conflicts:
	src/nodes.coffee
2010-05-10 21:09:00 +10:00
gfxmonk
eb91f9922d determine @children dynamically based on attribute names, instead of manual bookkeeping 2010-05-10 20:58:01 +10:00
Jeremy Ashkenas
9a7420ccd0 adding support for calling variadic functions with less than the requested number of arguments. 2010-05-08 12:44:54 -04:00
Jeremy Ashkenas
be72120311 further minor cleanup to varargs 2010-05-08 12:20:14 -04:00
Jeremy Ashkenas
c452c3a101 minor cleanup to varargs 2010-05-08 12:15:47 -04:00
Tim Jones
0b3bb66708 Added safe soaking on non-existent variables. 2010-05-05 21:58:48 +12:00
Jeremy Ashkenas
d0d0fa4d10 disallowing regex literals as implicit calls immediatly after ']', a rare case, I hope. Ticket #358 2010-05-04 23:50:22 -04:00
Jeremy Ashkenas
6222ed622f forcing spaces for implicit calls ... making '@ name' a call instead of an access. Ticket #353 2010-05-04 23:44:54 -04:00
Jeremy Ashkenas
1a03e98057 making 'while' and 'until' have the same associativity and precedence as 'for', #356 2010-05-04 23:37:03 -04:00
Jeremy Ashkenas
46cea93fc3 recompiling annotated documentation 2010-05-04 23:31:28 -04:00
Jeremy Ashkenas
d64b8fd9d8 merged in Trevor Burnham's recursive coffee compilation, with some adjustments... 2010-05-04 23:22:28 -04:00
Jeremy Ashkenas
c051daee2f Merge commit 'TrevorBurnham/master' 2010-05-04 23:01:15 -04:00
Tim Jones
ae70d10996 Removing obsolete delete calls. 2010-05-03 21:17:30 -04:00
Tim Jones
52e6399e02 Added missing or to IndexNode. 2010-05-03 21:17:23 -04:00
Tim Jones
ac05f62f2f Wrapping all soaked chains that are involved in operations. 2010-05-03 21:17:16 -04:00
Tim Jones
4d935efd09 Stop anonymous supers. 2010-05-03 21:16:50 -04:00
Trevor Burnham
fa8cc7976a Added recursive compilation and monitoring option to coffee command 2010-05-03 17:38:59 -04:00
Jeremy Ashkenas
ee4e34bf6d relative requires... 2010-05-01 11:00:43 -04:00
gfxmonk
c8e0f8b149 Cleaned up IfNodes
- renamed rewrite_condition() to switches_over(),
   and @switcher to @switch_subject
 - removed unused else_body constructor parameter, as well
   as unnecessary push() method
 - ensure both @body and @else_body are always Expressions
   (previously they could be either Expressions or IfNode)
2010-05-02 00:39:34 +10:00
gfxmonk
b47188763c add require statements to tests that depend on coffee-script modules 2010-05-02 00:27:50 +10:00
Jeremy Ashkenas
5e5c9df5c4 removing holmsand's cleanup 2010-05-01 08:40:02 -04:00
Jeremy Ashkenas
1a97f599dd added a test for the multiple-functions-passed-sans-parens 2010-04-30 23:20:22 -04:00
Tim Jones
3b264c9572 Added a small part to the rewriter to allow a better two-function call. 2010-05-01 14:04:57 +12:00
Dan Holmsand
144c096ae6 Remove unused variable index_var from for loops 2010-04-30 09:48:30 +02:00
Jeremy Ashkenas
adbcd320b2 adding until loops as the inverse of while loops 2010-04-28 22:08:00 -04:00
Jeremy Ashkenas
17ba44056e changing 'filter' to 'guard' to get around Express' clobbering of Object.prototype. 2010-04-28 21:46:47 -04:00
Jeremy Ashkenas
502abade7c rewriting the compiler using 'unless' blocks where appropriate. 2010-04-27 19:38:24 -04:00
Jeremy Ashkenas
b746c9018e adding 'unless' blocks 2010-04-27 19:35:15 -04:00
Jeremy Ashkenas
92af641827 no newline on no_such_task for Cake 2010-04-27 07:59:19 -04:00
Jeremy Ashkenas
b5606a247d adding pattern matching for comprehensions. 2010-04-26 23:46:35 -04:00
Jeremy Ashkenas
d62baf5a5d Merge branch 'for_destructuring' of git://github.com/StanAngeloff/coffee-script 2010-04-26 23:34:07 -04:00
Jeremy Ashkenas
e17567866a Merge branch 'master' of git://github.com/Tesco/coffee-script 2010-04-26 23:31:18 -04:00
Stan Angeloff
76f9596f22 Cleaning up. 2010-04-26 21:54:31 +03:00
Stan Angeloff
2a3a713811 Allowing pattern matching within for..loops 2010-04-26 21:35:35 +03:00
gfxmonk
175ebb3cd8 fail with appropriate error status if child process fails 2010-04-26 16:08:19 +10:00
Tim Jones
95367a4a63 Fixing silly mistake with the comments. 2010-04-26 16:00:12 +12:00
Tim Jones
8950c3c4c8 Fixing invalid pattern matching and object creation. 2010-04-26 15:54:47 +12:00
Jeremy Ashkenas
2d1abd099d rewriting the Lexer, CommandLine, Nodes, and Rewriter to take advantage of the new DRY object pattern matching. 2010-04-25 22:29:43 -04:00
Jeremy Ashkenas
a894db35fd Got the DRY object pattern matching style working properly, from Harmony. {name, age}: person now works correctly. 2010-04-25 22:21:53 -04:00
Jeremy Ashkenas
328a14014c eliminating the IndentedAssignList nonterminal. 2010-04-25 21:22:29 -04:00
Jeremy Ashkenas
315a2c63fa simplifying the grammar by replacing all of our trailing comma rules with an OptComma nonterminal. 2010-04-25 21:17:46 -04:00
Jeremy Ashkenas
ca4ea7649d Throwing an error when pattern matching has a non-identifier on the left-hand side. 2010-04-25 11:22:15 -04:00
Jeremy Ashkenas
08c877ec7b Fixing string keys in pattern matching on objects (ticket 325) 2010-04-25 11:07:09 -04:00
Jeremy Ashkenas
212ad45be4 merging gfxmonk's removed error event fix. 2010-04-24 22:13:13 -04:00
gfxmonk
e9b37c7578 replaced nonexistant error event callback with a combination of stderr and exit events 2010-04-25 11:24:06 +10:00
Jeremy Ashkenas
1438cecfad Fixing splats-with-super()-in-classes, an oversight. 2010-04-24 15:57:15 -04:00
Jeremy Ashkenas
49824ce1a6 removing yytext mentions for real this time. 2010-04-21 23:21:48 -04:00
Jeremy Ashkenas
bc0ec9dc07 Revert "removing yytext mentions from the grammar"
This reverts commit 5957b9f155.
2010-04-21 23:10:45 -04:00
Jeremy Ashkenas
5957b9f155 removing yytext mentions from the grammar 2010-04-21 23:01:14 -04:00
Jeremy Ashkenas
72e6e828f1 new version of Jison vendored ... rebuild the grammar, tests pass. 2010-04-21 22:52:20 -04:00
Jeremy Ashkenas
01b4393fa7 fixing Issue #328, parse error with indents and comments (StanAngeloff) 2010-04-21 22:26:45 -04:00
Jeremy Ashkenas
bf2a5386f9 requiring helpers module in test_bind.coffee 2010-04-21 19:52:58 -04:00
Jeremy Ashkenas
fb4d4a609b making bin/cake install add CoffeeScript as a Node.js library, and creating an index.js file for the top-level inclusion. 2010-04-20 20:20:38 -04:00
Jeremy Ashkenas
1cddb2aa88 Redoing Rewriter#add_implicit_parentheses to be more robust. 2010-04-20 01:32:12 -04:00
Jeremy Ashkenas
aac9679282 merging in gfodor's excellent Rewriter patch. 2010-04-19 23:18:39 -04:00
Jeremy Ashkenas
90472685e8 Merge branch 'master' of git://github.com/gfodor/coffee-script 2010-04-19 23:12:24 -04:00
Jeremy Ashkenas
7bb764b3e4 ignoring raw 2010-04-18 18:14:17 -04:00
Greg Fodor
1aed9c545f Fix for bug with chaining 2010-04-18 00:41:47 -04:00
Jeremy Ashkenas
c937e49689 adding 'coffeescript-idea' to the resources section. 2010-04-13 23:41:18 -04:00
Jeremy Ashkenas
0d860516ac fixing non-spaced function application. 2010-04-13 09:05:55 -04:00
Jeremy Ashkenas
4ced1d65b4 allowing 'debugger' ... it should never have been a reserved word. 2010-04-12 21:23:01 -04:00
Jeremy Ashkenas
92540d5e85 CoffeeScript 0.6.1, for Node.js v0.1.90 2010-04-12 21:20:00 -04:00
Jeremy Ashkenas
ea982a627e adding coffee-haml-filter to the docs 2010-04-11 17:57:29 -04:00
Jeremy Ashkenas
835ecac8db simplifying some unecessary interpolated expressions into interpolated values. 2010-04-11 16:57:53 -04:00
Jeremy Ashkenas
c3bbb48041 adding a test case for issue 309, interpolations with implicit calls. 2010-04-11 09:37:48 -04:00
Jeremy Ashkenas
2e842f0146 merging Stan's recursive tokenizing fix for interpolations. 2010-04-11 09:26:21 -04:00
Jeremy Ashkenas
8de2fb9009 Merge commit 'StanAngeloff/issue_309' 2010-04-11 09:22:31 -04:00
Stan Angeloff
17e177405a FIXES #309: Optional parens and interpolation. 2010-04-11 12:22:54 +03:00
Dr Nic Williams
ef67561fb3 Using anonymous callback for 'exit' event when running tests 2010-04-11 19:05:49 +10:00
Jeremy Ashkenas
df97effb9c fixing implicit-call-in-function-in-parens bug. 2010-04-10 18:56:46 -04:00
Jeremy Ashkenas
8317960f81 Battery of patches for compatibility with Node v0.1.90 2010-04-10 18:05:35 -04:00
Jeremy Ashkenas
065bf54094 generated closures should only call() or apply() when necessary. 2010-04-10 14:40:05 -04:00
Jeremy Ashkenas
f36acc27e5 safely preserving the arguments object through generated closure wrappers. 2010-04-10 14:20:32 -04:00
Jeremy Ashkenas
491ad6de95 adding webchat to the doc page 2010-04-10 13:42:39 -04:00
Jeremy Ashkenas
3eedf8ed1b Adding noonat to the contributor list 2010-04-06 21:09:23 -04:00
Jeremy Ashkenas
75b260e495 Merge branch 'master' of git://github.com/noonat/coffee-script 2010-04-06 21:08:29 -04:00
noonat
2351948291 Renamed Lexer.tag() argument to new_tag, due to Rhino scope confusion 2010-04-05 22:58:56 -07:00
Tim Jones
538e518d76 Realigning function arrows. 2010-04-06 02:29:38 +12:00
Tim Jones
de955dacc4 Added Statement to the grammar. 2010-04-06 02:26:23 +12:00
Chris Lloyd
19ed63129e Interpolated strings are expressions. 2010-04-04 17:05:52 +10:00
Chris Lloyd
2e744a1c1b Failing test for string interpolation. Interpolated strings need to be expressions, not values. 2010-04-04 16:54:59 +10:00
Jeremy Ashkenas
89534b88b1 merging in Chris Lloyd's fix for optional descriptions on Cake tasks. 2010-04-04 00:20:17 -04:00
Jeremy Ashkenas
c067808b54 CoffeeScript 0.6.0 is on the books. 2010-04-03 20:43:50 -04:00
Jeremy Ashkenas
59ae79d8fb rebuilding the docs with the fixed highlighter for '@' and regexes. 2010-04-03 19:10:26 -04:00
Jeremy Ashkenas
ad1c5e1884 merging non-func-constructor-fix, but a little more forgiving. 2010-04-03 14:53:26 -04:00
Stan Angeloff
9958cedd89 Throwing proper error when "constructor" is not a function within a class body. 2010-04-03 21:43:42 +03:00
Jeremy Ashkenas
d1aaed4430 Merge branch 'master' of git://github.com/Tesco/coffee-script 2010-04-03 12:21:31 -04:00
Tim Jones
89debc87b2 Removing {@prop: value} from the grammar. 2010-04-04 04:18:29 +12:00
Jeremy Ashkenas
9d2c81ea54 rebuilding the docs with new pygments, no errors on '@' 2010-04-03 12:01:46 -04:00
Jeremy Ashkenas
44765907b3 tiny tweak 2010-04-03 11:16:49 -04:00
Jeremy Ashkenas
4a85f3d499 cleaning up tests ... consolidation, consistency... 2010-04-03 10:39:32 -04:00
Jeremy Ashkenas
f99b5ad463 Merging Tesco's invoking-this-fix 2010-04-03 09:58:45 -04:00
Tim Jones
8fc631269b Added a rule to prevent invoking THIS. 2010-04-03 14:14:16 +13:00
Tim Jones
a1975583a7 Added THIS to CALLABLE. 2010-04-03 13:58:21 +13:00
Jeremy Ashkenas
1c628e7883 fixing parens-around-implicit-function-with-multiline-chained-chaser bug 2010-04-01 23:38:20 -04:00
Jeremy Ashkenas
3605168e85 fixing single evaluation of functions used in chained comparisons wrapped in parentheses. 2010-03-31 22:48:47 -04:00
Jeremy Ashkenas
f86fca2739 merged tanob's fix for installing outside of /usr/local without a /bin 2010-03-31 21:30:14 -04:00
Adriano Bonat
0410748e2d Merge remote branch 'upstream/master' 2010-03-31 22:14:26 -03:00
Adriano Bonat
2172878f21 When installing in different prefixes, prefix + '/bin' may not exist. 2010-03-31 09:38:05 -03:00
Jeremy Ashkenas
d3a51fbfa1 stylistics: removing a bunch of unecessary parentheses 2010-03-31 00:17:49 -04:00
Jeremy Ashkenas
aae2405de4 removing all of the 'type' tags from the Nodes. Simply using constructor.name instead. 2010-03-31 00:04:14 -04:00
Jeremy Ashkenas
2b578367a9 rebuilding the source documentation with the new utility refactors 2010-03-30 23:53:02 -04:00
Jeremy Ashkenas
f9b028b78c __extend back to __extends, as is the correct name. 2010-03-30 20:15:51 -04:00
Jeremy Ashkenas
572aa4e98f reverting the grammar to the pre-slice notation. 2010-03-30 20:11:40 -04:00
Jeremy Ashkenas
864275f07e removing __range, and all the slice behavior it enabled. If you can't do array[-1], then you shouldn't be able to do array[0..-1] -- it's just too inconsistent. 2010-03-30 20:06:44 -04:00
Jeremy Ashkenas
998a7c8cb0 more cleanups, added a utility helper function to the codegen 2010-03-30 19:48:37 -04:00
Jeremy Ashkenas
6d7a04228f another reshuffle ... removed utilities.coffee entirely. 2010-03-30 19:42:09 -04:00
Jeremy Ashkenas
4a8c2e8a13 more refactors to utilities ... removing dependencies and the namespacing 2010-03-30 19:27:38 -04:00
Jeremy Ashkenas
f3a60edc5d simplifying the lookup of the top-level scope object 2010-03-30 19:21:14 -04:00
Jeremy Ashkenas
1e1146d61d more utility simplifications 2010-03-30 19:17:40 -04:00
Jeremy Ashkenas
832e1d8cb8 Utilities doesn't need to be a class, and removing __utilities.keys 2010-03-30 19:00:59 -04:00
Jeremy Ashkenas
4936211a9c modified shorter imlementation of bind 2010-03-30 18:49:55 -04:00
Jeremy Ashkenas
f0d731009f merged matehat's utility branch, arraySlice -> slice, removed dead dependency... 2010-03-30 18:27:53 -04:00
Jeremy Ashkenas
a6248d03e5 Merge branch 'slice' of git://github.com/matehat/coffee-script 2010-03-30 18:19:41 -04:00
Jeremy Ashkenas
a934cf4947 make JSLint happy about the while condition 2010-03-30 18:19:09 -04:00
matehat
c498b7090e Removed __splice in the same manner 2010-03-30 18:14:51 -04:00
matehat
ca9e45e8af Removed the __slice method, in favor of the native array slice method 2010-03-30 17:57:23 -04:00
matehat
97096696a2 Put back every utility functions on the global scope, automatically prefixed with __ and set them dynamically as reserved on the lexer. 2010-03-30 16:48:43 -04:00
matehat
27fb3763b4 A set of improvements on previous code 2010-03-30 16:14:07 -04:00
matehat
da43c70488 Merged in StanAngeloff excellent slice branch, applying recent factoring of utility functions 2010-03-30 15:43:30 -04:00
Stan Angeloff
76ade0cb4d Removing vendor specific files for measurement tests. 2010-03-30 14:33:57 -04:00
Stan Angeloff
09e1526bca Removing commented code in compile_splice -- this is working correctly now. 2010-03-30 14:33:57 -04:00
Stan Angeloff
7d1fbeb708 Re-compiling the core using the new __slice and __splice functions. 2010-03-30 14:32:37 -04:00
Stan Angeloff
15217c705e Allowing for negative indices in slice literals. 2010-03-30 14:30:15 -04:00
matehat
9f108e87eb Removed unused __hasProp assignment and declared Coffeescript a reserved name 2010-03-30 11:20:53 -04:00
matehat
1e786d6d8b Removed unnecessary check 2010-03-30 10:58:21 -04:00
matehat
0557eb9b93 Removed hard-coding of utility object name 2010-03-30 09:08:16 -04:00
matehat
241f6f3068 Applied the utility factoring into a "Coffeescript" object to the core. All tests pass fast. 2010-03-30 09:02:51 -04:00
Jeremy Ashkenas
326656245a using the new static properties of class definitions in the CoffeeScript compiler -- it's hardly used. 2010-03-29 21:49:20 -04:00
Jeremy Ashkenas
177ec92c39 adding class methods to class definition syntax, using '@' 2010-03-29 21:43:12 -04:00
Jeremy Ashkenas
711dacae5f more little documentation for the rewriter ... moving along 2010-03-29 21:22:12 -04:00
Jeremy Ashkenas
c19183118e removing a case from Rewriter#add_implicit_parentheses that apparently never happens... 2010-03-29 20:52:22 -04:00
Jeremy Ashkenas
0af132d0c6 update internal documentation ... it's been a while 2010-03-29 20:48:41 -04:00
Jeremy Ashkenas
83c0e77ca8 making the Rewriter's add_implicit_calls more sensitive of parenthetical arguments. 2010-03-28 17:12:30 -04:00
Jeremy Ashkenas
1e315b5a33 fixing single-line implicit call wrapped around function with trailing arguments 2010-03-28 16:44:41 -04:00
Tim Jones
6e0e0767f9 Removed unprocessed values on a for loop from the grammar. 2010-03-29 07:32:01 +13:00
Tim Jones
6df50399a9 Restricted class and extends values to simple assignments. 2010-03-29 06:14:35 +13:00
Tim Jones
7b9a8998cf Addressing some assignment issues. 2010-03-29 06:06:16 +13:00
Jeremy Ashkenas
7de5253318 removing unused reserved variable 'source var' from range comprehensions 2010-03-27 16:04:47 -04:00
Jeremy Ashkenas
eaf4a71d32 Revert "Added Unix-like piping. Allows chaining of function calls where every succeeding call receives as first argument the result of all preceding expressions."
This reverts commit 7ee10e06be.
2010-03-27 15:25:34 -04:00
Jeremy Ashkenas
4dd40034ed Revert "removing the special case for | or"
This reverts commit 9763839ed1.
2010-03-27 15:25:27 -04:00
Jeremy Ashkenas
030476d335 Revert "typo for @compile_bitwise_or"
This reverts commit 45aae5e322.
2010-03-27 15:25:19 -04:00
Jeremy Ashkenas
45aae5e322 typo for @compile_bitwise_or 2010-03-27 12:13:24 -04:00
Jeremy Ashkenas
9763839ed1 removing the special case for | or 2010-03-27 10:28:08 -04:00
Stan Angeloff
7ee10e06be Added Unix-like piping. Allows chaining of function calls where every succeeding call receives as first argument the result of all preceding expressions. 2010-03-27 15:49:33 +02:00
matehat
8f3ea1d0c5 Fixed a small bug that happened when having a trailing comma in multiline array and object literals 2010-03-26 14:11:34 -04:00
matehat
b9b87f7d8e Minor modifications to the grammar to allow a single trailing comma for function call arguments, array literal and object literals. Adjusted tests accordingly 2010-03-26 11:44:25 -04:00
Chris Lloyd
c9b6e82e2c Optional sentence descriptions for cake tasks. 2010-03-26 20:25:17 +11:00
Jeremy Ashkenas
c8f969b4a2 adding a test case for the explicit returns 2010-03-25 18:54:17 -04:00
Jeremy Ashkenas
ecd1c77f48 fixing explicit returns of comprehensions (and probably other things as well) 2010-03-25 18:51:24 -04:00
Jeremy Ashkenas
ad93d2fe4d added another language extension test for a << b into a.push(b) 2010-03-23 20:42:40 -04:00
Jeremy Ashkenas
5a4d401582 make sure that the source-hacking docs mention to 'git checkout lib' 2010-03-23 00:25:37 -04:00
Jeremy Ashkenas
590c069158 CoffeeScript 0.5.6 2010-03-23 00:18:50 -04:00
Jeremy Ashkenas
94185e3f70 Merge branch 'master' of git://github.com/matehat/coffee-script 2010-03-22 23:20:05 -04:00
Jeremy Ashkenas
9adcd16ec6 '=' -> ':' 2010-03-22 18:48:41 -04:00
matehat
74bcd898e7 improving readability a bit 2010-03-22 02:02:04 -04:00
matehat
296808d4d3 Added splats positional flexibility to pattern matching 2010-03-22 01:52:47 -04:00
Jeremy Ashkenas
b7519cb834 switching a couple of the half_assignment tests to ensure that : and = are still interchangeable 2010-03-21 23:46:58 -04:00
Jeremy Ashkenas
7d6c050048 more half-assignment tests 2010-03-21 23:39:05 -04:00
Jeremy Ashkenas
16f9a2e6b7 rewriting the compiler to use half-expression assignment 2010-03-21 23:33:24 -04:00
Jeremy Ashkenas
cbfe7f5822 fix and tests for half assignments... whew. 2010-03-21 23:24:24 -04:00
Jeremy Ashkenas
895cd88761 almost there with half-assignments 2010-03-21 23:06:04 -04:00
Jeremy Ashkenas
f2ea18b0ba removing AND OR NOT IS ISNT from the grammar 2010-03-21 22:07:46 -04:00
Jeremy Ashkenas
162f6b9d5c one step at a time 2010-03-21 22:05:49 -04:00
Jeremy Ashkenas
4f8ae3ccbe one more step 2010-03-21 21:46:53 -04:00
Jeremy Ashkenas
acd9be3863 one step further 2010-03-21 21:46:06 -04:00
Jeremy Ashkenas
ddf18ae34c nothing much 2010-03-21 21:26:12 -04:00
Jeremy Ashkenas
0da61ec47e adding a couple of interchangeable tests 2010-03-21 21:07:32 -04:00
Jeremy Ashkenas
80230414a2 merging in gfxmonk's major refactor to the way that returns are pushed down into the interior of expressions 2010-03-21 11:28:05 -04:00
Jeremy Ashkenas
ce7c0d176b briefer test runner output 2010-03-21 10:18:23 -04:00
Jeremy Ashkenas
4ec79732f1 merging gfxmonk's cleanups 2010-03-21 10:11:02 -04:00
gfxmonk
cc3c314988 Cleaned up return logic
- ReturnNodes are explicitly added during compilation
 - ReturnNode is used instead of scattering "return" throughout
   code compilation snippets
 - nodes gain a make_return method in order to do the most useful
   thing when a return is requested
2010-03-21 22:21:55 +11:00
gfxmonk
8553a89af2 improve feedback when running the test task
- run synchronously, to ensure ordering is consistent
 - big red error message (and exit status)
 - don't bail early
 - don't bother printing a stack trace (it's useless
   until we can get line numbers in eval'd code)
2010-03-21 22:21:47 +11:00
Jeremy Ashkenas
566321d67a fixing infinite recursion when compiling if statements containing pure_statements 2010-03-20 10:36:06 -04:00
Jeremy Ashkenas
a2778bf06d resolving issues with comments in the middle of unfinished single-line expressions. 2010-03-20 00:58:25 -04:00
Jeremy Ashkenas
29eff23490 renaming test_curry to test_bind 2010-03-19 23:32:00 -04:00
Jeremy Ashkenas
4ebaa82563 removing the CoffeeScript.run named function from eval'd script scope by making it anonymous 2010-03-19 23:15:42 -04:00
Jeremy Ashkenas
69911209ea adding a pattern-matching-on-expression test 2010-03-19 22:48:55 -04:00
Jeremy Ashkenas
92688c89ef merging in matehat's nice refactor to splats (in arrays and otherwise) 2010-03-19 22:41:23 -04:00
matehat
fe04f8ce6b Added function call's flexibility with splats to array literals, factoring out splat compiling, and adjusted tests 2010-03-18 09:31:40 -04:00
Jeremy Ashkenas
b72641693d fixing doubled semis 2010-03-18 08:45:26 -04:00
Jeremy Ashkenas
0c6ee52cfc merging in matehat's curry branch. cleaning some loose ends up. adding some tests. 2010-03-18 00:42:26 -04:00
matehat
1f87094628 Slightly altered syntax, similar to Underscore's Function#bind form, highly simplified lexing and parsing and no polluted scope. Passing tests included. 2010-03-18 00:19:32 -04:00
matehat
3b22018296 Applied the new splat flexibility to function currying operator 2010-03-18 00:08:34 -04:00
matehat
5be437deb9 Added some inline docs 2010-03-18 00:08:34 -04:00
matehat
8d098194dd Added the '<-' currying operator, as heavily discussed in #251, along with tests. 2010-03-18 00:08:34 -04:00
matehat
256525bfa2 Fixed a small bug about flexible splats that occured when the leading array was a literal 2010-03-18 00:08:05 -04:00
Jeremy Ashkenas
79e4f30f69 fixing a bug where the Lexer assumed that values would always be strings. 2010-03-17 22:16:18 -04:00
Jeremy Ashkenas
884637468e fixing off-by-one error in compile_splat_arguments 2010-03-17 22:07:11 -04:00
Jeremy Ashkenas
6fd7810d89 can't use indexing[] into strings cross-browser, use substr() instead. 2010-03-17 21:41:00 -04:00
Jeremy Ashkenas
2f97d0d9b1 merging matehat's flexible splats (at any position within argument lists) 2010-03-17 21:15:54 -04:00
Jeremy Ashkenas
1bb9c57767 Merge branch 'splats' of git://github.com/matehat/coffee-script 2010-03-17 21:07:31 -04:00
Jeremy Ashkenas
d880b8b8f2 adding interpolation to heredocs, using the same rules as for strings 2010-03-17 20:47:27 -04:00
matehat
7129f518a4 Added the ability for function declaration to have a splat at an arbitrary position, not just at the end. Still restrict their number to 1. Adjusted tests accordingly. 2010-03-17 15:00:19 -04:00
matehat
fa6f1c2fb1 Fixed a tiny slicing bug 2010-03-17 15:00:19 -04:00
matehat
2bd1c3acca Added the ability to put as many splats in a function call as one wants. Also optimized the assembly into static arrays. Adjusted tests accordingly. 2010-03-17 15:00:19 -04:00
Jeremy Ashkenas
70cfc9500e pushing docs to the site 2010-03-16 23:18:54 -04:00
Jeremy Ashkenas
61b011cc28 fixing trailing whitespace on the final line 2010-03-16 19:57:39 -04:00
Jeremy Ashkenas
391135b1a5 fixing the relative path to 'grammar' 2010-03-16 19:36:08 -04:00
Jeremy Ashkenas
12d8d70573 fixing incorrectly-rooted relative paths in bin/cake and bin/coffee 2010-03-16 19:27:11 -04:00
Jeremy Ashkenas
04c5aeda2d Merge branch 'master' of git://github.com/matehat/coffee-script 2010-03-16 19:15:21 -04:00
Jeremy Ashkenas
25438be207 new docs for underscore 2010-03-16 19:13:13 -04:00
matehat
33f51d76f4 Added the possibility to end an identifier with '::', refering directly to its prototype. 2010-03-16 17:39:36 -04:00
Jeremy Ashkenas
e3021909c2 comments and tests 2010-03-16 06:54:49 -04:00
Jeremy Ashkenas
61dee1beba tweakin' 2010-03-15 23:10:14 -07:00
Jeremy Ashkenas
21e954eec3 updating module loading test 2010-03-15 23:08:58 -07:00
Jeremy Ashkenas
0b3054a348 merging in matehat's registerExtension patch for direct-requires of CoffeeScript. 2010-03-15 23:03:30 -07:00
Jeremy Ashkenas
02f4cb75dd removing deprecated references to process.mixin in favor of helpers.extend for Node 0.1.32 2010-03-15 22:53:25 -07:00
Jeremy Ashkenas
3aeb8c6bdb moving the contains-a-pure-statement-means-no-closure logic into ClosureNode.wrap itself. 2010-03-15 22:27:31 -07:00
Jeremy Ashkenas
8c2b2c7f80 merging in the fixed branch for gfxmonk/break_issue 2010-03-15 22:22:41 -07:00
Jeremy Ashkenas
745c635a55 fixing issue with break statements and for loops and closures and the value of 'this' 2010-03-15 22:20:29 -07:00
Jeremy Ashkenas
c7dd31846d merging in gfxmonk's fix for reporting line numbers for unclosed { [ ( opening symbols 2010-03-15 22:09:16 -07:00
gfxmonk
e87fa4293d report line number of opening token if a pair (eg bracket) is left open 2010-03-15 22:07:40 -07:00
gfxmonk
b269884f8d fixed non-recursive traverse() for CodeNode 2010-03-15 22:03:54 -07:00
Jeremy Ashkenas
3fed9761a6 let's make that non-greedy 2010-03-15 21:50:33 -07:00
Jeremy Ashkenas
6ccf196b61 adding another language extension test, with %w{} style ruby word array literals 2010-03-15 21:47:40 -07:00
Jeremy Ashkenas
a4bd8dc623 removing outdated arguments tests 2010-03-15 21:45:37 -07:00
Jeremy Ashkenas
34f01408c9 removing arguments-to-arrays from the docs 2010-03-15 20:53:43 -07:00
Jeremy Ashkenas
73074daa07 removing arguments-to-array-conversion from coffee 2010-03-15 20:46:14 -07:00
Jeremy Ashkenas
119b80d449 removing fiddling with require.paths from CoffeeScript 2010-03-15 20:39:46 -07:00
Jeremy Ashkenas
60b3103314 using granular helper imports, for nicer within. 2010-03-14 14:58:32 -07:00
Jeremy Ashkenas
75ffb9dc84 stop mixing in helpers (t(ticket #250) -- with a test 2010-03-14 14:48:43 -07:00
Jeremy Ashkenas
b306d40bf1 we don't need relative requires for the language 2010-03-14 13:48:58 -07:00
Jeremy Ashkenas
a27f146338 fixing 'cake test' to print out the name of the file with the failing test. 2010-03-14 09:33:41 -07:00
Jeremy Ashkenas
74995358cd updating the Cakefile for the new tmbundle location. 2010-03-14 08:59:55 -07:00
Jeremy Ashkenas
35da6c32b7 removing the tmbundle from the main repository. See jashkenas/coffee-script-tmbundle for the new one 2010-03-14 08:05:33 -07:00
Jeremy Ashkenas
701a5c7cb9 Merge branch 'master' of git://github.com/drnic/coffee-script 2010-03-14 07:39:02 -07:00
gfxmonk
3c3e7f666b added another "invalid break" example, with code not on the top-level 2010-03-14 13:02:36 +11:00
gfxmonk
89dfa1fd7a added code to illustrate an issue with break statements 2010-03-14 13:02:35 +11:00
gfxmonk
1da00f0ee3 added a test case for broken "break" statement 2010-03-14 11:35:56 +11:00
gfxmonk
5809a1637f fixed non-recursive traverse() for CodeNode 2010-03-14 00:05:51 +11:00
gfxmonk
e47bea34d5 report line number of opening token if a pair (eg bracket) is left open 2010-03-14 00:03:17 +11:00
matehat
709f17c278 Added an extension on node's 'require' module so it can import .coffee module and added some tests to make sure it works. 2010-03-12 14:22:01 -05:00
Jeremy Ashkenas
3c597dde72 no need to save the lookups 2010-03-10 22:32:00 -05:00
Jeremy Ashkenas
0379431812 tweaks 2010-03-10 21:53:33 -05:00
Jeremy Ashkenas
3f9fd85afb removing the unused CallNode#push 2010-03-10 20:53:31 -05:00
Jeremy Ashkenas
7b0a235c71 removing the nearly-unused notion of 'operation sensitive' 2010-03-10 20:19:32 -05:00
Jeremy Ashkenas
55cac23976 fixing indentation for prefix while nodes 2010-03-10 20:15:12 -05:00
Dr Nic Williams
22a16a3e33 added two snippets for creating functions; matching tab/key triggers from JavaScript bundle 2010-03-11 10:27:25 +10:00
Dr Nic Williams
db555d12ea can set Grammar via Shift+Ctrl+Alt+C 2010-03-11 10:16:34 +10:00
Jeremy Ashkenas
b9f1390405 adding more comment tests -- this terminator/comment as-block business really seems to have opened them up a bit 2010-03-10 16:44:50 -05:00
Jeremy Ashkenas
f2d0aee656 added Stan's fix for try/finally without catch 2010-03-10 16:27:30 -05:00
Jeremy Ashkenas
2a47727641 allowing terminator/comment as a block, so that you can have comment-only blocks 2010-03-10 16:18:17 -05:00
Jeremy Ashkenas
ccb7f63b8a fixing exports for the browser 2010-03-10 09:47:02 -05:00
Jeremy Ashkenas
1f9bb6a1c4 fixing broken multi-line optional-paren blocks 2010-03-10 09:28:00 -05:00
Jeremy Ashkenas
21b5d2cac5 tweaks to the helper docs, if they're going to be published 2010-03-10 00:05:30 -05:00
Jeremy Ashkenas
56eeeebed1 updating the docco 2010-03-09 23:53:21 -05:00
Jeremy Ashkenas
54627f6807 CoffeeScript language extensions are now working. 2010-03-09 23:44:29 -05:00
Jeremy Ashkenas
5754d36fdd adding the broken test 2010-03-09 23:32:54 -05:00
Jeremy Ashkenas
3d14d362a8 first draft of CoffeeScript language extensions. 2010-03-09 23:04:16 -05:00
Jeremy Ashkenas
472e027463 fixing the nested-implicit-parens-on-a-single-line 2010-03-09 21:54:44 -05:00
Jeremy Ashkenas
b297510d2b big refactor -- pulled all helper functions into helpers.coffee to facilitate sharing. 2010-03-09 21:24:30 -05:00
Jeremy Ashkenas
4932d25540 making balanced_string accept an array of delimiters, in hope of using it in the Rewriter 2010-03-09 20:53:56 -05:00
Jeremy Ashkenas
b6c3b743f0 Merge branch 'tm_highlighting' of git://github.com/cehoffman/coffee-script 2010-03-09 19:45:52 -05:00
Jeremy Ashkenas
1b4edd0e37 scrubbing all carriage returns from CoffeeScript source before compiling for the benefit of Windows users. 2010-03-08 23:07:26 -05:00
Jeremy Ashkenas
dcb00b4fe8 minor refactors to balanced_string 2010-03-08 22:48:14 -05:00
Jeremy Ashkenas
b33b688373 fixing more bugs in balance/interpolate/regexp/string/etc 2010-03-08 22:25:06 -05:00
Jeremy Ashkenas
4b97b15c0c more refactors to interpolation 2010-03-08 21:55:06 -05:00
Chris Hoffman
93c0774036 Regex interpolation highlighting 2010-03-08 20:48:23 -06:00
Chris Hoffman
645885d72d Merge branch 'master' of git://github.com/jashkenas/coffee-script 2010-03-08 20:34:36 -06:00
Jeremy Ashkenas
b5af5f66fb more regexp and string interpolation tweaks 2010-03-08 21:34:10 -05:00
Chris Hoffman
fb04f8900a Merge branch 'master' of git://github.com/jashkenas/coffee-script 2010-03-08 20:12:40 -06:00
Jeremy Ashkenas
3396dce2bb waypoint -- going to try to clean up regex_token 2010-03-08 20:57:28 -05:00
Jeremy Ashkenas
3291bd2a4a removing the 'supress' option from the lexer, just look at the slash. 2010-03-08 20:07:19 -05:00
Jeremy Ashkenas
121f01c06f merged stan's interpolation_3, a couple of tweaks 2010-03-08 19:43:12 -05:00
Jeremy Ashkenas
6cac2d57ba Merge commit 'StanAngeloff/interpolation_3' 2010-03-08 19:36:09 -05:00
Jeremy Ashkenas
c04b43e047 adding documentation for var shadowing 2010-03-08 19:27:38 -05:00
Jeremy Ashkenas
ff20732dd7 Merge branch 'tm_highlighting' of git://github.com/cehoffman/coffee-script 2010-03-08 19:14:34 -05:00
Stan Angeloff
81af8f296e Regular expression interpolations; fixed bug in string interpolations when all tokens were identifiers. 2010-03-08 20:06:51 +02:00
Stan Angeloff
830d1fb42b Merge branch 'master' of git://github.com/jashkenas/coffee-script into interpolation_3 2010-03-08 16:43:41 +02:00
Jeremy Ashkenas
e19cb48d3d Merge branch 'master' of git://github.com/uiru/coffee-script 2010-03-08 09:30:25 -05:00
Chris Hoffman
f755580b11 Match regex highlighting to how coffee parses it 2010-03-08 08:18:37 -06:00
Jeremy Ashkenas
81955005b9 doc tweaks 2010-03-08 09:13:15 -05:00
Will
62a871773b Include an extra line process.mixin require 'sys' on the top to let the .js output run using node (v0.1.31) 2010-03-09 01:03:43 +11:00
Chris Hoffman
5e52e7f19e While loop can be a single line expressions so don't indent when it is 2010-03-08 08:02:23 -06:00
Chris Hoffman
4c66a6a642 Merge branch 'master' of git://github.com/jashkenas/coffee-script 2010-03-08 07:33:45 -06:00
Chris Hoffman
9e1deecf13 Merge branch 'tm_highlighting' 2010-03-08 07:33:02 -06:00
Chris Hoffman
1ce93ccceb Indent function in symbol list based on indention in source 2010-03-08 07:30:15 -06:00
Chris Hoffman
4b04f8bec1 Add auto indent settings for textmate 2010-03-08 07:28:56 -06:00
Jeremy Ashkenas
5528bc7b2d scratch 'as seen above' 2010-03-08 06:44:47 -05:00
Jeremy Ashkenas
912f3b19f7 little tweaks to the docs 2010-03-08 06:40:54 -05:00
Chris Hoffman
9e5e85780b Don't highlight fresh[key]: val situations 2010-03-08 05:37:51 -06:00
Chris Hoffman
10aa3b3ae3 Revert "Properly highlight fresh[key]: val situations" 2010-03-08 05:37:07 -06:00
Jeremy Ashkenas
bcf7b3f95b CoffeeScript 0.5.5, with string interpolation and internal documentation 2010-03-08 06:34:07 -05:00
Chris Hoffman
07f1c784a4 Properly highlight fresh[key]: val situations 2010-03-08 05:29:01 -06:00
Chris Hoffman
465994cff9 Clean up some misplaced files 2010-03-08 05:26:38 -06:00
Chris Hoffman
697ad6cbda Merge remote branch 'origin' 2010-03-08 05:15:17 -06:00
Jeremy Ashkenas
a840671015 Finishing off the docs for nodes.coffee -- almost ready to roll. 2010-03-08 05:13:05 -06:00
Jeremy Ashkenas
7f0ab8308d making ThrowNode not a pure_statement -- it can jump out of the closure just fine 2010-03-08 05:13:05 -06:00
Jeremy Ashkenas
270b9fde04 waypoint -- documented down to the ThrowNode 2010-03-08 05:13:04 -06:00
Jeremy Ashkenas
993c9899cb Fixing up command-line args for --stdio and --eval. Now makes more sense with --run by default. 2010-03-08 05:13:04 -06:00
Jeremy Ashkenas
c8246e95f1 broke the flag for --no-wrap, fixed. 2010-03-08 05:13:04 -06:00
Stan Angeloff
f08de1ed4c Empty expression interpolations evaluate as empty strings now. 2010-03-08 05:13:04 -06:00
Jeremy Ashkenas
90f2e0dbb9 Merge branch 'tm_highlighting' of git://github.com/cehoffman/coffee-script 2010-03-08 06:11:15 -05:00
Chris Hoffman
80a3bd8951 Add variable assignment highlighting for textmate 2010-03-08 05:10:08 -06:00
Jeremy Ashkenas
b0aec3cbe2 Finishing off the docs for nodes.coffee -- almost ready to roll. 2010-03-08 05:42:57 -05:00
Jeremy Ashkenas
5f5e0634dd making ThrowNode not a pure_statement -- it can jump out of the closure just fine 2010-03-08 05:19:48 -05:00
Jeremy Ashkenas
049e605016 changing from storage.type... to variable.assignment -- it was a little garish in most color schemes I tried. 2010-03-08 05:16:45 -05:00
Jeremy Ashkenas
4687c3e140 Merge branch 'tm_highlighting' of git://github.com/cehoffman/coffee-script 2010-03-08 04:59:10 -05:00
Jeremy Ashkenas
6d74e223be waypoint -- documented down to the ThrowNode 2010-03-08 04:58:39 -05:00
Chris Hoffman
221427a6b4 Make variable assignment highlighting work in more cases 2010-03-08 03:55:03 -06:00
Chris Hoffman
3bf892128d Make old style classes show up as a function and don't let $\d be highlighted as a number 2010-03-08 03:47:49 -06:00
Chris Hoffman
abd7f939f2 Don't show object creation instances in symbol list for textmate 2010-03-08 03:46:38 -06:00
Jeremy Ashkenas
299e9918b9 Fixing up command-line args for --stdio and --eval. Now makes more sense with --run by default. 2010-03-08 04:46:24 -05:00
Chris Hoffman
eea83ff613 Add comment starter preference for textmate 2010-03-08 03:46:05 -06:00
Jeremy Ashkenas
9eceab667c broke the flag for --no-wrap, fixed. 2010-03-08 04:28:26 -05:00
Stan Angeloff
026e7649d5 Empty expression interpolations evaluate as empty strings now. 2010-03-08 04:13:59 -05:00
Chris Hoffman
c807da7664 Identify functions for symbol lookup and correct lookbehind assertion 2010-03-08 02:39:38 -06:00
Chris Hoffman
dde5db621d Add some TextMate triggers for string interpolation 2010-03-08 02:06:57 -06:00
Chris Hoffman
6b95cb4ee0 Fix the naked .property highlighting in interpolation to match coffee parsing 2010-03-08 01:40:04 -06:00
Stan Angeloff
a5f69ef716 Empty expression interpolations evaluate as empty strings now. 2010-03-08 09:31:31 +02:00
Chris Hoffman
accccb5f39 Allow $ to be the first character in a variable name for highlighting in textmate 2010-03-08 01:20:43 -06:00
Chris Hoffman
f8ddccd7d0 Escape $ in regexes where it was meant as character and not end of line 2010-03-08 01:05:52 -06:00
Chris Hoffman
e06e882962 Update highlighting for class definitions in textmate 2010-03-08 00:59:21 -06:00
Chris Hoffman
c3f74ca4f1 Add string interpolation highlighting and Cakefile highlighting 2010-03-08 00:43:04 -06:00
Jeremy Ashkenas
532464f7ae waypoint -- docs halfway down through the OpNode 2010-03-07 22:47:34 -05:00
Jeremy Ashkenas
570fb013e2 test tweaks 2010-03-07 22:29:46 -05:00
Jeremy Ashkenas
71ace9d8d0 allowing naked interpolation of dotted properties. .property 2010-03-07 22:26:25 -05:00
Jeremy Ashkenas
1cf0326183 unifying the CoffeeScript.compile and CoffeeScript.run apis to be the same -- source code and options hash. 2010-03-07 22:17:45 -05:00
Jeremy Ashkenas
5b9ebd19d5 adding source file information to all coffeescript compiles 2010-03-07 22:08:24 -05:00
Jeremy Ashkenas
6ce869b3fb adding a note about the 'git co lib' - build twice shuffle to the docs -- there's been more than one question about it already. 2010-03-07 21:57:08 -05:00
Jeremy Ashkenas
06b50ecb98 unifying all of the server-side evaluation under CoffeeScript.run -- this means that __filename and __dirname and relative requires should work from all angles under Node.js 2010-03-07 21:49:08 -05:00
Jeremy Ashkenas
0bc7719572 merging in Zaach's Jison updates 2010-03-07 19:11:03 -05:00
Jeremy Ashkenas
9028f79a27 Merge branch 'master' of git://github.com/zaach/coffee-script 2010-03-07 19:09:20 -05:00
Jeremy Ashkenas
a3e1693a75 waypoint -- docc'd down to the SplatNode 2010-03-07 19:07:37 -05:00
Zachary Carter
060b3e23c1 Merge branch 'master' of git://github.com/jashkenas/coffee-script 2010-03-07 18:59:54 -05:00
Zachary Carter
612c238157 Rebuild parser, now with skinnier parse table. 2010-03-07 18:53:23 -05:00
Zachary Carter
8adbc75811 Update Jison for table optimizations. 2010-03-07 18:48:15 -05:00
Jeremy Ashkenas
7485e5482c mention rlwrap in the docs on --interactive 2010-03-07 18:19:41 -05:00
Jeremy Ashkenas
659a5436a5 adding coffee-mode and rack-coffee to the Resources section of the docs 2010-03-07 17:52:14 -05:00
Jeremy Ashkenas
c6d7a27848 waypoint on the documentation -- almost halfway through the nodes 2010-03-07 17:31:39 -05:00
Jeremy Ashkenas
094b198d5d first little bit of commenting the nodes.coffee -- with some slight refactors 2010-03-07 16:41:06 -05:00
Jeremy Ashkenas
22b97a3b54 documenting scope.coffee -- nodes.coffee is the next, and last up to bat. 2010-03-07 15:45:45 -05:00
Jeremy Ashkenas
a4f7a5e248 documenting and cleaning up the Rewriter 2010-03-07 14:41:52 -05:00
Jeremy Ashkenas
45d8cf163e updating to the latest docco 2010-03-07 13:49:34 -05:00
Jeremy Ashkenas
d46daa1d7c documenting optparse.coffee and repl.coffee 2010-03-07 13:41:15 -05:00
Jeremy Ashkenas
4906cf1aff cleaned and commented the lexer (again) interpolate_string() continues to shrink 2010-03-07 12:47:03 -05:00
Stan Angeloff
f74fae58e3 Rewritting lexer.coffee to accept nested string interpolations. 2010-03-07 11:42:52 -05:00
Jeremy Ashkenas
1602e0e823 adding complete documentation for the grammar 2010-03-07 11:41:56 -05:00
Jeremy Ashkenas
202ebf06ff documentation for command.coffee 2010-03-07 00:28:58 -05:00
Jeremy Ashkenas
3e3b71724d making equality left-associative so that our chaining works properly with it. 2010-03-06 23:48:06 -05:00
Jeremy Ashkenas
893fb98522 moving command_line.coffee -> command.coffee 2010-03-06 22:18:15 -05:00
Jeremy Ashkenas
e267226438 commenting coffee-script.coffee for documentation 2010-03-06 20:30:40 -05:00
Jeremy Ashkenas
62626b712b Commenting cake.coffee for Docco docs. 2010-03-06 20:18:50 -05:00
Jeremy Ashkenas
7bdf14b210 Override process.argv as well as process.ARGV for eval'd scripts 2010-03-06 20:09:08 -05:00
Jeremy Ashkenas
87420e6504 updating the Function Binding docs with an improved explanation. 2010-03-06 19:29:41 -05:00
Jeremy Ashkenas
c73a3ec356 updating webserver example for node API 2010-03-06 19:23:25 -05:00
Jeremy Ashkenas
2e23e6a2dc removing narwhal.coffee and narwhal.js, because I don't think that anyone was using them. 2010-03-06 19:05:21 -05:00
Jeremy Ashkenas
5b3ef78101 adding a doc:source Cake task to document CoffeeScript's internals 2010-03-06 19:02:31 -05:00
Jeremy Ashkenas
9b262d56a5 allowing relative requires of JavaScript from directly-eval'd CoffeeScript. 2010-03-06 17:40:13 -05:00
Jeremy Ashkenas
453b43992d fixing line numbers in errors printed prior to parsing 2010-03-06 16:42:40 -05:00
Jeremy Ashkenas
a5e3617015 Adding a starts() helper to avoid substring() calls for simple matches. 2010-03-06 16:24:06 -05:00
Jeremy Ashkenas
c4ad6d1ee6 minor cleanups to balanced_group -> balanced_token, removing optional escaper (unused), and using it to implement interpolated javascript. 2010-03-06 16:06:47 -05:00
Stan Angeloff
f9cde1b46d Improving performance by removing call to bound function for every character in a string. Added a third option to \delimited\ to allow custom escape sequences. 2010-03-06 15:53:37 -05:00
Jeremy Ashkenas
03bc897b39 updating CoffeeScript docs to require Node 0.1.31 + 2010-03-06 15:48:20 -05:00
Stan Angeloff
83fd84745d Rewriting string tokenizer; allowing nested double-quoted strings inside expression interpolations. 2010-03-06 15:21:30 -05:00
Jeremy Ashkenas
e977967eb5 implementing the CoffeeScript compiler using interpolation where appropriate. 2010-03-06 13:59:11 -05:00
Jeremy Ashkenas
15b00cb3ca implementing string interpolation using string interpolation 2010-03-06 13:32:43 -05:00
Jeremy Ashkenas
18e5f72a84 done converting nodes.coffee code generation to use string interpolation where appropriate 2010-03-06 00:23:54 -05:00
Jeremy Ashkenas
47682de0f0 adding a test for intermingled identifier/expression interpolations 2010-03-05 22:54:39 -05:00
Jeremy Ashkenas
b4ea43cbd0 waypoint -- starting to implement nodes.coffee with interpolations, and fixing/shortening/combining the lexer implementation to allow identifier interpolations to be interleaved with expression interps 2010-03-05 22:52:28 -05:00
Jeremy Ashkenas
08341286a3 adding back parentheses wrapper around interpolated expressions -- we need it 2010-03-05 21:12:13 -05:00
Jeremy Ashkenas
4c3b0b9a74 allowing @properties to be referenced in naked interpolations 2010-03-05 21:05:31 -05:00
Jeremy Ashkenas
d250e9e9cc some edits to the interpolation path 2010-03-05 20:42:36 -05:00
Stan Angeloff
75be5eed62 Test line commented by mistake, no functional changes 2010-03-05 19:50:28 -05:00
Stan Angeloff
e2f86678a4 Allowing expressions to be used inside strings; syntax is $\{...\} 2010-03-05 19:50:20 -05:00
Stan Angeloff
fe7d5dfd19 Added string interpolation for identifiers 2010-03-05 19:49:48 -05:00
Jeremy Ashkenas
965034e16e add proper spacing to optparse by default 2010-03-04 22:59:03 -05:00
Jeremy Ashkenas
44398d044f Updating docs for CoffeeScript 0.5.4. Tag it and bag it. 2010-03-03 23:01:53 -05:00
Jeremy Ashkenas
3feb874b1e Merge branch 'path_fix' of git://github.com/cehoffman/coffee-script 2010-03-03 20:17:58 -05:00
Chris Hoffman
f7183e6918 Use new node api for resolving a chain of symlinks 2010-03-03 16:34:17 -06:00
Samuel Reis
707cd2d734 updated command_line.js 2010-03-03 14:32:28 +01:00
Samuel Reis
c11c3ed2f2 fix: process.watchFile has moved to fs.watchFile 2010-03-03 14:31:30 +01:00
Jeremy Ashkenas
5fd0972b5d improvement to comment handling that should ensure that they have no effect on indentation 2010-03-02 19:23:21 -05:00
Jeremy Ashkenas
70cb195e6f rebuilding extras/coffee-script.js 2010-03-02 16:52:55 -05:00
Jeremy Ashkenas
c219adffd5 removing special rule from rewriter for naked functions in arrays 2010-03-02 00:43:01 -05:00
Jeremy Ashkenas
cd6dd5abfd couple more tweaks to lexer.coffee 2010-02-28 21:39:07 -05:00
Jeremy Ashkenas
29ece0e6ba better commenting the coffeescript lexer as the first trial for docco 2010-02-28 20:44:33 -05:00
Jeremy Ashkenas
45bad556ab defining __filename and __dirname correctly as local variables for eval'd scripts 2010-02-28 19:56:00 -05:00
Jeremy Ashkenas
30cf63ec92 updating Underscore.coffee to Underscore.js version 0.6.0 2010-02-28 15:12:18 -05:00
Jeremy Ashkenas
969c2e528d a number of refactors to the Lexer. It should be a good bit clearer to read now. 2010-02-28 13:34:52 -05:00
Jeremy Ashkenas
bb2bf7ce57 allowing chaining of property accesses by indentation level (really nice for Node and jQuery work) ticket #221 2010-02-28 12:49:37 -05:00
Jeremy Ashkenas
2969e156c7 fixing require paths in the Cakefile so that build:jison will work, even if you don't have it installed. 2010-02-28 10:37:12 -05:00
Jeremy Ashkenas
b08995cbcc fixing heredocs with multiple double quotes (broken regex from the Ruby translation), with tests. 2010-02-28 10:29:30 -05:00
Jeremy Ashkenas
47f71f9193 updating docs to say 'Node.js greater than 0.1.30' 2010-02-28 10:11:01 -05:00
Jeremy Ashkenas
fec2eaef7e removing the (now-unused) inherits helper, and adding a helper for creating LiteralNodes 2010-02-28 00:22:06 -05:00
Jeremy Ashkenas
56eb474bf3 If you don't specify a constructor, one will be provided for you by the state. 2010-02-28 00:13:17 -05:00
513 changed files with 102050 additions and 21328 deletions

10
.gitignore vendored
View File

@@ -1,6 +1,10 @@
raw
presentation
test.coffee
test*.coffee
test.litcoffee
test*.litcoffee
test/*.js
parser.output
test/fixtures/underscore
examples/beautiful_code/parse.coffee
*.gem
/node_modules
npm-debug.log*

0
.nojekyll Normal file
View File

9
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,9 @@
## How to contribute to CoffeeScript
* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffeescript/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one.
* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffeescript/tree/master/test).
* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffeescript/tree/master/src). If youre just getting started with CoffeeScript, theres a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide).
* In your pull request, do not add documentation to `index.html` or re-build the minified `coffeescript.js` file. Well do those things before cutting a new release.

494
Cakefile
View File

@@ -1,71 +1,463 @@
fs: require 'fs'
coffee: require 'coffee-script'
fs = require 'fs'
os = require 'os'
path = require 'path'
_ = require 'underscore'
{ spawn, exec, execSync } = require 'child_process'
CoffeeScript = require './lib/coffeescript'
helpers = require './lib/coffeescript/helpers'
# ANSI Terminal Colors.
bold = red = green = reset = ''
unless process.env.NODE_DISABLE_COLORS
bold = '\x1B[0;1m'
red = '\x1B[0;31m'
green = '\x1B[0;32m'
reset = '\x1B[0m'
# Built file header.
header = """
/**
* CoffeeScript Compiler v#{CoffeeScript.VERSION}
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
"""
# Used in folder names like `docs/v1`.
majorVersion = parseInt CoffeeScript.VERSION.split('.')[0], 10
# Log a message with a color.
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
spawnNodeProcess = (args, output = 'stderr', callback) ->
relayOutput = (buffer) -> console.log buffer.toString()
proc = spawn 'node', args
proc.stdout.on 'data', relayOutput if output is 'both' or output is 'stdout'
proc.stderr.on 'data', relayOutput if output is 'both' or output is 'stderr'
proc.on 'exit', (status) -> callback(status) if typeof callback is 'function'
# Run a CoffeeScript through our node/coffee interpreter.
run: (args) ->
proc: process.createChildProcess 'bin/coffee', args
proc.addListener 'error', (err) -> if err then puts err
run = (args, callback) ->
spawnNodeProcess ['bin/coffee'].concat(args), 'stderr', (status) ->
process.exit(1) if status isnt 0
callback() if typeof callback is 'function'
option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
# Build the CoffeeScript language from source.
buildParser = ->
helpers.extend global, require 'util'
require 'jison'
# We don't need `moduleMain`, since the parser is unlikely to be run standalone.
parser = require('./lib/coffeescript/grammar').parser.generate(moduleMain: ->)
fs.writeFileSync 'lib/coffeescript/parser.js', parser
task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
base: options.prefix or '/usr/local'
lib: base + '/lib/coffee-script'
exec([
'mkdir -p ' + lib
'cp -rf bin lib LICENSE README package.json src vendor ' + lib
'ln -sf ' + lib + '/bin/coffee ' + base + '/bin/coffee'
'ln -sf ' + lib + '/bin/cake ' + base + '/bin/cake'
].join(' && '), (err, stdout, stderr) ->
if err then print stderr
)
buildExceptParser = (callback) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffeescript'].concat(files), callback
build = (callback) ->
buildParser()
buildExceptParser callback
testBuiltCode = (watch = no) ->
csPath = './lib/coffeescript'
csDir = path.dirname require.resolve csPath
for mod of require.cache when csDir is mod[0 ... csDir.length]
delete require.cache[mod]
testResults = runTests require csPath
unless watch
process.exit 1 unless testResults
buildAndTest = (includingParser = yes, harmony = no) ->
process.stdout.write '\x1Bc' # Clear terminal screen.
execSync 'git checkout lib/*', stdio: [0,1,2] # Reset the generated compiler.
buildArgs = ['bin/cake']
buildArgs.push if includingParser then 'build' else 'build:except-parser'
log "building#{if includingParser then ', including parser' else ''}...", green
spawnNodeProcess buildArgs, 'both', ->
log 'testing...', green
testArgs = if harmony then ['--harmony'] else []
testArgs = testArgs.concat ['bin/cake', 'test']
spawnNodeProcess testArgs, 'both'
watchAndBuildAndTest = (harmony = no) ->
buildAndTest yes, harmony
fs.watch 'src/', interval: 200, (eventType, filename) ->
if eventType is 'change'
log "src/#{filename} changed, rebuilding..."
buildAndTest (filename is 'grammar.coffee'), harmony
fs.watch 'test/', {interval: 200, recursive: yes}, (eventType, filename) ->
if eventType is 'change'
log "test/#{filename} changed, rebuilding..."
buildAndTest no, harmony
task 'build', 'build the CoffeeScript language from source', ->
files: fs.readdirSync 'src'
files: 'src/' + file for file in files when file.match(/\.coffee$/)
run ['-c', '-o', 'lib'].concat(files)
task 'build', 'build the CoffeeScript compiler from source', build
task 'build:parser', 'build the Jison parser only', buildParser
task 'build:except-parser', 'build the CoffeeScript compiler, except for the Jison parser', buildExceptParser
task 'build:full', 'build the CoffeeScript compiler from source twice, and run the tests', ->
build ->
build testBuiltCode
task 'build:browser', 'merge the built scripts into a single file for use in a browser', ->
code = """
require['../../package.json'] = (function() {
return #{fs.readFileSync "./package.json"};
})();
"""
for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'nodes', 'sourcemap', 'coffeescript', 'browser']
code += """
require['./#{name}'] = (function() {
var exports = {}, module = {exports: exports};
#{fs.readFileSync "lib/coffeescript/#{name}.js"}
return module.exports;
})();
"""
code = """
(function(root) {
var CoffeeScript = function() {
function require(path){ return require[path]; }
#{code}
return require['./browser'];
}();
if (typeof define === 'function' && define.amd) {
define(function() { return CoffeeScript; });
} else {
root.CoffeeScript = CoffeeScript;
}
}(this));
"""
babel = require 'babel-core'
presets = []
# Exclude the `modules` plugin in order to not break the `}(this));`
# at the end of the above code block.
presets.push ['env', {modules: no}] unless process.env.TRANSFORM is 'false'
presets.push 'babili' unless process.env.MINIFY is 'false'
babelOptions =
compact: process.env.MINIFY isnt 'false'
presets: presets
sourceType: 'script'
{ code } = babel.transform code, babelOptions unless presets.length is 0
outputFolder = "docs/v#{majorVersion}/browser-compiler"
fs.mkdirSync outputFolder unless fs.existsSync outputFolder
fs.writeFileSync "#{outputFolder}/coffeescript.js", header + '\n' + code
task 'build:browser:full', 'merge the built scripts into a single file for use in a browser, and test it', ->
invoke 'build:browser'
console.log "built ... running browser tests:"
invoke 'test:browser'
task 'build:watch', 'watch and continually rebuild the CoffeeScript compiler, running tests on each build', ->
watchAndBuildAndTest()
task 'build:watch:harmony', 'watch and continually rebuild the CoffeeScript compiler, running harmony tests on each build', ->
watchAndBuildAndTest yes
task 'build:parser', 'rebuild the Jison parser (run build first)', ->
parser: require('grammar').parser
js: parser.generate()
parser_path: 'lib/parser.js'
fs.writeFile parser_path, js
buildDocs = (watch = no) ->
# Constants
indexFile = 'documentation/index.html'
versionedSourceFolder = "documentation/v#{majorVersion}"
sectionsSourceFolder = 'documentation/sections'
examplesSourceFolder = 'documentation/examples'
outputFolder = "docs/v#{majorVersion}"
# Helpers
releaseHeader = (date, version, prevVersion) ->
monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
formatDate = (date) ->
date.replace /^(\d\d\d\d)-(\d\d)-(\d\d)$/, (match, $1, $2, $3) ->
"#{monthNames[$2 - 1]} #{+$3}, #{$1}"
"""
<div class="anchor" id="#{version}"></div>
<h2 class="header">
#{prevVersion and "<a href=\"https://github.com/jashkenas/coffeescript/compare/#{prevVersion}...#{version}\">#{version}</a>" or version}
<span class="timestamp"> &mdash; <time datetime="#{date}">#{formatDate date}</time></span>
</h2>
"""
codeFor = require "./documentation/v#{majorVersion}/code.coffee"
htmlFor = ->
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
markdownRenderer = require('markdown-it')
html: yes
typographer: yes
highlight: (str, lang) ->
# From https://github.com/markdown-it/markdown-it#syntax-highlighting
if lang and hljs.getLanguage(lang)
try
return hljs.highlight(lang, str).value
catch ex
return '' # No syntax highlighting
task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter', ->
exec 'plist2syntax extras/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage', (err) ->
exec 'sudo mv coffeescript.yaml /usr/local/lib/ruby/gems/1.8/gems/ultraviolet-0.10.2/syntax/coffeescript.syntax'
# Add some custom overrides to Markdown-Its rendering, per
# https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md#renderer
defaultFence = markdownRenderer.renderer.rules.fence
markdownRenderer.renderer.rules.fence = (tokens, idx, options, env, slf) ->
code = tokens[idx].content
if code.indexOf('codeFor(') is 0 or code.indexOf('releaseHeader(') is 0
"<%= #{code} %>"
else
"<blockquote class=\"uneditable-code-block\">#{defaultFence.apply @, arguments}</blockquote>"
(file, bookmark) ->
md = fs.readFileSync "#{sectionsSourceFolder}/#{file}.md", 'utf-8'
md = md.replace /<%= releaseHeader %>/g, releaseHeader
md = md.replace /<%= majorVersion %>/g, majorVersion
md = md.replace /<%= fullVersion %>/g, CoffeeScript.VERSION
html = markdownRenderer.render md
html = _.template(html)
codeFor: codeFor()
releaseHeader: releaseHeader
include = ->
(file) ->
file = "#{versionedSourceFolder}/#{file}" if file.indexOf('/') is -1
output = fs.readFileSync file, 'utf-8'
if /\.html$/.test(file)
render = _.template output
output = render
releaseHeader: releaseHeader
majorVersion: majorVersion
fullVersion: CoffeeScript.VERSION
htmlFor: htmlFor()
codeFor: codeFor()
include: include()
output
# Task
do renderIndex = ->
render = _.template fs.readFileSync(indexFile, 'utf-8')
output = render
include: include()
fs.writeFileSync "#{outputFolder}/index.html", output
log 'compiled', green, "#{indexFile} → #{outputFolder}/index.html"
try
fs.symlinkSync "v#{majorVersion}/index.html", 'docs/index.html'
catch exception
if watch
for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder]
fs.watch target, interval: 200, renderIndex
log 'watching...', green
task 'doc:site', 'build the documentation for the website', ->
buildDocs()
task 'doc:site:watch', 'watch and continually rebuild the documentation for the website', ->
buildDocs yes
task 'build:underscore', 'rebuild the Underscore.coffee documentation page', ->
exec 'uv -s coffeescript -t idle -h examples/underscore.coffee > documentation/underscore.html'
buildDocTests = (watch = no) ->
# Constants
testFile = 'documentation/test.html'
testsSourceFolder = 'test'
outputFolder = "docs/v#{majorVersion}"
# Included in test.html
testHelpers = fs.readFileSync('test/support/helpers.coffee', 'utf-8').replace /exports\./g, '@'
# Helpers
testsInScriptBlocks = ->
output = ''
for filename in fs.readdirSync testsSourceFolder
if filename.indexOf('.coffee') isnt -1
type = 'coffeescript'
else if filename.indexOf('.litcoffee') isnt -1
type = 'literate-coffeescript'
else
continue
# Set the type to text/x-coffeescript or text/x-literate-coffeescript
# to prevent the browser compiler from automatically running the script
output += """
<script type="text/x-#{type}" class="test" id="#{filename.split('.')[0]}">
#{fs.readFileSync "test/#{filename}", 'utf-8'}
</script>\n
"""
output
# Task
do renderTest = ->
render = _.template fs.readFileSync(testFile, 'utf-8')
output = render
testHelpers: testHelpers
tests: testsInScriptBlocks()
fs.writeFileSync "#{outputFolder}/test.html", output
log 'compiled', green, "#{testFile} → #{outputFolder}/test.html"
if watch
for target in [testFile, testsSourceFolder]
fs.watch target, interval: 200, renderTest
log 'watching...', green
task 'doc:test', 'build the browser-based tests', ->
buildDocTests()
task 'doc:test:watch', 'watch and continually rebuild the browser-based tests', ->
buildDocTests yes
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
exec 'rake browser'
buildAnnotatedSource = (watch = no) ->
do generateAnnotatedSource = ->
exec "node_modules/docco/bin/docco src/*.*coffee --output docs/v#{majorVersion}/annotated-source", (err) -> throw err if err
log 'generated', green, "annotated source in docs/v#{majorVersion}/annotated-source/"
if watch
fs.watch 'src/', interval: 200, generateAnnotatedSource
log 'watching...', green
task 'doc:source', 'build the annotated source documentation', ->
buildAnnotatedSource()
task 'doc:source:watch', 'watch and continually rebuild the annotated source documentation', ->
buildAnnotatedSource yes
task 'doc', 'watch and continually rebuild the documentation', ->
exec 'rake doc'
task 'release', 'build and test the CoffeeScript source, and build the documentation', ->
invoke 'build:full'
invoke 'build:browser:full'
invoke 'doc:site'
invoke 'doc:test'
invoke 'doc:source'
task 'bench', 'quick benchmark of compilation time', ->
{Rewriter} = require './lib/coffeescript/rewriter'
sources = ['coffeescript', 'grammar', 'helpers', 'lexer', 'nodes', 'rewriter']
coffee = sources.map((name) -> fs.readFileSync "src/#{name}.coffee").join '\n'
litcoffee = fs.readFileSync("src/scope.litcoffee").toString()
fmt = (ms) -> " #{bold}#{ " #{ms}".slice -4 }#{reset} ms"
total = 0
now = Date.now()
time = -> total += ms = -(now - now = Date.now()); fmt ms
tokens = CoffeeScript.tokens coffee, rewrite: no
littokens = CoffeeScript.tokens litcoffee, rewrite: no, literate: yes
tokens = tokens.concat(littokens)
console.log "Lex #{time()} (#{tokens.length} tokens)"
tokens = new Rewriter().rewrite tokens
console.log "Rewrite#{time()} (#{tokens.length} tokens)"
nodes = CoffeeScript.nodes tokens
console.log "Parse #{time()}"
js = nodes.compile bare: yes
console.log "Compile#{time()} (#{js.length} chars)"
console.log "total #{ fmt total }"
# Run the CoffeeScript test suite.
runTests = (CoffeeScript) ->
CoffeeScript.register() unless global.testingBrowser
startTime = Date.now()
# These are attached to `global` so that theyre accessible from within
# `test/async.coffee`, which has an async-capable version of
# `global.test`.
global.currentFile = null
global.passedTests = 0
global.failures = []
global[name] = func for name, func of require 'assert'
# Convenience aliases.
global.CoffeeScript = CoffeeScript
global.Repl = require './lib/coffeescript/repl'
# Our test helper function for delimiting different test cases.
global.test = (description, fn) ->
try
fn.test = {description, currentFile}
fn.call(fn)
++passedTests
catch e
failures.push
filename: currentFile
error: e
description: description if description?
source: fn.toString() if fn.toString?
helpers.extend global, require './test/support/helpers'
# When all the tests have run, collect and print errors.
# If a stacktrace is available, output the compiled function source.
process.on 'exit', ->
time = ((Date.now() - startTime) / 1000).toFixed(2)
message = "passed #{passedTests} tests in #{time} seconds#{reset}"
return log(message, green) unless failures.length
log "failed #{failures.length} and #{message}", red
for fail in failures
{error, filename, description, source} = fail
console.log ''
log " #{description}", red if description
log " #{error.stack}", red
console.log " #{source}" if source
return
# Run every test in the `test` folder, recording failures.
files = fs.readdirSync 'test'
for file in files when helpers.isCoffee file
literate = helpers.isLiterate file
currentFile = filename = path.join 'test', file
code = fs.readFileSync filename
try
CoffeeScript.run code.toString(), {filename, literate}
catch error
failures.push {filename, error}
return !failures.length
task 'test', 'run the CoffeeScript language test suite', ->
process.mixin require 'assert'
test_count: 0
start_time: new Date()
[original_ok, original_throws]: [ok, throws]
process.mixin {
ok: (args...) -> test_count += 1; original_ok(args...)
throws: (args...) -> test_count += 1; original_throws(args...)
}
process.addListener 'exit', ->
time: ((new Date() - start_time) / 1000).toFixed(2)
puts '\033[0;32mpassed ' + test_count + ' tests in ' + time + ' seconds\033[0m'
fs.readdir 'test', (err, files) ->
for file in files
fs.readFile 'test/' + file, (err, source) ->
js: coffee.compile source
process.compile js, file
testResults = runTests CoffeeScript
process.exit 1 unless testResults
task 'test:browser', 'run the test suite against the merged browser script', ->
source = fs.readFileSync "docs/v#{majorVersion}/browser-compiler/coffeescript.js", 'utf-8'
result = {}
global.testingBrowser = yes
(-> eval source).call result
testResults = runTests result.CoffeeScript
process.exit 1 unless testResults
task 'test:integrations', 'test the module integrated with other libraries and environments', ->
# Tools like Webpack and Browserify generate builds intended for a browser
# environment where Node modules are not available. We want to ensure that
# the CoffeeScript module as presented by the `browser` key in `package.json`
# can be built by such tools; if such a build succeeds, it verifies that no
# Node modules are required as part of the compiler (as opposed to the tests)
# and that therefore the compiler will run in a browser environment.
tmpdir = os.tmpdir()
try
buildLog = execSync "./node_modules/webpack/bin/webpack.js
--entry=./
--output-library=CoffeeScript
--output-library-target=commonjs2
--output-path=#{tmpdir}
--output-filename=coffeescript.js"
catch exception
console.error buildLog.toString()
throw exception
builtCompiler = path.join tmpdir, 'coffeescript.js'
CoffeeScript = require builtCompiler
global.testingBrowser = yes
testResults = runTests CoffeeScript
fs.unlinkSync builtCompiler
process.exit 1 unless testResults

View File

@@ -1,4 +1,4 @@
Copyright (c) 2010 Jeremy Ashkenas
Copyright (c) 2009-2017 Jeremy Ashkenas
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.

42
README
View File

@@ -1,42 +0,0 @@
=
{
} } {
{ { } }
} }{ {
{ }{ } } _____ __ __
( }{ }{ { ) / ____| / _|/ _|
.- { { } { }} -. | | ___ | |_| |_ ___ ___
( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \
|`-..________ ..-'| | |___| (_) | | | || __/ __/
| | \_____\___/|_| |_| \___|\___|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|
CoffeeScript is a little language that compiles into JavaScript.
Install Node.js, and then the CoffeeScript compiler:
sudo bin/cake install
Compile a script:
coffee /path/to/script.coffee
For documentation, usage, and examples, see:
http://coffeescript.org/
To suggest a feature, report a bug, or general discussion:
http://github.com/jashkenas/coffee-script/issues/
If you'd like to chat, drop by #coffeescript on Freenode IRC,
or on webchat.freenode.net.
The source repository:
git://github.com/jashkenas/coffee-script.git

57
README.md Normal file
View File

@@ -0,0 +1,57 @@
{
} } {
{ { } }
} }{ {
{ }{ } } _____ __ __
{ }{ }{ { } / ____| / _|/ _|
.- { { } { }} -. | | ___ | |_| |_ ___ ___
( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \
|`-..________ ..-'| | |___| (_) | | | || __/ __/
| | \_____\___/|_| |_| \___|\___|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|
CoffeeScript is a little language that compiles into JavaScript.
## Installation
Once you have Node.js installed:
```shell
npm install --global coffeescript
```
Leave off the `--global` if you dont wish to install globally.
## Getting Started
Execute a script:
```shell
coffee /path/to/script.coffee
```
Compile a script:
```shell
coffee -c /path/to/script.coffee
```
For documentation, usage, and examples, see: http://coffeescript.org/
To suggest a feature or report a bug: https://github.com/jashkenas/coffeescript/issues
If youd 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: https://github.com/jashkenas/coffeescript/contributors

View File

@@ -1,31 +0,0 @@
require 'erb'
require 'fileutils'
require 'rake/testtask'
require 'rubygems'
require 'yui/compressor'
desc "Build the documentation page"
task :doc do
source = 'documentation/index.html.erb'
child = fork { exec "bin/coffee -c documentation/coffee/*.coffee -o documentation/js -w" }
at_exit { Process.kill("INT", child) }
Signal.trap("INT") { exit }
loop do
mtime = File.stat(source).mtime
if !@mtime || mtime > @mtime
rendered = ERB.new(File.read(source)).result(binding)
File.open('index.html', 'w+') {|f| f.write(rendered) }
end
@mtime = mtime
sleep 1
end
end
desc "Build the single concatenated and minified script for the browser"
task :browser do
sources = %w(rewriter.js lexer.js parser.js scope.js nodes.js coffee-script.js)
code = sources.map {|s| File.read('lib/' + s) }.join('')
code = YUI::JavaScriptCompressor.new.compress(code)
File.open('extras/coffee-script.js', 'w+') {|f| f.write(code) }
end

View File

@@ -1,15 +1,18 @@
#!/usr/bin/env node
process.mixin(require('sys'));
var path = require('path');
var fs = require('fs');
var lib = null;
var fs = require('fs');
if (fs.lstatSync(__filename).isSymbolicLink()) {
lib = path.join(path.dirname(fs.readlinkSync(__filename)), '../lib');
} else {
lib = path.join(__dirname, '../lib');
var potentialPaths = [
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffeescript'),
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffee-script'),
path.join(process.cwd(), 'node_modules/coffee-script/lib/coffee-script'),
path.join(__dirname, '../lib/coffeescript')
];
for (var i = 0, len = potentialPaths.length; i < len; i++) {
if (fs.existsSync(potentialPaths[i])) {
require(potentialPaths[i] + '/cake').run();
break;
}
}
require.paths.unshift(lib);
require('cake').run();

View File

@@ -1,15 +1,18 @@
#!/usr/bin/env node
process.mixin(require('sys'));
var path = require('path');
var fs = require('fs');
var lib = null;
var fs = require('fs');
if (fs.lstatSync(__filename).isSymbolicLink()) {
lib = path.join(path.dirname(fs.readlinkSync(__filename)), '../lib');
} else {
lib = path.join(__dirname, '../lib');
var potentialPaths = [
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffeescript'),
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffee-script'),
path.join(process.cwd(), 'node_modules/coffee-script/lib/coffee-script'),
path.join(__dirname, '../lib/coffeescript')
];
for (var i = 0, len = potentialPaths.length; i < len; i++) {
if (fs.existsSync(potentialPaths[i])) {
require(potentialPaths[i] + '/command').run();
break;
}
}
require.paths.unshift(lib);
require('command_line').run();

19
bower.json Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "coffeescript",
"main": [
"lib/coffeescript/browser.js"
],
"description": "Unfancy JavaScript",
"keywords": [
"javascript",
"language",
"coffeescript",
"compiler"
],
"author": {
"name": "Jeremy Ashkenas"
},
"ignore": [
"test"
]
}

1
docs/CNAME Normal file
View File

@@ -0,0 +1 @@
coffeescript.org

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

9
docs/browserconfig.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

BIN
docs/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

BIN
docs/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
docs/index.html Symbolic link
View File

@@ -0,0 +1 @@
v1/index.html

17
docs/manifest.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "",
"icons": [
{
"src": "\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png"
},
{
"src": "\/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image\/png"
}
],
"theme_color": "#ffffff",
"display": "standalone"
}

BIN
docs/mstile-150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="916.000000pt" height="916.000000pt" viewBox="0 0 916.000000 916.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.11, written by Peter Selinger 2001-2013
</metadata>
<g transform="translate(0.000000,916.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M5555 8253 c-199 -8 -487 -49 -670 -94 -283 -70 -464 -155 -829 -387
-307 -196 -461 -259 -721 -297 -134 -20 -345 -19 -442 1 -160 33 -243 104
-243 208 0 59 38 103 118 139 159 72 516 78 707 11 l70 -24 40 28 c94 66 62
162 -73 213 -90 34 -196 48 -352 48 -404 1 -684 -104 -767 -286 -22 -48 -25
-65 -21 -138 8 -147 86 -267 241 -368 192 -125 402 -184 702 -194 248 -9 474
23 699 99 148 50 244 94 565 262 375 197 551 266 806 319 207 43 297 52 535
51 194 0 238 -3 319 -22 199 -46 311 -131 311 -235 0 -125 -160 -221 -435
-262 -333 -50 -606 26 -685 191 -25 50 -31 52 -128 29 -258 -61 -317 -257
-117 -390 157 -104 371 -149 700 -149 539 1 944 133 1084 352 108 171 68 386
-105 557 -195 192 -518 305 -959 335 -143 9 -193 10 -350 3z"/>
<path d="M1095 7556 c-323 -132 -512 -261 -576 -391 -35 -73 -33 -161 5 -235
139 -267 715 -511 1644 -696 1114 -222 2726 -285 4162 -163 584 49 1082 129
1590 255 590 146 1001 330 1155 518 135 165 92 351 -120 513 -68 52 -250 153
-276 153 -7 0 1 -15 18 -32 74 -77 93 -189 48 -286 -88 -189 -401 -351 -950
-491 -589 -149 -1176 -233 -2060 -293 -302 -21 -1490 -17 -1815 5 -988 68
-1692 183 -2240 366 -363 122 -575 252 -646 397 -58 118 -25 250 88 357 34 31
59 57 57 57 -2 -1 -40 -16 -84 -34z"/>
<path d="M554 6215 c42 -244 59 -335 76 -415 53 -243 141 -560 215 -779 19
-58 35 -108 35 -112 0 -4 -43 -38 -97 -75 -176 -126 -380 -340 -500 -527 -113
-176 -202 -394 -245 -602 -20 -96 -23 -139 -23 -330 0 -198 3 -229 24 -315 47
-189 122 -347 237 -500 235 -313 529 -501 879 -560 109 -19 341 -14 475 9 106
18 460 129 484 152 6 5 -15 9 -50 9 -158 0 -384 62 -556 152 -224 117 -495
354 -622 546 -119 178 -177 338 -216 592 -62 402 38 761 288 1030 l60 65 22
-50 c175 -407 322 -695 457 -894 59 -86 238 -340 398 -566 414 -584 421 -593
471 -701 97 -210 179 -432 220 -599 19 -80 58 -137 172 -252 180 -182 363
-282 727 -398 303 -96 462 -132 770 -177 128 -18 1029 -18 1175 0 304 39 499
81 780 169 266 83 422 160 600 294 77 58 207 185 257 251 15 20 35 38 43 41
10 2 21 34 33 93 37 180 111 402 199 595 23 50 146 230 360 530 518 724 597
846 743 1142 270 549 475 1133 614 1752 45 203 92 447 88 452 -2 2 -22 -19
-45 -46 -153 -181 -518 -355 -1007 -479 -1503 -383 -3714 -462 -5485 -196
-390 58 -751 129 -988 195 -511 141 -861 305 -1025 482 -46 50 -48 51 -43 22z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,299 @@
<!DOCTYPE html>
<html>
<head>
<title>browser.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>browser.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>This <strong>Browser</strong> compatibility layer extends core CoffeeScript functions
to make things work smoothly when compiling code directly in the browser.
We add support for loading remote Coffee scripts via <strong>XHR</strong>, and
<code>text/coffeescript</code> script tags, source maps via data-URLs, and so on.</p>
</div>
<div class="content"><div class='highlight'><pre>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span>
CoffeeScript.<span class="hljs-built_in">require</span> = <span class="hljs-built_in">require</span>
compile = CoffeeScript.compile</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Use standard JavaScript <code>eval</code> to eval code.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.eval = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.bare ?= <span class="hljs-literal">on</span>
eval compile code, options</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Running code does not provide access to this scope.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.run = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.bare = <span class="hljs-literal">on</span>
options.shiftLine = <span class="hljs-literal">on</span>
Function(compile code, options)()</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>If were not in a browser environment, were finished with the public API.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-built_in">window</span>?</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Include source maps where possible. If weve got a base64 encoder, a
JSON serializer, and tools for escaping unicode characters, were good to go.
Ported from <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa">https://developer.mozilla.org/en-US/docs/DOM/window.btoa</a></p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> btoa? <span class="hljs-keyword">and</span> JSON?
<span class="hljs-function"> <span class="hljs-title">compile</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.inlineMap = <span class="hljs-literal">true</span>
CoffeeScript.compile code, options</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Load a remote script from the current domain via XHR.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.load = <span class="hljs-function"><span class="hljs-params">(url, callback, options = {}, hold = <span class="hljs-literal">false</span>)</span> -&gt;</span>
options.sourceFiles = [url]
xhr = <span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>.ActiveXObject
<span class="hljs-keyword">new</span> <span class="hljs-built_in">window</span>.ActiveXObject(<span class="hljs-string">'Microsoft.XMLHTTP'</span>)
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">new</span> <span class="hljs-built_in">window</span>.XMLHttpRequest()
xhr.open <span class="hljs-string">'GET'</span>, url, <span class="hljs-literal">true</span>
xhr.overrideMimeType <span class="hljs-string">'text/plain'</span> <span class="hljs-keyword">if</span> <span class="hljs-string">'overrideMimeType'</span> <span class="hljs-keyword">of</span> xhr
xhr.onreadystatechange = <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">if</span> xhr.readyState <span class="hljs-keyword">is</span> <span class="hljs-number">4</span>
<span class="hljs-keyword">if</span> xhr.status <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">200</span>]
param = [xhr.responseText, options]
CoffeeScript.run param... <span class="hljs-keyword">unless</span> hold
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Could not load <span class="hljs-subst">#{url}</span>"</span>
callback param <span class="hljs-keyword">if</span> callback
xhr.send <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Activate CoffeeScript in the browser by having it compile and evaluate
all script tags with a content-type of <code>text/coffeescript</code>.
This happens on page load.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">runScripts</span> = -&gt;</span>
scripts = <span class="hljs-built_in">window</span>.<span class="hljs-built_in">document</span>.getElementsByTagName <span class="hljs-string">'script'</span>
coffeetypes = [<span class="hljs-string">'text/coffeescript'</span>, <span class="hljs-string">'text/literate-coffeescript'</span>]
coffees = (s <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> scripts <span class="hljs-keyword">when</span> s.type <span class="hljs-keyword">in</span> coffeetypes)
index = <span class="hljs-number">0</span>
<span class="hljs-function">
<span class="hljs-title">execute</span> = -&gt;</span>
param = coffees[index]
<span class="hljs-keyword">if</span> param <span class="hljs-keyword">instanceof</span> Array
CoffeeScript.run param...
index++
execute()
<span class="hljs-keyword">for</span> script, i <span class="hljs-keyword">in</span> coffees
<span class="hljs-keyword">do</span> (script, i) -&gt;
options = literate: script.type <span class="hljs-keyword">is</span> coffeetypes[<span class="hljs-number">1</span>]
source = script.src <span class="hljs-keyword">or</span> script.getAttribute(<span class="hljs-string">'data-src'</span>)
<span class="hljs-keyword">if</span> source
CoffeeScript.load source,
<span class="hljs-function"><span class="hljs-params">(param)</span> -&gt;</span>
coffees[i] = param
execute()
options
<span class="hljs-literal">true</span>
<span class="hljs-keyword">else</span>
options.sourceFiles = [<span class="hljs-string">'embedded'</span>]
coffees[i] = [script.innerHTML, options]
execute()</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Listen for window load, both in decent browsers and in IE.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>.addEventListener
<span class="hljs-built_in">window</span>.addEventListener <span class="hljs-string">'DOMContentLoaded'</span>, runScripts, <span class="hljs-literal">no</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">window</span>.attachEvent <span class="hljs-string">'onload'</span>, runScripts</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,345 @@
<!DOCTYPE html>
<html>
<head>
<title>cake.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>cake.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p><code>cake</code> is a simplified version of <a href="http://www.gnu.org/software/make/">Make</a>
(<a href="http://rake.rubyforge.org/">Rake</a>, <a href="https://github.com/280north/jake">Jake</a>)
for CoffeeScript. You define tasks with names and descriptions in a Cakefile,
and can call them from the command line, or invoke them from other tasks.</p>
<p>Running <code>cake</code> with no arguments will print out a list of all the tasks in the
current directorys Cakefile.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>External dependencies.</p>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
optparse = <span class="hljs-built_in">require</span> <span class="hljs-string">'./optparse'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Register .coffee extension</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.register()</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Keep track of the list of defined tasks, the accepted options, and so on.</p>
</div>
<div class="content"><div class='highlight'><pre>tasks = {}
options = {}
switches = []
oparse = <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Mixin the top-level Cake functions for Cakefiles to use directly.</p>
</div>
<div class="content"><div class='highlight'><pre>helpers.extend <span class="hljs-built_in">global</span>,</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Define a Cake task with a short name, an optional sentence description,
and the function to run as the action itself.</p>
</div>
<div class="content"><div class='highlight'><pre> task: <span class="hljs-function"><span class="hljs-params">(name, description, action)</span> -&gt;</span>
[action, description] = [description, action] <span class="hljs-keyword">unless</span> action
tasks[name] = {name, description, action}</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Define an option that the Cakefile accepts. The parsed options hash,
containing all of the command-line options passed, will be made available
as the first argument to the action.</p>
</div>
<div class="content"><div class='highlight'><pre> option: <span class="hljs-function"><span class="hljs-params">(letter, flag, description)</span> -&gt;</span>
switches.push [letter, flag, description]</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Invoke another task in the current Cakefile.</p>
</div>
<div class="content"><div class='highlight'><pre> invoke: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
missingTask name <span class="hljs-keyword">unless</span> tasks[name]
tasks[name].action options</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Run <code>cake</code>. Executes all of the tasks you pass, in order. Note that Nodes
asynchrony may cause tasks to execute in a different order than youd expect.
If no tasks are passed, print the help screen. Keep a reference to the
original directory name, when running Cake tasks from subdirectories.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-&gt;</span>
<span class="hljs-built_in">global</span>.__originalDirname = fs.realpathSync <span class="hljs-string">'.'</span>
process.chdir cakefileDirectory __originalDirname
args = process.argv[<span class="hljs-number">2.</span>.]
CoffeeScript.run fs.readFileSync(<span class="hljs-string">'Cakefile'</span>).toString(), filename: <span class="hljs-string">'Cakefile'</span>
oparse = <span class="hljs-keyword">new</span> optparse.OptionParser switches
<span class="hljs-keyword">return</span> printTasks() <span class="hljs-keyword">unless</span> args.length
<span class="hljs-keyword">try</span>
options = oparse.parse(args)
<span class="hljs-keyword">catch</span> e
<span class="hljs-keyword">return</span> fatalError <span class="hljs-string">"<span class="hljs-subst">#{e}</span>"</span>
invoke arg <span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> options.arguments</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">printTasks</span> = -&gt;</span>
relative = path.relative <span class="hljs-keyword">or</span> path.resolve
cakefilePath = path.join relative(__originalDirname, process.cwd()), <span class="hljs-string">'Cakefile'</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"<span class="hljs-subst">#{cakefilePath}</span> defines the following tasks:\n"</span>
<span class="hljs-keyword">for</span> name, task <span class="hljs-keyword">of</span> tasks
spaces = <span class="hljs-number">20</span> - name.length
spaces = <span class="hljs-keyword">if</span> spaces &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> Array(spaces + <span class="hljs-number">1</span>).join(<span class="hljs-string">' '</span>) <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
desc = <span class="hljs-keyword">if</span> task.description <span class="hljs-keyword">then</span> <span class="hljs-string">"# <span class="hljs-subst">#{task.description}</span>"</span> <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"cake <span class="hljs-subst">#{name}</span><span class="hljs-subst">#{spaces}</span> <span class="hljs-subst">#{desc}</span>"</span>
<span class="hljs-built_in">console</span>.log oparse.help() <span class="hljs-keyword">if</span> switches.length</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Print an error and exit when attempting to use an invalid task/option.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">fatalError</span> = <span class="hljs-params">(message)</span> -&gt;</span>
<span class="hljs-built_in">console</span>.error message + <span class="hljs-string">'\n'</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">'To see a list of all tasks/options, run "cake"'</span>
process.exit <span class="hljs-number">1</span>
<span class="hljs-function">
<span class="hljs-title">missingTask</span> = <span class="hljs-params">(task)</span> -&gt;</span> fatalError <span class="hljs-string">"No such task: <span class="hljs-subst">#{task}</span>"</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>When <code>cake</code> is invoked, search in the current and all parent directories
to find the relevant Cakefile.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">cakefileDirectory</span> = <span class="hljs-params">(dir)</span> -&gt;</span>
<span class="hljs-keyword">return</span> dir <span class="hljs-keyword">if</span> fs.existsSync path.join dir, <span class="hljs-string">'Cakefile'</span>
parent = path.normalize path.join dir, <span class="hljs-string">'..'</span>
<span class="hljs-keyword">return</span> cakefileDirectory parent <span class="hljs-keyword">unless</span> parent <span class="hljs-keyword">is</span> dir
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Cakefile not found in <span class="hljs-subst">#{process.cwd()}</span>"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,982 @@
<!DOCTYPE html>
<html>
<head>
<title>coffee-script.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>coffee-script.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>CoffeeScript can be used both on the server, as a command-line compiler based
on Node.js/V8, or to run CoffeeScript directly in the browser. This module
contains the main entry functions for tokenizing, parsing, and compiling
source CoffeeScript into JavaScript.</p>
</div>
<div class="content"><div class='highlight'><pre>
fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
vm = <span class="hljs-built_in">require</span> <span class="hljs-string">'vm'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
{Lexer} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./lexer'</span>
{parser} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./parser'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-string">'./sourcemap'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Require <code>package.json</code>, which is two levels above this file, as this file is
evaluated from <code>lib/coffee-script</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>packageJson = <span class="hljs-built_in">require</span> <span class="hljs-string">'../../package.json'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>The current CoffeeScript version number.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.VERSION = packageJson.version
exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Expose helpers for testing.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.helpers = helpers</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Function that allows for btoa in both nodejs and the browser.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">base64encode</span> = <span class="hljs-params">(src)</span> -&gt;</span> <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> <span class="hljs-keyword">typeof</span> Buffer <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
<span class="hljs-keyword">new</span> Buffer(src).toString(<span class="hljs-string">'base64'</span>)
<span class="hljs-keyword">when</span> <span class="hljs-keyword">typeof</span> btoa <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>The contents of a <code>&lt;script&gt;</code> block are encoded via UTF-16, so if any extended
characters are used in the block, btoa will fail as it maxes out at UTF-8.
See <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem">https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem</a>
for the gory details, and for the solution implemented here.</p>
</div>
<div class="content"><div class='highlight'><pre> btoa encodeURIComponent(src).replace <span class="hljs-regexp">/%([0-9A-F]{2})/g</span>, <span class="hljs-function"><span class="hljs-params">(match, p1)</span> -&gt;</span>
String.fromCharCode <span class="hljs-string">'0x'</span> + p1
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error(<span class="hljs-string">'Unable to base64 encode inline sourcemap.'</span>)</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Function wrapper to add source file information to SyntaxErrors thrown by the
lexer/parser/compiler.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">withPrettyErrors</span> = <span class="hljs-params">(fn)</span> -&gt;</span>
(code, options = {}) -&gt;
<span class="hljs-keyword">try</span>
fn.call @, code, options
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'string'</span> <span class="hljs-comment"># Support `CoffeeScript.nodes(tokens)`.</span>
<span class="hljs-keyword">throw</span> helpers.updateSyntaxError err, code, options.filename</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>For each compiled file, save its source in memory in case we need to
recompile it later. We might need to recompile if the first compilation
didnt create a source map (faster) but something went wrong and we need
a stack trace. Assuming that most of the time, code isnt throwing
exceptions, its probably more efficient to compile twice only when we
need a stack trace, rather than always generating a source map even when
its not likely to be used. Save in form of <code>filename</code>: <code>(source)</code></p>
</div>
<div class="content"><div class='highlight'><pre>sources = {}</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Also save source maps if generated, in form of <code>filename</code>: <code>(source map)</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>sourceMaps = {}</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Compile CoffeeScript code to JavaScript, using the Coffee/Jison compiler.</p>
<p>If <code>options.sourceMap</code> is specified, then <code>options.filename</code> must also be
specified. All options that can be passed to <code>SourceMap#generate</code> may also
be passed here.</p>
<p>This returns a javascript string, unless <code>options.sourceMap</code> is passed,
in which case this returns a <code>{js, v3SourceMap, sourceMap}</code>
object, where sourceMap is a sourcemap.coffee#SourceMap object, handy for
doing programmatic lookups.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.compile = compile = withPrettyErrors (code, options) -&gt;
{merge, extend} = helpers
options = extend {}, options</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Always generate a source map if no filename is passed in, since without a
a filename we have no way to retrieve this source later in the event that
we need to recompile it to get a source map for <code>prepareStackTrace</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> generateSourceMap = options.sourceMap <span class="hljs-keyword">or</span> options.inlineMap <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> options.filename?
filename = options.filename <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>
sources[filename] = code
map = <span class="hljs-keyword">new</span> SourceMap <span class="hljs-keyword">if</span> generateSourceMap
tokens = lexer.tokenize code, options</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Pass a list of referenced variables, so that generated variables wont get
the same name.</p>
</div>
<div class="content"><div class='highlight'><pre> options.referencedVars = (
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>
)</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Check for import or export; if found, force bare mode.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> options.bare? <span class="hljs-keyword">and</span> options.bare <span class="hljs-keyword">is</span> <span class="hljs-literal">yes</span>
<span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens
<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'IMPORT'</span>, <span class="hljs-string">'EXPORT'</span>]
options.bare = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">break</span>
fragments = parser.parse(tokens).compileToFragments options
currentLine = <span class="hljs-number">0</span>
currentLine += <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> options.header
currentLine += <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> options.shiftLine
currentColumn = <span class="hljs-number">0</span>
js = <span class="hljs-string">""</span>
<span class="hljs-keyword">for</span> fragment <span class="hljs-keyword">in</span> fragments</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Update the sourcemap with data from each fragment.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> generateSourceMap</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Do not include empty, whitespace, or semicolon-only fragments.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> fragment.locationData <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-regexp">/^[;\s]*$/</span>.test fragment.code
map.add(
[fragment.locationData.first_line, fragment.locationData.first_column]
[currentLine, currentColumn]
{noReplace: <span class="hljs-literal">true</span>})
newLines = helpers.count fragment.code, <span class="hljs-string">"\n"</span>
currentLine += newLines
<span class="hljs-keyword">if</span> newLines
currentColumn = fragment.code.length - (fragment.code.lastIndexOf(<span class="hljs-string">"\n"</span>) + <span class="hljs-number">1</span>)
<span class="hljs-keyword">else</span>
currentColumn += fragment.code.length</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Copy the code from each fragment into the final JavaScript.</p>
</div>
<div class="content"><div class='highlight'><pre> js += fragment.code
<span class="hljs-keyword">if</span> options.header
header = <span class="hljs-string">"Generated by CoffeeScript <span class="hljs-subst">#{@VERSION}</span>"</span>
js = <span class="hljs-string">"// <span class="hljs-subst">#{header}</span>\n<span class="hljs-subst">#{js}</span>"</span>
<span class="hljs-keyword">if</span> generateSourceMap
v3SourceMap = map.generate(options, code)
sourceMaps[filename] = map
<span class="hljs-keyword">if</span> options.inlineMap
encoded = base64encode JSON.stringify v3SourceMap
sourceMapDataURI = <span class="hljs-string">"//# sourceMappingURL=data:application/json;base64,<span class="hljs-subst">#{encoded}</span>"</span>
sourceURL = <span class="hljs-string">"//# sourceURL=<span class="hljs-subst">#{options.filename ? <span class="hljs-string">'coffeescript'</span>}</span>"</span>
js = <span class="hljs-string">"<span class="hljs-subst">#{js}</span>\n<span class="hljs-subst">#{sourceMapDataURI}</span>\n<span class="hljs-subst">#{sourceURL}</span>"</span>
<span class="hljs-keyword">if</span> options.sourceMap
{
js
sourceMap: map
v3SourceMap: JSON.stringify v3SourceMap, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>
}
<span class="hljs-keyword">else</span>
js</pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.tokens = withPrettyErrors (code, options) -&gt;
lexer.tokenize code, options</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Parse a string of CoffeeScript code or an array of lexed tokens, and
return the AST. You can then compile it by calling <code>.compile()</code> on the root,
or traverse it by using <code>.traverseChildren()</code> with a callback.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.nodes = withPrettyErrors (source, options) -&gt;
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> source <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span>
parser.parse lexer.tokenize source, options
<span class="hljs-keyword">else</span>
parser.parse source</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Compile and execute a string of CoffeeScript (on the server), correctly
setting <code>__filename</code>, <code>__dirname</code>, and relative <code>require()</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
mainModule = <span class="hljs-built_in">require</span>.main</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Set the filename.</p>
</div>
<div class="content"><div class='highlight'><pre> mainModule.filename = process.argv[<span class="hljs-number">1</span>] =
<span class="hljs-keyword">if</span> options.filename <span class="hljs-keyword">then</span> fs.realpathSync(options.filename) <span class="hljs-keyword">else</span> <span class="hljs-string">'&lt;anonymous&gt;'</span></pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Clear the module cache.</p>
</div>
<div class="content"><div class='highlight'><pre> mainModule.moduleCache <span class="hljs-keyword">and</span>= {}</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Assign paths for node_modules loading</p>
</div>
<div class="content"><div class='highlight'><pre> dir = <span class="hljs-keyword">if</span> options.filename?
path.dirname fs.realpathSync options.filename
<span class="hljs-keyword">else</span>
fs.realpathSync <span class="hljs-string">'.'</span>
mainModule.paths = <span class="hljs-built_in">require</span>(<span class="hljs-string">'module'</span>)._nodeModulePaths dir</pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Compile.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> helpers.isCoffee(mainModule.filename) <span class="hljs-keyword">or</span> <span class="hljs-built_in">require</span>.extensions
answer = compile code, options
code = answer.js ? answer
mainModule._compile code, mainModule.filename</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
The CoffeeScript REPL uses this to run the input.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.eval = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> code = code.trim()
createContext = vm.Script.createContext ? vm.createContext
isContext = vm.isContext ? (ctx) -&gt;
options.sandbox <span class="hljs-keyword">instanceof</span> createContext().constructor
<span class="hljs-keyword">if</span> createContext
<span class="hljs-keyword">if</span> options.sandbox?
<span class="hljs-keyword">if</span> isContext options.sandbox
sandbox = options.sandbox
<span class="hljs-keyword">else</span>
sandbox = createContext()
sandbox[k] = v <span class="hljs-keyword">for</span> own k, v <span class="hljs-keyword">of</span> options.sandbox
sandbox.<span class="hljs-built_in">global</span> = sandbox.root = sandbox.GLOBAL = sandbox
<span class="hljs-keyword">else</span>
sandbox = <span class="hljs-built_in">global</span>
sandbox.__filename = options.filename || <span class="hljs-string">'eval'</span>
sandbox.__dirname = path.dirname sandbox.__filename</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>define module/require only if they chose not to specify their own</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> sandbox <span class="hljs-keyword">isnt</span> <span class="hljs-built_in">global</span> <span class="hljs-keyword">or</span> sandbox.<span class="hljs-built_in">module</span> <span class="hljs-keyword">or</span> sandbox.<span class="hljs-built_in">require</span>
Module = <span class="hljs-built_in">require</span> <span class="hljs-string">'module'</span>
sandbox.<span class="hljs-built_in">module</span> = _module = <span class="hljs-keyword">new</span> Module(options.modulename || <span class="hljs-string">'eval'</span>)
sandbox.<span class="hljs-built_in">require</span> = _require = <span class="hljs-function"><span class="hljs-params">(path)</span> -&gt;</span> Module._load path, _module, <span class="hljs-literal">true</span>
_module.filename = sandbox.__filename
<span class="hljs-keyword">for</span> r <span class="hljs-keyword">in</span> Object.getOwnPropertyNames <span class="hljs-built_in">require</span> <span class="hljs-keyword">when</span> r <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> [<span class="hljs-string">'paths'</span>, <span class="hljs-string">'arguments'</span>, <span class="hljs-string">'caller'</span>]
_require[r] = <span class="hljs-built_in">require</span>[r]</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>use the same hack node currently uses for their own REPL</p>
</div>
<div class="content"><div class='highlight'><pre> _require.paths = _module.paths = Module._nodeModulePaths process.cwd()
_require.resolve = <span class="hljs-function"><span class="hljs-params">(request)</span> -&gt;</span> Module._resolveFilename request, _module
o = {}
o[k] = v <span class="hljs-keyword">for</span> own k, v <span class="hljs-keyword">of</span> options
o.bare = <span class="hljs-literal">on</span> <span class="hljs-comment"># ensure return value</span>
js = compile code, o
<span class="hljs-keyword">if</span> sandbox <span class="hljs-keyword">is</span> <span class="hljs-built_in">global</span>
vm.runInThisContext js
<span class="hljs-keyword">else</span>
vm.runInContext js, sandbox
exports.register = <span class="hljs-function">-&gt;</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./register'</span></pre></div></div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
</div>
<p>Throw error with deprecation warning when depending upon implicit <code>require.extensions</code> registration</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.extensions
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> @FILE_EXTENSIONS <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span> (ext) -&gt;
<span class="hljs-built_in">require</span>.extensions[ext] ?= <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"""
Use CoffeeScript.register() or require the coffee-script/register module to require <span class="hljs-subst">#{ext}</span> files.
"""</span>
exports._compileFile = <span class="hljs-function"><span class="hljs-params">(filename, sourceMap = <span class="hljs-literal">no</span>, inlineMap = <span class="hljs-literal">no</span>)</span> -&gt;</span>
raw = fs.readFileSync filename, <span class="hljs-string">'utf8'</span></pre></div></div>
</li>
<li id="section-28">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">&#182;</a>
</div>
<p>Strip the Unicode byte order mark, if this file begins with one.</p>
</div>
<div class="content"><div class='highlight'><pre> stripped = <span class="hljs-keyword">if</span> raw.charCodeAt(<span class="hljs-number">0</span>) <span class="hljs-keyword">is</span> <span class="hljs-number">0xFEFF</span> <span class="hljs-keyword">then</span> raw.substring <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> raw
<span class="hljs-keyword">try</span>
answer = compile stripped, {
filename, sourceMap, inlineMap
sourceFiles: [filename]
literate: helpers.isLiterate filename
}
<span class="hljs-keyword">catch</span> err</pre></div></div>
</li>
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
</div>
<p>As the filename and code of a dynamically loaded file will be different
from the original file compiled with CoffeeScript.run, add that
information to error so it can be pretty-printed later.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">throw</span> helpers.updateSyntaxError err, stripped, filename
answer</pre></div></div>
</li>
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">&#182;</a>
</div>
<p>Instantiate a Lexer for our use here.</p>
</div>
<div class="content"><div class='highlight'><pre>lexer = <span class="hljs-keyword">new</span> Lexer</pre></div></div>
</li>
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-31">&#182;</a>
</div>
<p>The real Lexer produces a generic stream of tokens. This object provides a
thin wrapper around it, compatible with the Jison API. We can then pass it
directly as a “Jison lexer”.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.lexer =
lex: <span class="hljs-function">-&gt;</span>
token = parser.tokens[@pos++]
<span class="hljs-keyword">if</span> token
[tag, @yytext, @yylloc] = token
parser.errorToken = token.origin <span class="hljs-keyword">or</span> token
@yylineno = @yylloc.first_line
<span class="hljs-keyword">else</span>
tag = <span class="hljs-string">''</span>
tag
setInput: <span class="hljs-function"><span class="hljs-params">(tokens)</span> -&gt;</span>
parser.tokens = tokens
@pos = <span class="hljs-number">0</span>
upcomingInput: <span class="hljs-function">-&gt;</span>
<span class="hljs-string">""</span></pre></div></div>
</li>
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-32">&#182;</a>
</div>
<p>Make all the AST nodes visible to the parser.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.yy = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span></pre></div></div>
</li>
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-33">&#182;</a>
</div>
<p>Override Jisons default error handling function.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.yy.parseError = <span class="hljs-function"><span class="hljs-params">(message, {token})</span> -&gt;</span></pre></div></div>
</li>
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-34">&#182;</a>
</div>
<p>Disregard Jisons message, it contains redundant line number information.
Disregard the token, we take its value directly from the lexer in case
the error is caused by a generated token which might refer to its origin.</p>
</div>
<div class="content"><div class='highlight'><pre> {errorToken, tokens} = parser
[errorTag, errorText, errorLoc] = errorToken
errorText = <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> errorToken <span class="hljs-keyword">is</span> tokens[tokens.length - <span class="hljs-number">1</span>]
<span class="hljs-string">'end of input'</span>
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'INDENT'</span>, <span class="hljs-string">'OUTDENT'</span>]
<span class="hljs-string">'indentation'</span>
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'NUMBER'</span>, <span class="hljs-string">'INFINITY'</span>, <span class="hljs-string">'STRING'</span>, <span class="hljs-string">'STRING_START'</span>, <span class="hljs-string">'REGEX'</span>, <span class="hljs-string">'REGEX_START'</span>]
errorTag.replace(<span class="hljs-regexp">/_START$/</span>, <span class="hljs-string">''</span>).toLowerCase()
<span class="hljs-keyword">else</span>
helpers.nameWhitespaceCharacter errorText</pre></div></div>
</li>
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-35">&#182;</a>
</div>
<p>The second argument has a <code>loc</code> property, which should have the location
data for this token. Unfortunately, Jison seems to send an outdated <code>loc</code>
(from the previous token), so we take the location information directly
from the lexer.</p>
</div>
<div class="content"><div class='highlight'><pre> helpers.throwSyntaxError <span class="hljs-string">"unexpected <span class="hljs-subst">#{errorText}</span>"</span>, errorLoc</pre></div></div>
</li>
<li id="section-36">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-36">&#182;</a>
</div>
<p>Based on <a href="http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js">http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js</a>
Modified to handle sourceMap</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">formatSourcePosition</span> = <span class="hljs-params">(frame, getSourceMapping)</span> -&gt;</span>
filename = <span class="hljs-literal">undefined</span>
fileLocation = <span class="hljs-string">''</span>
<span class="hljs-keyword">if</span> frame.isNative()
fileLocation = <span class="hljs-string">"native"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">if</span> frame.isEval()
filename = frame.getScriptNameOrSourceURL()
fileLocation = <span class="hljs-string">"<span class="hljs-subst">#{frame.getEvalOrigin()}</span>, "</span> <span class="hljs-keyword">unless</span> filename
<span class="hljs-keyword">else</span>
filename = frame.getFileName()
filename <span class="hljs-keyword">or</span>= <span class="hljs-string">"&lt;anonymous&gt;"</span>
line = frame.getLineNumber()
column = frame.getColumnNumber()</pre></div></div>
</li>
<li id="section-37">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">&#182;</a>
</div>
<p>Check for a sourceMap position</p>
</div>
<div class="content"><div class='highlight'><pre> source = getSourceMapping filename, line, column
fileLocation =
<span class="hljs-keyword">if</span> source
<span class="hljs-string">"<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{source[<span class="hljs-number">0</span>]}</span>:<span class="hljs-subst">#{source[<span class="hljs-number">1</span>]}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{line}</span>:<span class="hljs-subst">#{column}</span>"</span>
functionName = frame.getFunctionName()
isConstructor = frame.isConstructor()
isMethodCall = <span class="hljs-keyword">not</span> (frame.isToplevel() <span class="hljs-keyword">or</span> isConstructor)
<span class="hljs-keyword">if</span> isMethodCall
methodName = frame.getMethodName()
typeName = frame.getTypeName()
<span class="hljs-keyword">if</span> functionName
tp = <span class="hljs-keyword">as</span> = <span class="hljs-string">''</span>
<span class="hljs-keyword">if</span> typeName <span class="hljs-keyword">and</span> functionName.indexOf typeName
tp = <span class="hljs-string">"<span class="hljs-subst">#{typeName}</span>."</span>
<span class="hljs-keyword">if</span> methodName <span class="hljs-keyword">and</span> functionName.indexOf(<span class="hljs-string">".<span class="hljs-subst">#{methodName}</span>"</span>) <span class="hljs-keyword">isnt</span> functionName.length - methodName.length - <span class="hljs-number">1</span>
<span class="hljs-keyword">as</span> = <span class="hljs-string">" [as <span class="hljs-subst">#{methodName}</span>]"</span>
<span class="hljs-string">"<span class="hljs-subst">#{tp}</span><span class="hljs-subst">#{functionName}</span><span class="hljs-subst">#{<span class="hljs-keyword">as</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{typeName}</span>.<span class="hljs-subst">#{methodName <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> isConstructor
<span class="hljs-string">"new <span class="hljs-subst">#{functionName <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> functionName
<span class="hljs-string">"<span class="hljs-subst">#{functionName}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span>
fileLocation
<span class="hljs-function">
<span class="hljs-title">getSourceMap</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
<span class="hljs-keyword">if</span> sourceMaps[filename]?
sourceMaps[filename]</pre></div></div>
</li>
<li id="section-38">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-38">&#182;</a>
</div>
<p>CoffeeScript compiled in a browser may get compiled with <code>options.filename</code>
of <code>&lt;anonymous&gt;</code>, but the browser may request the stack trace with the
filename of the script file.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sourceMaps[<span class="hljs-string">'&lt;anonymous&gt;'</span>]?
sourceMaps[<span class="hljs-string">'&lt;anonymous&gt;'</span>]
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sources[filename]?
answer = compile sources[filename],
filename: filename
sourceMap: <span class="hljs-literal">yes</span>
literate: helpers.isLiterate filename
answer.sourceMap
<span class="hljs-keyword">else</span>
<span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-39">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-39">&#182;</a>
</div>
<p>Based on <a href="http://goo.gl/ZTx1p">michaelficarra/CoffeeScriptRedux</a>
NodeJS / V8 have no support for transforming positions in stack traces using
sourceMap, so we must monkey-patch Error to display CoffeeScript source
positions.</p>
</div>
<div class="content"><div class='highlight'><pre>Error.prepareStackTrace = <span class="hljs-function"><span class="hljs-params">(err, stack)</span> -&gt;</span>
<span class="hljs-function"> <span class="hljs-title">getSourceMapping</span> = <span class="hljs-params">(filename, line, column)</span> -&gt;</span>
sourceMap = getSourceMap filename
answer = sourceMap.sourceLocation [line - <span class="hljs-number">1</span>, column - <span class="hljs-number">1</span>] <span class="hljs-keyword">if</span> sourceMap?
<span class="hljs-keyword">if</span> answer? <span class="hljs-keyword">then</span> [answer[<span class="hljs-number">0</span>] + <span class="hljs-number">1</span>, answer[<span class="hljs-number">1</span>] + <span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> <span class="hljs-literal">null</span>
frames = <span class="hljs-keyword">for</span> frame <span class="hljs-keyword">in</span> stack
<span class="hljs-keyword">break</span> <span class="hljs-keyword">if</span> frame.getFunction() <span class="hljs-keyword">is</span> exports.run
<span class="hljs-string">" at <span class="hljs-subst">#{formatSourcePosition frame, getSourceMapping}</span>"</span>
<span class="hljs-string">"<span class="hljs-subst">#{err.toString()}</span>\n<span class="hljs-subst">#{frames.join <span class="hljs-string">'\n'</span>}</span>\n"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,882 @@
<!DOCTYPE html>
<html>
<head>
<title>command.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>command.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>The <code>coffee</code> utility. Handles command-line compilation of CoffeeScript
into various forms: saved into <code>.js</code> files or printed to stdout
or recompiled every time the source is saved,
printed as a token stream or as the syntax tree, or launch an
interactive REPL.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>External dependencies.</p>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
optparse = <span class="hljs-built_in">require</span> <span class="hljs-string">'./optparse'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span>
{spawn, exec} = <span class="hljs-built_in">require</span> <span class="hljs-string">'child_process'</span>
{EventEmitter} = <span class="hljs-built_in">require</span> <span class="hljs-string">'events'</span>
useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs-string">'\\'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Allow CoffeeScript to emit Node.js events.</p>
</div>
<div class="content"><div class='highlight'><pre>helpers.extend CoffeeScript, <span class="hljs-keyword">new</span> EventEmitter
<span class="hljs-function">
<span class="hljs-title">printLine</span> = <span class="hljs-params">(line)</span> -&gt;</span> process.stdout.write line + <span class="hljs-string">'\n'</span>
<span class="hljs-function"><span class="hljs-title">printWarn</span> = <span class="hljs-params">(line)</span> -&gt;</span> process.stderr.write line + <span class="hljs-string">'\n'</span>
<span class="hljs-function">
<span class="hljs-title">hidden</span> = <span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/^\.|~$/</span>.test file</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>The help banner that is printed in conjunction with <code>-h</code>/<code>--help</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>BANNER = <span class="hljs-string">'''
Usage: coffee [options] path/to/script.coffee -- [args]
If called without options, `coffee` will run your script.
'''</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>The list of all the valid option flags that <code>coffee</code> knows how to handle.</p>
</div>
<div class="content"><div class='highlight'><pre>SWITCHES = [
[<span class="hljs-string">'-b'</span>, <span class="hljs-string">'--bare'</span>, <span class="hljs-string">'compile without a top-level function wrapper'</span>]
[<span class="hljs-string">'-c'</span>, <span class="hljs-string">'--compile'</span>, <span class="hljs-string">'compile to JavaScript and save as .js files'</span>]
[<span class="hljs-string">'-e'</span>, <span class="hljs-string">'--eval'</span>, <span class="hljs-string">'pass a string from the command line as input'</span>]
[<span class="hljs-string">'-h'</span>, <span class="hljs-string">'--help'</span>, <span class="hljs-string">'display this help message'</span>]
[<span class="hljs-string">'-i'</span>, <span class="hljs-string">'--interactive'</span>, <span class="hljs-string">'run an interactive CoffeeScript REPL'</span>]
[<span class="hljs-string">'-j'</span>, <span class="hljs-string">'--join [FILE]'</span>, <span class="hljs-string">'concatenate the source CoffeeScript before compiling'</span>]
[<span class="hljs-string">'-m'</span>, <span class="hljs-string">'--map'</span>, <span class="hljs-string">'generate source map and save as .js.map files'</span>]
[<span class="hljs-string">'-M'</span>, <span class="hljs-string">'--inline-map'</span>, <span class="hljs-string">'generate source map and include it directly in output'</span>]
[<span class="hljs-string">'-n'</span>, <span class="hljs-string">'--nodes'</span>, <span class="hljs-string">'print out the parse tree that the parser produces'</span>]
[ <span class="hljs-string">'--nodejs [ARGS]'</span>, <span class="hljs-string">'pass options directly to the "node" binary'</span>]
[ <span class="hljs-string">'--no-header'</span>, <span class="hljs-string">'suppress the "Generated by" header'</span>]
[<span class="hljs-string">'-o'</span>, <span class="hljs-string">'--output [DIR]'</span>, <span class="hljs-string">'set the output directory for compiled JavaScript'</span>]
[<span class="hljs-string">'-p'</span>, <span class="hljs-string">'--print'</span>, <span class="hljs-string">'print out the compiled JavaScript'</span>]
[<span class="hljs-string">'-r'</span>, <span class="hljs-string">'--require [MODULE*]'</span>, <span class="hljs-string">'require the given module before eval or REPL'</span>]
[<span class="hljs-string">'-s'</span>, <span class="hljs-string">'--stdio'</span>, <span class="hljs-string">'listen for and compile scripts over stdio'</span>]
[<span class="hljs-string">'-l'</span>, <span class="hljs-string">'--literate'</span>, <span class="hljs-string">'treat stdio as literate style coffee-script'</span>]
[<span class="hljs-string">'-t'</span>, <span class="hljs-string">'--tokens'</span>, <span class="hljs-string">'print out the tokens that the lexer/rewriter produce'</span>]
[<span class="hljs-string">'-v'</span>, <span class="hljs-string">'--version'</span>, <span class="hljs-string">'display the version number'</span>]
[<span class="hljs-string">'-w'</span>, <span class="hljs-string">'--watch'</span>, <span class="hljs-string">'watch scripts for changes and rerun commands'</span>]
]</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Top-level objects shared by all the functions.</p>
</div>
<div class="content"><div class='highlight'><pre>opts = {}
sources = []
sourceCode = []
notSources = {}
watchedDirs = {}
optionParser = <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Run <code>coffee</code> by parsing passed options and determining what action to take.
Many flags cause us to divert before compiling anything. Flags passed after
<code>--</code> will be passed verbatim to your script as arguments in <code>process.argv</code></p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-&gt;</span>
parseOptions()</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Make the REPL <em>CLI</em> use the global context so as to (a) be consistent with the
<code>node</code> REPL CLI and, therefore, (b) make packages that modify native prototypes
(such as colors and sugar) work as expected.</p>
</div>
<div class="content"><div class='highlight'><pre> replCliOpts = useGlobal: <span class="hljs-literal">yes</span>
opts.prelude = makePrelude opts.<span class="hljs-built_in">require</span> <span class="hljs-keyword">if</span> opts.<span class="hljs-built_in">require</span>
replCliOpts.prelude = opts.prelude
<span class="hljs-keyword">return</span> forkNode() <span class="hljs-keyword">if</span> opts.nodejs
<span class="hljs-keyword">return</span> usage() <span class="hljs-keyword">if</span> opts.help
<span class="hljs-keyword">return</span> version() <span class="hljs-keyword">if</span> opts.version
<span class="hljs-keyword">return</span> <span class="hljs-built_in">require</span>(<span class="hljs-string">'./repl'</span>).start(replCliOpts) <span class="hljs-keyword">if</span> opts.interactive
<span class="hljs-keyword">return</span> compileStdio() <span class="hljs-keyword">if</span> opts.stdio
<span class="hljs-keyword">return</span> compileScript <span class="hljs-literal">null</span>, opts.arguments[<span class="hljs-number">0</span>] <span class="hljs-keyword">if</span> opts.eval
<span class="hljs-keyword">return</span> <span class="hljs-built_in">require</span>(<span class="hljs-string">'./repl'</span>).start(replCliOpts) <span class="hljs-keyword">unless</span> opts.arguments.length
literals = <span class="hljs-keyword">if</span> opts.run <span class="hljs-keyword">then</span> opts.arguments.splice <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> []
process.argv = process.argv[<span class="hljs-number">0.</span><span class="hljs-number">.1</span>].concat literals
process.argv[<span class="hljs-number">0</span>] = <span class="hljs-string">'coffee'</span>
opts.output = path.resolve opts.output <span class="hljs-keyword">if</span> opts.output
<span class="hljs-keyword">if</span> opts.join
opts.join = path.resolve opts.join
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
The --join option is deprecated and will be removed in a future version.
If for some reason it's necessary to share local variables between files,
replace...
$ coffee --compile --join bundle.js -- a.coffee b.coffee c.coffee
with...
$ cat a.coffee b.coffee c.coffee | coffee --compile --stdio &gt; bundle.js
'''</span>
<span class="hljs-keyword">for</span> source <span class="hljs-keyword">in</span> opts.arguments
source = path.resolve source
compilePath source, <span class="hljs-literal">yes</span>, source
<span class="hljs-function">
<span class="hljs-title">makePrelude</span> = <span class="hljs-params">(requires)</span> -&gt;</span>
requires.map (<span class="hljs-built_in">module</span>) -&gt;
[_, name, <span class="hljs-built_in">module</span>] = match <span class="hljs-keyword">if</span> match = <span class="hljs-built_in">module</span>.match(<span class="hljs-regexp">/^(.*)=(.*)$/</span>)
name ||= helpers.baseFileName <span class="hljs-built_in">module</span>, <span class="hljs-literal">yes</span>, useWinPathSep
<span class="hljs-string">"<span class="hljs-subst">#{name}</span> = require('<span class="hljs-subst">#{<span class="hljs-built_in">module</span>}</span>')"</span>
.join <span class="hljs-string">';'</span></pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Compile a path, which could be a script or a directory. If a directory
is passed, recursively compile all .coffee, .litcoffee, and .coffee.md
extension source files in it and all subdirectories.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compilePath</span> = <span class="hljs-params">(source, topLevel, base)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> source <span class="hljs-keyword">in</span> sources <span class="hljs-keyword">or</span>
watchedDirs[source] <span class="hljs-keyword">or</span>
<span class="hljs-keyword">not</span> topLevel <span class="hljs-keyword">and</span> (notSources[source] <span class="hljs-keyword">or</span> hidden source)
<span class="hljs-keyword">try</span>
stats = fs.statSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"File not found: <span class="hljs-subst">#{source}</span>"</span>
process.exit <span class="hljs-number">1</span>
<span class="hljs-keyword">throw</span> err
<span class="hljs-keyword">if</span> stats.isDirectory()
<span class="hljs-keyword">if</span> path.basename(source) <span class="hljs-keyword">is</span> <span class="hljs-string">'node_modules'</span>
notSources[source] = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">return</span>
<span class="hljs-keyword">if</span> opts.run
compilePath findDirectoryIndex(source), topLevel, base
<span class="hljs-keyword">return</span>
watchDir source, base <span class="hljs-keyword">if</span> opts.watch
<span class="hljs-keyword">try</span>
files = fs.readdirSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">return</span> <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> err
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> files
compilePath (path.join source, file), <span class="hljs-literal">no</span>, base
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> topLevel <span class="hljs-keyword">or</span> helpers.isCoffee source
sources.push source
sourceCode.push <span class="hljs-literal">null</span>
<span class="hljs-keyword">delete</span> notSources[source]
watch source, base <span class="hljs-keyword">if</span> opts.watch
<span class="hljs-keyword">try</span>
code = fs.readFileSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">return</span> <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> err
compileScript(source, code.toString(), base)
<span class="hljs-keyword">else</span>
notSources[source] = <span class="hljs-literal">yes</span>
<span class="hljs-function">
<span class="hljs-title">findDirectoryIndex</span> = <span class="hljs-params">(source)</span> -&gt;</span>
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> CoffeeScript.FILE_EXTENSIONS
index = path.join source, <span class="hljs-string">"index<span class="hljs-subst">#{ext}</span>"</span>
<span class="hljs-keyword">try</span>
<span class="hljs-keyword">return</span> index <span class="hljs-keyword">if</span> (fs.statSync index).isFile()
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"Missing index.coffee or index.litcoffee in <span class="hljs-subst">#{source}</span>"</span>
process.exit <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Compile a single source script, containing the given code, according to the
requested options. If evaluating the script directly sets <code>__filename</code>,
<code>__dirname</code> and <code>module.filename</code> to be correct relative to the scripts path.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileScript</span> = <span class="hljs-params">(file, input, base = <span class="hljs-literal">null</span>)</span> -&gt;</span>
o = opts
options = compileOptions file, base
<span class="hljs-keyword">try</span>
t = task = {file, input, options}
CoffeeScript.emit <span class="hljs-string">'compile'</span>, task
<span class="hljs-keyword">if</span> o.tokens
printTokens CoffeeScript.tokens t.input, t.options
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.nodes
printLine CoffeeScript.nodes(t.input, t.options).toString().trim()
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.run
CoffeeScript.register()
CoffeeScript.eval opts.prelude, t.options <span class="hljs-keyword">if</span> opts.prelude
CoffeeScript.run t.input, t.options
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.join <span class="hljs-keyword">and</span> t.file <span class="hljs-keyword">isnt</span> o.join
t.input = helpers.invertLiterate t.input <span class="hljs-keyword">if</span> helpers.isLiterate file
sourceCode[sources.indexOf(t.file)] = t.input
compileJoin()
<span class="hljs-keyword">else</span>
compiled = CoffeeScript.compile t.input, t.options
t.output = compiled
<span class="hljs-keyword">if</span> o.map
t.output = compiled.js
t.sourceMap = compiled.v3SourceMap
CoffeeScript.emit <span class="hljs-string">'success'</span>, task
<span class="hljs-keyword">if</span> o.<span class="hljs-built_in">print</span>
printLine t.output.trim()
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.compile <span class="hljs-keyword">or</span> o.map
writeJs base, t.file, t.output, options.jsPath, t.sourceMap
<span class="hljs-keyword">catch</span> err
CoffeeScript.emit <span class="hljs-string">'failure'</span>, err, task
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> CoffeeScript.listeners(<span class="hljs-string">'failure'</span>).length
message = err?.stack <span class="hljs-keyword">or</span> <span class="hljs-string">"<span class="hljs-subst">#{err}</span>"</span>
<span class="hljs-keyword">if</span> o.watch
printLine message + <span class="hljs-string">'\x07'</span>
<span class="hljs-keyword">else</span>
printWarn message
process.exit <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Attach the appropriate listeners to compile scripts incoming over <strong>stdin</strong>,
and write them back to <strong>stdout</strong>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileStdio</span> = -&gt;</span>
buffers = []
stdin = process.openStdin()
stdin.<span class="hljs-literal">on</span> <span class="hljs-string">'data'</span>, <span class="hljs-function"><span class="hljs-params">(buffer)</span> -&gt;</span>
buffers.push buffer <span class="hljs-keyword">if</span> buffer
stdin.<span class="hljs-literal">on</span> <span class="hljs-string">'end'</span>, <span class="hljs-function">-&gt;</span>
compileScript <span class="hljs-literal">null</span>, Buffer.concat(buffers).toString()</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>If all of the source files are done being read, concatenate and compile
them together.</p>
</div>
<div class="content"><div class='highlight'><pre>joinTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function"><span class="hljs-title">compileJoin</span> = -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> opts.join
<span class="hljs-keyword">unless</span> sourceCode.some(<span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span> code <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span>)
clearTimeout joinTimeout
joinTimeout = wait <span class="hljs-number">100</span>, <span class="hljs-function">-&gt;</span>
compileScript opts.join, sourceCode.join(<span class="hljs-string">'\n'</span>), opts.join</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Watch a source CoffeeScript file using <code>fs.watch</code>, recompiling it every
time the file is updated. May be used in combination with other options,
such as <code>--print</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">watch</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
watcher = <span class="hljs-literal">null</span>
prevStats = <span class="hljs-literal">null</span>
compileTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">watchErr</span> = <span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> source <span class="hljs-keyword">in</span> sources
<span class="hljs-keyword">try</span>
rewatch()
compile()
<span class="hljs-keyword">catch</span>
removeSource source, base
compileJoin()
<span class="hljs-function">
<span class="hljs-title">compile</span> = -&gt;</span>
clearTimeout compileTimeout
compileTimeout = wait <span class="hljs-number">25</span>, <span class="hljs-function">-&gt;</span>
fs.stat source, <span class="hljs-function"><span class="hljs-params">(err, stats)</span> -&gt;</span>
<span class="hljs-keyword">return</span> watchErr err <span class="hljs-keyword">if</span> err
<span class="hljs-keyword">return</span> rewatch() <span class="hljs-keyword">if</span> prevStats <span class="hljs-keyword">and</span>
stats.size <span class="hljs-keyword">is</span> prevStats.size <span class="hljs-keyword">and</span>
stats.mtime.getTime() <span class="hljs-keyword">is</span> prevStats.mtime.getTime()
prevStats = stats
fs.readFile source, <span class="hljs-function"><span class="hljs-params">(err, code)</span> -&gt;</span>
<span class="hljs-keyword">return</span> watchErr err <span class="hljs-keyword">if</span> err
compileScript(source, code.toString(), base)
rewatch()
<span class="hljs-function">
<span class="hljs-title">startWatcher</span> = -&gt;</span>
watcher = fs.watch source
.<span class="hljs-literal">on</span> <span class="hljs-string">'change'</span>, compile
.<span class="hljs-literal">on</span> <span class="hljs-string">'error'</span>, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'EPERM'</span>
removeSource source, base
<span class="hljs-function">
<span class="hljs-title">rewatch</span> = -&gt;</span>
watcher?.close()
startWatcher()
<span class="hljs-keyword">try</span>
startWatcher()
<span class="hljs-keyword">catch</span> err
watchErr err</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Watch a directory of files for new additions.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">watchDir</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
watcher = <span class="hljs-literal">null</span>
readdirTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">startWatcher</span> = -&gt;</span>
watcher = fs.watch source
.<span class="hljs-literal">on</span> <span class="hljs-string">'error'</span>, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'EPERM'</span>
stopWatcher()
.<span class="hljs-literal">on</span> <span class="hljs-string">'change'</span>, <span class="hljs-function">-&gt;</span>
clearTimeout readdirTimeout
readdirTimeout = wait <span class="hljs-number">25</span>, <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">try</span>
files = fs.readdirSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-keyword">return</span> stopWatcher()
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> files
compilePath (path.join source, file), <span class="hljs-literal">no</span>, base
<span class="hljs-function">
<span class="hljs-title">stopWatcher</span> = -&gt;</span>
watcher.close()
removeSourceDir source, base
watchedDirs[source] = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">try</span>
startWatcher()
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-function">
<span class="hljs-title">removeSourceDir</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
<span class="hljs-keyword">delete</span> watchedDirs[source]
sourcesChanged = <span class="hljs-literal">no</span>
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> sources <span class="hljs-keyword">when</span> source <span class="hljs-keyword">is</span> path.dirname file
removeSource file, base
sourcesChanged = <span class="hljs-literal">yes</span>
compileJoin() <span class="hljs-keyword">if</span> sourcesChanged</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Remove a file from our source list, and source code cache. Optionally remove
the compiled JS version as well.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">removeSource</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
index = sources.indexOf source
sources.splice index, <span class="hljs-number">1</span>
sourceCode.splice index, <span class="hljs-number">1</span>
<span class="hljs-keyword">unless</span> opts.join
silentUnlink outputPath source, base
silentUnlink outputPath source, base, <span class="hljs-string">'.js.map'</span>
timeLog <span class="hljs-string">"removed <span class="hljs-subst">#{source}</span>"</span>
<span class="hljs-function">
<span class="hljs-title">silentUnlink</span> = <span class="hljs-params">(path)</span> -&gt;</span>
<span class="hljs-keyword">try</span>
fs.unlinkSync path
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">in</span> [<span class="hljs-string">'ENOENT'</span>, <span class="hljs-string">'EPERM'</span>]</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Get the corresponding output JavaScript path for a source file.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">outputPath</span> = <span class="hljs-params">(source, base, extension=<span class="hljs-string">".js"</span>)</span> -&gt;</span>
basename = helpers.baseFileName source, <span class="hljs-literal">yes</span>, useWinPathSep
srcDir = path.dirname source
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> opts.output
dir = srcDir
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> source <span class="hljs-keyword">is</span> base
dir = opts.output
<span class="hljs-keyword">else</span>
dir = path.join opts.output, path.relative base, srcDir
path.join dir, basename + extension</pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Recursively mkdir, like <code>mkdir -p</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">mkdirp</span> = <span class="hljs-params">(dir, fn)</span> -&gt;</span>
mode = <span class="hljs-number">0</span>o777 &amp; ~process.umask()
<span class="hljs-keyword">do</span> mkdirs = <span class="hljs-function"><span class="hljs-params">(p = dir, fn)</span> -&gt;</span>
fs.exists p, <span class="hljs-function"><span class="hljs-params">(exists)</span> -&gt;</span>
<span class="hljs-keyword">if</span> exists
fn()
<span class="hljs-keyword">else</span>
mkdirs path.dirname(p), <span class="hljs-function">-&gt;</span>
fs.mkdir p, mode, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">return</span> fn err <span class="hljs-keyword">if</span> err
fn()</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Write out a JavaScript source file with the compiled code. By default, files
are written out in <code>cwd</code> as <code>.js</code> files with the same name, but the output
directory can be customized with <code>--output</code>.</p>
<p>If <code>generatedSourceMap</code> is provided, this will write a <code>.js.map</code> file into the
same directory as the <code>.js</code> file.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">writeJs</span> = <span class="hljs-params">(base, sourcePath, js, jsPath, generatedSourceMap = <span class="hljs-literal">null</span>)</span> -&gt;</span>
sourceMapPath = outputPath sourcePath, base, <span class="hljs-string">".js.map"</span>
jsDir = path.dirname jsPath
<span class="hljs-function"> <span class="hljs-title">compile</span> = -&gt;</span>
<span class="hljs-keyword">if</span> opts.compile
js = <span class="hljs-string">' '</span> <span class="hljs-keyword">if</span> js.length &lt;= <span class="hljs-number">0</span>
<span class="hljs-keyword">if</span> generatedSourceMap <span class="hljs-keyword">then</span> js = <span class="hljs-string">"<span class="hljs-subst">#{js}</span>\n//# sourceMappingURL=<span class="hljs-subst">#{helpers.baseFileName sourceMapPath, <span class="hljs-literal">no</span>, useWinPathSep}</span>\n"</span>
fs.writeFile jsPath, js, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">if</span> err
printLine err.message
process.exit <span class="hljs-number">1</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.compile <span class="hljs-keyword">and</span> opts.watch
timeLog <span class="hljs-string">"compiled <span class="hljs-subst">#{sourcePath}</span>"</span>
<span class="hljs-keyword">if</span> generatedSourceMap
fs.writeFile sourceMapPath, generatedSourceMap, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">if</span> err
printLine <span class="hljs-string">"Could not write source map: <span class="hljs-subst">#{err.message}</span>"</span>
process.exit <span class="hljs-number">1</span>
fs.exists jsDir, <span class="hljs-function"><span class="hljs-params">(itExists)</span> -&gt;</span>
<span class="hljs-keyword">if</span> itExists <span class="hljs-keyword">then</span> compile() <span class="hljs-keyword">else</span> mkdirp jsDir, compile</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Convenience for cleaner setTimeouts.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">wait</span> = <span class="hljs-params">(milliseconds, func)</span> -&gt;</span> setTimeout func, milliseconds</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>When watching scripts, its useful to log changes with the timestamp.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">timeLog</span> = <span class="hljs-params">(message)</span> -&gt;</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"<span class="hljs-subst">#{(<span class="hljs-keyword">new</span> Date).toLocaleTimeString()}</span> - <span class="hljs-subst">#{message}</span>"</span></pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Pretty-print a stream of tokens, sans location data.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">printTokens</span> = <span class="hljs-params">(tokens)</span> -&gt;</span>
strings = <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens
tag = token[<span class="hljs-number">0</span>]
value = token[<span class="hljs-number">1</span>].toString().replace(<span class="hljs-regexp">/\n/</span>, <span class="hljs-string">'\\n'</span>)
<span class="hljs-string">"[<span class="hljs-subst">#{tag}</span> <span class="hljs-subst">#{value}</span>]"</span>
printLine strings.join(<span class="hljs-string">' '</span>)</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Use the <a href="optparse.html">OptionParser module</a> to extract all options from
<code>process.argv</code> that are specified in <code>SWITCHES</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">parseOptions</span> = -&gt;</span>
optionParser = <span class="hljs-keyword">new</span> optparse.OptionParser SWITCHES, BANNER
o = opts = optionParser.parse process.argv[<span class="hljs-number">2.</span>.]
o.compile <span class="hljs-keyword">or</span>= !!o.output
o.run = <span class="hljs-keyword">not</span> (o.compile <span class="hljs-keyword">or</span> o.<span class="hljs-built_in">print</span> <span class="hljs-keyword">or</span> o.map)
o.<span class="hljs-built_in">print</span> = !! (o.<span class="hljs-built_in">print</span> <span class="hljs-keyword">or</span> (o.eval <span class="hljs-keyword">or</span> o.stdio <span class="hljs-keyword">and</span> o.compile))</pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>The compile-time options to pass to the CoffeeScript compiler.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileOptions</span> = <span class="hljs-params">(filename, base)</span> -&gt;</span>
answer = {
filename
literate: opts.literate <span class="hljs-keyword">or</span> helpers.isLiterate(filename)
bare: opts.bare
header: opts.compile <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> opts[<span class="hljs-string">'no-header'</span>]
sourceMap: opts.map
inlineMap: opts[<span class="hljs-string">'inline-map'</span>]
}
<span class="hljs-keyword">if</span> filename
<span class="hljs-keyword">if</span> base
cwd = process.cwd()
jsPath = outputPath filename, base
jsDir = path.dirname jsPath
answer = helpers.merge answer, {
jsPath
sourceRoot: path.relative jsDir, cwd
sourceFiles: [path.relative cwd, filename]
generatedFile: helpers.baseFileName(jsPath, <span class="hljs-literal">no</span>, useWinPathSep)
}
<span class="hljs-keyword">else</span>
answer = helpers.merge answer,
sourceRoot: <span class="hljs-string">""</span>
sourceFiles: [helpers.baseFileName filename, <span class="hljs-literal">no</span>, useWinPathSep]
generatedFile: helpers.baseFileName(filename, <span class="hljs-literal">yes</span>, useWinPathSep) + <span class="hljs-string">".js"</span>
answer</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
the <code>node</code> binary, preserving the other options.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">forkNode</span> = -&gt;</span>
nodeArgs = opts.nodejs.split <span class="hljs-regexp">/\s+/</span>
args = process.argv[<span class="hljs-number">1.</span>.]
args.splice args.indexOf(<span class="hljs-string">'--nodejs'</span>), <span class="hljs-number">2</span>
p = spawn process.execPath, nodeArgs.concat(args),
cwd: process.cwd()
env: process.env
stdio: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
p.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span> process.exit code</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Print the <code>--help</code> usage message and exit. Deprecated switches are not
shown.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">usage</span> = -&gt;</span>
printLine (<span class="hljs-keyword">new</span> optparse.OptionParser SWITCHES, BANNER).help()</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Print the <code>--version</code> message and exit.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">version</span> = -&gt;</span>
printLine <span class="hljs-string">"CoffeeScript version <span class="hljs-subst">#{CoffeeScript.VERSION}</span>"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,518 @@
/*--------------------- Typography ----------------------------*/
@font-face {
font-family: 'aller-light';
src: url('public/fonts/aller-light.eot');
src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'),
url('public/fonts/aller-light.woff') format('woff'),
url('public/fonts/aller-light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'aller-bold';
src: url('public/fonts/aller-bold.eot');
src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'),
url('public/fonts/aller-bold.woff') format('woff'),
url('public/fonts/aller-bold.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'roboto-black';
src: url('public/fonts/roboto-black.eot');
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
url('public/fonts/roboto-black.woff') format('woff'),
url('public/fonts/roboto-black.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/*--------------------- Layout ----------------------------*/
html { height: 100%; }
body {
font-family: "aller-light";
font-size: 14px;
line-height: 18px;
color: #30404f;
margin: 0; padding: 0;
height:100%;
}
#container { min-height: 100%; }
a {
color: #000;
}
b, strong {
font-weight: normal;
font-family: "aller-bold";
}
p {
margin: 15px 0 0px;
}
.annotation ul, .annotation ol {
margin: 25px 0;
}
.annotation ul li, .annotation ol li {
font-size: 14px;
line-height: 18px;
margin: 10px 0;
}
h1, h2, h3, h4, h5, h6 {
color: #112233;
line-height: 1em;
font-weight: normal;
font-family: "roboto-black";
text-transform: uppercase;
margin: 30px 0 15px 0;
}
h1 {
margin-top: 40px;
}
h2 {
font-size: 1.26em;
}
hr {
border: 0;
background: 1px #ddd;
height: 1px;
margin: 20px 0;
}
pre, tt, code {
font-size: 12px; line-height: 16px;
font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
margin: 0; padding: 0;
}
.annotation pre {
display: block;
margin: 0;
padding: 7px 10px;
background: #fcfcfc;
-moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
overflow-x: auto;
}
.annotation pre code {
border: 0;
padding: 0;
background: transparent;
}
blockquote {
border-left: 5px solid #ccc;
margin: 0;
padding: 1px 0 1px 1em;
}
.sections blockquote p {
font-family: Menlo, Consolas, Monaco, monospace;
font-size: 12px; line-height: 16px;
color: #999;
margin: 10px 0 0;
white-space: pre-wrap;
}
ul.sections {
list-style: none;
padding:0 0 5px 0;;
margin:0;
}
/*
Force border-box so that % widths fit the parent
container without overlap because of margin/padding.
More Info : http://www.quirksmode.org/css/box.html
*/
ul.sections > li > div {
-moz-box-sizing: border-box; /* firefox */
-ms-box-sizing: border-box; /* ie */
-webkit-box-sizing: border-box; /* webkit */
-khtml-box-sizing: border-box; /* konqueror */
box-sizing: border-box; /* css3 */
}
/*---------------------- Jump Page -----------------------------*/
#jump_to, #jump_page {
margin: 0;
background: white;
-webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
-webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
font: 16px Arial;
cursor: pointer;
text-align: right;
list-style: none;
}
#jump_to a {
text-decoration: none;
}
#jump_to a.large {
display: none;
}
#jump_to a.small {
font-size: 22px;
font-weight: bold;
color: #676767;
}
#jump_to, #jump_wrapper {
position: fixed;
right: 0; top: 0;
padding: 10px 15px;
margin:0;
}
#jump_wrapper {
display: none;
padding:0;
}
#jump_to:hover #jump_wrapper {
display: block;
}
#jump_page_wrapper{
position: fixed;
right: 0;
top: 0;
bottom: 0;
}
#jump_page {
padding: 5px 0 3px;
margin: 0 0 25px 25px;
max-height: 100%;
overflow: auto;
}
#jump_page .source {
display: block;
padding: 15px;
text-decoration: none;
border-top: 1px solid #eee;
}
#jump_page .source:hover {
background: #f5f5ff;
}
#jump_page .source:first-child {
}
/*---------------------- Low resolutions (> 320px) ---------------------*/
@media only screen and (min-width: 320px) {
.pilwrap { display: none; }
ul.sections > li > div {
display: block;
padding:5px 10px 0 10px;
}
ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
padding-left: 30px;
}
ul.sections > li > div.content {
overflow-x:auto;
-webkit-box-shadow: inset 0 0 5px #e5e5ee;
box-shadow: inset 0 0 5px #e5e5ee;
border: 1px solid #dedede;
margin:5px 10px 5px 10px;
padding-bottom: 5px;
}
ul.sections > li > div.annotation pre {
margin: 7px 0 7px;
padding-left: 15px;
}
ul.sections > li > div.annotation p tt, .annotation code {
background: #f8f8ff;
border: 1px solid #dedede;
font-size: 12px;
padding: 0 0.2em;
}
}
/*---------------------- (> 481px) ---------------------*/
@media only screen and (min-width: 481px) {
#container {
position: relative;
}
body {
background-color: #F5F5FF;
font-size: 15px;
line-height: 21px;
}
pre, tt, code {
line-height: 18px;
}
p, ul, ol {
margin: 0 0 15px;
}
#jump_to {
padding: 5px 10px;
}
#jump_wrapper {
padding: 0;
}
#jump_to, #jump_page {
font: 10px Arial;
text-transform: uppercase;
}
#jump_page .source {
padding: 5px 10px;
}
#jump_to a.large {
display: inline-block;
}
#jump_to a.small {
display: none;
}
#background {
position: absolute;
top: 0; bottom: 0;
width: 350px;
background: #fff;
border-right: 1px solid #e5e5ee;
z-index: -1;
}
ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
padding-left: 40px;
}
ul.sections > li {
white-space: nowrap;
}
ul.sections > li > div {
display: inline-block;
}
ul.sections > li > div.annotation {
max-width: 350px;
min-width: 350px;
min-height: 5px;
padding: 13px;
overflow-x: hidden;
white-space: normal;
vertical-align: top;
text-align: left;
}
ul.sections > li > div.annotation pre {
margin: 15px 0 15px;
padding-left: 15px;
}
ul.sections > li > div.content {
padding: 13px;
vertical-align: top;
border: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.pilwrap {
position: relative;
display: inline;
}
.pilcrow {
font: 12px Arial;
text-decoration: none;
color: #454545;
position: absolute;
top: 3px; left: -20px;
padding: 1px 2px;
opacity: 0;
-webkit-transition: opacity 0.2s linear;
}
.for-h1 .pilcrow {
top: 47px;
}
.for-h2 .pilcrow, .for-h3 .pilcrow, .for-h4 .pilcrow {
top: 35px;
}
ul.sections > li > div.annotation:hover .pilcrow {
opacity: 1;
}
}
/*---------------------- (> 1025px) ---------------------*/
@media only screen and (min-width: 1025px) {
body {
font-size: 16px;
line-height: 24px;
}
#background {
width: 525px;
}
ul.sections > li > div.annotation {
max-width: 525px;
min-width: 525px;
padding: 10px 25px 1px 50px;
}
ul.sections > li > div.content {
padding: 9px 15px 16px 25px;
}
}
/*---------------------- Syntax Highlighting -----------------------------*/
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
pre code {
display: block; padding: 0.5em;
color: #000;
background: #f8f8ff
}
pre .hljs-comment,
pre .hljs-template_comment,
pre .hljs-diff .hljs-header,
pre .hljs-javadoc {
color: #408080;
font-style: italic
}
pre .hljs-keyword,
pre .hljs-assignment,
pre .hljs-literal,
pre .hljs-css .hljs-rule .hljs-keyword,
pre .hljs-winutils,
pre .hljs-javascript .hljs-title,
pre .hljs-lisp .hljs-title,
pre .hljs-subst {
color: #954121;
/*font-weight: bold*/
}
pre .hljs-number,
pre .hljs-hexcolor {
color: #40a070
}
pre .hljs-string,
pre .hljs-tag .hljs-value,
pre .hljs-phpdoc,
pre .hljs-tex .hljs-formula {
color: #219161;
}
pre .hljs-title,
pre .hljs-id {
color: #19469D;
}
pre .hljs-params {
color: #00F;
}
pre .hljs-javascript .hljs-title,
pre .hljs-lisp .hljs-title,
pre .hljs-subst {
font-weight: normal
}
pre .hljs-class .hljs-title,
pre .hljs-haskell .hljs-label,
pre .hljs-tex .hljs-command {
color: #458;
font-weight: bold
}
pre .hljs-tag,
pre .hljs-tag .hljs-title,
pre .hljs-rules .hljs-property,
pre .hljs-django .hljs-tag .hljs-keyword {
color: #000080;
font-weight: normal
}
pre .hljs-attribute,
pre .hljs-variable,
pre .hljs-instancevar,
pre .hljs-lisp .hljs-body {
color: #008080
}
pre .hljs-regexp {
color: #B68
}
pre .hljs-class {
color: #458;
font-weight: bold
}
pre .hljs-symbol,
pre .hljs-ruby .hljs-symbol .hljs-string,
pre .hljs-ruby .hljs-symbol .hljs-keyword,
pre .hljs-ruby .hljs-symbol .hljs-keymethods,
pre .hljs-lisp .hljs-keyword,
pre .hljs-tex .hljs-special,
pre .hljs-input_number {
color: #990073
}
pre .hljs-builtin,
pre .hljs-constructor,
pre .hljs-built_in,
pre .hljs-lisp .hljs-title {
color: #0086b3
}
pre .hljs-preprocessor,
pre .hljs-pi,
pre .hljs-doctype,
pre .hljs-shebang,
pre .hljs-cdata {
color: #999;
font-weight: bold
}
pre .hljs-deletion {
background: #fdd
}
pre .hljs-addition {
background: #dfd
}
pre .hljs-diff .hljs-change {
background: #0086b3
}
pre .hljs-chunk {
color: #aaa
}
pre .hljs-tex .hljs-formula {
opacity: 0.5;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,612 @@
<!DOCTYPE html>
<html>
<head>
<title>helpers.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>helpers.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>This file contains the common helper functions that wed like to share among
the <strong>Lexer</strong>, <strong>Rewriter</strong>, and the <strong>Nodes</strong>. Merge objects, flatten
arrays, count characters, that sort of thing.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Peek at the beginning of a given string to see if it matches a sequence.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.starts = <span class="hljs-function"><span class="hljs-params">(string, literal, start)</span> -&gt;</span>
literal <span class="hljs-keyword">is</span> string.substr start, literal.length</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Peek at the end of a given string to see if it matches a sequence.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.ends = <span class="hljs-function"><span class="hljs-params">(string, literal, back)</span> -&gt;</span>
len = literal.length
literal <span class="hljs-keyword">is</span> string.substr string.length - len - (back <span class="hljs-keyword">or</span> <span class="hljs-number">0</span>), len</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Repeat a string <code>n</code> times.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.repeat = repeat = <span class="hljs-function"><span class="hljs-params">(str, n)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Use clever algorithm to have O(log(n)) string concatenation operations.</p>
</div>
<div class="content"><div class='highlight'><pre> res = <span class="hljs-string">''</span>
<span class="hljs-keyword">while</span> n &gt; <span class="hljs-number">0</span>
res += str <span class="hljs-keyword">if</span> n &amp; <span class="hljs-number">1</span>
n &gt;&gt;&gt;= <span class="hljs-number">1</span>
str += str
res</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Trim out all falsy values from an array.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.compact = <span class="hljs-function"><span class="hljs-params">(array)</span> -&gt;</span>
item <span class="hljs-keyword">for</span> item <span class="hljs-keyword">in</span> array <span class="hljs-keyword">when</span> item</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Count the number of occurrences of a string in a string.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.count = <span class="hljs-function"><span class="hljs-params">(string, substr)</span> -&gt;</span>
num = pos = <span class="hljs-number">0</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>/<span class="hljs-number">0</span> <span class="hljs-keyword">unless</span> substr.length
num++ <span class="hljs-keyword">while</span> pos = <span class="hljs-number">1</span> + string.indexOf substr, pos
num</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Merge objects, returning a fresh copy with attributes from both sides.
Used every time <code>Base#compile</code> is called, to allow properties in the
options hash to propagate down the tree without polluting other branches.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.merge = <span class="hljs-function"><span class="hljs-params">(options, overrides)</span> -&gt;</span>
extend (extend {}, options), overrides</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Extend a source object with the properties of another object (shallow copy).</p>
</div>
<div class="content"><div class='highlight'><pre>extend = exports.extend = <span class="hljs-function"><span class="hljs-params">(object, properties)</span> -&gt;</span>
<span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">of</span> properties
object[key] = val
object</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Return a flattened version of an array.
Handy for getting a list of <code>children</code> from the nodes.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.flatten = flatten = <span class="hljs-function"><span class="hljs-params">(array)</span> -&gt;</span>
flattened = []
<span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> array
<span class="hljs-keyword">if</span> <span class="hljs-string">'[object Array]'</span> <span class="hljs-keyword">is</span> Object::toString.call element
flattened = flattened.concat flatten element
<span class="hljs-keyword">else</span>
flattened.push element
flattened</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Delete a key from an object, returning the value. Useful when a node is
looking for a particular method in an options hash.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.del = <span class="hljs-function"><span class="hljs-params">(obj, key)</span> -&gt;</span>
val = obj[key]
<span class="hljs-keyword">delete</span> obj[key]
val</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Typical Array::some</p>
</div>
<div class="content"><div class='highlight'><pre>exports.some = Array::some ? (fn) -&gt;
<span class="hljs-keyword">return</span> <span class="hljs-literal">true</span> <span class="hljs-keyword">for</span> e <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> <span class="hljs-keyword">when</span> fn e
<span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Simple function for inverting Literate CoffeeScript code by putting the
documentation in comments, producing a string of CoffeeScript code that
can be compiled “normally”.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.invertLiterate = <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span>
maybe_code = <span class="hljs-literal">true</span>
lines = <span class="hljs-keyword">for</span> line <span class="hljs-keyword">in</span> code.split(<span class="hljs-string">'\n'</span>)
<span class="hljs-keyword">if</span> maybe_code <span class="hljs-keyword">and</span> <span class="hljs-regexp">/^([ ]{4}|[ ]{0,3}\t)/</span>.test line
line
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> maybe_code = <span class="hljs-regexp">/^\s*$/</span>.test line
line
<span class="hljs-keyword">else</span>
<span class="hljs-string">'# '</span> + line
lines.join <span class="hljs-string">'\n'</span></pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Merge two jison-style location data objects together.
If <code>last</code> is not provided, this will simply return <code>first</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildLocationData</span> = <span class="hljs-params">(first, last)</span> -&gt;</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> last
first
<span class="hljs-keyword">else</span>
first_line: first.first_line
first_column: first.first_column
last_line: last.last_line
last_column: last.last_column</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>This returns a function which takes an object as a parameter, and if that
object is an AST node, updates that objects locationData.
The object is returned either way.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.addLocationDataFn = <span class="hljs-function"><span class="hljs-params">(first, last)</span> -&gt;</span>
(obj) -&gt;
<span class="hljs-keyword">if</span> ((<span class="hljs-keyword">typeof</span> obj) <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>) <span class="hljs-keyword">and</span> (!!obj[<span class="hljs-string">'updateLocationDataIfMissing'</span>])
obj.updateLocationDataIfMissing buildLocationData(first, last)
<span class="hljs-keyword">return</span> obj</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Convert jison location data to a string.
<code>obj</code> can be a token, or a locationData.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.locationDataToString = <span class="hljs-function"><span class="hljs-params">(obj)</span> -&gt;</span>
<span class="hljs-keyword">if</span> (<span class="hljs-string">"2"</span> <span class="hljs-keyword">of</span> obj) <span class="hljs-keyword">and</span> (<span class="hljs-string">"first_line"</span> <span class="hljs-keyword">of</span> obj[<span class="hljs-number">2</span>]) <span class="hljs-keyword">then</span> locationData = obj[<span class="hljs-number">2</span>]
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-string">"first_line"</span> <span class="hljs-keyword">of</span> obj <span class="hljs-keyword">then</span> locationData = obj
<span class="hljs-keyword">if</span> locationData
<span class="hljs-string">"<span class="hljs-subst">#{locationData.first_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{locationData.first_column + <span class="hljs-number">1</span>}</span>-"</span> +
<span class="hljs-string">"<span class="hljs-subst">#{locationData.last_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{locationData.last_column + <span class="hljs-number">1</span>}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"No location data"</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>A <code>.coffee.md</code> compatible version of <code>basename</code>, that returns the file sans-extension.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.baseFileName = <span class="hljs-function"><span class="hljs-params">(file, stripExt = <span class="hljs-literal">no</span>, useWinPathSep = <span class="hljs-literal">no</span>)</span> -&gt;</span>
pathSep = <span class="hljs-keyword">if</span> useWinPathSep <span class="hljs-keyword">then</span> <span class="hljs-regexp">/\\|\//</span> <span class="hljs-keyword">else</span> <span class="hljs-regexp">/\//</span>
parts = file.split(pathSep)
file = parts[parts.length - <span class="hljs-number">1</span>]
<span class="hljs-keyword">return</span> file <span class="hljs-keyword">unless</span> stripExt <span class="hljs-keyword">and</span> file.indexOf(<span class="hljs-string">'.'</span>) &gt;= <span class="hljs-number">0</span>
parts = file.split(<span class="hljs-string">'.'</span>)
parts.pop()
parts.pop() <span class="hljs-keyword">if</span> parts[parts.length - <span class="hljs-number">1</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'coffee'</span> <span class="hljs-keyword">and</span> parts.length &gt; <span class="hljs-number">1</span>
parts.join(<span class="hljs-string">'.'</span>)</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Determine if a filename represents a CoffeeScript file.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.isCoffee = <span class="hljs-function"><span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.((lit)?coffee|coffee\.md)$/</span>.test file</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.isLiterate = <span class="hljs-function"><span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.(litcoffee|coffee\.md)$/</span>.test file</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Throws a SyntaxError from a given location.
The errors <code>toString</code> will return an error message following the “standard”
format <code>&lt;filename&gt;:&lt;line&gt;:&lt;col&gt;: &lt;message&gt;</code> plus the line with the error and a
marker showing where the error is.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.throwSyntaxError = <span class="hljs-function"><span class="hljs-params">(message, location)</span> -&gt;</span>
error = <span class="hljs-keyword">new</span> SyntaxError message
error.location = location
error.toString = syntaxErrorToString</pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Instead of showing the compilers stacktrace, show our custom error message
(this is useful when the error bubbles up in Node.js applications that
compile CoffeeScript for example).</p>
</div>
<div class="content"><div class='highlight'><pre> error.stack = error.toString()
<span class="hljs-keyword">throw</span> error</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Update a compiler SyntaxError with source code information if it didnt have
it already.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.updateSyntaxError = <span class="hljs-function"><span class="hljs-params">(error, code, filename)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Avoid screwing up the <code>stack</code> property of other errors (i.e. possible bugs).</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> error.toString <span class="hljs-keyword">is</span> syntaxErrorToString
error.code <span class="hljs-keyword">or</span>= code
error.filename <span class="hljs-keyword">or</span>= filename
error.stack = error.toString()
error
<span class="hljs-function">
<span class="hljs-title">syntaxErrorToString</span> = -&gt;</span>
<span class="hljs-keyword">return</span> Error::toString.call @ <span class="hljs-keyword">unless</span> @code <span class="hljs-keyword">and</span> @location
{first_line, first_column, last_line, last_column} = @location
last_line ?= first_line
last_column ?= first_column
filename = @filename <span class="hljs-keyword">or</span> <span class="hljs-string">'[stdin]'</span>
codeLine = @code.split(<span class="hljs-string">'\n'</span>)[first_line]
start = first_column</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Show only the first line on multi-line errors.</p>
</div>
<div class="content"><div class='highlight'><pre> end = <span class="hljs-keyword">if</span> first_line <span class="hljs-keyword">is</span> last_line <span class="hljs-keyword">then</span> last_column + <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> codeLine.length
marker = codeLine[...start].replace(<span class="hljs-regexp">/[^\s]/g</span>, <span class="hljs-string">' '</span>) + repeat(<span class="hljs-string">'^'</span>, end - start)</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Check to see if were running on a color-enabled TTY.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> process?
colorsEnabled = process.stdout?.isTTY <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> process.env?.NODE_DISABLE_COLORS
<span class="hljs-keyword">if</span> @colorful ? colorsEnabled
<span class="hljs-function"> <span class="hljs-title">colorize</span> = <span class="hljs-params">(str)</span> -&gt;</span> <span class="hljs-string">"\x1B[1;31m<span class="hljs-subst">#{str}</span>\x1B[0m"</span>
codeLine = codeLine[...start] + colorize(codeLine[start...end]) + codeLine[end..]
marker = colorize marker
<span class="hljs-string">"""
<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{first_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{first_column + <span class="hljs-number">1</span>}</span>: error: <span class="hljs-subst">#{@message}</span>
<span class="hljs-subst">#{codeLine}</span>
<span class="hljs-subst">#{marker}</span>
"""</span>
exports.nameWhitespaceCharacter = <span class="hljs-function"><span class="hljs-params">(string)</span> -&gt;</span>
<span class="hljs-keyword">switch</span> string
<span class="hljs-keyword">when</span> <span class="hljs-string">' '</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'space'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\n'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'newline'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\r'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'carriage return'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\t'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'tab'</span>
<span class="hljs-keyword">else</span> string</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html>
<head>
<title>index.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>index.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Loader for CoffeeScript as a Node.js library.</p>
</div>
<div class="content"><div class='highlight'><pre>exports[key] = val <span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">of</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,366 @@
<!DOCTYPE html>
<html>
<head>
<title>optparse.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>optparse.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>{repeat} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>A simple <strong>OptionParser</strong> class to parse option flags from the command-line.
Use it like so:</p>
<pre><code>parser = <span class="hljs-keyword">new</span> OptionParser switches, helpBanner
options = parser.parse process.argv
</code></pre><p>The first non-option is considered to be the start of the file (and file
option) list, and all subsequent arguments are left unparsed.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.OptionParser = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OptionParser</span></span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Initialize with a list of valid options, in the form:</p>
<pre><code>[short-flag, long-flag, description]
</code></pre><p>Along with an optional banner for the usage help.</p>
</div>
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(rules, @banner)</span> -&gt;</span>
@rules = buildRules rules</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Parse the list of arguments, populating an <code>options</code> object with all of the
specified options, and return it. Options after the first non-option
argument are treated as arguments. <code>options.arguments</code> will be an array
containing the remaining arguments. This is a simpler API than many option
parsers that allow you to attach callback actions for every flag. Instead,
youre responsible for interpreting the options object.</p>
</div>
<div class="content"><div class='highlight'><pre> parse: <span class="hljs-function"><span class="hljs-params">(args)</span> -&gt;</span>
options = arguments: []
skippingArgument = <span class="hljs-literal">no</span>
originalArgs = args
args = normalizeArguments args
<span class="hljs-keyword">for</span> arg, i <span class="hljs-keyword">in</span> args
<span class="hljs-keyword">if</span> skippingArgument
skippingArgument = <span class="hljs-literal">no</span>
<span class="hljs-keyword">continue</span>
<span class="hljs-keyword">if</span> arg <span class="hljs-keyword">is</span> <span class="hljs-string">'--'</span>
pos = originalArgs.indexOf <span class="hljs-string">'--'</span>
options.arguments = options.arguments.concat originalArgs[(pos + <span class="hljs-number">1</span>)..]
<span class="hljs-keyword">break</span>
isOption = !!(arg.match(LONG_FLAG) <span class="hljs-keyword">or</span> arg.match(SHORT_FLAG))</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>the CS option parser is a little odd; options after the first
non-option argument are treated as non-option arguments themselves</p>
</div>
<div class="content"><div class='highlight'><pre> seenNonOptionArg = options.arguments.length &gt; <span class="hljs-number">0</span>
<span class="hljs-keyword">unless</span> seenNonOptionArg
matchedRule = <span class="hljs-literal">no</span>
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
<span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">is</span> arg <span class="hljs-keyword">or</span> rule.longFlag <span class="hljs-keyword">is</span> arg
value = <span class="hljs-literal">true</span>
<span class="hljs-keyword">if</span> rule.hasArgument
skippingArgument = <span class="hljs-literal">yes</span>
value = args[i + <span class="hljs-number">1</span>]
options[rule.name] = <span class="hljs-keyword">if</span> rule.isList <span class="hljs-keyword">then</span> (options[rule.name] <span class="hljs-keyword">or</span> []).concat value <span class="hljs-keyword">else</span> value
matchedRule = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">break</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"unrecognized option: <span class="hljs-subst">#{arg}</span>"</span> <span class="hljs-keyword">if</span> isOption <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> matchedRule
<span class="hljs-keyword">if</span> seenNonOptionArg <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> isOption
options.arguments.push arg
options</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
of the valid options, for <code>--help</code> and such.</p>
</div>
<div class="content"><div class='highlight'><pre> help: <span class="hljs-function">-&gt;</span>
lines = []
lines.unshift <span class="hljs-string">"<span class="hljs-subst">#{@banner}</span>\n"</span> <span class="hljs-keyword">if</span> @banner
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
spaces = <span class="hljs-number">15</span> - rule.longFlag.length
spaces = <span class="hljs-keyword">if</span> spaces &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> repeat <span class="hljs-string">' '</span>, spaces <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
letPart = <span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">then</span> rule.shortFlag + <span class="hljs-string">', '</span> <span class="hljs-keyword">else</span> <span class="hljs-string">' '</span>
lines.push <span class="hljs-string">' '</span> + letPart + rule.longFlag + spaces + rule.description
<span class="hljs-string">"\n<span class="hljs-subst">#{ lines.join(<span class="hljs-string">'\n'</span>) }</span>\n"</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<h2 id="helpers">Helpers</h2>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
</div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Regex matchers for option flags.</p>
</div>
<div class="content"><div class='highlight'><pre>LONG_FLAG = <span class="hljs-regexp">/^(--\w[\w\-]*)/</span>
SHORT_FLAG = <span class="hljs-regexp">/^(-\w)$/</span>
MULTI_FLAG = <span class="hljs-regexp">/^-(\w{2,})/</span>
OPTIONAL = <span class="hljs-regexp">/\[(\w+(\*?))\]/</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Build and return the list of option rules. If the optional <em>short-flag</em> is
unspecified, leave it out by padding with <code>null</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRules</span> = <span class="hljs-params">(rules)</span> -&gt;</span>
<span class="hljs-keyword">for</span> tuple <span class="hljs-keyword">in</span> rules
tuple.unshift <span class="hljs-literal">null</span> <span class="hljs-keyword">if</span> tuple.length &lt; <span class="hljs-number">3</span>
buildRule tuple...</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
description of what the option does.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRule</span> = <span class="hljs-params">(shortFlag, longFlag, description, options = {})</span> -&gt;</span>
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[<span class="hljs-number">1</span>]
{
name: longFlag.substr <span class="hljs-number">2</span>
shortFlag: shortFlag
longFlag: longFlag
description: description
hasArgument: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">1</span>])
isList: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">2</span>])
}</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Normalize arguments by expanding merged flags into multiple flags. This allows
you to have <code>-wl</code> be the same as <code>--watch --lint</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">normalizeArguments</span> = <span class="hljs-params">(args)</span> -&gt;</span>
args = args[..]
result = []
<span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> args
<span class="hljs-keyword">if</span> match = arg.match MULTI_FLAG
result.push <span class="hljs-string">'-'</span> + l <span class="hljs-keyword">for</span> l <span class="hljs-keyword">in</span> match[<span class="hljs-number">1</span>].split <span class="hljs-string">''</span>
<span class="hljs-keyword">else</span>
result.push arg
result</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,375 @@
/*! normalize.css v2.0.1 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects `block` display not defined in IE 8/9.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
/*
* Corrects `inline-block` display not defined in IE 8/9.
*/
audio,
canvas,
video {
display: inline-block;
}
/*
* Prevents modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/*
* Addresses styling for `hidden` attribute not present in IE 8/9.
*/
[hidden] {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/*
* 1. Sets default font family to sans-serif.
* 2. Prevents iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
/*
* Removes default margin.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/*
* Addresses `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/*
* Improves readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/*
* Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
* Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
}
/*
* Addresses styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/*
* Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/*
* Addresses styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/*
* Addresses styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/*
* Corrects font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/*
* Improves readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
/*
* Sets consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019";
}
/*
* Addresses inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/*
* Prevents `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
========================================================================== */
/*
* Removes border when inside `a` element in IE 8/9.
*/
img {
border: 0;
}
/*
* Corrects overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/*
* Addresses margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/*
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/*
* 1. Corrects color not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/*
* 1. Corrects font family not being inherited in all browsers.
* 2. Corrects font size not being inherited in all browsers.
* 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
*/
button,
input,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
}
/*
* Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/*
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Corrects inability to style clickable `input` types in iOS.
* 3. Improves usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/*
* Re-set default cursor for disabled elements.
*/
button[disabled],
input[disabled] {
cursor: default;
}
/*
* 1. Addresses box sizing set to `content-box` in IE 8/9.
* 2. Removes excess padding in IE 8/9.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/*
* 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/*
* Removes inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/*
* Removes inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/*
* 1. Removes default vertical scrollbar in IE 8/9.
* 2. Improves readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}

View File

@@ -0,0 +1,251 @@
<!DOCTYPE html>
<html>
<head>
<title>register.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>register.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span>
child_process = <span class="hljs-built_in">require</span> <span class="hljs-string">'child_process'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Load and run a CoffeeScript file for Node, stripping any <code>BOM</code>s.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">loadFile</span> = <span class="hljs-params">(<span class="hljs-built_in">module</span>, filename)</span> -&gt;</span>
answer = CoffeeScript._compileFile filename, <span class="hljs-literal">no</span>, <span class="hljs-literal">yes</span>
<span class="hljs-built_in">module</span>._compile answer, filename</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>If the installed version of Node supports <code>require.extensions</code>, register
CoffeeScript as an extension.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.extensions
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> CoffeeScript.FILE_EXTENSIONS
<span class="hljs-built_in">require</span>.extensions[ext] = loadFile</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Patch Nodes module loader to be able to handle multi-dot extensions.
This is a horrible thing that should not be required.</p>
</div>
<div class="content"><div class='highlight'><pre> Module = <span class="hljs-built_in">require</span> <span class="hljs-string">'module'</span>
<span class="hljs-function">
<span class="hljs-title">findExtension</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
extensions = path.basename(filename).split <span class="hljs-string">'.'</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Remove the initial dot from dotfiles.</p>
</div>
<div class="content"><div class='highlight'><pre> extensions.shift() <span class="hljs-keyword">if</span> extensions[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Start with the longest possible extension and work our way shortwards.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">while</span> extensions.shift()
curExtension = <span class="hljs-string">'.'</span> + extensions.join <span class="hljs-string">'.'</span>
<span class="hljs-keyword">return</span> curExtension <span class="hljs-keyword">if</span> Module._extensions[curExtension]
<span class="hljs-string">'.js'</span>
Module::load = <span class="hljs-function"><span class="hljs-params">(filename)</span> -&gt;</span>
@filename = filename
@paths = Module._nodeModulePaths path.dirname filename
extension = findExtension filename
Module._extensions[extension](<span class="hljs-keyword">this</span>, filename)
@loaded = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>If were on Node, patch <code>child_process.fork</code> so that Coffee scripts are able
to fork both CoffeeScript files, and JavaScript files, directly.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> child_process
{fork} = child_process
binary = <span class="hljs-built_in">require</span>.resolve <span class="hljs-string">'../../bin/coffee'</span>
child_process.fork = <span class="hljs-function"><span class="hljs-params">(path, args, options)</span> -&gt;</span>
<span class="hljs-keyword">if</span> helpers.isCoffee path
<span class="hljs-keyword">unless</span> Array.isArray args
options = args <span class="hljs-keyword">or</span> {}
args = []
args = [path].concat args
path = binary
fork path, args, options</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,624 @@
<!DOCTYPE html>
<html>
<head>
<title>repl.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>repl.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
vm = <span class="hljs-built_in">require</span> <span class="hljs-string">'vm'</span>
nodeREPL = <span class="hljs-built_in">require</span> <span class="hljs-string">'repl'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span>
{merge, updateSyntaxError} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
replDefaults =
prompt: <span class="hljs-string">'coffee&gt; '</span>,
historyFile: path.join process.env.HOME, <span class="hljs-string">'.coffee_history'</span> <span class="hljs-keyword">if</span> process.env.HOME
historyMaxInputSize: <span class="hljs-number">10240</span>
eval: <span class="hljs-function"><span class="hljs-params">(input, context, filename, cb)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>XXX: multiline hack.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/\uFF00/g</span>, <span class="hljs-string">'\n'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Nodes REPL sends the input ending with a newline and then wrapped in
parens. Unwrap all that.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/^\(([\s\S]*)\n\)$/m</span>, <span class="hljs-string">'$1'</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Nodes REPL v6.9.1+ sends the input wrapped in a try/catch statement.
Unwrap that too.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/^\s*try\s*{([\s\S]*)}\s*catch.*$/m</span>, <span class="hljs-string">'$1'</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Require AST nodes to do some AST manipulation.</p>
</div>
<div class="content"><div class='highlight'><pre> {Block, Assign, Value, Literal} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span>
<span class="hljs-keyword">try</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Tokenize the clean input.</p>
</div>
<div class="content"><div class='highlight'><pre> tokens = CoffeeScript.tokens input</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Collect referenced variable names just like in <code>CoffeeScript.compile</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> referencedVars = (
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>
)</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Generate the AST of the tokens.</p>
</div>
<div class="content"><div class='highlight'><pre> ast = CoffeeScript.nodes tokens</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Add assignment to <code>_</code> variable to force the input to be an expression.</p>
</div>
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Block [
<span class="hljs-keyword">new</span> Assign (<span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Literal <span class="hljs-string">'_'</span>), ast, <span class="hljs-string">'='</span>
]
js = ast.compile {bare: <span class="hljs-literal">yes</span>, locals: Object.keys(context), referencedVars}
cb <span class="hljs-literal">null</span>, runInContext js, context, filename
<span class="hljs-keyword">catch</span> err</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>ASTs <code>compile</code> does not add source code information to syntax errors.</p>
</div>
<div class="content"><div class='highlight'><pre> updateSyntaxError err, input
cb err
<span class="hljs-function">
<span class="hljs-title">runInContext</span> = <span class="hljs-params">(js, context, filename)</span> -&gt;</span>
<span class="hljs-keyword">if</span> context <span class="hljs-keyword">is</span> <span class="hljs-built_in">global</span>
vm.runInThisContext js, filename
<span class="hljs-keyword">else</span>
vm.runInContext js, context, filename
<span class="hljs-function">
<span class="hljs-title">addMultilineHandler</span> = <span class="hljs-params">(repl)</span> -&gt;</span>
{rli, inputStream, outputStream} = repl</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Node 0.11.12 changed API, prompt is now _prompt.</p>
</div>
<div class="content"><div class='highlight'><pre> origPrompt = repl._prompt ? repl.prompt
multiline =
enabled: <span class="hljs-literal">off</span>
initialPrompt: origPrompt.replace <span class="hljs-regexp">/^[^&gt; ]*/</span>, <span class="hljs-function"><span class="hljs-params">(x)</span> -&gt;</span> x.replace <span class="hljs-regexp">/./g</span>, <span class="hljs-string">'-'</span>
prompt: origPrompt.replace <span class="hljs-regexp">/^[^&gt; ]*&gt;?/</span>, <span class="hljs-function"><span class="hljs-params">(x)</span> -&gt;</span> x.replace <span class="hljs-regexp">/./g</span>, <span class="hljs-string">'.'</span>
buffer: <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Proxy nodes line listener</p>
</div>
<div class="content"><div class='highlight'><pre> nodeLineListener = rli.listeners(<span class="hljs-string">'line'</span>)[<span class="hljs-number">0</span>]
rli.removeListener <span class="hljs-string">'line'</span>, nodeLineListener
rli.<span class="hljs-literal">on</span> <span class="hljs-string">'line'</span>, <span class="hljs-function"><span class="hljs-params">(cmd)</span> -&gt;</span>
<span class="hljs-keyword">if</span> multiline.enabled
multiline.buffer += <span class="hljs-string">"<span class="hljs-subst">#{cmd}</span>\n"</span>
rli.setPrompt multiline.prompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">else</span>
rli.setPrompt origPrompt
nodeLineListener cmd
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Handle Ctrl-v</p>
</div>
<div class="content"><div class='highlight'><pre> inputStream.<span class="hljs-literal">on</span> <span class="hljs-string">'keypress'</span>, <span class="hljs-function"><span class="hljs-params">(char, key)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> key <span class="hljs-keyword">and</span> key.ctrl <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> key.meta <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> key.shift <span class="hljs-keyword">and</span> key.name <span class="hljs-keyword">is</span> <span class="hljs-string">'v'</span>
<span class="hljs-keyword">if</span> multiline.enabled</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>allow arbitrarily switching between modes any time before multiple lines are entered</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> multiline.buffer.match <span class="hljs-regexp">/\n/</span>
multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.setPrompt origPrompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>no-op unless the current line is empty</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> rli.line? <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> rli.line.match <span class="hljs-regexp">/^\s*$/</span></pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>eval, print, loop</p>
</div>
<div class="content"><div class='highlight'><pre> multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.line = <span class="hljs-string">''</span>
rli.cursor = <span class="hljs-number">0</span>
rli.output.cursorTo <span class="hljs-number">0</span>
rli.output.clearLine <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>XXX: multiline hack</p>
</div>
<div class="content"><div class='highlight'><pre> multiline.buffer = multiline.buffer.replace <span class="hljs-regexp">/\n/g</span>, <span class="hljs-string">'\uFF00'</span>
rli.emit <span class="hljs-string">'line'</span>, multiline.buffer
multiline.buffer = <span class="hljs-string">''</span>
<span class="hljs-keyword">else</span>
multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.setPrompt multiline.initialPrompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Store and load command history from a file</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">addHistory</span> = <span class="hljs-params">(repl, filename, maxSize)</span> -&gt;</span>
lastLine = <span class="hljs-literal">null</span>
<span class="hljs-keyword">try</span></pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Get file info and at most maxSize of command history</p>
</div>
<div class="content"><div class='highlight'><pre> stat = fs.statSync filename
size = Math.min maxSize, stat.size</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Read last <code>size</code> bytes from the file</p>
</div>
<div class="content"><div class='highlight'><pre> readFd = fs.openSync filename, <span class="hljs-string">'r'</span>
buffer = <span class="hljs-keyword">new</span> Buffer(size)
fs.readSync readFd, buffer, <span class="hljs-number">0</span>, size, stat.size - size
fs.closeSync readFd</pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Set the history on the interpreter</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history = buffer.toString().split(<span class="hljs-string">'\n'</span>).reverse()</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>If the history file was truncated we should pop off a potential partial line</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history.pop() <span class="hljs-keyword">if</span> stat.size &gt; maxSize</pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Shift off the final blank newline</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history.shift() <span class="hljs-keyword">if</span> repl.rli.history[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">''</span>
repl.rli.historyIndex = <span class="hljs-number">-1</span>
lastLine = repl.rli.history[<span class="hljs-number">0</span>]
fd = fs.openSync filename, <span class="hljs-string">'a'</span>
repl.rli.addListener <span class="hljs-string">'line'</span>, <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span>
<span class="hljs-keyword">if</span> code <span class="hljs-keyword">and</span> code.length <span class="hljs-keyword">and</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'.history'</span> <span class="hljs-keyword">and</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'.exit'</span> <span class="hljs-keyword">and</span> lastLine <span class="hljs-keyword">isnt</span> code</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Save the latest command in the file</p>
</div>
<div class="content"><div class='highlight'><pre> fs.writeSync fd, <span class="hljs-string">"<span class="hljs-subst">#{code}</span>\n"</span>
lastLine = code
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-&gt;</span> fs.closeSync fd</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Add a command to show the history stack</p>
</div>
<div class="content"><div class='highlight'><pre> repl.commands[getCommandId(repl, <span class="hljs-string">'history'</span>)] =
help: <span class="hljs-string">'Show command history'</span>
action: <span class="hljs-function">-&gt;</span>
repl.outputStream.write <span class="hljs-string">"<span class="hljs-subst">#{repl.rli.history[..].reverse().join <span class="hljs-string">'\n'</span>}</span>\n"</span>
repl.displayPrompt()
<span class="hljs-function">
<span class="hljs-title">getCommandId</span> = <span class="hljs-params">(repl, commandName)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Node 0.11 changed API, a command such as .help is now stored as help</p>
</div>
<div class="content"><div class='highlight'><pre> commandsHaveLeadingDot = repl.commands[<span class="hljs-string">'.help'</span>]?
<span class="hljs-keyword">if</span> commandsHaveLeadingDot <span class="hljs-keyword">then</span> <span class="hljs-string">".<span class="hljs-subst">#{commandName}</span>"</span> <span class="hljs-keyword">else</span> commandName
<span class="hljs-built_in">module</span>.exports =
start: <span class="hljs-function"><span class="hljs-params">(opts = {})</span> -&gt;</span>
[major, minor, build] = process.versions.node.split(<span class="hljs-string">'.'</span>).map (n) -&gt; parseInt(n, <span class="hljs-number">10</span>)
<span class="hljs-keyword">if</span> major <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> minor &lt; <span class="hljs-number">8</span>
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"Node 0.8.0+ required for CoffeeScript REPL"</span>
process.exit <span class="hljs-number">1</span>
CoffeeScript.register()
process.argv = [<span class="hljs-string">'coffee'</span>].concat process.argv[<span class="hljs-number">2.</span>.]
opts = merge replDefaults, opts
repl = nodeREPL.start opts
runInContext opts.prelude, repl.context, <span class="hljs-string">'prelude'</span> <span class="hljs-keyword">if</span> opts.prelude
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-&gt;</span> repl.outputStream.write <span class="hljs-string">'\n'</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> repl.rli.closed
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize <span class="hljs-keyword">if</span> opts.historyFile</pre></div></div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
</div>
<p>Adapt help inherited from the node REPL</p>
</div>
<div class="content"><div class='highlight'><pre> repl.commands[getCommandId(repl, <span class="hljs-string">'load'</span>)].help = <span class="hljs-string">'Load code from a file into this REPL session'</span>
repl</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,398 @@
<!DOCTYPE html>
<html>
<head>
<title>scope.litcoffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>scope.litcoffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>The <strong>Scope</strong> class regulates lexical scoping within CoffeeScript. As you
generate code, you create a tree of scopes in the same shape as the nested
function bodies. Each scope knows about the variables declared within it,
and has a reference to its parent enclosing scope. In this way, we know which
variables are new and need to be declared with <code>var</code>, and which are shared
with external scopes.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.Scope = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Scope</span></span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Initialize a scope with its parent, for lookups up the chain,
as well as a reference to the <strong>Block</strong> node it belongs to, which is
where it should declare its variables, a reference to the function that
it belongs to, and a list of variables referenced in the source code
and therefore should be avoided when generating variables.</p>
</div>
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(@parent, @expressions, @method, @referencedVars)</span> -&gt;</span>
@variables = [{name: <span class="hljs-string">'arguments'</span>, type: <span class="hljs-string">'arguments'</span>}]
@positions = {}
@utilities = {} <span class="hljs-keyword">unless</span> @parent</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>The <code>@root</code> is the top-level <strong>Scope</strong> object for a given file.</p>
</div>
<div class="content"><div class='highlight'><pre> @root = @parent?.root ? <span class="hljs-keyword">this</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Adds a new variable or overrides an existing one.</p>
</div>
<div class="content"><div class='highlight'><pre> add: <span class="hljs-function"><span class="hljs-params">(name, type, immediate)</span> -&gt;</span>
<span class="hljs-keyword">return</span> @parent.add name, type, immediate <span class="hljs-keyword">if</span> @shared <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> immediate
<span class="hljs-keyword">if</span> Object::hasOwnProperty.call @positions, name
@variables[@positions[name]].type = type
<span class="hljs-keyword">else</span>
@positions[name] = @variables.push({name, type}) - <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>When <code>super</code> is called, we need to find the name of the current method were
in, so that we know how to invoke the same method of the parent class. This
can get complicated if super is being called from an inner function.
<code>namedMethod</code> will walk up the scope tree until it either finds the first
function object that has a name filled in, or bottoms out.</p>
</div>
<div class="content"><div class='highlight'><pre> namedMethod: <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">return</span> @method <span class="hljs-keyword">if</span> @method?.name <span class="hljs-keyword">or</span> !@parent
@parent.namedMethod()</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Look up a variable name in lexical scope, and declare it if it does not
already exist.</p>
</div>
<div class="content"><div class='highlight'><pre> find: <span class="hljs-function"><span class="hljs-params">(name, type = <span class="hljs-string">'var'</span>)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> @check name
@add name, type
<span class="hljs-literal">no</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Reserve a variable name as originating from a function parameter for this
scope. No <code>var</code> required for internal references.</p>
</div>
<div class="content"><div class='highlight'><pre> parameter: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> @shared <span class="hljs-keyword">and</span> @parent.check name, <span class="hljs-literal">yes</span>
@add name, <span class="hljs-string">'param'</span></pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Just check to see if a variable has already been declared, without reserving,
walks up to the root scope.</p>
</div>
<div class="content"><div class='highlight'><pre> check: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
!!(@type(name) <span class="hljs-keyword">or</span> @parent?.check(name))</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Generate a temporary variable name at the given index.</p>
</div>
<div class="content"><div class='highlight'><pre> temporary: <span class="hljs-function"><span class="hljs-params">(name, index, single=<span class="hljs-literal">false</span>)</span> -&gt;</span>
<span class="hljs-keyword">if</span> single
startCode = name.charCodeAt(<span class="hljs-number">0</span>)
endCode = <span class="hljs-string">'z'</span>.charCodeAt(<span class="hljs-number">0</span>)
diff = endCode - startCode
newCode = startCode + index % (diff + <span class="hljs-number">1</span>)
letter = String.fromCharCode(newCode)
num = index <span class="hljs-regexp">//</span> (diff + <span class="hljs-number">1</span>)
<span class="hljs-string">"<span class="hljs-subst">#{letter}</span><span class="hljs-subst">#{num <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{name}</span><span class="hljs-subst">#{index <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>}</span>"</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Gets the type of a variable.</p>
</div>
<div class="content"><div class='highlight'><pre> type: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> v.type <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.name <span class="hljs-keyword">is</span> name
<span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>If we need to store an intermediate result, find an available name for a
compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…</p>
</div>
<div class="content"><div class='highlight'><pre> freeVariable: <span class="hljs-function"><span class="hljs-params">(name, options={})</span> -&gt;</span>
index = <span class="hljs-number">0</span>
<span class="hljs-keyword">loop</span>
temp = @temporary name, index, options.single
<span class="hljs-keyword">break</span> <span class="hljs-keyword">unless</span> @check(temp) <span class="hljs-keyword">or</span> temp <span class="hljs-keyword">in</span> @root.referencedVars
index++
@add temp, <span class="hljs-string">'var'</span>, <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> options.reserve ? <span class="hljs-literal">true</span>
temp</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Ensure that an assignment is made at the top of this scope
(or at the top-level scope, if requested).</p>
</div>
<div class="content"><div class='highlight'><pre> assign: <span class="hljs-function"><span class="hljs-params">(name, value)</span> -&gt;</span>
@add name, {value, assigned: <span class="hljs-literal">yes</span>}, <span class="hljs-literal">yes</span>
@hasAssignments = <span class="hljs-literal">yes</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Does this scope have any declared variables?</p>
</div>
<div class="content"><div class='highlight'><pre> hasDeclarations: <span class="hljs-function">-&gt;</span>
!!@declaredVariables().length</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Return the list of variables first declared in this scope.</p>
</div>
<div class="content"><div class='highlight'><pre> declaredVariables: <span class="hljs-function">-&gt;</span>
(v.name <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.type <span class="hljs-keyword">is</span> <span class="hljs-string">'var'</span>).sort()</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Return the list of assignments that are supposed to be made at the top
of this scope.</p>
</div>
<div class="content"><div class='highlight'><pre> assignedVariables: <span class="hljs-function">-&gt;</span>
<span class="hljs-string">"<span class="hljs-subst">#{v.name}</span> = <span class="hljs-subst">#{v.type.value}</span>"</span> <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.type.assigned</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,523 @@
<!DOCTYPE html>
<html>
<head>
<title>sourcemap.litcoffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffee-script.html">
coffee-script.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>sourcemap.litcoffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Source maps allow JavaScript runtimes to match running JavaScript back to
the original source code that corresponds to it. This can be minified
JavaScript, but in our case, were concerned with mapping pretty-printed
JavaScript back to CoffeeScript.</p>
<p>In order to produce maps, we must keep track of positions (line number, column number)
that originated every node in the syntax tree, and be able to generate a
<a href="https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit">map file</a>
— which is a compact, VLQ-encoded representation of the JSON serialization
of this information — to write out alongside the generated JavaScript.</p>
<h2 id="linemap">LineMap</h2>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>A <strong>LineMap</strong> object keeps track of information about original line and column
positions for a single line of output JavaScript code.
<strong>SourceMaps</strong> are implemented in terms of <strong>LineMaps</strong>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LineMap</span></span>
constructor: <span class="hljs-function"><span class="hljs-params">(@line)</span> -&gt;</span>
@columns = []
add: <span class="hljs-function"><span class="hljs-params">(column, [sourceLine, sourceColumn], options={})</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> @columns[column] <span class="hljs-keyword">and</span> options.noReplace
@columns[column] = {line: @line, column, sourceLine, sourceColumn}
sourceLocation: <span class="hljs-function"><span class="hljs-params">(column)</span> -&gt;</span>
column-- <span class="hljs-keyword">until</span> (mapping = @columns[column]) <span class="hljs-keyword">or</span> (column &lt;= <span class="hljs-number">0</span>)
mapping <span class="hljs-keyword">and</span> [mapping.sourceLine, mapping.sourceColumn]</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<h2 id="sourcemap">SourceMap</h2>
</div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Maps locations in a single generated JavaScript file back to locations in
the original CoffeeScript source file.</p>
<p>This is intentionally agnostic towards how a source map might be represented on
disk. Once the compiler is ready to produce a “v3”-style source map, we can walk
through the arrays of line and column buffer to produce it.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SourceMap</span></span>
constructor: <span class="hljs-function">-&gt;</span>
@lines = []</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Adds a mapping to this SourceMap. <code>sourceLocation</code> and <code>generatedLocation</code>
are both <code>[line, column]</code> arrays. If <code>options.noReplace</code> is true, then if there
is already a mapping for the specified <code>line</code> and <code>column</code>, this will have no
effect.</p>
</div>
<div class="content"><div class='highlight'><pre> add: <span class="hljs-function"><span class="hljs-params">(sourceLocation, generatedLocation, options = {})</span> -&gt;</span>
[line, column] = generatedLocation
lineMap = (@lines[line] <span class="hljs-keyword">or</span>= <span class="hljs-keyword">new</span> LineMap(line))
lineMap.add column, sourceLocation, options</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Look up the original position of a given <code>line</code> and <code>column</code> in the generated
code.</p>
</div>
<div class="content"><div class='highlight'><pre> sourceLocation: <span class="hljs-function"><span class="hljs-params">([line, column])</span> -&gt;</span>
line-- <span class="hljs-keyword">until</span> (lineMap = @lines[line]) <span class="hljs-keyword">or</span> (line &lt;= <span class="hljs-number">0</span>)
lineMap <span class="hljs-keyword">and</span> lineMap.sourceLocation column</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<h2 id="v3-sourcemap-generation">V3 SourceMap Generation</h2>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Builds up a V3 source map, returning the generated JSON as a string.
<code>options.sourceRoot</code> may be used to specify the sourceRoot written to the source
map. Also, <code>options.sourceFiles</code> and <code>options.generatedFile</code> may be passed to
set “sources” and “file”, respectively.</p>
</div>
<div class="content"><div class='highlight'><pre> generate: <span class="hljs-function"><span class="hljs-params">(options = {}, code = <span class="hljs-literal">null</span>)</span> -&gt;</span>
writingline = <span class="hljs-number">0</span>
lastColumn = <span class="hljs-number">0</span>
lastSourceLine = <span class="hljs-number">0</span>
lastSourceColumn = <span class="hljs-number">0</span>
needComma = <span class="hljs-literal">no</span>
buffer = <span class="hljs-string">""</span>
<span class="hljs-keyword">for</span> lineMap, lineNumber <span class="hljs-keyword">in</span> @lines <span class="hljs-keyword">when</span> lineMap
<span class="hljs-keyword">for</span> mapping <span class="hljs-keyword">in</span> lineMap.columns <span class="hljs-keyword">when</span> mapping
<span class="hljs-keyword">while</span> writingline &lt; mapping.line
lastColumn = <span class="hljs-number">0</span>
needComma = <span class="hljs-literal">no</span>
buffer += <span class="hljs-string">";"</span>
writingline++</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Write a comma if weve already written a segment on this line.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> needComma
buffer += <span class="hljs-string">","</span>
needComma = <span class="hljs-literal">no</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Write the next segment. Segments can be 1, 4, or 5 values. If just one, then it
is a generated column which doesnt match anything in the source code.</p>
<p>The starting column in the generated source, relative to any previous recorded
column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.column - lastColumn
lastColumn = mapping.column</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>The index into the list of sources:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>The starting line in the original source, relative to the previous source line.</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.sourceLine - lastSourceLine
lastSourceLine = mapping.sourceLine</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>The starting column in the original source, relative to the previous column.</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.sourceColumn - lastSourceColumn
lastSourceColumn = mapping.sourceColumn
needComma = <span class="hljs-literal">yes</span></pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Produce the canonical JSON object format for a “v3” source map.</p>
</div>
<div class="content"><div class='highlight'><pre> v3 =
version: <span class="hljs-number">3</span>
file: options.generatedFile <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
sourceRoot: options.sourceRoot <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
sources: options.sourceFiles <span class="hljs-keyword">or</span> [<span class="hljs-string">''</span>]
names: []
mappings: buffer
v3.sourcesContent = [code] <span class="hljs-keyword">if</span> options.inlineMap
v3</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<h2 id="base64-vlq-encoding">Base64 VLQ Encoding</h2>
</div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Note that SourceMap VLQ encoding is “backwards”. MIDI-style VLQ encoding puts
the most-significant-bit (MSB) from the original value into the MSB of the VLQ
encoded value (see <a href="https://en.wikipedia.org/wiki/File:Uintvar_coding.svg">Wikipedia</a>).
SourceMap VLQ does things the other way around, with the least significat four
bits of the original value encoded into the first byte of the VLQ encoded value.</p>
</div>
<div class="content"><div class='highlight'><pre> VLQ_SHIFT = <span class="hljs-number">5</span>
VLQ_CONTINUATION_BIT = <span class="hljs-number">1</span> &lt;&lt; VLQ_SHIFT <span class="hljs-comment"># 0010 0000</span>
VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - <span class="hljs-number">1</span> <span class="hljs-comment"># 0001 1111</span>
encodeVlq: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
answer = <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Least significant bit represents the sign.</p>
</div>
<div class="content"><div class='highlight'><pre> signBit = <span class="hljs-keyword">if</span> value &lt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>The next bits are the actual value.</p>
</div>
<div class="content"><div class='highlight'><pre> valueToEncode = (Math.abs(value) &lt;&lt; <span class="hljs-number">1</span>) + signBit</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Make sure we encode at least one character, even if valueToEncode is 0.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">while</span> valueToEncode <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> answer
nextChunk = valueToEncode &amp; VLQ_VALUE_MASK
valueToEncode = valueToEncode &gt;&gt; VLQ_SHIFT
nextChunk |= VLQ_CONTINUATION_BIT <span class="hljs-keyword">if</span> valueToEncode
answer += @encodeBase64 nextChunk
answer</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<h2 id="regular-base64-encoding">Regular Base64 Encoding</h2>
</div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre> BASE64_CHARS = <span class="hljs-string">'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'</span>
encodeBase64: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
BASE64_CHARS[value] <span class="hljs-keyword">or</span> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Cannot Base64 encode value: <span class="hljs-subst">#{value}</span>"</span></pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Our API for source maps is just the <code>SourceMap</code> class.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">module</span>.exports = SourceMap</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,405 @@
/**
* CoffeeScript Compiler v1.12.6
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(u,xa,va){if(null==u)throw new TypeError("The 'this' value for String.prototype."+va+" must not be null or undefined");if(xa instanceof RegExp)throw new TypeError("First argument to String.prototype."+va+" must not be a regular expression");return u+""};
$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(u,xa,va){if(va.get||va.set)throw new TypeError("ES3 does not support getters and setters.");u!=Array.prototype&&u!=Object.prototype&&(u[xa]=va.value)};$jscomp.getGlobal=function(u){return"undefined"!=typeof window&&window===u?u:"undefined"!=typeof global&&null!=global?global:u};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(u,xa,va,f){if(xa){va=$jscomp.global;u=u.split(".");for(f=0;f<u.length-1;f++){var qa=u[f];qa in va||(va[qa]={});va=va[qa]}u=u[u.length-1];f=va[u];xa=xa(f);xa!=f&&null!=xa&&$jscomp.defineProperty(va,u,{configurable:!0,writable:!0,value:xa})}};
$jscomp.polyfill("String.prototype.repeat",function(u){return u?u:function(u){var va=$jscomp.checkStringArgs(this,null,"repeat");if(0>u||1342177279<u)throw new RangeError("Invalid count value");u|=0;for(var f="";u;)if(u&1&&(f+=va),u>>>=1)va+=va;return f}},"es6-impl","es3");$jscomp.findInternal=function(u,xa,va){u instanceof String&&(u=String(u));for(var f=u.length,qa=0;qa<f;qa++){var q=u[qa];if(xa.call(va,q,qa,u))return{i:qa,v:q}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(u){return u?u:function(u,va){return $jscomp.findInternal(this,u,va).v}},"es6-impl","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(u){return $jscomp.SYMBOL_PREFIX+(u||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var u=$jscomp.global.Symbol.iterator;u||(u=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[u]&&$jscomp.defineProperty(Array.prototype,u,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};
$jscomp.arrayIterator=function(u){var xa=0;return $jscomp.iteratorPrototype(function(){return xa<u.length?{done:!1,value:u[xa++]}:{done:!0}})};$jscomp.iteratorPrototype=function(u){$jscomp.initSymbolIterator();u={next:u};u[$jscomp.global.Symbol.iterator]=function(){return this};return u};
$jscomp.iteratorFromArray=function(u,xa){$jscomp.initSymbolIterator();u instanceof String&&(u+="");var va=0,f={next:function(){if(va<u.length){var qa=va++;return{value:xa(qa,u[qa]),done:!1}}f.next=function(){return{done:!0,value:void 0}};return f.next()}};f[Symbol.iterator]=function(){return f};return f};$jscomp.polyfill("Array.prototype.keys",function(u){return u?u:function(){return $jscomp.iteratorFromArray(this,function(u){return u})}},"es6-impl","es3");
(function(u){var xa=function(){function u(f){return u[f]}u["../../package.json"]={name:"coffee-script",description:"Unfancy JavaScript",keywords:["javascript","language","coffeescript","compiler"],author:"Jeremy Ashkenas",version:"1.12.6",license:"MIT",engines:{node:"\x3e\x3d0.8.0"},directories:{lib:"./lib/coffee-script"},main:"./lib/coffee-script/coffee-script",bin:{coffee:"./bin/coffee",cake:"./bin/cake"},files:["bin","lib","register.js","repl.js"],scripts:{test:"node ./bin/cake test","test-harmony":"node --harmony ./bin/cake test"},
homepage:"http://coffeescript.org",bugs:"https://github.com/jashkenas/coffeescript/issues",repository:{type:"git",url:"git://github.com/jashkenas/coffeescript.git"},devDependencies:{docco:"~0.7.0","google-closure-compiler-js":"^20170423.0.0","highlight.js":"~9.11.0",jison:"\x3e\x3d0.4.17","markdown-it":"^8.3.1",underscore:"~1.8.3"}};u["./helpers"]=function(){var f={};(function(){var u,q,y;f.starts=function(a,h,r){return h===a.substr(r,h.length)};f.ends=function(a,h,r){var g=h.length;return h===a.substr(a.length-
g-(r||0),g)};f.repeat=y=function(a,h){var g;for(g="";0<h;)h&1&&(g+=a),h>>>=1,a+=a;return g};f.compact=function(a){var g,b;var n=[];var y=0;for(b=a.length;y<b;y++)(g=a[y])&&n.push(g);return n};f.count=function(a,h){var g;var b=g=0;if(!h.length)return 1/0;for(;g=1+a.indexOf(h,g);)b++;return b};f.merge=function(g,h){return a(a({},g),h)};var a=f.extend=function(a,h){var g;for(g in h){var b=h[g];a[g]=b}return a};f.flatten=u=function(a){var g;var b=[];var y=0;for(g=a.length;y<g;y++){var f=a[y];"[object Array]"===
Object.prototype.toString.call(f)?b=b.concat(u(f)):b.push(f)}return b};f.del=function(a,h){var g=a[h];delete a[h];return g};f.some=null!=(q=Array.prototype.some)?q:function(a){var g;var b=0;for(g=this.length;b<g;b++){var y=this[b];if(a(y))return!0}return!1};f.invertLiterate=function(a){var g=!0;var b;var y=a.split("\n");var f=[];var H=0;for(b=y.length;H<b;H++)a=y[H],g&&/^([ ]{4}|[ ]{0,3}\t)/.test(a)?f.push(a):(g=/^\s*$/.test(a))?f.push(a):f.push("# "+a);return f.join("\n")};var b=function(a,b){return b?
{first_line:a.first_line,first_column:a.first_column,last_line:b.last_line,last_column:b.last_column}:a};f.addLocationDataFn=function(a,h){return function(g){"object"===typeof g&&g.updateLocationDataIfMissing&&g.updateLocationDataIfMissing(b(a,h));return g}};f.locationDataToString=function(a){var g;"2"in a&&"first_line"in a[2]?g=a[2]:"first_line"in a&&(g=a);return g?g.first_line+1+":"+(g.first_column+1)+"-"+(g.last_line+1+":"+(g.last_column+1)):"No location data"};f.baseFileName=function(a,b,y){null==
b&&(b=!1);null==y&&(y=!1);a=a.split(y?/\\|\//:/\//);a=a[a.length-1];if(!(b&&0<=a.indexOf(".")))return a;a=a.split(".");a.pop();"coffee"===a[a.length-1]&&1<a.length&&a.pop();return a.join(".")};f.isCoffee=function(a){return/\.((lit)?coffee|coffee\.md)$/.test(a)};f.isLiterate=function(a){return/\.(litcoffee|coffee\.md)$/.test(a)};f.throwSyntaxError=function(a,b){a=new SyntaxError(a);a.location=b;a.toString=ya;a.stack=a.toString();throw a;};f.updateSyntaxError=function(a,b,y){a.toString===ya&&(a.code||
(a.code=b),a.filename||(a.filename=y),a.stack=a.toString());return a};var ya=function(){var a,b,f;if(!this.code||!this.location)return Error.prototype.toString.call(this);var n=this.location;var B=n.first_line;var H=n.first_column;var I=n.last_line;var F=n.last_column;null==I&&(I=B);null==F&&(F=H);var u=this.filename||"[stdin]";n=this.code.split("\n")[B];I=B===I?F+1:n.length;F=n.slice(0,H).replace(/[^\s]/g," ")+y("^",I-H);if("undefined"!==typeof process&&null!==process)var x=(null!=(a=process.stdout)?
a.isTTY:void 0)&&!(null!=(b=process.env)&&b.NODE_DISABLE_COLORS);if(null!=(f=this.colorful)?f:x)x=function(a){return"\u001b[1;31m"+a+"\u001b[0m"},n=n.slice(0,H)+x(n.slice(H,I))+n.slice(I),F=x(F);return u+":"+(B+1)+":"+(H+1)+": error: "+this.message+"\n"+n+"\n"+F};f.nameWhitespaceCharacter=function(a){switch(a){case " ":return"space";case "\n":return"newline";case "\r":return"carriage return";case "\t":return"tab";default:return a}}}).call(this);return f}();u["./rewriter"]=function(){var f={};(function(){var u,
q,y=[].indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in this&&this[c]===a)return c;return-1},a=[].slice;var b=function(a,c,b){a=[a,c];a.generated=!0;b&&(a.origin=b);return a};f.Rewriter=function(){function l(){}l.prototype.rewrite=function(a){this.tokens=a;this.removeLeadingNewlines();this.closeOpenCalls();this.closeOpenIndexes();this.normalizeLines();this.tagPostfixConditionals();this.addImplicitBracesAndParens();this.addLocationDataToGeneratedTokens();this.fixOutdentLocationData();
return this.tokens};l.prototype.scanTokens=function(a){var c,b;var k=this.tokens;for(c=0;b=k[c];)c+=a.call(this,b,c,k);return!0};l.prototype.detectEnd=function(a,b,m){var c,w,l,L;var f=this.tokens;for(c=0;L=f[a];){if(0===c&&b.call(this,L,a))return m.call(this,L,a);if(!L||0>c)return m.call(this,L,a-1);(w=L[0],0<=y.call(g,w))?c+=1:(l=L[0],0<=y.call(h,l))&&--c;a+=1}return a-1};l.prototype.removeLeadingNewlines=function(){var a,b;var m=this.tokens;var k=a=0;for(b=m.length;a<b;k=++a){var g=m[k][0];if("TERMINATOR"!==
g)break}if(k)return this.tokens.splice(0,k)};l.prototype.closeOpenCalls=function(){var a=function(a,c){var k;return")"===(k=a[0])||"CALL_END"===k||"OUTDENT"===a[0]&&")"===this.tag(c-1)};var b=function(a,c){return this.tokens["OUTDENT"===a[0]?c-1:c][0]="CALL_END"};return this.scanTokens(function(c,k){"CALL_START"===c[0]&&this.detectEnd(k+1,a,b);return 1})};l.prototype.closeOpenIndexes=function(){var a=function(a,c){var k;return"]"===(k=a[0])||"INDEX_END"===k};var b=function(a,c){return a[0]="INDEX_END"};
return this.scanTokens(function(c,k){"INDEX_START"===c[0]&&this.detectEnd(k+1,a,b);return 1})};l.prototype.indexOfTag=function(){var c,b,g,k;var l=arguments[0];var h=2<=arguments.length?a.call(arguments,1):[];var f=b=c=0;for(g=h.length;0<=g?b<g:b>g;f=0<=g?++b:--b){for(;"HERECOMMENT"===this.tag(l+f+c);)c+=2;if(null!=h[f]&&("string"===typeof h[f]&&(h[f]=[h[f]]),k=this.tag(l+f+c),0>y.call(h[f],k)))return-1}return l+f+c-1};l.prototype.looksObjectish=function(a){if(-1<this.indexOfTag(a,"@",null,":")||
-1<this.indexOfTag(a,null,":"))return!0;a=this.indexOfTag(a,g);if(-1<a){var c=null;this.detectEnd(a+1,function(a){var c;return c=a[0],0<=y.call(h,c)},function(a,b){return c=b});if(":"===this.tag(c+1))return!0}return!1};l.prototype.findTagsBackwards=function(a,b){var c,k,l,w,f,n,x;for(c=[];0<=a&&(c.length||(w=this.tag(a),0>y.call(b,w))&&((f=this.tag(a),0>y.call(g,f))||this.tokens[a].generated)&&(n=this.tag(a),0>y.call(R,n)));)(k=this.tag(a),0<=y.call(h,k))&&c.push(this.tag(a)),(l=this.tag(a),0<=y.call(g,
l))&&c.length&&c.pop(),--a;return x=this.tag(a),0<=y.call(b,x)};l.prototype.addImplicitBracesAndParens=function(){var a=[];var l=null;return this.scanTokens(function(c,k,f){var m,w,n,r;var G=c[0];var K=(m=0<k?f[k-1]:[])[0];var u=(k<f.length-1?f[k+1]:[])[0];var B=function(){return a[a.length-1]};var D=k;var A=function(a){return k-D+a};var H=function(a){var b;return null!=a?null!=(b=a[2])?b.ours:void 0:void 0};var E=function(a){return H(a)&&"{"===(null!=a?a[0]:void 0)};var J=function(a){return H(a)&&
"("===(null!=a?a[0]:void 0)};var O=function(){return H(B())};var C=function(){return J(B())};var T=function(){return E(B())};var v=function(){var a;return O&&"CONTROL"===(null!=(a=B())?a[0]:void 0)};var Y=function(c){var g=null!=c?c:k;a.push(["(",g,{ours:!0}]);f.splice(g,0,b("CALL_START","("));if(null==c)return k+=1};var S=function(){a.pop();f.splice(k,0,b("CALL_END",")",["","end of input",c[2]]));return k+=1};var M=function(g,l){null==l&&(l=!0);var m=null!=g?g:k;a.push(["{",m,{sameLine:!0,startsLine:l,
ours:!0}]);l=new String("{");l.generated=!0;f.splice(m,0,b("{",l,c));if(null==g)return k+=1};var q=function(g){g=null!=g?g:k;a.pop();f.splice(g,0,b("}","}",c));return k+=1};if(C()&&("IF"===G||"TRY"===G||"FINALLY"===G||"CATCH"===G||"CLASS"===G||"SWITCH"===G))return a.push(["CONTROL",k,{ours:!0}]),A(1);if("INDENT"===G&&O()){if("\x3d\x3e"!==K&&"-\x3e"!==K&&"["!==K&&"("!==K&&","!==K&&"{"!==K&&"TRY"!==K&&"ELSE"!==K&&"\x3d"!==K)for(;C();)S();v()&&a.pop();a.push([G,k]);return A(1)}if(0<=y.call(g,G))return a.push([G,
k]),A(1);if(0<=y.call(h,G)){for(;O();)C()?S():T()?q():a.pop();l=a.pop()}if((0<=y.call(I,G)&&c.spaced||"?"===G&&0<k&&!f[k-1].spaced)&&(0<=y.call(F,u)||0<=y.call(Q,u)&&(null==(w=f[k+1])||!w.spaced)&&(null==(n=f[k+1])||!n.newLine)))return"?"===G&&(G=c[0]="FUNC_EXIST"),Y(k+1),A(2);if(0<=y.call(I,G)&&-1<this.indexOfTag(k+1,"INDENT")&&this.looksObjectish(k+2)&&!this.findTagsBackwards(k,"CLASS EXTENDS IF CATCH SWITCH LEADING_WHEN FOR WHILE UNTIL".split(" ")))return Y(k+1),a.push(["INDENT",k+2]),A(3);if(":"===
G){for(q=function(){var a;switch(!1){case a=this.tag(k-1),0>y.call(h,a):return l[1];case "@"!==this.tag(k-2):return k-2;default:return k-1}}.call(this);"HERECOMMENT"===this.tag(q-2);)q-=2;this.insideForDeclaration="FOR"===u;m=0===q||(r=this.tag(q-1),0<=y.call(R,r))||f[q-1].newLine;if(B()&&(T=B(),r=T[0],v=T[1],("{"===r||"INDENT"===r&&"{"===this.tag(v-1))&&(m||","===this.tag(q-1)||"{"===this.tag(q-1))))return A(1);M(q,!!m);return A(2)}if(0<=y.call(R,G))for(M=a.length-1;0<=M;M+=-1)r=a[M],E(r)&&(r[2].sameLine=
!1);M="OUTDENT"===K||m.newLine;if(0<=y.call(x,G)||0<=y.call(z,G)&&M)for(;O();)if(M=B(),r=M[0],v=M[1],m=M[2],M=m.sameLine,m=m.startsLine,C()&&","!==K)S();else if(T()&&!this.insideForDeclaration&&M&&"TERMINATOR"!==G&&":"!==K)q();else if(!T()||"TERMINATOR"!==G||","===K||m&&this.looksObjectish(k+1))break;else{if("HERECOMMENT"===u)return A(1);q()}if(!(","!==G||this.looksObjectish(k+1)||!T()||this.insideForDeclaration||"TERMINATOR"===u&&this.looksObjectish(k+2)))for(u="OUTDENT"===u?1:0;T();)q(k+u);return A(1)})};
l.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(a,b,g){var c,l;if(a[2]||!a.generated&&!a.explicit)return 1;if("{"===a[0]&&(c=null!=(l=g[b+1])?l[2]:void 0)){var m=c.first_line;c=c.first_column}else(c=null!=(m=g[b-1])?m[2]:void 0)?(m=c.last_line,c=c.last_column):m=c=0;a[2]={first_line:m,first_column:c,last_line:m,last_column:c};return 1})};l.prototype.fixOutdentLocationData=function(){return this.scanTokens(function(a,b,g){if(!("OUTDENT"===a[0]||a.generated&&
"CALL_END"===a[0]||a.generated&&"}"===a[0]))return 1;b=g[b-1][2];a[2]={first_line:b.last_line,first_column:b.last_column,last_line:b.last_line,last_column:b.last_column};return 1})};l.prototype.normalizeLines=function(){var b,g;var l=b=g=null;var k=function(a,b){var c,g,k,f;return";"!==a[1]&&(c=a[0],0<=y.call(O,c))&&!("TERMINATOR"===a[0]&&(g=this.tag(b+1),0<=y.call(H,g)))&&!("ELSE"===a[0]&&"THEN"!==l)&&!!("CATCH"!==(k=a[0])&&"FINALLY"!==k||"-\x3e"!==l&&"\x3d\x3e"!==l)||(f=a[0],0<=y.call(z,f))&&(this.tokens[b-
1].newLine||"OUTDENT"===this.tokens[b-1][0])};var f=function(a,b){return this.tokens.splice(","===this.tag(b-1)?b-1:b,0,g)};return this.scanTokens(function(c,m,h){var w,n,r;c=c[0];if("TERMINATOR"===c){if("ELSE"===this.tag(m+1)&&"OUTDENT"!==this.tag(m-1))return h.splice.apply(h,[m,1].concat(a.call(this.indentation()))),1;if(w=this.tag(m+1),0<=y.call(H,w))return h.splice(m,1),0}if("CATCH"===c)for(w=n=1;2>=n;w=++n)if("OUTDENT"===(r=this.tag(m+w))||"TERMINATOR"===r||"FINALLY"===r)return h.splice.apply(h,
[m+w,0].concat(a.call(this.indentation()))),2+w;0<=y.call(J,c)&&"INDENT"!==this.tag(m+1)&&("ELSE"!==c||"IF"!==this.tag(m+1))&&(l=c,r=this.indentation(h[m]),b=r[0],g=r[1],"THEN"===l&&(b.fromThen=!0),h.splice(m+1,0,b),this.detectEnd(m+2,k,f),"THEN"===c&&h.splice(m,1));return 1})};l.prototype.tagPostfixConditionals=function(){var a=null;var b=function(a,b){a=a[0];b=this.tokens[b-1][0];return"TERMINATOR"===a||"INDENT"===a&&0>y.call(J,b)};var g=function(b,c){if("INDENT"!==b[0]||b.generated&&!b.fromThen)return a[0]=
"POST_"+a[0]};return this.scanTokens(function(c,l){if("IF"!==c[0])return 1;a=c;this.detectEnd(l+1,b,g);return 1})};l.prototype.indentation=function(a){var b=["INDENT",2];var c=["OUTDENT",2];a?(b.generated=c.generated=!0,b.origin=c.origin=a):b.explicit=c.explicit=!0;return[b,c]};l.prototype.generate=b;l.prototype.tag=function(a){var b;return null!=(b=this.tokens[a])?b[0]:void 0};return l}();var ya=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],
["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],["REGEX_START","REGEX_END"]];f.INVERSES=u={};var g=[];var h=[];var r=0;for(q=ya.length;r<q;r++){var n=ya[r];var B=n[0];n=n[1];g.push(u[n]=B);h.push(u[B]=n)}var H=["CATCH","THEN","ELSE","FINALLY"].concat(h);var I="IDENTIFIER PROPERTY SUPER ) CALL_END ] INDEX_END @ THIS".split(" ");var F="IDENTIFIER PROPERTY NUMBER INFINITY NAN STRING STRING_START REGEX REGEX_START JS NEW PARAM_START CLASS IF TRY SWITCH THIS UNDEFINED NULL BOOL UNARY YIELD UNARY_MATH SUPER THROW @ -\x3e \x3d\x3e [ ( { -- ++".split(" ");
var Q=["+","-"];var x="POST_IF FOR WHILE UNTIL WHEN BY LOOP TERMINATOR".split(" ");var J="ELSE -\x3e \x3d\x3e TRY FINALLY THEN".split(" ");var O="TERMINATOR CATCH FINALLY ELSE OUTDENT LEADING_WHEN".split(" ");var R=["TERMINATOR","INDENT","OUTDENT"];var z=[".","?.","::","?::"]}).call(this);return f}();u["./lexer"]=function(){var f={};(function(){var qa,q=[].indexOf||function(a){for(var N=0,b=this.length;N<b;N++)if(N in this&&this[N]===a)return N;return-1},y=[].slice;var a=u("./rewriter");var b=a.Rewriter;
var ya=a.INVERSES;a=u("./helpers");var g=a.count;var h=a.repeat;var r=a.invertLiterate;var n=a.throwSyntaxError;f.Lexer=function(){function a(){}a.prototype.tokenize=function(a,c){var N,g;null==c&&(c={});this.literate=c.literate;this.outdebt=this.indebt=this.baseIndent=this.indent=0;this.indents=[];this.ends=[];this.tokens=[];this.exportSpecifierList=this.importSpecifierList=this.seenExport=this.seenImport=this.seenFor=!1;this.chunkLine=c.line||0;this.chunkColumn=c.column||0;a=this.clean(a);for(g=
0;this.chunk=a.slice(g);){var l=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken();var k=this.getLineAndColumnFromChunk(l);this.chunkLine=k[0];this.chunkColumn=k[1];g+=l;if(c.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:g}}this.closeIndentation();(N=this.ends.pop())&&this.error("missing "+N.tag,N.origin[2]);return!1===c.rewrite?this.tokens:(new b).rewrite(this.tokens)};
a.prototype.clean=function(a){a.charCodeAt(0)===R&&(a=a.slice(1));a=a.replace(/\r/g,"").replace(Z,"");w.test(a)&&(a="\n"+a,this.chunkLine--);this.literate&&(a=r(a));return a};a.prototype.identifierToken=function(){var a,b,c,g,l,k,m;if(!(a=z.exec(this.chunk)))return 0;var f=a[0];var h=a[1];a=a[2];var y=h.length;var w=void 0;if("own"===h&&"FOR"===this.tag())return this.token("OWN",h),h.length;if("from"===h&&"YIELD"===this.tag())return this.token("FROM",h),h.length;if("as"===h&&this.seenImport){if("*"===
this.value())this.tokens[this.tokens.length-1][0]="IMPORT_ALL";else if(b=this.value(),0<=q.call(F,b))this.tokens[this.tokens.length-1][0]="IDENTIFIER";if("DEFAULT"===(c=this.tag())||"IMPORT_ALL"===c||"IDENTIFIER"===c)return this.token("AS",h),h.length}if("as"===h&&this.seenExport&&("IDENTIFIER"===(g=this.tag())||"DEFAULT"===g))return this.token("AS",h),h.length;if("default"===h&&this.seenExport&&("EXPORT"===(l=this.tag())||"AS"===l))return this.token("DEFAULT",h),h.length;b=this.tokens;b=b[b.length-
1];var n=a||null!=b&&("."===(k=b[0])||"?."===k||"::"===k||"?::"===k||!b.spaced&&"@"===b[0])?"PROPERTY":"IDENTIFIER";"IDENTIFIER"!==n||!(0<=q.call(I,h)||0<=q.call(F,h))||this.exportSpecifierList&&0<=q.call(F,h)?"IDENTIFIER"===n&&this.seenFor&&"from"===h&&H(b)&&(n="FORFROM",this.seenFor=!1):(n=h.toUpperCase(),"WHEN"===n&&(m=this.tag(),0<=q.call(ra,m))?n="LEADING_WHEN":"FOR"===n?this.seenFor=!0:"UNLESS"===n?n="IF":"IMPORT"===n?this.seenImport=!0:"EXPORT"===n?this.seenExport=!0:0<=q.call(ia,n)?n="UNARY":
0<=q.call(pa,n)&&("INSTANCEOF"!==n&&this.seenFor?(n="FOR"+n,this.seenFor=!1):(n="RELATION","!"===this.value()&&(w=this.tokens.pop(),h="!"+h))));"IDENTIFIER"===n&&0<=q.call(J,h)&&this.error("reserved word '"+h+"'",{length:h.length});if("PROPERTY"!==n){if(0<=q.call(x,h)){var r=h;h=Q[h]}n=function(){switch(h){case "!":return"UNARY";case "\x3d\x3d":case "!\x3d":return"COMPARE";case "true":case "false":return"BOOL";case "break":case "continue":case "debugger":return"STATEMENT";case "\x26\x26":case "||":return h;
default:return n}}()}k=this.token(n,h,0,y);r&&(k.origin=[n,r,k[2]]);w&&(r=[w[2].first_line,w[2].first_column],k[2].first_line=r[0],k[2].first_column=r[1]);a&&(r=f.lastIndexOf(":"),this.token(":",":",r,a.length));return f.length};a.prototype.numberToken=function(){var a,b;if(!(a=l.exec(this.chunk)))return 0;var c=a[0];a=c.length;switch(!1){case !/^0[BOX]/.test(c):this.error("radix prefix in '"+c+"' must be lowercase",{offset:1});break;case !/^(?!0x).*E/.test(c):this.error("exponential notation in '"+
c+"' must be indicated with a lowercase 'e'",{offset:c.indexOf("E")});break;case !/^0\d*[89]/.test(c):this.error("decimal literal '"+c+"' must not be prefixed with '0'",{length:a});break;case !/^0\d+/.test(c):this.error("octal literal '"+c+"' must be prefixed with '0o'",{length:a})}var g=function(){switch(c.charAt(1)){case "b":return 2;case "o":return 8;case "x":return 16;default:return null}}();g=null!=g?parseInt(c.slice(2),g):parseFloat(c);if("b"===(b=c.charAt(1))||"o"===b)c="0x"+g.toString(16);
this.token(Infinity===g?"INFINITY":"NUMBER",c,0,a);return a};a.prototype.stringToken=function(){var a,b,c,g,l;var k=(V.exec(this.chunk)||[])[0];if(!k)return 0;this.tokens.length&&"from"===this.value()&&(this.seenImport||this.seenExport)&&(this.tokens[this.tokens.length-1][0]="FROM");var h=function(){switch(k){case "'":return X;case '"':return G;case "'''":return aa;case '"""':return U}}();var m=3===k.length;h=this.matchWithInterpolations(h,k);var f=h.tokens;var n=h.index;var y=f.length-1;h=k.charAt(0);
if(m){var w=null;for(m=function(){var a,c;var N=[];b=a=0;for(c=f.length;a<c;b=++a)l=f[b],"NEOSTRING"===l[0]&&N.push(l[1]);return N}().join("#{}");a=A.exec(m);)if(a=a[1],null===w||0<(g=a.length)&&g<w.length)w=a;w&&(c=RegExp("\\n"+w,"g"));this.mergeInterpolationTokens(f,{delimiter:h},function(a){return function(b,N){b=a.formatString(b,{delimiter:k});c&&(b=b.replace(c,"\n"));0===N&&(b=b.replace(za,""));N===y&&(b=b.replace(ma,""));return b}}(this))}else this.mergeInterpolationTokens(f,{delimiter:h},function(a){return function(b,
N){b=a.formatString(b,{delimiter:k});return b=b.replace(D,function(a,p){return 0===N&&0===p||N===y&&p+a.length===b.length?"":" "})}}(this));return n};a.prototype.commentToken=function(){var a,b;if(!(b=this.chunk.match(m)))return 0;var c=b[0];if(a=b[1])(b=Y.exec(c))&&this.error("block comments cannot contain "+b[0],{offset:b.index,length:b[0].length}),0<=a.indexOf("\n")&&(a=a.replace(RegExp("\\n"+h(" ",this.indent),"g"),"\n")),this.token("HERECOMMENT",a,0,c.length);return c.length};a.prototype.jsToken=
function(){var a;if("`"!==this.chunk.charAt(0)||!(a=L.exec(this.chunk)||P.exec(this.chunk)))return 0;var b=a[1].replace(/\\+(`|$)/g,function(a){return a.slice(-Math.ceil(a.length/2))});this.token("JS",b,0,a[0].length);return a[0].length};a.prototype.regexToken=function(){var a,b,c;switch(!1){case !(a=T.exec(this.chunk)):this.error("regular expressions cannot begin with "+a[2],{offset:a.index+a[1].length});break;case !(a=this.matchWithInterpolations(ca,"///")):var g=a.tokens;var k=a.index;break;case !(a=
fc.exec(this.chunk)):var l=a[0];var h=a[1];a=a[2];this.validateEscapes(h,{isRegex:!0,offsetInChunk:1});h=this.formatRegex(h,{delimiter:"/"});k=l.length;var m=this.tokens;if(m=m[m.length-1])if(m.spaced&&(b=m[0],0<=q.call(ha,b))){if(!a||v.test(l))return 0}else if(c=m[0],0<=q.call(na,c))return 0;a||this.error("missing / (unclosed regex)");break;default:return 0}c=E.exec(this.chunk.slice(k))[0];b=k+c.length;a=this.makeToken("REGEX",null,0,b);switch(!1){case !!ba.test(c):this.error("invalid regular expression flags "+
c,{offset:k,length:c.length});break;case !(l||1===g.length):null==h&&(h=this.formatHeregex(g[0][1]));this.token("REGEX",""+this.makeDelimitedLiteral(h,{delimiter:"/"})+c,0,b,a);break;default:this.token("REGEX_START","(",0,0,a),this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),this.mergeInterpolationTokens(g,{delimiter:'"',double:!0},this.formatHeregex),c&&(this.token(",",",",k-1,0),this.token("STRING",'"'+c+'"',k-1,c.length)),this.token(")",")",b-1,0),this.token("REGEX_END",")",
b-1,0)}return b};a.prototype.lineToken=function(){var a;if(!(a=K.exec(this.chunk)))return 0;a=a[0];this.seenFor=!1;this.importSpecifierList||(this.seenImport=!1);this.exportSpecifierList||(this.seenExport=!1);var b=a.length-1-a.lastIndexOf("\n");var c=this.unfinished();if(b-this.indebt===this.indent)return c?this.suppressNewlines():this.newlineToken(0),a.length;if(b>this.indent){if(c||"RETURN"===this.tag())return this.indebt=b-this.indent,this.suppressNewlines(),a.length;if(!this.tokens.length)return this.baseIndent=
this.indent=b,a.length;c=b-this.indent+this.outdebt;this.token("INDENT",c,a.length-b,b);this.indents.push(c);this.ends.push({tag:"OUTDENT"});this.outdebt=this.indebt=0;this.indent=b}else b<this.baseIndent?this.error("missing indentation",{offset:a.length}):(this.indebt=0,this.outdentToken(this.indent-b,c,a.length));return a.length};a.prototype.outdentToken=function(a,b,c){var g,N,k;for(g=this.indent-a;0<a;)if(N=this.indents[this.indents.length-1])if(N===this.outdebt)a-=this.outdebt,this.outdebt=0;
else if(N<this.outdebt)this.outdebt-=N,a-=N;else{var h=this.indents.pop()+this.outdebt;c&&(k=this.chunk[c],0<=q.call(da,k))&&(g-=h-a,a=h);this.outdebt=0;this.pair("OUTDENT");this.token("OUTDENT",a,0,c);a-=h}else a=0;h&&(this.outdebt-=a);for(;";"===this.value();)this.tokens.pop();"TERMINATOR"===this.tag()||b||this.token("TERMINATOR","\n",c,0);this.indent=g;return this};a.prototype.whitespaceToken=function(){var a;if(!(a=w.exec(this.chunk))&&"\n"!==this.chunk.charAt(0))return 0;var b=this.tokens;(b=
b[b.length-1])&&(b[a?"spaced":"newLine"]=!0);return a?a[0].length:0};a.prototype.newlineToken=function(a){for(;";"===this.value();)this.tokens.pop();"TERMINATOR"!==this.tag()&&this.token("TERMINATOR","\n",a,0);return this};a.prototype.suppressNewlines=function(){"\\"===this.value()&&this.tokens.pop();return this};a.prototype.literalToken=function(){var a,b,g,h,l;(a=c.exec(this.chunk))?(a=a[0],k.test(a)&&this.tagParameters()):a=this.chunk.charAt(0);var m=a;var f=this.tokens;if((f=f[f.length-1])&&0<=
q.call(["\x3d"].concat(y.call(fa)),a)){var n=!1;"\x3d"!==a||"||"!==(g=f[1])&&"\x26\x26"!==g||f.spaced||(f[0]="COMPOUND_ASSIGN",f[1]+="\x3d",f=this.tokens[this.tokens.length-2],n=!0);f&&"PROPERTY"!==f[0]&&(g=null!=(b=f.origin)?b:f,(b=B(f[1],g[1]))&&this.error(b,g[2]));if(n)return a.length}"{"===a&&this.seenImport?this.importSpecifierList=!0:this.importSpecifierList&&"}"===a?this.importSpecifierList=!1:"{"===a&&"EXPORT"===(null!=f?f[0]:void 0)?this.exportSpecifierList=!0:this.exportSpecifierList&&"}"===
a&&(this.exportSpecifierList=!1);if(";"===a)this.seenFor=this.seenImport=this.seenExport=!1,m="TERMINATOR";else if("*"===a&&"EXPORT"===f[0])m="EXPORT_ALL";else if(0<=q.call(oa,a))m="MATH";else if(0<=q.call(la,a))m="COMPARE";else if(0<=q.call(fa,a))m="COMPOUND_ASSIGN";else if(0<=q.call(ia,a))m="UNARY";else if(0<=q.call(ga,a))m="UNARY_MATH";else if(0<=q.call(ja,a))m="SHIFT";else if("?"===a&&null!=f&&f.spaced)m="BIN?";else if(f&&!f.spaced)if("("===a&&(h=f[0],0<=q.call(ha,h)))"?"===f[0]&&(f[0]="FUNC_EXIST"),
m="CALL_START";else if("["===a&&(l=f[0],0<=q.call(ka,l)))switch(m="INDEX_START",f[0]){case "?":f[0]="INDEX_SOAK"}h=this.makeToken(m,a);switch(a){case "(":case "{":case "[":this.ends.push({tag:ya[a],origin:h});break;case ")":case "}":case "]":this.pair(a)}this.tokens.push(h);return a.length};a.prototype.tagParameters=function(){var a;if(")"!==this.tag())return this;var b=[];var c=this.tokens;var g=c.length;for(c[--g][0]="PARAM_END";a=c[--g];)switch(a[0]){case ")":b.push(a);break;case "(":case "CALL_START":if(b.length)b.pop();
else return"("===a[0]&&(a[0]="PARAM_START"),this}return this};a.prototype.closeIndentation=function(){return this.outdentToken(this.indent)};a.prototype.matchWithInterpolations=function(b,c){var g,h;var k=[];var l=c.length;if(this.chunk.slice(0,l)!==c)return null;for(h=this.chunk.slice(l);;){var f=b.exec(h)[0];this.validateEscapes(f,{isRegex:"/"===c.charAt(0),offsetInChunk:l});k.push(this.makeToken("NEOSTRING",f,l));h=h.slice(f.length);l+=f.length;if("#{"!==h.slice(0,2))break;var m=this.getLineAndColumnFromChunk(l+
1);f=m[0];m=m[1];m=(new a).tokenize(h.slice(1),{line:f,column:m,untilBalanced:!0});f=m.tokens;var N=m.index;N+=1;var n=f[0];m=f[f.length-1];n[0]=n[1]="(";m[0]=m[1]=")";m.origin=["","end of interpolation",m[2]];"TERMINATOR"===(null!=(g=f[1])?g[0]:void 0)&&f.splice(1,1);k.push(["TOKENS",f]);h=h.slice(N);l+=N}h.slice(0,c.length)!==c&&this.error("missing "+c,{length:c.length});b=k[0];g=k[k.length-1];b[2].first_column-=c.length;"\n"===g[1].substr(-1)?(g[2].last_line+=1,g[2].last_column=c.length-1):g[2].last_column+=
c.length;0===g[1].length&&--g[2].last_column;return{tokens:k,index:l+c.length}};a.prototype.mergeInterpolationTokens=function(a,b,c){var g,h,k,f;1<a.length&&(k=this.token("STRING_START","(",0,0));var l=this.tokens.length;var m=g=0;for(h=a.length;g<h;m=++g){var n=a[m];var N=n[0];var y=n[1];switch(N){case "TOKENS":if(2===y.length)continue;var w=y[0];var r=y;break;case "NEOSTRING":N=c.call(this,n[1],m);if(0===N.length)if(0===m)var Ha=this.tokens.length;else continue;2===m&&null!=Ha&&this.tokens.splice(Ha,
2);n[0]="STRING";n[1]=this.makeDelimitedLiteral(N,b);w=n;r=[n]}this.tokens.length>l&&(m=this.token("+","+"),m[2]={first_line:w[2].first_line,first_column:w[2].first_column,last_line:w[2].first_line,last_column:w[2].first_column});(f=this.tokens).push.apply(f,r)}if(k)return a=a[a.length-1],k.origin=["STRING",null,{first_line:k[2].first_line,first_column:k[2].first_column,last_line:a[2].last_line,last_column:a[2].last_column}],k=this.token("STRING_END",")"),k[2]={first_line:a[2].last_line,first_column:a[2].last_column,
last_line:a[2].last_line,last_column:a[2].last_column}};a.prototype.pair=function(a){var b=this.ends;b=b[b.length-1];return a!==(b=null!=b?b.tag:void 0)?("OUTDENT"!==b&&this.error("unmatched "+a),b=this.indents,b=b[b.length-1],this.outdentToken(b,!0),this.pair(a)):this.ends.pop()};a.prototype.getLineAndColumnFromChunk=function(a){if(0===a)return[this.chunkLine,this.chunkColumn];var b=a>=this.chunk.length?this.chunk:this.chunk.slice(0,+(a-1)+1||9E9);a=g(b,"\n");var c=this.chunkColumn;0<a?(c=b.split("\n"),
c=c[c.length-1],c=c.length):c+=b.length;return[this.chunkLine+a,c]};a.prototype.makeToken=function(a,b,c,g){null==c&&(c=0);null==g&&(g=b.length);var k={};var h=this.getLineAndColumnFromChunk(c);k.first_line=h[0];k.first_column=h[1];c=this.getLineAndColumnFromChunk(c+(0<g?g-1:0));k.last_line=c[0];k.last_column=c[1];return[a,b,k]};a.prototype.token=function(a,b,c,g,k){a=this.makeToken(a,b,c,g);k&&(a.origin=k);this.tokens.push(a);return a};a.prototype.tag=function(){var a=this.tokens;a=a[a.length-1];
return null!=a?a[0]:void 0};a.prototype.value=function(){var a=this.tokens;a=a[a.length-1];return null!=a?a[1]:void 0};a.prototype.unfinished=function(){var a;return S.test(this.chunk)||"\\"===(a=this.tag())||"."===a||"?."===a||"?::"===a||"UNARY"===a||"MATH"===a||"UNARY_MATH"===a||"+"===a||"-"===a||"**"===a||"SHIFT"===a||"RELATION"===a||"COMPARE"===a||"\x26"===a||"^"===a||"|"===a||"\x26\x26"===a||"||"===a||"BIN?"===a||"THROW"===a||"EXTENDS"===a||"DEFAULT"===a};a.prototype.formatString=function(a,
b){return this.replaceUnicodeCodePointEscapes(a.replace(W,"$1"),b)};a.prototype.formatHeregex=function(a){return this.formatRegex(a.replace(C,"$1$2"),{delimiter:"///"})};a.prototype.formatRegex=function(a,b){return this.replaceUnicodeCodePointEscapes(a,b)};a.prototype.unicodeCodePointToUnicodeEscapes=function(a){var b=function(a){a=a.toString(16);return"\\u"+h("0",4-a.length)+a};if(65536>a)return b(a);var c=Math.floor((a-65536)/1024)+55296;a=(a-65536)%1024+56320;return""+b(c)+b(a)};a.prototype.replaceUnicodeCodePointEscapes=
function(a,b){return a.replace(sa,function(a){return function(c,g,k,h){if(g)return g;c=parseInt(k,16);1114111<c&&a.error("unicode code point escapes greater than \\u{10ffff} are not allowed",{offset:h+b.delimiter.length,length:k.length+4});return a.unicodeCodePointToUnicodeEscapes(c)}}(this))};a.prototype.validateEscapes=function(a,b){var c,g;null==b&&(b={});if(c=(b.isRegex?va:M).exec(a)){c[0];a=c[1];var k=c[2];var h=c[3];var f=c[4];var l=c[5];h="\\"+(k||h||f||l);return this.error((k?"octal escape sequences are not allowed":
"invalid escape sequence")+" "+h,{offset:(null!=(g=b.offsetInChunk)?g:0)+c.index+a.length,length:h.length})}};a.prototype.makeDelimitedLiteral=function(a,b){null==b&&(b={});""===a&&"/"===b.delimiter&&(a="(?:)");a=a.replace(RegExp("(\\\\\\\\)|(\\\\0(?\x3d[1-7]))|\\\\?("+b.delimiter+")|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)","g"),function(a,c,g,k,h,f,l,m,n){switch(!1){case !c:return b.double?c+c:c;case !g:return"\\x00";case !k:return"\\"+k;case !h:return"\\n";case !f:return"\\r";case !l:return"\\u2028";
case !m:return"\\u2029";case !n:return b.double?"\\"+n:n}});return""+b.delimiter+a+b.delimiter};a.prototype.error=function(a,b){var c,g,k,h,f;null==b&&(b={});b="first_line"in b?b:(h=this.getLineAndColumnFromChunk(null!=(k=b.offset)?k:0),g=h[0],c=h[1],h,{first_line:g,first_column:c,last_column:c+(null!=(f=b.length)?f:1)-1});return n(a,b)};return a}();var B=function(a,b){null==b&&(b=a);switch(!1){case 0>q.call(y.call(I).concat(y.call(F)),a):return"keyword '"+b+"' can't be assigned";case 0>q.call(O,
a):return"'"+b+"' can't be assigned";case 0>q.call(J,a):return"reserved word '"+b+"' can't be assigned";default:return!1}};f.isUnassignable=B;var H=function(a){var b;return"IDENTIFIER"===a[0]?("from"===a[1]&&(a[1][0]="IDENTIFIER",!0),!0):"FOR"===a[0]?!1:"{"===(b=a[1])||"["===b||","===b||":"===b?!1:!0};var I="true false null this new delete typeof in instanceof return throw break continue debugger yield if else switch for while do try catch finally class extends super import export default".split(" ");
var F="undefined Infinity NaN then unless until loop of by when".split(" ");var Q={and:"\x26\x26",or:"||",is:"\x3d\x3d",isnt:"!\x3d",not:"!",yes:"true",no:"false",on:"true",off:"false"};var x=function(){var a=[];for(qa in Q)a.push(qa);return a}();F=F.concat(x);var J="case function var void with const let enum native implements interface package private protected public static".split(" ");var O=["arguments","eval"];f.JS_FORBIDDEN=I.concat(J).concat(O);var R=65279;var z=/^(?!\d)((?:(?!\s)[$\w\x7f-\uffff])+)([^\n\S]*:(?!:))?/;
var l=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;var c=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>*\/%])\2=?|\?(\.|::)|\.{2,3})/;var w=/^[^\n\S]+/;var m=/^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/;var k=/^[-=]>/;var K=/^(?:\n[^\n\S]*)+/;var P=/^`(?!``)((?:[^`\\]|\\[\s\S])*)`/;var L=/^```((?:[^`\\]|\\[\s\S]|`(?!``))*)```/;var V=/^(?:'''|"""|'|")/;var X=/^(?:[^\\']|\\[\s\S])*/;var G=/^(?:[^\\"#]|\\[\s\S]|\#(?!\{))*/;var aa=/^(?:[^\\']|\\[\s\S]|'(?!''))*/;
var U=/^(?:[^\\"#]|\\[\s\S]|"(?!"")|\#(?!\{))*/;var W=/((?:\\\\)+)|\\[^\S\n]*\n\s*/g;var D=/\s*\n\s*/g;var A=/\n+([^\n\S]*)(?=\S)/g;var fc=/^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/;var E=/^\w*/;var ba=/^(?!.*(.).*\1)[imguy]*$/;var ca=/^(?:[^\\\/#]|\\[\s\S]|\/(?!\/\/)|\#(?!\{))*/;var C=/((?:\\\\)+)|\\(\s)|\s+(?:#.*)?/g;var T=/^(\/|\/{3}\s*)(\*)/;var v=/^\/=?\s/;var Y=/\*\//;var S=/^\s*(?:,|\??\.(?![.\d])|::)/;var M=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u\{(?![\da-fA-F]{1,}\})[^}]*\}?)|(u(?!\{|[\da-fA-F]{4}).{0,4}))/;
var va=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7])|(x(?![\da-fA-F]{2}).{0,2})|(u\{(?![\da-fA-F]{1,}\})[^}]*\}?)|(u(?!\{|[\da-fA-F]{4}).{0,4}))/;var sa=/(\\\\)|\\u\{([\da-fA-F]+)\}/g;var za=/^[^\n\S]*\n/;var ma=/\n[^\n\S]*$/;var Z=/\s+$/;var fa="-\x3d +\x3d /\x3d *\x3d %\x3d ||\x3d \x26\x26\x3d ?\x3d \x3c\x3c\x3d \x3e\x3e\x3d \x3e\x3e\x3e\x3d \x26\x3d ^\x3d |\x3d **\x3d //\x3d %%\x3d".split(" ");var ia=["NEW","TYPEOF","DELETE","DO"];var ga=["!","~"];var ja=["\x3c\x3c","\x3e\x3e","\x3e\x3e\x3e"];var la="\x3d\x3d !\x3d \x3c \x3e \x3c\x3d \x3e\x3d".split(" ");
var oa=["*","/","%","//","%%"];var pa=["IN","OF","INSTANCEOF"];var ha="IDENTIFIER PROPERTY ) ] ? @ THIS SUPER".split(" ");var ka=ha.concat("NUMBER INFINITY NAN STRING STRING_END REGEX REGEX_END BOOL NULL UNDEFINED } ::".split(" "));var na=ka.concat(["++","--"]);var ra=["INDENT","OUTDENT","TERMINATOR"];var da=[")","}","]"]}).call(this);return f}();u["./parser"]=function(){var f={},qa={exports:f},q=function(){function f(){this.yy={}}var a=function(a,p,t,d){t=t||{};for(d=a.length;d--;t[a[d]]=p);return t},
b=[1,22],u=[1,25],g=[1,83],h=[1,79],r=[1,84],n=[1,85],B=[1,81],H=[1,82],I=[1,56],F=[1,58],Q=[1,59],x=[1,60],J=[1,61],O=[1,62],R=[1,49],z=[1,50],l=[1,32],c=[1,68],w=[1,69],m=[1,78],k=[1,47],K=[1,51],P=[1,52],L=[1,67],V=[1,65],X=[1,66],G=[1,64],aa=[1,42],U=[1,48],W=[1,63],D=[1,73],A=[1,74],q=[1,75],E=[1,76],ba=[1,46],ca=[1,72],C=[1,34],T=[1,35],v=[1,36],Y=[1,37],S=[1,38],M=[1,39],qa=[1,86],sa=[1,6,32,42,131],za=[1,101],ma=[1,89],Z=[1,88],fa=[1,87],ia=[1,90],ga=[1,91],ja=[1,92],la=[1,93],oa=[1,94],pa=
[1,95],ha=[1,96],ka=[1,97],na=[1,98],ra=[1,99],da=[1,100],va=[1,104],N=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],xa=[2,166],ta=[1,110],Na=[1,111],Fa=[1,112],Ga=[1,113],Ca=[1,115],Pa=[1,116],Ia=[1,109],Ea=[1,6,32,42,131,133,135,139,156],Va=[2,27],ea=[1,123],Ya=[1,121],Ba=[1,6,31,32,40,41,42,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,
173,174],Ha=[2,94],t=[1,6,31,32,42,46,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],p=[2,73],d=[1,128],wa=[1,133],e=[1,134],Da=[1,136],Ta=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],ua=[2,91],Eb=[1,6,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,
169,170,171,172,173,174],Za=[2,63],Fb=[1,166],$a=[1,178],Ua=[1,180],Gb=[1,175],Oa=[1,182],sb=[1,184],La=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,96,113,114,115,120,122,131,133,134,135,139,140,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175],Hb=[2,110],Ib=[1,6,31,32,40,41,42,58,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],Jb=[1,6,31,32,40,41,42,46,58,65,70,73,82,83,84,
85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],Kb=[40,41,114],Lb=[1,241],tb=[1,240],Ma=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156],Ja=[2,71],Mb=[1,250],Sa=[6,31,32,65,70],fb=[6,31,32,55,65,70,73],ab=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,164,166,167,168,169,170,171,172,173,174],Nb=[40,41,82,83,84,85,87,90,113,114],gb=[1,269],bb=[2,62],hb=[1,279],Wa=[1,281],ub=[1,
286],cb=[1,288],Ob=[2,187],vb=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],ib=[1,297],Qa=[6,31,32,70,115,120],Pb=[1,6,31,32,40,41,42,55,58,65,70,73,82,83,84,85,87,89,90,94,96,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175],Qb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,140,156],Xa=[1,6,31,32,
42,65,70,73,89,94,115,120,122,131,134,140,156],jb=[146,147,148],kb=[70,146,147,148],lb=[6,31,94],Rb=[1,311],Aa=[6,31,32,70,94],Sb=[6,31,32,58,70,94],wb=[6,31,32,55,58,70,94],Tb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,166,167,168,169,170,171,172,173,174],Ub=[12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,62,63,67,68,89,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,158,159,160,161,162],Vb=[2,176],Ra=[6,31,32],db=[2,72],Wb=[1,323],Xb=[1,324],
Yb=[1,6,31,32,42,65,70,73,89,94,115,120,122,127,128,131,133,134,135,139,140,151,153,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],mb=[32,151,153],Zb=[1,6,32,42,65,70,73,89,94,115,120,122,131,134,140,156],nb=[1,350],xb=[1,356],yb=[1,6,32,42,131,156],eb=[2,86],ob=[1,367],pb=[1,368],$b=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,151,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],zb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,135,139,140,156],ac=
[1,381],bc=[1,382],Ab=[6,31,32,94],cc=[6,31,32,70],Bb=[1,6,31,32,42,65,70,73,89,94,115,120,122,127,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],dc=[31,70],qb=[1,408],rb=[1,409],Cb=[1,415],Db=[1,416],ec={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Line:5,TERMINATOR:6,Expression:7,Statement:8,YieldReturn:9,Return:10,Comment:11,STATEMENT:12,Import:13,Export:14,Value:15,Invocation:16,Code:17,Operation:18,Assign:19,If:20,Try:21,While:22,For:23,Switch:24,
Class:25,Throw:26,Yield:27,YIELD:28,FROM:29,Block:30,INDENT:31,OUTDENT:32,Identifier:33,IDENTIFIER:34,Property:35,PROPERTY:36,AlphaNumeric:37,NUMBER:38,String:39,STRING:40,STRING_START:41,STRING_END:42,Regex:43,REGEX:44,REGEX_START:45,REGEX_END:46,Literal:47,JS:48,UNDEFINED:49,NULL:50,BOOL:51,INFINITY:52,NAN:53,Assignable:54,"\x3d":55,AssignObj:56,ObjAssignable:57,":":58,SimpleObjAssignable:59,ThisProperty:60,RETURN:61,HERECOMMENT:62,PARAM_START:63,ParamList:64,PARAM_END:65,FuncGlyph:66,"-\x3e":67,
"\x3d\x3e":68,OptComma:69,",":70,Param:71,ParamVar:72,"...":73,Array:74,Object:75,Splat:76,SimpleAssignable:77,Accessor:78,Parenthetical:79,Range:80,This:81,".":82,"?.":83,"::":84,"?::":85,Index:86,INDEX_START:87,IndexValue:88,INDEX_END:89,INDEX_SOAK:90,Slice:91,"{":92,AssignList:93,"}":94,CLASS:95,EXTENDS:96,IMPORT:97,ImportDefaultSpecifier:98,ImportNamespaceSpecifier:99,ImportSpecifierList:100,ImportSpecifier:101,AS:102,DEFAULT:103,IMPORT_ALL:104,EXPORT:105,ExportSpecifierList:106,EXPORT_ALL:107,
ExportSpecifier:108,OptFuncExist:109,Arguments:110,Super:111,SUPER:112,FUNC_EXIST:113,CALL_START:114,CALL_END:115,ArgList:116,THIS:117,"@":118,"[":119,"]":120,RangeDots:121,"..":122,Arg:123,SimpleArgs:124,TRY:125,Catch:126,FINALLY:127,CATCH:128,THROW:129,"(":130,")":131,WhileSource:132,WHILE:133,WHEN:134,UNTIL:135,Loop:136,LOOP:137,ForBody:138,FOR:139,BY:140,ForStart:141,ForSource:142,ForVariables:143,OWN:144,ForValue:145,FORIN:146,FOROF:147,FORFROM:148,SWITCH:149,Whens:150,ELSE:151,When:152,LEADING_WHEN:153,
IfBlock:154,IF:155,POST_IF:156,UNARY:157,UNARY_MATH:158,"-":159,"+":160,"--":161,"++":162,"?":163,MATH:164,"**":165,SHIFT:166,COMPARE:167,"\x26":168,"^":169,"|":170,"\x26\x26":171,"||":172,"BIN?":173,RELATION:174,COMPOUND_ASSIGN:175,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",12:"STATEMENT",28:"YIELD",29:"FROM",31:"INDENT",32:"OUTDENT",34:"IDENTIFIER",36:"PROPERTY",38:"NUMBER",40:"STRING",41:"STRING_START",42:"STRING_END",44:"REGEX",45:"REGEX_START",46:"REGEX_END",48:"JS",49:"UNDEFINED",
50:"NULL",51:"BOOL",52:"INFINITY",53:"NAN",55:"\x3d",58:":",61:"RETURN",62:"HERECOMMENT",63:"PARAM_START",65:"PARAM_END",67:"-\x3e",68:"\x3d\x3e",70:",",73:"...",82:".",83:"?.",84:"::",85:"?::",87:"INDEX_START",89:"INDEX_END",90:"INDEX_SOAK",92:"{",94:"}",95:"CLASS",96:"EXTENDS",97:"IMPORT",102:"AS",103:"DEFAULT",104:"IMPORT_ALL",105:"EXPORT",107:"EXPORT_ALL",112:"SUPER",113:"FUNC_EXIST",114:"CALL_START",115:"CALL_END",117:"THIS",118:"@",119:"[",120:"]",122:"..",125:"TRY",127:"FINALLY",128:"CATCH",
129:"THROW",130:"(",131:")",133:"WHILE",134:"WHEN",135:"UNTIL",137:"LOOP",139:"FOR",140:"BY",144:"OWN",146:"FORIN",147:"FOROF",148:"FORFROM",149:"SWITCH",151:"ELSE",153:"LEADING_WHEN",155:"IF",156:"POST_IF",157:"UNARY",158:"UNARY_MATH",159:"-",160:"+",161:"--",162:"++",163:"?",164:"MATH",165:"**",166:"SHIFT",167:"COMPARE",168:"\x26",169:"^",170:"|",171:"\x26\x26",172:"||",173:"BIN?",174:"RELATION",175:"COMPOUND_ASSIGN"},productions_:[0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[5,1],[8,1],[8,1],[8,
1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[27,1],[27,2],[27,3],[30,2],[30,3],[33,1],[35,1],[37,1],[37,1],[39,1],[39,3],[43,1],[43,3],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[19,3],[19,4],[19,5],[56,1],[56,3],[56,5],[56,3],[56,5],[56,1],[59,1],[59,1],[59,1],[57,1],[57,1],[10,2],[10,1],[9,3],[9,2],[11,1],[17,5],[17,2],[66,1],[66,1],[69,0],[69,1],[64,0],[64,1],[64,3],[64,4],[64,6],[71,1],[71,2],[71,3],[71,1],[72,1],[72,1],[72,1],[72,
1],[76,2],[77,1],[77,2],[77,2],[77,1],[54,1],[54,1],[54,1],[15,1],[15,1],[15,1],[15,1],[15,1],[78,2],[78,2],[78,2],[78,2],[78,1],[78,1],[86,3],[86,2],[88,1],[88,1],[75,4],[93,0],[93,1],[93,3],[93,4],[93,6],[25,1],[25,2],[25,3],[25,4],[25,2],[25,3],[25,4],[25,5],[13,2],[13,4],[13,4],[13,5],[13,7],[13,6],[13,9],[100,1],[100,3],[100,4],[100,4],[100,6],[101,1],[101,3],[101,1],[101,3],[98,1],[99,3],[14,3],[14,5],[14,2],[14,4],[14,5],[14,6],[14,3],[14,4],[14,7],[106,1],[106,3],[106,4],[106,4],[106,6],[108,
1],[108,3],[108,3],[108,1],[108,3],[16,3],[16,3],[16,3],[16,1],[111,1],[111,2],[109,0],[109,1],[110,2],[110,4],[81,1],[81,1],[60,2],[74,2],[74,4],[121,1],[121,1],[80,5],[91,3],[91,2],[91,2],[91,1],[116,1],[116,3],[116,4],[116,4],[116,6],[123,1],[123,1],[123,1],[124,1],[124,3],[21,2],[21,3],[21,4],[21,5],[126,3],[126,3],[126,2],[26,2],[79,3],[79,5],[132,2],[132,4],[132,2],[132,4],[22,2],[22,2],[22,2],[22,1],[136,2],[136,2],[23,2],[23,2],[23,2],[138,2],[138,4],[138,2],[141,2],[141,3],[145,1],[145,1],
[145,1],[145,1],[143,1],[143,3],[142,2],[142,2],[142,4],[142,4],[142,4],[142,6],[142,6],[142,2],[142,4],[24,5],[24,7],[24,4],[24,6],[150,1],[150,2],[152,3],[152,4],[154,3],[154,5],[20,1],[20,3],[20,3],[20,3],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,5],[18,4],[18,3]],performAction:function(a,p,t,d,wa,b,e){a=b.length-1;switch(wa){case 1:return this.$=d.addLocationDataFn(e[a],e[a])(new d.Block);
case 2:return this.$=b[a];case 3:this.$=d.addLocationDataFn(e[a],e[a])(d.Block.wrap([b[a]]));break;case 4:this.$=d.addLocationDataFn(e[a-2],e[a])(b[a-2].push(b[a]));break;case 5:this.$=b[a-1];break;case 6:case 7:case 8:case 9:case 10:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 35:case 40:case 42:case 56:case 57:case 58:case 59:case 60:case 61:case 71:case 72:case 82:case 83:case 84:case 85:case 90:case 91:case 94:case 98:case 104:case 163:case 187:case 188:case 190:case 220:case 221:case 239:case 245:this.$=
b[a];break;case 11:this.$=d.addLocationDataFn(e[a],e[a])(new d.StatementLiteral(b[a]));break;case 27:this.$=d.addLocationDataFn(e[a],e[a])(new d.Op(b[a],new d.Value(new d.Literal(""))));break;case 28:case 249:case 250:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op(b[a-1],b[a]));break;case 29:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Op(b[a-2].concat(b[a-1]),b[a]));break;case 30:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Block);break;case 31:case 105:this.$=d.addLocationDataFn(e[a-2],e[a])(b[a-
1]);break;case 32:this.$=d.addLocationDataFn(e[a],e[a])(new d.IdentifierLiteral(b[a]));break;case 33:this.$=d.addLocationDataFn(e[a],e[a])(new d.PropertyName(b[a]));break;case 34:this.$=d.addLocationDataFn(e[a],e[a])(new d.NumberLiteral(b[a]));break;case 36:this.$=d.addLocationDataFn(e[a],e[a])(new d.StringLiteral(b[a]));break;case 37:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.StringWithInterpolations(b[a-1]));break;case 38:this.$=d.addLocationDataFn(e[a],e[a])(new d.RegexLiteral(b[a]));break;
case 39:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.RegexWithInterpolations(b[a-1].args));break;case 41:this.$=d.addLocationDataFn(e[a],e[a])(new d.PassthroughLiteral(b[a]));break;case 43:this.$=d.addLocationDataFn(e[a],e[a])(new d.UndefinedLiteral);break;case 44:this.$=d.addLocationDataFn(e[a],e[a])(new d.NullLiteral);break;case 45:this.$=d.addLocationDataFn(e[a],e[a])(new d.BooleanLiteral(b[a]));break;case 46:this.$=d.addLocationDataFn(e[a],e[a])(new d.InfinityLiteral(b[a]));break;case 47:this.$=
d.addLocationDataFn(e[a],e[a])(new d.NaNLiteral);break;case 48:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Assign(b[a-2],b[a]));break;case 49:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Assign(b[a-3],b[a]));break;case 50:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Assign(b[a-4],b[a-1]));break;case 51:case 87:case 92:case 93:case 95:case 96:case 97:case 222:case 223:this.$=d.addLocationDataFn(e[a],e[a])(new d.Value(b[a]));break;case 52:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Assign(d.addLocationDataFn(e[a-
2])(new d.Value(b[a-2])),b[a],"object",{operatorToken:d.addLocationDataFn(e[a-1])(new d.Literal(b[a-1]))}));break;case 53:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Assign(d.addLocationDataFn(e[a-4])(new d.Value(b[a-4])),b[a-1],"object",{operatorToken:d.addLocationDataFn(e[a-3])(new d.Literal(b[a-3]))}));break;case 54:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Assign(d.addLocationDataFn(e[a-2])(new d.Value(b[a-2])),b[a],null,{operatorToken:d.addLocationDataFn(e[a-1])(new d.Literal(b[a-1]))}));
break;case 55:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Assign(d.addLocationDataFn(e[a-4])(new d.Value(b[a-4])),b[a-1],null,{operatorToken:d.addLocationDataFn(e[a-3])(new d.Literal(b[a-3]))}));break;case 62:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Return(b[a]));break;case 63:this.$=d.addLocationDataFn(e[a],e[a])(new d.Return);break;case 64:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.YieldReturn(b[a]));break;case 65:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.YieldReturn);break;case 66:this.$=
d.addLocationDataFn(e[a],e[a])(new d.Comment(b[a]));break;case 67:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Code(b[a-3],b[a],b[a-1]));break;case 68:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Code([],b[a],b[a-1]));break;case 69:this.$=d.addLocationDataFn(e[a],e[a])("func");break;case 70:this.$=d.addLocationDataFn(e[a],e[a])("boundfunc");break;case 73:case 110:this.$=d.addLocationDataFn(e[a],e[a])([]);break;case 74:case 111:case 130:case 150:case 182:case 224:this.$=d.addLocationDataFn(e[a],
e[a])([b[a]]);break;case 75:case 112:case 131:case 151:case 183:this.$=d.addLocationDataFn(e[a-2],e[a])(b[a-2].concat(b[a]));break;case 76:case 113:case 132:case 152:case 184:this.$=d.addLocationDataFn(e[a-3],e[a])(b[a-3].concat(b[a]));break;case 77:case 114:case 134:case 154:case 186:this.$=d.addLocationDataFn(e[a-5],e[a])(b[a-5].concat(b[a-2]));break;case 78:this.$=d.addLocationDataFn(e[a],e[a])(new d.Param(b[a]));break;case 79:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Param(b[a-1],null,!0));
break;case 80:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Param(b[a-2],b[a]));break;case 81:case 189:this.$=d.addLocationDataFn(e[a],e[a])(new d.Expansion);break;case 86:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Splat(b[a-1]));break;case 88:this.$=d.addLocationDataFn(e[a-1],e[a])(b[a-1].add(b[a]));break;case 89:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Value(b[a-1],[].concat(b[a])));break;case 99:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Access(b[a]));break;case 100:this.$=d.addLocationDataFn(e[a-
1],e[a])(new d.Access(b[a],"soak"));break;case 101:this.$=d.addLocationDataFn(e[a-1],e[a])([d.addLocationDataFn(e[a-1])(new d.Access(new d.PropertyName("prototype"))),d.addLocationDataFn(e[a])(new d.Access(b[a]))]);break;case 102:this.$=d.addLocationDataFn(e[a-1],e[a])([d.addLocationDataFn(e[a-1])(new d.Access(new d.PropertyName("prototype"),"soak")),d.addLocationDataFn(e[a])(new d.Access(b[a]))]);break;case 103:this.$=d.addLocationDataFn(e[a],e[a])(new d.Access(new d.PropertyName("prototype")));
break;case 106:this.$=d.addLocationDataFn(e[a-1],e[a])(d.extend(b[a],{soak:!0}));break;case 107:this.$=d.addLocationDataFn(e[a],e[a])(new d.Index(b[a]));break;case 108:this.$=d.addLocationDataFn(e[a],e[a])(new d.Slice(b[a]));break;case 109:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Obj(b[a-2],b[a-3].generated));break;case 115:this.$=d.addLocationDataFn(e[a],e[a])(new d.Class);break;case 116:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Class(null,null,b[a]));break;case 117:this.$=d.addLocationDataFn(e[a-
2],e[a])(new d.Class(null,b[a]));break;case 118:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Class(null,b[a-1],b[a]));break;case 119:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Class(b[a]));break;case 120:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Class(b[a-1],null,b[a]));break;case 121:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Class(b[a-2],b[a]));break;case 122:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Class(b[a-3],b[a-1],b[a]));break;case 123:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.ImportDeclaration(null,
b[a]));break;case 124:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.ImportDeclaration(new d.ImportClause(b[a-2],null),b[a]));break;case 125:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.ImportDeclaration(new d.ImportClause(null,b[a-2]),b[a]));break;case 126:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.ImportDeclaration(new d.ImportClause(null,new d.ImportSpecifierList([])),b[a]));break;case 127:this.$=d.addLocationDataFn(e[a-6],e[a])(new d.ImportDeclaration(new d.ImportClause(null,new d.ImportSpecifierList(b[a-
4])),b[a]));break;case 128:this.$=d.addLocationDataFn(e[a-5],e[a])(new d.ImportDeclaration(new d.ImportClause(b[a-4],b[a-2]),b[a]));break;case 129:this.$=d.addLocationDataFn(e[a-8],e[a])(new d.ImportDeclaration(new d.ImportClause(b[a-7],new d.ImportSpecifierList(b[a-4])),b[a]));break;case 133:case 153:case 169:case 185:this.$=d.addLocationDataFn(e[a-3],e[a])(b[a-2]);break;case 135:this.$=d.addLocationDataFn(e[a],e[a])(new d.ImportSpecifier(b[a]));break;case 136:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ImportSpecifier(b[a-
2],b[a]));break;case 137:this.$=d.addLocationDataFn(e[a],e[a])(new d.ImportSpecifier(new d.Literal(b[a])));break;case 138:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ImportSpecifier(new d.Literal(b[a-2]),b[a]));break;case 139:this.$=d.addLocationDataFn(e[a],e[a])(new d.ImportDefaultSpecifier(b[a]));break;case 140:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ImportNamespaceSpecifier(new d.Literal(b[a-2]),b[a]));break;case 141:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList([])));
break;case 142:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList(b[a-2])));break;case 143:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.ExportNamedDeclaration(b[a]));break;case 144:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-2],b[a],null,{moduleDeclaration:"export"})));break;case 145:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-3],b[a],null,{moduleDeclaration:"export"})));
break;case 146:this.$=d.addLocationDataFn(e[a-5],e[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-4],b[a-1],null,{moduleDeclaration:"export"})));break;case 147:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ExportDefaultDeclaration(b[a]));break;case 148:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.ExportAllDeclaration(new d.Literal(b[a-2]),b[a]));break;case 149:this.$=d.addLocationDataFn(e[a-6],e[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList(b[a-4]),b[a]));break;case 155:this.$=d.addLocationDataFn(e[a],
e[a])(new d.ExportSpecifier(b[a]));break;case 156:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ExportSpecifier(b[a-2],b[a]));break;case 157:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ExportSpecifier(b[a-2],new d.Literal(b[a])));break;case 158:this.$=d.addLocationDataFn(e[a],e[a])(new d.ExportSpecifier(new d.Literal(b[a])));break;case 159:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.ExportSpecifier(new d.Literal(b[a-2]),b[a]));break;case 160:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.TaggedTemplateCall(b[a-
2],b[a],b[a-1]));break;case 161:case 162:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Call(b[a-2],b[a],b[a-1]));break;case 164:this.$=d.addLocationDataFn(e[a],e[a])(new d.SuperCall);break;case 165:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.SuperCall(b[a]));break;case 166:this.$=d.addLocationDataFn(e[a],e[a])(!1);break;case 167:this.$=d.addLocationDataFn(e[a],e[a])(!0);break;case 168:this.$=d.addLocationDataFn(e[a-1],e[a])([]);break;case 170:case 171:this.$=d.addLocationDataFn(e[a],e[a])(new d.Value(new d.ThisLiteral));
break;case 172:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Value(d.addLocationDataFn(e[a-1])(new d.ThisLiteral),[d.addLocationDataFn(e[a])(new d.Access(b[a]))],"this"));break;case 173:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Arr([]));break;case 174:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Arr(b[a-2]));break;case 175:this.$=d.addLocationDataFn(e[a],e[a])("inclusive");break;case 176:this.$=d.addLocationDataFn(e[a],e[a])("exclusive");break;case 177:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Range(b[a-
3],b[a-1],b[a-2]));break;case 178:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Range(b[a-2],b[a],b[a-1]));break;case 179:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Range(b[a-1],null,b[a]));break;case 180:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Range(null,b[a],b[a-1]));break;case 181:this.$=d.addLocationDataFn(e[a],e[a])(new d.Range(null,null,b[a]));break;case 191:this.$=d.addLocationDataFn(e[a-2],e[a])([].concat(b[a-2],b[a]));break;case 192:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Try(b[a]));
break;case 193:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Try(b[a-1],b[a][0],b[a][1]));break;case 194:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Try(b[a-2],null,null,b[a]));break;case 195:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Try(b[a-3],b[a-2][0],b[a-2][1],b[a]));break;case 196:this.$=d.addLocationDataFn(e[a-2],e[a])([b[a-1],b[a]]);break;case 197:this.$=d.addLocationDataFn(e[a-2],e[a])([d.addLocationDataFn(e[a-1])(new d.Value(b[a-1])),b[a]]);break;case 198:this.$=d.addLocationDataFn(e[a-
1],e[a])([null,b[a]]);break;case 199:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Throw(b[a]));break;case 200:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Parens(b[a-1]));break;case 201:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Parens(b[a-2]));break;case 202:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.While(b[a]));break;case 203:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.While(b[a-2],{guard:b[a]}));break;case 204:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.While(b[a],{invert:!0}));break;
case 205:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.While(b[a-2],{invert:!0,guard:b[a]}));break;case 206:this.$=d.addLocationDataFn(e[a-1],e[a])(b[a-1].addBody(b[a]));break;case 207:case 208:this.$=d.addLocationDataFn(e[a-1],e[a])(b[a].addBody(d.addLocationDataFn(e[a-1])(d.Block.wrap([b[a-1]]))));break;case 209:this.$=d.addLocationDataFn(e[a],e[a])(b[a]);break;case 210:this.$=d.addLocationDataFn(e[a-1],e[a])((new d.While(d.addLocationDataFn(e[a-1])(new d.BooleanLiteral("true")))).addBody(b[a]));
break;case 211:this.$=d.addLocationDataFn(e[a-1],e[a])((new d.While(d.addLocationDataFn(e[a-1])(new d.BooleanLiteral("true")))).addBody(d.addLocationDataFn(e[a])(d.Block.wrap([b[a]]))));break;case 212:case 213:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.For(b[a-1],b[a]));break;case 214:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.For(b[a],b[a-1]));break;case 215:this.$=d.addLocationDataFn(e[a-1],e[a])({source:d.addLocationDataFn(e[a])(new d.Value(b[a]))});break;case 216:this.$=d.addLocationDataFn(e[a-
3],e[a])({source:d.addLocationDataFn(e[a-2])(new d.Value(b[a-2])),step:b[a]});break;case 217:d=d.addLocationDataFn(e[a-1],e[a]);b[a].own=b[a-1].own;b[a].ownTag=b[a-1].ownTag;b[a].name=b[a-1][0];b[a].index=b[a-1][1];this.$=d(b[a]);break;case 218:this.$=d.addLocationDataFn(e[a-1],e[a])(b[a]);break;case 219:wa=d.addLocationDataFn(e[a-2],e[a]);b[a].own=!0;b[a].ownTag=d.addLocationDataFn(e[a-1])(new d.Literal(b[a-1]));this.$=wa(b[a]);break;case 225:this.$=d.addLocationDataFn(e[a-2],e[a])([b[a-2],b[a]]);
break;case 226:this.$=d.addLocationDataFn(e[a-1],e[a])({source:b[a]});break;case 227:this.$=d.addLocationDataFn(e[a-1],e[a])({source:b[a],object:!0});break;case 228:this.$=d.addLocationDataFn(e[a-3],e[a])({source:b[a-2],guard:b[a]});break;case 229:this.$=d.addLocationDataFn(e[a-3],e[a])({source:b[a-2],guard:b[a],object:!0});break;case 230:this.$=d.addLocationDataFn(e[a-3],e[a])({source:b[a-2],step:b[a]});break;case 231:this.$=d.addLocationDataFn(e[a-5],e[a])({source:b[a-4],guard:b[a-2],step:b[a]});
break;case 232:this.$=d.addLocationDataFn(e[a-5],e[a])({source:b[a-4],step:b[a-2],guard:b[a]});break;case 233:this.$=d.addLocationDataFn(e[a-1],e[a])({source:b[a],from:!0});break;case 234:this.$=d.addLocationDataFn(e[a-3],e[a])({source:b[a-2],guard:b[a],from:!0});break;case 235:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Switch(b[a-3],b[a-1]));break;case 236:this.$=d.addLocationDataFn(e[a-6],e[a])(new d.Switch(b[a-5],b[a-3],b[a-1]));break;case 237:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Switch(null,
b[a-1]));break;case 238:this.$=d.addLocationDataFn(e[a-5],e[a])(new d.Switch(null,b[a-3],b[a-1]));break;case 240:this.$=d.addLocationDataFn(e[a-1],e[a])(b[a-1].concat(b[a]));break;case 241:this.$=d.addLocationDataFn(e[a-2],e[a])([[b[a-1],b[a]]]);break;case 242:this.$=d.addLocationDataFn(e[a-3],e[a])([[b[a-2],b[a-1]]]);break;case 243:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.If(b[a-1],b[a],{type:b[a-2]}));break;case 244:this.$=d.addLocationDataFn(e[a-4],e[a])(b[a-4].addElse(d.addLocationDataFn(e[a-
2],e[a])(new d.If(b[a-1],b[a],{type:b[a-2]}))));break;case 246:this.$=d.addLocationDataFn(e[a-2],e[a])(b[a-2].addElse(b[a]));break;case 247:case 248:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.If(b[a],d.addLocationDataFn(e[a-2])(d.Block.wrap([b[a-2]])),{type:b[a-1],statement:!0}));break;case 251:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("-",b[a]));break;case 252:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("+",b[a]));break;case 253:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("--",
b[a]));break;case 254:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("++",b[a]));break;case 255:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("--",b[a-1],null,!0));break;case 256:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Op("++",b[a-1],null,!0));break;case 257:this.$=d.addLocationDataFn(e[a-1],e[a])(new d.Existence(b[a-1]));break;case 258:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Op("+",b[a-2],b[a]));break;case 259:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Op("-",b[a-2],b[a]));break;
case 260:case 261:case 262:case 263:case 264:case 265:case 266:case 267:case 268:case 269:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Op(b[a-1],b[a-2],b[a]));break;case 270:e=d.addLocationDataFn(e[a-2],e[a]);b="!"===b[a-1].charAt(0)?(new d.Op(b[a-1].slice(1),b[a-2],b[a])).invert():new d.Op(b[a-1],b[a-2],b[a]);this.$=e(b);break;case 271:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Assign(b[a-2],b[a],b[a-1]));break;case 272:this.$=d.addLocationDataFn(e[a-4],e[a])(new d.Assign(b[a-4],b[a-1],b[a-3]));
break;case 273:this.$=d.addLocationDataFn(e[a-3],e[a])(new d.Assign(b[a-3],b[a],b[a-2]));break;case 274:this.$=d.addLocationDataFn(e[a-2],e[a])(new d.Extends(b[a-2],b[a]))}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:6,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:u,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,
97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{1:[3]},{1:[2,2],6:qa},a(sa,[2,3]),a(sa,[2,6],{141:77,132:102,138:103,133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(sa,[2,7],{141:77,132:105,138:106,133:D,135:A,139:E,156:va}),a(sa,[2,8]),a(N,[2,14],{109:107,78:108,86:114,40:xa,41:xa,114:xa,82:ta,83:Na,
84:Fa,85:Ga,87:Ca,90:Pa,113:Ia}),a(N,[2,15],{86:114,109:117,78:118,82:ta,83:Na,84:Fa,85:Ga,87:Ca,90:Pa,113:Ia,114:xa}),a(N,[2,16]),a(N,[2,17]),a(N,[2,18]),a(N,[2,19]),a(N,[2,20]),a(N,[2,21]),a(N,[2,22]),a(N,[2,23]),a(N,[2,24]),a(N,[2,25]),a(N,[2,26]),a(Ea,[2,9]),a(Ea,[2,10]),a(Ea,[2,11]),a(Ea,[2,12]),a(Ea,[2,13]),a([1,6,32,42,131,133,135,139,156,163,164,165,166,167,168,169,170,171,172,173,174],Va,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,
47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,8:122,12:b,28:ea,29:Ya,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:[1,119],62:z,63:l,67:c,68:w,92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,137:q,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),a(Ba,Ha,{55:[1,124]}),a(Ba,[2,95]),a(Ba,[2,96]),a(Ba,[2,97]),a(Ba,[2,98]),a(t,[2,163]),a([6,31,65,70],p,{64:125,71:126,72:127,33:129,60:130,
74:131,75:132,34:g,73:d,92:m,118:wa,119:e}),{30:135,31:Da},{7:137,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,
158:T,159:v,160:Y,161:S,162:M},{7:138,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},
{7:139,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:140,8:122,10:20,11:21,12:b,
13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{15:142,16:143,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,
44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:144,60:71,74:53,75:54,77:141,79:28,80:29,81:30,92:m,111:31,112:L,117:V,118:X,119:G,130:W},{15:142,16:143,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:144,60:71,74:53,75:54,77:145,79:28,80:29,81:30,92:m,111:31,112:L,117:V,118:X,119:G,130:W},a(Ta,ua,{96:[1,149],161:[1,146],162:[1,147],175:[1,148]}),a(N,[2,245],{151:[1,150]}),{30:151,31:Da},{30:152,31:Da},a(N,[2,209]),{30:153,31:Da},{7:154,8:122,10:20,11:21,
12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,155],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Eb,[2,115],{47:27,79:28,80:29,81:30,111:31,
74:53,75:54,37:55,43:57,33:70,60:71,39:80,15:142,16:143,54:144,30:156,77:158,31:Da,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,92:m,96:[1,157],112:L,117:V,118:X,119:G,130:W}),{7:159,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,
111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Ea,Za,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,7:160,12:b,28:ea,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:R,62:z,63:l,67:c,68:w,
92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,137:q,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),a([1,6,31,32,42,70,94,131,133,135,139,156],[2,66]),{33:165,34:g,39:161,40:r,41:n,92:[1,164],98:162,99:163,104:Fb},{25:168,33:169,34:g,92:[1,167],95:k,103:[1,170],107:[1,171]},a(Ta,[2,92]),a(Ta,[2,93]),a(Ba,[2,40]),a(Ba,[2,41]),a(Ba,[2,42]),a(Ba,[2,43]),a(Ba,[2,44]),a(Ba,[2,45]),a(Ba,[2,46]),a(Ba,[2,47]),{4:172,5:3,7:4,8:5,9:6,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,
20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:u,31:[1,173],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:174,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,
23:15,24:16,25:17,26:18,27:19,28:ea,31:$a,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,116:176,117:V,118:X,119:G,120:Gb,123:177,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Ba,[2,170]),a(Ba,[2,171],{35:181,36:Oa}),a([1,6,31,32,42,46,65,70,73,82,
83,84,85,87,89,90,94,113,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],[2,164],{110:183,114:sb}),{31:[2,69]},{31:[2,70]},a(La,[2,87]),a(La,[2,90]),{7:185,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,
105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:186,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,
119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:187,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,
133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:189,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,30:188,31:Da,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,
137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{33:194,34:g,60:195,74:196,75:197,80:190,92:m,118:wa,119:G,143:191,144:[1,192],145:193},{142:198,146:[1,199],147:[1,200],148:[1,201]},a([6,31,70,94],Hb,{39:80,93:202,56:203,57:204,59:205,11:206,37:207,33:208,35:209,60:210,34:g,36:Oa,38:h,40:r,41:n,62:z,118:wa}),a(Ib,[2,34]),a(Ib,[2,35]),a(Ba,[2,38]),{15:142,16:211,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:144,60:71,
74:53,75:54,77:212,79:28,80:29,81:30,92:m,111:31,112:L,117:V,118:X,119:G,130:W},a([1,6,29,31,32,40,41,42,55,58,65,70,73,82,83,84,85,87,89,90,94,96,102,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175],[2,32]),a(Jb,[2,36]),{4:213,5:3,7:4,8:5,9:6,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:u,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,
50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(sa,[2,5],{7:4,8:5,9:6,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,
33:70,60:71,141:77,39:80,5:214,12:b,28:u,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:R,62:z,63:l,67:c,68:w,92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,133:D,135:A,137:q,139:E,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),a(N,[2,257]),{7:215,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,
61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:216,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,
74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:217,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,
81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:218,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,
112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:219,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,
129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:220,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,
136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:221,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,
149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:222,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,
159:v,160:Y,161:S,162:M},{7:223,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:224,
8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:225,8:122,10:20,11:21,12:b,13:23,
14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:226,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,
20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:227,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,
25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:228,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,
34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(N,[2,208]),a(N,[2,213]),{7:229,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,
37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(N,[2,207]),a(N,[2,212]),{39:230,40:r,41:n,110:231,114:sb},a(La,[2,88]),a(Kb,[2,167]),{35:232,36:Oa},{35:233,36:Oa},a(La,[2,103],{35:234,36:Oa}),{35:235,36:Oa},a(La,
[2,104]),{7:237,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Lb,74:53,75:54,77:40,79:28,80:29,81:30,88:236,91:238,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,121:239,122:tb,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,
161:S,162:M},{86:242,87:Ca,90:Pa},{110:243,114:sb},a(La,[2,89]),a(sa,[2,65],{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,7:244,12:b,28:ea,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:R,62:z,63:l,67:c,68:w,92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,133:Za,135:Za,139:Za,156:Za,
137:q,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),a(Ma,[2,28],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:245,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,
111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{132:105,133:D,135:A,138:106,139:E,141:77,156:va},a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,163,164,165,166,167,168,169,170,171,172,173,174],Va,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,
138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,8:122,12:b,28:ea,29:Ya,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:R,62:z,63:l,67:c,68:w,92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,137:q,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),{6:[1,247],7:246,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,248],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,
49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a([6,31],Ja,{69:251,65:[1,249],70:Mb}),a(Sa,[2,74]),a(Sa,[2,78],{55:[1,253],73:[1,252]}),a(Sa,[2,81]),a(fb,[2,82]),a(fb,[2,83]),a(fb,[2,84]),a(fb,[2,85]),{35:181,36:Oa},{7:254,8:122,10:20,11:21,12:b,13:23,14:24,15:7,
16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:$a,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,116:176,117:V,118:X,119:G,120:Gb,123:177,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(N,[2,68]),{4:256,5:3,7:4,8:5,9:6,
10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:u,32:[1,255],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a([1,6,31,32,42,65,70,73,89,94,
115,120,122,131,133,134,135,139,140,156,159,160,164,165,166,167,168,169,170,171,172,173,174],[2,249],{141:77,132:102,138:103,163:fa}),a(ab,[2,250],{141:77,132:102,138:103,163:fa,165:ga}),a(ab,[2,251],{141:77,132:102,138:103,163:fa,165:ga}),a(ab,[2,252],{141:77,132:102,138:103,163:fa,165:ga}),a(N,[2,253],{40:ua,41:ua,82:ua,83:ua,84:ua,85:ua,87:ua,90:ua,113:ua,114:ua}),a(Kb,xa,{109:107,78:108,86:114,82:ta,83:Na,84:Fa,85:Ga,87:Ca,90:Pa,113:Ia}),{78:118,82:ta,83:Na,84:Fa,85:Ga,86:114,87:Ca,90:Pa,109:117,
113:Ia,114:xa},a(Nb,Ha),a(N,[2,254],{40:ua,41:ua,82:ua,83:ua,84:ua,85:ua,87:ua,90:ua,113:ua,114:ua}),a(N,[2,255]),a(N,[2,256]),{6:[1,259],7:257,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,258],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,
130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:260,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,
137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{30:261,31:Da,155:[1,262]},a(N,[2,192],{126:263,127:[1,264],128:[1,265]}),a(N,[2,206]),a(N,[2,214]),{31:[1,266],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{150:267,152:268,153:gb},a(N,[2,116]),{7:270,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,
33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Eb,[2,119],{30:271,31:Da,40:ua,41:ua,82:ua,83:ua,84:ua,85:ua,87:ua,90:ua,113:ua,114:ua,96:[1,272]}),a(Ma,[2,199],{141:77,132:102,138:103,159:ma,160:Z,
163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ea,bb,{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ea,[2,123]),{29:[1,273],70:[1,274]},{29:[1,275]},{31:hb,33:280,34:g,94:[1,276],100:277,101:278,103:Wa},a([29,70],[2,139]),{102:[1,282]},{31:ub,33:287,34:g,94:[1,283],103:cb,106:284,108:285},a(Ea,[2,143]),{55:[1,289]},{7:290,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,
20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{29:[1,291]},{6:qa,131:[1,292]},{4:293,5:3,7:4,8:5,9:6,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,
18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:u,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a([6,31,70,120],Ob,{141:77,132:102,138:103,121:294,73:[1,295],122:tb,133:D,135:A,139:E,
156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(vb,[2,173]),a([6,31,120],Ja,{69:296,70:ib}),a(Qa,[2,182]),{7:254,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:$a,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,
112:L,116:298,117:V,118:X,119:G,123:177,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Qa,[2,188]),a(Qa,[2,189]),a(Pb,[2,172]),a(Pb,[2,33]),a(t,[2,165]),{7:254,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:$a,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,
74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,115:[1,299],116:300,117:V,118:X,119:G,123:177,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{30:301,31:Da,132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},a(Qb,[2,202],{141:77,132:102,138:103,133:D,134:[1,302],135:A,139:E,159:ma,160:Z,163:fa,164:ia,
165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Qb,[2,204],{141:77,132:102,138:103,133:D,134:[1,303],135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(N,[2,210]),a(Xa,[2,211],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,156,159,160,163,164,165,166,167,168,
169,170,171,172,173,174],[2,215],{140:[1,304]}),a(jb,[2,218]),{33:194,34:g,60:195,74:196,75:197,92:m,118:wa,119:e,143:305,145:193},a(jb,[2,224],{70:[1,306]}),a(kb,[2,220]),a(kb,[2,221]),a(kb,[2,222]),a(kb,[2,223]),a(N,[2,217]),{7:307,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,
79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:308,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,
97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:309,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,
118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(lb,Ja,{69:310,70:Rb}),a(Aa,[2,111]),a(Aa,[2,51],{58:[1,312]}),a(Sb,[2,60],{55:[1,313]}),a(Aa,[2,56]),a(Sb,[2,61]),a(wb,[2,57]),a(wb,[2,58]),a(wb,[2,59]),{46:[1,314],78:118,82:ta,83:Na,84:Fa,85:Ga,86:114,87:Ca,90:Pa,109:117,113:Ia,114:xa},a(Nb,ua),{6:qa,42:[1,315]},a(sa,[2,4]),a(Tb,[2,258],{141:77,132:102,138:103,163:fa,164:ia,165:ga}),a(Tb,[2,259],{141:77,
132:102,138:103,163:fa,164:ia,165:ga}),a(ab,[2,260],{141:77,132:102,138:103,163:fa,165:ga}),a(ab,[2,261],{141:77,132:102,138:103,163:fa,165:ga}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,166,167,168,169,170,171,172,173,174],[2,262],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173],[2,263],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,174:da}),
a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,168,169,170,171,172,173],[2,264],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,169,170,171,172,173],[2,265],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,170,171,172,173],[2,266],{141:77,132:102,138:103,159:ma,160:Z,
163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,171,172,173],[2,267],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,172,173],[2,268],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,
135,139,140,156,173],[2,269],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,174:da}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173,174],[2,270],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja}),a(Xa,[2,248],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Xa,[2,247],{141:77,132:102,
138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(t,[2,160]),a(t,[2,161]),a(La,[2,99]),a(La,[2,100]),a(La,[2,101]),a(La,[2,102]),{89:[1,316]},{73:Lb,89:[2,107],121:317,122:tb,132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{89:[2,108]},{7:318,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,
24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,89:[2,181],92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Ub,[2,175]),a(Ub,Vb),a(La,[2,106]),a(t,[2,162]),a(sa,[2,64],{141:77,132:102,138:103,133:bb,135:bb,139:bb,156:bb,
159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ma,[2,29],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ma,[2,48],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:319,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,
37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:320,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,
44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{66:321,67:c,68:w},a(Ra,db,{72:127,33:129,60:130,74:131,75:132,71:322,34:g,73:d,92:m,118:wa,119:e}),{6:Wb,31:Xb},a(Sa,[2,79]),{7:325,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,
20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Qa,Ob,{141:77,132:102,138:103,73:[1,326],133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,
166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Yb,[2,30]),{6:qa,32:[1,327]},a(Ma,[2,271],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:328,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,
79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:329,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,
97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Ma,[2,274],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(N,[2,246]),{7:330,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,
48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(N,[2,193],{127:[1,331]}),{30:332,31:Da},{30:335,31:Da,33:333,34:g,75:334,92:m},{150:336,152:268,153:gb},{32:[1,337],151:[1,338],152:339,153:gb},a(mb,[2,239]),{7:341,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,
17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,124:340,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Zb,[2,117],{141:77,132:102,138:103,30:342,31:Da,133:D,135:A,139:E,159:ma,
160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(N,[2,120]),{7:343,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,
139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{39:344,40:r,41:n},{92:[1,346],99:345,104:Fb},{39:347,40:r,41:n},{29:[1,348]},a(lb,Ja,{69:349,70:nb}),a(Aa,[2,130]),{31:hb,33:280,34:g,100:351,101:278,103:Wa},a(Aa,[2,135],{102:[1,352]}),a(Aa,[2,137],{102:[1,353]}),{33:354,34:g},a(Ea,[2,141]),a(lb,Ja,{69:355,70:xb}),a(Aa,[2,150]),{31:ub,33:287,34:g,103:cb,106:357,108:285},a(Aa,[2,155],{102:[1,358]}),a(Aa,[2,158],{102:[1,359]}),{6:[1,361],7:360,8:122,10:20,11:21,12:b,13:23,14:24,
15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,362],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(yb,[2,147],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,
160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{39:363,40:r,41:n},a(Ba,[2,200]),{6:qa,32:[1,364]},{7:365,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,
132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a([12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,62,63,67,68,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,158,159,160,161,162],Vb,{6:eb,31:eb,70:eb,120:eb}),{6:ob,31:pb,120:[1,366]},a([6,31,32,115,120],db,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,
136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,76:179,7:254,123:369,12:b,28:ea,34:g,38:h,40:r,41:n,44:B,45:H,48:I,49:F,50:Q,51:x,52:J,53:O,61:R,62:z,63:l,67:c,68:w,73:Ua,92:m,95:k,97:K,105:P,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,133:D,135:A,137:q,139:E,149:ba,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M}),a(Ra,Ja,{69:370,70:ib}),a(t,[2,168]),a([6,31,115],Ja,{69:371,70:ib}),a($b,[2,243]),{7:372,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,
23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:373,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,
28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:374,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,
39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(jb,[2,219]),{33:194,34:g,60:195,74:196,75:197,92:m,118:wa,119:e,145:375},a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,135,139,156],[2,226],{141:77,132:102,138:103,134:[1,
376],140:[1,377],159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(zb,[2,227],{141:77,132:102,138:103,134:[1,378],159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(zb,[2,233],{141:77,132:102,138:103,134:[1,379],159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{6:ac,31:bc,94:[1,380]},a(Ab,db,{39:80,57:204,59:205,11:206,37:207,33:208,35:209,60:210,56:383,
34:g,36:Oa,38:h,40:r,41:n,62:z,118:wa}),{7:384,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,385],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,
160:Y,161:S,162:M},{7:386,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:[1,387],33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},
a(Ba,[2,39]),a(Jb,[2,37]),a(La,[2,105]),{7:388,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,89:[2,179],92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,
160:Y,161:S,162:M},{89:[2,180],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},a(Ma,[2,49],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{32:[1,389],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{30:390,31:Da},a(Sa,[2,75]),{33:129,
34:g,60:130,71:391,72:127,73:d,74:131,75:132,92:m,118:wa,119:e},a(cc,p,{71:126,72:127,33:129,60:130,74:131,75:132,64:392,34:g,73:d,92:m,118:wa,119:e}),a(Sa,[2,80],{141:77,132:102,138:103,133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Qa,eb),a(Yb,[2,31]),{32:[1,393],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},a(Ma,[2,273],
{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{30:394,31:Da,132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{30:395,31:Da},a(N,[2,194]),{30:396,31:Da},{30:397,31:Da},a(Bb,[2,198]),{32:[1,398],151:[1,399],152:339,153:gb},a(N,[2,237]),{30:400,31:Da},a(mb,[2,240]),{30:401,31:Da,70:[1,402]},a(dc,[2,190],{141:77,132:102,138:103,133:D,
135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(N,[2,118]),a(Zb,[2,121],{141:77,132:102,138:103,30:403,31:Da,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ea,[2,124]),{29:[1,404]},{31:hb,33:280,34:g,100:405,101:278,103:Wa},a(Ea,[2,125]),{39:406,40:r,41:n},{6:qb,31:rb,94:[1,407]},a(Ab,db,{33:280,101:410,34:g,103:Wa}),a(Ra,Ja,{69:411,70:nb}),{33:412,34:g},
{33:413,34:g},{29:[2,140]},{6:Cb,31:Db,94:[1,414]},a(Ab,db,{33:287,108:417,34:g,103:cb}),a(Ra,Ja,{69:418,70:xb}),{33:419,34:g,103:[1,420]},{33:421,34:g},a(yb,[2,144],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:422,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,
51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:423,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,
62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Ea,[2,148]),{131:[1,424]},{120:[1,425],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},a(vb,[2,174]),{7:254,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,
18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,123:426,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:254,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,
20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,31:$a,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,73:Ua,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,116:427,117:V,118:X,119:G,123:177,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Qa,[2,183]),{6:ob,31:pb,32:[1,428]},{6:ob,31:pb,115:[1,429]},
a(Xa,[2,203],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Xa,[2,205],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Xa,[2,216],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(jb,[2,225]),{7:430,8:122,10:20,11:21,
12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:431,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,
18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:432,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,
23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:433,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,
28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(vb,[2,109]),{11:206,33:208,34:g,35:209,36:Oa,37:207,38:h,39:80,40:r,41:n,56:434,57:204,59:205,60:210,62:z,118:wa},a(cc,Hb,{39:80,56:203,57:204,
59:205,11:206,37:207,33:208,35:209,60:210,93:435,34:g,36:Oa,38:h,40:r,41:n,62:z,118:wa}),a(Aa,[2,112]),a(Aa,[2,52],{141:77,132:102,138:103,133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:436,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,
66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(Aa,[2,54],{141:77,132:102,138:103,133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{7:437,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,
27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{89:[2,178],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,
173:ra,174:da},a(N,[2,50]),a(N,[2,67]),a(Sa,[2,76]),a(Ra,Ja,{69:438,70:Mb}),a(N,[2,272]),a($b,[2,244]),a(N,[2,195]),a(Bb,[2,196]),a(Bb,[2,197]),a(N,[2,235]),{30:439,31:Da},{32:[1,440]},a(mb,[2,241],{6:[1,441]}),{7:442,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,
92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},a(N,[2,122]),{39:443,40:r,41:n},a(lb,Ja,{69:444,70:nb}),a(Ea,[2,126]),{29:[1,445]},{33:280,34:g,101:446,103:Wa},{31:hb,33:280,34:g,100:447,101:278,103:Wa},a(Aa,[2,131]),{6:qb,31:rb,32:[1,448]},a(Aa,[2,136]),a(Aa,[2,138]),a(Ea,[2,142],{29:[1,449]}),{33:287,34:g,103:cb,108:450},{31:ub,33:287,34:g,103:cb,106:451,108:285},
a(Aa,[2,151]),{6:Cb,31:Db,32:[1,452]},a(Aa,[2,156]),a(Aa,[2,157]),a(Aa,[2,159]),a(yb,[2,145],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),{32:[1,453],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},a(Ba,[2,201]),a(Ba,[2,177]),a(Qa,[2,184]),a(Ra,Ja,{69:454,70:ib}),a(Qa,[2,185]),a(t,[2,169]),a([1,6,31,32,42,
65,70,73,89,94,115,120,122,131,133,134,135,139,156],[2,228],{141:77,132:102,138:103,140:[1,455],159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(zb,[2,230],{141:77,132:102,138:103,134:[1,456],159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ma,[2,229],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ma,[2,234],{141:77,132:102,
138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Aa,[2,113]),a(Ra,Ja,{69:457,70:Rb}),{32:[1,458],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{32:[1,459],132:102,133:D,135:A,138:103,139:E,141:77,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da},{6:Wb,31:Xb,32:[1,460]},{32:[1,461]},a(N,
[2,238]),a(mb,[2,242]),a(dc,[2,191],{141:77,132:102,138:103,133:D,135:A,139:E,156:za,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ea,[2,128]),{6:qb,31:rb,94:[1,462]},{39:463,40:r,41:n},a(Aa,[2,132]),a(Ra,Ja,{69:464,70:nb}),a(Aa,[2,133]),{39:465,40:r,41:n},a(Aa,[2,152]),a(Ra,Ja,{69:466,70:xb}),a(Aa,[2,153]),a(Ea,[2,146]),{6:ob,31:pb,32:[1,467]},{7:468,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,
25:17,26:18,27:19,28:ea,33:70,34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{7:469,8:122,10:20,11:21,12:b,13:23,14:24,15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,28:ea,33:70,
34:g,37:55,38:h,39:80,40:r,41:n,43:57,44:B,45:H,47:27,48:I,49:F,50:Q,51:x,52:J,53:O,54:26,60:71,61:R,62:z,63:l,66:33,67:c,68:w,74:53,75:54,77:40,79:28,80:29,81:30,92:m,95:k,97:K,105:P,111:31,112:L,117:V,118:X,119:G,125:aa,129:U,130:W,132:43,133:D,135:A,136:44,137:q,138:45,139:E,141:77,149:ba,154:41,155:ca,157:C,158:T,159:v,160:Y,161:S,162:M},{6:ac,31:bc,32:[1,470]},a(Aa,[2,53]),a(Aa,[2,55]),a(Sa,[2,77]),a(N,[2,236]),{29:[1,471]},a(Ea,[2,127]),{6:qb,31:rb,32:[1,472]},a(Ea,[2,149]),{6:Cb,31:Db,32:[1,
473]},a(Qa,[2,186]),a(Ma,[2,231],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Ma,[2,232],{141:77,132:102,138:103,159:ma,160:Z,163:fa,164:ia,165:ga,166:ja,167:la,168:oa,169:pa,170:ha,171:ka,172:na,173:ra,174:da}),a(Aa,[2,114]),{39:474,40:r,41:n},a(Aa,[2,134]),a(Aa,[2,154]),a(Ea,[2,129])],defaultActions:{68:[2,69],69:[2,70],238:[2,108],354:[2,140]},parseError:function(a,d){if(d.recoverable)this.trace(a);else{var e=function(a,
d){this.message=a;this.hash=d};e.prototype=Error;throw new e(a,d);}},parse:function(a){var d=[0],e=[null],b=[],p=this.table,t="",wa=0,c=0,g=0,Da=b.slice.call(arguments,1),k=Object.create(this.lexer),h={};for(f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(h[f]=this.yy[f]);k.setInput(a,h);h.lexer=k;h.parser=this;"undefined"==typeof k.yylloc&&(k.yylloc={});var f=k.yylloc;b.push(f);var l=k.options&&k.options.ranges;this.parseError="function"===typeof h.parseError?h.parseError:Object.getPrototypeOf(this).parseError;
for(var m,Ta,Ha,n,ua={},y,w;;){Ha=d[d.length-1];if(this.defaultActions[Ha])n=this.defaultActions[Ha];else{if(null===m||"undefined"==typeof m)m=k.lex()||1,"number"!==typeof m&&(m=this.symbols_[m]||m);n=p[Ha]&&p[Ha][m]}if("undefined"===typeof n||!n.length||!n[0]){w=[];for(y in p[Ha])this.terminals_[y]&&2<y&&w.push("'"+this.terminals_[y]+"'");var q=k.showPosition?"Parse error on line "+(wa+1)+":\n"+k.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+
(wa+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'");this.parseError(q,{text:k.match,token:this.terminals_[m]||m,line:k.yylineno,loc:f,expected:w})}if(n[0]instanceof Array&&1<n.length)throw Error("Parse Error: multiple actions possible at state: "+Ha+", token: "+m);switch(n[0]){case 1:d.push(m);e.push(k.yytext);b.push(k.yylloc);d.push(n[1]);m=null;Ta?(m=Ta,Ta=null):(c=k.yyleng,t=k.yytext,wa=k.yylineno,f=k.yylloc,0<g&&g--);break;case 2:w=this.productions_[n[1]][1];ua.$=e[e.length-
w];ua._$={first_line:b[b.length-(w||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(w||1)].first_column,last_column:b[b.length-1].last_column};l&&(ua._$.range=[b[b.length-(w||1)].range[0],b[b.length-1].range[1]]);Ha=this.performAction.apply(ua,[t,c,wa,h,n[1],e,b].concat(Da));if("undefined"!==typeof Ha)return Ha;w&&(d=d.slice(0,-2*w),e=e.slice(0,-1*w),b=b.slice(0,-1*w));d.push(this.productions_[n[1]][0]);e.push(ua.$);b.push(ua._$);n=p[d[d.length-2]][d[d.length-1]];d.push(n);
break;case 3:return!0}}}};f.prototype=ec;ec.Parser=f;return new f}();"undefined"!==typeof u&&"undefined"!==typeof f&&(f.parser=q,f.Parser=q.Parser,f.parse=function(){return q.parse.apply(q,arguments)},f.main=function(y){y[1]||(console.log("Usage: "+y[0]+" FILE"),process.exit(1));var a="",b=u("fs");"undefined"!==typeof b&&null!==b&&(a=b.readFileSync(u("path").normalize(y[1]),"utf8"));return f.parser.parse(a)},"undefined"!==typeof qa&&u.main===qa&&f.main(process.argv.slice(1)));return qa.exports}();
u["./scope"]=function(){var f={};(function(){var u=[].indexOf||function(f){for(var y=0,a=this.length;y<a;y++)if(y in this&&this[y]===f)return y;return-1};f.Scope=function(){function f(f,a,b,q){var g,h;this.parent=f;this.expressions=a;this.method=b;this.referencedVars=q;this.variables=[{name:"arguments",type:"arguments"}];this.positions={};this.parent||(this.utilities={});this.root=null!=(g=null!=(h=this.parent)?h.root:void 0)?g:this}f.prototype.add=function(f,a,b){return this.shared&&!b?this.parent.add(f,
a,b):Object.prototype.hasOwnProperty.call(this.positions,f)?this.variables[this.positions[f]].type=a:this.positions[f]=this.variables.push({name:f,type:a})-1};f.prototype.namedMethod=function(){var f;return null!=(f=this.method)&&f.name||!this.parent?this.method:this.parent.namedMethod()};f.prototype.find=function(f,a){null==a&&(a="var");if(this.check(f))return!0;this.add(f,a);return!1};f.prototype.parameter=function(f){if(!this.shared||!this.parent.check(f,!0))return this.add(f,"param")};f.prototype.check=
function(f){var a;return!!(this.type(f)||null!=(a=this.parent)&&a.check(f))};f.prototype.temporary=function(f,a,b){null==b&&(b=!1);return b?(b=f.charCodeAt(0),f=122-b,b=String.fromCharCode(b+a%(f+1)),a=Math.floor(a/(f+1)),""+b+(a||"")):""+f+(a||"")};f.prototype.type=function(f){var a;var b=this.variables;var q=0;for(a=b.length;q<a;q++){var g=b[q];if(g.name===f)return g.type}return null};f.prototype.freeVariable=function(f,a){var b,q;null==a&&(a={});for(b=0;;){var g=this.temporary(f,b,a.single);if(!(this.check(g)||
0<=u.call(this.root.referencedVars,g)))break;b++}(null!=(q=a.reserve)?q:1)&&this.add(g,"var",!0);return g};f.prototype.assign=function(f,a){this.add(f,{value:a,assigned:!0},!0);return this.hasAssignments=!0};f.prototype.hasDeclarations=function(){return!!this.declaredVariables().length};f.prototype.declaredVariables=function(){var f;var a=this.variables;var b=[];var q=0;for(f=a.length;q<f;q++){var g=a[q];"var"===g.type&&b.push(g.name)}return b.sort()};f.prototype.assignedVariables=function(){var f;
var a=this.variables;var b=[];var q=0;for(f=a.length;q<f;q++){var g=a[q];g.type.assigned&&b.push(g.name+" \x3d "+g.type.value)}return b};return f}()}).call(this);return f}();u["./nodes"]=function(){var f={};(function(){var qa,q,y,a,b,ya,g,h,r,n,B,H,I,F,Q,x,J,O,R,z,l,c,w,m,k,K,P,L,V,X,G,aa,U,W,D,A,va,E,ba,ca,C,T,v=function(a,b){function p(){this.constructor=a}for(var d in b)Y.call(b,d)&&(a[d]=b[d]);p.prototype=b.prototype;a.prototype=new p;a.__super__=b.prototype;return a},Y={}.hasOwnProperty,S=[].indexOf||
function(a){for(var b=0,p=this.length;b<p;b++)if(b in this&&this[b]===a)return b;return-1},M=[].slice;Error.stackTraceLimit=Infinity;var xa=u("./scope").Scope;var sa=u("./lexer");var za=sa.isUnassignable;var ma=sa.JS_FORBIDDEN;var Z=u("./helpers");var fa=Z.compact;var ia=Z.flatten;var ga=Z.extend;var ja=Z.merge;var la=Z.del;sa=Z.addLocationDataFn;var oa=Z.locationDataToString;var pa=Z.throwSyntaxError;f.extend=ga;f.addLocationDataFn=sa;var ha=function(){return!0};var ka=function(){return!1};var na=
function(){return this};var ra=function(){this.negated=!this.negated;return this};f.CodeFragment=r=function(){function a(a,b){var d;this.code=""+b;this.locationData=null!=a?a.locationData:void 0;this.type=(null!=a?null!=(d=a.constructor)?d.name:void 0:void 0)||"unknown"}a.prototype.toString=function(){return""+this.code+(this.locationData?": "+oa(this.locationData):"")};return a}();var da=function(a){var b;var p=[];var d=0;for(b=a.length;d<b;d++){var wa=a[d];p.push(wa.code)}return p.join("")};f.Base=
sa=function(){function b(){}b.prototype.compile=function(a,b){return da(this.compileToFragments(a,b))};b.prototype.compileToFragments=function(a,b){a=ga({},a);b&&(a.level=b);b=this.unfoldSoak(a)||this;b.tab=a.indent;return a.level!==N&&b.isStatement(a)?b.compileClosure(a):b.compileNode(a)};b.prototype.compileClosure=function(b){var p,d,t;(d=this.jumps())&&d.error("cannot use a pure statement in an expression");b.sharedScope=!0;d=new h([],a.wrap([this]));var e=[];if((p=this.contains(Va))||this.contains(ea))e=
[new E],p?(p="apply",e.push(new x("arguments"))):p="call",d=new C(d,[new qa(new L(p))]);b=(new ya(d,e)).compileNode(b);if(d.isGenerator||null!=(t=d.base)&&t.isGenerator)b.unshift(this.makeCode("(yield* ")),b.push(this.makeCode(")"));return b};b.prototype.cache=function(a,b,d){if(null!=d?d(this):this.isComplex()){d=new x(a.scope.freeVariable("ref"));var p=new y(d,this);return b?[p.compileToFragments(a,b),[this.makeCode(d.value)]]:[p,d]}d=b?this.compileToFragments(a,b):this;return[d,d]};b.prototype.cacheToCodeFragments=
function(a){return[da(a[0]),da(a[1])]};b.prototype.makeReturn=function(a){var b=this.unwrapAll();return a?new ya(new z(a+".push"),[b]):new G(b)};b.prototype.contains=function(a){var b=void 0;this.traverseChildren(!1,function(d){if(a(d))return b=d,!1});return b};b.prototype.lastNonComment=function(a){var b;for(b=a.length;b--;)if(!(a[b]instanceof n))return a[b];return null};b.prototype.toString=function(a,b){null==a&&(a="");null==b&&(b=this.constructor.name);var d="\n"+a+b;this.soak&&(d+="?");this.eachChild(function(b){return d+=
b.toString(a+Ca)});return d};b.prototype.eachChild=function(a){var b,d;if(!this.children)return this;var t=this.children;var e=0;for(b=t.length;e<b;e++){var c=t[e];if(this[c]){var f=ia([this[c]]);var g=0;for(d=f.length;g<d;g++)if(c=f[g],!1===a(c))return this}}return this};b.prototype.traverseChildren=function(a,b){return this.eachChild(function(d){if(!1!==b(d))return d.traverseChildren(a,b)})};b.prototype.invert=function(){return new k("!",this)};b.prototype.unwrapAll=function(){var a;for(a=this;a!==
(a=a.unwrap()););return a};b.prototype.children=[];b.prototype.isStatement=ka;b.prototype.jumps=ka;b.prototype.isComplex=ha;b.prototype.isChainable=ka;b.prototype.isAssignable=ka;b.prototype.isNumber=ka;b.prototype.unwrap=na;b.prototype.unfoldSoak=ka;b.prototype.assigns=ka;b.prototype.updateLocationDataIfMissing=function(a){if(this.locationData)return this;this.locationData=a;return this.eachChild(function(b){return b.updateLocationDataIfMissing(a)})};b.prototype.error=function(a){return pa(a,this.locationData)};
b.prototype.makeCode=function(a){return new r(this,a)};b.prototype.wrapInBraces=function(a){return[].concat(this.makeCode("("),a,this.makeCode(")"))};b.prototype.joinFragmentArrays=function(a,b){var d,p;var e=[];var t=d=0;for(p=a.length;d<p;t=++d){var c=a[t];t&&e.push(this.makeCode(b));e=e.concat(c)}return e};return b}();f.Block=a=function(a){function b(a){this.expressions=fa(ia(a||[]))}v(b,a);b.prototype.children=["expressions"];b.prototype.push=function(a){this.expressions.push(a);return this};
b.prototype.pop=function(){return this.expressions.pop()};b.prototype.unshift=function(a){this.expressions.unshift(a);return this};b.prototype.unwrap=function(){return 1===this.expressions.length?this.expressions[0]:this};b.prototype.isEmpty=function(){return!this.expressions.length};b.prototype.isStatement=function(a){var d;var b=this.expressions;var e=0;for(d=b.length;e<d;e++){var p=b[e];if(p.isStatement(a))return!0}return!1};b.prototype.jumps=function(a){var d;var b=this.expressions;var e=0;for(d=
b.length;e<d;e++){var p=b[e];if(p=p.jumps(a))return p}};b.prototype.makeReturn=function(a){var d;for(d=this.expressions.length;d--;){var b=this.expressions[d];if(!(b instanceof n)){this.expressions[d]=b.makeReturn(a);b instanceof G&&!b.expression&&this.expressions.splice(d,1);break}}return this};b.prototype.compileToFragments=function(a,d){null==a&&(a={});return a.scope?b.__super__.compileToFragments.call(this,a,d):this.compileRoot(a)};b.prototype.compileNode=function(a){var d,p;this.tab=a.indent;
var e=a.level===N;var t=[];var c=this.expressions;var f=d=0;for(p=c.length;d<p;f=++d){var g=c[f];g=g.unwrapAll();g=g.unfoldSoak(a)||g;g instanceof b?t.push(g.compileNode(a)):e?(g.front=!0,f=g.compileToFragments(a),g.isStatement(a)||(f.unshift(this.makeCode(""+this.tab)),f.push(this.makeCode(";"))),t.push(f)):t.push(g.compileToFragments(a,ta))}if(e)return this.spaced?[].concat(this.joinFragmentArrays(t,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(t,"\n");d=t.length?this.joinFragmentArrays(t,
", "):[this.makeCode("void 0")];return 1<t.length&&a.level>=ta?this.wrapInBraces(d):d};b.prototype.compileRoot=function(a){var d,b;a.indent=a.bare?"":Ca;a.level=N;this.spaced=!0;a.scope=new xa(null,this,null,null!=(b=a.referencedVars)?b:[]);var e=a.locals||[];b=0;for(d=e.length;b<d;b++){var p=e[b];a.scope.parameter(p)}b=[];if(!a.bare){var t=this.expressions;d=[];var c=p=0;for(e=t.length;p<e;c=++p){c=t[c];if(!(c.unwrap()instanceof n))break;d.push(c)}p=this.expressions.slice(d.length);this.expressions=
d;d.length&&(b=this.compileNode(ja(a,{indent:""})),b.push(this.makeCode("\n")));this.expressions=p}d=this.compileWithDeclarations(a);return a.bare?d:[].concat(b,this.makeCode("(function() {\n"),d,this.makeCode("\n}).call(this);\n"))};b.prototype.compileWithDeclarations=function(a){var d,b;var e=[];var p=this.expressions;var t=b=0;for(d=p.length;b<d;t=++b){var c=p[t];c=c.unwrap();if(!(c instanceof n||c instanceof z))break}a=ja(a,{level:N});t&&(c=this.expressions.splice(t,9E9),e=[this.spaced,!1],b=
e[0],this.spaced=e[1],b=[this.compileNode(a),b],e=b[0],this.spaced=b[1],this.expressions=c);c=this.compileNode(a);b=a.scope;b.expressions===this&&(d=a.scope.hasDeclarations(),a=b.hasAssignments,d||a?(t&&e.push(this.makeCode("\n")),e.push(this.makeCode(this.tab+"var ")),d&&e.push(this.makeCode(b.declaredVariables().join(", "))),a&&(d&&e.push(this.makeCode(",\n"+(this.tab+Ca))),e.push(this.makeCode(b.assignedVariables().join(",\n"+(this.tab+Ca))))),e.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):
e.length&&c.length&&e.push(this.makeCode("\n")));return e.concat(c)};b.wrap=function(a){return 1===a.length&&a[0]instanceof b?a[0]:new b(a)};return b}(sa);f.Literal=z=function(a){function b(a){this.value=a}v(b,a);b.prototype.isComplex=ka;b.prototype.assigns=function(a){return a===this.value};b.prototype.compileNode=function(a){return[this.makeCode(this.value)]};b.prototype.toString=function(){return" "+(this.isStatement()?b.__super__.toString.apply(this,arguments):this.constructor.name)+": "+this.value};
return b}(sa);f.NumberLiteral=w=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(z);f.InfinityLiteral=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.compileNode=function(){return[this.makeCode("2e308")]};return b}(w);f.NaNLiteral=function(a){function b(){b.__super__.constructor.call(this,"NaN")}v(b,a);b.prototype.compileNode=function(a){var d=[this.makeCode("0/0")];return a.level>=Fa?this.wrapInBraces(d):
d};return b}(w);f.StringLiteral=D=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(z);f.RegexLiteral=X=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(z);f.PassthroughLiteral=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(z);f.IdentifierLiteral=x=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isAssignable=ha;
return b}(z);f.PropertyName=L=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isAssignable=ha;return b}(z);f.StatementLiteral=W=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isStatement=ha;b.prototype.makeReturn=na;b.prototype.jumps=function(a){if("break"===this.value&&!(null!=a&&a.loop||null!=a&&a.block)||"continue"===this.value&&(null==a||!a.loop))return this};b.prototype.compileNode=function(a){return[this.makeCode(""+
this.tab+this.value+";")]};return b}(z);f.ThisLiteral=E=function(a){function b(){b.__super__.constructor.call(this,"this")}v(b,a);b.prototype.compileNode=function(a){var d;a=null!=(d=a.scope.method)&&d.bound?a.scope.method.context:this.value;return[this.makeCode(a)]};return b}(z);f.UndefinedLiteral=ca=function(a){function b(){b.__super__.constructor.call(this,"undefined")}v(b,a);b.prototype.compileNode=function(a){return[this.makeCode(a.level>=Ga?"(void 0)":"void 0")]};return b}(z);f.NullLiteral=
c=function(a){function b(){b.__super__.constructor.call(this,"null")}v(b,a);return b}(z);f.BooleanLiteral=b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(z);f.Return=G=function(a){function b(a){this.expression=a}v(b,a);b.prototype.children=["expression"];b.prototype.isStatement=ha;b.prototype.makeReturn=na;b.prototype.jumps=na;b.prototype.compileToFragments=function(a,d){var p;var e=null!=(p=this.expression)?p.makeReturn():void 0;return!e||e instanceof
b?b.__super__.compileToFragments.call(this,a,d):e.compileToFragments(a,d)};b.prototype.compileNode=function(a){var b=[];b.push(this.makeCode(this.tab+("return"+(this.expression?" ":""))));this.expression&&(b=b.concat(this.expression.compileToFragments(a,Ka)));b.push(this.makeCode(";"));return b};return b}(sa);f.YieldReturn=T=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.compileNode=function(a){null==a.scope.parent&&this.error("yield can only occur inside functions");
return b.__super__.compileNode.apply(this,arguments)};return b}(G);f.Value=C=function(a){function t(a,b,wa){if(!b&&a instanceof t)return a;this.base=a;this.properties=b||[];wa&&(this[wa]=!0);return this}v(t,a);t.prototype.children=["base","properties"];t.prototype.add=function(a){this.properties=this.properties.concat(a);return this};t.prototype.hasProperties=function(){return!!this.properties.length};t.prototype.bareLiteral=function(a){return!this.properties.length&&this.base instanceof a};t.prototype.isArray=
function(){return this.bareLiteral(q)};t.prototype.isRange=function(){return this.bareLiteral(V)};t.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()};t.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()};t.prototype.isNumber=function(){return this.bareLiteral(w)};t.prototype.isString=function(){return this.bareLiteral(D)};t.prototype.isRegex=function(){return this.bareLiteral(X)};t.prototype.isUndefined=function(){return this.bareLiteral(ca)};
t.prototype.isNull=function(){return this.bareLiteral(c)};t.prototype.isBoolean=function(){return this.bareLiteral(b)};t.prototype.isAtomic=function(){var a;var b=this.properties.concat(this.base);var wa=0;for(a=b.length;wa<a;wa++){var e=b[wa];if(e.soak||e instanceof ya)return!1}return!0};t.prototype.isNotCallable=function(){return this.isNumber()||this.isString()||this.isRegex()||this.isArray()||this.isRange()||this.isSplice()||this.isObject()||this.isUndefined()||this.isNull()||this.isBoolean()};
t.prototype.isStatement=function(a){return!this.properties.length&&this.base.isStatement(a)};t.prototype.assigns=function(a){return!this.properties.length&&this.base.assigns(a)};t.prototype.jumps=function(a){return!this.properties.length&&this.base.jumps(a)};t.prototype.isObject=function(a){return this.properties.length?!1:this.base instanceof m&&(!a||this.base.generated)};t.prototype.isSplice=function(){var a=this.properties;return a[a.length-1]instanceof aa};t.prototype.looksStatic=function(a){var b;
return this.base.value===a&&1===this.properties.length&&"prototype"!==(null!=(b=this.properties[0].name)?b.value:void 0)};t.prototype.unwrap=function(){return this.properties.length?this:this.base};t.prototype.cacheReference=function(a){var b=this.properties;var p=b[b.length-1];if(2>this.properties.length&&!this.base.isComplex()&&(null==p||!p.isComplex()))return[this,this];b=new t(this.base,this.properties.slice(0,-1));if(b.isComplex()){var e=new x(a.scope.freeVariable("base"));b=new t(new P(new y(e,
b)))}if(!p)return[b,e];if(p.isComplex()){var c=new x(a.scope.freeVariable("name"));p=new R(new y(c,p.index));c=new R(c)}return[b.add(p),new t(e||b.base,[c||p])]};t.prototype.compileNode=function(a){var b;this.base.front=this.front;var p=this.properties;var e=this.base.compileToFragments(a,p.length?Ga:null);p.length&&Pa.test(da(e))&&e.push(this.makeCode("."));var t=0;for(b=p.length;t<b;t++){var c=p[t];e.push.apply(e,c.compileToFragments(a))}return e};t.prototype.unfoldSoak=function(a){return null!=
this.unfoldedSoak?this.unfoldedSoak:this.unfoldedSoak=function(b){return function(){var d,e,p;if(e=b.base.unfoldSoak(a))return(d=e.body.properties).push.apply(d,b.properties),e;var c=b.properties;e=d=0;for(p=c.length;d<p;e=++d){var f=c[e];if(f.soak)return f.soak=!1,d=new t(b.base,b.properties.slice(0,e)),p=new t(b.base,b.properties.slice(e)),d.isComplex()&&(e=new x(a.scope.freeVariable("ref")),d=new P(new y(e,d)),p.base=e),new J(new B(d),p,{soak:!0})}return!1}}(this)()};return t}(sa);f.Comment=n=
function(a){function b(a){this.comment=a}v(b,a);b.prototype.isStatement=ha;b.prototype.makeReturn=na;b.prototype.compileNode=function(a,b){var d=this.comment.replace(/^(\s*)#(?=\s)/gm,"$1 *");d="/*"+Ea(d,this.tab)+(0<=S.call(d,"\n")?"\n"+this.tab:"")+" */";(b||a.level)===N&&(d=a.indent+d);return[this.makeCode("\n"),this.makeCode(d)]};return b}(sa);f.Call=ya=function(a){function b(a,b,c){this.variable=a;this.args=null!=b?b:[];this.soak=c;this.isNew=!1;this.variable instanceof C&&this.variable.isNotCallable()&&
this.variable.error("literal is not a function")}v(b,a);b.prototype.children=["variable","args"];b.prototype.updateLocationDataIfMissing=function(a){var d;if(this.locationData&&this.needsUpdatedStartLocation){this.locationData.first_line=a.first_line;this.locationData.first_column=a.first_column;var p=(null!=(d=this.variable)?d.base:void 0)||this.variable;p.needsUpdatedStartLocation&&(this.variable.locationData.first_line=a.first_line,this.variable.locationData.first_column=a.first_column,p.updateLocationDataIfMissing(a));
delete this.needsUpdatedStartLocation}return b.__super__.updateLocationDataIfMissing.apply(this,arguments)};b.prototype.newInstance=function(){var a;var d=(null!=(a=this.variable)?a.base:void 0)||this.variable;d instanceof b&&!d.isNew?d.newInstance():this.isNew=!0;this.needsUpdatedStartLocation=!0;return this};b.prototype.unfoldSoak=function(a){var d,p;if(this.soak){if(this instanceof va){var e=new z(this.superReference(a));var c=new C(e)}else{if(c=Ba(a,this,"variable"))return c;c=(new C(this.variable)).cacheReference(a);
e=c[0];c=c[1]}c=new b(c,this.args);c.isNew=this.isNew;e=new z("typeof "+e.compile(a)+' \x3d\x3d\x3d "function"');return new J(e,new C(c),{soak:!0})}e=this;for(d=[];;)if(e.variable instanceof b)d.push(e),e=e.variable;else{if(!(e.variable instanceof C))break;d.push(e);if(!((e=e.variable.base)instanceof b))break}var t=d.reverse();d=0;for(p=t.length;d<p;d++)e=t[d],c&&(e.variable instanceof b?e.variable=c:e.variable.base=c),c=Ba(a,e,"variable");return c};b.prototype.compileNode=function(a){var b,p,e;null!=
(b=this.variable)&&(b.front=this.front);b=U.compileSplattedArray(a,this.args,!0);if(b.length)return this.compileSplat(a,b);b=[];var c=this.args;var t=p=0;for(e=c.length;p<e;t=++p){var f=c[t];t&&b.push(this.makeCode(", "));b.push.apply(b,f.compileToFragments(a,ta))}f=[];this instanceof va?(a=this.superReference(a)+(".call("+this.superThis(a)),b.length&&(a+=", "),f.push(this.makeCode(a))):(this.isNew&&f.push(this.makeCode("new ")),f.push.apply(f,this.variable.compileToFragments(a,Ga)),f.push(this.makeCode("(")));
f.push.apply(f,b);f.push(this.makeCode(")"));return f};b.prototype.compileSplat=function(a,b){var d;if(this instanceof va)return[].concat(this.makeCode(this.superReference(a)+".apply("+this.superThis(a)+", "),b,this.makeCode(")"));if(this.isNew){var e=this.tab+Ca;return[].concat(this.makeCode("(function(func, args, ctor) {\n"+e+"ctor.prototype \x3d func.prototype;\n"+e+"var child \x3d new ctor, result \x3d func.apply(child, args);\n"+e+"return Object(result) \x3d\x3d\x3d result ? result : child;\n"+
this.tab+"})("),this.variable.compileToFragments(a,ta),this.makeCode(", "),b,this.makeCode(", function(){})"))}e=[];var p=new C(this.variable);if((d=p.properties.pop())&&p.isComplex()){var c=a.scope.freeVariable("ref");e=e.concat(this.makeCode("("+c+" \x3d "),p.compileToFragments(a,ta),this.makeCode(")"),d.compileToFragments(a))}else p=p.compileToFragments(a,Ga),Pa.test(da(p))&&(p=this.wrapInBraces(p)),d?(c=da(p),p.push.apply(p,d.compileToFragments(a))):c="null",e=e.concat(p);return e.concat(this.makeCode(".apply("+
c+", "),b,this.makeCode(")"))};return b}(sa);f.SuperCall=va=function(a){function b(a){b.__super__.constructor.call(this,null,null!=a?a:[new U(new x("arguments"))]);this.isBare=null!=a}v(b,a);b.prototype.superReference=function(a){var b=a.scope.namedMethod();if(null!=b&&b.klass){var p=b.klass;var e=b.name;var c=b.variable;if(p.isComplex()){var t=new x(a.scope.parent.freeVariable("base"));var f=new C(new P(new y(t,p)));c.base=f;c.properties.splice(0,p.properties.length)}if(e.isComplex()||e instanceof
R&&e.index.isAssignable()){var g=new x(a.scope.parent.freeVariable("name"));e=new R(new y(g,e.index));c.properties.pop();c.properties.push(e)}f=[new qa(new L("__super__"))];b["static"]&&f.push(new qa(new L("constructor")));f.push(null!=g?new R(g):e);return(new C(null!=t?t:p,f)).compile(a)}return null!=b&&b.ctor?b.name+".__super__.constructor":this.error("cannot call super outside of an instance method.")};b.prototype.superThis=function(a){return(a=a.scope.method)&&!a.klass&&a.context||"this"};return b}(ya);
f.RegexWithInterpolations=function(a){function b(a){null==a&&(a=[]);b.__super__.constructor.call(this,new C(new x("RegExp")),a,!1)}v(b,a);return b}(ya);f.TaggedTemplateCall=function(b){function c(b,d,t){d instanceof D&&(d=new A(a.wrap([new C(d)])));c.__super__.constructor.call(this,b,[d],t)}v(c,b);c.prototype.compileNode=function(a){a.inTaggedTemplateCall=!0;return this.variable.compileToFragments(a,Ga).concat(this.args[0].compileToFragments(a,ta))};return c}(ya);f.Extends=F=function(a){function b(a,
b){this.child=a;this.parent=b}v(b,a);b.prototype.children=["child","parent"];b.prototype.compileToFragments=function(a){return(new ya(new C(new z(Ia("extend",a))),[this.child,this.parent])).compileToFragments(a)};return b}(sa);f.Access=qa=function(a){function b(a,b){this.name=a;this.soak="soak"===b}v(b,a);b.prototype.children=["name"];b.prototype.compileToFragments=function(a){var b;a=this.name.compileToFragments(a);var p=this.name.unwrap();return p instanceof L?(b=p.value,0<=S.call(ma,b))?[this.makeCode('["')].concat(M.call(a),
[this.makeCode('"]')]):[this.makeCode(".")].concat(M.call(a)):[this.makeCode("[")].concat(M.call(a),[this.makeCode("]")])};b.prototype.isComplex=ka;return b}(sa);f.Index=R=function(a){function b(a){this.index=a}v(b,a);b.prototype.children=["index"];b.prototype.compileToFragments=function(a){return[].concat(this.makeCode("["),this.index.compileToFragments(a,Ka),this.makeCode("]"))};b.prototype.isComplex=function(){return this.index.isComplex()};return b}(sa);f.Range=V=function(a){function b(a,b,c){this.from=
a;this.to=b;this.equals=(this.exclusive="exclusive"===c)?"":"\x3d"}v(b,a);b.prototype.children=["from","to"];b.prototype.compileVariables=function(a){a=ja(a,{top:!0});var b=la(a,"isComplex");var p=this.cacheToCodeFragments(this.from.cache(a,ta,b));this.fromC=p[0];this.fromVar=p[1];p=this.cacheToCodeFragments(this.to.cache(a,ta,b));this.toC=p[0];this.toVar=p[1];if(p=la(a,"step"))a=this.cacheToCodeFragments(p.cache(a,ta,b)),this.step=a[0],this.stepVar=a[1];this.fromNum=this.from.isNumber()?Number(this.fromVar):
null;this.toNum=this.to.isNumber()?Number(this.toVar):null;return this.stepNum=null!=p&&p.isNumber()?Number(this.stepVar):null};b.prototype.compileNode=function(a){var b,p,e,c;this.fromVar||this.compileVariables(a);if(!a.index)return this.compileArray(a);var t=null!=this.fromNum&&null!=this.toNum;var f=la(a,"index");var g=(a=la(a,"name"))&&a!==f;var k=f+" \x3d "+this.fromC;this.toC!==this.toVar&&(k+=", "+this.toC);this.step!==this.stepVar&&(k+=", "+this.step);var h=[f+" \x3c"+this.equals,f+" \x3e"+
this.equals];var m=h[0];h=h[1];m=null!=this.stepNum?0<this.stepNum?m+" "+this.toVar:h+" "+this.toVar:t?(e=[this.fromNum,this.toNum],p=e[0],c=e[1],e,p<=c?m+" "+c:h+" "+c):(b=this.stepVar?this.stepVar+" \x3e 0":this.fromVar+" \x3c\x3d "+this.toVar,b+" ? "+m+" "+this.toVar+" : "+h+" "+this.toVar);b=this.stepVar?f+" +\x3d "+this.stepVar:t?g?p<=c?"++"+f:"--"+f:p<=c?f+"++":f+"--":g?b+" ? ++"+f+" : --"+f:b+" ? "+f+"++ : "+f+"--";g&&(k=a+" \x3d "+k);g&&(b=a+" \x3d "+b);return[this.makeCode(k+"; "+m+"; "+
b)]};b.prototype.compileArray=function(a){var b,p,e;if((b=null!=this.fromNum&&null!=this.toNum)&&20>=Math.abs(this.fromNum-this.toNum)){var c=function(){e=[];for(var a=p=this.fromNum,b=this.toNum;p<=b?a<=b:a>=b;p<=b?a++:a--)e.push(a);return e}.apply(this);this.exclusive&&c.pop();return[this.makeCode("["+c.join(", ")+"]")]}var t=this.tab+Ca;var f=a.scope.freeVariable("i",{single:!0});var g=a.scope.freeVariable("results");var k="\n"+t+g+" \x3d [];";if(b)a.index=f,b=da(this.compileNode(a));else{var h=
f+" \x3d "+this.fromC+(this.toC!==this.toVar?", "+this.toC:"");b=this.fromVar+" \x3c\x3d "+this.toVar;b="var "+h+"; "+b+" ? "+f+" \x3c"+this.equals+" "+this.toVar+" : "+f+" \x3e"+this.equals+" "+this.toVar+"; "+b+" ? "+f+"++ : "+f+"--"}f="{ "+g+".push("+f+"); }\n"+t+"return "+g+";\n"+a.indent;a=function(a){return null!=a?a.contains(Va):void 0};if(a(this.from)||a(this.to))c=", arguments";return[this.makeCode("(function() {"+k+"\n"+t+"for ("+b+")"+f+"}).apply(this"+(null!=c?c:"")+")")]};return b}(sa);
f.Slice=aa=function(a){function b(a){this.range=a;b.__super__.constructor.call(this)}v(b,a);b.prototype.children=["range"];b.prototype.compileNode=function(a){var b=this.range;var p=b.to;var e=(b=b.from)&&b.compileToFragments(a,Ka)||[this.makeCode("0")];if(p){b=p.compileToFragments(a,Ka);var c=da(b);if(this.range.exclusive||-1!==+c)var t=", "+(this.range.exclusive?c:p.isNumber()?""+(+c+1):(b=p.compileToFragments(a,Ga),"+"+da(b)+" + 1 || 9e9"))}return[this.makeCode(".slice("+da(e)+(t||"")+")")]};return b}(sa);
f.Obj=m=function(a){function b(a,b){this.generated=null!=b?b:!1;this.objects=this.properties=a||[]}v(b,a);b.prototype.children=["properties"];b.prototype.compileNode=function(a){var b,p,e;var c=this.properties;if(this.generated){var t=0;for(b=c.length;t<b;t++){var f=c[t];f instanceof C&&f.error("cannot have an implicit value in an implicit object")}}t=b=0;for(f=c.length;b<f;t=++b){var g=c[t];if((g.variable||g).base instanceof P)break}f=t<c.length;var k=a.indent+=Ca;var h=this.lastNonComment(this.properties);
b=[];if(f){var m=a.scope.freeVariable("obj");b.push(this.makeCode("(\n"+k+m+" \x3d "))}b.push(this.makeCode("{"+(0===c.length||0===t?"}":"\n")));var l=p=0;for(e=c.length;p<e;l=++p){g=c[l];l===t&&(0!==l&&b.push(this.makeCode("\n"+k+"}")),b.push(this.makeCode(",\n")));var w=l===c.length-1||l===t-1?"":g===h||g instanceof n?"\n":",\n";var q=g instanceof n?"":k;f&&l<t&&(q+=Ca);g instanceof y&&("object"!==g.context&&g.operatorToken.error("unexpected "+g.operatorToken.value),g.variable instanceof C&&g.variable.hasProperties()&&
g.variable.error("invalid object key"));g instanceof C&&g["this"]&&(g=new y(g.properties[0].name,g,"object"));g instanceof n||(l<t?g instanceof y||(g=new y(g,g,"object")):(g instanceof y?(l=g.variable,g=g.value):(g=g.base.cache(a),l=g[0],g=g[1],l instanceof x&&(l=new L(l.value))),g=new y(new C(new x(m),[new qa(l)]),g)));q&&b.push(this.makeCode(q));b.push.apply(b,g.compileToFragments(a,N));w&&b.push(this.makeCode(w))}f?b.push(this.makeCode(",\n"+k+m+"\n"+this.tab+")")):0!==c.length&&b.push(this.makeCode("\n"+
this.tab+"}"));return this.front&&!f?this.wrapInBraces(b):b};b.prototype.assigns=function(a){var b;var p=this.properties;var e=0;for(b=p.length;e<b;e++){var c=p[e];if(c.assigns(a))return!0}return!1};return b}(sa);f.Arr=q=function(a){function b(a){this.objects=a||[]}v(b,a);b.prototype.children=["objects"];b.prototype.compileNode=function(a){var b;if(!this.objects.length)return[this.makeCode("[]")];a.indent+=Ca;var p=U.compileSplattedArray(a,this.objects);if(p.length)return p;p=[];var e=this.objects;
var c=[];var t=0;for(b=e.length;t<b;t++){var f=e[t];c.push(f.compileToFragments(a,ta))}t=b=0;for(e=c.length;b<e;t=++b)f=c[t],t&&p.push(this.makeCode(", ")),p.push.apply(p,f);0<=da(p).indexOf("\n")?(p.unshift(this.makeCode("[\n"+a.indent)),p.push(this.makeCode("\n"+this.tab+"]"))):(p.unshift(this.makeCode("[")),p.push(this.makeCode("]")));return p};b.prototype.assigns=function(a){var b;var p=this.objects;var e=0;for(b=p.length;e<b;e++){var c=p[e];if(c.assigns(a))return!0}return!1};return b}(sa);f.Class=
g=function(b){function c(b,d,c){this.variable=b;this.parent=d;this.body=null!=c?c:new a;this.boundFuncs=[];this.body.classBody=!0}v(c,b);c.prototype.children=["variable","parent","body"];c.prototype.defaultClassVariableName="_Class";c.prototype.determineName=function(){var a;if(!this.variable)return this.defaultClassVariableName;var b=this.variable.properties;b=(a=b[b.length-1])?a instanceof qa&&a.name:this.variable.base;if(!(b instanceof x||b instanceof L))return this.defaultClassVariableName;b=
b.value;a||(a=za(b))&&this.variable.error(a);return 0<=S.call(ma,b)?"_"+b:b};c.prototype.setContext=function(a){return this.body.traverseChildren(!1,function(b){if(b.classBody)return!1;if(b instanceof E)return b.value=a;if(b instanceof h&&b.bound)return b.context=a})};c.prototype.addBoundFunctions=function(a){var b;var p=this.boundFuncs;var e=0;for(b=p.length;e<b;e++){var c=p[e];c=(new C(new E,[new qa(c)])).compile(a);this.ctor.body.unshift(new z(c+" \x3d "+Ia("bind",a)+"("+c+", this)"))}};c.prototype.addProperties=
function(a,b,c){var d;var p=a.base.properties.slice(0);var f;for(f=[];d=p.shift();){if(d instanceof y){var t=d.variable.base;delete d.context;var g=d.value;"constructor"===t.value?(this.ctor&&d.error("cannot define more than one constructor in a class"),g.bound&&d.error("cannot define a constructor as a bound function"),g instanceof h?d=this.ctor=g:(this.externalCtor=c.classScope.freeVariable("ctor"),d=new y(new x(this.externalCtor),g))):d.variable["this"]?g["static"]=!0:(a=t.isComplex()?new R(t):
new qa(t),d.variable=new C(new x(b),[new qa(new L("prototype")),a]),g instanceof h&&g.bound&&(this.boundFuncs.push(t),g.bound=!1))}f.push(d)}return fa(f)};c.prototype.walkBody=function(b,d){return this.traverseChildren(!1,function(p){return function(e){var f,t,g;var wa=!0;if(e instanceof c)return!1;if(e instanceof a){var k=f=e.expressions;var h=t=0;for(g=k.length;t<g;h=++t){var m=k[h];m instanceof y&&m.variable.looksStatic(b)?m.value["static"]=!0:m instanceof C&&m.isObject(!0)&&(wa=!1,f[h]=p.addProperties(m,
b,d))}e.expressions=ia(f)}return wa&&!(e instanceof c)}}(this))};c.prototype.hoistDirectivePrologue=function(){var a,b;var c=0;for(a=this.body.expressions;(b=a[c])&&b instanceof n||b instanceof C&&b.isString();)++c;return this.directives=a.splice(0,c)};c.prototype.ensureConstructor=function(a){this.ctor||(this.ctor=new h,this.externalCtor?this.ctor.body.push(new z(this.externalCtor+".apply(this, arguments)")):this.parent&&this.ctor.body.push(new z(a+".__super__.constructor.apply(this, arguments)")),
this.ctor.body.makeReturn(),this.body.expressions.unshift(this.ctor));this.ctor.ctor=this.ctor.name=a;this.ctor.klass=null;return this.ctor.noReturn=!0};c.prototype.compileNode=function(b){var d,c,e;(c=this.body.jumps())&&c.error("Class bodies cannot contain pure statements");(d=this.body.contains(Va))&&d.error("Class bodies shouldn't reference arguments");var p=this.determineName();var f=new x(p);c=new h([],a.wrap([this.body]));d=[];b.classScope=c.makeScope(b.scope);this.hoistDirectivePrologue();
this.setContext(p);this.walkBody(p,b);this.ensureConstructor(p);this.addBoundFunctions(b);this.body.spaced=!0;this.body.expressions.push(f);this.parent&&(p=new x(b.classScope.freeVariable("superClass",{reserve:!1})),this.body.expressions.unshift(new F(f,p)),c.params.push(new K(p)),d.push(this.parent));(e=this.body.expressions).unshift.apply(e,this.directives);e=new P(new ya(c,d));this.variable&&(e=new y(this.variable,e,null,{moduleDeclaration:this.moduleDeclaration}));return e.compileToFragments(b)};
return c}(sa);f.ModuleDeclaration=Z=function(a){function b(a,b){this.clause=a;this.source=b;this.checkSource()}v(b,a);b.prototype.children=["clause","source"];b.prototype.isStatement=ha;b.prototype.jumps=na;b.prototype.makeReturn=na;b.prototype.checkSource=function(){if(null!=this.source&&this.source instanceof A)return this.source.error("the name of the module to be imported from must be an uninterpolated string")};b.prototype.checkScope=function(a,b){if(0!==a.indent.length)return this.error(b+" statements must be at top-level scope")};
return b}(sa);f.ImportDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.compileNode=function(a){var b;this.checkScope(a,"import");a.importedSymbols=[];var c=[];c.push(this.makeCode(this.tab+"import "));null!=this.clause&&c.push.apply(c,this.clause.compileNode(a));null!=(null!=(b=this.source)?b.value:void 0)&&(null!==this.clause&&c.push(this.makeCode(" from ")),c.push(this.makeCode(this.source.value)));c.push(this.makeCode(";"));return c};
return b}(Z);f.ImportClause=function(a){function b(a,b){this.defaultBinding=a;this.namedImports=b}v(b,a);b.prototype.children=["defaultBinding","namedImports"];b.prototype.compileNode=function(a){var b=[];null!=this.defaultBinding&&(b.push.apply(b,this.defaultBinding.compileNode(a)),null!=this.namedImports&&b.push(this.makeCode(", ")));null!=this.namedImports&&b.push.apply(b,this.namedImports.compileNode(a));return b};return b}(sa);f.ExportDeclaration=Z=function(b){function c(){return c.__super__.constructor.apply(this,
arguments)}v(c,b);c.prototype.compileNode=function(b){var d;this.checkScope(b,"export");var c=[];c.push(this.makeCode(this.tab+"export "));this instanceof I&&c.push(this.makeCode("default "));this instanceof I||!(this.clause instanceof y||this.clause instanceof g)||(this.clause instanceof g&&!this.clause.variable&&this.clause.error("anonymous classes cannot be exported"),c.push(this.makeCode("var ")),this.clause.moduleDeclaration="export");c=null!=this.clause.body&&this.clause.body instanceof a?c.concat(this.clause.compileToFragments(b,
N)):c.concat(this.clause.compileNode(b));null!=(null!=(d=this.source)?d.value:void 0)&&c.push(this.makeCode(" from "+this.source.value));c.push(this.makeCode(";"));return c};return c}(Z);f.ExportNamedDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ExportDefaultDeclaration=I=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ExportAllDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,
arguments)}v(b,a);return b}(Z);f.ModuleSpecifierList=Z=function(a){function b(a){this.specifiers=a}v(b,a);b.prototype.children=["specifiers"];b.prototype.compileNode=function(a){var b;var c=[];a.indent+=Ca;var e=this.specifiers;var p=[];var f=0;for(b=e.length;f<b;f++){var g=e[f];p.push(g.compileToFragments(a,ta))}if(0!==this.specifiers.length){c.push(this.makeCode("{\n"+a.indent));f=b=0;for(e=p.length;b<e;f=++b)g=p[f],f&&c.push(this.makeCode(",\n"+a.indent)),c.push.apply(c,g);c.push(this.makeCode("\n}"))}else c.push(this.makeCode("{}"));
return c};return b}(sa);f.ImportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ExportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ModuleSpecifier=l=function(a){function b(a,b,c){this.original=a;this.alias=b;this.moduleDeclarationType=c;this.identifier=null!=this.alias?this.alias.value:this.original.value}v(b,a);b.prototype.children=["original","alias"];b.prototype.compileNode=
function(a){a.scope.find(this.identifier,this.moduleDeclarationType);a=[];a.push(this.makeCode(this.original.value));null!=this.alias&&a.push(this.makeCode(" as "+this.alias.value));return a};return b}(sa);f.ImportSpecifier=Z=function(a){function b(a,d){b.__super__.constructor.call(this,a,d,"import")}v(b,a);b.prototype.compileNode=function(a){var d;(d=this.identifier,0<=S.call(a.importedSymbols,d))||a.scope.check(this.identifier)?this.error("'"+this.identifier+"' has already been declared"):a.importedSymbols.push(this.identifier);
return b.__super__.compileNode.call(this,a)};return b}(l);f.ImportDefaultSpecifier=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ImportNamespaceSpecifier=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Z);f.ExportSpecifier=function(a){function b(a,d){b.__super__.constructor.call(this,a,d,"export")}v(b,a);return b}(l);f.Assign=y=function(a){function b(a,b,c,e){this.variable=a;this.value=b;this.context=
c;null==e&&(e={});this.param=e.param;this.subpattern=e.subpattern;this.operatorToken=e.operatorToken;this.moduleDeclaration=e.moduleDeclaration}v(b,a);b.prototype.children=["variable","value"];b.prototype.isStatement=function(a){return(null!=a?a.level:void 0)===N&&null!=this.context&&(this.moduleDeclaration||0<=S.call(this.context,"?"))};b.prototype.checkAssignability=function(a,b){if(Object.prototype.hasOwnProperty.call(a.scope.positions,b.value)&&"import"===a.scope.variables[a.scope.positions[b.value]].type)return b.error("'"+
b.value+"' is read-only")};b.prototype.assigns=function(a){return this["object"===this.context?"value":"variable"].assigns(a)};b.prototype.unfoldSoak=function(a){return Ba(a,this,"variable")};b.prototype.compileNode=function(a){var b,c,e,p,f,g,k;if(c=this.variable instanceof C){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(a);if(this.variable.isSplice())return this.compileSplice(a);if("||\x3d"===(p=this.context)||"\x26\x26\x3d"===p||"?\x3d"===p)return this.compileConditional(a);
if("**\x3d"===(f=this.context)||"//\x3d"===f||"%%\x3d"===f)return this.compileSpecialMath(a)}this.value instanceof h&&(this.value["static"]?(this.value.klass=this.variable.base,this.value.name=this.variable.properties[0],this.value.variable=this.variable):2<=(null!=(g=this.variable.properties)?g.length:void 0)&&(g=this.variable.properties,p=3<=g.length?M.call(g,0,e=g.length-2):(e=0,[]),f=g[e++],e=g[e++],"prototype"===(null!=(k=f.name)?k.value:void 0)&&(this.value.klass=new C(this.variable.base,p),
this.value.name=e,this.value.variable=this.variable)));this.context||(k=this.variable.unwrapAll(),k.isAssignable()||this.variable.error("'"+this.variable.compile(a)+"' can't be assigned"),"function"===typeof k.hasProperties&&k.hasProperties()||(this.moduleDeclaration?(this.checkAssignability(a,k),a.scope.add(k.value,this.moduleDeclaration)):this.param?a.scope.add(k.value,"var"):(this.checkAssignability(a,k),a.scope.find(k.value))));k=this.value.compileToFragments(a,ta);c&&this.variable.base instanceof
m&&(this.variable.front=!0);c=this.variable.compileToFragments(a,ta);if("object"===this.context){if(b=da(c),0<=S.call(ma,b))c.unshift(this.makeCode('"')),c.push(this.makeCode('"'));return c.concat(this.makeCode(": "),k)}b=c.concat(this.makeCode(" "+(this.context||"\x3d")+" "),k);return a.level<=ta?b:this.wrapInBraces(b)};b.prototype.compilePatternMatch=function(a){var d,c,e;var p=a.level===N;var f=this.value;var g=this.variable.base.objects;if(!(e=g.length)){var t=f.compileToFragments(a);return a.level>=
Fa?this.wrapInBraces(t):t}var h=g[0];1===e&&h instanceof H&&h.error("Destructuring assignment has no target");var m=this.variable.isObject();if(p&&1===e&&!(h instanceof U)){var l=null;if(h instanceof b&&"object"===h.context){t=h;var n=t.variable;var q=n.base;h=t.value;h instanceof b&&(l=h.value,h=h.variable)}else h instanceof b&&(l=h.value,h=h.variable),q=m?h["this"]?h.properties[0].name:new L(h.unwrap().value):new w(0);var r=q.unwrap()instanceof L;f=new C(f);f.properties.push(new (r?qa:R)(q));(c=
za(h.unwrap().value))&&h.error(c);l&&(f=new k("?",f,l));return(new b(h,f,null,{param:this.param})).compileToFragments(a,N)}var v=f.compileToFragments(a,ta);var y=da(v);t=[];n=!1;f.unwrap()instanceof x&&!this.variable.assigns(y)||(t.push([this.makeCode((l=a.scope.freeVariable("ref"))+" \x3d ")].concat(M.call(v))),v=[this.makeCode(l)],y=l);l=f=0;for(d=g.length;f<d;l=++f){h=g[l];q=l;if(!n&&h instanceof U){c=h.name.unwrap().value;h=h.unwrap();q=e+" \x3c\x3d "+y+".length ? "+Ia("slice",a)+".call("+y+", "+
l;if(r=e-l-1){var u=a.scope.freeVariable("i",{single:!0});q+=", "+u+" \x3d "+y+".length - "+r+") : ("+u+" \x3d "+l+", [])"}else q+=") : []";q=new z(q);n=u+"++"}else if(!n&&h instanceof H){if(r=e-l-1)1===r?n=y+".length - 1":(u=a.scope.freeVariable("i",{single:!0}),q=new z(u+" \x3d "+y+".length - "+r),n=u+"++",t.push(q.compileToFragments(a,ta)));continue}else(h instanceof U||h instanceof H)&&h.error("multiple splats/expansions are disallowed in an assignment"),l=null,h instanceof b&&"object"===h.context?
(q=h.variable,q=q.base,h=h.value,h instanceof b&&(l=h.value,h=h.variable)):(h instanceof b&&(l=h.value,h=h.variable),q=m?h["this"]?h.properties[0].name:new L(h.unwrap().value):new z(n||q)),c=h.unwrap().value,r=q.unwrap()instanceof L,q=new C(new z(y),[new (r?qa:R)(q)]),l&&(q=new k("?",q,l));null!=c&&(c=za(c))&&h.error(c);t.push((new b(h,q,null,{param:this.param,subpattern:!0})).compileToFragments(a,ta))}p||this.subpattern||t.push(v);t=this.joinFragmentArrays(t,", ");return a.level<ta?t:this.wrapInBraces(t)};
b.prototype.compileConditional=function(a){var d=this.variable.cacheReference(a);var c=d[0];d=d[1];c.properties.length||!(c.base instanceof z)||c.base instanceof E||a.scope.check(c.base.value)||this.variable.error('the variable "'+c.base.value+"\" can't be assigned with "+this.context+" because it has not been declared before");if(0<=S.call(this.context,"?"))return a.isExistentialEquals=!0,(new J(new B(c),d,{type:"if"})).addElse(new b(d,this.value,"\x3d")).compileToFragments(a);c=(new k(this.context.slice(0,
-1),c,new b(d,this.value,"\x3d"))).compileToFragments(a);return a.level<=ta?c:this.wrapInBraces(c)};b.prototype.compileSpecialMath=function(a){var d=this.variable.cacheReference(a);var c=d[0];d=d[1];return(new b(c,new k(this.context.slice(0,-1),d,this.value))).compileToFragments(a)};b.prototype.compileSplice=function(a){var b=this.variable.properties.pop().range;var c=b.from;var e=b.to;var p=b.exclusive;var f=this.variable.compile(a);if(c){var g=this.cacheToCodeFragments(c.cache(a,Fa));b=g[0];g=g[1]}else b=
g="0";e?null!=c&&c.isNumber()&&e.isNumber()?(e=e.compile(a)-g,p||(e+=1)):(e=e.compile(a,Ga)+" - "+g,p||(e+=" + 1")):e="9e9";p=this.value.cache(a,ta);c=p[0];p=p[1];e=[].concat(this.makeCode("[].splice.apply("+f+", ["+b+", "+e+"].concat("),c,this.makeCode(")), "),p);return a.level>N?this.wrapInBraces(e):e};return b}(sa);f.Code=h=function(b){function c(b,d,c){this.params=b||[];this.body=d||new a;this.bound="boundfunc"===c;this.isGenerator=!!this.body.contains(function(a){return a instanceof k&&a.isYield()||
a instanceof T})}v(c,b);c.prototype.children=["params","body"];c.prototype.isStatement=function(){return!!this.ctor};c.prototype.jumps=ka;c.prototype.makeScope=function(a){return new xa(a,this.body,this)};c.prototype.compileNode=function(b){var d,f,e,g;this.bound&&null!=(d=b.scope.method)&&d.bound&&(this.context=b.scope.method.context);if(this.bound&&!this.context)return this.context="_this",d=new c([new K(new x(this.context))],new a([this])),d=new ya(d,[new E]),d.updateLocationDataIfMissing(this.locationData),
d.compileNode(b);b.scope=la(b,"classScope")||this.makeScope(b.scope);b.scope.shared=la(b,"sharedScope");b.indent+=Ca;delete b.bare;delete b.isExistentialEquals;d=[];var p=[];var h=this.params;var t=0;for(e=h.length;t<e;t++){var l=h[t];l instanceof H||b.scope.parameter(l.asReference(b))}h=this.params;t=0;for(e=h.length;t<e;t++)if(l=h[t],l.splat||l instanceof H){t=this.params;var m=0;for(l=t.length;m<l;m++){var n=t[m];n instanceof H||!n.name.value||b.scope.add(n.name.value,"var",!0)}m=new y(new C(new q(function(){var a;
var d=this.params;var e=[];var c=0;for(a=d.length;c<a;c++)n=d[c],e.push(n.asReference(b));return e}.call(this))),new C(new x("arguments")));break}var w=this.params;h=0;for(t=w.length;h<t;h++){l=w[h];if(l.isComplex()){var r=g=l.asReference(b);l.value&&(r=new k("?",g,l.value));p.push(new y(new C(l.name),r,"\x3d",{param:!0}))}else g=l,l.value&&(e=new z(g.name.value+" \x3d\x3d null"),r=new y(new C(l.name),l.value,"\x3d"),p.push(new J(e,r)));m||d.push(g)}l=this.body.isEmpty();m&&p.unshift(m);p.length&&
(f=this.body.expressions).unshift.apply(f,p);f=m=0;for(p=d.length;m<p;f=++m)n=d[f],d[f]=n.compileToFragments(b),b.scope.parameter(da(d[f]));var v=[];this.eachParamName(function(a,b){0<=S.call(v,a)&&b.error("multiple parameters named "+a);return v.push(a)});l||this.noReturn||this.body.makeReturn();f="function";this.isGenerator&&(f+="*");this.ctor&&(f+=" "+this.name);p=[this.makeCode(f+"(")];f=l=0;for(m=d.length;l<m;f=++l)n=d[f],f&&p.push(this.makeCode(", ")),p.push.apply(p,n);p.push(this.makeCode(") {"));
this.body.isEmpty()||(p=p.concat(this.makeCode("\n"),this.body.compileWithDeclarations(b),this.makeCode("\n"+this.tab)));p.push(this.makeCode("}"));return this.ctor?[this.makeCode(this.tab)].concat(M.call(p)):this.front||b.level>=Ga?this.wrapInBraces(p):p};c.prototype.eachParamName=function(a){var b;var c=this.params;var e=[];var f=0;for(b=c.length;f<b;f++){var p=c[f];e.push(p.eachName(a))}return e};c.prototype.traverseChildren=function(a,b){if(a)return c.__super__.traverseChildren.call(this,a,b)};
return c}(sa);f.Param=K=function(a){function b(a,b,c){this.name=a;this.value=b;this.splat=c;(a=za(this.name.unwrapAll().value))&&this.name.error(a);this.name instanceof m&&this.name.generated&&(a=this.name.objects[0].operatorToken,a.error("unexpected "+a.value))}v(b,a);b.prototype.children=["name","value"];b.prototype.compileToFragments=function(a){return this.name.compileToFragments(a,ta)};b.prototype.asReference=function(a){if(this.reference)return this.reference;var b=this.name;b["this"]?(b=b.properties[0].name.value,
0<=S.call(ma,b)&&(b="_"+b),b=new x(a.scope.freeVariable(b))):b.isComplex()&&(b=new x(a.scope.freeVariable("arg")));b=new C(b);this.splat&&(b=new U(b));b.updateLocationDataIfMissing(this.locationData);return this.reference=b};b.prototype.isComplex=function(){return this.name.isComplex()};b.prototype.eachName=function(a,b){var d,e;null==b&&(b=this.name);var c=function(b){return a("@"+b.properties[0].name.value,b)};if(b instanceof z)return a(b.value,b);if(b instanceof C)return c(b);b=null!=(d=b.objects)?
d:[];d=0;for(e=b.length;d<e;d++){var f=b[d];f instanceof y&&null==f.context&&(f=f.variable);f instanceof y?(f.value instanceof y&&(f=f.value),this.eachName(a,f.value.unwrap())):f instanceof U?(f=f.name.unwrap(),a(f.value,f)):f instanceof C?f.isArray()||f.isObject()?this.eachName(a,f.base):f["this"]?c(f):a(f.base.value,f.base):f instanceof H||f.error("illegal parameter "+f.compile())}};return b}(sa);f.Splat=U=function(a){function b(a){this.name=a.compile?a:new z(a)}v(b,a);b.prototype.children=["name"];
b.prototype.isAssignable=ha;b.prototype.assigns=function(a){return this.name.assigns(a)};b.prototype.compileToFragments=function(a){return this.name.compileToFragments(a)};b.prototype.unwrap=function(){return this.name};b.compileSplattedArray=function(a,d,c){var e,f,g,p;for(f=-1;(e=d[++f])&&!(e instanceof b););if(f>=d.length)return[];if(1===d.length)return e=d[0],d=e.compileToFragments(a,ta),c?d:[].concat(e.makeCode(Ia("slice",a)+".call("),d,e.makeCode(")"));c=d.slice(f);var h=g=0;for(p=c.length;g<
p;h=++g){e=c[h];var k=e.compileToFragments(a,ta);c[h]=e instanceof b?[].concat(e.makeCode(Ia("slice",a)+".call("),k,e.makeCode(")")):[].concat(e.makeCode("["),k,e.makeCode("]"))}if(0===f)return e=d[0],a=e.joinFragmentArrays(c.slice(1),", "),c[0].concat(e.makeCode(".concat("),a,e.makeCode(")"));g=d.slice(0,f);p=[];k=0;for(h=g.length;k<h;k++)e=g[k],p.push(e.compileToFragments(a,ta));e=d[0].joinFragmentArrays(p,", ");a=d[f].joinFragmentArrays(c,", ");c=d[d.length-1];return[].concat(d[0].makeCode("["),
e,d[f].makeCode("].concat("),a,c.makeCode(")"))};return b}(sa);f.Expansion=H=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isComplex=ka;b.prototype.compileNode=function(a){return this.error("Expansion must be used inside a destructuring assignment or parameter list")};b.prototype.asReference=function(a){return this};b.prototype.eachName=function(a){};return b}(sa);f.While=Z=function(b){function c(a,b){this.condition=null!=b&&b.invert?a.invert():a;
this.guard=null!=b?b.guard:void 0}v(c,b);c.prototype.children=["condition","guard","body"];c.prototype.isStatement=ha;c.prototype.makeReturn=function(a){if(a)return c.__super__.makeReturn.apply(this,arguments);this.returns=!this.jumps({loop:!0});return this};c.prototype.addBody=function(a){this.body=a;return this};c.prototype.jumps=function(){var a;var b=this.body.expressions;if(!b.length)return!1;var c=0;for(a=b.length;c<a;c++){var e=b[c];if(e=e.jumps({loop:!0}))return e}return!1};c.prototype.compileNode=
function(b){var d;b.indent+=Ca;var c="";var e=this.body;e.isEmpty()?e=this.makeCode(""):(this.returns&&(e.makeReturn(d=b.scope.freeVariable("results")),c=""+this.tab+d+" \x3d [];\n"),this.guard&&(1<e.expressions.length?e.expressions.unshift(new J((new P(this.guard)).invert(),new W("continue"))):this.guard&&(e=a.wrap([new J(this.guard,e)]))),e=[].concat(this.makeCode("\n"),e.compileToFragments(b,N),this.makeCode("\n"+this.tab)));b=[].concat(this.makeCode(c+this.tab+"while ("),this.condition.compileToFragments(b,
Ka),this.makeCode(") {"),e,this.makeCode("}"));this.returns&&b.push(this.makeCode("\n"+this.tab+"return "+d+";"));return b};return c}(sa);f.Op=k=function(a){function b(a,b,d,f){if("in"===a)return new O(b,d);if("do"===a)return this.generateDo(b);if("new"===a){if(b instanceof ya&&!b["do"]&&!b.isNew)return b.newInstance();if(b instanceof h&&b.bound||b["do"])b=new P(b)}this.operator=c[a]||a;this.first=b;this.second=d;this.flip=!!f;return this}v(b,a);var c={"\x3d\x3d":"\x3d\x3d\x3d","!\x3d":"!\x3d\x3d",
of:"in",yieldfrom:"yield*"};var d={"!\x3d\x3d":"\x3d\x3d\x3d","\x3d\x3d\x3d":"!\x3d\x3d"};b.prototype.children=["first","second"];b.prototype.isNumber=function(){var a;return this.isUnary()&&("+"===(a=this.operator)||"-"===a)&&this.first instanceof C&&this.first.isNumber()};b.prototype.isYield=function(){var a;return"yield"===(a=this.operator)||"yield*"===a};b.prototype.isUnary=function(){return!this.second};b.prototype.isComplex=function(){return!this.isNumber()};b.prototype.isChainable=function(){var a;
return"\x3c"===(a=this.operator)||"\x3e"===a||"\x3e\x3d"===a||"\x3c\x3d"===a||"\x3d\x3d\x3d"===a||"!\x3d\x3d"===a};b.prototype.invert=function(){var a,e;if(this.isChainable()&&this.first.isChainable()){var c=!0;for(a=this;a&&a.operator;)c&&(c=a.operator in d),a=a.first;if(!c)return(new P(this)).invert();for(a=this;a&&a.operator;)a.invert=!a.invert,a.operator=d[a.operator],a=a.first;return this}return(a=d[this.operator])?(this.operator=a,this.first.unwrap()instanceof b&&this.first.invert(),this):this.second?
(new P(this)).invert():"!"===this.operator&&(c=this.first.unwrap())instanceof b&&("!"===(e=c.operator)||"in"===e||"instanceof"===e)?c:new b("!",this)};b.prototype.unfoldSoak=function(a){var b;return("++"===(b=this.operator)||"--"===b||"delete"===b)&&Ba(a,this,"first")};b.prototype.generateDo=function(a){var b,d;var c=[];var f=(a instanceof y&&(b=a.value.unwrap())instanceof h?b:a).params||[];b=0;for(d=f.length;b<d;b++){var g=f[b];g.value?(c.push(g.value),delete g.value):c.push(g)}a=new ya(a,c);a["do"]=
!0;return a};b.prototype.compileNode=function(a){var b;var d=this.isChainable()&&this.first.isChainable();d||(this.first.front=this.front);"delete"===this.operator&&a.scope.check(this.first.unwrapAll().value)&&this.error("delete operand may not be argument or var");("--"===(b=this.operator)||"++"===b)&&(b=za(this.first.unwrapAll().value))&&this.first.error(b);if(this.isYield())return this.compileYield(a);if(this.isUnary())return this.compileUnary(a);if(d)return this.compileChain(a);switch(this.operator){case "?":return this.compileExistence(a);
case "**":return this.compilePower(a);case "//":return this.compileFloorDivision(a);case "%%":return this.compileModulo(a);default:return d=this.first.compileToFragments(a,Fa),b=this.second.compileToFragments(a,Fa),d=[].concat(d,this.makeCode(" "+this.operator+" "),b),a.level<=Fa?d:this.wrapInBraces(d)}};b.prototype.compileChain=function(a){var b=this.first.second.cache(a);this.first.second=b[0];b=b[1];a=this.first.compileToFragments(a,Fa).concat(this.makeCode(" "+(this.invert?"\x26\x26":"||")+" "),
b.compileToFragments(a),this.makeCode(" "+this.operator+" "),this.second.compileToFragments(a,Fa));return this.wrapInBraces(a)};b.prototype.compileExistence=function(a){if(this.first.isComplex()){var b=new x(a.scope.freeVariable("ref"));var d=new P(new y(b,this.first))}else b=d=this.first;return(new J(new B(d),b,{type:"if"})).addElse(this.second).compileToFragments(a)};b.prototype.compileUnary=function(a){var d=[];var c=this.operator;d.push([this.makeCode(c)]);if("!"===c&&this.first instanceof B)return this.first.negated=
!this.first.negated,this.first.compileToFragments(a);if(a.level>=Ga)return(new P(this)).compileToFragments(a);var f="+"===c||"-"===c;("new"===c||"typeof"===c||"delete"===c||f&&this.first instanceof b&&this.first.operator===c)&&d.push([this.makeCode(" ")]);if(f&&this.first instanceof b||"new"===c&&this.first.isStatement(a))this.first=new P(this.first);d.push(this.first.compileToFragments(a,Fa));this.flip&&d.reverse();return this.joinFragmentArrays(d,"")};b.prototype.compileYield=function(a){var b;
var d=[];var c=this.operator;null==a.scope.parent&&this.error("yield can only occur inside functions");0<=S.call(Object.keys(this.first),"expression")&&!(this.first instanceof ba)?null!=this.first.expression&&d.push(this.first.expression.compileToFragments(a,Fa)):(a.level>=Ka&&d.push([this.makeCode("(")]),d.push([this.makeCode(c)]),""!==(null!=(b=this.first.base)?b.value:void 0)&&d.push([this.makeCode(" ")]),d.push(this.first.compileToFragments(a,Fa)),a.level>=Ka&&d.push([this.makeCode(")")]));return this.joinFragmentArrays(d,
"")};b.prototype.compilePower=function(a){var b=new C(new x("Math"),[new qa(new L("pow"))]);return(new ya(b,[this.first,this.second])).compileToFragments(a)};b.prototype.compileFloorDivision=function(a){var d=new C(new x("Math"),[new qa(new L("floor"))]);var c=this.second.isComplex()?new P(this.second):this.second;c=new b("/",this.first,c);return(new ya(d,[c])).compileToFragments(a)};b.prototype.compileModulo=function(a){var b=new C(new z(Ia("modulo",a)));return(new ya(b,[this.first,this.second])).compileToFragments(a)};
b.prototype.toString=function(a){return b.__super__.toString.call(this,a,this.constructor.name+" "+this.operator)};return b}(sa);f.In=O=function(a){function b(a,b){this.object=a;this.array=b}v(b,a);b.prototype.children=["object","array"];b.prototype.invert=ra;b.prototype.compileNode=function(a){var b;if(this.array instanceof C&&this.array.isArray()&&this.array.base.objects.length){var c=this.array.base.objects;var e=0;for(b=c.length;e<b;e++){var f=c[e];if(f instanceof U){var g=!0;break}}if(!g)return this.compileOrTest(a)}return this.compileLoopTest(a)};
b.prototype.compileOrTest=function(a){var b,c;var e=this.object.cache(a,Fa);var f=e[0];var g=e[1];var h=this.negated?[" !\x3d\x3d "," \x26\x26 "]:[" \x3d\x3d\x3d "," || "];e=h[0];h=h[1];var p=[];var k=this.array.base.objects;var l=b=0;for(c=k.length;b<c;l=++b){var m=k[l];l&&p.push(this.makeCode(h));p=p.concat(l?g:f,this.makeCode(e),m.compileToFragments(a,Ga))}return a.level<Fa?p:this.wrapInBraces(p)};b.prototype.compileLoopTest=function(a){var b=this.object.cache(a,ta);var c=b[0];var e=b[1];b=[].concat(this.makeCode(Ia("indexOf",
a)+".call("),this.array.compileToFragments(a,ta),this.makeCode(", "),e,this.makeCode(") "+(this.negated?"\x3c 0":"\x3e\x3d 0")));if(da(c)===da(e))return b;b=c.concat(this.makeCode(", "),b);return a.level<ta?b:this.wrapInBraces(b)};b.prototype.toString=function(a){return b.__super__.toString.call(this,a,this.constructor.name+(this.negated?"!":""))};return b}(sa);f.Try=function(a){function b(a,b,c,e){this.attempt=a;this.errorVariable=b;this.recovery=c;this.ensure=e}v(b,a);b.prototype.children=["attempt",
"recovery","ensure"];b.prototype.isStatement=ha;b.prototype.jumps=function(a){var b;return this.attempt.jumps(a)||(null!=(b=this.recovery)?b.jumps(a):void 0)};b.prototype.makeReturn=function(a){this.attempt&&(this.attempt=this.attempt.makeReturn(a));this.recovery&&(this.recovery=this.recovery.makeReturn(a));return this};b.prototype.compileNode=function(a){var b,c,e;a.indent+=Ca;var f=this.attempt.compileToFragments(a,N);var g=this.recovery?(b=a.scope.freeVariable("error",{reserve:!1}),e=new x(b),
this.errorVariable?(c=za(this.errorVariable.unwrapAll().value),c?this.errorVariable.error(c):void 0,this.recovery.unshift(new y(this.errorVariable,e))):void 0,[].concat(this.makeCode(" catch ("),e.compileToFragments(a),this.makeCode(") {\n"),this.recovery.compileToFragments(a,N),this.makeCode("\n"+this.tab+"}"))):this.ensure||this.recovery?[]:(b=a.scope.freeVariable("error",{reserve:!1}),[this.makeCode(" catch ("+b+") {}")]);a=this.ensure?[].concat(this.makeCode(" finally {\n"),this.ensure.compileToFragments(a,
N),this.makeCode("\n"+this.tab+"}")):[];return[].concat(this.makeCode(this.tab+"try {\n"),f,this.makeCode("\n"+this.tab+"}"),g,a)};return b}(sa);f.Throw=ba=function(a){function b(a){this.expression=a}v(b,a);b.prototype.children=["expression"];b.prototype.isStatement=ha;b.prototype.jumps=ka;b.prototype.makeReturn=na;b.prototype.compileNode=function(a){return[].concat(this.makeCode(this.tab+"throw "),this.expression.compileToFragments(a),this.makeCode(";"))};return b}(sa);f.Existence=B=function(a){function b(a){this.expression=
a}v(b,a);b.prototype.children=["expression"];b.prototype.invert=ra;b.prototype.compileNode=function(a){this.expression.front=this.front;var b=this.expression.compile(a,Fa);if(this.expression.unwrap()instanceof x&&!a.scope.check(b)){var c=this.negated?["\x3d\x3d\x3d","||"]:["!\x3d\x3d","\x26\x26"];var e=c[0];c=c[1];b="typeof "+b+" "+e+' "undefined" '+c+" "+b+" "+e+" null"}else b=b+" "+(this.negated?"\x3d\x3d":"!\x3d")+" null";return[this.makeCode(a.level<=Na?b:"("+b+")")]};return b}(sa);f.Parens=P=
function(a){function b(a){this.body=a}v(b,a);b.prototype.children=["body"];b.prototype.unwrap=function(){return this.body};b.prototype.isComplex=function(){return this.body.isComplex()};b.prototype.compileNode=function(a){var b=this.body.unwrap();if(b instanceof C&&b.isAtomic())return b.front=this.front,b.compileToFragments(a);var c=b.compileToFragments(a,Ka);return a.level<Fa&&(b instanceof k||b instanceof ya||b instanceof Q&&b.returns)&&(a.level<Na||3>=c.length)?c:this.wrapInBraces(c)};return b}(sa);
f.StringWithInterpolations=A=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.compileNode=function(a){var d;if(!a.inTaggedTemplateCall)return b.__super__.compileNode.apply(this,arguments);var c=this.body.unwrap();var e=[];c.traverseChildren(!1,function(a){if(a instanceof D)e.push(a);else if(a instanceof P)return e.push(a),!1;return!0});c=[];c.push(this.makeCode("`"));var f=0;for(d=e.length;f<d;f++){var g=e[f];g instanceof D?(g=g.value.slice(1,-1),g=
g.replace(/(\\*)(`|\$\{)/g,function(a,b,d){return 0===b.length%2?b+"\\"+d:a}),c.push(this.makeCode(g))):(c.push(this.makeCode("${")),c.push.apply(c,g.compileToFragments(a,Ka)),c.push(this.makeCode("}")))}c.push(this.makeCode("`"));return c};return b}(P);f.For=Q=function(b){function c(b,d){this.source=d.source;this.guard=d.guard;this.step=d.step;this.name=d.name;this.index=d.index;this.body=a.wrap([b]);this.own=!!d.own;this.object=!!d.object;(this.from=!!d.from)&&this.index&&this.index.error("cannot use index with for-from");
this.own&&!this.object&&d.ownTag.error("cannot use own with for-"+(this.from?"from":"in"));this.object&&(b=[this.index,this.name],this.name=b[0],this.index=b[1]);this.index instanceof C&&!this.index.isAssignable()&&this.index.error("index cannot be a pattern matching expression");this.range=this.source instanceof C&&this.source.base instanceof V&&!this.source.properties.length&&!this.from;this.pattern=this.name instanceof C;this.range&&this.index&&this.index.error("indexes do not apply to range loops");
this.range&&this.pattern&&this.name.error("cannot pattern match over range loops");this.returns=!1}v(c,b);c.prototype.children=["body","source","guard","step"];c.prototype.compileNode=function(b){var d,c,e,f,g,h,k;var l=a.wrap([this.body]);var p=l.expressions;p=p[p.length-1];(null!=p?p.jumps():void 0)instanceof G&&(this.returns=!1);var m=this.range?this.source.base:this.source;var n=b.scope;this.pattern||(e=this.name&&this.name.compile(b,ta));p=this.index&&this.index.compile(b,ta);e&&!this.pattern&&
n.find(e);!p||this.index instanceof C||n.find(p);this.returns&&(c=n.freeVariable("results"));this.from?this.pattern&&(f=n.freeVariable("x",{single:!0})):f=this.object&&p||n.freeVariable("i",{single:!0});var q=(this.range||this.from)&&e||p||f;var t=q!==f?q+" \x3d ":"";if(this.step&&!this.range){p=this.cacheToCodeFragments(this.step.cache(b,ta,Ya));var w=p[0];var r=p[1];this.step.isNumber()&&(h=Number(r))}this.pattern&&(e=f);var v=p=k="";var u=this.tab+Ca;if(this.range)var K=m.compileToFragments(ja(b,
{index:f,name:e,step:this.step,isComplex:Ya}));else{var A=this.source.compile(b,ta);!e&&!this.own||this.source.unwrap()instanceof x||(v+=""+this.tab+(m=n.freeVariable("ref"))+" \x3d "+A+";\n",A=m);!e||this.pattern||this.from||(g=e+" \x3d "+A+"["+q+"]");this.object||this.from||(w!==r&&(v+=""+this.tab+w+";\n"),e=0>h,this.step&&null!=h&&e||(d=n.freeVariable("len")),K=""+t+f+" \x3d 0, "+d+" \x3d "+A+".length",w=""+t+f+" \x3d "+A+".length - 1",d=f+" \x3c "+d,n=f+" \x3e\x3d 0",this.step?(null!=h?e&&(d=
n,K=w):(d=r+" \x3e 0 ? "+d+" : "+n,K="("+r+" \x3e 0 ? ("+K+") : "+w+")"),f=f+" +\x3d "+r):f=""+(q!==f?"++"+f:f+"++"),K=[this.makeCode(K+"; "+d+"; "+t+f)])}if(this.returns){var B=""+this.tab+c+" \x3d [];\n";var V="\n"+this.tab+"return "+c+";";l.makeReturn(c)}this.guard&&(1<l.expressions.length?l.expressions.unshift(new J((new P(this.guard)).invert(),new W("continue"))):this.guard&&(l=a.wrap([new J(this.guard,l)])));this.pattern&&l.expressions.unshift(new y(this.name,this.from?new x(q):new z(A+"["+
q+"]")));c=[].concat(this.makeCode(v),this.pluckDirectCall(b,l));g&&(k="\n"+u+g+";");this.object?(K=[this.makeCode(q+" in "+A)],this.own&&(p="\n"+u+"if (!"+Ia("hasProp",b)+".call("+A+", "+q+")) continue;")):this.from&&(K=[this.makeCode(q+" of "+A)]);(b=l.compileToFragments(ja(b,{indent:u}),N))&&0<b.length&&(b=[].concat(this.makeCode("\n"),b,this.makeCode("\n")));return[].concat(c,this.makeCode(""+(B||"")+this.tab+"for ("),K,this.makeCode(") {"+p+k),b,this.makeCode(this.tab+"}"+(V||"")))};c.prototype.pluckDirectCall=
function(a,b){var d,c,f,g,k,l,p;var m=[];var n=b.expressions;var q=d=0;for(c=n.length;d<c;q=++d){var w=n[q];w=w.unwrapAll();if(w instanceof ya){var t=null!=(f=w.variable)?f.unwrapAll():void 0;if(t instanceof h||t instanceof C&&(null!=(g=t.base)?g.unwrapAll():void 0)instanceof h&&1===t.properties.length&&("call"===(k=null!=(l=t.properties[0].name)?l.value:void 0)||"apply"===k)){var r=(null!=(p=t.base)?p.unwrapAll():void 0)||t;var v=new x(a.scope.freeVariable("fn"));var u=new C(v);t.base&&(u=[u,t],
t.base=u[0],u=u[1]);b.expressions[q]=new ya(u,w.args);m=m.concat(this.makeCode(this.tab),(new y(v,r)).compileToFragments(a,N),this.makeCode(";\n"))}}}return m};return c}(Z);f.Switch=function(b){function c(a,b,c){this.subject=a;this.cases=b;this.otherwise=c}v(c,b);c.prototype.children=["subject","cases","otherwise"];c.prototype.isStatement=ha;c.prototype.jumps=function(a){var b,c;null==a&&(a={block:!0});var e=this.cases;var f=0;for(b=e.length;f<b;f++){var g=e[f];g=g[1];if(g=g.jumps(a))return g}return null!=
(c=this.otherwise)?c.jumps(a):void 0};c.prototype.makeReturn=function(b){var c,f;var e=this.cases;var g=0;for(c=e.length;g<c;g++){var h=e[g];h[1].makeReturn(b)}b&&(this.otherwise||(this.otherwise=new a([new z("void 0")])));null!=(f=this.otherwise)&&f.makeReturn(b);return this};c.prototype.compileNode=function(a){var b,c,e,f;var g=a.indent+Ca;var h=a.indent=g+Ca;var k=[].concat(this.makeCode(this.tab+"switch ("),this.subject?this.subject.compileToFragments(a,Ka):this.makeCode("false"),this.makeCode(") {\n"));
var l=this.cases;var m=c=0;for(e=l.length;c<e;m=++c){var p=l[m];var n=p[0];p=p[1];var q=ia([n]);n=0;for(f=q.length;n<f;n++){var w=q[n];this.subject||(w=w.invert());k=k.concat(this.makeCode(g+"case "),w.compileToFragments(a,Ka),this.makeCode(":\n"))}0<(b=p.compileToFragments(a,N)).length&&(k=k.concat(b,this.makeCode("\n")));if(m===this.cases.length-1&&!this.otherwise)break;m=this.lastNonComment(p.expressions);m instanceof G||m instanceof z&&m.jumps()&&"debugger"!==m.value||k.push(w.makeCode(h+"break;\n"))}this.otherwise&&
this.otherwise.expressions.length&&k.push.apply(k,[this.makeCode(g+"default:\n")].concat(M.call(this.otherwise.compileToFragments(a,N)),[this.makeCode("\n")]));k.push(this.makeCode(this.tab+"}"));return k};return c}(sa);f.If=J=function(b){function c(a,b,c){this.body=b;null==c&&(c={});this.condition="unless"===c.type?a.invert():a;this.elseBody=null;this.isChain=!1;this.soak=c.soak}v(c,b);c.prototype.children=["condition","body","elseBody"];c.prototype.bodyNode=function(){var a;return null!=(a=this.body)?
a.unwrap():void 0};c.prototype.elseBodyNode=function(){var a;return null!=(a=this.elseBody)?a.unwrap():void 0};c.prototype.addElse=function(a){this.isChain?this.elseBodyNode().addElse(a):(this.isChain=a instanceof c,this.elseBody=this.ensureBlock(a),this.elseBody.updateLocationDataIfMissing(a.locationData));return this};c.prototype.isStatement=function(a){var b;return(null!=a?a.level:void 0)===N||this.bodyNode().isStatement(a)||(null!=(b=this.elseBodyNode())?b.isStatement(a):void 0)};c.prototype.jumps=
function(a){var b;return this.body.jumps(a)||(null!=(b=this.elseBody)?b.jumps(a):void 0)};c.prototype.compileNode=function(a){return this.isStatement(a)?this.compileStatement(a):this.compileExpression(a)};c.prototype.makeReturn=function(b){b&&(this.elseBody||(this.elseBody=new a([new z("void 0")])));this.body&&(this.body=new a([this.body.makeReturn(b)]));this.elseBody&&(this.elseBody=new a([this.elseBody.makeReturn(b)]));return this};c.prototype.ensureBlock=function(b){return b instanceof a?b:new a([b])};
c.prototype.compileStatement=function(a){var b=la(a,"chainChild");if(la(a,"isExistentialEquals"))return(new c(this.condition.invert(),this.elseBodyNode(),{type:"if"})).compileToFragments(a);var f=a.indent+Ca;var e=this.condition.compileToFragments(a,Ka);var g=this.ensureBlock(this.body).compileToFragments(ja(a,{indent:f}));g=[].concat(this.makeCode("if ("),e,this.makeCode(") {\n"),g,this.makeCode("\n"+this.tab+"}"));b||g.unshift(this.makeCode(this.tab));if(!this.elseBody)return g;b=g.concat(this.makeCode(" else "));
this.isChain?(a.chainChild=!0,b=b.concat(this.elseBody.unwrap().compileToFragments(a,N))):b=b.concat(this.makeCode("{\n"),this.elseBody.compileToFragments(ja(a,{indent:f}),N),this.makeCode("\n"+this.tab+"}"));return b};c.prototype.compileExpression=function(a){var b=this.condition.compileToFragments(a,Na);var c=this.bodyNode().compileToFragments(a,ta);var e=this.elseBodyNode()?this.elseBodyNode().compileToFragments(a,ta):[this.makeCode("void 0")];e=b.concat(this.makeCode(" ? "),c,this.makeCode(" : "),
e);return a.level>=Na?this.wrapInBraces(e):e};c.prototype.unfoldSoak=function(){return this.soak&&this};return c}(sa);var gc={extend:function(a){return"function(child, parent) { for (var key in parent) { if ("+Ia("hasProp",a)+".call(parent, key)) child[key] \x3d parent[key]; } function ctor() { this.constructor \x3d child; } ctor.prototype \x3d parent.prototype; child.prototype \x3d new ctor(); child.__super__ \x3d parent.prototype; return child; }"},bind:function(){return"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }"},
indexOf:function(){return"[].indexOf || function(item) { for (var i \x3d 0, l \x3d this.length; i \x3c l; i++) { if (i in this \x26\x26 this[i] \x3d\x3d\x3d item) return i; } return -1; }"},modulo:function(){return"function(a, b) { return (+a % (b \x3d +b) + b) % b; }"},hasProp:function(){return"{}.hasOwnProperty"},slice:function(){return"[].slice"}};var N=1;var Ka=2;var ta=3;var Na=4;var Fa=5;var Ga=6;var Ca=" ";var Pa=/^[+-]?\d+$/;var Ia=function(a,b){var c=b.scope.root;if(a in c.utilities)return c.utilities[a];
var d=c.freeVariable(a);c.assign(d,gc[a](b));return c.utilities[a]=d};var Ea=function(a,b){a=a.replace(/\n/g,"$\x26"+b);return a.replace(/\s+$/,"")};var Va=function(a){return a instanceof x&&"arguments"===a.value};var ea=function(a){return a instanceof E||a instanceof h&&a.bound||a instanceof va};var Ya=function(a){return a.isComplex()||("function"===typeof a.isAssignable?a.isAssignable():void 0)};var Ba=function(a,b,c){if(a=b[c].unfoldSoak(a))return b[c]=a.body,a.body=new C(b),a}}).call(this);return f}();
u["./sourcemap"]=function(){var f={};(function(){var u=function(){function f(f){this.line=f;this.columns=[]}f.prototype.add=function(f,a,b){var q=a[0];a=a[1];null==b&&(b={});if(!this.columns[f]||!b.noReplace)return this.columns[f]={line:this.line,column:f,sourceLine:q,sourceColumn:a}};f.prototype.sourceLocation=function(f){for(var a;!((a=this.columns[f])||0>=f);)f--;return a&&[a.sourceLine,a.sourceColumn]};return f}();f=function(){function f(){this.lines=[]}f.prototype.add=function(f,a,b){var q;null==
b&&(b={});var g=a[0];a=a[1];return((q=this.lines)[g]||(q[g]=new u(g))).add(a,f,b)};f.prototype.sourceLocation=function(f){var a;var b=f[0];for(f=f[1];!((a=this.lines[b])||0>=b);)b--;return a&&a.sourceLocation(f)};f.prototype.generate=function(f,a){var b,q,g,h,r,n,u;null==f&&(f={});null==a&&(a=null);var y=g=q=u=0;var I=!1;var F="";var Q=this.lines;var x=b=0;for(h=Q.length;b<h;x=++b)if(x=Q[x]){var J=x.columns;x=0;for(r=J.length;x<r;x++)if(n=J[x]){for(;u<n.line;)q=0,I=!1,F+=";",u++;I&&(F+=",");F+=this.encodeVlq(n.column-
q);q=n.column;F+=this.encodeVlq(0);F+=this.encodeVlq(n.sourceLine-g);g=n.sourceLine;F+=this.encodeVlq(n.sourceColumn-y);y=n.sourceColumn;I=!0}}F={version:3,file:f.generatedFile||"",sourceRoot:f.sourceRoot||"",sources:f.sourceFiles||[""],names:[],mappings:F};f.inlineMap&&(F.sourcesContent=[a]);return F};f.prototype.encodeVlq=function(f){var a;var b="";for(a=(Math.abs(f)<<1)+(0>f?1:0);a||!b;)f=a&31,(a>>=5)&&(f|=32),b+=this.encodeBase64(f);return b};f.prototype.encodeBase64=function(f){var a;if(!(a=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f]))throw Error("Cannot Base64 encode value: "+f);return a};return f}()}).call(this);return f}();u["./coffee-script"]=function(){var f={};(function(){var qa,q,y={}.hasOwnProperty;var a=u("fs");var b=u("vm");var ya=u("path");var g=u("./lexer").Lexer;var h=u("./parser").parser;var r=u("./helpers");var n=u("./sourcemap");var B=u("../../package.json");f.VERSION=B.version;f.FILE_EXTENSIONS=[".coffee",".litcoffee",".coffee.md"];f.helpers=
r;var H=function(a){switch(!1){case "function"!==typeof Buffer:return(new Buffer(a)).toString("base64");case "function"!==typeof btoa:return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)}));default:throw Error("Unable to base64 encode inline sourcemap.");}};B=function(a){return function(b,f){null==f&&(f={});try{return a.call(this,b,f)}catch(m){if("string"!==typeof b)throw m;throw r.updateSyntaxError(m,b,f.filename);}}};var I={};var F={};f.compile=
qa=B(function(a,b){var c,f,g,l;var q=r.extend;b=q({},b);var u=b.sourceMap||b.inlineMap||null==b.filename;q=b.filename||"\x3canonymous\x3e";I[q]=a;u&&(g=new n);var x=O.tokenize(a,b);var y=b;var G=[];var z=0;for(c=x.length;z<c;z++){var B=x[z];"IDENTIFIER"===B[0]&&G.push(B[1])}y.referencedVars=G;if(null==b.bare||!0!==b.bare)for(y=0,z=x.length;y<z;y++)if(B=x[y],"IMPORT"===(f=B[0])||"EXPORT"===f){b.bare=!0;break}z=h.parse(x).compileToFragments(b);x=0;b.header&&(x+=1);b.shiftLine&&(x+=1);B=0;f="";c=0;for(G=
z.length;c<G;c++){y=z[c];if(u){y.locationData&&!/^[;\s]*$/.test(y.code)&&g.add([y.locationData.first_line,y.locationData.first_column],[x,B],{noReplace:!0});var J=r.count(y.code,"\n");x+=J;B=J?y.code.length-(y.code.lastIndexOf("\n")+1):B+y.code.length}f+=y.code}b.header&&(B="Generated by CoffeeScript "+this.VERSION,f="// "+B+"\n"+f);if(u){var D=g.generate(b,a);F[q]=g}b.inlineMap&&(a=H(JSON.stringify(D)),q="//# sourceURL\x3d"+(null!=(l=b.filename)?l:"coffeescript"),f=f+"\n"+("//# sourceMappingURL\x3ddata:application/json;base64,"+
a)+"\n"+q);return b.sourceMap?{js:f,sourceMap:g,v3SourceMap:JSON.stringify(D,null,2)}:f});f.tokens=B(function(a,b){return O.tokenize(a,b)});f.nodes=B(function(a,b){return"string"===typeof a?h.parse(O.tokenize(a,b)):h.parse(a)});f.run=function(b,c){var f;null==c&&(c={});var g=u.main;g.filename=process.argv[1]=c.filename?a.realpathSync(c.filename):"\x3canonymous\x3e";g.moduleCache&&(g.moduleCache={});var h=null!=c.filename?ya.dirname(a.realpathSync(c.filename)):a.realpathSync(".");g.paths=u("module")._nodeModulePaths(h);
if(!r.isCoffee(g.filename)||u.extensions)b=qa(b,c),b=null!=(f=b.js)?f:b;return g._compile(b,g.filename)};f.eval=function(a,c){var f,g,h,l,n;null==c&&(c={});if(a=a.trim()){var q=null!=(h=b.Script.createContext)?h:b.createContext;h=null!=(g=b.isContext)?g:function(a){return c.sandbox instanceof q().constructor};if(q){if(null!=c.sandbox){if(h(c.sandbox))var r=c.sandbox;else for(l in r=q(),h=c.sandbox,h)y.call(h,l)&&(g=h[l],r[l]=g);r.global=r.root=r.GLOBAL=r}else r=global;r.__filename=c.filename||"eval";
r.__dirname=ya.dirname(r.__filename);if(r===global&&!r.module&&!r.require){var x=u("module");r.module=f=new x(c.modulename||"eval");r.require=g=function(a){return x._load(a,f,!0)};f.filename=r.__filename;var B=Object.getOwnPropertyNames(u);h=0;for(n=B.length;h<n;h++){var z=B[h];"paths"!==z&&"arguments"!==z&&"caller"!==z&&(g[z]=u[z])}g.paths=f.paths=x._nodeModulePaths(process.cwd());g.resolve=function(a){return x._resolveFilename(a,f)}}}h={};for(l in c)y.call(c,l)&&(g=c[l],h[l]=g);h.bare=!0;a=qa(a,
h);return r===global?b.runInThisContext(a):b.runInContext(a,r)}};f.register=function(){return u("./register")};if(u.extensions){var Q=this.FILE_EXTENSIONS;var x=function(a){var b;return null!=(b=u.extensions)[a]?b[a]:b[a]=function(){throw Error("Use CoffeeScript.register() or require the coffee-script/register module to require "+a+" files.");}};var J=0;for(q=Q.length;J<q;J++)B=Q[J],x(B)}f._compileFile=function(b,c,f){null==c&&(c=!1);null==f&&(f=!1);var g=a.readFileSync(b,"utf8");g=65279===g.charCodeAt(0)?
g.substring(1):g;try{var h=qa(g,{filename:b,sourceMap:c,inlineMap:f,sourceFiles:[b],literate:r.isLiterate(b)})}catch(K){throw r.updateSyntaxError(K,g,b);}return h};var O=new g;h.lexer={lex:function(){var a;if(a=h.tokens[this.pos++]){var b=a[0];this.yytext=a[1];this.yylloc=a[2];h.errorToken=a.origin||a;this.yylineno=this.yylloc.first_line}else b="";return b},setInput:function(a){h.tokens=a;return this.pos=0},upcomingInput:function(){return""}};h.yy=u("./nodes");h.yy.parseError=function(a,b){var c=
h.errorToken;var f=h.tokens;var g=c[0];var l=c[1];a=c[2];l=function(){switch(!1){case c!==f[f.length-1]:return"end of input";case "INDENT"!==g&&"OUTDENT"!==g:return"indentation";case "IDENTIFIER"!==g&&"NUMBER"!==g&&"INFINITY"!==g&&"STRING"!==g&&"STRING_START"!==g&&"REGEX"!==g&&"REGEX_START"!==g:return g.replace(/_START$/,"").toLowerCase();default:return r.nameWhitespaceCharacter(l)}}();return r.throwSyntaxError("unexpected "+l,a)};var R=function(a,b){var c;if(a.isNative())var f="native";else{a.isEval()?
(c=a.getScriptNameOrSourceURL())||a.getEvalOrigin():c=a.getFileName();c||(c="\x3canonymous\x3e");var g=a.getLineNumber();f=a.getColumnNumber();f=(b=b(c,g,f))?c+":"+b[0]+":"+b[1]:c+":"+g+":"+f}c=a.getFunctionName();g=a.isConstructor();if(a.isToplevel()||g)return g?"new "+(c||"\x3canonymous\x3e")+" ("+f+")":c?c+" ("+f+")":f;g=a.getMethodName();var h=a.getTypeName();return c?(b=a="",h&&c.indexOf(h)&&(b=h+"."),g&&c.indexOf("."+g)!==c.length-g.length-1&&(a=" [as "+g+"]"),""+b+c+a+" ("+f+")"):h+"."+(g||
"\x3canonymous\x3e")+" ("+f+")"};var z=function(a){return null!=F[a]?F[a]:null!=F["\x3canonymous\x3e"]?F["\x3canonymous\x3e"]:null!=I[a]?(a=qa(I[a],{filename:a,sourceMap:!0,literate:r.isLiterate(a)}),a.sourceMap):null};Error.prepareStackTrace=function(a,b){var c;var g=function(a,b,c){var f;a=z(a);null!=a&&(f=a.sourceLocation([b-1,c-1]));return null!=f?[f[0]+1,f[1]+1]:null};var h=function(){var a;var h=[];var k=0;for(a=b.length;k<a;k++){c=b[k];if(c.getFunction()===f.run)break;h.push(" at "+R(c,
g))}return h}();return a.toString()+"\n"+h.join("\n")+"\n"}}).call(this);return f}();u["./browser"]=function(){(function(){var f=[].indexOf||function(a){for(var b=0,f=this.length;b<f;b++)if(b in this&&this[b]===a)return b;return-1};var qa=u("./coffee-script");qa.require=u;var q=qa.compile;qa.eval=function(a,b){null==b&&(b={});null==b.bare&&(b.bare=!0);return eval(q(a,b))};qa.run=function(a,b){null==b&&(b={});b.bare=!0;b.shiftLine=!0;return Function(q(a,b))()};if("undefined"!==typeof window&&null!==
window){"undefined"!==typeof btoa&&null!==btoa&&"undefined"!==typeof JSON&&null!==JSON&&(q=function(a,b){null==b&&(b={});b.inlineMap=!0;return qa.compile(a,b)});qa.load=function(a,b,f,g){null==f&&(f={});null==g&&(g=!1);f.sourceFiles=[a];var h=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest;h.open("GET",a,!0);"overrideMimeType"in h&&h.overrideMimeType("text/plain");h.onreadystatechange=function(){var q;if(4===h.readyState){if(0===(q=h.status)||200===q)q=
[h.responseText,f],g||qa.run.apply(qa,q);else throw Error("Could not load "+a);if(b)return b(q)}};return h.send(null)};var y=function(){var a,b,q;var g=window.document.getElementsByTagName("script");var h=["text/coffeescript","text/literate-coffeescript"];var r=function(){var a,b;var n=[];var r=0;for(a=g.length;r<a;r++)q=g[r],(b=q.type,0<=f.call(h,b))&&n.push(q);return n}();var n=0;var u=function(){var a=r[n];if(a instanceof Array)return qa.run.apply(qa,a),n++,u()};var y=function(a,b){var f;var g=
{literate:a.type===h[1]};if(f=a.src||a.getAttribute("data-src"))return qa.load(f,function(a){r[b]=a;return u()},g,!0);g.sourceFiles=["embedded"];return r[b]=[a.innerHTML,g]};var I=a=0;for(b=r.length;a<b;I=++a){var F=r[I];y(F,I)}return u()};window.addEventListener?window.addEventListener("DOMContentLoaded",y,!1):window.attachEvent("onload",y)}}).call(this);return{}}();return u["./coffee-script"]}();"function"===typeof define&&define.amd?define(function(){return xa}):u.CoffeeScript=xa})(this);

3217
docs/v1/index.html Normal file

File diff suppressed because one or more lines are too long

11691
docs/v1/test.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,334 @@
<!DOCTYPE html>
<html>
<head>
<title>browser.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>browser.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>This <strong>Browser</strong> compatibility layer extends core CoffeeScript functions
to make things work smoothly when compiling code directly in the browser.
We add support for loading remote Coffee scripts via <strong>XHR</strong>, and
<code>text/coffeescript</code> script tags, source maps via data-URLs, and so on.</p>
</div>
<div class="content"><div class='highlight'><pre>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffeescript'</span>
compile = CoffeeScript.compile</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Use standard JavaScript <code>eval</code> to eval code.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.eval = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.bare ?= <span class="hljs-literal">on</span>
eval compile code, options</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Running code does not provide access to this scope.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.run = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.bare = <span class="hljs-literal">on</span>
options.shiftLine = <span class="hljs-literal">on</span>
Function(compile code, options)()</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Export this more limited <code>CoffeeScript</code> than what is exported by
<code>index.coffee</code>, which is intended for a Node environment.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">module</span>.exports = CoffeeScript</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>If were not in a browser environment, were finished with the public API.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-built_in">window</span>?</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Include source maps where possible. If weve got a base64 encoder, a
JSON serializer, and tools for escaping unicode characters, were good to go.
Ported from <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa">https://developer.mozilla.org/en-US/docs/DOM/window.btoa</a></p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> btoa? <span class="hljs-keyword">and</span> JSON?
<span class="hljs-function"> <span class="hljs-title">compile</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.inlineMap = <span class="hljs-literal">true</span>
CoffeeScript.compile code, options</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Load a remote script from the current domain via XHR.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.load = <span class="hljs-function"><span class="hljs-params">(url, callback, options = {}, hold = <span class="hljs-literal">false</span>)</span> -&gt;</span>
options.sourceFiles = [url]
xhr = <span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>.ActiveXObject
<span class="hljs-keyword">new</span> <span class="hljs-built_in">window</span>.ActiveXObject(<span class="hljs-string">'Microsoft.XMLHTTP'</span>)
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">new</span> <span class="hljs-built_in">window</span>.XMLHttpRequest()
xhr.open <span class="hljs-string">'GET'</span>, url, <span class="hljs-literal">true</span>
xhr.overrideMimeType <span class="hljs-string">'text/plain'</span> <span class="hljs-keyword">if</span> <span class="hljs-string">'overrideMimeType'</span> <span class="hljs-keyword">of</span> xhr
xhr.onreadystatechange = <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">if</span> xhr.readyState <span class="hljs-keyword">is</span> <span class="hljs-number">4</span>
<span class="hljs-keyword">if</span> xhr.status <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">200</span>]
param = [xhr.responseText, options]
CoffeeScript.run param... <span class="hljs-keyword">unless</span> hold
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Could not load <span class="hljs-subst">#{url}</span>"</span>
callback param <span class="hljs-keyword">if</span> callback
xhr.send <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Activate CoffeeScript in the browser by having it compile and evaluate
all script tags with a content-type of <code>text/coffeescript</code>.
This happens on page load.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">runScripts</span> = -&gt;</span>
scripts = <span class="hljs-built_in">window</span>.<span class="hljs-built_in">document</span>.getElementsByTagName <span class="hljs-string">'script'</span>
coffeetypes = [<span class="hljs-string">'text/coffeescript'</span>, <span class="hljs-string">'text/literate-coffeescript'</span>]
coffees = (s <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> scripts <span class="hljs-keyword">when</span> s.type <span class="hljs-keyword">in</span> coffeetypes)
index = <span class="hljs-number">0</span>
<span class="hljs-function">
<span class="hljs-title">execute</span> = -&gt;</span>
param = coffees[index]
<span class="hljs-keyword">if</span> param <span class="hljs-keyword">instanceof</span> Array
CoffeeScript.run param...
index++
execute()
<span class="hljs-keyword">for</span> script, i <span class="hljs-keyword">in</span> coffees
<span class="hljs-keyword">do</span> (script, i) -&gt;
options = literate: script.type <span class="hljs-keyword">is</span> coffeetypes[<span class="hljs-number">1</span>]
source = script.src <span class="hljs-keyword">or</span> script.getAttribute(<span class="hljs-string">'data-src'</span>)
<span class="hljs-keyword">if</span> source
options.filename = source
CoffeeScript.load source,
<span class="hljs-function"><span class="hljs-params">(param)</span> -&gt;</span>
coffees[i] = param
execute()
options
<span class="hljs-literal">true</span>
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p><code>options.filename</code> defines the filename the source map appears as
in Developer Tools. If a script tag has an <code>id</code>, use that as the
filename; otherwise use <code>coffeescript</code>, or <code>coffeescript1</code> etc.,
leaving the first one unnumbered for the common case that theres
only one CoffeeScript script block to parse.</p>
</div>
<div class="content"><div class='highlight'><pre> options.filename = <span class="hljs-keyword">if</span> script.id <span class="hljs-keyword">and</span> script.id <span class="hljs-keyword">isnt</span> <span class="hljs-string">''</span> <span class="hljs-keyword">then</span> script.id <span class="hljs-keyword">else</span> <span class="hljs-string">"coffeescript<span class="hljs-subst">#{<span class="hljs-keyword">if</span> i <span class="hljs-keyword">isnt</span> <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> i <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>}</span>"</span>
options.sourceFiles = [<span class="hljs-string">'embedded'</span>]
coffees[i] = [script.innerHTML, options]
execute()</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Listen for window load, both in decent browsers and in IE.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>.addEventListener
<span class="hljs-built_in">window</span>.addEventListener <span class="hljs-string">'DOMContentLoaded'</span>, runScripts, <span class="hljs-literal">no</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">window</span>.attachEvent <span class="hljs-string">'onload'</span>, runScripts</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,345 @@
<!DOCTYPE html>
<html>
<head>
<title>cake.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>cake.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p><code>cake</code> is a simplified version of <a href="http://www.gnu.org/software/make/">Make</a>
(<a href="http://rake.rubyforge.org/">Rake</a>, <a href="https://github.com/280north/jake">Jake</a>)
for CoffeeScript. You define tasks with names and descriptions in a Cakefile,
and can call them from the command line, or invoke them from other tasks.</p>
<p>Running <code>cake</code> with no arguments will print out a list of all the tasks in the
current directorys Cakefile.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>External dependencies.</p>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
optparse = <span class="hljs-built_in">require</span> <span class="hljs-string">'./optparse'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Register .coffee extension</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.register()</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Keep track of the list of defined tasks, the accepted options, and so on.</p>
</div>
<div class="content"><div class='highlight'><pre>tasks = {}
options = {}
switches = []
oparse = <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Mixin the top-level Cake functions for Cakefiles to use directly.</p>
</div>
<div class="content"><div class='highlight'><pre>helpers.extend <span class="hljs-built_in">global</span>,</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Define a Cake task with a short name, an optional sentence description,
and the function to run as the action itself.</p>
</div>
<div class="content"><div class='highlight'><pre> task: <span class="hljs-function"><span class="hljs-params">(name, description, action)</span> -&gt;</span>
[action, description] = [description, action] <span class="hljs-keyword">unless</span> action
tasks[name] = {name, description, action}</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Define an option that the Cakefile accepts. The parsed options hash,
containing all of the command-line options passed, will be made available
as the first argument to the action.</p>
</div>
<div class="content"><div class='highlight'><pre> option: <span class="hljs-function"><span class="hljs-params">(letter, flag, description)</span> -&gt;</span>
switches.push [letter, flag, description]</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Invoke another task in the current Cakefile.</p>
</div>
<div class="content"><div class='highlight'><pre> invoke: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
missingTask name <span class="hljs-keyword">unless</span> tasks[name]
tasks[name].action options</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Run <code>cake</code>. Executes all of the tasks you pass, in order. Note that Nodes
asynchrony may cause tasks to execute in a different order than youd expect.
If no tasks are passed, print the help screen. Keep a reference to the
original directory name, when running Cake tasks from subdirectories.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-&gt;</span>
<span class="hljs-built_in">global</span>.__originalDirname = fs.realpathSync <span class="hljs-string">'.'</span>
process.chdir cakefileDirectory __originalDirname
args = process.argv[<span class="hljs-number">2.</span>.]
CoffeeScript.run fs.readFileSync(<span class="hljs-string">'Cakefile'</span>).toString(), filename: <span class="hljs-string">'Cakefile'</span>
oparse = <span class="hljs-keyword">new</span> optparse.OptionParser switches
<span class="hljs-keyword">return</span> printTasks() <span class="hljs-keyword">unless</span> args.length
<span class="hljs-keyword">try</span>
options = oparse.parse(args)
<span class="hljs-keyword">catch</span> e
<span class="hljs-keyword">return</span> fatalError <span class="hljs-string">"<span class="hljs-subst">#{e}</span>"</span>
invoke arg <span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> options.arguments</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">printTasks</span> = -&gt;</span>
relative = path.relative <span class="hljs-keyword">or</span> path.resolve
cakefilePath = path.join relative(__originalDirname, process.cwd()), <span class="hljs-string">'Cakefile'</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"<span class="hljs-subst">#{cakefilePath}</span> defines the following tasks:\n"</span>
<span class="hljs-keyword">for</span> name, task <span class="hljs-keyword">of</span> tasks
spaces = <span class="hljs-number">20</span> - name.length
spaces = <span class="hljs-keyword">if</span> spaces &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> Array(spaces + <span class="hljs-number">1</span>).join(<span class="hljs-string">' '</span>) <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
desc = <span class="hljs-keyword">if</span> task.description <span class="hljs-keyword">then</span> <span class="hljs-string">"# <span class="hljs-subst">#{task.description}</span>"</span> <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"cake <span class="hljs-subst">#{name}</span><span class="hljs-subst">#{spaces}</span> <span class="hljs-subst">#{desc}</span>"</span>
<span class="hljs-built_in">console</span>.log oparse.help() <span class="hljs-keyword">if</span> switches.length</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Print an error and exit when attempting to use an invalid task/option.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">fatalError</span> = <span class="hljs-params">(message)</span> -&gt;</span>
<span class="hljs-built_in">console</span>.error message + <span class="hljs-string">'\n'</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">'To see a list of all tasks/options, run "cake"'</span>
process.exit <span class="hljs-number">1</span>
<span class="hljs-function">
<span class="hljs-title">missingTask</span> = <span class="hljs-params">(task)</span> -&gt;</span> fatalError <span class="hljs-string">"No such task: <span class="hljs-subst">#{task}</span>"</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>When <code>cake</code> is invoked, search in the current and all parent directories
to find the relevant Cakefile.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">cakefileDirectory</span> = <span class="hljs-params">(dir)</span> -&gt;</span>
<span class="hljs-keyword">return</span> dir <span class="hljs-keyword">if</span> fs.existsSync path.join dir, <span class="hljs-string">'Cakefile'</span>
parent = path.normalize path.join dir, <span class="hljs-string">'..'</span>
<span class="hljs-keyword">return</span> cakefileDirectory parent <span class="hljs-keyword">unless</span> parent <span class="hljs-keyword">is</span> dir
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Cakefile not found in <span class="hljs-subst">#{process.cwd()}</span>"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,767 @@
<!DOCTYPE html>
<html>
<head>
<title>coffeescript.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>coffeescript.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>CoffeeScript can be used both on the server, as a command-line compiler based
on Node.js/V8, or to run CoffeeScript directly in the browser. This module
contains the main entry functions for tokenizing, parsing, and compiling
source CoffeeScript into JavaScript.</p>
</div>
<div class="content"><div class='highlight'><pre>
{Lexer} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./lexer'</span>
{parser} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./parser'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-string">'./sourcemap'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Require <code>package.json</code>, which is two levels above this file, as this file is
evaluated from <code>lib/coffeescript</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>packageJson = <span class="hljs-built_in">require</span> <span class="hljs-string">'../../package.json'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>The current CoffeeScript version number.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.VERSION = packageJson.version
exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Expose helpers for testing.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.helpers = helpers</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Function that allows for btoa in both nodejs and the browser.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">base64encode</span> = <span class="hljs-params">(src)</span> -&gt;</span> <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> <span class="hljs-keyword">typeof</span> Buffer <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
Buffer.<span class="hljs-keyword">from</span>(src).toString(<span class="hljs-string">'base64'</span>)
<span class="hljs-keyword">when</span> <span class="hljs-keyword">typeof</span> btoa <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>The contents of a <code>&lt;script&gt;</code> block are encoded via UTF-16, so if any extended
characters are used in the block, btoa will fail as it maxes out at UTF-8.
See <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem">https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem</a>
for the gory details, and for the solution implemented here.</p>
</div>
<div class="content"><div class='highlight'><pre> btoa encodeURIComponent(src).replace <span class="hljs-regexp">/%([0-9A-F]{2})/g</span>, <span class="hljs-function"><span class="hljs-params">(match, p1)</span> -&gt;</span>
String.fromCharCode <span class="hljs-string">'0x'</span> + p1
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error(<span class="hljs-string">'Unable to base64 encode inline sourcemap.'</span>)</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Function wrapper to add source file information to SyntaxErrors thrown by the
lexer/parser/compiler.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">withPrettyErrors</span> = <span class="hljs-params">(fn)</span> -&gt;</span>
(code, options = {}) -&gt;
<span class="hljs-keyword">try</span>
fn.call @, code, options
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'string'</span> <span class="hljs-comment"># Support `CoffeeScript.nodes(tokens)`.</span>
<span class="hljs-keyword">throw</span> helpers.updateSyntaxError err, code, options.filename</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>For each compiled file, save its source in memory in case we need to
recompile it later. We might need to recompile if the first compilation
didnt create a source map (faster) but something went wrong and we need
a stack trace. Assuming that most of the time, code isnt throwing
exceptions, its probably more efficient to compile twice only when we
need a stack trace, rather than always generating a source map even when
its not likely to be used. Save in form of <code>filename</code>: <code>(source)</code></p>
</div>
<div class="content"><div class='highlight'><pre>sources = {}</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Also save source maps if generated, in form of <code>filename</code>: <code>(source map)</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>sourceMaps = {}</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Compile CoffeeScript code to JavaScript, using the Coffee/Jison compiler.</p>
<p>If <code>options.sourceMap</code> is specified, then <code>options.filename</code> must also be
specified. All options that can be passed to <code>SourceMap#generate</code> may also
be passed here.</p>
<p>This returns a javascript string, unless <code>options.sourceMap</code> is passed,
in which case this returns a <code>{js, v3SourceMap, sourceMap}</code>
object, where sourceMap is a sourcemap.coffee#SourceMap object, handy for
doing programmatic lookups.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.compile = compile = withPrettyErrors (code, options) -&gt;
{merge, extend} = helpers
options = extend {}, options</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Always generate a source map if no filename is passed in, since without a
a filename we have no way to retrieve this source later in the event that
we need to recompile it to get a source map for <code>prepareStackTrace</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> generateSourceMap = options.sourceMap <span class="hljs-keyword">or</span> options.inlineMap <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> options.filename?
filename = options.filename <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>
sources[filename] = code
map = <span class="hljs-keyword">new</span> SourceMap <span class="hljs-keyword">if</span> generateSourceMap
tokens = lexer.tokenize code, options</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Pass a list of referenced variables, so that generated variables wont get
the same name.</p>
</div>
<div class="content"><div class='highlight'><pre> options.referencedVars = (
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>
)</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Check for import or export; if found, force bare mode.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> options.bare? <span class="hljs-keyword">and</span> options.bare <span class="hljs-keyword">is</span> <span class="hljs-literal">yes</span>
<span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens
<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'IMPORT'</span>, <span class="hljs-string">'EXPORT'</span>]
options.bare = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">break</span>
fragments = parser.parse(tokens).compileToFragments options
currentLine = <span class="hljs-number">0</span>
currentLine += <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> options.header
currentLine += <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> options.shiftLine
currentColumn = <span class="hljs-number">0</span>
js = <span class="hljs-string">""</span>
<span class="hljs-keyword">for</span> fragment <span class="hljs-keyword">in</span> fragments</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Update the sourcemap with data from each fragment.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> generateSourceMap</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Do not include empty, whitespace, or semicolon-only fragments.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> fragment.locationData <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-regexp">/^[;\s]*$/</span>.test fragment.code
map.add(
[fragment.locationData.first_line, fragment.locationData.first_column]
[currentLine, currentColumn]
{noReplace: <span class="hljs-literal">true</span>})
newLines = helpers.count fragment.code, <span class="hljs-string">"\n"</span>
currentLine += newLines
<span class="hljs-keyword">if</span> newLines
currentColumn = fragment.code.length - (fragment.code.lastIndexOf(<span class="hljs-string">"\n"</span>) + <span class="hljs-number">1</span>)
<span class="hljs-keyword">else</span>
currentColumn += fragment.code.length</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Copy the code from each fragment into the final JavaScript.</p>
</div>
<div class="content"><div class='highlight'><pre> js += fragment.code
<span class="hljs-keyword">if</span> options.header
header = <span class="hljs-string">"Generated by CoffeeScript <span class="hljs-subst">#{@VERSION}</span>"</span>
js = <span class="hljs-string">"// <span class="hljs-subst">#{header}</span>\n<span class="hljs-subst">#{js}</span>"</span>
<span class="hljs-keyword">if</span> generateSourceMap
v3SourceMap = map.generate(options, code)
sourceMaps[filename] = map
<span class="hljs-keyword">if</span> options.inlineMap
encoded = base64encode JSON.stringify v3SourceMap
sourceMapDataURI = <span class="hljs-string">"//# sourceMappingURL=data:application/json;base64,<span class="hljs-subst">#{encoded}</span>"</span>
sourceURL = <span class="hljs-string">"//# sourceURL=<span class="hljs-subst">#{options.filename ? <span class="hljs-string">'coffeescript'</span>}</span>"</span>
js = <span class="hljs-string">"<span class="hljs-subst">#{js}</span>\n<span class="hljs-subst">#{sourceMapDataURI}</span>\n<span class="hljs-subst">#{sourceURL}</span>"</span>
<span class="hljs-keyword">if</span> options.sourceMap
{
js
sourceMap: map
v3SourceMap: JSON.stringify v3SourceMap, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>
}
<span class="hljs-keyword">else</span>
js</pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.tokens = withPrettyErrors (code, options) -&gt;
lexer.tokenize code, options</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Parse a string of CoffeeScript code or an array of lexed tokens, and
return the AST. You can then compile it by calling <code>.compile()</code> on the root,
or traverse it by using <code>.traverseChildren()</code> with a callback.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.nodes = withPrettyErrors (source, options) -&gt;
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> source <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span>
parser.parse lexer.tokenize source, options
<span class="hljs-keyword">else</span>
parser.parse source</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>This file used to export these methods; leave stubs that throw warnings
instead. These methods have been moved into <code>index.coffee</code> to provide
separate entrypoints for Node and non-Node environments, so that static
analysis tools dont choke on Node packages when compiling for a non-Node
environment.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = exports.eval = exports.register = <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">'require index.coffee, not this file'</span></pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Instantiate a Lexer for our use here.</p>
</div>
<div class="content"><div class='highlight'><pre>lexer = <span class="hljs-keyword">new</span> Lexer</pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>The real Lexer produces a generic stream of tokens. This object provides a
thin wrapper around it, compatible with the Jison API. We can then pass it
directly as a “Jison lexer”.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.lexer =
lex: <span class="hljs-function">-&gt;</span>
token = parser.tokens[@pos++]
<span class="hljs-keyword">if</span> token
[tag, @yytext, @yylloc] = token
parser.errorToken = token.origin <span class="hljs-keyword">or</span> token
@yylineno = @yylloc.first_line
<span class="hljs-keyword">else</span>
tag = <span class="hljs-string">''</span>
tag
setInput: <span class="hljs-function"><span class="hljs-params">(tokens)</span> -&gt;</span>
parser.tokens = tokens
@pos = <span class="hljs-number">0</span>
upcomingInput: <span class="hljs-function">-&gt;</span>
<span class="hljs-string">""</span></pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Make all the AST nodes visible to the parser.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.yy = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span></pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Override Jisons default error handling function.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.yy.parseError = <span class="hljs-function"><span class="hljs-params">(message, {token})</span> -&gt;</span></pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Disregard Jisons message, it contains redundant line number information.
Disregard the token, we take its value directly from the lexer in case
the error is caused by a generated token which might refer to its origin.</p>
</div>
<div class="content"><div class='highlight'><pre> {errorToken, tokens} = parser
[errorTag, errorText, errorLoc] = errorToken
errorText = <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> errorToken <span class="hljs-keyword">is</span> tokens[tokens.length - <span class="hljs-number">1</span>]
<span class="hljs-string">'end of input'</span>
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'INDENT'</span>, <span class="hljs-string">'OUTDENT'</span>]
<span class="hljs-string">'indentation'</span>
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'NUMBER'</span>, <span class="hljs-string">'INFINITY'</span>, <span class="hljs-string">'STRING'</span>, <span class="hljs-string">'STRING_START'</span>, <span class="hljs-string">'REGEX'</span>, <span class="hljs-string">'REGEX_START'</span>]
errorTag.replace(<span class="hljs-regexp">/_START$/</span>, <span class="hljs-string">''</span>).toLowerCase()
<span class="hljs-keyword">else</span>
helpers.nameWhitespaceCharacter errorText</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>The second argument has a <code>loc</code> property, which should have the location
data for this token. Unfortunately, Jison seems to send an outdated <code>loc</code>
(from the previous token), so we take the location information directly
from the lexer.</p>
</div>
<div class="content"><div class='highlight'><pre> helpers.throwSyntaxError <span class="hljs-string">"unexpected <span class="hljs-subst">#{errorText}</span>"</span>, errorLoc</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Based on <a href="http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js">http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js</a>
Modified to handle sourceMap</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">formatSourcePosition</span> = <span class="hljs-params">(frame, getSourceMapping)</span> -&gt;</span>
filename = <span class="hljs-literal">undefined</span>
fileLocation = <span class="hljs-string">''</span>
<span class="hljs-keyword">if</span> frame.isNative()
fileLocation = <span class="hljs-string">"native"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">if</span> frame.isEval()
filename = frame.getScriptNameOrSourceURL()
fileLocation = <span class="hljs-string">"<span class="hljs-subst">#{frame.getEvalOrigin()}</span>, "</span> <span class="hljs-keyword">unless</span> filename
<span class="hljs-keyword">else</span>
filename = frame.getFileName()
filename <span class="hljs-keyword">or</span>= <span class="hljs-string">"&lt;anonymous&gt;"</span>
line = frame.getLineNumber()
column = frame.getColumnNumber()</pre></div></div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
</div>
<p>Check for a sourceMap position</p>
</div>
<div class="content"><div class='highlight'><pre> source = getSourceMapping filename, line, column
fileLocation =
<span class="hljs-keyword">if</span> source
<span class="hljs-string">"<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{source[<span class="hljs-number">0</span>]}</span>:<span class="hljs-subst">#{source[<span class="hljs-number">1</span>]}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{line}</span>:<span class="hljs-subst">#{column}</span>"</span>
functionName = frame.getFunctionName()
isConstructor = frame.isConstructor()
isMethodCall = <span class="hljs-keyword">not</span> (frame.isToplevel() <span class="hljs-keyword">or</span> isConstructor)
<span class="hljs-keyword">if</span> isMethodCall
methodName = frame.getMethodName()
typeName = frame.getTypeName()
<span class="hljs-keyword">if</span> functionName
tp = <span class="hljs-keyword">as</span> = <span class="hljs-string">''</span>
<span class="hljs-keyword">if</span> typeName <span class="hljs-keyword">and</span> functionName.indexOf typeName
tp = <span class="hljs-string">"<span class="hljs-subst">#{typeName}</span>."</span>
<span class="hljs-keyword">if</span> methodName <span class="hljs-keyword">and</span> functionName.indexOf(<span class="hljs-string">".<span class="hljs-subst">#{methodName}</span>"</span>) <span class="hljs-keyword">isnt</span> functionName.length - methodName.length - <span class="hljs-number">1</span>
<span class="hljs-keyword">as</span> = <span class="hljs-string">" [as <span class="hljs-subst">#{methodName}</span>]"</span>
<span class="hljs-string">"<span class="hljs-subst">#{tp}</span><span class="hljs-subst">#{functionName}</span><span class="hljs-subst">#{<span class="hljs-keyword">as</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{typeName}</span>.<span class="hljs-subst">#{methodName <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> isConstructor
<span class="hljs-string">"new <span class="hljs-subst">#{functionName <span class="hljs-keyword">or</span> <span class="hljs-string">'&lt;anonymous&gt;'</span>}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> functionName
<span class="hljs-string">"<span class="hljs-subst">#{functionName}</span> (<span class="hljs-subst">#{fileLocation}</span>)"</span>
<span class="hljs-keyword">else</span>
fileLocation
<span class="hljs-function">
<span class="hljs-title">getSourceMap</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
<span class="hljs-keyword">if</span> sourceMaps[filename]?
sourceMaps[filename]</pre></div></div>
</li>
<li id="section-28">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">&#182;</a>
</div>
<p>CoffeeScript compiled in a browser may get compiled with <code>options.filename</code>
of <code>&lt;anonymous&gt;</code>, but the browser may request the stack trace with the
filename of the script file.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sourceMaps[<span class="hljs-string">'&lt;anonymous&gt;'</span>]?
sourceMaps[<span class="hljs-string">'&lt;anonymous&gt;'</span>]
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sources[filename]?
answer = compile sources[filename],
filename: filename
sourceMap: <span class="hljs-literal">yes</span>
literate: helpers.isLiterate filename
answer.sourceMap
<span class="hljs-keyword">else</span>
<span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
</div>
<p>Based on <a href="http://goo.gl/ZTx1p">michaelficarra/CoffeeScriptRedux</a>
NodeJS / V8 have no support for transforming positions in stack traces using
sourceMap, so we must monkey-patch Error to display CoffeeScript source
positions.</p>
</div>
<div class="content"><div class='highlight'><pre>Error.prepareStackTrace = <span class="hljs-function"><span class="hljs-params">(err, stack)</span> -&gt;</span>
<span class="hljs-function"> <span class="hljs-title">getSourceMapping</span> = <span class="hljs-params">(filename, line, column)</span> -&gt;</span>
sourceMap = getSourceMap filename
answer = sourceMap.sourceLocation [line - <span class="hljs-number">1</span>, column - <span class="hljs-number">1</span>] <span class="hljs-keyword">if</span> sourceMap?
<span class="hljs-keyword">if</span> answer? <span class="hljs-keyword">then</span> [answer[<span class="hljs-number">0</span>] + <span class="hljs-number">1</span>, answer[<span class="hljs-number">1</span>] + <span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> <span class="hljs-literal">null</span>
frames = <span class="hljs-keyword">for</span> frame <span class="hljs-keyword">in</span> stack
<span class="hljs-keyword">break</span> <span class="hljs-keyword">if</span> frame.getFunction() <span class="hljs-keyword">is</span> exports.run
<span class="hljs-string">" at <span class="hljs-subst">#{formatSourcePosition frame, getSourceMapping}</span>"</span>
<span class="hljs-string">"<span class="hljs-subst">#{err.toString()}</span>\n<span class="hljs-subst">#{frames.join <span class="hljs-string">'\n'</span>}</span>\n"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,882 @@
<!DOCTYPE html>
<html>
<head>
<title>command.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>command.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>The <code>coffee</code> utility. Handles command-line compilation of CoffeeScript
into various forms: saved into <code>.js</code> files or printed to stdout
or recompiled every time the source is saved,
printed as a token stream or as the syntax tree, or launch an
interactive REPL.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>External dependencies.</p>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
optparse = <span class="hljs-built_in">require</span> <span class="hljs-string">'./optparse'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./'</span>
{spawn, exec} = <span class="hljs-built_in">require</span> <span class="hljs-string">'child_process'</span>
{EventEmitter} = <span class="hljs-built_in">require</span> <span class="hljs-string">'events'</span>
useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs-string">'\\'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Allow CoffeeScript to emit Node.js events.</p>
</div>
<div class="content"><div class='highlight'><pre>helpers.extend CoffeeScript, <span class="hljs-keyword">new</span> EventEmitter
<span class="hljs-function">
<span class="hljs-title">printLine</span> = <span class="hljs-params">(line)</span> -&gt;</span> process.stdout.write line + <span class="hljs-string">'\n'</span>
<span class="hljs-function"><span class="hljs-title">printWarn</span> = <span class="hljs-params">(line)</span> -&gt;</span> process.stderr.write line + <span class="hljs-string">'\n'</span>
<span class="hljs-function">
<span class="hljs-title">hidden</span> = <span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/^\.|~$/</span>.test file</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>The help banner that is printed in conjunction with <code>-h</code>/<code>--help</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>BANNER = <span class="hljs-string">'''
Usage: coffee [options] path/to/script.coffee -- [args]
If called without options, `coffee` will run your script.
'''</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>The list of all the valid option flags that <code>coffee</code> knows how to handle.</p>
</div>
<div class="content"><div class='highlight'><pre>SWITCHES = [
[<span class="hljs-string">'-b'</span>, <span class="hljs-string">'--bare'</span>, <span class="hljs-string">'compile without a top-level function wrapper'</span>]
[<span class="hljs-string">'-c'</span>, <span class="hljs-string">'--compile'</span>, <span class="hljs-string">'compile to JavaScript and save as .js files'</span>]
[<span class="hljs-string">'-e'</span>, <span class="hljs-string">'--eval'</span>, <span class="hljs-string">'pass a string from the command line as input'</span>]
[<span class="hljs-string">'-h'</span>, <span class="hljs-string">'--help'</span>, <span class="hljs-string">'display this help message'</span>]
[<span class="hljs-string">'-i'</span>, <span class="hljs-string">'--interactive'</span>, <span class="hljs-string">'run an interactive CoffeeScript REPL'</span>]
[<span class="hljs-string">'-j'</span>, <span class="hljs-string">'--join [FILE]'</span>, <span class="hljs-string">'concatenate the source CoffeeScript before compiling'</span>]
[<span class="hljs-string">'-m'</span>, <span class="hljs-string">'--map'</span>, <span class="hljs-string">'generate source map and save as .js.map files'</span>]
[<span class="hljs-string">'-M'</span>, <span class="hljs-string">'--inline-map'</span>, <span class="hljs-string">'generate source map and include it directly in output'</span>]
[<span class="hljs-string">'-n'</span>, <span class="hljs-string">'--nodes'</span>, <span class="hljs-string">'print out the parse tree that the parser produces'</span>]
[ <span class="hljs-string">'--nodejs [ARGS]'</span>, <span class="hljs-string">'pass options directly to the "node" binary'</span>]
[ <span class="hljs-string">'--no-header'</span>, <span class="hljs-string">'suppress the "Generated by" header'</span>]
[<span class="hljs-string">'-o'</span>, <span class="hljs-string">'--output [DIR]'</span>, <span class="hljs-string">'set the output directory for compiled JavaScript'</span>]
[<span class="hljs-string">'-p'</span>, <span class="hljs-string">'--print'</span>, <span class="hljs-string">'print out the compiled JavaScript'</span>]
[<span class="hljs-string">'-r'</span>, <span class="hljs-string">'--require [MODULE*]'</span>, <span class="hljs-string">'require the given module before eval or REPL'</span>]
[<span class="hljs-string">'-s'</span>, <span class="hljs-string">'--stdio'</span>, <span class="hljs-string">'listen for and compile scripts over stdio'</span>]
[<span class="hljs-string">'-l'</span>, <span class="hljs-string">'--literate'</span>, <span class="hljs-string">'treat stdio as literate style coffeescript'</span>]
[<span class="hljs-string">'-t'</span>, <span class="hljs-string">'--tokens'</span>, <span class="hljs-string">'print out the tokens that the lexer/rewriter produce'</span>]
[<span class="hljs-string">'-v'</span>, <span class="hljs-string">'--version'</span>, <span class="hljs-string">'display the version number'</span>]
[<span class="hljs-string">'-w'</span>, <span class="hljs-string">'--watch'</span>, <span class="hljs-string">'watch scripts for changes and rerun commands'</span>]
]</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Top-level objects shared by all the functions.</p>
</div>
<div class="content"><div class='highlight'><pre>opts = {}
sources = []
sourceCode = []
notSources = {}
watchedDirs = {}
optionParser = <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Run <code>coffee</code> by parsing passed options and determining what action to take.
Many flags cause us to divert before compiling anything. Flags passed after
<code>--</code> will be passed verbatim to your script as arguments in <code>process.argv</code></p>
</div>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-&gt;</span>
parseOptions()</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Make the REPL <em>CLI</em> use the global context so as to (a) be consistent with the
<code>node</code> REPL CLI and, therefore, (b) make packages that modify native prototypes
(such as colors and sugar) work as expected.</p>
</div>
<div class="content"><div class='highlight'><pre> replCliOpts = useGlobal: <span class="hljs-literal">yes</span>
opts.prelude = makePrelude opts.<span class="hljs-built_in">require</span> <span class="hljs-keyword">if</span> opts.<span class="hljs-built_in">require</span>
replCliOpts.prelude = opts.prelude
<span class="hljs-keyword">return</span> forkNode() <span class="hljs-keyword">if</span> opts.nodejs
<span class="hljs-keyword">return</span> usage() <span class="hljs-keyword">if</span> opts.help
<span class="hljs-keyword">return</span> version() <span class="hljs-keyword">if</span> opts.version
<span class="hljs-keyword">return</span> <span class="hljs-built_in">require</span>(<span class="hljs-string">'./repl'</span>).start(replCliOpts) <span class="hljs-keyword">if</span> opts.interactive
<span class="hljs-keyword">return</span> compileStdio() <span class="hljs-keyword">if</span> opts.stdio
<span class="hljs-keyword">return</span> compileScript <span class="hljs-literal">null</span>, opts.arguments[<span class="hljs-number">0</span>] <span class="hljs-keyword">if</span> opts.eval
<span class="hljs-keyword">return</span> <span class="hljs-built_in">require</span>(<span class="hljs-string">'./repl'</span>).start(replCliOpts) <span class="hljs-keyword">unless</span> opts.arguments.length
literals = <span class="hljs-keyword">if</span> opts.run <span class="hljs-keyword">then</span> opts.arguments.splice <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> []
process.argv = process.argv[<span class="hljs-number">0.</span><span class="hljs-number">.1</span>].concat literals
process.argv[<span class="hljs-number">0</span>] = <span class="hljs-string">'coffee'</span>
opts.output = path.resolve opts.output <span class="hljs-keyword">if</span> opts.output
<span class="hljs-keyword">if</span> opts.join
opts.join = path.resolve opts.join
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
The --join option is deprecated and will be removed in a future version.
If for some reason it's necessary to share local variables between files,
replace...
$ coffee --compile --join bundle.js -- a.coffee b.coffee c.coffee
with...
$ cat a.coffee b.coffee c.coffee | coffee --compile --stdio &gt; bundle.js
'''</span>
<span class="hljs-keyword">for</span> source <span class="hljs-keyword">in</span> opts.arguments
source = path.resolve source
compilePath source, <span class="hljs-literal">yes</span>, source
<span class="hljs-function">
<span class="hljs-title">makePrelude</span> = <span class="hljs-params">(requires)</span> -&gt;</span>
requires.map (<span class="hljs-built_in">module</span>) -&gt;
[_, name, <span class="hljs-built_in">module</span>] = match <span class="hljs-keyword">if</span> match = <span class="hljs-built_in">module</span>.match(<span class="hljs-regexp">/^(.*)=(.*)$/</span>)
name ||= helpers.baseFileName <span class="hljs-built_in">module</span>, <span class="hljs-literal">yes</span>, useWinPathSep
<span class="hljs-string">"<span class="hljs-subst">#{name}</span> = require('<span class="hljs-subst">#{<span class="hljs-built_in">module</span>}</span>')"</span>
.join <span class="hljs-string">';'</span></pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Compile a path, which could be a script or a directory. If a directory
is passed, recursively compile all .coffee, .litcoffee, and .coffee.md
extension source files in it and all subdirectories.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compilePath</span> = <span class="hljs-params">(source, topLevel, base)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> source <span class="hljs-keyword">in</span> sources <span class="hljs-keyword">or</span>
watchedDirs[source] <span class="hljs-keyword">or</span>
<span class="hljs-keyword">not</span> topLevel <span class="hljs-keyword">and</span> (notSources[source] <span class="hljs-keyword">or</span> hidden source)
<span class="hljs-keyword">try</span>
stats = fs.statSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"File not found: <span class="hljs-subst">#{source}</span>"</span>
process.exit <span class="hljs-number">1</span>
<span class="hljs-keyword">throw</span> err
<span class="hljs-keyword">if</span> stats.isDirectory()
<span class="hljs-keyword">if</span> path.basename(source) <span class="hljs-keyword">is</span> <span class="hljs-string">'node_modules'</span>
notSources[source] = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">return</span>
<span class="hljs-keyword">if</span> opts.run
compilePath findDirectoryIndex(source), topLevel, base
<span class="hljs-keyword">return</span>
watchDir source, base <span class="hljs-keyword">if</span> opts.watch
<span class="hljs-keyword">try</span>
files = fs.readdirSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">return</span> <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> err
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> files
compilePath (path.join source, file), <span class="hljs-literal">no</span>, base
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> topLevel <span class="hljs-keyword">or</span> helpers.isCoffee source
sources.push source
sourceCode.push <span class="hljs-literal">null</span>
<span class="hljs-keyword">delete</span> notSources[source]
watch source, base <span class="hljs-keyword">if</span> opts.watch
<span class="hljs-keyword">try</span>
code = fs.readFileSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">return</span> <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> err
compileScript(source, code.toString(), base)
<span class="hljs-keyword">else</span>
notSources[source] = <span class="hljs-literal">yes</span>
<span class="hljs-function">
<span class="hljs-title">findDirectoryIndex</span> = <span class="hljs-params">(source)</span> -&gt;</span>
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> CoffeeScript.FILE_EXTENSIONS
index = path.join source, <span class="hljs-string">"index<span class="hljs-subst">#{ext}</span>"</span>
<span class="hljs-keyword">try</span>
<span class="hljs-keyword">return</span> index <span class="hljs-keyword">if</span> (fs.statSync index).isFile()
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"Missing index.coffee or index.litcoffee in <span class="hljs-subst">#{source}</span>"</span>
process.exit <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Compile a single source script, containing the given code, according to the
requested options. If evaluating the script directly sets <code>__filename</code>,
<code>__dirname</code> and <code>module.filename</code> to be correct relative to the scripts path.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileScript</span> = <span class="hljs-params">(file, input, base = <span class="hljs-literal">null</span>)</span> -&gt;</span>
o = opts
options = compileOptions file, base
<span class="hljs-keyword">try</span>
t = task = {file, input, options}
CoffeeScript.emit <span class="hljs-string">'compile'</span>, task
<span class="hljs-keyword">if</span> o.tokens
printTokens CoffeeScript.tokens t.input, t.options
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.nodes
printLine CoffeeScript.nodes(t.input, t.options).toString().trim()
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.run
CoffeeScript.register()
CoffeeScript.eval opts.prelude, t.options <span class="hljs-keyword">if</span> opts.prelude
CoffeeScript.run t.input, t.options
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.join <span class="hljs-keyword">and</span> t.file <span class="hljs-keyword">isnt</span> o.join
t.input = helpers.invertLiterate t.input <span class="hljs-keyword">if</span> helpers.isLiterate file
sourceCode[sources.indexOf(t.file)] = t.input
compileJoin()
<span class="hljs-keyword">else</span>
compiled = CoffeeScript.compile t.input, t.options
t.output = compiled
<span class="hljs-keyword">if</span> o.map
t.output = compiled.js
t.sourceMap = compiled.v3SourceMap
CoffeeScript.emit <span class="hljs-string">'success'</span>, task
<span class="hljs-keyword">if</span> o.<span class="hljs-built_in">print</span>
printLine t.output.trim()
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.compile <span class="hljs-keyword">or</span> o.map
writeJs base, t.file, t.output, options.jsPath, t.sourceMap
<span class="hljs-keyword">catch</span> err
CoffeeScript.emit <span class="hljs-string">'failure'</span>, err, task
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> CoffeeScript.listeners(<span class="hljs-string">'failure'</span>).length
message = err?.stack <span class="hljs-keyword">or</span> <span class="hljs-string">"<span class="hljs-subst">#{err}</span>"</span>
<span class="hljs-keyword">if</span> o.watch
printLine message + <span class="hljs-string">'\x07'</span>
<span class="hljs-keyword">else</span>
printWarn message
process.exit <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Attach the appropriate listeners to compile scripts incoming over <strong>stdin</strong>,
and write them back to <strong>stdout</strong>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileStdio</span> = -&gt;</span>
buffers = []
stdin = process.openStdin()
stdin.<span class="hljs-literal">on</span> <span class="hljs-string">'data'</span>, <span class="hljs-function"><span class="hljs-params">(buffer)</span> -&gt;</span>
buffers.push buffer <span class="hljs-keyword">if</span> buffer
stdin.<span class="hljs-literal">on</span> <span class="hljs-string">'end'</span>, <span class="hljs-function">-&gt;</span>
compileScript <span class="hljs-literal">null</span>, Buffer.concat(buffers).toString()</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>If all of the source files are done being read, concatenate and compile
them together.</p>
</div>
<div class="content"><div class='highlight'><pre>joinTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function"><span class="hljs-title">compileJoin</span> = -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> opts.join
<span class="hljs-keyword">unless</span> sourceCode.some(<span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span> code <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span>)
clearTimeout joinTimeout
joinTimeout = wait <span class="hljs-number">100</span>, <span class="hljs-function">-&gt;</span>
compileScript opts.join, sourceCode.join(<span class="hljs-string">'\n'</span>), opts.join</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Watch a source CoffeeScript file using <code>fs.watch</code>, recompiling it every
time the file is updated. May be used in combination with other options,
such as <code>--print</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">watch</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
watcher = <span class="hljs-literal">null</span>
prevStats = <span class="hljs-literal">null</span>
compileTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">watchErr</span> = <span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> source <span class="hljs-keyword">in</span> sources
<span class="hljs-keyword">try</span>
rewatch()
compile()
<span class="hljs-keyword">catch</span>
removeSource source, base
compileJoin()
<span class="hljs-function">
<span class="hljs-title">compile</span> = -&gt;</span>
clearTimeout compileTimeout
compileTimeout = wait <span class="hljs-number">25</span>, <span class="hljs-function">-&gt;</span>
fs.stat source, <span class="hljs-function"><span class="hljs-params">(err, stats)</span> -&gt;</span>
<span class="hljs-keyword">return</span> watchErr err <span class="hljs-keyword">if</span> err
<span class="hljs-keyword">return</span> rewatch() <span class="hljs-keyword">if</span> prevStats <span class="hljs-keyword">and</span>
stats.size <span class="hljs-keyword">is</span> prevStats.size <span class="hljs-keyword">and</span>
stats.mtime.getTime() <span class="hljs-keyword">is</span> prevStats.mtime.getTime()
prevStats = stats
fs.readFile source, <span class="hljs-function"><span class="hljs-params">(err, code)</span> -&gt;</span>
<span class="hljs-keyword">return</span> watchErr err <span class="hljs-keyword">if</span> err
compileScript(source, code.toString(), base)
rewatch()
<span class="hljs-function">
<span class="hljs-title">startWatcher</span> = -&gt;</span>
watcher = fs.watch source
.<span class="hljs-literal">on</span> <span class="hljs-string">'change'</span>, compile
.<span class="hljs-literal">on</span> <span class="hljs-string">'error'</span>, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'EPERM'</span>
removeSource source, base
<span class="hljs-function">
<span class="hljs-title">rewatch</span> = -&gt;</span>
watcher?.close()
startWatcher()
<span class="hljs-keyword">try</span>
startWatcher()
<span class="hljs-keyword">catch</span> err
watchErr err</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Watch a directory of files for new additions.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">watchDir</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
watcher = <span class="hljs-literal">null</span>
readdirTimeout = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">startWatcher</span> = -&gt;</span>
watcher = fs.watch source
.<span class="hljs-literal">on</span> <span class="hljs-string">'error'</span>, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'EPERM'</span>
stopWatcher()
.<span class="hljs-literal">on</span> <span class="hljs-string">'change'</span>, <span class="hljs-function">-&gt;</span>
clearTimeout readdirTimeout
readdirTimeout = wait <span class="hljs-number">25</span>, <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">try</span>
files = fs.readdirSync source
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-keyword">return</span> stopWatcher()
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> files
compilePath (path.join source, file), <span class="hljs-literal">no</span>, base
<span class="hljs-function">
<span class="hljs-title">stopWatcher</span> = -&gt;</span>
watcher.close()
removeSourceDir source, base
watchedDirs[source] = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">try</span>
startWatcher()
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span>
<span class="hljs-function">
<span class="hljs-title">removeSourceDir</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
<span class="hljs-keyword">delete</span> watchedDirs[source]
sourcesChanged = <span class="hljs-literal">no</span>
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> sources <span class="hljs-keyword">when</span> source <span class="hljs-keyword">is</span> path.dirname file
removeSource file, base
sourcesChanged = <span class="hljs-literal">yes</span>
compileJoin() <span class="hljs-keyword">if</span> sourcesChanged</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Remove a file from our source list, and source code cache. Optionally remove
the compiled JS version as well.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">removeSource</span> = <span class="hljs-params">(source, base)</span> -&gt;</span>
index = sources.indexOf source
sources.splice index, <span class="hljs-number">1</span>
sourceCode.splice index, <span class="hljs-number">1</span>
<span class="hljs-keyword">unless</span> opts.join
silentUnlink outputPath source, base
silentUnlink outputPath source, base, <span class="hljs-string">'.js.map'</span>
timeLog <span class="hljs-string">"removed <span class="hljs-subst">#{source}</span>"</span>
<span class="hljs-function">
<span class="hljs-title">silentUnlink</span> = <span class="hljs-params">(path)</span> -&gt;</span>
<span class="hljs-keyword">try</span>
fs.unlinkSync path
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> err <span class="hljs-keyword">unless</span> err.code <span class="hljs-keyword">in</span> [<span class="hljs-string">'ENOENT'</span>, <span class="hljs-string">'EPERM'</span>]</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Get the corresponding output JavaScript path for a source file.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">outputPath</span> = <span class="hljs-params">(source, base, extension=<span class="hljs-string">".js"</span>)</span> -&gt;</span>
basename = helpers.baseFileName source, <span class="hljs-literal">yes</span>, useWinPathSep
srcDir = path.dirname source
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> opts.output
dir = srcDir
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> source <span class="hljs-keyword">is</span> base
dir = opts.output
<span class="hljs-keyword">else</span>
dir = path.join opts.output, path.relative base, srcDir
path.join dir, basename + extension</pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Recursively mkdir, like <code>mkdir -p</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">mkdirp</span> = <span class="hljs-params">(dir, fn)</span> -&gt;</span>
mode = <span class="hljs-number">0</span>o777 &amp; ~process.umask()
<span class="hljs-keyword">do</span> mkdirs = <span class="hljs-function"><span class="hljs-params">(p = dir, fn)</span> -&gt;</span>
fs.exists p, <span class="hljs-function"><span class="hljs-params">(exists)</span> -&gt;</span>
<span class="hljs-keyword">if</span> exists
fn()
<span class="hljs-keyword">else</span>
mkdirs path.dirname(p), <span class="hljs-function">-&gt;</span>
fs.mkdir p, mode, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">return</span> fn err <span class="hljs-keyword">if</span> err
fn()</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Write out a JavaScript source file with the compiled code. By default, files
are written out in <code>cwd</code> as <code>.js</code> files with the same name, but the output
directory can be customized with <code>--output</code>.</p>
<p>If <code>generatedSourceMap</code> is provided, this will write a <code>.js.map</code> file into the
same directory as the <code>.js</code> file.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">writeJs</span> = <span class="hljs-params">(base, sourcePath, js, jsPath, generatedSourceMap = <span class="hljs-literal">null</span>)</span> -&gt;</span>
sourceMapPath = outputPath sourcePath, base, <span class="hljs-string">".js.map"</span>
jsDir = path.dirname jsPath
<span class="hljs-function"> <span class="hljs-title">compile</span> = -&gt;</span>
<span class="hljs-keyword">if</span> opts.compile
js = <span class="hljs-string">' '</span> <span class="hljs-keyword">if</span> js.length &lt;= <span class="hljs-number">0</span>
<span class="hljs-keyword">if</span> generatedSourceMap <span class="hljs-keyword">then</span> js = <span class="hljs-string">"<span class="hljs-subst">#{js}</span>\n//# sourceMappingURL=<span class="hljs-subst">#{helpers.baseFileName sourceMapPath, <span class="hljs-literal">no</span>, useWinPathSep}</span>\n"</span>
fs.writeFile jsPath, js, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">if</span> err
printLine err.message
process.exit <span class="hljs-number">1</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.compile <span class="hljs-keyword">and</span> opts.watch
timeLog <span class="hljs-string">"compiled <span class="hljs-subst">#{sourcePath}</span>"</span>
<span class="hljs-keyword">if</span> generatedSourceMap
fs.writeFile sourceMapPath, generatedSourceMap, <span class="hljs-function"><span class="hljs-params">(err)</span> -&gt;</span>
<span class="hljs-keyword">if</span> err
printLine <span class="hljs-string">"Could not write source map: <span class="hljs-subst">#{err.message}</span>"</span>
process.exit <span class="hljs-number">1</span>
fs.exists jsDir, <span class="hljs-function"><span class="hljs-params">(itExists)</span> -&gt;</span>
<span class="hljs-keyword">if</span> itExists <span class="hljs-keyword">then</span> compile() <span class="hljs-keyword">else</span> mkdirp jsDir, compile</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Convenience for cleaner setTimeouts.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">wait</span> = <span class="hljs-params">(milliseconds, func)</span> -&gt;</span> setTimeout func, milliseconds</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>When watching scripts, its useful to log changes with the timestamp.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">timeLog</span> = <span class="hljs-params">(message)</span> -&gt;</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"<span class="hljs-subst">#{(<span class="hljs-keyword">new</span> Date).toLocaleTimeString()}</span> - <span class="hljs-subst">#{message}</span>"</span></pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Pretty-print a stream of tokens, sans location data.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">printTokens</span> = <span class="hljs-params">(tokens)</span> -&gt;</span>
strings = <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens
tag = token[<span class="hljs-number">0</span>]
value = token[<span class="hljs-number">1</span>].toString().replace(<span class="hljs-regexp">/\n/</span>, <span class="hljs-string">'\\n'</span>)
<span class="hljs-string">"[<span class="hljs-subst">#{tag}</span> <span class="hljs-subst">#{value}</span>]"</span>
printLine strings.join(<span class="hljs-string">' '</span>)</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Use the <a href="optparse.html">OptionParser module</a> to extract all options from
<code>process.argv</code> that are specified in <code>SWITCHES</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">parseOptions</span> = -&gt;</span>
optionParser = <span class="hljs-keyword">new</span> optparse.OptionParser SWITCHES, BANNER
o = opts = optionParser.parse process.argv[<span class="hljs-number">2.</span>.]
o.compile <span class="hljs-keyword">or</span>= !!o.output
o.run = <span class="hljs-keyword">not</span> (o.compile <span class="hljs-keyword">or</span> o.<span class="hljs-built_in">print</span> <span class="hljs-keyword">or</span> o.map)
o.<span class="hljs-built_in">print</span> = !! (o.<span class="hljs-built_in">print</span> <span class="hljs-keyword">or</span> (o.eval <span class="hljs-keyword">or</span> o.stdio <span class="hljs-keyword">and</span> o.compile))</pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>The compile-time options to pass to the CoffeeScript compiler.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileOptions</span> = <span class="hljs-params">(filename, base)</span> -&gt;</span>
answer = {
filename
literate: opts.literate <span class="hljs-keyword">or</span> helpers.isLiterate(filename)
bare: opts.bare
header: opts.compile <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> opts[<span class="hljs-string">'no-header'</span>]
sourceMap: opts.map
inlineMap: opts[<span class="hljs-string">'inline-map'</span>]
}
<span class="hljs-keyword">if</span> filename
<span class="hljs-keyword">if</span> base
cwd = process.cwd()
jsPath = outputPath filename, base
jsDir = path.dirname jsPath
answer = helpers.merge answer, {
jsPath
sourceRoot: path.relative jsDir, cwd
sourceFiles: [path.relative cwd, filename]
generatedFile: helpers.baseFileName(jsPath, <span class="hljs-literal">no</span>, useWinPathSep)
}
<span class="hljs-keyword">else</span>
answer = helpers.merge answer,
sourceRoot: <span class="hljs-string">""</span>
sourceFiles: [helpers.baseFileName filename, <span class="hljs-literal">no</span>, useWinPathSep]
generatedFile: helpers.baseFileName(filename, <span class="hljs-literal">yes</span>, useWinPathSep) + <span class="hljs-string">".js"</span>
answer</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
the <code>node</code> binary, preserving the other options.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">forkNode</span> = -&gt;</span>
nodeArgs = opts.nodejs.split <span class="hljs-regexp">/\s+/</span>
args = process.argv[<span class="hljs-number">1.</span>.]
args.splice args.indexOf(<span class="hljs-string">'--nodejs'</span>), <span class="hljs-number">2</span>
p = spawn process.execPath, nodeArgs.concat(args),
cwd: process.cwd()
env: process.env
stdio: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
p.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span> process.exit code</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Print the <code>--help</code> usage message and exit. Deprecated switches are not
shown.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">usage</span> = -&gt;</span>
printLine (<span class="hljs-keyword">new</span> optparse.OptionParser SWITCHES, BANNER).help()</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Print the <code>--version</code> message and exit.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">version</span> = -&gt;</span>
printLine <span class="hljs-string">"CoffeeScript version <span class="hljs-subst">#{CoffeeScript.VERSION}</span>"</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,518 @@
/*--------------------- Typography ----------------------------*/
@font-face {
font-family: 'aller-light';
src: url('public/fonts/aller-light.eot');
src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'),
url('public/fonts/aller-light.woff') format('woff'),
url('public/fonts/aller-light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'aller-bold';
src: url('public/fonts/aller-bold.eot');
src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'),
url('public/fonts/aller-bold.woff') format('woff'),
url('public/fonts/aller-bold.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'roboto-black';
src: url('public/fonts/roboto-black.eot');
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
url('public/fonts/roboto-black.woff') format('woff'),
url('public/fonts/roboto-black.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/*--------------------- Layout ----------------------------*/
html { height: 100%; }
body {
font-family: "aller-light";
font-size: 14px;
line-height: 18px;
color: #30404f;
margin: 0; padding: 0;
height:100%;
}
#container { min-height: 100%; }
a {
color: #000;
}
b, strong {
font-weight: normal;
font-family: "aller-bold";
}
p {
margin: 15px 0 0px;
}
.annotation ul, .annotation ol {
margin: 25px 0;
}
.annotation ul li, .annotation ol li {
font-size: 14px;
line-height: 18px;
margin: 10px 0;
}
h1, h2, h3, h4, h5, h6 {
color: #112233;
line-height: 1em;
font-weight: normal;
font-family: "roboto-black";
text-transform: uppercase;
margin: 30px 0 15px 0;
}
h1 {
margin-top: 40px;
}
h2 {
font-size: 1.26em;
}
hr {
border: 0;
background: 1px #ddd;
height: 1px;
margin: 20px 0;
}
pre, tt, code {
font-size: 12px; line-height: 16px;
font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
margin: 0; padding: 0;
}
.annotation pre {
display: block;
margin: 0;
padding: 7px 10px;
background: #fcfcfc;
-moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
overflow-x: auto;
}
.annotation pre code {
border: 0;
padding: 0;
background: transparent;
}
blockquote {
border-left: 5px solid #ccc;
margin: 0;
padding: 1px 0 1px 1em;
}
.sections blockquote p {
font-family: Menlo, Consolas, Monaco, monospace;
font-size: 12px; line-height: 16px;
color: #999;
margin: 10px 0 0;
white-space: pre-wrap;
}
ul.sections {
list-style: none;
padding:0 0 5px 0;;
margin:0;
}
/*
Force border-box so that % widths fit the parent
container without overlap because of margin/padding.
More Info : http://www.quirksmode.org/css/box.html
*/
ul.sections > li > div {
-moz-box-sizing: border-box; /* firefox */
-ms-box-sizing: border-box; /* ie */
-webkit-box-sizing: border-box; /* webkit */
-khtml-box-sizing: border-box; /* konqueror */
box-sizing: border-box; /* css3 */
}
/*---------------------- Jump Page -----------------------------*/
#jump_to, #jump_page {
margin: 0;
background: white;
-webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
-webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
font: 16px Arial;
cursor: pointer;
text-align: right;
list-style: none;
}
#jump_to a {
text-decoration: none;
}
#jump_to a.large {
display: none;
}
#jump_to a.small {
font-size: 22px;
font-weight: bold;
color: #676767;
}
#jump_to, #jump_wrapper {
position: fixed;
right: 0; top: 0;
padding: 10px 15px;
margin:0;
}
#jump_wrapper {
display: none;
padding:0;
}
#jump_to:hover #jump_wrapper {
display: block;
}
#jump_page_wrapper{
position: fixed;
right: 0;
top: 0;
bottom: 0;
}
#jump_page {
padding: 5px 0 3px;
margin: 0 0 25px 25px;
max-height: 100%;
overflow: auto;
}
#jump_page .source {
display: block;
padding: 15px;
text-decoration: none;
border-top: 1px solid #eee;
}
#jump_page .source:hover {
background: #f5f5ff;
}
#jump_page .source:first-child {
}
/*---------------------- Low resolutions (> 320px) ---------------------*/
@media only screen and (min-width: 320px) {
.pilwrap { display: none; }
ul.sections > li > div {
display: block;
padding:5px 10px 0 10px;
}
ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
padding-left: 30px;
}
ul.sections > li > div.content {
overflow-x:auto;
-webkit-box-shadow: inset 0 0 5px #e5e5ee;
box-shadow: inset 0 0 5px #e5e5ee;
border: 1px solid #dedede;
margin:5px 10px 5px 10px;
padding-bottom: 5px;
}
ul.sections > li > div.annotation pre {
margin: 7px 0 7px;
padding-left: 15px;
}
ul.sections > li > div.annotation p tt, .annotation code {
background: #f8f8ff;
border: 1px solid #dedede;
font-size: 12px;
padding: 0 0.2em;
}
}
/*---------------------- (> 481px) ---------------------*/
@media only screen and (min-width: 481px) {
#container {
position: relative;
}
body {
background-color: #F5F5FF;
font-size: 15px;
line-height: 21px;
}
pre, tt, code {
line-height: 18px;
}
p, ul, ol {
margin: 0 0 15px;
}
#jump_to {
padding: 5px 10px;
}
#jump_wrapper {
padding: 0;
}
#jump_to, #jump_page {
font: 10px Arial;
text-transform: uppercase;
}
#jump_page .source {
padding: 5px 10px;
}
#jump_to a.large {
display: inline-block;
}
#jump_to a.small {
display: none;
}
#background {
position: absolute;
top: 0; bottom: 0;
width: 350px;
background: #fff;
border-right: 1px solid #e5e5ee;
z-index: -1;
}
ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
padding-left: 40px;
}
ul.sections > li {
white-space: nowrap;
}
ul.sections > li > div {
display: inline-block;
}
ul.sections > li > div.annotation {
max-width: 350px;
min-width: 350px;
min-height: 5px;
padding: 13px;
overflow-x: hidden;
white-space: normal;
vertical-align: top;
text-align: left;
}
ul.sections > li > div.annotation pre {
margin: 15px 0 15px;
padding-left: 15px;
}
ul.sections > li > div.content {
padding: 13px;
vertical-align: top;
border: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.pilwrap {
position: relative;
display: inline;
}
.pilcrow {
font: 12px Arial;
text-decoration: none;
color: #454545;
position: absolute;
top: 3px; left: -20px;
padding: 1px 2px;
opacity: 0;
-webkit-transition: opacity 0.2s linear;
}
.for-h1 .pilcrow {
top: 47px;
}
.for-h2 .pilcrow, .for-h3 .pilcrow, .for-h4 .pilcrow {
top: 35px;
}
ul.sections > li > div.annotation:hover .pilcrow {
opacity: 1;
}
}
/*---------------------- (> 1025px) ---------------------*/
@media only screen and (min-width: 1025px) {
body {
font-size: 16px;
line-height: 24px;
}
#background {
width: 525px;
}
ul.sections > li > div.annotation {
max-width: 525px;
min-width: 525px;
padding: 10px 25px 1px 50px;
}
ul.sections > li > div.content {
padding: 9px 15px 16px 25px;
}
}
/*---------------------- Syntax Highlighting -----------------------------*/
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
pre code {
display: block; padding: 0.5em;
color: #000;
background: #f8f8ff
}
pre .hljs-comment,
pre .hljs-template_comment,
pre .hljs-diff .hljs-header,
pre .hljs-javadoc {
color: #408080;
font-style: italic
}
pre .hljs-keyword,
pre .hljs-assignment,
pre .hljs-literal,
pre .hljs-css .hljs-rule .hljs-keyword,
pre .hljs-winutils,
pre .hljs-javascript .hljs-title,
pre .hljs-lisp .hljs-title,
pre .hljs-subst {
color: #954121;
/*font-weight: bold*/
}
pre .hljs-number,
pre .hljs-hexcolor {
color: #40a070
}
pre .hljs-string,
pre .hljs-tag .hljs-value,
pre .hljs-phpdoc,
pre .hljs-tex .hljs-formula {
color: #219161;
}
pre .hljs-title,
pre .hljs-id {
color: #19469D;
}
pre .hljs-params {
color: #00F;
}
pre .hljs-javascript .hljs-title,
pre .hljs-lisp .hljs-title,
pre .hljs-subst {
font-weight: normal
}
pre .hljs-class .hljs-title,
pre .hljs-haskell .hljs-label,
pre .hljs-tex .hljs-command {
color: #458;
font-weight: bold
}
pre .hljs-tag,
pre .hljs-tag .hljs-title,
pre .hljs-rules .hljs-property,
pre .hljs-django .hljs-tag .hljs-keyword {
color: #000080;
font-weight: normal
}
pre .hljs-attribute,
pre .hljs-variable,
pre .hljs-instancevar,
pre .hljs-lisp .hljs-body {
color: #008080
}
pre .hljs-regexp {
color: #B68
}
pre .hljs-class {
color: #458;
font-weight: bold
}
pre .hljs-symbol,
pre .hljs-ruby .hljs-symbol .hljs-string,
pre .hljs-ruby .hljs-symbol .hljs-keyword,
pre .hljs-ruby .hljs-symbol .hljs-keymethods,
pre .hljs-lisp .hljs-keyword,
pre .hljs-tex .hljs-special,
pre .hljs-input_number {
color: #990073
}
pre .hljs-builtin,
pre .hljs-constructor,
pre .hljs-built_in,
pre .hljs-lisp .hljs-title {
color: #0086b3
}
pre .hljs-preprocessor,
pre .hljs-pi,
pre .hljs-doctype,
pre .hljs-shebang,
pre .hljs-cdata {
color: #999;
font-weight: bold
}
pre .hljs-deletion {
background: #fdd
}
pre .hljs-addition {
background: #dfd
}
pre .hljs-diff .hljs-change {
background: #0086b3
}
pre .hljs-chunk {
color: #aaa
}
pre .hljs-tex .hljs-formula {
opacity: 0.5;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,628 @@
<!DOCTYPE html>
<html>
<head>
<title>helpers.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>helpers.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>This file contains the common helper functions that wed like to share among
the <strong>Lexer</strong>, <strong>Rewriter</strong>, and the <strong>Nodes</strong>. Merge objects, flatten
arrays, count characters, that sort of thing.</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Peek at the beginning of a given string to see if it matches a sequence.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.starts = <span class="hljs-function"><span class="hljs-params">(string, literal, start)</span> -&gt;</span>
literal <span class="hljs-keyword">is</span> string.substr start, literal.length</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Peek at the end of a given string to see if it matches a sequence.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.ends = <span class="hljs-function"><span class="hljs-params">(string, literal, back)</span> -&gt;</span>
len = literal.length
literal <span class="hljs-keyword">is</span> string.substr string.length - len - (back <span class="hljs-keyword">or</span> <span class="hljs-number">0</span>), len</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Repeat a string <code>n</code> times.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.repeat = repeat = <span class="hljs-function"><span class="hljs-params">(str, n)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Use clever algorithm to have O(log(n)) string concatenation operations.</p>
</div>
<div class="content"><div class='highlight'><pre> res = <span class="hljs-string">''</span>
<span class="hljs-keyword">while</span> n &gt; <span class="hljs-number">0</span>
res += str <span class="hljs-keyword">if</span> n &amp; <span class="hljs-number">1</span>
n &gt;&gt;&gt;= <span class="hljs-number">1</span>
str += str
res</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Trim out all falsy values from an array.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.compact = <span class="hljs-function"><span class="hljs-params">(array)</span> -&gt;</span>
item <span class="hljs-keyword">for</span> item <span class="hljs-keyword">in</span> array <span class="hljs-keyword">when</span> item</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Count the number of occurrences of a string in a string.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.count = <span class="hljs-function"><span class="hljs-params">(string, substr)</span> -&gt;</span>
num = pos = <span class="hljs-number">0</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>/<span class="hljs-number">0</span> <span class="hljs-keyword">unless</span> substr.length
num++ <span class="hljs-keyword">while</span> pos = <span class="hljs-number">1</span> + string.indexOf substr, pos
num</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Merge objects, returning a fresh copy with attributes from both sides.
Used every time <code>Base#compile</code> is called, to allow properties in the
options hash to propagate down the tree without polluting other branches.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.merge = <span class="hljs-function"><span class="hljs-params">(options, overrides)</span> -&gt;</span>
extend (extend {}, options), overrides</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Extend a source object with the properties of another object (shallow copy).</p>
</div>
<div class="content"><div class='highlight'><pre>extend = exports.extend = <span class="hljs-function"><span class="hljs-params">(object, properties)</span> -&gt;</span>
<span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">of</span> properties
object[key] = val
object</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Return a flattened version of an array.
Handy for getting a list of <code>children</code> from the nodes.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.flatten = flatten = <span class="hljs-function"><span class="hljs-params">(array)</span> -&gt;</span>
flattened = []
<span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> array
<span class="hljs-keyword">if</span> <span class="hljs-string">'[object Array]'</span> <span class="hljs-keyword">is</span> Object::toString.call element
flattened = flattened.concat flatten element
<span class="hljs-keyword">else</span>
flattened.push element
flattened</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Delete a key from an object, returning the value. Useful when a node is
looking for a particular method in an options hash.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.del = <span class="hljs-function"><span class="hljs-params">(obj, key)</span> -&gt;</span>
val = obj[key]
<span class="hljs-keyword">delete</span> obj[key]
val</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Typical Array::some</p>
</div>
<div class="content"><div class='highlight'><pre>exports.some = Array::some ? (fn) -&gt;
<span class="hljs-keyword">return</span> <span class="hljs-literal">true</span> <span class="hljs-keyword">for</span> e <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> <span class="hljs-keyword">when</span> fn e
<span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Helper function for extracting code from Literate CoffeeScript by stripping
out all non-code blocks, producing a string of CoffeeScript code that can
be compiled “normally.”</p>
</div>
<div class="content"><div class='highlight'><pre>exports.invertLiterate = <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span>
out = []
blankLine = <span class="hljs-regexp">/^\s*$/</span>
indented = <span class="hljs-regexp">/^[\t ]/</span>
listItemStart = <span class="hljs-regexp">/// ^
(?:\t?|\ {0,3}) <span class="hljs-comment"># Up to one tab, or up to three spaces, or neither;</span>
(?:
[\*\-\+] | <span class="hljs-comment"># followed by `*`, `-` or `+`;</span>
[0-9]{1,9}\. <span class="hljs-comment"># or by an integer up to 9 digits long, followed by a period;</span>
)
[\ \t] <span class="hljs-comment"># followed by a space or a tab.</span>
///</span>
insideComment = <span class="hljs-literal">no</span>
<span class="hljs-keyword">for</span> line <span class="hljs-keyword">in</span> code.split(<span class="hljs-string">'\n'</span>)
<span class="hljs-keyword">if</span> blankLine.test(line)
insideComment = <span class="hljs-literal">no</span>
out.push line
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> insideComment <span class="hljs-keyword">or</span> listItemStart.test(line)
insideComment = <span class="hljs-literal">yes</span>
out.push <span class="hljs-string">"# <span class="hljs-subst">#{line}</span>"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> insideComment <span class="hljs-keyword">and</span> indented.test(line)
out.push line
<span class="hljs-keyword">else</span>
insideComment = <span class="hljs-literal">yes</span>
out.push <span class="hljs-string">"# <span class="hljs-subst">#{line}</span>"</span>
out.join <span class="hljs-string">'\n'</span></pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Merge two jison-style location data objects together.
If <code>last</code> is not provided, this will simply return <code>first</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildLocationData</span> = <span class="hljs-params">(first, last)</span> -&gt;</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> last
first
<span class="hljs-keyword">else</span>
first_line: first.first_line
first_column: first.first_column
last_line: last.last_line
last_column: last.last_column</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>This returns a function which takes an object as a parameter, and if that
object is an AST node, updates that objects locationData.
The object is returned either way.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.addLocationDataFn = <span class="hljs-function"><span class="hljs-params">(first, last)</span> -&gt;</span>
(obj) -&gt;
<span class="hljs-keyword">if</span> ((<span class="hljs-keyword">typeof</span> obj) <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>) <span class="hljs-keyword">and</span> (!!obj[<span class="hljs-string">'updateLocationDataIfMissing'</span>])
obj.updateLocationDataIfMissing buildLocationData(first, last)
<span class="hljs-keyword">return</span> obj</pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Convert jison location data to a string.
<code>obj</code> can be a token, or a locationData.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.locationDataToString = <span class="hljs-function"><span class="hljs-params">(obj)</span> -&gt;</span>
<span class="hljs-keyword">if</span> (<span class="hljs-string">"2"</span> <span class="hljs-keyword">of</span> obj) <span class="hljs-keyword">and</span> (<span class="hljs-string">"first_line"</span> <span class="hljs-keyword">of</span> obj[<span class="hljs-number">2</span>]) <span class="hljs-keyword">then</span> locationData = obj[<span class="hljs-number">2</span>]
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-string">"first_line"</span> <span class="hljs-keyword">of</span> obj <span class="hljs-keyword">then</span> locationData = obj
<span class="hljs-keyword">if</span> locationData
<span class="hljs-string">"<span class="hljs-subst">#{locationData.first_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{locationData.first_column + <span class="hljs-number">1</span>}</span>-"</span> +
<span class="hljs-string">"<span class="hljs-subst">#{locationData.last_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{locationData.last_column + <span class="hljs-number">1</span>}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"No location data"</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>A <code>.coffee.md</code> compatible version of <code>basename</code>, that returns the file sans-extension.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.baseFileName = <span class="hljs-function"><span class="hljs-params">(file, stripExt = <span class="hljs-literal">no</span>, useWinPathSep = <span class="hljs-literal">no</span>)</span> -&gt;</span>
pathSep = <span class="hljs-keyword">if</span> useWinPathSep <span class="hljs-keyword">then</span> <span class="hljs-regexp">/\\|\//</span> <span class="hljs-keyword">else</span> <span class="hljs-regexp">/\//</span>
parts = file.split(pathSep)
file = parts[parts.length - <span class="hljs-number">1</span>]
<span class="hljs-keyword">return</span> file <span class="hljs-keyword">unless</span> stripExt <span class="hljs-keyword">and</span> file.indexOf(<span class="hljs-string">'.'</span>) &gt;= <span class="hljs-number">0</span>
parts = file.split(<span class="hljs-string">'.'</span>)
parts.pop()
parts.pop() <span class="hljs-keyword">if</span> parts[parts.length - <span class="hljs-number">1</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'coffee'</span> <span class="hljs-keyword">and</span> parts.length &gt; <span class="hljs-number">1</span>
parts.join(<span class="hljs-string">'.'</span>)</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Determine if a filename represents a CoffeeScript file.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.isCoffee = <span class="hljs-function"><span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.((lit)?coffee|coffee\.md)$/</span>.test file</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.isLiterate = <span class="hljs-function"><span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.(litcoffee|coffee\.md)$/</span>.test file</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Throws a SyntaxError from a given location.
The errors <code>toString</code> will return an error message following the “standard”
format <code>&lt;filename&gt;:&lt;line&gt;:&lt;col&gt;: &lt;message&gt;</code> plus the line with the error and a
marker showing where the error is.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.throwSyntaxError = <span class="hljs-function"><span class="hljs-params">(message, location)</span> -&gt;</span>
error = <span class="hljs-keyword">new</span> SyntaxError message
error.location = location
error.toString = syntaxErrorToString</pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Instead of showing the compilers stacktrace, show our custom error message
(this is useful when the error bubbles up in Node.js applications that
compile CoffeeScript for example).</p>
</div>
<div class="content"><div class='highlight'><pre> error.stack = error.toString()
<span class="hljs-keyword">throw</span> error</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Update a compiler SyntaxError with source code information if it didnt have
it already.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.updateSyntaxError = <span class="hljs-function"><span class="hljs-params">(error, code, filename)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Avoid screwing up the <code>stack</code> property of other errors (i.e. possible bugs).</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> error.toString <span class="hljs-keyword">is</span> syntaxErrorToString
error.code <span class="hljs-keyword">or</span>= code
error.filename <span class="hljs-keyword">or</span>= filename
error.stack = error.toString()
error
<span class="hljs-function">
<span class="hljs-title">syntaxErrorToString</span> = -&gt;</span>
<span class="hljs-keyword">return</span> Error::toString.call @ <span class="hljs-keyword">unless</span> @code <span class="hljs-keyword">and</span> @location
{first_line, first_column, last_line, last_column} = @location
last_line ?= first_line
last_column ?= first_column
filename = @filename <span class="hljs-keyword">or</span> <span class="hljs-string">'[stdin]'</span>
codeLine = @code.split(<span class="hljs-string">'\n'</span>)[first_line]
start = first_column</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Show only the first line on multi-line errors.</p>
</div>
<div class="content"><div class='highlight'><pre> end = <span class="hljs-keyword">if</span> first_line <span class="hljs-keyword">is</span> last_line <span class="hljs-keyword">then</span> last_column + <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> codeLine.length
marker = codeLine[...start].replace(<span class="hljs-regexp">/[^\s]/g</span>, <span class="hljs-string">' '</span>) + repeat(<span class="hljs-string">'^'</span>, end - start)</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Check to see if were running on a color-enabled TTY.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> process?
colorsEnabled = process.stdout?.isTTY <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> process.env?.NODE_DISABLE_COLORS
<span class="hljs-keyword">if</span> @colorful ? colorsEnabled
<span class="hljs-function"> <span class="hljs-title">colorize</span> = <span class="hljs-params">(str)</span> -&gt;</span> <span class="hljs-string">"\x1B[1;31m<span class="hljs-subst">#{str}</span>\x1B[0m"</span>
codeLine = codeLine[...start] + colorize(codeLine[start...end]) + codeLine[end..]
marker = colorize marker
<span class="hljs-string">"""
<span class="hljs-subst">#{filename}</span>:<span class="hljs-subst">#{first_line + <span class="hljs-number">1</span>}</span>:<span class="hljs-subst">#{first_column + <span class="hljs-number">1</span>}</span>: error: <span class="hljs-subst">#{@message}</span>
<span class="hljs-subst">#{codeLine}</span>
<span class="hljs-subst">#{marker}</span>
"""</span>
exports.nameWhitespaceCharacter = <span class="hljs-function"><span class="hljs-params">(string)</span> -&gt;</span>
<span class="hljs-keyword">switch</span> string
<span class="hljs-keyword">when</span> <span class="hljs-string">' '</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'space'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\n'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'newline'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\r'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'carriage return'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'\t'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'tab'</span>
<span class="hljs-keyword">else</span> string</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,369 @@
<!DOCTYPE html>
<html>
<head>
<title>index.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>index.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Node.js Implementation</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffeescript'</span>
fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
vm = <span class="hljs-built_in">require</span> <span class="hljs-string">'vm'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
helpers = CoffeeScript.helpers
compile = CoffeeScript.compile</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Compile and execute a string of CoffeeScript (on the server), correctly
setting <code>__filename</code>, <code>__dirname</code>, and relative <code>require()</code>.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.run = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
mainModule = <span class="hljs-built_in">require</span>.main</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Set the filename.</p>
</div>
<div class="content"><div class='highlight'><pre> mainModule.filename = process.argv[<span class="hljs-number">1</span>] =
<span class="hljs-keyword">if</span> options.filename <span class="hljs-keyword">then</span> fs.realpathSync(options.filename) <span class="hljs-keyword">else</span> <span class="hljs-string">'&lt;anonymous&gt;'</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Clear the module cache.</p>
</div>
<div class="content"><div class='highlight'><pre> mainModule.moduleCache <span class="hljs-keyword">and</span>= {}</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Assign paths for node_modules loading</p>
</div>
<div class="content"><div class='highlight'><pre> dir = <span class="hljs-keyword">if</span> options.filename?
path.dirname fs.realpathSync options.filename
<span class="hljs-keyword">else</span>
fs.realpathSync <span class="hljs-string">'.'</span>
mainModule.paths = <span class="hljs-built_in">require</span>(<span class="hljs-string">'module'</span>)._nodeModulePaths dir</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Compile.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> helpers.isCoffee(mainModule.filename) <span class="hljs-keyword">or</span> <span class="hljs-built_in">require</span>.extensions
answer = compile code, options
code = answer.js ? answer
mainModule._compile code, mainModule.filename</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
The CoffeeScript REPL uses this to run the input.</p>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.eval = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> code = code.trim()
createContext = vm.Script.createContext ? vm.createContext
isContext = vm.isContext ? (ctx) -&gt;
options.sandbox <span class="hljs-keyword">instanceof</span> createContext().constructor
<span class="hljs-keyword">if</span> createContext
<span class="hljs-keyword">if</span> options.sandbox?
<span class="hljs-keyword">if</span> isContext options.sandbox
sandbox = options.sandbox
<span class="hljs-keyword">else</span>
sandbox = createContext()
sandbox[k] = v <span class="hljs-keyword">for</span> own k, v <span class="hljs-keyword">of</span> options.sandbox
sandbox.<span class="hljs-built_in">global</span> = sandbox.root = sandbox.GLOBAL = sandbox
<span class="hljs-keyword">else</span>
sandbox = <span class="hljs-built_in">global</span>
sandbox.__filename = options.filename || <span class="hljs-string">'eval'</span>
sandbox.__dirname = path.dirname sandbox.__filename</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>define module/require only if they chose not to specify their own</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> sandbox <span class="hljs-keyword">isnt</span> <span class="hljs-built_in">global</span> <span class="hljs-keyword">or</span> sandbox.<span class="hljs-built_in">module</span> <span class="hljs-keyword">or</span> sandbox.<span class="hljs-built_in">require</span>
Module = <span class="hljs-built_in">require</span> <span class="hljs-string">'module'</span>
sandbox.<span class="hljs-built_in">module</span> = _module = <span class="hljs-keyword">new</span> Module(options.modulename || <span class="hljs-string">'eval'</span>)
sandbox.<span class="hljs-built_in">require</span> = _require = <span class="hljs-function"><span class="hljs-params">(path)</span> -&gt;</span> Module._load path, _module, <span class="hljs-literal">true</span>
_module.filename = sandbox.__filename
<span class="hljs-keyword">for</span> r <span class="hljs-keyword">in</span> Object.getOwnPropertyNames <span class="hljs-built_in">require</span> <span class="hljs-keyword">when</span> r <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> [<span class="hljs-string">'paths'</span>, <span class="hljs-string">'arguments'</span>, <span class="hljs-string">'caller'</span>]
_require[r] = <span class="hljs-built_in">require</span>[r]</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>use the same hack node currently uses for their own REPL</p>
</div>
<div class="content"><div class='highlight'><pre> _require.paths = _module.paths = Module._nodeModulePaths process.cwd()
_require.resolve = <span class="hljs-function"><span class="hljs-params">(request)</span> -&gt;</span> Module._resolveFilename request, _module
o = {}
o[k] = v <span class="hljs-keyword">for</span> own k, v <span class="hljs-keyword">of</span> options
o.bare = <span class="hljs-literal">on</span> <span class="hljs-comment"># ensure return value</span>
js = compile code, o
<span class="hljs-keyword">if</span> sandbox <span class="hljs-keyword">is</span> <span class="hljs-built_in">global</span>
vm.runInThisContext js
<span class="hljs-keyword">else</span>
vm.runInContext js, sandbox
CoffeeScript.register = <span class="hljs-function">-&gt;</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./register'</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Throw error with deprecation warning when depending upon implicit <code>require.extensions</code> registration</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.extensions
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> CoffeeScript.FILE_EXTENSIONS <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span> (ext) -&gt;
<span class="hljs-built_in">require</span>.extensions[ext] ?= <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"""
Use CoffeeScript.register() or require the coffeescript/register module to require <span class="hljs-subst">#{ext}</span> files.
"""</span>
CoffeeScript._compileFile = <span class="hljs-function"><span class="hljs-params">(filename, sourceMap = <span class="hljs-literal">no</span>, inlineMap = <span class="hljs-literal">no</span>)</span> -&gt;</span>
raw = fs.readFileSync filename, <span class="hljs-string">'utf8'</span></pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Strip the Unicode byte order mark, if this file begins with one.</p>
</div>
<div class="content"><div class='highlight'><pre> stripped = <span class="hljs-keyword">if</span> raw.charCodeAt(<span class="hljs-number">0</span>) <span class="hljs-keyword">is</span> <span class="hljs-number">0xFEFF</span> <span class="hljs-keyword">then</span> raw.substring <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> raw
<span class="hljs-keyword">try</span>
answer = compile stripped, {
filename, sourceMap, inlineMap
sourceFiles: [filename]
literate: helpers.isLiterate filename
}
<span class="hljs-keyword">catch</span> err</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>As the filename and code of a dynamically loaded file will be different
from the original file compiled with CoffeeScript.run, add that
information to error so it can be pretty-printed later.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">throw</span> helpers.updateSyntaxError err, stripped, filename
answer
<span class="hljs-built_in">module</span>.exports = CoffeeScript</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,366 @@
<!DOCTYPE html>
<html>
<head>
<title>optparse.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>optparse.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>{repeat} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>A simple <strong>OptionParser</strong> class to parse option flags from the command-line.
Use it like so:</p>
<pre><code>parser = <span class="hljs-keyword">new</span> OptionParser switches, helpBanner
options = parser.parse process.argv
</code></pre><p>The first non-option is considered to be the start of the file (and file
option) list, and all subsequent arguments are left unparsed.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.OptionParser = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OptionParser</span></span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Initialize with a list of valid options, in the form:</p>
<pre><code>[short-flag, long-flag, description]
</code></pre><p>Along with an optional banner for the usage help.</p>
</div>
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(rules, @banner)</span> -&gt;</span>
@rules = buildRules rules</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Parse the list of arguments, populating an <code>options</code> object with all of the
specified options, and return it. Options after the first non-option
argument are treated as arguments. <code>options.arguments</code> will be an array
containing the remaining arguments. This is a simpler API than many option
parsers that allow you to attach callback actions for every flag. Instead,
youre responsible for interpreting the options object.</p>
</div>
<div class="content"><div class='highlight'><pre> parse: <span class="hljs-function"><span class="hljs-params">(args)</span> -&gt;</span>
options = arguments: []
skippingArgument = <span class="hljs-literal">no</span>
originalArgs = args
args = normalizeArguments args
<span class="hljs-keyword">for</span> arg, i <span class="hljs-keyword">in</span> args
<span class="hljs-keyword">if</span> skippingArgument
skippingArgument = <span class="hljs-literal">no</span>
<span class="hljs-keyword">continue</span>
<span class="hljs-keyword">if</span> arg <span class="hljs-keyword">is</span> <span class="hljs-string">'--'</span>
pos = originalArgs.indexOf <span class="hljs-string">'--'</span>
options.arguments = options.arguments.concat originalArgs[(pos + <span class="hljs-number">1</span>)..]
<span class="hljs-keyword">break</span>
isOption = !!(arg.match(LONG_FLAG) <span class="hljs-keyword">or</span> arg.match(SHORT_FLAG))</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>the CS option parser is a little odd; options after the first
non-option argument are treated as non-option arguments themselves</p>
</div>
<div class="content"><div class='highlight'><pre> seenNonOptionArg = options.arguments.length &gt; <span class="hljs-number">0</span>
<span class="hljs-keyword">unless</span> seenNonOptionArg
matchedRule = <span class="hljs-literal">no</span>
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
<span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">is</span> arg <span class="hljs-keyword">or</span> rule.longFlag <span class="hljs-keyword">is</span> arg
value = <span class="hljs-literal">true</span>
<span class="hljs-keyword">if</span> rule.hasArgument
skippingArgument = <span class="hljs-literal">yes</span>
value = args[i + <span class="hljs-number">1</span>]
options[rule.name] = <span class="hljs-keyword">if</span> rule.isList <span class="hljs-keyword">then</span> (options[rule.name] <span class="hljs-keyword">or</span> []).concat value <span class="hljs-keyword">else</span> value
matchedRule = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">break</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"unrecognized option: <span class="hljs-subst">#{arg}</span>"</span> <span class="hljs-keyword">if</span> isOption <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> matchedRule
<span class="hljs-keyword">if</span> seenNonOptionArg <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> isOption
options.arguments.push arg
options</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
of the valid options, for <code>--help</code> and such.</p>
</div>
<div class="content"><div class='highlight'><pre> help: <span class="hljs-function">-&gt;</span>
lines = []
lines.unshift <span class="hljs-string">"<span class="hljs-subst">#{@banner}</span>\n"</span> <span class="hljs-keyword">if</span> @banner
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
spaces = <span class="hljs-number">15</span> - rule.longFlag.length
spaces = <span class="hljs-keyword">if</span> spaces &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> repeat <span class="hljs-string">' '</span>, spaces <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
letPart = <span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">then</span> rule.shortFlag + <span class="hljs-string">', '</span> <span class="hljs-keyword">else</span> <span class="hljs-string">' '</span>
lines.push <span class="hljs-string">' '</span> + letPart + rule.longFlag + spaces + rule.description
<span class="hljs-string">"\n<span class="hljs-subst">#{ lines.join(<span class="hljs-string">'\n'</span>) }</span>\n"</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<h2 id="helpers">Helpers</h2>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
</div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Regex matchers for option flags.</p>
</div>
<div class="content"><div class='highlight'><pre>LONG_FLAG = <span class="hljs-regexp">/^(--\w[\w\-]*)/</span>
SHORT_FLAG = <span class="hljs-regexp">/^(-\w)$/</span>
MULTI_FLAG = <span class="hljs-regexp">/^-(\w{2,})/</span>
OPTIONAL = <span class="hljs-regexp">/\[(\w+(\*?))\]/</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Build and return the list of option rules. If the optional <em>short-flag</em> is
unspecified, leave it out by padding with <code>null</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRules</span> = <span class="hljs-params">(rules)</span> -&gt;</span>
<span class="hljs-keyword">for</span> tuple <span class="hljs-keyword">in</span> rules
tuple.unshift <span class="hljs-literal">null</span> <span class="hljs-keyword">if</span> tuple.length &lt; <span class="hljs-number">3</span>
buildRule tuple...</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
description of what the option does.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRule</span> = <span class="hljs-params">(shortFlag, longFlag, description, options = {})</span> -&gt;</span>
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[<span class="hljs-number">1</span>]
{
name: longFlag.substr <span class="hljs-number">2</span>
shortFlag: shortFlag
longFlag: longFlag
description: description
hasArgument: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">1</span>])
isList: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">2</span>])
}</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Normalize arguments by expanding merged flags into multiple flags. This allows
you to have <code>-wl</code> be the same as <code>--watch --lint</code>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">normalizeArguments</span> = <span class="hljs-params">(args)</span> -&gt;</span>
args = args[..]
result = []
<span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> args
<span class="hljs-keyword">if</span> match = arg.match MULTI_FLAG
result.push <span class="hljs-string">'-'</span> + l <span class="hljs-keyword">for</span> l <span class="hljs-keyword">in</span> match[<span class="hljs-number">1</span>].split <span class="hljs-string">''</span>
<span class="hljs-keyword">else</span>
result.push arg
result</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,375 @@
/*! normalize.css v2.0.1 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects `block` display not defined in IE 8/9.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
/*
* Corrects `inline-block` display not defined in IE 8/9.
*/
audio,
canvas,
video {
display: inline-block;
}
/*
* Prevents modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/*
* Addresses styling for `hidden` attribute not present in IE 8/9.
*/
[hidden] {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/*
* 1. Sets default font family to sans-serif.
* 2. Prevents iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
/*
* Removes default margin.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/*
* Addresses `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/*
* Improves readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/*
* Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
* Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
}
/*
* Addresses styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/*
* Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/*
* Addresses styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/*
* Addresses styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/*
* Corrects font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/*
* Improves readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
/*
* Sets consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019";
}
/*
* Addresses inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/*
* Prevents `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
========================================================================== */
/*
* Removes border when inside `a` element in IE 8/9.
*/
img {
border: 0;
}
/*
* Corrects overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/*
* Addresses margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/*
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/*
* 1. Corrects color not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/*
* 1. Corrects font family not being inherited in all browsers.
* 2. Corrects font size not being inherited in all browsers.
* 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
*/
button,
input,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
}
/*
* Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/*
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Corrects inability to style clickable `input` types in iOS.
* 3. Improves usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/*
* Re-set default cursor for disabled elements.
*/
button[disabled],
input[disabled] {
cursor: default;
}
/*
* 1. Addresses box sizing set to `content-box` in IE 8/9.
* 2. Removes excess padding in IE 8/9.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/*
* 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/*
* Removes inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/*
* Removes inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/*
* 1. Removes default vertical scrollbar in IE 8/9.
* 2. Improves readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}

View File

@@ -0,0 +1,251 @@
<!DOCTYPE html>
<html>
<head>
<title>register.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>register.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./'</span>
child_process = <span class="hljs-built_in">require</span> <span class="hljs-string">'child_process'</span>
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Load and run a CoffeeScript file for Node, stripping any <code>BOM</code>s.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">loadFile</span> = <span class="hljs-params">(<span class="hljs-built_in">module</span>, filename)</span> -&gt;</span>
answer = CoffeeScript._compileFile filename, <span class="hljs-literal">no</span>, <span class="hljs-literal">yes</span>
<span class="hljs-built_in">module</span>._compile answer, filename</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>If the installed version of Node supports <code>require.extensions</code>, register
CoffeeScript as an extension.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.extensions
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> CoffeeScript.FILE_EXTENSIONS
<span class="hljs-built_in">require</span>.extensions[ext] = loadFile</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Patch Nodes module loader to be able to handle multi-dot extensions.
This is a horrible thing that should not be required.</p>
</div>
<div class="content"><div class='highlight'><pre> Module = <span class="hljs-built_in">require</span> <span class="hljs-string">'module'</span>
<span class="hljs-function">
<span class="hljs-title">findExtension</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
extensions = path.basename(filename).split <span class="hljs-string">'.'</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Remove the initial dot from dotfiles.</p>
</div>
<div class="content"><div class='highlight'><pre> extensions.shift() <span class="hljs-keyword">if</span> extensions[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Start with the longest possible extension and work our way shortwards.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">while</span> extensions.shift()
curExtension = <span class="hljs-string">'.'</span> + extensions.join <span class="hljs-string">'.'</span>
<span class="hljs-keyword">return</span> curExtension <span class="hljs-keyword">if</span> Module._extensions[curExtension]
<span class="hljs-string">'.js'</span>
Module::load = <span class="hljs-function"><span class="hljs-params">(filename)</span> -&gt;</span>
@filename = filename
@paths = Module._nodeModulePaths path.dirname filename
extension = findExtension filename
Module._extensions[extension](<span class="hljs-keyword">this</span>, filename)
@loaded = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>If were on Node, patch <code>child_process.fork</code> so that Coffee scripts are able
to fork both CoffeeScript files, and JavaScript files, directly.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> child_process
{fork} = child_process
binary = <span class="hljs-built_in">require</span>.resolve <span class="hljs-string">'../../bin/coffee'</span>
child_process.fork = <span class="hljs-function"><span class="hljs-params">(path, args, options)</span> -&gt;</span>
<span class="hljs-keyword">if</span> helpers.isCoffee path
<span class="hljs-keyword">unless</span> Array.isArray args
options = args <span class="hljs-keyword">or</span> {}
args = []
args = [path].concat args
path = binary
fork path, args, options</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,626 @@
<!DOCTYPE html>
<html>
<head>
<title>repl.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>repl.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>fs = <span class="hljs-built_in">require</span> <span class="hljs-string">'fs'</span>
path = <span class="hljs-built_in">require</span> <span class="hljs-string">'path'</span>
vm = <span class="hljs-built_in">require</span> <span class="hljs-string">'vm'</span>
nodeREPL = <span class="hljs-built_in">require</span> <span class="hljs-string">'repl'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./'</span>
{merge, updateSyntaxError} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
replDefaults =
prompt: <span class="hljs-string">'coffee&gt; '</span>,
historyFile: <span class="hljs-keyword">do</span> -&gt;
historyPath = process.env.XDG_CACHE_HOME <span class="hljs-keyword">or</span> process.env.HOME
path.join historyPath, <span class="hljs-string">'.coffee_history'</span> <span class="hljs-keyword">if</span> historyPath
historyMaxInputSize: <span class="hljs-number">10240</span>
eval: <span class="hljs-function"><span class="hljs-params">(input, context, filename, cb)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>XXX: multiline hack.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/\uFF00/g</span>, <span class="hljs-string">'\n'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Nodes REPL sends the input ending with a newline and then wrapped in
parens. Unwrap all that.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/^\(([\s\S]*)\n\)$/m</span>, <span class="hljs-string">'$1'</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Nodes REPL v6.9.1+ sends the input wrapped in a try/catch statement.
Unwrap that too.</p>
</div>
<div class="content"><div class='highlight'><pre> input = input.replace <span class="hljs-regexp">/^\s*try\s*{([\s\S]*)}\s*catch.*$/m</span>, <span class="hljs-string">'$1'</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Require AST nodes to do some AST manipulation.</p>
</div>
<div class="content"><div class='highlight'><pre> {Block, Assign, Value, Literal} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span>
<span class="hljs-keyword">try</span></pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Tokenize the clean input.</p>
</div>
<div class="content"><div class='highlight'><pre> tokens = CoffeeScript.tokens input</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Collect referenced variable names just like in <code>CoffeeScript.compile</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> referencedVars = (
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>
)</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Generate the AST of the tokens.</p>
</div>
<div class="content"><div class='highlight'><pre> ast = CoffeeScript.nodes tokens</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Add assignment to <code>_</code> variable to force the input to be an expression.</p>
</div>
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Block [
<span class="hljs-keyword">new</span> Assign (<span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Literal <span class="hljs-string">'_'</span>), ast, <span class="hljs-string">'='</span>
]
js = ast.compile {bare: <span class="hljs-literal">yes</span>, locals: Object.keys(context), referencedVars}
cb <span class="hljs-literal">null</span>, runInContext js, context, filename
<span class="hljs-keyword">catch</span> err</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>ASTs <code>compile</code> does not add source code information to syntax errors.</p>
</div>
<div class="content"><div class='highlight'><pre> updateSyntaxError err, input
cb err
<span class="hljs-function">
<span class="hljs-title">runInContext</span> = <span class="hljs-params">(js, context, filename)</span> -&gt;</span>
<span class="hljs-keyword">if</span> context <span class="hljs-keyword">is</span> <span class="hljs-built_in">global</span>
vm.runInThisContext js, filename
<span class="hljs-keyword">else</span>
vm.runInContext js, context, filename
<span class="hljs-function">
<span class="hljs-title">addMultilineHandler</span> = <span class="hljs-params">(repl)</span> -&gt;</span>
{rli, inputStream, outputStream} = repl</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Node 0.11.12 changed API, prompt is now _prompt.</p>
</div>
<div class="content"><div class='highlight'><pre> origPrompt = repl._prompt ? repl.prompt
multiline =
enabled: <span class="hljs-literal">off</span>
initialPrompt: origPrompt.replace <span class="hljs-regexp">/^[^&gt; ]*/</span>, <span class="hljs-function"><span class="hljs-params">(x)</span> -&gt;</span> x.replace <span class="hljs-regexp">/./g</span>, <span class="hljs-string">'-'</span>
prompt: origPrompt.replace <span class="hljs-regexp">/^[^&gt; ]*&gt;?/</span>, <span class="hljs-function"><span class="hljs-params">(x)</span> -&gt;</span> x.replace <span class="hljs-regexp">/./g</span>, <span class="hljs-string">'.'</span>
buffer: <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Proxy nodes line listener</p>
</div>
<div class="content"><div class='highlight'><pre> nodeLineListener = rli.listeners(<span class="hljs-string">'line'</span>)[<span class="hljs-number">0</span>]
rli.removeListener <span class="hljs-string">'line'</span>, nodeLineListener
rli.<span class="hljs-literal">on</span> <span class="hljs-string">'line'</span>, <span class="hljs-function"><span class="hljs-params">(cmd)</span> -&gt;</span>
<span class="hljs-keyword">if</span> multiline.enabled
multiline.buffer += <span class="hljs-string">"<span class="hljs-subst">#{cmd}</span>\n"</span>
rli.setPrompt multiline.prompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">else</span>
rli.setPrompt origPrompt
nodeLineListener cmd
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Handle Ctrl-v</p>
</div>
<div class="content"><div class='highlight'><pre> inputStream.<span class="hljs-literal">on</span> <span class="hljs-string">'keypress'</span>, <span class="hljs-function"><span class="hljs-params">(char, key)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> key <span class="hljs-keyword">and</span> key.ctrl <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> key.meta <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> key.shift <span class="hljs-keyword">and</span> key.name <span class="hljs-keyword">is</span> <span class="hljs-string">'v'</span>
<span class="hljs-keyword">if</span> multiline.enabled</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>allow arbitrarily switching between modes any time before multiple lines are entered</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> multiline.buffer.match <span class="hljs-regexp">/\n/</span>
multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.setPrompt origPrompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>no-op unless the current line is empty</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> rli.line? <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> rli.line.match <span class="hljs-regexp">/^\s*$/</span></pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>eval, print, loop</p>
</div>
<div class="content"><div class='highlight'><pre> multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.line = <span class="hljs-string">''</span>
rli.cursor = <span class="hljs-number">0</span>
rli.output.cursorTo <span class="hljs-number">0</span>
rli.output.clearLine <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>XXX: multiline hack</p>
</div>
<div class="content"><div class='highlight'><pre> multiline.buffer = multiline.buffer.replace <span class="hljs-regexp">/\n/g</span>, <span class="hljs-string">'\uFF00'</span>
rli.emit <span class="hljs-string">'line'</span>, multiline.buffer
multiline.buffer = <span class="hljs-string">''</span>
<span class="hljs-keyword">else</span>
multiline.enabled = <span class="hljs-keyword">not</span> multiline.enabled
rli.setPrompt multiline.initialPrompt
rli.prompt <span class="hljs-literal">true</span>
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Store and load command history from a file</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">addHistory</span> = <span class="hljs-params">(repl, filename, maxSize)</span> -&gt;</span>
lastLine = <span class="hljs-literal">null</span>
<span class="hljs-keyword">try</span></pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Get file info and at most maxSize of command history</p>
</div>
<div class="content"><div class='highlight'><pre> stat = fs.statSync filename
size = Math.min maxSize, stat.size</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Read last <code>size</code> bytes from the file</p>
</div>
<div class="content"><div class='highlight'><pre> readFd = fs.openSync filename, <span class="hljs-string">'r'</span>
buffer = Buffer.alloc size
fs.readSync readFd, buffer, <span class="hljs-number">0</span>, size, stat.size - size
fs.closeSync readFd</pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Set the history on the interpreter</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history = buffer.toString().split(<span class="hljs-string">'\n'</span>).reverse()</pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>If the history file was truncated we should pop off a potential partial line</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history.pop() <span class="hljs-keyword">if</span> stat.size &gt; maxSize</pre></div></div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Shift off the final blank newline</p>
</div>
<div class="content"><div class='highlight'><pre> repl.rli.history.shift() <span class="hljs-keyword">if</span> repl.rli.history[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">''</span>
repl.rli.historyIndex = <span class="hljs-number">-1</span>
lastLine = repl.rli.history[<span class="hljs-number">0</span>]
fd = fs.openSync filename, <span class="hljs-string">'a'</span>
repl.rli.addListener <span class="hljs-string">'line'</span>, <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span>
<span class="hljs-keyword">if</span> code <span class="hljs-keyword">and</span> code.length <span class="hljs-keyword">and</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'.history'</span> <span class="hljs-keyword">and</span> code <span class="hljs-keyword">isnt</span> <span class="hljs-string">'.exit'</span> <span class="hljs-keyword">and</span> lastLine <span class="hljs-keyword">isnt</span> code</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Save the latest command in the file</p>
</div>
<div class="content"><div class='highlight'><pre> fs.writeSync fd, <span class="hljs-string">"<span class="hljs-subst">#{code}</span>\n"</span>
lastLine = code
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-&gt;</span> fs.closeSync fd</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>Add a command to show the history stack</p>
</div>
<div class="content"><div class='highlight'><pre> repl.commands[getCommandId(repl, <span class="hljs-string">'history'</span>)] =
help: <span class="hljs-string">'Show command history'</span>
action: <span class="hljs-function">-&gt;</span>
repl.outputStream.write <span class="hljs-string">"<span class="hljs-subst">#{repl.rli.history[..].reverse().join <span class="hljs-string">'\n'</span>}</span>\n"</span>
repl.displayPrompt()
<span class="hljs-function">
<span class="hljs-title">getCommandId</span> = <span class="hljs-params">(repl, commandName)</span> -&gt;</span></pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Node 0.11 changed API, a command such as .help is now stored as help</p>
</div>
<div class="content"><div class='highlight'><pre> commandsHaveLeadingDot = repl.commands[<span class="hljs-string">'.help'</span>]?
<span class="hljs-keyword">if</span> commandsHaveLeadingDot <span class="hljs-keyword">then</span> <span class="hljs-string">".<span class="hljs-subst">#{commandName}</span>"</span> <span class="hljs-keyword">else</span> commandName
<span class="hljs-built_in">module</span>.exports =
start: <span class="hljs-function"><span class="hljs-params">(opts = {})</span> -&gt;</span>
[major, minor, build] = process.versions.node.split(<span class="hljs-string">'.'</span>).map (n) -&gt; parseInt(n, <span class="hljs-number">10</span>)
<span class="hljs-keyword">if</span> major &lt; <span class="hljs-number">6</span>
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"Node 6+ required for CoffeeScript REPL"</span>
process.exit <span class="hljs-number">1</span>
CoffeeScript.register()
process.argv = [<span class="hljs-string">'coffee'</span>].concat process.argv[<span class="hljs-number">2.</span>.]
opts = merge replDefaults, opts
repl = nodeREPL.start opts
runInContext opts.prelude, repl.context, <span class="hljs-string">'prelude'</span> <span class="hljs-keyword">if</span> opts.prelude
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-&gt;</span> repl.outputStream.write <span class="hljs-string">'\n'</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> repl.rli.closed
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize <span class="hljs-keyword">if</span> opts.historyFile</pre></div></div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
</div>
<p>Adapt help inherited from the node REPL</p>
</div>
<div class="content"><div class='highlight'><pre> repl.commands[getCommandId(repl, <span class="hljs-string">'load'</span>)].help = <span class="hljs-string">'Load code from a file into this REPL session'</span>
repl</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,398 @@
<!DOCTYPE html>
<html>
<head>
<title>scope.litcoffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>scope.litcoffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>The <strong>Scope</strong> class regulates lexical scoping within CoffeeScript. As you
generate code, you create a tree of scopes in the same shape as the nested
function bodies. Each scope knows about the variables declared within it,
and has a reference to its parent enclosing scope. In this way, we know which
variables are new and need to be declared with <code>var</code>, and which are shared
with external scopes.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.Scope = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Scope</span></span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Initialize a scope with its parent, for lookups up the chain,
as well as a reference to the <strong>Block</strong> node it belongs to, which is
where it should declare its variables, a reference to the function that
it belongs to, and a list of variables referenced in the source code
and therefore should be avoided when generating variables.</p>
</div>
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(@parent, @expressions, @method, @referencedVars)</span> -&gt;</span>
@variables = [{name: <span class="hljs-string">'arguments'</span>, type: <span class="hljs-string">'arguments'</span>}]
@positions = {}
@utilities = {} <span class="hljs-keyword">unless</span> @parent</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>The <code>@root</code> is the top-level <strong>Scope</strong> object for a given file.</p>
</div>
<div class="content"><div class='highlight'><pre> @root = @parent?.root ? <span class="hljs-keyword">this</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Adds a new variable or overrides an existing one.</p>
</div>
<div class="content"><div class='highlight'><pre> add: <span class="hljs-function"><span class="hljs-params">(name, type, immediate)</span> -&gt;</span>
<span class="hljs-keyword">return</span> @parent.add name, type, immediate <span class="hljs-keyword">if</span> @shared <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> immediate
<span class="hljs-keyword">if</span> Object::hasOwnProperty.call @positions, name
@variables[@positions[name]].type = type
<span class="hljs-keyword">else</span>
@positions[name] = @variables.push({name, type}) - <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>When <code>super</code> is called, we need to find the name of the current method were
in, so that we know how to invoke the same method of the parent class. This
can get complicated if super is being called from an inner function.
<code>namedMethod</code> will walk up the scope tree until it either finds the first
function object that has a name filled in, or bottoms out.</p>
</div>
<div class="content"><div class='highlight'><pre> namedMethod: <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">return</span> @method <span class="hljs-keyword">if</span> @method?.name <span class="hljs-keyword">or</span> !@parent
@parent.namedMethod()</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Look up a variable name in lexical scope, and declare it if it does not
already exist.</p>
</div>
<div class="content"><div class='highlight'><pre> find: <span class="hljs-function"><span class="hljs-params">(name, type = <span class="hljs-string">'var'</span>)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> @check name
@add name, type
<span class="hljs-literal">no</span></pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Reserve a variable name as originating from a function parameter for this
scope. No <code>var</code> required for internal references.</p>
</div>
<div class="content"><div class='highlight'><pre> parameter: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> @shared <span class="hljs-keyword">and</span> @parent.check name, <span class="hljs-literal">yes</span>
@add name, <span class="hljs-string">'param'</span></pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Just check to see if a variable has already been declared, without reserving,
walks up to the root scope.</p>
</div>
<div class="content"><div class='highlight'><pre> check: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
!!(@type(name) <span class="hljs-keyword">or</span> @parent?.check(name))</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Generate a temporary variable name at the given index.</p>
</div>
<div class="content"><div class='highlight'><pre> temporary: <span class="hljs-function"><span class="hljs-params">(name, index, single=<span class="hljs-literal">false</span>)</span> -&gt;</span>
<span class="hljs-keyword">if</span> single
startCode = name.charCodeAt(<span class="hljs-number">0</span>)
endCode = <span class="hljs-string">'z'</span>.charCodeAt(<span class="hljs-number">0</span>)
diff = endCode - startCode
newCode = startCode + index % (diff + <span class="hljs-number">1</span>)
letter = String.fromCharCode(newCode)
num = index <span class="hljs-regexp">//</span> (diff + <span class="hljs-number">1</span>)
<span class="hljs-string">"<span class="hljs-subst">#{letter}</span><span class="hljs-subst">#{num <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>}</span>"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">"<span class="hljs-subst">#{name}</span><span class="hljs-subst">#{index <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>}</span>"</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Gets the type of a variable.</p>
</div>
<div class="content"><div class='highlight'><pre> type: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> v.type <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.name <span class="hljs-keyword">is</span> name
<span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>If we need to store an intermediate result, find an available name for a
compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…</p>
</div>
<div class="content"><div class='highlight'><pre> freeVariable: <span class="hljs-function"><span class="hljs-params">(name, options={})</span> -&gt;</span>
index = <span class="hljs-number">0</span>
<span class="hljs-keyword">loop</span>
temp = @temporary name, index, options.single
<span class="hljs-keyword">break</span> <span class="hljs-keyword">unless</span> @check(temp) <span class="hljs-keyword">or</span> temp <span class="hljs-keyword">in</span> @root.referencedVars
index++
@add temp, <span class="hljs-string">'var'</span>, <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> options.reserve ? <span class="hljs-literal">true</span>
temp</pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Ensure that an assignment is made at the top of this scope
(or at the top-level scope, if requested).</p>
</div>
<div class="content"><div class='highlight'><pre> assign: <span class="hljs-function"><span class="hljs-params">(name, value)</span> -&gt;</span>
@add name, {value, assigned: <span class="hljs-literal">yes</span>}, <span class="hljs-literal">yes</span>
@hasAssignments = <span class="hljs-literal">yes</span></pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Does this scope have any declared variables?</p>
</div>
<div class="content"><div class='highlight'><pre> hasDeclarations: <span class="hljs-function">-&gt;</span>
!!@declaredVariables().length</pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Return the list of variables first declared in this scope.</p>
</div>
<div class="content"><div class='highlight'><pre> declaredVariables: <span class="hljs-function">-&gt;</span>
(v.name <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.type <span class="hljs-keyword">is</span> <span class="hljs-string">'var'</span>).sort()</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Return the list of assignments that are supposed to be made at the top
of this scope.</p>
</div>
<div class="content"><div class='highlight'><pre> assignedVariables: <span class="hljs-function">-&gt;</span>
<span class="hljs-string">"<span class="hljs-subst">#{v.name}</span> = <span class="hljs-subst">#{v.type.value}</span>"</span> <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> @variables <span class="hljs-keyword">when</span> v.type.assigned</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,523 @@
<!DOCTYPE html>
<html>
<head>
<title>sourcemap.litcoffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To &hellip;</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page_wrapper">
<div id="jump_page">
<a class="source" href="browser.html">
browser.coffee
</a>
<a class="source" href="cake.html">
cake.coffee
</a>
<a class="source" href="coffeescript.html">
coffeescript.coffee
</a>
<a class="source" href="command.html">
command.coffee
</a>
<a class="source" href="grammar.html">
grammar.coffee
</a>
<a class="source" href="helpers.html">
helpers.coffee
</a>
<a class="source" href="index.html">
index.coffee
</a>
<a class="source" href="lexer.html">
lexer.coffee
</a>
<a class="source" href="nodes.html">
nodes.coffee
</a>
<a class="source" href="optparse.html">
optparse.coffee
</a>
<a class="source" href="register.html">
register.coffee
</a>
<a class="source" href="repl.html">
repl.coffee
</a>
<a class="source" href="rewriter.html">
rewriter.coffee
</a>
<a class="source" href="scope.html">
scope.litcoffee
</a>
<a class="source" href="sourcemap.html">
sourcemap.litcoffee
</a>
</div>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>sourcemap.litcoffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Source maps allow JavaScript runtimes to match running JavaScript back to
the original source code that corresponds to it. This can be minified
JavaScript, but in our case, were concerned with mapping pretty-printed
JavaScript back to CoffeeScript.</p>
<p>In order to produce maps, we must keep track of positions (line number, column number)
that originated every node in the syntax tree, and be able to generate a
<a href="https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit">map file</a>
— which is a compact, VLQ-encoded representation of the JSON serialization
of this information — to write out alongside the generated JavaScript.</p>
<h2 id="linemap">LineMap</h2>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>A <strong>LineMap</strong> object keeps track of information about original line and column
positions for a single line of output JavaScript code.
<strong>SourceMaps</strong> are implemented in terms of <strong>LineMaps</strong>.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LineMap</span></span>
constructor: <span class="hljs-function"><span class="hljs-params">(@line)</span> -&gt;</span>
@columns = []
add: <span class="hljs-function"><span class="hljs-params">(column, [sourceLine, sourceColumn], options={})</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> @columns[column] <span class="hljs-keyword">and</span> options.noReplace
@columns[column] = {line: @line, column, sourceLine, sourceColumn}
sourceLocation: <span class="hljs-function"><span class="hljs-params">(column)</span> -&gt;</span>
column-- <span class="hljs-keyword">until</span> (mapping = @columns[column]) <span class="hljs-keyword">or</span> (column &lt;= <span class="hljs-number">0</span>)
mapping <span class="hljs-keyword">and</span> [mapping.sourceLine, mapping.sourceColumn]</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<h2 id="sourcemap">SourceMap</h2>
</div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Maps locations in a single generated JavaScript file back to locations in
the original CoffeeScript source file.</p>
<p>This is intentionally agnostic towards how a source map might be represented on
disk. Once the compiler is ready to produce a “v3”-style source map, we can walk
through the arrays of line and column buffer to produce it.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SourceMap</span></span>
constructor: <span class="hljs-function">-&gt;</span>
@lines = []</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Adds a mapping to this SourceMap. <code>sourceLocation</code> and <code>generatedLocation</code>
are both <code>[line, column]</code> arrays. If <code>options.noReplace</code> is true, then if there
is already a mapping for the specified <code>line</code> and <code>column</code>, this will have no
effect.</p>
</div>
<div class="content"><div class='highlight'><pre> add: <span class="hljs-function"><span class="hljs-params">(sourceLocation, generatedLocation, options = {})</span> -&gt;</span>
[line, column] = generatedLocation
lineMap = (@lines[line] <span class="hljs-keyword">or</span>= <span class="hljs-keyword">new</span> LineMap(line))
lineMap.add column, sourceLocation, options</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Look up the original position of a given <code>line</code> and <code>column</code> in the generated
code.</p>
</div>
<div class="content"><div class='highlight'><pre> sourceLocation: <span class="hljs-function"><span class="hljs-params">([line, column])</span> -&gt;</span>
line-- <span class="hljs-keyword">until</span> (lineMap = @lines[line]) <span class="hljs-keyword">or</span> (line &lt;= <span class="hljs-number">0</span>)
lineMap <span class="hljs-keyword">and</span> lineMap.sourceLocation column</pre></div></div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<h2 id="v3-sourcemap-generation">V3 SourceMap Generation</h2>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Builds up a V3 source map, returning the generated JSON as a string.
<code>options.sourceRoot</code> may be used to specify the sourceRoot written to the source
map. Also, <code>options.sourceFiles</code> and <code>options.generatedFile</code> may be passed to
set “sources” and “file”, respectively.</p>
</div>
<div class="content"><div class='highlight'><pre> generate: <span class="hljs-function"><span class="hljs-params">(options = {}, code = <span class="hljs-literal">null</span>)</span> -&gt;</span>
writingline = <span class="hljs-number">0</span>
lastColumn = <span class="hljs-number">0</span>
lastSourceLine = <span class="hljs-number">0</span>
lastSourceColumn = <span class="hljs-number">0</span>
needComma = <span class="hljs-literal">no</span>
buffer = <span class="hljs-string">""</span>
<span class="hljs-keyword">for</span> lineMap, lineNumber <span class="hljs-keyword">in</span> @lines <span class="hljs-keyword">when</span> lineMap
<span class="hljs-keyword">for</span> mapping <span class="hljs-keyword">in</span> lineMap.columns <span class="hljs-keyword">when</span> mapping
<span class="hljs-keyword">while</span> writingline &lt; mapping.line
lastColumn = <span class="hljs-number">0</span>
needComma = <span class="hljs-literal">no</span>
buffer += <span class="hljs-string">";"</span>
writingline++</pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
</div>
<p>Write a comma if weve already written a segment on this line.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> needComma
buffer += <span class="hljs-string">","</span>
needComma = <span class="hljs-literal">no</span></pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Write the next segment. Segments can be 1, 4, or 5 values. If just one, then it
is a generated column which doesnt match anything in the source code.</p>
<p>The starting column in the generated source, relative to any previous recorded
column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.column - lastColumn
lastColumn = mapping.column</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>The index into the list of sources:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>The starting line in the original source, relative to the previous source line.</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.sourceLine - lastSourceLine
lastSourceLine = mapping.sourceLine</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>The starting column in the original source, relative to the previous column.</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.sourceColumn - lastSourceColumn
lastSourceColumn = mapping.sourceColumn
needComma = <span class="hljs-literal">yes</span></pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Produce the canonical JSON object format for a “v3” source map.</p>
</div>
<div class="content"><div class='highlight'><pre> v3 =
version: <span class="hljs-number">3</span>
file: options.generatedFile <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
sourceRoot: options.sourceRoot <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
sources: options.sourceFiles <span class="hljs-keyword">or</span> [<span class="hljs-string">''</span>]
names: []
mappings: buffer
v3.sourcesContent = [code] <span class="hljs-keyword">if</span> options.inlineMap
v3</pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<h2 id="base64-vlq-encoding">Base64 VLQ Encoding</h2>
</div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Note that SourceMap VLQ encoding is “backwards”. MIDI-style VLQ encoding puts
the most-significant-bit (MSB) from the original value into the MSB of the VLQ
encoded value (see <a href="https://en.wikipedia.org/wiki/File:Uintvar_coding.svg">Wikipedia</a>).
SourceMap VLQ does things the other way around, with the least significat four
bits of the original value encoded into the first byte of the VLQ encoded value.</p>
</div>
<div class="content"><div class='highlight'><pre> VLQ_SHIFT = <span class="hljs-number">5</span>
VLQ_CONTINUATION_BIT = <span class="hljs-number">1</span> &lt;&lt; VLQ_SHIFT <span class="hljs-comment"># 0010 0000</span>
VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - <span class="hljs-number">1</span> <span class="hljs-comment"># 0001 1111</span>
encodeVlq: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
answer = <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Least significant bit represents the sign.</p>
</div>
<div class="content"><div class='highlight'><pre> signBit = <span class="hljs-keyword">if</span> value &lt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>The next bits are the actual value.</p>
</div>
<div class="content"><div class='highlight'><pre> valueToEncode = (Math.abs(value) &lt;&lt; <span class="hljs-number">1</span>) + signBit</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Make sure we encode at least one character, even if valueToEncode is 0.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">while</span> valueToEncode <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> answer
nextChunk = valueToEncode &amp; VLQ_VALUE_MASK
valueToEncode = valueToEncode &gt;&gt; VLQ_SHIFT
nextChunk |= VLQ_CONTINUATION_BIT <span class="hljs-keyword">if</span> valueToEncode
answer += @encodeBase64 nextChunk
answer</pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<h2 id="regular-base64-encoding">Regular Base64 Encoding</h2>
</div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
</div>
<div class="content"><div class='highlight'><pre> BASE64_CHARS = <span class="hljs-string">'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'</span>
encodeBase64: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
BASE64_CHARS[value] <span class="hljs-keyword">or</span> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Cannot Base64 encode value: <span class="hljs-subst">#{value}</span>"</span></pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Our API for source maps is just the <code>SourceMap</code> class.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">module</span>.exports = SourceMap</pre></div></div>
</li>
</ul>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

4363
docs/v2/index.html Normal file

File diff suppressed because it is too large Load Diff

13218
docs/v2/test.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
launch() if ignition is on
volume: 10 if band isnt spinal_tap
let_the_wild_rumpus_begin() unless answer is no
if car.speed < speed_limit then accelerate()
print "My name is " + @name

View File

@@ -1,4 +0,0 @@
backwards: ->
alert arguments.reverse()
backwards "stairway", "to", "heaven"

View File

@@ -1,7 +0,0 @@
# Eat lunch.
lunch: eat food for food in ['toast', 'cheese', 'wine']
# Naive collision detection.
for roid in asteroids
for roid2 in asteroids when roid isnt roid2
roid.explode() if roid.overlaps roid2

View File

@@ -1,2 +0,0 @@
greeting: "Hello CoffeeScript"
difficulty: 0.5

View File

@@ -1,5 +0,0 @@
process.mixin require 'assert'
task 'test', 'run each of the unit tests', ->
for test in test_files
fs.readFile test, (err, code) -> eval coffee.compile code

View File

@@ -1,5 +0,0 @@
cholesterol: 127
healthy: 200 > cholesterol > 60

View File

@@ -1,9 +0,0 @@
mood: greatly_improved if singing
if happy and knows_it
claps_hands()
cha_cha_cha()
date: if friday then sue else jill
expensive ||= do_the_math()

View File

@@ -1,8 +0,0 @@
solipsism: true if mind? and not world?
speed ?= 140

View File

@@ -1,9 +0,0 @@
grade: (student) ->
if student.excellent_work
"A+"
else if student.okay_stuff
if student.tried_hard then "B" else "B-"
else
"C"
eldest: if 24 > 21 then "Liz" else "Ike"

View File

@@ -1 +0,0 @@
six: (one: 1) + (two: 2) + (three: 3)

View File

@@ -1,3 +0,0 @@
# The first ten global properties.
globals: (name for name of window)[0...10]

View File

@@ -1,6 +0,0 @@
Account: (customer, cart) ->
@customer: customer
@cart: cart
$('.shopping_cart').bind 'click', (event) =>
@customer.purchase @cart

View File

@@ -1,2 +0,0 @@
square: (x) -> x * x
cube: (x) -> square(x) * x

View File

@@ -1,5 +0,0 @@
html: '''
<strong>
cup of coffeescript
</strong>
'''

View File

@@ -1,5 +0,0 @@
weather_report: (location) ->
# Make an Ajax request to fetch the weather...
[location, 72, "Mostly Sunny"]
[city, temp, forecast]: weather_report "Berkeley, CA"

View File

@@ -1,4 +0,0 @@
years_old: {max: 10, ida: 9, tim: 11}
ages: for child, age of years_old
child + " is " + age

View File

@@ -1,13 +0,0 @@
song: ["do", "re", "mi", "fa", "so"]
ages: {
max: 10
ida: 9
tim: 11
}
matrix: [
1, 0, 1
0, 0, 1
1, 1, 0
]

View File

@@ -1,4 +0,0 @@
bait: 1000
and_switch: 0
[bait, and_switch]: [and_switch, bait]

View File

@@ -1,2 +0,0 @@
String::dasherize: ->
this.replace(/_/g, "-")

Some files were not shown because too many files have changed in this diff Show More