batman-rails-flo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +29 -0
  3. data/Rakefile +2 -0
  4. data/lib/batman-rails-flo.rb +5 -0
  5. data/lib/batman_rails_flo/railtie.rb +9 -0
  6. data/lib/batman_rails_flo/tasks.rake +14 -0
  7. data/lib/batman_rails_flo/version.rb +3 -0
  8. data/vendor/assets/javascripts/batman_rails_flo/flo_server.js +67 -0
  9. data/vendor/assets/javascripts/batman_rails_flo/live_reload.js.coffee +129 -0
  10. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CNAME +1 -0
  11. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CONTRIBUTING.md +9 -0
  12. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/LICENSE +22 -0
  13. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/README +50 -0
  14. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/cake +7 -0
  15. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/coffee +7 -0
  16. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/browser.js +134 -0
  17. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/cake.js +112 -0
  18. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/coffee-script.js +335 -0
  19. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/command.js +569 -0
  20. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/grammar.js +631 -0
  21. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/helpers.js +252 -0
  22. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
  23. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/lexer.js +926 -0
  24. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/nodes.js +3158 -0
  25. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/optparse.js +139 -0
  26. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/parser.js +724 -0
  27. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/register.js +66 -0
  28. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/repl.js +163 -0
  29. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/rewriter.js +475 -0
  30. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
  31. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/sourcemap.js +161 -0
  32. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/LICENSE +21 -0
  33. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js +6 -0
  34. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/index.js +82 -0
  35. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/package.json +34 -0
  36. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/readme.markdown +63 -0
  37. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js +38 -0
  38. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js +37 -0
  39. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js +28 -0
  40. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm.js +32 -0
  41. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js +39 -0
  42. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/race.js +41 -0
  43. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/rel.js +32 -0
  44. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return.js +25 -0
  45. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js +24 -0
  46. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/root.js +18 -0
  47. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/sync.js +32 -0
  48. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask.js +28 -0
  49. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js +32 -0
  50. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/package.json +50 -0
  51. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/register.js +1 -0
  52. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/LICENSE +30 -0
  53. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/PATENTS +23 -0
  54. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/README.md +124 -0
  55. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/bin/flo +26 -0
  56. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.html +57 -0
  57. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.js +205 -0
  58. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/style.css +334 -0
  59. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/connection.js +235 -0
  60. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/devtools.html +12 -0
  61. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/index.js +323 -0
  62. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logger.js +42 -0
  63. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logo.png +0 -0
  64. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/manifest.json +13 -0
  65. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/session.js +305 -0
  66. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/index.js +10 -0
  67. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/flo.js +226 -0
  68. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/server.js +94 -0
  69. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/README.md +66 -0
  70. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/index.js +437 -0
  71. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/LICENSE +23 -0
  72. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/README.md +218 -0
  73. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/minimatch.js +1055 -0
  74. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
  75. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  76. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  77. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
  78. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/package.json +33 -0
  79. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
  80. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  81. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  82. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  83. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  84. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  85. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/package.json +42 -0
  86. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  87. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  88. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/package.json +40 -0
  89. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/basic.js +399 -0
  90. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/brace-expand.js +33 -0
  91. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/caching.js +14 -0
  92. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/defaults.js +274 -0
  93. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  94. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/lib/walker.js +111 -0
  95. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/license +13 -0
  96. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/lib/makeerror.js +87 -0
  97. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/lib/tmpl.js +17 -0
  98. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/package.json +31 -0
  99. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/readme.md +10 -0
  100. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/package.json +34 -0
  101. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/readme.md +77 -0
  102. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/package.json +36 -0
  103. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/readme.md +52 -0
  104. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/LICENSE +55 -0
  105. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/main.js +128 -0
  106. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/package.json +34 -0
  107. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/readme.mkd +72 -0
  108. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/d/t +0 -0
  109. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/t +0 -0
  110. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitor.js +31 -0
  111. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitorRootDirectory.js +28 -0
  112. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js +20 -0
  113. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/package.json +45 -0
  114. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/test/test.js +243 -0
  115. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/CHANGELOG.md +81 -0
  116. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/LICENSE +177 -0
  117. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/Makefile +11 -0
  118. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/README.md +245 -0
  119. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/binding.gyp +14 -0
  120. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Makefile +355 -0
  121. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/linker.lock +0 -0
  122. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/validation/src/validation.o +0 -0
  123. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/xor/src/xor.o +0 -0
  124. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/validation.node +0 -0
  125. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/xor.node +0 -0
  126. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/binding.Makefile +6 -0
  127. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/config.gypi +115 -0
  128. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/gyp-mac-tool +512 -0
  129. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/validation.target.mk +154 -0
  130. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/xor.target.mk +154 -0
  131. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/index.js +1 -0
  132. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/install.js +31 -0
  133. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Constants.js +23 -0
  134. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Deprecation.js +38 -0
  135. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.fallback.js +12 -0
  136. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.js +18 -0
  137. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketClient.js +359 -0
  138. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketConnection.js +717 -0
  139. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketFrame.js +282 -0
  140. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRequest.js +478 -0
  141. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouter.js +154 -0
  142. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouterRequest.js +59 -0
  143. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketServer.js +216 -0
  144. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/utils.js +7 -0
  145. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/websocket.js +11 -0
  146. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.fallback.js +13 -0
  147. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.js +18 -0
  148. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/package.json +43 -0
  149. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/validation.cc +144 -0
  150. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/xor.cpp +86 -0
  151. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/FastBufferList.js +192 -0
  152. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/LICENSE +18 -0
  153. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/ctio-faster.js +1126 -0
  154. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/package.json +25 -0
  155. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/browser_websocket.js +63 -0
  156. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/connection_test.js +57 -0
  157. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/logger_mock.js +15 -0
  158. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/session_test.js +194 -0
  159. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/server/flo_test.js +211 -0
  160. data/vendor/assets/javascripts/batman_rails_flo/package.json +15 -0
  161. data/vendor/assets/javascripts/batman_rails_flo/reload_event_handler.js.coffee +56 -0
  162. metadata +232 -0
@@ -0,0 +1,66 @@
1
+ // Generated by CoffeeScript 1.7.1
2
+ (function() {
3
+ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, loadFile, path, _i, _len, _ref;
4
+
5
+ CoffeeScript = require('./coffee-script');
6
+
7
+ child_process = require('child_process');
8
+
9
+ helpers = require('./helpers');
10
+
11
+ path = require('path');
12
+
13
+ loadFile = function(module, filename) {
14
+ var answer;
15
+ answer = CoffeeScript._compileFile(filename, false);
16
+ return module._compile(answer, filename);
17
+ };
18
+
19
+ if (require.extensions) {
20
+ _ref = CoffeeScript.FILE_EXTENSIONS;
21
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
22
+ ext = _ref[_i];
23
+ require.extensions[ext] = loadFile;
24
+ }
25
+ Module = require('module');
26
+ findExtension = function(filename) {
27
+ var curExtension, extensions;
28
+ extensions = path.basename(filename).split('.');
29
+ if (extensions[0] === '') {
30
+ extensions.shift();
31
+ }
32
+ while (extensions.shift()) {
33
+ curExtension = '.' + extensions.join('.');
34
+ if (Module._extensions[curExtension]) {
35
+ return curExtension;
36
+ }
37
+ }
38
+ return '.js';
39
+ };
40
+ Module.prototype.load = function(filename) {
41
+ var extension;
42
+ this.filename = filename;
43
+ this.paths = Module._nodeModulePaths(path.dirname(filename));
44
+ extension = findExtension(filename);
45
+ Module._extensions[extension](this, filename);
46
+ return this.loaded = true;
47
+ };
48
+ }
49
+
50
+ if (child_process) {
51
+ fork = child_process.fork;
52
+ binary = require.resolve('../../bin/coffee');
53
+ child_process.fork = function(path, args, options) {
54
+ if (helpers.isCoffee(path)) {
55
+ if (!Array.isArray(args)) {
56
+ options = args || {};
57
+ args = [];
58
+ }
59
+ args = [path].concat(args);
60
+ path = binary;
61
+ }
62
+ return fork(path, args, options);
63
+ };
64
+ }
65
+
66
+ }).call(this);
@@ -0,0 +1,163 @@
1
+ // Generated by CoffeeScript 1.7.1
2
+ (function() {
3
+ var CoffeeScript, addHistory, addMultilineHandler, fs, merge, nodeREPL, path, replDefaults, updateSyntaxError, vm, _ref;
4
+
5
+ fs = require('fs');
6
+
7
+ path = require('path');
8
+
9
+ vm = require('vm');
10
+
11
+ nodeREPL = require('repl');
12
+
13
+ CoffeeScript = require('./coffee-script');
14
+
15
+ _ref = require('./helpers'), merge = _ref.merge, updateSyntaxError = _ref.updateSyntaxError;
16
+
17
+ replDefaults = {
18
+ prompt: 'coffee> ',
19
+ historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0,
20
+ historyMaxInputSize: 10240,
21
+ "eval": function(input, context, filename, cb) {
22
+ var Assign, Block, Literal, Value, ast, err, js, result, _ref1;
23
+ input = input.replace(/\uFF00/g, '\n');
24
+ input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
25
+ _ref1 = require('./nodes'), Block = _ref1.Block, Assign = _ref1.Assign, Value = _ref1.Value, Literal = _ref1.Literal;
26
+ try {
27
+ ast = CoffeeScript.nodes(input);
28
+ ast = new Block([new Assign(new Value(new Literal('_')), ast, '=')]);
29
+ js = ast.compile({
30
+ bare: true,
31
+ locals: Object.keys(context)
32
+ });
33
+ result = context === global ? vm.runInThisContext(js, filename) : vm.runInContext(js, context, filename);
34
+ return cb(null, result);
35
+ } catch (_error) {
36
+ err = _error;
37
+ updateSyntaxError(err, input);
38
+ return cb(err);
39
+ }
40
+ }
41
+ };
42
+
43
+ addMultilineHandler = function(repl) {
44
+ var inputStream, multiline, nodeLineListener, outputStream, rli;
45
+ rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream;
46
+ multiline = {
47
+ enabled: false,
48
+ initialPrompt: repl.prompt.replace(/^[^> ]*/, function(x) {
49
+ return x.replace(/./g, '-');
50
+ }),
51
+ prompt: repl.prompt.replace(/^[^> ]*>?/, function(x) {
52
+ return x.replace(/./g, '.');
53
+ }),
54
+ buffer: ''
55
+ };
56
+ nodeLineListener = rli.listeners('line')[0];
57
+ rli.removeListener('line', nodeLineListener);
58
+ rli.on('line', function(cmd) {
59
+ if (multiline.enabled) {
60
+ multiline.buffer += "" + cmd + "\n";
61
+ rli.setPrompt(multiline.prompt);
62
+ rli.prompt(true);
63
+ } else {
64
+ nodeLineListener(cmd);
65
+ }
66
+ });
67
+ return inputStream.on('keypress', function(char, key) {
68
+ if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) {
69
+ return;
70
+ }
71
+ if (multiline.enabled) {
72
+ if (!multiline.buffer.match(/\n/)) {
73
+ multiline.enabled = !multiline.enabled;
74
+ rli.setPrompt(repl.prompt);
75
+ rli.prompt(true);
76
+ return;
77
+ }
78
+ if ((rli.line != null) && !rli.line.match(/^\s*$/)) {
79
+ return;
80
+ }
81
+ multiline.enabled = !multiline.enabled;
82
+ rli.line = '';
83
+ rli.cursor = 0;
84
+ rli.output.cursorTo(0);
85
+ rli.output.clearLine(1);
86
+ multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00');
87
+ rli.emit('line', multiline.buffer);
88
+ multiline.buffer = '';
89
+ } else {
90
+ multiline.enabled = !multiline.enabled;
91
+ rli.setPrompt(multiline.initialPrompt);
92
+ rli.prompt(true);
93
+ }
94
+ });
95
+ };
96
+
97
+ addHistory = function(repl, filename, maxSize) {
98
+ var buffer, fd, lastLine, readFd, size, stat;
99
+ lastLine = null;
100
+ try {
101
+ stat = fs.statSync(filename);
102
+ size = Math.min(maxSize, stat.size);
103
+ readFd = fs.openSync(filename, 'r');
104
+ buffer = new Buffer(size);
105
+ fs.readSync(readFd, buffer, 0, size, stat.size - size);
106
+ repl.rli.history = buffer.toString().split('\n').reverse();
107
+ if (stat.size > maxSize) {
108
+ repl.rli.history.pop();
109
+ }
110
+ if (repl.rli.history[0] === '') {
111
+ repl.rli.history.shift();
112
+ }
113
+ repl.rli.historyIndex = -1;
114
+ lastLine = repl.rli.history[0];
115
+ } catch (_error) {}
116
+ fd = fs.openSync(filename, 'a');
117
+ repl.rli.addListener('line', function(code) {
118
+ if (code && code.length && code !== '.history' && lastLine !== code) {
119
+ fs.write(fd, "" + code + "\n");
120
+ return lastLine = code;
121
+ }
122
+ });
123
+ repl.rli.on('exit', function() {
124
+ return fs.close(fd);
125
+ });
126
+ return repl.commands['.history'] = {
127
+ help: 'Show command history',
128
+ action: function() {
129
+ repl.outputStream.write("" + (repl.rli.history.slice(0).reverse().join('\n')) + "\n");
130
+ return repl.displayPrompt();
131
+ }
132
+ };
133
+ };
134
+
135
+ module.exports = {
136
+ start: function(opts) {
137
+ var build, major, minor, repl, _ref1;
138
+ if (opts == null) {
139
+ opts = {};
140
+ }
141
+ _ref1 = process.versions.node.split('.').map(function(n) {
142
+ return parseInt(n);
143
+ }), major = _ref1[0], minor = _ref1[1], build = _ref1[2];
144
+ if (major === 0 && minor < 8) {
145
+ console.warn("Node 0.8.0+ required for CoffeeScript REPL");
146
+ process.exit(1);
147
+ }
148
+ CoffeeScript.register();
149
+ process.argv = ['coffee'].concat(process.argv.slice(2));
150
+ opts = merge(replDefaults, opts);
151
+ repl = nodeREPL.start(opts);
152
+ repl.on('exit', function() {
153
+ return repl.outputStream.write('\n');
154
+ });
155
+ addMultilineHandler(repl);
156
+ if (opts.historyFile) {
157
+ addHistory(repl, opts.historyFile, opts.historyMaxInputSize);
158
+ }
159
+ return repl;
160
+ }
161
+ };
162
+
163
+ }).call(this);
@@ -0,0 +1,475 @@
1
+ // Generated by CoffeeScript 1.7.1
2
+ (function() {
3
+ var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
4
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
5
+ __slice = [].slice;
6
+
7
+ generate = function(tag, value, origin) {
8
+ var tok;
9
+ tok = [tag, value];
10
+ tok.generated = true;
11
+ if (origin) {
12
+ tok.origin = origin;
13
+ }
14
+ return tok;
15
+ };
16
+
17
+ exports.Rewriter = (function() {
18
+ function Rewriter() {}
19
+
20
+ Rewriter.prototype.rewrite = function(tokens) {
21
+ this.tokens = tokens;
22
+ this.removeLeadingNewlines();
23
+ this.closeOpenCalls();
24
+ this.closeOpenIndexes();
25
+ this.normalizeLines();
26
+ this.tagPostfixConditionals();
27
+ this.addImplicitBracesAndParens();
28
+ this.addLocationDataToGeneratedTokens();
29
+ return this.tokens;
30
+ };
31
+
32
+ Rewriter.prototype.scanTokens = function(block) {
33
+ var i, token, tokens;
34
+ tokens = this.tokens;
35
+ i = 0;
36
+ while (token = tokens[i]) {
37
+ i += block.call(this, token, i, tokens);
38
+ }
39
+ return true;
40
+ };
41
+
42
+ Rewriter.prototype.detectEnd = function(i, condition, action) {
43
+ var levels, token, tokens, _ref, _ref1;
44
+ tokens = this.tokens;
45
+ levels = 0;
46
+ while (token = tokens[i]) {
47
+ if (levels === 0 && condition.call(this, token, i)) {
48
+ return action.call(this, token, i);
49
+ }
50
+ if (!token || levels < 0) {
51
+ return action.call(this, token, i - 1);
52
+ }
53
+ if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
54
+ levels += 1;
55
+ } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
56
+ levels -= 1;
57
+ }
58
+ i += 1;
59
+ }
60
+ return i - 1;
61
+ };
62
+
63
+ Rewriter.prototype.removeLeadingNewlines = function() {
64
+ var i, tag, _i, _len, _ref;
65
+ _ref = this.tokens;
66
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
67
+ tag = _ref[i][0];
68
+ if (tag !== 'TERMINATOR') {
69
+ break;
70
+ }
71
+ }
72
+ if (i) {
73
+ return this.tokens.splice(0, i);
74
+ }
75
+ };
76
+
77
+ Rewriter.prototype.closeOpenCalls = function() {
78
+ var action, condition;
79
+ condition = function(token, i) {
80
+ var _ref;
81
+ return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
82
+ };
83
+ action = function(token, i) {
84
+ return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
85
+ };
86
+ return this.scanTokens(function(token, i) {
87
+ if (token[0] === 'CALL_START') {
88
+ this.detectEnd(i + 1, condition, action);
89
+ }
90
+ return 1;
91
+ });
92
+ };
93
+
94
+ Rewriter.prototype.closeOpenIndexes = function() {
95
+ var action, condition;
96
+ condition = function(token, i) {
97
+ var _ref;
98
+ return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
99
+ };
100
+ action = function(token, i) {
101
+ return token[0] = 'INDEX_END';
102
+ };
103
+ return this.scanTokens(function(token, i) {
104
+ if (token[0] === 'INDEX_START') {
105
+ this.detectEnd(i + 1, condition, action);
106
+ }
107
+ return 1;
108
+ });
109
+ };
110
+
111
+ Rewriter.prototype.matchTags = function() {
112
+ var fuzz, i, j, pattern, _i, _ref, _ref1;
113
+ i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
114
+ fuzz = 0;
115
+ for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) {
116
+ while (this.tag(i + j + fuzz) === 'HERECOMMENT') {
117
+ fuzz += 2;
118
+ }
119
+ if (pattern[j] == null) {
120
+ continue;
121
+ }
122
+ if (typeof pattern[j] === 'string') {
123
+ pattern[j] = [pattern[j]];
124
+ }
125
+ if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) {
126
+ return false;
127
+ }
128
+ }
129
+ return true;
130
+ };
131
+
132
+ Rewriter.prototype.looksObjectish = function(j) {
133
+ return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':');
134
+ };
135
+
136
+ Rewriter.prototype.findTagsBackwards = function(i, tags) {
137
+ var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
138
+ backStack = [];
139
+ while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) {
140
+ if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) {
141
+ backStack.push(this.tag(i));
142
+ }
143
+ if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) {
144
+ backStack.pop();
145
+ }
146
+ i -= 1;
147
+ }
148
+ return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0;
149
+ };
150
+
151
+ Rewriter.prototype.addImplicitBracesAndParens = function() {
152
+ var stack;
153
+ stack = [];
154
+ return this.scanTokens(function(token, i, tokens) {
155
+ var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, newLine, nextTag, offset, prevTag, prevToken, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
156
+ tag = token[0];
157
+ prevTag = (prevToken = i > 0 ? tokens[i - 1] : [])[0];
158
+ nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
159
+ stackTop = function() {
160
+ return stack[stack.length - 1];
161
+ };
162
+ startIdx = i;
163
+ forward = function(n) {
164
+ return i - startIdx + n;
165
+ };
166
+ inImplicit = function() {
167
+ var _ref, _ref1;
168
+ return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0;
169
+ };
170
+ inImplicitCall = function() {
171
+ var _ref;
172
+ return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '(';
173
+ };
174
+ inImplicitObject = function() {
175
+ var _ref;
176
+ return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{';
177
+ };
178
+ inImplicitControl = function() {
179
+ var _ref;
180
+ return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL';
181
+ };
182
+ startImplicitCall = function(j) {
183
+ var idx;
184
+ idx = j != null ? j : i;
185
+ stack.push([
186
+ '(', idx, {
187
+ ours: true
188
+ }
189
+ ]);
190
+ tokens.splice(idx, 0, generate('CALL_START', '('));
191
+ if (j == null) {
192
+ return i += 1;
193
+ }
194
+ };
195
+ endImplicitCall = function() {
196
+ stack.pop();
197
+ tokens.splice(i, 0, generate('CALL_END', ')'));
198
+ return i += 1;
199
+ };
200
+ startImplicitObject = function(j, startsLine) {
201
+ var idx;
202
+ if (startsLine == null) {
203
+ startsLine = true;
204
+ }
205
+ idx = j != null ? j : i;
206
+ stack.push([
207
+ '{', idx, {
208
+ sameLine: true,
209
+ startsLine: startsLine,
210
+ ours: true
211
+ }
212
+ ]);
213
+ tokens.splice(idx, 0, generate('{', generate(new String('{')), token));
214
+ if (j == null) {
215
+ return i += 1;
216
+ }
217
+ };
218
+ endImplicitObject = function(j) {
219
+ j = j != null ? j : i;
220
+ stack.pop();
221
+ tokens.splice(j, 0, generate('}', '}', token));
222
+ return i += 1;
223
+ };
224
+ if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) {
225
+ stack.push([
226
+ 'CONTROL', i, {
227
+ ours: true
228
+ }
229
+ ]);
230
+ return forward(1);
231
+ }
232
+ if (tag === 'INDENT' && inImplicit()) {
233
+ if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') {
234
+ while (inImplicitCall()) {
235
+ endImplicitCall();
236
+ }
237
+ }
238
+ if (inImplicitControl()) {
239
+ stack.pop();
240
+ }
241
+ stack.push([tag, i]);
242
+ return forward(1);
243
+ }
244
+ if (__indexOf.call(EXPRESSION_START, tag) >= 0) {
245
+ stack.push([tag, i]);
246
+ return forward(1);
247
+ }
248
+ if (__indexOf.call(EXPRESSION_END, tag) >= 0) {
249
+ while (inImplicit()) {
250
+ if (inImplicitCall()) {
251
+ endImplicitCall();
252
+ } else if (inImplicitObject()) {
253
+ endImplicitObject();
254
+ } else {
255
+ stack.pop();
256
+ }
257
+ }
258
+ stack.pop();
259
+ }
260
+ if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) {
261
+ if (tag === '?') {
262
+ tag = token[0] = 'FUNC_EXIST';
263
+ }
264
+ startImplicitCall(i + 1);
265
+ return forward(2);
266
+ }
267
+ if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
268
+ startImplicitCall(i + 1);
269
+ stack.push(['INDENT', i + 2]);
270
+ return forward(3);
271
+ }
272
+ if (tag === ':') {
273
+ if (this.tag(i - 2) === '@') {
274
+ s = i - 2;
275
+ } else {
276
+ s = i - 1;
277
+ }
278
+ while (this.tag(s - 2) === 'HERECOMMENT') {
279
+ s -= 2;
280
+ }
281
+ this.insideForDeclaration = nextTag === 'FOR';
282
+ startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine;
283
+ if (stackTop()) {
284
+ _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1];
285
+ if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) {
286
+ return forward(1);
287
+ }
288
+ }
289
+ startImplicitObject(s, !!startsLine);
290
+ return forward(2);
291
+ }
292
+ if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
293
+ stackTop()[2].sameLine = false;
294
+ }
295
+ newLine = prevTag === 'OUTDENT' || prevToken.newLine;
296
+ if (__indexOf.call(IMPLICIT_END, tag) >= 0 || __indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) {
297
+ while (inImplicit()) {
298
+ _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine);
299
+ if (inImplicitCall() && prevTag !== ',') {
300
+ endImplicitCall();
301
+ } else if (inImplicitObject() && !this.insideForDeclaration && sameLine && tag !== 'TERMINATOR' && prevTag !== ':' && endImplicitObject()) {
302
+
303
+ } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {
304
+ endImplicitObject();
305
+ } else {
306
+ break;
307
+ }
308
+ }
309
+ }
310
+ if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && !this.insideForDeclaration && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) {
311
+ offset = nextTag === 'OUTDENT' ? 1 : 0;
312
+ while (inImplicitObject()) {
313
+ endImplicitObject(i + offset);
314
+ }
315
+ }
316
+ return forward(1);
317
+ });
318
+ };
319
+
320
+ Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
321
+ return this.scanTokens(function(token, i, tokens) {
322
+ var column, line, nextLocation, prevLocation, _ref, _ref1;
323
+ if (token[2]) {
324
+ return 1;
325
+ }
326
+ if (!(token.generated || token.explicit)) {
327
+ return 1;
328
+ }
329
+ if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) {
330
+ line = nextLocation.first_line, column = nextLocation.first_column;
331
+ } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) {
332
+ line = prevLocation.last_line, column = prevLocation.last_column;
333
+ } else {
334
+ line = column = 0;
335
+ }
336
+ token[2] = {
337
+ first_line: line,
338
+ first_column: column,
339
+ last_line: line,
340
+ last_column: column
341
+ };
342
+ return 1;
343
+ });
344
+ };
345
+
346
+ Rewriter.prototype.normalizeLines = function() {
347
+ var action, condition, indent, outdent, starter;
348
+ starter = indent = outdent = null;
349
+ condition = function(token, i) {
350
+ var _ref, _ref1, _ref2, _ref3;
351
+ return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'TERMINATOR' && (_ref1 = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref2 = token[0]) === 'CATCH' || _ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (_ref3 = token[0], __indexOf.call(CALL_CLOSERS, _ref3) >= 0) && this.tokens[i - 1].newLine;
352
+ };
353
+ action = function(token, i) {
354
+ return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
355
+ };
356
+ return this.scanTokens(function(token, i, tokens) {
357
+ var j, tag, _i, _ref, _ref1, _ref2;
358
+ tag = token[0];
359
+ if (tag === 'TERMINATOR') {
360
+ if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
361
+ tokens.splice.apply(tokens, [i, 1].concat(__slice.call(this.indentation())));
362
+ return 1;
363
+ }
364
+ if (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0) {
365
+ tokens.splice(i, 1);
366
+ return 0;
367
+ }
368
+ }
369
+ if (tag === 'CATCH') {
370
+ for (j = _i = 1; _i <= 2; j = ++_i) {
371
+ if (!((_ref1 = this.tag(i + j)) === 'OUTDENT' || _ref1 === 'TERMINATOR' || _ref1 === 'FINALLY')) {
372
+ continue;
373
+ }
374
+ tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
375
+ return 2 + j;
376
+ }
377
+ }
378
+ if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
379
+ starter = tag;
380
+ _ref2 = this.indentation(tokens[i]), indent = _ref2[0], outdent = _ref2[1];
381
+ if (starter === 'THEN') {
382
+ indent.fromThen = true;
383
+ }
384
+ tokens.splice(i + 1, 0, indent);
385
+ this.detectEnd(i + 2, condition, action);
386
+ if (tag === 'THEN') {
387
+ tokens.splice(i, 1);
388
+ }
389
+ return 1;
390
+ }
391
+ return 1;
392
+ });
393
+ };
394
+
395
+ Rewriter.prototype.tagPostfixConditionals = function() {
396
+ var action, condition, original;
397
+ original = null;
398
+ condition = function(token, i) {
399
+ var prevTag, tag;
400
+ tag = token[0];
401
+ prevTag = this.tokens[i - 1][0];
402
+ return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0);
403
+ };
404
+ action = function(token, i) {
405
+ if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) {
406
+ return original[0] = 'POST_' + original[0];
407
+ }
408
+ };
409
+ return this.scanTokens(function(token, i) {
410
+ if (token[0] !== 'IF') {
411
+ return 1;
412
+ }
413
+ original = token;
414
+ this.detectEnd(i + 1, condition, action);
415
+ return 1;
416
+ });
417
+ };
418
+
419
+ Rewriter.prototype.indentation = function(origin) {
420
+ var indent, outdent;
421
+ indent = ['INDENT', 2];
422
+ outdent = ['OUTDENT', 2];
423
+ if (origin) {
424
+ indent.generated = outdent.generated = true;
425
+ indent.origin = outdent.origin = origin;
426
+ } else {
427
+ indent.explicit = outdent.explicit = true;
428
+ }
429
+ return [indent, outdent];
430
+ };
431
+
432
+ Rewriter.prototype.generate = generate;
433
+
434
+ Rewriter.prototype.tag = function(i) {
435
+ var _ref;
436
+ return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
437
+ };
438
+
439
+ return Rewriter;
440
+
441
+ })();
442
+
443
+ BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']];
444
+
445
+ exports.INVERSES = INVERSES = {};
446
+
447
+ EXPRESSION_START = [];
448
+
449
+ EXPRESSION_END = [];
450
+
451
+ for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) {
452
+ _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1];
453
+ EXPRESSION_START.push(INVERSES[rite] = left);
454
+ EXPRESSION_END.push(INVERSES[left] = rite);
455
+ }
456
+
457
+ EXPRESSION_CLOSE = ['CATCH', 'THEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
458
+
459
+ IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
460
+
461
+ IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];
462
+
463
+ IMPLICIT_UNSPACED_CALL = ['+', '-'];
464
+
465
+ IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
466
+
467
+ SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
468
+
469
+ SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
470
+
471
+ LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
472
+
473
+ CALL_CLOSERS = ['.', '?.', '::', '?::'];
474
+
475
+ }).call(this);