vulcan 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/lib/vulcan/cli.rb +20 -10
  2. data/lib/vulcan/version.rb +1 -1
  3. data/server/Procfile +1 -1
  4. data/server/bin/web +10 -0
  5. data/server/lib/cloudant.coffee +20 -0
  6. data/server/lib/logger.coffee +17 -0
  7. data/server/lib/on.coffee +10 -0
  8. data/server/lib/spawner.coffee +65 -0
  9. data/server/node_modules/coffee-script/CNAME +1 -0
  10. data/server/node_modules/coffee-script/LICENSE +22 -0
  11. data/server/node_modules/coffee-script/README +51 -0
  12. data/server/node_modules/coffee-script/Rakefile +78 -0
  13. data/server/node_modules/coffee-script/bin/cake +7 -0
  14. data/server/node_modules/coffee-script/bin/coffee +7 -0
  15. data/server/node_modules/coffee-script/extras/jsl.conf +44 -0
  16. data/server/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
  17. data/server/node_modules/coffee-script/lib/coffee-script/cake.js +111 -0
  18. data/server/node_modules/coffee-script/lib/coffee-script/coffee-script.js +167 -0
  19. data/server/node_modules/coffee-script/lib/coffee-script/command.js +500 -0
  20. data/server/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
  21. data/server/node_modules/coffee-script/lib/coffee-script/helpers.js +77 -0
  22. data/server/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
  23. data/server/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
  24. data/server/node_modules/coffee-script/lib/coffee-script/nodes.js +2986 -0
  25. data/server/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
  26. data/server/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
  27. data/server/node_modules/coffee-script/lib/coffee-script/repl.js +261 -0
  28. data/server/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
  29. data/server/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
  30. data/server/node_modules/coffee-script/package.json +55 -0
  31. data/server/node_modules/connect-form/History.md +0 -6
  32. data/server/node_modules/connect-form/lib/connect-form.js +2 -4
  33. data/server/node_modules/connect-form/node_modules/formidable/Readme.md +64 -36
  34. data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +5 -1
  35. data/server/node_modules/connect-form/node_modules/formidable/package.json +20 -6
  36. data/server/node_modules/connect-form/node_modules/formidable/test/common.js +5 -6
  37. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
  38. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +1 -1
  39. data/server/node_modules/connect-form/node_modules/formidable/test/{slow → integration}/test-fixtures.js +38 -33
  40. data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
  41. data/server/node_modules/connect-form/node_modules/formidable/test/run.js +1 -6
  42. data/server/node_modules/connect-form/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
  43. data/server/node_modules/connect-form/package.json +27 -5
  44. data/server/node_modules/cradle/README.md +10 -10
  45. data/server/node_modules/cradle/lib/cradle.js +117 -523
  46. data/server/node_modules/cradle/lib/cradle/database/attachments.js +120 -0
  47. data/server/node_modules/cradle/lib/cradle/database/changes.js +56 -0
  48. data/server/node_modules/cradle/lib/cradle/database/documents.js +215 -0
  49. data/server/node_modules/cradle/lib/cradle/database/index.js +65 -0
  50. data/server/node_modules/cradle/lib/cradle/database/views.js +125 -0
  51. data/server/node_modules/cradle/node_modules/follow/LICENSE +202 -0
  52. data/server/node_modules/cradle/node_modules/follow/README.md +164 -0
  53. data/server/node_modules/cradle/node_modules/follow/Rakefile +54 -0
  54. data/server/node_modules/cradle/node_modules/follow/api.js +35 -0
  55. data/server/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +453 -0
  56. data/server/node_modules/cradle/node_modules/follow/browser/export.js +78 -0
  57. data/server/node_modules/cradle/node_modules/follow/browser/index.html +14 -0
  58. data/server/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +18 -0
  59. data/server/node_modules/cradle/node_modules/follow/browser/log4js.js +46 -0
  60. data/server/node_modules/cradle/node_modules/follow/browser/main.js +92 -0
  61. data/server/node_modules/cradle/node_modules/follow/browser/querystring.js +28 -0
  62. data/server/node_modules/cradle/node_modules/follow/browser/request.jquery.js +237 -0
  63. data/server/node_modules/cradle/node_modules/follow/browser/require.js +33 -0
  64. data/server/node_modules/cradle/node_modules/follow/browser/util.js +28 -0
  65. data/server/node_modules/cradle/node_modules/follow/cli.js +101 -0
  66. data/server/node_modules/cradle/node_modules/follow/lib/feed.js +556 -0
  67. data/server/node_modules/cradle/node_modules/follow/lib/index.js +66 -0
  68. data/server/node_modules/cradle/node_modules/follow/lib/stream.js +305 -0
  69. data/server/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +55 -0
  70. data/server/node_modules/cradle/node_modules/follow/node_modules/request/README.md +285 -0
  71. data/server/node_modules/cradle/node_modules/follow/node_modules/request/main.js +618 -0
  72. data/server/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +146 -0
  73. data/server/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +34 -0
  74. data/server/node_modules/cradle/node_modules/follow/node_modules/request/package.json +42 -0
  75. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png +0 -0
  76. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +6 -0
  77. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +57 -0
  78. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +90 -0
  79. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +29 -0
  80. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +90 -0
  81. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +30 -0
  82. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +109 -0
  83. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +167 -0
  84. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +39 -0
  85. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +87 -0
  86. data/server/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +19 -0
  87. data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +55 -0
  88. data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +72 -0
  89. data/server/node_modules/cradle/node_modules/follow/package.json +45 -0
  90. data/server/node_modules/cradle/node_modules/follow/test/couch.js +153 -0
  91. data/server/node_modules/cradle/node_modules/follow/test/follow.js +136 -0
  92. data/server/node_modules/cradle/node_modules/follow/test/issues.js +178 -0
  93. data/server/node_modules/cradle/node_modules/follow/test/issues/10.js +24 -0
  94. data/server/node_modules/cradle/node_modules/follow/test/stream.js +493 -0
  95. data/server/node_modules/cradle/node_modules/request/LICENSE +55 -0
  96. data/server/node_modules/cradle/node_modules/request/README.md +287 -0
  97. data/server/node_modules/cradle/node_modules/request/forever.js +103 -0
  98. data/server/node_modules/cradle/node_modules/request/main.js +913 -0
  99. data/server/node_modules/cradle/node_modules/request/mimetypes.js +152 -0
  100. data/server/node_modules/cradle/node_modules/request/oauth.js +34 -0
  101. data/server/node_modules/cradle/node_modules/request/package.json +42 -0
  102. data/server/node_modules/cradle/node_modules/request/tests/googledoodle.png +0 -0
  103. data/server/node_modules/cradle/node_modules/request/tests/run.js +38 -0
  104. data/server/node_modules/cradle/node_modules/request/tests/server.js +82 -0
  105. data/server/node_modules/cradle/node_modules/request/tests/squid.conf +77 -0
  106. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +20 -0
  107. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl +0 -0
  108. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +17 -0
  109. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +13 -0
  110. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +18 -0
  111. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +1 -0
  112. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +19 -0
  113. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +16 -0
  114. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +11 -0
  115. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +28 -0
  116. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +9 -0
  117. data/server/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +16 -0
  118. data/server/node_modules/cradle/node_modules/request/tests/ssl/test.crt +15 -0
  119. data/server/node_modules/cradle/node_modules/request/tests/ssl/test.key +15 -0
  120. data/server/node_modules/cradle/node_modules/request/tests/test-body.js +95 -0
  121. data/server/node_modules/cradle/node_modules/request/tests/test-cookie.js +29 -0
  122. data/server/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +90 -0
  123. data/server/node_modules/cradle/node_modules/request/tests/test-defaults.js +68 -0
  124. data/server/node_modules/cradle/node_modules/request/tests/test-errors.js +37 -0
  125. data/server/node_modules/cradle/node_modules/request/tests/test-headers.js +52 -0
  126. data/server/node_modules/cradle/node_modules/request/tests/test-httpModule.js +94 -0
  127. data/server/node_modules/cradle/node_modules/request/tests/test-https-strict.js +97 -0
  128. data/server/node_modules/cradle/node_modules/request/tests/test-https.js +86 -0
  129. data/server/node_modules/cradle/node_modules/request/tests/test-oauth.js +117 -0
  130. data/server/node_modules/cradle/node_modules/request/tests/test-params.js +92 -0
  131. data/server/node_modules/cradle/node_modules/request/tests/test-pipes.js +202 -0
  132. data/server/node_modules/cradle/node_modules/request/tests/test-proxy.js +39 -0
  133. data/server/node_modules/cradle/node_modules/request/tests/test-qs.js +28 -0
  134. data/server/node_modules/cradle/node_modules/request/tests/test-redirect.js +154 -0
  135. data/server/node_modules/cradle/node_modules/request/tests/test-timeout.js +87 -0
  136. data/server/node_modules/cradle/node_modules/request/tests/test-toJSON.js +14 -0
  137. data/server/node_modules/cradle/node_modules/request/tests/test-tunnel.js +61 -0
  138. data/server/node_modules/cradle/node_modules/request/tunnel.js +229 -0
  139. data/server/node_modules/cradle/node_modules/request/uuid.js +19 -0
  140. data/server/node_modules/cradle/node_modules/request/vendor/cookie/index.js +65 -0
  141. data/server/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +72 -0
  142. data/server/node_modules/cradle/node_modules/vargs/package.json +33 -10
  143. data/server/node_modules/cradle/package.json +50 -12
  144. data/server/node_modules/cradle/test/cache-test.js +1 -4
  145. data/server/node_modules/cradle/test/connection-test.js +179 -0
  146. data/server/node_modules/cradle/test/database-attachment-test.js +344 -0
  147. data/server/node_modules/cradle/test/database-cache-test.js +132 -0
  148. data/server/node_modules/cradle/test/database-test.js +219 -0
  149. data/server/node_modules/cradle/test/database-view-test.js +141 -0
  150. data/server/node_modules/cradle/test/fixtures/databases.json +28 -1
  151. data/server/node_modules/cradle/test/helpers/seed.js +14 -5
  152. data/server/node_modules/cradle/test/response-test.js +1 -1
  153. data/server/node_modules/express/History.md +16 -0
  154. data/server/node_modules/express/bin/express +7 -6
  155. data/server/node_modules/express/lib-cov/application.js +510 -0
  156. data/server/node_modules/express/lib-cov/express.js +65 -0
  157. data/server/node_modules/express/lib-cov/middleware.js +54 -0
  158. data/server/node_modules/express/lib-cov/request.js +225 -0
  159. data/server/node_modules/express/lib-cov/response.js +611 -0
  160. data/server/node_modules/express/lib-cov/router/collection.js +40 -0
  161. data/server/node_modules/express/lib-cov/router/index.js +515 -0
  162. data/server/node_modules/express/lib-cov/router/methods.js +9 -0
  163. data/server/node_modules/express/lib-cov/router/route.js +68 -0
  164. data/server/node_modules/express/lib-cov/utils.js +151 -0
  165. data/server/node_modules/express/lib-cov/view.js +81 -0
  166. data/server/node_modules/express/lib/express.js +1 -1
  167. data/server/node_modules/express/lib/http.js +1 -2
  168. data/server/node_modules/express/lib/request.js +2 -2
  169. data/server/node_modules/express/lib/router/methods.js +10 -1
  170. data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
  171. data/server/node_modules/express/node_modules/connect/lib/http.js +3 -2
  172. data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +0 -2
  173. data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +1 -2
  174. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +42 -25
  175. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +1 -0
  176. data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +14 -3
  177. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
  178. data/server/node_modules/express/node_modules/connect/package.json +35 -7
  179. data/server/node_modules/express/node_modules/mime/package.json +30 -8
  180. data/server/node_modules/express/node_modules/mkdirp/README.markdown +35 -2
  181. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +1 -1
  182. data/server/node_modules/express/node_modules/mkdirp/index.js +72 -13
  183. data/server/node_modules/express/node_modules/mkdirp/package.json +39 -21
  184. data/server/node_modules/express/node_modules/mkdirp/test/chmod.js +38 -0
  185. data/server/node_modules/express/node_modules/mkdirp/test/clobber.js +37 -0
  186. data/server/node_modules/express/node_modules/mkdirp/test/perm.js +32 -0
  187. data/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js +39 -0
  188. data/server/node_modules/express/node_modules/mkdirp/test/sync.js +27 -0
  189. data/server/node_modules/express/node_modules/mkdirp/test/umask.js +28 -0
  190. data/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js +27 -0
  191. data/server/node_modules/express/node_modules/qs/History.md +10 -0
  192. data/server/node_modules/express/node_modules/qs/Readme.md +9 -2
  193. data/server/node_modules/express/node_modules/qs/examples.js +3 -0
  194. data/server/node_modules/express/node_modules/qs/lib/querystring.js +8 -6
  195. data/server/node_modules/express/node_modules/qs/package.json +26 -8
  196. data/server/node_modules/express/node_modules/qs/test/parse.js +13 -1
  197. data/server/node_modules/express/node_modules/qs/test/stringify.js +45 -37
  198. data/server/node_modules/express/package.json +55 -16
  199. data/server/node_modules/express/test.js +41 -0
  200. data/server/node_modules/knox/package.json +26 -4
  201. data/server/node_modules/node-uuid/package.json +40 -11
  202. data/server/node_modules/node-uuid/test/test.js +1 -1
  203. data/server/node_modules/nodemon/README.md +120 -0
  204. data/server/node_modules/nodemon/nodemon.js +518 -0
  205. data/server/node_modules/nodemon/nodemonignore.example +11 -0
  206. data/server/node_modules/nodemon/package.json +49 -0
  207. data/server/node_modules/restler/README.md +144 -94
  208. data/server/node_modules/restler/lib/multipartform.js +2 -0
  209. data/server/node_modules/restler/lib/restler.js +218 -61
  210. data/server/node_modules/restler/package.json +35 -8
  211. data/server/node_modules/restler/test/all.js +6 -1
  212. data/server/node_modules/restler/test/restler.js +624 -118
  213. data/server/package.json +14 -10
  214. data/server/web.coffee +64 -0
  215. data/server/web.js +15 -3
  216. metadata +170 -57
  217. data/server/index.js +0 -14
  218. data/server/node_modules/connect-form/LICENSE +0 -22
  219. data/server/node_modules/connect-form/index.js +0 -100
  220. data/server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js +0 -45
  221. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  222. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
  223. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
  224. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
  225. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
  226. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
  227. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
  228. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
  229. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  230. data/server/node_modules/cradle/Makefile +0 -10
  231. data/server/node_modules/cradle/test/cradle-test.js +0 -650
  232. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  233. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
  234. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
  235. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
  236. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
  237. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
  238. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
  239. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
  240. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  241. data/server/node_modules/express/node_modules/connect/test.js +0 -52
  242. data/server/node_modules/express/testing/foo/app.js +0 -35
  243. data/server/node_modules/express/testing/foo/package.json +0 -9
  244. data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
  245. data/server/node_modules/express/testing/foo/routes/index.js +0 -10
  246. data/server/node_modules/express/testing/foo/views/index.jade +0 -2
  247. data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
  248. data/server/node_modules/express/testing/index.js +0 -43
  249. data/server/node_modules/express/testing/public/test.txt +0 -2971
  250. data/server/node_modules/express/testing/views/page.html +0 -1
  251. data/server/node_modules/express/testing/views/page.jade +0 -3
  252. data/server/node_modules/express/testing/views/test.md +0 -1
  253. data/server/node_modules/express/testing/views/user/index.jade +0 -1
  254. data/server/node_modules/express/testing/views/user/list.jade +0 -1
  255. data/server/node_modules/knox/lib/knox/mime/index.js +0 -308
  256. data/server/node_modules/knox/lib/knox/mime/test.js +0 -59
  257. data/server/node_modules/node-uuid/test/benchmark-native +0 -0
  258. data/server/node_modules/on/index.js +0 -13
  259. data/server/node_modules/restler/test/test_helper.js +0 -163
  260. data/server/node_modules/spawner/index.js +0 -106
@@ -0,0 +1,606 @@
1
+ // Generated by CoffeeScript 1.3.3
2
+ (function() {
3
+ var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
4
+
5
+ Parser = require('jison').Parser;
6
+
7
+ unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
8
+
9
+ o = function(patternString, action, options) {
10
+ var match;
11
+ patternString = patternString.replace(/\s{2,}/g, ' ');
12
+ if (!action) {
13
+ return [patternString, '$$ = $1;', options];
14
+ }
15
+ action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())";
16
+ action = action.replace(/\bnew /g, '$&yy.');
17
+ action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&');
18
+ return [patternString, "$$ = " + action + ";", options];
19
+ };
20
+
21
+ grammar = {
22
+ Root: [
23
+ o('', function() {
24
+ return new Block;
25
+ }), o('Body'), o('Block TERMINATOR')
26
+ ],
27
+ Body: [
28
+ o('Line', function() {
29
+ return Block.wrap([$1]);
30
+ }), o('Body TERMINATOR Line', function() {
31
+ return $1.push($3);
32
+ }), o('Body TERMINATOR')
33
+ ],
34
+ Line: [o('Expression'), o('Statement')],
35
+ Statement: [
36
+ o('Return'), o('Comment'), o('STATEMENT', function() {
37
+ return new Literal($1);
38
+ })
39
+ ],
40
+ Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')],
41
+ Block: [
42
+ o('INDENT OUTDENT', function() {
43
+ return new Block;
44
+ }), o('INDENT Body OUTDENT', function() {
45
+ return $2;
46
+ })
47
+ ],
48
+ Identifier: [
49
+ o('IDENTIFIER', function() {
50
+ return new Literal($1);
51
+ })
52
+ ],
53
+ AlphaNumeric: [
54
+ o('NUMBER', function() {
55
+ return new Literal($1);
56
+ }), o('STRING', function() {
57
+ return new Literal($1);
58
+ })
59
+ ],
60
+ Literal: [
61
+ o('AlphaNumeric'), o('JS', function() {
62
+ return new Literal($1);
63
+ }), o('REGEX', function() {
64
+ return new Literal($1);
65
+ }), o('DEBUGGER', function() {
66
+ return new Literal($1);
67
+ }), o('UNDEFINED', function() {
68
+ return new Undefined;
69
+ }), o('NULL', function() {
70
+ return new Null;
71
+ }), o('BOOL', function() {
72
+ return new Bool($1);
73
+ })
74
+ ],
75
+ Assign: [
76
+ o('Assignable = Expression', function() {
77
+ return new Assign($1, $3);
78
+ }), o('Assignable = TERMINATOR Expression', function() {
79
+ return new Assign($1, $4);
80
+ }), o('Assignable = INDENT Expression OUTDENT', function() {
81
+ return new Assign($1, $4);
82
+ })
83
+ ],
84
+ AssignObj: [
85
+ o('ObjAssignable', function() {
86
+ return new Value($1);
87
+ }), o('ObjAssignable : Expression', function() {
88
+ return new Assign(new Value($1), $3, 'object');
89
+ }), o('ObjAssignable :\
90
+ INDENT Expression OUTDENT', function() {
91
+ return new Assign(new Value($1), $4, 'object');
92
+ }), o('Comment')
93
+ ],
94
+ ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')],
95
+ Return: [
96
+ o('RETURN Expression', function() {
97
+ return new Return($2);
98
+ }), o('RETURN', function() {
99
+ return new Return;
100
+ })
101
+ ],
102
+ Comment: [
103
+ o('HERECOMMENT', function() {
104
+ return new Comment($1);
105
+ })
106
+ ],
107
+ Code: [
108
+ o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() {
109
+ return new Code($2, $5, $4);
110
+ }), o('FuncGlyph Block', function() {
111
+ return new Code([], $2, $1);
112
+ })
113
+ ],
114
+ FuncGlyph: [
115
+ o('->', function() {
116
+ return 'func';
117
+ }), o('=>', function() {
118
+ return 'boundfunc';
119
+ })
120
+ ],
121
+ OptComma: [o(''), o(',')],
122
+ ParamList: [
123
+ o('', function() {
124
+ return [];
125
+ }), o('Param', function() {
126
+ return [$1];
127
+ }), o('ParamList , Param', function() {
128
+ return $1.concat($3);
129
+ }), o('ParamList OptComma TERMINATOR Param', function() {
130
+ return $1.concat($4);
131
+ }), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() {
132
+ return $1.concat($4);
133
+ })
134
+ ],
135
+ Param: [
136
+ o('ParamVar', function() {
137
+ return new Param($1);
138
+ }), o('ParamVar ...', function() {
139
+ return new Param($1, null, true);
140
+ }), o('ParamVar = Expression', function() {
141
+ return new Param($1, $3);
142
+ })
143
+ ],
144
+ ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')],
145
+ Splat: [
146
+ o('Expression ...', function() {
147
+ return new Splat($1);
148
+ })
149
+ ],
150
+ SimpleAssignable: [
151
+ o('Identifier', function() {
152
+ return new Value($1);
153
+ }), o('Value Accessor', function() {
154
+ return $1.add($2);
155
+ }), o('Invocation Accessor', function() {
156
+ return new Value($1, [].concat($2));
157
+ }), o('ThisProperty')
158
+ ],
159
+ Assignable: [
160
+ o('SimpleAssignable'), o('Array', function() {
161
+ return new Value($1);
162
+ }), o('Object', function() {
163
+ return new Value($1);
164
+ })
165
+ ],
166
+ Value: [
167
+ o('Assignable'), o('Literal', function() {
168
+ return new Value($1);
169
+ }), o('Parenthetical', function() {
170
+ return new Value($1);
171
+ }), o('Range', function() {
172
+ return new Value($1);
173
+ }), o('This')
174
+ ],
175
+ Accessor: [
176
+ o('. Identifier', function() {
177
+ return new Access($2);
178
+ }), o('?. Identifier', function() {
179
+ return new Access($2, 'soak');
180
+ }), o(':: Identifier', function() {
181
+ return [new Access(new Literal('prototype')), new Access($2)];
182
+ }), o('::', function() {
183
+ return new Access(new Literal('prototype'));
184
+ }), o('Index')
185
+ ],
186
+ Index: [
187
+ o('INDEX_START IndexValue INDEX_END', function() {
188
+ return $2;
189
+ }), o('INDEX_SOAK Index', function() {
190
+ return extend($2, {
191
+ soak: true
192
+ });
193
+ })
194
+ ],
195
+ IndexValue: [
196
+ o('Expression', function() {
197
+ return new Index($1);
198
+ }), o('Slice', function() {
199
+ return new Slice($1);
200
+ })
201
+ ],
202
+ Object: [
203
+ o('{ AssignList OptComma }', function() {
204
+ return new Obj($2, $1.generated);
205
+ })
206
+ ],
207
+ AssignList: [
208
+ o('', function() {
209
+ return [];
210
+ }), o('AssignObj', function() {
211
+ return [$1];
212
+ }), o('AssignList , AssignObj', function() {
213
+ return $1.concat($3);
214
+ }), o('AssignList OptComma TERMINATOR AssignObj', function() {
215
+ return $1.concat($4);
216
+ }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() {
217
+ return $1.concat($4);
218
+ })
219
+ ],
220
+ Class: [
221
+ o('CLASS', function() {
222
+ return new Class;
223
+ }), o('CLASS Block', function() {
224
+ return new Class(null, null, $2);
225
+ }), o('CLASS EXTENDS Expression', function() {
226
+ return new Class(null, $3);
227
+ }), o('CLASS EXTENDS Expression Block', function() {
228
+ return new Class(null, $3, $4);
229
+ }), o('CLASS SimpleAssignable', function() {
230
+ return new Class($2);
231
+ }), o('CLASS SimpleAssignable Block', function() {
232
+ return new Class($2, null, $3);
233
+ }), o('CLASS SimpleAssignable EXTENDS Expression', function() {
234
+ return new Class($2, $4);
235
+ }), o('CLASS SimpleAssignable EXTENDS Expression Block', function() {
236
+ return new Class($2, $4, $5);
237
+ })
238
+ ],
239
+ Invocation: [
240
+ o('Value OptFuncExist Arguments', function() {
241
+ return new Call($1, $3, $2);
242
+ }), o('Invocation OptFuncExist Arguments', function() {
243
+ return new Call($1, $3, $2);
244
+ }), o('SUPER', function() {
245
+ return new Call('super', [new Splat(new Literal('arguments'))]);
246
+ }), o('SUPER Arguments', function() {
247
+ return new Call('super', $2);
248
+ })
249
+ ],
250
+ OptFuncExist: [
251
+ o('', function() {
252
+ return false;
253
+ }), o('FUNC_EXIST', function() {
254
+ return true;
255
+ })
256
+ ],
257
+ Arguments: [
258
+ o('CALL_START CALL_END', function() {
259
+ return [];
260
+ }), o('CALL_START ArgList OptComma CALL_END', function() {
261
+ return $2;
262
+ })
263
+ ],
264
+ This: [
265
+ o('THIS', function() {
266
+ return new Value(new Literal('this'));
267
+ }), o('@', function() {
268
+ return new Value(new Literal('this'));
269
+ })
270
+ ],
271
+ ThisProperty: [
272
+ o('@ Identifier', function() {
273
+ return new Value(new Literal('this'), [new Access($2)], 'this');
274
+ })
275
+ ],
276
+ Array: [
277
+ o('[ ]', function() {
278
+ return new Arr([]);
279
+ }), o('[ ArgList OptComma ]', function() {
280
+ return new Arr($2);
281
+ })
282
+ ],
283
+ RangeDots: [
284
+ o('..', function() {
285
+ return 'inclusive';
286
+ }), o('...', function() {
287
+ return 'exclusive';
288
+ })
289
+ ],
290
+ Range: [
291
+ o('[ Expression RangeDots Expression ]', function() {
292
+ return new Range($2, $4, $3);
293
+ })
294
+ ],
295
+ Slice: [
296
+ o('Expression RangeDots Expression', function() {
297
+ return new Range($1, $3, $2);
298
+ }), o('Expression RangeDots', function() {
299
+ return new Range($1, null, $2);
300
+ }), o('RangeDots Expression', function() {
301
+ return new Range(null, $2, $1);
302
+ }), o('RangeDots', function() {
303
+ return new Range(null, null, $1);
304
+ })
305
+ ],
306
+ ArgList: [
307
+ o('Arg', function() {
308
+ return [$1];
309
+ }), o('ArgList , Arg', function() {
310
+ return $1.concat($3);
311
+ }), o('ArgList OptComma TERMINATOR Arg', function() {
312
+ return $1.concat($4);
313
+ }), o('INDENT ArgList OptComma OUTDENT', function() {
314
+ return $2;
315
+ }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() {
316
+ return $1.concat($4);
317
+ })
318
+ ],
319
+ Arg: [o('Expression'), o('Splat')],
320
+ SimpleArgs: [
321
+ o('Expression'), o('SimpleArgs , Expression', function() {
322
+ return [].concat($1, $3);
323
+ })
324
+ ],
325
+ Try: [
326
+ o('TRY Block', function() {
327
+ return new Try($2);
328
+ }), o('TRY Block Catch', function() {
329
+ return new Try($2, $3[0], $3[1]);
330
+ }), o('TRY Block FINALLY Block', function() {
331
+ return new Try($2, null, null, $4);
332
+ }), o('TRY Block Catch FINALLY Block', function() {
333
+ return new Try($2, $3[0], $3[1], $5);
334
+ })
335
+ ],
336
+ Catch: [
337
+ o('CATCH Identifier Block', function() {
338
+ return [$2, $3];
339
+ })
340
+ ],
341
+ Throw: [
342
+ o('THROW Expression', function() {
343
+ return new Throw($2);
344
+ })
345
+ ],
346
+ Parenthetical: [
347
+ o('( Body )', function() {
348
+ return new Parens($2);
349
+ }), o('( INDENT Body OUTDENT )', function() {
350
+ return new Parens($3);
351
+ })
352
+ ],
353
+ WhileSource: [
354
+ o('WHILE Expression', function() {
355
+ return new While($2);
356
+ }), o('WHILE Expression WHEN Expression', function() {
357
+ return new While($2, {
358
+ guard: $4
359
+ });
360
+ }), o('UNTIL Expression', function() {
361
+ return new While($2, {
362
+ invert: true
363
+ });
364
+ }), o('UNTIL Expression WHEN Expression', function() {
365
+ return new While($2, {
366
+ invert: true,
367
+ guard: $4
368
+ });
369
+ })
370
+ ],
371
+ While: [
372
+ o('WhileSource Block', function() {
373
+ return $1.addBody($2);
374
+ }), o('Statement WhileSource', function() {
375
+ return $2.addBody(Block.wrap([$1]));
376
+ }), o('Expression WhileSource', function() {
377
+ return $2.addBody(Block.wrap([$1]));
378
+ }), o('Loop', function() {
379
+ return $1;
380
+ })
381
+ ],
382
+ Loop: [
383
+ o('LOOP Block', function() {
384
+ return new While(new Literal('true')).addBody($2);
385
+ }), o('LOOP Expression', function() {
386
+ return new While(new Literal('true')).addBody(Block.wrap([$2]));
387
+ })
388
+ ],
389
+ For: [
390
+ o('Statement ForBody', function() {
391
+ return new For($1, $2);
392
+ }), o('Expression ForBody', function() {
393
+ return new For($1, $2);
394
+ }), o('ForBody Block', function() {
395
+ return new For($2, $1);
396
+ })
397
+ ],
398
+ ForBody: [
399
+ o('FOR Range', function() {
400
+ return {
401
+ source: new Value($2)
402
+ };
403
+ }), o('ForStart ForSource', function() {
404
+ $2.own = $1.own;
405
+ $2.name = $1[0];
406
+ $2.index = $1[1];
407
+ return $2;
408
+ })
409
+ ],
410
+ ForStart: [
411
+ o('FOR ForVariables', function() {
412
+ return $2;
413
+ }), o('FOR OWN ForVariables', function() {
414
+ $3.own = true;
415
+ return $3;
416
+ })
417
+ ],
418
+ ForValue: [
419
+ o('Identifier'), o('ThisProperty'), o('Array', function() {
420
+ return new Value($1);
421
+ }), o('Object', function() {
422
+ return new Value($1);
423
+ })
424
+ ],
425
+ ForVariables: [
426
+ o('ForValue', function() {
427
+ return [$1];
428
+ }), o('ForValue , ForValue', function() {
429
+ return [$1, $3];
430
+ })
431
+ ],
432
+ ForSource: [
433
+ o('FORIN Expression', function() {
434
+ return {
435
+ source: $2
436
+ };
437
+ }), o('FOROF Expression', function() {
438
+ return {
439
+ source: $2,
440
+ object: true
441
+ };
442
+ }), o('FORIN Expression WHEN Expression', function() {
443
+ return {
444
+ source: $2,
445
+ guard: $4
446
+ };
447
+ }), o('FOROF Expression WHEN Expression', function() {
448
+ return {
449
+ source: $2,
450
+ guard: $4,
451
+ object: true
452
+ };
453
+ }), o('FORIN Expression BY Expression', function() {
454
+ return {
455
+ source: $2,
456
+ step: $4
457
+ };
458
+ }), o('FORIN Expression WHEN Expression BY Expression', function() {
459
+ return {
460
+ source: $2,
461
+ guard: $4,
462
+ step: $6
463
+ };
464
+ }), o('FORIN Expression BY Expression WHEN Expression', function() {
465
+ return {
466
+ source: $2,
467
+ step: $4,
468
+ guard: $6
469
+ };
470
+ })
471
+ ],
472
+ Switch: [
473
+ o('SWITCH Expression INDENT Whens OUTDENT', function() {
474
+ return new Switch($2, $4);
475
+ }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() {
476
+ return new Switch($2, $4, $6);
477
+ }), o('SWITCH INDENT Whens OUTDENT', function() {
478
+ return new Switch(null, $3);
479
+ }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() {
480
+ return new Switch(null, $3, $5);
481
+ })
482
+ ],
483
+ Whens: [
484
+ o('When'), o('Whens When', function() {
485
+ return $1.concat($2);
486
+ })
487
+ ],
488
+ When: [
489
+ o('LEADING_WHEN SimpleArgs Block', function() {
490
+ return [[$2, $3]];
491
+ }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() {
492
+ return [[$2, $3]];
493
+ })
494
+ ],
495
+ IfBlock: [
496
+ o('IF Expression Block', function() {
497
+ return new If($2, $3, {
498
+ type: $1
499
+ });
500
+ }), o('IfBlock ELSE IF Expression Block', function() {
501
+ return $1.addElse(new If($4, $5, {
502
+ type: $3
503
+ }));
504
+ })
505
+ ],
506
+ If: [
507
+ o('IfBlock'), o('IfBlock ELSE Block', function() {
508
+ return $1.addElse($3);
509
+ }), o('Statement POST_IF Expression', function() {
510
+ return new If($3, Block.wrap([$1]), {
511
+ type: $2,
512
+ statement: true
513
+ });
514
+ }), o('Expression POST_IF Expression', function() {
515
+ return new If($3, Block.wrap([$1]), {
516
+ type: $2,
517
+ statement: true
518
+ });
519
+ })
520
+ ],
521
+ Operation: [
522
+ o('UNARY Expression', function() {
523
+ return new Op($1, $2);
524
+ }), o('- Expression', (function() {
525
+ return new Op('-', $2);
526
+ }), {
527
+ prec: 'UNARY'
528
+ }), o('+ Expression', (function() {
529
+ return new Op('+', $2);
530
+ }), {
531
+ prec: 'UNARY'
532
+ }), o('-- SimpleAssignable', function() {
533
+ return new Op('--', $2);
534
+ }), o('++ SimpleAssignable', function() {
535
+ return new Op('++', $2);
536
+ }), o('SimpleAssignable --', function() {
537
+ return new Op('--', $1, null, true);
538
+ }), o('SimpleAssignable ++', function() {
539
+ return new Op('++', $1, null, true);
540
+ }), o('Expression ?', function() {
541
+ return new Existence($1);
542
+ }), o('Expression + Expression', function() {
543
+ return new Op('+', $1, $3);
544
+ }), o('Expression - Expression', function() {
545
+ return new Op('-', $1, $3);
546
+ }), o('Expression MATH Expression', function() {
547
+ return new Op($2, $1, $3);
548
+ }), o('Expression SHIFT Expression', function() {
549
+ return new Op($2, $1, $3);
550
+ }), o('Expression COMPARE Expression', function() {
551
+ return new Op($2, $1, $3);
552
+ }), o('Expression LOGIC Expression', function() {
553
+ return new Op($2, $1, $3);
554
+ }), o('Expression RELATION Expression', function() {
555
+ if ($2.charAt(0) === '!') {
556
+ return new Op($2.slice(1), $1, $3).invert();
557
+ } else {
558
+ return new Op($2, $1, $3);
559
+ }
560
+ }), o('SimpleAssignable COMPOUND_ASSIGN\
561
+ Expression', function() {
562
+ return new Assign($1, $3, $2);
563
+ }), o('SimpleAssignable COMPOUND_ASSIGN\
564
+ INDENT Expression OUTDENT', function() {
565
+ return new Assign($1, $4, $2);
566
+ }), o('SimpleAssignable EXTENDS Expression', function() {
567
+ return new Extends($1, $3);
568
+ })
569
+ ]
570
+ };
571
+
572
+ operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']];
573
+
574
+ tokens = [];
575
+
576
+ for (name in grammar) {
577
+ alternatives = grammar[name];
578
+ grammar[name] = (function() {
579
+ var _i, _j, _len, _len1, _ref, _results;
580
+ _results = [];
581
+ for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
582
+ alt = alternatives[_i];
583
+ _ref = alt[0].split(' ');
584
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
585
+ token = _ref[_j];
586
+ if (!grammar[token]) {
587
+ tokens.push(token);
588
+ }
589
+ }
590
+ if (name === 'Root') {
591
+ alt[1] = "return " + alt[1];
592
+ }
593
+ _results.push(alt);
594
+ }
595
+ return _results;
596
+ })();
597
+ }
598
+
599
+ exports.parser = new Parser({
600
+ tokens: tokens.join(' '),
601
+ bnf: grammar,
602
+ operators: operators.reverse(),
603
+ startSymbol: 'Root'
604
+ });
605
+
606
+ }).call(this);