Compare commits

..

415 Commits

Author SHA1 Message Date
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
Simon Lydell
c3f5b8db86 Replace .npmignore with "files": [...] in package.json 2016-09-24 14:26:46 +02:00
Simon Lydell
2923e88207 Merge pull request #4315 from lydell/1.11.0 2016-09-24 14:18:33 +02:00
Simon Lydell
66b5203689 CoffeeScript 1.11.0 2016-09-24 14:16:00 +02:00
Simon Lydell
e908fd4a91 Styling fixes for the documentation 2016-09-24 14:15:54 +02:00
Simon Lydell
ab97e2224e Add changelog for version 1.11.0 2016-09-24 14:15:54 +02:00
Simon Lydell
f6bc4b4c32 Update CLI flags documentation 2016-09-24 14:01:41 +02:00
Geoffrey Booth
a8b77fb4e7 Add modules documentation (#4309) 2016-09-18 20:54:44 +02:00
Simon Lydell
7667cb2370 Merge pull request #4308 from GeoffreyBooth/import-export
Be much more careful about parsing `*` in import and export statements
2016-09-15 17:20:07 +02:00
Geoffrey Booth
51f24e0641 Be much more careful about parsing * in import and export statements; handle export expressions that use * on the same line as export 2016-09-14 23:30:58 -07:00
Simon Lydell
9ae377b481 Fix source maps for errors thrown from .coffee.md files
Before:

```
$ cat tmp.coffee.md
test

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

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

After:

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

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

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

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

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

After:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #4269.

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

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

Before:

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

After:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This is what happens on smaller screens:

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

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

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

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

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

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

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

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

After:

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

This does not re-break #3638:

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

The repl was affected by the above bug.

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

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

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

It compiles to:

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

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

This also fixes #1392.

In short, `super` is now allowed:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

It should perhaps also be noted that apart from escaping (such as `a /\ b/`) you
may now also use parentheses to disambiguate division and regex: `a (/ b/)`. See
https://github.com/jashkenas/coffeescript/issues/3182#issuecomment-26688427.
2015-01-10 01:48:00 +01:00
Simon Lydell
24398774fc Fix #3598: Make unary + and - generate _refs
Before commit c056c93e `Op::isComplex()` used to return true always. As far as I
understand, that commit attempts to exclude code such as `+1` and `-2` from
being marked as complex (and thus getting cached into `_ref` variables
sometimes). CoffeeScript is supposed to generate readable output so that choice
is understandable. However, it also excludes code such as `+a` (by mistake I
believe), which can cause `a` to be coerced multiple times. This commit fixes
this by only excluding unary + and - ops followed by a number.
2015-01-09 18:12:10 +01:00
Jeremy Ashkenas
e769423d52 Merge pull request #3774 from lydell/unicode-spaces
Fix #2516, #3560: Unicode space handling
2015-01-06 16:10:59 -05:00
Simon Lydell
9ec427ba80 Fix #2516, #3560: Unicode space handling
It is possible to match only valid JavaScript identifiers with a really long
regex (like coco and CoffeeScriptRedux does), but CoffeeScript uses a much
simpler one, which allows a bit too much.

Quoting jashkenas/coffeescript#1718 #issuecomment-2152464 @jashkenas:

> But it still seems very much across the "worth it" line. You'll get the
> SyntaxError as soon as it hits JS, and performance aside -- even the increase
> in filesize for our browser coffee-script.js lib seems too much, considering
> this is something no one ever does, apart from experimentation.

In short, CoffeeScript treats any non-ASCII character as part of an identifier.
However, unicode spaces should be excluded since having blank characters as part
of a _word_ is very confusing. This commit does so, while still keeping the
regex really simple.
2015-01-06 21:32:14 +01:00
Jeremy Ashkenas
c478f283f4 Merge pull request #3771 from mbrio/master
Fix issue #3498
2015-01-05 15:51:26 -05:00
Michael Diolosa
8e299b09cc Fix issue #3498 2015-01-05 15:40:04 -05:00
Michael Ficarra
b70f6571bd Merge pull request #3770 from lydell/interpolations
Refactor interpolation (and string and regex) handling in lexer
2015-01-04 12:12:56 -08:00
Simon Lydell
ae6df88c5c Point "missing )/}/]" errors to the unclosed (/{/[
Previously such errors pointed at the end of the input, which wasn't very
helpful. This is also consistent with unclosed strings, where the errors point
at the opening quote.

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

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

- Fix #3348, by adding passing tests.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- The above two points should result in more easily read code, too.
2015-01-04 07:47:09 +01:00
Jeremy Ashkenas
8e4fb1b937 Merge pull request #3748 from sscotth/master
Include logo .svg files
2014-12-03 10:20:32 -05:00
Scott
931b74e449 include logo .svg files 2014-12-02 18:33:07 -06:00
Jeremy Ashkenas
4199f4f325 Merge pull request #3734 from alubbe/master
fixed yield keyword not working in switch & for loop expressions
2014-11-21 18:38:11 -05:00
alubbe
5950d6328d added tests for yield in switch & for loop expressions 2014-11-21 23:14:53 +01:00
alubbe
a9fbf14adf fixed yield keyword not working in switch & for loop expressions 2014-11-21 22:52:09 +01:00
Jeremy Ashkenas
485aa8efcf add Die Alternative to books section 2014-11-17 13:43:41 -05:00
Jeremy Ashkenas
a563e8f8fe Merge pull request #3703 from bigtunacan/master
Add bower.json configuration
2014-10-29 17:05:25 -04:00
Joiey Seeley
4035e7caab Removed "mkdirp": "~0.3.5" from bower.json 2014-10-29 15:10:57 -05:00
Joiey Seeley
2c6e6ca870 Added an initial bower.json configuration file 2014-10-29 14:23:31 -05:00
Jeremy Ashkenas
f2a3f7507e Merge pull request #3521 from gscottolson/master
Retina favicon.ico
2014-10-27 17:18:33 -04:00
Jeremy Ashkenas
4f82e5912e Merge pull request #3677 from alubbe/master
implemented proper precedence for 'yield'
2014-10-13 11:41:36 -04:00
alubbe
dd5da7f5f2 implemented proper precedence for 'yield' 2014-10-13 03:32:02 +02:00
Anatoly Ressin
ec44aba71a Improved test readability + fixed integer divison 2014-10-12 22:32:02 +03:00
Anatoly Ressin
e8a4e93a72 Added failing test case for the yield precedence 2014-10-12 20:08:28 +03:00
dtaniwaki
1301390087 Use stdio option instead of customFds 2014-10-04 12:54:07 +09:00
Jeremy Ashkenas
158ca0d869 Merge pull request #3638 from lbeschastny/issue3638
Invalid block comments compilation
2014-09-23 14:52:03 -04:00
Jeremy Ashkenas
a78cbe78a1 Merge pull request #3240 from alubbe/master
using 'yield' automatically turns functions into generators
2014-09-19 16:38:41 -04:00
Leonid Beschastny
77d5b95260 Added test for jashkenas/coffee-script#3638 2014-09-17 15:02:18 +04:00
Leonid Beschastny
55e3b6b3c3 Fixed jashkenas/coffeescript#3638 - invalid block comments compilation 2014-09-17 15:02:10 +04:00
Andreas Lubbe
efca2861a6 added tests for yield, yield from, yield return and yield in if statements 2014-09-06 17:25:44 +02:00
Andreas Lubbe
781ea22d57 always wrap 'yield' in () to allow composability with all other operators 2014-09-06 17:12:25 +02:00
Andreas Lubbe
437b9ed65c added 'yield return' 2014-09-06 15:40:53 +02:00
Andreas Lubbe
c72556619f added 'yield from' 2014-09-06 13:53:21 +02:00
Andreas Lubbe
565d78f00b removed support for '->*" and '=>*' 2014-09-06 13:38:04 +02:00
Andreas Lubbe
75900660fd Merge remote-tracking branch 'A/master' 2014-09-06 11:32:25 +02:00
Michael Ficarra
b407a59baf Merge pull request #3618 from josh/update-site-example-projects
Refresh site Examples section
2014-08-28 00:40:35 -04:00
Joshua Peek
9dfd71b0e4 Add Atom to Examples 2014-08-27 21:24:42 -07:00
Joshua Peek
872092f6de Remove josh/nack from Examples 2014-08-27 21:21:25 -07:00
Michael Ficarra
8b066f125d Merge pull request #3616 from epmatsw/spelling
Quick spelling fixes
2014-08-26 19:46:34 -07:00
Will Stamper
94c467b520 Quick spelling fixes 2014-08-26 20:41:32 -05:00
Jeremy Ashkenas
53aa50f785 merged 2014-08-26 12:28:39 -04:00
Nami-Doc
e8c96de269 Fix the "Examples" link on coffeescript.org
It now points to the "Trending repositories" of the month.
2014-07-23 22:21:14 +02:00
Nami-Doc
1157b32413 Update link to "CoffeeScript Ristretto", fixes #3489 2014-06-26 17:08:31 +02:00
G. Scott Olson
ba4157b5e2 Retina favicon.ico 2014-06-23 11:11:54 -04:00
Jeremy Ashkenas
6ae21ae461 merged 2014-05-08 15:09:40 -04:00
Andreas Lubbe
f375394381 Merge https://github.com/jashkenas/coffee-script
Conflicts:
	lib/coffee-script/lexer.js
	lib/coffee-script/parser.js
	lib/coffee-script/rewriter.js
	src/lexer.coffee
	src/rewriter.coffee
2014-01-25 19:37:35 -08:00
Andreas Lubbe
1e377ed59b 'yield*' now works as expected 2013-12-27 22:12:04 -08:00
Andreas Lubbe
64e78a2bec updated lexer to allow 'yield*' 2013-12-26 01:16:02 -08:00
Andreas Lubbe
25b1eee293 first attempt at including 'yield*' 2013-12-23 19:32:25 -08:00
Andreas Lubbe
dab4ae9416 '->*' and '=>*' now produce generators 2013-12-19 18:08:25 -08:00
Andreas Lubbe
56b04a58dc first attempt at using '->*" and '=>*' for generators 2013-12-19 14:21:14 -08:00
Andreas Lubbe
e1000205fd Merge github.com:jashkenas/coffee-script 2013-12-05 11:56:34 -08:00
Andreas Lubbe
c02a403f2e fixed misspelling in Cakefile 2013-12-04 21:49:17 -08:00
Andreas Lubbe
f4b850d59c further improved readability of cakefile generator check 2013-12-02 23:33:16 -08:00
Andreas Lubbe
85c7fffd1a improved readability of cakefile generator check 2013-11-30 20:51:53 -08:00
Andreas Lubbe
9d29a830df entire generator test file is now ignored if generators are not available 2013-11-30 12:26:32 -08:00
Andreas Lubbe
74a92db173 improved readability of generator test 2013-11-30 11:45:19 -08:00
Andreas Lubbe
d712a6c0f4 npm run-script test-harmony executes generator tests 2013-11-29 20:59:22 -08:00
Andreas Lubbe
7906a2b6c1 removed yield from the reserved words 2013-11-29 20:58:43 -08:00
Andreas Lubbe
f11ca9888f added a test for generators 2013-11-29 20:58:26 -08:00
Andreas Lubbe
9941050120 using 'yield' automatically turns functions into generators 2013-11-15 22:19:31 +01:00
Andreas Lubbe
dafc7bdea5 added 'yield' to the unary keywords 2013-11-15 22:16:28 +01:00
Andreas Lubbe
f51cbd7117 removed 'yield' from the reserved keywords 2013-11-15 22:15:31 +01:00
248 changed files with 32998 additions and 26969 deletions

0
.nojekyll Normal file
View File

View File

@@ -1,11 +0,0 @@
*.coffee
*.html
.DS_Store
.git*
Cakefile
documentation/
examples/
extras/coffee-script.js
raw/
src/
test/

1
CNAME
View File

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

View File

@@ -6,4 +6,4 @@
* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffeescript/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide).
* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release.
* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release.

242
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,6 +24,9 @@ header = """
*/
"""
# Used in folder names like docs/v1
majorVersion = CoffeeScript.VERSION.split('.')[0]
# Build the CoffeeScript language from source.
build = (cb) ->
files = fs.readdirSync 'src'
@@ -35,63 +38,13 @@ 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
process.exit(1) if status isnt 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>"
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>"
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) ->
@@ -99,9 +52,9 @@ task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options)
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"
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}"
@@ -130,10 +83,11 @@ task 'build:full', 'rebuild the source twice, and run the tests', ->
task 'build:parser', 'rebuild the Jison parser (run build first)', ->
helpers.extend global, require('util')
helpers.extend global, require 'util'
require 'jison'
parser = require('./lib/coffee-script/grammar').parser
fs.writeFile 'lib/coffee-script/parser.js', parser.generate()
fs.writeFileSync 'lib/coffee-script/parser.js', parser.generate()
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
code = ''
@@ -161,37 +115,146 @@ 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} = 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' + compiledCode
console.log "built ... running browser tests:"
invoke 'test:browser'
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'
# Helpers
css = fs.readFileSync('./documentation/css/docs.css', 'utf-8') + '\n' +
fs.readFileSync('./documentation/css/tomorrow.css', 'utf-8')
logo = fs.readFileSync './documentation/images/logo.svg', 'utf-8'
codeFor = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = false, showLoad = true) ->
counter++
return unless fs.existsSync "docs/v#{majorVersion}/examples/#{file}.js"
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = fs.readFileSync "docs/v#{majorVersion}/examples/#{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 keywords
# Added in https://github.com/isagalaev/highlight.js/pull/1357, awaiting release
if file in ['generator_iteration', 'generators', 'modules']
cshtml = cshtml.replace /(yield|import|export|from|as|default) /g, '<span class="keyword">$1</span> '
jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>"
append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '&quot;'
if executable and executable isnt 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.replace /"/g, '&quot;'};#{append}">#{run}</div>""" else ''
"<div class='code'>#{cshtml}#{jshtml}#{script}#{load}#{button}<br class='clear' /></div>"
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>
"""
testHelpers = fs.readFileSync('test/support/helpers.coffee', 'utf-8').replace /exports\./g, '@'
testsInScriptBlocks = ->
output = ''
excludedTestFiles = ['error_messages.coffee']
for filename in fs.readdirSync 'test'
continue if filename in excludedTestFiles
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
examplesSourceFolder = 'documentation/examples'
examplesOutputFolder = "docs/v#{majorVersion}/examples"
fs.mkdirSync examplesOutputFolder unless fs.existsSync examplesOutputFolder
do renderExamples = ->
execSync "bin/coffee -bc -o #{examplesOutputFolder} #{examplesSourceFolder}/*.coffee"
indexFile = 'documentation/index.html'
do renderIndex = ->
codeSnippetCounter = 0
rendered = _.template fs.readFileSync(source, 'utf-8'),
render = _.template fs.readFileSync(indexFile, 'utf-8')
output = render
css: css
logo: logo
codeFor: codeFor()
releaseHeader: releaseHeader
fs.writeFileSync 'index.html', rendered
log "compiled", green, "#{source}"
majorVersion: majorVersion
fullVersion: CoffeeScript.VERSION
fs.writeFileSync "docs/v#{majorVersion}/index.html", output
log 'compiled', green, "#{indexFile} → docs/v#{majorVersion}/index.html"
fs.watchFile source, interval: 200, renderIndex
log "watching..." , green
testFile = 'documentation/test.html'
do renderTest = ->
render = _.template fs.readFileSync(testFile, 'utf-8')
output = render
testHelpers: testHelpers
tests: testsInScriptBlocks()
majorVersion: majorVersion
fs.writeFileSync "docs/v#{majorVersion}/test.html", output
log 'compiled', green, "#{testFile} → docs/v#{majorVersion}/test.html"
fs.watch examplesSourceFolder, interval: 200, ->
renderExamples()
renderIndex()
fs.watch indexFile, interval: 200, renderIndex
fs.watch testFile, interval: 200, renderTest
fs.watch 'test', interval: 200, renderTest
log 'watching...' , green
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
task 'doc:source', 'rebuild the annotated source documentation', ->
exec "node_modules/docco/bin/docco src/*.*coffee --output docs/v#{majorVersion}/annotated-source", (err) -> throw err if err
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
task 'bench', 'quick benchmark of compilation time', ->
{Rewriter} = require './lib/coffee-script/rewriter'
sources = ['coffee-script', 'grammar', 'helpers', 'lexer', 'nodes', 'rewriter']
@@ -241,23 +304,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.
@@ -276,6 +323,7 @@ runTests = (CoffeeScript) ->
# Run every test in the `test` folder, recording failures.
files = fs.readdirSync 'test'
for file in files when helpers.isCoffee file
literate = helpers.isLiterate file
currentFile = filename = path.join 'test', file
@@ -292,7 +340,7 @@ task 'test', 'run the CoffeeScript language test suite', ->
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

View File

@@ -1,4 +1,4 @@
Copyright (c) 2009-2014 Jeremy Ashkenas
Copyright (c) 2009-2015 Jeremy Ashkenas
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

50
README
View File

@@ -1,50 +0,0 @@
{
} } {
{ { } }
} }{ {
{ }{ } } _____ __ __
{ }{ }{ { } / ____| / _|/ _|
.- { { } { }} -. | | ___ | |_| |_ ___ ___
( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \
|`-..________ ..-'| | |___| (_) | | | || __/ __/
| | \_____\___/|_| |_| \___|\___|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|
CoffeeScript is a little language that compiles into JavaScript.
If you have the Node Package Manager installed:
npm install -g coffee-script
(Leave off the -g if you don't wish to install globally.)
Or, if you don't wish to use npm:
sudo bin/cake install
Execute a script:
coffee /path/to/script.coffee
Compile a script:
coffee -c /path/to/script.coffee
For documentation, usage, and examples, see:
http://coffeescript.org/
To suggest a feature, report a bug, or general discussion:
http://github.com/jashkenas/coffeescript/issues/
If you'd like to chat, drop by #coffeescript on Freenode IRC,
or on webchat.freenode.net.
The source repository:
git://github.com/jashkenas/coffeescript.git
Top 100 contributors are listed here:
http://github.com/jashkenas/coffeescript/contributors

View File

@@ -57,4 +57,6 @@ If you'd like to chat, drop by #coffeescript on Freenode IRC.
The source repository: https://github.com/jashkenas/coffeescript.git
Changelog: http://coffeescript.org/#changelog
Our lovely and talented contributors are listed here: http://github.com/jashkenas/coffeescript/contributors

19
bower.json Normal file
View File

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

1
docs/CNAME Normal file
View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

9
docs/browserconfig.xml Normal file
View File

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

BIN
docs/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

BIN
docs/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
docs/index.html Symbolic link
View File

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

17
docs/manifest.json Normal file
View File

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

BIN
docs/mstile-150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

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

After

Width:  |  Height:  |  Size: 2.7 KiB

1
docs/v1/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
examples/

View File

@@ -140,7 +140,7 @@ compile = CoffeeScript.compile</pre></div></div>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.<span class="hljs-function"><span class="hljs-title">eval</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
<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>
@@ -157,8 +157,8 @@ compile = CoffeeScript.compile</pre></div></div>
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.<span class="hljs-function"><span class="hljs-title">run</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.bare = <span class="hljs-literal">on</span>
<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>
@@ -192,12 +192,10 @@ Ported from <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa">h
</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-keyword">and</span> unescape? <span class="hljs-keyword">and</span> encodeURIComponent?
<span class="hljs-function"><span class="hljs-title">compile</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
options.sourceMap = <span class="hljs-literal">true</span>
options.inline = <span class="hljs-literal">true</span>
{js, v3SourceMap} = CoffeeScript.compile code, options
<span class="hljs-string">"<span class="hljs-subst">#{js}</span>\n//# sourceMappingURL=data:application/json;base64,<span class="hljs-subst">#{btoa unescape encodeURIComponent v3SourceMap}</span>\n//# sourceURL=coffeescript"</span></pre></div></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>
@@ -212,7 +210,7 @@ Ported from <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa">h
</div>
<div class="content"><div class='highlight'><pre>CoffeeScript.<span class="hljs-function"><span class="hljs-title">load</span> = <span class="hljs-params">(url, callback, options = {}, hold = <span class="hljs-literal">false</span>)</span> -&gt;</span>
<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>)
@@ -220,7 +218,7 @@ Ported from <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa">h
<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.<span class="hljs-function"><span class="hljs-title">onreadystatechange</span> = -&gt;</span>
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]
@@ -250,8 +248,8 @@ This happens on page load.</p>
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>
<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...
@@ -259,10 +257,11 @@ This happens on page load.</p>
execute()
<span class="hljs-keyword">for</span> script, i <span class="hljs-keyword">in</span> coffees
<span class="hljs-keyword">do</span> <span class="hljs-function"><span class="hljs-params">(script, i)</span> -&gt;</span>
options = <span class="hljs-attribute">literate</span>: script.type <span class="hljs-keyword">is</span> coffeetypes[<span class="hljs-number">1</span>]
<span class="hljs-keyword">if</span> script.src
CoffeeScript.load script.src,
<span class="hljs-keyword">do</span> (script, i) -&gt;
options = literate: script.type <span class="hljs-keyword">is</span> coffeetypes[<span class="hljs-number">1</span>]
source = script.src <span class="hljs-keyword">or</span> script.getAttribute(<span class="hljs-string">'data-src'</span>)
<span class="hljs-keyword">if</span> source
CoffeeScript.load source,
<span class="hljs-function"><span class="hljs-params">(param)</span> -&gt;</span>
coffees[i] = param
execute()

View File

@@ -205,7 +205,7 @@ and the function to run as the action itself.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">task</span>: <span class="hljs-function"><span class="hljs-params">(name, description, action)</span> -&gt;</span>
<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>
@@ -224,7 +224,7 @@ as the first argument to the action.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">option</span>: <span class="hljs-function"><span class="hljs-params">(letter, flag, description)</span> -&gt;</span>
<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>
@@ -240,7 +240,7 @@ as the first argument to the action.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">invoke</span>: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<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>
@@ -260,11 +260,11 @@ original directory name, when running Cake tasks from subdirectories.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">run</span> = -&gt;</span>
<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(), <span class="hljs-attribute">filename</span>: <span class="hljs-string">'Cakefile'</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>
@@ -314,8 +314,8 @@ original directory name, when running Cake tasks from subdirectories.</p>
<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>
<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>

View File

@@ -144,9 +144,9 @@ SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-str
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.VERSION = <span class="hljs-string">'1.8.0'</span>
<div class="content"><div class='highlight'><pre>exports.VERSION = <span class="hljs-string">'1.12.1'</span>
<span class="hljs-built_in">exports</span>.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
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>
@@ -161,7 +161,7 @@ SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-str
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.helpers = helpers</pre></div></div>
<div class="content"><div class='highlight'><pre>exports.helpers = helpers</pre></div></div>
</li>
@@ -172,17 +172,14 @@ SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-str
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Function wrapper to add source file information to SyntaxErrors thrown by the
lexer/parser/compiler.</p>
<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">withPrettyErrors</span> = <span class="hljs-params">(fn)</span> -&gt;</span>
<span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
<span class="hljs-keyword">try</span>
fn.call @, code, options
<span class="hljs-keyword">catch</span> err
<span class="hljs-keyword">throw</span> helpers.updateSyntaxError err, code, options.filename</pre></div></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>
@@ -193,6 +190,49 @@ lexer/parser/compiler.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#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-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#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-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#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>
@@ -203,14 +243,54 @@ lookups.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.compile = compile = withPrettyErrors <span class="hljs-function"><span class="hljs-params">(code, options)</span> -&gt;</span>
<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
<span class="hljs-keyword">if</span> options.sourceMap
<span class="hljs-keyword">if</span> generateSourceMap
map = <span class="hljs-keyword">new</span> SourceMap
fragments = parser.parse(lexer.tokenize code, options).compileToFragments options
tokens = lexer.tokenize code, options</pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#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-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#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
@@ -222,22 +302,36 @@ lookups.</p>
</li>
<li id="section-6">
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
<a class="pilcrow" href="#section-10">&#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> options.sourceMap
<span class="hljs-keyword">if</span> fragment.locationData
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> generateSourceMap</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#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]
{<span class="hljs-attribute">noReplace</span>: <span class="hljs-literal">true</span>})
{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
@@ -248,11 +342,11 @@ lookups.</p>
</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>Copy the code from each fragment into the final JavaScript.</p>
@@ -261,41 +355,51 @@ lookups.</p>
<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">#{<span class="hljs-property">@VERSION</span>}</span>"</span>
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)
<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
answer = {js}
answer.sourceMap = map
answer.v3SourceMap = map.generate(options, code)
answer
{
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-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>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.tokens = withPrettyErrors <span class="hljs-function"><span class="hljs-params">(code, options)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre>exports.tokens = withPrettyErrors (code, options) -&gt;
lexer.tokenize code, options</pre></div></div>
</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>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,
@@ -303,7 +407,7 @@ or traverse it by using <code>.traverseChildren()</code> with a callback.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.nodes = withPrettyErrors <span class="hljs-function"><span class="hljs-params">(source, options)</span> -&gt;</span>
<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>
@@ -312,28 +416,28 @@ or traverse it by using <code>.traverseChildren()</code> with a callback.</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>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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">run</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
mainModule = <span class="hljs-built_in">require</span>.main</pre></div></div>
</li>
<li id="section-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>Set the filename.</p>
@@ -345,11 +449,11 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</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>Clear the module cache.</p>
@@ -360,11 +464,11 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</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>Assign paths for node_modules loading</p>
@@ -379,11 +483,11 @@ setting <code>__filename</code>, <code>__dirname</code>, and relative <code>requ
</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.</p>
@@ -398,26 +502,30 @@ 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>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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">eval</span> = <span class="hljs-params">(code, options = {})</span> -&gt;</span>
<div class="content"><div class='highlight'><pre>exports.eval = <span class="hljs-function"><span class="hljs-params">(code, options = {})</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> code = code.trim()
Script = vm.Script
<span class="hljs-keyword">if</span> Script
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> options.sandbox <span class="hljs-keyword">instanceof</span> Script.createContext().constructor
<span class="hljs-keyword">if</span> isContext options.sandbox
sandbox = options.sandbox
<span class="hljs-keyword">else</span>
sandbox = Script.createContext()
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>
@@ -428,11 +536,11 @@ The CoffeeScript REPL uses this to run the input.</p>
</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>define module/require only if they chose not to specify their own</p>
@@ -441,25 +549,26 @@ The CoffeeScript REPL uses this to run the input.</p>
<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> = <span class="hljs-function"><span class="hljs-title">_require</span> = <span class="hljs-params">(path)</span> -&gt;</span> Module._load path, _module, <span class="hljs-literal">true</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
_require[r] = <span class="hljs-built_in">require</span>[r] <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">isnt</span> <span class="hljs-string">'paths'</span></pre></div></div>
<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-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>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.<span class="hljs-function"><span class="hljs-title">resolve</span> = <span class="hljs-params">(request)</span> -&gt;</span> Module._resolveFilename request, _module
_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>
@@ -469,44 +578,48 @@ The CoffeeScript REPL uses this to run the input.</p>
<span class="hljs-keyword">else</span>
vm.runInContext js, sandbox
<span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">register</span> = -&gt;</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./register'</span></pre></div></div>
exports.register = <span class="hljs-function">-&gt;</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./register'</span></pre></div></div>
</li>
<li id="section-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>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> <span class="hljs-property">@FILE_EXTENSIONS</span>
<span class="hljs-built_in">require</span>.extensions[ext] ?=<span class="hljs-function"> -&gt;</span>
<span class="hljs-keyword">for</span> ext <span class="hljs-keyword">in</span> @FILE_EXTENSIONS <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span> (ext) -&gt;
<span class="hljs-built_in">require</span>.extensions[ext] ?= <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"""
Use CoffeeScript.register() or require the coffee-script/register module to require <span class="hljs-subst">#{ext}</span> files.
"""</span>
<span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">_compileFile</span> = <span class="hljs-params">(filename, sourceMap = <span class="hljs-literal">no</span>)</span> -&gt;</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
<span class="hljs-keyword">try</span>
answer = compile(stripped, {filename, sourceMap, <span class="hljs-attribute">literate</span>: helpers.isLiterate filename})
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-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>As the filename and code of a dynamically loaded file will be different
from the original file compiled with CoffeeScript.run, add that
@@ -521,11 +634,11 @@ information to error so it can be pretty-printed later.</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>Instantiate a Lexer for our use here.</p>
@@ -536,11 +649,11 @@ information to error so it can be pretty-printed later.</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>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
@@ -549,29 +662,30 @@ directly as a “Jison lexer”.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.lexer =
<span class="hljs-attribute">lex</span>:<span class="hljs-function"> -&gt;</span>
token = <span class="hljs-property">@tokens</span>[<span class="hljs-property">@pos</span>++]
lex: <span class="hljs-function">-&gt;</span>
token = parser.tokens[@pos++]
<span class="hljs-keyword">if</span> token
[tag, <span class="hljs-property">@yytext</span>, <span class="hljs-property">@yylloc</span>] = token
<span class="hljs-property">@errorToken</span> = token.origin <span class="hljs-keyword">or</span> token
<span class="hljs-property">@yylineno</span> = <span class="hljs-property">@yylloc</span>.first_line
[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
<span class="hljs-attribute">setInput</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@tokens</span>)</span> -&gt;</span>
<span class="hljs-property">@pos</span> = <span class="hljs-number">0</span>
<span class="hljs-attribute">upcomingInput</span>:<span class="hljs-function"> -&gt;</span>
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">
<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>Make all the AST nodes visible to the parser.</p>
@@ -582,51 +696,54 @@ directly as a “Jison lexer”.</p>
</li>
<li id="section-23">
<li id="section-28">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
<a class="pilcrow" href="#section-28">&#182;</a>
</div>
<p>Override Jisons default error handling function.</p>
</div>
<div class="content"><div class='highlight'><pre>parser.yy.<span class="hljs-function"><span class="hljs-title">parseError</span> = <span class="hljs-params">(message, {token})</span> -&gt;</span></pre></div></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">
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
<a class="pilcrow" href="#section-29">&#182;</a>
</div>
<p>Disregard Jisons message, it contains redundant line numer information.
<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.lexer
<div class="content"><div class='highlight'><pre> {errorToken, tokens} = parser
[errorTag, errorText, errorLoc] = errorToken
errorText = <span class="hljs-keyword">if</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">else</span> <span class="hljs-keyword">if</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">else</span>
helpers.nameWhitespaceCharacter errorText</pre></div></div>
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">
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
<a class="pilcrow" href="#section-30">&#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>
@@ -640,11 +757,11 @@ from the lexer.</p>
</li>
<li id="section-26">
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
<a class="pilcrow" href="#section-31">&#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>
@@ -672,11 +789,11 @@ Modified to handle sourceMap</p>
</li>
<li id="section-27">
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">&#182;</a>
<a class="pilcrow" href="#section-32">&#182;</a>
</div>
<p>Check for a sourceMap position</p>
@@ -698,13 +815,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
@@ -717,11 +834,11 @@ Modified to handle sourceMap</p>
</li>
<li id="section-28">
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">&#182;</a>
<a class="pilcrow" href="#section-33">&#182;</a>
</div>
<p>Map of filenames -&gt; sourceMap object.</p>
@@ -732,11 +849,11 @@ Modified to handle sourceMap</p>
</li>
<li id="section-29">
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">&#182;</a>
<a class="pilcrow" href="#section-34">&#182;</a>
</div>
<p>Generates the source map for a coffee file and stores it in the local cache variable.</p>
@@ -744,18 +861,20 @@ Modified to handle sourceMap</p>
<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">return</span> <span class="hljs-keyword">unless</span> path?.extname(filename) <span class="hljs-keyword">in</span> <span class="hljs-built_in">exports</span>.FILE_EXTENSIONS
answer = <span class="hljs-built_in">exports</span>._compileFile filename, <span class="hljs-literal">true</span>
sourceMaps[filename] = answer.sourceMap</pre></div></div>
<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-30">
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">&#182;</a>
<a class="pilcrow" href="#section-35">&#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
@@ -764,14 +883,14 @@ positions.</p>
</div>
<div class="content"><div class='highlight'><pre>Error.<span class="hljs-function"><span class="hljs-title">prepareStackTrace</span> = <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>
<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> <span class="hljs-built_in">exports</span>.run
<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>

View File

@@ -141,7 +141,6 @@ path = <span class="hljs-built_in">require</span> <span class="hljs-st
helpers = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
optparse = <span class="hljs-built_in">require</span> <span class="hljs-string">'./optparse'</span>
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span>
mkdirp = <span class="hljs-built_in">require</span> <span class="hljs-string">'mkdirp'</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>
@@ -161,11 +160,11 @@ useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs
</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">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>
<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>
@@ -207,11 +206,13 @@ useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs
[<span class="hljs-string">'-i'</span>, <span class="hljs-string">'--interactive'</span>, <span class="hljs-string">'run an interactive CoffeeScript REPL'</span>]
[<span class="hljs-string">'-j'</span>, <span class="hljs-string">'--join [FILE]'</span>, <span class="hljs-string">'concatenate the source CoffeeScript before compiling'</span>]
[<span class="hljs-string">'-m'</span>, <span class="hljs-string">'--map'</span>, <span class="hljs-string">'generate source map and save as .js.map files'</span>]
[<span class="hljs-string">'-M'</span>, <span class="hljs-string">'--inline-map'</span>, <span class="hljs-string">'generate source map and include it directly in output'</span>]
[<span class="hljs-string">'-n'</span>, <span class="hljs-string">'--nodes'</span>, <span class="hljs-string">'print out the parse tree that the parser produces'</span>]
[ <span class="hljs-string">'--nodejs [ARGS]'</span>, <span class="hljs-string">'pass options directly to the "node" binary'</span>]
[ <span class="hljs-string">'--no-header'</span>, <span class="hljs-string">'suppress the "Generated by" header'</span>]
[<span class="hljs-string">'-o'</span>, <span class="hljs-string">'--output [DIR]'</span>, <span class="hljs-string">'set the output directory for compiled JavaScript'</span>]
[<span class="hljs-string">'-p'</span>, <span class="hljs-string">'--print'</span>, <span class="hljs-string">'print out the compiled JavaScript'</span>]
[<span class="hljs-string">'-r'</span>, <span class="hljs-string">'--require [MODULE*]'</span>, <span class="hljs-string">'require the given module before eval or REPL'</span>]
[<span class="hljs-string">'-s'</span>, <span class="hljs-string">'--stdio'</span>, <span class="hljs-string">'listen for and compile scripts over stdio'</span>]
[<span class="hljs-string">'-l'</span>, <span class="hljs-string">'--literate'</span>, <span class="hljs-string">'treat stdio as literate style coffee-script'</span>]
[<span class="hljs-string">'-t'</span>, <span class="hljs-string">'--tokens'</span>, <span class="hljs-string">'print out the tokens that the lexer/rewriter produce'</span>]
@@ -254,7 +255,7 @@ Many flags cause us to divert before compiling anything. Flags passed after
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">run</span> = -&gt;</span>
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-&gt;</span>
parseOptions()</pre></div></div>
</li>
@@ -272,7 +273,9 @@ Many flags cause us to divert before compiling anything. Flags passed after
</div>
<div class="content"><div class='highlight'><pre> replCliOpts = <span class="hljs-attribute">useGlobal</span>: <span class="hljs-literal">yes</span>
<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
@@ -303,7 +306,14 @@ Many flags cause us to divert before compiling anything. Flags passed after
'''</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</pre></div></div>
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>
@@ -357,8 +367,8 @@ extension source files in it and all subdirectories.</p>
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-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>
@@ -395,6 +405,7 @@ requested options. If evaluating the script directly sets <code>__filename</code
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
@@ -415,7 +426,7 @@ requested options. If evaluating the script directly sets <code>__filename</code
<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>
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>
@@ -437,12 +448,12 @@ 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>
code = <span class="hljs-string">''</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>
code += buffer.toString() <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>, code</pre></div></div>
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>
@@ -461,9 +472,9 @@ them together.</p>
<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) -&gt; code <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span>)</span>
<span class="hljs-title">clearTimeout</span> <span class="hljs-title">joinTimeout</span>
<span class="hljs-title">joinTimeout</span> = <span class="hljs-title">wait</span> 100, -&gt;</span>
<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>
@@ -485,8 +496,8 @@ such as <code>--print</code>.</p>
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-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>
@@ -495,10 +506,10 @@ such as <code>--print</code>.</p>
<span class="hljs-keyword">catch</span>
removeSource source, base
compileJoin()
<span class="hljs-function"><span class="hljs-title">compile</span> = -&gt;</span>
<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>
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>
@@ -509,15 +520,15 @@ such as <code>--print</code>.</p>
<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>
<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>
<span class="hljs-function">
<span class="hljs-title">rewatch</span> = -&gt;</span>
watcher?.close()
startWatcher()
@@ -542,15 +553,15 @@ such as <code>--print</code>.</p>
<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>
<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>
.<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>
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
@@ -558,8 +569,8 @@ such as <code>--print</code>.</p>
<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>
<span class="hljs-function">
<span class="hljs-title">stopWatcher</span> = -&gt;</span>
watcher.close()
removeSourceDir source, base
@@ -568,8 +579,8 @@ such as <code>--print</code>.</p>
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-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
@@ -599,8 +610,8 @@ the compiled JS version as well.</p>
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-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
@@ -639,6 +650,32 @@ the compiled JS version as well.</p>
<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>
@@ -650,7 +687,7 @@ same directory as the <code>.js</code> file.</p>
<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-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>
@@ -671,11 +708,11 @@ same directory as the <code>.js</code> file.</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>Convenience for cleaner setTimeouts.</p>
@@ -686,11 +723,11 @@ same directory as the <code>.js</code> file.</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>When watching scripts, its useful to log changes with the timestamp.</p>
@@ -702,11 +739,11 @@ same directory as the <code>.js</code> file.</p>
</li>
<li id="section-20">
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Pretty-print a stream of tokens, sans location data.</p>
@@ -722,11 +759,11 @@ same directory as the <code>.js</code> file.</p>
</li>
<li id="section-21">
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
<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>
@@ -743,11 +780,11 @@ same directory as the <code>.js</code> file.</p>
</li>
<li id="section-22">
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>The compile-time options to pass to the CoffeeScript compiler.</p>
@@ -756,10 +793,11 @@ same directory as the <code>.js</code> file.</p>
<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
<span class="hljs-attribute">literate</span>: opts.literate <span class="hljs-keyword">or</span> helpers.isLiterate(filename)
<span class="hljs-attribute">bare</span>: opts.bare
<span class="hljs-attribute">header</span>: opts.compile <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> opts[<span class="hljs-string">'no-header'</span>]
<span class="hljs-attribute">sourceMap</span>: opts.map
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
@@ -768,25 +806,25 @@ same directory as the <code>.js</code> file.</p>
jsDir = path.dirname jsPath
answer = helpers.merge answer, {
jsPath
<span class="hljs-attribute">sourceRoot</span>: path.relative jsDir, cwd
<span class="hljs-attribute">sourceFiles</span>: [path.relative cwd, filename]
<span class="hljs-attribute">generatedFile</span>: helpers.baseFileName(jsPath, <span class="hljs-literal">no</span>, useWinPathSep)
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,
<span class="hljs-attribute">sourceRoot</span>: <span class="hljs-string">""</span>
<span class="hljs-attribute">sourceFiles</span>: [helpers.baseFileName filename, <span class="hljs-literal">no</span>, useWinPathSep]
<span class="hljs-attribute">generatedFile</span>: helpers.baseFileName(filename, <span class="hljs-literal">yes</span>, useWinPathSep) + <span class="hljs-string">".js"</span>
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-23">
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
<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>
@@ -798,19 +836,19 @@ the <code>node</code> binary, preserving the other options.</p>
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),
<span class="hljs-attribute">cwd</span>: process.cwd()
<span class="hljs-attribute">env</span>: process.env
<span class="hljs-attribute">customFds</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
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-24">
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
<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>
@@ -823,11 +861,11 @@ shown.</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>Print the <code>--version</code> message and exit.</p>

View File

@@ -21,11 +21,11 @@
}
@font-face {
font-family: 'novecento-bold';
src: url('public/fonts/novecento-bold.eot');
src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
url('public/fonts/novecento-bold.woff') format('woff'),
url('public/fonts/novecento-bold.ttf') format('truetype');
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;
}
@@ -67,7 +67,7 @@ h1, h2, h3, h4, h5, h6 {
color: #112233;
line-height: 1em;
font-weight: normal;
font-family: "novecento-bold";
font-family: "roboto-black";
text-transform: uppercase;
margin: 30px 0 15px 0;
}
@@ -75,6 +75,9 @@ h1, h2, h3, h4, h5, h6 {
h1 {
margin-top: 40px;
}
h2 {
font-size: 1.26em;
}
hr {
border: 0;

View File

@@ -134,7 +134,7 @@ arrays, count characters, that sort of thing.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">starts</span> = <span class="hljs-params">(string, literal, start)</span> -&gt;</span>
<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>
@@ -150,7 +150,7 @@ arrays, count characters, that sort of thing.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">ends</span> = <span class="hljs-params">(string, literal, back)</span> -&gt;</span>
<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>
@@ -167,7 +167,7 @@ arrays, count characters, that sort of thing.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.repeat = <span class="hljs-function"><span class="hljs-title">repeat</span> = <span class="hljs-params">(str, n)</span> -&gt;</span></pre></div></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>
@@ -202,7 +202,7 @@ arrays, count characters, that sort of thing.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">compact</span> = <span class="hljs-params">(array)</span> -&gt;</span>
<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>
@@ -218,7 +218,7 @@ arrays, count characters, that sort of thing.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">count</span> = <span class="hljs-params">(string, substr)</span> -&gt;</span>
<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
@@ -239,7 +239,7 @@ options hash to propagate down the tree without polluting other branches.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">merge</span> = <span class="hljs-params">(options, overrides)</span> -&gt;</span>
<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>
@@ -255,7 +255,7 @@ options hash to propagate down the tree without polluting other branches.</p>
</div>
<div class="content"><div class='highlight'><pre>extend = <span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">extend</span> = <span class="hljs-params">(object, properties)</span> -&gt;</span>
<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>
@@ -274,10 +274,10 @@ Handy for getting a list of <code>children</code> from the nodes.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.flatten = <span class="hljs-function"><span class="hljs-title">flatten</span> = <span class="hljs-params">(array)</span> -&gt;</span>
<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> element <span class="hljs-keyword">instanceof</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
@@ -297,7 +297,7 @@ looking for a particular method in an options hash.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">del</span> = <span class="hljs-params">(obj, key)</span> -&gt;</span>
<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>
@@ -311,11 +311,13 @@ looking for a particular method in an options hash.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Gets the last item of an array(-like) object.</p>
<p>Typical Array::some</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.last = <span class="hljs-function"><span class="hljs-title">last</span> = <span class="hljs-params">(array, back)</span> -&gt;</span> array[array.length - (back <span class="hljs-keyword">or</span> <span class="hljs-number">0</span>) - <span class="hljs-number">1</span>]</pre></div></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>
@@ -326,30 +328,13 @@ looking for a particular method in an options hash.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>Typical Array::some</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.some = <span class="hljs-attribute">Array</span>::some ? <span class="hljs-function"><span class="hljs-params">(fn)</span> -&gt;</span>
<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-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>Simple function for inverting Literate CoffeeScript code by putting the
documentation in comments, producing a string of CoffeeScript code that
can be compiled “normally”.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">invertLiterate</span> = <span class="hljs-params">(code)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre>exports.invertLiterate = <span class="hljs-function"><span class="hljs-params">(code)</span> -&gt;</span>
maybe_code = <span class="hljs-literal">true</span>
lines = <span class="hljs-keyword">for</span> line <span class="hljs-keyword">in</span> code.split(<span class="hljs-string">'\n'</span>)
<span class="hljs-keyword">if</span> maybe_code <span class="hljs-keyword">and</span> <span class="hljs-regexp">/^([ ]{4}|[ ]{0,3}\t)/</span>.test line
@@ -363,11 +348,11 @@ can be compiled “normally”.</p>
</li>
<li id="section-15">
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
<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>
@@ -378,10 +363,32 @@ If <code>last</code> is not provided, this will simply return <code>first</code>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> last
first
<span class="hljs-keyword">else</span>
<span class="hljs-attribute">first_line</span>: first.first_line
<span class="hljs-attribute">first_column</span>: first.first_column
<span class="hljs-attribute">last_line</span>: last.last_line
<span class="hljs-attribute">last_column</span>: last.last_column</pre></div></div>
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>
@@ -392,34 +399,12 @@ If <code>last</code> is not provided, this will simply return <code>first</code>
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">addLocationDataFn</span> = <span class="hljs-params">(first, last)</span> -&gt;</span>
<span class="hljs-function"><span class="hljs-params">(obj)</span> -&gt;</span>
<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-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">locationDataToString</span> = <span class="hljs-params">(obj)</span> -&gt;</span>
<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
@@ -432,18 +417,18 @@ The object is returned either way.</p>
</li>
<li id="section-18">
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#182;</a>
<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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">baseFileName</span> = <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>/
<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>
@@ -455,17 +440,32 @@ The object is returned either way.</p>
</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 CoffeeScript file.</p>
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">isCoffee</span> = <span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.((lit)?coffee|coffee\.md)$/</span>.test file</pre></div></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>
@@ -476,11 +476,17 @@ The object is returned either way.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
<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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">isLiterate</span> = <span class="hljs-params">(file)</span> -&gt;</span> <span class="hljs-regexp">/\.(litcoffee|coffee\.md)$/</span>.test file</pre></div></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>
@@ -491,27 +497,6 @@ The object is returned either way.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#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 <filename>:<line>:<col>: <message> plus the line with the error and a
marker showing where the error is.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">throwSyntaxError</span> = <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-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#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>
@@ -525,27 +510,27 @@ compile CoffeeScript for example).</p>
</li>
<li id="section-23">
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
<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><span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">updateSyntaxError</span> = <span class="hljs-params">(error, code, filename)</span> -&gt;</span></pre></div></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-24">
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#182;</a>
<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>
@@ -556,26 +541,26 @@ it already.</p>
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
<span class="hljs-function"><span class="hljs-title">syntaxErrorToString</span> = -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-attribute">Error</span>::toString.call @ <span class="hljs-keyword">unless</span> <span class="hljs-property">@code</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@location</span>
{first_line, first_column, last_line, last_column} = <span class="hljs-property">@location</span>
{first_line, first_column, last_line, last_column} = @location
last_line ?= first_line
last_column ?= first_column
filename = <span class="hljs-property">@filename</span> <span class="hljs-keyword">or</span> <span class="hljs-string">'[stdin]'</span>
codeLine = <span class="hljs-property">@code</span>.split(<span class="hljs-string">'\n'</span>)[first_line]
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-25">
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#182;</a>
<a class="pilcrow" href="#section-24">&#182;</a>
</div>
<p>Show only the first line on multi-line errors.</p>
@@ -587,31 +572,31 @@ it already.</p>
</li>
<li id="section-26">
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
<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
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> <span class="hljs-property">@colorful</span> ? 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>
<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">#{<span class="hljs-property">@message</span>}</span>
<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>
<span class="hljs-built_in">exports</span>.<span class="hljs-function"><span class="hljs-title">nameWhitespaceCharacter</span> = <span class="hljs-params">(string)</span> -&gt;</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>

View File

@@ -119,7 +119,7 @@
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>[key] = val <span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">of</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span></pre></div></div>
<div class="content"><div class='highlight'><pre>exports[key] = val <span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">of</span> <span class="hljs-built_in">require</span> <span class="hljs-string">'./coffee-script'</span></pre></div></div>
</li>

File diff suppressed because it is too large Load Diff

View File

@@ -138,7 +138,7 @@ option) list, and all subsequent arguments are left unparsed.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.OptionParser = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OptionParser</span></span></pre></div></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>
@@ -151,12 +151,12 @@ option) list, and all subsequent arguments are left unparsed.</p>
</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 an optional banner for the usage help.</p>
</code></pre><p>Along with an optional banner for the usage help.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">constructor</span>: <span class="hljs-function"><span class="hljs-params">(rules, <span class="hljs-property">@banner</span>)</span> -&gt;</span>
<span class="hljs-property">@rules</span> = buildRules rules</pre></div></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>
@@ -176,8 +176,8 @@ youre responsible for interpreting the options object.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">parse</span>: <span class="hljs-function"><span class="hljs-params">(args)</span> -&gt;</span>
options = <span class="hljs-attribute">arguments</span>: []
<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
@@ -208,7 +208,7 @@ non-option argument are treated as non-option arguments themselves</p>
<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> <span class="hljs-property">@rules</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
@@ -236,10 +236,10 @@ of the valid options, for <code>--help</code> and such.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">help</span>:<span class="hljs-function"> -&gt;</span>
<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">#{<span class="hljs-property">@banner</span>}</span>\n"</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@banner</span>
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> <span class="hljs-property">@rules</span>
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>
@@ -326,12 +326,12 @@ description of what the option does.</p>
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[<span class="hljs-number">1</span>]
{
<span class="hljs-attribute">name</span>: longFlag.substr <span class="hljs-number">2</span>
<span class="hljs-attribute">shortFlag</span>: shortFlag
<span class="hljs-attribute">longFlag</span>: longFlag
<span class="hljs-attribute">description</span>: description
<span class="hljs-attribute">hasArgument</span>: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">1</span>])
<span class="hljs-attribute">isList</span>: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">2</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>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -137,7 +137,7 @@ path = <span class="hljs-built_in">require</span> <span class="hljs-str
</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">false</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>
@@ -173,8 +173,8 @@ 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>
<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>
@@ -210,12 +210,12 @@ This is a horrible thing that should not be required.</p>
<span class="hljs-keyword">return</span> curExtension <span class="hljs-keyword">if</span> Module._extensions[curExtension]
<span class="hljs-string">'.js'</span>
<span class="hljs-attribute">Module</span>::<span class="hljs-function"><span class="hljs-title">load</span> = <span class="hljs-params">(filename)</span> -&gt;</span>
<span class="hljs-property">@filename</span> = filename
<span class="hljs-property">@paths</span> = Module._nodeModulePaths path.dirname filename
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)
<span class="hljs-property">@loaded</span> = <span class="hljs-literal">true</span></pre></div></div>
@loaded = <span class="hljs-literal">true</span></pre></div></div>
</li>
@@ -234,7 +234,7 @@ to fork both CoffeeScript files, and JavaScript files, directly.</p>
<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.<span class="hljs-function"><span class="hljs-title">fork</span> = <span class="hljs-params">(path, args, options)</span> -&gt;</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> {}

View File

@@ -126,10 +126,10 @@ CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-stri
{merge, updateSyntaxError} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
replDefaults =
<span class="hljs-attribute">prompt</span>: <span class="hljs-string">'coffee&gt; '</span>,
<span class="hljs-attribute">historyFile</span>: path.join process.env.HOME, <span class="hljs-string">'.coffee_history'</span> <span class="hljs-keyword">if</span> process.env.HOME
<span class="hljs-attribute">historyMaxInputSize</span>: <span class="hljs-number">10240</span>
<span class="hljs-attribute">eval</span>: <span class="hljs-function"><span class="hljs-params">(input, context, filename, cb)</span> -&gt;</span></pre></div></div>
prompt: <span class="hljs-string">'coffee&gt; '</span>,
historyFile: path.join process.env.HOME, <span class="hljs-string">'.coffee_history'</span> <span class="hljs-keyword">if</span> process.env.HOME
historyMaxInputSize: <span class="hljs-number">10240</span>
eval: <span class="hljs-function"><span class="hljs-params">(input, context, filename, cb)</span> -&gt;</span></pre></div></div>
</li>
@@ -188,11 +188,11 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Generate the AST of the clean input.</p>
<p>Tokenize the clean input.</p>
</div>
<div class="content"><div class='highlight'><pre> ast = CoffeeScript.nodes input</pre></div></div>
<div class="content"><div class='highlight'><pre> tokens = CoffeeScript.tokens input</pre></div></div>
</li>
@@ -203,20 +203,13 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Add assignment to <code>_</code> variable to force the input to be an expression.</p>
<p>Collect referenced variable names just like in <code>CoffeeScript.compile</code>.</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 <span class="hljs-attribute">bare</span>: <span class="hljs-literal">yes</span>, <span class="hljs-attribute">locals</span>: Object.keys(context)
result = <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
cb <span class="hljs-literal">null</span>, result
<span class="hljs-keyword">catch</span> err</pre></div></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>
@@ -227,15 +220,11 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>ASTs <code>compile</code> does not add source code information to syntax errors.</p>
<p>Generate the AST of the tokens.</p>
</div>
<div class="content"><div class='highlight'><pre> updateSyntaxError err, input
cb err
<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>
<div class="content"><div class='highlight'><pre> ast = CoffeeScript.nodes tokens</pre></div></div>
</li>
@@ -246,17 +235,16 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">&#182;</a>
</div>
<p>Node 0.11.12 changed API, prompt is now _prompt.</p>
<p>Add assignment to <code>_</code> variable to force the input to be an expression.</p>
</div>
<div class="content"><div class='highlight'><pre> origPrompt = repl._prompt ? repl.prompt
multiline =
<span class="hljs-attribute">enabled</span>: <span class="hljs-literal">off</span>
<span class="hljs-attribute">initialPrompt</span>: 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>
<span class="hljs-attribute">prompt</span>: 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>
<span class="hljs-attribute">buffer</span>: <span class="hljs-string">''</span></pre></div></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>
@@ -267,6 +255,52 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">&#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-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#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-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>Proxy nodes line listener</p>
</div>
@@ -286,11 +320,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-10">
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>Handle Ctrl-v</p>
@@ -303,11 +337,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-11">
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
<a class="pilcrow" href="#section-13">&#182;</a>
</div>
<p>allow arbitrarily switching between modes any time before multiple lines are entered</p>
@@ -322,11 +356,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-12">
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
<a class="pilcrow" href="#section-14">&#182;</a>
</div>
<p>no-op unless the current line is empty</p>
@@ -337,11 +371,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-13">
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">&#182;</a>
<a class="pilcrow" href="#section-15">&#182;</a>
</div>
<p>eval, print, loop</p>
@@ -356,11 +390,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-14">
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">&#182;</a>
<a class="pilcrow" href="#section-16">&#182;</a>
</div>
<p>XXX: multiline hack</p>
@@ -378,11 +412,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-15">
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">&#182;</a>
<a class="pilcrow" href="#section-17">&#182;</a>
</div>
<p>Store and load command history from a file</p>
@@ -395,11 +429,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-16">
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">&#182;</a>
<a class="pilcrow" href="#section-18">&#182;</a>
</div>
<p>Get file info and at most maxSize of command history</p>
@@ -411,11 +445,11 @@ parens. Unwrap all that.</p>
</li>
<li id="section-17">
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">&#182;</a>
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>Read last <code>size</code> bytes from the file</p>
@@ -423,37 +457,8 @@ 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</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">&#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-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">&#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>
fs.readSync readFd, buffer, <span class="hljs-number">0</span>, size, stat.size - size
fs.closeSync readFd</pre></div></div>
</li>
@@ -464,18 +469,11 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">&#182;</a>
</div>
<p>Shift off the final blank newline</p>
<p>Set the history on the interpreter</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> lastLine <span class="hljs-keyword">isnt</span> code</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>
@@ -486,14 +484,11 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">&#182;</a>
</div>
<p>Save the latest command in the file</p>
<p>If the history file was truncated we should pop off a potential partial line</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.rli.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>,<span class="hljs-function"> -&gt;</span> fs.close fd</pre></div></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>
@@ -504,17 +499,18 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">&#182;</a>
</div>
<p>Add a command to show the history stack</p>
<p>Shift off the final blank newline</p>
</div>
<div class="content"><div class='highlight'><pre> repl.commands[getCommandId(repl, <span class="hljs-string">'history'</span>)] =
<span class="hljs-attribute">help</span>: <span class="hljs-string">'Show command history'</span>
<span class="hljs-attribute">action</span>:<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()
<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>]
<span class="hljs-function"><span class="hljs-title">getCommandId</span> = <span class="hljs-params">(repl, commandName)</span> -&gt;</span></pre></div></div>
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>
@@ -525,28 +521,14 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">&#182;</a>
</div>
<p>Node 0.11 changed API, a command such as .help is now stored as help</p>
<p>Save the latest command in the file</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
<div class="content"><div class='highlight'><pre> fs.writeSync fd, <span class="hljs-string">"<span class="hljs-subst">#{code}</span>\n"</span>
lastLine = code
<span class="hljs-built_in">module</span>.<span class="hljs-built_in">exports</span> =
<span class="hljs-attribute">start</span>: <span class="hljs-function"><span class="hljs-params">(opts = {})</span> -&gt;</span>
[major, minor, build] = process.versions.node.split<span class="hljs-function"><span class="hljs-params">(<span class="hljs-string">'.'</span>)</span>.<span class="hljs-title">map</span> <span class="hljs-params">(n)</span> -&gt;</span> parseInt(n)
<span class="hljs-keyword">if</span> major <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> minor &lt; <span class="hljs-number">8</span>
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"Node 0.8.0+ required for CoffeeScript REPL"</span>
process.exit <span class="hljs-number">1</span>
CoffeeScript.register()
process.argv = [<span class="hljs-string">'coffee'</span>].concat process.argv[<span class="hljs-number">2.</span>.]
opts = merge replDefaults, opts
repl = nodeREPL.start opts
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>
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize <span class="hljs-keyword">if</span> opts.historyFile</pre></div></div>
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>
@@ -557,6 +539,60 @@ parens. Unwrap all that.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">&#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-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">&#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-keyword">if</span> major <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> minor &lt; <span class="hljs-number">8</span>
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"Node 0.8.0+ required for CoffeeScript REPL"</span>
process.exit <span class="hljs-number">1</span>
CoffeeScript.register()
process.argv = [<span class="hljs-string">'coffee'</span>].concat process.argv[<span class="hljs-number">2.</span>.]
opts = merge replDefaults, opts
repl = nodeREPL.start opts
runInContext opts.prelude, repl.context, <span class="hljs-string">'prelude'</span> <span class="hljs-keyword">if</span> opts.prelude
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-&gt;</span> repl.outputStream.write <span class="hljs-string">'\n'</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> repl.rli.closed
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize <span class="hljs-keyword">if</span> opts.historyFile</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">&#182;</a>
</div>
<p>Adapt help inherited from the node REPL</p>
</div>

View File

@@ -169,7 +169,7 @@ its internal array of tokens.</p>
<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> <span class="hljs-property">@tokens</span>).join <span class="hljs-string">' '</span>
<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>
</div>
@@ -185,20 +185,21 @@ its internal array of tokens.</p>
<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
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> <span class="hljs-attribute">rewrite</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@tokens</span>)</span> -&gt;</span>
<span class="hljs-property">@removeLeadingNewlines</span>()
<span class="hljs-property">@closeOpenCalls</span>()
<span class="hljs-property">@closeOpenIndexes</span>()
<span class="hljs-property">@normalizeLines</span>()
<span class="hljs-property">@tagPostfixConditionals</span>()
<span class="hljs-property">@addImplicitBracesAndParens</span>()
<span class="hljs-property">@addLocationDataToGeneratedTokens</span>()
<span class="hljs-property">@tokens</span></pre></div></div>
<div class="content"><div class='highlight'><pre> rewrite: <span class="hljs-function"><span class="hljs-params">(@tokens)</span> -&gt;</span>
@removeLeadingNewlines()
@closeOpenCalls()
@closeOpenIndexes()
@normalizeLines()
@tagPostfixConditionals()
@addImplicitBracesAndParens()
@addLocationDataToGeneratedTokens()
@fixOutdentLocationData()
@tokens</pre></div></div>
</li>
@@ -217,13 +218,13 @@ our feet.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">scanTokens</span>: <span class="hljs-function"><span class="hljs-params">(block)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> scanTokens: <span class="hljs-function"><span class="hljs-params">(block)</span> -&gt;</span>
{tokens} = <span class="hljs-keyword">this</span>
i = <span class="hljs-number">0</span>
i += block.call <span class="hljs-keyword">this</span>, token, i, tokens <span class="hljs-keyword">while</span> token = tokens[i]
<span class="hljs-literal">true</span>
<span class="hljs-attribute">detectEnd</span>: <span class="hljs-function"><span class="hljs-params">(i, condition, action)</span> -&gt;</span>
detectEnd: <span class="hljs-function"><span class="hljs-params">(i, condition, action)</span> -&gt;</span>
{tokens} = <span class="hljs-keyword">this</span>
levels = <span class="hljs-number">0</span>
<span class="hljs-keyword">while</span> token = tokens[i]
@@ -250,9 +251,9 @@ dispatch them here.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">removeLeadingNewlines</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-keyword">break</span> <span class="hljs-keyword">for</span> [tag], i <span class="hljs-keyword">in</span> <span class="hljs-property">@tokens</span> <span class="hljs-keyword">when</span> tag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span>
<span class="hljs-property">@tokens</span>.splice <span class="hljs-number">0</span>, i <span class="hljs-keyword">if</span> i</pre></div></div>
<div class="content"><div class='highlight'><pre> removeLeadingNewlines: <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">break</span> <span class="hljs-keyword">for</span> [tag], i <span class="hljs-keyword">in</span> @tokens <span class="hljs-keyword">when</span> tag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span>
@tokens.splice <span class="hljs-number">0</span>, i <span class="hljs-keyword">if</span> i</pre></div></div>
</li>
@@ -269,16 +270,16 @@ calls that close on the same line, just before their outdent.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">closeOpenCalls</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-function"><span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> closeOpenCalls: <span class="hljs-function">-&gt;</span>
<span class="hljs-function"> <span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">')'</span>, <span class="hljs-string">'CALL_END'</span>] <span class="hljs-keyword">or</span>
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">')'</span>
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span> <span class="hljs-keyword">and</span> @tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">')'</span>
<span class="hljs-function">
<span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
@tokens[<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</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>] = <span class="hljs-string">'CALL_END'</span>
<span class="hljs-function"><span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-property">@tokens</span>[<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</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>] = <span class="hljs-string">'CALL_END'</span>
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-property">@detectEnd</span> i + <span class="hljs-number">1</span>, condition, action <span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'CALL_START'</span>
@scanTokens (token, i) -&gt;
@detectEnd i + <span class="hljs-number">1</span>, condition, action <span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'CALL_START'</span>
<span class="hljs-number">1</span></pre></div></div>
</li>
@@ -295,15 +296,15 @@ Match it with its paired close.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">closeOpenIndexes</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-function"><span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> closeOpenIndexes: <span class="hljs-function">-&gt;</span>
<span class="hljs-function"> <span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">']'</span>, <span class="hljs-string">'INDEX_END'</span>]
<span class="hljs-function"><span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-function">
<span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
token[<span class="hljs-number">0</span>] = <span class="hljs-string">'INDEX_END'</span>
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-property">@detectEnd</span> i + <span class="hljs-number">1</span>, condition, action <span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'INDEX_START'</span>
@scanTokens (token, i) -&gt;
@detectEnd i + <span class="hljs-number">1</span>, condition, action <span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'INDEX_START'</span>
<span class="hljs-number">1</span></pre></div></div>
</li>
@@ -315,20 +316,20 @@ Match it with its paired close.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">&#182;</a>
</div>
<p>Match tags in token stream starting at i with pattern, skipping HERECOMMENTs
Pattern may consist of strings (equality), an array of strings (one of)
or null (wildcard)</p>
<p>Match tags in token stream starting at <code>i</code> with <code>pattern</code>, skipping HERECOMMENTs.
<code>pattern</code> may consist of strings (equality), an array of strings (one of)
or null (wildcard). Returns the index of the match or -1 if no match.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">matchTags</span>: <span class="hljs-function"><span class="hljs-params">(i, pattern...)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> indexOfTag: <span class="hljs-function"><span class="hljs-params">(i, pattern...)</span> -&gt;</span>
fuzz = <span class="hljs-number">0</span>
<span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span> ... pattern.length]
fuzz += <span class="hljs-number">2</span> <span class="hljs-keyword">while</span> <span class="hljs-property">@tag</span>(i + j + fuzz) <span class="hljs-keyword">is</span> <span class="hljs-string">'HERECOMMENT'</span>
fuzz += <span class="hljs-number">2</span> <span class="hljs-keyword">while</span> @tag(i + j + fuzz) <span class="hljs-keyword">is</span> <span class="hljs-string">'HERECOMMENT'</span>
<span class="hljs-keyword">continue</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> pattern[j]?
pattern[j] = [pattern[j]] <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> pattern[j] <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">no</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i + j + fuzz) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> pattern[j]
<span class="hljs-literal">yes</span></pre></div></div>
<span class="hljs-keyword">return</span> <span class="hljs-number">-1</span> <span class="hljs-keyword">if</span> @tag(i + j + fuzz) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> pattern[j]
i + j + fuzz - <span class="hljs-number">1</span></pre></div></div>
</li>
@@ -339,13 +340,20 @@ or null (wildcard)</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">&#182;</a>
</div>
<p>yes iff standing in front of something looking like
@<x>: or <x>:, skipping over HERECOMMENTs</p>
<p>Returns <code>yes</code> if standing in front of something looking like
<code>@&lt;x&gt;:</code>, <code>&lt;x&gt;:</code> or <code>&lt;EXPRESSION_START&gt;&lt;x&gt;...&lt;EXPRESSION_END&gt;:</code>,
skipping over HERECOMMENTs.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">looksObjectish</span>: <span class="hljs-function"><span class="hljs-params">(j)</span> -&gt;</span>
<span class="hljs-property">@matchTags</span>(j, <span class="hljs-string">'@'</span>, <span class="hljs-literal">null</span>, <span class="hljs-string">':'</span>) <span class="hljs-keyword">or</span> <span class="hljs-property">@matchTags</span>(j, <span class="hljs-literal">null</span>, <span class="hljs-string">':'</span>)</pre></div></div>
<div class="content"><div class='highlight'><pre> looksObjectish: <span class="hljs-function"><span class="hljs-params">(j)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> @indexOfTag(j, <span class="hljs-string">'@'</span>, <span class="hljs-literal">null</span>, <span class="hljs-string">':'</span>) &gt; <span class="hljs-number">-1</span> <span class="hljs-keyword">or</span> @indexOfTag(j, <span class="hljs-literal">null</span>, <span class="hljs-string">':'</span>) &gt; <span class="hljs-number">-1</span>
index = @indexOfTag(j, EXPRESSION_START)
<span class="hljs-keyword">if</span> index &gt; <span class="hljs-number">-1</span>
end = <span class="hljs-literal">null</span>
@detectEnd index + <span class="hljs-number">1</span>, <span class="hljs-function">(<span class="hljs-params">(token)</span> -&gt;</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> EXPRESSION_END), <span class="hljs-function">(<span class="hljs-params">(token, i)</span> -&gt;</span> end = i)
<span class="hljs-keyword">return</span> <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> @tag(end + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">':'</span>
<span class="hljs-literal">no</span></pre></div></div>
</li>
@@ -356,22 +364,22 @@ or null (wildcard)</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">&#182;</a>
</div>
<p>yes iff current line of tokens contain an element of tags on same
<p>Returns <code>yes</code> if current line of tokens contain an element of tags on same
expression level. Stop searching at LINEBREAKS or explicit start of
containing balanced expression.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">findTagsBackwards</span>: <span class="hljs-function"><span class="hljs-params">(i, tags)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> findTagsBackwards: <span class="hljs-function"><span class="hljs-params">(i, tags)</span> -&gt;</span>
backStack = []
<span class="hljs-keyword">while</span> i &gt;= <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> (backStack.length <span class="hljs-keyword">or</span>
<span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> tags <span class="hljs-keyword">and</span>
(<span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> EXPRESSION_START <span class="hljs-keyword">or</span> <span class="hljs-property">@tokens</span>[i].generated) <span class="hljs-keyword">and</span>
<span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> LINEBREAKS)
backStack.push <span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">in</span> EXPRESSION_END
backStack.pop() <span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">in</span> EXPRESSION_START <span class="hljs-keyword">and</span> backStack.length
@tag(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> tags <span class="hljs-keyword">and</span>
(@tag(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> EXPRESSION_START <span class="hljs-keyword">or</span> @tokens[i].generated) <span class="hljs-keyword">and</span>
@tag(i) <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> LINEBREAKS)
backStack.push @tag(i) <span class="hljs-keyword">if</span> @tag(i) <span class="hljs-keyword">in</span> EXPRESSION_END
backStack.pop() <span class="hljs-keyword">if</span> @tag(i) <span class="hljs-keyword">in</span> EXPRESSION_START <span class="hljs-keyword">and</span> backStack.length
i -= <span class="hljs-number">1</span>
<span class="hljs-property">@tag</span>(i) <span class="hljs-keyword">in</span> tags</pre></div></div>
@tag(i) <span class="hljs-keyword">in</span> tags</pre></div></div>
</li>
@@ -387,7 +395,7 @@ add them.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">addImplicitBracesAndParens</span>:<span class="hljs-function"> -&gt;</span></pre></div></div>
<div class="content"><div class='highlight'><pre> addImplicitBracesAndParens: <span class="hljs-function">-&gt;</span></pre></div></div>
</li>
@@ -403,12 +411,13 @@ add them.</p>
</div>
<div class="content"><div class='highlight'><pre> stack = []
start = <span class="hljs-literal">null</span>
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i, tokens)</span> -&gt;</span>
@scanTokens (token, i, tokens) -&gt;
[tag] = token
[prevTag] = prevToken = <span class="hljs-keyword">if</span> i &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> tokens[i - <span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> []
[nextTag] = <span class="hljs-keyword">if</span> i &lt; tokens.length - <span class="hljs-number">1</span> <span class="hljs-keyword">then</span> tokens[i + <span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> []
<span class="hljs-function"><span class="hljs-title">stackTop</span> = -&gt;</span> stack[stack.length - <span class="hljs-number">1</span>]
<span class="hljs-function"> <span class="hljs-title">stackTop</span> = -&gt;</span> stack[stack.length - <span class="hljs-number">1</span>]
startIdx = i</pre></div></div>
</li>
@@ -425,7 +434,7 @@ 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">forward</span> = <span class="hljs-params">(n)</span> -&gt;</span> i - startIdx + n</pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">forward</span> = <span class="hljs-params">(n)</span> -&gt;</span> i - startIdx + n</pre></div></div>
</li>
@@ -440,9 +449,9 @@ 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">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>
</li>
@@ -458,26 +467,28 @@ class declaration or if-conditionals)</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-function"><span class="hljs-title">inImplicitControl</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">'CONTROL'</span>
<span class="hljs-function"><span class="hljs-title">startImplicitCall</span> = <span class="hljs-params">(j)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">inImplicitControl</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">'CONTROL'</span>
<span class="hljs-function">
<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, <span class="hljs-attribute">ours</span>: <span class="hljs-literal">yes</span>]
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>
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>
<span class="hljs-function">
<span class="hljs-title">endImplicitCall</span> = -&gt;</span>
stack.pop()
tokens.splice i, <span class="hljs-number">0</span>, generate <span class="hljs-string">'CALL_END'</span>, <span class="hljs-string">')'</span>
tokens.splice i, <span class="hljs-number">0</span>, generate <span class="hljs-string">'CALL_END'</span>, <span class="hljs-string">')'</span>, [<span class="hljs-string">''</span>, <span class="hljs-string">'end of input'</span>, token[<span class="hljs-number">2</span>]]
i += <span class="hljs-number">1</span>
<span class="hljs-function"><span class="hljs-title">startImplicitObject</span> = <span class="hljs-params">(j, startsLine = <span class="hljs-literal">yes</span>)</span> -&gt;</span>
<span class="hljs-function">
<span class="hljs-title">startImplicitObject</span> = <span class="hljs-params">(j, startsLine = <span class="hljs-literal">yes</span>)</span> -&gt;</span>
idx = j ? i
stack.push [<span class="hljs-string">'{'</span>, idx, <span class="hljs-attribute">sameLine</span>: <span class="hljs-literal">yes</span>, <span class="hljs-attribute">startsLine</span>: startsLine, <span class="hljs-attribute">ours</span>: <span class="hljs-literal">yes</span>]
tokens.splice idx, <span class="hljs-number">0</span>, generate <span class="hljs-string">'{'</span>, generate(<span class="hljs-keyword">new</span> String(<span class="hljs-string">'{'</span>)), token
stack.push [<span class="hljs-string">'{'</span>, idx, sameLine: <span class="hljs-literal">yes</span>, startsLine: startsLine, ours: <span class="hljs-literal">yes</span>]
val = <span class="hljs-keyword">new</span> String <span class="hljs-string">'{'</span>
val.generated = <span class="hljs-literal">yes</span>
tokens.splice idx, <span class="hljs-number">0</span>, generate <span class="hljs-string">'{'</span>, val, token
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">endImplicitObject</span> = <span class="hljs-params">(j)</span> -&gt;</span>
<span class="hljs-function">
<span class="hljs-title">endImplicitObject</span> = <span class="hljs-params">(j)</span> -&gt;</span>
j = j ? i
stack.pop()
tokens.splice j, <span class="hljs-number">0</span>, generate <span class="hljs-string">'}'</span>, <span class="hljs-string">'}'</span>, token
@@ -498,7 +509,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, <span class="hljs-attribute">ours</span>: <span class="hljs-literal">true</span>]
stack.push [<span class="hljs-string">'CONTROL'</span>, i, ours: <span class="hljs-literal">true</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>
@@ -564,7 +575,7 @@ class declaration or if-conditionals)</p>
endImplicitObject()
<span class="hljs-keyword">else</span>
stack.pop()
stack.pop()</pre></div></div>
start = stack.pop()</pre></div></div>
</li>
@@ -580,7 +591,7 @@ f a, f() b, f? c, h[0] d etc.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (tag <span class="hljs-keyword">in</span> IMPLICIT_FUNC <span class="hljs-keyword">and</span> token.spaced <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> token.stringEnd <span class="hljs-keyword">or</span>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (tag <span class="hljs-keyword">in</span> IMPLICIT_FUNC <span class="hljs-keyword">and</span> token.spaced <span class="hljs-keyword">or</span>
tag <span class="hljs-keyword">is</span> <span class="hljs-string">'?'</span> <span class="hljs-keyword">and</span> i &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> tokens[i - <span class="hljs-number">1</span>].spaced) <span class="hljs-keyword">and</span>
(nextTag <span class="hljs-keyword">in</span> IMPLICIT_CALL <span class="hljs-keyword">or</span>
nextTag <span class="hljs-keyword">in</span> IMPLICIT_UNSPACED_CALL <span class="hljs-keyword">and</span>
@@ -600,27 +611,28 @@ f a, f() b, f? c, h[0] d etc.</p>
</div>
<p>Implicit call taking an implicit indented object as first argument.</p>
<pre><code>f
<span class="hljs-attribute">a</span>: b
<span class="hljs-attribute">c</span>: d
a: b
c: d
</code></pre><p>and</p>
<pre><code>f
<span class="hljs-number">1</span>
<span class="hljs-attribute">a</span>: b
<span class="hljs-attribute">b</span>: c
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
<span class="hljs-attribute">a</span>: <span class="hljs-number">1</span>
a: <span class="hljs-number">1</span>
</code></pre><p>as</p>
<pre><code><span class="hljs-keyword">if</span> f(<span class="hljs-attribute">a</span>: <span class="hljs-number">1</span>)
<pre><code><span class="hljs-keyword">if</span> f(a: <span class="hljs-number">1</span>)
</code></pre><p>which is probably always unintended.
Furthermore dont allow this in literal arrays, as
that creates grammatical ambiguities.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> IMPLICIT_FUNC <span class="hljs-keyword">and</span> <span class="hljs-property">@matchTags</span>(i + <span class="hljs-number">1</span>, <span class="hljs-string">'INDENT'</span>, <span class="hljs-literal">null</span>, <span class="hljs-string">':'</span>) <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> <span class="hljs-property">@findTagsBackwards</span>(i, [<span class="hljs-string">'CLASS'</span>, <span class="hljs-string">'EXTENDS'</span>, <span class="hljs-string">'IF'</span>, <span class="hljs-string">'CATCH'</span>,
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> IMPLICIT_FUNC <span class="hljs-keyword">and</span>
@indexOfTag(i + <span class="hljs-number">1</span>, <span class="hljs-string">'INDENT'</span>) &gt; <span class="hljs-number">-1</span> <span class="hljs-keyword">and</span> @looksObjectish(i + <span class="hljs-number">2</span>) <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> @findTagsBackwards(i, [<span class="hljs-string">'CLASS'</span>, <span class="hljs-string">'EXTENDS'</span>, <span class="hljs-string">'IF'</span>, <span class="hljs-string">'CATCH'</span>,
<span class="hljs-string">'SWITCH'</span>, <span class="hljs-string">'LEADING_WHEN'</span>, <span class="hljs-string">'FOR'</span>, <span class="hljs-string">'WHILE'</span>, <span class="hljs-string">'UNTIL'</span>])
startImplicitCall i + <span class="hljs-number">1</span>
stack.push [<span class="hljs-string">'INDENT'</span>, i + <span class="hljs-number">2</span>]
@@ -654,8 +666,11 @@ that creates grammatical ambiguities.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i - <span class="hljs-number">2</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'@'</span> <span class="hljs-keyword">then</span> s = i - <span class="hljs-number">2</span> <span class="hljs-keyword">else</span> s = i - <span class="hljs-number">1</span>
s -= <span class="hljs-number">2</span> <span class="hljs-keyword">while</span> <span class="hljs-property">@tag</span>(s - <span class="hljs-number">2</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'HERECOMMENT'</span></pre></div></div>
<div class="content"><div class='highlight'><pre> s = <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> @tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> EXPRESSION_END <span class="hljs-keyword">then</span> start[<span class="hljs-number">1</span>]
<span class="hljs-keyword">when</span> @tag(i - <span class="hljs-number">2</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'@'</span> <span class="hljs-keyword">then</span> i - <span class="hljs-number">2</span>
<span class="hljs-keyword">else</span> i - <span class="hljs-number">1</span>
s -= <span class="hljs-number">2</span> <span class="hljs-keyword">while</span> @tag(s - <span class="hljs-number">2</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'HERECOMMENT'</span></pre></div></div>
</li>
@@ -670,9 +685,9 @@ that creates grammatical ambiguities.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@insideForDeclaration</span> = nextTag <span class="hljs-keyword">is</span> <span class="hljs-string">'FOR'</span>
<div class="content"><div class='highlight'><pre> @insideForDeclaration = nextTag <span class="hljs-keyword">is</span> <span class="hljs-string">'FOR'</span>
startsLine = s <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">or</span> <span class="hljs-property">@tag</span>(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> LINEBREAKS <span class="hljs-keyword">or</span> tokens[s - <span class="hljs-number">1</span>].newLine</pre></div></div>
startsLine = s <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">or</span> @tag(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> LINEBREAKS <span class="hljs-keyword">or</span> tokens[s - <span class="hljs-number">1</span>].newLine</pre></div></div>
</li>
@@ -689,8 +704,8 @@ that creates grammatical ambiguities.</p>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> stackTop()
[stackTag, stackIdx] = stackTop()
<span class="hljs-keyword">if</span> (stackTag <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span> <span class="hljs-keyword">or</span> stackTag <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(stackIdx - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span>) <span class="hljs-keyword">and</span>
(startsLine <span class="hljs-keyword">or</span> <span class="hljs-property">@tag</span>(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">','</span> <span class="hljs-keyword">or</span> <span class="hljs-property">@tag</span>(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span>)
<span class="hljs-keyword">if</span> (stackTag <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span> <span class="hljs-keyword">or</span> stackTag <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span> @tag(stackIdx - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span>) <span class="hljs-keyword">and</span>
(startsLine <span class="hljs-keyword">or</span> @tag(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">','</span> <span class="hljs-keyword">or</span> @tag(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span>)
<span class="hljs-keyword">return</span> forward(<span class="hljs-number">1</span>)
startImplicitObject(s, !!startsLine)
@@ -707,9 +722,9 @@ that creates grammatical ambiguities.</p>
</div>
<p>End implicit calls when chaining method calls
like e.g.:</p>
<pre><code>f<span class="hljs-function"> -&gt;</span>
<pre><code>f -&gt;
a
.g b,<span class="hljs-function"> -&gt;</span>
.g b, <span class="hljs-function">-&gt;</span>
c
.h a
</code></pre><p>and also</p>
@@ -757,8 +772,8 @@ return a: 1, b: 2 unless true</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> inImplicitObject() <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-property">@insideForDeclaration</span> <span class="hljs-keyword">and</span> sameLine <span class="hljs-keyword">and</span>
tag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">and</span> prevTag <span class="hljs-keyword">isnt</span> <span class="hljs-string">':'</span> <span class="hljs-keyword">and</span>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> inImplicitObject() <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> @insideForDeclaration <span class="hljs-keyword">and</span> sameLine <span class="hljs-keyword">and</span>
tag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">and</span> prevTag <span class="hljs-keyword">isnt</span> <span class="hljs-string">':'</span>
endImplicitObject()</pre></div></div>
</li>
@@ -777,7 +792,8 @@ the continuation of an object.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> inImplicitObject() <span class="hljs-keyword">and</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">and</span> prevTag <span class="hljs-keyword">isnt</span> <span class="hljs-string">','</span> <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> (startsLine <span class="hljs-keyword">and</span> <span class="hljs-property">@looksObjectish</span>(i + <span class="hljs-number">1</span>))
<span class="hljs-keyword">not</span> (startsLine <span class="hljs-keyword">and</span> @looksObjectish(i + <span class="hljs-number">1</span>))
<span class="hljs-keyword">return</span> forward <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> nextTag <span class="hljs-keyword">is</span> <span class="hljs-string">'HERECOMMENT'</span>
endImplicitObject()
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">break</span></pre></div></div>
@@ -795,17 +811,17 @@ the continuation of an object.</p>
and what comes after doesnt look like it belongs.
This is used for trailing commas and calls, like:</p>
<pre><code>x =
<span class="hljs-attribute">a</span>: b,
<span class="hljs-attribute">c</span>: d,
a: b,
c: d,
e = <span class="hljs-number">2</span>
</code></pre><p>and</p>
<pre><code>f a, <span class="hljs-attribute">b</span>: c, <span class="hljs-attribute">d</span>: e, f, <span class="hljs-attribute">g</span>: <span class="hljs-attribute">h</span>: i, j
<pre><code>f a, b: c, d: e, f, g: h: i, j
</code></pre>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">','</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-property">@looksObjectish</span>(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">and</span> inImplicitObject() <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> <span class="hljs-property">@insideForDeclaration</span> <span class="hljs-keyword">and</span>
(nextTag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> <span class="hljs-property">@looksObjectish</span>(i + <span class="hljs-number">2</span>))</pre></div></div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">','</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> @looksObjectish(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">and</span> inImplicitObject() <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> @insideForDeclaration <span class="hljs-keyword">and</span>
(nextTag <span class="hljs-keyword">isnt</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> @looksObjectish(i + <span class="hljs-number">2</span>))</pre></div></div>
</li>
@@ -842,21 +858,21 @@ array further up the stack, so give it a chance.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">addLocationDataToGeneratedTokens</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i, tokens)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> addLocationDataToGeneratedTokens: <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">if</span> token[<span class="hljs-number">2</span>]
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span> <span class="hljs-keyword">unless</span> token.generated <span class="hljs-keyword">or</span> token.explicit
<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'{'</span> <span class="hljs-keyword">and</span> nextLocation=tokens[i + <span class="hljs-number">1</span>]?[<span class="hljs-number">2</span>]
{<span class="hljs-attribute">first_line</span>: line, <span class="hljs-attribute">first_column</span>: column} = nextLocation
{first_line: line, first_column: column} = nextLocation
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> prevLocation = tokens[i - <span class="hljs-number">1</span>]?[<span class="hljs-number">2</span>]
{<span class="hljs-attribute">last_line</span>: line, <span class="hljs-attribute">last_column</span>: column} = prevLocation
{last_line: line, last_column: column} = prevLocation
<span class="hljs-keyword">else</span>
line = column = <span class="hljs-number">0</span>
token[<span class="hljs-number">2</span>] =
<span class="hljs-attribute">first_line</span>: line
<span class="hljs-attribute">first_column</span>: column
<span class="hljs-attribute">last_line</span>: line
<span class="hljs-attribute">last_column</span>: column
first_line: line
first_column: column
last_line: line
last_column: column
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span></pre></div></div>
</li>
@@ -868,49 +884,23 @@ array further up the stack, so give it a chance.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-35">&#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
blocks, so it doesnt need to. To keep the grammar clean and tidy, trailing
newlines within expressions are removed and the indentation tokens of empty
blocks are added.</p>
<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> <span class="hljs-attribute">normalizeLines</span>:<span class="hljs-function"> -&gt;</span>
starter = indent = outdent = <span class="hljs-literal">null</span>
<span class="hljs-function"><span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">isnt</span> <span class="hljs-string">';'</span> <span class="hljs-keyword">and</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> SINGLE_CLOSERS <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">'TERMINATOR'</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(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> <span class="hljs-property">@tokens</span>[i - <span class="hljs-number">1</span>].newLine
<span class="hljs-function"><span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-property">@tokens</span>.splice (<span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(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
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i, tokens)</span> -&gt;</span>
[tag] = token
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'ELSE'</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">isnt</span> <span class="hljs-string">'OUTDENT'</span>
tokens.splice i, <span class="hljs-number">1</span>, <span class="hljs-property">@indentation</span>()...
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@tag</span>(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> EXPRESSION_CLOSE
tokens.splice i, <span class="hljs-number">1</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'CATCH'</span>
<span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> [<span class="hljs-number">1.</span><span class="hljs-number">.2</span>] <span class="hljs-keyword">when</span> <span class="hljs-property">@tag</span>(i + j) <span class="hljs-keyword">in</span> [<span class="hljs-string">'OUTDENT'</span>, <span class="hljs-string">'TERMINATOR'</span>, <span class="hljs-string">'FINALLY'</span>]
tokens.splice i + j, <span class="hljs-number">0</span>, <span class="hljs-property">@indentation</span>()...
<span class="hljs-keyword">return</span> <span class="hljs-number">2</span> + j
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> SINGLE_LINERS <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">isnt</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> (tag <span class="hljs-keyword">is</span> <span class="hljs-string">'ELSE'</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@tag</span>(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'IF'</span>)
starter = tag
[indent, outdent] = <span class="hljs-property">@indentation</span> tokens[i]
indent.fromThen = <span class="hljs-literal">true</span> <span class="hljs-keyword">if</span> starter <span class="hljs-keyword">is</span> <span class="hljs-string">'THEN'</span>
tokens.splice i + <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, indent
<span class="hljs-property">@detectEnd</span> i + <span class="hljs-number">2</span>, condition, action
tokens.splice i, <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'THEN'</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>
<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>
@@ -922,28 +912,49 @@ blocks are added.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-36">&#182;</a>
</div>
<p>Tag postfix conditionals as such, so that we can parse them with a
different precedence.</p>
<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
blocks, so it doesnt need to. To keep the grammar clean and tidy, trailing
newlines within expressions are removed and the indentation tokens of empty
blocks are added.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">tagPostfixConditionals</span>:<span class="hljs-function"> -&gt;</span>
<div class="content"><div class='highlight'><pre> normalizeLines: <span class="hljs-function">-&gt;</span>
starter = indent = outdent = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">isnt</span> <span class="hljs-string">';'</span> <span class="hljs-keyword">and</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> SINGLE_CLOSERS <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">'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
<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
original = <span class="hljs-literal">null</span>
<span class="hljs-function"><span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
@scanTokens (token, i, tokens) -&gt;
[tag] = token
[prevTag] = <span class="hljs-property">@tokens</span>[i - <span class="hljs-number">1</span>]
tag <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">or</span> (tag <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span> prevTag <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> SINGLE_LINERS)
<span class="hljs-function"><span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">isnt</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">or</span> (token.generated <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> token.fromThen)
original[<span class="hljs-number">0</span>] = <span class="hljs-string">'POST_'</span> + original[<span class="hljs-number">0</span>]
<span class="hljs-property">@scanTokens</span> <span class="hljs-function"><span class="hljs-params">(token, i)</span> -&gt;</span>
<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">'IF'</span>
original = token
<span class="hljs-property">@detectEnd</span> i + <span class="hljs-number">1</span>, condition, action
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span>
<span class="hljs-keyword">if</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'ELSE'</span> <span class="hljs-keyword">and</span> @tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">isnt</span> <span class="hljs-string">'OUTDENT'</span>
tokens.splice i, <span class="hljs-number">1</span>, @indentation()...
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>
<span class="hljs-keyword">if</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> EXPRESSION_CLOSE
tokens.splice i, <span class="hljs-number">1</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'CATCH'</span>
<span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> [<span class="hljs-number">1.</span><span class="hljs-number">.2</span>] <span class="hljs-keyword">when</span> @tag(i + j) <span class="hljs-keyword">in</span> [<span class="hljs-string">'OUTDENT'</span>, <span class="hljs-string">'TERMINATOR'</span>, <span class="hljs-string">'FINALLY'</span>]
tokens.splice i + j, <span class="hljs-number">0</span>, @indentation()...
<span class="hljs-keyword">return</span> <span class="hljs-number">2</span> + j
<span class="hljs-keyword">if</span> tag <span class="hljs-keyword">in</span> SINGLE_LINERS <span class="hljs-keyword">and</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">isnt</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span>
<span class="hljs-keyword">not</span> (tag <span class="hljs-keyword">is</span> <span class="hljs-string">'ELSE'</span> <span class="hljs-keyword">and</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'IF'</span>)
starter = tag
[indent, outdent] = @indentation tokens[i]
indent.fromThen = <span class="hljs-literal">true</span> <span class="hljs-keyword">if</span> starter <span class="hljs-keyword">is</span> <span class="hljs-string">'THEN'</span>
tokens.splice i + <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, indent
@detectEnd i + <span class="hljs-number">2</span>, condition, action
tokens.splice i, <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'THEN'</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span></pre></div></div>
</li>
@@ -955,21 +966,29 @@ different precedence.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">&#182;</a>
</div>
<p>Generate the indentation tokens, based on another token on the same line.</p>
<p>Tag postfix conditionals as such, so that we can parse them with a
different precedence.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">indentation</span>: <span class="hljs-function"><span class="hljs-params">(origin)</span> -&gt;</span>
indent = [<span class="hljs-string">'INDENT'</span>, <span class="hljs-number">2</span>]
outdent = [<span class="hljs-string">'OUTDENT'</span>, <span class="hljs-number">2</span>]
<span class="hljs-keyword">if</span> origin
indent.generated = outdent.generated = <span class="hljs-literal">yes</span>
indent.origin = outdent.origin = origin
<span class="hljs-keyword">else</span>
indent.explicit = outdent.explicit = <span class="hljs-literal">yes</span>
[indent, outdent]
<div class="content"><div class='highlight'><pre> tagPostfixConditionals: <span class="hljs-function">-&gt;</span>
<span class="hljs-attribute">generate</span>: generate</pre></div></div>
original = <span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
[tag] = token
[prevTag] = @tokens[i - <span class="hljs-number">1</span>]
tag <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">or</span> (tag <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">and</span> prevTag <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> SINGLE_LINERS)
<span class="hljs-function">
<span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -&gt;</span>
<span class="hljs-keyword">if</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">isnt</span> <span class="hljs-string">'INDENT'</span> <span class="hljs-keyword">or</span> (token.generated <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> token.fromThen)
original[<span class="hljs-number">0</span>] = <span class="hljs-string">'POST_'</span> + original[<span class="hljs-number">0</span>]
@scanTokens (token, i) -&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">'IF'</span>
original = token
@detectEnd i + <span class="hljs-number">1</span>, condition, action
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span></pre></div></div>
</li>
@@ -980,11 +999,21 @@ different precedence.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-38">&#182;</a>
</div>
<p>Look up a tag by token index.</p>
<p>Generate the indentation tokens, based on another token on the same line.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">tag</span>: <span class="hljs-function"><span class="hljs-params">(i)</span> -&gt;</span> <span class="hljs-property">@tokens</span>[i]?[<span class="hljs-number">0</span>]</pre></div></div>
<div class="content"><div class='highlight'><pre> indentation: <span class="hljs-function"><span class="hljs-params">(origin)</span> -&gt;</span>
indent = [<span class="hljs-string">'INDENT'</span>, <span class="hljs-number">2</span>]
outdent = [<span class="hljs-string">'OUTDENT'</span>, <span class="hljs-number">2</span>]
<span class="hljs-keyword">if</span> origin
indent.generated = outdent.generated = <span class="hljs-literal">yes</span>
indent.origin = outdent.origin = origin
<span class="hljs-keyword">else</span>
indent.explicit = outdent.explicit = <span class="hljs-literal">yes</span>
[indent, outdent]
generate: generate</pre></div></div>
</li>
@@ -995,10 +1024,12 @@ different precedence.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-39">&#182;</a>
</div>
<h2 id="constants">Constants</h2>
<p>Look up a tag by token index.</p>
</div>
<div class="content"><div class='highlight'><pre> tag: <span class="hljs-function"><span class="hljs-params">(i)</span> -&gt;</span> @tokens[i]?[<span class="hljs-number">0</span>]</pre></div></div>
</li>
@@ -1008,7 +1039,8 @@ different precedence.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-40">&#182;</a>
</div>
<h2 id="constants">Constants</h2>
</div>
</li>
@@ -1020,6 +1052,18 @@ different precedence.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-41">&#182;</a>
</div>
</div>
</li>
<li id="section-42">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-42">&#182;</a>
</div>
<p>List of the token pairs that must be balanced.</p>
</div>
@@ -1032,33 +1076,35 @@ different precedence.</p>
[<span class="hljs-string">'CALL_START'</span>, <span class="hljs-string">'CALL_END'</span>]
[<span class="hljs-string">'PARAM_START'</span>, <span class="hljs-string">'PARAM_END'</span>]
[<span class="hljs-string">'INDEX_START'</span>, <span class="hljs-string">'INDEX_END'</span>]
[<span class="hljs-string">'STRING_START'</span>, <span class="hljs-string">'STRING_END'</span>]
[<span class="hljs-string">'REGEX_START'</span>, <span class="hljs-string">'REGEX_END'</span>]
]</pre></div></div>
</li>
<li id="section-42">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-42">&#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>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.INVERSES = INVERSES = {}</pre></div></div>
</li>
<li id="section-43">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-43">&#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>
</div>
<div class="content"><div class='highlight'><pre>exports.INVERSES = INVERSES = {}</pre></div></div>
</li>
<li id="section-44">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-44">&#182;</a>
</div>
<p>The tokens that signal the start/end of a balanced pair.</p>
</div>
@@ -1073,11 +1119,11 @@ EXPRESSION_END = []
</li>
<li id="section-44">
<li id="section-45">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-44">&#182;</a>
<a class="pilcrow" href="#section-45">&#182;</a>
</div>
<p>Tokens that indicate the close of a clause of an expression.</p>
@@ -1088,38 +1134,17 @@ EXPRESSION_END = []
</li>
<li id="section-45">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-45">&#182;</a>
</div>
<p>Tokens that, if followed by an <code>IMPLICIT_CALL</code>, indicate a function invocation.</p>
</div>
<div class="content"><div class='highlight'><pre>IMPLICIT_FUNC = [<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'SUPER'</span>, <span class="hljs-string">')'</span>, <span class="hljs-string">'CALL_END'</span>, <span class="hljs-string">']'</span>, <span class="hljs-string">'INDEX_END'</span>, <span class="hljs-string">'@'</span>, <span class="hljs-string">'THIS'</span>]</pre></div></div>
</li>
<li id="section-46">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-46">&#182;</a>
</div>
<p>If preceded by an <code>IMPLICIT_FUNC</code>, indicates a function invocation.</p>
<p>Tokens that, if followed by an <code>IMPLICIT_CALL</code>, indicate a function invocation.</p>
</div>
<div class="content"><div class='highlight'><pre>IMPLICIT_CALL = [
<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'NUMBER'</span>, <span class="hljs-string">'STRING'</span>, <span class="hljs-string">'JS'</span>, <span class="hljs-string">'REGEX'</span>, <span class="hljs-string">'NEW'</span>, <span class="hljs-string">'PARAM_START'</span>, <span class="hljs-string">'CLASS'</span>
<span class="hljs-string">'IF'</span>, <span class="hljs-string">'TRY'</span>, <span class="hljs-string">'SWITCH'</span>, <span class="hljs-string">'THIS'</span>, <span class="hljs-string">'BOOL'</span>, <span class="hljs-string">'NULL'</span>, <span class="hljs-string">'UNDEFINED'</span>, <span class="hljs-string">'UNARY'</span>,
<span class="hljs-string">'UNARY_MATH'</span>, <span class="hljs-string">'SUPER'</span>, <span class="hljs-string">'THROW'</span>, <span class="hljs-string">'@'</span>, <span class="hljs-string">'-&gt;'</span>, <span class="hljs-string">'=&gt;'</span>, <span class="hljs-string">'['</span>, <span class="hljs-string">'('</span>, <span class="hljs-string">'{'</span>, <span class="hljs-string">'--'</span>, <span class="hljs-string">'++'</span>
]
IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hljs-string">'-'</span>]</pre></div></div>
<div class="content"><div class='highlight'><pre>IMPLICIT_FUNC = [<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'PROPERTY'</span>, <span class="hljs-string">'SUPER'</span>, <span class="hljs-string">')'</span>, <span class="hljs-string">'CALL_END'</span>, <span class="hljs-string">']'</span>, <span class="hljs-string">'INDEX_END'</span>, <span class="hljs-string">'@'</span>, <span class="hljs-string">'THIS'</span>]</pre></div></div>
</li>
@@ -1130,6 +1155,30 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
<div class="pilwrap ">
<a class="pilcrow" href="#section-47">&#182;</a>
</div>
<p>If preceded by an <code>IMPLICIT_FUNC</code>, indicates a function invocation.</p>
</div>
<div class="content"><div class='highlight'><pre>IMPLICIT_CALL = [
<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'PROPERTY'</span>, <span class="hljs-string">'NUMBER'</span>, <span class="hljs-string">'INFINITY'</span>, <span class="hljs-string">'NAN'</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>, <span class="hljs-string">'JS'</span>
<span class="hljs-string">'NEW'</span>, <span class="hljs-string">'PARAM_START'</span>, <span class="hljs-string">'CLASS'</span>, <span class="hljs-string">'IF'</span>, <span class="hljs-string">'TRY'</span>, <span class="hljs-string">'SWITCH'</span>, <span class="hljs-string">'THIS'</span>
<span class="hljs-string">'UNDEFINED'</span>, <span class="hljs-string">'NULL'</span>, <span class="hljs-string">'BOOL'</span>
<span class="hljs-string">'UNARY'</span>, <span class="hljs-string">'YIELD'</span>, <span class="hljs-string">'UNARY_MATH'</span>, <span class="hljs-string">'SUPER'</span>, <span class="hljs-string">'THROW'</span>
<span class="hljs-string">'@'</span>, <span class="hljs-string">'-&gt;'</span>, <span class="hljs-string">'=&gt;'</span>, <span class="hljs-string">'['</span>, <span class="hljs-string">'('</span>, <span class="hljs-string">'{'</span>, <span class="hljs-string">'--'</span>, <span class="hljs-string">'++'</span>
]
IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hljs-string">'-'</span>]</pre></div></div>
</li>
<li id="section-48">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-48">&#182;</a>
</div>
<p>Tokens that always mark the end of an implicit call for single-liners.</p>
</div>
@@ -1140,11 +1189,11 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
</li>
<li id="section-48">
<li id="section-49">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-48">&#182;</a>
<a class="pilcrow" href="#section-49">&#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>
@@ -1157,11 +1206,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
</li>
<li id="section-49">
<li id="section-50">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-49">&#182;</a>
<a class="pilcrow" href="#section-50">&#182;</a>
</div>
<p>Tokens that end a line.</p>
@@ -1172,11 +1221,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
</li>
<li id="section-50">
<li id="section-51">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-50">&#182;</a>
<a class="pilcrow" href="#section-51">&#182;</a>
</div>
<p>Tokens that close open calls when they follow a newline.</p>

View File

@@ -121,13 +121,10 @@ 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>
<p>Import the helpers we plan to use.</p>
</div>
<div class="content"><div class='highlight'><pre>{extend, last} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
<span class="hljs-built_in">exports</span>.Scope = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Scope</span></span></pre></div></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>
@@ -138,11 +135,18 @@ with external scopes.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>The <code>root</code> is the top-level <strong>Scope</strong> object for a given file.</p>
<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> <span class="hljs-property">@root</span>: <span class="hljs-literal">null</span></pre></div></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>
@@ -153,17 +157,11 @@ with external scopes.</p>
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#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, and a reference to the function that
it belongs to.</p>
<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> <span class="hljs-attribute">constructor</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@parent</span>, <span class="hljs-property">@expressions</span>, <span class="hljs-property">@method</span>)</span> -&gt;</span>
<span class="hljs-property">@variables</span> = [{<span class="hljs-attribute">name</span>: <span class="hljs-string">'arguments'</span>, <span class="hljs-attribute">type</span>: <span class="hljs-string">'arguments'</span>}]
<span class="hljs-property">@positions</span> = {}
Scope.root = <span class="hljs-keyword">this</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@parent</span></pre></div></div>
<div class="content"><div class='highlight'><pre> @root = @parent?.root ? <span class="hljs-keyword">this</span></pre></div></div>
</li>
@@ -178,12 +176,12 @@ it belongs to.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">add</span>: <span class="hljs-function"><span class="hljs-params">(name, type, immediate)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-property">@parent</span>.add name, type, immediate <span class="hljs-keyword">if</span> <span class="hljs-property">@shared</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> immediate
<span class="hljs-keyword">if</span> <span class="hljs-attribute">Object</span>::hasOwnProperty.call <span class="hljs-property">@positions</span>, name
<span class="hljs-property">@variables</span>[<span class="hljs-property">@positions</span>[name]].type = type
<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>
<span class="hljs-property">@positions</span>[name] = <span class="hljs-property">@variables</span>.push({name, type}) - <span class="hljs-number">1</span></pre></div></div>
@positions[name] = @variables.push({name, type}) - <span class="hljs-number">1</span></pre></div></div>
</li>
@@ -202,9 +200,9 @@ function object that has a name filled in, or bottoms out.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">namedMethod</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-property">@method</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@method</span>?.name <span class="hljs-keyword">or</span> !<span class="hljs-property">@parent</span>
<span class="hljs-property">@parent</span>.namedMethod()</pre></div></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>
@@ -220,9 +218,9 @@ already exist.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">find</span>: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@check</span> name
<span class="hljs-property">@add</span> name, <span class="hljs-string">'var'</span>
<div class="content"><div class='highlight'><pre> find: <span class="hljs-function"><span class="hljs-params">(name)</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>
<span class="hljs-literal">no</span></pre></div></div>
</li>
@@ -239,9 +237,9 @@ scope. No <code>var</code> required for internal references.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">parameter</span>: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@shared</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@parent</span>.check name, <span class="hljs-literal">yes</span>
<span class="hljs-property">@add</span> name, <span class="hljs-string">'param'</span></pre></div></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>
@@ -257,8 +255,8 @@ walks up to the root scope.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">check</span>: <span class="hljs-function"><span class="hljs-params">(name)</span> -&gt;</span>
!!(<span class="hljs-property">@type</span>(name) <span class="hljs-keyword">or</span> <span class="hljs-property">@parent</span>?.check(name))</pre></div></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>
@@ -273,11 +271,17 @@ walks up to the root scope.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">temporary</span>: <span class="hljs-function"><span class="hljs-params">(name, index)</span> -&gt;</span>
<span class="hljs-keyword">if</span> name.length &gt; <span class="hljs-number">1</span>
<span class="hljs-string">'_'</span> + name + <span class="hljs-keyword">if</span> index &gt; <span class="hljs-number">1</span> <span class="hljs-keyword">then</span> index - <span class="hljs-number">1</span> <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
<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> + (index + parseInt name, <span class="hljs-number">36</span>).toString(<span class="hljs-number">36</span>).replace <span class="hljs-regexp">/\d/g</span>, <span class="hljs-string">'a'</span></pre></div></div>
<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>
@@ -292,8 +296,8 @@ walks up to the root scope.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">type</span>: <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> <span class="hljs-property">@variables</span> <span class="hljs-keyword">when</span> v.name <span class="hljs-keyword">is</span> name
<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>
@@ -310,10 +314,13 @@ compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">freeVariable</span>: <span class="hljs-function"><span class="hljs-params">(name, reserve=<span class="hljs-literal">true</span>)</span> -&gt;</span>
<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>
index++ <span class="hljs-keyword">while</span> <span class="hljs-property">@check</span>((temp = <span class="hljs-property">@temporary</span> name, index))
<span class="hljs-property">@add</span> temp, <span class="hljs-string">'var'</span>, <span class="hljs-literal">yes</span> <span class="hljs-keyword">if</span> reserve
<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>
@@ -330,9 +337,9 @@ compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">assign</span>: <span class="hljs-function"><span class="hljs-params">(name, value)</span> -&gt;</span>
<span class="hljs-property">@add</span> name, {value, <span class="hljs-attribute">assigned</span>: <span class="hljs-literal">yes</span>}, <span class="hljs-literal">yes</span>
<span class="hljs-property">@hasAssignments</span> = <span class="hljs-literal">yes</span></pre></div></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>
@@ -347,8 +354,8 @@ compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">hasDeclarations</span>:<span class="hljs-function"> -&gt;</span>
!!<span class="hljs-property">@declaredVariables</span>().length</pre></div></div>
<div class="content"><div class='highlight'><pre> hasDeclarations: <span class="hljs-function">-&gt;</span>
!!@declaredVariables().length</pre></div></div>
</li>
@@ -363,12 +370,8 @@ compiler-generated variable. <code>_var</code>, <code>_var2</code>, and so on…
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">declaredVariables</span>:<span class="hljs-function"> -&gt;</span>
realVars = []
tempVars = []
<span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> <span class="hljs-property">@variables</span> <span class="hljs-keyword">when</span> v.type <span class="hljs-keyword">is</span> <span class="hljs-string">'var'</span>
(<span class="hljs-keyword">if</span> v.name.charAt(<span class="hljs-number">0</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'_'</span> <span class="hljs-keyword">then</span> tempVars <span class="hljs-keyword">else</span> realVars).push v.name
realVars.sort().concat tempVars.sort()</pre></div></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>
@@ -384,8 +387,8 @@ of this scope.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">assignedVariables</span>:<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> <span class="hljs-property">@variables</span> <span class="hljs-keyword">when</span> v.type.assigned</pre></div></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>

View File

@@ -144,15 +144,15 @@ positions for a single line of output JavaScript code.
</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>
<span class="hljs-attribute">constructor</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@line</span>)</span> -&gt;</span>
<span class="hljs-property">@columns</span> = []
constructor: <span class="hljs-function"><span class="hljs-params">(@line)</span> -&gt;</span>
@columns = []
<span class="hljs-attribute">add</span>: <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> <span class="hljs-property">@columns</span>[column] <span class="hljs-keyword">and</span> options.noReplace
<span class="hljs-property">@columns</span>[column] = {<span class="hljs-attribute">line</span>: <span class="hljs-property">@line</span>, column, sourceLine, sourceColumn}
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}
<span class="hljs-attribute">sourceLocation</span>: <span class="hljs-function"><span class="hljs-params">(column)</span> -&gt;</span>
column-- <span class="hljs-keyword">until</span> (mapping = <span class="hljs-property">@columns</span>[column]) <span class="hljs-keyword">or</span> (column &lt;= <span class="hljs-number">0</span>)
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>
@@ -186,8 +186,8 @@ 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>
<span class="hljs-attribute">constructor</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-property">@lines</span> = []</pre></div></div>
constructor: <span class="hljs-function">-&gt;</span>
@lines = []</pre></div></div>
</li>
@@ -205,9 +205,9 @@ effect.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">add</span>: <span class="hljs-function"><span class="hljs-params">(sourceLocation, generatedLocation, options = {})</span> -&gt;</span>
<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 = (<span class="hljs-property">@lines</span>[line] <span class="hljs-keyword">or</span>= <span class="hljs-keyword">new</span> LineMap(line))
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>
@@ -224,8 +224,8 @@ code.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">sourceLocation</span>: <span class="hljs-function"><span class="hljs-params">([line, column])</span> -&gt;</span>
line-- <span class="hljs-keyword">until</span> (lineMap = <span class="hljs-property">@lines</span>[line]) <span class="hljs-keyword">or</span> (line &lt;= <span class="hljs-number">0</span>)
<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>
@@ -257,7 +257,7 @@ set “sources” and “file”, respectively.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">generate</span>: <span class="hljs-function"><span class="hljs-params">(options = {}, code = <span class="hljs-literal">null</span>)</span> -&gt;</span>
<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>
@@ -265,7 +265,7 @@ set “sources” and “file”, respectively.</p>
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> <span class="hljs-property">@lines</span> <span class="hljs-keyword">when</span> lineMap
<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>
@@ -306,7 +306,7 @@ column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += <span class="hljs-property">@encodeVlq</span> mapping.column - lastColumn
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.column - lastColumn
lastColumn = mapping.column</pre></div></div>
</li>
@@ -322,7 +322,7 @@ column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += <span class="hljs-property">@encodeVlq</span> <span class="hljs-number">0</span></pre></div></div>
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq <span class="hljs-number">0</span></pre></div></div>
</li>
@@ -337,7 +337,7 @@ column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += <span class="hljs-property">@encodeVlq</span> mapping.sourceLine - lastSourceLine
<div class="content"><div class='highlight'><pre> buffer += @encodeVlq mapping.sourceLine - lastSourceLine
lastSourceLine = mapping.sourceLine</pre></div></div>
</li>
@@ -353,7 +353,7 @@ column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> buffer += <span class="hljs-property">@encodeVlq</span> mapping.sourceColumn - lastSourceColumn
<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>
@@ -371,16 +371,16 @@ column for the current line:</p>
</div>
<div class="content"><div class='highlight'><pre> v3 =
<span class="hljs-attribute">version</span>: <span class="hljs-number">3</span>
<span class="hljs-attribute">file</span>: options.generatedFile <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
<span class="hljs-attribute">sourceRoot</span>: options.sourceRoot <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
<span class="hljs-attribute">sources</span>: options.sourceFiles <span class="hljs-keyword">or</span> [<span class="hljs-string">''</span>]
<span class="hljs-attribute">names</span>: []
<span class="hljs-attribute">mappings</span>: buffer
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.inline
v3.sourcesContent = [code] <span class="hljs-keyword">if</span> options.inlineMap
JSON.stringify v3, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span></pre></div></div>
v3</pre></div></div>
</li>
@@ -416,7 +416,7 @@ bits of the original value encoded into the first byte of the VLQ encoded value.
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>
<span class="hljs-attribute">encodeVlq</span>: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
encodeVlq: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</span>
answer = <span class="hljs-string">''</span></pre></div></div>
</li>
@@ -466,7 +466,7 @@ bits of the original value encoded into the first byte of the VLQ encoded value.
nextChunk = valueToEncode &amp; VLQ_VALUE_MASK
valueToEncode = valueToEncode &gt;&gt; VLQ_SHIFT
nextChunk |= VLQ_CONTINUATION_BIT <span class="hljs-keyword">if</span> valueToEncode
answer += <span class="hljs-property">@encodeBase64</span> nextChunk
answer += @encodeBase64 nextChunk
answer</pre></div></div>
@@ -497,7 +497,7 @@ bits of the original value encoded into the first byte of the VLQ encoded value.
<div class="content"><div class='highlight'><pre> BASE64_CHARS = <span class="hljs-string">'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'</span>
<span class="hljs-attribute">encodeBase64</span>: <span class="hljs-function"><span class="hljs-params">(value)</span> -&gt;</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>
@@ -513,7 +513,7 @@ bits of the original value encoded into the first byte of the VLQ encoded value.
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">module</span>.<span class="hljs-built_in">exports</span> = SourceMap</pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">module</span>.exports = SourceMap</pre></div></div>
</li>

View File

@@ -0,0 +1,397 @@
/**
* CoffeeScript Compiler v1.12.1
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
var $jscomp={scope:{},checkStringArgs:function(t,ya,oa){if(null==t)throw new TypeError("The 'this' value for String.prototype."+oa+" must not be null or undefined");if(ya instanceof RegExp)throw new TypeError("First argument to String.prototype."+oa+" must not be a regular expression");return t+""}};
$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(t,ya,oa){if(oa.get||oa.set)throw new TypeError("ES3 does not support getters and setters.");t!=Array.prototype&&t!=Object.prototype&&(t[ya]=oa.value)};$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(t,ya,oa,f){if(ya){oa=$jscomp.global;t=t.split(".");for(f=0;f<t.length-1;f++){var ta=t[f];ta in oa||(oa[ta]={});oa=oa[ta]}t=t[t.length-1];f=oa[t];ya=ya(f);ya!=f&&null!=ya&&$jscomp.defineProperty(oa,t,{configurable:!0,writable:!0,value:ya})}};
$jscomp.polyfill("String.prototype.repeat",function(t){return t?t:function(t){var oa=$jscomp.checkStringArgs(this,null,"repeat");if(0>t||1342177279<t)throw new RangeError("Invalid count value");t|=0;for(var f="";t;)if(t&1&&(f+=oa),t>>>=1)oa+=oa;return f}},"es6-impl","es3");$jscomp.findInternal=function(t,ya,oa){t instanceof String&&(t=String(t));for(var f=t.length,ta=0;ta<f;ta++){var wa=t[ta];if(ya.call(oa,wa,ta,t))return{i:ta,v:wa}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(t){return t?t:function(t,oa){return $jscomp.findInternal(this,t,oa).v}},"es6-impl","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(t){return $jscomp.SYMBOL_PREFIX+(t||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};
$jscomp.arrayIterator=function(t){var ya=0;return $jscomp.iteratorPrototype(function(){return ya<t.length?{done:!1,value:t[ya++]}:{done:!0}})};$jscomp.iteratorPrototype=function(t){$jscomp.initSymbolIterator();t={next:t};t[$jscomp.global.Symbol.iterator]=function(){return this};return t};$jscomp.array=$jscomp.array||{};
$jscomp.iteratorFromArray=function(t,ya){$jscomp.initSymbolIterator();t instanceof String&&(t+="");var oa=0,f={next:function(){if(oa<t.length){var ta=oa++;return{value:ya(ta,t[ta]),done:!1}}f.next=function(){return{done:!0,value:void 0}};return f.next()}};f[Symbol.iterator]=function(){return f};return f};$jscomp.polyfill("Array.prototype.keys",function(t){return t?t:function(){return $jscomp.iteratorFromArray(this,function(t){return t})}},"es6-impl","es3");
(function(t){var ya=function(){function t(f){return t[f]}t["./helpers"]=function(){var f={};(function(){var t,wa,D,a,c,Ca;f.starts=function(a,c,l){return c===a.substr(l,c.length)};f.ends=function(a,c,l){var d;d=c.length;return c===a.substr(a.length-d-(l||0),d)};f.repeat=c=function(a,c){var d;for(d="";0<c;)c&1&&(d+=a),c>>>=1,a+=a;return d};f.compact=function(a){var d,c,f,D;D=[];d=0;for(f=a.length;d<f;d++)(c=a[d])&&D.push(c);return D};f.count=function(a,c){var d,v;d=v=0;if(!c.length)return 1/0;for(;v=
1+a.indexOf(c,v);)d++;return d};f.merge=function(a,c){return wa(wa({},a),c)};wa=f.extend=function(a,c){var d,v;for(d in c)v=c[d],a[d]=v;return a};f.flatten=D=function(a){var d,c,f,F;c=[];f=0;for(F=a.length;f<F;f++)d=a[f],"[object Array]"===Object.prototype.toString.call(d)?c=c.concat(D(d)):c.push(d);return c};f.del=function(a,c){var d;d=a[c];delete a[c];return d};f.some=null!=(a=Array.prototype.some)?a:function(a){var d,c,f;c=0;for(f=this.length;c<f;c++)if(d=this[c],a(d))return!0;return!1};f.invertLiterate=
function(a){var d;d=!0;var c,f,D,w;D=a.split("\n");w=[];c=0;for(f=D.length;c<f;c++)a=D[c],d&&/^([ ]{4}|[ ]{0,3}\t)/.test(a)?w.push(a):(d=/^\s*$/.test(a))?w.push(a):w.push("# "+a);return w.join("\n")};t=function(a,c){return c?{first_line:a.first_line,first_column:a.first_column,last_line:c.last_line,last_column:c.last_column}:a};f.addLocationDataFn=function(a,c){return function(d){"object"===typeof d&&d.updateLocationDataIfMissing&&d.updateLocationDataIfMissing(t(a,c));return d}};f.locationDataToString=
function(a){var d;"2"in a&&"first_line"in a[2]?d=a[2]:"first_line"in a&&(d=a);return d?d.first_line+1+":"+(d.first_column+1)+"-"+(d.last_line+1+":"+(d.last_column+1)):"No location data"};f.baseFileName=function(a,c,f){null==c&&(c=!1);null==f&&(f=!1);a=a.split(f?/\\|\//:/\//);a=a[a.length-1];if(!(c&&0<=a.indexOf(".")))return a;a=a.split(".");a.pop();"coffee"===a[a.length-1]&&1<a.length&&a.pop();return a.join(".")};f.isCoffee=function(a){return/\.((lit)?coffee|coffee\.md)$/.test(a)};f.isLiterate=function(a){return/\.(litcoffee|coffee\.md)$/.test(a)};
f.throwSyntaxError=function(a,c){a=new SyntaxError(a);a.location=c;a.toString=Ca;a.stack=a.toString();throw a;};f.updateSyntaxError=function(a,c,f){a.toString===Ca&&(a.code||(a.code=c),a.filename||(a.filename=f),a.stack=a.toString());return a};Ca=function(){var a,f,l,D,F,w,z,n,G,t;if(!this.code||!this.location)return Error.prototype.toString.call(this);a=this.location;w=a.first_line;F=a.first_column;l=a.last_line;z=a.last_column;null==l&&(l=w);null==z&&(z=F);D=this.filename||"[stdin]";a=this.code.split("\n")[w];
l=w===l?z+1:a.length;z=a.slice(0,F).replace(/[^\s]/g," ")+c("^",l-F);"undefined"!==typeof process&&null!==process&&(f=(null!=(n=process.stdout)?n.isTTY:void 0)&&!(null!=(G=process.env)&&G.NODE_DISABLE_COLORS));if(null!=(t=this.colorful)?t:f)f=function(a){return"\u001b[1;31m"+a+"\u001b[0m"},a=a.slice(0,F)+f(a.slice(F,l))+a.slice(l),z=f(z);return D+":"+(w+1)+":"+(F+1)+": error: "+this.message+"\n"+a+"\n"+z};f.nameWhitespaceCharacter=function(a){switch(a){case " ":return"space";case "\n":return"newline";
case "\r":return"carriage return";case "\t":return"tab";default:return a}}}).call(this);return f}();t["./rewriter"]=function(){var f={};(function(){var t,wa,D,a,c,Ca,d,v,l,x,F,w,z,n,G,M,I,u,E=[].indexOf||function(a){for(var c=0,d=this.length;c<d;c++)if(c in this&&this[c]===a)return c;return-1},m=[].slice;n=function(a,c,d){a=[a,c];a.generated=!0;d&&(a.origin=d);return a};f.Rewriter=function(){function g(){}g.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};g.prototype.scanTokens=function(a){var c,d,h;h=this.tokens;for(c=0;d=h[c];)c+=a.call(this,d,c,h);return!0};g.prototype.detectEnd=function(d,p,k){var h,r,g,f,m;m=this.tokens;for(h=0;f=m[d];){if(0===h&&p.call(this,f,d))return k.call(this,f,d);if(!f||0>h)return k.call(this,f,d-1);(r=f[0],0<=E.call(c,r))?
h+=1:(g=f[0],0<=E.call(a,g))&&--h;d+=1}return d-1};g.prototype.removeLeadingNewlines=function(){var a,c,d,h,g;h=this.tokens;a=c=0;for(d=h.length;c<d&&(g=h[a][0],"TERMINATOR"===g);a=++c);if(a)return this.tokens.splice(0,a)};g.prototype.closeOpenCalls=function(){var a,c;c=function(a,c){var h;return")"===(h=a[0])||"CALL_END"===h||"OUTDENT"===a[0]&&")"===this.tag(c-1)};a=function(a,c){return this.tokens["OUTDENT"===a[0]?c-1:c][0]="CALL_END"};return this.scanTokens(function(d,h){"CALL_START"===d[0]&&this.detectEnd(h+
1,c,a);return 1})};g.prototype.closeOpenIndexes=function(){var a,c;c=function(a,c){var h;return"]"===(h=a[0])||"INDEX_END"===h};a=function(a,c){return a[0]="INDEX_END"};return this.scanTokens(function(d,h){"INDEX_START"===d[0]&&this.detectEnd(h+1,c,a);return 1})};g.prototype.indexOfTag=function(){var a,c,d,h,g,f,H;c=arguments[0];g=2<=arguments.length?m.call(arguments,1):[];d=h=a=0;for(f=g.length;0<=f?h<f:h>f;d=0<=f?++h:--h){for(;"HERECOMMENT"===this.tag(c+d+a);)a+=2;if(null!=g[d]&&("string"===typeof g[d]&&
(g[d]=[g[d]]),H=this.tag(c+d+a),0>E.call(g[d],H)))return-1}return c+d+a-1};g.prototype.looksObjectish=function(d){var g;if(-1<this.indexOfTag(d,"@",null,":")||-1<this.indexOfTag(d,null,":"))return!0;d=this.indexOfTag(d,c);return-1<d&&(g=null,this.detectEnd(d+1,function(c){var d;return d=c[0],0<=E.call(a,d)},function(a,c){return g=c}),":"===this.tag(g+1))?!0:!1};g.prototype.findTagsBackwards=function(d,g){var f,h,r,p,H,m,l;for(f=[];0<=d&&(f.length||(p=this.tag(d),0>E.call(g,p))&&((H=this.tag(d),0>
E.call(c,H))||this.tokens[d].generated)&&(m=this.tag(d),0>E.call(F,m)));)(h=this.tag(d),0<=E.call(a,h))&&f.push(this.tag(d)),(r=this.tag(d),0<=E.call(c,r))&&f.length&&f.pop(),--d;return l=this.tag(d),0<=E.call(g,l)};g.prototype.addImplicitBracesAndParens=function(){var g,f;g=[];f=null;return this.scanTokens(function(p,h,r){var k,m,y,K,D,u,x,z,C,A,G,B,t,w,I,M,U,J;J=p[0];A=(G=0<h?r[h-1]:[])[0];C=(h<r.length-1?r[h+1]:[])[0];I=function(){return g[g.length-1]};M=h;y=function(a){return h-M+a};K=function(){var a,
c;return null!=(a=I())?null!=(c=a[2])?c.ours:void 0:void 0};D=function(){var a;return K()&&"("===(null!=(a=I())?a[0]:void 0)};x=function(){var a;return K()&&"{"===(null!=(a=I())?a[0]:void 0)};u=function(){var a;return K&&"CONTROL"===(null!=(a=I())?a[0]:void 0)};U=function(a){var c;c=null!=a?a:h;g.push(["(",c,{ours:!0}]);r.splice(c,0,n("CALL_START","("));if(null==a)return h+=1};k=function(){g.pop();r.splice(h,0,n("CALL_END",")",["","end of input",p[2]]));return h+=1};z=function(a,c){var d;null==c&&
(c=!0);d=null!=a?a:h;g.push(["{",d,{sameLine:!0,startsLine:c,ours:!0}]);c=new String("{");c.generated=!0;r.splice(d,0,n("{",c,p));if(null==a)return h+=1};m=function(a){a=null!=a?a:h;g.pop();r.splice(a,0,n("}","}",p));return h+=1};if(D()&&("IF"===J||"TRY"===J||"FINALLY"===J||"CATCH"===J||"CLASS"===J||"SWITCH"===J))return g.push(["CONTROL",h,{ours:!0}]),y(1);if("INDENT"===J&&K()){if("\x3d\x3e"!==A&&"-\x3e"!==A&&"["!==A&&"("!==A&&","!==A&&"{"!==A&&"TRY"!==A&&"ELSE"!==A&&"\x3d"!==A)for(;D();)k();u()&&
g.pop();g.push([J,h]);return y(1)}if(0<=E.call(c,J))return g.push([J,h]),y(1);if(0<=E.call(a,J)){for(;K();)D()?k():x()?m():g.pop();f=g.pop()}if((0<=E.call(v,J)&&p.spaced||"?"===J&&0<h&&!r[h-1].spaced)&&(0<=E.call(Ca,C)||0<=E.call(l,C)&&(null==(B=r[h+1])||!B.spaced)&&(null==(t=r[h+1])||!t.newLine)))return"?"===J&&(J=p[0]="FUNC_EXIST"),U(h+1),y(2);if(0<=E.call(v,J)&&-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 U(h+
1),g.push(["INDENT",h+2]),y(3);if(":"===J){for(m=function(){var c;switch(!1){case c=this.tag(h-1),0>E.call(a,c):return f[1];case "@"!==this.tag(h-2):return h-2;default:return h-1}}.call(this);"HERECOMMENT"===this.tag(m-2);)m-=2;this.insideForDeclaration="FOR"===C;u=0===m||(w=this.tag(m-1),0<=E.call(F,w))||r[m-1].newLine;if(I()&&(x=I(),w=x[0],G=x[1],("{"===w||"INDENT"===w&&"{"===this.tag(G-1))&&(u||","===this.tag(m-1)||"{"===this.tag(m-1))))return y(1);z(m,!!u);return y(2)}x()&&0<=E.call(F,J)&&(I()[2].sameLine=
!1);z="OUTDENT"===A||G.newLine;if(0<=E.call(d,J)||0<=E.call(wa,J)&&z)for(;K();)if(z=I(),w=z[0],G=z[1],w=z[2],z=w.sameLine,u=w.startsLine,D()&&","!==A)k();else if(x()&&!this.insideForDeclaration&&z&&"TERMINATOR"!==J&&":"!==A)m();else if(!x()||"TERMINATOR"!==J||","===A||u&&this.looksObjectish(h+1))break;else{if("HERECOMMENT"===C)return y(1);m()}if(!(","!==J||this.looksObjectish(h+1)||!x()||this.insideForDeclaration||"TERMINATOR"===C&&this.looksObjectish(h+2)))for(C="OUTDENT"===C?1:0;x();)m(h+C);return y(1)})};
g.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(a,c,d){var h,g,f;if(a[2]||!a.generated&&!a.explicit)return 1;"{"===a[0]&&(h=null!=(f=d[c+1])?f[2]:void 0)?(g=h.first_line,h=h.first_column):(h=null!=(g=d[c-1])?g[2]:void 0)?(g=h.last_line,h=h.last_column):g=h=0;a[2]={first_line:g,first_column:h,last_line:g,last_column:h};return 1})};g.prototype.fixOutdentLocationData=function(){return this.scanTokens(function(a,c,d){if(!("OUTDENT"===a[0]||a.generated&&"CALL_END"===
a[0]||a.generated&&"}"===a[0]))return 1;c=d[c-1][2];a[2]={first_line:c.last_line,first_column:c.last_column,last_line:c.last_line,last_column:c.last_column};return 1})};g.prototype.normalizeLines=function(){var a,c,d,h,g;g=d=h=null;c=function(a,c){var d,h,f,m;return";"!==a[1]&&(d=a[0],0<=E.call(w,d))&&!("TERMINATOR"===a[0]&&(h=this.tag(c+1),0<=E.call(D,h)))&&!("ELSE"===a[0]&&"THEN"!==g)&&!!("CATCH"!==(f=a[0])&&"FINALLY"!==f||"-\x3e"!==g&&"\x3d\x3e"!==g)||(m=a[0],0<=E.call(wa,m))&&this.tokens[c-1].newLine};
a=function(a,c){return this.tokens.splice(","===this.tag(c-1)?c-1:c,0,h)};return this.scanTokens(function(f,p,r){var k,l,u;f=f[0];if("TERMINATOR"===f){if("ELSE"===this.tag(p+1)&&"OUTDENT"!==this.tag(p-1))return r.splice.apply(r,[p,1].concat(m.call(this.indentation()))),1;if(k=this.tag(p+1),0<=E.call(D,k))return r.splice(p,1),0}if("CATCH"===f)for(k=l=1;2>=l;k=++l)if("OUTDENT"===(u=this.tag(p+k))||"TERMINATOR"===u||"FINALLY"===u)return r.splice.apply(r,[p+k,0].concat(m.call(this.indentation()))),2+
k;0<=E.call(z,f)&&"INDENT"!==this.tag(p+1)&&("ELSE"!==f||"IF"!==this.tag(p+1))&&(g=f,u=this.indentation(r[p]),d=u[0],h=u[1],"THEN"===g&&(d.fromThen=!0),r.splice(p+1,0,d),this.detectEnd(p+2,c,a),"THEN"===f&&r.splice(p,1));return 1})};g.prototype.tagPostfixConditionals=function(){var a,c,d;d=null;c=function(a,c){a=a[0];c=this.tokens[c-1][0];return"TERMINATOR"===a||"INDENT"===a&&0>E.call(z,c)};a=function(a,c){if("INDENT"!==a[0]||a.generated&&!a.fromThen)return d[0]="POST_"+d[0]};return this.scanTokens(function(h,
g){if("IF"!==h[0])return 1;d=h;this.detectEnd(g+1,c,a);return 1})};g.prototype.indentation=function(a){var c,d;c=["INDENT",2];d=["OUTDENT",2];a?(c.generated=d.generated=!0,c.origin=d.origin=a):c.explicit=d.explicit=!0;return[c,d]};g.prototype.generate=n;g.prototype.tag=function(a){var c;return null!=(c=this.tokens[a])?c[0]:void 0};return g}();t=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],
["REGEX_START","REGEX_END"]];f.INVERSES=x={};c=[];a=[];G=0;for(I=t.length;G<I;G++)u=t[G],M=u[0],u=u[1],c.push(x[u]=M),a.push(x[M]=u);D=["CATCH","THEN","ELSE","FINALLY"].concat(a);v="IDENTIFIER PROPERTY SUPER ) CALL_END ] INDEX_END @ THIS".split(" ");Ca="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(" ");l=["+","-"];d="POST_IF FOR WHILE UNTIL WHEN BY LOOP TERMINATOR".split(" ");
z="ELSE -\x3e \x3d\x3e TRY FINALLY THEN".split(" ");w="TERMINATOR CATCH FINALLY ELSE OUTDENT LEADING_WHEN".split(" ");F=["TERMINATOR","INDENT","OUTDENT"];wa=[".","?.","::","?::"]}).call(this);return f}();t["./lexer"]=function(){var f={};(function(){var ta,wa,D,a,c,Ca,d,v,l,x,F,w,z,n,G,M,I,u,E,m,g,r,p,k,h,K,O,H,y,T,S,P,Z,R,C,A,W,B,N,X,Y,V,U,J,aa,Q,oa,ya,Xa,ja,ba,da,ga,ha,ka,na,L,ia,pa,ca=[].indexOf||function(a){for(var c=0,d=this.length;c<d;c++)if(c in this&&this[c]===a)return c;return-1},la=[].slice;
L=t("./rewriter");B=L.Rewriter;g=L.INVERSES;L=t("./helpers");da=L.count;ia=L.repeat;ga=L.invertLiterate;pa=L.throwSyntaxError;f.Lexer=function(){function f(){}f.prototype.tokenize=function(a,c){var d,ea,f,h;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.seenExport=this.seenImport=this.seenFor=!1;this.chunkLine=c.line||0;this.chunkColumn=c.column||0;a=this.clean(a);for(f=0;this.chunk=
a.slice(f);)if(d=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken(),h=this.getLineAndColumnFromChunk(d),this.chunkLine=h[0],this.chunkColumn=h[1],f+=d,c.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:f};this.closeIndentation();(ea=this.ends.pop())&&this.error("missing "+ea.tag,ea.origin[2]);return!1===c.rewrite?this.tokens:(new B).rewrite(this.tokens)};
f.prototype.clean=function(a){a.charCodeAt(0)===ta&&(a=a.slice(1));a=a.replace(/\r/g,"").replace(oa,"");ba.test(a)&&(a="\n"+a,this.chunkLine--);this.literate&&(a=ga(a));return a};f.prototype.identifierToken=function(){var d,f,g,m,r,k,l,u,D,y,n;if(!(f=I.exec(this.chunk)))return 0;r=f[0];g=f[1];f=f[2];m=g.length;k=void 0;if("own"===g&&"FOR"===this.tag())return this.token("OWN",g),g.length;if("from"===g&&"YIELD"===this.tag())return this.token("FROM",g),g.length;if("as"===g&&this.seenImport){if("*"===
this.value())this.tokens[this.tokens.length-1][0]="IMPORT_ALL";else if(l=this.value(),0<=ca.call(Ca,l))this.tokens[this.tokens.length-1][0]="IDENTIFIER";if("DEFAULT"===(u=this.tag())||"IMPORT_ALL"===u||"IDENTIFIER"===u)return this.token("AS",g),g.length}if("as"===g&&this.seenExport&&"IDENTIFIER"===this.tag())return this.token("AS",g),g.length;if("default"===g&&this.seenExport)return this.token("DEFAULT",g),g.length;l=this.tokens;l=l[l.length-1];n=f||null!=l&&("."===(D=l[0])||"?."===D||"::"===D||"?::"===
D||!l.spaced&&"@"===l[0])?"PROPERTY":"IDENTIFIER";"IDENTIFIER"!==n||!(0<=ca.call(p,g)||0<=ca.call(Ca,g))||this.exportSpecifierList&&0<=ca.call(Ca,g)?"IDENTIFIER"===n&&this.seenFor&&"from"===g&&ha(l)&&(n="FORFROM",this.seenFor=!1):(n=g.toUpperCase(),"WHEN"===n&&(y=this.tag(),0<=ca.call(h,y))?n="LEADING_WHEN":"FOR"===n?this.seenFor=!0:"UNLESS"===n?n="IF":"IMPORT"===n?this.seenImport=!0:"EXPORT"===n?this.seenExport=!0:0<=ca.call(ya,n)?n="UNARY":0<=ca.call(A,n)&&("INSTANCEOF"!==n&&this.seenFor?(n="FOR"+
n,this.seenFor=!1):(n="RELATION","!"===this.value()&&(k=this.tokens.pop(),g="!"+g))));"IDENTIFIER"===n&&0<=ca.call(W,g)&&this.error("reserved word '"+g+"'",{length:g.length});"PROPERTY"!==n&&(0<=ca.call(a,g)&&(d=g,g=c[g]),n=function(){switch(g){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 g;default:return n}}());D=this.token(n,g,0,m);d&&(D.origin=
[n,d,D[2]]);k&&(d=[k[2].first_line,k[2].first_column],D[2].first_line=d[0],D[2].first_column=d[1]);f&&(d=r.lastIndexOf(":"),this.token(":",":",d,f.length));return r.length};f.prototype.numberToken=function(){var a,c,d,g;if(!(c=T.exec(this.chunk)))return 0;d=c[0];c=d.length;switch(!1){case !/^0[BOX]/.test(d):this.error("radix prefix in '"+d+"' must be lowercase",{offset:1});break;case !/^(?!0x).*E/.test(d):this.error("exponential notation in '"+d+"' must be indicated with a lowercase 'e'",{offset:d.indexOf("E")});
break;case !/^0\d*[89]/.test(d):this.error("decimal literal '"+d+"' must not be prefixed with '0'",{length:c});break;case !/^0\d+/.test(d):this.error("octal literal '"+d+"' must be prefixed with '0o'",{length:c})}a=function(){switch(d.charAt(1)){case "b":return 2;case "o":return 8;case "x":return 16;default:return null}}();a=null!=a?parseInt(d.slice(2),a):parseFloat(d);if("b"===(g=d.charAt(1))||"o"===g)d="0x"+a.toString(16);this.token(Infinity===a?"INFINITY":"NUMBER",d,0,c);return c};f.prototype.stringToken=
function(){var a,c,d,g,f,h,m,p,r,n,l,D;r=(aa.exec(this.chunk)||[])[0];if(!r)return 0;this.tokens.length&&"from"===this.value()&&(this.seenImport||this.seenExport)&&(this.tokens[this.tokens.length-1][0]="FROM");d=function(){switch(r){case "'":return J;case '"':return V;case "'''":return z;case '"""':return F}}();g=3===r.length;d=this.matchWithInterpolations(d,r);D=d.tokens;f=d.index;a=D.length-1;d=r.charAt(0);if(g){m=null;for(g=function(){var a,c,d;d=[];h=a=0;for(c=D.length;a<c;h=++a)l=D[h],"NEOSTRING"===
l[0]&&d.push(l[1]);return d}().join("#{}");c=w.exec(g);)if(c=c[1],null===m||0<(n=c.length)&&n<m.length)m=c;m&&(p=RegExp("\\n"+m,"g"));this.mergeInterpolationTokens(D,{delimiter:d},function(c){return function(d,g){d=c.formatString(d);p&&(d=d.replace(p,"\n"));0===g&&(d=d.replace(k,""));g===a&&(d=d.replace(Q,""));return d}}(this))}else this.mergeInterpolationTokens(D,{delimiter:d},function(c){return function(d,g){d=c.formatString(d);return d=d.replace(X,function(c,f){return 0===g&&0===f||g===a&&f+c.length===
d.length?"":" "})}}(this));return f};f.prototype.commentToken=function(){var a,c,g;if(!(g=this.chunk.match(d)))return 0;a=g[0];if(c=g[1])(g=x.exec(a))&&this.error("block comments cannot contain "+g[0],{offset:g.index,length:g[0].length}),0<=c.indexOf("\n")&&(c=c.replace(RegExp("\\n"+ia(" ",this.indent),"g"),"\n")),this.token("HERECOMMENT",c,0,a.length);return a.length};f.prototype.jsToken=function(){var a,c;if("`"!==this.chunk.charAt(0)||!(a=M.exec(this.chunk)||r.exec(this.chunk)))return 0;c=a[1].replace(/\\+(`|$)/g,
function(a){return a.slice(-Math.ceil(a.length/2))});this.token("JS",c,0,a[0].length);return a[0].length};f.prototype.regexToken=function(){var a,c,d,g,f,h,m,r;switch(!1){case !(c=C.exec(this.chunk)):this.error("regular expressions cannot begin with "+c[2],{offset:c.index+c[1].length});break;case !(c=this.matchWithInterpolations(n,"///")):r=c.tokens;f=c.index;break;case !(c=Z.exec(this.chunk)):m=c[0];a=c[1];c=c[2];this.validateEscapes(a,{isRegex:!0,offsetInChunk:1});f=m.length;h=this.tokens;if(h=
h[h.length-1])if(h.spaced&&(d=h[0],0<=ca.call(wa,d))){if(!c||P.test(m))return 0}else if(g=h[0],0<=ca.call(y,g))return 0;c||this.error("missing / (unclosed regex)");break;default:return 0}g=R.exec(this.chunk.slice(f))[0];d=f+g.length;c=this.makeToken("REGEX",null,0,d);switch(!1){case !!ja.test(g):this.error("invalid regular expression flags "+g,{offset:f,length:g.length});break;case !(m||1===r.length):null==a&&(a=this.formatHeregex(r[0][1]));this.token("REGEX",""+this.makeDelimitedLiteral(a,{delimiter:"/"})+
g,0,d,c);break;default:this.token("REGEX_START","(",0,0,c),this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),this.mergeInterpolationTokens(r,{delimiter:'"',double:!0},this.formatHeregex),g&&(this.token(",",",",f,0),this.token("STRING",'"'+g+'"',f,g.length)),this.token(")",")",d,0),this.token("REGEX_END",")",d,0)}return d};f.prototype.lineToken=function(){var a,c,d;if(!(c=H.exec(this.chunk)))return 0;c=c[0];this.seenFor=!1;d=c.length-1-c.lastIndexOf("\n");a=this.unfinished();if(d-
this.indebt===this.indent)return a?this.suppressNewlines():this.newlineToken(0),c.length;if(d>this.indent){if(a)return this.indebt=d-this.indent,this.suppressNewlines(),c.length;if(!this.tokens.length)return this.baseIndent=this.indent=d,c.length;a=d-this.indent+this.outdebt;this.token("INDENT",a,c.length-d,d);this.indents.push(a);this.ends.push({tag:"OUTDENT"});this.outdebt=this.indebt=0;this.indent=d}else d<this.baseIndent?this.error("missing indentation",{offset:c.length}):(this.indebt=0,this.outdentToken(this.indent-
d,a,c.length));return c.length};f.prototype.outdentToken=function(a,c,d){var g,f,h,ea;for(g=this.indent-a;0<a;)(h=this.indents[this.indents.length-1])?h===this.outdebt?(a-=this.outdebt,this.outdebt=0):h<this.outdebt?(this.outdebt-=h,a-=h):(f=this.indents.pop()+this.outdebt,d&&(ea=this.chunk[d],0<=ca.call(u,ea))&&(g-=f-a,a=f),this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",a,0,d),a-=f):a=0;f&&(this.outdebt-=a);for(;";"===this.value();)this.tokens.pop();"TERMINATOR"===this.tag()||c||this.token("TERMINATOR",
"\n",d,0);this.indent=g;return this};f.prototype.whitespaceToken=function(){var a,c;if(!(a=ba.exec(this.chunk))&&"\n"!==this.chunk.charAt(0))return 0;c=this.tokens;(c=c[c.length-1])&&(c[a?"spaced":"newLine"]=!0);return a?a[0].length:0};f.prototype.newlineToken=function(a){for(;";"===this.value();)this.tokens.pop();"TERMINATOR"!==this.tag()&&this.token("TERMINATOR","\n",a,0);return this};f.prototype.suppressNewlines=function(){"\\"===this.value()&&this.tokens.pop();return this};f.prototype.literalToken=
function(){var a,c,d,f,h,m,r,p;(a=S.exec(this.chunk))?(a=a[0],D.test(a)&&this.tagParameters()):a=this.chunk.charAt(0);p=a;f=this.tokens;if((f=f[f.length-1])&&0<=ca.call(["\x3d"].concat(la.call(l)),a)&&(r=!1,"\x3d"!==a||"||"!==(d=f[1])&&"\x26\x26"!==d||f.spaced||(f[0]="COMPOUND_ASSIGN",f[1]+="\x3d",f=this.tokens[this.tokens.length-2],r=!0),f&&"PROPERTY"!==f[0]&&(d=null!=(c=f.origin)?c:f,(c=ka(f[1],d[1]))&&this.error(c,d[2])),r))return a.length;"{"===a&&"EXPORT"===(null!=f?f[0]:void 0)?this.exportSpecifierList=
!0:this.exportSpecifierList&&"}"===a&&(this.exportSpecifierList=!1);if(";"===a)this.seenFor=this.seenImport=this.seenExport=!1,p="TERMINATOR";else if("*"===a&&"EXPORT"===f[0])p="EXPORT_ALL";else if(0<=ca.call(O,a))p="MATH";else if(0<=ca.call(v,a))p="COMPARE";else if(0<=ca.call(l,a))p="COMPOUND_ASSIGN";else if(0<=ca.call(ya,a))p="UNARY";else if(0<=ca.call(Xa,a))p="UNARY_MATH";else if(0<=ca.call(N,a))p="SHIFT";else if("?"===a&&null!=f&&f.spaced)p="BIN?";else if(f&&!f.spaced)if("("===a&&(h=f[0],0<=ca.call(wa,
h)))"?"===f[0]&&(f[0]="FUNC_EXIST"),p="CALL_START";else if("["===a&&(m=f[0],0<=ca.call(E,m)))switch(p="INDEX_START",f[0]){case "?":f[0]="INDEX_SOAK"}h=this.makeToken(p,a);switch(a){case "(":case "{":case "[":this.ends.push({tag:g[a],origin:h});break;case ")":case "}":case "]":this.pair(a)}this.tokens.push(h);return a.length};f.prototype.tagParameters=function(){var a,c,d,f;if(")"!==this.tag())return this;c=[];f=this.tokens;a=f.length;for(f[--a][0]="PARAM_END";d=f[--a];)switch(d[0]){case ")":c.push(d);
break;case "(":case "CALL_START":if(c.length)c.pop();else return"("===d[0]&&(d[0]="PARAM_START"),this}return this};f.prototype.closeIndentation=function(){return this.outdentToken(this.indent)};f.prototype.matchWithInterpolations=function(a,c){var d,g,h,m,p,r,k,n;n=[];p=c.length;if(this.chunk.slice(0,p)!==c)return null;for(k=this.chunk.slice(p);;){m=a.exec(k)[0];this.validateEscapes(m,{isRegex:"/"===c.charAt(0),offsetInChunk:p});n.push(this.makeToken("NEOSTRING",m,p));k=k.slice(m.length);p+=m.length;
if("#{"!==k.slice(0,2))break;d=this.getLineAndColumnFromChunk(p+1);m=d[0];d=d[1];d=(new f).tokenize(k.slice(1),{line:m,column:d,untilBalanced:!0});m=d.tokens;g=d.index;g+=1;r=m[0];d=m[m.length-1];r[0]=r[1]="(";d[0]=d[1]=")";d.origin=["","end of interpolation",d[2]];"TERMINATOR"===(null!=(h=m[1])?h[0]:void 0)&&m.splice(1,1);n.push(["TOKENS",m]);k=k.slice(g);p+=g}k.slice(0,c.length)!==c&&this.error("missing "+c,{length:c.length});a=n[0];h=n[n.length-1];a[2].first_column-=c.length;"\n"===h[1].substr(-1)?
(h[2].last_line+=1,h[2].last_column=c.length-1):h[2].last_column+=c.length;0===h[1].length&&--h[2].last_column;return{tokens:n,index:p+c.length}};f.prototype.mergeInterpolationTokens=function(a,c,d){var f,g,h,m,p,r,k,n,l,D,u,ea;1<a.length&&(n=this.token("STRING_START","(",0,0));h=this.tokens.length;m=p=0;for(r=a.length;p<r;m=++p){D=a[m];f=D[0];ea=D[1];switch(f){case "TOKENS":if(2===ea.length)continue;k=ea[0];u=ea;break;case "NEOSTRING":f=d(D[1],m);if(0===f.length)if(0===m)g=this.tokens.length;else continue;
2===m&&null!=g&&this.tokens.splice(g,2);D[0]="STRING";D[1]=this.makeDelimitedLiteral(f,c);k=D;u=[D]}this.tokens.length>h&&(m=this.token("+","+"),m[2]={first_line:k[2].first_line,first_column:k[2].first_column,last_line:k[2].first_line,last_column:k[2].first_column});(l=this.tokens).push.apply(l,u)}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}};f.prototype.pair=function(a){var c;c=this.ends;c=c[c.length-1];return a!==(c=null!=c?c.tag:void 0)?("OUTDENT"!==c&&this.error("unmatched "+a),c=this.indents,c=c[c.length-1],this.outdentToken(c,!0),this.pair(a)):this.ends.pop()};f.prototype.getLineAndColumnFromChunk=function(a){var c,d;if(0===a)return[this.chunkLine,this.chunkColumn];d=a>=this.chunk.length?this.chunk:this.chunk.slice(0,
+(a-1)+1||9E9);a=da(d,"\n");c=this.chunkColumn;0<a?(c=d.split("\n"),c=c[c.length-1],c=c.length):c+=d.length;return[this.chunkLine+a,c]};f.prototype.makeToken=function(a,c,d,f){var g,h;null==d&&(d=0);null==f&&(f=c.length);g={};h=this.getLineAndColumnFromChunk(d);g.first_line=h[0];g.first_column=h[1];d=this.getLineAndColumnFromChunk(d+(0<f?f-1:0));g.last_line=d[0];g.last_column=d[1];return[a,c,g]};f.prototype.token=function(a,c,d,f,g){a=this.makeToken(a,c,d,f);g&&(a.origin=g);this.tokens.push(a);return a};
f.prototype.tag=function(){var a;a=this.tokens;a=a[a.length-1];return null!=a?a[0]:void 0};f.prototype.value=function(){var a;a=this.tokens;a=a[a.length-1];return null!=a?a[1]:void 0};f.prototype.unfinished=function(){var a;return K.test(this.chunk)||"\\"===(a=this.tag())||"."===a||"?."===a||"?::"===a||"UNARY"===a||"MATH"===a||"UNARY_MATH"===a||"+"===a||"-"===a||"**"===a||"SHIFT"===a||"RELATION"===a||"COMPARE"===a||"\x26"===a||"^"===a||"|"===a||"\x26\x26"===a||"||"===a||"BIN?"===a||"THROW"===a||"EXTENDS"===
a};f.prototype.formatString=function(a){return a.replace(U,"$1")};f.prototype.formatHeregex=function(a){return a.replace(G,"$1$2")};f.prototype.validateEscapes=function(a,c){var d,f,g,h,p;null==c&&(c={});if(f=m.exec(a))if(f[0],a=f[1],g=f[2],d=f[3],p=f[4],!c.isRegex||!g||"0"===g.charAt(0))return d="\\"+(g||d||p),this.error((g?"octal escape sequences are not allowed":"invalid escape sequence")+" "+d,{offset:(null!=(h=c.offsetInChunk)?h:0)+f.index+a.length,length:d.length})};f.prototype.makeDelimitedLiteral=
function(a,c){null==c&&(c={});""===a&&"/"===c.delimiter&&(a="(?:)");a=a.replace(RegExp("(\\\\\\\\)|(\\\\0(?\x3d[1-7]))|\\\\?("+c.delimiter+")|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)","g"),function(a,d,f,g,h,m,p,r,k){switch(!1){case !d:return c.double?d+d:d;case !f:return"\\x00";case !g:return"\\"+g;case !h:return"\\n";case !m:return"\\r";case !p:return"\\u2028";case !r:return"\\u2029";case !k:return c.double?"\\"+k:k}});return""+c.delimiter+a+c.delimiter};f.prototype.error=function(a,c){var d,
f,g,h,m;null==c&&(c={});c="first_line"in c?c:(h=this.getLineAndColumnFromChunk(null!=(g=c.offset)?g:0),f=h[0],d=h[1],h,{first_line:f,first_column:d,last_column:d+(null!=(m=c.length)?m:1)-1});return pa(a,c)};return f}();ka=function(a,c){null==c&&(c=a);switch(!1){case 0>ca.call(la.call(p).concat(la.call(Ca)),a):return"keyword '"+c+"' can't be assigned";case 0>ca.call(Y,a):return"'"+c+"' can't be assigned";case 0>ca.call(W,a):return"reserved word '"+c+"' can't be assigned";default:return!1}};f.isUnassignable=
ka;ha=function(a){var c;return"IDENTIFIER"===a[0]?("from"===a[1]&&(a[1][0]="IDENTIFIER",!0),!0):"FOR"===a[0]?!1:"{"===(c=a[1])||"["===c||","===c||":"===c?!1:!0};p="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(" ");Ca="undefined Infinity NaN then unless until loop of by when".split(" ");c={and:"\x26\x26",or:"||",is:"\x3d\x3d",isnt:"!\x3d",not:"!",yes:"true",
no:"false",on:"true",off:"false"};a=function(){var a;a=[];for(na in c)a.push(na);return a}();Ca=Ca.concat(a);W="case function var void with const let enum native implements interface package private protected public static".split(" ");Y=["arguments","eval"];f.JS_FORBIDDEN=p.concat(W).concat(Y);ta=65279;I=/^(?!\d)((?:(?!\s)[$\w\x7f-\uffff])+)([^\n\S]*:(?!:))?/;T=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;S=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>*\/%])\2=?|\?(\.|::)|\.{2,3})/;
ba=/^[^\n\S]+/;d=/^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/;D=/^[-=]>/;H=/^(?:\n[^\n\S]*)+/;r=/^`(?!``)((?:[^`\\]|\\[\s\S])*)`/;M=/^```((?:[^`\\]|\\[\s\S]|`(?!``))*)```/;aa=/^(?:'''|"""|'|")/;J=/^(?:[^\\']|\\[\s\S])*/;V=/^(?:[^\\"#]|\\[\s\S]|\#(?!\{))*/;z=/^(?:[^\\']|\\[\s\S]|'(?!''))*/;F=/^(?:[^\\"#]|\\[\s\S]|"(?!"")|\#(?!\{))*/;U=/((?:\\\\)+)|\\[^\S\n]*\n\s*/g;X=/\s*\n\s*/g;w=/\n+([^\n\S]*)(?=\S)/g;Z=/^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/;R=/^\w*/;
ja=/^(?!.*(.).*\1)[imgy]*$/;n=/^(?:[^\\\/#]|\\[\s\S]|\/(?!\/\/)|\#(?!\{))*/;G=/((?:\\\\)+)|\\(\s)|\s+(?:#.*)?/g;C=/^(\/|\/{3}\s*)(\*)/;P=/^\/=?\s/;x=/\*\//;K=/^\s*(?:,|\??\.(?![.\d])|::)/;m=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/;k=/^[^\n\S]*\n/;Q=/\n[^\n\S]*$/;oa=/\s+$/;l="-\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(" ");ya=["NEW","TYPEOF",
"DELETE","DO"];Xa=["!","~"];N=["\x3c\x3c","\x3e\x3e","\x3e\x3e\x3e"];v="\x3d\x3d !\x3d \x3c \x3e \x3c\x3d \x3e\x3d".split(" ");O=["*","/","%","//","%%"];A=["IN","OF","INSTANCEOF"];wa="IDENTIFIER PROPERTY ) ] ? @ THIS SUPER".split(" ");E=wa.concat("NUMBER INFINITY NAN STRING STRING_END REGEX REGEX_END BOOL NULL UNDEFINED } ::".split(" "));y=E.concat(["++","--"]);h=["INDENT","OUTDENT","TERMINATOR"];u=[")","}","]"]}).call(this);return f}();t["./parser"]=function(){var f={},ta={exports:f},wa=function(){function f(){this.yy=
{}}var a=function(a,q,qa,b){qa=qa||{};for(b=a.length;b--;qa[a[b]]=q);return qa},c=[1,22],t=[1,25],d=[1,83],v=[1,79],l=[1,84],x=[1,85],F=[1,81],w=[1,82],z=[1,56],n=[1,58],G=[1,59],M=[1,60],I=[1,61],u=[1,62],E=[1,49],m=[1,50],g=[1,32],r=[1,68],p=[1,69],k=[1,78],h=[1,47],K=[1,51],O=[1,52],H=[1,67],y=[1,65],T=[1,66],S=[1,64],P=[1,42],Z=[1,48],R=[1,63],C=[1,73],A=[1,74],W=[1,75],B=[1,76],N=[1,46],X=[1,72],Y=[1,34],V=[1,35],U=[1,36],J=[1,37],aa=[1,38],Q=[1,39],wa=[1,86],ta=[1,6,32,42,131],oa=[1,101],ja=
[1,89],ba=[1,88],da=[1,87],ga=[1,90],ha=[1,91],ka=[1,92],na=[1,93],L=[1,94],ia=[1,95],pa=[1,96],ca=[1,97],la=[1,98],ra=[1,99],ea=[1,100],ya=[1,104],sa=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],Ja=[2,165],Ta=[1,110],Ga=[1,111],Ua=[1,112],Fa=[1,113],Pa=[1,115],Qa=[1,116],Na=[1,109],za=[1,6,32,42,131,133,135,139,156],ma=[2,27],fa=[1,123],Ha=[1,121],Aa=[1,6,31,32,40,41,42,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,
122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],Ia=[2,94],b=[1,6,31,32,42,46,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],q=[2,73],qa=[1,128],ua=[1,133],e=[1,134],va=[1,136],Ka=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],xa=[2,91],Gb=[1,6,32,42,65,70,
73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],ab=[2,63],Hb=[1,166],bb=[1,178],Wa=[1,180],Ib=[1,175],Oa=[1,182],ub=[1,184],La=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,96,113,114,115,120,122,131,133,134,135,139,140,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175],Jb=[2,110],Kb=[1,6,31,32,40,41,42,58,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,
167,168,169,170,171,172,173,174],Lb=[1,6,31,32,40,41,42,46,58,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],Mb=[40,41,114],Nb=[1,241],vb=[1,240],Ma=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156],Ea=[2,71],Ob=[1,250],Va=[6,31,32,65,70],hb=[6,31,32,55,65,70,73],cb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,164,166,167,168,169,170,171,172,173,174],Pb=[40,
41,82,83,84,85,87,90,113,114],ib=[1,269],db=[2,62],jb=[1,279],Ya=[1,281],wb=[1,286],eb=[1,288],Qb=[2,186],xb=[1,6,31,32,40,41,42,55,65,70,73,82,83,84,85,87,89,90,94,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],kb=[1,297],Ra=[6,31,32,70,115,120],Rb=[1,6,31,32,40,41,42,55,58,65,70,73,82,83,84,85,87,89,90,94,96,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,
174,175],Sb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,140,156],Za=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,134,140,156],lb=[146,147,148],mb=[70,146,147,148],nb=[6,31,94],Tb=[1,311],Ba=[6,31,32,70,94],Ub=[6,31,32,58,70,94],yb=[6,31,32,55,58,70,94],Vb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,166,167,168,169,170,171,172,173,174],Wb=[12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,62,63,67,68,89,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,
158,159,160,161,162],Xb=[2,175],Sa=[6,31,32],fb=[2,72],Yb=[1,323],Zb=[1,324],$b=[1,6,31,32,42,65,70,73,89,94,115,120,122,127,128,131,133,134,135,139,140,151,153,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],ob=[32,151,153],ac=[1,6,32,42,65,70,73,89,94,115,120,122,131,134,140,156],pb=[1,350],zb=[1,356],Ab=[1,6,32,42,131,156],gb=[2,86],qb=[1,366],rb=[1,367],bc=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,151,156,159,160,163,164,165,166,167,168,169,170,171,172,173,
174],Bb=[1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,135,139,140,156],cc=[1,380],dc=[1,381],Cb=[6,31,32,94],ec=[6,31,32,70],Db=[1,6,31,32,42,65,70,73,89,94,115,120,122,127,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],fc=[31,70],sb=[1,407],tb=[1,408],Eb=[1,414],Fb=[1,415],gc={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Line:5,TERMINATOR:6,Expression:7,Statement:8,YieldReturn:9,Return:10,Comment:11,STATEMENT:12,Import:13,Export:14,Value:15,Invocation:16,
Code:17,Operation:18,Assign:19,If:20,Try:21,While:22,For:23,Switch:24,Class:25,Throw:26,Yield:27,YIELD:28,FROM:29,Block:30,INDENT:31,OUTDENT:32,Identifier:33,IDENTIFIER:34,Property:35,PROPERTY:36,AlphaNumeric:37,NUMBER:38,String:39,STRING:40,STRING_START:41,STRING_END:42,Regex:43,REGEX:44,REGEX_START:45,REGEX_END:46,Literal:47,JS:48,UNDEFINED:49,NULL:50,BOOL:51,INFINITY:52,NAN:53,Assignable:54,"\x3d":55,AssignObj:56,ObjAssignable:57,":":58,SimpleObjAssignable:59,ThisProperty:60,RETURN:61,HERECOMMENT:62,
PARAM_START:63,ParamList:64,PARAM_END:65,FuncGlyph:66,"-\x3e":67,"\x3d\x3e":68,OptComma:69,",":70,Param:71,ParamVar:72,"...":73,Array:74,Object:75,Splat:76,SimpleAssignable:77,Accessor:78,Parenthetical:79,Range:80,This:81,".":82,"?.":83,"::":84,"?::":85,Index:86,INDEX_START:87,IndexValue:88,INDEX_END:89,INDEX_SOAK:90,Slice:91,"{":92,AssignList:93,"}":94,CLASS:95,EXTENDS:96,IMPORT:97,ImportDefaultSpecifier:98,ImportNamespaceSpecifier:99,ImportSpecifierList:100,ImportSpecifier:101,AS:102,DEFAULT:103,
IMPORT_ALL:104,EXPORT:105,ExportSpecifierList:106,EXPORT_ALL:107,ExportSpecifier:108,OptFuncExist:109,Arguments:110,Super:111,SUPER:112,FUNC_EXIST:113,CALL_START:114,CALL_END:115,ArgList:116,THIS:117,"@":118,"[":119,"]":120,RangeDots:121,"..":122,Arg:123,SimpleArgs:124,TRY:125,Catch:126,FINALLY:127,CATCH:128,THROW:129,"(":130,")":131,WhileSource:132,WHILE:133,WHEN:134,UNTIL:135,Loop:136,LOOP:137,ForBody:138,FOR:139,BY:140,ForStart:141,ForSource:142,ForVariables:143,OWN:144,ForValue:145,FORIN:146,
FOROF:147,FORFROM:148,SWITCH:149,Whens:150,ELSE:151,When:152,LEADING_WHEN:153,IfBlock:154,IF:155,POST_IF:156,UNARY:157,UNARY_MATH:158,"-":159,"+":160,"--":161,"++":162,"?":163,MATH:164,"**":165,SHIFT:166,COMPARE:167,"\x26":168,"^":169,"|":170,"\x26\x26":171,"||":172,"BIN?":173,RELATION:174,COMPOUND_ASSIGN:175,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",12:"STATEMENT",28:"YIELD",29:"FROM",31:"INDENT",32:"OUTDENT",34:"IDENTIFIER",36:"PROPERTY",38:"NUMBER",40:"STRING",41:"STRING_START",42:"STRING_END",
44:"REGEX",45:"REGEX_START",46:"REGEX_END",48:"JS",49:"UNDEFINED",50:"NULL",51:"BOOL",52:"INFINITY",53:"NAN",55:"\x3d",58:":",61:"RETURN",62:"HERECOMMENT",63:"PARAM_START",65:"PARAM_END",67:"-\x3e",68:"\x3d\x3e",70:",",73:"...",82:".",83:"?.",84:"::",85:"?::",87:"INDEX_START",89:"INDEX_END",90:"INDEX_SOAK",92:"{",94:"}",95:"CLASS",96:"EXTENDS",97:"IMPORT",102:"AS",103:"DEFAULT",104:"IMPORT_ALL",105:"EXPORT",107:"EXPORT_ALL",112:"SUPER",113:"FUNC_EXIST",114:"CALL_START",115:"CALL_END",117:"THIS",118:"@",
119:"[",120:"]",122:"..",125:"TRY",127:"FINALLY",128:"CATCH",129:"THROW",130:"(",131:")",133:"WHILE",134:"WHEN",135:"UNTIL",137:"LOOP",139:"FOR",140:"BY",144:"OWN",146:"FORIN",147:"FOROF",148:"FORFROM",149:"SWITCH",151:"ELSE",153:"LEADING_WHEN",155:"IF",156:"POST_IF",157:"UNARY",158:"UNARY_MATH",159:"-",160:"+",161:"--",162:"++",163:"?",164:"MATH",165:"**",166:"SHIFT",167:"COMPARE",168:"\x26",169:"^",170:"|",171:"\x26\x26",172:"||",173:"BIN?",174:"RELATION",175:"COMPOUND_ASSIGN"},productions_:[0,
[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[5,1],[8,1],[8,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[27,1],[27,2],[27,3],[30,2],[30,3],[33,1],[35,1],[37,1],[37,1],[39,1],[39,3],[43,1],[43,3],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[47,1],[19,3],[19,4],[19,5],[56,1],[56,3],[56,5],[56,3],[56,5],[56,1],[59,1],[59,1],[59,1],[57,1],[57,1],[10,2],[10,1],[9,3],[9,2],[11,1],[17,5],[17,2],[66,1],[66,1],[69,0],[69,1],[64,0],[64,1],[64,3],[64,
4],[64,6],[71,1],[71,2],[71,3],[71,1],[72,1],[72,1],[72,1],[72,1],[76,2],[77,1],[77,2],[77,2],[77,1],[54,1],[54,1],[54,1],[15,1],[15,1],[15,1],[15,1],[15,1],[78,2],[78,2],[78,2],[78,2],[78,1],[78,1],[86,3],[86,2],[88,1],[88,1],[75,4],[93,0],[93,1],[93,3],[93,4],[93,6],[25,1],[25,2],[25,3],[25,4],[25,2],[25,3],[25,4],[25,5],[13,2],[13,4],[13,4],[13,5],[13,7],[13,6],[13,9],[100,1],[100,3],[100,4],[100,4],[100,6],[101,1],[101,3],[101,1],[101,3],[98,1],[99,3],[14,3],[14,5],[14,2],[14,4],[14,5],[14,6],
[14,3],[14,4],[14,7],[106,1],[106,3],[106,4],[106,4],[106,6],[108,1],[108,3],[108,3],[108,1],[16,3],[16,3],[16,3],[16,1],[111,1],[111,2],[109,0],[109,1],[110,2],[110,4],[81,1],[81,1],[60,2],[74,2],[74,4],[121,1],[121,1],[80,5],[91,3],[91,2],[91,2],[91,1],[116,1],[116,3],[116,4],[116,4],[116,6],[123,1],[123,1],[123,1],[124,1],[124,3],[21,2],[21,3],[21,4],[21,5],[126,3],[126,3],[126,2],[26,2],[79,3],[79,5],[132,2],[132,4],[132,2],[132,4],[22,2],[22,2],[22,2],[22,1],[136,2],[136,2],[23,2],[23,2],[23,
2],[138,2],[138,4],[138,2],[141,2],[141,3],[145,1],[145,1],[145,1],[145,1],[143,1],[143,3],[142,2],[142,2],[142,4],[142,4],[142,4],[142,6],[142,6],[142,2],[142,4],[24,5],[24,7],[24,4],[24,6],[150,1],[150,2],[152,3],[152,4],[154,3],[154,5],[20,1],[20,3],[20,3],[20,3],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,5],[18,4],[18,3]],performAction:function(a,q,qa,b,ua,c,e){a=c.length-
1;switch(ua){case 1:return this.$=b.addLocationDataFn(e[a],e[a])(new b.Block);case 2:return this.$=c[a];case 3:this.$=b.addLocationDataFn(e[a],e[a])(b.Block.wrap([c[a]]));break;case 4:this.$=b.addLocationDataFn(e[a-2],e[a])(c[a-2].push(c[a]));break;case 5:this.$=c[a-1];break;case 6:case 7:case 8:case 9:case 10:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 35:case 40:case 42:case 56:case 57:case 58:case 59:case 60:case 61:case 71:case 72:case 82:case 83:case 84:case 85:case 90:case 91:case 94:case 98:case 104:case 162:case 186:case 187:case 189:case 219:case 220:case 238:case 244:this.$=
c[a];break;case 11:this.$=b.addLocationDataFn(e[a],e[a])(new b.StatementLiteral(c[a]));break;case 27:this.$=b.addLocationDataFn(e[a],e[a])(new b.Op(c[a],new b.Value(new b.Literal(""))));break;case 28:case 248:case 249:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op(c[a-1],c[a]));break;case 29:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Op(c[a-2].concat(c[a-1]),c[a]));break;case 30:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Block);break;case 31:case 105:this.$=b.addLocationDataFn(e[a-2],e[a])(c[a-
1]);break;case 32:this.$=b.addLocationDataFn(e[a],e[a])(new b.IdentifierLiteral(c[a]));break;case 33:this.$=b.addLocationDataFn(e[a],e[a])(new b.PropertyName(c[a]));break;case 34:this.$=b.addLocationDataFn(e[a],e[a])(new b.NumberLiteral(c[a]));break;case 36:this.$=b.addLocationDataFn(e[a],e[a])(new b.StringLiteral(c[a]));break;case 37:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.StringWithInterpolations(c[a-1]));break;case 38:this.$=b.addLocationDataFn(e[a],e[a])(new b.RegexLiteral(c[a]));break;
case 39:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.RegexWithInterpolations(c[a-1].args));break;case 41:this.$=b.addLocationDataFn(e[a],e[a])(new b.PassthroughLiteral(c[a]));break;case 43:this.$=b.addLocationDataFn(e[a],e[a])(new b.UndefinedLiteral);break;case 44:this.$=b.addLocationDataFn(e[a],e[a])(new b.NullLiteral);break;case 45:this.$=b.addLocationDataFn(e[a],e[a])(new b.BooleanLiteral(c[a]));break;case 46:this.$=b.addLocationDataFn(e[a],e[a])(new b.InfinityLiteral(c[a]));break;case 47:this.$=
b.addLocationDataFn(e[a],e[a])(new b.NaNLiteral);break;case 48:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Assign(c[a-2],c[a]));break;case 49:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Assign(c[a-3],c[a]));break;case 50:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Assign(c[a-4],c[a-1]));break;case 51:case 87:case 92:case 93:case 95:case 96:case 97:case 221:case 222:this.$=b.addLocationDataFn(e[a],e[a])(new b.Value(c[a]));break;case 52:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Assign(b.addLocationDataFn(e[a-
2])(new b.Value(c[a-2])),c[a],"object",{operatorToken:b.addLocationDataFn(e[a-1])(new b.Literal(c[a-1]))}));break;case 53:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Assign(b.addLocationDataFn(e[a-4])(new b.Value(c[a-4])),c[a-1],"object",{operatorToken:b.addLocationDataFn(e[a-3])(new b.Literal(c[a-3]))}));break;case 54:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Assign(b.addLocationDataFn(e[a-2])(new b.Value(c[a-2])),c[a],null,{operatorToken:b.addLocationDataFn(e[a-1])(new b.Literal(c[a-1]))}));
break;case 55:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Assign(b.addLocationDataFn(e[a-4])(new b.Value(c[a-4])),c[a-1],null,{operatorToken:b.addLocationDataFn(e[a-3])(new b.Literal(c[a-3]))}));break;case 62:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Return(c[a]));break;case 63:this.$=b.addLocationDataFn(e[a],e[a])(new b.Return);break;case 64:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.YieldReturn(c[a]));break;case 65:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.YieldReturn);break;case 66:this.$=
b.addLocationDataFn(e[a],e[a])(new b.Comment(c[a]));break;case 67:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Code(c[a-3],c[a],c[a-1]));break;case 68:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Code([],c[a],c[a-1]));break;case 69:this.$=b.addLocationDataFn(e[a],e[a])("func");break;case 70:this.$=b.addLocationDataFn(e[a],e[a])("boundfunc");break;case 73:case 110:this.$=b.addLocationDataFn(e[a],e[a])([]);break;case 74:case 111:case 130:case 150:case 181:case 223:this.$=b.addLocationDataFn(e[a],
e[a])([c[a]]);break;case 75:case 112:case 131:case 151:case 182:this.$=b.addLocationDataFn(e[a-2],e[a])(c[a-2].concat(c[a]));break;case 76:case 113:case 132:case 152:case 183:this.$=b.addLocationDataFn(e[a-3],e[a])(c[a-3].concat(c[a]));break;case 77:case 114:case 134:case 154:case 185:this.$=b.addLocationDataFn(e[a-5],e[a])(c[a-5].concat(c[a-2]));break;case 78:this.$=b.addLocationDataFn(e[a],e[a])(new b.Param(c[a]));break;case 79:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Param(c[a-1],null,!0));
break;case 80:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Param(c[a-2],c[a]));break;case 81:case 188:this.$=b.addLocationDataFn(e[a],e[a])(new b.Expansion);break;case 86:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Splat(c[a-1]));break;case 88:this.$=b.addLocationDataFn(e[a-1],e[a])(c[a-1].add(c[a]));break;case 89:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Value(c[a-1],[].concat(c[a])));break;case 99:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Access(c[a]));break;case 100:this.$=b.addLocationDataFn(e[a-
1],e[a])(new b.Access(c[a],"soak"));break;case 101:this.$=b.addLocationDataFn(e[a-1],e[a])([b.addLocationDataFn(e[a-1])(new b.Access(new b.PropertyName("prototype"))),b.addLocationDataFn(e[a])(new b.Access(c[a]))]);break;case 102:this.$=b.addLocationDataFn(e[a-1],e[a])([b.addLocationDataFn(e[a-1])(new b.Access(new b.PropertyName("prototype"),"soak")),b.addLocationDataFn(e[a])(new b.Access(c[a]))]);break;case 103:this.$=b.addLocationDataFn(e[a],e[a])(new b.Access(new b.PropertyName("prototype")));
break;case 106:this.$=b.addLocationDataFn(e[a-1],e[a])(b.extend(c[a],{soak:!0}));break;case 107:this.$=b.addLocationDataFn(e[a],e[a])(new b.Index(c[a]));break;case 108:this.$=b.addLocationDataFn(e[a],e[a])(new b.Slice(c[a]));break;case 109:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Obj(c[a-2],c[a-3].generated));break;case 115:this.$=b.addLocationDataFn(e[a],e[a])(new b.Class);break;case 116:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Class(null,null,c[a]));break;case 117:this.$=b.addLocationDataFn(e[a-
2],e[a])(new b.Class(null,c[a]));break;case 118:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Class(null,c[a-1],c[a]));break;case 119:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Class(c[a]));break;case 120:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Class(c[a-1],null,c[a]));break;case 121:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Class(c[a-2],c[a]));break;case 122:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Class(c[a-3],c[a-1],c[a]));break;case 123:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.ImportDeclaration(null,
c[a]));break;case 124:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.ImportDeclaration(new b.ImportClause(c[a-2],null),c[a]));break;case 125:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.ImportDeclaration(new b.ImportClause(null,c[a-2]),c[a]));break;case 126:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.ImportDeclaration(new b.ImportClause(null,new b.ImportSpecifierList([])),c[a]));break;case 127:this.$=b.addLocationDataFn(e[a-6],e[a])(new b.ImportDeclaration(new b.ImportClause(null,new b.ImportSpecifierList(c[a-
4])),c[a]));break;case 128:this.$=b.addLocationDataFn(e[a-5],e[a])(new b.ImportDeclaration(new b.ImportClause(c[a-4],c[a-2]),c[a]));break;case 129:this.$=b.addLocationDataFn(e[a-8],e[a])(new b.ImportDeclaration(new b.ImportClause(c[a-7],new b.ImportSpecifierList(c[a-4])),c[a]));break;case 133:case 153:case 168:case 184:this.$=b.addLocationDataFn(e[a-3],e[a])(c[a-2]);break;case 135:this.$=b.addLocationDataFn(e[a],e[a])(new b.ImportSpecifier(c[a]));break;case 136:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ImportSpecifier(c[a-
2],c[a]));break;case 137:this.$=b.addLocationDataFn(e[a],e[a])(new b.ImportSpecifier(new b.Literal(c[a])));break;case 138:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ImportSpecifier(new b.Literal(c[a-2]),c[a]));break;case 139:this.$=b.addLocationDataFn(e[a],e[a])(new b.ImportDefaultSpecifier(c[a]));break;case 140:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ImportNamespaceSpecifier(new b.Literal(c[a-2]),c[a]));break;case 141:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ExportNamedDeclaration(new b.ExportSpecifierList([])));
break;case 142:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.ExportNamedDeclaration(new b.ExportSpecifierList(c[a-2])));break;case 143:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.ExportNamedDeclaration(c[a]));break;case 144:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.ExportNamedDeclaration(new b.Assign(c[a-2],c[a],null,{moduleDeclaration:"export"})));break;case 145:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.ExportNamedDeclaration(new b.Assign(c[a-3],c[a],null,{moduleDeclaration:"export"})));
break;case 146:this.$=b.addLocationDataFn(e[a-5],e[a])(new b.ExportNamedDeclaration(new b.Assign(c[a-4],c[a-1],null,{moduleDeclaration:"export"})));break;case 147:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ExportDefaultDeclaration(c[a]));break;case 148:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.ExportAllDeclaration(new b.Literal(c[a-2]),c[a]));break;case 149:this.$=b.addLocationDataFn(e[a-6],e[a])(new b.ExportNamedDeclaration(new b.ExportSpecifierList(c[a-4]),c[a]));break;case 155:this.$=b.addLocationDataFn(e[a],
e[a])(new b.ExportSpecifier(c[a]));break;case 156:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ExportSpecifier(c[a-2],c[a]));break;case 157:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.ExportSpecifier(c[a-2],new b.Literal(c[a])));break;case 158:this.$=b.addLocationDataFn(e[a],e[a])(new b.ExportSpecifier(new b.Literal(c[a])));break;case 159:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.TaggedTemplateCall(c[a-2],c[a],c[a-1]));break;case 160:case 161:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Call(c[a-
2],c[a],c[a-1]));break;case 163:this.$=b.addLocationDataFn(e[a],e[a])(new b.SuperCall);break;case 164:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.SuperCall(c[a]));break;case 165:this.$=b.addLocationDataFn(e[a],e[a])(!1);break;case 166:this.$=b.addLocationDataFn(e[a],e[a])(!0);break;case 167:this.$=b.addLocationDataFn(e[a-1],e[a])([]);break;case 169:case 170:this.$=b.addLocationDataFn(e[a],e[a])(new b.Value(new b.ThisLiteral));break;case 171:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Value(b.addLocationDataFn(e[a-
1])(new b.ThisLiteral),[b.addLocationDataFn(e[a])(new b.Access(c[a]))],"this"));break;case 172:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Arr([]));break;case 173:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Arr(c[a-2]));break;case 174:this.$=b.addLocationDataFn(e[a],e[a])("inclusive");break;case 175:this.$=b.addLocationDataFn(e[a],e[a])("exclusive");break;case 176:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Range(c[a-3],c[a-1],c[a-2]));break;case 177:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Range(c[a-
2],c[a],c[a-1]));break;case 178:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Range(c[a-1],null,c[a]));break;case 179:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Range(null,c[a],c[a-1]));break;case 180:this.$=b.addLocationDataFn(e[a],e[a])(new b.Range(null,null,c[a]));break;case 190:this.$=b.addLocationDataFn(e[a-2],e[a])([].concat(c[a-2],c[a]));break;case 191:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Try(c[a]));break;case 192:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Try(c[a-1],c[a][0],
c[a][1]));break;case 193:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Try(c[a-2],null,null,c[a]));break;case 194:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Try(c[a-3],c[a-2][0],c[a-2][1],c[a]));break;case 195:this.$=b.addLocationDataFn(e[a-2],e[a])([c[a-1],c[a]]);break;case 196:this.$=b.addLocationDataFn(e[a-2],e[a])([b.addLocationDataFn(e[a-1])(new b.Value(c[a-1])),c[a]]);break;case 197:this.$=b.addLocationDataFn(e[a-1],e[a])([null,c[a]]);break;case 198:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Throw(c[a]));
break;case 199:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Parens(c[a-1]));break;case 200:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Parens(c[a-2]));break;case 201:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.While(c[a]));break;case 202:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.While(c[a-2],{guard:c[a]}));break;case 203:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.While(c[a],{invert:!0}));break;case 204:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.While(c[a-2],{invert:!0,guard:c[a]}));
break;case 205:this.$=b.addLocationDataFn(e[a-1],e[a])(c[a-1].addBody(c[a]));break;case 206:case 207:this.$=b.addLocationDataFn(e[a-1],e[a])(c[a].addBody(b.addLocationDataFn(e[a-1])(b.Block.wrap([c[a-1]]))));break;case 208:this.$=b.addLocationDataFn(e[a],e[a])(c[a]);break;case 209:this.$=b.addLocationDataFn(e[a-1],e[a])((new b.While(b.addLocationDataFn(e[a-1])(new b.BooleanLiteral("true")))).addBody(c[a]));break;case 210:this.$=b.addLocationDataFn(e[a-1],e[a])((new b.While(b.addLocationDataFn(e[a-
1])(new b.BooleanLiteral("true")))).addBody(b.addLocationDataFn(e[a])(b.Block.wrap([c[a]]))));break;case 211:case 212:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.For(c[a-1],c[a]));break;case 213:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.For(c[a],c[a-1]));break;case 214:this.$=b.addLocationDataFn(e[a-1],e[a])({source:b.addLocationDataFn(e[a])(new b.Value(c[a]))});break;case 215:this.$=b.addLocationDataFn(e[a-3],e[a])({source:b.addLocationDataFn(e[a-2])(new b.Value(c[a-2])),step:c[a]});break;
case 216:b=b.addLocationDataFn(e[a-1],e[a]);c[a].own=c[a-1].own;c[a].ownTag=c[a-1].ownTag;c[a].name=c[a-1][0];c[a].index=c[a-1][1];this.$=b(c[a]);break;case 217:this.$=b.addLocationDataFn(e[a-1],e[a])(c[a]);break;case 218:ua=b.addLocationDataFn(e[a-2],e[a]);c[a].own=!0;c[a].ownTag=b.addLocationDataFn(e[a-1])(new b.Literal(c[a-1]));this.$=ua(c[a]);break;case 224:this.$=b.addLocationDataFn(e[a-2],e[a])([c[a-2],c[a]]);break;case 225:this.$=b.addLocationDataFn(e[a-1],e[a])({source:c[a]});break;case 226:this.$=
b.addLocationDataFn(e[a-1],e[a])({source:c[a],object:!0});break;case 227:this.$=b.addLocationDataFn(e[a-3],e[a])({source:c[a-2],guard:c[a]});break;case 228:this.$=b.addLocationDataFn(e[a-3],e[a])({source:c[a-2],guard:c[a],object:!0});break;case 229:this.$=b.addLocationDataFn(e[a-3],e[a])({source:c[a-2],step:c[a]});break;case 230:this.$=b.addLocationDataFn(e[a-5],e[a])({source:c[a-4],guard:c[a-2],step:c[a]});break;case 231:this.$=b.addLocationDataFn(e[a-5],e[a])({source:c[a-4],step:c[a-2],guard:c[a]});
break;case 232:this.$=b.addLocationDataFn(e[a-1],e[a])({source:c[a],from:!0});break;case 233:this.$=b.addLocationDataFn(e[a-3],e[a])({source:c[a-2],guard:c[a],from:!0});break;case 234:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Switch(c[a-3],c[a-1]));break;case 235:this.$=b.addLocationDataFn(e[a-6],e[a])(new b.Switch(c[a-5],c[a-3],c[a-1]));break;case 236:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Switch(null,c[a-1]));break;case 237:this.$=b.addLocationDataFn(e[a-5],e[a])(new b.Switch(null,c[a-
3],c[a-1]));break;case 239:this.$=b.addLocationDataFn(e[a-1],e[a])(c[a-1].concat(c[a]));break;case 240:this.$=b.addLocationDataFn(e[a-2],e[a])([[c[a-1],c[a]]]);break;case 241:this.$=b.addLocationDataFn(e[a-3],e[a])([[c[a-2],c[a-1]]]);break;case 242:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.If(c[a-1],c[a],{type:c[a-2]}));break;case 243:this.$=b.addLocationDataFn(e[a-4],e[a])(c[a-4].addElse(b.addLocationDataFn(e[a-2],e[a])(new b.If(c[a-1],c[a],{type:c[a-2]}))));break;case 245:this.$=b.addLocationDataFn(e[a-
2],e[a])(c[a-2].addElse(c[a]));break;case 246:case 247:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.If(c[a],b.addLocationDataFn(e[a-2])(b.Block.wrap([c[a-2]])),{type:c[a-1],statement:!0}));break;case 250:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op("-",c[a]));break;case 251:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op("+",c[a]));break;case 252:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op("--",c[a]));break;case 253:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op("++",c[a]));break;case 254:this.$=
b.addLocationDataFn(e[a-1],e[a])(new b.Op("--",c[a-1],null,!0));break;case 255:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Op("++",c[a-1],null,!0));break;case 256:this.$=b.addLocationDataFn(e[a-1],e[a])(new b.Existence(c[a-1]));break;case 257:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Op("+",c[a-2],c[a]));break;case 258:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Op("-",c[a-2],c[a]));break;case 259:case 260:case 261:case 262:case 263:case 264:case 265:case 266:case 267:case 268:this.$=b.addLocationDataFn(e[a-
2],e[a])(new b.Op(c[a-1],c[a-2],c[a]));break;case 269:e=b.addLocationDataFn(e[a-2],e[a]);c="!"===c[a-1].charAt(0)?(new b.Op(c[a-1].slice(1),c[a-2],c[a])).invert():new b.Op(c[a-1],c[a-2],c[a]);this.$=e(c);break;case 270:this.$=b.addLocationDataFn(e[a-2],e[a])(new b.Assign(c[a-2],c[a],c[a-1]));break;case 271:this.$=b.addLocationDataFn(e[a-4],e[a])(new b.Assign(c[a-4],c[a-1],c[a-3]));break;case 272:this.$=b.addLocationDataFn(e[a-3],e[a])(new b.Assign(c[a-3],c[a],c[a-2]));break;case 273:this.$=b.addLocationDataFn(e[a-
2],e[a])(new b.Extends(c[a-2],c[a]))}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:6,10:20,11:21,12:c,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:t,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,
158:V,159:U,160:J,161:aa,162:Q},{1:[3]},{1:[2,2],6:wa},a(ta,[2,3]),a(ta,[2,6],{141:77,132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(ta,[2,7],{141:77,132:105,138:106,133:C,135:A,139:B,156:ya}),a(ta,[2,8]),a(sa,[2,14],{109:107,78:108,86:114,40:Ja,41:Ja,114:Ja,82:Ta,83:Ga,84:Ua,85:Fa,87:Pa,90:Qa,113:Na}),a(sa,[2,15],{86:114,109:117,78:118,82:Ta,83:Ga,84:Ua,85:Fa,87:Pa,90:Qa,113:Na,114:Ja}),a(sa,[2,16]),a(sa,
[2,17]),a(sa,[2,18]),a(sa,[2,19]),a(sa,[2,20]),a(sa,[2,21]),a(sa,[2,22]),a(sa,[2,23]),a(sa,[2,24]),a(sa,[2,25]),a(sa,[2,26]),a(za,[2,9]),a(za,[2,10]),a(za,[2,11]),a(za,[2,12]),a(za,[2,13]),a([1,6,32,42,131,133,135,139,156,163,164,165,166,167,168,169,170,171,172,173,174],ma,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,
8:122,12:c,28:fa,29:Ha,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,53:u,61:[1,119],62:m,63:g,67:r,68:p,92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,137:W,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),a(Aa,Ia,{55:[1,124]}),a(Aa,[2,95]),a(Aa,[2,96]),a(Aa,[2,97]),a(Aa,[2,98]),a(b,[2,162]),a([6,31,65,70],q,{64:125,71:126,72:127,33:129,60:130,74:131,75:132,34:d,73:qa,92:k,118:ua,119:e}),{30:135,31:va},{7:137,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:138,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:139,8:122,10:20,11:21,12:c,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:fa,33:70,
34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:140,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,
43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{15:142,16:143,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:144,60:71,74:53,75:54,77:141,79:28,80:29,81:30,92:k,111:31,112:H,117:y,118:T,119:S,
130:R},{15:142,16:143,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:144,60:71,74:53,75:54,77:145,79:28,80:29,81:30,92:k,111:31,112:H,117:y,118:T,119:S,130:R},a(Ka,xa,{96:[1,149],161:[1,146],162:[1,147],175:[1,148]}),a(sa,[2,244],{151:[1,150]}),{30:151,31:va},{30:152,31:va},a(sa,[2,208]),{30:153,31:va},{7:154,8:122,10:20,11:21,12:c,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:fa,31:[1,155],33:70,34:d,37:55,
38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Gb,[2,115],{47:27,79:28,80:29,81:30,111:31,74:53,75:54,37:55,43:57,33:70,60:71,39:80,15:142,16:143,54:144,30:156,77:158,31:va,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,
51:M,52:I,53:u,92:k,96:[1,157],112:H,117:y,118:T,119:S,130:R}),{7:159,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,
158:V,159:U,160:J,161:aa,162:Q},a(za,ab,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,7:160,12:c,28:fa,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,53:u,61:E,62:m,63:g,67:r,68:p,92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,137:W,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),a([1,6,
31,32,42,70,94,131,133,135,139,156],[2,66]),{33:165,34:d,39:161,40:l,41:x,92:[1,164],98:162,99:163,104:Hb},{25:168,33:169,34:d,92:[1,167],95:h,103:[1,170],107:[1,171]},a(Ka,[2,92]),a(Ka,[2,93]),a(Aa,[2,40]),a(Aa,[2,41]),a(Aa,[2,42]),a(Aa,[2,43]),a(Aa,[2,44]),a(Aa,[2,45]),a(Aa,[2,46]),a(Aa,[2,47]),{4:172,5:3,7:4,8:5,9:6,10:20,11:21,12:c,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:t,31:[1,173],33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,
48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:174,8:122,10:20,11:21,12:c,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:fa,31:bb,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,
53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,116:176,117:y,118:T,119:S,120:Ib,123:177,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Aa,[2,169]),a(Aa,[2,170],{35:181,36:Oa}),a([1,6,31,32,42,46,65,70,73,82,83,84,85,87,89,90,94,113,115,120,122,131,133,134,135,139,140,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],[2,163],
{110:183,114:ub}),{31:[2,69]},{31:[2,70]},a(La,[2,87]),a(La,[2,90]),{7:185,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,
157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:186,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,
162:Q},{7:187,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:189,8:122,10:20,11:21,
12:c,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:fa,30:188,31:va,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{33:194,34:d,60:195,74:196,75:197,80:190,92:k,
118:ua,119:S,143:191,144:[1,192],145:193},{142:198,146:[1,199],147:[1,200],148:[1,201]},a([6,31,70,94],Jb,{39:80,93:202,56:203,57:204,59:205,11:206,37:207,33:208,35:209,60:210,34:d,36:Oa,38:v,40:l,41:x,62:m,118:ua}),a(Kb,[2,34]),a(Kb,[2,35]),a(Aa,[2,38]),{15:142,16:211,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:144,60:71,74:53,75:54,77:212,79:28,80:29,81:30,92:k,111:31,112:H,117:y,118:T,119:S,130:R},a([1,6,29,31,32,40,41,42,55,58,65,70,73,82,83,84,
85,87,89,90,94,96,102,113,114,115,120,122,131,133,134,135,139,140,146,147,148,156,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175],[2,32]),a(Lb,[2,36]),{4:213,5:3,7:4,8:5,9:6,10:20,11:21,12:c,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:t,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,
112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},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,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,5:214,12:c,28:t,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,53:u,61:E,62:m,63:g,67:r,68:p,
92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,133:C,135:A,137:W,139:B,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),a(sa,[2,256]),{7:215,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,
129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:216,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,
136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:217,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,
149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:218,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,
159:U,160:J,161:aa,162:Q},{7:219,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:220,
8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:221,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:222,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:223,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:224,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,
38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:225,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,
45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:226,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,
52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:227,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,
63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:228,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,
77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(sa,[2,207]),a(sa,[2,212]),{7:229,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,
79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(sa,[2,206]),a(sa,[2,211]),{39:230,40:l,41:x,110:231,114:ub},a(La,[2,88]),a(Mb,[2,166]),{35:232,36:Oa},{35:233,36:Oa},a(La,[2,103],{35:234,36:Oa}),{35:235,36:Oa},a(La,[2,104]),{7:237,8:122,10:20,11:21,12:c,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:fa,33:70,
34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,73:Nb,74:53,75:54,77:40,79:28,80:29,81:30,88:236,91:238,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,121:239,122:vb,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{86:242,87:Pa,90:Qa},{110:243,114:ub},a(La,[2,89]),a(ta,[2,65],{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,
26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,7:244,12:c,28:fa,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,53:u,61:E,62:m,63:g,67:r,68:p,92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,133:ab,135:ab,139:ab,156:ab,137:W,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),a(Ma,[2,28],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,
168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:245,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,
160:J,161:aa,162:Q},{132:105,133:C,135:A,138:106,139:B,141:77,156:ya},a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,163,164,165,166,167,168,169,170,171,172,173,174],ma,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,7:120,8:122,12:c,28:fa,29:Ha,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,
53:u,61:E,62:m,63:g,67:r,68:p,92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,137:W,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),{6:[1,247],7:246,8:122,10:20,11:21,12:c,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:fa,31:[1,248],33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,
118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a([6,31],Ea,{69:251,65:[1,249],70:Ob}),a(Va,[2,74]),a(Va,[2,78],{55:[1,253],73:[1,252]}),a(Va,[2,81]),a(hb,[2,82]),a(hb,[2,83]),a(hb,[2,84]),a(hb,[2,85]),{35:181,36:Oa},{7:254,8:122,10:20,11:21,12:c,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:fa,31:bb,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,
49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,116:176,117:y,118:T,119:S,120:Ib,123:177,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(sa,[2,68]),{4:256,5:3,7:4,8:5,9:6,10:20,11:21,12:c,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:t,32:[1,255],33:70,34:d,37:55,38:v,39:80,
40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,159,160,164,165,166,167,168,169,170,171,172,173,174],[2,248],{141:77,132:102,138:103,163:da}),a(cb,[2,249],{141:77,
132:102,138:103,163:da,165:ha}),a(cb,[2,250],{141:77,132:102,138:103,163:da,165:ha}),a(cb,[2,251],{141:77,132:102,138:103,163:da,165:ha}),a(sa,[2,252],{40:xa,41:xa,82:xa,83:xa,84:xa,85:xa,87:xa,90:xa,113:xa,114:xa}),a(Mb,Ja,{109:107,78:108,86:114,82:Ta,83:Ga,84:Ua,85:Fa,87:Pa,90:Qa,113:Na}),{78:118,82:Ta,83:Ga,84:Ua,85:Fa,86:114,87:Pa,90:Qa,109:117,113:Na,114:Ja},a(Pb,Ia),a(sa,[2,253],{40:xa,41:xa,82:xa,83:xa,84:xa,85:xa,87:xa,90:xa,113:xa,114:xa}),a(sa,[2,254]),a(sa,[2,255]),{6:[1,259],7:257,8:122,
10:20,11:21,12:c,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:fa,31:[1,258],33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:260,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{30:261,31:va,155:[1,262]},a(sa,[2,191],{126:263,127:[1,264],128:[1,
265]}),a(sa,[2,205]),a(sa,[2,213]),{31:[1,266],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{150:267,152:268,153:ib},a(sa,[2,116]),{7:270,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,
79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Gb,[2,119],{30:271,31:va,40:xa,41:xa,82:xa,83:xa,84:xa,85:xa,87:xa,90:xa,113:xa,114:xa,96:[1,272]}),a(Ma,[2,198],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(za,db,{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,
166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(za,[2,123]),{29:[1,273],70:[1,274]},{29:[1,275]},{31:jb,33:280,34:d,94:[1,276],100:277,101:278,103:Ya},a([29,70],[2,139]),{102:[1,282]},{31:wb,33:287,34:d,94:[1,283],103:eb,106:284,108:285},a(za,[2,143]),{55:[1,289]},{7:290,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,
60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{29:[1,291]},{6:wa,131:[1,292]},{4:293,5:3,7:4,8:5,9:6,10:20,11:21,12:c,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:t,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,
53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a([6,31,70,120],Qb,{141:77,132:102,138:103,121:294,73:[1,295],122:vb,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(xb,[2,172]),a([6,31,120],Ea,{69:296,70:kb}),
a(Ra,[2,181]),{7:254,8:122,10:20,11:21,12:c,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:fa,31:bb,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,116:298,117:y,118:T,119:S,123:177,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,
161:aa,162:Q},a(Ra,[2,187]),a(Ra,[2,188]),a(Rb,[2,171]),a(Rb,[2,33]),a(b,[2,164]),{7:254,8:122,10:20,11:21,12:c,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:fa,31:bb,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,115:[1,299],116:300,117:y,118:T,119:S,123:177,125:P,129:Z,130:R,132:43,133:C,
135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{30:301,31:va,132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},a(Sb,[2,201],{141:77,132:102,138:103,133:C,134:[1,302],135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Sb,[2,203],{141:77,132:102,138:103,133:C,134:[1,303],135:A,139:B,159:ja,160:ba,
163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(sa,[2,209]),a(Za,[2,210],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,156,159,160,163,164,165,166,167,168,169,170,171,172,173,174],[2,214],{140:[1,304]}),a(lb,[2,217]),{33:194,34:d,60:195,74:196,75:197,92:k,118:ua,119:e,143:305,145:193},a(lb,[2,223],{70:[1,
306]}),a(mb,[2,219]),a(mb,[2,220]),a(mb,[2,221]),a(mb,[2,222]),a(sa,[2,216]),{7:307,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,
155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:308,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,
161:aa,162:Q},{7:309,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(nb,Ea,{69:310,
70:Tb}),a(Ba,[2,111]),a(Ba,[2,51],{58:[1,312]}),a(Ub,[2,60],{55:[1,313]}),a(Ba,[2,56]),a(Ub,[2,61]),a(yb,[2,57]),a(yb,[2,58]),a(yb,[2,59]),{46:[1,314],78:118,82:Ta,83:Ga,84:Ua,85:Fa,86:114,87:Pa,90:Qa,109:117,113:Na,114:Ja},a(Pb,xa),{6:wa,42:[1,315]},a(ta,[2,4]),a(Vb,[2,257],{141:77,132:102,138:103,163:da,164:ga,165:ha}),a(Vb,[2,258],{141:77,132:102,138:103,163:da,164:ga,165:ha}),a(cb,[2,259],{141:77,132:102,138:103,163:da,165:ha}),a(cb,[2,260],{141:77,132:102,138:103,163:da,165:ha}),a([1,6,31,32,
42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,166,167,168,169,170,171,172,173,174],[2,261],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173],[2,262],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,168,169,170,171,172,173],[2,263],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,
165:ha,166:ka,167:na,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,169,170,171,172,173],[2,264],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,170,171,172,173],[2,265],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,171,172,173],[2,266],
{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,172,173],[2,267],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,174:ea}),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,173],[2,268],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,174:ea}),a([1,
6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,140,156,167,168,169,170,171,172,173,174],[2,269],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka}),a(Za,[2,247],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Za,[2,246],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(b,[2,159]),a(b,[2,
160]),a(La,[2,99]),a(La,[2,100]),a(La,[2,101]),a(La,[2,102]),{89:[1,316]},{73:Nb,89:[2,107],121:317,122:vb,132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{89:[2,108]},{7:318,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,
63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,89:[2,180],92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Wb,[2,174]),a(Wb,Xb),a(La,[2,106]),a(b,[2,161]),a(ta,[2,64],{141:77,132:102,138:103,133:db,135:db,139:db,156:db,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ma,[2,29],{141:77,132:102,138:103,159:ja,
160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ma,[2,48],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:319,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,
79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:320,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,
105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{66:321,67:r,68:p},a(Sa,fb,{72:127,33:129,60:130,74:131,75:132,71:322,34:d,73:qa,92:k,118:ua,119:e}),{6:Yb,31:Zb},a(Va,[2,79]),{7:325,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,
54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Ra,Qb,{141:77,132:102,138:103,73:[1,326],133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a($b,[2,30]),{6:wa,32:[1,327]},a(Ma,[2,270],{141:77,132:102,138:103,159:ja,160:ba,
163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:328,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,
154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:329,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,
160:J,161:aa,162:Q},a(Ma,[2,273],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(sa,[2,245]),{7:330,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,
118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(sa,[2,192],{127:[1,331]}),{30:332,31:va},{30:335,31:va,33:333,34:d,75:334,92:k},{150:336,152:268,153:ib},{32:[1,337],151:[1,338],152:339,153:ib},a(ob,[2,238]),{7:341,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,
52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,124:340,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(ac,[2,117],{141:77,132:102,138:103,30:342,31:va,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(sa,[2,120]),{7:343,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{39:344,40:l,41:x},{92:[1,346],99:345,104:Hb},{39:347,40:l,41:x},{29:[1,348]},
a(nb,Ea,{69:349,70:pb}),a(Ba,[2,130]),{31:jb,33:280,34:d,100:351,101:278,103:Ya},a(Ba,[2,135],{102:[1,352]}),a(Ba,[2,137],{102:[1,353]}),{33:354,34:d},a(za,[2,141]),a(nb,Ea,{69:355,70:zb}),a(Ba,[2,150]),{31:wb,33:287,34:d,103:eb,106:357,108:285},a(Ba,[2,155],{102:[1,358]}),a(Ba,[2,158]),{6:[1,360],7:359,8:122,10:20,11:21,12:c,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:fa,31:[1,361],33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,
50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Ab,[2,147],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{39:362,40:l,41:x},a(Aa,[2,199]),{6:wa,32:[1,363]},{7:364,8:122,10:20,
11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a([12,28,34,38,40,41,44,45,48,49,50,51,52,53,61,62,
63,67,68,92,95,97,105,112,117,118,119,125,129,130,133,135,137,139,149,155,157,158,159,160,161,162],Xb,{6:gb,31:gb,70:gb,120:gb}),{6:qb,31:rb,120:[1,365]},a([6,31,32,115,120],fb,{15:7,16:8,17:9,18:10,19:11,20:12,21:13,22:14,23:15,24:16,25:17,26:18,27:19,10:20,11:21,13:23,14:24,54:26,47:27,79:28,80:29,81:30,111:31,66:33,77:40,154:41,132:43,136:44,138:45,74:53,75:54,37:55,43:57,33:70,60:71,141:77,39:80,8:122,76:179,7:254,123:368,12:c,28:fa,34:d,38:v,40:l,41:x,44:F,45:w,48:z,49:n,50:G,51:M,52:I,53:u,
61:E,62:m,63:g,67:r,68:p,73:Wa,92:k,95:h,97:K,105:O,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,133:C,135:A,137:W,139:B,149:N,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q}),a(Sa,Ea,{69:369,70:kb}),a(b,[2,167]),a([6,31,115],Ea,{69:370,70:kb}),a(bc,[2,242]),{7:371,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,
68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:372,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,
81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:373,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,
112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(lb,[2,218]),{33:194,34:d,60:195,74:196,75:197,92:k,118:ua,119:e,145:374},a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,135,139,156],[2,225],{141:77,132:102,138:103,134:[1,375],140:[1,376],159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Bb,[2,226],{141:77,132:102,138:103,134:[1,377],159:ja,
160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Bb,[2,232],{141:77,132:102,138:103,134:[1,378],159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{6:cc,31:dc,94:[1,379]},a(Cb,fb,{39:80,57:204,59:205,11:206,37:207,33:208,35:209,60:210,56:382,34:d,36:Oa,38:v,40:l,41:x,62:m,118:ua}),{7:383,8:122,10:20,11:21,12:c,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:fa,31:[1,
384],33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:385,8:122,10:20,11:21,12:c,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:fa,31:[1,386],33:70,34:d,37:55,
38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Aa,[2,39]),a(Lb,[2,37]),a(La,[2,105]),{7:387,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,
37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,89:[2,178],92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{89:[2,179],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},
a(Ma,[2,49],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{32:[1,388],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{30:389,31:va},a(Va,[2,75]),{33:129,34:d,60:130,71:390,72:127,73:qa,74:131,75:132,92:k,118:ua,119:e},a(ec,q,{71:126,72:127,33:129,60:130,74:131,75:132,64:391,34:d,73:qa,92:k,118:ua,119:e}),a(Va,[2,80],{141:77,
132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ra,gb),a($b,[2,31]),{32:[1,392],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},a(Ma,[2,272],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{30:393,31:va,132:102,133:C,135:A,138:103,139:B,
141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{30:394,31:va},a(sa,[2,193]),{30:395,31:va},{30:396,31:va},a(Db,[2,197]),{32:[1,397],151:[1,398],152:339,153:ib},a(sa,[2,236]),{30:399,31:va},a(ob,[2,239]),{30:400,31:va,70:[1,401]},a(fc,[2,189],{141:77,132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(sa,[2,118]),a(ac,[2,121],{141:77,132:102,138:103,
30:402,31:va,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(za,[2,124]),{29:[1,403]},{31:jb,33:280,34:d,100:404,101:278,103:Ya},a(za,[2,125]),{39:405,40:l,41:x},{6:sb,31:tb,94:[1,406]},a(Cb,fb,{33:280,101:409,34:d,103:Ya}),a(Sa,Ea,{69:410,70:pb}),{33:411,34:d},{33:412,34:d},{29:[2,140]},{6:Eb,31:Fb,94:[1,413]},a(Cb,fb,{33:287,108:416,34:d,103:eb}),a(Sa,Ea,{69:417,70:zb}),{33:418,34:d,103:[1,419]},a(Ab,[2,144],{141:77,132:102,
138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:420,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,
136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:421,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,
149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(za,[2,148]),{131:[1,422]},{120:[1,423],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},a(xb,[2,173]),{7:254,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,
67:r,68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,123:424,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:254,8:122,10:20,11:21,12:c,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:fa,31:bb,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,
68:p,73:Wa,74:53,75:54,76:179,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,116:425,117:y,118:T,119:S,123:177,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(Ra,[2,182]),{6:qb,31:rb,32:[1,426]},{6:qb,31:rb,115:[1,427]},a(Za,[2,202],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Za,[2,204],{141:77,132:102,138:103,
133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Za,[2,215],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(lb,[2,224]),{7:428,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,
60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:429,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,
68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:430,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,
81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:431,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,
112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(xb,[2,109]),{11:206,33:208,34:d,35:209,36:Oa,37:207,38:v,39:80,40:l,41:x,56:432,57:204,59:205,60:210,62:m,118:ua},a(ec,Jb,{39:80,56:203,57:204,59:205,11:206,37:207,33:208,35:209,60:210,93:433,34:d,36:Oa,38:v,40:l,41:x,62:m,118:ua}),a(Ba,[2,112]),a(Ba,[2,52],{141:77,132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,
167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:434,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,
159:U,160:J,161:aa,162:Q},a(Ba,[2,54],{141:77,132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),{7:435,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,
112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{89:[2,177],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},a(sa,[2,50]),a(sa,[2,67]),a(Va,[2,76]),a(Sa,Ea,{69:436,70:Ob}),a(sa,[2,271]),a(bc,[2,243]),a(sa,[2,194]),a(Db,[2,195]),a(Db,[2,196]),a(sa,[2,234]),{30:437,31:va},{32:[1,438]},a(ob,[2,240],{6:[1,
439]}),{7:440,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},a(sa,[2,122]),{39:441,40:l,
41:x},a(nb,Ea,{69:442,70:pb}),a(za,[2,126]),{29:[1,443]},{33:280,34:d,101:444,103:Ya},{31:jb,33:280,34:d,100:445,101:278,103:Ya},a(Ba,[2,131]),{6:sb,31:tb,32:[1,446]},a(Ba,[2,136]),a(Ba,[2,138]),a(za,[2,142],{29:[1,447]}),{33:287,34:d,103:eb,108:448},{31:wb,33:287,34:d,103:eb,106:449,108:285},a(Ba,[2,151]),{6:Eb,31:Fb,32:[1,450]},a(Ba,[2,156]),a(Ba,[2,157]),a(Ab,[2,145],{141:77,132:102,138:103,133:C,135:A,139:B,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,
174:ea}),{32:[1,451],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},a(Aa,[2,200]),a(Aa,[2,176]),a(Ra,[2,183]),a(Sa,Ea,{69:452,70:kb}),a(Ra,[2,184]),a(b,[2,168]),a([1,6,31,32,42,65,70,73,89,94,115,120,122,131,133,134,135,139,156],[2,227],{141:77,132:102,138:103,140:[1,453],159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Bb,[2,229],{141:77,132:102,138:103,
134:[1,454],159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ma,[2,228],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ma,[2,233],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ba,[2,113]),a(Sa,Ea,{69:455,70:Tb}),{32:[1,456],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,
164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{32:[1,457],132:102,133:C,135:A,138:103,139:B,141:77,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea},{6:Yb,31:Zb,32:[1,458]},{32:[1,459]},a(sa,[2,237]),a(ob,[2,241]),a(fc,[2,190],{141:77,132:102,138:103,133:C,135:A,139:B,156:oa,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(za,[2,128]),{6:sb,31:tb,94:[1,460]},{39:461,
40:l,41:x},a(Ba,[2,132]),a(Sa,Ea,{69:462,70:pb}),a(Ba,[2,133]),{39:463,40:l,41:x},a(Ba,[2,152]),a(Sa,Ea,{69:464,70:zb}),a(Ba,[2,153]),a(za,[2,146]),{6:qb,31:rb,32:[1,465]},{7:466,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,
118:T,119:S,125:P,129:Z,130:R,132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{7:467,8:122,10:20,11:21,12:c,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:fa,33:70,34:d,37:55,38:v,39:80,40:l,41:x,43:57,44:F,45:w,47:27,48:z,49:n,50:G,51:M,52:I,53:u,54:26,60:71,61:E,62:m,63:g,66:33,67:r,68:p,74:53,75:54,77:40,79:28,80:29,81:30,92:k,95:h,97:K,105:O,111:31,112:H,117:y,118:T,119:S,125:P,129:Z,130:R,
132:43,133:C,135:A,136:44,137:W,138:45,139:B,141:77,149:N,154:41,155:X,157:Y,158:V,159:U,160:J,161:aa,162:Q},{6:cc,31:dc,32:[1,468]},a(Ba,[2,53]),a(Ba,[2,55]),a(Va,[2,77]),a(sa,[2,235]),{29:[1,469]},a(za,[2,127]),{6:sb,31:tb,32:[1,470]},a(za,[2,149]),{6:Eb,31:Fb,32:[1,471]},a(Ra,[2,185]),a(Ma,[2,230],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ma,[2,231],{141:77,132:102,138:103,159:ja,160:ba,163:da,164:ga,165:ha,166:ka,
167:na,168:L,169:ia,170:pa,171:ca,172:la,173:ra,174:ea}),a(Ba,[2,114]),{39:472,40:l,41:x},a(Ba,[2,134]),a(Ba,[2,154]),a(za,[2,129])],defaultActions:{68:[2,69],69:[2,70],238:[2,108],354:[2,140]},parseError:function(a,b){if(b.recoverable)this.trace(a);else{var e=function(a,b){this.message=a;this.hash=b};e.prototype=Error;throw new e(a,b);}},parse:function(a){var b=[0],e=[null],c=[],q=this.table,qa="",ua=0,d=0,f=0,g=c.slice.call(arguments,1),va=Object.create(this.lexer),h={},Ka;for(Ka in this.yy)Object.prototype.hasOwnProperty.call(this.yy,
Ka)&&(h[Ka]=this.yy[Ka]);va.setInput(a,h);h.lexer=va;h.parser=this;"undefined"==typeof va.yylloc&&(va.yylloc={});Ka=va.yylloc;c.push(Ka);var m=va.options&&va.options.ranges;this.parseError="function"===typeof h.parseError?h.parseError:Object.getPrototypeOf(this).parseError;for(var p,r,Ia,k,n={},l,D;;){Ia=b[b.length-1];if(this.defaultActions[Ia])k=this.defaultActions[Ia];else{if(null===p||"undefined"==typeof p)p=va.lex()||1,"number"!==typeof p&&(p=this.symbols_[p]||p);k=q[Ia]&&q[Ia][p]}if("undefined"===
typeof k||!k.length||!k[0]){var u;D=[];for(l in q[Ia])this.terminals_[l]&&2<l&&D.push("'"+this.terminals_[l]+"'");u=va.showPosition?"Parse error on line "+(ua+1)+":\n"+va.showPosition()+"\nExpecting "+D.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(ua+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'");this.parseError(u,{text:va.match,token:this.terminals_[p]||p,line:va.yylineno,loc:Ka,expected:D})}if(k[0]instanceof Array&&1<k.length)throw Error("Parse Error: multiple actions possible at state: "+
Ia+", token: "+p);switch(k[0]){case 1:b.push(p);e.push(va.yytext);c.push(va.yylloc);b.push(k[1]);p=null;r?(p=r,r=null):(d=va.yyleng,qa=va.yytext,ua=va.yylineno,Ka=va.yylloc,0<f&&f--);break;case 2:D=this.productions_[k[1]][1];n.$=e[e.length-D];n._$={first_line:c[c.length-(D||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(D||1)].first_column,last_column:c[c.length-1].last_column};m&&(n._$.range=[c[c.length-(D||1)].range[0],c[c.length-1].range[1]]);Ia=this.performAction.apply(n,
[qa,d,ua,h,k[1],e,c].concat(g));if("undefined"!==typeof Ia)return Ia;D&&(b=b.slice(0,-2*D),e=e.slice(0,-1*D),c=c.slice(0,-1*D));b.push(this.productions_[k[1]][0]);e.push(n.$);c.push(n._$);k=q[b[b.length-2]][b[b.length-1]];b.push(k);break;case 3:return!0}}}};f.prototype=gc;gc.Parser=f;return new f}();"undefined"!==typeof t&&"undefined"!==typeof f&&(f.parser=wa,f.Parser=wa.Parser,f.parse=function(){return wa.parse.apply(wa,arguments)},f.main=function(D){D[1]||(console.log("Usage: "+D[0]+" FILE"),process.exit(1));
D=t("fs").readFileSync(t("path").normalize(D[1]),"utf8");return f.parser.parse(D)},"undefined"!==typeof ta&&t.main===ta&&f.main(process.argv.slice(1)));return ta.exports}();t["./scope"]=function(){var f={};(function(){var t=[].indexOf||function(f){for(var D=0,a=this.length;D<a;D++)if(D in this&&this[D]===f)return D;return-1};f.Scope=function(){function f(f,a,c,t){var d,D;this.parent=f;this.expressions=a;this.method=c;this.referencedVars=t;this.variables=[{name:"arguments",type:"arguments"}];this.positions=
{};this.parent||(this.utilities={});this.root=null!=(d=null!=(D=this.parent)?D.root:void 0)?d:this}f.prototype.add=function(f,a,c){return this.shared&&!c?this.parent.add(f,a,c):Object.prototype.hasOwnProperty.call(this.positions,f)?this.variables[this.positions[f]].type=a:this.positions[f]=this.variables.push({name:f,type:a})-1};f.prototype.namedMethod=function(){var f;return null!=(f=this.method)&&f.name||!this.parent?this.method:this.parent.namedMethod()};f.prototype.find=function(f){if(this.check(f))return!0;
this.add(f,"var");return!1};f.prototype.parameter=function(f){if(!this.shared||!this.parent.check(f,!0))return this.add(f,"param")};f.prototype.check=function(f){var a;return!!(this.type(f)||null!=(a=this.parent)&&a.check(f))};f.prototype.temporary=function(f,a,c){null==c&&(c=!1);return c?(c=f.charCodeAt(0),f=122-c,c=String.fromCharCode(c+a%(f+1)),a=Math.floor(a/(f+1)),""+c+(a||"")):""+f+(a||"")};f.prototype.type=function(f){var a,c,D,d;D=this.variables;a=0;for(c=D.length;a<c;a++)if(d=D[a],d.name===
f)return d.type;return null};f.prototype.freeVariable=function(f,a){var c,D,d;null==a&&(a={});for(c=0;;){d=this.temporary(f,c,a.single);if(!(this.check(d)||0<=t.call(this.root.referencedVars,d)))break;c++}(null!=(D=a.reserve)?D:1)&&this.add(d,"var",!0);return d};f.prototype.assign=function(f,a){this.add(f,{value:a,assigned:!0},!0);return this.hasAssignments=!0};f.prototype.hasDeclarations=function(){return!!this.declaredVariables().length};f.prototype.declaredVariables=function(){var f,a,c,t,d;t=
this.variables;d=[];a=0;for(c=t.length;a<c;a++)f=t[a],"var"===f.type&&d.push(f.name);return d.sort()};f.prototype.assignedVariables=function(){var f,a,c,t,d;c=this.variables;t=[];f=0;for(a=c.length;f<a;f++)d=c[f],d.type.assigned&&t.push(d.name+" \x3d "+d.type.value);return t};return f}()}).call(this);return f}();t["./nodes"]=function(){var f={};(function(){var ta,oa,D,a,c,Ca,d,v,l,x,F,w,z,n,G,M,I,u,E,m,g,r,p,k,h,K,O,H,y,T,S,P,Z,R,C,A,W,B,N,X,Y,V,U,J,aa,Q,ya,$a,Xa,ja,ba,da,ga,ha,ka,na,L,ia,pa,ca,la,
ra,ea,Da,sa,Ja,Ta,Ga,Ua,Fa,Pa,Qa,Na,za,ma=function(a,b){function c(){this.constructor=a}for(var qa in b)fa.call(b,qa)&&(a[qa]=b[qa]);c.prototype=b.prototype;a.prototype=new c;a.__super__=b.prototype;return a},fa={}.hasOwnProperty,Ha=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},Aa=[].slice;Error.stackTraceLimit=Infinity;J=t("./scope").Scope;a=t("./lexer");Ga=a.isUnassignable;r=a.JS_FORBIDDEN;n=t("./helpers");ca=n.compact;ea=n.flatten;ra=n.extend;
Fa=n.merge;la=n.del;a=n.addLocationDataFn;Ua=n.locationDataToString;Qa=n.throwSyntaxError;f.extend=ra;f.addLocationDataFn=a;ia=function(){return!0};P=function(){return!1};da=function(){return this};S=function(){this.negated=!this.negated;return this};f.CodeFragment=x=function(){function a(a,c){var b;this.code=""+c;this.locationData=null!=a?a.locationData:void 0;this.type=(null!=a?null!=(b=a.constructor)?b.name:void 0:void 0)||"unknown"}a.prototype.toString=function(){return""+this.code+(this.locationData?
": "+Ua(this.locationData):"")};return a}();Da=function(a){var b,c,qa,ua;ua=[];c=0;for(qa=a.length;c<qa;c++)b=a[c],ua.push(b.code);return ua.join("")};f.Base=a=function(){function a(){}a.prototype.compile=function(a,c){return Da(this.compileToFragments(a,c))};a.prototype.compileToFragments=function(a,c){a=ra({},a);c&&(a.level=c);c=this.unfoldSoak(a)||this;c.tab=a.indent;return a.level!==H&&c.isStatement(a)?c.compileClosure(a):c.compileNode(a)};a.prototype.compileClosure=function(a){var b,qa,ua,e;
(ua=this.jumps())&&ua.error("cannot use a pure statement in an expression");a.sharedScope=!0;ua=new l([],c.wrap([this]));b=[];if((qa=this.contains(Ja))||this.contains(Ta))b=[new ga],qa?(qa="apply",b.push(new u("arguments"))):qa="call",ua=new L(ua,[new ta(new N(qa))]);a=(new d(ua,b)).compileNode(a);if(ua.isGenerator||null!=(e=ua.base)&&e.isGenerator)a.unshift(this.makeCode("(yield* ")),a.push(this.makeCode(")"));return a};a.prototype.cache=function(a,c,qa){var b;if(null!=qa?qa(this):this.isComplex())return qa=
new u(a.scope.freeVariable("ref")),b=new D(qa,this),c?[b.compileToFragments(a,c),[this.makeCode(qa.value)]]:[b,qa];qa=c?this.compileToFragments(a,c):this;return[qa,qa]};a.prototype.cacheToCodeFragments=function(a){return[Da(a[0]),Da(a[1])]};a.prototype.makeReturn=function(a){var b;b=this.unwrapAll();return a?new d(new y(a+".push"),[b]):new V(b)};a.prototype.contains=function(a){var b;b=void 0;this.traverseChildren(!1,function(c){if(a(c))return b=c,!1});return b};a.prototype.lastNonComment=function(a){var b;
for(b=a.length;b--;)if(!(a[b]instanceof F))return a[b];return null};a.prototype.toString=function(a,c){var b;null==a&&(a="");null==c&&(c=this.constructor.name);b="\n"+a+c;this.soak&&(b+="?");this.eachChild(function(c){return b+=c.toString(a+ba)});return b};a.prototype.eachChild=function(a){var b,c,ua,e,d,f,g;if(!this.children)return this;f=this.children;c=0;for(e=f.length;c<e;c++)if(b=f[c],this[b])for(g=ea([this[b]]),ua=0,d=g.length;ua<d;ua++)if(b=g[ua],!1===a(b))return this;return this};a.prototype.traverseChildren=
function(a,c){return this.eachChild(function(b){if(!1!==c(b))return b.traverseChildren(a,c)})};a.prototype.invert=function(){return new A("!",this)};a.prototype.unwrapAll=function(){var a;for(a=this;a!==(a=a.unwrap()););return a};a.prototype.children=[];a.prototype.isStatement=P;a.prototype.jumps=P;a.prototype.isComplex=ia;a.prototype.isChainable=P;a.prototype.isAssignable=P;a.prototype.isNumber=P;a.prototype.unwrap=da;a.prototype.unfoldSoak=P;a.prototype.assigns=P;a.prototype.updateLocationDataIfMissing=
function(a){if(this.locationData)return this;this.locationData=a;return this.eachChild(function(b){return b.updateLocationDataIfMissing(a)})};a.prototype.error=function(a){return Qa(a,this.locationData)};a.prototype.makeCode=function(a){return new x(this,a)};a.prototype.wrapInBraces=function(a){return[].concat(this.makeCode("("),a,this.makeCode(")"))};a.prototype.joinFragmentArrays=function(a,c){var b,q,e,d,f;b=[];e=d=0;for(f=a.length;d<f;e=++d)q=a[e],e&&b.push(this.makeCode(c)),b=b.concat(q);return b};
return a}();f.Block=c=function(a){function b(a){this.expressions=ca(ea(a||[]))}ma(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 b,
c,e,q;q=this.expressions;c=0;for(e=q.length;c<e;c++)if(b=q[c],b.isStatement(a))return!0;return!1};b.prototype.jumps=function(a){var b,c,e,q;q=this.expressions;c=0;for(e=q.length;c<e;c++)if(b=q[c],b=b.jumps(a))return b};b.prototype.makeReturn=function(a){var b,c;for(c=this.expressions.length;c--;)if(b=this.expressions[c],!(b instanceof F)){this.expressions[c]=b.makeReturn(a);b instanceof V&&!b.expression&&this.expressions.splice(c,1);break}return this};b.prototype.compileToFragments=function(a,c){null==
a&&(a={});return a.scope?b.__super__.compileToFragments.call(this,a,c):this.compileRoot(a)};b.prototype.compileNode=function(a){var c,q,e,d,f,g,p;this.tab=a.indent;p=a.level===H;q=[];g=this.expressions;e=c=0;for(d=g.length;c<d;e=++c)f=g[e],f=f.unwrapAll(),f=f.unfoldSoak(a)||f,f instanceof b?q.push(f.compileNode(a)):p?(f.front=!0,e=f.compileToFragments(a),f.isStatement(a)||(e.unshift(this.makeCode(""+this.tab)),e.push(this.makeCode(";"))),q.push(e)):q.push(f.compileToFragments(a,h));if(p)return this.spaced?
[].concat(this.joinFragmentArrays(q,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(q,"\n");c=q.length?this.joinFragmentArrays(q,", "):[this.makeCode("void 0")];return 1<q.length&&a.level>=h?this.wrapInBraces(c):c};b.prototype.compileRoot=function(a){var b,c,e,q,d;a.indent=a.bare?"":ba;a.level=H;this.spaced=!0;a.scope=new J(null,this,null,null!=(e=a.referencedVars)?e:[]);d=a.locals||[];e=0;for(c=d.length;e<c;e++)q=d[e],a.scope.parameter(q);e=[];if(!a.bare){var f;f=this.expressions;c=[];b=q=0;
for(d=f.length;q<d;b=++q){b=f[b];if(!(b.unwrap()instanceof F))break;c.push(b)}q=this.expressions.slice(c.length);this.expressions=c;c.length&&(e=this.compileNode(Fa(a,{indent:""})),e.push(this.makeCode("\n")));this.expressions=q}c=this.compileWithDeclarations(a);return a.bare?c:[].concat(e,this.makeCode("(function() {\n"),c,this.makeCode("\n}).call(this);\n"))};b.prototype.compileWithDeclarations=function(a){var b,c,e,q,d,f;e=[];f=this.expressions;q=d=0;for(b=f.length;d<b&&(c=f[q],c=c.unwrap(),c instanceof
F||c instanceof y);q=++d);a=Fa(a,{level:H});q&&(c=this.expressions.splice(q,9E9),e=[this.spaced,!1],d=e[0],this.spaced=e[1],d=[this.compileNode(a),d],e=d[0],this.spaced=d[1],this.expressions=c);c=this.compileNode(a);d=a.scope;d.expressions===this&&(b=a.scope.hasDeclarations(),a=d.hasAssignments,b||a?(q&&e.push(this.makeCode("\n")),e.push(this.makeCode(this.tab+"var ")),b&&e.push(this.makeCode(d.declaredVariables().join(", "))),a&&(b&&e.push(this.makeCode(",\n"+(this.tab+ba))),e.push(this.makeCode(d.assignedVariables().join(",\n"+
(this.tab+ba))))),e.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):e.length&&c.length&&e.push(this.makeCode("\n")));return e.concat(c)};b.wrap=function(a){return 1===a.length&&a[0]instanceof b?a[0]:new b(a)};return b}(a);f.Literal=y=function(a){function b(a){this.value=a}ma(b,a);b.prototype.isComplex=P;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}(a);f.NumberLiteral=R=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(y);f.InfinityLiteral=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.compileNode=function(){return[this.makeCode("2e308")]};return b}(R);f.NaNLiteral=function(a){function b(){b.__super__.constructor.call(this,"NaN")}ma(b,a);b.prototype.compileNode=function(a){var b;b=[this.makeCode("0/0")];
return a.level>=K?this.wrapInBraces(b):b};return b}(R);f.StringLiteral=$a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(y);f.RegexLiteral=Y=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(y);f.PassthroughLiteral=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(y);f.IdentifierLiteral=u=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}
ma(b,a);b.prototype.isAssignable=ia;return b}(y);f.PropertyName=N=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.isAssignable=ia;return b}(y);f.StatementLiteral=ya=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.isStatement=ia;b.prototype.makeReturn=da;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}(y);f.ThisLiteral=ga=function(a){function b(){b.__super__.constructor.call(this,"this")}ma(b,a);b.prototype.compileNode=function(a){var b;a=null!=(b=a.scope.method)&&b.bound?a.scope.method.context:this.value;return[this.makeCode(a)]};return b}(y);f.UndefinedLiteral=na=function(a){function b(){b.__super__.constructor.call(this,"undefined")}ma(b,a);b.prototype.compileNode=function(a){return[this.makeCode(a.level>=
p?"(void 0)":"void 0")]};return b}(y);f.NullLiteral=Z=function(a){function b(){b.__super__.constructor.call(this,"null")}ma(b,a);return b}(y);f.BooleanLiteral=Ca=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(y);f.Return=V=function(a){function b(a){this.expression=a}ma(b,a);b.prototype.children=["expression"];b.prototype.isStatement=ia;b.prototype.makeReturn=da;b.prototype.jumps=da;b.prototype.compileToFragments=function(a,c){var qa,e;qa=null!=(e=this.expression)?
e.makeReturn():void 0;return!qa||qa instanceof b?b.__super__.compileToFragments.call(this,a,c):qa.compileToFragments(a,c)};b.prototype.compileNode=function(a){var b;b=[];b.push(this.makeCode(this.tab+("return"+(this.expression?" ":""))));this.expression&&(b=b.concat(this.expression.compileToFragments(a,O)));b.push(this.makeCode(";"));return b};return b}(a);f.YieldReturn=pa=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(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}(V);f.Value=L=function(a){function b(a,c,d){if(!c&&a instanceof b)return a;this.base=a;this.properties=c||[];d&&(this[d]=!0);return this}ma(b,a);b.prototype.children=["base","properties"];b.prototype.add=function(a){this.properties=this.properties.concat(a);return this};b.prototype.hasProperties=function(){return!!this.properties.length};b.prototype.bareLiteral=function(a){return!this.properties.length&&
this.base instanceof a};b.prototype.isArray=function(){return this.bareLiteral(oa)};b.prototype.isRange=function(){return this.bareLiteral(X)};b.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()};b.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()};b.prototype.isNumber=function(){return this.bareLiteral(R)};b.prototype.isString=function(){return this.bareLiteral($a)};b.prototype.isRegex=function(){return this.bareLiteral(Y)};b.prototype.isUndefined=
function(){return this.bareLiteral(na)};b.prototype.isNull=function(){return this.bareLiteral(Z)};b.prototype.isBoolean=function(){return this.bareLiteral(Ca)};b.prototype.isAtomic=function(){var a,b,c,e;e=this.properties.concat(this.base);a=0;for(b=e.length;a<b;a++)if(c=e[a],c.soak||c instanceof d)return!1;return!0};b.prototype.isNotCallable=function(){return this.isNumber()||this.isString()||this.isRegex()||this.isArray()||this.isRange()||this.isSplice()||this.isObject()||this.isUndefined()||this.isNull()||
this.isBoolean()};b.prototype.isStatement=function(a){return!this.properties.length&&this.base.isStatement(a)};b.prototype.assigns=function(a){return!this.properties.length&&this.base.assigns(a)};b.prototype.jumps=function(a){return!this.properties.length&&this.base.jumps(a)};b.prototype.isObject=function(a){return this.properties.length?!1:this.base instanceof C&&(!a||this.base.generated)};b.prototype.isSplice=function(){var a;a=this.properties;return a[a.length-1]instanceof aa};b.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)};b.prototype.unwrap=function(){return this.properties.length?this:this.base};b.prototype.cacheReference=function(a){var c,q,e,d;c=this.properties;e=c[c.length-1];if(2>this.properties.length&&!this.base.isComplex()&&(null==e||!e.isComplex()))return[this,this];c=new b(this.base,this.properties.slice(0,-1));c.isComplex()&&(q=new u(a.scope.freeVariable("base")),c=
new b(new B(new D(q,c))));if(!e)return[c,q];e.isComplex()&&(d=new u(a.scope.freeVariable("name")),e=new g(new D(d,e.index)),d=new g(d));return[c.add(e),new b(q||c.base,[d||e])]};b.prototype.compileNode=function(a){var b,c,e,q,d;this.base.front=this.front;d=this.properties;b=this.base.compileToFragments(a,d.length?p:null);d.length&&U.test(Da(b))&&b.push(this.makeCode("."));c=0;for(e=d.length;c<e;c++)q=d[c],b.push.apply(b,q.compileToFragments(a));return b};b.prototype.unfoldSoak=function(a){return null!=
this.unfoldedSoak?this.unfoldedSoak:this.unfoldedSoak=function(c){return function(){var q,e,qa,d,f;if(e=c.base.unfoldSoak(a))return(q=e.body.properties).push.apply(q,c.properties),e;f=c.properties;e=q=0;for(qa=f.length;q<qa;e=++q)if(d=f[e],d.soak)return d.soak=!1,q=new b(c.base,c.properties.slice(0,e)),qa=new b(c.base,c.properties.slice(e)),q.isComplex()&&(e=new u(a.scope.freeVariable("ref")),q=new B(new D(e,q)),qa.base=e),new E(new w(q),qa,{soak:!0});return!1}}(this)()};return b}(a);f.Comment=F=
function(a){function b(a){this.comment=a}ma(b,a);b.prototype.isStatement=ia;b.prototype.makeReturn=da;b.prototype.compileNode=function(a,b){var c;c=this.comment.replace(/^(\s*)#(?=\s)/gm,"$1 *");c="/*"+Pa(c,this.tab)+(0<=Ha.call(c,"\n")?"\n"+this.tab:"")+" */";(b||a.level)===H&&(c=a.indent+c);return[this.makeCode("\n"),this.makeCode(c)]};return b}(a);f.Call=d=function(a){function b(a,b,c){this.variable=a;this.args=null!=b?b:[];this.soak=c;this.isNew=!1;this.variable instanceof L&&this.variable.isNotCallable()&&
this.variable.error("literal is not a function")}ma(b,a);b.prototype.children=["variable","args"];b.prototype.newInstance=function(){var a,c;a=(null!=(c=this.variable)?c.base:void 0)||this.variable;a instanceof b&&!a.isNew?a.newInstance():this.isNew=!0;return this};b.prototype.unfoldSoak=function(a){var c,q,e,d,f;if(this.soak){if(this instanceof ja)c=new y(this.superReference(a)),q=new L(c);else{if(q=Na(a,this,"variable"))return q;q=(new L(this.variable)).cacheReference(a);c=q[0];q=q[1]}q=new b(q,
this.args);q.isNew=this.isNew;c=new y("typeof "+c.compile(a)+' \x3d\x3d\x3d "function"');return new E(c,new L(q),{soak:!0})}c=this;for(e=[];;)if(c.variable instanceof b)e.push(c),c=c.variable;else{if(!(c.variable instanceof L))break;e.push(c);if(!((c=c.variable.base)instanceof b))break}f=e.reverse();e=0;for(d=f.length;e<d;e++)c=f[e],q&&(c.variable instanceof b?c.variable=q:c.variable.base=q),q=Na(a,c,"variable");return q};b.prototype.compileNode=function(a){var b,c,e,q,d,f;null!=(e=this.variable)&&
(e.front=this.front);e=Q.compileSplattedArray(a,this.args,!0);if(e.length)return this.compileSplat(a,e);e=[];f=this.args;c=q=0;for(d=f.length;q<d;c=++q)b=f[c],c&&e.push(this.makeCode(", ")),e.push.apply(e,b.compileToFragments(a,h));b=[];this instanceof ja?(a=this.superReference(a)+(".call("+this.superThis(a)),e.length&&(a+=", "),b.push(this.makeCode(a))):(this.isNew&&b.push(this.makeCode("new ")),b.push.apply(b,this.variable.compileToFragments(a,p)),b.push(this.makeCode("(")));b.push.apply(b,e);b.push(this.makeCode(")"));
return b};b.prototype.compileSplat=function(a,b){var c,e,q,qa;if(this instanceof ja)return[].concat(this.makeCode(this.superReference(a)+".apply("+this.superThis(a)+", "),b,this.makeCode(")"));if(this.isNew)return c=this.tab+ba,[].concat(this.makeCode("(function(func, args, ctor) {\n"+c+"ctor.prototype \x3d func.prototype;\n"+c+"var child \x3d new ctor, result \x3d func.apply(child, args);\n"+c+"return Object(result) \x3d\x3d\x3d result ? result : child;\n"+this.tab+"})("),this.variable.compileToFragments(a,
h),this.makeCode(", "),b,this.makeCode(", function(){})"));c=[];e=new L(this.variable);(q=e.properties.pop())&&e.isComplex()?(qa=a.scope.freeVariable("ref"),c=c.concat(this.makeCode("("+qa+" \x3d "),e.compileToFragments(a,h),this.makeCode(")"),q.compileToFragments(a))):(e=e.compileToFragments(a,p),U.test(Da(e))&&(e=this.wrapInBraces(e)),q?(qa=Da(e),e.push.apply(e,q.compileToFragments(a))):qa="null",c=c.concat(e));return c.concat(this.makeCode(".apply("+qa+", "),b,this.makeCode(")"))};return b}(a);
f.SuperCall=ja=function(a){function b(a){b.__super__.constructor.call(this,null,null!=a?a:[new Q(new u("arguments"))]);this.isBare=null!=a}ma(b,a);b.prototype.superReference=function(a){var b,c,e,q,d,f,h;q=a.scope.namedMethod();if(null!=q&&q.klass){e=q.klass;d=q.name;h=q.variable;e.isComplex()&&(c=new u(a.scope.parent.freeVariable("base")),b=new L(new B(new D(c,e))),h.base=b,h.properties.splice(0,e.properties.length));if(d.isComplex()||d instanceof g&&d.index.isAssignable())f=new u(a.scope.parent.freeVariable("name")),
d=new g(new D(f,d.index)),h.properties.pop(),h.properties.push(d);b=[new ta(new N("__super__"))];q["static"]&&b.push(new ta(new N("constructor")));b.push(null!=f?new g(f):d);return(new L(null!=c?c:e,b)).compile(a)}return null!=q&&q.ctor?q.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}(d);f.RegexWithInterpolations=function(a){function b(a){null==a&&(a=[]);
b.__super__.constructor.call(this,new L(new u("RegExp")),a,!1)}ma(b,a);return b}(d);f.TaggedTemplateCall=function(a){function b(a,d,f){d instanceof $a&&(d=new Xa(c.wrap([new L(d)])));b.__super__.constructor.call(this,a,[d],f)}ma(b,a);b.prototype.compileNode=function(a){a.inTaggedTemplateCall=!0;return this.variable.compileToFragments(a,p).concat(this.args[0].compileToFragments(a,h))};return b}(d);f.Extends=M=function(a){function b(a,b){this.child=a;this.parent=b}ma(b,a);b.prototype.children=["child",
"parent"];b.prototype.compileToFragments=function(a){return(new d(new L(new y(za("extend",a))),[this.child,this.parent])).compileToFragments(a)};return b}(a);f.Access=ta=function(a){function b(a,b){this.name=a;this.soak="soak"===b}ma(b,a);b.prototype.children=["name"];b.prototype.compileToFragments=function(a){var b,c;a=this.name.compileToFragments(a);b=this.name.unwrap();return b instanceof N?(c=b.value,0<=Ha.call(r,c))?[this.makeCode('["')].concat(Aa.call(a),[this.makeCode('"]')]):[this.makeCode(".")].concat(Aa.call(a)):
[this.makeCode("[")].concat(Aa.call(a),[this.makeCode("]")])};b.prototype.isComplex=P;return b}(a);f.Index=g=function(a){function b(a){this.index=a}ma(b,a);b.prototype.children=["index"];b.prototype.compileToFragments=function(a){return[].concat(this.makeCode("["),this.index.compileToFragments(a,O),this.makeCode("]"))};b.prototype.isComplex=function(){return this.index.isComplex()};return b}(a);f.Range=X=function(a){function b(a,b,c){this.from=a;this.to=b;this.equals=(this.exclusive="exclusive"===
c)?"":"\x3d"}ma(b,a);b.prototype.children=["from","to"];b.prototype.compileVariables=function(a){var b,c;a=Fa(a,{top:!0});b=la(a,"isComplex");c=this.cacheToCodeFragments(this.from.cache(a,h,b));this.fromC=c[0];this.fromVar=c[1];c=this.cacheToCodeFragments(this.to.cache(a,h,b));this.toC=c[0];this.toVar=c[1];if(c=la(a,"step"))a=this.cacheToCodeFragments(c.cache(a,h,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!=c&&c.isNumber()?Number(this.stepVar):null};b.prototype.compileNode=function(a){var b,c,e,d,q,f,g,h,p,m;this.fromVar||this.compileVariables(a);if(!a.index)return this.compileArray(a);f=null!=this.fromNum&&null!=this.toNum;q=la(a,"index");g=(a=la(a,"name"))&&a!==q;m=q+" \x3d "+this.fromC;this.toC!==this.toVar&&(m+=", "+this.toC);this.step!==this.stepVar&&(m+=", "+this.step);d=[q+" \x3c"+this.equals,q+" \x3e"+this.equals];c=d[0];d=d[1];c=null!=this.stepNum?0<this.stepNum?
c+" "+this.toVar:d+" "+this.toVar:f?(h=[this.fromNum,this.toNum],e=h[0],p=h[1],h,e<=p?c+" "+p:d+" "+p):(b=this.stepVar?this.stepVar+" \x3e 0":this.fromVar+" \x3c\x3d "+this.toVar,b+" ? "+c+" "+this.toVar+" : "+d+" "+this.toVar);b=this.stepVar?q+" +\x3d "+this.stepVar:f?g?e<=p?"++"+q:"--"+q:e<=p?q+"++":q+"--":g?b+" ? ++"+q+" : --"+q:b+" ? "+q+"++ : "+q+"--";g&&(m=a+" \x3d "+m);g&&(b=a+" \x3d "+b);return[this.makeCode(m+"; "+c+"; "+b)]};b.prototype.compileArray=function(a){var b,c,e,d,q,f,g,h,p;if((c=
null!=this.fromNum&&null!=this.toNum)&&20>=Math.abs(this.fromNum-this.toNum))return b=function(){h=[];for(var a=f=this.fromNum,b=this.toNum;f<=b?a<=b:a>=b;f<=b?a++:a--)h.push(a);return h}.apply(this),this.exclusive&&b.pop(),[this.makeCode("["+b.join(", ")+"]")];d=this.tab+ba;e=a.scope.freeVariable("i",{single:!0});g=a.scope.freeVariable("results");q="\n"+d+g+" \x3d [];";c?(a.index=e,c=Da(this.compileNode(a))):(p=e+" \x3d "+this.fromC+(this.toC!==this.toVar?", "+this.toC:""),c=this.fromVar+" \x3c\x3d "+
this.toVar,c="var "+p+"; "+c+" ? "+e+" \x3c"+this.equals+" "+this.toVar+" : "+e+" \x3e"+this.equals+" "+this.toVar+"; "+c+" ? "+e+"++ : "+e+"--");e="{ "+g+".push("+e+"); }\n"+d+"return "+g+";\n"+a.indent;a=function(a){return null!=a?a.contains(Ja):void 0};if(a(this.from)||a(this.to))b=", arguments";return[this.makeCode("(function() {"+q+"\n"+d+"for ("+c+")"+e+"}).apply(this"+(null!=b?b:"")+")")]};return b}(a);f.Slice=aa=function(a){function b(a){this.range=a;b.__super__.constructor.call(this)}ma(b,
a);b.prototype.children=["range"];b.prototype.compileNode=function(a){var b,c,e,d,q;b=this.range;d=b.to;e=(b=b.from)&&b.compileToFragments(a,O)||[this.makeCode("0")];d&&(b=d.compileToFragments(a,O),c=Da(b),this.range.exclusive||-1!==+c)&&(q=", "+(this.range.exclusive?c:d.isNumber()?""+(+c+1):(b=d.compileToFragments(a,p),"+"+Da(b)+" + 1 || 9e9")));return[this.makeCode(".slice("+Da(e)+(q||"")+")")]};return b}(a);f.Obj=C=function(a){function b(a,b){this.generated=null!=b?b:!1;this.objects=this.properties=
a||[]}ma(b,a);b.prototype.children=["properties"];b.prototype.compileNode=function(a){var b,c,e,d,q,f,g,h,p,m,r,k,n;n=this.properties;if(this.generated)for(c=0,b=n.length;c<b;c++)e=n[c],e instanceof L&&e.error("cannot have an implicit value in an implicit object");c=b=0;for(e=n.length;b<e&&!(k=n[c],(k.variable||k).base instanceof B);c=++b);e=c<n.length;q=a.indent+=ba;p=this.lastNonComment(this.properties);b=[];e&&(r=a.scope.freeVariable("obj"),b.push(this.makeCode("(\n"+q+r+" \x3d ")));b.push(this.makeCode("{"+
(0===n.length||0===c?"}":"\n")));d=h=0;for(m=n.length;h<m;d=++h)k=n[d],d===c&&(0!==d&&b.push(this.makeCode("\n"+q+"}")),b.push(this.makeCode(",\n"))),g=d===n.length-1||d===c-1?"":k===p||k instanceof F?"\n":",\n",f=k instanceof F?"":q,e&&d<c&&(f+=ba),k instanceof D&&("object"!==k.context&&k.operatorToken.error("unexpected "+k.operatorToken.value),k.variable instanceof L&&k.variable.hasProperties()&&k.variable.error("invalid object key")),k instanceof L&&k["this"]&&(k=new D(k.properties[0].name,k,"object")),
k instanceof F||(d<c?k instanceof D||(k=new D(k,k,"object")):(k instanceof D?(d=k.variable,k=k.value):(k=k.base.cache(a),d=k[0],k=k[1],d instanceof u&&(d=new N(d.value))),k=new D(new L(new u(r),[new ta(d)]),k))),f&&b.push(this.makeCode(f)),b.push.apply(b,k.compileToFragments(a,H)),g&&b.push(this.makeCode(g));e?b.push(this.makeCode(",\n"+q+r+"\n"+this.tab+")")):0!==n.length&&b.push(this.makeCode("\n"+this.tab+"}"));return this.front&&!e?this.wrapInBraces(b):b};b.prototype.assigns=function(a){var b,
c,e,d;d=this.properties;b=0;for(c=d.length;b<c;b++)if(e=d[b],e.assigns(a))return!0;return!1};return b}(a);f.Arr=oa=function(a){function b(a){this.objects=a||[]}ma(b,a);b.prototype.children=["objects"];b.prototype.compileNode=function(a){var b,c,e,d,q;if(!this.objects.length)return[this.makeCode("[]")];a.indent+=ba;b=Q.compileSplattedArray(a,this.objects);if(b.length)return b;b=[];var f;q=this.objects;f=[];e=0;for(d=q.length;e<d;e++)c=q[e],f.push(c.compileToFragments(a,h));e=d=0;for(q=f.length;d<q;e=
++d)c=f[e],e&&b.push(this.makeCode(", ")),b.push.apply(b,c);0<=Da(b).indexOf("\n")?(b.unshift(this.makeCode("[\n"+a.indent)),b.push(this.makeCode("\n"+this.tab+"]"))):(b.unshift(this.makeCode("[")),b.push(this.makeCode("]")));return b};b.prototype.assigns=function(a){var b,c,e,d;d=this.objects;b=0;for(c=d.length;b<c;b++)if(e=d[b],e.assigns(a))return!0;return!1};return b}(a);f.Class=v=function(a){function b(a,b,d){this.variable=a;this.parent=b;this.body=null!=d?d:new c;this.boundFuncs=[];this.body.classBody=
!0}ma(b,a);b.prototype.children=["variable","parent","body"];b.prototype.defaultClassVariableName="_Class";b.prototype.determineName=function(){var a,b;if(!this.variable)return this.defaultClassVariableName;b=this.variable.properties;b=(a=b[b.length-1])?a instanceof ta&&a.name:this.variable.base;if(!(b instanceof u||b instanceof N))return this.defaultClassVariableName;b=b.value;a||(a=Ga(b))&&this.variable.error(a);return 0<=Ha.call(r,b)?"_"+b:b};b.prototype.setContext=function(a){return this.body.traverseChildren(!1,
function(b){if(b.classBody)return!1;if(b instanceof ga)return b.value=a;if(b instanceof l&&b.bound)return b.context=a})};b.prototype.addBoundFunctions=function(a){var b,c,e,d;d=this.boundFuncs;c=0;for(e=d.length;c<e;c++)b=d[c],b=(new L(new ga,[new ta(b)])).compile(a),this.ctor.body.unshift(new y(b+" \x3d "+za("bind",a)+"("+b+", this)"))};b.prototype.addProperties=function(a,b,c){var e,d,q,f;f=a.base.properties.slice(0);var qa;for(qa=[];e=f.shift();)e instanceof D&&(d=e.variable.base,delete e.context,
q=e.value,"constructor"===d.value?(this.ctor&&e.error("cannot define more than one constructor in a class"),q.bound&&e.error("cannot define a constructor as a bound function"),q instanceof l?e=this.ctor=q:(this.externalCtor=c.classScope.freeVariable("ctor"),e=new D(new u(this.externalCtor),q))):e.variable["this"]?q["static"]=!0:(a=d.isComplex()?new g(d):new ta(d),e.variable=new L(new u(b),[new ta(new N("prototype")),a]),q instanceof l&&q.bound&&(this.boundFuncs.push(d),q.bound=!1))),qa.push(e);return ca(qa)};
b.prototype.walkBody=function(a,d){return this.traverseChildren(!1,function(q){return function(e){var f,qa,g,h,ua,p,m;f=!0;if(e instanceof b)return!1;if(e instanceof c){m=qa=e.expressions;g=h=0;for(ua=m.length;h<ua;g=++h)p=m[g],p instanceof D&&p.variable.looksStatic(a)?p.value["static"]=!0:p instanceof L&&p.isObject(!0)&&(f=!1,qa[g]=q.addProperties(p,a,d));e.expressions=ea(qa)}return f&&!(e instanceof b)}}(this))};b.prototype.hoistDirectivePrologue=function(){var a,b,c;b=0;for(a=this.body.expressions;(c=
a[b])&&c instanceof F||c instanceof L&&c.isString();)++b;return this.directives=a.splice(0,b)};b.prototype.ensureConstructor=function(a){this.ctor||(this.ctor=new l,this.externalCtor?this.ctor.body.push(new y(this.externalCtor+".apply(this, arguments)")):this.parent&&this.ctor.body.push(new y(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};b.prototype.compileNode=
function(a){var b,q,e,f,g;(q=this.body.jumps())&&q.error("Class bodies cannot contain pure statements");(b=this.body.contains(Ja))&&b.error("Class bodies shouldn't reference arguments");g=this.determineName();f=new u(g);q=new l([],c.wrap([this.body]));b=[];a.classScope=q.makeScope(a.scope);this.hoistDirectivePrologue();this.setContext(g);this.walkBody(g,a);this.ensureConstructor(g);this.addBoundFunctions(a);this.body.spaced=!0;this.body.expressions.push(f);this.parent&&(g=new u(a.classScope.freeVariable("superClass",
{reserve:!1})),this.body.expressions.unshift(new M(f,g)),q.params.push(new W(g)),b.push(this.parent));(e=this.body.expressions).unshift.apply(e,this.directives);e=new B(new d(q,b));this.variable&&(e=new D(this.variable,e,null,{moduleDeclaration:this.moduleDeclaration}));return e.compileToFragments(a)};return b}(a);f.ModuleDeclaration=n=function(a){function b(a,b){this.clause=a;this.source=b;this.checkSource()}ma(b,a);b.prototype.children=["clause","source"];b.prototype.isStatement=ia;b.prototype.jumps=
da;b.prototype.makeReturn=da;b.prototype.checkSource=function(){if(null!=this.source&&this.source instanceof Xa)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}(a);f.ImportDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.compileNode=function(a){var b,
c;this.checkScope(a,"import");a.importedSymbols=[];b=[];b.push(this.makeCode(this.tab+"import "));null!=this.clause&&b.push.apply(b,this.clause.compileNode(a));null!=(null!=(c=this.source)?c.value:void 0)&&(null!==this.clause&&b.push(this.makeCode(" from ")),b.push(this.makeCode(this.source.value)));b.push(this.makeCode(";"));return b};return b}(n);f.ImportClause=function(a){function b(a,b){this.defaultBinding=a;this.namedImports=b}ma(b,a);b.prototype.children=["defaultBinding","namedImports"];b.prototype.compileNode=
function(a){var b;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}(a);f.ExportDeclaration=n=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.compileNode=function(a){var b,d;this.checkScope(a,"export");b=[];b.push(this.makeCode(this.tab+"export "));this instanceof G&&b.push(this.makeCode("default "));
this instanceof G||!(this.clause instanceof D||this.clause instanceof v)||(this.clause instanceof v&&!this.clause.variable&&this.clause.error("anonymous classes cannot be exported"),b.push(this.makeCode("var ")),this.clause.moduleDeclaration="export");b=null!=this.clause.body&&this.clause.body instanceof c?b.concat(this.clause.compileToFragments(a,H)):b.concat(this.clause.compileNode(a));null!=(null!=(d=this.source)?d.value:void 0)&&b.push(this.makeCode(" from "+this.source.value));b.push(this.makeCode(";"));
return b};return b}(n);f.ExportNamedDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ExportDefaultDeclaration=G=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ExportAllDeclaration=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ModuleSpecifierList=n=function(a){function b(a){this.specifiers=a}ma(b,a);b.prototype.children=["specifiers"];
b.prototype.compileNode=function(a){var b,c,e,d,f;b=[];a.indent+=ba;var q;f=this.specifiers;q=[];e=0;for(d=f.length;e<d;e++)c=f[e],q.push(c.compileToFragments(a,h));if(0!==this.specifiers.length){b.push(this.makeCode("{\n"+a.indent));e=d=0;for(f=q.length;d<f;e=++d)c=q[e],e&&b.push(this.makeCode(",\n"+a.indent)),b.push.apply(b,c);b.push(this.makeCode("\n}"))}else b.push(this.makeCode("{}"));return b};return b}(a);f.ImportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,
arguments)}ma(b,a);return b}(n);f.ExportSpecifierList=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ModuleSpecifier=T=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}ma(b,a);b.prototype.children=["original","alias"];b.prototype.compileNode=function(a){a.scope.add(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}(a);f.ImportSpecifier=n=function(a){function b(a,c){b.__super__.constructor.call(this,a,c,"import")}ma(b,a);b.prototype.compileNode=function(a){var c;(c=this.identifier,0<=Ha.call(a.importedSymbols,c))||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}(T);f.ImportDefaultSpecifier=
function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ImportNamespaceSpecifier=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);return b}(n);f.ExportSpecifier=function(a){function b(a,c){b.__super__.constructor.call(this,a,c,"export")}ma(b,a);return b}(T);f.Assign=D=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}ma(b,a);b.prototype.children=["variable","value"];b.prototype.isStatement=function(a){return(null!=a?a.level:void 0)===H&&null!=this.context&&(this.moduleDeclaration||0<=Ha.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 Na(a,this,"variable")};b.prototype.compileNode=function(a){var b,c,e,d,f,q,g;if(c=this.variable instanceof L){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(a);if(this.variable.isSplice())return this.compileSplice(a);if("||\x3d"===(d=this.context)||"\x26\x26\x3d"===d||"?\x3d"===d)return this.compileConditional(a);if("**\x3d"===(f=this.context)||"//\x3d"===f||"%%\x3d"===f)return this.compileSpecialMath(a)}this.value instanceof
l&&(this.value["static"]?(this.value.klass=this.variable.base,this.value.name=this.variable.properties[0],this.value.variable=this.variable):2<=(null!=(q=this.variable.properties)?q.length:void 0)&&(q=this.variable.properties,d=3<=q.length?Aa.call(q,0,e=q.length-2):(e=0,[]),f=q[e++],e=q[e++],"prototype"===(null!=(g=f.name)?g.value:void 0)&&(this.value.klass=new L(this.variable.base,d),this.value.name=e,this.value.variable=this.variable)));this.context||(g=this.variable.unwrapAll(),g.isAssignable()||
this.variable.error("'"+this.variable.compile(a)+"' can't be assigned"),"function"===typeof g.hasProperties&&g.hasProperties()||(this.moduleDeclaration?(this.checkAssignability(a,g),a.scope.add(g.value,this.moduleDeclaration)):this.param?a.scope.add(g.value,"var"):(this.checkAssignability(a,g),a.scope.find(g.value))));g=this.value.compileToFragments(a,h);c&&this.variable.base instanceof C&&(this.variable.front=!0);c=this.variable.compileToFragments(a,h);if("object"===this.context){if(b=Da(c),0<=Ha.call(r,
b))c.unshift(this.makeCode('"')),c.push(this.makeCode('"'));return c.concat(this.makeCode(": "),g)}b=c.concat(this.makeCode(" "+(this.context||"\x3d")+" "),g);return a.level<=h?b:this.wrapInBraces(b)};b.prototype.compilePatternMatch=function(a){var c,d,e,f,q,p,m,k,r,n,l,D,t,x,B,v;x=a.level===H;k=this.value;D=this.variable.base.objects;if(!(t=D.length))return d=k.compileToFragments(a),a.level>=K?this.wrapInBraces(d):d;l=D[0];1===t&&l instanceof z&&l.error("Destructuring assignment has no target");
p=this.variable.isObject();if(x&&1===t&&!(l instanceof Q))return e=null,l instanceof b&&"object"===l.context?(d=l,f=d.variable,q=f.base,l=d.value,l instanceof b&&(e=l.value,l=l.variable)):(l instanceof b&&(e=l.value,l=l.variable),q=p?l["this"]?l.properties[0].name:new N(l.unwrap().value):new R(0)),c=q.unwrap()instanceof N,k=new L(k),k.properties.push(new (c?ta:g)(q)),(n=Ga(l.unwrap().value))&&l.error(n),e&&(k=new A("?",k,e)),(new b(l,k,null,{param:this.param})).compileToFragments(a,H);B=k.compileToFragments(a,
h);v=Da(B);d=[];f=!1;k.unwrap()instanceof u&&!this.variable.assigns(v)||(d.push([this.makeCode((e=a.scope.freeVariable("ref"))+" \x3d ")].concat(Aa.call(B))),B=[this.makeCode(e)],v=e);e=k=0;for(r=D.length;k<r;e=++k){l=D[e];q=e;if(!f&&l instanceof Q)n=l.name.unwrap().value,l=l.unwrap(),q=t+" \x3c\x3d "+v+".length ? "+za("slice",a)+".call("+v+", "+e,(c=t-e-1)?(m=a.scope.freeVariable("i",{single:!0}),q+=", "+m+" \x3d "+v+".length - "+c+") : ("+m+" \x3d "+e+", [])"):q+=") : []",q=new y(q),f=m+"++";else if(!f&&
l instanceof z){if(c=t-e-1)1===c?f=v+".length - 1":(m=a.scope.freeVariable("i",{single:!0}),q=new y(m+" \x3d "+v+".length - "+c),f=m+"++",d.push(q.compileToFragments(a,h)));continue}else(l instanceof Q||l instanceof z)&&l.error("multiple splats/expansions are disallowed in an assignment"),e=null,l instanceof b&&"object"===l.context?(q=l.variable,q=q.base,l=l.value,l instanceof b&&(e=l.value,l=l.variable)):(l instanceof b&&(e=l.value,l=l.variable),q=p?l["this"]?l.properties[0].name:new N(l.unwrap().value):
new y(f||q)),n=l.unwrap().value,c=q.unwrap()instanceof N,q=new L(new y(v),[new (c?ta:g)(q)]),e&&(q=new A("?",q,e));null!=n&&(n=Ga(n))&&l.error(n);d.push((new b(l,q,null,{param:this.param,subpattern:!0})).compileToFragments(a,h))}x||this.subpattern||d.push(B);d=this.joinFragmentArrays(d,", ");return a.level<h?d:this.wrapInBraces(d)};b.prototype.compileConditional=function(a){var c,d;d=this.variable.cacheReference(a);c=d[0];d=d[1];c.properties.length||!(c.base instanceof y)||c.base instanceof ga||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<=Ha.call(this.context,"?"))return a.isExistentialEquals=!0,(new E(new w(c),d,{type:"if"})).addElse(new b(d,this.value,"\x3d")).compileToFragments(a);c=(new A(this.context.slice(0,-1),c,new b(d,this.value,"\x3d"))).compileToFragments(a);return a.level<=h?c:this.wrapInBraces(c)};b.prototype.compileSpecialMath=function(a){var c,d;d=this.variable.cacheReference(a);
c=d[0];d=d[1];return(new b(c,new A(this.context.slice(0,-1),d,this.value))).compileToFragments(a)};b.prototype.compileSplice=function(a){var b,c,e,d,f,q;d=this.variable.properties.pop().range;e=d.from;b=d.to;c=d.exclusive;q=this.variable.compile(a);e?(f=this.cacheToCodeFragments(e.cache(a,K)),d=f[0],f=f[1]):d=f="0";b?null!=e&&e.isNumber()&&b.isNumber()?(b=b.compile(a)-f,c||(b+=1)):(b=b.compile(a,p)+" - "+f,c||(b+=" + 1")):b="9e9";c=this.value.cache(a,h);e=c[0];c=c[1];b=[].concat(this.makeCode("[].splice.apply("+
q+", ["+d+", "+b+"].concat("),e,this.makeCode(")), "),c);return a.level>H?this.wrapInBraces(b):b};return b}(a);f.Code=l=function(a){function b(a,b,d){this.params=a||[];this.body=b||new c;this.bound="boundfunc"===d;this.isGenerator=!!this.body.contains(function(a){return a instanceof A&&a.isYield()||a instanceof pa})}ma(b,a);b.prototype.children=["params","body"];b.prototype.isStatement=function(){return!!this.ctor};b.prototype.jumps=P;b.prototype.makeScope=function(a){return new J(a,this.body,this)};
b.prototype.compileNode=function(a){var f,q,e,g,h,m,k,l,r,n,t,x,v;this.bound&&null!=(q=a.scope.method)&&q.bound&&(this.context=a.scope.method.context);if(this.bound&&!this.context)return this.context="_this",q=new b([new W(new u(this.context))],new c([this])),q=new d(q,[new ga]),q.updateLocationDataIfMissing(this.locationData),q.compileNode(a);a.scope=la(a,"classScope")||this.makeScope(a.scope);a.scope.shared=la(a,"sharedScope");a.indent+=ba;delete a.bare;delete a.isExistentialEquals;q=[];f=[];l=
this.params;g=0;for(m=l.length;g<m;g++)k=l[g],k instanceof z||a.scope.parameter(k.asReference(a));l=this.params;g=0;for(m=l.length;g<m;g++)if(k=l[g],k.splat||k instanceof z){g=this.params;h=0;for(k=g.length;h<k;h++)r=g[h],r instanceof z||!r.name.value||a.scope.add(r.name.value,"var",!0);h=new D(new L(new oa(function(){var b,c,e,d;e=this.params;d=[];c=0;for(b=e.length;c<b;c++)r=e[c],d.push(r.asReference(a));return d}.call(this))),new L(new u("arguments")));break}t=this.params;l=0;for(g=t.length;l<
g;l++)k=t[l],k.isComplex()?(v=n=k.asReference(a),k.value&&(v=new A("?",n,k.value)),f.push(new D(new L(k.name),v,"\x3d",{param:!0}))):(n=k,k.value&&(m=new y(n.name.value+" \x3d\x3d null"),v=new D(new L(k.name),k.value,"\x3d"),f.push(new E(m,v)))),h||q.push(n);k=this.body.isEmpty();h&&f.unshift(h);f.length&&(e=this.body.expressions).unshift.apply(e,f);e=h=0;for(f=q.length;h<f;e=++h)r=q[e],q[e]=r.compileToFragments(a),a.scope.parameter(Da(q[e]));x=[];this.eachParamName(function(a,b){0<=Ha.call(x,a)&&
b.error("multiple parameters named "+a);return x.push(a)});k||this.noReturn||this.body.makeReturn();e="function";this.isGenerator&&(e+="*");this.ctor&&(e+=" "+this.name);f=[this.makeCode(e+"(")];e=k=0;for(h=q.length;k<h;e=++k)r=q[e],e&&f.push(this.makeCode(", ")),f.push.apply(f,r);f.push(this.makeCode(") {"));this.body.isEmpty()||(f=f.concat(this.makeCode("\n"),this.body.compileWithDeclarations(a),this.makeCode("\n"+this.tab)));f.push(this.makeCode("}"));return this.ctor?[this.makeCode(this.tab)].concat(Aa.call(f)):
this.front||a.level>=p?this.wrapInBraces(f):f};b.prototype.eachParamName=function(a){var b,c,e,d,f;d=this.params;f=[];b=0;for(c=d.length;b<c;b++)e=d[b],f.push(e.eachName(a));return f};b.prototype.traverseChildren=function(a,c){if(a)return b.__super__.traverseChildren.call(this,a,c)};return b}(a);f.Param=W=function(a){function b(a,b,c){this.name=a;this.value=b;this.splat=c;(a=Ga(this.name.unwrapAll().value))&&this.name.error(a);this.name instanceof C&&this.name.generated&&(a=this.name.objects[0].operatorToken,
a.error("unexpected "+a.value))}ma(b,a);b.prototype.children=["name","value"];b.prototype.compileToFragments=function(a){return this.name.compileToFragments(a,h)};b.prototype.asReference=function(a){var b;if(this.reference)return this.reference;b=this.name;b["this"]?(b=b.properties[0].name.value,0<=Ha.call(r,b)&&(b="_"+b),b=new u(a.scope.freeVariable(b))):b.isComplex()&&(b=new u(a.scope.freeVariable("arg")));b=new L(b);this.splat&&(b=new Q(b));b.updateLocationDataIfMissing(this.locationData);return this.reference=
b};b.prototype.isComplex=function(){return this.name.isComplex()};b.prototype.eachName=function(a,b){var c,e,d,f;null==b&&(b=this.name);c=function(b){return a("@"+b.properties[0].name.value,b)};if(b instanceof y)return a(b.value,b);if(b instanceof L)return c(b);b=null!=(e=b.objects)?e:[];e=0;for(d=b.length;e<d;e++)f=b[e],f instanceof D&&null==f.context&&(f=f.variable),f instanceof D?(f.value instanceof D&&(f=f.value),this.eachName(a,f.value.unwrap())):f instanceof Q?(f=f.name.unwrap(),a(f.value,f)):
f instanceof L?f.isArray()||f.isObject()?this.eachName(a,f.base):f["this"]?c(f):a(f.base.value,f.base):f instanceof z||f.error("illegal parameter "+f.compile())};return b}(a);f.Splat=Q=function(a){function b(a){this.name=a.compile?a:new y(a)}ma(b,a);b.prototype.children=["name"];b.prototype.isAssignable=ia;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,c,d){var e,f,g,q,k,p;for(q=-1;(e=c[++q])&&!(e instanceof b););if(q>=c.length)return[];if(1===c.length)return e=c[0],c=e.compileToFragments(a,h),d?c:[].concat(e.makeCode(za("slice",a)+".call("),c,e.makeCode(")"));d=c.slice(q);g=k=0;for(p=d.length;k<p;g=++k)e=d[g],f=e.compileToFragments(a,h),d[g]=e instanceof b?[].concat(e.makeCode(za("slice",a)+".call("),f,e.makeCode(")")):[].concat(e.makeCode("["),f,e.makeCode("]"));if(0===q)return e=c[0],a=e.joinFragmentArrays(d.slice(1),", "),d[0].concat(e.makeCode(".concat("),
a,e.makeCode(")"));k=c.slice(0,q);p=[];f=0;for(g=k.length;f<g;f++)e=k[f],p.push(e.compileToFragments(a,h));e=c[0].joinFragmentArrays(p,", ");a=c[q].joinFragmentArrays(d,", ");d=c[c.length-1];return[].concat(c[0].makeCode("["),e,c[q].makeCode("].concat("),a,d.makeCode(")"))};return b}(a);f.Expansion=z=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.isComplex=P;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}(a);f.While=n=function(a){function b(a,b){this.condition=null!=b&&b.invert?a.invert():a;this.guard=null!=b?b.guard:void 0}ma(b,a);b.prototype.children=["condition","guard","body"];b.prototype.isStatement=ia;b.prototype.makeReturn=function(a){if(a)return b.__super__.makeReturn.apply(this,arguments);this.returns=!this.jumps({loop:!0});return this};b.prototype.addBody=function(a){this.body=a;return this};b.prototype.jumps=
function(){var a,b,c,e;a=this.body.expressions;if(!a.length)return!1;b=0;for(e=a.length;b<e;b++)if(c=a[b],c=c.jumps({loop:!0}))return c;return!1};b.prototype.compileNode=function(a){var b,d,e;a.indent+=ba;e="";b=this.body;b.isEmpty()?b=this.makeCode(""):(this.returns&&(b.makeReturn(d=a.scope.freeVariable("results")),e=""+this.tab+d+" \x3d [];\n"),this.guard&&(1<b.expressions.length?b.expressions.unshift(new E((new B(this.guard)).invert(),new ya("continue"))):this.guard&&(b=c.wrap([new E(this.guard,
b)]))),b=[].concat(this.makeCode("\n"),b.compileToFragments(a,H),this.makeCode("\n"+this.tab)));a=[].concat(this.makeCode(e+this.tab+"while ("),this.condition.compileToFragments(a,O),this.makeCode(") {"),b,this.makeCode("}"));this.returns&&a.push(this.makeCode("\n"+this.tab+"return "+d+";"));return a};return b}(a);f.Op=A=function(a){function b(a,b,f,g){if("in"===a)return new m(b,f);if("do"===a)return this.generateDo(b);if("new"===a){if(b instanceof d&&!b["do"]&&!b.isNew)return b.newInstance();if(b instanceof
l&&b.bound||b["do"])b=new B(b)}this.operator=c[a]||a;this.first=b;this.second=f;this.flip=!!g;return this}var c,f;ma(b,a);c={"\x3d\x3d":"\x3d\x3d\x3d","!\x3d":"!\x3d\x3d",of:"in",yieldfrom:"yield*"};f={"!\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 L&&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,d;if(this.isChainable()&&this.first.isChainable()){a=!0;for(c=this;c&&c.operator;)a&&(a=c.operator in f),c=c.first;if(!a)return(new B(this)).invert();for(c=this;c&&c.operator;)c.invert=
!c.invert,c.operator=f[c.operator],c=c.first;return this}return(c=f[this.operator])?(this.operator=c,this.first.unwrap()instanceof b&&this.first.invert(),this):this.second?(new B(this)).invert():"!"===this.operator&&(a=this.first.unwrap())instanceof b&&("!"===(d=a.operator)||"in"===d||"instanceof"===d)?a:new b("!",this)};b.prototype.unfoldSoak=function(a){var b;return("++"===(b=this.operator)||"--"===b||"delete"===b)&&Na(a,this,"first")};b.prototype.generateDo=function(a){var b,c,f,g,q;g=[];q=(a instanceof
D&&(b=a.value.unwrap())instanceof l?b:a).params||[];b=0;for(c=q.length;b<c;b++)f=q[b],f.value?(g.push(f.value),delete f.value):g.push(f);a=new d(a,g);a["do"]=!0;return a};b.prototype.compileNode=function(a){var b,c;b=this.isChainable()&&this.first.isChainable();b||(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");("--"===(c=this.operator)||"++"===c)&&(c=Ga(this.first.unwrapAll().value))&&this.first.error(c);
if(this.isYield())return this.compileYield(a);if(this.isUnary())return this.compileUnary(a);if(b)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 b=this.first.compileToFragments(a,K),c=this.second.compileToFragments(a,K),b=[].concat(b,this.makeCode(" "+this.operator+" "),c),a.level<=K?b:this.wrapInBraces(b)}};b.prototype.compileChain=
function(a){var b;b=this.first.second.cache(a);this.first.second=b[0];b=b[1];a=this.first.compileToFragments(a,K).concat(this.makeCode(" "+(this.invert?"\x26\x26":"||")+" "),b.compileToFragments(a),this.makeCode(" "+this.operator+" "),this.second.compileToFragments(a,K));return this.wrapInBraces(a)};b.prototype.compileExistence=function(a){var b,c;this.first.isComplex()?(c=new u(a.scope.freeVariable("ref")),b=new B(new D(c,this.first))):c=b=this.first;return(new E(new w(b),c,{type:"if"})).addElse(this.second).compileToFragments(a)};
b.prototype.compileUnary=function(a){var c,d,f;d=[];c=this.operator;d.push([this.makeCode(c)]);if("!"===c&&this.first instanceof w)return this.first.negated=!this.first.negated,this.first.compileToFragments(a);if(a.level>=p)return(new B(this)).compileToFragments(a);f="+"===c||"-"===c;("new"===c||"typeof"===c||"delete"===c||f&&this.first instanceof b&&this.first.operator===c)&&d.push([this.makeCode(" ")]);if(f&&this.first instanceof b||"new"===c&&this.first.isStatement(a))this.first=new B(this.first);
d.push(this.first.compileToFragments(a,K));this.flip&&d.reverse();return this.joinFragmentArrays(d,"")};b.prototype.compileYield=function(a){var b,c,d;c=[];b=this.operator;null==a.scope.parent&&this.error("yield can only occur inside functions");0<=Ha.call(Object.keys(this.first),"expression")&&!(this.first instanceof ha)?null!=this.first.expression&&c.push(this.first.expression.compileToFragments(a,K)):(a.level>=O&&c.push([this.makeCode("(")]),c.push([this.makeCode(b)]),""!==(null!=(d=this.first.base)?
d.value:void 0)&&c.push([this.makeCode(" ")]),c.push(this.first.compileToFragments(a,K)),a.level>=O&&c.push([this.makeCode(")")]));return this.joinFragmentArrays(c,"")};b.prototype.compilePower=function(a){var b;b=new L(new u("Math"),[new ta(new N("pow"))]);return(new d(b,[this.first,this.second])).compileToFragments(a)};b.prototype.compileFloorDivision=function(a){var c,f;f=new L(new u("Math"),[new ta(new N("floor"))]);c=new b("/",this.first,this.second);return(new d(f,[c])).compileToFragments(a)};
b.prototype.compileModulo=function(a){var b;b=new L(new y(za("modulo",a)));return(new d(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}(a);f.In=m=function(a){function b(a,b){this.object=a;this.array=b}ma(b,a);b.prototype.children=["object","array"];b.prototype.invert=S;b.prototype.compileNode=function(a){var b,c,e,d,f;if(this.array instanceof L&&this.array.isArray()&&this.array.base.objects.length){f=
this.array.base.objects;c=0;for(e=f.length;c<e;c++)if(d=f[c],d instanceof Q){b=!0;break}if(!b)return this.compileOrTest(a)}return this.compileLoopTest(a)};b.prototype.compileOrTest=function(a){var b,c,e,d,f,g,q,h,k,m;b=this.object.cache(a,K);k=b[0];q=b[1];c=this.negated?[" !\x3d\x3d "," \x26\x26 "]:[" \x3d\x3d\x3d "," || "];b=c[0];c=c[1];m=[];h=this.array.base.objects;e=f=0;for(g=h.length;f<g;e=++f)d=h[e],e&&m.push(this.makeCode(c)),m=m.concat(e?q:k,this.makeCode(b),d.compileToFragments(a,p));return a.level<
K?m:this.wrapInBraces(m)};b.prototype.compileLoopTest=function(a){var b,c,e;b=this.object.cache(a,h);e=b[0];c=b[1];b=[].concat(this.makeCode(za("indexOf",a)+".call("),this.array.compileToFragments(a,h),this.makeCode(", "),c,this.makeCode(") "+(this.negated?"\x3c 0":"\x3e\x3d 0")));if(Da(e)===Da(c))return b;b=e.concat(this.makeCode(", "),b);return a.level<h?b:this.wrapInBraces(b)};b.prototype.toString=function(a){return b.__super__.toString.call(this,a,this.constructor.name+(this.negated?"!":""))};
return b}(a);f.Try=function(a){function b(a,b,c,e){this.attempt=a;this.errorVariable=b;this.recovery=c;this.ensure=e}ma(b,a);b.prototype.children=["attempt","recovery","ensure"];b.prototype.isStatement=ia;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,d,f;a.indent+=ba;f=this.attempt.compileToFragments(a,H);b=this.recovery?(c=a.scope.freeVariable("error",{reserve:!1}),d=new u(c),this.errorVariable?(e=Ga(this.errorVariable.unwrapAll().value),e?this.errorVariable.error(e):void 0,this.recovery.unshift(new D(this.errorVariable,d))):void 0,[].concat(this.makeCode(" catch ("),d.compileToFragments(a),this.makeCode(") {\n"),this.recovery.compileToFragments(a,H),this.makeCode("\n"+this.tab+"}"))):this.ensure||this.recovery?[]:(c=a.scope.freeVariable("error",
{reserve:!1}),[this.makeCode(" catch ("+c+") {}")]);a=this.ensure?[].concat(this.makeCode(" finally {\n"),this.ensure.compileToFragments(a,H),this.makeCode("\n"+this.tab+"}")):[];return[].concat(this.makeCode(this.tab+"try {\n"),f,this.makeCode("\n"+this.tab+"}"),b,a)};return b}(a);f.Throw=ha=function(a){function b(a){this.expression=a}ma(b,a);b.prototype.children=["expression"];b.prototype.isStatement=ia;b.prototype.jumps=P;b.prototype.makeReturn=da;b.prototype.compileNode=function(a){return[].concat(this.makeCode(this.tab+
"throw "),this.expression.compileToFragments(a),this.makeCode(";"))};return b}(a);f.Existence=w=function(a){function b(a){this.expression=a}ma(b,a);b.prototype.children=["expression"];b.prototype.invert=S;b.prototype.compileNode=function(a){var b,c,e;this.expression.front=this.front;e=this.expression.compile(a,K);this.expression.unwrap()instanceof u&&!a.scope.check(e)?(c=this.negated?["\x3d\x3d\x3d","||"]:["!\x3d\x3d","\x26\x26"],b=c[0],c=c[1],e="typeof "+e+" "+b+' "undefined" '+c+" "+e+" "+b+" null"):
e=e+" "+(this.negated?"\x3d\x3d":"!\x3d")+" null";return[this.makeCode(a.level<=k?e:"("+e+")")]};return b}(a);f.Parens=B=function(a){function b(a){this.body=a}ma(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,c;b=this.body.unwrap();if(b instanceof L&&b.isAtomic())return b.front=this.front,b.compileToFragments(a);c=b.compileToFragments(a,O);return a.level<K&&
(b instanceof A||b instanceof d||b instanceof I&&b.returns)?c:this.wrapInBraces(c)};return b}(a);f.StringWithInterpolations=Xa=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}ma(b,a);b.prototype.compileNode=function(a){var c,d,e,f,g;if(!a.inTaggedTemplateCall)return b.__super__.compileNode.apply(this,arguments);e=this.body.unwrap();d=[];e.traverseChildren(!1,function(a){if(a instanceof $a)d.push(a);else if(a instanceof B)return d.push(a),!1;return!0});e=[];e.push(this.makeCode("`"));
f=0;for(g=d.length;f<g;f++)c=d[f],c instanceof $a?(c=c.value.slice(1,-1),c=c.replace(/(\\*)(`|\$\{)/g,function(a,b,c){return 0===b.length%2?b+"\\"+c:a}),e.push(this.makeCode(c))):(e.push(this.makeCode("${")),e.push.apply(e,c.compileToFragments(a,O)),e.push(this.makeCode("}")));e.push(this.makeCode("`"));return e};return b}(B);f.For=I=function(a){function b(a,b){this.source=b.source;this.guard=b.guard;this.step=b.step;this.name=b.name;this.index=b.index;this.body=c.wrap([a]);this.own=!!b.own;this.object=
!!b.object;(this.from=!!b.from)&&this.index&&this.index.error("cannot use index with for-from");this.own&&!this.object&&b.ownTag.error("cannot use own with for-"+(this.from?"from":"in"));this.object&&(a=[this.index,this.name],this.name=a[0],this.index=a[1]);this.index instanceof L&&this.index.error("index cannot be a pattern matching expression");this.range=this.source instanceof L&&this.source.base instanceof X&&!this.source.properties.length&&!this.from;this.pattern=this.name instanceof L;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}ma(b,a);b.prototype.children=["body","source","guard","step"];b.prototype.compileNode=function(a){var b,d,e,f,g,q,k,p,m,l,r,n,t,v,x,K,A,z,C,w,G;b=c.wrap([this.body]);m=b.expressions;m=m[m.length-1];(null!=m?m.jumps():void 0)instanceof V&&(this.returns=!1);x=this.range?this.source.base:this.source;e=a.scope;this.pattern||(p=this.name&&
this.name.compile(a,h));m=this.index&&this.index.compile(a,h);p&&!this.pattern&&e.find(p);m&&e.find(m);this.returns&&(k=e.freeVariable("results"));this.from?this.pattern&&(r=e.freeVariable("x",{single:!0})):r=this.object&&m||e.freeVariable("i",{single:!0});n=(this.range||this.from)&&p||m||r;t=n!==r?n+" \x3d ":"";this.step&&!this.range&&(m=this.cacheToCodeFragments(this.step.cache(a,h,sa)),g=m[0],C=m[1],this.step.isNumber()&&(z=Number(C)));this.pattern&&(p=r);q=m=G="";l=this.tab+ba;this.range?f=x.compileToFragments(Fa(a,
{index:r,name:p,step:this.step,isComplex:sa})):(w=this.source.compile(a,h),!p&&!this.own||this.source.unwrap()instanceof u||(q+=""+this.tab+(x=e.freeVariable("ref"))+" \x3d "+w+";\n",w=x),!p||this.pattern||this.from||(v=p+" \x3d "+w+"["+n+"]"),this.object||this.from||(g!==C&&(q+=""+this.tab+g+";\n"),p=0>z,this.step&&null!=z&&p||(d=e.freeVariable("len")),f=""+t+r+" \x3d 0, "+d+" \x3d "+w+".length",g=""+t+r+" \x3d "+w+".length - 1",d=r+" \x3c "+d,e=r+" \x3e\x3d 0",this.step?(null!=z?p&&(d=e,f=g):(d=
C+" \x3e 0 ? "+d+" : "+e,f="("+C+" \x3e 0 ? ("+f+") : "+g+")"),r=r+" +\x3d "+C):r=""+(n!==r?"++"+r:r+"++"),f=[this.makeCode(f+"; "+d+"; "+t+r)]));this.returns&&(K=""+this.tab+k+" \x3d [];\n",A="\n"+this.tab+"return "+k+";",b.makeReturn(k));this.guard&&(1<b.expressions.length?b.expressions.unshift(new E((new B(this.guard)).invert(),new ya("continue"))):this.guard&&(b=c.wrap([new E(this.guard,b)])));this.pattern&&b.expressions.unshift(new D(this.name,this.from?new u(n):new y(w+"["+n+"]")));k=[].concat(this.makeCode(q),
this.pluckDirectCall(a,b));v&&(G="\n"+l+v+";");this.object?(f=[this.makeCode(n+" in "+w)],this.own&&(m="\n"+l+"if (!"+za("hasProp",a)+".call("+w+", "+n+")) continue;")):this.from&&(f=[this.makeCode(n+" of "+w)]);(a=b.compileToFragments(Fa(a,{indent:l}),H))&&0<a.length&&(a=[].concat(this.makeCode("\n"),a,this.makeCode("\n")));return[].concat(k,this.makeCode(""+(K||"")+this.tab+"for ("),f,this.makeCode(") {"+m+G),a,this.makeCode(this.tab+"}"+(A||"")))};b.prototype.pluckDirectCall=function(a,b){var c,
e,f,g,h,q,k,m,p,r,n,t,v,x,y;e=[];p=b.expressions;h=q=0;for(k=p.length;q<k;h=++q)if(f=p[h],f=f.unwrapAll(),f instanceof d&&(y=null!=(r=f.variable)?r.unwrapAll():void 0,y instanceof l||y instanceof L&&(null!=(n=y.base)?n.unwrapAll():void 0)instanceof l&&1===y.properties.length&&("call"===(t=null!=(v=y.properties[0].name)?v.value:void 0)||"apply"===t)))g=(null!=(x=y.base)?x.unwrapAll():void 0)||y,m=new u(a.scope.freeVariable("fn")),c=new L(m),y.base&&(c=[c,y],y.base=c[0],c=c[1]),b.expressions[h]=new d(c,
f.args),e=e.concat(this.makeCode(this.tab),(new D(m,g)).compileToFragments(a,H),this.makeCode(";\n"));return e};return b}(n);f.Switch=function(a){function b(a,b,c){this.subject=a;this.cases=b;this.otherwise=c}ma(b,a);b.prototype.children=["subject","cases","otherwise"];b.prototype.isStatement=ia;b.prototype.jumps=function(a){var b,c,e,d,f;null==a&&(a={block:!0});d=this.cases;c=0;for(e=d.length;c<e;c++)if(b=d[c],b=b[1],b=b.jumps(a))return b;return null!=(f=this.otherwise)?f.jumps(a):void 0};b.prototype.makeReturn=
function(a){var b,d,e,f,g;f=this.cases;b=0;for(d=f.length;b<d;b++)e=f[b],e[1].makeReturn(a);a&&(this.otherwise||(this.otherwise=new c([new y("void 0")])));null!=(g=this.otherwise)&&g.makeReturn(a);return this};b.prototype.compileNode=function(a){var b,c,e,d,f,g,h,k,m,p,q,r,l;h=a.indent+ba;k=a.indent=h+ba;g=[].concat(this.makeCode(this.tab+"switch ("),this.subject?this.subject.compileToFragments(a,O):this.makeCode("false"),this.makeCode(") {\n"));r=this.cases;f=m=0;for(p=r.length;m<p;f=++m){b=r[f];
d=b[0];b=b[1];l=ea([d]);d=0;for(q=l.length;d<q;d++)e=l[d],this.subject||(e=e.invert()),g=g.concat(this.makeCode(h+"case "),e.compileToFragments(a,O),this.makeCode(":\n"));0<(c=b.compileToFragments(a,H)).length&&(g=g.concat(c,this.makeCode("\n")));if(f===this.cases.length-1&&!this.otherwise)break;f=this.lastNonComment(b.expressions);f instanceof V||f instanceof y&&f.jumps()&&"debugger"!==f.value||g.push(e.makeCode(k+"break;\n"))}this.otherwise&&this.otherwise.expressions.length&&g.push.apply(g,[this.makeCode(h+
"default:\n")].concat(Aa.call(this.otherwise.compileToFragments(a,H)),[this.makeCode("\n")]));g.push(this.makeCode(this.tab+"}"));return g};return b}(a);f.If=E=function(a){function b(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}ma(b,a);b.prototype.children=["condition","body","elseBody"];b.prototype.bodyNode=function(){var a;return null!=(a=this.body)?a.unwrap():void 0};b.prototype.elseBodyNode=function(){var a;
return null!=(a=this.elseBody)?a.unwrap():void 0};b.prototype.addElse=function(a){this.isChain?this.elseBodyNode().addElse(a):(this.isChain=a instanceof b,this.elseBody=this.ensureBlock(a),this.elseBody.updateLocationDataIfMissing(a.locationData));return this};b.prototype.isStatement=function(a){var b;return(null!=a?a.level:void 0)===H||this.bodyNode().isStatement(a)||(null!=(b=this.elseBodyNode())?b.isStatement(a):void 0)};b.prototype.jumps=function(a){var b;return this.body.jumps(a)||(null!=(b=
this.elseBody)?b.jumps(a):void 0)};b.prototype.compileNode=function(a){return this.isStatement(a)?this.compileStatement(a):this.compileExpression(a)};b.prototype.makeReturn=function(a){a&&(this.elseBody||(this.elseBody=new c([new y("void 0")])));this.body&&(this.body=new c([this.body.makeReturn(a)]));this.elseBody&&(this.elseBody=new c([this.elseBody.makeReturn(a)]));return this};b.prototype.ensureBlock=function(a){return a instanceof c?a:new c([a])};b.prototype.compileStatement=function(a){var c,
d,e,f;c=la(a,"chainChild");if(la(a,"isExistentialEquals"))return(new b(this.condition.invert(),this.elseBodyNode(),{type:"if"})).compileToFragments(a);f=a.indent+ba;e=this.condition.compileToFragments(a,O);d=this.ensureBlock(this.body).compileToFragments(Fa(a,{indent:f}));d=[].concat(this.makeCode("if ("),e,this.makeCode(") {\n"),d,this.makeCode("\n"+this.tab+"}"));c||d.unshift(this.makeCode(this.tab));if(!this.elseBody)return d;c=d.concat(this.makeCode(" else "));this.isChain?(a.chainChild=!0,c=
c.concat(this.elseBody.unwrap().compileToFragments(a,H))):c=c.concat(this.makeCode("{\n"),this.elseBody.compileToFragments(Fa(a,{indent:f}),H),this.makeCode("\n"+this.tab+"}"));return c};b.prototype.compileExpression=function(a){var b,c,e;e=this.condition.compileToFragments(a,k);c=this.bodyNode().compileToFragments(a,h);b=this.elseBodyNode()?this.elseBodyNode().compileToFragments(a,h):[this.makeCode("void 0")];b=e.concat(this.makeCode(" ? "),c,this.makeCode(" : "),b);return a.level>=k?this.wrapInBraces(b):
b};b.prototype.unfoldSoak=function(){return this.soak&&this};return b}(a);ka={extend:function(a){return"function(child, parent) { for (var key in parent) { if ("+za("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"}};H=1;O=2;h=3;k=4;K=5;p=6;ba=" ";U=/^[+-]?\d+$/;za=function(a,b){var c,d;d=b.scope.root;if(a in d.utilities)return d.utilities[a];c=d.freeVariable(a);
d.assign(c,ka[a](b));return d.utilities[a]=c};Pa=function(a,b){a=a.replace(/\n/g,"$\x26"+b);return a.replace(/\s+$/,"")};Ja=function(a){return a instanceof u&&"arguments"===a.value};Ta=function(a){return a instanceof ga||a instanceof l&&a.bound||a instanceof ja};sa=function(a){return a.isComplex()||("function"===typeof a.isAssignable?a.isAssignable():void 0)};Na=function(a,b,c){if(a=b[c].unfoldSoak(a))return b[c]=a.body,a.body=new L(b),a}}).call(this);return f}();t["./sourcemap"]=function(){var f=
{};(function(){var t;t=function(){function f(f){this.line=f;this.columns=[]}f.prototype.add=function(f,a,c){var t;t=a[0];a=a[1];null==c&&(c={});if(!this.columns[f]||!c.noReplace)return this.columns[f]={line:this.line,column:f,sourceLine:t,sourceColumn:a}};f.prototype.sourceLocation=function(f){for(var a;!((a=this.columns[f])||0>=f);)f--;return a&&[a.sourceLine,a.sourceColumn]};return f}();f=function(){function f(){this.lines=[]}f.prototype.add=function(f,a,c){var D,d;null==c&&(c={});d=a[0];a=a[1];
return((D=this.lines)[d]||(D[d]=new t(d))).add(a,f,c)};f.prototype.sourceLocation=function(f){var a,c;a=f[0];for(f=f[1];!((c=this.lines[a])||0>=a);)a--;return c&&c.sourceLocation(f)};f.prototype.generate=function(f,a){var c,t,d,v,l,x,D,w,z,n,G,M,I;null==f&&(f={});null==a&&(a=null);l=x=v=I=0;n=!1;c="";G=this.lines;d=t=0;for(D=G.length;t<D;d=++t)if(d=G[d])for(M=d.columns,d=0,w=M.length;d<w;d++)if(z=M[d]){for(;I<z.line;)v=0,n=!1,c+=";",I++;n&&(c+=",");c+=this.encodeVlq(z.column-v);v=z.column;c+=this.encodeVlq(0);
c+=this.encodeVlq(z.sourceLine-x);x=z.sourceLine;c+=this.encodeVlq(z.sourceColumn-l);l=z.sourceColumn;n=!0}c={version:3,file:f.generatedFile||"",sourceRoot:f.sourceRoot||"",sources:f.sourceFiles||[""],names:[],mappings:c};f.inlineMap&&(c.sourcesContent=[a]);return c};f.prototype.encodeVlq=function(f){var a,c;a="";for(c=(Math.abs(f)<<1)+(0>f?1:0);c||!a;)f=c&31,(c>>=5)&&(f|=32),a+=this.encodeBase64(f);return a};f.prototype.encodeBase64=function(f){var a;if(!(a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f]))throw Error("Cannot Base64 encode value: "+
f);return a};return f}()}).call(this);return f}();t["./coffee-script"]=function(){var f={};(function(){var oa,wa,D,a,c,Ca,d,v,l,x,F,w,z,n,G,M,I,u,E={}.hasOwnProperty;v=t("fs");u=t("vm");G=t("path");oa=t("./lexer").Lexer;n=t("./parser").parser;x=t("./helpers");wa=t("./sourcemap");f.VERSION="1.12.1";f.FILE_EXTENSIONS=[".coffee",".litcoffee",".coffee.md"];f.helpers=x;D=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,c){return String.fromCharCode("0x"+c)}));default:throw Error("Unable to base64 encode inline sourcemap.");}};Ca=function(a){return function(c,d){null==d&&(d={});try{return a.call(this,c,d)}catch(p){if("string"!==typeof c)throw p;throw x.updateSyntaxError(p,c,d.filename);}}};f.compile=a=Ca(function(a,c){var d,f,g,h,m,l,t,u,v,w,G,E;g=x.extend;c=g({},c);(g=c.sourceMap||c.inlineMap)&&(v=new wa);f=z.tokenize(a,c);h=c;u=[];m=0;for(l=f.length;m<l;m++)d=f[m],"IDENTIFIER"===d[0]&&u.push(d[1]);h.referencedVars=
u;if(null==c.bare||!0!==c.bare)for(h=0,m=f.length;h<m;h++)if(d=f[h],"IMPORT"===(t=d[0])||"EXPORT"===t){c.bare=!0;break}m=n.parse(f).compileToFragments(c);f=0;c.header&&(f+=1);c.shiftLine&&(f+=1);d=0;t="";l=0;for(u=m.length;l<u;l++)h=m[l],g&&(h.locationData&&!/^[;\s]*$/.test(h.code)&&v.add([h.locationData.first_line,h.locationData.first_column],[f,d],{noReplace:!0}),w=x.count(h.code,"\n"),f+=w,d=w?h.code.length-(h.code.lastIndexOf("\n")+1):d+h.code.length),t+=h.code;c.header&&(d="Generated by CoffeeScript "+
this.VERSION,t="// "+d+"\n"+t);g&&(E=v.generate(c,a));c.inlineMap&&(a=D(JSON.stringify(E)),g="//# sourceURL\x3d"+(null!=(G=c.filename)?G:"coffeescript"),t=t+"\n"+("//# sourceMappingURL\x3ddata:application/json;base64,"+a)+"\n"+g);return c.sourceMap?{js:t,sourceMap:v,v3SourceMap:JSON.stringify(E,null,2)}:t});f.tokens=Ca(function(a,c){return z.tokenize(a,c)});f.nodes=Ca(function(a,c){return"string"===typeof a?n.parse(z.tokenize(a,c)):n.parse(a)});f.run=function(c,d){var f,g,k;null==d&&(d={});g=t.main;
g.filename=process.argv[1]=d.filename?v.realpathSync(d.filename):".";g.moduleCache&&(g.moduleCache={});f=d.filename?G.dirname(v.realpathSync(d.filename)):v.realpathSync(".");g.paths=t("module")._nodeModulePaths(f);if(!x.isCoffee(g.filename)||t.extensions)c=a(c,d),c=null!=(k=c.js)?k:c;return g._compile(c,g.filename)};f.eval=function(c,d){var f,g,k,h,m,l,n,v,x,w;null==d&&(d={});if(c=c.trim()){h=null!=(m=u.Script.createContext)?m:u.createContext;m=null!=(k=u.isContext)?k:function(a){return d.sandbox instanceof
h().constructor};if(h){if(null!=d.sandbox){if(m(d.sandbox))w=d.sandbox;else for(l in w=h(),m=d.sandbox,m)E.call(m,l)&&(k=m[l],w[l]=k);w.global=w.root=w.GLOBAL=w}else w=global;w.__filename=d.filename||"eval";w.__dirname=G.dirname(w.__filename);if(w===global&&!w.module&&!w.require){f=t("module");w.module=g=new f(d.modulename||"eval");w.require=k=function(a){return f._load(a,g,!0)};g.filename=w.__filename;x=Object.getOwnPropertyNames(t);m=0;for(n=x.length;m<n;m++)v=x[m],"paths"!==v&&"arguments"!==v&&
"caller"!==v&&(k[v]=t[v]);k.paths=g.paths=f._nodeModulePaths(process.cwd());k.resolve=function(a){return f._resolveFilename(a,g)}}}m={};for(l in d)E.call(d,l)&&(k=d[l],m[l]=k);m.bare=!0;c=a(c,m);return w===global?u.runInThisContext(c):u.runInContext(c,w)}};f.register=function(){return t("./register")};if(t.extensions)for(M=this.FILE_EXTENSIONS,Ca=function(a){var c;return null!=(c=t.extensions)[a]?c[a]:c[a]=function(){throw Error("Use CoffeeScript.register() or require the coffee-script/register module to require "+
a+" files.");}},F=0,w=M.length;F<w;F++)c=M[F],Ca(c);f._compileFile=function(c,d,f){var g,k;null==d&&(d=!1);null==f&&(f=!1);k=v.readFileSync(c,"utf8");k=65279===k.charCodeAt(0)?k.substring(1):k;try{g=a(k,{filename:c,sourceMap:d,inlineMap:f,sourceFiles:[c],literate:x.isLiterate(c)})}catch(h){throw x.updateSyntaxError(h,k,c);}return g};z=new oa;n.lexer={lex:function(){var a,c;(c=n.tokens[this.pos++])?(a=c[0],this.yytext=c[1],this.yylloc=c[2],n.errorToken=c.origin||c,this.yylineno=this.yylloc.first_line):
a="";return a},setInput:function(a){n.tokens=a;return this.pos=0},upcomingInput:function(){return""}};n.yy=t("./nodes");n.yy.parseError=function(a,c){var d,f,g,h;g=n.errorToken;h=n.tokens;d=g[0];f=g[1];a=g[2];f=function(){switch(!1){case g!==h[h.length-1]:return"end of input";case "INDENT"!==d&&"OUTDENT"!==d:return"indentation";case "IDENTIFIER"!==d&&"NUMBER"!==d&&"INFINITY"!==d&&"STRING"!==d&&"STRING_START"!==d&&"REGEX"!==d&&"REGEX_START"!==d:return d.replace(/_START$/,"").toLowerCase();default:return x.nameWhitespaceCharacter(f)}}();
return x.throwSyntaxError("unexpected "+f,a)};d=function(a,c){var d,f,g,h;a.isNative()?d="native":(a.isEval()?(f=a.getScriptNameOrSourceURL())||a.getEvalOrigin():f=a.getFileName(),f||(f="\x3canonymous\x3e"),g=a.getLineNumber(),d=a.getColumnNumber(),d=(c=c(f,g,d))?f+":"+c[0]+":"+c[1]:f+":"+g+":"+d);f=a.getFunctionName();g=a.isConstructor();if(a.isToplevel()||g)return g?"new "+(f||"\x3canonymous\x3e")+" ("+d+")":f?f+" ("+d+")":d;g=a.getMethodName();h=a.getTypeName();return f?(c=a="",h&&f.indexOf(h)&&
(c=h+"."),g&&f.indexOf("."+g)!==f.length-g.length-1&&(a=" [as "+g+"]"),""+c+f+a+" ("+d+")"):h+"."+(g||"\x3canonymous\x3e")+" ("+d+")"};I={};l=function(a){var d,l,m;if(I[a])return I[a];m=f.FILE_EXTENSIONS;d=0;for(l=m.length;d<l;d++)if(c=m[d],x.ends(a,c))return d=f._compileFile(a,!0),I[a]=d.sourceMap;return null};Error.prepareStackTrace=function(a,c){var g,m,k;k=function(a,c,d){var f;(a=l(a))&&(f=a.sourceLocation([c-1,d-1]));return f?[f[0]+1,f[1]+1]:null};m=function(){var a,l,m;m=[];a=0;for(l=c.length;a<
l;a++){g=c[a];if(g.getFunction()===f.run)break;m.push(" at "+d(g,k))}return m}();return a.toString()+"\n"+m.join("\n")+"\n"}}).call(this);return f}();t["./browser"]=function(){(function(){var f,oa,wa,D=[].indexOf||function(a){for(var c=0,f=this.length;c<f;c++)if(c in this&&this[c]===a)return c;return-1};f=t("./coffee-script");f.require=t;oa=f.compile;f.eval=function(a,c){null==c&&(c={});null==c.bare&&(c.bare=!0);return eval(oa(a,c))};f.run=function(a,c){null==c&&(c={});c.bare=!0;c.shiftLine=!0;return Function(oa(a,
c))()};"undefined"!==typeof window&&null!==window&&("undefined"!==typeof btoa&&null!==btoa&&"undefined"!==typeof JSON&&null!==JSON&&(oa=function(a,c){null==c&&(c={});c.inlineMap=!0;return f.compile(a,c)}),f.load=function(a,c,t,d){var v;null==t&&(t={});null==d&&(d=!1);t.sourceFiles=[a];v=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest;v.open("GET",a,!0);"overrideMimeType"in v&&v.overrideMimeType("text/plain");v.onreadystatechange=function(){var l;if(4===
v.readyState){if(0===(l=v.status)||200===l)l=[v.responseText,t],d||f.run.apply(f,l);else throw Error("Could not load "+a);if(c)return c(l)}};return v.send(null)},wa=function(){var a,c,t,d,v,l,x,F,w,z,n;n=window.document.getElementsByTagName("script");c=["text/coffeescript","text/literate-coffeescript"];a=function(){var a,d,f,l;l=[];a=0;for(d=n.length;a<d;a++)w=n[a],(f=w.type,0<=D.call(c,f))&&l.push(w);return l}();l=0;t=function(){var c;c=a[l];if(c instanceof Array)return f.run.apply(f,c),l++,t()};
d=function(d,l){var n,u;n={literate:d.type===c[1]};if(u=d.src||d.getAttribute("data-src"))return f.load(u,function(c){a[l]=c;return t()},n,!0);n.sourceFiles=["embedded"];return a[l]=[d.innerHTML,n]};v=x=0;for(F=a.length;x<F;v=++x)z=a[v],d(z,v);return t()},window.addEventListener?window.addEventListener("DOMContentLoaded",wa,!1):window.attachEvent("onload",wa))}).call(this);return{}}();return t["./coffee-script"]}();"function"===typeof define&&define.amd?define(function(){return ya}):t.CoffeeScript=
ya})(this);

4764
docs/v1/index.html Normal file

File diff suppressed because one or more lines are too long

10000
docs/v1/test.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
class Person
constructor: (options) ->
{@name, @age, @height} = options
tim = new Person age: 4

View File

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

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,5 +2,3 @@
SkinnyMochaHalfCaffScript Compiler v1.0
Released under the MIT License
###

View File

@@ -6,4 +6,4 @@ task 'build:parser', 'rebuild the Jison parser', (options) ->
require 'jison'
code = require('./lib/grammar').parser.generate()
dir = options.output or 'lib'
fs.writeFile "#{dir}/parser.js", code
fs.writeFile "#{dir}/parser.js", code

View File

@@ -4,5 +4,3 @@ $ 'body'
.fadeIn 'fast'
.addClass '.active'
.css 'background', 'white'

View File

@@ -19,7 +19,3 @@ tom = new Horse "Tommy the Palomino"
sam.move()
tom.move()

View File

@@ -1,5 +1,3 @@
cholesterol = 127
healthy = 200 > cholesterol > 60

View File

@@ -7,6 +7,3 @@ else
showIt()
date = if friday then sue else jill

View File

@@ -0,0 +1,5 @@
class Person
constructor: (options) ->
{@name, @age, @height = 'average'} = options
tim = new Person name: 'Tim', age: 4

View File

@@ -1,8 +1,2 @@
fill = (container, liquid = "coffee") ->
"Filling the #{container} with #{liquid}..."

View File

@@ -1,4 +1,4 @@
for filename in list
do (filename) ->
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
compile filename, contents.toString()

View File

@@ -1,6 +1,3 @@
hi = `function() {
return [document.title, "Hello JavaScript"].join(": ");
}`

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\\\`\`;
}`

View File

@@ -4,10 +4,3 @@ speed = 0
speed ?= 15
footprints = yeti ? "bear"

View File

@@ -2,6 +2,3 @@ text = "Every literary critic believes he will
outwit history and have the last word"
[first, ..., last] = text.split " "

View File

@@ -6,4 +6,4 @@ grade = (student) ->
else
"C"
eldest = if 24 > 21 then "Liz" else "Ike"
eldest = if 24 > 21 then "Liz" else "Ike"

View File

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

View File

@@ -4,4 +4,3 @@ alert(
catch error
"And the error is ... #{error}"
)

View File

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

View File

@@ -0,0 +1,13 @@
fibonacci = ->
[previous, current] = [1, 1]
loop
[previous, current] = [current, previous + current]
yield current
return
getFibonacciNumbers = (length) ->
results = [1]
for n from fibonacci()
results.push n
break if results.length is length
results

View File

@@ -0,0 +1,8 @@
perfectSquares = ->
num = 0
loop
num += 1
yield num * num
return
window.ps or= perfectSquares()

View File

@@ -3,4 +3,3 @@ html = """
cup of coffeescript
</strong>
"""

View File

@@ -7,5 +7,3 @@ OPERATOR = /// ^ (
| \?\. # soak access
| \.{2,3} # range or splat
) ///

View File

@@ -2,8 +2,3 @@ author = "Wittgenstein"
quote = "A picture is a fact. -- #{ author }"
sentence = "#{ 22 / 7 } is a decent approximation of π"

View File

@@ -0,0 +1,22 @@
import 'local-file.coffee'
import 'coffee-script'
import _ from 'underscore'
import * as underscore from 'underscore'
import { now } from 'underscore'
import { now as currentTimestamp } from 'underscore'
import { first, last } from 'underscore'
import utilityBelt, { each } from 'underscore'
export default Math
export square = (x) -> x * x
export class Mathematics
least: (x, y) -> if x < y then x else y
export { sqrt }
export { sqrt as squareRoot }
export { Mathematics as default, sqrt as squareRoot }
export * from 'underscore'
export { max, min } from 'underscore'

View File

@@ -0,0 +1,4 @@
-7 % 5 == -2 # The remainder of 7 / 5
-7 %% 5 == 3 # n %% 5 is always between 0 and 4
tabs.selectTabAtIndex((tabs.currentIndex - count) %% tabs.length)

View File

@@ -3,7 +3,3 @@ weatherReport = (location) ->
[location, 72, "Mostly Sunny"]
[city, temp, forecast] = weatherReport "Berkeley, CA"

View File

@@ -9,6 +9,3 @@ futurists =
]
{poet: {name, address: [street, city]}} = futurists

View File

@@ -15,5 +15,3 @@ kids =
sister:
name: "Ida"
age: 9

View File

@@ -1,5 +1,3 @@
$('.account').attr class: 'active'
log object.class

View File

@@ -0,0 +1,5 @@
name = "Michelangelo"
mask = "orange"
weapon = "nunchuks"
turtle = {name, mask, weapon}
output = "#{turtle.name} wears an #{turtle.mask} mask. Watch out for his #{turtle.weapon}!"

View File

@@ -2,8 +2,3 @@ theBait = 1000
theSwitch = 0
[theBait, theSwitch] = [theSwitch, theBait]

View File

@@ -1,9 +1,3 @@
tag = "<impossible>"
[open, contents..., close] = tag.split("")

View File

@@ -1,3 +1,2 @@
String::dasherize = ->
this.replace /_/g, "-"

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