Compare commits

...

189 Commits

Author SHA1 Message Date
Geoffrey Booth
27f21a34e2 1.12.7 (#4617)
* 1.12.7: Update changelog and version number

* Update dependencies

* Improve formatting

* Updated output

* Disable regex Unicode test for runtimes lacking support. Fixes #4610.

* More better

* Bump date
2017-07-16 23:53:22 -07:00
Julian Rosse
799bc6e81c Restrict indented return arg to object (#4605)
* throw multiline implicit object [Fixes #3199]

* only return

* fix from code review

* test error on non-object

* test error on call indented non-object

* unique test names
2017-07-09 10:29:47 -07:00
Julian Rosse
e4bf1631e1 refine sameLine implicit object tagging [Fixes #4568] (#4598) 2017-07-04 11:31:51 -07:00
Geoffrey Booth
9d82bf74f3 Add more features to the list of reasons to check out CoffeeScript 2 2017-06-30 10:56:34 -07:00
Geoffrey Booth
ebe8493020 Update v2 docs for 2.0.0-beta3 2017-06-30 10:52:11 -07:00
Simon Lydell
b1b34d328a Merge pull request #4585 from helixbass/iss4283_error_message_implicit_call
Fix #4283: error message for implicit call
2017-06-26 07:22:34 +02:00
Julian Rosse
8234ce2712 error message for implicit call [Fixes #4283] 2017-06-25 13:39:45 -05:00
Michal Srb
48c7debe5a Fix REPL assignment (#4559) 2017-06-07 11:37:25 -07:00
Geoffrey Booth
cd6daf0b79 2.0.0-beta2 docs 2017-05-16 18:59:02 -07:00
Geoffrey Booth
f0e9837dca 1.12.6 missing updated output 2017-05-14 21:22:48 -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
Michal Srb
e00fa5d5f8 Fix #4533: chained calls incorrectly wrapping enclosing implicit objects (#4534) 2017-05-12 06:12:06 -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
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
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
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
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
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
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
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
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
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
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
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
Ruben Rodriguez
3d0d04efe2 getSourceMap needs to pass literate flag to compile() (#4435) 2017-02-04 19:33:09 -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
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
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
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
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
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
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
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
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
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
Jan
81174187f5 Fix empty source file when building with MINIFY=false, closes #4403 (#4404) 2016-12-15 20:35:10 -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
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
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
a80d74a672 1.12.1, includes #4393 and #4388. 2016-12-06 21:15:04 -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
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
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
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
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
02c5641b32 Fix path to browser compiler (#4374) 2016-11-27 20:47:54 -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
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
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
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
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
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
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
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
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
0d132318ce Resolve conflicts with 2 branch 2016-10-26 09:05:35 -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
887052de07 Merge branch 'master' of github.com:jashkenas/coffeescript 2016-10-23 17:06:13 -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
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
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
Simon Lydell
46841d916d Fix shorthands after interpolated key in objects
Fixes #4324.
2016-09-29 19:02:00 +02: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
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
303 changed files with 59201 additions and 19406 deletions

8
.gitignore vendored
View File

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

0
.nojekyll Normal file
View File

423
Cakefile
View File

@@ -1,9 +1,9 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore'
CoffeeScript = require './lib/coffee-script'
{spawn, exec} = require 'child_process'
helpers = require './lib/coffee-script/helpers'
fs = require 'fs'
path = require 'path'
_ = require 'underscore'
{ spawn, exec, execSync } = require 'child_process'
CoffeeScript = require './lib/coffee-script'
helpers = require './lib/coffee-script/helpers'
# ANSI Terminal Colors.
bold = red = green = reset = ''
@@ -24,122 +24,104 @@ header = """
*/
"""
# Build the CoffeeScript language from source.
build = (cb) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffee-script'].concat(files), cb
# Used in folder names like `docs/v1`.
majorVersion = parseInt CoffeeScript.VERSION.split('.')[0], 10
# Run a CoffeeScript through our node/coffee interpreter.
run = (args, cb) ->
proc = spawn 'node', ['bin/coffee'].concat(args)
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) ->
process.exit(1) if status != 0
cb() if typeof cb is 'function'
# Log a message with a color.
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
codeFor = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = false, showLoad = true) ->
counter++
return unless fs.existsSync "documentation/js/#{file}.js"
cs = fs.readFileSync "documentation/coffee/#{file}.coffee", 'utf-8'
js = fs.readFileSync "documentation/js/#{file}.js", 'utf-8'
js = js.replace /^\/\/ generated.*?\n/i, ''
cshtml = "<pre><code>#{hljs.highlight('coffeescript', cs).value}</code></pre>"
# Temporary fix until highlight.js adds support for newer CoffeeScript reserved words
if file is 'modules'
cshtml = cshtml.replace /(import|export|from|as|default) /g, '<span class="reserved">$1</span> '
jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>"
append = if executable is yes then '' else "alert(#{executable});"
if executable and executable != yes
cs.replace /(\S)\s*\Z/m, "$1\n\nalert #{executable}"
run = if executable is true then 'run' else "run: #{executable}"
name = "example#{counter}"
script = "<script>window.#{name} = #{JSON.stringify cs}</script>"
load = if showLoad then "<div class='minibutton load' onclick='javascript: loadConsole(#{name});'>load</div>" else ''
button = if executable then "<div class='minibutton ok' onclick='javascript: #{js};#{append}'>#{run}</div>" else ''
"<div class='code'>#{cshtml}#{jshtml}#{script}#{load}#{button}<br class='clear' /></div>"
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'
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}"
releaseHeader = (date, version, prevVersion) -> """
<div class="anchor" id="#{version}"></div>
<b 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>
</b>
"""
option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
base = options.prefix or '/usr/local'
lib = "#{base}/lib/coffee-script"
bin = "#{base}/bin"
node = "~/.node_libraries/coffee-script"
console.log "Installing CoffeeScript to #{lib}"
console.log "Linking to #{node}"
console.log "Linking 'coffee' to #{bin}/coffee"
exec([
"mkdir -p #{lib} #{bin}"
"cp -rf bin lib LICENSE README.md package.json src #{lib}"
"ln -sfn #{lib}/bin/coffee #{bin}/coffee"
"ln -sfn #{lib}/bin/cake #{bin}/cake"
"mkdir -p ~/.node_libraries"
"ln -sfn #{lib}/lib/coffee-script #{node}"
].join(' && '), (err, stdout, stderr) ->
if err then console.log stderr.trim() else log 'done', green
)
# Run a CoffeeScript through our node/coffee interpreter.
run = (args, callback) ->
spawnNodeProcess ['bin/coffee'].concat(args), 'stderr', (status) ->
process.exit(1) if status isnt 0
callback() if typeof callback is 'function'
task 'build', 'build the CoffeeScript language from source', build
task 'build:full', 'rebuild the source twice, and run the tests', ->
build ->
build ->
csPath = './lib/coffee-script'
csDir = path.dirname require.resolve csPath
for mod of require.cache when csDir is mod[0 ... csDir.length]
delete require.cache[mod]
unless runTests require csPath
process.exit 1
task 'build:parser', 'rebuild the Jison parser (run build first)', ->
helpers.extend global, require('util')
# Build the CoffeeScript language from source.
buildParser = ->
helpers.extend global, require 'util'
require 'jison'
parser = require('./lib/coffee-script/grammar').parser
fs.writeFile 'lib/coffee-script/parser.js', parser.generate()
parser = require('./lib/coffee-script/grammar').parser.generate()
# Patch Jisons output, until https://github.com/zaach/jison/pull/339 is accepted,
# to ensure that require('fs') is only called where it exists.
parser = parser.replace "var source = require('fs')", """
var source = '';
var fs = require('fs');
if (typeof fs !== 'undefined' && fs !== null)
source = fs"""
fs.writeFileSync 'lib/coffee-script/parser.js', parser
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
code = ''
buildExceptParser = (callback) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffee-script'].concat(files), callback
build = (callback) ->
buildParser()
buildExceptParser callback
testBuiltCode = (watch = no) ->
csPath = './lib/coffee-script'
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 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', 'coffee-script', 'browser']
code += """
require['./#{name}'] = (function() {
@@ -164,36 +146,188 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser',
}(this));
"""
unless process.env.MINIFY is 'false'
{code} = require('uglify-js').minify code, fromString: true
fs.writeFileSync 'extras/coffee-script.js', header + '\n' + code
{compiledCode: code} = require('google-closure-compiler-js').compile
jsCode: [
src: code
languageOut: if majorVersion is 1 then 'ES5' else 'ES6'
]
outputFolder = "docs/v#{majorVersion}/browser-compiler"
fs.mkdirSync outputFolder unless fs.existsSync outputFolder
fs.writeFileSync "#{outputFolder}/coffee-script.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 'doc:site', 'watch and continually rebuild the documentation for the website', ->
source = 'documentation/index.html.js'
exec 'bin/coffee -bc -o documentation/js documentation/coffee/*.coffee'
task 'build:watch:harmony', 'watch and continually rebuild the CoffeeScript compiler, running harmony tests on each build', ->
watchAndBuildAndTest yes
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 = ->
markdownRenderer = require('markdown-it')
html: yes
typographer: yes
# 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 = ->
codeSnippetCounter = 0
rendered = _.template fs.readFileSync(source, 'utf-8'),
codeFor: codeFor()
releaseHeader: releaseHeader
fs.writeFileSync 'index.html', rendered
log "compiled", green, "#{source}"
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
fs.watchFile source, interval: 200, renderIndex
log "watching..." , green
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 'doc:source', 'rebuild the internal documentation', ->
exec 'node_modules/.bin/docco src/*.*coffee && cp -rf docs documentation && rm -r docs', (err) ->
throw err if err
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 'doc:underscore', 'rebuild the Underscore.coffee documentation page', ->
exec 'node_modules/.bin/docco examples/underscore.coffee && cp -rf docs documentation && rm -r docs', (err) ->
throw err if err
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 '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/coffee-script/rewriter'
@@ -244,23 +378,7 @@ runTests = (CoffeeScript) ->
description: description if description?
source: fn.toString() if fn.toString?
# See http://wiki.ecmascript.org/doku.php?id=harmony:egal
egal = (a, b) ->
if a is b
a isnt 0 or 1/a is 1/b
else
a isnt a and b isnt b
# A recursive functional equivalence helper; uses egal for testing equivalence.
arrayEgal = (a, b) ->
if egal a, b then yes
else if a instanceof Array and b instanceof Array
return no unless a.length is b.length
return no for el, idx in a when not arrayEgal el, b[idx]
yes
global.eq = (a, b, msg) -> ok egal(a, b), msg ? "Expected #{a} to equal #{b}"
global.arrayEq = (a, b, msg) -> ok arrayEgal(a,b), msg ? "Expected #{a} to deep equal #{b}"
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.
@@ -280,11 +398,6 @@ runTests = (CoffeeScript) ->
# Run every test in the `test` folder, recording failures.
files = fs.readdirSync 'test'
# Ignore generators test file if generators are not available
generatorsAreAvailable = '--harmony' in process.execArgv or
'--harmony-generators' in process.execArgv
files.splice files.indexOf('generators.coffee'), 1 if not generatorsAreAvailable
for file in files when helpers.isCoffee file
literate = helpers.isLiterate file
currentFile = filename = path.join 'test', file
@@ -297,12 +410,14 @@ runTests = (CoffeeScript) ->
task 'test', 'run the CoffeeScript language test suite', ->
runTests CoffeeScript
testResults = runTests CoffeeScript
process.exit 1 unless testResults
task 'test:browser', 'run the test suite against the merged browser script', ->
source = fs.readFileSync 'extras/coffee-script.js', 'utf-8'
source = fs.readFileSync "docs/v#{majorVersion}/browser-compiler/coffee-script.js", 'utf-8'
result = {}
global.testingBrowser = yes
(-> eval source).call result
runTests result.CoffeeScript
testResults = runTests result.CoffeeScript
process.exit 1 unless testResults

View File

@@ -1,4 +1,4 @@
Copyright (c) 2009-2015 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

View File

@@ -22,18 +22,13 @@ CoffeeScript is a little language that compiles into JavaScript.
## Installation
If you have the node package manager, npm, installed:
Once you have Node.js installed:
```shell
npm install -g coffee-script
npm install --global coffeescript
```
Leave off the `-g` if you don't wish to install globally. If you don't wish to use npm:
```shell
git clone https://github.com/jashkenas/coffeescript.git
sudo coffeescript/bin/cake install
```
Leave off the `--global` if you dont wish to install globally.
## Getting Started
@@ -51,12 +46,12 @@ coffee -c /path/to/script.coffee
For documentation, usage, and examples, see: http://coffeescript.org/
To suggest a feature or report a bug: http://github.com/jashkenas/coffeescript/issues
To suggest a feature or report a bug: https://github.com/jashkenas/coffeescript/issues
If you'd like to chat, drop by #coffeescript on Freenode IRC.
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: http://github.com/jashkenas/coffeescript/contributors
Our lovely and talented contributors are listed here: https://github.com/jashkenas/coffeescript/contributors

View File

@@ -2,6 +2,17 @@
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/coffee-script/cake').run();
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/coffee-script')
];
for (var i = 0, len = potentialPaths.length; i < len; i++) {
if (fs.existsSync(potentialPaths[i])) {
require(potentialPaths[i] + '/cake').run();
break;
}
}

View File

@@ -2,6 +2,17 @@
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/coffee-script/command').run();
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/coffee-script')
];
for (var i = 0, len = potentialPaths.length; i < len; i++) {
if (fs.existsSync(potentialPaths[i])) {
require(potentialPaths[i] + '/command').run();
break;
}
}

View File

@@ -1,6 +1,5 @@
{
"name": "coffee-script",
"version": "1.11.0",
"main": [
"lib/coffee-script/coffee-script.js"
],
@@ -11,13 +10,6 @@
"coffeescript",
"compiler"
],
"devDependencies": {
"uglify-js": "~2.2",
"jison": ">=0.2.0",
"highlight.js": "~9.6.0",
"underscore": "~1.5.2",
"docco": "~0.6.2"
},
"author": {
"name": "Jeremy Ashkenas"
},

View File

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

@@ -116,7 +116,7 @@
<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="http://github.com/280north/jake">Jake</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

View File

@@ -140,13 +140,12 @@ SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-str
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>The current CoffeeScript version number.</p>
<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>exports.VERSION = <span class="hljs-string">'1.11.0'</span>
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>
<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>
@@ -157,11 +156,13 @@ exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span cla
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Expose helpers for testing.</p>
<p>The current CoffeeScript version number.</p>
</div>
<div class="content"><div class='highlight'><pre>exports.helpers = helpers</pre></div></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>
@@ -172,17 +173,11 @@ exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span cla
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Function that allows for btoa in both nodejs and the browser.</p>
<p>Expose helpers for testing.</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>
btoa(src)
<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>
<div class="content"><div class='highlight'><pre>exports.helpers = helpers</pre></div></div>
</li>
@@ -193,6 +188,45 @@ exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span cla
<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>
@@ -209,40 +243,94 @@ lexer/parser/compiler.</p>
</li>
<li id="section-6">
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
<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>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 programatic
lookups.</p>
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
generateSourceMap = options.sourceMap <span class="hljs-keyword">or</span> options.inlineMap
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>
<span class="hljs-keyword">if</span> generateSourceMap
map = <span class="hljs-keyword">new</span> SourceMap
</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-7">
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
<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>
@@ -256,13 +344,13 @@ the same name.</p>
</li>
<li id="section-8">
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Check for import or export; if found, force bare mode</p>
<p>Check for import or export; if found, force bare mode.</p>
</div>
@@ -284,13 +372,13 @@ the same name.</p>
</li>
<li id="section-9">
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Update the sourcemap with data from each fragment</p>
<p>Update the sourcemap with data from each fragment.</p>
</div>
@@ -299,11 +387,11 @@ the same name.</p>
</li>
<li id="section-10">
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>Do not include empty, whitespace, or semicolon-only fragments.</p>
@@ -324,11 +412,11 @@ the same name.</p>
</li>
<li id="section-11">
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>Copy the code from each fragment into the final JavaScript.</p>
@@ -342,6 +430,7 @@ the same name.</p>
<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
@@ -361,11 +450,11 @@ the same name.</p>
</li>
<li id="section-12">
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>
@@ -377,11 +466,11 @@ the same name.</p>
</li>
<li id="section-13">
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
<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,
@@ -398,11 +487,11 @@ or traverse it by using <code>.traverseChildren()</code> with a callback.</p>
</li>
<li id="section-14">
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
<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>
@@ -415,27 +504,27 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</li>
<li id="section-15">
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
<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">'.'</span></pre></div></div>
<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-16">
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Clear the module cache.</p>
@@ -446,17 +535,17 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</li>
<li id="section-17">
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
<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
<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>
@@ -465,11 +554,11 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</li>
<li id="section-18">
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Compile.</p>
@@ -484,11 +573,11 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</li>
<li id="section-19">
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
<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>
@@ -518,11 +607,11 @@ The CoffeeScript REPL uses this to run the input.</p>
</li>
<li id="section-20">
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
<a class="pilcrow" href="#section-25">&#182;</a>
</div>
<p>define module/require only if they chose not to specify their own</p>
@@ -539,11 +628,11 @@ The CoffeeScript REPL uses this to run the input.</p>
</li>
<li id="section-21">
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>use the same hack node currently uses for their own REPL</p>
@@ -565,11 +654,11 @@ exports.register = <span class="hljs-function">-&gt;</span> <span class="hljs-bu
</li>
<li id="section-22">
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
<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>
@@ -583,8 +672,22 @@ exports.register = <span class="hljs-function">-&gt;</span> <span class="hljs-bu
"""</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>
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
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, {
@@ -597,11 +700,11 @@ exports._compileFile = <span class="hljs-function"><span class="hljs-params">(fi
</li>
<li id="section-23">
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
<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
@@ -616,11 +719,11 @@ information to error so it can be pretty-printed later.</p>
</li>
<li id="section-24">
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
<a class="pilcrow" href="#section-30">&#182;</a>
</div>
<p>Instantiate a Lexer for our use here.</p>
@@ -631,11 +734,11 @@ information to error so it can be pretty-printed later.</p>
</li>
<li id="section-25">
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
<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
@@ -663,11 +766,11 @@ directly as a “Jison lexer”.</p>
</li>
<li id="section-26">
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
<a class="pilcrow" href="#section-32">&#182;</a>
</div>
<p>Make all the AST nodes visible to the parser.</p>
@@ -678,11 +781,11 @@ directly as a “Jison lexer”.</p>
</li>
<li id="section-27">
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
<a class="pilcrow" href="#section-33">&#182;</a>
</div>
<p>Override Jisons default error handling function.</p>
@@ -693,11 +796,11 @@ directly as a “Jison lexer”.</p>
</li>
<li id="section-28">
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">&#182;</a>
<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
@@ -721,11 +824,11 @@ the error is caused by a generated token which might refer to its origin.</p>
</li>
<li id="section-29">
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
<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>
@@ -739,11 +842,11 @@ from the lexer.</p>
</li>
<li id="section-30">
<li id="section-36">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">&#182;</a>
<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>
@@ -751,19 +854,19 @@ 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>
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
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 = frame.getFileName()
fileName <span class="hljs-keyword">or</span>= <span class="hljs-string">"&lt;anonymous&gt;"</span>
filename <span class="hljs-keyword">or</span>= <span class="hljs-string">"&lt;anonymous&gt;"</span>
line = frame.getLineNumber()
column = frame.getColumnNumber()</pre></div></div>
@@ -771,22 +874,22 @@ Modified to handle sourceMap</p>
</li>
<li id="section-31">
<li id="section-37">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-31">&#182;</a>
<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
<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-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>
<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()
@@ -797,13 +900,13 @@ Modified to handle sourceMap</p>
typeName = frame.getTypeName()
<span class="hljs-keyword">if</span> functionName
tp = as = <span class="hljs-string">''</span>
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>
as = <span class="hljs-string">" [as <span class="hljs-subst">#{methodName}</span>]"</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">#{as}</span> (<span class="hljs-subst">#{fileLocation}</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
@@ -811,52 +914,46 @@ Modified to handle sourceMap</p>
<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</pre></div></div>
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-32">
<li id="section-38">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-32">&#182;</a>
<a class="pilcrow" href="#section-38">&#182;</a>
</div>
<p>Map of filenames -&gt; sourceMap object.</p>
<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>sourceMaps = {}</pre></div></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-33">
<li id="section-39">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-33">&#182;</a>
</div>
<p>Generates the source map for a coffee file and stores it in the local cache variable.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">getSourceMap</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
<span class="hljs-keyword">return</span> sourceMaps[filename] <span class="hljs-keyword">if</span> sourceMaps[filename]
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> exports.FILE_EXTENSIONS
<span class="hljs-keyword">if</span> helpers.ends filename, ext
answer = exports._compileFile filename, <span class="hljs-literal">true</span>
<span class="hljs-keyword">return</span> sourceMaps[filename] = answer.sourceMap
<span class="hljs-keyword">return</span> <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-34">&#182;</a>
<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
@@ -868,12 +965,12 @@ positions.</p>
<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>
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">" 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>

View File

@@ -115,17 +115,17 @@
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>The CoffeeScript parser is generated by <a href="http://github.com/zaach/jison">Jison</a>
<p>The CoffeeScript parser is generated by <a href="https://github.com/zaach/jison">Jison</a>
from this grammar file. Jison is a bottom-up parser generator, similar in
style to <a href="http://www.gnu.org/software/bison">Bison</a>, implemented in JavaScript.
It can recognize <a href="http://en.wikipedia.org/wiki/LR_grammar">LALR(1), LR(0), SLR(1), and LR(1)</a>
It can recognize <a href="https://en.wikipedia.org/wiki/LR_grammar">LALR(1), LR(0), SLR(1), and LR(1)</a>
type grammars. To create the Jison parser, we list the pattern to match
on the left-hand side, and the action to take (usually the creation of syntax
tree nodes) on the right. As the parser runs, it
shifts tokens from our token stream, from left to right, and
<a href="http://en.wikipedia.org/wiki/Bottom-up_parsing">attempts to match</a>
<a href="https://en.wikipedia.org/wiki/Bottom-up_parsing">attempts to match</a>
the token sequence against the rules below. When a match can be made, it
reduces into the <a href="http://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols">nonterminal</a>
reduces into the <a href="https://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols">nonterminal</a>
(the enclosing name at the top), and we proceed from there.</p>
<p>If you run the <code>cake build:parser</code> command, Jison constructs a parse table
from our rules and saves it into <code>lib/parser.js</code>.</p>
@@ -199,7 +199,7 @@ wrapper and just returning the value directly.</p>
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Our handy DSL for Jison grammar generation, thanks to
<a href="http://github.com/creationix">Tim Caswell</a>. For every rule in the grammar,
<a href="https://github.com/creationix">Tim Caswell</a>. For every rule in the grammar,
we pass the pattern-defining string, the action to run, and extra options,
optionally. If no action is specified, we simply pass the value of the
previous nonterminal.</p>
@@ -575,6 +575,7 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
<div class="content"><div class='highlight'><pre> Return: [
o <span class="hljs-string">'RETURN Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Return $<span class="hljs-number">2</span>
o <span class="hljs-string">'RETURN INDENT Object OUTDENT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Return <span class="hljs-keyword">new</span> Value $<span class="hljs-number">3</span>
o <span class="hljs-string">'RETURN'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Return
]
@@ -928,6 +929,8 @@ and optional references to the superclass.</p>
ImportSpecifier: [
o <span class="hljs-string">'Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ImportSpecifier $<span class="hljs-number">1</span>
o <span class="hljs-string">'Identifier AS Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ImportSpecifier $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'DEFAULT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ImportSpecifier <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
o <span class="hljs-string">'DEFAULT AS Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ImportSpecifier <span class="hljs-keyword">new</span> Literal($<span class="hljs-number">1</span>), $<span class="hljs-number">3</span>
]
ImportDefaultSpecifier: [
@@ -965,6 +968,8 @@ and optional references to the superclass.</p>
o <span class="hljs-string">'Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ExportSpecifier $<span class="hljs-number">1</span>
o <span class="hljs-string">'Identifier AS Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ExportSpecifier $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Identifier AS DEFAULT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ExportSpecifier $<span class="hljs-number">1</span>, <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">3</span>
o <span class="hljs-string">'DEFAULT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ExportSpecifier <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
o <span class="hljs-string">'DEFAULT AS Identifier'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> ExportSpecifier <span class="hljs-keyword">new</span> Literal($<span class="hljs-number">1</span>), $<span class="hljs-number">3</span>
]</pre></div></div>
</li>
@@ -981,6 +986,7 @@ and optional references to the superclass.</p>
</div>
<div class="content"><div class='highlight'><pre> Invocation: [
o <span class="hljs-string">'Value OptFuncExist String'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> TaggedTemplateCall $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'Value OptFuncExist Arguments'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Call $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'Invocation OptFuncExist Arguments'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Call $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'Super'</span>
@@ -1344,12 +1350,12 @@ or postfix, with a single expression.</p>
ForBody: [
o <span class="hljs-string">'FOR Range'</span>, <span class="hljs-function">-&gt;</span> source: (LOC(<span class="hljs-number">2</span>) <span class="hljs-keyword">new</span> Value($<span class="hljs-number">2</span>))
o <span class="hljs-string">'FOR Range BY Expression'</span>, <span class="hljs-function">-&gt;</span> source: (LOC(<span class="hljs-number">2</span>) <span class="hljs-keyword">new</span> Value($<span class="hljs-number">2</span>)), step: $<span class="hljs-number">4</span>
o <span class="hljs-string">'ForStart ForSource'</span>, <span class="hljs-function">-&gt;</span> $<span class="hljs-number">2.</span>own = $<span class="hljs-number">1.</span>own; $<span class="hljs-number">2.</span>name = $<span class="hljs-number">1</span>[<span class="hljs-number">0</span>]; $<span class="hljs-number">2.</span>index = $<span class="hljs-number">1</span>[<span class="hljs-number">1</span>]; $<span class="hljs-number">2</span>
o <span class="hljs-string">'ForStart ForSource'</span>, <span class="hljs-function">-&gt;</span> $<span class="hljs-number">2.</span>own = $<span class="hljs-number">1.</span>own; $<span class="hljs-number">2.</span>ownTag = $<span class="hljs-number">1.</span>ownTag; $<span class="hljs-number">2.</span>name = $<span class="hljs-number">1</span>[<span class="hljs-number">0</span>]; $<span class="hljs-number">2.</span>index = $<span class="hljs-number">1</span>[<span class="hljs-number">1</span>]; $<span class="hljs-number">2</span>
]
ForStart: [
o <span class="hljs-string">'FOR ForVariables'</span>, <span class="hljs-function">-&gt;</span> $<span class="hljs-number">2</span>
o <span class="hljs-string">'FOR OWN ForVariables'</span>, <span class="hljs-function">-&gt;</span> $<span class="hljs-number">3.</span>own = <span class="hljs-literal">yes</span>; $<span class="hljs-number">3</span>
o <span class="hljs-string">'FOR OWN ForVariables'</span>, <span class="hljs-function">-&gt;</span> $<span class="hljs-number">3.</span>own = <span class="hljs-literal">yes</span>; $<span class="hljs-number">3.</span>ownTag = (LOC(<span class="hljs-number">2</span>) <span class="hljs-keyword">new</span> Literal($<span class="hljs-number">2</span>)); $<span class="hljs-number">3</span>
]</pre></div></div>
</li>
@@ -1416,6 +1422,8 @@ in fixed-size increments.</p>
o <span class="hljs-string">'FORIN Expression BY Expression'</span>, <span class="hljs-function">-&gt;</span> source: $<span class="hljs-number">2</span>, step: $<span class="hljs-number">4</span>
o <span class="hljs-string">'FORIN Expression WHEN Expression BY Expression'</span>, <span class="hljs-function">-&gt;</span> source: $<span class="hljs-number">2</span>, guard: $<span class="hljs-number">4</span>, step: $<span class="hljs-number">6</span>
o <span class="hljs-string">'FORIN Expression BY Expression WHEN Expression'</span>, <span class="hljs-function">-&gt;</span> source: $<span class="hljs-number">2</span>, step: $<span class="hljs-number">4</span>, guard: $<span class="hljs-number">6</span>
o <span class="hljs-string">'FORFROM Expression'</span>, <span class="hljs-function">-&gt;</span> source: $<span class="hljs-number">2</span>, from: <span class="hljs-literal">yes</span>
o <span class="hljs-string">'FORFROM Expression WHEN Expression'</span>, <span class="hljs-function">-&gt;</span> source: $<span class="hljs-number">2</span>, guard: $<span class="hljs-number">4</span>, from: <span class="hljs-literal">yes</span>
]
Switch: [
@@ -1527,7 +1535,7 @@ rules are necessary.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-65">&#182;</a>
</div>
<p><a href="http://jashkenas.github.com/coffee-script/#existence">The existential operator</a>.</p>
<p><a href="http://coffeescript.org/#existential-operator">The existential operator</a>.</p>
</div>
@@ -1540,7 +1548,12 @@ rules are necessary.</p>
o <span class="hljs-string">'Expression ** Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression SHIFT Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression COMPARE Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression LOGIC Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression &amp; Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression ^ Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression | Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression &amp;&amp; Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression || Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression BIN? Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'Expression RELATION Expression'</span>, <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">if</span> $<span class="hljs-number">2.</span>charAt(<span class="hljs-number">0</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'!'</span>
<span class="hljs-keyword">new</span> Op($<span class="hljs-number">2</span>[<span class="hljs-number">1.</span>.], $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>).invert()
@@ -1611,11 +1624,16 @@ down. Following these rules is what makes <code>2 + 3 * 4</code> parse as:</p>
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'SHIFT'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'RELATION'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'COMPARE'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'LOGIC'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'&amp;'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'^'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'|'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'&amp;&amp;'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'||'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'BIN?'</span>]
[<span class="hljs-string">'nonassoc'</span>, <span class="hljs-string">'INDENT'</span>, <span class="hljs-string">'OUTDENT'</span>]
[<span class="hljs-string">'right'</span>, <span class="hljs-string">'YIELD'</span>]
[<span class="hljs-string">'right'</span>, <span class="hljs-string">'='</span>, <span class="hljs-string">':'</span>, <span class="hljs-string">'COMPOUND_ASSIGN'</span>, <span class="hljs-string">'RETURN'</span>, <span class="hljs-string">'THROW'</span>, <span class="hljs-string">'EXTENDS'</span>]
[<span class="hljs-string">'right'</span>, <span class="hljs-string">'FORIN'</span>, <span class="hljs-string">'FOROF'</span>, <span class="hljs-string">'BY'</span>, <span class="hljs-string">'WHEN'</span>]
[<span class="hljs-string">'right'</span>, <span class="hljs-string">'FORIN'</span>, <span class="hljs-string">'FOROF'</span>, <span class="hljs-string">'FORFROM'</span>, <span class="hljs-string">'BY'</span>, <span class="hljs-string">'WHEN'</span>]
[<span class="hljs-string">'right'</span>, <span class="hljs-string">'IF'</span>, <span class="hljs-string">'ELSE'</span>, <span class="hljs-string">'FOR'</span>, <span class="hljs-string">'WHILE'</span>, <span class="hljs-string">'UNTIL'</span>, <span class="hljs-string">'LOOP'</span>, <span class="hljs-string">'SUPER'</span>, <span class="hljs-string">'CLASS'</span>, <span class="hljs-string">'IMPORT'</span>, <span class="hljs-string">'EXPORT'</span>]
[<span class="hljs-string">'left'</span>, <span class="hljs-string">'POST_IF'</span>]
]</pre></div></div>

View File

@@ -478,7 +478,7 @@ The object is returned either way.</p>
</div>
<p>Throws a SyntaxError from a given location.
The errors <code>toString</code> will return an error message following the “standard”
format <filename>:<line>:<col>: <message> plus the line with the error and a
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>

View File

@@ -171,6 +171,22 @@ parens. Unwrap all that.</p>
<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>
@@ -182,11 +198,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-5">
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Tokenize the clean input.</p>
@@ -197,11 +213,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-6">
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Collect referenced variable names just like in <code>CoffeeScript.compile</code>.</p>
@@ -214,11 +230,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-7">
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Generate the AST of the tokens.</p>
@@ -229,18 +245,18 @@ parens. Unwrap all that.</p>
</li>
<li id="section-8">
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
<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>
<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
@@ -249,11 +265,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-9">
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#182;</a>
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>ASTs <code>compile</code> does not add source code information to syntax errors.</p>
@@ -274,11 +290,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-10">
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Node 0.11.12 changed API, prompt is now _prompt.</p>
@@ -295,11 +311,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-11">
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Proxy nodes line listener</p>
@@ -320,11 +336,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-12">
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Handle Ctrl-v</p>
@@ -337,11 +353,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-13">
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>allow arbitrarily switching between modes any time before multiple lines are entered</p>
@@ -356,11 +372,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-14">
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>no-op unless the current line is empty</p>
@@ -371,11 +387,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-15">
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>eval, print, loop</p>
@@ -390,11 +406,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-16">
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>XXX: multiline hack</p>
@@ -412,11 +428,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-17">
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Store and load command history from a file</p>
@@ -429,11 +445,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-18">
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Get file info and at most maxSize of command history</p>
@@ -445,11 +461,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-19">
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#182;</a>
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Read last <code>size</code> bytes from the file</p>
@@ -458,22 +474,7 @@ parens. Unwrap all that.</p>
<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.close readFd</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 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>
fs.closeSync readFd</pre></div></div>
</li>
@@ -484,11 +485,11 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>If the history file was truncated we should pop off a potential partial line</p>
<p>Set the history on the interpreter</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>
<div class="content"><div class='highlight'><pre> repl.rli.history = buffer.toString().split(<span class="hljs-string">'\n'</span>).reverse()</pre></div></div>
</li>
@@ -499,6 +500,21 @@ parens. Unwrap all that.</p>
<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>
@@ -515,30 +531,30 @@ parens. Unwrap all that.</p>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Save the latest command in the file</p>
</div>
<div class="content"><div class='highlight'><pre> fs.write 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.close fd</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>
@@ -554,11 +570,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-25">
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
<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>
@@ -569,7 +585,7 @@ parens. Unwrap all that.</p>
<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)
[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>
@@ -587,11 +603,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-26">
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
<a class="pilcrow" href="#section-27">&#182;</a>
</div>
<p>Adapt help inherited from the node REPL</p>

View File

@@ -157,7 +157,7 @@ its internal array of tokens.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">exports</span>.<span class="hljs-title">Rewriter</span></span></pre></div></div>
<div class="content"><div class='highlight'><pre>exports.Rewriter = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Rewriter</span></span></pre></div></div>
</li>
@@ -168,11 +168,16 @@ its internal array of tokens.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Helpful snippet for debugging:</p>
<pre><code><span class="hljs-built_in">console</span>.log (t[<span class="hljs-number">0</span>] + <span class="hljs-string">'/'</span> + t[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> @tokens).join <span class="hljs-string">' '</span>
</code></pre>
<p>Rewrite the token stream in multiple passes, one logical filter at
a time. This could certainly be changed into a single pass through the
stream, with a big ol efficient switch, but its much nicer to work with
like this. The order of these passes matters indentation must be
corrected before implicit parentheses can be wrapped around blocks of code.</p>
</div>
<div class="content"><div class='highlight'><pre> rewrite: <span class="hljs-function"><span class="hljs-params">(@tokens)</span> -&gt;</span></pre></div></div>
</li>
@@ -182,22 +187,19 @@ its internal array of tokens.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Rewrite the token stream in multiple passes, one logical filter at
a time. This could certainly be changed into a single pass through the
stream, with a big ol efficient switch, but its much nicer to work with
like this. The order of these passes matters indentation must be
corrected before implicit parentheses can be wrapped around blocks of code.</p>
<p>Helpful snippet for debugging:
console.log (t[0] + / + t[1] for t in @tokens).join </p>
</div>
<div class="content"><div class='highlight'><pre> rewrite: <span class="hljs-function"><span class="hljs-params">(@tokens)</span> -&gt;</span>
@removeLeadingNewlines()
<div class="content"><div class='highlight'><pre> @removeLeadingNewlines()
@closeOpenCalls()
@closeOpenIndexes()
@normalizeLines()
@tagPostfixConditionals()
@addImplicitBracesAndParens()
@addLocationDataToGeneratedTokens()
@fixOutdentLocationData()
@tokens</pre></div></div>
</li>
@@ -448,9 +450,12 @@ and spliced, when returning for getting a new token.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">inImplicit</span> = -&gt;</span> stackTop()?[<span class="hljs-number">2</span>]?.ours
<span class="hljs-function"> <span class="hljs-title">inImplicitCall</span> = -&gt;</span> inImplicit() <span class="hljs-keyword">and</span> stackTop()?[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'('</span>
<span class="hljs-function"> <span class="hljs-title">inImplicitObject</span> = -&gt;</span> inImplicit() <span class="hljs-keyword">and</span> stackTop()?[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span></pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">isImplicit</span> = <span class="hljs-params">(stackItem)</span> -&gt;</span> stackItem?[<span class="hljs-number">2</span>]?.ours
<span class="hljs-function"> <span class="hljs-title">isImplicitObject</span> = <span class="hljs-params">(stackItem)</span> -&gt;</span> isImplicit(stackItem) <span class="hljs-keyword">and</span> stackItem?[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span>
<span class="hljs-function"> <span class="hljs-title">isImplicitCall</span> = <span class="hljs-params">(stackItem)</span> -&gt;</span> isImplicit(stackItem) <span class="hljs-keyword">and</span> stackItem?[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'('</span>
<span class="hljs-function"> <span class="hljs-title">inImplicit</span> = -&gt;</span> isImplicit stackTop()
<span class="hljs-function"> <span class="hljs-title">inImplicitCall</span> = -&gt;</span> isImplicitCall stackTop()
<span class="hljs-function"> <span class="hljs-title">inImplicitObject</span> = -&gt;</span> isImplicitObject stackTop()</pre></div></div>
</li>
@@ -471,7 +476,7 @@ class declaration or if-conditionals)</p>
<span class="hljs-title">startImplicitCall</span> = <span class="hljs-params">(j)</span> -&gt;</span>
idx = j ? i
stack.push [<span class="hljs-string">'('</span>, idx, ours: <span class="hljs-literal">yes</span>]
tokens.splice idx, <span class="hljs-number">0</span>, generate <span class="hljs-string">'CALL_START'</span>, <span class="hljs-string">'('</span>
tokens.splice idx, <span class="hljs-number">0</span>, generate <span class="hljs-string">'CALL_START'</span>, <span class="hljs-string">'('</span>, [<span class="hljs-string">''</span>, <span class="hljs-string">'implicit function call'</span>, token[<span class="hljs-number">2</span>]]
i += <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> j?
<span class="hljs-function">
<span class="hljs-title">endImplicitCall</span> = -&gt;</span>
@@ -508,7 +513,7 @@ class declaration or if-conditionals)</p>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> inImplicitCall() <span class="hljs-keyword">and</span> tag <span class="hljs-keyword">in</span> [<span class="hljs-string">'IF'</span>, <span class="hljs-string">'TRY'</span>, <span class="hljs-string">'FINALLY'</span>, <span class="hljs-string">'CATCH'</span>,
<span class="hljs-string">'CLASS'</span>, <span class="hljs-string">'SWITCH'</span>]
stack.push [<span class="hljs-string">'CONTROL'</span>, i, ours: <span class="hljs-literal">true</span>]
stack.push [<span class="hljs-string">'CONTROL'</span>, i, ours: <span class="hljs-literal">yes</span>]
<span class="hljs-keyword">return</span> forward(<span class="hljs-number">1</span>)
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span> inImplicit()</pre></div></div>
@@ -618,7 +623,7 @@ f a, f() b, f? c, h[0] d etc.</p>
a: b
b: c
</code></pre><p>Dont accept implicit calls of this type, when on the same line
as the control strucutures below as that may misinterpret constructs like:</p>
as the control structures below as that may misinterpret constructs like:</p>
<pre><code><span class="hljs-keyword">if</span> f
a: <span class="hljs-number">1</span>
</code></pre><p>as</p>
@@ -733,8 +738,23 @@ like e.g.:</p>
</code></pre>
</div>
<div class="content"><div class='highlight'><pre>
stackTop()[<span class="hljs-number">2</span>].sameLine = <span class="hljs-literal">no</span> <span class="hljs-keyword">if</span> inImplicitObject() <span class="hljs-keyword">and</span> tag <span class="hljs-keyword">in</span> LINEBREAKS
</li>
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
</div>
<p>Mark all enclosing objects as not sameLine</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> LINEBREAKS
<span class="hljs-keyword">for</span> stackItem <span class="hljs-keyword">in</span> stack <span class="hljs-keyword">by</span> <span class="hljs-number">-1</span>
<span class="hljs-keyword">break</span> <span class="hljs-keyword">unless</span> isImplicit stackItem
stackItem[<span class="hljs-number">2</span>].sameLine = <span class="hljs-literal">no</span> <span class="hljs-keyword">if</span> isImplicitObject stackItem
newLine = prevTag <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span> <span class="hljs-keyword">or</span> prevToken.newLine
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> IMPLICIT_END <span class="hljs-keyword">or</span> tag <span class="hljs-keyword">in</span> CALL_CLOSERS <span class="hljs-keyword">and</span> newLine
@@ -744,11 +764,11 @@ like e.g.:</p>
</li>
<li id="section-29">
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
<a class="pilcrow" href="#section-30">&#182;</a>
</div>
<p>Close implicit calls when reached end of argument list</p>
@@ -760,11 +780,11 @@ like e.g.:</p>
</li>
<li id="section-30">
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">&#182;</a>
<a class="pilcrow" href="#section-31">&#182;</a>
</div>
<p>Close implicit objects such as:
return a: 1, b: 2 unless true</p>
@@ -778,11 +798,11 @@ return a: 1, b: 2 unless true</p>
</li>
<li id="section-31">
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-31">&#182;</a>
<a class="pilcrow" href="#section-32">&#182;</a>
</div>
<p>Close implicit objects when at end of line, line didnt end with a comma
and the implicit object didnt start the line or the next line doesnt look like
@@ -800,11 +820,11 @@ the continuation of an object.</p>
</li>
<li id="section-32">
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-32">&#182;</a>
<a class="pilcrow" href="#section-33">&#182;</a>
</div>
<p>Close implicit object if comma is the last character
and what comes after doesnt look like it belongs.
@@ -825,11 +845,11 @@ e = <span class="hljs-number">2</span>
</li>
<li id="section-33">
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-33">&#182;</a>
<a class="pilcrow" href="#section-34">&#182;</a>
</div>
<p>When nextTag is OUTDENT the comma is insignificant and
should just be ignored so embed it in the implicit object.</p>
@@ -847,11 +867,11 @@ array further up the stack, so give it a chance.</p>
</li>
<li id="section-34">
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-34">&#182;</a>
<a class="pilcrow" href="#section-35">&#182;</a>
</div>
<p>Add location data to all tokens generated by the rewriter.</p>
@@ -877,11 +897,39 @@ array further up the stack, so give it a chance.</p>
</li>
<li id="section-35">
<li id="section-36">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-35">&#182;</a>
<a class="pilcrow" href="#section-36">&#182;</a>
</div>
<p>OUTDENT tokens should always be positioned at the last character of the
previous token, so that AST nodes ending in an OUTDENT token end up with a
location corresponding to the last “real” token under the node.</p>
</div>
<div class="content"><div class='highlight'><pre> fixOutdentLocationData: <span class="hljs-function">-&gt;</span>
@scanTokens (token, i, tokens) -&gt;
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span> <span class="hljs-keyword">unless</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span> <span class="hljs-keyword">or</span>
(token.generated <span class="hljs-keyword">and</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'CALL_END'</span>) <span class="hljs-keyword">or</span>
(token.generated <span class="hljs-keyword">and</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'}'</span>)
prevLocationData = tokens[i - <span class="hljs-number">1</span>][<span class="hljs-number">2</span>]
token[<span class="hljs-number">2</span>] =
first_line: prevLocationData.last_line
first_column: prevLocationData.last_column
last_line: prevLocationData.last_line
last_column: prevLocationData.last_column
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-37">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">&#182;</a>
</div>
<p>Because our grammar is LALR(1), it cant handle some single-line
expressions that lack ending delimiters. The <strong>Rewriter</strong> adds the implicit
@@ -899,7 +947,8 @@ blocks are added.</p>
<span class="hljs-keyword">not</span> (token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">and</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> EXPRESSION_CLOSE) <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> (token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'ELSE'</span> <span class="hljs-keyword">and</span> starter <span class="hljs-keyword">isnt</span> <span class="hljs-string">'THEN'</span>) <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> (token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'CATCH'</span>, <span class="hljs-string">'FINALLY'</span>] <span class="hljs-keyword">and</span> starter <span class="hljs-keyword">in</span> [<span class="hljs-string">'-&gt;'</span>, <span class="hljs-string">'=&gt;'</span>]) <span class="hljs-keyword">or</span>
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> CALL_CLOSERS <span class="hljs-keyword">and</span> @tokens[i - <span class="hljs-number">1</span>].newLine
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> CALL_CLOSERS <span class="hljs-keyword">and</span>
(@tokens[i - <span class="hljs-number">1</span>].newLine <span class="hljs-keyword">or</span> @tokens[i - <span class="hljs-number">1</span>][<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span>)
<span class="hljs-function">
<span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
@tokens.splice (<span class="hljs-keyword">if</span> @tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">','</span> <span class="hljs-keyword">then</span> i - <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> i), <span class="hljs-number">0</span>, outdent
@@ -931,11 +980,11 @@ blocks are added.</p>
</li>
<li id="section-36">
<li id="section-38">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-36">&#182;</a>
<a class="pilcrow" href="#section-38">&#182;</a>
</div>
<p>Tag postfix conditionals as such, so that we can parse them with a
different precedence.</p>
@@ -964,11 +1013,11 @@ different precedence.</p>
</li>
<li id="section-37">
<li id="section-39">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">&#182;</a>
<a class="pilcrow" href="#section-39">&#182;</a>
</div>
<p>Generate the indentation tokens, based on another token on the same line.</p>
@@ -989,11 +1038,11 @@ different precedence.</p>
</li>
<li id="section-38">
<li id="section-40">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-38">&#182;</a>
<a class="pilcrow" href="#section-40">&#182;</a>
</div>
<p>Look up a tag by token index.</p>
@@ -1004,11 +1053,11 @@ different precedence.</p>
</li>
<li id="section-39">
<li id="section-41">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-39">&#182;</a>
<a class="pilcrow" href="#section-41">&#182;</a>
</div>
<h2 id="constants">Constants</h2>
@@ -1017,11 +1066,11 @@ different precedence.</p>
</li>
<li id="section-40">
<li id="section-42">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-40">&#182;</a>
<a class="pilcrow" href="#section-42">&#182;</a>
</div>
</div>
@@ -1029,11 +1078,11 @@ different precedence.</p>
</li>
<li id="section-41">
<li id="section-43">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-41">&#182;</a>
<a class="pilcrow" href="#section-43">&#182;</a>
</div>
<p>List of the token pairs that must be balanced.</p>
@@ -1054,11 +1103,11 @@ different precedence.</p>
</li>
<li id="section-42">
<li id="section-44">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-42">&#182;</a>
<a class="pilcrow" href="#section-44">&#182;</a>
</div>
<p>The inverse mappings of <code>BALANCED_PAIRS</code> were trying to fix up, so we can
look things up from either end.</p>
@@ -1070,11 +1119,11 @@ look things up from either end.</p>
</li>
<li id="section-43">
<li id="section-45">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-43">&#182;</a>
<a class="pilcrow" href="#section-45">&#182;</a>
</div>
<p>The tokens that signal the start/end of a balanced pair.</p>
@@ -1090,11 +1139,11 @@ EXPRESSION_END = []
</li>
<li id="section-44">
<li id="section-46">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-44">&#182;</a>
<a class="pilcrow" href="#section-46">&#182;</a>
</div>
<p>Tokens that indicate the close of a clause of an expression.</p>
@@ -1105,11 +1154,11 @@ EXPRESSION_END = []
</li>
<li id="section-45">
<li id="section-47">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-45">&#182;</a>
<a class="pilcrow" href="#section-47">&#182;</a>
</div>
<p>Tokens that, if followed by an <code>IMPLICIT_CALL</code>, indicate a function invocation.</p>
@@ -1120,11 +1169,11 @@ EXPRESSION_END = []
</li>
<li id="section-46">
<li id="section-48">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-46">&#182;</a>
<a class="pilcrow" href="#section-48">&#182;</a>
</div>
<p>If preceded by an <code>IMPLICIT_FUNC</code>, indicates a function invocation.</p>
@@ -1144,11 +1193,11 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
</li>
<li id="section-47">
<li id="section-49">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-47">&#182;</a>
<a class="pilcrow" href="#section-49">&#182;</a>
</div>
<p>Tokens that always mark the end of an implicit call for single-liners.</p>
@@ -1160,11 +1209,11 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
</li>
<li id="section-48">
<li id="section-50">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-48">&#182;</a>
<a class="pilcrow" href="#section-50">&#182;</a>
</div>
<p>Single-line flavors of block expressions that have unclosed endings.
The grammar cant disambiguate them, so we insert the implicit indentation.</p>
@@ -1177,11 +1226,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
</li>
<li id="section-49">
<li id="section-51">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-49">&#182;</a>
<a class="pilcrow" href="#section-51">&#182;</a>
</div>
<p>Tokens that end a line.</p>
@@ -1192,11 +1241,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
</li>
<li id="section-50">
<li id="section-52">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-50">&#182;</a>
<a class="pilcrow" href="#section-52">&#182;</a>
</div>
<p>Tokens that close open calls when they follow a newline.</p>

View File

@@ -218,9 +218,9 @@ already exist.</p>
</div>
<div class="content"><div class='highlight'><pre> find: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<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, <span class="hljs-string">'var'</span>
@add name, type
<span class="hljs-literal">no</span></pre></div></div>
</li>

View File

@@ -406,7 +406,7 @@ column for the current line:</p>
</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="http://en.wikipedia.org/wiki/File:Uintvar_coding.svg">Wikipedia</a>).
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>

View File

@@ -0,0 +1,405 @@
/**
* CoffeeScript Compiler v1.12.7
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(u,xa,ya){if(null==u)throw new TypeError("The 'this' value for String.prototype."+ya+" must not be null or undefined");if(xa instanceof RegExp)throw new TypeError("First argument to String.prototype."+ya+" must not be a regular expression");return u+""};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(u,xa,ya){u!=Array.prototype&&u!=Object.prototype&&(u[xa]=ya.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,ya,e){if(xa){ya=$jscomp.global;u=u.split(".");for(e=0;e<u.length-1;e++){var ra=u[e];ra in ya||(ya[ra]={});ya=ya[ra]}u=u[u.length-1];e=ya[u];xa=xa(e);xa!=e&&null!=xa&&$jscomp.defineProperty(ya,u,{configurable:!0,writable:!0,value:xa})}};
$jscomp.polyfill("String.prototype.repeat",function(u){return u?u:function(u){var ya=$jscomp.checkStringArgs(this,null,"repeat");if(0>u||1342177279<u)throw new RangeError("Invalid count value");u|=0;for(var e="";u;)if(u&1&&(e+=ya),u>>>=1)ya+=ya;return e}},"es6","es3");$jscomp.findInternal=function(u,xa,ya){u instanceof String&&(u=String(u));for(var e=u.length,ra=0;ra<e;ra++){var r=u[ra];if(xa.call(ya,r,ra,u))return{i:ra,v:r}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(u){return u?u:function(u,ya){return $jscomp.findInternal(this,u,ya).v}},"es6","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 ya=0,e={next:function(){if(ya<u.length){var ra=ya++;return{value:xa(ra,u[ra]),done:!1}}e.next=function(){return{done:!0,value:void 0}};return e.next()}};e[Symbol.iterator]=function(){return e};return e};$jscomp.polyfill("Array.prototype.keys",function(u){return u?u:function(){return $jscomp.iteratorFromArray(this,function(u){return u})}},"es6","es3");
(function(u){var xa=function(){function u(e){return u[e]}u["../../package.json"]={name:"coffee-script",description:"Unfancy JavaScript",keywords:["javascript","language","coffeescript","compiler"],author:"Jeremy Ashkenas",version:"1.12.7",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":"^20170626.0.0","highlight.js":"~9.12.0",jison:"\x3e\x3d0.4.17","markdown-it":"^8.3.1",underscore:"~1.8.3"}};u["./helpers"]=function(){var e={};(function(){var u,r,x;e.starts=function(a,k,t){return k===a.substr(t,k.length)};e.ends=function(a,k,t){var f=k.length;return k===a.substr(a.length-
f-(t||0),f)};e.repeat=x=function(a,k){var f;for(f="";0<k;)k&1&&(f+=a),k>>>=1,a+=a;return f};e.compact=function(a){var f,b;var p=[];var x=0;for(b=a.length;x<b;x++)(f=a[x])&&p.push(f);return p};e.count=function(a,k){var f;var b=f=0;if(!k.length)return 1/0;for(;f=1+a.indexOf(k,f);)b++;return b};e.merge=function(f,k){return a(a({},f),k)};var a=e.extend=function(a,k){var f;for(f in k){var b=k[f];a[f]=b}return a};e.flatten=u=function(a){var f;var b=[];var x=0;for(f=a.length;x<f;x++){var e=a[x];"[object Array]"===
Object.prototype.toString.call(e)?b=b.concat(u(e)):b.push(e)}return b};e.del=function(a,k){var f=a[k];delete a[k];return f};e.some=null!=(r=Array.prototype.some)?r:function(a){var f;var b=0;for(f=this.length;b<f;b++){var x=this[b];if(a(x))return!0}return!1};e.invertLiterate=function(a){var f=!0;var b;var x=a.split("\n");var e=[];var I=0;for(b=x.length;I<b;I++)a=x[I],f&&/^([ ]{4}|[ ]{0,3}\t)/.test(a)?e.push(a):(f=/^\s*$/.test(a))?e.push(a):e.push("# "+a);return e.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};e.addLocationDataFn=function(a,k){return function(f){"object"===typeof f&&f.updateLocationDataIfMissing&&f.updateLocationDataIfMissing(b(a,k));return f}};e.locationDataToString=function(a){var f;"2"in a&&"first_line"in a[2]?f=a[2]:"first_line"in a&&(f=a);return f?f.first_line+1+":"+(f.first_column+1)+"-"+(f.last_line+1+":"+(f.last_column+1)):"No location data"};e.baseFileName=function(a,b,x){null==
b&&(b=!1);null==x&&(x=!1);a=a.split(x?/\\|\//:/\//);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(".")};e.isCoffee=function(a){return/\.((lit)?coffee|coffee\.md)$/.test(a)};e.isLiterate=function(a){return/\.(litcoffee|coffee\.md)$/.test(a)};e.throwSyntaxError=function(a,b){a=new SyntaxError(a);a.location=b;a.toString=za;a.stack=a.toString();throw a;};e.updateSyntaxError=function(a,b,x){a.toString===za&&(a.code||
(a.code=b),a.filename||(a.filename=x),a.stack=a.toString());return a};var za=function(){var a,b,e;if(!this.code||!this.location)return Error.prototype.toString.call(this);var p=this.location;var z=p.first_line;var I=p.first_column;var J=p.last_line;var F=p.last_column;null==J&&(J=z);null==F&&(F=I);var u=this.filename||"[stdin]";p=this.code.split("\n")[z];J=z===J?F+1:p.length;F=p.slice(0,I).replace(/[^\s]/g," ")+x("^",J-I);if("undefined"!==typeof process&&null!==process)var y=(null!=(a=process.stdout)?
a.isTTY:void 0)&&!(null!=(b=process.env)&&b.NODE_DISABLE_COLORS);if(null!=(e=this.colorful)?e:y)y=function(a){return"\u001b[1;31m"+a+"\u001b[0m"},p=p.slice(0,I)+y(p.slice(I,J))+p.slice(J),F=y(F);return u+":"+(z+1)+":"+(I+1)+": error: "+this.message+"\n"+p+"\n"+F};e.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 e}();u["./rewriter"]=function(){var e={};(function(){var u,
r,x=[].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};e.Rewriter=function(){function n(){}n.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};n.prototype.scanTokens=function(a){var c,b;var h=this.tokens;for(c=0;b=h[c];)c+=a.call(this,b,c,h);return!0};n.prototype.detectEnd=function(a,b,q){var c,w,n,L;var e=this.tokens;for(c=0;L=e[a];){if(0===c&&b.call(this,L,a))return q.call(this,L,a);if(!L||0>c)return q.call(this,L,a-1);(w=L[0],0<=x.call(f,w))?c+=1:(n=L[0],0<=x.call(k,n))&&--c;a+=1}return a-1};n.prototype.removeLeadingNewlines=function(){var a,b;var q=this.tokens;var h=a=0;for(b=q.length;a<b;h=++a){var f=q[h][0];if("TERMINATOR"!==
f)break}if(h)return this.tokens.splice(0,h)};n.prototype.closeOpenCalls=function(){var a=function(a,c){var h;return")"===(h=a[0])||"CALL_END"===h||"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,h){"CALL_START"===c[0]&&this.detectEnd(h+1,a,b);return 1})};n.prototype.closeOpenIndexes=function(){var a=function(a,c){var h;return"]"===(h=a[0])||"INDEX_END"===h};var b=function(a,c){return a[0]="INDEX_END"};
return this.scanTokens(function(c,h){"INDEX_START"===c[0]&&this.detectEnd(h+1,a,b);return 1})};n.prototype.indexOfTag=function(){var c,b,f,h;var n=arguments[0];var k=2<=arguments.length?a.call(arguments,1):[];var e=b=c=0;for(f=k.length;0<=f?b<f:b>f;e=0<=f?++b:--b){for(;"HERECOMMENT"===this.tag(n+e+c);)c+=2;if(null!=k[e]&&("string"===typeof k[e]&&(k[e]=[k[e]]),h=this.tag(n+e+c),0>x.call(k[e],h)))return-1}return n+e+c-1};n.prototype.looksObjectish=function(a){if(-1<this.indexOfTag(a,"@",null,":")||
-1<this.indexOfTag(a,null,":"))return!0;a=this.indexOfTag(a,f);if(-1<a){var c=null;this.detectEnd(a+1,function(a){var c;return c=a[0],0<=x.call(k,c)},function(a,b){return c=b});if(":"===this.tag(c+1))return!0}return!1};n.prototype.findTagsBackwards=function(a,b){var c,h,n,w,e,p,y;for(c=[];0<=a&&(c.length||(w=this.tag(a),0>x.call(b,w))&&((e=this.tag(a),0>x.call(f,e))||this.tokens[a].generated)&&(p=this.tag(a),0>x.call(Q,p)));)(h=this.tag(a),0<=x.call(k,h))&&c.push(this.tag(a)),(n=this.tag(a),0<=x.call(f,
n))&&c.length&&c.pop(),--a;return y=this.tag(a),0<=x.call(b,y)};n.prototype.addImplicitBracesAndParens=function(){var a=[];var n=null;return this.scanTokens(function(c,h,e){var q,w,p,t;var H=c[0];var K=(q=0<h?e[h-1]:[])[0];var u=(h<e.length-1?e[h+1]:[])[0];var z=function(){return a[a.length-1]};var D=h;var A=function(a){return h-D+a};var I=function(a){var c;return null!=a?null!=(c=a[2])?c.ours:void 0:void 0};var E=function(a){return I(a)&&"{"===(null!=a?a[0]:void 0)};var G=function(a){return I(a)&&
"("===(null!=a?a[0]:void 0)};var O=function(){return I(z())};var C=function(){return G(z())};var S=function(){return E(z())};var v=function(){var a;return O&&"CONTROL"===(null!=(a=z())?a[0]:void 0)};var X=function(f){var n=null!=f?f:h;a.push(["(",n,{ours:!0}]);e.splice(n,0,b("CALL_START","(",["","implicit function call",c[2]]));if(null==f)return h+=1};var R=function(){a.pop();e.splice(h,0,b("CALL_END",")",["","end of input",c[2]]));return h+=1};var M=function(f,n){null==n&&(n=!0);var q=null!=f?f:
h;a.push(["{",q,{sameLine:!0,startsLine:n,ours:!0}]);n=new String("{");n.generated=!0;e.splice(q,0,b("{",n,c));if(null==f)return h+=1};var r=function(f){f=null!=f?f:h;a.pop();e.splice(f,0,b("}","}",c));return h+=1};if(C()&&("IF"===H||"TRY"===H||"FINALLY"===H||"CATCH"===H||"CLASS"===H||"SWITCH"===H))return a.push(["CONTROL",h,{ours:!0}]),A(1);if("INDENT"===H&&O()){if("\x3d\x3e"!==K&&"-\x3e"!==K&&"["!==K&&"("!==K&&","!==K&&"{"!==K&&"TRY"!==K&&"ELSE"!==K&&"\x3d"!==K)for(;C();)R();v()&&a.pop();a.push([H,
h]);return A(1)}if(0<=x.call(f,H))return a.push([H,h]),A(1);if(0<=x.call(k,H)){for(;O();)C()?R():S()?r():a.pop();n=a.pop()}if((0<=x.call(J,H)&&c.spaced||"?"===H&&0<h&&!e[h-1].spaced)&&(0<=x.call(F,u)||0<=x.call(N,u)&&(null==(w=e[h+1])||!w.spaced)&&(null==(p=e[h+1])||!p.newLine)))return"?"===H&&(H=c[0]="FUNC_EXIST"),X(h+1),A(2);if(0<=x.call(J,H)&&-1<this.indexOfTag(h+1,"INDENT")&&this.looksObjectish(h+2)&&!this.findTagsBackwards(h,"CLASS EXTENDS IF CATCH SWITCH LEADING_WHEN FOR WHILE UNTIL".split(" ")))return X(h+
1),a.push(["INDENT",h+2]),A(3);if(":"===H){for(r=function(){var a;switch(!1){case a=this.tag(h-1),0>x.call(k,a):return n[1];case "@"!==this.tag(h-2):return h-2;default:return h-1}}.call(this);"HERECOMMENT"===this.tag(r-2);)r-=2;this.insideForDeclaration="FOR"===u;q=0===r||(t=this.tag(r-1),0<=x.call(Q,t))||e[r-1].newLine;if(z()&&(S=z(),t=S[0],v=S[1],("{"===t||"INDENT"===t&&"{"===this.tag(v-1))&&(q||","===this.tag(r-1)||"{"===this.tag(r-1))))return A(1);M(r,!!q);return A(2)}if(0<=x.call(Q,H))for(M=
a.length-1;0<=M;M+=-1){t=a[M];if(!I(t))break;E(t)&&(t[2].sameLine=!1)}M="OUTDENT"===K||q.newLine;if(0<=x.call(y,H)||0<=x.call(B,H)&&M)for(;O();)if(M=z(),t=M[0],v=M[1],q=M[2],M=q.sameLine,q=q.startsLine,C()&&","!==K)R();else if(S()&&!this.insideForDeclaration&&M&&"TERMINATOR"!==H&&":"!==K)r();else if(!S()||"TERMINATOR"!==H||","===K||q&&this.looksObjectish(h+1))break;else{if("HERECOMMENT"===u)return A(1);r()}if(!(","!==H||this.looksObjectish(h+1)||!S()||this.insideForDeclaration||"TERMINATOR"===u&&
this.looksObjectish(h+2)))for(u="OUTDENT"===u?1:0;S();)r(h+u);return A(1)})};n.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(a,b,f){var c,n;if(a[2]||!a.generated&&!a.explicit)return 1;if("{"===a[0]&&(c=null!=(n=f[b+1])?n[2]:void 0)){var q=c.first_line;c=c.first_column}else(c=null!=(q=f[b-1])?q[2]:void 0)?(q=c.last_line,c=c.last_column):q=c=0;a[2]={first_line:q,first_column:c,last_line:q,last_column:c};return 1})};n.prototype.fixOutdentLocationData=function(){return this.scanTokens(function(a,
b,f){if(!("OUTDENT"===a[0]||a.generated&&"CALL_END"===a[0]||a.generated&&"}"===a[0]))return 1;b=f[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})};n.prototype.normalizeLines=function(){var b,f;var n=b=f=null;var h=function(a,b){var c,f,h,e;return";"!==a[1]&&(c=a[0],0<=x.call(O,c))&&!("TERMINATOR"===a[0]&&(f=this.tag(b+1),0<=x.call(I,f)))&&!("ELSE"===a[0]&&"THEN"!==n)&&!!("CATCH"!==(h=a[0])&&"FINALLY"!==h||"-\x3e"!==n&&"\x3d\x3e"!==
n)||(e=a[0],0<=x.call(B,e))&&(this.tokens[b-1].newLine||"OUTDENT"===this.tokens[b-1][0])};var e=function(a,b){return this.tokens.splice(","===this.tag(b-1)?b-1:b,0,f)};return this.scanTokens(function(c,q,k){var w,p,t;c=c[0];if("TERMINATOR"===c){if("ELSE"===this.tag(q+1)&&"OUTDENT"!==this.tag(q-1))return k.splice.apply(k,[q,1].concat(a.call(this.indentation()))),1;if(w=this.tag(q+1),0<=x.call(I,w))return k.splice(q,1),0}if("CATCH"===c)for(w=p=1;2>=p;w=++p)if("OUTDENT"===(t=this.tag(q+w))||"TERMINATOR"===
t||"FINALLY"===t)return k.splice.apply(k,[q+w,0].concat(a.call(this.indentation()))),2+w;0<=x.call(G,c)&&"INDENT"!==this.tag(q+1)&&("ELSE"!==c||"IF"!==this.tag(q+1))&&(n=c,t=this.indentation(k[q]),b=t[0],f=t[1],"THEN"===n&&(b.fromThen=!0),k.splice(q+1,0,b),this.detectEnd(q+2,h,e),"THEN"===c&&k.splice(q,1));return 1})};n.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>x.call(G,b)};var f=function(b,c){if("INDENT"!==
b[0]||b.generated&&!b.fromThen)return a[0]="POST_"+a[0]};return this.scanTokens(function(c,n){if("IF"!==c[0])return 1;a=c;this.detectEnd(n+1,b,f);return 1})};n.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]};n.prototype.generate=b;n.prototype.tag=function(a){var b;return null!=(b=this.tokens[a])?b[0]:void 0};return n}();var za=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START",
"CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],["REGEX_START","REGEX_END"]];e.INVERSES=u={};var f=[];var k=[];var t=0;for(r=za.length;t<r;t++){var p=za[t];var z=p[0];p=p[1];f.push(u[p]=z);k.push(u[z]=p)}var I=["CATCH","THEN","ELSE","FINALLY"].concat(k);var J="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 N=["+","-"];var y="POST_IF FOR WHILE UNTIL WHEN BY LOOP TERMINATOR".split(" ");var G="ELSE -\x3e \x3d\x3e TRY FINALLY THEN".split(" ");var O="TERMINATOR CATCH FINALLY ELSE OUTDENT LEADING_WHEN".split(" ");var Q=["TERMINATOR","INDENT","OUTDENT"];var B=[".","?.","::","?::"]}).call(this);return e}();u["./lexer"]=function(){var e={};(function(){var ra,r=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},x=[].slice;var a=u("./rewriter");var b=a.Rewriter;
var za=a.INVERSES;a=u("./helpers");var f=a.count;var k=a.repeat;var t=a.invertLiterate;var p=a.throwSyntaxError;e.Lexer=function(){function a(){}a.prototype.tokenize=function(a,c){var f,Da;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(Da=
0;this.chunk=a.slice(Da);){var n=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken();var h=this.getLineAndColumnFromChunk(n);this.chunkLine=h[0];this.chunkColumn=h[1];Da+=n;if(c.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:Da}}this.closeIndentation();(f=this.ends.pop())&&this.error("missing "+f.tag,f.origin[2]);return!1===c.rewrite?this.tokens:(new b).rewrite(this.tokens)};
a.prototype.clean=function(a){a.charCodeAt(0)===Q&&(a=a.slice(1));a=a.replace(/\r/g,"").replace(Y,"");w.test(a)&&(a="\n"+a,this.chunkLine--);this.literate&&(a=t(a));return a};a.prototype.identifierToken=function(){var a,b,c,f,n,h,q;if(!(a=B.exec(this.chunk)))return 0;var e=a[0];var k=a[1];a=a[2];var x=k.length;var w=void 0;if("own"===k&&"FOR"===this.tag())return this.token("OWN",k),k.length;if("from"===k&&"YIELD"===this.tag())return this.token("FROM",k),k.length;if("as"===k&&this.seenImport){if("*"===
this.value())this.tokens[this.tokens.length-1][0]="IMPORT_ALL";else if(b=this.value(),0<=r.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",k),k.length}if("as"===k&&this.seenExport&&("IDENTIFIER"===(f=this.tag())||"DEFAULT"===f))return this.token("AS",k),k.length;if("default"===k&&this.seenExport&&("EXPORT"===(n=this.tag())||"AS"===n))return this.token("DEFAULT",k),k.length;b=this.tokens;b=b[b.length-
1];var p=a||null!=b&&("."===(h=b[0])||"?."===h||"::"===h||"?::"===h||!b.spaced&&"@"===b[0])?"PROPERTY":"IDENTIFIER";"IDENTIFIER"!==p||!(0<=r.call(J,k)||0<=r.call(F,k))||this.exportSpecifierList&&0<=r.call(F,k)?"IDENTIFIER"===p&&this.seenFor&&"from"===k&&I(b)&&(p="FORFROM",this.seenFor=!1):(p=k.toUpperCase(),"WHEN"===p&&(q=this.tag(),0<=r.call(sa,q))?p="LEADING_WHEN":"FOR"===p?this.seenFor=!0:"UNLESS"===p?p="IF":"IMPORT"===p?this.seenImport=!0:"EXPORT"===p?this.seenExport=!0:0<=r.call(ia,p)?p="UNARY":
0<=r.call(qa,p)&&("INSTANCEOF"!==p&&this.seenFor?(p="FOR"+p,this.seenFor=!1):(p="RELATION","!"===this.value()&&(w=this.tokens.pop(),k="!"+k))));"IDENTIFIER"===p&&0<=r.call(G,k)&&this.error("reserved word '"+k+"'",{length:k.length});if("PROPERTY"!==p){if(0<=r.call(y,k)){var t=k;k=N[k]}p=function(){switch(k){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 k;
default:return p}}()}h=this.token(p,k,0,x);t&&(h.origin=[p,t,h[2]]);w&&(t=[w[2].first_line,w[2].first_column],h[2].first_line=t[0],h[2].first_column=t[1]);a&&(t=e.lastIndexOf(":"),this.token(":",":",t,a.length));return e.length};a.prototype.numberToken=function(){var a,b;if(!(a=n.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 f=function(){switch(c.charAt(1)){case "b":return 2;case "o":return 8;case "x":return 16;default:return null}}();f=null!=f?parseInt(c.slice(2),f):parseFloat(c);if("b"===(b=c.charAt(1))||"o"===b)c="0x"+f.toString(16);
this.token(Infinity===f?"INFINITY":"NUMBER",c,0,a);return a};a.prototype.stringToken=function(){var a,b,c,f,n;var h=(U.exec(this.chunk)||[])[0];if(!h)return 0;this.tokens.length&&"from"===this.value()&&(this.seenImport||this.seenExport)&&(this.tokens[this.tokens.length-1][0]="FROM");var k=function(){switch(h){case "'":return W;case '"':return H;case "'''":return Z;case '"""':return T}}();var q=3===h.length;k=this.matchWithInterpolations(k,h);var e=k.tokens;var p=k.index;var x=e.length-1;k=h.charAt(0);
if(q){var w=null;for(q=function(){var a,c;var m=[];b=a=0;for(c=e.length;a<c;b=++a)n=e[b],"NEOSTRING"===n[0]&&m.push(n[1]);return m}().join("#{}");a=A.exec(q);)if(a=a[1],null===w||0<(f=a.length)&&f<w.length)w=a;w&&(c=RegExp("\\n"+w,"g"));this.mergeInterpolationTokens(e,{delimiter:k},function(a){return function(b,m){b=a.formatString(b,{delimiter:h});c&&(b=b.replace(c,"\n"));0===m&&(b=b.replace(Aa,""));m===x&&(b=b.replace(ma,""));return b}}(this))}else this.mergeInterpolationTokens(e,{delimiter:k},function(a){return function(b,
m){b=a.formatString(b,{delimiter:h});return b=b.replace(D,function(a,d){return 0===m&&0===d||m===x&&d+a.length===b.length?"":" "})}}(this));return p};a.prototype.commentToken=function(){var a,b;if(!(b=this.chunk.match(q)))return 0;var c=b[0];if(a=b[1])(b=X.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"+k(" ",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=S.exec(this.chunk)):this.error("regular expressions cannot begin with "+a[2],{offset:a.index+a[1].length});break;case !(a=this.matchWithInterpolations(ba,"///")):var f=a.tokens;var h=a.index;break;case !(a=
ic.exec(this.chunk)):var n=a[0];var k=a[1];a=a[2];this.validateEscapes(k,{isRegex:!0,offsetInChunk:1});k=this.formatRegex(k,{delimiter:"/"});h=n.length;var q=this.tokens;if(q=q[q.length-1])if(q.spaced&&(b=q[0],0<=r.call(ha,b))){if(!a||v.test(n))return 0}else if(c=q[0],0<=r.call(oa,c))return 0;a||this.error("missing / (unclosed regex)");break;default:return 0}c=E.exec(this.chunk.slice(h))[0];b=h+c.length;a=this.makeToken("REGEX",null,0,b);switch(!1){case !!aa.test(c):this.error("invalid regular expression flags "+
c,{offset:h,length:c.length});break;case !(n||1===f.length):null==k&&(k=this.formatHeregex(f[0][1]));this.token("REGEX",""+this.makeDelimitedLiteral(k,{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(f,{delimiter:'"',double:!0},this.formatHeregex),c&&(this.token(",",",",h-1,0),this.token("STRING",'"'+c+'"',h-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.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 f,h,n;for(f=this.indent-a;0<a;)if(h=this.indents[this.indents.length-1])if(h===this.outdebt)a-=this.outdebt,this.outdebt=0;else if(h<this.outdebt)this.outdebt-=
h,a-=h;else{var k=this.indents.pop()+this.outdebt;c&&(n=this.chunk[c],0<=r.call(ca,n))&&(f-=k-a,a=k);this.outdebt=0;this.pair("OUTDENT");this.token("OUTDENT",a,0,c);a-=k}else a=0;k&&(this.outdebt-=a);for(;";"===this.value();)this.tokens.pop();"TERMINATOR"===this.tag()||b||this.token("TERMINATOR","\n",c,0);this.indent=f;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,f,n,k;(a=c.exec(this.chunk))?(a=a[0],h.test(a)&&this.tagParameters()):a=this.chunk.charAt(0);var q=a;var e=this.tokens;if((e=e[e.length-1])&&0<=r.call(["\x3d"].concat(x.call(ea)),a)){var p=
!1;"\x3d"!==a||"||"!==(f=e[1])&&"\x26\x26"!==f||e.spaced||(e[0]="COMPOUND_ASSIGN",e[1]+="\x3d",e=this.tokens[this.tokens.length-2],p=!0);e&&"PROPERTY"!==e[0]&&(f=null!=(b=e.origin)?b:e,(b=z(e[1],f[1]))&&this.error(b,f[2]));if(p)return a.length}"{"===a&&this.seenImport?this.importSpecifierList=!0:this.importSpecifierList&&"}"===a?this.importSpecifierList=!1:"{"===a&&"EXPORT"===(null!=e?e[0]:void 0)?this.exportSpecifierList=!0:this.exportSpecifierList&&"}"===a&&(this.exportSpecifierList=!1);if(";"===
a)this.seenFor=this.seenImport=this.seenExport=!1,q="TERMINATOR";else if("*"===a&&"EXPORT"===e[0])q="EXPORT_ALL";else if(0<=r.call(pa,a))q="MATH";else if(0<=r.call(la,a))q="COMPARE";else if(0<=r.call(ea,a))q="COMPOUND_ASSIGN";else if(0<=r.call(ia,a))q="UNARY";else if(0<=r.call(fa,a))q="UNARY_MATH";else if(0<=r.call(ja,a))q="SHIFT";else if("?"===a&&null!=e&&e.spaced)q="BIN?";else if(e&&!e.spaced)if("("===a&&(n=e[0],0<=r.call(ha,n)))"?"===e[0]&&(e[0]="FUNC_EXIST"),q="CALL_START";else if("["===a&&(k=
e[0],0<=r.call(ka,k)))switch(q="INDEX_START",e[0]){case "?":e[0]="INDEX_SOAK"}n=this.makeToken(q,a);switch(a){case "(":case "{":case "[":this.ends.push({tag:za[a],origin:n});break;case ")":case "}":case "]":this.pair(a)}this.tokens.push(n);return a.length};a.prototype.tagParameters=function(){var a;if(")"!==this.tag())return this;var b=[];var c=this.tokens;var f=c.length;for(c[--f][0]="PARAM_END";a=c[--f];)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 f,h;var n=[];var k=c.length;if(this.chunk.slice(0,k)!==c)return null;for(h=this.chunk.slice(k);;){var e=b.exec(h)[0];this.validateEscapes(e,{isRegex:"/"===c.charAt(0),offsetInChunk:k});n.push(this.makeToken("NEOSTRING",e,k));h=h.slice(e.length);k+=e.length;if("#{"!==h.slice(0,2))break;var q=this.getLineAndColumnFromChunk(k+
1);e=q[0];q=q[1];q=(new a).tokenize(h.slice(1),{line:e,column:q,untilBalanced:!0});e=q.tokens;var p=q.index;p+=1;var x=e[0];q=e[e.length-1];x[0]=x[1]="(";q[0]=q[1]=")";q.origin=["","end of interpolation",q[2]];"TERMINATOR"===(null!=(f=e[1])?f[0]:void 0)&&e.splice(1,1);n.push(["TOKENS",e]);h=h.slice(p);k+=p}h.slice(0,c.length)!==c&&this.error("missing "+c,{length:c.length});b=n[0];f=n[n.length-1];b[2].first_column-=c.length;"\n"===f[1].substr(-1)?(f[2].last_line+=1,f[2].last_column=c.length-1):f[2].last_column+=
c.length;0===f[1].length&&--f[2].last_column;return{tokens:n,index:k+c.length}};a.prototype.mergeInterpolationTokens=function(a,b,c){var f,h,n,k;1<a.length&&(n=this.token("STRING_START","(",0,0));var e=this.tokens.length;var q=f=0;for(h=a.length;f<h;q=++f){var p=a[q];var x=p[0];var w=p[1];switch(x){case "TOKENS":if(2===w.length)continue;var t=w[0];var Ia=w;break;case "NEOSTRING":x=c.call(this,p[1],q);if(0===x.length)if(0===q)var m=this.tokens.length;else continue;2===q&&null!=m&&this.tokens.splice(m,
2);p[0]="STRING";p[1]=this.makeDelimitedLiteral(x,b);t=p;Ia=[p]}this.tokens.length>e&&(q=this.token("+","+"),q[2]={first_line:t[2].first_line,first_column:t[2].first_column,last_line:t[2].first_line,last_column:t[2].first_column});(k=this.tokens).push.apply(k,Ia)}if(n)return a=a[a.length-1],n.origin=["STRING",null,{first_line:n[2].first_line,first_column:n[2].first_column,last_line:a[2].last_line,last_column:a[2].last_column}],n=this.token("STRING_END",")"),n[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=f(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,f){null==c&&(c=0);null==f&&(f=b.length);var h={};var n=this.getLineAndColumnFromChunk(c);h.first_line=n[0];h.first_column=n[1];c=this.getLineAndColumnFromChunk(c+(0<f?f-1:0));h.last_line=c[0];h.last_column=c[1];return[a,b,h]};a.prototype.token=function(a,b,c,f,h){a=this.makeToken(a,b,c,f);h&&(a.origin=h);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 R.test(this.chunk)||(a=this.tag(),0<=r.call(xa,a))};a.prototype.formatString=function(a,b){return this.replaceUnicodeCodePointEscapes(a.replace(V,"$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"+k("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(ta,function(a){return function(c,f,h,n){if(f)return f;c=parseInt(h,16);1114111<c&&a.error("unicode code point escapes greater than \\u{10ffff} are not allowed",{offset:n+b.delimiter.length,length:h.length+
4});return a.unicodeCodePointToUnicodeEscapes(c)}}(this))};a.prototype.validateEscapes=function(a,b){var c,f;null==b&&(b={});if(c=(b.isRegex?ya:M).exec(a)){c[0];a=c[1];var h=c[2];var n=c[3];var k=c[4];var e=c[5];n="\\"+(h||n||k||e);return this.error((h?"octal escape sequences are not allowed":"invalid escape sequence")+" "+n,{offset:(null!=(f=b.offsetInChunk)?f:0)+c.index+a.length,length:n.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,f,h,n,k,e,q,p){switch(!1){case !c:return b.double?c+c:c;case !f:return"\\x00";case !h:return"\\"+h;case !n:return"\\n";case !k:return"\\r";case !e:return"\\u2028";case !q:return"\\u2029";case !p:return b.double?"\\"+p:p}});return""+b.delimiter+a+b.delimiter};a.prototype.error=function(a,b){var c,f,h,n,k;null==b&&(b={});b="first_line"in b?b:(n=this.getLineAndColumnFromChunk(null!=
(h=b.offset)?h:0),f=n[0],c=n[1],n,{first_line:f,first_column:c,last_column:c+(null!=(k=b.length)?k:1)-1});return p(a,b)};return a}();var z=function(a,b){null==b&&(b=a);switch(!1){case 0>r.call(x.call(J).concat(x.call(F)),a):return"keyword '"+b+"' can't be assigned";case 0>r.call(O,a):return"'"+b+"' can't be assigned";case 0>r.call(G,a):return"reserved word '"+b+"' can't be assigned";default:return!1}};e.isUnassignable=z;var I=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 J="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 N={and:"\x26\x26",or:"||",is:"\x3d\x3d",isnt:"!\x3d",not:"!",yes:"true",no:"false",on:"true",off:"false"};var y=function(){var a=[];for(ra in N)a.push(ra);
return a}();F=F.concat(y);var G="case function var void with const let enum native implements interface package private protected public static".split(" ");var O=["arguments","eval"];e.JS_FORBIDDEN=J.concat(G).concat(O);var Q=65279;var B=/^(?!\d)((?:(?!\s)[$\w\x7f-\uffff])+)([^\n\S]*:(?!:))?/;var n=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;var c=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>*\/%])\2=?|\?(\.|::)|\.{2,3})/;var w=/^[^\n\S]+/;var q=/^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/;
var h=/^[-=]>/;var K=/^(?:\n[^\n\S]*)+/;var P=/^`(?!``)((?:[^`\\]|\\[\s\S])*)`/;var L=/^```((?:[^`\\]|\\[\s\S]|`(?!``))*)```/;var U=/^(?:'''|"""|'|")/;var W=/^(?:[^\\']|\\[\s\S])*/;var H=/^(?:[^\\"#]|\\[\s\S]|\#(?!\{))*/;var Z=/^(?:[^\\']|\\[\s\S]|'(?!''))*/;var T=/^(?:[^\\"#]|\\[\s\S]|"(?!"")|\#(?!\{))*/;var V=/((?:\\\\)+)|\\[^\S\n]*\n\s*/g;var D=/\s*\n\s*/g;var A=/\n+([^\n\S]*)(?=\S)/g;var ic=/^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/;var E=/^\w*/;var aa=/^(?!.*(.).*\1)[imguy]*$/;
var ba=/^(?:[^\\\/#]|\\[\s\S]|\/(?!\/\/)|\#(?!\{))*/;var C=/((?:\\\\)+)|\\(\s)|\s+(?:#.*)?/g;var S=/^(\/|\/{3}\s*)(\*)/;var v=/^\/=?\s/;var X=/\*\//;var R=/^\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 ya=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7])|(x(?![\da-fA-F]{2}).{0,2})|(u\{(?![\da-fA-F]{1,}\})[^}]*\}?)|(u(?!\{|[\da-fA-F]{4}).{0,4}))/;var ta=/(\\\\)|\\u\{([\da-fA-F]+)\}/g;
var Aa=/^[^\n\S]*\n/;var ma=/\n[^\n\S]*$/;var Y=/\s+$/;var ea="-\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 fa=["!","~"];var ja=["\x3c\x3c","\x3e\x3e","\x3e\x3e\x3e"];var la="\x3d\x3d !\x3d \x3c \x3e \x3c\x3d \x3e\x3d".split(" ");var pa=["*","/","%","//","%%"];var qa=["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 oa=ka.concat(["++","--"]);var sa=["INDENT","OUTDENT","TERMINATOR"];var ca=[")","}","]"];var xa="\\ . ?. ?:: UNARY MATH UNARY_MATH + - ** SHIFT RELATION COMPARE \x26 ^ | \x26\x26 || BIN? THROW EXTENDS DEFAULT".split(" ")}).call(this);return e}();u["./parser"]=function(){var e={},ra={exports:e},r=function(){function e(){this.yy={}}var a=function(a,l,m,d){m=m||{};for(d=a.length;d--;m[a[d]]=
l);return m},b=[1,22],u=[1,25],f=[1,83],k=[1,79],t=[1,84],p=[1,85],z=[1,81],I=[1,82],J=[1,56],F=[1,58],N=[1,59],y=[1,60],G=[1,61],O=[1,62],Q=[1,49],B=[1,50],n=[1,32],c=[1,68],w=[1,69],q=[1,78],h=[1,47],K=[1,51],P=[1,52],L=[1,67],U=[1,65],W=[1,66],H=[1,64],Z=[1,42],T=[1,48],V=[1,63],D=[1,73],A=[1,74],r=[1,75],E=[1,76],aa=[1,46],ba=[1,72],C=[1,34],S=[1,35],v=[1,36],X=[1,37],R=[1,38],M=[1,39],ra=[1,86],ta=[1,6,32,42,131],Aa=[1,101],ma=[1,89],Y=[1,88],ea=[1,87],ia=[1,90],fa=[1,91],ja=[1,92],la=[1,93],
pa=[1,94],qa=[1,95],ha=[1,96],ka=[1,97],oa=[1,98],sa=[1,99],ca=[1,100],ya=[1,104],na=[1,6,31,32,42,66,71,74,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],Da=[2,167],va=[1,110],xa=[1,111],Ha=[1,112],Ka=[1,113],Fa=[1,115],Ra=[1,116],La=[1,109],Ga=[1,6,32,42,131,133,135,139,156],Wa=[2,27],da=[1,123],Za=[1,121],Ea=[1,6,31,32,40,41,42,66,71,74,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],Ia=[2,95],m=[1,6,31,32,42,46,66,71,74,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],l=[2,74],d=[1,128],Ca=[1,133],Ja=[1,134],ua=[1,136],Na=[1,6,31,32,40,41,42,55,66,71,74,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],wa=[2,92],Gb=[1,6,32,42,66,71,74,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],$a=[2,64],Hb=[1,161],Ib=[1,167],ab=[1,179],Va=[1,181],Jb=[1,176],Qa=[1,183],ub=[1,185],Oa=[1,6,31,32,40,41,42,55,66,71,74,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],Kb=[2,111],Lb=[1,6,31,32,40,41,42,58,66,71,74,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],Mb=[1,6,31,32,40,41,
42,46,58,66,71,74,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],Nb=[40,41,114],Ob=[1,242],vb=[1,241],Pa=[1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156],Ma=[2,72],Pb=[1,251],Ua=[6,31,32,66,71],hb=[6,31,32,55,66,71,74],bb=[1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,159,160,164,166,167,168,169,170,171,172,173,174],Qb=[40,41,82,83,84,85,87,90,113,114],ib=[1,270],cb=[2,62],
jb=[1,281],Xa=[1,283],wb=[1,288],db=[1,290],Rb=[2,188],xb=[1,6,31,32,40,41,42,55,66,71,74,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],kb=[1,299],Sa=[6,31,32,71,115,120],Sb=[1,6,31,32,40,41,42,55,58,66,71,74,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],Tb=[1,6,31,32,42,66,71,74,89,94,115,120,122,
131,140,156],Ya=[1,6,31,32,42,66,71,74,89,94,115,120,122,131,134,140,156],lb=[146,147,148],mb=[71,146,147,148],nb=[6,31,94],Ub=[1,313],Ba=[6,31,32,71,94],Vb=[6,31,32,58,71,94],yb=[6,31,32,55,58,71,94],Wb=[1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,159,160,166,167,168,169,170,171,172,173,174],Xb=[12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,63,64,68,69,89,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,158,159,160,161,162],Yb=[2,177],Ta=[6,31,32],eb=[2,
73],Zb=[1,325],$b=[1,326],ac=[1,6,31,32,42,66,71,74,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],ob=[32,151,153],bc=[1,6,32,42,66,71,74,89,94,115,120,122,131,134,140,156],pb=[1,353],zb=[1,359],Ab=[1,6,32,42,131,156],fb=[2,87],qb=[1,370],rb=[1,371],cc=[1,6,31,32,42,66,71,74,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],Bb=[1,6,31,32,42,66,71,74,89,94,115,120,122,131,
133,135,139,140,156],dc=[1,384],ec=[1,385],Cb=[6,31,32,94],fc=[6,31,32,71],Db=[1,6,31,32,42,66,71,74,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],gc=[31,71],sb=[1,411],tb=[1,412],Eb=[1,418],Fb=[1,419],hc={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,Object:62,HERECOMMENT:63,PARAM_START:64,ParamList:65,
PARAM_END:66,FuncGlyph:67,"-\x3e":68,"\x3d\x3e":69,OptComma:70,",":71,Param:72,ParamVar:73,"...":74,Array: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",63:"HERECOMMENT",64:"PARAM_START",66:"PARAM_END",68:"-\x3e",69:"\x3d\x3e",71:",",74:"...",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,4],[10,1],[9,3],[9,2],[11,1],[17,5],[17,2],[67,1],[67,1],[70,0],[70,1],[65,0],[65,1],[65,3],[65,4],[65,6],[72,1],[72,2],[72,3],[72,1],[73,1],
[73,1],[73,1],[73,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],[62,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],[75,2],[75,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,l,m,d,Ca,b,g){a=b.length-1;switch(Ca){case 1:return this.$=d.addLocationDataFn(g[a],
g[a])(new d.Block);case 2:return this.$=b[a];case 3:this.$=d.addLocationDataFn(g[a],g[a])(d.Block.wrap([b[a]]));break;case 4:this.$=d.addLocationDataFn(g[a-2],g[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 72:case 73:case 83:case 84:case 85:case 86:case 91:case 92:case 95:case 99:case 105:case 164:case 188:case 189:case 191:case 221:case 222:case 240:case 246:this.$=
b[a];break;case 11:this.$=d.addLocationDataFn(g[a],g[a])(new d.StatementLiteral(b[a]));break;case 27:this.$=d.addLocationDataFn(g[a],g[a])(new d.Op(b[a],new d.Value(new d.Literal(""))));break;case 28:case 250:case 251:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op(b[a-1],b[a]));break;case 29:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Op(b[a-2].concat(b[a-1]),b[a]));break;case 30:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Block);break;case 31:case 106:this.$=d.addLocationDataFn(g[a-2],g[a])(b[a-
1]);break;case 32:this.$=d.addLocationDataFn(g[a],g[a])(new d.IdentifierLiteral(b[a]));break;case 33:this.$=d.addLocationDataFn(g[a],g[a])(new d.PropertyName(b[a]));break;case 34:this.$=d.addLocationDataFn(g[a],g[a])(new d.NumberLiteral(b[a]));break;case 36:this.$=d.addLocationDataFn(g[a],g[a])(new d.StringLiteral(b[a]));break;case 37:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.StringWithInterpolations(b[a-1]));break;case 38:this.$=d.addLocationDataFn(g[a],g[a])(new d.RegexLiteral(b[a]));break;
case 39:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.RegexWithInterpolations(b[a-1].args));break;case 41:this.$=d.addLocationDataFn(g[a],g[a])(new d.PassthroughLiteral(b[a]));break;case 43:this.$=d.addLocationDataFn(g[a],g[a])(new d.UndefinedLiteral);break;case 44:this.$=d.addLocationDataFn(g[a],g[a])(new d.NullLiteral);break;case 45:this.$=d.addLocationDataFn(g[a],g[a])(new d.BooleanLiteral(b[a]));break;case 46:this.$=d.addLocationDataFn(g[a],g[a])(new d.InfinityLiteral(b[a]));break;case 47:this.$=
d.addLocationDataFn(g[a],g[a])(new d.NaNLiteral);break;case 48:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Assign(b[a-2],b[a]));break;case 49:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Assign(b[a-3],b[a]));break;case 50:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Assign(b[a-4],b[a-1]));break;case 51:case 88:case 93:case 94:case 96:case 97:case 98:case 223:case 224:this.$=d.addLocationDataFn(g[a],g[a])(new d.Value(b[a]));break;case 52:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Assign(d.addLocationDataFn(g[a-
2])(new d.Value(b[a-2])),b[a],"object",{operatorToken:d.addLocationDataFn(g[a-1])(new d.Literal(b[a-1]))}));break;case 53:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Assign(d.addLocationDataFn(g[a-4])(new d.Value(b[a-4])),b[a-1],"object",{operatorToken:d.addLocationDataFn(g[a-3])(new d.Literal(b[a-3]))}));break;case 54:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Assign(d.addLocationDataFn(g[a-2])(new d.Value(b[a-2])),b[a],null,{operatorToken:d.addLocationDataFn(g[a-1])(new d.Literal(b[a-1]))}));
break;case 55:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Assign(d.addLocationDataFn(g[a-4])(new d.Value(b[a-4])),b[a-1],null,{operatorToken:d.addLocationDataFn(g[a-3])(new d.Literal(b[a-3]))}));break;case 62:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Return(b[a]));break;case 63:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Return(new d.Value(b[a-1])));break;case 64:this.$=d.addLocationDataFn(g[a],g[a])(new d.Return);break;case 65:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.YieldReturn(b[a]));
break;case 66:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.YieldReturn);break;case 67:this.$=d.addLocationDataFn(g[a],g[a])(new d.Comment(b[a]));break;case 68:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Code(b[a-3],b[a],b[a-1]));break;case 69:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Code([],b[a],b[a-1]));break;case 70:this.$=d.addLocationDataFn(g[a],g[a])("func");break;case 71:this.$=d.addLocationDataFn(g[a],g[a])("boundfunc");break;case 74:case 111:this.$=d.addLocationDataFn(g[a],g[a])([]);
break;case 75:case 112:case 131:case 151:case 183:case 225:this.$=d.addLocationDataFn(g[a],g[a])([b[a]]);break;case 76:case 113:case 132:case 152:case 184:this.$=d.addLocationDataFn(g[a-2],g[a])(b[a-2].concat(b[a]));break;case 77:case 114:case 133:case 153:case 185:this.$=d.addLocationDataFn(g[a-3],g[a])(b[a-3].concat(b[a]));break;case 78:case 115:case 135:case 155:case 187:this.$=d.addLocationDataFn(g[a-5],g[a])(b[a-5].concat(b[a-2]));break;case 79:this.$=d.addLocationDataFn(g[a],g[a])(new d.Param(b[a]));
break;case 80:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Param(b[a-1],null,!0));break;case 81:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Param(b[a-2],b[a]));break;case 82:case 190:this.$=d.addLocationDataFn(g[a],g[a])(new d.Expansion);break;case 87:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Splat(b[a-1]));break;case 89:this.$=d.addLocationDataFn(g[a-1],g[a])(b[a-1].add(b[a]));break;case 90:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Value(b[a-1],[].concat(b[a])));break;case 100:this.$=
d.addLocationDataFn(g[a-1],g[a])(new d.Access(b[a]));break;case 101:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Access(b[a],"soak"));break;case 102:this.$=d.addLocationDataFn(g[a-1],g[a])([d.addLocationDataFn(g[a-1])(new d.Access(new d.PropertyName("prototype"))),d.addLocationDataFn(g[a])(new d.Access(b[a]))]);break;case 103:this.$=d.addLocationDataFn(g[a-1],g[a])([d.addLocationDataFn(g[a-1])(new d.Access(new d.PropertyName("prototype"),"soak")),d.addLocationDataFn(g[a])(new d.Access(b[a]))]);break;
case 104:this.$=d.addLocationDataFn(g[a],g[a])(new d.Access(new d.PropertyName("prototype")));break;case 107:this.$=d.addLocationDataFn(g[a-1],g[a])(d.extend(b[a],{soak:!0}));break;case 108:this.$=d.addLocationDataFn(g[a],g[a])(new d.Index(b[a]));break;case 109:this.$=d.addLocationDataFn(g[a],g[a])(new d.Slice(b[a]));break;case 110:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Obj(b[a-2],b[a-3].generated));break;case 116:this.$=d.addLocationDataFn(g[a],g[a])(new d.Class);break;case 117:this.$=d.addLocationDataFn(g[a-
1],g[a])(new d.Class(null,null,b[a]));break;case 118:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Class(null,b[a]));break;case 119:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Class(null,b[a-1],b[a]));break;case 120:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Class(b[a]));break;case 121:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Class(b[a-1],null,b[a]));break;case 122:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Class(b[a-2],b[a]));break;case 123:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Class(b[a-
3],b[a-1],b[a]));break;case 124:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.ImportDeclaration(null,b[a]));break;case 125:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.ImportDeclaration(new d.ImportClause(b[a-2],null),b[a]));break;case 126:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.ImportDeclaration(new d.ImportClause(null,b[a-2]),b[a]));break;case 127:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.ImportDeclaration(new d.ImportClause(null,new d.ImportSpecifierList([])),b[a]));break;case 128:this.$=
d.addLocationDataFn(g[a-6],g[a])(new d.ImportDeclaration(new d.ImportClause(null,new d.ImportSpecifierList(b[a-4])),b[a]));break;case 129:this.$=d.addLocationDataFn(g[a-5],g[a])(new d.ImportDeclaration(new d.ImportClause(b[a-4],b[a-2]),b[a]));break;case 130:this.$=d.addLocationDataFn(g[a-8],g[a])(new d.ImportDeclaration(new d.ImportClause(b[a-7],new d.ImportSpecifierList(b[a-4])),b[a]));break;case 134:case 154:case 170:case 186:this.$=d.addLocationDataFn(g[a-3],g[a])(b[a-2]);break;case 136:this.$=
d.addLocationDataFn(g[a],g[a])(new d.ImportSpecifier(b[a]));break;case 137:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ImportSpecifier(b[a-2],b[a]));break;case 138:this.$=d.addLocationDataFn(g[a],g[a])(new d.ImportSpecifier(new d.Literal(b[a])));break;case 139:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ImportSpecifier(new d.Literal(b[a-2]),b[a]));break;case 140:this.$=d.addLocationDataFn(g[a],g[a])(new d.ImportDefaultSpecifier(b[a]));break;case 141:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ImportNamespaceSpecifier(new d.Literal(b[a-
2]),b[a]));break;case 142:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList([])));break;case 143:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList(b[a-2])));break;case 144:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.ExportNamedDeclaration(b[a]));break;case 145:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-2],b[a],null,{moduleDeclaration:"export"})));break;case 146:this.$=
d.addLocationDataFn(g[a-4],g[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-3],b[a],null,{moduleDeclaration:"export"})));break;case 147:this.$=d.addLocationDataFn(g[a-5],g[a])(new d.ExportNamedDeclaration(new d.Assign(b[a-4],b[a-1],null,{moduleDeclaration:"export"})));break;case 148:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ExportDefaultDeclaration(b[a]));break;case 149:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.ExportAllDeclaration(new d.Literal(b[a-2]),b[a]));break;case 150:this.$=d.addLocationDataFn(g[a-
6],g[a])(new d.ExportNamedDeclaration(new d.ExportSpecifierList(b[a-4]),b[a]));break;case 156:this.$=d.addLocationDataFn(g[a],g[a])(new d.ExportSpecifier(b[a]));break;case 157:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ExportSpecifier(b[a-2],b[a]));break;case 158:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.ExportSpecifier(b[a-2],new d.Literal(b[a])));break;case 159:this.$=d.addLocationDataFn(g[a],g[a])(new d.ExportSpecifier(new d.Literal(b[a])));break;case 160:this.$=d.addLocationDataFn(g[a-
2],g[a])(new d.ExportSpecifier(new d.Literal(b[a-2]),b[a]));break;case 161:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.TaggedTemplateCall(b[a-2],b[a],b[a-1]));break;case 162:case 163:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Call(b[a-2],b[a],b[a-1]));break;case 165:this.$=d.addLocationDataFn(g[a],g[a])(new d.SuperCall);break;case 166:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.SuperCall(b[a]));break;case 167:this.$=d.addLocationDataFn(g[a],g[a])(!1);break;case 168:this.$=d.addLocationDataFn(g[a],
g[a])(!0);break;case 169:this.$=d.addLocationDataFn(g[a-1],g[a])([]);break;case 171:case 172:this.$=d.addLocationDataFn(g[a],g[a])(new d.Value(new d.ThisLiteral));break;case 173:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Value(d.addLocationDataFn(g[a-1])(new d.ThisLiteral),[d.addLocationDataFn(g[a])(new d.Access(b[a]))],"this"));break;case 174:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Arr([]));break;case 175:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Arr(b[a-2]));break;case 176:this.$=d.addLocationDataFn(g[a],
g[a])("inclusive");break;case 177:this.$=d.addLocationDataFn(g[a],g[a])("exclusive");break;case 178:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Range(b[a-3],b[a-1],b[a-2]));break;case 179:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Range(b[a-2],b[a],b[a-1]));break;case 180:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Range(b[a-1],null,b[a]));break;case 181:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Range(null,b[a],b[a-1]));break;case 182:this.$=d.addLocationDataFn(g[a],g[a])(new d.Range(null,
null,b[a]));break;case 192:this.$=d.addLocationDataFn(g[a-2],g[a])([].concat(b[a-2],b[a]));break;case 193:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Try(b[a]));break;case 194:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Try(b[a-1],b[a][0],b[a][1]));break;case 195:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Try(b[a-2],null,null,b[a]));break;case 196:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Try(b[a-3],b[a-2][0],b[a-2][1],b[a]));break;case 197:this.$=d.addLocationDataFn(g[a-2],g[a])([b[a-
1],b[a]]);break;case 198:this.$=d.addLocationDataFn(g[a-2],g[a])([d.addLocationDataFn(g[a-1])(new d.Value(b[a-1])),b[a]]);break;case 199:this.$=d.addLocationDataFn(g[a-1],g[a])([null,b[a]]);break;case 200:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Throw(b[a]));break;case 201:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Parens(b[a-1]));break;case 202:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Parens(b[a-2]));break;case 203:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.While(b[a]));break;case 204:this.$=
d.addLocationDataFn(g[a-3],g[a])(new d.While(b[a-2],{guard:b[a]}));break;case 205:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.While(b[a],{invert:!0}));break;case 206:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.While(b[a-2],{invert:!0,guard:b[a]}));break;case 207:this.$=d.addLocationDataFn(g[a-1],g[a])(b[a-1].addBody(b[a]));break;case 208:case 209:this.$=d.addLocationDataFn(g[a-1],g[a])(b[a].addBody(d.addLocationDataFn(g[a-1])(d.Block.wrap([b[a-1]]))));break;case 210:this.$=d.addLocationDataFn(g[a],
g[a])(b[a]);break;case 211:this.$=d.addLocationDataFn(g[a-1],g[a])((new d.While(d.addLocationDataFn(g[a-1])(new d.BooleanLiteral("true")))).addBody(b[a]));break;case 212:this.$=d.addLocationDataFn(g[a-1],g[a])((new d.While(d.addLocationDataFn(g[a-1])(new d.BooleanLiteral("true")))).addBody(d.addLocationDataFn(g[a])(d.Block.wrap([b[a]]))));break;case 213:case 214:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.For(b[a-1],b[a]));break;case 215:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.For(b[a],b[a-
1]));break;case 216:this.$=d.addLocationDataFn(g[a-1],g[a])({source:d.addLocationDataFn(g[a])(new d.Value(b[a]))});break;case 217:this.$=d.addLocationDataFn(g[a-3],g[a])({source:d.addLocationDataFn(g[a-2])(new d.Value(b[a-2])),step:b[a]});break;case 218:d=d.addLocationDataFn(g[a-1],g[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 219:this.$=d.addLocationDataFn(g[a-1],g[a])(b[a]);break;case 220:Ca=d.addLocationDataFn(g[a-2],g[a]);
b[a].own=!0;b[a].ownTag=d.addLocationDataFn(g[a-1])(new d.Literal(b[a-1]));this.$=Ca(b[a]);break;case 226:this.$=d.addLocationDataFn(g[a-2],g[a])([b[a-2],b[a]]);break;case 227:this.$=d.addLocationDataFn(g[a-1],g[a])({source:b[a]});break;case 228:this.$=d.addLocationDataFn(g[a-1],g[a])({source:b[a],object:!0});break;case 229:this.$=d.addLocationDataFn(g[a-3],g[a])({source:b[a-2],guard:b[a]});break;case 230:this.$=d.addLocationDataFn(g[a-3],g[a])({source:b[a-2],guard:b[a],object:!0});break;case 231:this.$=
d.addLocationDataFn(g[a-3],g[a])({source:b[a-2],step:b[a]});break;case 232:this.$=d.addLocationDataFn(g[a-5],g[a])({source:b[a-4],guard:b[a-2],step:b[a]});break;case 233:this.$=d.addLocationDataFn(g[a-5],g[a])({source:b[a-4],step:b[a-2],guard:b[a]});break;case 234:this.$=d.addLocationDataFn(g[a-1],g[a])({source:b[a],from:!0});break;case 235:this.$=d.addLocationDataFn(g[a-3],g[a])({source:b[a-2],guard:b[a],from:!0});break;case 236:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Switch(b[a-3],b[a-1]));
break;case 237:this.$=d.addLocationDataFn(g[a-6],g[a])(new d.Switch(b[a-5],b[a-3],b[a-1]));break;case 238:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Switch(null,b[a-1]));break;case 239:this.$=d.addLocationDataFn(g[a-5],g[a])(new d.Switch(null,b[a-3],b[a-1]));break;case 241:this.$=d.addLocationDataFn(g[a-1],g[a])(b[a-1].concat(b[a]));break;case 242:this.$=d.addLocationDataFn(g[a-2],g[a])([[b[a-1],b[a]]]);break;case 243:this.$=d.addLocationDataFn(g[a-3],g[a])([[b[a-2],b[a-1]]]);break;case 244:this.$=
d.addLocationDataFn(g[a-2],g[a])(new d.If(b[a-1],b[a],{type:b[a-2]}));break;case 245:this.$=d.addLocationDataFn(g[a-4],g[a])(b[a-4].addElse(d.addLocationDataFn(g[a-2],g[a])(new d.If(b[a-1],b[a],{type:b[a-2]}))));break;case 247:this.$=d.addLocationDataFn(g[a-2],g[a])(b[a-2].addElse(b[a]));break;case 248:case 249:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.If(b[a],d.addLocationDataFn(g[a-2])(d.Block.wrap([b[a-2]])),{type:b[a-1],statement:!0}));break;case 252:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("-",
b[a]));break;case 253:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("+",b[a]));break;case 254:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("--",b[a]));break;case 255:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("++",b[a]));break;case 256:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("--",b[a-1],null,!0));break;case 257:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Op("++",b[a-1],null,!0));break;case 258:this.$=d.addLocationDataFn(g[a-1],g[a])(new d.Existence(b[a-1]));break;case 259:this.$=
d.addLocationDataFn(g[a-2],g[a])(new d.Op("+",b[a-2],b[a]));break;case 260:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Op("-",b[a-2],b[a]));break;case 261:case 262:case 263:case 264:case 265:case 266:case 267:case 268:case 269:case 270:this.$=d.addLocationDataFn(g[a-2],g[a])(new d.Op(b[a-1],b[a-2],b[a]));break;case 271:g=d.addLocationDataFn(g[a-2],g[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.$=g(b);break;case 272:this.$=d.addLocationDataFn(g[a-
2],g[a])(new d.Assign(b[a-2],b[a],b[a-1]));break;case 273:this.$=d.addLocationDataFn(g[a-4],g[a])(new d.Assign(b[a-4],b[a-1],b[a-3]));break;case 274:this.$=d.addLocationDataFn(g[a-3],g[a])(new d.Assign(b[a-3],b[a],b[a-2]));break;case 275:this.$=d.addLocationDataFn(g[a-2],g[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:f,37:55,38:k,39:80,40:t,41:p,43:57,
44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{1:[3]},{1:[2,2],6:ra},a(ta,[2,3]),a(ta,[2,6],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(ta,
[2,7],{141:77,132:105,138:106,133:D,135:A,139:E,156:ya}),a(ta,[2,8]),a(na,[2,14],{109:107,78:108,86:114,40:Da,41:Da,114:Da,82:va,83:xa,84:Ha,85:Ka,87:Fa,90:Ra,113:La}),a(na,[2,15],{86:114,109:117,78:118,82:va,83:xa,84:Ha,85:Ka,87:Fa,90:Ra,113:La,114:Da}),a(na,[2,16]),a(na,[2,17]),a(na,[2,18]),a(na,[2,19]),a(na,[2,20]),a(na,[2,21]),a(na,[2,22]),a(na,[2,23]),a(na,[2,24]),a(na,[2,25]),a(na,[2,26]),a(Ga,[2,9]),a(Ga,[2,10]),a(Ga,[2,11]),a(Ga,[2,12]),a(Ga,[2,13]),a([1,6,32,42,131,133,135,139,156,163,164,
165,166,167,168,169,170,171,172,173,174],Wa,{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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,8:122,12:b,28:da,29:Za,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:[1,119],63:B,64:n,68:c,69:w,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,137:r,149:aa,155:ba,157:C,158:S,159:v,160:X,161:R,
162:M}),a(Ea,Ia,{55:[1,124]}),a(Ea,[2,96]),a(Ea,[2,97]),a(Ea,[2,98]),a(Ea,[2,99]),a(m,[2,164]),a([6,31,66,71],l,{65:125,72:126,73:127,33:129,60:130,75:131,62:132,34:f,74:d,92:q,118:Ca,119:Ja}),{30:135,31:ua},{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,
95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,
117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,
130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,
137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{15:142,16:143,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:144,60:71,62:54,75:53,77:141,79:28,80:29,81:30,92:q,111:31,112:L,117:U,118:W,119:H,130:V},{15:142,16:143,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:144,60:71,62:54,75:53,77:145,79:28,80:29,81:30,92:q,111:31,112:L,117:U,118:W,119:H,130:V},a(Na,wa,{96:[1,149],161:[1,
146],162:[1,147],175:[1,148]}),a(na,[2,246],{151:[1,150]}),{30:151,31:ua},{30:152,31:ua},a(na,[2,210]),{30:153,31:ua},{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:da,31:[1,155],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,
135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Gb,[2,116],{47:27,79:28,80:29,81:30,111:31,75:53,62:54,37:55,43:57,33:70,60:71,39:80,15:142,16:143,54:144,30:156,77:158,31:ua,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,92:q,96:[1,157],112:L,117:U,118:W,119:H,130:V}),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,
45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ga,$a,{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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,
43:57,33:70,60:71,141:77,39:80,8:122,7:160,12:b,28:da,31:Hb,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:Q,63:B,64:n,68:c,69:w,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,137:r,149:aa,155:ba,157:C,158:S,159:v,160:X,161:R,162:M}),a([1,6,31,32,42,71,94,131,133,135,139,156],[2,67]),{33:166,34:f,39:162,40:t,41:p,92:[1,165],98:163,99:164,104:Ib},{25:169,33:170,34:f,92:[1,168],95:h,103:[1,171],107:[1,172]},a(Na,[2,93]),a(Na,[2,94]),a(Ea,[2,40]),a(Ea,[2,41]),a(Ea,[2,
42]),a(Ea,[2,43]),a(Ea,[2,44]),a(Ea,[2,45]),a(Ea,[2,46]),a(Ea,[2,47]),{4:173,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,174],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,
149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:175,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:da,31:ab,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,116:177,117:U,118:W,119:H,120:Jb,123:178,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,
139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ea,[2,171]),a(Ea,[2,172],{35:182,36:Qa}),a([1,6,31,32,42,46,66,71,74,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,165],{110:184,114:ub}),{31:[2,70]},{31:[2,71]},a(Oa,[2,88]),a(Oa,[2,91]),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,
43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,
50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:188,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,
61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:190,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:da,30:189,31:ua,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,
64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{33:195,34:f,60:196,62:198,75:197,80:191,92:q,118:Ca,119:H,143:192,144:[1,193],145:194},{142:199,146:[1,200],147:[1,201],148:[1,202]},a([6,31,71,94],Kb,{39:80,93:203,56:204,57:205,59:206,11:207,37:208,33:209,35:210,60:211,34:f,36:Qa,38:k,40:t,41:p,63:B,118:Ca}),a(Lb,[2,
34]),a(Lb,[2,35]),a(Ea,[2,38]),{15:142,16:212,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:144,60:71,62:54,75:53,77:213,79:28,80:29,81:30,92:q,111:31,112:L,117:U,118:W,119:H,130:V},a([1,6,29,31,32,40,41,42,55,58,66,71,74,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(Mb,[2,36]),{4:214,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:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(ta,[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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,43:57,33:70,60:71,141:77,39:80,5:215,12:b,28:u,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:Q,63:B,64:n,68:c,69:w,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,133:D,135:A,137:r,139:E,149:aa,155:ba,157:C,158:S,159:v,160:X,161:R,162:M}),a(na,[2,258]),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,
37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,
44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,
51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,
62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,
75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,
92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,
117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,
130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,
137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,
154:41,155:ba,157:C,158:S,159:v,160:X,161:R,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,
160:X,161:R,162:M},{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(na,[2,209]),
a(na,[2,214]),{7:230,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(na,[2,208]),a(na,
[2,213]),{39:231,40:t,41:p,110:232,114:ub},a(Oa,[2,89]),a(Nb,[2,168]),{35:233,36:Qa},{35:234,36:Qa},a(Oa,[2,104],{35:235,36:Qa}),{35:236,36:Qa},a(Oa,[2,105]),{7:238,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Ob,75:53,77:40,79:28,80:29,81:30,88:237,91:239,92:q,95:h,97:K,105:P,111:31,112:L,
117:U,118:W,119:H,121:240,122:vb,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{86:243,87:Fa,90:Ra},{110:244,114:ub},a(Oa,[2,90]),a(ta,[2,66],{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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,7:245,12:b,28:da,31:Hb,34:f,38:k,40:t,41:p,44:z,
45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:Q,63:B,64:n,68:c,69:w,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,133:$a,135:$a,139:$a,156:$a,137:r,149:aa,155:ba,157:C,158:S,159:v,160:X,161:R,162:M}),a(Pa,[2,28],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,
43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{132:105,133:D,135:A,138:106,139:E,141:77,156:ya},a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,163,164,165,166,167,168,169,170,171,172,173,174],Wa,{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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,8:122,12:b,28:da,29:Za,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:Q,63:B,64:n,68:c,69:w,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,137:r,149:aa,155:ba,157:C,158:S,159:v,160:X,161:R,162:M}),{6:[1,248],7:247,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:da,31:[1,249],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a([6,31],Ma,{70:252,66:[1,250],71:Pb}),a(Ua,[2,75]),a(Ua,[2,79],{55:[1,
254],74:[1,253]}),a(Ua,[2,82]),a(hb,[2,83]),a(hb,[2,84]),a(hb,[2,85]),a(hb,[2,86]),{35:182,36:Qa},{7:255,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:da,31:ab,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,116:177,117:U,118:W,119:H,120:Jb,123:178,125:Z,129:T,130:V,
132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(na,[2,69]),{4:257,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,256],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,
132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a([1,6,31,32,42,66,71,74,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,250],{141:77,132:102,138:103,163:ea}),a(bb,[2,251],{141:77,132:102,138:103,163:ea,165:fa}),a(bb,[2,252],{141:77,132:102,138:103,163:ea,165:fa}),a(bb,[2,253],{141:77,132:102,138:103,163:ea,165:fa}),a(na,[2,254],{40:wa,41:wa,82:wa,83:wa,84:wa,85:wa,87:wa,90:wa,113:wa,
114:wa}),a(Nb,Da,{109:107,78:108,86:114,82:va,83:xa,84:Ha,85:Ka,87:Fa,90:Ra,113:La}),{78:118,82:va,83:xa,84:Ha,85:Ka,86:114,87:Fa,90:Ra,109:117,113:La,114:Da},a(Qb,Ia),a(na,[2,255],{40:wa,41:wa,82:wa,83:wa,84:wa,85:wa,87:wa,90:wa,113:wa,114:wa}),a(na,[2,256]),a(na,[2,257]),{6:[1,260],7:258,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:da,31:[1,259],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,
53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:261,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,
64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{30:262,31:ua,155:[1,263]},a(na,[2,193],{126:264,127:[1,265],128:[1,266]}),a(na,[2,207]),a(na,[2,215]),{31:[1,267],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{150:268,
152:269,153:ib},a(na,[2,117]),{7:271,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},
a(Gb,[2,120],{30:272,31:ua,40:wa,41:wa,82:wa,83:wa,84:wa,85:wa,87:wa,90:wa,113:wa,114:wa,96:[1,273]}),a(Pa,[2,200],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ga,cb,{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{62:274,92:q},a(Ga,[2,124]),{29:[1,275],71:[1,276]},{29:[1,277]},{31:jb,33:282,34:f,94:[1,278],100:279,101:280,103:Xa},a([29,71],[2,
140]),{102:[1,284]},{31:wb,33:289,34:f,94:[1,285],103:db,106:286,108:287},a(Ga,[2,144]),{55:[1,291]},{7:292,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,
139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{29:[1,293]},{6:ra,131:[1,294]},{4:295,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:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,
138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a([6,31,71,120],Rb,{141:77,132:102,138:103,121:296,74:[1,297],122:vb,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(xb,[2,174]),a([6,31,120],Ma,{70:298,71:kb}),a(Sa,[2,183]),{7:255,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:da,31:ab,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,
44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,116:300,117:U,118:W,119:H,123:178,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Sa,[2,189]),a(Sa,[2,190]),a(Sb,[2,173]),a(Sb,[2,33]),a(m,[2,166]),{7:255,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:da,31:ab,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,115:[1,301],116:302,117:U,118:W,119:H,123:178,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{30:303,31:ua,132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,
164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(Tb,[2,203],{141:77,132:102,138:103,133:D,134:[1,304],135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Tb,[2,205],{141:77,132:102,138:103,133:D,134:[1,305],135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(na,[2,211]),a(Ya,[2,212],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,
165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a([1,6,31,32,42,66,71,74,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,216],{140:[1,306]}),a(lb,[2,219]),{33:195,34:f,60:196,62:198,75:197,92:q,118:Ca,119:Ja,143:307,145:194},a(lb,[2,225],{71:[1,308]}),a(mb,[2,221]),a(mb,[2,222]),a(mb,[2,223]),a(mb,[2,224]),a(na,[2,218]),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:310,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:da,33:70,34:f,
37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:311,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,
44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(nb,Ma,{70:312,71:Ub}),a(Ba,[2,112]),a(Ba,[2,51],{58:[1,314]}),a(Vb,[2,60],{55:[1,315]}),a(Ba,[2,56]),a(Vb,[2,61]),a(yb,[2,57]),a(yb,[2,58]),a(yb,[2,59]),{46:[1,316],78:118,82:va,83:xa,84:Ha,85:Ka,
86:114,87:Fa,90:Ra,109:117,113:La,114:Da},a(Qb,wa),{6:ra,42:[1,317]},a(ta,[2,4]),a(Wb,[2,259],{141:77,132:102,138:103,163:ea,164:ia,165:fa}),a(Wb,[2,260],{141:77,132:102,138:103,163:ea,164:ia,165:fa}),a(bb,[2,261],{141:77,132:102,138:103,163:ea,165:fa}),a(bb,[2,262],{141:77,132:102,138:103,163:ea,165:fa}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,166,167,168,169,170,171,172,173,174],[2,263],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa}),a([1,6,31,32,42,66,
71,74,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173],[2,264],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,168,169,170,171,172,173],[2,265],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,169,170,171,172,173],[2,266],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,
166:ja,167:la,168:pa,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,170,171,172,173],[2,267],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,171,172,173],[2,268],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,172,173],[2,269],
{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,173],[2,270],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,174:ca}),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173,174],[2,271],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja}),a(Ya,[2,249],
{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ya,[2,248],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(m,[2,161]),a(m,[2,162]),a(Oa,[2,100]),a(Oa,[2,101]),a(Oa,[2,102]),a(Oa,[2,103]),{89:[1,318]},{74:Ob,89:[2,108],121:319,122:vb,132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,
166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{89:[2,109]},{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,89:[2,182],92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,
149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Xb,[2,176]),a(Xb,Yb),a(Oa,[2,107]),a(m,[2,163]),a(ta,[2,65],{141:77,132:102,138:103,133:cb,135:cb,139:cb,156:cb,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Pa,[2,29],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Pa,[2,48],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,
170:ha,171:ka,172:oa,173:sa,174:ca}),{7:321,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,
162:M},{7:322,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{67:323,68:c,69:w},a(Ta,
eb,{73:127,33:129,60:130,75:131,62:132,72:324,34:f,74:d,92:q,118:Ca,119:Ja}),{6:Zb,31:$b},a(Ua,[2,80]),{7:327,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,
139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Sa,Rb,{141:77,132:102,138:103,74:[1,328],133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(ac,[2,30]),{6:ra,32:[1,329]},a(Pa,[2,272],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:331,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:da,33:70,
34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Pa,[2,275],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(na,[2,247]),{7:332,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(na,[2,194],{127:[1,333]}),{30:334,31:ua},
{30:337,31:ua,33:335,34:f,62:336,92:q},{150:338,152:269,153:ib},{32:[1,339],151:[1,340],152:341,153:ib},a(ob,[2,240]),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,124:342,125:Z,129:T,130:V,132:43,133:D,
135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(bc,[2,118],{141:77,132:102,138:103,30:344,31:ua,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(na,[2,121]),{7:345,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,
61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{32:[1,346]},{39:347,40:t,41:p},{92:[1,349],99:348,104:Ib},{39:350,40:t,41:p},{29:[1,351]},a(nb,Ma,{70:352,71:pb}),a(Ba,[2,131]),{31:jb,33:282,34:f,100:354,101:280,103:Xa},a(Ba,[2,136],{102:[1,355]}),a(Ba,[2,138],{102:[1,356]}),{33:357,34:f},a(Ga,[2,142]),
a(nb,Ma,{70:358,71:zb}),a(Ba,[2,151]),{31:wb,33:289,34:f,103:db,106:360,108:287},a(Ba,[2,156],{102:[1,361]}),a(Ba,[2,159],{102:[1,362]}),{6:[1,364],7:363,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:da,31:[1,365],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,
125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ab,[2,148],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{39:366,40:t,41:p},a(Ea,[2,201]),{6:ra,32:[1,367]},{7:368,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,
45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a([12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,63,64,68,69,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,158,159,160,161,162],Yb,{6:fb,31:fb,71:fb,120:fb}),{6:qb,31:rb,120:[1,369]},
a([6,31,32,115,120],eb,{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,67:33,77:40,154:41,132:43,136:44,138:45,75:53,62:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,76:180,7:255,123:372,12:b,28:da,34:f,38:k,40:t,41:p,44:z,45:I,48:J,49:F,50:N,51:y,52:G,53:O,61:Q,63:B,64:n,68:c,69:w,74:Va,92:q,95:h,97:K,105:P,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,133:D,135:A,137:r,139:E,149:aa,155:ba,157:C,158:S,159:v,160:X,
161:R,162:M}),a(Ta,Ma,{70:373,71:kb}),a(m,[2,169]),a([6,31,115],Ma,{70:374,71:kb}),a(cc,[2,244]),{7:375,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,
141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:376,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,
158:S,159:v,160:X,161:R,162:M},{7:377,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},
a(lb,[2,220]),{33:195,34:f,60:196,62:198,75:197,92:q,118:Ca,119:Ja,145:378},a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,135,139,156],[2,227],{141:77,132:102,138:103,134:[1,379],140:[1,380],159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Bb,[2,228],{141:77,132:102,138:103,134:[1,381],159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Bb,[2,234],{141:77,132:102,138:103,134:[1,382],159:ma,160:Y,
163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{6:dc,31:ec,94:[1,383]},a(Cb,eb,{39:80,57:205,59:206,11:207,37:208,33:209,35:210,60:211,56:386,34:f,36:Qa,38:k,40:t,41:p,63:B,118:Ca}),{7:387,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:da,31:[1,388],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,
79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:389,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:da,31:[1,390],33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,
92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ea,[2,39]),a(Mb,[2,37]),a(Oa,[2,106]),{7:391,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,
81:30,89:[2,180],92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{89:[2,181],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(Pa,[2,49],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{32:[1,392],
132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{30:393,31:ua},a(Ua,[2,76]),{33:129,34:f,60:130,62:132,72:394,73:127,74:d,75:131,92:q,118:Ca,119:Ja},a(fc,l,{72:126,73:127,33:129,60:130,75:131,62:132,65:395,34:f,74:d,92:q,118:Ca,119:Ja}),a(Ua,[2,81],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Sa,fb),
a(ac,[2,31]),{32:[1,396],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(Pa,[2,274],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{30:397,31:ua,132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{30:398,31:ua},a(na,[2,195]),{30:399,
31:ua},{30:400,31:ua},a(Db,[2,199]),{32:[1,401],151:[1,402],152:341,153:ib},a(na,[2,238]),{30:403,31:ua},a(ob,[2,241]),{30:404,31:ua,71:[1,405]},a(gc,[2,191],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(na,[2,119]),a(bc,[2,122],{141:77,132:102,138:103,30:406,31:ua,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ga,[2,63]),a(Ga,
[2,125]),{29:[1,407]},{31:jb,33:282,34:f,100:408,101:280,103:Xa},a(Ga,[2,126]),{39:409,40:t,41:p},{6:sb,31:tb,94:[1,410]},a(Cb,eb,{33:282,101:413,34:f,103:Xa}),a(Ta,Ma,{70:414,71:pb}),{33:415,34:f},{33:416,34:f},{29:[2,141]},{6:Eb,31:Fb,94:[1,417]},a(Cb,eb,{33:289,108:420,34:f,103:db}),a(Ta,Ma,{70:421,71:zb}),{33:422,34:f,103:[1,423]},{33:424,34:f},a(Ab,[2,145],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),
{7:425,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:426,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ga,[2,149]),{131:[1,427]},{120:[1,428],132:102,133:D,135:A,
138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(xb,[2,175]),{7:255,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,123:429,
125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:255,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:da,31:ab,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,74:Va,75:53,76:180,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,116:430,117:U,118:W,119:H,123:178,
125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Sa,[2,184]),{6:qb,31:rb,32:[1,431]},{6:qb,31:rb,115:[1,432]},a(Ya,[2,204],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ya,[2,206],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ya,
[2,217],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(lb,[2,226]),{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,
119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:434,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,
133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:435,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,
139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,
157:C,158:S,159:v,160:X,161:R,162:M},a(xb,[2,110]),{11:207,33:209,34:f,35:210,36:Qa,37:208,38:k,39:80,40:t,41:p,56:437,57:205,59:206,60:211,63:B,118:Ca},a(fc,Kb,{39:80,56:204,57:205,59:206,11:207,37:208,33:209,35:210,60:211,93:438,34:f,36:Qa,38:k,40:t,41:p,63:B,118:Ca}),a(Ba,[2,113]),a(Ba,[2,52],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{7:439,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(Ba,[2,54],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,
165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{7:440,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,
157:C,158:S,159:v,160:X,161:R,162:M},{89:[2,179],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(na,[2,50]),a(na,[2,68]),a(Ua,[2,77]),a(Ta,Ma,{70:441,71:Pb}),a(na,[2,273]),a(cc,[2,245]),a(na,[2,196]),a(Db,[2,197]),a(Db,[2,198]),a(na,[2,236]),{30:442,31:ua},{32:[1,443]},a(ob,[2,242],{6:[1,444]}),{7:445,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,161:R,162:M},a(na,[2,123]),{39:446,40:t,41:p},a(nb,Ma,{70:447,71:pb}),a(Ga,[2,127]),{29:[1,448]},{33:282,34:f,101:449,103:Xa},{31:jb,33:282,34:f,100:450,
101:280,103:Xa},a(Ba,[2,132]),{6:sb,31:tb,32:[1,451]},a(Ba,[2,137]),a(Ba,[2,139]),a(Ga,[2,143],{29:[1,452]}),{33:289,34:f,103:db,108:453},{31:wb,33:289,34:f,103:db,106:454,108:287},a(Ba,[2,152]),{6:Eb,31:Fb,32:[1,455]},a(Ba,[2,157]),a(Ba,[2,158]),a(Ba,[2,160]),a(Ab,[2,146],{141:77,132:102,138:103,133:D,135:A,139:E,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),{32:[1,456],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,
165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},a(Ea,[2,202]),a(Ea,[2,178]),a(Sa,[2,185]),a(Ta,Ma,{70:457,71:kb}),a(Sa,[2,186]),a(m,[2,170]),a([1,6,31,32,42,66,71,74,89,94,115,120,122,131,133,134,135,139,156],[2,229],{141:77,132:102,138:103,140:[1,458],159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Bb,[2,231],{141:77,132:102,138:103,134:[1,459],159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,
173:sa,174:ca}),a(Pa,[2,230],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Pa,[2,235],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ba,[2,114]),a(Ta,Ma,{70:460,71:Ub}),{32:[1,461],132:102,133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{32:[1,462],132:102,
133:D,135:A,138:103,139:E,141:77,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca},{6:Zb,31:$b,32:[1,463]},{32:[1,464]},a(na,[2,239]),a(ob,[2,243]),a(gc,[2,192],{141:77,132:102,138:103,133:D,135:A,139:E,156:Aa,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ga,[2,129]),{6:sb,31:tb,94:[1,465]},{39:466,40:t,41:p},a(Ba,[2,133]),a(Ta,Ma,{70:467,71:pb}),a(Ba,[2,134]),{39:468,40:t,41:p},a(Ba,[2,153]),
a(Ta,Ma,{70:469,71:zb}),a(Ba,[2,154]),a(Ga,[2,147]),{6:qb,31:rb,32:[1,470]},{7:471,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,
155:ba,157:C,158:S,159:v,160:X,161:R,162:M},{7:472,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:da,33:70,34:f,37:55,38:k,39:80,40:t,41:p,43:57,44:z,45:I,47:27,48:J,49:F,50:N,51:y,52:G,53:O,54:26,60:71,61:Q,62:54,63:B,64:n,67:33,68:c,69:w,75:53,77:40,79:28,80:29,81:30,92:q,95:h,97:K,105:P,111:31,112:L,117:U,118:W,119:H,125:Z,129:T,130:V,132:43,133:D,135:A,136:44,137:r,138:45,139:E,141:77,149:aa,154:41,155:ba,157:C,158:S,159:v,160:X,
161:R,162:M},{6:dc,31:ec,32:[1,473]},a(Ba,[2,53]),a(Ba,[2,55]),a(Ua,[2,78]),a(na,[2,237]),{29:[1,474]},a(Ga,[2,128]),{6:sb,31:tb,32:[1,475]},a(Ga,[2,150]),{6:Eb,31:Fb,32:[1,476]},a(Sa,[2,187]),a(Pa,[2,232],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Pa,[2,233],{141:77,132:102,138:103,159:ma,160:Y,163:ea,164:ia,165:fa,166:ja,167:la,168:pa,169:qa,170:ha,171:ka,172:oa,173:sa,174:ca}),a(Ba,[2,115]),{39:477,40:t,41:p},a(Ba,
[2,135]),a(Ba,[2,155]),a(Ga,[2,130])],defaultActions:{68:[2,70],69:[2,71],239:[2,109],357:[2,141]},parseError:function(a,d){if(d.recoverable)this.trace(a);else{var b=function(a,d){this.message=a;this.hash=d};b.prototype=Error;throw new b(a,d);}},parse:function(a){var d=[0],b=[null],l=[],m=this.table,Ca="",g=0,Ja=0,c=0,f=l.slice.call(arguments,1),ua=Object.create(this.lexer),h={};for(n in this.yy)Object.prototype.hasOwnProperty.call(this.yy,n)&&(h[n]=this.yy[n]);ua.setInput(a,h);h.lexer=ua;h.parser=
this;"undefined"==typeof ua.yylloc&&(ua.yylloc={});var n=ua.yylloc;l.push(n);var k=ua.options&&ua.options.ranges;this.parseError="function"===typeof h.parseError?h.parseError:Object.getPrototypeOf(this).parseError;for(var e,q,Na,Ia,p={},wa,x;;){Na=d[d.length-1];if(this.defaultActions[Na])Ia=this.defaultActions[Na];else{if(null===e||"undefined"==typeof e)e=ua.lex()||1,"number"!==typeof e&&(e=this.symbols_[e]||e);Ia=m[Na]&&m[Na][e]}if("undefined"===typeof Ia||!Ia.length||!Ia[0]){x=[];for(wa in m[Na])this.terminals_[wa]&&
2<wa&&x.push("'"+this.terminals_[wa]+"'");var w=ua.showPosition?"Parse error on line "+(g+1)+":\n"+ua.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[e]||e)+"'":"Parse error on line "+(g+1)+": Unexpected "+(1==e?"end of input":"'"+(this.terminals_[e]||e)+"'");this.parseError(w,{text:ua.match,token:this.terminals_[e]||e,line:ua.yylineno,loc:n,expected:x})}if(Ia[0]instanceof Array&&1<Ia.length)throw Error("Parse Error: multiple actions possible at state: "+Na+", token: "+e);switch(Ia[0]){case 1:d.push(e);
b.push(ua.yytext);l.push(ua.yylloc);d.push(Ia[1]);e=null;q?(e=q,q=null):(Ja=ua.yyleng,Ca=ua.yytext,g=ua.yylineno,n=ua.yylloc,0<c&&c--);break;case 2:x=this.productions_[Ia[1]][1];p.$=b[b.length-x];p._$={first_line:l[l.length-(x||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(x||1)].first_column,last_column:l[l.length-1].last_column};k&&(p._$.range=[l[l.length-(x||1)].range[0],l[l.length-1].range[1]]);Na=this.performAction.apply(p,[Ca,Ja,g,h,Ia[1],b,l].concat(f));if("undefined"!==
typeof Na)return Na;x&&(d=d.slice(0,-2*x),b=b.slice(0,-1*x),l=l.slice(0,-1*x));d.push(this.productions_[Ia[1]][0]);b.push(p.$);l.push(p._$);Ia=m[d[d.length-2]][d[d.length-1]];d.push(Ia);break;case 3:return!0}}}};e.prototype=hc;hc.Parser=e;return new e}();"undefined"!==typeof u&&"undefined"!==typeof e&&(e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(x){x[1]||(console.log("Usage: "+x[0]+" FILE"),process.exit(1));var a="",b=u("fs");"undefined"!==typeof b&&
null!==b&&(a=b.readFileSync(u("path").normalize(x[1]),"utf8"));return e.parser.parse(a)},"undefined"!==typeof ra&&u.main===ra&&e.main(process.argv.slice(1)));return ra.exports}();u["./scope"]=function(){var e={};(function(){var u=[].indexOf||function(e){for(var x=0,a=this.length;x<a;x++)if(x in this&&this[x]===e)return x;return-1};e.Scope=function(){function e(e,a,b,r){var f,k;this.parent=e;this.expressions=a;this.method=b;this.referencedVars=r;this.variables=[{name:"arguments",type:"arguments"}];
this.positions={};this.parent||(this.utilities={});this.root=null!=(f=null!=(k=this.parent)?k.root:void 0)?f:this}e.prototype.add=function(e,a,b){return this.shared&&!b?this.parent.add(e,a,b):Object.prototype.hasOwnProperty.call(this.positions,e)?this.variables[this.positions[e]].type=a:this.positions[e]=this.variables.push({name:e,type:a})-1};e.prototype.namedMethod=function(){var e;return null!=(e=this.method)&&e.name||!this.parent?this.method:this.parent.namedMethod()};e.prototype.find=function(e,
a){null==a&&(a="var");if(this.check(e))return!0;this.add(e,a);return!1};e.prototype.parameter=function(e){if(!this.shared||!this.parent.check(e,!0))return this.add(e,"param")};e.prototype.check=function(e){var a;return!!(this.type(e)||null!=(a=this.parent)&&a.check(e))};e.prototype.temporary=function(e,a,b){null==b&&(b=!1);return b?(b=e.charCodeAt(0),e=122-b,b=String.fromCharCode(b+a%(e+1)),a=Math.floor(a/(e+1)),""+b+(a||"")):""+e+(a||"")};e.prototype.type=function(e){var a;var b=this.variables;var x=
0;for(a=b.length;x<a;x++){var f=b[x];if(f.name===e)return f.type}return null};e.prototype.freeVariable=function(e,a){var b,x;null==a&&(a={});for(b=0;;){var f=this.temporary(e,b,a.single);if(!(this.check(f)||0<=u.call(this.root.referencedVars,f)))break;b++}(null!=(x=a.reserve)?x:1)&&this.add(f,"var",!0);return f};e.prototype.assign=function(e,a){this.add(e,{value:a,assigned:!0},!0);return this.hasAssignments=!0};e.prototype.hasDeclarations=function(){return!!this.declaredVariables().length};e.prototype.declaredVariables=
function(){var e;var a=this.variables;var b=[];var r=0;for(e=a.length;r<e;r++){var f=a[r];"var"===f.type&&b.push(f.name)}return b.sort()};e.prototype.assignedVariables=function(){var e;var a=this.variables;var b=[];var r=0;for(e=a.length;r<e;r++){var f=a[r];f.type.assigned&&b.push(f.name+" \x3d "+f.type.value)}return b};return e}()}).call(this);return e}();u["./nodes"]=function(){var e={};(function(){var ra,r,x,a,b,za,f,k,t,p,z,I,J,F,N,y,G,O,Q,B,n,c,w,q,h,K,P,L,U,W,H,Z,T,V,D,A,xa,E,aa,ba,C,S,v=function(a,
b){function l(){this.constructor=a}for(var d in b)X.call(b,d)&&(a[d]=b[d]);l.prototype=b.prototype;a.prototype=new l;a.__super__=b.prototype;return a},X={}.hasOwnProperty,R=[].indexOf||function(a){for(var b=0,l=this.length;b<l;b++)if(b in this&&this[b]===a)return b;return-1},M=[].slice;Error.stackTraceLimit=Infinity;var ya=u("./scope").Scope;var ta=u("./lexer");var Aa=ta.isUnassignable;var ma=ta.JS_FORBIDDEN;var Y=u("./helpers");var ea=Y.compact;var ia=Y.flatten;var fa=Y.extend;var ja=Y.merge;var la=
Y.del;ta=Y.addLocationDataFn;var pa=Y.locationDataToString;var qa=Y.throwSyntaxError;e.extend=fa;e.addLocationDataFn=ta;var ha=function(){return!0};var ka=function(){return!1};var oa=function(){return this};var sa=function(){this.negated=!this.negated;return this};e.CodeFragment=t=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?": "+pa(this.locationData):"")};return a}();var ca=function(a){var b;var l=[];var d=0;for(b=a.length;d<b;d++){var Ca=a[d];l.push(Ca.code)}return l.join("")};e.Base=ta=function(){function b(){}b.prototype.compile=function(a,b){return ca(this.compileToFragments(a,b))};b.prototype.compileToFragments=function(a,b){a=fa({},a);b&&(a.level=b);b=this.unfoldSoak(a)||this;b.tab=a.indent;return a.level!==na&&b.isStatement(a)?b.compileClosure(a):b.compileNode(a)};b.prototype.compileClosure=
function(b){var l,d,m;(d=this.jumps())&&d.error("cannot use a pure statement in an expression");b.sharedScope=!0;d=new k([],a.wrap([this]));var Ja=[];if((l=this.contains(Wa))||this.contains(da))Ja=[new E],l?(l="apply",Ja.push(new y("arguments"))):l="call",d=new C(d,[new ra(new L(l))]);b=(new za(d,Ja)).compileNode(b);if(d.isGenerator||null!=(m=d.base)&&m.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 y(a.scope.freeVariable("ref"));var l=new x(d,this);return b?[l.compileToFragments(a,b),[this.makeCode(d.value)]]:[l,d]}d=b?this.compileToFragments(a,b):this;return[d,d]};b.prototype.cacheToCodeFragments=function(a){return[ca(a[0]),ca(a[1])]};b.prototype.makeReturn=function(a){var b=this.unwrapAll();return a?new za(new B(a+".push"),[b]):new H(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 p))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+Fa)});return d};b.prototype.eachChild=function(a){var b,d;if(!this.children)return this;var m=this.children;var Ja=0;for(b=m.length;Ja<b;Ja++){var c=m[Ja];if(this[c]){var e=ia([this[c]]);var f=0;for(d=e.length;f<d;f++)if(c=e[f],!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 h("!",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=oa;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 qa(a,this.locationData)};b.prototype.makeCode=function(a){return new t(this,a)};b.prototype.wrapInBraces=function(a){return[].concat(this.makeCode("("),a,this.makeCode(")"))};b.prototype.joinFragmentArrays=function(a,b){var d,l;var m=[];var c=d=0;for(l=a.length;d<l;c=++d){var e=
a[c];c&&m.push(this.makeCode(b));m=m.concat(e)}return m};return b}();e.Block=a=function(a){function b(a){this.expressions=ea(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 l=0;for(d=b.length;l<d;l++){var m=b[l];if(m.isStatement(a))return!0}return!1};b.prototype.jumps=function(a){var d;var b=this.expressions;var l=0;for(d=b.length;l<d;l++){var m=b[l];if(m=m.jumps(a))return m}};b.prototype.makeReturn=function(a){var d;for(d=this.expressions.length;d--;){var b=this.expressions[d];if(!(b instanceof p)){this.expressions[d]=b.makeReturn(a);b instanceof H&&!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,l;this.tab=a.indent;var m=a.level===na;var c=[];var e=this.expressions;var f=d=0;for(l=e.length;d<l;f=++d){var h=e[f];h=h.unwrapAll();h=h.unfoldSoak(a)||h;h instanceof b?c.push(h.compileNode(a)):m?(h.front=!0,f=h.compileToFragments(a),h.isStatement(a)||(f.unshift(this.makeCode(""+this.tab)),f.push(this.makeCode(";"))),
c.push(f)):c.push(h.compileToFragments(a,va))}if(m)return this.spaced?[].concat(this.joinFragmentArrays(c,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(c,"\n");d=c.length?this.joinFragmentArrays(c,", "):[this.makeCode("void 0")];return 1<c.length&&a.level>=va?this.wrapInBraces(d):d};b.prototype.compileRoot=function(a){var d,b;a.indent=a.bare?"":Fa;a.level=na;this.spaced=!0;a.scope=new ya(null,this,null,null!=(b=a.referencedVars)?b:[]);var l=a.locals||[];b=0;for(d=l.length;b<d;b++){var m=l[b];
a.scope.parameter(m)}b=[];if(!a.bare){var c=this.expressions;d=[];var e=m=0;for(l=c.length;m<l;e=++m){e=c[e];if(!(e.unwrap()instanceof p))break;d.push(e)}m=this.expressions.slice(d.length);this.expressions=d;d.length&&(b=this.compileNode(ja(a,{indent:""})),b.push(this.makeCode("\n")));this.expressions=m}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 l=
[];var m=this.expressions;var c=b=0;for(d=m.length;b<d;c=++b){var e=m[c];e=e.unwrap();if(!(e instanceof p||e instanceof B))break}a=ja(a,{level:na});c&&(e=this.expressions.splice(c,9E9),l=[this.spaced,!1],b=l[0],this.spaced=l[1],b=[this.compileNode(a),b],l=b[0],this.spaced=b[1],this.expressions=e);e=this.compileNode(a);b=a.scope;b.expressions===this&&(d=a.scope.hasDeclarations(),a=b.hasAssignments,d||a?(c&&l.push(this.makeCode("\n")),l.push(this.makeCode(this.tab+"var ")),d&&l.push(this.makeCode(b.declaredVariables().join(", "))),
a&&(d&&l.push(this.makeCode(",\n"+(this.tab+Fa))),l.push(this.makeCode(b.assignedVariables().join(",\n"+(this.tab+Fa))))),l.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):l.length&&e.length&&l.push(this.makeCode("\n")));return l.concat(e)};b.wrap=function(a){return 1===a.length&&a[0]instanceof b?a[0]:new b(a)};return b}(ta);e.Literal=B=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}(ta);e.NumberLiteral=w=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(B);e.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);e.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>=Ha?this.wrapInBraces(d):d};return b}(w);e.StringLiteral=D=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(B);e.RegexLiteral=W=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(B);e.PassthroughLiteral=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(B);e.IdentifierLiteral=
y=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isAssignable=ha;return b}(B);e.PropertyName=L=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isAssignable=ha;return b}(B);e.StatementLiteral=V=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);b.prototype.isStatement=ha;b.prototype.makeReturn=oa;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}(B);e.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}(B);e.UndefinedLiteral=ba=function(a){function b(){b.__super__.constructor.call(this,"undefined")}
v(b,a);b.prototype.compileNode=function(a){return[this.makeCode(a.level>=Ka?"(void 0)":"void 0")]};return b}(B);e.NullLiteral=c=function(a){function b(){b.__super__.constructor.call(this,"null")}v(b,a);return b}(B);e.BooleanLiteral=b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(B);e.Return=H=function(a){function b(a){this.expression=a}v(b,a);b.prototype.children=["expression"];b.prototype.isStatement=ha;b.prototype.makeReturn=oa;b.prototype.jumps=
oa;b.prototype.compileToFragments=function(a,d){var l;var m=null!=(l=this.expression)?l.makeReturn():void 0;return!m||m instanceof b?b.__super__.compileToFragments.call(this,a,d):m.compileToFragments(a,d)};b.prototype.compileNode=function(a){var d=[];d.push(this.makeCode(this.tab+("return"+(this.expression?" ":""))));this.expression&&(d=d.concat(this.expression.compileToFragments(a,Da)));d.push(this.makeCode(";"));return d};return b}(ta);e.YieldReturn=S=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}(H);e.Value=C=function(a){function m(a,b,Ca){if(!b&&a instanceof m)return a;this.base=a;this.properties=b||[];Ca&&(this[Ca]=!0);return this}v(m,a);m.prototype.children=["base","properties"];m.prototype.add=function(a){this.properties=this.properties.concat(a);return this};m.prototype.hasProperties=function(){return!!this.properties.length};
m.prototype.bareLiteral=function(a){return!this.properties.length&&this.base instanceof a};m.prototype.isArray=function(){return this.bareLiteral(r)};m.prototype.isRange=function(){return this.bareLiteral(U)};m.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()};m.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()};m.prototype.isNumber=function(){return this.bareLiteral(w)};m.prototype.isString=function(){return this.bareLiteral(D)};
m.prototype.isRegex=function(){return this.bareLiteral(W)};m.prototype.isUndefined=function(){return this.bareLiteral(ba)};m.prototype.isNull=function(){return this.bareLiteral(c)};m.prototype.isBoolean=function(){return this.bareLiteral(b)};m.prototype.isAtomic=function(){var a;var b=this.properties.concat(this.base);var m=0;for(a=b.length;m<a;m++){var c=b[m];if(c.soak||c instanceof za)return!1}return!0};m.prototype.isNotCallable=function(){return this.isNumber()||this.isString()||this.isRegex()||
this.isArray()||this.isRange()||this.isSplice()||this.isObject()||this.isUndefined()||this.isNull()||this.isBoolean()};m.prototype.isStatement=function(a){return!this.properties.length&&this.base.isStatement(a)};m.prototype.assigns=function(a){return!this.properties.length&&this.base.assigns(a)};m.prototype.jumps=function(a){return!this.properties.length&&this.base.jumps(a)};m.prototype.isObject=function(a){return this.properties.length?!1:this.base instanceof q&&(!a||this.base.generated)};m.prototype.isSplice=
function(){var a=this.properties;return a[a.length-1]instanceof Z};m.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)};m.prototype.unwrap=function(){return this.properties.length?this:this.base};m.prototype.cacheReference=function(a){var b=this.properties;var l=b[b.length-1];if(2>this.properties.length&&!this.base.isComplex()&&(null==l||!l.isComplex()))return[this,this];b=new m(this.base,
this.properties.slice(0,-1));if(b.isComplex()){var c=new y(a.scope.freeVariable("base"));b=new m(new P(new x(c,b)))}if(!l)return[b,c];if(l.isComplex()){var e=new y(a.scope.freeVariable("name"));l=new Q(new x(e,l.index));e=new Q(e)}return[b.add(l),new m(c||b.base,[e||l])]};m.prototype.compileNode=function(a){var b;this.base.front=this.front;var l=this.properties;var m=this.base.compileToFragments(a,l.length?Ka:null);l.length&&Ra.test(ca(m))&&m.push(this.makeCode("."));var c=0;for(b=l.length;c<b;c++){var e=
l[c];m.push.apply(m,e.compileToFragments(a))}return m};m.prototype.unfoldSoak=function(a){return null!=this.unfoldedSoak?this.unfoldedSoak:this.unfoldedSoak=function(b){return function(){var d,l,c;if(l=b.base.unfoldSoak(a))return(d=l.body.properties).push.apply(d,b.properties),l;var e=b.properties;l=d=0;for(c=e.length;d<c;l=++d){var f=e[l];if(f.soak)return f.soak=!1,d=new m(b.base,b.properties.slice(0,l)),c=new m(b.base,b.properties.slice(l)),d.isComplex()&&(l=new y(a.scope.freeVariable("ref")),d=
new P(new x(l,d)),c.base=l),new G(new z(d),c,{soak:!0})}return!1}}(this)()};return m}(ta);e.Comment=p=function(a){function b(a){this.comment=a}v(b,a);b.prototype.isStatement=ha;b.prototype.makeReturn=oa;b.prototype.compileNode=function(a,b){var d=this.comment.replace(/^(\s*)#(?=\s)/gm,"$1 *");d="/*"+Ga(d,this.tab)+(0<=R.call(d,"\n")?"\n"+this.tab:"")+" */";(b||a.level)===na&&(d=a.indent+d);return[this.makeCode("\n"),this.makeCode(d)]};return b}(ta);e.Call=za=function(a){function b(a,b,m){this.variable=
a;this.args=null!=b?b:[];this.soak=m;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 l=(null!=(d=this.variable)?d.base:void 0)||this.variable;l.needsUpdatedStartLocation&&(this.variable.locationData.first_line=
a.first_line,this.variable.locationData.first_column=a.first_column,l.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,l;if(this.soak){if(this instanceof xa){var m=new B(this.superReference(a));
var c=new C(m)}else{if(c=Ea(a,this,"variable"))return c;c=(new C(this.variable)).cacheReference(a);m=c[0];c=c[1]}c=new b(c,this.args);c.isNew=this.isNew;m=new B("typeof "+m.compile(a)+' \x3d\x3d\x3d "function"');return new G(m,new C(c),{soak:!0})}m=this;for(d=[];;)if(m.variable instanceof b)d.push(m),m=m.variable;else{if(!(m.variable instanceof C))break;d.push(m);if(!((m=m.variable.base)instanceof b))break}var e=d.reverse();d=0;for(l=e.length;d<l;d++)m=e[d],c&&(m.variable instanceof b?m.variable=
c:m.variable.base=c),c=Ea(a,m,"variable");return c};b.prototype.compileNode=function(a){var b,l,m;null!=(b=this.variable)&&(b.front=this.front);b=T.compileSplattedArray(a,this.args,!0);if(b.length)return this.compileSplat(a,b);b=[];var c=this.args;var e=l=0;for(m=c.length;l<m;e=++l){var f=c[e];e&&b.push(this.makeCode(", "));b.push.apply(b,f.compileToFragments(a,va))}f=[];this instanceof xa?(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,Ka)),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 xa)return[].concat(this.makeCode(this.superReference(a)+".apply("+this.superThis(a)+", "),b,this.makeCode(")"));if(this.isNew){var l=this.tab+Fa;return[].concat(this.makeCode("(function(func, args, ctor) {\n"+l+"ctor.prototype \x3d func.prototype;\n"+l+"var child \x3d new ctor, result \x3d func.apply(child, args);\n"+
l+"return Object(result) \x3d\x3d\x3d result ? result : child;\n"+this.tab+"})("),this.variable.compileToFragments(a,va),this.makeCode(", "),b,this.makeCode(", function(){})"))}l=[];var m=new C(this.variable);if((d=m.properties.pop())&&m.isComplex()){var c=a.scope.freeVariable("ref");l=l.concat(this.makeCode("("+c+" \x3d "),m.compileToFragments(a,va),this.makeCode(")"),d.compileToFragments(a))}else m=m.compileToFragments(a,Ka),Ra.test(ca(m))&&(m=this.wrapInBraces(m)),d?(c=ca(m),m.push.apply(m,d.compileToFragments(a))):
c="null",l=l.concat(m);return l.concat(this.makeCode(".apply("+c+", "),b,this.makeCode(")"))};return b}(ta);e.SuperCall=xa=function(a){function b(a){b.__super__.constructor.call(this,null,null!=a?a:[new T(new y("arguments"))]);this.isBare=null!=a}v(b,a);b.prototype.superReference=function(a){var b=a.scope.namedMethod();if(null!=b&&b.klass){var l=b.klass;var m=b.name;var c=b.variable;if(l.isComplex()){var e=new y(a.scope.parent.freeVariable("base"));var f=new C(new P(new x(e,l)));c.base=f;c.properties.splice(0,
l.properties.length)}if(m.isComplex()||m instanceof Q&&m.index.isAssignable()){var h=new y(a.scope.parent.freeVariable("name"));m=new Q(new x(h,m.index));c.properties.pop();c.properties.push(m)}f=[new ra(new L("__super__"))];b["static"]&&f.push(new ra(new L("constructor")));f.push(null!=h?new Q(h):m);return(new C(null!=e?e:l,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}(za);e.RegexWithInterpolations=function(a){function b(a){null==a&&(a=[]);b.__super__.constructor.call(this,new C(new y("RegExp")),a,!1)}v(b,a);return b}(za);e.TaggedTemplateCall=function(b){function m(b,d,c){d instanceof D&&(d=new A(a.wrap([new C(d)])));m.__super__.constructor.call(this,b,[d],c)}v(m,b);m.prototype.compileNode=function(a){a.inTaggedTemplateCall=!0;return this.variable.compileToFragments(a,Ka).concat(this.args[0].compileToFragments(a,
va))};return m}(za);e.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 za(new C(new B(La("extend",a))),[this.child,this.parent])).compileToFragments(a)};return b}(ta);e.Access=ra=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 l=this.name.unwrap();
return l instanceof L?(b=l.value,0<=R.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}(ta);e.Index=Q=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,Da),this.makeCode("]"))};b.prototype.isComplex=function(){return this.index.isComplex()};
return b}(ta);e.Range=U=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 l=this.cacheToCodeFragments(this.from.cache(a,va,b));this.fromC=l[0];this.fromVar=l[1];l=this.cacheToCodeFragments(this.to.cache(a,va,b));this.toC=l[0];this.toVar=l[1];if(l=la(a,"step"))a=this.cacheToCodeFragments(l.cache(a,va,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!=l&&l.isNumber()?Number(this.stepVar):null};b.prototype.compileNode=function(a){var b,l,c,m;this.fromVar||this.compileVariables(a);if(!a.index)return this.compileArray(a);var e=null!=this.fromNum&&null!=this.toNum;var f=la(a,"index");var h=(a=la(a,"name"))&&a!==f;var n=f+" \x3d "+this.fromC;this.toC!==this.toVar&&(n+=", "+this.toC);this.step!==
this.stepVar&&(n+=", "+this.step);var k=[f+" \x3c"+this.equals,f+" \x3e"+this.equals];var q=k[0];k=k[1];q=null!=this.stepNum?0<this.stepNum?q+" "+this.toVar:k+" "+this.toVar:e?(c=[this.fromNum,this.toNum],l=c[0],m=c[1],c,l<=m?q+" "+m:k+" "+m):(b=this.stepVar?this.stepVar+" \x3e 0":this.fromVar+" \x3c\x3d "+this.toVar,b+" ? "+q+" "+this.toVar+" : "+k+" "+this.toVar);b=this.stepVar?f+" +\x3d "+this.stepVar:e?h?l<=m?"++"+f:"--"+f:l<=m?f+"++":f+"--":h?b+" ? ++"+f+" : --"+f:b+" ? "+f+"++ : "+f+"--";h&&
(n=a+" \x3d "+n);h&&(b=a+" \x3d "+b);return[this.makeCode(n+"; "+q+"; "+b)]};b.prototype.compileArray=function(a){var b,l,c;if((b=null!=this.fromNum&&null!=this.toNum)&&20>=Math.abs(this.fromNum-this.toNum)){var m=function(){c=[];for(var a=l=this.fromNum,b=this.toNum;l<=b?a<=b:a>=b;l<=b?a++:a--)c.push(a);return c}.apply(this);this.exclusive&&m.pop();return[this.makeCode("["+m.join(", ")+"]")]}var e=this.tab+Fa;var f=a.scope.freeVariable("i",{single:!0});var h=a.scope.freeVariable("results");var n=
"\n"+e+h+" \x3d [];";if(b)a.index=f,b=ca(this.compileNode(a));else{var k=f+" \x3d "+this.fromC+(this.toC!==this.toVar?", "+this.toC:"");b=this.fromVar+" \x3c\x3d "+this.toVar;b="var "+k+"; "+b+" ? "+f+" \x3c"+this.equals+" "+this.toVar+" : "+f+" \x3e"+this.equals+" "+this.toVar+"; "+b+" ? "+f+"++ : "+f+"--"}f="{ "+h+".push("+f+"); }\n"+e+"return "+h+";\n"+a.indent;a=function(a){return null!=a?a.contains(Wa):void 0};if(a(this.from)||a(this.to))m=", arguments";return[this.makeCode("(function() {"+n+
"\n"+e+"for ("+b+")"+f+"}).apply(this"+(null!=m?m:"")+")")]};return b}(ta);e.Slice=Z=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 l=b.to;var c=(b=b.from)&&b.compileToFragments(a,Da)||[this.makeCode("0")];if(l){b=l.compileToFragments(a,Da);var m=ca(b);if(this.range.exclusive||-1!==+m)var e=", "+(this.range.exclusive?m:l.isNumber()?""+(+m+1):(b=l.compileToFragments(a,Ka),"+"+ca(b)+
" + 1 || 9e9"))}return[this.makeCode(".slice("+ca(c)+(e||"")+")")]};return b}(ta);e.Obj=q=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,l,c;var m=this.properties;if(this.generated){var e=0;for(b=m.length;e<b;e++){var f=m[e];f instanceof C&&f.error("cannot have an implicit value in an implicit object")}}e=b=0;for(f=m.length;b<f;e=++b){var h=m[e];if((h.variable||h).base instanceof
P)break}f=e<m.length;var n=a.indent+=Fa;var k=this.lastNonComment(this.properties);b=[];if(f){var q=a.scope.freeVariable("obj");b.push(this.makeCode("(\n"+n+q+" \x3d "))}b.push(this.makeCode("{"+(0===m.length||0===e?"}":"\n")));var w=l=0;for(c=m.length;l<c;w=++l){h=m[w];w===e&&(0!==w&&b.push(this.makeCode("\n"+n+"}")),b.push(this.makeCode(",\n")));var t=w===m.length-1||w===e-1?"":h===k||h instanceof p?"\n":",\n";var r=h instanceof p?"":n;f&&w<e&&(r+=Fa);h instanceof x&&("object"!==h.context&&h.operatorToken.error("unexpected "+
h.operatorToken.value),h.variable instanceof C&&h.variable.hasProperties()&&h.variable.error("invalid object key"));h instanceof C&&h["this"]&&(h=new x(h.properties[0].name,h,"object"));h instanceof p||(w<e?h instanceof x||(h=new x(h,h,"object")):(h instanceof x?(w=h.variable,h=h.value):(h=h.base.cache(a),w=h[0],h=h[1],w instanceof y&&(w=new L(w.value))),h=new x(new C(new y(q),[new ra(w)]),h)));r&&b.push(this.makeCode(r));b.push.apply(b,h.compileToFragments(a,na));t&&b.push(this.makeCode(t))}f?b.push(this.makeCode(",\n"+
n+q+"\n"+this.tab+")")):0!==m.length&&b.push(this.makeCode("\n"+this.tab+"}"));return this.front&&!f?this.wrapInBraces(b):b};b.prototype.assigns=function(a){var b;var l=this.properties;var c=0;for(b=l.length;c<b;c++){var m=l[c];if(m.assigns(a))return!0}return!1};return b}(ta);e.Arr=r=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+=Fa;var l=T.compileSplattedArray(a,
this.objects);if(l.length)return l;l=[];var c=this.objects;var m=[];var e=0;for(b=c.length;e<b;e++){var f=c[e];m.push(f.compileToFragments(a,va))}e=b=0;for(c=m.length;b<c;e=++b)f=m[e],e&&l.push(this.makeCode(", ")),l.push.apply(l,f);0<=ca(l).indexOf("\n")?(l.unshift(this.makeCode("[\n"+a.indent)),l.push(this.makeCode("\n"+this.tab+"]"))):(l.unshift(this.makeCode("[")),l.push(this.makeCode("]")));return l};b.prototype.assigns=function(a){var b;var l=this.objects;var c=0;for(b=l.length;c<b;c++){var m=
l[c];if(m.assigns(a))return!0}return!1};return b}(ta);e.Class=f=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 ra&&a.name:this.variable.base;if(!(b instanceof
y||b instanceof L))return this.defaultClassVariableName;b=b.value;a||(a=Aa(b))&&this.variable.error(a);return 0<=R.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 k&&b.bound)return b.context=a})};c.prototype.addBoundFunctions=function(a){var b;var l=this.boundFuncs;var c=0;for(b=l.length;c<b;c++){var m=l[c];m=(new C(new E,[new ra(m)])).compile(a);this.ctor.body.unshift(new B(m+
" \x3d "+La("bind",a)+"("+m+", this)"))}};c.prototype.addProperties=function(a,b,c){var d;var l=a.base.properties.slice(0);var m;for(m=[];d=l.shift();){if(d instanceof x){var e=d.variable.base;delete d.context;var f=d.value;"constructor"===e.value?(this.ctor&&d.error("cannot define more than one constructor in a class"),f.bound&&d.error("cannot define a constructor as a bound function"),f instanceof k?d=this.ctor=f:(this.externalCtor=c.classScope.freeVariable("ctor"),d=new x(new y(this.externalCtor),
f))):d.variable["this"]?f["static"]=!0:(a=e.isComplex()?new Q(e):new ra(e),d.variable=new C(new y(b),[new ra(new L("prototype")),a]),f instanceof k&&f.bound&&(this.boundFuncs.push(e),f.bound=!1))}m.push(d)}return ea(m)};c.prototype.walkBody=function(b,d){return this.traverseChildren(!1,function(l){return function(m){var e,f,h;var Ca=!0;if(m instanceof c)return!1;if(m instanceof a){var n=e=m.expressions;var k=f=0;for(h=n.length;f<h;k=++f){var q=n[k];q instanceof x&&q.variable.looksStatic(b)?q.value["static"]=
!0:q instanceof C&&q.isObject(!0)&&(Ca=!1,e[k]=l.addProperties(q,b,d))}m.expressions=ia(e)}return Ca&&!(m instanceof c)}}(this))};c.prototype.hoistDirectivePrologue=function(){var a,b;var c=0;for(a=this.body.expressions;(b=a[c])&&b instanceof p||b instanceof C&&b.isString();)++c;return this.directives=a.splice(0,c)};c.prototype.ensureConstructor=function(a){this.ctor||(this.ctor=new k,this.externalCtor?this.ctor.body.push(new B(this.externalCtor+".apply(this, arguments)")):this.parent&&this.ctor.body.push(new B(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,l,c;(l=this.body.jumps())&&l.error("Class bodies cannot contain pure statements");(d=this.body.contains(Wa))&&d.error("Class bodies shouldn't reference arguments");var m=this.determineName();var e=new y(m);l=new k([],a.wrap([this.body]));d=[];b.classScope=
l.makeScope(b.scope);this.hoistDirectivePrologue();this.setContext(m);this.walkBody(m,b);this.ensureConstructor(m);this.addBoundFunctions(b);this.body.spaced=!0;this.body.expressions.push(e);this.parent&&(m=new y(b.classScope.freeVariable("superClass",{reserve:!1})),this.body.expressions.unshift(new F(e,m)),l.params.push(new K(m)),d.push(this.parent));(c=this.body.expressions).unshift.apply(c,this.directives);c=new P(new za(l,d));this.variable&&(c=new x(this.variable,c,null,{moduleDeclaration:this.moduleDeclaration}));
return c.compileToFragments(b)};return c}(ta);e.ModuleDeclaration=Y=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=oa;b.prototype.makeReturn=oa;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}(ta);e.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 l=[];l.push(this.makeCode(this.tab+"import "));null!=this.clause&&l.push.apply(l,this.clause.compileNode(a));null!=(null!=(b=this.source)?b.value:void 0)&&(null!==this.clause&&l.push(this.makeCode(" from ")),l.push(this.makeCode(this.source.value)));
l.push(this.makeCode(";"));return l};return b}(Y);e.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}(ta);e.ExportDeclaration=Y=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 l=[];l.push(this.makeCode(this.tab+"export "));this instanceof J&&l.push(this.makeCode("default "));this instanceof J||!(this.clause instanceof x||this.clause instanceof f)||(this.clause instanceof f&&!this.clause.variable&&this.clause.error("anonymous classes cannot be exported"),l.push(this.makeCode("var ")),this.clause.moduleDeclaration="export");l=null!=this.clause.body&&this.clause.body instanceof a?l.concat(this.clause.compileToFragments(b,
na)):l.concat(this.clause.compileNode(b));null!=(null!=(d=this.source)?d.value:void 0)&&l.push(this.makeCode(" from "+this.source.value));l.push(this.makeCode(";"));return l};return c}(Y);e.ExportNamedDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ExportDefaultDeclaration=J=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ExportAllDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,
arguments)}v(b,a);return b}(Y);e.ModuleSpecifierList=Y=function(a){function b(a){this.specifiers=a}v(b,a);b.prototype.children=["specifiers"];b.prototype.compileNode=function(a){var b;var l=[];a.indent+=Fa;var c=this.specifiers;var m=[];var e=0;for(b=c.length;e<b;e++){var f=c[e];m.push(f.compileToFragments(a,va))}if(0!==this.specifiers.length){l.push(this.makeCode("{\n"+a.indent));e=b=0;for(c=m.length;b<c;e=++b)f=m[e],e&&l.push(this.makeCode(",\n"+a.indent)),l.push.apply(l,f);l.push(this.makeCode("\n}"))}else l.push(this.makeCode("{}"));
return l};return b}(ta);e.ImportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ExportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ModuleSpecifier=n=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}(ta);e.ImportSpecifier=Y=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<=R.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}(n);e.ImportDefaultSpecifier=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ImportNamespaceSpecifier=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}v(b,a);return b}(Y);e.ExportSpecifier=function(a){function b(a,d){b.__super__.constructor.call(this,a,d,"export")}v(b,a);return b}(n);e.Assign=x=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)===na&&null!=this.context&&(this.moduleDeclaration||0<=R.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 Ea(a,this,"variable")};b.prototype.compileNode=function(a){var b,c,l,e,f,m,h;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"===(e=this.context)||"\x26\x26\x3d"===e||"?\x3d"===e)return this.compileConditional(a);
if("**\x3d"===(f=this.context)||"//\x3d"===f||"%%\x3d"===f)return this.compileSpecialMath(a)}this.value instanceof k&&(this.value["static"]?(this.value.klass=this.variable.base,this.value.name=this.variable.properties[0],this.value.variable=this.variable):2<=(null!=(m=this.variable.properties)?m.length:void 0)&&(m=this.variable.properties,e=3<=m.length?M.call(m,0,l=m.length-2):(l=0,[]),f=m[l++],l=m[l++],"prototype"===(null!=(h=f.name)?h.value:void 0)&&(this.value.klass=new C(this.variable.base,e),
this.value.name=l,this.value.variable=this.variable)));this.context||(h=this.variable.unwrapAll(),h.isAssignable()||this.variable.error("'"+this.variable.compile(a)+"' can't be assigned"),"function"===typeof h.hasProperties&&h.hasProperties()||(this.moduleDeclaration?(this.checkAssignability(a,h),a.scope.add(h.value,this.moduleDeclaration)):this.param?a.scope.add(h.value,"var"):(this.checkAssignability(a,h),a.scope.find(h.value))));h=this.value.compileToFragments(a,va);c&&this.variable.base instanceof
q&&(this.variable.front=!0);c=this.variable.compileToFragments(a,va);if("object"===this.context){if(b=ca(c),0<=R.call(ma,b))c.unshift(this.makeCode('"')),c.push(this.makeCode('"'));return c.concat(this.makeCode(": "),h)}b=c.concat(this.makeCode(" "+(this.context||"\x3d")+" "),h);return a.level<=va?b:this.wrapInBraces(b)};b.prototype.compilePatternMatch=function(a){var d,c,l;var e=a.level===na;var f=this.value;var m=this.variable.base.objects;if(!(l=m.length)){var n=f.compileToFragments(a);return a.level>=
Ha?this.wrapInBraces(n):n}var k=m[0];1===l&&k instanceof I&&k.error("Destructuring assignment has no target");var q=this.variable.isObject();if(e&&1===l&&!(k instanceof T)){var p=null;if(k instanceof b&&"object"===k.context){n=k;var t=n.variable;var r=t.base;k=n.value;k instanceof b&&(p=k.value,k=k.variable)}else k instanceof b&&(p=k.value,k=k.variable),r=q?k["this"]?k.properties[0].name:new L(k.unwrap().value):new w(0);var x=r.unwrap()instanceof L;f=new C(f);f.properties.push(new (x?ra:Q)(r));(c=
Aa(k.unwrap().value))&&k.error(c);p&&(f=new h("?",f,p));return(new b(k,f,null,{param:this.param})).compileToFragments(a,na)}var v=f.compileToFragments(a,va);var u=ca(v);n=[];t=!1;f.unwrap()instanceof y&&!this.variable.assigns(u)||(n.push([this.makeCode((p=a.scope.freeVariable("ref"))+" \x3d ")].concat(M.call(v))),v=[this.makeCode(p)],u=p);p=f=0;for(d=m.length;f<d;p=++f){k=m[p];r=p;if(!t&&k instanceof T){c=k.name.unwrap().value;k=k.unwrap();r=l+" \x3c\x3d "+u+".length ? "+La("slice",a)+".call("+u+
", "+p;if(x=l-p-1){var K=a.scope.freeVariable("i",{single:!0});r+=", "+K+" \x3d "+u+".length - "+x+") : ("+K+" \x3d "+p+", [])"}else r+=") : []";r=new B(r);t=K+"++"}else if(!t&&k instanceof I){if(x=l-p-1)1===x?t=u+".length - 1":(K=a.scope.freeVariable("i",{single:!0}),r=new B(K+" \x3d "+u+".length - "+x),t=K+"++",n.push(r.compileToFragments(a,va)));continue}else(k instanceof T||k instanceof I)&&k.error("multiple splats/expansions are disallowed in an assignment"),p=null,k instanceof b&&"object"===
k.context?(r=k.variable,r=r.base,k=k.value,k instanceof b&&(p=k.value,k=k.variable)):(k instanceof b&&(p=k.value,k=k.variable),r=q?k["this"]?k.properties[0].name:new L(k.unwrap().value):new B(t||r)),c=k.unwrap().value,x=r.unwrap()instanceof L,r=new C(new B(u),[new (x?ra:Q)(r)]),p&&(r=new h("?",r,p));null!=c&&(c=Aa(c))&&k.error(c);n.push((new b(k,r,null,{param:this.param,subpattern:!0})).compileToFragments(a,va))}e||this.subpattern||n.push(v);n=this.joinFragmentArrays(n,", ");return a.level<va?n:this.wrapInBraces(n)};
b.prototype.compileConditional=function(a){var d=this.variable.cacheReference(a);var c=d[0];d=d[1];c.properties.length||!(c.base instanceof B)||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<=R.call(this.context,"?"))return a.isExistentialEquals=!0,(new G(new z(c),d,{type:"if"})).addElse(new b(d,this.value,"\x3d")).compileToFragments(a);c=(new h(this.context.slice(0,
-1),c,new b(d,this.value,"\x3d"))).compileToFragments(a);return a.level<=va?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 h(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 l=b.to;var e=b.exclusive;var f=this.variable.compile(a);if(c){var m=this.cacheToCodeFragments(c.cache(a,Ha));b=m[0];m=m[1]}else b=
m="0";l?null!=c&&c.isNumber()&&l.isNumber()?(l=l.compile(a)-m,e||(l+=1)):(l=l.compile(a,Ka)+" - "+m,e||(l+=" + 1")):l="9e9";e=this.value.cache(a,va);c=e[0];e=e[1];l=[].concat(this.makeCode("[].splice.apply("+f+", ["+b+", "+l+"].concat("),c,this.makeCode(")), "),e);return a.level>na?this.wrapInBraces(l):l};return b}(ta);e.Code=k=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 h&&a.isYield()||
a instanceof S})}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 ya(a,this.body,this)};c.prototype.compileNode=function(b){var d,l,e,f;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 y(this.context))],new a([this])),d=new za(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+=Fa;delete b.bare;delete b.isExistentialEquals;d=[];var m=[];var k=this.params;var n=0;for(e=k.length;n<e;n++){var q=k[n];q instanceof I||b.scope.parameter(q.asReference(b))}k=this.params;n=0;for(e=k.length;n<e;n++)if(q=k[n],q.splat||q instanceof I){n=this.params;var p=0;for(q=n.length;p<q;p++){var w=n[p];w instanceof I||!w.name.value||b.scope.add(w.name.value,"var",!0)}p=new x(new C(new r(function(){var a;
var d=this.params;var c=[];var l=0;for(a=d.length;l<a;l++)w=d[l],c.push(w.asReference(b));return c}.call(this))),new C(new y("arguments")));break}var t=this.params;k=0;for(n=t.length;k<n;k++){q=t[k];if(q.isComplex()){var v=f=q.asReference(b);q.value&&(v=new h("?",f,q.value));m.push(new x(new C(q.name),v,"\x3d",{param:!0}))}else f=q,q.value&&(e=new B(f.name.value+" \x3d\x3d null"),v=new x(new C(q.name),q.value,"\x3d"),m.push(new G(e,v)));p||d.push(f)}q=this.body.isEmpty();p&&m.unshift(p);m.length&&
(l=this.body.expressions).unshift.apply(l,m);l=p=0;for(m=d.length;p<m;l=++p)w=d[l],d[l]=w.compileToFragments(b),b.scope.parameter(ca(d[l]));var u=[];this.eachParamName(function(a,b){0<=R.call(u,a)&&b.error("multiple parameters named "+a);return u.push(a)});q||this.noReturn||this.body.makeReturn();l="function";this.isGenerator&&(l+="*");this.ctor&&(l+=" "+this.name);m=[this.makeCode(l+"(")];l=q=0;for(p=d.length;q<p;l=++q)w=d[l],l&&m.push(this.makeCode(", ")),m.push.apply(m,w);m.push(this.makeCode(") {"));
this.body.isEmpty()||(m=m.concat(this.makeCode("\n"),this.body.compileWithDeclarations(b),this.makeCode("\n"+this.tab)));m.push(this.makeCode("}"));return this.ctor?[this.makeCode(this.tab)].concat(M.call(m)):this.front||b.level>=Ka?this.wrapInBraces(m):m};c.prototype.eachParamName=function(a){var b;var c=this.params;var l=[];var e=0;for(b=c.length;e<b;e++){var f=c[e];l.push(f.eachName(a))}return l};c.prototype.traverseChildren=function(a,b){if(a)return c.__super__.traverseChildren.call(this,a,b)};
return c}(ta);e.Param=K=function(a){function b(a,b,c){this.name=a;this.value=b;this.splat=c;(a=Aa(this.name.unwrapAll().value))&&this.name.error(a);this.name instanceof q&&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,va)};b.prototype.asReference=function(a){if(this.reference)return this.reference;var b=this.name;b["this"]?(b=b.properties[0].name.value,
0<=R.call(ma,b)&&(b="_"+b),b=new y(a.scope.freeVariable(b))):b.isComplex()&&(b=new y(a.scope.freeVariable("arg")));b=new C(b);this.splat&&(b=new T(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,c;null==b&&(b=this.name);var l=function(b){return a("@"+b.properties[0].name.value,b)};if(b instanceof B)return a(b.value,b);if(b instanceof C)return l(b);b=null!=(d=b.objects)?
d:[];d=0;for(c=b.length;d<c;d++){var e=b[d];e instanceof x&&null==e.context&&(e=e.variable);e instanceof x?(e.value instanceof x&&(e=e.value),this.eachName(a,e.value.unwrap())):e instanceof T?(e=e.name.unwrap(),a(e.value,e)):e instanceof C?e.isArray()||e.isObject()?this.eachName(a,e.base):e["this"]?l(e):a(e.base.value,e.base):e instanceof I||e.error("illegal parameter "+e.compile())}};return b}(ta);e.Splat=T=function(a){function b(a){this.name=a.compile?a:new B(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,l,f,m;for(l=-1;(e=d[++l])&&!(e instanceof b););if(l>=d.length)return[];if(1===d.length)return e=d[0],d=e.compileToFragments(a,va),c?d:[].concat(e.makeCode(La("slice",a)+".call("),d,e.makeCode(")"));c=d.slice(l);var h=f=0;for(m=c.length;f<
m;h=++f){e=c[h];var k=e.compileToFragments(a,va);c[h]=e instanceof b?[].concat(e.makeCode(La("slice",a)+".call("),k,e.makeCode(")")):[].concat(e.makeCode("["),k,e.makeCode("]"))}if(0===l)return e=d[0],a=e.joinFragmentArrays(c.slice(1),", "),c[0].concat(e.makeCode(".concat("),a,e.makeCode(")"));f=d.slice(0,l);m=[];k=0;for(h=f.length;k<h;k++)e=f[k],m.push(e.compileToFragments(a,va));e=d[0].joinFragmentArrays(m,", ");a=d[l].joinFragmentArrays(c,", ");c=d[d.length-1];return[].concat(d[0].makeCode("["),
e,d[l].makeCode("].concat("),a,c.makeCode(")"))};return b}(ta);e.Expansion=I=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}(ta);e.While=Y=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+=Fa;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 G((new P(this.guard)).invert(),new V("continue"))):this.guard&&(e=a.wrap([new G(this.guard,e)]))),e=[].concat(this.makeCode("\n"),e.compileToFragments(b,na),this.makeCode("\n"+this.tab)));b=[].concat(this.makeCode(c+this.tab+"while ("),this.condition.compileToFragments(b,
Da),this.makeCode(") {"),e,this.makeCode("}"));this.returns&&b.push(this.makeCode("\n"+this.tab+"return "+d+";"));return b};return c}(ta);e.Op=h=function(a){function b(a,b,d,e){if("in"===a)return new O(b,d);if("do"===a)return this.generateDo(b);if("new"===a){if(b instanceof za&&!b["do"]&&!b.isNew)return b.newInstance();if(b instanceof k&&b.bound||b["do"])b=new P(b)}this.operator=c[a]||a;this.first=b;this.second=d;this.flip=!!e;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,c;if(this.isChainable()&&this.first.isChainable()){var e=!0;for(a=this;a&&a.operator;)e&&(e=a.operator in d),a=a.first;if(!e)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&&(e=this.first.unwrap())instanceof b&&("!"===(c=e.operator)||"in"===c||"instanceof"===c)?e:new b("!",this)};b.prototype.unfoldSoak=function(a){var b;return("++"===(b=this.operator)||"--"===b||"delete"===b)&&Ea(a,this,"first")};b.prototype.generateDo=function(a){var b,d;var c=[];var e=(a instanceof x&&(b=a.value.unwrap())instanceof k?b:a).params||[];b=0;for(d=e.length;b<d;b++){var l=e[b];l.value?(c.push(l.value),delete l.value):c.push(l)}a=new za(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=Aa(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,Ha),b=this.second.compileToFragments(a,Ha),d=[].concat(d,this.makeCode(" "+this.operator+" "),b),a.level<=Ha?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,Ha).concat(this.makeCode(" "+(this.invert?"\x26\x26":"||")+" "),
b.compileToFragments(a),this.makeCode(" "+this.operator+" "),this.second.compileToFragments(a,Ha));return this.wrapInBraces(a)};b.prototype.compileExistence=function(a){if(this.first.isComplex()){var b=new y(a.scope.freeVariable("ref"));var d=new P(new x(b,this.first))}else b=d=this.first;return(new G(new z(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 z)return this.first.negated=
!this.first.negated,this.first.compileToFragments(a);if(a.level>=Ka)return(new P(this)).compileToFragments(a);var e="+"===c||"-"===c;("new"===c||"typeof"===c||"delete"===c||e&&this.first instanceof b&&this.first.operator===c)&&d.push([this.makeCode(" ")]);if(e&&this.first instanceof b||"new"===c&&this.first.isStatement(a))this.first=new P(this.first);d.push(this.first.compileToFragments(a,Ha));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<=R.call(Object.keys(this.first),"expression")&&!(this.first instanceof aa)?null!=this.first.expression&&d.push(this.first.expression.compileToFragments(a,Ha)):(a.level>=Da&&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,Ha)),a.level>=Da&&d.push([this.makeCode(")")]));return this.joinFragmentArrays(d,
"")};b.prototype.compilePower=function(a){var b=new C(new y("Math"),[new ra(new L("pow"))]);return(new za(b,[this.first,this.second])).compileToFragments(a)};b.prototype.compileFloorDivision=function(a){var d=new C(new y("Math"),[new ra(new L("floor"))]);var c=this.second.isComplex()?new P(this.second):this.second;c=new b("/",this.first,c);return(new za(d,[c])).compileToFragments(a)};b.prototype.compileModulo=function(a){var b=new C(new B(La("modulo",a)));return(new za(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}(ta);e.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=sa;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 l=c[e];if(l instanceof T){var f=!0;break}}if(!f)return this.compileOrTest(a)}return this.compileLoopTest(a)};
b.prototype.compileOrTest=function(a){var b,c;var e=this.object.cache(a,Ha);var f=e[0];var l=e[1];var h=this.negated?[" !\x3d\x3d "," \x26\x26 "]:[" \x3d\x3d\x3d "," || "];e=h[0];h=h[1];var m=[];var k=this.array.base.objects;var n=b=0;for(c=k.length;b<c;n=++b){var q=k[n];n&&m.push(this.makeCode(h));m=m.concat(n?l:f,this.makeCode(e),q.compileToFragments(a,Ka))}return a.level<Ha?m:this.wrapInBraces(m)};b.prototype.compileLoopTest=function(a){var b=this.object.cache(a,va);var c=b[0];var e=b[1];b=[].concat(this.makeCode(La("indexOf",
a)+".call("),this.array.compileToFragments(a,va),this.makeCode(", "),e,this.makeCode(") "+(this.negated?"\x3c 0":"\x3e\x3d 0")));if(ca(c)===ca(e))return b;b=c.concat(this.makeCode(", "),b);return a.level<va?b:this.wrapInBraces(b)};b.prototype.toString=function(a){return b.__super__.toString.call(this,a,this.constructor.name+(this.negated?"!":""))};return b}(ta);e.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+=Fa;var f=this.attempt.compileToFragments(a,na);var l=this.recovery?(b=a.scope.freeVariable("error",{reserve:!1}),e=new y(b),
this.errorVariable?(c=Aa(this.errorVariable.unwrapAll().value),c?this.errorVariable.error(c):void 0,this.recovery.unshift(new x(this.errorVariable,e))):void 0,[].concat(this.makeCode(" catch ("),e.compileToFragments(a),this.makeCode(") {\n"),this.recovery.compileToFragments(a,na),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,
na),this.makeCode("\n"+this.tab+"}")):[];return[].concat(this.makeCode(this.tab+"try {\n"),f,this.makeCode("\n"+this.tab+"}"),l,a)};return b}(ta);e.Throw=aa=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=oa;b.prototype.compileNode=function(a){return[].concat(this.makeCode(this.tab+"throw "),this.expression.compileToFragments(a),this.makeCode(";"))};return b}(ta);e.Existence=z=function(a){function b(a){this.expression=
a}v(b,a);b.prototype.children=["expression"];b.prototype.invert=sa;b.prototype.compileNode=function(a){this.expression.front=this.front;var b=this.expression.compile(a,Ha);if(this.expression.unwrap()instanceof y&&!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<=gb?b:"("+b+")")]};return b}(ta);e.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,Da);return a.level<Ha&&(b instanceof h||b instanceof za||b instanceof N&&b.returns)&&(a.level<gb||3>=c.length)?c:this.wrapInBraces(c)};return b}(ta);
e.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 l=e[f];l instanceof D?(l=l.value.slice(1,-1),l=
l.replace(/(\\*)(`|\$\{)/g,function(a,b,d){return 0===b.length%2?b+"\\"+d:a}),c.push(this.makeCode(l))):(c.push(this.makeCode("${")),c.push.apply(c,l.compileToFragments(a,Da)),c.push(this.makeCode("}")))}c.push(this.makeCode("`"));return c};return b}(P);e.For=N=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 U&&!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,l,h,k;var n=a.wrap([this.body]);var m=n.expressions;m=m[m.length-1];(null!=m?m.jumps():void 0)instanceof H&&(this.returns=!1);var q=this.range?this.source.base:this.source;var p=b.scope;this.pattern||(e=this.name&&this.name.compile(b,va));m=this.index&&this.index.compile(b,va);e&&!this.pattern&&
p.find(e);!m||this.index instanceof C||p.find(m);this.returns&&(c=p.freeVariable("results"));this.from?this.pattern&&(f=p.freeVariable("x",{single:!0})):f=this.object&&m||p.freeVariable("i",{single:!0});var w=(this.range||this.from)&&e||m||f;var r=w!==f?w+" \x3d ":"";if(this.step&&!this.range){m=this.cacheToCodeFragments(this.step.cache(b,va,Za));var t=m[0];var v=m[1];this.step.isNumber()&&(h=Number(v))}this.pattern&&(e=f);var u=m=k="";var K=this.tab+Fa;if(this.range)var A=q.compileToFragments(ja(b,
{index:f,name:e,step:this.step,isComplex:Za}));else{var z=this.source.compile(b,va);!e&&!this.own||this.source.unwrap()instanceof y||(u+=""+this.tab+(q=p.freeVariable("ref"))+" \x3d "+z+";\n",z=q);!e||this.pattern||this.from||(l=e+" \x3d "+z+"["+w+"]");this.object||this.from||(t!==v&&(u+=""+this.tab+t+";\n"),e=0>h,this.step&&null!=h&&e||(d=p.freeVariable("len")),A=""+r+f+" \x3d 0, "+d+" \x3d "+z+".length",t=""+r+f+" \x3d "+z+".length - 1",d=f+" \x3c "+d,p=f+" \x3e\x3d 0",this.step?(null!=h?e&&(d=
p,A=t):(d=v+" \x3e 0 ? "+d+" : "+p,A="("+v+" \x3e 0 ? ("+A+") : "+t+")"),f=f+" +\x3d "+v):f=""+(w!==f?"++"+f:f+"++"),A=[this.makeCode(A+"; "+d+"; "+r+f)])}if(this.returns){var U=""+this.tab+c+" \x3d [];\n";var D="\n"+this.tab+"return "+c+";";n.makeReturn(c)}this.guard&&(1<n.expressions.length?n.expressions.unshift(new G((new P(this.guard)).invert(),new V("continue"))):this.guard&&(n=a.wrap([new G(this.guard,n)])));this.pattern&&n.expressions.unshift(new x(this.name,this.from?new y(w):new B(z+"["+
w+"]")));c=[].concat(this.makeCode(u),this.pluckDirectCall(b,n));l&&(k="\n"+K+l+";");this.object?(A=[this.makeCode(w+" in "+z)],this.own&&(m="\n"+K+"if (!"+La("hasProp",b)+".call("+z+", "+w+")) continue;")):this.from&&(A=[this.makeCode(w+" of "+z)]);(b=n.compileToFragments(ja(b,{indent:K}),na))&&0<b.length&&(b=[].concat(this.makeCode("\n"),b,this.makeCode("\n")));return[].concat(c,this.makeCode(""+(U||"")+this.tab+"for ("),A,this.makeCode(") {"+m+k),b,this.makeCode(this.tab+"}"+(D||"")))};c.prototype.pluckDirectCall=
function(a,b){var d,c,e,f,h,l,n;var m=[];var q=b.expressions;var p=d=0;for(c=q.length;d<c;p=++d){var w=q[p];w=w.unwrapAll();if(w instanceof za){var r=null!=(e=w.variable)?e.unwrapAll():void 0;if(r instanceof k||r instanceof C&&(null!=(f=r.base)?f.unwrapAll():void 0)instanceof k&&1===r.properties.length&&("call"===(h=null!=(l=r.properties[0].name)?l.value:void 0)||"apply"===h)){var t=(null!=(n=r.base)?n.unwrapAll():void 0)||r;var v=new y(a.scope.freeVariable("fn"));var u=new C(v);r.base&&(u=[u,r],
r.base=u[0],u=u[1]);b.expressions[p]=new za(u,w.args);m=m.concat(this.makeCode(this.tab),(new x(v,t)).compileToFragments(a,na),this.makeCode(";\n"))}}}return m};return c}(Y);e.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 h=e[f];h=h[1];if(h=h.jumps(a))return h}return null!=
(c=this.otherwise)?c.jumps(a):void 0};c.prototype.makeReturn=function(b){var d,c;var e=this.cases;var f=0;for(d=e.length;f<d;f++){var h=e[f];h[1].makeReturn(b)}b&&(this.otherwise||(this.otherwise=new a([new B("void 0")])));null!=(c=this.otherwise)&&c.makeReturn(b);return this};c.prototype.compileNode=function(a){var b,c,e,f;var h=a.indent+Fa;var l=a.indent=h+Fa;var k=[].concat(this.makeCode(this.tab+"switch ("),this.subject?this.subject.compileToFragments(a,Da):this.makeCode("false"),this.makeCode(") {\n"));
var n=this.cases;var m=c=0;for(e=n.length;c<e;m=++c){var q=n[m];var p=q[0];q=q[1];var w=ia([p]);p=0;for(f=w.length;p<f;p++){var r=w[p];this.subject||(r=r.invert());k=k.concat(this.makeCode(h+"case "),r.compileToFragments(a,Da),this.makeCode(":\n"))}0<(b=q.compileToFragments(a,na)).length&&(k=k.concat(b,this.makeCode("\n")));if(m===this.cases.length-1&&!this.otherwise)break;m=this.lastNonComment(q.expressions);m instanceof H||m instanceof B&&m.jumps()&&"debugger"!==m.value||k.push(r.makeCode(l+"break;\n"))}this.otherwise&&
this.otherwise.expressions.length&&k.push.apply(k,[this.makeCode(h+"default:\n")].concat(M.call(this.otherwise.compileToFragments(a,na)),[this.makeCode("\n")]));k.push(this.makeCode(this.tab+"}"));return k};return c}(ta);e.If=G=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)===na||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 B("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 e=a.indent+Fa;var f=this.condition.compileToFragments(a,Da);var h=this.ensureBlock(this.body).compileToFragments(ja(a,{indent:e}));h=[].concat(this.makeCode("if ("),f,this.makeCode(") {\n"),h,this.makeCode("\n"+this.tab+"}"));b||h.unshift(this.makeCode(this.tab));if(!this.elseBody)return h;b=h.concat(this.makeCode(" else "));
this.isChain?(a.chainChild=!0,b=b.concat(this.elseBody.unwrap().compileToFragments(a,na))):b=b.concat(this.makeCode("{\n"),this.elseBody.compileToFragments(ja(a,{indent:e}),na),this.makeCode("\n"+this.tab+"}"));return b};c.prototype.compileExpression=function(a){var b=this.condition.compileToFragments(a,gb);var c=this.bodyNode().compileToFragments(a,va);var e=this.elseBodyNode()?this.elseBodyNode().compileToFragments(a,va):[this.makeCode("void 0")];e=b.concat(this.makeCode(" ? "),c,this.makeCode(" : "),
e);return a.level>=gb?this.wrapInBraces(e):e};c.prototype.unfoldSoak=function(){return this.soak&&this};return c}(ta);var jc={extend:function(a){return"function(child, parent) { for (var key in parent) { if ("+La("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 na=1;var Da=2;var va=3;var gb=4;var Ha=5;var Ka=6;var Fa=" ";var Ra=/^[+-]?\d+$/;var La=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,jc[a](b));return c.utilities[a]=d};var Ga=function(a,b){a=a.replace(/\n/g,"$\x26"+b);return a.replace(/\s+$/,"")};var Wa=function(a){return a instanceof y&&"arguments"===a.value};var da=function(a){return a instanceof E||a instanceof k&&a.bound||a instanceof xa};var Za=function(a){return a.isComplex()||("function"===typeof a.isAssignable?a.isAssignable():void 0)};var Ea=function(a,b,c){if(a=b[c].unfoldSoak(a))return b[c]=a.body,a.body=new C(b),a}}).call(this);return e}();
u["./sourcemap"]=function(){var e={};(function(){var u=function(){function e(e){this.line=e;this.columns=[]}e.prototype.add=function(e,a,b){var r=a[0];a=a[1];null==b&&(b={});if(!this.columns[e]||!b.noReplace)return this.columns[e]={line:this.line,column:e,sourceLine:r,sourceColumn:a}};e.prototype.sourceLocation=function(e){for(var a;!((a=this.columns[e])||0>=e);)e--;return a&&[a.sourceLine,a.sourceColumn]};return e}();e=function(){function e(){this.lines=[]}e.prototype.add=function(e,a,b){var r;null==
b&&(b={});var f=a[0];a=a[1];return((r=this.lines)[f]||(r[f]=new u(f))).add(a,e,b)};e.prototype.sourceLocation=function(e){var a;var b=e[0];for(e=e[1];!((a=this.lines[b])||0>=b);)b--;return a&&a.sourceLocation(e)};e.prototype.generate=function(e,a){var b,r,f,k,t,p,u;null==e&&(e={});null==a&&(a=null);var x=f=r=u=0;var J=!1;var F="";var N=this.lines;var y=b=0;for(k=N.length;b<k;y=++b)if(y=N[y]){var G=y.columns;y=0;for(t=G.length;y<t;y++)if(p=G[y]){for(;u<p.line;)r=0,J=!1,F+=";",u++;J&&(F+=",");F+=this.encodeVlq(p.column-
r);r=p.column;F+=this.encodeVlq(0);F+=this.encodeVlq(p.sourceLine-f);f=p.sourceLine;F+=this.encodeVlq(p.sourceColumn-x);x=p.sourceColumn;J=!0}}F={version:3,file:e.generatedFile||"",sourceRoot:e.sourceRoot||"",sources:e.sourceFiles||[""],names:[],mappings:F};e.inlineMap&&(F.sourcesContent=[a]);return F};e.prototype.encodeVlq=function(e){var a;var b="";for(a=(Math.abs(e)<<1)+(0>e?1:0);a||!b;)e=a&31,(a>>=5)&&(e|=32),b+=this.encodeBase64(e);return b};e.prototype.encodeBase64=function(e){var a;if(!(a=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e]))throw Error("Cannot Base64 encode value: "+e);return a};return e}()}).call(this);return e}();u["./coffee-script"]=function(){var e={};(function(){var ra,r,x={}.hasOwnProperty;var a=u("fs");var b=u("vm");var za=u("path");var f=u("./lexer").Lexer;var k=u("./parser").parser;var t=u("./helpers");var p=u("./sourcemap");var z=u("../../package.json");e.VERSION=z.version;e.FILE_EXTENSIONS=[".coffee",".litcoffee",".coffee.md"];e.helpers=
t;var I=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.");}};z=function(a){return function(b,e){null==e&&(e={});try{return a.call(this,b,e)}catch(h){var c=h;if("string"!==typeof b)throw c;throw t.updateSyntaxError(c,b,e.filename);}}};var J={};var F=
{};e.compile=ra=z(function(a,b){var c,e,f,n;var r=t.extend;b=r({},b);var u=b.sourceMap||b.inlineMap||null==b.filename;r=b.filename||"\x3canonymous\x3e";J[r]=a;u&&(f=new p);var y=O.tokenize(a,b);var x=b;var z=[];var B=0;for(c=y.length;B<c;B++){var G=y[B];"IDENTIFIER"===G[0]&&z.push(G[1])}x.referencedVars=z;if(null==b.bare||!0!==b.bare)for(x=0,B=y.length;x<B;x++)if(G=y[x],"IMPORT"===(e=G[0])||"EXPORT"===e){b.bare=!0;break}B=k.parse(y).compileToFragments(b);y=0;b.header&&(y+=1);b.shiftLine&&(y+=1);G=
0;e="";c=0;for(z=B.length;c<z;c++){x=B[c];if(u){x.locationData&&!/^[;\s]*$/.test(x.code)&&f.add([x.locationData.first_line,x.locationData.first_column],[y,G],{noReplace:!0});var N=t.count(x.code,"\n");y+=N;G=N?x.code.length-(x.code.lastIndexOf("\n")+1):G+x.code.length}e+=x.code}b.header&&(G="Generated by CoffeeScript "+this.VERSION,e="// "+G+"\n"+e);if(u){var D=f.generate(b,a);F[r]=f}b.inlineMap&&(a=I(JSON.stringify(D)),r="//# sourceURL\x3d"+(null!=(n=b.filename)?n:"coffeescript"),e=e+"\n"+("//# sourceMappingURL\x3ddata:application/json;base64,"+
a)+"\n"+r);return b.sourceMap?{js:e,sourceMap:f,v3SourceMap:JSON.stringify(D,null,2)}:e});e.tokens=z(function(a,b){return O.tokenize(a,b)});e.nodes=z(function(a,b){return"string"===typeof a?k.parse(O.tokenize(a,b)):k.parse(a)});e.run=function(b,c){var e;null==c&&(c={});var f=u.main;f.filename=process.argv[1]=c.filename?a.realpathSync(c.filename):"\x3canonymous\x3e";f.moduleCache&&(f.moduleCache={});var h=null!=c.filename?za.dirname(a.realpathSync(c.filename)):a.realpathSync(".");f.paths=u("module")._nodeModulePaths(h);
if(!t.isCoffee(f.filename)||u.extensions)b=ra(b,c),b=null!=(e=b.js)?e:b;return f._compile(b,f.filename)};e.eval=function(a,c){var e,f,h,k,n;null==c&&(c={});if(a=a.trim()){var p=null!=(h=b.Script.createContext)?h:b.createContext;h=null!=(f=b.isContext)?f:function(a){return c.sandbox instanceof p().constructor};if(p){if(null!=c.sandbox){if(h(c.sandbox))var r=c.sandbox;else for(k in r=p(),h=c.sandbox,h)x.call(h,k)&&(f=h[k],r[k]=f);r.global=r.root=r.GLOBAL=r}else r=global;r.__filename=c.filename||"eval";
r.__dirname=za.dirname(r.__filename);if(r===global&&!r.module&&!r.require){var t=u("module");r.module=e=new t(c.modulename||"eval");r.require=f=function(a){return t._load(a,e,!0)};e.filename=r.__filename;var y=Object.getOwnPropertyNames(u);h=0;for(n=y.length;h<n;h++){var z=y[h];"paths"!==z&&"arguments"!==z&&"caller"!==z&&(f[z]=u[z])}f.paths=e.paths=t._nodeModulePaths(process.cwd());f.resolve=function(a){return t._resolveFilename(a,e)}}}h={};for(k in c)x.call(c,k)&&(f=c[k],h[k]=f);h.bare=!0;a=ra(a,
h);return r===global?b.runInThisContext(a):b.runInContext(a,r)}};e.register=function(){return u("./register")};if(u.extensions){var N=this.FILE_EXTENSIONS;var y=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 G=0;for(r=N.length;G<r;G++)z=N[G],y(z)}e._compileFile=function(b,c,e){null==c&&(c=!1);null==e&&(e=!1);var f=a.readFileSync(b,"utf8");f=65279===f.charCodeAt(0)?
f.substring(1):f;try{var h=ra(f,{filename:b,sourceMap:c,inlineMap:e,sourceFiles:[b],literate:t.isLiterate(b)})}catch(K){throw c=K,t.updateSyntaxError(c,f,b);}return h};var O=new f;k.lexer={lex:function(){var a;if(a=k.tokens[this.pos++]){var b=a[0];this.yytext=a[1];this.yylloc=a[2];k.errorToken=a.origin||a;this.yylineno=this.yylloc.first_line}else b="";return b},setInput:function(a){k.tokens=a;return this.pos=0},upcomingInput:function(){return""}};k.yy=u("./nodes");k.yy.parseError=function(a,b){var c=
k.errorToken;var e=k.tokens;var f=c[0];var n=c[1];a=c[2];n=function(){switch(!1){case c!==e[e.length-1]:return"end of input";case "INDENT"!==f&&"OUTDENT"!==f:return"indentation";case "IDENTIFIER"!==f&&"NUMBER"!==f&&"INFINITY"!==f&&"STRING"!==f&&"STRING_START"!==f&&"REGEX"!==f&&"REGEX_START"!==f:return f.replace(/_START$/,"").toLowerCase();default:return t.nameWhitespaceCharacter(n)}}();return t.throwSyntaxError("unexpected "+n,a)};var Q=function(a,b){var c;if(a.isNative())var e="native";else{a.isEval()?
(c=a.getScriptNameOrSourceURL())||a.getEvalOrigin():c=a.getFileName();c||(c="\x3canonymous\x3e");var f=a.getLineNumber();e=a.getColumnNumber();e=(b=b(c,f,e))?c+":"+b[0]+":"+b[1]:c+":"+f+":"+e}c=a.getFunctionName();f=a.isConstructor();if(a.isToplevel()||f)return f?"new "+(c||"\x3canonymous\x3e")+" ("+e+")":c?c+" ("+e+")":e;f=a.getMethodName();var k=a.getTypeName();return c?(b=a="",k&&c.indexOf(k)&&(b=k+"."),f&&c.indexOf("."+f)!==c.length-f.length-1&&(a=" [as "+f+"]"),""+b+c+a+" ("+e+")"):k+"."+(f||
"\x3canonymous\x3e")+" ("+e+")"};var B=function(a){return null!=F[a]?F[a]:null!=F["\x3canonymous\x3e"]?F["\x3canonymous\x3e"]:null!=J[a]?(a=ra(J[a],{filename:a,sourceMap:!0,literate:t.isLiterate(a)}),a.sourceMap):null};Error.prepareStackTrace=function(a,b){var c;var f=function(a,b,c){var e;a=B(a);null!=a&&(e=a.sourceLocation([b-1,c-1]));return null!=e?[e[0]+1,e[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()===e.run)break;h.push(" at "+Q(c,
f))}return h}();return a.toString()+"\n"+h.join("\n")+"\n"}}).call(this);return e}();u["./browser"]=function(){(function(){var e=[].indexOf||function(a){for(var b=0,e=this.length;b<e;b++)if(b in this&&this[b]===a)return b;return-1};var ra=u("./coffee-script");ra.require=u;var r=ra.compile;ra.eval=function(a,b){null==b&&(b={});null==b.bare&&(b.bare=!0);return eval(r(a,b))};ra.run=function(a,b){null==b&&(b={});b.bare=!0;b.shiftLine=!0;return Function(r(a,b))()};if("undefined"!==typeof window&&null!==
window){"undefined"!==typeof btoa&&null!==btoa&&"undefined"!==typeof JSON&&null!==JSON&&(r=function(a,b){null==b&&(b={});b.inlineMap=!0;return ra.compile(a,b)});ra.load=function(a,b,e,f){null==e&&(e={});null==f&&(f=!1);e.sourceFiles=[a];var k=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest;k.open("GET",a,!0);"overrideMimeType"in k&&k.overrideMimeType("text/plain");k.onreadystatechange=function(){var r;if(4===k.readyState){if(0===(r=k.status)||200===r)r=
[k.responseText,e],f||ra.run.apply(ra,r);else throw Error("Could not load "+a);if(b)return b(r)}};return k.send(null)};var x=function(){var a,b,r;var f=window.document.getElementsByTagName("script");var k=["text/coffeescript","text/literate-coffeescript"];var t=function(){var a,b;var p=[];var t=0;for(a=f.length;t<a;t++)r=f[t],(b=r.type,0<=e.call(k,b))&&p.push(r);return p}();var p=0;var u=function(){var a=t[p];if(a instanceof Array)return ra.run.apply(ra,a),p++,u()};var x=function(a,b){var e;var f=
{literate:a.type===k[1]};if(e=a.src||a.getAttribute("data-src"))return ra.load(e,function(a){t[b]=a;return u()},f,!0);f.sourceFiles=["embedded"];return t[b]=[a.innerHTML,f]};var J=a=0;for(b=t.length;a<b;J=++a){var F=t[J];x(F,J)}return u()};window.addEventListener?window.addEventListener("DOMContentLoaded",x,!1):window.attachEvent("onload",x)}}).call(this);return{}}();return u["./coffee-script"]}();"function"===typeof define&&define.amd?define(function(){return xa}):u.CoffeeScript=xa})(this);

3228
docs/v1/index.html Normal file

File diff suppressed because one or more lines are too long

11761
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,885 @@
<!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>
exports.buildCSOptionParser = buildCSOptionParser = <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">new</span> optparse.OptionParser SWITCHES, BANNER</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>
optionParser = buildCSOptionParser()
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>
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 optionParser.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,368 @@
<!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>
<p>The <code>coffee</code> command uses an instance of <strong>OptionParser</strong> to parse its
command-line arguments in <code>src/command.coffee</code>.</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

4572
docs/v2/index.html Normal file

File diff suppressed because it is too large Load Diff

14681
docs/v2/test.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
```
function time() {
return `The time is ${new Date().toLocaleTimeString()}`;
}
```

View File

@@ -0,0 +1,3 @@
markdown = `function () {
return \`In Markdown, write code like \\\`this\\\`\`;
}`

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