coffeecake 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1336) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/README.markdown +28 -0
  4. data/Rakefile +2 -0
  5. data/bin/ck +16 -0
  6. data/coffeecake.gemspec +21 -0
  7. data/lib/coffeecake.rb +4 -0
  8. data/lib/coffeecake/generators.rb +12 -0
  9. data/lib/coffeecake/generators/new_generator.rb +55 -0
  10. data/lib/coffeecake/templates/.gitkeep +0 -0
  11. data/lib/coffeecake/templates/README.markdown +56 -0
  12. data/lib/coffeecake/templates/SpecHelper.tt +0 -0
  13. data/lib/coffeecake/templates/docs_readme +5 -0
  14. data/lib/coffeecake/templates/jasmine.tt +18 -0
  15. data/lib/coffeecake/templates/lib.tt +3 -0
  16. data/lib/coffeecake/templates/spec.tt +3 -0
  17. data/lib/coffeecake/version.rb +3 -0
  18. data/lib/thor_register_patch.rb +16 -0
  19. data/node_modules/.bin/cake +7 -0
  20. data/node_modules/.bin/coffee +7 -0
  21. data/node_modules/.bin/docco +8 -0
  22. data/node_modules/.bin/jasmine +26 -0
  23. data/node_modules/.bin/jasmine-node +7 -0
  24. data/node_modules/.bin/uglifycss +127 -0
  25. data/node_modules/.bin/uglifyjs +317 -0
  26. data/node_modules/coffee-script/.npmignore +11 -0
  27. data/node_modules/coffee-script/LICENSE +22 -0
  28. data/node_modules/coffee-script/README +51 -0
  29. data/node_modules/coffee-script/Rakefile +78 -0
  30. data/node_modules/coffee-script/bin/cake +7 -0
  31. data/node_modules/coffee-script/bin/coffee +7 -0
  32. data/node_modules/coffee-script/extras/jsl.conf +44 -0
  33. data/node_modules/coffee-script/lib/coffee-script/browser.js +74 -0
  34. data/node_modules/coffee-script/lib/coffee-script/cake.js +89 -0
  35. data/node_modules/coffee-script/lib/coffee-script/coffee-script.js +148 -0
  36. data/node_modules/coffee-script/lib/coffee-script/command.js +310 -0
  37. data/node_modules/coffee-script/lib/coffee-script/grammar.js +588 -0
  38. data/node_modules/coffee-script/lib/coffee-script/helpers.js +72 -0
  39. data/node_modules/coffee-script/lib/coffee-script/index.js +10 -0
  40. data/node_modules/coffee-script/lib/coffee-script/lexer.js +687 -0
  41. data/node_modules/coffee-script/lib/coffee-script/nodes.js +2481 -0
  42. data/node_modules/coffee-script/lib/coffee-script/optparse.js +122 -0
  43. data/node_modules/coffee-script/lib/coffee-script/parser.js +670 -0
  44. data/node_modules/coffee-script/lib/coffee-script/repl.js +149 -0
  45. data/node_modules/coffee-script/lib/coffee-script/rewriter.js +288 -0
  46. data/node_modules/coffee-script/lib/coffee-script/scope.js +124 -0
  47. data/node_modules/coffee-script/npm-install-45965.sh +282 -0
  48. data/node_modules/coffee-script/package.json +31 -0
  49. data/node_modules/docco/.gitignore +3 -0
  50. data/node_modules/docco/Cakefile +27 -0
  51. data/node_modules/docco/README +13 -0
  52. data/node_modules/docco/bin/docco +8 -0
  53. data/node_modules/docco/index.html +143 -0
  54. data/node_modules/docco/lib/docco.js +155 -0
  55. data/node_modules/docco/package.json +21 -0
  56. data/node_modules/docco/resources/docco.css +186 -0
  57. data/node_modules/docco/resources/docco.jst +58 -0
  58. data/node_modules/docco/src/docco.coffee +204 -0
  59. data/node_modules/docco/vendor/showdown.js +1298 -0
  60. data/node_modules/jasmine-jquery/.gitignore +3 -0
  61. data/node_modules/jasmine-jquery/MIT.LICENSE +20 -0
  62. data/node_modules/jasmine-jquery/README.markdown +174 -0
  63. data/node_modules/jasmine-jquery/SpecRunner.html +24 -0
  64. data/node_modules/jasmine-jquery/index.js +15 -0
  65. data/node_modules/jasmine-jquery/lib/jasmine-jquery.js +288 -0
  66. data/node_modules/jasmine-jquery/package.json +19 -0
  67. data/node_modules/jasmine-jquery/spec/fixtures/real_non_mocked_fixture.html +1 -0
  68. data/node_modules/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +691 -0
  69. data/node_modules/jasmine-node/.gitignore +10 -0
  70. data/node_modules/jasmine-node/LICENSE +22 -0
  71. data/node_modules/jasmine-node/README.md +35 -0
  72. data/node_modules/jasmine-node/bin/jasmine-node +7 -0
  73. data/node_modules/jasmine-node/lib/jasmine-node/cli.js +110 -0
  74. data/node_modules/jasmine-node/lib/jasmine-node/index.js +171 -0
  75. data/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js +2479 -0
  76. data/node_modules/jasmine-node/lib/jasmine-node/reporter.js +177 -0
  77. data/node_modules/jasmine-node/package.json +22 -0
  78. data/node_modules/jasmine-node/spec/CoffeeSpec.coffee +4 -0
  79. data/node_modules/jasmine-node/spec/SampleSpecs.js +15 -0
  80. data/node_modules/jasmine-node/spec/TestSpec.js +5 -0
  81. data/node_modules/jasmine-node/spec/helper_spec.js +7 -0
  82. data/node_modules/jasmine-node/spec/include/include_spec.js +7 -0
  83. data/node_modules/jasmine-node/spec/include/lib/test.js +3 -0
  84. data/node_modules/jasmine-node/spec/nested.js/NestedSpec.js +5 -0
  85. data/node_modules/jasmine-node/spec/nested/NestedSpec.js +5 -0
  86. data/node_modules/jasmine-node/spec/nested/uber-nested/UberNestedSpec.js +11 -0
  87. data/node_modules/jasmine-node/spec/sample_helper.js +19 -0
  88. data/node_modules/jasmine-node/specs.sh +2 -0
  89. data/node_modules/jasmine-reporters/.gitignore +1 -0
  90. data/node_modules/jasmine-reporters/.gitmodules +3 -0
  91. data/node_modules/jasmine-reporters/LICENSE +21 -0
  92. data/node_modules/jasmine-reporters/README.markdown +52 -0
  93. data/node_modules/jasmine-reporters/ext/env.rhino.1.2.js +13989 -0
  94. data/node_modules/jasmine-reporters/ext/jasmine-html.js +182 -0
  95. data/node_modules/jasmine-reporters/ext/jasmine.css +166 -0
  96. data/node_modules/jasmine-reporters/ext/jasmine.js +2421 -0
  97. data/node_modules/jasmine-reporters/ext/jline.jar +0 -0
  98. data/node_modules/jasmine-reporters/ext/js.jar +0 -0
  99. data/node_modules/jasmine-reporters/ext/phantomjs/.gitignore +10 -0
  100. data/node_modules/jasmine-reporters/ext/phantomjs/ChangeLog +57 -0
  101. data/node_modules/jasmine-reporters/ext/phantomjs/LICENSE.BSD +22 -0
  102. data/node_modules/jasmine-reporters/ext/phantomjs/README.md +28 -0
  103. data/node_modules/jasmine-reporters/ext/phantomjs/examples/arguments.coffee +6 -0
  104. data/node_modules/jasmine-reporters/ext/phantomjs/examples/arguments.js +8 -0
  105. data/node_modules/jasmine-reporters/ext/phantomjs/examples/colorwheel.coffee +45 -0
  106. data/node_modules/jasmine-reporters/ext/phantomjs/examples/colorwheel.js +52 -0
  107. data/node_modules/jasmine-reporters/ext/phantomjs/examples/countdown.coffee +8 -0
  108. data/node_modules/jasmine-reporters/ext/phantomjs/examples/countdown.js +8 -0
  109. data/node_modules/jasmine-reporters/ext/phantomjs/examples/cycle_multiple_urls.js +64 -0
  110. data/node_modules/jasmine-reporters/ext/phantomjs/examples/direction.coffee +28 -0
  111. data/node_modules/jasmine-reporters/ext/phantomjs/examples/direction.js +34 -0
  112. data/node_modules/jasmine-reporters/ext/phantomjs/examples/extract-text.coffee +81 -0
  113. data/node_modules/jasmine-reporters/ext/phantomjs/examples/extract-text.js +121 -0
  114. data/node_modules/jasmine-reporters/ext/phantomjs/examples/fibo.coffee +8 -0
  115. data/node_modules/jasmine-reporters/ext/phantomjs/examples/fibo.js +9 -0
  116. data/node_modules/jasmine-reporters/ext/phantomjs/examples/follow.coffee +36 -0
  117. data/node_modules/jasmine-reporters/ext/phantomjs/examples/follow.js +37 -0
  118. data/node_modules/jasmine-reporters/ext/phantomjs/examples/hello.coffee +2 -0
  119. data/node_modules/jasmine-reporters/ext/phantomjs/examples/hello.js +2 -0
  120. data/node_modules/jasmine-reporters/ext/phantomjs/examples/ipgeocode.coffee +13 -0
  121. data/node_modules/jasmine-reporters/ext/phantomjs/examples/ipgeocode.js +14 -0
  122. data/node_modules/jasmine-reporters/ext/phantomjs/examples/loadspeed.coffee +17 -0
  123. data/node_modules/jasmine-reporters/ext/phantomjs/examples/loadspeed.js +20 -0
  124. data/node_modules/jasmine-reporters/ext/phantomjs/examples/movies.coffee +13 -0
  125. data/node_modules/jasmine-reporters/ext/phantomjs/examples/movies.js +14 -0
  126. data/node_modules/jasmine-reporters/ext/phantomjs/examples/pizza.coffee +10 -0
  127. data/node_modules/jasmine-reporters/ext/phantomjs/examples/pizza.js +12 -0
  128. data/node_modules/jasmine-reporters/ext/phantomjs/examples/rasterize.coffee +21 -0
  129. data/node_modules/jasmine-reporters/ext/phantomjs/examples/rasterize.js +22 -0
  130. data/node_modules/jasmine-reporters/ext/phantomjs/examples/run-jasmine.js +26 -0
  131. data/node_modules/jasmine-reporters/ext/phantomjs/examples/run-qunit.js +24 -0
  132. data/node_modules/jasmine-reporters/ext/phantomjs/examples/seasonfood.coffee +17 -0
  133. data/node_modules/jasmine-reporters/ext/phantomjs/examples/seasonfood.js +19 -0
  134. data/node_modules/jasmine-reporters/ext/phantomjs/examples/technews.coffee +13 -0
  135. data/node_modules/jasmine-reporters/ext/phantomjs/examples/technews.js +14 -0
  136. data/node_modules/jasmine-reporters/ext/phantomjs/examples/tweets.coffee +8 -0
  137. data/node_modules/jasmine-reporters/ext/phantomjs/examples/tweets.js +12 -0
  138. data/node_modules/jasmine-reporters/ext/phantomjs/examples/useragent.coffee +7 -0
  139. data/node_modules/jasmine-reporters/ext/phantomjs/examples/useragent.js +8 -0
  140. data/node_modules/jasmine-reporters/ext/phantomjs/examples/version.coffee +5 -0
  141. data/node_modules/jasmine-reporters/ext/phantomjs/examples/version.js +5 -0
  142. data/node_modules/jasmine-reporters/ext/phantomjs/examples/waitfor.coffee +40 -0
  143. data/node_modules/jasmine-reporters/ext/phantomjs/examples/waitfor.js +43 -0
  144. data/node_modules/jasmine-reporters/ext/phantomjs/examples/weather.coffee +35 -0
  145. data/node_modules/jasmine-reporters/ext/phantomjs/examples/weather.js +42 -0
  146. data/node_modules/jasmine-reporters/ext/phantomjs/phantomjs.pro +3 -0
  147. data/node_modules/jasmine-reporters/ext/phantomjs/python/INSTALL +20 -0
  148. data/node_modules/jasmine-reporters/ext/phantomjs/python/LICENSE +674 -0
  149. data/node_modules/jasmine-reporters/ext/phantomjs/python/README +56 -0
  150. data/node_modules/jasmine-reporters/ext/phantomjs/python/csconverter.py +41 -0
  151. data/node_modules/jasmine-reporters/ext/phantomjs/python/networkaccessmanager.py +84 -0
  152. data/node_modules/jasmine-reporters/ext/phantomjs/python/phantom.py +384 -0
  153. data/node_modules/jasmine-reporters/ext/phantomjs/python/plugincontroller.py +98 -0
  154. data/node_modules/jasmine-reporters/ext/phantomjs/python/plugins/__init__.py +1 -0
  155. data/node_modules/jasmine-reporters/ext/phantomjs/python/pyphantomjs.py +154 -0
  156. data/node_modules/jasmine-reporters/ext/phantomjs/python/resources.py +4160 -0
  157. data/node_modules/jasmine-reporters/ext/phantomjs/python/resources.qrc +6 -0
  158. data/node_modules/jasmine-reporters/ext/phantomjs/python/resources/coffee-script.js +8 -0
  159. data/node_modules/jasmine-reporters/ext/phantomjs/python/resources/pyphantomjs-icon.ico +0 -0
  160. data/node_modules/jasmine-reporters/ext/phantomjs/python/resources/pyphantomjs-icon.png +0 -0
  161. data/node_modules/jasmine-reporters/ext/phantomjs/python/tools/build_resources.sh +14 -0
  162. data/node_modules/jasmine-reporters/ext/phantomjs/python/tools/setup.py +52 -0
  163. data/node_modules/jasmine-reporters/ext/phantomjs/python/utils.py +126 -0
  164. data/node_modules/jasmine-reporters/ext/phantomjs/python/webpage.py +67 -0
  165. data/node_modules/jasmine-reporters/ext/phantomjs/src/coffee-script.js +8 -0
  166. data/node_modules/jasmine-reporters/ext/phantomjs/src/consts.h +39 -0
  167. data/node_modules/jasmine-reporters/ext/phantomjs/src/csconverter.cpp +61 -0
  168. data/node_modules/jasmine-reporters/ext/phantomjs/src/csconverter.h +47 -0
  169. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/config.h +1 -0
  170. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/egif_lib.c +1111 -0
  171. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif.pri +20 -0
  172. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_err.c +120 -0
  173. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_hash.c +160 -0
  174. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_hash.h +59 -0
  175. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_lib.h +336 -0
  176. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_lib_private.h +59 -0
  177. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifalloc.c +443 -0
  178. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifwriter.cpp +126 -0
  179. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifwriter.h +38 -0
  180. data/node_modules/jasmine-reporters/ext/phantomjs/src/gif/quantize.c +330 -0
  181. data/node_modules/jasmine-reporters/ext/phantomjs/src/main.cpp +64 -0
  182. data/node_modules/jasmine-reporters/ext/phantomjs/src/networkaccessmanager.cpp +119 -0
  183. data/node_modules/jasmine-reporters/ext/phantomjs/src/networkaccessmanager.h +53 -0
  184. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantom.cpp +494 -0
  185. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantom.h +117 -0
  186. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs-icon.png +0 -0
  187. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs.pro +32 -0
  188. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs.qrc +7 -0
  189. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_os2.ico +0 -0
  190. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_os2.rc +1 -0
  191. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_win.ico +0 -0
  192. data/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_win.rc +1 -0
  193. data/node_modules/jasmine-reporters/ext/phantomjs/src/usage.txt +11 -0
  194. data/node_modules/jasmine-reporters/ext/phantomjs/src/utils.cpp +74 -0
  195. data/node_modules/jasmine-reporters/ext/phantomjs/src/utils.h +50 -0
  196. data/node_modules/jasmine-reporters/ext/phantomjs/src/webpage.cpp +87 -0
  197. data/node_modules/jasmine-reporters/ext/phantomjs/src/webpage.h +61 -0
  198. data/node_modules/jasmine-reporters/package.json +15 -0
  199. data/node_modules/jasmine-reporters/src/jasmine.console_reporter.js +132 -0
  200. data/node_modules/jasmine-reporters/src/jasmine.junit_reporter.js +199 -0
  201. data/node_modules/jasmine-reporters/src/load_reporters.js +2 -0
  202. data/node_modules/jasmine-reporters/test/JUnitXmlReporterSpec.js +214 -0
  203. data/node_modules/jasmine-reporters/test/console_reporter.html +36 -0
  204. data/node_modules/jasmine-reporters/test/envjs.bootstrap.js +14 -0
  205. data/node_modules/jasmine-reporters/test/envjs.runner.sh +7 -0
  206. data/node_modules/jasmine-reporters/test/junit_xml_reporter.html +23 -0
  207. data/node_modules/jasmine-reporters/test/phantomjs-testrunner.js +39 -0
  208. data/node_modules/jasmine-reporters/test/phantomjs.runner.sh +30 -0
  209. data/node_modules/jasmine-reporters/test/pyphantomjs-plugins/saveToFile/__init__.py +1 -0
  210. data/node_modules/jasmine-reporters/test/pyphantomjs-plugins/saveToFile/saveToFile.py +46 -0
  211. data/node_modules/jasmine-runner/README.md +42 -0
  212. data/node_modules/jasmine-runner/TODO.md +16 -0
  213. data/node_modules/jasmine-runner/bin/jasmine +26 -0
  214. data/node_modules/jasmine-runner/lib/ServerRoutes.js +70 -0
  215. data/node_modules/jasmine-runner/lib/TestRunner.js +29 -0
  216. data/node_modules/jasmine-runner/lib/browser.js +14 -0
  217. data/node_modules/jasmine-runner/lib/config.js +21 -0
  218. data/node_modules/jasmine-runner/lib/jasmine-runner.js +83 -0
  219. data/node_modules/jasmine-runner/lib/monitor.js +34 -0
  220. data/node_modules/jasmine-runner/lib/notify.js +48 -0
  221. data/node_modules/jasmine-runner/lib/public/control-frame.js +57 -0
  222. data/node_modules/jasmine-runner/lib/public/jasmine-html.js +188 -0
  223. data/node_modules/jasmine-runner/lib/public/jasmine.css +166 -0
  224. data/node_modules/jasmine-runner/lib/public/jasmine.js +2421 -0
  225. data/node_modules/jasmine-runner/lib/public/jquery-1.4.3.js +166 -0
  226. data/node_modules/jasmine-runner/lib/public/json2.js +482 -0
  227. data/node_modules/jasmine-runner/lib/public/run.js +6 -0
  228. data/node_modules/jasmine-runner/lib/reporters.js +31 -0
  229. data/node_modules/jasmine-runner/lib/server-worker.js +18 -0
  230. data/node_modules/jasmine-runner/lib/server.js +27 -0
  231. data/node_modules/jasmine-runner/lib/template/jasmine.json +18 -0
  232. data/node_modules/jasmine-runner/lib/template/public/javascript/Player.js +22 -0
  233. data/node_modules/jasmine-runner/lib/template/public/javascript/Song.js +7 -0
  234. data/node_modules/jasmine-runner/lib/template/spec/PlayerSpec.coffee +45 -0
  235. data/node_modules/jasmine-runner/lib/template/spec/PlayerSpec.js +58 -0
  236. data/node_modules/jasmine-runner/lib/template/spec/SpecHelper.js +9 -0
  237. data/node_modules/jasmine-runner/lib/testserver.js +26 -0
  238. data/node_modules/jasmine-runner/lib/views/control-frame.jade +7 -0
  239. data/node_modules/jasmine-runner/lib/views/index.jade +18 -0
  240. data/node_modules/jasmine-runner/node_modules/.bin/cake +7 -0
  241. data/node_modules/jasmine-runner/node_modules/.bin/coffee +7 -0
  242. data/node_modules/jasmine-runner/node_modules/.bin/express +451 -0
  243. data/node_modules/jasmine-runner/node_modules/.bin/jade +92 -0
  244. data/node_modules/jasmine-runner/node_modules/.bin/vows +421 -0
  245. data/node_modules/jasmine-runner/node_modules/coffee-script/.npmignore +11 -0
  246. data/node_modules/jasmine-runner/node_modules/coffee-script/LICENSE +22 -0
  247. data/node_modules/jasmine-runner/node_modules/coffee-script/README +47 -0
  248. data/node_modules/jasmine-runner/node_modules/coffee-script/Rakefile +78 -0
  249. data/node_modules/jasmine-runner/node_modules/coffee-script/bin/cake +7 -0
  250. data/node_modules/jasmine-runner/node_modules/coffee-script/bin/coffee +7 -0
  251. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/browser.js +52 -0
  252. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/cake.js +76 -0
  253. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/coffee-script.js +82 -0
  254. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/command.js +269 -0
  255. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/grammar.js +586 -0
  256. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/helpers.js +66 -0
  257. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/index.js +8 -0
  258. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/lexer.js +638 -0
  259. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/nodes.js +2181 -0
  260. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/optparse.js +111 -0
  261. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/parser.js +656 -0
  262. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/repl.js +47 -0
  263. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/rewriter.js +353 -0
  264. data/node_modules/jasmine-runner/node_modules/coffee-script/lib/scope.js +120 -0
  265. data/node_modules/jasmine-runner/node_modules/coffee-script/package.json +22 -0
  266. data/node_modules/jasmine-runner/node_modules/colors/MIT-LICENSE.txt +20 -0
  267. data/node_modules/jasmine-runner/node_modules/colors/ReadMe.md +30 -0
  268. data/node_modules/jasmine-runner/node_modules/colors/colors.js +75 -0
  269. data/node_modules/jasmine-runner/node_modules/colors/example.js +6 -0
  270. data/node_modules/jasmine-runner/node_modules/colors/package.json +14 -0
  271. data/node_modules/jasmine-runner/node_modules/express/.npmignore +7 -0
  272. data/node_modules/jasmine-runner/node_modules/express/History.md +630 -0
  273. data/node_modules/jasmine-runner/node_modules/express/LICENSE +22 -0
  274. data/node_modules/jasmine-runner/node_modules/express/Makefile +39 -0
  275. data/node_modules/jasmine-runner/node_modules/express/Readme.md +102 -0
  276. data/node_modules/jasmine-runner/node_modules/express/bin/express +451 -0
  277. data/node_modules/jasmine-runner/node_modules/express/index.js +2 -0
  278. data/node_modules/jasmine-runner/node_modules/express/lib/express.js +78 -0
  279. data/node_modules/jasmine-runner/node_modules/express/lib/http.js +503 -0
  280. data/node_modules/jasmine-runner/node_modules/express/lib/https.js +52 -0
  281. data/node_modules/jasmine-runner/node_modules/express/lib/request.js +289 -0
  282. data/node_modules/jasmine-runner/node_modules/express/lib/response.js +423 -0
  283. data/node_modules/jasmine-runner/node_modules/express/lib/router/index.js +329 -0
  284. data/node_modules/jasmine-runner/node_modules/express/lib/router/methods.js +70 -0
  285. data/node_modules/jasmine-runner/node_modules/express/lib/router/route.js +71 -0
  286. data/node_modules/jasmine-runner/node_modules/express/lib/utils.js +122 -0
  287. data/node_modules/jasmine-runner/node_modules/express/lib/view.js +413 -0
  288. data/node_modules/jasmine-runner/node_modules/express/lib/view/partial.js +40 -0
  289. data/node_modules/jasmine-runner/node_modules/express/lib/view/view.js +206 -0
  290. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/.npmignore +11 -0
  291. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/LICENSE +24 -0
  292. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/index.js +2 -0
  293. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/cache.js +81 -0
  294. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/connect.js +106 -0
  295. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/http.js +215 -0
  296. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/https.js +47 -0
  297. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/index.js +46 -0
  298. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js +93 -0
  299. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +92 -0
  300. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/compiler.js +163 -0
  301. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js +46 -0
  302. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/csrf.js +105 -0
  303. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/directory.js +222 -0
  304. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js +100 -0
  305. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/favicon.js +76 -0
  306. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/limit.js +82 -0
  307. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/logger.js +299 -0
  308. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js +38 -0
  309. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/profiler.js +100 -0
  310. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/query.js +40 -0
  311. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/responseTime.js +34 -0
  312. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/router.js +379 -0
  313. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/session.js +346 -0
  314. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js +126 -0
  315. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/session/memory.js +131 -0
  316. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/session/session.js +137 -0
  317. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/session/store.js +87 -0
  318. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/static.js +225 -0
  319. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +175 -0
  320. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/middleware/vhost.js +44 -0
  321. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/patch.js +79 -0
  322. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/directory.html +75 -0
  323. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/error.html +13 -0
  324. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/favicon.ico +0 -0
  325. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page.png +0 -0
  326. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_add.png +0 -0
  327. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png +0 -0
  328. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_code.png +0 -0
  329. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png +0 -0
  330. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png +0 -0
  331. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png +0 -0
  332. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_error.png +0 -0
  333. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png +0 -0
  334. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_find.png +0 -0
  335. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png +0 -0
  336. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_go.png +0 -0
  337. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_green.png +0 -0
  338. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_key.png +0 -0
  339. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png +0 -0
  340. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_link.png +0 -0
  341. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png +0 -0
  342. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png +0 -0
  343. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_red.png +0 -0
  344. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png +0 -0
  345. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_save.png +0 -0
  346. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white.png +0 -0
  347. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png +0 -0
  348. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png +0 -0
  349. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png +0 -0
  350. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png +0 -0
  351. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png +0 -0
  352. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png +0 -0
  353. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png +0 -0
  354. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png +0 -0
  355. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png +0 -0
  356. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png +0 -0
  357. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png +0 -0
  358. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png +0 -0
  359. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png +0 -0
  360. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png +0 -0
  361. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png +0 -0
  362. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png +0 -0
  363. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png +0 -0
  364. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png +0 -0
  365. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png +0 -0
  366. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png +0 -0
  367. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png +0 -0
  368. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png +0 -0
  369. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png +0 -0
  370. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png +0 -0
  371. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png +0 -0
  372. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png +0 -0
  373. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png +0 -0
  374. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png +0 -0
  375. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png +0 -0
  376. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png +0 -0
  377. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png +0 -0
  378. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png +0 -0
  379. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png +0 -0
  380. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png +0 -0
  381. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png +0 -0
  382. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png +0 -0
  383. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png +0 -0
  384. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png +0 -0
  385. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png +0 -0
  386. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png +0 -0
  387. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png +0 -0
  388. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png +0 -0
  389. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png +0 -0
  390. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png +0 -0
  391. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png +0 -0
  392. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png +0 -0
  393. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png +0 -0
  394. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png +0 -0
  395. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png +0 -0
  396. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png +0 -0
  397. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png +0 -0
  398. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png +0 -0
  399. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png +0 -0
  400. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png +0 -0
  401. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png +0 -0
  402. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_word.png +0 -0
  403. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/icons/page_world.png +0 -0
  404. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/public/style.css +141 -0
  405. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/lib/utils.js +451 -0
  406. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/package.json +24 -0
  407. data/node_modules/jasmine-runner/node_modules/express/node_modules/connect/test.js +11 -0
  408. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/LICENSE +19 -0
  409. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/README.md +50 -0
  410. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/mime.js +92 -0
  411. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/package.json +22 -0
  412. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/test.js +79 -0
  413. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/types/mime.types +1479 -0
  414. data/node_modules/jasmine-runner/node_modules/express/node_modules/mime/types/node.types +43 -0
  415. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/.gitignore +1 -0
  416. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/.gitmodules +6 -0
  417. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/History.md +57 -0
  418. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/Makefile +7 -0
  419. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/Readme.md +49 -0
  420. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/benchmark.js +17 -0
  421. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/examples.js +48 -0
  422. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/index.js +2 -0
  423. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/lib/querystring.js +236 -0
  424. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/package.json +16 -0
  425. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/test/parse.test.js +156 -0
  426. data/node_modules/jasmine-runner/node_modules/express/node_modules/qs/test/stringify.test.js +95 -0
  427. data/node_modules/jasmine-runner/node_modules/express/package.json +22 -0
  428. data/node_modules/jasmine-runner/node_modules/growl/History.md +10 -0
  429. data/node_modules/jasmine-runner/node_modules/growl/Readme.md +74 -0
  430. data/node_modules/jasmine-runner/node_modules/growl/lib/growl.js +80 -0
  431. data/node_modules/jasmine-runner/node_modules/growl/package.json +6 -0
  432. data/node_modules/jasmine-runner/node_modules/growl/seed.yml +4 -0
  433. data/node_modules/jasmine-runner/node_modules/growl/test.js +17 -0
  434. data/node_modules/jasmine-runner/node_modules/jade/.gitignore +3 -0
  435. data/node_modules/jasmine-runner/node_modules/jade/.gitmodules +21 -0
  436. data/node_modules/jasmine-runner/node_modules/jade/.npmignore +4 -0
  437. data/node_modules/jasmine-runner/node_modules/jade/CNAME +1 -0
  438. data/node_modules/jasmine-runner/node_modules/jade/History.md +163 -0
  439. data/node_modules/jasmine-runner/node_modules/jade/LICENSE +22 -0
  440. data/node_modules/jasmine-runner/node_modules/jade/Makefile +25 -0
  441. data/node_modules/jasmine-runner/node_modules/jade/Readme.md +408 -0
  442. data/node_modules/jasmine-runner/node_modules/jade/api.html +850 -0
  443. data/node_modules/jasmine-runner/node_modules/jade/bin/jade +92 -0
  444. data/node_modules/jasmine-runner/node_modules/jade/index.js +2 -0
  445. data/node_modules/jasmine-runner/node_modules/jade/lib/compiler.js +273 -0
  446. data/node_modules/jasmine-runner/node_modules/jade/lib/doctypes.js +18 -0
  447. data/node_modules/jasmine-runner/node_modules/jade/lib/filters.js +70 -0
  448. data/node_modules/jasmine-runner/node_modules/jade/lib/index.js +314 -0
  449. data/node_modules/jasmine-runner/node_modules/jade/lib/jade.js +314 -0
  450. data/node_modules/jasmine-runner/node_modules/jade/lib/lexer.js +359 -0
  451. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/block.js +29 -0
  452. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/code.js +35 -0
  453. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/comment.js +32 -0
  454. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/doctype.js +29 -0
  455. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/each.js +35 -0
  456. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/filter.js +33 -0
  457. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/index.js +16 -0
  458. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/node.js +20 -0
  459. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/tag.js +80 -0
  460. data/node_modules/jasmine-runner/node_modules/jade/lib/nodes/text.js +29 -0
  461. data/node_modules/jasmine-runner/node_modules/jade/lib/parser.js +358 -0
  462. data/node_modules/jasmine-runner/node_modules/jade/lib/self-closing.js +17 -0
  463. data/node_modules/jasmine-runner/node_modules/jade/lib/utils.js +49 -0
  464. data/node_modules/jasmine-runner/node_modules/jade/package.json +9 -0
  465. data/node_modules/jasmine-runner/node_modules/libnotify/.gitignore +2 -0
  466. data/node_modules/jasmine-runner/node_modules/libnotify/README.md +59 -0
  467. data/node_modules/jasmine-runner/node_modules/libnotify/lib/libnotify.js +72 -0
  468. data/node_modules/jasmine-runner/node_modules/libnotify/package.json +11 -0
  469. data/node_modules/jasmine-runner/node_modules/libnotify/seed.yml +5 -0
  470. data/node_modules/jasmine-runner/node_modules/libnotify/test.js +5 -0
  471. data/node_modules/jasmine-runner/node_modules/socket.io/.gitignore +8 -0
  472. data/node_modules/jasmine-runner/node_modules/socket.io/Makefile +10 -0
  473. data/node_modules/jasmine-runner/node_modules/socket.io/README.md +218 -0
  474. data/node_modules/jasmine-runner/node_modules/socket.io/example/chat.html +61 -0
  475. data/node_modules/jasmine-runner/node_modules/socket.io/example/json.js +18 -0
  476. data/node_modules/jasmine-runner/node_modules/socket.io/example/server.js +58 -0
  477. data/node_modules/jasmine-runner/node_modules/socket.io/index.js +1 -0
  478. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/client.js +191 -0
  479. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/index.js +4 -0
  480. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/listener.js +166 -0
  481. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/flashsocket.js +44 -0
  482. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/htmlfile.js +45 -0
  483. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/jsonp-polling.js +32 -0
  484. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/websocket.js +137 -0
  485. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/xhr-multipart.js +63 -0
  486. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/transports/xhr-polling.js +75 -0
  487. data/node_modules/jasmine-runner/node_modules/socket.io/lib/socket.io/utils.js +52 -0
  488. data/node_modules/jasmine-runner/node_modules/socket.io/package.json +17 -0
  489. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/.gitignore +3 -0
  490. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/.gitmodules +3 -0
  491. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/History.md +97 -0
  492. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/Makefile +53 -0
  493. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/Readme.md +39 -0
  494. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/bin/expresso +837 -0
  495. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/COPYING +339 -0
  496. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/Makefile.am +81 -0
  497. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/Makefile.in +884 -0
  498. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/Readme.md +8 -0
  499. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/aclocal.m4 +872 -0
  500. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/config.guess +1526 -0
  501. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/config.h.in +92 -0
  502. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/config.rpath +666 -0
  503. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/config.sub +1658 -0
  504. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/configure +7971 -0
  505. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/configure.ac +88 -0
  506. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/depcomp +589 -0
  507. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/encoding.c +315 -0
  508. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/encoding.h +33 -0
  509. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/generate-resources.c +58 -0
  510. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/global.h +29 -0
  511. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/highlight.c +478 -0
  512. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/highlight.h +37 -0
  513. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-connection.c +192 -0
  514. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-exchange.c +494 -0
  515. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-host.c +95 -0
  516. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-message.c +900 -0
  517. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-server.c +236 -0
  518. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-server.h +208 -0
  519. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/http-url.c +156 -0
  520. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/install-sh +519 -0
  521. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/instrument-js.cpp +1873 -0
  522. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/instrument-js.h +81 -0
  523. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/instrument.c +226 -0
  524. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/instrument.h +31 -0
  525. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/GNUmakefile +15 -0
  526. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/Makefile.ref +483 -0
  527. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/README.html +54 -0
  528. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/SpiderMonkey.rsp +11 -0
  529. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/aclocal.m4 +9 -0
  530. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/bench.sh +5 -0
  531. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/builtins.tbl +98 -0
  532. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config.mk +206 -0
  533. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/Makefile.in +106 -0
  534. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/Moz/Milestone.pm +232 -0
  535. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/autoconf.mk.in +349 -0
  536. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/check-sync-dirs.py +108 -0
  537. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/check-sync-exceptions +6 -0
  538. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/config.mk +884 -0
  539. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/fastcwd.pl +66 -0
  540. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/gcc_hidden.h +2 -0
  541. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/insure.mk +53 -0
  542. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/make-system-wrappers.pl +59 -0
  543. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/milestone.pl +112 -0
  544. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/milestone.txt +13 -0
  545. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/Makefile.in +84 -0
  546. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/cppsetup.c +233 -0
  547. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/def.h +184 -0
  548. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/ifparser.c +549 -0
  549. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/ifparser.h +83 -0
  550. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/imakemdep.h +733 -0
  551. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/include.c +337 -0
  552. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/main.c +860 -0
  553. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/mkdepend.man +382 -0
  554. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/parse.c +686 -0
  555. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/mkdepend/pr.c +124 -0
  556. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/nfspwd.pl +50 -0
  557. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/nsinstall.c +481 -0
  558. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/nsinstall.py +139 -0
  559. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/pathsub.c +247 -0
  560. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/pathsub.h +74 -0
  561. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/preprocessor.pl +671 -0
  562. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/revdepth-nt.pl +48 -0
  563. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/revdepth.pl +51 -0
  564. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/rules.mk +2269 -0
  565. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/system-headers +1038 -0
  566. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/version.mk +85 -0
  567. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/config/version_win.pl +423 -0
  568. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/dtoa.c +3321 -0
  569. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/Makefile.ref +143 -0
  570. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/README +83 -0
  571. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/editline.3 +175 -0
  572. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/editline.c +1368 -0
  573. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/editline.h +135 -0
  574. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/sysunix.c +182 -0
  575. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/editline/unix.h +82 -0
  576. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/javascript-trace.d +73 -0
  577. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jitstats.tbl +52 -0
  578. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js-config.h.in +55 -0
  579. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js-config.in +111 -0
  580. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js.cpp +4050 -0
  581. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js.mdp +0 -0
  582. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js.msg +309 -0
  583. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/js3240.rc +79 -0
  584. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsOS240.def +654 -0
  585. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsapi.cpp +6060 -0
  586. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsapi.h +2699 -0
  587. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsarena.cpp +450 -0
  588. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsarena.h +318 -0
  589. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsarray.cpp +3426 -0
  590. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsarray.h +191 -0
  591. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsatom.cpp +1064 -0
  592. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsatom.h +458 -0
  593. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsbit.h +253 -0
  594. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsbool.cpp +182 -0
  595. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsbool.h +75 -0
  596. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsbuiltins.cpp +497 -0
  597. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsbuiltins.h +374 -0
  598. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsclist.h +139 -0
  599. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jscntxt.cpp +1394 -0
  600. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jscntxt.h +1247 -0
  601. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jscompat.h +57 -0
  602. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsconfig.mk +181 -0
  603. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jscpucfg.cpp +388 -0
  604. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jscpucfg.h +212 -0
  605. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdate.cpp +2475 -0
  606. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdate.h +124 -0
  607. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdbgapi.cpp +1954 -0
  608. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdbgapi.h +500 -0
  609. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdhash.cpp +876 -0
  610. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdhash.h +588 -0
  611. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdtoa.cpp +572 -0
  612. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdtoa.h +131 -0
  613. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdtracef.c +318 -0
  614. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsdtracef.h +81 -0
  615. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsemit.cpp +6857 -0
  616. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsemit.h +777 -0
  617. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsexn.cpp +1376 -0
  618. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsexn.h +96 -0
  619. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsfile.cpp +2736 -0
  620. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsfile.h +56 -0
  621. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsfile.msg +90 -0
  622. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsfun.cpp +2706 -0
  623. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsfun.h +296 -0
  624. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsgc.cpp +3763 -0
  625. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsgc.h +427 -0
  626. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jshash.cpp +476 -0
  627. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jshash.h +151 -0
  628. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsify.pl +483 -0
  629. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsinterp.cpp +7225 -0
  630. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsinterp.h +591 -0
  631. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsinvoke.cpp +42 -0
  632. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsiter.cpp +1050 -0
  633. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsiter.h +140 -0
  634. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jskeyword.tbl +124 -0
  635. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jskwgen.cpp +460 -0
  636. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslibmath.h +69 -0
  637. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslock.cpp +1417 -0
  638. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslock.h +311 -0
  639. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslocko.asm +60 -0
  640. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslog2.cpp +94 -0
  641. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslong.cpp +264 -0
  642. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jslong.h +412 -0
  643. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsmath.cpp +721 -0
  644. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsmath.h +63 -0
  645. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsnum.cpp +1338 -0
  646. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsnum.h +287 -0
  647. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsobj.cpp +5563 -0
  648. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsobj.h +735 -0
  649. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/json.cpp +954 -0
  650. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/json.h +107 -0
  651. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsopcode.cpp +5304 -0
  652. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsopcode.h +404 -0
  653. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsopcode.tbl +557 -0
  654. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsoplengen.cpp +121 -0
  655. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsotypes.h +202 -0
  656. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsparse.cpp +6822 -0
  657. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsparse.h +508 -0
  658. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsprf.cpp +1262 -0
  659. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsprf.h +150 -0
  660. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsproto.tbl +129 -0
  661. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsprvtd.h +263 -0
  662. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jspubtd.h +727 -0
  663. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsregexp.cpp +4772 -0
  664. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsregexp.h +192 -0
  665. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsreops.tbl +145 -0
  666. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscan.cpp +2017 -0
  667. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscan.h +389 -0
  668. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscope.cpp +1955 -0
  669. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscope.h +419 -0
  670. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscript.cpp +1891 -0
  671. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsscript.h +330 -0
  672. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsshell.msg +51 -0
  673. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsstaticcheck.h +57 -0
  674. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsstddef.h +87 -0
  675. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsstr.cpp +5347 -0
  676. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsstr.h +662 -0
  677. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jstracer.cpp +8276 -0
  678. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jstracer.h +552 -0
  679. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jstypes.h +490 -0
  680. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsutil.cpp +345 -0
  681. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsutil.h +168 -0
  682. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsversion.h +243 -0
  683. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsxdrapi.cpp +800 -0
  684. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsxdrapi.h +220 -0
  685. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsxml.cpp +8343 -0
  686. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/jsxml.h +298 -0
  687. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/lock_SunOS.s +119 -0
  688. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/plify_jsdhash.sed +35 -0
  689. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/prmjtime.cpp +846 -0
  690. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/prmjtime.h +103 -0
  691. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/AIX4.1.mk +65 -0
  692. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/AIX4.2.mk +64 -0
  693. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/AIX4.3.mk +65 -0
  694. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Cygwin.mk +14 -0
  695. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin.mk +85 -0
  696. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin1.3.mk +81 -0
  697. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin1.4.mk +41 -0
  698. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin5.2.mk +81 -0
  699. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin5.3.mk +81 -0
  700. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Darwin64.mk +72 -0
  701. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/HP-UXB.10.10.mk +77 -0
  702. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/HP-UXB.10.20.mk +77 -0
  703. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/HP-UXB.11.00.mk +80 -0
  704. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX.mk +87 -0
  705. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX5.3.mk +44 -0
  706. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX6.1.mk +44 -0
  707. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX6.2.mk +44 -0
  708. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX6.3.mk +44 -0
  709. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/IRIX6.5.mk +44 -0
  710. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Linux_All.mk +105 -0
  711. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/MSYS.mk +7 -0
  712. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/Mac_OS10.0.mk +82 -0
  713. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/OSF1V4.0.mk +72 -0
  714. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/OSF1V5.0.mk +69 -0
  715. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS4.1.4.mk +101 -0
  716. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.10.mk +50 -0
  717. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.3.mk +91 -0
  718. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.4.mk +92 -0
  719. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.5.1.mk +44 -0
  720. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.5.mk +87 -0
  721. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.6.mk +89 -0
  722. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.7.mk +44 -0
  723. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.8.mk +44 -0
  724. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/SunOS5.9.mk +44 -0
  725. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/WINNT4.0.mk +118 -0
  726. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/WINNT5.0.mk +118 -0
  727. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/WINNT5.1.mk +118 -0
  728. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/WINNT5.2.mk +118 -0
  729. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/WINNT6.0.mk +118 -0
  730. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/ref-config/dgux.mk +64 -0
  731. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/resource.h +15 -0
  732. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/rules.mk +206 -0
  733. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/time.sh +13 -0
  734. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/js/win32.order +384 -0
  735. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-help.txt +12 -0
  736. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-highlight.css +38 -0
  737. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-ie.css +89 -0
  738. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-overlay.js +211 -0
  739. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-server-help.txt +17 -0
  740. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-server.1 +79 -0
  741. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-server.c +1307 -0
  742. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage-throbber.gif +0 -0
  743. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.1 +52 -0
  744. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.c +142 -0
  745. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.css +328 -0
  746. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.html +125 -0
  747. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.js +1024 -0
  748. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.jsm +22 -0
  749. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.manifest +2 -0
  750. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/jscoverage.xul +36 -0
  751. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/m4/iconv.m4 +180 -0
  752. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/m4/lib-ld.m4 +110 -0
  753. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/m4/lib-link.m4 +709 -0
  754. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/m4/lib-prefix.m4 +185 -0
  755. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/make-bin-dist.sh.in +24 -0
  756. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/make-dist.sh.in +43 -0
  757. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/missing +367 -0
  758. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/report.js +76 -0
  759. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/resource-manager.c +59 -0
  760. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/resource-manager.h +46 -0
  761. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/stream.c +129 -0
  762. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/stream.h +57 -0
  763. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/Makefile.am +130 -0
  764. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/Makefile.in +846 -0
  765. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/asprintf.c +42 -0
  766. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/asprintf.sh +19 -0
  767. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/charset.sh +110 -0
  768. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/chunked.sh +74 -0
  769. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/common.sh +7 -0
  770. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/destination-is-existing-directory.expected.err +2 -0
  771. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/destination-is-file.expected.err +2 -0
  772. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/encoding-requires-argument.expected.err +2 -0
  773. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/encodings.c +223 -0
  774. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/encodings.sh +19 -0
  775. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/exclude-requires-argument.expected.err +2 -0
  776. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/fatal.sh +110 -0
  777. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/gethostbyname.c +53 -0
  778. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/gethostbyname.sh +25 -0
  779. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/help.sh +35 -0
  780. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-client-bad-body.c +98 -0
  781. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-client-bad-url.c +77 -0
  782. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-client-close-after-request.c +57 -0
  783. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-server-bad-body.c +97 -0
  784. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-server-bad-headers.c +97 -0
  785. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-server-charset.c +144 -0
  786. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-server-chunked.c +196 -0
  787. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/http-server-close-immediately.c +60 -0
  788. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/invalid-option.expected.err +2 -0
  789. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/invalid-option.sh +29 -0
  790. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-ignore.expected/ignore.js +106 -0
  791. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-ignore.sh +28 -0
  792. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-ignore/ignore.js +44 -0
  793. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-invalid.expected.err +2 -0
  794. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-invalid/javascript-invalid.js +1 -0
  795. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-setter.expected.err +1 -0
  796. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-setter/javascript-setter.js +3 -0
  797. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-utf-8.expected/javascript-utf-8.js +15 -0
  798. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-utf-8.sh +43 -0
  799. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-utf-8/javascript-utf-8.js +2 -0
  800. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-xml.expected.err +1 -0
  801. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript-xml/javascript-xml.js +8 -0
  802. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-array-comprehension.js +32 -0
  803. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-assign.js +51 -0
  804. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-colon.js +24 -0
  805. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-comma.js +12 -0
  806. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-cr.js +12 -0
  807. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-crlf.js +12 -0
  808. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-debugger.js +21 -0
  809. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-dec.js +15 -0
  810. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-delete.js +12 -0
  811. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-destructuring.js +96 -0
  812. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-do.js +28 -0
  813. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-dot.js +30 -0
  814. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-empty.js +9 -0
  815. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-for.js +51 -0
  816. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-foreach.js +16 -0
  817. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-function.js +79 -0
  818. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-generator-expression.js +45 -0
  819. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-generator.js +32 -0
  820. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-getter-setter.js +31 -0
  821. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-hook.js +15 -0
  822. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-if.js +71 -0
  823. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-in.js +19 -0
  824. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-inc.js +15 -0
  825. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-iso-8859-1.js +15 -0
  826. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-lambda.js +14 -0
  827. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-let.js +148 -0
  828. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-lf.js +12 -0
  829. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-new.js +22 -0
  830. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-number.js +57 -0
  831. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-object.js +15 -0
  832. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-op.js +108 -0
  833. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-primary.js +21 -0
  834. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-rb.js +24 -0
  835. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-rc.js +15 -0
  836. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-rp.js +12 -0
  837. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-special-characters.js +30 -0
  838. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-string.js +36 -0
  839. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-switch.js +55 -0
  840. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-throw.js +21 -0
  841. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-try.js +66 -0
  842. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-unaryop.js +27 -0
  843. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-var.js +15 -0
  844. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-while.js +79 -0
  845. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.expected/javascript-with.js +30 -0
  846. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript.sh +53 -0
  847. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-array-comprehension.js +14 -0
  848. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-assign.js +14 -0
  849. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-colon.js +7 -0
  850. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-comma.js +1 -0
  851. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-cr.js +1 -0
  852. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-crlf.js +4 -0
  853. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-debugger.js +6 -0
  854. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-dec.js +2 -0
  855. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-delete.js +1 -0
  856. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js +42 -0
  857. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-do.js +10 -0
  858. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-dot.js +8 -0
  859. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-empty.js +0 -0
  860. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-for.js +22 -0
  861. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-foreach.js +8 -0
  862. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-function.js +38 -0
  863. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-generator-expression.js +18 -0
  864. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-generator.js +11 -0
  865. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-getter-setter.js +19 -0
  866. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-hook.js +2 -0
  867. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-if.js +30 -0
  868. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-in.js +4 -0
  869. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-inc.js +2 -0
  870. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-iso-8859-1.js +2 -0
  871. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-lambda.js +3 -0
  872. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-let.js +79 -0
  873. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-lf.js +4 -0
  874. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-new.js +4 -0
  875. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-number.js +19 -0
  876. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-object.js +2 -0
  877. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-op.js +55 -0
  878. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-primary.js +4 -0
  879. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-rb.js +5 -0
  880. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-rc.js +7 -0
  881. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-rp.js +1 -0
  882. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-special-characters.js +11 -0
  883. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-string.js +11 -0
  884. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-switch.js +21 -0
  885. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-throw.js +6 -0
  886. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-try.js +32 -0
  887. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-unaryop.js +6 -0
  888. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-var.js +2 -0
  889. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-while.js +35 -0
  890. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/javascript/javascript-with.js +9 -0
  891. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/json-cmp.js +65 -0
  892. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/json.c +48 -0
  893. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/json.sh +19 -0
  894. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/mkdirs.c +42 -0
  895. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/mkdirs.sh +19 -0
  896. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/netcat.pl +35 -0
  897. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/no-arguments.expected.err +2 -0
  898. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/no-arguments.sh +29 -0
  899. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/no-instrument-requires-argument.expected.err +2 -0
  900. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-bad-request-body.sh +58 -0
  901. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-bad-response-body-javascript.sh +53 -0
  902. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-bad-response-body.expected.err +1 -0
  903. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-bad-response-body.sh +54 -0
  904. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-bad-response-headers.sh +53 -0
  905. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-no-server.sh +49 -0
  906. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy-url.sh +67 -0
  907. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/proxy.sh +143 -0
  908. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-crlf.sh +59 -0
  909. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-dir-list.c +93 -0
  910. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-dir-list.sh +19 -0
  911. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-exclude.sh +41 -0
  912. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-fatal.sh +40 -0
  913. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive-no-instrument.sh +41 -0
  914. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/1.css +3 -0
  915. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/1.html +12 -0
  916. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/1.js +12 -0
  917. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/2/2.css +3 -0
  918. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/2/2.html +11 -0
  919. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/1/2/2.js +12 -0
  920. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/image.png +0 -0
  921. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/index.html +12 -0
  922. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/script.js +19 -0
  923. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/style.css +3 -0
  924. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/unix.txt +3 -0
  925. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/windows.txt +3 -0
  926. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.expected/x +1 -0
  927. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive.sh +55 -0
  928. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/1.css +3 -0
  929. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/1.html +12 -0
  930. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/1.js +1 -0
  931. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/2/2.css +3 -0
  932. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/2/2.html +11 -0
  933. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/1/2/2.js +1 -0
  934. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/image.png +0 -0
  935. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/index.html +12 -0
  936. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/script.js +6 -0
  937. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/style.css +3 -0
  938. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/unix.txt +3 -0
  939. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/windows.txt +3 -0
  940. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/recursive/x +1 -0
  941. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/same-directory.expected.err +1 -0
  942. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/same-directory.sh +30 -0
  943. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-bad-requests.sh +104 -0
  944. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-close-after-request.sh +47 -0
  945. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-content-types.sh +68 -0
  946. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-directory-listing.expected +4 -0
  947. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-directory-listing.sh +57 -0
  948. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-directory-redirect.sh +50 -0
  949. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-encoded-url.sh +57 -0
  950. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-error.sh +61 -0
  951. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-help.sh +26 -0
  952. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-ip-address.sh +68 -0
  953. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-shutdown-bad-method.sh +49 -0
  954. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-shutdown.expected.err +1 -0
  955. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-shutdown.sh +42 -0
  956. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-special-file.sh +62 -0
  957. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-unreadable-directory.sh +61 -0
  958. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-unreadable-file.sh +62 -0
  959. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-verbose.expected.err +4 -0
  960. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-verbose.sh +54 -0
  961. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server-version.sh +25 -0
  962. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server.pl +61 -0
  963. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/server.sh +216 -0
  964. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/source-does-not-exist.expected.err +2 -0
  965. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/source-is-file.expected.err +2 -0
  966. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-bad-json.sh +50 -0
  967. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-bad-request-body.sh +48 -0
  968. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-bad-response-headers.sh +56 -0
  969. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-bad-source-urls.expected.err +3 -0
  970. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-bad-source-urls.expected.json +14 -0
  971. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-escaped-characters.expected.json +6 -0
  972. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-escaped-characters.js +11 -0
  973. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-escaped-characters.json +3 -0
  974. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-escaped-characters.sh +52 -0
  975. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-server-bad-body.sh +59 -0
  976. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-server-closes-immediately.sh +58 -0
  977. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-not-found.expected.err +1 -0
  978. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-not-found.expected.json +6 -0
  979. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-not-found.json +3 -0
  980. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-not-found.sh +50 -0
  981. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-urls.expected.err +3 -0
  982. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-source-urls.expected.json +14 -0
  983. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-unreachable-source-urls.expected.err +3 -0
  984. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-unreachable-source-urls.expected.json +14 -0
  985. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-unreadable-json.sh +66 -0
  986. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store-unwritable-json.sh +58 -0
  987. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store.expected.json +14 -0
  988. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store.json +5 -0
  989. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/store.sh +137 -0
  990. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/streams.c +107 -0
  991. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/streams.sh +19 -0
  992. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/too-many-arguments.expected.err +2 -0
  993. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/valgrind.sh +7 -0
  994. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/tests/version.sh +29 -0
  995. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/util.c +570 -0
  996. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/deps/jscoverage/util.h +133 -0
  997. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/docs/api.html +1048 -0
  998. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/docs/index.html +373 -0
  999. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/docs/index.md +290 -0
  1000. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/docs/layout/foot.html +3 -0
  1001. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/docs/layout/head.html +42 -0
  1002. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/lib/bar.js +4 -0
  1003. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/lib/foo.js +16 -0
  1004. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/package.json +12 -0
  1005. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/assert.test.js +84 -0
  1006. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/async.test.js +6 -0
  1007. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/bar.test.js +12 -0
  1008. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/foo.test.js +13 -0
  1009. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/http.test.js +82 -0
  1010. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/serial/async.test.js +38 -0
  1011. data/node_modules/jasmine-runner/node_modules/socket.io/support/expresso/test/serial/http.test.js +47 -0
  1012. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/LICENSE +27 -0
  1013. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/Makefile +8 -0
  1014. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/README.md +41 -0
  1015. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/examples/client-unix.js +12 -0
  1016. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/examples/client.js +10 -0
  1017. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/examples/server-unix.js +13 -0
  1018. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/lib/websocket.js +562 -0
  1019. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/package.json +22 -0
  1020. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/test/test-basic.js +63 -0
  1021. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/test/test-readonly-attrs.js +44 -0
  1022. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/test/test-ready-state.js +23 -0
  1023. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/test/test-unix-send-fd.js +63 -0
  1024. data/node_modules/jasmine-runner/node_modules/socket.io/support/node-websocket-client/test/test-unix-sockets.js +46 -0
  1025. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/.gitignore +1 -0
  1026. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/.gitmodules +3 -0
  1027. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/Makefile +2 -0
  1028. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/README.md +213 -0
  1029. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/io.js +24 -0
  1030. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/socket.js +157 -0
  1031. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transport.js +141 -0
  1032. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/flashsocket.js +53 -0
  1033. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/htmlfile.js +73 -0
  1034. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/jsonp-polling.js +116 -0
  1035. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/websocket.js +60 -0
  1036. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/xhr-multipart.js +36 -0
  1037. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/xhr-polling.js +68 -0
  1038. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/transports/xhr.js +131 -0
  1039. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/util.js +60 -0
  1040. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/.gitignore +1 -0
  1041. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/FABridge.js +604 -0
  1042. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/README.txt +109 -0
  1043. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf +0 -0
  1044. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/WebSocketMainInsecure.zip +0 -0
  1045. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocket.as +461 -0
  1046. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketMain.as +94 -0
  1047. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketMainInsecure.as +19 -0
  1048. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketStateEvent.as +32 -0
  1049. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/bridge/FABridge.as +943 -0
  1050. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/build.sh +10 -0
  1051. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/adobe/net/proxies/RFC2817Socket.as +204 -0
  1052. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/gsolo/encryption/MD5.as +375 -0
  1053. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/Crypto.as +287 -0
  1054. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/MozillaRootCertificates.as +3235 -0
  1055. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509Certificate.as +218 -0
  1056. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509CertificateCollection.as +57 -0
  1057. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as +82 -0
  1058. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHMAC.as +27 -0
  1059. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHash.as +21 -0
  1060. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MAC.as +137 -0
  1061. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD2.as +124 -0
  1062. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD5.as +204 -0
  1063. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA1.as +106 -0
  1064. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA224.as +28 -0
  1065. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA256.as +115 -0
  1066. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHABase.as +71 -0
  1067. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/ARC4.as +90 -0
  1068. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/IPRNG.as +20 -0
  1069. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/Random.as +119 -0
  1070. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/TLSPRF.as +142 -0
  1071. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as +339 -0
  1072. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/AESKey.as +2797 -0
  1073. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/BlowFishKey.as +375 -0
  1074. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CBCMode.as +55 -0
  1075. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFB8Mode.as +61 -0
  1076. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFBMode.as +64 -0
  1077. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CTRMode.as +58 -0
  1078. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/DESKey.as +365 -0
  1079. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ECBMode.as +86 -0
  1080. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ICipher.as +21 -0
  1081. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IMode.as +15 -0
  1082. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IPad.as +32 -0
  1083. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IStreamCipher.as +21 -0
  1084. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ISymmetricKey.as +35 -0
  1085. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IVMode.as +110 -0
  1086. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/NullPad.as +34 -0
  1087. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/OFBMode.as +52 -0
  1088. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/PKCS5.as +44 -0
  1089. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SSLPad.as +44 -0
  1090. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SimpleIVMode.as +60 -0
  1091. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TLSPad.as +42 -0
  1092. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TripleDESKey.as +88 -0
  1093. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/XTeaKey.as +94 -0
  1094. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/aeskey.pl +29 -0
  1095. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/dump.txt +2304 -0
  1096. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/AESKeyTest.as +1220 -0
  1097. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ARC4Test.as +58 -0
  1098. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BigIntegerTest.as +39 -0
  1099. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BlowFishKeyTest.as +148 -0
  1100. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CBCModeTest.as +160 -0
  1101. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFB8ModeTest.as +71 -0
  1102. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFBModeTest.as +98 -0
  1103. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CTRModeTest.as +109 -0
  1104. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/DESKeyTest.as +112 -0
  1105. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ECBModeTest.as +151 -0
  1106. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/HMACTest.as +184 -0
  1107. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ITestHarness.as +20 -0
  1108. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD2Test.as +56 -0
  1109. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD5Test.as +58 -0
  1110. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/OFBModeTest.as +101 -0
  1111. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/RSAKeyTest.as +92 -0
  1112. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA1Test.as +198 -0
  1113. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA224Test.as +58 -0
  1114. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA256Test.as +60 -0
  1115. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TLSPRFTest.as +51 -0
  1116. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TestCase.as +42 -0
  1117. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TripleDESKeyTest.as +59 -0
  1118. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/XTeaKeyTest.as +66 -0
  1119. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/BulkCiphers.as +102 -0
  1120. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/CipherSuites.as +117 -0
  1121. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/IConnectionState.as +14 -0
  1122. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/ISecurityParameters.as +29 -0
  1123. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/KeyExchanges.as +24 -0
  1124. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as +38 -0
  1125. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLConnectionState.as +171 -0
  1126. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLEvent.as +26 -0
  1127. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLSecurityParameters.as +340 -0
  1128. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConfig.as +70 -0
  1129. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConnectionState.as +151 -0
  1130. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEngine.as +895 -0
  1131. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSError.as +39 -0
  1132. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEvent.as +27 -0
  1133. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSecurityParameters.as +197 -0
  1134. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocket.as +370 -0
  1135. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocketEvent.as +26 -0
  1136. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSTest.as +180 -0
  1137. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BarrettReduction.as +90 -0
  1138. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BigInteger.as +1543 -0
  1139. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/ClassicReduction.as +35 -0
  1140. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/IReduction.as +11 -0
  1141. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/MontgomeryReduction.as +85 -0
  1142. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/NullReduction.as +34 -0
  1143. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/bi_internal.as +11 -0
  1144. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/ArrayUtil.as +25 -0
  1145. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Base64.as +189 -0
  1146. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Hex.as +66 -0
  1147. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Memory.as +28 -0
  1148. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ByteString.as +43 -0
  1149. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/DER.as +210 -0
  1150. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/IAsn1Type.as +21 -0
  1151. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Integer.as +44 -0
  1152. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/OID.as +35 -0
  1153. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as +112 -0
  1154. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PEM.as +118 -0
  1155. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PrintableString.as +49 -0
  1156. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Sequence.as +90 -0
  1157. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Set.as +27 -0
  1158. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Type.as +94 -0
  1159. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/UTCTime.as +60 -0
  1160. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/sample.html +76 -0
  1161. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/swfobject.js +4 -0
  1162. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/web_socket.js +388 -0
  1163. data/node_modules/jasmine-runner/node_modules/socket.io/support/socket.io-client/socket.io.js +1918 -0
  1164. data/node_modules/jasmine-runner/node_modules/socket.io/tests/index.js +17 -0
  1165. data/node_modules/jasmine-runner/node_modules/socket.io/tests/listener.js +152 -0
  1166. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.flashsocket.js +48 -0
  1167. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.htmlfile.js +214 -0
  1168. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.jsonp-polling.js +148 -0
  1169. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.websocket.js +245 -0
  1170. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.xhr-multipart.js +215 -0
  1171. data/node_modules/jasmine-runner/node_modules/socket.io/tests/transports.xhr-polling.js +138 -0
  1172. data/node_modules/jasmine-runner/node_modules/socket.io/tests/utils.js +25 -0
  1173. data/node_modules/jasmine-runner/node_modules/vows/LICENSE +20 -0
  1174. data/node_modules/jasmine-runner/node_modules/vows/Makefile +7 -0
  1175. data/node_modules/jasmine-runner/node_modules/vows/README.md +39 -0
  1176. data/node_modules/jasmine-runner/node_modules/vows/bin/vows +421 -0
  1177. data/node_modules/jasmine-runner/node_modules/vows/lib/assert/error.js +27 -0
  1178. data/node_modules/jasmine-runner/node_modules/vows/lib/assert/macros.js +180 -0
  1179. data/node_modules/jasmine-runner/node_modules/vows/lib/vows.js +195 -0
  1180. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/console.js +93 -0
  1181. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/context.js +55 -0
  1182. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/extras.js +28 -0
  1183. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/dot-matrix.js +69 -0
  1184. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/json.js +10 -0
  1185. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/silent.js +8 -0
  1186. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/spec.js +74 -0
  1187. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/watch.js +38 -0
  1188. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/reporters/xunit.js +90 -0
  1189. data/node_modules/jasmine-runner/node_modules/vows/lib/vows/suite.js +321 -0
  1190. data/node_modules/jasmine-runner/node_modules/vows/package.json +14 -0
  1191. data/node_modules/jasmine-runner/node_modules/vows/test/assert-test.js +101 -0
  1192. data/node_modules/jasmine-runner/node_modules/vows/test/vows-test.js +373 -0
  1193. data/node_modules/jasmine-runner/node_modules/webworker/.gitignore +2 -0
  1194. data/node_modules/jasmine-runner/node_modules/webworker/LICENSE +27 -0
  1195. data/node_modules/jasmine-runner/node_modules/webworker/Makefile +15 -0
  1196. data/node_modules/jasmine-runner/node_modules/webworker/README.md +74 -0
  1197. data/node_modules/jasmine-runner/node_modules/webworker/docs/design.md +103 -0
  1198. data/node_modules/jasmine-runner/node_modules/webworker/examples/prefork/README.md +1 -0
  1199. data/node_modules/jasmine-runner/node_modules/webworker/examples/prefork/master.js +12 -0
  1200. data/node_modules/jasmine-runner/node_modules/webworker/examples/prefork/worker.js +20 -0
  1201. data/node_modules/jasmine-runner/node_modules/webworker/lib/webworker-child.js +173 -0
  1202. data/node_modules/jasmine-runner/node_modules/webworker/lib/webworker-util.js +185 -0
  1203. data/node_modules/jasmine-runner/node_modules/webworker/lib/webworker.js +304 -0
  1204. data/node_modules/jasmine-runner/node_modules/webworker/lib/ws.js +118 -0
  1205. data/node_modules/jasmine-runner/node_modules/webworker/lib/ws/connection.js +408 -0
  1206. data/node_modules/jasmine-runner/node_modules/webworker/lib/ws/manager.js +98 -0
  1207. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/LICENSE +27 -0
  1208. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/Makefile +8 -0
  1209. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/README.md +41 -0
  1210. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/examples/client-unix.js +12 -0
  1211. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/examples/client.js +10 -0
  1212. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/examples/server-unix.js +13 -0
  1213. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/lib/websocket.js +516 -0
  1214. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/package.json +22 -0
  1215. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/test/test-basic.js +63 -0
  1216. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/test/test-readonly-attrs.js +44 -0
  1217. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/test/test-ready-state.js +23 -0
  1218. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/test/test-unix-send-fd.js +63 -0
  1219. data/node_modules/jasmine-runner/node_modules/webworker/node_modules/websocket-client/test/test-unix-sockets.js +46 -0
  1220. data/node_modules/jasmine-runner/node_modules/webworker/package.json +25 -0
  1221. data/node_modules/jasmine-runner/node_modules/webworker/test/test-error.js +24 -0
  1222. data/node_modules/jasmine-runner/node_modules/webworker/test/test-fd.js +32 -0
  1223. data/node_modules/jasmine-runner/node_modules/webworker/test/test-simple.js +36 -0
  1224. data/node_modules/jasmine-runner/node_modules/webworker/test/workers/error.js +6 -0
  1225. data/node_modules/jasmine-runner/node_modules/webworker/test/workers/fd.js +17 -0
  1226. data/node_modules/jasmine-runner/node_modules/webworker/test/workers/simple.js +15 -0
  1227. data/node_modules/jasmine-runner/package.json +22 -0
  1228. data/node_modules/jasmine-runner/spec/ConsoleLoggerSpec.js +1 -0
  1229. data/node_modules/jasmine-runner/spec/ServerSpec.js +42 -0
  1230. data/node_modules/jasmine-runner/spec/TestRunner.js +72 -0
  1231. data/node_modules/jasmine-runner/spec/file.worker +8 -0
  1232. data/node_modules/jasmine-runner/spec/temp/spec/foo.spec.js +0 -0
  1233. data/node_modules/jasmine-runner/spec/temp/src/foo.hs +1 -0
  1234. data/node_modules/uglify-js/.gitignore +4 -0
  1235. data/node_modules/uglify-js/README.html +1026 -0
  1236. data/node_modules/uglify-js/README.org +571 -0
  1237. data/node_modules/uglify-js/bin/uglifyjs +317 -0
  1238. data/node_modules/uglify-js/docstyle.css +75 -0
  1239. data/node_modules/uglify-js/lib/object-ast.js +75 -0
  1240. data/node_modules/uglify-js/lib/parse-js.js +1339 -0
  1241. data/node_modules/uglify-js/lib/process.js +2001 -0
  1242. data/node_modules/uglify-js/lib/squeeze-more.js +51 -0
  1243. data/node_modules/uglify-js/package.json +24 -0
  1244. data/node_modules/uglify-js/package.json~ +24 -0
  1245. data/node_modules/uglify-js/test/beautify.js +28 -0
  1246. data/node_modules/uglify-js/test/testparser.js +403 -0
  1247. data/node_modules/uglify-js/test/unit/compress/expected/array1.js +1 -0
  1248. data/node_modules/uglify-js/test/unit/compress/expected/array2.js +1 -0
  1249. data/node_modules/uglify-js/test/unit/compress/expected/array3.js +1 -0
  1250. data/node_modules/uglify-js/test/unit/compress/expected/array4.js +1 -0
  1251. data/node_modules/uglify-js/test/unit/compress/expected/assignment.js +1 -0
  1252. data/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +1 -0
  1253. data/node_modules/uglify-js/test/unit/compress/expected/const.js +1 -0
  1254. data/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +1 -0
  1255. data/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +1 -0
  1256. data/node_modules/uglify-js/test/unit/compress/expected/if.js +1 -0
  1257. data/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +1 -0
  1258. data/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +1 -0
  1259. data/node_modules/uglify-js/test/unit/compress/expected/issue10.js +1 -0
  1260. data/node_modules/uglify-js/test/unit/compress/expected/issue11.js +1 -0
  1261. data/node_modules/uglify-js/test/unit/compress/expected/issue13.js +1 -0
  1262. data/node_modules/uglify-js/test/unit/compress/expected/issue14.js +1 -0
  1263. data/node_modules/uglify-js/test/unit/compress/expected/issue16.js +1 -0
  1264. data/node_modules/uglify-js/test/unit/compress/expected/issue17.js +1 -0
  1265. data/node_modules/uglify-js/test/unit/compress/expected/issue20.js +1 -0
  1266. data/node_modules/uglify-js/test/unit/compress/expected/issue21.js +1 -0
  1267. data/node_modules/uglify-js/test/unit/compress/expected/issue25.js +1 -0
  1268. data/node_modules/uglify-js/test/unit/compress/expected/issue27.js +1 -0
  1269. data/node_modules/uglify-js/test/unit/compress/expected/issue28.js +1 -0
  1270. data/node_modules/uglify-js/test/unit/compress/expected/issue29.js +1 -0
  1271. data/node_modules/uglify-js/test/unit/compress/expected/issue30.js +1 -0
  1272. data/node_modules/uglify-js/test/unit/compress/expected/issue34.js +1 -0
  1273. data/node_modules/uglify-js/test/unit/compress/expected/issue4.js +1 -0
  1274. data/node_modules/uglify-js/test/unit/compress/expected/issue48.js +1 -0
  1275. data/node_modules/uglify-js/test/unit/compress/expected/issue50.js +1 -0
  1276. data/node_modules/uglify-js/test/unit/compress/expected/issue53.js +1 -0
  1277. data/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +1 -0
  1278. data/node_modules/uglify-js/test/unit/compress/expected/issue68.js +1 -0
  1279. data/node_modules/uglify-js/test/unit/compress/expected/issue69.js +1 -0
  1280. data/node_modules/uglify-js/test/unit/compress/expected/issue9.js +1 -0
  1281. data/node_modules/uglify-js/test/unit/compress/expected/mangle.js +1 -0
  1282. data/node_modules/uglify-js/test/unit/compress/expected/null_string.js +1 -0
  1283. data/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +1 -0
  1284. data/node_modules/uglify-js/test/unit/compress/expected/var.js +1 -0
  1285. data/node_modules/uglify-js/test/unit/compress/expected/whitespace.js +1 -0
  1286. data/node_modules/uglify-js/test/unit/compress/expected/with.js +1 -0
  1287. data/node_modules/uglify-js/test/unit/compress/test/array1.js +3 -0
  1288. data/node_modules/uglify-js/test/unit/compress/test/array2.js +4 -0
  1289. data/node_modules/uglify-js/test/unit/compress/test/array3.js +4 -0
  1290. data/node_modules/uglify-js/test/unit/compress/test/array4.js +6 -0
  1291. data/node_modules/uglify-js/test/unit/compress/test/assignment.js +20 -0
  1292. data/node_modules/uglify-js/test/unit/compress/test/concatstring.js +3 -0
  1293. data/node_modules/uglify-js/test/unit/compress/test/const.js +5 -0
  1294. data/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +4 -0
  1295. data/node_modules/uglify-js/test/unit/compress/test/forstatement.js +10 -0
  1296. data/node_modules/uglify-js/test/unit/compress/test/if.js +6 -0
  1297. data/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +9 -0
  1298. data/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +16 -0
  1299. data/node_modules/uglify-js/test/unit/compress/test/issue10.js +1 -0
  1300. data/node_modules/uglify-js/test/unit/compress/test/issue11.js +3 -0
  1301. data/node_modules/uglify-js/test/unit/compress/test/issue13.js +1 -0
  1302. data/node_modules/uglify-js/test/unit/compress/test/issue14.js +1 -0
  1303. data/node_modules/uglify-js/test/unit/compress/test/issue16.js +1 -0
  1304. data/node_modules/uglify-js/test/unit/compress/test/issue17.js +4 -0
  1305. data/node_modules/uglify-js/test/unit/compress/test/issue20.js +1 -0
  1306. data/node_modules/uglify-js/test/unit/compress/test/issue21.js +6 -0
  1307. data/node_modules/uglify-js/test/unit/compress/test/issue25.js +7 -0
  1308. data/node_modules/uglify-js/test/unit/compress/test/issue27.js +1 -0
  1309. data/node_modules/uglify-js/test/unit/compress/test/issue28.js +3 -0
  1310. data/node_modules/uglify-js/test/unit/compress/test/issue29.js +1 -0
  1311. data/node_modules/uglify-js/test/unit/compress/test/issue30.js +3 -0
  1312. data/node_modules/uglify-js/test/unit/compress/test/issue34.js +3 -0
  1313. data/node_modules/uglify-js/test/unit/compress/test/issue4.js +3 -0
  1314. data/node_modules/uglify-js/test/unit/compress/test/issue48.js +1 -0
  1315. data/node_modules/uglify-js/test/unit/compress/test/issue50.js +9 -0
  1316. data/node_modules/uglify-js/test/unit/compress/test/issue53.js +1 -0
  1317. data/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +3 -0
  1318. data/node_modules/uglify-js/test/unit/compress/test/issue68.js +5 -0
  1319. data/node_modules/uglify-js/test/unit/compress/test/issue69.js +1 -0
  1320. data/node_modules/uglify-js/test/unit/compress/test/issue9.js +4 -0
  1321. data/node_modules/uglify-js/test/unit/compress/test/mangle.js +5 -0
  1322. data/node_modules/uglify-js/test/unit/compress/test/null_string.js +1 -0
  1323. data/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +3 -0
  1324. data/node_modules/uglify-js/test/unit/compress/test/var.js +3 -0
  1325. data/node_modules/uglify-js/test/unit/compress/test/whitespace.js +21 -0
  1326. data/node_modules/uglify-js/test/unit/compress/test/with.js +2 -0
  1327. data/node_modules/uglify-js/test/unit/scripts.js +55 -0
  1328. data/node_modules/uglify-js/uglify-js.js +17 -0
  1329. data/node_modules/uglifycss/README.md +21 -0
  1330. data/node_modules/uglifycss/index.js +26 -0
  1331. data/node_modules/uglifycss/package.json +15 -0
  1332. data/node_modules/uglifycss/test.js +43 -0
  1333. data/node_modules/uglifycss/tests.yui.js +42 -0
  1334. data/node_modules/uglifycss/uglifycss +127 -0
  1335. data/node_modules/uglifycss/uglifycss-lib.js +461 -0
  1336. metadata +1383 -0
@@ -0,0 +1,4772 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ * vim: set sw=4 ts=8 et tw=78:
3
+ *
4
+ * ***** BEGIN LICENSE BLOCK *****
5
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
+ *
7
+ * The contents of this file are subject to the Mozilla Public License Version
8
+ * 1.1 (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ * http://www.mozilla.org/MPL/
11
+ *
12
+ * Software distributed under the License is distributed on an "AS IS" basis,
13
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
+ * for the specific language governing rights and limitations under the
15
+ * License.
16
+ *
17
+ * The Original Code is Mozilla Communicator client code, released
18
+ * March 31, 1998.
19
+ *
20
+ * The Initial Developer of the Original Code is
21
+ * Netscape Communications Corporation.
22
+ * Portions created by the Initial Developer are Copyright (C) 1998
23
+ * the Initial Developer. All Rights Reserved.
24
+ *
25
+ * Contributor(s):
26
+ *
27
+ * Alternatively, the contents of this file may be used under the terms of
28
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
29
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
+ * in which case the provisions of the GPL or the LGPL are applicable instead
31
+ * of those above. If you wish to allow use of your version of this file only
32
+ * under the terms of either the GPL or the LGPL, and not to allow others to
33
+ * use your version of this file under the terms of the MPL, indicate your
34
+ * decision by deleting the provisions above and replace them with the notice
35
+ * and other provisions required by the GPL or the LGPL. If you do not delete
36
+ * the provisions above, a recipient may use your version of this file under
37
+ * the terms of any one of the MPL, the GPL or the LGPL.
38
+ *
39
+ * ***** END LICENSE BLOCK ***** */
40
+
41
+ /*
42
+ * JS regular expressions, after Perl.
43
+ */
44
+ #include "jsstddef.h"
45
+ #include <stdlib.h>
46
+ #include <string.h>
47
+ #include <stdarg.h>
48
+ #include "jstypes.h"
49
+ #include "jsarena.h" /* Added by JSIFY */
50
+ #include "jsutil.h" /* Added by JSIFY */
51
+ #include "jsapi.h"
52
+ #include "jsarray.h"
53
+ #include "jsatom.h"
54
+ #include "jsbuiltins.h"
55
+ #include "jscntxt.h"
56
+ #include "jsversion.h"
57
+ #include "jsfun.h"
58
+ #include "jsgc.h"
59
+ #include "jsinterp.h"
60
+ #include "jslock.h"
61
+ #include "jsnum.h"
62
+ #include "jsobj.h"
63
+ #include "jsopcode.h"
64
+ #include "jsregexp.h"
65
+ #include "jsscan.h"
66
+ #include "jsscope.h"
67
+ #include "jsstr.h"
68
+
69
+ #ifdef JS_TRACER
70
+ #include "jstracer.h"
71
+ using namespace avmplus;
72
+ using namespace nanojit;
73
+
74
+ /*
75
+ * FIXME Duplicated with jstracer.cpp, doing it this way for now
76
+ * to keep it private to files that need it.
77
+ */
78
+ #ifdef JS_JIT_SPEW
79
+ static bool verbose_debug = getenv("TRACEMONKEY") && strstr(getenv("TRACEMONKEY"), "verbose");
80
+ #define debug_only_v(x) if (verbose_debug) { x; }
81
+ #else
82
+ #define debug_only_v(x)
83
+ #endif
84
+ #endif
85
+
86
+ typedef enum REOp {
87
+ #define REOP_DEF(opcode, name) opcode,
88
+ #include "jsreops.tbl"
89
+ #undef REOP_DEF
90
+ REOP_LIMIT /* META: no operator >= to this */
91
+ } REOp;
92
+
93
+ #define REOP_IS_SIMPLE(op) ((op) <= REOP_NCLASS)
94
+
95
+ #ifdef REGEXP_DEBUG
96
+ const char *reop_names[] = {
97
+ #define REOP_DEF(opcode, name) name,
98
+ #include "jsreops.tbl"
99
+ #undef REOP_DEF
100
+ NULL
101
+ };
102
+ #endif
103
+
104
+ #ifdef __GNUC__
105
+ static int
106
+ re_debug(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
107
+ #endif
108
+
109
+ #ifdef REGEXP_DEBUG
110
+ static int
111
+ re_debug(const char *fmt, ...)
112
+ {
113
+ va_list ap;
114
+ int retval;
115
+
116
+ va_start(ap, fmt);
117
+ retval = vprintf(fmt, ap);
118
+ va_end(ap);
119
+ return retval;
120
+ }
121
+
122
+ static void
123
+ re_debug_chars(const jschar *chrs, size_t length)
124
+ {
125
+ int i = 0;
126
+
127
+ printf(" \"");
128
+ while (*chrs && i++ < length) {
129
+ putchar((char)*chrs++);
130
+ }
131
+ printf("\"");
132
+ }
133
+ #else /* !REGEXP_DEBUG */
134
+ /* This should be optimized to a no-op by our tier-1 compilers. */
135
+ static int
136
+ re_debug(const char *fmt, ...)
137
+ {
138
+ return 0;
139
+ }
140
+
141
+ static void
142
+ re_debug_chars(const jschar *chrs, size_t length)
143
+ {
144
+ }
145
+ #endif /* !REGEXP_DEBUG */
146
+
147
+ struct RENode {
148
+ REOp op; /* r.e. op bytecode */
149
+ RENode *next; /* next in concatenation order */
150
+ void *kid; /* first operand */
151
+ union {
152
+ void *kid2; /* second operand */
153
+ jsint num; /* could be a number */
154
+ size_t parenIndex; /* or a parenthesis index */
155
+ struct { /* or a quantifier range */
156
+ uintN min;
157
+ uintN max;
158
+ JSPackedBool greedy;
159
+ } range;
160
+ struct { /* or a character class */
161
+ size_t startIndex;
162
+ size_t kidlen; /* length of string at kid, in jschars */
163
+ size_t index; /* index into class list */
164
+ uint16 bmsize; /* bitmap size, based on max char code */
165
+ JSPackedBool sense;
166
+ } ucclass;
167
+ struct { /* or a literal sequence */
168
+ jschar chr; /* of one character */
169
+ size_t length; /* or many (via the kid) */
170
+ } flat;
171
+ struct {
172
+ RENode *kid2; /* second operand from ALT */
173
+ jschar ch1; /* match char for ALTPREREQ */
174
+ jschar ch2; /* ditto, or class index for ALTPREREQ2 */
175
+ } altprereq;
176
+ } u;
177
+ };
178
+
179
+ #define RE_IS_LETTER(c) (((c >= 'A') && (c <= 'Z')) || \
180
+ ((c >= 'a') && (c <= 'z')) )
181
+ #define RE_IS_LINE_TERM(c) ((c == '\n') || (c == '\r') || \
182
+ (c == LINE_SEPARATOR) || (c == PARA_SEPARATOR))
183
+
184
+ #define CLASS_CACHE_SIZE 4
185
+
186
+ typedef struct CompilerState {
187
+ JSContext *context;
188
+ JSTokenStream *tokenStream; /* For reporting errors */
189
+ const jschar *cpbegin;
190
+ const jschar *cpend;
191
+ const jschar *cp;
192
+ size_t parenCount;
193
+ size_t classCount; /* number of [] encountered */
194
+ size_t treeDepth; /* maximum depth of parse tree */
195
+ size_t progLength; /* estimated bytecode length */
196
+ RENode *result;
197
+ size_t classBitmapsMem; /* memory to hold all class bitmaps */
198
+ struct {
199
+ const jschar *start; /* small cache of class strings */
200
+ size_t length; /* since they're often the same */
201
+ size_t index;
202
+ } classCache[CLASS_CACHE_SIZE];
203
+ uint16 flags;
204
+ } CompilerState;
205
+
206
+ typedef struct EmitStateStackEntry {
207
+ jsbytecode *altHead; /* start of REOP_ALT* opcode */
208
+ jsbytecode *nextAltFixup; /* fixup pointer to next-alt offset */
209
+ jsbytecode *nextTermFixup; /* fixup ptr. to REOP_JUMP offset */
210
+ jsbytecode *endTermFixup; /* fixup ptr. to REOPT_ALTPREREQ* offset */
211
+ RENode *continueNode; /* original REOP_ALT* node being stacked */
212
+ jsbytecode continueOp; /* REOP_JUMP or REOP_ENDALT continuation */
213
+ JSPackedBool jumpToJumpFlag; /* true if we've patched jump-to-jump to
214
+ avoid 16-bit unsigned offset overflow */
215
+ } EmitStateStackEntry;
216
+
217
+ /*
218
+ * Immediate operand sizes and getter/setters. Unlike the ones in jsopcode.h,
219
+ * the getters and setters take the pc of the offset, not of the opcode before
220
+ * the offset.
221
+ */
222
+ #define ARG_LEN 2
223
+ #define GET_ARG(pc) ((uint16)(((pc)[0] << 8) | (pc)[1]))
224
+ #define SET_ARG(pc, arg) ((pc)[0] = (jsbytecode) ((arg) >> 8), \
225
+ (pc)[1] = (jsbytecode) (arg))
226
+
227
+ #define OFFSET_LEN ARG_LEN
228
+ #define OFFSET_MAX (JS_BIT(ARG_LEN * 8) - 1)
229
+ #define GET_OFFSET(pc) GET_ARG(pc)
230
+
231
+ /*
232
+ * Maximum supported tree depth is maximum size of EmitStateStackEntry stack.
233
+ * For sanity, we limit it to 2^24 bytes.
234
+ */
235
+ #define TREE_DEPTH_MAX (JS_BIT(24) / sizeof(EmitStateStackEntry))
236
+
237
+ /*
238
+ * The maximum memory that can be allocated for class bitmaps.
239
+ * For sanity, we limit it to 2^24 bytes.
240
+ */
241
+ #define CLASS_BITMAPS_MEM_LIMIT JS_BIT(24)
242
+
243
+ /*
244
+ * Functions to get size and write/read bytecode that represent small indexes
245
+ * compactly.
246
+ * Each byte in the code represent 7-bit chunk of the index. 8th bit when set
247
+ * indicates that the following byte brings more bits to the index. Otherwise
248
+ * this is the last byte in the index bytecode representing highest index bits.
249
+ */
250
+ static size_t
251
+ GetCompactIndexWidth(size_t index)
252
+ {
253
+ size_t width;
254
+
255
+ for (width = 1; (index >>= 7) != 0; ++width) { }
256
+ return width;
257
+ }
258
+
259
+ static JS_ALWAYS_INLINE jsbytecode *
260
+ WriteCompactIndex(jsbytecode *pc, size_t index)
261
+ {
262
+ size_t next;
263
+
264
+ while ((next = index >> 7) != 0) {
265
+ *pc++ = (jsbytecode)(index | 0x80);
266
+ index = next;
267
+ }
268
+ *pc++ = (jsbytecode)index;
269
+ return pc;
270
+ }
271
+
272
+ static JS_ALWAYS_INLINE jsbytecode *
273
+ ReadCompactIndex(jsbytecode *pc, size_t *result)
274
+ {
275
+ size_t nextByte;
276
+
277
+ nextByte = *pc++;
278
+ if ((nextByte & 0x80) == 0) {
279
+ /*
280
+ * Short-circuit the most common case when compact index <= 127.
281
+ */
282
+ *result = nextByte;
283
+ } else {
284
+ size_t shift = 7;
285
+ *result = 0x7F & nextByte;
286
+ do {
287
+ nextByte = *pc++;
288
+ *result |= (nextByte & 0x7F) << shift;
289
+ shift += 7;
290
+ } while ((nextByte & 0x80) != 0);
291
+ }
292
+ return pc;
293
+ }
294
+
295
+ typedef struct RECapture {
296
+ ptrdiff_t index; /* start of contents, -1 for empty */
297
+ size_t length; /* length of capture */
298
+ } RECapture;
299
+
300
+ typedef struct REMatchState {
301
+ const jschar *cp;
302
+ RECapture parens[1]; /* first of 're->parenCount' captures,
303
+ allocated at end of this struct */
304
+ } REMatchState;
305
+
306
+ struct REBackTrackData;
307
+
308
+ typedef struct REProgState {
309
+ jsbytecode *continue_pc; /* current continuation data */
310
+ jsbytecode continue_op;
311
+ ptrdiff_t index; /* progress in text */
312
+ size_t parenSoFar; /* highest indexed paren started */
313
+ union {
314
+ struct {
315
+ uintN min; /* current quantifier limits */
316
+ uintN max;
317
+ } quantifier;
318
+ struct {
319
+ size_t top; /* backtrack stack state */
320
+ size_t sz;
321
+ } assertion;
322
+ } u;
323
+ } REProgState;
324
+
325
+ typedef struct REBackTrackData {
326
+ size_t sz; /* size of previous stack entry */
327
+ jsbytecode *backtrack_pc; /* where to backtrack to */
328
+ jsbytecode backtrack_op;
329
+ const jschar *cp; /* index in text of match at backtrack */
330
+ size_t parenIndex; /* start index of saved paren contents */
331
+ size_t parenCount; /* # of saved paren contents */
332
+ size_t saveStateStackTop; /* number of parent states */
333
+ /* saved parent states follow */
334
+ /* saved paren contents follow */
335
+ } REBackTrackData;
336
+
337
+ #define INITIAL_STATESTACK 100
338
+ #define INITIAL_BACKTRACK 8000
339
+
340
+ typedef struct REGlobalData {
341
+ JSContext *cx;
342
+ JSRegExp *regexp; /* the RE in execution */
343
+ JSBool ok; /* runtime error (out_of_memory only?) */
344
+ size_t start; /* offset to start at */
345
+ ptrdiff_t skipped; /* chars skipped anchoring this r.e. */
346
+ const jschar *cpbegin; /* text base address */
347
+ const jschar *cpend; /* text limit address */
348
+
349
+ REProgState *stateStack; /* stack of state of current parents */
350
+ size_t stateStackTop;
351
+ size_t stateStackLimit;
352
+
353
+ REBackTrackData *backTrackStack;/* stack of matched-so-far positions */
354
+ REBackTrackData *backTrackSP;
355
+ size_t backTrackStackSize;
356
+ size_t cursz; /* size of current stack entry */
357
+ size_t backTrackCount; /* how many times we've backtracked */
358
+ size_t backTrackLimit; /* upper limit on backtrack states */
359
+ } REGlobalData;
360
+
361
+ /*
362
+ * 1. If IgnoreCase is false, return ch.
363
+ * 2. Let u be ch converted to upper case as if by calling
364
+ * String.prototype.toUpperCase on the one-character string ch.
365
+ * 3. If u does not consist of a single character, return ch.
366
+ * 4. Let cu be u's character.
367
+ * 5. If ch's code point value is greater than or equal to decimal 128 and cu's
368
+ * code point value is less than decimal 128, then return ch.
369
+ * 6. Return cu.
370
+ */
371
+ static JS_ALWAYS_INLINE uintN
372
+ upcase(uintN ch)
373
+ {
374
+ uintN cu;
375
+
376
+ JS_ASSERT((uintN) (jschar) ch == ch);
377
+ if (ch < 128) {
378
+ if (ch - (uintN) 'a' <= (uintN) ('z' - 'a'))
379
+ ch -= (uintN) ('a' - 'A');
380
+ return ch;
381
+ }
382
+
383
+ cu = JS_TOUPPER(ch);
384
+ return (cu < 128) ? ch : cu;
385
+ }
386
+
387
+ static JS_ALWAYS_INLINE uintN
388
+ downcase(uintN ch)
389
+ {
390
+ JS_ASSERT((uintN) (jschar) ch == ch);
391
+ if (ch < 128) {
392
+ if (ch - (uintN) 'A' <= (uintN) ('Z' - 'A'))
393
+ ch += (uintN) ('a' - 'A');
394
+ return ch;
395
+ }
396
+
397
+ return JS_TOLOWER(ch);
398
+ }
399
+
400
+ /* Construct and initialize an RENode, returning NULL for out-of-memory */
401
+ static RENode *
402
+ NewRENode(CompilerState *state, REOp op)
403
+ {
404
+ JSContext *cx;
405
+ RENode *ren;
406
+
407
+ cx = state->context;
408
+ JS_ARENA_ALLOCATE_CAST(ren, RENode *, &cx->tempPool, sizeof *ren);
409
+ if (!ren) {
410
+ js_ReportOutOfScriptQuota(cx);
411
+ return NULL;
412
+ }
413
+ ren->op = op;
414
+ ren->next = NULL;
415
+ ren->kid = NULL;
416
+ return ren;
417
+ }
418
+
419
+ /*
420
+ * Validates and converts hex ascii value.
421
+ */
422
+ static JSBool
423
+ isASCIIHexDigit(jschar c, uintN *digit)
424
+ {
425
+ uintN cv = c;
426
+
427
+ if (cv < '0')
428
+ return JS_FALSE;
429
+ if (cv <= '9') {
430
+ *digit = cv - '0';
431
+ return JS_TRUE;
432
+ }
433
+ cv |= 0x20;
434
+ if (cv >= 'a' && cv <= 'f') {
435
+ *digit = cv - 'a' + 10;
436
+ return JS_TRUE;
437
+ }
438
+ return JS_FALSE;
439
+ }
440
+
441
+
442
+ typedef struct {
443
+ REOp op;
444
+ const jschar *errPos;
445
+ size_t parenIndex;
446
+ } REOpData;
447
+
448
+ static JSBool
449
+ ReportRegExpErrorHelper(CompilerState *state, uintN flags, uintN errorNumber,
450
+ const jschar *arg)
451
+ {
452
+ if (state->tokenStream) {
453
+ return js_ReportCompileErrorNumber(state->context, state->tokenStream,
454
+ NULL, JSREPORT_UC | flags,
455
+ errorNumber, arg);
456
+ }
457
+ return JS_ReportErrorFlagsAndNumberUC(state->context, flags,
458
+ js_GetErrorMessage, NULL,
459
+ errorNumber, arg);
460
+ }
461
+
462
+ static JSBool
463
+ ReportRegExpError(CompilerState *state, uintN flags, uintN errorNumber)
464
+ {
465
+ return ReportRegExpErrorHelper(state, flags, errorNumber, NULL);
466
+ }
467
+
468
+ /*
469
+ * Process the op against the two top operands, reducing them to a single
470
+ * operand in the penultimate slot. Update progLength and treeDepth.
471
+ */
472
+ static JSBool
473
+ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
474
+ intN operandSP)
475
+ {
476
+ RENode *result;
477
+
478
+ switch (opData->op) {
479
+ case REOP_ALT:
480
+ result = NewRENode(state, REOP_ALT);
481
+ if (!result)
482
+ return JS_FALSE;
483
+ result->kid = operandStack[operandSP - 2];
484
+ result->u.kid2 = operandStack[operandSP - 1];
485
+ operandStack[operandSP - 2] = result;
486
+
487
+ if (state->treeDepth == TREE_DEPTH_MAX) {
488
+ ReportRegExpError(state, JSREPORT_ERROR, JSMSG_REGEXP_TOO_COMPLEX);
489
+ return JS_FALSE;
490
+ }
491
+ ++state->treeDepth;
492
+
493
+ /*
494
+ * Look at both alternates to see if there's a FLAT or a CLASS at
495
+ * the start of each. If so, use a prerequisite match.
496
+ */
497
+ if (((RENode *) result->kid)->op == REOP_FLAT &&
498
+ ((RENode *) result->u.kid2)->op == REOP_FLAT &&
499
+ (state->flags & JSREG_FOLD) == 0) {
500
+ result->op = REOP_ALTPREREQ;
501
+ result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
502
+ result->u.altprereq.ch2 = ((RENode *) result->u.kid2)->u.flat.chr;
503
+ /* ALTPREREQ, <end>, uch1, uch2, <next>, ...,
504
+ JUMP, <end> ... ENDALT */
505
+ state->progLength += 13;
506
+ }
507
+ else
508
+ if (((RENode *) result->kid)->op == REOP_CLASS &&
509
+ ((RENode *) result->kid)->u.ucclass.index < 256 &&
510
+ ((RENode *) result->u.kid2)->op == REOP_FLAT &&
511
+ (state->flags & JSREG_FOLD) == 0) {
512
+ result->op = REOP_ALTPREREQ2;
513
+ result->u.altprereq.ch1 = ((RENode *) result->u.kid2)->u.flat.chr;
514
+ result->u.altprereq.ch2 = ((RENode *) result->kid)->u.ucclass.index;
515
+ /* ALTPREREQ2, <end>, uch1, uch2, <next>, ...,
516
+ JUMP, <end> ... ENDALT */
517
+ state->progLength += 13;
518
+ }
519
+ else
520
+ if (((RENode *) result->kid)->op == REOP_FLAT &&
521
+ ((RENode *) result->u.kid2)->op == REOP_CLASS &&
522
+ ((RENode *) result->u.kid2)->u.ucclass.index < 256 &&
523
+ (state->flags & JSREG_FOLD) == 0) {
524
+ result->op = REOP_ALTPREREQ2;
525
+ result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
526
+ result->u.altprereq.ch2 =
527
+ ((RENode *) result->u.kid2)->u.ucclass.index;
528
+ /* ALTPREREQ2, <end>, uch1, uch2, <next>, ...,
529
+ JUMP, <end> ... ENDALT */
530
+ state->progLength += 13;
531
+ }
532
+ else {
533
+ /* ALT, <next>, ..., JUMP, <end> ... ENDALT */
534
+ state->progLength += 7;
535
+ }
536
+ break;
537
+
538
+ case REOP_CONCAT:
539
+ result = operandStack[operandSP - 2];
540
+ while (result->next)
541
+ result = result->next;
542
+ result->next = operandStack[operandSP - 1];
543
+ break;
544
+
545
+ case REOP_ASSERT:
546
+ case REOP_ASSERT_NOT:
547
+ case REOP_LPARENNON:
548
+ case REOP_LPAREN:
549
+ /* These should have been processed by a close paren. */
550
+ ReportRegExpErrorHelper(state, JSREPORT_ERROR, JSMSG_MISSING_PAREN,
551
+ opData->errPos);
552
+ return JS_FALSE;
553
+
554
+ default:;
555
+ }
556
+ return JS_TRUE;
557
+ }
558
+
559
+ /*
560
+ * Parser forward declarations.
561
+ */
562
+ static JSBool ParseTerm(CompilerState *state);
563
+ static JSBool ParseQuantifier(CompilerState *state);
564
+ static intN ParseMinMaxQuantifier(CompilerState *state, JSBool ignoreValues);
565
+
566
+ /*
567
+ * Top-down regular expression grammar, based closely on Perl4.
568
+ *
569
+ * regexp: altern A regular expression is one or more
570
+ * altern '|' regexp alternatives separated by vertical bar.
571
+ */
572
+ #define INITIAL_STACK_SIZE 128
573
+
574
+ static JSBool
575
+ ParseRegExp(CompilerState *state)
576
+ {
577
+ size_t parenIndex;
578
+ RENode *operand;
579
+ REOpData *operatorStack;
580
+ RENode **operandStack;
581
+ REOp op;
582
+ intN i;
583
+ JSBool result = JS_FALSE;
584
+
585
+ intN operatorSP = 0, operatorStackSize = INITIAL_STACK_SIZE;
586
+ intN operandSP = 0, operandStackSize = INITIAL_STACK_SIZE;
587
+
588
+ /* Watch out for empty regexp */
589
+ if (state->cp == state->cpend) {
590
+ state->result = NewRENode(state, REOP_EMPTY);
591
+ return (state->result != NULL);
592
+ }
593
+
594
+ operatorStack = (REOpData *)
595
+ JS_malloc(state->context, sizeof(REOpData) * operatorStackSize);
596
+ if (!operatorStack)
597
+ return JS_FALSE;
598
+
599
+ operandStack = (RENode **)
600
+ JS_malloc(state->context, sizeof(RENode *) * operandStackSize);
601
+ if (!operandStack)
602
+ goto out;
603
+
604
+ for (;;) {
605
+ parenIndex = state->parenCount;
606
+ if (state->cp == state->cpend) {
607
+ /*
608
+ * If we are at the end of the regexp and we're short one or more
609
+ * operands, the regexp must have the form /x|/ or some such, with
610
+ * left parentheses making us short more than one operand.
611
+ */
612
+ if (operatorSP >= operandSP) {
613
+ operand = NewRENode(state, REOP_EMPTY);
614
+ if (!operand)
615
+ goto out;
616
+ goto pushOperand;
617
+ }
618
+ } else {
619
+ switch (*state->cp) {
620
+ case '(':
621
+ ++state->cp;
622
+ if (state->cp + 1 < state->cpend &&
623
+ *state->cp == '?' &&
624
+ (state->cp[1] == '=' ||
625
+ state->cp[1] == '!' ||
626
+ state->cp[1] == ':')) {
627
+ switch (state->cp[1]) {
628
+ case '=':
629
+ op = REOP_ASSERT;
630
+ /* ASSERT, <next>, ... ASSERTTEST */
631
+ state->progLength += 4;
632
+ break;
633
+ case '!':
634
+ op = REOP_ASSERT_NOT;
635
+ /* ASSERTNOT, <next>, ... ASSERTNOTTEST */
636
+ state->progLength += 4;
637
+ break;
638
+ default:
639
+ op = REOP_LPARENNON;
640
+ break;
641
+ }
642
+ state->cp += 2;
643
+ } else {
644
+ op = REOP_LPAREN;
645
+ /* LPAREN, <index>, ... RPAREN, <index> */
646
+ state->progLength
647
+ += 2 * (1 + GetCompactIndexWidth(parenIndex));
648
+ state->parenCount++;
649
+ if (state->parenCount == 65535) {
650
+ ReportRegExpError(state, JSREPORT_ERROR,
651
+ JSMSG_TOO_MANY_PARENS);
652
+ goto out;
653
+ }
654
+ }
655
+ goto pushOperator;
656
+
657
+ case ')':
658
+ /*
659
+ * If there's no stacked open parenthesis, throw syntax error.
660
+ */
661
+ for (i = operatorSP - 1; ; i--) {
662
+ if (i < 0) {
663
+ ReportRegExpError(state, JSREPORT_ERROR,
664
+ JSMSG_UNMATCHED_RIGHT_PAREN);
665
+ goto out;
666
+ }
667
+ if (operatorStack[i].op == REOP_ASSERT ||
668
+ operatorStack[i].op == REOP_ASSERT_NOT ||
669
+ operatorStack[i].op == REOP_LPARENNON ||
670
+ operatorStack[i].op == REOP_LPAREN) {
671
+ break;
672
+ }
673
+ }
674
+ /* FALL THROUGH */
675
+
676
+ case '|':
677
+ /* Expected an operand before these, so make an empty one */
678
+ operand = NewRENode(state, REOP_EMPTY);
679
+ if (!operand)
680
+ goto out;
681
+ goto pushOperand;
682
+
683
+ default:
684
+ if (!ParseTerm(state))
685
+ goto out;
686
+ operand = state->result;
687
+ pushOperand:
688
+ if (operandSP == operandStackSize) {
689
+ RENode **tmp;
690
+ operandStackSize += operandStackSize;
691
+ tmp = (RENode **)
692
+ JS_realloc(state->context, operandStack,
693
+ sizeof(RENode *) * operandStackSize);
694
+ if (!tmp)
695
+ goto out;
696
+ operandStack = tmp;
697
+ }
698
+ operandStack[operandSP++] = operand;
699
+ break;
700
+ }
701
+ }
702
+
703
+ /* At the end; process remaining operators. */
704
+ restartOperator:
705
+ if (state->cp == state->cpend) {
706
+ while (operatorSP) {
707
+ --operatorSP;
708
+ if (!ProcessOp(state, &operatorStack[operatorSP],
709
+ operandStack, operandSP))
710
+ goto out;
711
+ --operandSP;
712
+ }
713
+ JS_ASSERT(operandSP == 1);
714
+ state->result = operandStack[0];
715
+ result = JS_TRUE;
716
+ goto out;
717
+ }
718
+
719
+ switch (*state->cp) {
720
+ case '|':
721
+ /* Process any stacked 'concat' operators */
722
+ ++state->cp;
723
+ while (operatorSP &&
724
+ operatorStack[operatorSP - 1].op == REOP_CONCAT) {
725
+ --operatorSP;
726
+ if (!ProcessOp(state, &operatorStack[operatorSP],
727
+ operandStack, operandSP)) {
728
+ goto out;
729
+ }
730
+ --operandSP;
731
+ }
732
+ op = REOP_ALT;
733
+ goto pushOperator;
734
+
735
+ case ')':
736
+ /*
737
+ * If there's no stacked open parenthesis, throw syntax error.
738
+ */
739
+ for (i = operatorSP - 1; ; i--) {
740
+ if (i < 0) {
741
+ ReportRegExpError(state, JSREPORT_ERROR,
742
+ JSMSG_UNMATCHED_RIGHT_PAREN);
743
+ goto out;
744
+ }
745
+ if (operatorStack[i].op == REOP_ASSERT ||
746
+ operatorStack[i].op == REOP_ASSERT_NOT ||
747
+ operatorStack[i].op == REOP_LPARENNON ||
748
+ operatorStack[i].op == REOP_LPAREN) {
749
+ break;
750
+ }
751
+ }
752
+ ++state->cp;
753
+
754
+ /* Process everything on the stack until the open parenthesis. */
755
+ for (;;) {
756
+ JS_ASSERT(operatorSP);
757
+ --operatorSP;
758
+ switch (operatorStack[operatorSP].op) {
759
+ case REOP_ASSERT:
760
+ case REOP_ASSERT_NOT:
761
+ case REOP_LPAREN:
762
+ operand = NewRENode(state, operatorStack[operatorSP].op);
763
+ if (!operand)
764
+ goto out;
765
+ operand->u.parenIndex =
766
+ operatorStack[operatorSP].parenIndex;
767
+ JS_ASSERT(operandSP);
768
+ operand->kid = operandStack[operandSP - 1];
769
+ operandStack[operandSP - 1] = operand;
770
+ if (state->treeDepth == TREE_DEPTH_MAX) {
771
+ ReportRegExpError(state, JSREPORT_ERROR,
772
+ JSMSG_REGEXP_TOO_COMPLEX);
773
+ goto out;
774
+ }
775
+ ++state->treeDepth;
776
+ /* FALL THROUGH */
777
+
778
+ case REOP_LPARENNON:
779
+ state->result = operandStack[operandSP - 1];
780
+ if (!ParseQuantifier(state))
781
+ goto out;
782
+ operandStack[operandSP - 1] = state->result;
783
+ goto restartOperator;
784
+ default:
785
+ if (!ProcessOp(state, &operatorStack[operatorSP],
786
+ operandStack, operandSP))
787
+ goto out;
788
+ --operandSP;
789
+ break;
790
+ }
791
+ }
792
+ break;
793
+
794
+ case '{':
795
+ {
796
+ const jschar *errp = state->cp;
797
+
798
+ if (ParseMinMaxQuantifier(state, JS_TRUE) < 0) {
799
+ /*
800
+ * This didn't even scan correctly as a quantifier, so we should
801
+ * treat it as flat.
802
+ */
803
+ op = REOP_CONCAT;
804
+ goto pushOperator;
805
+ }
806
+
807
+ state->cp = errp;
808
+ /* FALL THROUGH */
809
+ }
810
+
811
+ case '+':
812
+ case '*':
813
+ case '?':
814
+ ReportRegExpErrorHelper(state, JSREPORT_ERROR, JSMSG_BAD_QUANTIFIER,
815
+ state->cp);
816
+ result = JS_FALSE;
817
+ goto out;
818
+
819
+ default:
820
+ /* Anything else is the start of the next term. */
821
+ op = REOP_CONCAT;
822
+ pushOperator:
823
+ if (operatorSP == operatorStackSize) {
824
+ REOpData *tmp;
825
+ operatorStackSize += operatorStackSize;
826
+ tmp = (REOpData *)
827
+ JS_realloc(state->context, operatorStack,
828
+ sizeof(REOpData) * operatorStackSize);
829
+ if (!tmp)
830
+ goto out;
831
+ operatorStack = tmp;
832
+ }
833
+ operatorStack[operatorSP].op = op;
834
+ operatorStack[operatorSP].errPos = state->cp;
835
+ operatorStack[operatorSP++].parenIndex = parenIndex;
836
+ break;
837
+ }
838
+ }
839
+ out:
840
+ if (operatorStack)
841
+ JS_free(state->context, operatorStack);
842
+ if (operandStack)
843
+ JS_free(state->context, operandStack);
844
+ return result;
845
+ }
846
+
847
+ /*
848
+ * Hack two bits in CompilerState.flags, for use within FindParenCount to flag
849
+ * its being on the stack, and to propagate errors to its callers.
850
+ */
851
+ #define JSREG_FIND_PAREN_COUNT 0x8000
852
+ #define JSREG_FIND_PAREN_ERROR 0x4000
853
+
854
+ /*
855
+ * Magic return value from FindParenCount and GetDecimalValue, to indicate
856
+ * overflow beyond GetDecimalValue's max parameter, or a computed maximum if
857
+ * its findMax parameter is non-null.
858
+ */
859
+ #define OVERFLOW_VALUE ((uintN)-1)
860
+
861
+ static uintN
862
+ FindParenCount(CompilerState *state)
863
+ {
864
+ CompilerState temp;
865
+ int i;
866
+
867
+ if (state->flags & JSREG_FIND_PAREN_COUNT)
868
+ return OVERFLOW_VALUE;
869
+
870
+ /*
871
+ * Copy state into temp, flag it so we never report an invalid backref,
872
+ * and reset its members to parse the entire regexp. This is obviously
873
+ * suboptimal, but GetDecimalValue calls us only if a backref appears to
874
+ * refer to a forward parenthetical, which is rare.
875
+ */
876
+ temp = *state;
877
+ temp.flags |= JSREG_FIND_PAREN_COUNT;
878
+ temp.cp = temp.cpbegin;
879
+ temp.parenCount = 0;
880
+ temp.classCount = 0;
881
+ temp.progLength = 0;
882
+ temp.treeDepth = 0;
883
+ temp.classBitmapsMem = 0;
884
+ for (i = 0; i < CLASS_CACHE_SIZE; i++)
885
+ temp.classCache[i].start = NULL;
886
+
887
+ if (!ParseRegExp(&temp)) {
888
+ state->flags |= JSREG_FIND_PAREN_ERROR;
889
+ return OVERFLOW_VALUE;
890
+ }
891
+ return temp.parenCount;
892
+ }
893
+
894
+ /*
895
+ * Extract and return a decimal value at state->cp. The initial character c
896
+ * has already been read. Return OVERFLOW_VALUE if the result exceeds max.
897
+ * Callers who pass a non-null findMax should test JSREG_FIND_PAREN_ERROR in
898
+ * state->flags to discover whether an error occurred under findMax.
899
+ */
900
+ static uintN
901
+ GetDecimalValue(jschar c, uintN max, uintN (*findMax)(CompilerState *state),
902
+ CompilerState *state)
903
+ {
904
+ uintN value = JS7_UNDEC(c);
905
+ JSBool overflow = (value > max && (!findMax || value > findMax(state)));
906
+
907
+ /* The following restriction allows simpler overflow checks. */
908
+ JS_ASSERT(max <= ((uintN)-1 - 9) / 10);
909
+ while (state->cp < state->cpend) {
910
+ c = *state->cp;
911
+ if (!JS7_ISDEC(c))
912
+ break;
913
+ value = 10 * value + JS7_UNDEC(c);
914
+ if (!overflow && value > max && (!findMax || value > findMax(state)))
915
+ overflow = JS_TRUE;
916
+ ++state->cp;
917
+ }
918
+ return overflow ? OVERFLOW_VALUE : value;
919
+ }
920
+
921
+ /*
922
+ * Calculate the total size of the bitmap required for a class expression.
923
+ */
924
+ static JSBool
925
+ CalculateBitmapSize(CompilerState *state, RENode *target, const jschar *src,
926
+ const jschar *end)
927
+ {
928
+ uintN max = 0;
929
+ JSBool inRange = JS_FALSE;
930
+ jschar c, rangeStart = 0;
931
+ uintN n, digit, nDigits, i;
932
+
933
+ target->u.ucclass.bmsize = 0;
934
+ target->u.ucclass.sense = JS_TRUE;
935
+
936
+ if (src == end)
937
+ return JS_TRUE;
938
+
939
+ if (*src == '^') {
940
+ ++src;
941
+ target->u.ucclass.sense = JS_FALSE;
942
+ }
943
+
944
+ while (src != end) {
945
+ JSBool canStartRange = JS_TRUE;
946
+ uintN localMax = 0;
947
+
948
+ switch (*src) {
949
+ case '\\':
950
+ ++src;
951
+ c = *src++;
952
+ switch (c) {
953
+ case 'b':
954
+ localMax = 0x8;
955
+ break;
956
+ case 'f':
957
+ localMax = 0xC;
958
+ break;
959
+ case 'n':
960
+ localMax = 0xA;
961
+ break;
962
+ case 'r':
963
+ localMax = 0xD;
964
+ break;
965
+ case 't':
966
+ localMax = 0x9;
967
+ break;
968
+ case 'v':
969
+ localMax = 0xB;
970
+ break;
971
+ case 'c':
972
+ if (src < end && RE_IS_LETTER(*src)) {
973
+ localMax = (uintN) (*src++) & 0x1F;
974
+ } else {
975
+ --src;
976
+ localMax = '\\';
977
+ }
978
+ break;
979
+ case 'x':
980
+ nDigits = 2;
981
+ goto lexHex;
982
+ case 'u':
983
+ nDigits = 4;
984
+ lexHex:
985
+ n = 0;
986
+ for (i = 0; (i < nDigits) && (src < end); i++) {
987
+ c = *src++;
988
+ if (!isASCIIHexDigit(c, &digit)) {
989
+ /*
990
+ * Back off to accepting the original
991
+ *'\' as a literal.
992
+ */
993
+ src -= i + 1;
994
+ n = '\\';
995
+ break;
996
+ }
997
+ n = (n << 4) | digit;
998
+ }
999
+ localMax = n;
1000
+ break;
1001
+ case 'd':
1002
+ canStartRange = JS_FALSE;
1003
+ if (inRange) {
1004
+ JS_ReportErrorNumber(state->context,
1005
+ js_GetErrorMessage, NULL,
1006
+ JSMSG_BAD_CLASS_RANGE);
1007
+ return JS_FALSE;
1008
+ }
1009
+ localMax = '9';
1010
+ break;
1011
+ case 'D':
1012
+ case 's':
1013
+ case 'S':
1014
+ case 'w':
1015
+ case 'W':
1016
+ canStartRange = JS_FALSE;
1017
+ if (inRange) {
1018
+ JS_ReportErrorNumber(state->context,
1019
+ js_GetErrorMessage, NULL,
1020
+ JSMSG_BAD_CLASS_RANGE);
1021
+ return JS_FALSE;
1022
+ }
1023
+ max = 65535;
1024
+
1025
+ /*
1026
+ * If this is the start of a range, ensure that it's less than
1027
+ * the end.
1028
+ */
1029
+ localMax = 0;
1030
+ break;
1031
+ case '0':
1032
+ case '1':
1033
+ case '2':
1034
+ case '3':
1035
+ case '4':
1036
+ case '5':
1037
+ case '6':
1038
+ case '7':
1039
+ /*
1040
+ * This is a non-ECMA extension - decimal escapes (in this
1041
+ * case, octal!) are supposed to be an error inside class
1042
+ * ranges, but supported here for backwards compatibility.
1043
+ *
1044
+ */
1045
+ n = JS7_UNDEC(c);
1046
+ c = *src;
1047
+ if ('0' <= c && c <= '7') {
1048
+ src++;
1049
+ n = 8 * n + JS7_UNDEC(c);
1050
+ c = *src;
1051
+ if ('0' <= c && c <= '7') {
1052
+ src++;
1053
+ i = 8 * n + JS7_UNDEC(c);
1054
+ if (i <= 0377)
1055
+ n = i;
1056
+ else
1057
+ src--;
1058
+ }
1059
+ }
1060
+ localMax = n;
1061
+ break;
1062
+
1063
+ default:
1064
+ localMax = c;
1065
+ break;
1066
+ }
1067
+ break;
1068
+ default:
1069
+ localMax = *src++;
1070
+ break;
1071
+ }
1072
+
1073
+ if (inRange) {
1074
+ /* Throw a SyntaxError here, per ECMA-262, 15.10.2.15. */
1075
+ if (rangeStart > localMax) {
1076
+ JS_ReportErrorNumber(state->context,
1077
+ js_GetErrorMessage, NULL,
1078
+ JSMSG_BAD_CLASS_RANGE);
1079
+ return JS_FALSE;
1080
+ }
1081
+ inRange = JS_FALSE;
1082
+ } else {
1083
+ if (canStartRange && src < end - 1) {
1084
+ if (*src == '-') {
1085
+ ++src;
1086
+ inRange = JS_TRUE;
1087
+ rangeStart = (jschar)localMax;
1088
+ continue;
1089
+ }
1090
+ }
1091
+ if (state->flags & JSREG_FOLD)
1092
+ rangeStart = localMax; /* one run of the uc/dc loop below */
1093
+ }
1094
+
1095
+ if (state->flags & JSREG_FOLD) {
1096
+ jschar maxch = localMax;
1097
+
1098
+ for (i = rangeStart; i <= localMax; i++) {
1099
+ jschar uch, dch;
1100
+
1101
+ uch = upcase(i);
1102
+ dch = downcase(i);
1103
+ maxch = JS_MAX(maxch, uch);
1104
+ maxch = JS_MAX(maxch, dch);
1105
+ }
1106
+ localMax = maxch;
1107
+ }
1108
+
1109
+ if (localMax > max)
1110
+ max = localMax;
1111
+ }
1112
+ target->u.ucclass.bmsize = max;
1113
+ return JS_TRUE;
1114
+ }
1115
+
1116
+ /*
1117
+ * item: assertion An item is either an assertion or
1118
+ * quantatom a quantified atom.
1119
+ *
1120
+ * assertion: '^' Assertions match beginning of string
1121
+ * (or line if the class static property
1122
+ * RegExp.multiline is true).
1123
+ * '$' End of string (or line if the class
1124
+ * static property RegExp.multiline is
1125
+ * true).
1126
+ * '\b' Word boundary (between \w and \W).
1127
+ * '\B' Word non-boundary.
1128
+ *
1129
+ * quantatom: atom An unquantified atom.
1130
+ * quantatom '{' n ',' m '}'
1131
+ * Atom must occur between n and m times.
1132
+ * quantatom '{' n ',' '}' Atom must occur at least n times.
1133
+ * quantatom '{' n '}' Atom must occur exactly n times.
1134
+ * quantatom '*' Zero or more times (same as {0,}).
1135
+ * quantatom '+' One or more times (same as {1,}).
1136
+ * quantatom '?' Zero or one time (same as {0,1}).
1137
+ *
1138
+ * any of which can be optionally followed by '?' for ungreedy
1139
+ *
1140
+ * atom: '(' regexp ')' A parenthesized regexp (what matched
1141
+ * can be addressed using a backreference,
1142
+ * see '\' n below).
1143
+ * '.' Matches any char except '\n'.
1144
+ * '[' classlist ']' A character class.
1145
+ * '[' '^' classlist ']' A negated character class.
1146
+ * '\f' Form Feed.
1147
+ * '\n' Newline (Line Feed).
1148
+ * '\r' Carriage Return.
1149
+ * '\t' Horizontal Tab.
1150
+ * '\v' Vertical Tab.
1151
+ * '\d' A digit (same as [0-9]).
1152
+ * '\D' A non-digit.
1153
+ * '\w' A word character, [0-9a-z_A-Z].
1154
+ * '\W' A non-word character.
1155
+ * '\s' A whitespace character, [ \b\f\n\r\t\v].
1156
+ * '\S' A non-whitespace character.
1157
+ * '\' n A backreference to the nth (n decimal
1158
+ * and positive) parenthesized expression.
1159
+ * '\' octal An octal escape sequence (octal must be
1160
+ * two or three digits long, unless it is
1161
+ * 0 for the null character).
1162
+ * '\x' hex A hex escape (hex must be two digits).
1163
+ * '\u' unicode A unicode escape (must be four digits).
1164
+ * '\c' ctrl A control character, ctrl is a letter.
1165
+ * '\' literalatomchar Any character except one of the above
1166
+ * that follow '\' in an atom.
1167
+ * otheratomchar Any character not first among the other
1168
+ * atom right-hand sides.
1169
+ */
1170
+ static JSBool
1171
+ ParseTerm(CompilerState *state)
1172
+ {
1173
+ jschar c = *state->cp++;
1174
+ uintN nDigits;
1175
+ uintN num, tmp, n, i;
1176
+ const jschar *termStart;
1177
+
1178
+ switch (c) {
1179
+ /* assertions and atoms */
1180
+ case '^':
1181
+ state->result = NewRENode(state, REOP_BOL);
1182
+ if (!state->result)
1183
+ return JS_FALSE;
1184
+ state->progLength++;
1185
+ return JS_TRUE;
1186
+ case '$':
1187
+ state->result = NewRENode(state, REOP_EOL);
1188
+ if (!state->result)
1189
+ return JS_FALSE;
1190
+ state->progLength++;
1191
+ return JS_TRUE;
1192
+ case '\\':
1193
+ if (state->cp >= state->cpend) {
1194
+ /* a trailing '\' is an error */
1195
+ ReportRegExpError(state, JSREPORT_ERROR, JSMSG_TRAILING_SLASH);
1196
+ return JS_FALSE;
1197
+ }
1198
+ c = *state->cp++;
1199
+ switch (c) {
1200
+ /* assertion escapes */
1201
+ case 'b' :
1202
+ state->result = NewRENode(state, REOP_WBDRY);
1203
+ if (!state->result)
1204
+ return JS_FALSE;
1205
+ state->progLength++;
1206
+ return JS_TRUE;
1207
+ case 'B':
1208
+ state->result = NewRENode(state, REOP_WNONBDRY);
1209
+ if (!state->result)
1210
+ return JS_FALSE;
1211
+ state->progLength++;
1212
+ return JS_TRUE;
1213
+ /* Decimal escape */
1214
+ case '0':
1215
+ /* Give a strict warning. See also the note below. */
1216
+ if (!ReportRegExpError(state, JSREPORT_WARNING | JSREPORT_STRICT,
1217
+ JSMSG_INVALID_BACKREF)) {
1218
+ return JS_FALSE;
1219
+ }
1220
+ doOctal:
1221
+ num = 0;
1222
+ while (state->cp < state->cpend) {
1223
+ c = *state->cp;
1224
+ if (c < '0' || '7' < c)
1225
+ break;
1226
+ state->cp++;
1227
+ tmp = 8 * num + (uintN)JS7_UNDEC(c);
1228
+ if (tmp > 0377)
1229
+ break;
1230
+ num = tmp;
1231
+ }
1232
+ c = (jschar)num;
1233
+ doFlat:
1234
+ state->result = NewRENode(state, REOP_FLAT);
1235
+ if (!state->result)
1236
+ return JS_FALSE;
1237
+ state->result->u.flat.chr = c;
1238
+ state->result->u.flat.length = 1;
1239
+ state->progLength += 3;
1240
+ break;
1241
+ case '1':
1242
+ case '2':
1243
+ case '3':
1244
+ case '4':
1245
+ case '5':
1246
+ case '6':
1247
+ case '7':
1248
+ case '8':
1249
+ case '9':
1250
+ termStart = state->cp - 1;
1251
+ num = GetDecimalValue(c, state->parenCount, FindParenCount, state);
1252
+ if (state->flags & JSREG_FIND_PAREN_ERROR)
1253
+ return JS_FALSE;
1254
+ if (num == OVERFLOW_VALUE) {
1255
+ /* Give a strict mode warning. */
1256
+ if (!ReportRegExpError(state,
1257
+ JSREPORT_WARNING | JSREPORT_STRICT,
1258
+ (c >= '8')
1259
+ ? JSMSG_INVALID_BACKREF
1260
+ : JSMSG_BAD_BACKREF)) {
1261
+ return JS_FALSE;
1262
+ }
1263
+
1264
+ /*
1265
+ * Note: ECMA 262, 15.10.2.9 says that we should throw a syntax
1266
+ * error here. However, for compatibility with IE, we treat the
1267
+ * whole backref as flat if the first character in it is not a
1268
+ * valid octal character, and as an octal escape otherwise.
1269
+ */
1270
+ state->cp = termStart;
1271
+ if (c >= '8') {
1272
+ /* Treat this as flat. termStart - 1 is the \. */
1273
+ c = '\\';
1274
+ goto asFlat;
1275
+ }
1276
+
1277
+ /* Treat this as an octal escape. */
1278
+ goto doOctal;
1279
+ }
1280
+ JS_ASSERT(1 <= num && num <= 0x10000);
1281
+ state->result = NewRENode(state, REOP_BACKREF);
1282
+ if (!state->result)
1283
+ return JS_FALSE;
1284
+ state->result->u.parenIndex = num - 1;
1285
+ state->progLength
1286
+ += 1 + GetCompactIndexWidth(state->result->u.parenIndex);
1287
+ break;
1288
+ /* Control escape */
1289
+ case 'f':
1290
+ c = 0xC;
1291
+ goto doFlat;
1292
+ case 'n':
1293
+ c = 0xA;
1294
+ goto doFlat;
1295
+ case 'r':
1296
+ c = 0xD;
1297
+ goto doFlat;
1298
+ case 't':
1299
+ c = 0x9;
1300
+ goto doFlat;
1301
+ case 'v':
1302
+ c = 0xB;
1303
+ goto doFlat;
1304
+ /* Control letter */
1305
+ case 'c':
1306
+ if (state->cp < state->cpend && RE_IS_LETTER(*state->cp)) {
1307
+ c = (jschar) (*state->cp++ & 0x1F);
1308
+ } else {
1309
+ /* back off to accepting the original '\' as a literal */
1310
+ --state->cp;
1311
+ c = '\\';
1312
+ }
1313
+ goto doFlat;
1314
+ /* HexEscapeSequence */
1315
+ case 'x':
1316
+ nDigits = 2;
1317
+ goto lexHex;
1318
+ /* UnicodeEscapeSequence */
1319
+ case 'u':
1320
+ nDigits = 4;
1321
+ lexHex:
1322
+ n = 0;
1323
+ for (i = 0; i < nDigits && state->cp < state->cpend; i++) {
1324
+ uintN digit;
1325
+ c = *state->cp++;
1326
+ if (!isASCIIHexDigit(c, &digit)) {
1327
+ /*
1328
+ * Back off to accepting the original 'u' or 'x' as a
1329
+ * literal.
1330
+ */
1331
+ state->cp -= i + 2;
1332
+ n = *state->cp++;
1333
+ break;
1334
+ }
1335
+ n = (n << 4) | digit;
1336
+ }
1337
+ c = (jschar) n;
1338
+ goto doFlat;
1339
+ /* Character class escapes */
1340
+ case 'd':
1341
+ state->result = NewRENode(state, REOP_DIGIT);
1342
+ doSimple:
1343
+ if (!state->result)
1344
+ return JS_FALSE;
1345
+ state->progLength++;
1346
+ break;
1347
+ case 'D':
1348
+ state->result = NewRENode(state, REOP_NONDIGIT);
1349
+ goto doSimple;
1350
+ case 's':
1351
+ state->result = NewRENode(state, REOP_SPACE);
1352
+ goto doSimple;
1353
+ case 'S':
1354
+ state->result = NewRENode(state, REOP_NONSPACE);
1355
+ goto doSimple;
1356
+ case 'w':
1357
+ state->result = NewRENode(state, REOP_ALNUM);
1358
+ goto doSimple;
1359
+ case 'W':
1360
+ state->result = NewRENode(state, REOP_NONALNUM);
1361
+ goto doSimple;
1362
+ /* IdentityEscape */
1363
+ default:
1364
+ state->result = NewRENode(state, REOP_FLAT);
1365
+ if (!state->result)
1366
+ return JS_FALSE;
1367
+ state->result->u.flat.chr = c;
1368
+ state->result->u.flat.length = 1;
1369
+ state->result->kid = (void *) (state->cp - 1);
1370
+ state->progLength += 3;
1371
+ break;
1372
+ }
1373
+ break;
1374
+ case '[':
1375
+ state->result = NewRENode(state, REOP_CLASS);
1376
+ if (!state->result)
1377
+ return JS_FALSE;
1378
+ termStart = state->cp;
1379
+ state->result->u.ucclass.startIndex = termStart - state->cpbegin;
1380
+ for (;;) {
1381
+ if (state->cp == state->cpend) {
1382
+ ReportRegExpErrorHelper(state, JSREPORT_ERROR,
1383
+ JSMSG_UNTERM_CLASS, termStart);
1384
+
1385
+ return JS_FALSE;
1386
+ }
1387
+ if (*state->cp == '\\') {
1388
+ state->cp++;
1389
+ if (state->cp != state->cpend)
1390
+ state->cp++;
1391
+ continue;
1392
+ }
1393
+ if (*state->cp == ']') {
1394
+ state->result->u.ucclass.kidlen = state->cp - termStart;
1395
+ break;
1396
+ }
1397
+ state->cp++;
1398
+ }
1399
+ for (i = 0; i < CLASS_CACHE_SIZE; i++) {
1400
+ if (!state->classCache[i].start) {
1401
+ state->classCache[i].start = termStart;
1402
+ state->classCache[i].length = state->result->u.ucclass.kidlen;
1403
+ state->classCache[i].index = state->classCount;
1404
+ break;
1405
+ }
1406
+ if (state->classCache[i].length ==
1407
+ state->result->u.ucclass.kidlen) {
1408
+ for (n = 0; ; n++) {
1409
+ if (n == state->classCache[i].length) {
1410
+ state->result->u.ucclass.index
1411
+ = state->classCache[i].index;
1412
+ goto claim;
1413
+ }
1414
+ if (state->classCache[i].start[n] != termStart[n])
1415
+ break;
1416
+ }
1417
+ }
1418
+ }
1419
+ state->result->u.ucclass.index = state->classCount++;
1420
+
1421
+ claim:
1422
+ /*
1423
+ * Call CalculateBitmapSize now as we want any errors it finds
1424
+ * to be reported during the parse phase, not at execution.
1425
+ */
1426
+ if (!CalculateBitmapSize(state, state->result, termStart, state->cp++))
1427
+ return JS_FALSE;
1428
+ /*
1429
+ * Update classBitmapsMem with number of bytes to hold bmsize bits,
1430
+ * which is (bitsCount + 7) / 8 or (highest_bit + 1 + 7) / 8
1431
+ * or highest_bit / 8 + 1 where highest_bit is u.ucclass.bmsize.
1432
+ */
1433
+ n = (state->result->u.ucclass.bmsize >> 3) + 1;
1434
+ if (n > CLASS_BITMAPS_MEM_LIMIT - state->classBitmapsMem) {
1435
+ ReportRegExpError(state, JSREPORT_ERROR, JSMSG_REGEXP_TOO_COMPLEX);
1436
+ return JS_FALSE;
1437
+ }
1438
+ state->classBitmapsMem += n;
1439
+ /* CLASS, <index> */
1440
+ state->progLength
1441
+ += 1 + GetCompactIndexWidth(state->result->u.ucclass.index);
1442
+ break;
1443
+
1444
+ case '.':
1445
+ state->result = NewRENode(state, REOP_DOT);
1446
+ goto doSimple;
1447
+
1448
+ case '{':
1449
+ {
1450
+ const jschar *errp = state->cp--;
1451
+ intN err;
1452
+
1453
+ err = ParseMinMaxQuantifier(state, JS_TRUE);
1454
+ state->cp = errp;
1455
+
1456
+ if (err < 0)
1457
+ goto asFlat;
1458
+
1459
+ /* FALL THROUGH */
1460
+ }
1461
+ case '*':
1462
+ case '+':
1463
+ case '?':
1464
+ ReportRegExpErrorHelper(state, JSREPORT_ERROR,
1465
+ JSMSG_BAD_QUANTIFIER, state->cp - 1);
1466
+ return JS_FALSE;
1467
+ default:
1468
+ asFlat:
1469
+ state->result = NewRENode(state, REOP_FLAT);
1470
+ if (!state->result)
1471
+ return JS_FALSE;
1472
+ state->result->u.flat.chr = c;
1473
+ state->result->u.flat.length = 1;
1474
+ state->result->kid = (void *) (state->cp - 1);
1475
+ state->progLength += 3;
1476
+ break;
1477
+ }
1478
+ return ParseQuantifier(state);
1479
+ }
1480
+
1481
+ static JSBool
1482
+ ParseQuantifier(CompilerState *state)
1483
+ {
1484
+ RENode *term;
1485
+ term = state->result;
1486
+ if (state->cp < state->cpend) {
1487
+ switch (*state->cp) {
1488
+ case '+':
1489
+ state->result = NewRENode(state, REOP_QUANT);
1490
+ if (!state->result)
1491
+ return JS_FALSE;
1492
+ state->result->u.range.min = 1;
1493
+ state->result->u.range.max = (uintN)-1;
1494
+ /* <PLUS>, <next> ... <ENDCHILD> */
1495
+ state->progLength += 4;
1496
+ goto quantifier;
1497
+ case '*':
1498
+ state->result = NewRENode(state, REOP_QUANT);
1499
+ if (!state->result)
1500
+ return JS_FALSE;
1501
+ state->result->u.range.min = 0;
1502
+ state->result->u.range.max = (uintN)-1;
1503
+ /* <STAR>, <next> ... <ENDCHILD> */
1504
+ state->progLength += 4;
1505
+ goto quantifier;
1506
+ case '?':
1507
+ state->result = NewRENode(state, REOP_QUANT);
1508
+ if (!state->result)
1509
+ return JS_FALSE;
1510
+ state->result->u.range.min = 0;
1511
+ state->result->u.range.max = 1;
1512
+ /* <OPT>, <next> ... <ENDCHILD> */
1513
+ state->progLength += 4;
1514
+ goto quantifier;
1515
+ case '{': /* balance '}' */
1516
+ {
1517
+ intN err;
1518
+ const jschar *errp = state->cp;
1519
+
1520
+ err = ParseMinMaxQuantifier(state, JS_FALSE);
1521
+ if (err == 0)
1522
+ goto quantifier;
1523
+ if (err == -1)
1524
+ return JS_TRUE;
1525
+
1526
+ ReportRegExpErrorHelper(state, JSREPORT_ERROR, err, errp);
1527
+ return JS_FALSE;
1528
+ }
1529
+ default:;
1530
+ }
1531
+ }
1532
+ return JS_TRUE;
1533
+
1534
+ quantifier:
1535
+ if (state->treeDepth == TREE_DEPTH_MAX) {
1536
+ ReportRegExpError(state, JSREPORT_ERROR, JSMSG_REGEXP_TOO_COMPLEX);
1537
+ return JS_FALSE;
1538
+ }
1539
+
1540
+ ++state->treeDepth;
1541
+ ++state->cp;
1542
+ state->result->kid = term;
1543
+ if (state->cp < state->cpend && *state->cp == '?') {
1544
+ ++state->cp;
1545
+ state->result->u.range.greedy = JS_FALSE;
1546
+ } else {
1547
+ state->result->u.range.greedy = JS_TRUE;
1548
+ }
1549
+ return JS_TRUE;
1550
+ }
1551
+
1552
+ static intN
1553
+ ParseMinMaxQuantifier(CompilerState *state, JSBool ignoreValues)
1554
+ {
1555
+ uintN min, max;
1556
+ jschar c;
1557
+ const jschar *errp = state->cp++;
1558
+
1559
+ c = *state->cp;
1560
+ if (JS7_ISDEC(c)) {
1561
+ ++state->cp;
1562
+ min = GetDecimalValue(c, 0xFFFF, NULL, state);
1563
+ c = *state->cp;
1564
+
1565
+ if (!ignoreValues && min == OVERFLOW_VALUE)
1566
+ return JSMSG_MIN_TOO_BIG;
1567
+
1568
+ if (c == ',') {
1569
+ c = *++state->cp;
1570
+ if (JS7_ISDEC(c)) {
1571
+ ++state->cp;
1572
+ max = GetDecimalValue(c, 0xFFFF, NULL, state);
1573
+ c = *state->cp;
1574
+ if (!ignoreValues && max == OVERFLOW_VALUE)
1575
+ return JSMSG_MAX_TOO_BIG;
1576
+ if (!ignoreValues && min > max)
1577
+ return JSMSG_OUT_OF_ORDER;
1578
+ } else {
1579
+ max = (uintN)-1;
1580
+ }
1581
+ } else {
1582
+ max = min;
1583
+ }
1584
+ if (c == '}') {
1585
+ state->result = NewRENode(state, REOP_QUANT);
1586
+ if (!state->result)
1587
+ return JSMSG_OUT_OF_MEMORY;
1588
+ state->result->u.range.min = min;
1589
+ state->result->u.range.max = max;
1590
+ /*
1591
+ * QUANT, <min>, <max>, <next> ... <ENDCHILD>
1592
+ * where <max> is written as compact(max+1) to make
1593
+ * (uintN)-1 sentinel to occupy 1 byte, not width_of(max)+1.
1594
+ */
1595
+ state->progLength += (1 + GetCompactIndexWidth(min)
1596
+ + GetCompactIndexWidth(max + 1)
1597
+ +3);
1598
+ return 0;
1599
+ }
1600
+ }
1601
+
1602
+ state->cp = errp;
1603
+ return -1;
1604
+ }
1605
+
1606
+ static JSBool
1607
+ SetForwardJumpOffset(jsbytecode *jump, jsbytecode *target)
1608
+ {
1609
+ ptrdiff_t offset = target - jump;
1610
+
1611
+ /* Check that target really points forward. */
1612
+ JS_ASSERT(offset >= 2);
1613
+ if ((size_t)offset > OFFSET_MAX)
1614
+ return JS_FALSE;
1615
+
1616
+ jump[0] = JUMP_OFFSET_HI(offset);
1617
+ jump[1] = JUMP_OFFSET_LO(offset);
1618
+ return JS_TRUE;
1619
+ }
1620
+
1621
+ /* Copy the charset data from a character class node to the charset list
1622
+ * in the regexp object. */
1623
+ static JS_ALWAYS_INLINE RECharSet *
1624
+ InitNodeCharSet(JSRegExp *re, RENode *node)
1625
+ {
1626
+ RECharSet *charSet = &re->classList[node->u.ucclass.index];
1627
+ charSet->converted = JS_FALSE;
1628
+ charSet->length = node->u.ucclass.bmsize;
1629
+ charSet->u.src.startIndex = node->u.ucclass.startIndex;
1630
+ charSet->u.src.length = node->u.ucclass.kidlen;
1631
+ charSet->sense = node->u.ucclass.sense;
1632
+ return charSet;
1633
+ }
1634
+
1635
+ /*
1636
+ * Generate bytecode for the tree rooted at t using an explicit stack instead
1637
+ * of recursion.
1638
+ */
1639
+ static jsbytecode *
1640
+ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
1641
+ jsbytecode *pc, RENode *t)
1642
+ {
1643
+ EmitStateStackEntry *emitStateSP, *emitStateStack;
1644
+ REOp op;
1645
+
1646
+ if (treeDepth == 0) {
1647
+ emitStateStack = NULL;
1648
+ } else {
1649
+ emitStateStack =
1650
+ (EmitStateStackEntry *)JS_malloc(state->context,
1651
+ sizeof(EmitStateStackEntry) *
1652
+ treeDepth);
1653
+ if (!emitStateStack)
1654
+ return NULL;
1655
+ }
1656
+ emitStateSP = emitStateStack;
1657
+ op = t->op;
1658
+ JS_ASSERT(op < REOP_LIMIT);
1659
+
1660
+ for (;;) {
1661
+ *pc++ = op;
1662
+ switch (op) {
1663
+ case REOP_EMPTY:
1664
+ --pc;
1665
+ break;
1666
+
1667
+ case REOP_ALTPREREQ2:
1668
+ case REOP_ALTPREREQ:
1669
+ JS_ASSERT(emitStateSP);
1670
+ emitStateSP->altHead = pc - 1;
1671
+ emitStateSP->endTermFixup = pc;
1672
+ pc += OFFSET_LEN;
1673
+ SET_ARG(pc, t->u.altprereq.ch1);
1674
+ pc += ARG_LEN;
1675
+ SET_ARG(pc, t->u.altprereq.ch2);
1676
+ pc += ARG_LEN;
1677
+
1678
+ emitStateSP->nextAltFixup = pc; /* offset to next alternate */
1679
+ pc += OFFSET_LEN;
1680
+
1681
+ emitStateSP->continueNode = t;
1682
+ emitStateSP->continueOp = REOP_JUMP;
1683
+ emitStateSP->jumpToJumpFlag = JS_FALSE;
1684
+ ++emitStateSP;
1685
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1686
+ t = (RENode *) t->kid;
1687
+ op = t->op;
1688
+ JS_ASSERT(op < REOP_LIMIT);
1689
+ continue;
1690
+
1691
+ case REOP_JUMP:
1692
+ emitStateSP->nextTermFixup = pc; /* offset to following term */
1693
+ pc += OFFSET_LEN;
1694
+ if (!SetForwardJumpOffset(emitStateSP->nextAltFixup, pc))
1695
+ goto jump_too_big;
1696
+ emitStateSP->continueOp = REOP_ENDALT;
1697
+ ++emitStateSP;
1698
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1699
+ t = (RENode *) t->u.kid2;
1700
+ op = t->op;
1701
+ JS_ASSERT(op < REOP_LIMIT);
1702
+ continue;
1703
+
1704
+ case REOP_ENDALT:
1705
+ /*
1706
+ * If we already patched emitStateSP->nextTermFixup to jump to
1707
+ * a nearer jump, to avoid 16-bit immediate offset overflow, we
1708
+ * are done here.
1709
+ */
1710
+ if (emitStateSP->jumpToJumpFlag)
1711
+ break;
1712
+
1713
+ /*
1714
+ * Fix up the REOP_JUMP offset to go to the op after REOP_ENDALT.
1715
+ * REOP_ENDALT is executed only on successful match of the last
1716
+ * alternate in a group.
1717
+ */
1718
+ if (!SetForwardJumpOffset(emitStateSP->nextTermFixup, pc))
1719
+ goto jump_too_big;
1720
+ if (t->op != REOP_ALT) {
1721
+ if (!SetForwardJumpOffset(emitStateSP->endTermFixup, pc))
1722
+ goto jump_too_big;
1723
+ }
1724
+
1725
+ /*
1726
+ * If the program is bigger than the REOP_JUMP offset range, then
1727
+ * we must check for alternates before this one that are part of
1728
+ * the same group, and fix up their jump offsets to target jumps
1729
+ * close enough to fit in a 16-bit unsigned offset immediate.
1730
+ */
1731
+ if ((size_t)(pc - re->program) > OFFSET_MAX &&
1732
+ emitStateSP > emitStateStack) {
1733
+ EmitStateStackEntry *esp, *esp2;
1734
+ jsbytecode *alt, *jump;
1735
+ ptrdiff_t span, header;
1736
+
1737
+ esp2 = emitStateSP;
1738
+ alt = esp2->altHead;
1739
+ for (esp = esp2 - 1; esp >= emitStateStack; --esp) {
1740
+ if (esp->continueOp == REOP_ENDALT &&
1741
+ !esp->jumpToJumpFlag &&
1742
+ esp->nextTermFixup + OFFSET_LEN == alt &&
1743
+ (size_t)(pc - ((esp->continueNode->op != REOP_ALT)
1744
+ ? esp->endTermFixup
1745
+ : esp->nextTermFixup)) > OFFSET_MAX) {
1746
+ alt = esp->altHead;
1747
+ jump = esp->nextTermFixup;
1748
+
1749
+ /*
1750
+ * The span must be 1 less than the distance from
1751
+ * jump offset to jump offset, so we actually jump
1752
+ * to a REOP_JUMP bytecode, not to its offset!
1753
+ */
1754
+ for (;;) {
1755
+ JS_ASSERT(jump < esp2->nextTermFixup);
1756
+ span = esp2->nextTermFixup - jump - 1;
1757
+ if ((size_t)span <= OFFSET_MAX)
1758
+ break;
1759
+ do {
1760
+ if (--esp2 == esp)
1761
+ goto jump_too_big;
1762
+ } while (esp2->continueOp != REOP_ENDALT);
1763
+ }
1764
+
1765
+ jump[0] = JUMP_OFFSET_HI(span);
1766
+ jump[1] = JUMP_OFFSET_LO(span);
1767
+
1768
+ if (esp->continueNode->op != REOP_ALT) {
1769
+ /*
1770
+ * We must patch the offset at esp->endTermFixup
1771
+ * as well, for the REOP_ALTPREREQ{,2} opcodes.
1772
+ * If we're unlucky and endTermFixup is more than
1773
+ * OFFSET_MAX bytes from its target, we cheat by
1774
+ * jumping 6 bytes to the jump whose offset is at
1775
+ * esp->nextTermFixup, which has the same target.
1776
+ */
1777
+ jump = esp->endTermFixup;
1778
+ header = esp->nextTermFixup - jump;
1779
+ span += header;
1780
+ if ((size_t)span > OFFSET_MAX)
1781
+ span = header;
1782
+
1783
+ jump[0] = JUMP_OFFSET_HI(span);
1784
+ jump[1] = JUMP_OFFSET_LO(span);
1785
+ }
1786
+
1787
+ esp->jumpToJumpFlag = JS_TRUE;
1788
+ }
1789
+ }
1790
+ }
1791
+ break;
1792
+
1793
+ case REOP_ALT:
1794
+ JS_ASSERT(emitStateSP);
1795
+ emitStateSP->altHead = pc - 1;
1796
+ emitStateSP->nextAltFixup = pc; /* offset to next alternate */
1797
+ pc += OFFSET_LEN;
1798
+ emitStateSP->continueNode = t;
1799
+ emitStateSP->continueOp = REOP_JUMP;
1800
+ emitStateSP->jumpToJumpFlag = JS_FALSE;
1801
+ ++emitStateSP;
1802
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1803
+ t = (RENode *) t->kid;
1804
+ op = t->op;
1805
+ JS_ASSERT(op < REOP_LIMIT);
1806
+ continue;
1807
+
1808
+ case REOP_FLAT:
1809
+ /*
1810
+ * Coalesce FLATs if possible and if it would not increase bytecode
1811
+ * beyond preallocated limit. The latter happens only when bytecode
1812
+ * size for coalesced string with offset p and length 2 exceeds 6
1813
+ * bytes preallocated for 2 single char nodes, i.e. when
1814
+ * 1 + GetCompactIndexWidth(p) + GetCompactIndexWidth(2) > 6 or
1815
+ * GetCompactIndexWidth(p) > 4.
1816
+ * Since when GetCompactIndexWidth(p) <= 4 coalescing of 3 or more
1817
+ * nodes strictly decreases bytecode size, the check has to be
1818
+ * done only for the first coalescing.
1819
+ */
1820
+ if (t->kid &&
1821
+ GetCompactIndexWidth((jschar *)t->kid - state->cpbegin) <= 4)
1822
+ {
1823
+ while (t->next &&
1824
+ t->next->op == REOP_FLAT &&
1825
+ (jschar*)t->kid + t->u.flat.length ==
1826
+ (jschar*)t->next->kid) {
1827
+ t->u.flat.length += t->next->u.flat.length;
1828
+ t->next = t->next->next;
1829
+ }
1830
+ }
1831
+ if (t->kid && t->u.flat.length > 1) {
1832
+ pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLATi : REOP_FLAT;
1833
+ pc = WriteCompactIndex(pc, (jschar *)t->kid - state->cpbegin);
1834
+ pc = WriteCompactIndex(pc, t->u.flat.length);
1835
+ } else if (t->u.flat.chr < 256) {
1836
+ pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLAT1i : REOP_FLAT1;
1837
+ *pc++ = (jsbytecode) t->u.flat.chr;
1838
+ } else {
1839
+ pc[-1] = (state->flags & JSREG_FOLD)
1840
+ ? REOP_UCFLAT1i
1841
+ : REOP_UCFLAT1;
1842
+ SET_ARG(pc, t->u.flat.chr);
1843
+ pc += ARG_LEN;
1844
+ }
1845
+ break;
1846
+
1847
+ case REOP_LPAREN:
1848
+ JS_ASSERT(emitStateSP);
1849
+ pc = WriteCompactIndex(pc, t->u.parenIndex);
1850
+ emitStateSP->continueNode = t;
1851
+ emitStateSP->continueOp = REOP_RPAREN;
1852
+ ++emitStateSP;
1853
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1854
+ t = (RENode *) t->kid;
1855
+ op = t->op;
1856
+ continue;
1857
+
1858
+ case REOP_RPAREN:
1859
+ pc = WriteCompactIndex(pc, t->u.parenIndex);
1860
+ break;
1861
+
1862
+ case REOP_BACKREF:
1863
+ pc = WriteCompactIndex(pc, t->u.parenIndex);
1864
+ break;
1865
+
1866
+ case REOP_ASSERT:
1867
+ JS_ASSERT(emitStateSP);
1868
+ emitStateSP->nextTermFixup = pc;
1869
+ pc += OFFSET_LEN;
1870
+ emitStateSP->continueNode = t;
1871
+ emitStateSP->continueOp = REOP_ASSERTTEST;
1872
+ ++emitStateSP;
1873
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1874
+ t = (RENode *) t->kid;
1875
+ op = t->op;
1876
+ continue;
1877
+
1878
+ case REOP_ASSERTTEST:
1879
+ case REOP_ASSERTNOTTEST:
1880
+ if (!SetForwardJumpOffset(emitStateSP->nextTermFixup, pc))
1881
+ goto jump_too_big;
1882
+ break;
1883
+
1884
+ case REOP_ASSERT_NOT:
1885
+ JS_ASSERT(emitStateSP);
1886
+ emitStateSP->nextTermFixup = pc;
1887
+ pc += OFFSET_LEN;
1888
+ emitStateSP->continueNode = t;
1889
+ emitStateSP->continueOp = REOP_ASSERTNOTTEST;
1890
+ ++emitStateSP;
1891
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1892
+ t = (RENode *) t->kid;
1893
+ op = t->op;
1894
+ continue;
1895
+
1896
+ case REOP_QUANT:
1897
+ JS_ASSERT(emitStateSP);
1898
+ if (t->u.range.min == 0 && t->u.range.max == (uintN)-1) {
1899
+ pc[-1] = (t->u.range.greedy) ? REOP_STAR : REOP_MINIMALSTAR;
1900
+ } else if (t->u.range.min == 0 && t->u.range.max == 1) {
1901
+ pc[-1] = (t->u.range.greedy) ? REOP_OPT : REOP_MINIMALOPT;
1902
+ } else if (t->u.range.min == 1 && t->u.range.max == (uintN) -1) {
1903
+ pc[-1] = (t->u.range.greedy) ? REOP_PLUS : REOP_MINIMALPLUS;
1904
+ } else {
1905
+ if (!t->u.range.greedy)
1906
+ pc[-1] = REOP_MINIMALQUANT;
1907
+ pc = WriteCompactIndex(pc, t->u.range.min);
1908
+ /*
1909
+ * Write max + 1 to avoid using size_t(max) + 1 bytes
1910
+ * for (uintN)-1 sentinel.
1911
+ */
1912
+ pc = WriteCompactIndex(pc, t->u.range.max + 1);
1913
+ }
1914
+ emitStateSP->nextTermFixup = pc;
1915
+ pc += OFFSET_LEN;
1916
+ emitStateSP->continueNode = t;
1917
+ emitStateSP->continueOp = REOP_ENDCHILD;
1918
+ ++emitStateSP;
1919
+ JS_ASSERT((size_t)(emitStateSP - emitStateStack) <= treeDepth);
1920
+ t = (RENode *) t->kid;
1921
+ op = t->op;
1922
+ continue;
1923
+
1924
+ case REOP_ENDCHILD:
1925
+ if (!SetForwardJumpOffset(emitStateSP->nextTermFixup, pc))
1926
+ goto jump_too_big;
1927
+ break;
1928
+
1929
+ case REOP_CLASS:
1930
+ if (!t->u.ucclass.sense)
1931
+ pc[-1] = REOP_NCLASS;
1932
+ pc = WriteCompactIndex(pc, t->u.ucclass.index);
1933
+ InitNodeCharSet(re, t);
1934
+ break;
1935
+
1936
+ default:
1937
+ break;
1938
+ }
1939
+
1940
+ t = t->next;
1941
+ if (t) {
1942
+ op = t->op;
1943
+ } else {
1944
+ if (emitStateSP == emitStateStack)
1945
+ break;
1946
+ --emitStateSP;
1947
+ t = emitStateSP->continueNode;
1948
+ op = (REOp) emitStateSP->continueOp;
1949
+ }
1950
+ }
1951
+
1952
+ cleanup:
1953
+ if (emitStateStack)
1954
+ JS_free(state->context, emitStateStack);
1955
+ return pc;
1956
+
1957
+ jump_too_big:
1958
+ ReportRegExpError(state, JSREPORT_ERROR, JSMSG_REGEXP_TOO_COMPLEX);
1959
+ pc = NULL;
1960
+ goto cleanup;
1961
+ }
1962
+
1963
+ #ifdef JS_TRACER
1964
+ typedef List<LIns*, LIST_NonGCObjects> LInsList;
1965
+
1966
+ /* Dummy GC for nanojit placement new. */
1967
+ static GC gc;
1968
+
1969
+ class RegExpNativeCompiler {
1970
+ private:
1971
+ JSRegExp* re; /* Careful: not fully initialized */
1972
+ CompilerState* cs; /* RegExp to compile */
1973
+ Fragment* fragment;
1974
+ LirWriter* lir;
1975
+
1976
+ LIns* state;
1977
+ LIns* gdata;
1978
+ LIns* cpend;
1979
+
1980
+ JSBool isCaseInsensitive() const { return cs->flags & JSREG_FOLD; }
1981
+
1982
+ void targetCurrentPoint(LIns* ins) { ins->target(lir->ins0(LIR_label)); }
1983
+
1984
+ void targetCurrentPoint(LInsList& fails)
1985
+ {
1986
+ LIns* fail = lir->ins0(LIR_label);
1987
+ for (size_t i = 0; i < fails.size(); ++i) {
1988
+ fails[i]->target(fail);
1989
+ }
1990
+ fails.clear();
1991
+ }
1992
+
1993
+ /*
1994
+ * These functions return the new position after their match operation,
1995
+ * or NULL if there was an error.
1996
+ */
1997
+ LIns* compileEmpty(RENode* node, LIns* pos, LInsList& fails)
1998
+ {
1999
+ return pos;
2000
+ }
2001
+
2002
+ LIns* compileFlatSingleChar(RENode* node, LIns* pos, LInsList& fails)
2003
+ {
2004
+ /*
2005
+ * Fast case-insensitive test for ASCII letters: convert text
2006
+ * char to lower case by bit-or-ing in 32 and compare.
2007
+ */
2008
+ JSBool useFastCI = JS_FALSE;
2009
+ jschar ch = node->u.flat.chr; /* char to test for */
2010
+ jschar ch2 = ch; /* 2nd char to test for if ci */
2011
+ if (cs->flags & JSREG_FOLD) {
2012
+ if (L'A' <= ch && ch <= L'Z' || L'a' <= ch || ch <= L'z') {
2013
+ ch |= 32;
2014
+ ch2 = ch;
2015
+ useFastCI = JS_TRUE;
2016
+ } else if (JS_TOLOWER(ch) != ch) {
2017
+ ch2 = JS_TOLOWER(ch);
2018
+ ch = JS_TOUPPER(ch);
2019
+ }
2020
+ }
2021
+
2022
+ LIns* to_fail = lir->insBranch(LIR_jf, lir->ins2(LIR_lt, pos, cpend), 0);
2023
+ fails.add(to_fail);
2024
+ LIns* text_ch = lir->insLoad(LIR_ldcs, pos, lir->insImm(0));
2025
+ LIns* comp_ch = useFastCI ?
2026
+ lir->ins2(LIR_or, text_ch, lir->insImm(32)) :
2027
+ text_ch;
2028
+ if (ch == ch2) {
2029
+ fails.add(lir->insBranch(LIR_jf, lir->ins2(LIR_eq, comp_ch, lir->insImm(ch)), 0));
2030
+ } else {
2031
+ LIns* to_ok = lir->insBranch(LIR_jt, lir->ins2(LIR_eq, comp_ch, lir->insImm(ch)), 0);
2032
+ fails.add(lir->insBranch(LIR_jf, lir->ins2(LIR_eq, comp_ch, lir->insImm(ch2)), 0));
2033
+ targetCurrentPoint(to_ok);
2034
+ }
2035
+
2036
+ return lir->ins2(LIR_piadd, pos, lir->insImm(2));
2037
+ }
2038
+
2039
+ LIns* compileClass(RENode* node, LIns* pos, LInsList& fails)
2040
+ {
2041
+ if (!node->u.ucclass.sense)
2042
+ return JS_FALSE;
2043
+
2044
+ RECharSet* charSet = InitNodeCharSet(re, node);
2045
+ LIns* to_fail = lir->insBranch(LIR_jf, lir->ins2(LIR_lt, pos, cpend), 0);
2046
+ fails.add(to_fail);
2047
+ LIns* text_ch = lir->insLoad(LIR_ldcs, pos, lir->insImm(0));
2048
+ fails.add(lir->insBranch(LIR_jf, lir->ins2(LIR_le, text_ch, lir->insImm(charSet->length)), 0));
2049
+ LIns* byteIndex = lir->ins2(LIR_rsh, text_ch, lir->insImm(3));
2050
+ LIns* bitmap = lir->insLoad(LIR_ld, lir->insImmPtr(charSet), (int) offsetof(RECharSet, u.bits));
2051
+ LIns* byte = lir->insLoad(LIR_ldcb, lir->ins2(LIR_piadd, bitmap, byteIndex), (int) 0);
2052
+ LIns* bitMask = lir->ins2(LIR_lsh, lir->insImm(1),
2053
+ lir->ins2(LIR_and, text_ch, lir->insImm(0x7)));
2054
+ LIns* test = lir->ins2(LIR_eq, lir->ins2(LIR_and, byte, bitMask), lir->insImm(0));
2055
+
2056
+ LIns* to_next = lir->insBranch(LIR_jt, test, 0);
2057
+ fails.add(to_next);
2058
+ return lir->ins2(LIR_piadd, pos, lir->insImm(2));
2059
+ }
2060
+
2061
+ LIns* compileAlt(RENode* node, LIns* pos, LInsList& fails)
2062
+ {
2063
+ LInsList kidFails(NULL);
2064
+ if (!compileNode((RENode *) node->kid, pos, kidFails))
2065
+ return JS_FALSE;
2066
+ if (!compileNode(node->next, pos, kidFails))
2067
+ return JS_FALSE;
2068
+
2069
+ targetCurrentPoint(kidFails);
2070
+ if (!compileNode(node->u.altprereq.kid2, pos, fails))
2071
+ return JS_FALSE;
2072
+ /*
2073
+ * Disable compilation for any regexp where something follows an
2074
+ * alternation. To make this work, we need to redesign to either
2075
+ * (a) pass around continuations so we know the right place to go
2076
+ * when we logically return, or (b) generate explicit backtracking
2077
+ * code.
2078
+ */
2079
+ if (node->next)
2080
+ return JS_FALSE;
2081
+ return pos;
2082
+ }
2083
+
2084
+ JSBool compileNode(RENode* node, LIns* pos, LInsList& fails)
2085
+ {
2086
+ for (; node; node = node->next) {
2087
+ if (fragment->lirbuf->outOmem())
2088
+ return JS_FALSE;
2089
+
2090
+ switch (node->op) {
2091
+ case REOP_EMPTY:
2092
+ pos = compileEmpty(node, pos, fails);
2093
+ break;
2094
+ case REOP_FLAT:
2095
+ if (node->u.flat.length != 1)
2096
+ return JS_FALSE;
2097
+ pos = compileFlatSingleChar(node, pos, fails);
2098
+ break;
2099
+ case REOP_ALT:
2100
+ case REOP_ALTPREREQ:
2101
+ pos = compileAlt(node, pos, fails);
2102
+ break;
2103
+ case REOP_CLASS:
2104
+ pos = compileClass(node, pos, fails);
2105
+ break;
2106
+ default:
2107
+ return JS_FALSE;
2108
+ }
2109
+ if (!pos)
2110
+ return JS_FALSE;
2111
+ }
2112
+
2113
+ lir->insStorei(pos, state, (int) offsetof(REMatchState, cp));
2114
+ lir->ins1(LIR_ret, state);
2115
+ return JS_TRUE;
2116
+ }
2117
+
2118
+ JSBool compileSticky(RENode* root, LIns* start)
2119
+ {
2120
+ LInsList fails(NULL);
2121
+ if (!compileNode(root, start, fails))
2122
+ return JS_FALSE;
2123
+ targetCurrentPoint(fails);
2124
+ lir->ins1(LIR_ret, lir->insImm(0));
2125
+ return JS_TRUE;
2126
+ }
2127
+
2128
+ JSBool compileAnchoring(RENode* root, LIns* start)
2129
+ {
2130
+ /* Even at the end, the empty regexp would match. */
2131
+ LIns* to_next = lir->insBranch(LIR_jf,
2132
+ lir->ins2(LIR_le, start, cpend), 0);
2133
+ LInsList fails(NULL);
2134
+ if (!compileNode(root, start, fails))
2135
+ return JS_FALSE;
2136
+
2137
+ targetCurrentPoint(to_next);
2138
+ lir->ins1(LIR_ret, lir->insImm(0));
2139
+
2140
+ targetCurrentPoint(fails);
2141
+ lir->insStorei(lir->ins2(LIR_piadd, start, lir->insImm(2)), gdata,
2142
+ (int) offsetof(REGlobalData, skipped));
2143
+
2144
+ return JS_TRUE;
2145
+ }
2146
+
2147
+ inline LIns*
2148
+ addName(LirBuffer* lirbuf, LIns* ins, const char* name)
2149
+ {
2150
+ debug_only_v(lirbuf->names->addName(ins, name);)
2151
+ return ins;
2152
+ }
2153
+
2154
+ public:
2155
+ RegExpNativeCompiler(JSRegExp *re, CompilerState *cs)
2156
+ : re(re), cs(cs), fragment(NULL) { }
2157
+
2158
+ JSBool compile(JSContext* cx)
2159
+ {
2160
+ GuardRecord* guard;
2161
+ LIns* skip;
2162
+ LIns* start;
2163
+ bool oom = false;
2164
+
2165
+ Fragmento* fragmento = JS_TRACE_MONITOR(cx).reFragmento;
2166
+ fragment = fragmento->getLoop(re);
2167
+ if (!fragment) {
2168
+ fragment = fragmento->getAnchor(re);
2169
+ fragment->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
2170
+ /* Scary: required to have the onDestroy method delete the lirbuf. */
2171
+ fragment->root = fragment;
2172
+ }
2173
+ LirBuffer* lirbuf = fragment->lirbuf;
2174
+ LirBufWriter* lirb;
2175
+ if (lirbuf->outOmem()) goto fail2;
2176
+ /* FIXME Use bug 463260 smart pointer when available. */
2177
+ lir = lirb = new (&gc) LirBufWriter(lirbuf);
2178
+
2179
+ /* FIXME Use bug 463260 smart pointer when available. */
2180
+ debug_only_v(fragment->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, fragmento->labels);)
2181
+ /* FIXME Use bug 463260 smart pointer when available. */
2182
+ debug_only_v(lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names);)
2183
+
2184
+ lir->ins0(LIR_start);
2185
+ lirbuf->state = state = addName(lirbuf, lir->insParam(0, 0), "state");
2186
+ lirbuf->param1 = gdata = addName(lirbuf, lir->insParam(1, 0), "gdata");
2187
+ start = addName(lirbuf, lir->insLoad(LIR_ldp, lirbuf->param1, (int) offsetof(REGlobalData, skipped)), "start");
2188
+ cpend = addName(lirbuf, lir->insLoad(LIR_ldp, lirbuf->param1, offsetof(REGlobalData, cpend)), "cpend");
2189
+
2190
+ if (cs->flags & JSREG_STICKY) {
2191
+ if (!compileSticky(cs->result, start)) goto fail;
2192
+ } else {
2193
+ if (!compileAnchoring(cs->result, start)) goto fail;
2194
+ }
2195
+
2196
+ /* Create fake guard record for loop edge. */
2197
+ skip = lirb->skip(sizeof(GuardRecord) + sizeof(SideExit));
2198
+ guard = (GuardRecord *) skip->payload();
2199
+ memset(guard, 0, sizeof(*guard));
2200
+ guard->exit = (SideExit *) guard+1;
2201
+ guard->exit->target = fragment;
2202
+ fragment->lastIns = lir->insGuard(LIR_loop, lir->insImm(1), skip);
2203
+
2204
+ ::compile(fragmento->assm(), fragment);
2205
+ if (fragmento->assm()->error() != nanojit::None) {
2206
+ oom = fragmento->assm()->error() == nanojit::OutOMem;
2207
+ goto fail;
2208
+ }
2209
+
2210
+ delete lirb;
2211
+ debug_only_v(delete lir;)
2212
+ return JS_TRUE;
2213
+ fail:
2214
+ delete lirb;
2215
+ debug_only_v(delete lir;)
2216
+ fail2:
2217
+ if (lirbuf->outOmem() || oom)
2218
+ fragmento->clearFrags();
2219
+ return JS_FALSE;
2220
+ }
2221
+ };
2222
+
2223
+ static inline JSBool
2224
+ js_CompileRegExpToNative(JSContext *cx, JSRegExp *re, CompilerState *cs)
2225
+ {
2226
+ RegExpNativeCompiler rc(re, cs);
2227
+ return rc.compile(cx);
2228
+ }
2229
+ #endif
2230
+
2231
+ JSRegExp *
2232
+ js_NewRegExp(JSContext *cx, JSTokenStream *ts,
2233
+ JSString *str, uintN flags, JSBool flat)
2234
+ {
2235
+ JSRegExp *re;
2236
+ void *mark;
2237
+ CompilerState state;
2238
+ size_t resize;
2239
+ jsbytecode *endPC;
2240
+ uintN i;
2241
+ size_t len;
2242
+
2243
+ re = NULL;
2244
+ mark = JS_ARENA_MARK(&cx->tempPool);
2245
+ len = JSSTRING_LENGTH(str);
2246
+
2247
+ state.context = cx;
2248
+ state.tokenStream = ts;
2249
+ state.cp = js_UndependString(cx, str);
2250
+ if (!state.cp)
2251
+ goto out;
2252
+ state.cpbegin = state.cp;
2253
+ state.cpend = state.cp + len;
2254
+ state.flags = flags;
2255
+ state.parenCount = 0;
2256
+ state.classCount = 0;
2257
+ state.progLength = 0;
2258
+ state.treeDepth = 0;
2259
+ state.classBitmapsMem = 0;
2260
+ for (i = 0; i < CLASS_CACHE_SIZE; i++)
2261
+ state.classCache[i].start = NULL;
2262
+
2263
+ if (len != 0 && flat) {
2264
+ state.result = NewRENode(&state, REOP_FLAT);
2265
+ if (!state.result)
2266
+ goto out;
2267
+ state.result->u.flat.chr = *state.cpbegin;
2268
+ state.result->u.flat.length = len;
2269
+ state.result->kid = (void *) state.cpbegin;
2270
+ /* Flat bytecode: REOP_FLAT compact(string_offset) compact(len). */
2271
+ state.progLength += 1 + GetCompactIndexWidth(0)
2272
+ + GetCompactIndexWidth(len);
2273
+ } else {
2274
+ if (!ParseRegExp(&state))
2275
+ goto out;
2276
+ }
2277
+
2278
+ resize = offsetof(JSRegExp, program) + state.progLength + 1;
2279
+ re = (JSRegExp *) JS_malloc(cx, resize);
2280
+ if (!re)
2281
+ goto out;
2282
+
2283
+ re->nrefs = 1;
2284
+ JS_ASSERT(state.classBitmapsMem <= CLASS_BITMAPS_MEM_LIMIT);
2285
+ re->classCount = state.classCount;
2286
+ if (re->classCount) {
2287
+ re->classList = (RECharSet *)
2288
+ JS_malloc(cx, re->classCount * sizeof(RECharSet));
2289
+ if (!re->classList) {
2290
+ js_DestroyRegExp(cx, re);
2291
+ re = NULL;
2292
+ goto out;
2293
+ }
2294
+ for (i = 0; i < re->classCount; i++)
2295
+ re->classList[i].converted = JS_FALSE;
2296
+ } else {
2297
+ re->classList = NULL;
2298
+ }
2299
+
2300
+ #ifdef JS_TRACER
2301
+ /*
2302
+ * Try compiling the native code version. For the time being we also
2303
+ * compile the bytecode version in case we evict the native code
2304
+ * version from the code cache.
2305
+ */
2306
+ if (TRACING_ENABLED(cx))
2307
+ js_CompileRegExpToNative(cx, re, &state);
2308
+ #endif
2309
+ /* Compile the bytecode version. */
2310
+ endPC = EmitREBytecode(&state, re, state.treeDepth, re->program, state.result);
2311
+ if (!endPC) {
2312
+ js_DestroyRegExp(cx, re);
2313
+ re = NULL;
2314
+ goto out;
2315
+ }
2316
+ *endPC++ = REOP_END;
2317
+ /*
2318
+ * Check whether size was overestimated and shrink using realloc.
2319
+ * This is safe since no pointers to newly parsed regexp or its parts
2320
+ * besides re exist here.
2321
+ */
2322
+ #if 0
2323
+ /*
2324
+ * FIXME: Until bug 464866 is fixed, we can't move the re object so
2325
+ * don't shrink it for now.
2326
+ */
2327
+ if ((size_t)(endPC - re->program) != state.progLength + 1) {
2328
+ JSRegExp *tmp;
2329
+ JS_ASSERT((size_t)(endPC - re->program) < state.progLength + 1);
2330
+ resize = offsetof(JSRegExp, program) + (endPC - re->program);
2331
+ tmp = (JSRegExp *) JS_realloc(cx, re, resize);
2332
+ if (tmp)
2333
+ re = tmp;
2334
+ }
2335
+ #endif
2336
+
2337
+ re->flags = flags;
2338
+ re->parenCount = state.parenCount;
2339
+ re->source = str;
2340
+
2341
+ out:
2342
+ JS_ARENA_RELEASE(&cx->tempPool, mark);
2343
+ return re;
2344
+ }
2345
+
2346
+ JSRegExp *
2347
+ js_NewRegExpOpt(JSContext *cx, JSString *str, JSString *opt, JSBool flat)
2348
+ {
2349
+ uintN flags;
2350
+ jschar *s;
2351
+ size_t i, n;
2352
+ char charBuf[2];
2353
+
2354
+ flags = 0;
2355
+ if (opt) {
2356
+ JSSTRING_CHARS_AND_LENGTH(opt, s, n);
2357
+ for (i = 0; i < n; i++) {
2358
+ switch (s[i]) {
2359
+ case 'g':
2360
+ flags |= JSREG_GLOB;
2361
+ break;
2362
+ case 'i':
2363
+ flags |= JSREG_FOLD;
2364
+ break;
2365
+ case 'm':
2366
+ flags |= JSREG_MULTILINE;
2367
+ break;
2368
+ case 'y':
2369
+ flags |= JSREG_STICKY;
2370
+ break;
2371
+ default:
2372
+ charBuf[0] = (char)s[i];
2373
+ charBuf[1] = '\0';
2374
+ JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
2375
+ js_GetErrorMessage, NULL,
2376
+ JSMSG_BAD_FLAG, charBuf);
2377
+ return NULL;
2378
+ }
2379
+ }
2380
+ }
2381
+ return js_NewRegExp(cx, NULL, str, flags, flat);
2382
+ }
2383
+
2384
+ /*
2385
+ * Save the current state of the match - the position in the input
2386
+ * text as well as the position in the bytecode. The state of any
2387
+ * parent expressions is also saved (preceding state).
2388
+ * Contents of parenCount parentheses from parenIndex are also saved.
2389
+ */
2390
+ static REBackTrackData *
2391
+ PushBackTrackState(REGlobalData *gData, REOp op,
2392
+ jsbytecode *target, REMatchState *x, const jschar *cp,
2393
+ size_t parenIndex, size_t parenCount)
2394
+ {
2395
+ size_t i;
2396
+ REBackTrackData *result =
2397
+ (REBackTrackData *) ((char *)gData->backTrackSP + gData->cursz);
2398
+
2399
+ size_t sz = sizeof(REBackTrackData) +
2400
+ gData->stateStackTop * sizeof(REProgState) +
2401
+ parenCount * sizeof(RECapture);
2402
+
2403
+ ptrdiff_t btsize = gData->backTrackStackSize;
2404
+ ptrdiff_t btincr = ((char *)result + sz) -
2405
+ ((char *)gData->backTrackStack + btsize);
2406
+
2407
+ re_debug("\tBT_Push: %lu,%lu",
2408
+ (unsigned long) parenIndex, (unsigned long) parenCount);
2409
+
2410
+ JS_COUNT_OPERATION(gData->cx, JSOW_JUMP * (1 + parenCount));
2411
+ if (btincr > 0) {
2412
+ ptrdiff_t offset = (char *)result - (char *)gData->backTrackStack;
2413
+
2414
+ JS_COUNT_OPERATION(gData->cx, JSOW_ALLOCATION);
2415
+ btincr = JS_ROUNDUP(btincr, btsize);
2416
+ JS_ARENA_GROW_CAST(gData->backTrackStack, REBackTrackData *,
2417
+ &gData->cx->regexpPool, btsize, btincr);
2418
+ if (!gData->backTrackStack) {
2419
+ js_ReportOutOfScriptQuota(gData->cx);
2420
+ gData->ok = JS_FALSE;
2421
+ return NULL;
2422
+ }
2423
+ gData->backTrackStackSize = btsize + btincr;
2424
+ result = (REBackTrackData *) ((char *)gData->backTrackStack + offset);
2425
+ }
2426
+ gData->backTrackSP = result;
2427
+ result->sz = gData->cursz;
2428
+ gData->cursz = sz;
2429
+
2430
+ result->backtrack_op = op;
2431
+ result->backtrack_pc = target;
2432
+ result->cp = cp;
2433
+ result->parenCount = parenCount;
2434
+ result->parenIndex = parenIndex;
2435
+
2436
+ result->saveStateStackTop = gData->stateStackTop;
2437
+ JS_ASSERT(gData->stateStackTop);
2438
+ memcpy(result + 1, gData->stateStack,
2439
+ sizeof(REProgState) * result->saveStateStackTop);
2440
+
2441
+ if (parenCount != 0) {
2442
+ memcpy((char *)(result + 1) +
2443
+ sizeof(REProgState) * result->saveStateStackTop,
2444
+ &x->parens[parenIndex],
2445
+ sizeof(RECapture) * parenCount);
2446
+ for (i = 0; i != parenCount; i++)
2447
+ x->parens[parenIndex + i].index = -1;
2448
+ }
2449
+
2450
+ return result;
2451
+ }
2452
+
2453
+
2454
+ /*
2455
+ * Consecutive literal characters.
2456
+ */
2457
+ #if 0
2458
+ static REMatchState *
2459
+ FlatNMatcher(REGlobalData *gData, REMatchState *x, jschar *matchChars,
2460
+ size_t length)
2461
+ {
2462
+ size_t i;
2463
+ if (length > gData->cpend - x->cp)
2464
+ return NULL;
2465
+ for (i = 0; i != length; i++) {
2466
+ if (matchChars[i] != x->cp[i])
2467
+ return NULL;
2468
+ }
2469
+ x->cp += length;
2470
+ return x;
2471
+ }
2472
+ #endif
2473
+
2474
+ static JS_ALWAYS_INLINE REMatchState *
2475
+ FlatNIMatcher(REGlobalData *gData, REMatchState *x, jschar *matchChars,
2476
+ size_t length)
2477
+ {
2478
+ size_t i;
2479
+ JS_ASSERT(gData->cpend >= x->cp);
2480
+ if (length > (size_t)(gData->cpend - x->cp))
2481
+ return NULL;
2482
+ for (i = 0; i != length; i++) {
2483
+ if (upcase(matchChars[i]) != upcase(x->cp[i]))
2484
+ return NULL;
2485
+ }
2486
+ x->cp += length;
2487
+ return x;
2488
+ }
2489
+
2490
+ /*
2491
+ * 1. Evaluate DecimalEscape to obtain an EscapeValue E.
2492
+ * 2. If E is not a character then go to step 6.
2493
+ * 3. Let ch be E's character.
2494
+ * 4. Let A be a one-element RECharSet containing the character ch.
2495
+ * 5. Call CharacterSetMatcher(A, false) and return its Matcher result.
2496
+ * 6. E must be an integer. Let n be that integer.
2497
+ * 7. If n=0 or n>NCapturingParens then throw a SyntaxError exception.
2498
+ * 8. Return an internal Matcher closure that takes two arguments, a State x
2499
+ * and a Continuation c, and performs the following:
2500
+ * 1. Let cap be x's captures internal array.
2501
+ * 2. Let s be cap[n].
2502
+ * 3. If s is undefined, then call c(x) and return its result.
2503
+ * 4. Let e be x's endIndex.
2504
+ * 5. Let len be s's length.
2505
+ * 6. Let f be e+len.
2506
+ * 7. If f>InputLength, return failure.
2507
+ * 8. If there exists an integer i between 0 (inclusive) and len (exclusive)
2508
+ * such that Canonicalize(s[i]) is not the same character as
2509
+ * Canonicalize(Input [e+i]), then return failure.
2510
+ * 9. Let y be the State (f, cap).
2511
+ * 10. Call c(y) and return its result.
2512
+ */
2513
+ static REMatchState *
2514
+ BackrefMatcher(REGlobalData *gData, REMatchState *x, size_t parenIndex)
2515
+ {
2516
+ size_t len, i;
2517
+ const jschar *parenContent;
2518
+ RECapture *cap = &x->parens[parenIndex];
2519
+
2520
+ if (cap->index == -1)
2521
+ return x;
2522
+
2523
+ len = cap->length;
2524
+ if (x->cp + len > gData->cpend)
2525
+ return NULL;
2526
+
2527
+ parenContent = &gData->cpbegin[cap->index];
2528
+ if (gData->regexp->flags & JSREG_FOLD) {
2529
+ for (i = 0; i < len; i++) {
2530
+ if (upcase(parenContent[i]) != upcase(x->cp[i]))
2531
+ return NULL;
2532
+ }
2533
+ } else {
2534
+ for (i = 0; i < len; i++) {
2535
+ if (parenContent[i] != x->cp[i])
2536
+ return NULL;
2537
+ }
2538
+ }
2539
+ x->cp += len;
2540
+ return x;
2541
+ }
2542
+
2543
+
2544
+ /* Add a single character to the RECharSet */
2545
+ static void
2546
+ AddCharacterToCharSet(RECharSet *cs, jschar c)
2547
+ {
2548
+ uintN byteIndex = (uintN)(c >> 3);
2549
+ JS_ASSERT(c <= cs->length);
2550
+ cs->u.bits[byteIndex] |= 1 << (c & 0x7);
2551
+ }
2552
+
2553
+
2554
+ /* Add a character range, c1 to c2 (inclusive) to the RECharSet */
2555
+ static void
2556
+ AddCharacterRangeToCharSet(RECharSet *cs, uintN c1, uintN c2)
2557
+ {
2558
+ uintN i;
2559
+
2560
+ uintN byteIndex1 = c1 >> 3;
2561
+ uintN byteIndex2 = c2 >> 3;
2562
+
2563
+ JS_ASSERT(c2 <= cs->length && c1 <= c2);
2564
+
2565
+ c1 &= 0x7;
2566
+ c2 &= 0x7;
2567
+
2568
+ if (byteIndex1 == byteIndex2) {
2569
+ cs->u.bits[byteIndex1] |= ((uint8)0xFF >> (7 - (c2 - c1))) << c1;
2570
+ } else {
2571
+ cs->u.bits[byteIndex1] |= 0xFF << c1;
2572
+ for (i = byteIndex1 + 1; i < byteIndex2; i++)
2573
+ cs->u.bits[i] = 0xFF;
2574
+ cs->u.bits[byteIndex2] |= (uint8)0xFF >> (7 - c2);
2575
+ }
2576
+ }
2577
+
2578
+ struct CharacterRange {
2579
+ jschar start;
2580
+ jschar end;
2581
+ };
2582
+
2583
+ /*
2584
+ * The following characters are taken from the ECMA-262 standard, section 7.2
2585
+ * and 7.3, and the Unicode 3 standard, Table 6-1.
2586
+ */
2587
+ static const CharacterRange WhiteSpaceRanges[] = {
2588
+ /* TAB, LF, VT, FF, CR */
2589
+ { 0x0009, 0x000D },
2590
+ /* SPACE */
2591
+ { 0x0020, 0x0020 },
2592
+ /* NO-BREAK SPACE */
2593
+ { 0x00A0, 0x00A0 },
2594
+ /*
2595
+ * EN QUAD, EM QUAD, EN SPACE, EM SPACE, THREE-PER-EM SPACE, FOUR-PER-EM
2596
+ * SPACE, SIX-PER-EM SPACE, FIGURE SPACE, PUNCTUATION SPACE, THIN SPACE,
2597
+ * HAIR SPACE, ZERO WIDTH SPACE
2598
+ */
2599
+ { 0x2000, 0x200B },
2600
+ /* LS, PS */
2601
+ { 0x2028, 0x2029 },
2602
+ /* NARROW NO-BREAK SPACE */
2603
+ { 0x202F, 0x202F },
2604
+ /* IDEOGRAPHIC SPACE */
2605
+ { 0x3000, 0x3000 }
2606
+ };
2607
+
2608
+ /* ECMA-262 standard, section 15.10.2.6. */
2609
+ static const CharacterRange WordRanges[] = {
2610
+ { jschar('0'), jschar('9') },
2611
+ { jschar('A'), jschar('Z') },
2612
+ { jschar('_'), jschar('_') },
2613
+ { jschar('a'), jschar('z') }
2614
+ };
2615
+
2616
+ static void
2617
+ AddCharacterRanges(RECharSet *charSet,
2618
+ const CharacterRange *range,
2619
+ const CharacterRange *end)
2620
+ {
2621
+ for (; range < end; ++range)
2622
+ AddCharacterRangeToCharSet(charSet, range->start, range->end);
2623
+ }
2624
+
2625
+ static void
2626
+ AddInvertedCharacterRanges(RECharSet *charSet,
2627
+ const CharacterRange *range,
2628
+ const CharacterRange *end)
2629
+ {
2630
+ uint16 previous = 0;
2631
+ for (; range < end; ++range) {
2632
+ AddCharacterRangeToCharSet(charSet, previous, range->start - 1);
2633
+ previous = range->end + 1;
2634
+ }
2635
+ AddCharacterRangeToCharSet(charSet, previous, charSet->length);
2636
+ }
2637
+
2638
+ /* Compile the source of the class into a RECharSet */
2639
+ static JSBool
2640
+ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
2641
+ {
2642
+ const jschar *src, *end;
2643
+ JSBool inRange = JS_FALSE;
2644
+ jschar rangeStart = 0;
2645
+ uintN byteLength, n;
2646
+ jschar c, thisCh;
2647
+ intN nDigits, i;
2648
+
2649
+ JS_ASSERT(!charSet->converted);
2650
+ /*
2651
+ * Assert that startIndex and length points to chars inside [] inside
2652
+ * source string.
2653
+ */
2654
+ JS_ASSERT(1 <= charSet->u.src.startIndex);
2655
+ JS_ASSERT(charSet->u.src.startIndex
2656
+ < JSSTRING_LENGTH(gData->regexp->source));
2657
+ JS_ASSERT(charSet->u.src.length <= JSSTRING_LENGTH(gData->regexp->source)
2658
+ - 1 - charSet->u.src.startIndex);
2659
+
2660
+ charSet->converted = JS_TRUE;
2661
+ src = JSSTRING_CHARS(gData->regexp->source) + charSet->u.src.startIndex;
2662
+ end = src + charSet->u.src.length;
2663
+ JS_ASSERT(src[-1] == '[');
2664
+ JS_ASSERT(end[0] == ']');
2665
+
2666
+ byteLength = (charSet->length >> 3) + 1;
2667
+ charSet->u.bits = (uint8 *)JS_malloc(gData->cx, byteLength);
2668
+ if (!charSet->u.bits) {
2669
+ JS_ReportOutOfMemory(gData->cx);
2670
+ gData->ok = JS_FALSE;
2671
+ return JS_FALSE;
2672
+ }
2673
+ memset(charSet->u.bits, 0, byteLength);
2674
+
2675
+ if (src == end)
2676
+ return JS_TRUE;
2677
+
2678
+ if (*src == '^') {
2679
+ JS_ASSERT(charSet->sense == JS_FALSE);
2680
+ ++src;
2681
+ } else {
2682
+ JS_ASSERT(charSet->sense == JS_TRUE);
2683
+ }
2684
+
2685
+ while (src != end) {
2686
+ switch (*src) {
2687
+ case '\\':
2688
+ ++src;
2689
+ c = *src++;
2690
+ switch (c) {
2691
+ case 'b':
2692
+ thisCh = 0x8;
2693
+ break;
2694
+ case 'f':
2695
+ thisCh = 0xC;
2696
+ break;
2697
+ case 'n':
2698
+ thisCh = 0xA;
2699
+ break;
2700
+ case 'r':
2701
+ thisCh = 0xD;
2702
+ break;
2703
+ case 't':
2704
+ thisCh = 0x9;
2705
+ break;
2706
+ case 'v':
2707
+ thisCh = 0xB;
2708
+ break;
2709
+ case 'c':
2710
+ if (src < end && JS_ISWORD(*src)) {
2711
+ thisCh = (jschar)(*src++ & 0x1F);
2712
+ } else {
2713
+ --src;
2714
+ thisCh = '\\';
2715
+ }
2716
+ break;
2717
+ case 'x':
2718
+ nDigits = 2;
2719
+ goto lexHex;
2720
+ case 'u':
2721
+ nDigits = 4;
2722
+ lexHex:
2723
+ n = 0;
2724
+ for (i = 0; (i < nDigits) && (src < end); i++) {
2725
+ uintN digit;
2726
+ c = *src++;
2727
+ if (!isASCIIHexDigit(c, &digit)) {
2728
+ /*
2729
+ * Back off to accepting the original '\'
2730
+ * as a literal
2731
+ */
2732
+ src -= i + 1;
2733
+ n = '\\';
2734
+ break;
2735
+ }
2736
+ n = (n << 4) | digit;
2737
+ }
2738
+ thisCh = (jschar)n;
2739
+ break;
2740
+ case '0':
2741
+ case '1':
2742
+ case '2':
2743
+ case '3':
2744
+ case '4':
2745
+ case '5':
2746
+ case '6':
2747
+ case '7':
2748
+ /*
2749
+ * This is a non-ECMA extension - decimal escapes (in this
2750
+ * case, octal!) are supposed to be an error inside class
2751
+ * ranges, but supported here for backwards compatibility.
2752
+ */
2753
+ n = JS7_UNDEC(c);
2754
+ c = *src;
2755
+ if ('0' <= c && c <= '7') {
2756
+ src++;
2757
+ n = 8 * n + JS7_UNDEC(c);
2758
+ c = *src;
2759
+ if ('0' <= c && c <= '7') {
2760
+ src++;
2761
+ i = 8 * n + JS7_UNDEC(c);
2762
+ if (i <= 0377)
2763
+ n = i;
2764
+ else
2765
+ src--;
2766
+ }
2767
+ }
2768
+ thisCh = (jschar)n;
2769
+ break;
2770
+
2771
+ case 'd':
2772
+ AddCharacterRangeToCharSet(charSet, '0', '9');
2773
+ continue; /* don't need range processing */
2774
+ case 'D':
2775
+ AddCharacterRangeToCharSet(charSet, 0, '0' - 1);
2776
+ AddCharacterRangeToCharSet(charSet,
2777
+ (jschar)('9' + 1),
2778
+ (jschar)charSet->length);
2779
+ continue;
2780
+ case 's':
2781
+ AddCharacterRanges(charSet, WhiteSpaceRanges,
2782
+ WhiteSpaceRanges + JS_ARRAY_LENGTH(WhiteSpaceRanges));
2783
+ continue;
2784
+ case 'S':
2785
+ AddInvertedCharacterRanges(charSet, WhiteSpaceRanges,
2786
+ WhiteSpaceRanges + JS_ARRAY_LENGTH(WhiteSpaceRanges));
2787
+ continue;
2788
+ case 'w':
2789
+ AddCharacterRanges(charSet, WordRanges,
2790
+ WordRanges + JS_ARRAY_LENGTH(WordRanges));
2791
+ continue;
2792
+ case 'W':
2793
+ AddInvertedCharacterRanges(charSet, WordRanges,
2794
+ WordRanges + JS_ARRAY_LENGTH(WordRanges));
2795
+ continue;
2796
+ default:
2797
+ thisCh = c;
2798
+ break;
2799
+
2800
+ }
2801
+ break;
2802
+
2803
+ default:
2804
+ thisCh = *src++;
2805
+ break;
2806
+
2807
+ }
2808
+ if (inRange) {
2809
+ if (gData->regexp->flags & JSREG_FOLD) {
2810
+ int i;
2811
+
2812
+ JS_ASSERT(rangeStart <= thisCh);
2813
+ for (i = rangeStart; i <= thisCh; i++) {
2814
+ jschar uch, dch;
2815
+
2816
+ AddCharacterToCharSet(charSet, i);
2817
+ uch = upcase(i);
2818
+ dch = downcase(i);
2819
+ if (i != uch)
2820
+ AddCharacterToCharSet(charSet, uch);
2821
+ if (i != dch)
2822
+ AddCharacterToCharSet(charSet, dch);
2823
+ }
2824
+ } else {
2825
+ AddCharacterRangeToCharSet(charSet, rangeStart, thisCh);
2826
+ }
2827
+ inRange = JS_FALSE;
2828
+ } else {
2829
+ if (gData->regexp->flags & JSREG_FOLD) {
2830
+ AddCharacterToCharSet(charSet, upcase(thisCh));
2831
+ AddCharacterToCharSet(charSet, downcase(thisCh));
2832
+ } else {
2833
+ AddCharacterToCharSet(charSet, thisCh);
2834
+ }
2835
+ if (src < end - 1) {
2836
+ if (*src == '-') {
2837
+ ++src;
2838
+ inRange = JS_TRUE;
2839
+ rangeStart = thisCh;
2840
+ }
2841
+ }
2842
+ }
2843
+ }
2844
+ return JS_TRUE;
2845
+ }
2846
+
2847
+ void
2848
+ js_DestroyRegExp(JSContext *cx, JSRegExp *re)
2849
+ {
2850
+ if (JS_ATOMIC_DECREMENT(&re->nrefs) == 0) {
2851
+ #ifdef JS_TRACER
2852
+ /* Don't reuse this compiled code for some new regexp at same addr. */
2853
+ Fragment* fragment = JS_TRACE_MONITOR(cx).reFragmento->getLoop(re);
2854
+ if (fragment)
2855
+ fragment->blacklist();
2856
+ #endif
2857
+ if (re->classList) {
2858
+ uintN i;
2859
+ for (i = 0; i < re->classCount; i++) {
2860
+ if (re->classList[i].converted)
2861
+ JS_free(cx, re->classList[i].u.bits);
2862
+ re->classList[i].u.bits = NULL;
2863
+ }
2864
+ JS_free(cx, re->classList);
2865
+ }
2866
+ JS_free(cx, re);
2867
+ }
2868
+ }
2869
+
2870
+ static JSBool
2871
+ ReallocStateStack(REGlobalData *gData)
2872
+ {
2873
+ size_t limit = gData->stateStackLimit;
2874
+ size_t sz = sizeof(REProgState) * limit;
2875
+
2876
+ JS_ARENA_GROW_CAST(gData->stateStack, REProgState *,
2877
+ &gData->cx->regexpPool, sz, sz);
2878
+ if (!gData->stateStack) {
2879
+ js_ReportOutOfScriptQuota(gData->cx);
2880
+ gData->ok = JS_FALSE;
2881
+ return JS_FALSE;
2882
+ }
2883
+ gData->stateStackLimit = limit + limit;
2884
+ return JS_TRUE;
2885
+ }
2886
+
2887
+ #define PUSH_STATE_STACK(data) \
2888
+ JS_BEGIN_MACRO \
2889
+ ++(data)->stateStackTop; \
2890
+ if ((data)->stateStackTop == (data)->stateStackLimit && \
2891
+ !ReallocStateStack((data))) { \
2892
+ return NULL; \
2893
+ } \
2894
+ JS_END_MACRO
2895
+
2896
+ /*
2897
+ * Apply the current op against the given input to see if it's going to match
2898
+ * or fail. Return false if we don't get a match, true if we do. If updatecp is
2899
+ * true, then update the current state's cp. Always update startpc to the next
2900
+ * op.
2901
+ */
2902
+ static JS_ALWAYS_INLINE REMatchState *
2903
+ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
2904
+ jsbytecode **startpc, JSBool updatecp)
2905
+ {
2906
+ REMatchState *result = NULL;
2907
+ jschar matchCh;
2908
+ size_t parenIndex;
2909
+ size_t offset, length, index;
2910
+ jsbytecode *pc = *startpc; /* pc has already been incremented past op */
2911
+ jschar *source;
2912
+ const jschar *startcp = x->cp;
2913
+ jschar ch;
2914
+ RECharSet *charSet;
2915
+
2916
+ #ifdef REGEXP_DEBUG
2917
+ const char *opname = reop_names[op];
2918
+ re_debug("\n%06d: %*s%s", pc - gData->regexp->program,
2919
+ gData->stateStackTop * 2, "", opname);
2920
+ #endif
2921
+ switch (op) {
2922
+ case REOP_EMPTY:
2923
+ result = x;
2924
+ break;
2925
+ case REOP_BOL:
2926
+ if (x->cp != gData->cpbegin) {
2927
+ if (!gData->cx->regExpStatics.multiline &&
2928
+ !(gData->regexp->flags & JSREG_MULTILINE)) {
2929
+ break;
2930
+ }
2931
+ if (!RE_IS_LINE_TERM(x->cp[-1]))
2932
+ break;
2933
+ }
2934
+ result = x;
2935
+ break;
2936
+ case REOP_EOL:
2937
+ if (x->cp != gData->cpend) {
2938
+ if (!gData->cx->regExpStatics.multiline &&
2939
+ !(gData->regexp->flags & JSREG_MULTILINE)) {
2940
+ break;
2941
+ }
2942
+ if (!RE_IS_LINE_TERM(*x->cp))
2943
+ break;
2944
+ }
2945
+ result = x;
2946
+ break;
2947
+ case REOP_WBDRY:
2948
+ if ((x->cp == gData->cpbegin || !JS_ISWORD(x->cp[-1])) ^
2949
+ !(x->cp != gData->cpend && JS_ISWORD(*x->cp))) {
2950
+ result = x;
2951
+ }
2952
+ break;
2953
+ case REOP_WNONBDRY:
2954
+ if ((x->cp == gData->cpbegin || !JS_ISWORD(x->cp[-1])) ^
2955
+ (x->cp != gData->cpend && JS_ISWORD(*x->cp))) {
2956
+ result = x;
2957
+ }
2958
+ break;
2959
+ case REOP_DOT:
2960
+ if (x->cp != gData->cpend && !RE_IS_LINE_TERM(*x->cp)) {
2961
+ result = x;
2962
+ result->cp++;
2963
+ }
2964
+ break;
2965
+ case REOP_DIGIT:
2966
+ if (x->cp != gData->cpend && JS7_ISDEC(*x->cp)) {
2967
+ result = x;
2968
+ result->cp++;
2969
+ }
2970
+ break;
2971
+ case REOP_NONDIGIT:
2972
+ if (x->cp != gData->cpend && !JS7_ISDEC(*x->cp)) {
2973
+ result = x;
2974
+ result->cp++;
2975
+ }
2976
+ break;
2977
+ case REOP_ALNUM:
2978
+ if (x->cp != gData->cpend && JS_ISWORD(*x->cp)) {
2979
+ result = x;
2980
+ result->cp++;
2981
+ }
2982
+ break;
2983
+ case REOP_NONALNUM:
2984
+ if (x->cp != gData->cpend && !JS_ISWORD(*x->cp)) {
2985
+ result = x;
2986
+ result->cp++;
2987
+ }
2988
+ break;
2989
+ case REOP_SPACE:
2990
+ if (x->cp != gData->cpend && JS_ISSPACE(*x->cp)) {
2991
+ result = x;
2992
+ result->cp++;
2993
+ }
2994
+ break;
2995
+ case REOP_NONSPACE:
2996
+ if (x->cp != gData->cpend && !JS_ISSPACE(*x->cp)) {
2997
+ result = x;
2998
+ result->cp++;
2999
+ }
3000
+ break;
3001
+ case REOP_BACKREF:
3002
+ pc = ReadCompactIndex(pc, &parenIndex);
3003
+ JS_ASSERT(parenIndex < gData->regexp->parenCount);
3004
+ result = BackrefMatcher(gData, x, parenIndex);
3005
+ break;
3006
+ case REOP_FLAT:
3007
+ pc = ReadCompactIndex(pc, &offset);
3008
+ JS_ASSERT(offset < JSSTRING_LENGTH(gData->regexp->source));
3009
+ pc = ReadCompactIndex(pc, &length);
3010
+ JS_ASSERT(1 <= length);
3011
+ JS_ASSERT(length <= JSSTRING_LENGTH(gData->regexp->source) - offset);
3012
+ if (length <= (size_t)(gData->cpend - x->cp)) {
3013
+ source = JSSTRING_CHARS(gData->regexp->source) + offset;
3014
+ re_debug_chars(source, length);
3015
+ for (index = 0; index != length; index++) {
3016
+ if (source[index] != x->cp[index])
3017
+ return NULL;
3018
+ }
3019
+ x->cp += length;
3020
+ result = x;
3021
+ }
3022
+ break;
3023
+ case REOP_FLAT1:
3024
+ matchCh = *pc++;
3025
+ re_debug(" '%c' == '%c'", (char)matchCh, (char)*x->cp);
3026
+ if (x->cp != gData->cpend && *x->cp == matchCh) {
3027
+ result = x;
3028
+ result->cp++;
3029
+ }
3030
+ break;
3031
+ case REOP_FLATi:
3032
+ pc = ReadCompactIndex(pc, &offset);
3033
+ JS_ASSERT(offset < JSSTRING_LENGTH(gData->regexp->source));
3034
+ pc = ReadCompactIndex(pc, &length);
3035
+ JS_ASSERT(1 <= length);
3036
+ JS_ASSERT(length <= JSSTRING_LENGTH(gData->regexp->source) - offset);
3037
+ source = JSSTRING_CHARS(gData->regexp->source);
3038
+ result = FlatNIMatcher(gData, x, source + offset, length);
3039
+ break;
3040
+ case REOP_FLAT1i:
3041
+ matchCh = *pc++;
3042
+ if (x->cp != gData->cpend && upcase(*x->cp) == upcase(matchCh)) {
3043
+ result = x;
3044
+ result->cp++;
3045
+ }
3046
+ break;
3047
+ case REOP_UCFLAT1:
3048
+ matchCh = GET_ARG(pc);
3049
+ re_debug(" '%c' == '%c'", (char)matchCh, (char)*x->cp);
3050
+ pc += ARG_LEN;
3051
+ if (x->cp != gData->cpend && *x->cp == matchCh) {
3052
+ result = x;
3053
+ result->cp++;
3054
+ }
3055
+ break;
3056
+ case REOP_UCFLAT1i:
3057
+ matchCh = GET_ARG(pc);
3058
+ pc += ARG_LEN;
3059
+ if (x->cp != gData->cpend && upcase(*x->cp) == upcase(matchCh)) {
3060
+ result = x;
3061
+ result->cp++;
3062
+ }
3063
+ break;
3064
+ case REOP_CLASS:
3065
+ pc = ReadCompactIndex(pc, &index);
3066
+ JS_ASSERT(index < gData->regexp->classCount);
3067
+ if (x->cp != gData->cpend) {
3068
+ charSet = &gData->regexp->classList[index];
3069
+ JS_ASSERT(charSet->converted);
3070
+ ch = *x->cp;
3071
+ index = ch >> 3;
3072
+ if (charSet->length != 0 &&
3073
+ ch <= charSet->length &&
3074
+ (charSet->u.bits[index] & (1 << (ch & 0x7)))) {
3075
+ result = x;
3076
+ result->cp++;
3077
+ }
3078
+ }
3079
+ break;
3080
+ case REOP_NCLASS:
3081
+ pc = ReadCompactIndex(pc, &index);
3082
+ JS_ASSERT(index < gData->regexp->classCount);
3083
+ if (x->cp != gData->cpend) {
3084
+ charSet = &gData->regexp->classList[index];
3085
+ JS_ASSERT(charSet->converted);
3086
+ ch = *x->cp;
3087
+ index = ch >> 3;
3088
+ if (charSet->length == 0 ||
3089
+ ch > charSet->length ||
3090
+ !(charSet->u.bits[index] & (1 << (ch & 0x7)))) {
3091
+ result = x;
3092
+ result->cp++;
3093
+ }
3094
+ }
3095
+ break;
3096
+
3097
+ default:
3098
+ JS_ASSERT(JS_FALSE);
3099
+ }
3100
+ if (result) {
3101
+ if (!updatecp)
3102
+ x->cp = startcp;
3103
+ *startpc = pc;
3104
+ re_debug(" * ");
3105
+ return result;
3106
+ }
3107
+ x->cp = startcp;
3108
+ return NULL;
3109
+ }
3110
+
3111
+ static JS_ALWAYS_INLINE REMatchState *
3112
+ ExecuteREBytecode(REGlobalData *gData, REMatchState *x)
3113
+ {
3114
+ REMatchState *result = NULL;
3115
+ REBackTrackData *backTrackData;
3116
+ jsbytecode *nextpc, *testpc;
3117
+ REOp nextop;
3118
+ RECapture *cap;
3119
+ REProgState *curState;
3120
+ const jschar *startcp;
3121
+ size_t parenIndex, k;
3122
+ size_t parenSoFar = 0;
3123
+
3124
+ jschar matchCh1, matchCh2;
3125
+ RECharSet *charSet;
3126
+
3127
+ JSBool anchor;
3128
+ jsbytecode *pc = gData->regexp->program;
3129
+ REOp op = (REOp) *pc++;
3130
+
3131
+ /*
3132
+ * If the first node is a simple match, step the index into the string
3133
+ * until that match is made, or fail if it can't be found at all.
3134
+ */
3135
+ if (REOP_IS_SIMPLE(op) && !(gData->regexp->flags & JSREG_STICKY)) {
3136
+ anchor = JS_FALSE;
3137
+ while (x->cp <= gData->cpend) {
3138
+ nextpc = pc; /* reset back to start each time */
3139
+ result = SimpleMatch(gData, x, op, &nextpc, JS_TRUE);
3140
+ if (result) {
3141
+ anchor = JS_TRUE;
3142
+ x = result;
3143
+ pc = nextpc; /* accept skip to next opcode */
3144
+ op = (REOp) *pc++;
3145
+ JS_ASSERT(op < REOP_LIMIT);
3146
+ break;
3147
+ }
3148
+ gData->skipped++;
3149
+ x->cp++;
3150
+ }
3151
+ if (!anchor)
3152
+ goto bad;
3153
+ }
3154
+
3155
+ for (;;) {
3156
+ #ifdef REGEXP_DEBUG
3157
+ const char *opname = reop_names[op];
3158
+ re_debug("\n%06d: %*s%s", pc - gData->regexp->program,
3159
+ gData->stateStackTop * 2, "", opname);
3160
+ #endif
3161
+ if (REOP_IS_SIMPLE(op)) {
3162
+ result = SimpleMatch(gData, x, op, &pc, JS_TRUE);
3163
+ } else {
3164
+ curState = &gData->stateStack[gData->stateStackTop];
3165
+ switch (op) {
3166
+ case REOP_END:
3167
+ goto good;
3168
+ case REOP_ALTPREREQ2:
3169
+ nextpc = pc + GET_OFFSET(pc); /* start of next op */
3170
+ pc += ARG_LEN;
3171
+ matchCh2 = GET_ARG(pc);
3172
+ pc += ARG_LEN;
3173
+ k = GET_ARG(pc);
3174
+ pc += ARG_LEN;
3175
+
3176
+ if (x->cp != gData->cpend) {
3177
+ if (*x->cp == matchCh2)
3178
+ goto doAlt;
3179
+
3180
+ charSet = &gData->regexp->classList[k];
3181
+ if (!charSet->converted && !ProcessCharSet(gData, charSet))
3182
+ goto bad;
3183
+ matchCh1 = *x->cp;
3184
+ k = matchCh1 >> 3;
3185
+ if ((charSet->length == 0 ||
3186
+ matchCh1 > charSet->length ||
3187
+ !(charSet->u.bits[k] & (1 << (matchCh1 & 0x7)))) ^
3188
+ charSet->sense) {
3189
+ goto doAlt;
3190
+ }
3191
+ }
3192
+ result = NULL;
3193
+ break;
3194
+
3195
+ case REOP_ALTPREREQ:
3196
+ nextpc = pc + GET_OFFSET(pc); /* start of next op */
3197
+ pc += ARG_LEN;
3198
+ matchCh1 = GET_ARG(pc);
3199
+ pc += ARG_LEN;
3200
+ matchCh2 = GET_ARG(pc);
3201
+ pc += ARG_LEN;
3202
+ if (x->cp == gData->cpend ||
3203
+ (*x->cp != matchCh1 && *x->cp != matchCh2)) {
3204
+ result = NULL;
3205
+ break;
3206
+ }
3207
+ /* else false thru... */
3208
+
3209
+ case REOP_ALT:
3210
+ doAlt:
3211
+ nextpc = pc + GET_OFFSET(pc); /* start of next alternate */
3212
+ pc += ARG_LEN; /* start of this alternate */
3213
+ curState->parenSoFar = parenSoFar;
3214
+ PUSH_STATE_STACK(gData);
3215
+ op = (REOp) *pc++;
3216
+ startcp = x->cp;
3217
+ if (REOP_IS_SIMPLE(op)) {
3218
+ if (!SimpleMatch(gData, x, op, &pc, JS_TRUE)) {
3219
+ op = (REOp) *nextpc++;
3220
+ pc = nextpc;
3221
+ continue;
3222
+ }
3223
+ result = x;
3224
+ op = (REOp) *pc++;
3225
+ }
3226
+ nextop = (REOp) *nextpc++;
3227
+ if (!PushBackTrackState(gData, nextop, nextpc, x, startcp, 0, 0))
3228
+ goto bad;
3229
+ continue;
3230
+
3231
+ /*
3232
+ * Occurs at (successful) end of REOP_ALT,
3233
+ */
3234
+ case REOP_JUMP:
3235
+ /*
3236
+ * If we have not gotten a result here, it is because of an
3237
+ * empty match. Do the same thing REOP_EMPTY would do.
3238
+ */
3239
+ if (!result)
3240
+ result = x;
3241
+
3242
+ --gData->stateStackTop;
3243
+ pc += GET_OFFSET(pc);
3244
+ op = (REOp) *pc++;
3245
+ continue;
3246
+
3247
+ /*
3248
+ * Occurs at last (successful) end of REOP_ALT,
3249
+ */
3250
+ case REOP_ENDALT:
3251
+ /*
3252
+ * If we have not gotten a result here, it is because of an
3253
+ * empty match. Do the same thing REOP_EMPTY would do.
3254
+ */
3255
+ if (!result)
3256
+ result = x;
3257
+
3258
+ --gData->stateStackTop;
3259
+ op = (REOp) *pc++;
3260
+ continue;
3261
+
3262
+ case REOP_LPAREN:
3263
+ pc = ReadCompactIndex(pc, &parenIndex);
3264
+ re_debug("[ %lu ]", (unsigned long) parenIndex);
3265
+ JS_ASSERT(parenIndex < gData->regexp->parenCount);
3266
+ if (parenIndex + 1 > parenSoFar)
3267
+ parenSoFar = parenIndex + 1;
3268
+ x->parens[parenIndex].index = x->cp - gData->cpbegin;
3269
+ x->parens[parenIndex].length = 0;
3270
+ op = (REOp) *pc++;
3271
+ continue;
3272
+
3273
+ case REOP_RPAREN:
3274
+ {
3275
+ ptrdiff_t delta;
3276
+
3277
+ pc = ReadCompactIndex(pc, &parenIndex);
3278
+ JS_ASSERT(parenIndex < gData->regexp->parenCount);
3279
+ cap = &x->parens[parenIndex];
3280
+ delta = x->cp - (gData->cpbegin + cap->index);
3281
+ cap->length = (delta < 0) ? 0 : (size_t) delta;
3282
+ op = (REOp) *pc++;
3283
+
3284
+ if (!result)
3285
+ result = x;
3286
+ continue;
3287
+ }
3288
+ case REOP_ASSERT:
3289
+ nextpc = pc + GET_OFFSET(pc); /* start of term after ASSERT */
3290
+ pc += ARG_LEN; /* start of ASSERT child */
3291
+ op = (REOp) *pc++;
3292
+ testpc = pc;
3293
+ if (REOP_IS_SIMPLE(op) &&
3294
+ !SimpleMatch(gData, x, op, &testpc, JS_FALSE)) {
3295
+ result = NULL;
3296
+ break;
3297
+ }
3298
+ curState->u.assertion.top =
3299
+ (char *)gData->backTrackSP - (char *)gData->backTrackStack;
3300
+ curState->u.assertion.sz = gData->cursz;
3301
+ curState->index = x->cp - gData->cpbegin;
3302
+ curState->parenSoFar = parenSoFar;
3303
+ PUSH_STATE_STACK(gData);
3304
+ if (!PushBackTrackState(gData, REOP_ASSERTTEST,
3305
+ nextpc, x, x->cp, 0, 0)) {
3306
+ goto bad;
3307
+ }
3308
+ continue;
3309
+
3310
+ case REOP_ASSERT_NOT:
3311
+ nextpc = pc + GET_OFFSET(pc);
3312
+ pc += ARG_LEN;
3313
+ op = (REOp) *pc++;
3314
+ testpc = pc;
3315
+ if (REOP_IS_SIMPLE(op) /* Note - fail to fail! */ &&
3316
+ SimpleMatch(gData, x, op, &testpc, JS_FALSE) &&
3317
+ *testpc == REOP_ASSERTNOTTEST) {
3318
+ result = NULL;
3319
+ break;
3320
+ }
3321
+ curState->u.assertion.top
3322
+ = (char *)gData->backTrackSP -
3323
+ (char *)gData->backTrackStack;
3324
+ curState->u.assertion.sz = gData->cursz;
3325
+ curState->index = x->cp - gData->cpbegin;
3326
+ curState->parenSoFar = parenSoFar;
3327
+ PUSH_STATE_STACK(gData);
3328
+ if (!PushBackTrackState(gData, REOP_ASSERTNOTTEST,
3329
+ nextpc, x, x->cp, 0, 0)) {
3330
+ goto bad;
3331
+ }
3332
+ continue;
3333
+
3334
+ case REOP_ASSERTTEST:
3335
+ --gData->stateStackTop;
3336
+ --curState;
3337
+ x->cp = gData->cpbegin + curState->index;
3338
+ gData->backTrackSP =
3339
+ (REBackTrackData *) ((char *)gData->backTrackStack +
3340
+ curState->u.assertion.top);
3341
+ gData->cursz = curState->u.assertion.sz;
3342
+ if (result)
3343
+ result = x;
3344
+ break;
3345
+
3346
+ case REOP_ASSERTNOTTEST:
3347
+ --gData->stateStackTop;
3348
+ --curState;
3349
+ x->cp = gData->cpbegin + curState->index;
3350
+ gData->backTrackSP =
3351
+ (REBackTrackData *) ((char *)gData->backTrackStack +
3352
+ curState->u.assertion.top);
3353
+ gData->cursz = curState->u.assertion.sz;
3354
+ result = (!result) ? x : NULL;
3355
+ break;
3356
+ case REOP_STAR:
3357
+ curState->u.quantifier.min = 0;
3358
+ curState->u.quantifier.max = (uintN)-1;
3359
+ goto quantcommon;
3360
+ case REOP_PLUS:
3361
+ curState->u.quantifier.min = 1;
3362
+ curState->u.quantifier.max = (uintN)-1;
3363
+ goto quantcommon;
3364
+ case REOP_OPT:
3365
+ curState->u.quantifier.min = 0;
3366
+ curState->u.quantifier.max = 1;
3367
+ goto quantcommon;
3368
+ case REOP_QUANT:
3369
+ pc = ReadCompactIndex(pc, &k);
3370
+ curState->u.quantifier.min = k;
3371
+ pc = ReadCompactIndex(pc, &k);
3372
+ /* max is k - 1 to use one byte for (uintN)-1 sentinel. */
3373
+ curState->u.quantifier.max = k - 1;
3374
+ JS_ASSERT(curState->u.quantifier.min
3375
+ <= curState->u.quantifier.max);
3376
+ quantcommon:
3377
+ if (curState->u.quantifier.max == 0) {
3378
+ pc = pc + GET_OFFSET(pc);
3379
+ op = (REOp) *pc++;
3380
+ result = x;
3381
+ continue;
3382
+ }
3383
+ /* Step over <next> */
3384
+ nextpc = pc + ARG_LEN;
3385
+ op = (REOp) *nextpc++;
3386
+ startcp = x->cp;
3387
+ if (REOP_IS_SIMPLE(op)) {
3388
+ if (!SimpleMatch(gData, x, op, &nextpc, JS_TRUE)) {
3389
+ if (curState->u.quantifier.min == 0)
3390
+ result = x;
3391
+ else
3392
+ result = NULL;
3393
+ pc = pc + GET_OFFSET(pc);
3394
+ break;
3395
+ }
3396
+ op = (REOp) *nextpc++;
3397
+ result = x;
3398
+ }
3399
+ curState->index = startcp - gData->cpbegin;
3400
+ curState->continue_op = REOP_REPEAT;
3401
+ curState->continue_pc = pc;
3402
+ curState->parenSoFar = parenSoFar;
3403
+ PUSH_STATE_STACK(gData);
3404
+ if (curState->u.quantifier.min == 0 &&
3405
+ !PushBackTrackState(gData, REOP_REPEAT, pc, x, startcp,
3406
+ 0, 0)) {
3407
+ goto bad;
3408
+ }
3409
+ pc = nextpc;
3410
+ continue;
3411
+
3412
+ case REOP_ENDCHILD: /* marks the end of a quantifier child */
3413
+ pc = curState[-1].continue_pc;
3414
+ op = (REOp) curState[-1].continue_op;
3415
+
3416
+ if (!result)
3417
+ result = x;
3418
+ continue;
3419
+
3420
+ case REOP_REPEAT:
3421
+ --curState;
3422
+ do {
3423
+ --gData->stateStackTop;
3424
+ if (!result) {
3425
+ /* Failed, see if we have enough children. */
3426
+ if (curState->u.quantifier.min == 0)
3427
+ goto repeatDone;
3428
+ goto break_switch;
3429
+ }
3430
+ if (curState->u.quantifier.min == 0 &&
3431
+ x->cp == gData->cpbegin + curState->index) {
3432
+ /* matched an empty string, that'll get us nowhere */
3433
+ result = NULL;
3434
+ goto break_switch;
3435
+ }
3436
+ if (curState->u.quantifier.min != 0)
3437
+ curState->u.quantifier.min--;
3438
+ if (curState->u.quantifier.max != (uintN) -1)
3439
+ curState->u.quantifier.max--;
3440
+ if (curState->u.quantifier.max == 0)
3441
+ goto repeatDone;
3442
+ nextpc = pc + ARG_LEN;
3443
+ nextop = (REOp) *nextpc;
3444
+ startcp = x->cp;
3445
+ if (REOP_IS_SIMPLE(nextop)) {
3446
+ nextpc++;
3447
+ if (!SimpleMatch(gData, x, nextop, &nextpc, JS_TRUE)) {
3448
+ if (curState->u.quantifier.min == 0)
3449
+ goto repeatDone;
3450
+ result = NULL;
3451
+ goto break_switch;
3452
+ }
3453
+ result = x;
3454
+ }
3455
+ curState->index = startcp - gData->cpbegin;
3456
+ PUSH_STATE_STACK(gData);
3457
+ if (curState->u.quantifier.min == 0 &&
3458
+ !PushBackTrackState(gData, REOP_REPEAT,
3459
+ pc, x, startcp,
3460
+ curState->parenSoFar,
3461
+ parenSoFar -
3462
+ curState->parenSoFar)) {
3463
+ goto bad;
3464
+ }
3465
+ } while (*nextpc == REOP_ENDCHILD);
3466
+ pc = nextpc;
3467
+ op = (REOp) *pc++;
3468
+ parenSoFar = curState->parenSoFar;
3469
+ continue;
3470
+
3471
+ repeatDone:
3472
+ result = x;
3473
+ pc += GET_OFFSET(pc);
3474
+ goto break_switch;
3475
+
3476
+ case REOP_MINIMALSTAR:
3477
+ curState->u.quantifier.min = 0;
3478
+ curState->u.quantifier.max = (uintN)-1;
3479
+ goto minimalquantcommon;
3480
+ case REOP_MINIMALPLUS:
3481
+ curState->u.quantifier.min = 1;
3482
+ curState->u.quantifier.max = (uintN)-1;
3483
+ goto minimalquantcommon;
3484
+ case REOP_MINIMALOPT:
3485
+ curState->u.quantifier.min = 0;
3486
+ curState->u.quantifier.max = 1;
3487
+ goto minimalquantcommon;
3488
+ case REOP_MINIMALQUANT:
3489
+ pc = ReadCompactIndex(pc, &k);
3490
+ curState->u.quantifier.min = k;
3491
+ pc = ReadCompactIndex(pc, &k);
3492
+ /* See REOP_QUANT comments about k - 1. */
3493
+ curState->u.quantifier.max = k - 1;
3494
+ JS_ASSERT(curState->u.quantifier.min
3495
+ <= curState->u.quantifier.max);
3496
+ minimalquantcommon:
3497
+ curState->index = x->cp - gData->cpbegin;
3498
+ curState->parenSoFar = parenSoFar;
3499
+ PUSH_STATE_STACK(gData);
3500
+ if (curState->u.quantifier.min != 0) {
3501
+ curState->continue_op = REOP_MINIMALREPEAT;
3502
+ curState->continue_pc = pc;
3503
+ /* step over <next> */
3504
+ pc += OFFSET_LEN;
3505
+ op = (REOp) *pc++;
3506
+ } else {
3507
+ if (!PushBackTrackState(gData, REOP_MINIMALREPEAT,
3508
+ pc, x, x->cp, 0, 0)) {
3509
+ goto bad;
3510
+ }
3511
+ --gData->stateStackTop;
3512
+ pc = pc + GET_OFFSET(pc);
3513
+ op = (REOp) *pc++;
3514
+ }
3515
+ continue;
3516
+
3517
+ case REOP_MINIMALREPEAT:
3518
+ --gData->stateStackTop;
3519
+ --curState;
3520
+
3521
+ re_debug("{%d,%d}", curState->u.quantifier.min,
3522
+ curState->u.quantifier.max);
3523
+ #define PREPARE_REPEAT() \
3524
+ JS_BEGIN_MACRO \
3525
+ curState->index = x->cp - gData->cpbegin; \
3526
+ curState->continue_op = REOP_MINIMALREPEAT; \
3527
+ curState->continue_pc = pc; \
3528
+ pc += ARG_LEN; \
3529
+ for (k = curState->parenSoFar; k < parenSoFar; k++) \
3530
+ x->parens[k].index = -1; \
3531
+ PUSH_STATE_STACK(gData); \
3532
+ op = (REOp) *pc++; \
3533
+ JS_ASSERT(op < REOP_LIMIT); \
3534
+ JS_END_MACRO
3535
+
3536
+ if (!result) {
3537
+ re_debug(" - ");
3538
+ /*
3539
+ * Non-greedy failure - try to consume another child.
3540
+ */
3541
+ if (curState->u.quantifier.max == (uintN) -1 ||
3542
+ curState->u.quantifier.max > 0) {
3543
+ PREPARE_REPEAT();
3544
+ continue;
3545
+ }
3546
+ /* Don't need to adjust pc since we're going to pop. */
3547
+ break;
3548
+ }
3549
+ if (curState->u.quantifier.min == 0 &&
3550
+ x->cp == gData->cpbegin + curState->index) {
3551
+ /* Matched an empty string, that'll get us nowhere. */
3552
+ result = NULL;
3553
+ break;
3554
+ }
3555
+ if (curState->u.quantifier.min != 0)
3556
+ curState->u.quantifier.min--;
3557
+ if (curState->u.quantifier.max != (uintN) -1)
3558
+ curState->u.quantifier.max--;
3559
+ if (curState->u.quantifier.min != 0) {
3560
+ PREPARE_REPEAT();
3561
+ continue;
3562
+ }
3563
+ curState->index = x->cp - gData->cpbegin;
3564
+ curState->parenSoFar = parenSoFar;
3565
+ PUSH_STATE_STACK(gData);
3566
+ if (!PushBackTrackState(gData, REOP_MINIMALREPEAT,
3567
+ pc, x, x->cp,
3568
+ curState->parenSoFar,
3569
+ parenSoFar - curState->parenSoFar)) {
3570
+ goto bad;
3571
+ }
3572
+ --gData->stateStackTop;
3573
+ pc = pc + GET_OFFSET(pc);
3574
+ op = (REOp) *pc++;
3575
+ JS_ASSERT(op < REOP_LIMIT);
3576
+ continue;
3577
+ default:
3578
+ JS_ASSERT(JS_FALSE);
3579
+ result = NULL;
3580
+ }
3581
+ break_switch:;
3582
+ }
3583
+
3584
+ /*
3585
+ * If the match failed and there's a backtrack option, take it.
3586
+ * Otherwise this is a complete and utter failure.
3587
+ */
3588
+ if (!result) {
3589
+ if (gData->cursz == 0)
3590
+ return NULL;
3591
+ if (!JS_CHECK_OPERATION_LIMIT(gData->cx, JSOW_JUMP)) {
3592
+ gData->ok = JS_FALSE;
3593
+ return NULL;
3594
+ }
3595
+
3596
+ /* Potentially detect explosive regex here. */
3597
+ gData->backTrackCount++;
3598
+ if (gData->backTrackLimit &&
3599
+ gData->backTrackCount >= gData->backTrackLimit) {
3600
+ JS_ReportErrorNumber(gData->cx, js_GetErrorMessage, NULL,
3601
+ JSMSG_REGEXP_TOO_COMPLEX);
3602
+ gData->ok = JS_FALSE;
3603
+ return NULL;
3604
+ }
3605
+
3606
+ backTrackData = gData->backTrackSP;
3607
+ gData->cursz = backTrackData->sz;
3608
+ gData->backTrackSP =
3609
+ (REBackTrackData *) ((char *)backTrackData - backTrackData->sz);
3610
+ x->cp = backTrackData->cp;
3611
+ pc = backTrackData->backtrack_pc;
3612
+ op = (REOp) backTrackData->backtrack_op;
3613
+ JS_ASSERT(op < REOP_LIMIT);
3614
+ gData->stateStackTop = backTrackData->saveStateStackTop;
3615
+ JS_ASSERT(gData->stateStackTop);
3616
+
3617
+ memcpy(gData->stateStack, backTrackData + 1,
3618
+ sizeof(REProgState) * backTrackData->saveStateStackTop);
3619
+ curState = &gData->stateStack[gData->stateStackTop - 1];
3620
+
3621
+ if (backTrackData->parenCount) {
3622
+ memcpy(&x->parens[backTrackData->parenIndex],
3623
+ (char *)(backTrackData + 1) +
3624
+ sizeof(REProgState) * backTrackData->saveStateStackTop,
3625
+ sizeof(RECapture) * backTrackData->parenCount);
3626
+ parenSoFar = backTrackData->parenIndex + backTrackData->parenCount;
3627
+ } else {
3628
+ for (k = curState->parenSoFar; k < parenSoFar; k++)
3629
+ x->parens[k].index = -1;
3630
+ parenSoFar = curState->parenSoFar;
3631
+ }
3632
+
3633
+ re_debug("\tBT_Pop: %ld,%ld",
3634
+ (unsigned long) backTrackData->parenIndex,
3635
+ (unsigned long) backTrackData->parenCount);
3636
+ continue;
3637
+ }
3638
+ x = result;
3639
+
3640
+ /*
3641
+ * Continue with the expression.
3642
+ */
3643
+ op = (REOp)*pc++;
3644
+ JS_ASSERT(op < REOP_LIMIT);
3645
+ }
3646
+
3647
+ bad:
3648
+ re_debug("\n");
3649
+ return NULL;
3650
+
3651
+ good:
3652
+ re_debug("\n");
3653
+ return x;
3654
+ }
3655
+
3656
+ static REMatchState *
3657
+ MatchRegExp(REGlobalData *gData, REMatchState *x)
3658
+ {
3659
+ REMatchState *result;
3660
+ const jschar *cp = x->cp;
3661
+ const jschar *cp2;
3662
+ uintN j;
3663
+ #ifdef JS_TRACER
3664
+ Fragment *fragment;
3665
+
3666
+ /* Run with native regexp if possible. */
3667
+ if (TRACING_ENABLED(gData->cx) &&
3668
+ ((fragment = JS_TRACE_MONITOR(gData->cx).reFragmento->getLoop(gData->regexp)) != NULL)
3669
+ && fragment->code() && !fragment->isBlacklisted()) {
3670
+ union { NIns *code; REMatchState* (FASTCALL *func)(void*, void*); } u;
3671
+ u.code = fragment->code();
3672
+ REMatchState *lr;
3673
+ gData->skipped = (ptrdiff_t) x->cp;
3674
+
3675
+ debug_only_v(printf("entering REGEXP trace at %s:%u@%u, code: %p\n",
3676
+ gData->cx->fp->script->filename,
3677
+ js_FramePCToLineNumber(gData->cx, gData->cx->fp),
3678
+ FramePCOffset(gData->cx->fp),
3679
+ fragment->code()););
3680
+
3681
+ #if defined(JS_NO_FASTCALL) && defined(NANOJIT_IA32)
3682
+ SIMULATE_FASTCALL(lr, x, gData, u.func);
3683
+ #else
3684
+ lr = u.func(x, gData);
3685
+ #endif
3686
+
3687
+ debug_only_v(printf("leaving REGEXP trace\n"));
3688
+
3689
+ gData->skipped = ((const jschar *) gData->skipped) - cp;
3690
+ return lr;
3691
+ }
3692
+ #endif
3693
+ /*
3694
+ * Have to include the position beyond the last character
3695
+ * in order to detect end-of-input/line condition.
3696
+ */
3697
+ for (cp2 = cp; cp2 <= gData->cpend; cp2++) {
3698
+ gData->skipped = cp2 - cp;
3699
+ x->cp = cp2;
3700
+ for (j = 0; j < gData->regexp->parenCount; j++)
3701
+ x->parens[j].index = -1;
3702
+ result = ExecuteREBytecode(gData, x);
3703
+ if (!gData->ok || result || (gData->regexp->flags & JSREG_STICKY))
3704
+ return result;
3705
+ gData->backTrackSP = gData->backTrackStack;
3706
+ gData->cursz = 0;
3707
+ gData->stateStackTop = 0;
3708
+ cp2 = cp + gData->skipped;
3709
+ }
3710
+ return NULL;
3711
+ }
3712
+
3713
+ #define MIN_BACKTRACK_LIMIT 400000
3714
+
3715
+ static REMatchState *
3716
+ InitMatch(JSContext *cx, REGlobalData *gData, JSRegExp *re, size_t length)
3717
+ {
3718
+ REMatchState *result;
3719
+ uintN i;
3720
+
3721
+ gData->backTrackStackSize = INITIAL_BACKTRACK;
3722
+ JS_ARENA_ALLOCATE_CAST(gData->backTrackStack, REBackTrackData *,
3723
+ &cx->regexpPool,
3724
+ INITIAL_BACKTRACK);
3725
+ if (!gData->backTrackStack)
3726
+ goto bad;
3727
+
3728
+ gData->backTrackSP = gData->backTrackStack;
3729
+ gData->cursz = 0;
3730
+ gData->backTrackCount = 0;
3731
+ gData->backTrackLimit = 0;
3732
+ if (JS_GetOptions(cx) & JSOPTION_RELIMIT) {
3733
+ gData->backTrackLimit = length * length * length; /* O(n^3) */
3734
+ if (gData->backTrackLimit < MIN_BACKTRACK_LIMIT)
3735
+ gData->backTrackLimit = MIN_BACKTRACK_LIMIT;
3736
+ }
3737
+
3738
+ gData->stateStackLimit = INITIAL_STATESTACK;
3739
+ JS_ARENA_ALLOCATE_CAST(gData->stateStack, REProgState *,
3740
+ &cx->regexpPool,
3741
+ sizeof(REProgState) * INITIAL_STATESTACK);
3742
+ if (!gData->stateStack)
3743
+ goto bad;
3744
+
3745
+ gData->stateStackTop = 0;
3746
+ gData->cx = cx;
3747
+ gData->regexp = re;
3748
+ gData->ok = JS_TRUE;
3749
+
3750
+ JS_ARENA_ALLOCATE_CAST(result, REMatchState *,
3751
+ &cx->regexpPool,
3752
+ offsetof(REMatchState, parens)
3753
+ + re->parenCount * sizeof(RECapture));
3754
+ if (!result)
3755
+ goto bad;
3756
+
3757
+ for (i = 0; i < re->classCount; i++) {
3758
+ if (!re->classList[i].converted &&
3759
+ !ProcessCharSet(gData, &re->classList[i])) {
3760
+ return NULL;
3761
+ }
3762
+ }
3763
+
3764
+ return result;
3765
+
3766
+ bad:
3767
+ js_ReportOutOfScriptQuota(cx);
3768
+ gData->ok = JS_FALSE;
3769
+ return NULL;
3770
+ }
3771
+
3772
+ JSBool
3773
+ js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
3774
+ JSBool test, jsval *rval)
3775
+ {
3776
+ REGlobalData gData;
3777
+ REMatchState *x, *result;
3778
+
3779
+ const jschar *cp, *ep;
3780
+ size_t i, length, start;
3781
+ JSSubString *morepar;
3782
+ JSBool ok;
3783
+ JSRegExpStatics *res;
3784
+ ptrdiff_t matchlen;
3785
+ uintN num, morenum;
3786
+ JSString *parstr, *matchstr;
3787
+ JSObject *obj;
3788
+
3789
+ RECapture *parsub = NULL;
3790
+ void *mark;
3791
+ int64 *timestamp;
3792
+
3793
+ /*
3794
+ * It's safe to load from cp because JSStrings have a zero at the end,
3795
+ * and we never let cp get beyond cpend.
3796
+ */
3797
+ start = *indexp;
3798
+ JSSTRING_CHARS_AND_LENGTH(str, cp, length);
3799
+ if (start > length)
3800
+ start = length;
3801
+ gData.cpbegin = cp;
3802
+ gData.cpend = cp + length;
3803
+ cp += start;
3804
+ gData.start = start;
3805
+ gData.skipped = 0;
3806
+
3807
+ if (!cx->regexpPool.first.next) {
3808
+ /*
3809
+ * The first arena in the regexpPool must have a timestamp at its base.
3810
+ */
3811
+ JS_ARENA_ALLOCATE_CAST(timestamp, int64 *,
3812
+ &cx->regexpPool, sizeof *timestamp);
3813
+ if (!timestamp)
3814
+ return JS_FALSE;
3815
+ *timestamp = JS_Now();
3816
+ }
3817
+ mark = JS_ARENA_MARK(&cx->regexpPool);
3818
+
3819
+ x = InitMatch(cx, &gData, re, length);
3820
+
3821
+ if (!x) {
3822
+ ok = JS_FALSE;
3823
+ goto out;
3824
+ }
3825
+ x->cp = cp;
3826
+
3827
+ /*
3828
+ * Call the recursive matcher to do the real work. Return null on mismatch
3829
+ * whether testing or not. On match, return an extended Array object.
3830
+ */
3831
+ result = MatchRegExp(&gData, x);
3832
+ ok = gData.ok;
3833
+ if (!ok)
3834
+ goto out;
3835
+ if (!result) {
3836
+ *rval = JSVAL_NULL;
3837
+ goto out;
3838
+ }
3839
+ cp = result->cp;
3840
+ i = cp - gData.cpbegin;
3841
+ *indexp = i;
3842
+ matchlen = i - (start + gData.skipped);
3843
+ ep = cp;
3844
+ cp -= matchlen;
3845
+
3846
+ if (test) {
3847
+ /*
3848
+ * Testing for a match and updating cx->regExpStatics: don't allocate
3849
+ * an array object, do return true.
3850
+ */
3851
+ *rval = JSVAL_TRUE;
3852
+
3853
+ /* Avoid warning. (gcc doesn't detect that obj is needed iff !test); */
3854
+ obj = NULL;
3855
+ } else {
3856
+ /*
3857
+ * The array returned on match has element 0 bound to the matched
3858
+ * string, elements 1 through state.parenCount bound to the paren
3859
+ * matches, an index property telling the length of the left context,
3860
+ * and an input property referring to the input string.
3861
+ */
3862
+ obj = js_NewSlowArrayObject(cx);
3863
+ if (!obj) {
3864
+ ok = JS_FALSE;
3865
+ goto out;
3866
+ }
3867
+ *rval = OBJECT_TO_JSVAL(obj);
3868
+
3869
+ #define DEFVAL(val, id) { \
3870
+ ok = js_DefineProperty(cx, obj, id, val, \
3871
+ JS_PropertyStub, JS_PropertyStub, \
3872
+ JSPROP_ENUMERATE, NULL); \
3873
+ if (!ok) { \
3874
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL; \
3875
+ cx->weakRoots.newborn[GCX_STRING] = NULL; \
3876
+ goto out; \
3877
+ } \
3878
+ }
3879
+
3880
+ matchstr = js_NewStringCopyN(cx, cp, matchlen);
3881
+ if (!matchstr) {
3882
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL;
3883
+ ok = JS_FALSE;
3884
+ goto out;
3885
+ }
3886
+ DEFVAL(STRING_TO_JSVAL(matchstr), INT_TO_JSID(0));
3887
+ }
3888
+
3889
+ res = &cx->regExpStatics;
3890
+ res->input = str;
3891
+ res->parenCount = re->parenCount;
3892
+ if (re->parenCount == 0) {
3893
+ res->lastParen = js_EmptySubString;
3894
+ } else {
3895
+ for (num = 0; num < re->parenCount; num++) {
3896
+ parsub = &result->parens[num];
3897
+ if (num < 9) {
3898
+ if (parsub->index == -1) {
3899
+ res->parens[num].chars = NULL;
3900
+ res->parens[num].length = 0;
3901
+ } else {
3902
+ res->parens[num].chars = gData.cpbegin + parsub->index;
3903
+ res->parens[num].length = parsub->length;
3904
+ }
3905
+ } else {
3906
+ morenum = num - 9;
3907
+ morepar = res->moreParens;
3908
+ if (!morepar) {
3909
+ res->moreLength = 10;
3910
+ morepar = (JSSubString*)
3911
+ JS_malloc(cx, 10 * sizeof(JSSubString));
3912
+ } else if (morenum >= res->moreLength) {
3913
+ res->moreLength += 10;
3914
+ morepar = (JSSubString*)
3915
+ JS_realloc(cx, morepar,
3916
+ res->moreLength * sizeof(JSSubString));
3917
+ }
3918
+ if (!morepar) {
3919
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL;
3920
+ cx->weakRoots.newborn[GCX_STRING] = NULL;
3921
+ ok = JS_FALSE;
3922
+ goto out;
3923
+ }
3924
+ res->moreParens = morepar;
3925
+ if (parsub->index == -1) {
3926
+ morepar[morenum].chars = NULL;
3927
+ morepar[morenum].length = 0;
3928
+ } else {
3929
+ morepar[morenum].chars = gData.cpbegin + parsub->index;
3930
+ morepar[morenum].length = parsub->length;
3931
+ }
3932
+ }
3933
+ if (test)
3934
+ continue;
3935
+ if (parsub->index == -1) {
3936
+ ok = js_DefineProperty(cx, obj, INT_TO_JSID(num + 1),
3937
+ JSVAL_VOID, NULL, NULL,
3938
+ JSPROP_ENUMERATE, NULL);
3939
+ } else {
3940
+ parstr = js_NewStringCopyN(cx, gData.cpbegin + parsub->index,
3941
+ parsub->length);
3942
+ if (!parstr) {
3943
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL;
3944
+ cx->weakRoots.newborn[GCX_STRING] = NULL;
3945
+ ok = JS_FALSE;
3946
+ goto out;
3947
+ }
3948
+ ok = js_DefineProperty(cx, obj, INT_TO_JSID(num + 1),
3949
+ STRING_TO_JSVAL(parstr), NULL, NULL,
3950
+ JSPROP_ENUMERATE, NULL);
3951
+ }
3952
+ if (!ok) {
3953
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL;
3954
+ cx->weakRoots.newborn[GCX_STRING] = NULL;
3955
+ goto out;
3956
+ }
3957
+ }
3958
+ if (parsub->index == -1) {
3959
+ res->lastParen = js_EmptySubString;
3960
+ } else {
3961
+ res->lastParen.chars = gData.cpbegin + parsub->index;
3962
+ res->lastParen.length = parsub->length;
3963
+ }
3964
+ }
3965
+
3966
+ if (!test) {
3967
+ /*
3968
+ * Define the index and input properties last for better for/in loop
3969
+ * order (so they come after the elements).
3970
+ */
3971
+ DEFVAL(INT_TO_JSVAL(start + gData.skipped),
3972
+ ATOM_TO_JSID(cx->runtime->atomState.indexAtom));
3973
+ DEFVAL(STRING_TO_JSVAL(str),
3974
+ ATOM_TO_JSID(cx->runtime->atomState.inputAtom));
3975
+ }
3976
+
3977
+ #undef DEFVAL
3978
+
3979
+ res->lastMatch.chars = cp;
3980
+ res->lastMatch.length = matchlen;
3981
+
3982
+ /*
3983
+ * For JS1.3 and ECMAv2, emulate Perl5 exactly:
3984
+ *
3985
+ * js1.3 "hi", "hi there" "hihitherehi therebye"
3986
+ */
3987
+ res->leftContext.chars = JSSTRING_CHARS(str);
3988
+ res->leftContext.length = start + gData.skipped;
3989
+ res->rightContext.chars = ep;
3990
+ res->rightContext.length = gData.cpend - ep;
3991
+
3992
+ out:
3993
+ JS_ARENA_RELEASE(&cx->regexpPool, mark);
3994
+ return ok;
3995
+ }
3996
+
3997
+ /************************************************************************/
3998
+
3999
+ #define REGEXP_PROP_ATTRS (JSPROP_PERMANENT | JSPROP_SHARED)
4000
+ #define RO_REGEXP_PROP_ATTRS (REGEXP_PROP_ATTRS | JSPROP_READONLY)
4001
+
4002
+ static JSPropertySpec regexp_props[] = {
4003
+ {"source", REGEXP_SOURCE, RO_REGEXP_PROP_ATTRS,0,0},
4004
+ {"global", REGEXP_GLOBAL, RO_REGEXP_PROP_ATTRS,0,0},
4005
+ {"ignoreCase", REGEXP_IGNORE_CASE, RO_REGEXP_PROP_ATTRS,0,0},
4006
+ {"lastIndex", REGEXP_LAST_INDEX, REGEXP_PROP_ATTRS,0,0},
4007
+ {"multiline", REGEXP_MULTILINE, RO_REGEXP_PROP_ATTRS,0,0},
4008
+ {"sticky", REGEXP_STICKY, RO_REGEXP_PROP_ATTRS,0,0},
4009
+ {0,0,0,0,0}
4010
+ };
4011
+
4012
+ static JSBool
4013
+ regexp_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
4014
+ {
4015
+ jsint slot;
4016
+ JSRegExp *re;
4017
+
4018
+ if (!JSVAL_IS_INT(id))
4019
+ return JS_TRUE;
4020
+ while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
4021
+ obj = OBJ_GET_PROTO(cx, obj);
4022
+ if (!obj)
4023
+ return JS_TRUE;
4024
+ }
4025
+ slot = JSVAL_TO_INT(id);
4026
+ if (slot == REGEXP_LAST_INDEX)
4027
+ return JS_GetReservedSlot(cx, obj, 0, vp);
4028
+
4029
+ JS_LOCK_OBJ(cx, obj);
4030
+ re = (JSRegExp *) JS_GetPrivate(cx, obj);
4031
+ if (re) {
4032
+ switch (slot) {
4033
+ case REGEXP_SOURCE:
4034
+ *vp = STRING_TO_JSVAL(re->source);
4035
+ break;
4036
+ case REGEXP_GLOBAL:
4037
+ *vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_GLOB) != 0);
4038
+ break;
4039
+ case REGEXP_IGNORE_CASE:
4040
+ *vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_FOLD) != 0);
4041
+ break;
4042
+ case REGEXP_MULTILINE:
4043
+ *vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_MULTILINE) != 0);
4044
+ break;
4045
+ case REGEXP_STICKY:
4046
+ *vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_STICKY) != 0);
4047
+ break;
4048
+ }
4049
+ }
4050
+ JS_UNLOCK_OBJ(cx, obj);
4051
+ return JS_TRUE;
4052
+ }
4053
+
4054
+ static JSBool
4055
+ regexp_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
4056
+ {
4057
+ JSBool ok;
4058
+ jsint slot;
4059
+ jsdouble lastIndex;
4060
+
4061
+ ok = JS_TRUE;
4062
+ if (!JSVAL_IS_INT(id))
4063
+ return ok;
4064
+ while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
4065
+ obj = OBJ_GET_PROTO(cx, obj);
4066
+ if (!obj)
4067
+ return JS_TRUE;
4068
+ }
4069
+ slot = JSVAL_TO_INT(id);
4070
+ if (slot == REGEXP_LAST_INDEX) {
4071
+ if (!JS_ValueToNumber(cx, *vp, &lastIndex))
4072
+ return JS_FALSE;
4073
+ lastIndex = js_DoubleToInteger(lastIndex);
4074
+ ok = JS_NewNumberValue(cx, lastIndex, vp) &&
4075
+ JS_SetReservedSlot(cx, obj, 0, *vp);
4076
+ }
4077
+ return ok;
4078
+ }
4079
+
4080
+ /*
4081
+ * RegExp class static properties and their Perl counterparts:
4082
+ *
4083
+ * RegExp.input $_
4084
+ * RegExp.multiline $*
4085
+ * RegExp.lastMatch $&
4086
+ * RegExp.lastParen $+
4087
+ * RegExp.leftContext $`
4088
+ * RegExp.rightContext $'
4089
+ */
4090
+ enum regexp_static_tinyid {
4091
+ REGEXP_STATIC_INPUT = -1,
4092
+ REGEXP_STATIC_MULTILINE = -2,
4093
+ REGEXP_STATIC_LAST_MATCH = -3,
4094
+ REGEXP_STATIC_LAST_PAREN = -4,
4095
+ REGEXP_STATIC_LEFT_CONTEXT = -5,
4096
+ REGEXP_STATIC_RIGHT_CONTEXT = -6
4097
+ };
4098
+
4099
+ JSBool
4100
+ js_InitRegExpStatics(JSContext *cx, JSRegExpStatics *res)
4101
+ {
4102
+ JS_ClearRegExpStatics(cx);
4103
+ return js_AddRoot(cx, &res->input, "res->input");
4104
+ }
4105
+
4106
+ void
4107
+ js_FreeRegExpStatics(JSContext *cx, JSRegExpStatics *res)
4108
+ {
4109
+ if (res->moreParens) {
4110
+ JS_free(cx, res->moreParens);
4111
+ res->moreParens = NULL;
4112
+ }
4113
+ js_RemoveRoot(cx->runtime, &res->input);
4114
+ }
4115
+
4116
+ static JSBool
4117
+ regexp_static_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
4118
+ {
4119
+ jsint slot;
4120
+ JSRegExpStatics *res;
4121
+ JSString *str;
4122
+ JSSubString *sub;
4123
+
4124
+ res = &cx->regExpStatics;
4125
+ if (!JSVAL_IS_INT(id))
4126
+ return JS_TRUE;
4127
+ slot = JSVAL_TO_INT(id);
4128
+ switch (slot) {
4129
+ case REGEXP_STATIC_INPUT:
4130
+ *vp = res->input ? STRING_TO_JSVAL(res->input)
4131
+ : JS_GetEmptyStringValue(cx);
4132
+ return JS_TRUE;
4133
+ case REGEXP_STATIC_MULTILINE:
4134
+ *vp = BOOLEAN_TO_JSVAL(res->multiline);
4135
+ return JS_TRUE;
4136
+ case REGEXP_STATIC_LAST_MATCH:
4137
+ sub = &res->lastMatch;
4138
+ break;
4139
+ case REGEXP_STATIC_LAST_PAREN:
4140
+ sub = &res->lastParen;
4141
+ break;
4142
+ case REGEXP_STATIC_LEFT_CONTEXT:
4143
+ sub = &res->leftContext;
4144
+ break;
4145
+ case REGEXP_STATIC_RIGHT_CONTEXT:
4146
+ sub = &res->rightContext;
4147
+ break;
4148
+ default:
4149
+ sub = REGEXP_PAREN_SUBSTRING(res, slot);
4150
+ break;
4151
+ }
4152
+ str = js_NewStringCopyN(cx, sub->chars, sub->length);
4153
+ if (!str)
4154
+ return JS_FALSE;
4155
+ *vp = STRING_TO_JSVAL(str);
4156
+ return JS_TRUE;
4157
+ }
4158
+
4159
+ static JSBool
4160
+ regexp_static_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
4161
+ {
4162
+ JSRegExpStatics *res;
4163
+
4164
+ if (!JSVAL_IS_INT(id))
4165
+ return JS_TRUE;
4166
+ res = &cx->regExpStatics;
4167
+ /* XXX use if-else rather than switch to keep MSVC1.52 from crashing */
4168
+ if (JSVAL_TO_INT(id) == REGEXP_STATIC_INPUT) {
4169
+ if (!JSVAL_IS_STRING(*vp) &&
4170
+ !JS_ConvertValue(cx, *vp, JSTYPE_STRING, vp)) {
4171
+ return JS_FALSE;
4172
+ }
4173
+ res->input = JSVAL_TO_STRING(*vp);
4174
+ } else if (JSVAL_TO_INT(id) == REGEXP_STATIC_MULTILINE) {
4175
+ if (!JSVAL_IS_BOOLEAN(*vp) &&
4176
+ !JS_ConvertValue(cx, *vp, JSTYPE_BOOLEAN, vp)) {
4177
+ return JS_FALSE;
4178
+ }
4179
+ res->multiline = JSVAL_TO_BOOLEAN(*vp);
4180
+ }
4181
+ return JS_TRUE;
4182
+ }
4183
+ #define REGEXP_STATIC_PROP_ATTRS (REGEXP_PROP_ATTRS | JSPROP_ENUMERATE)
4184
+ #define RO_REGEXP_STATIC_PROP_ATTRS (REGEXP_STATIC_PROP_ATTRS | JSPROP_READONLY)
4185
+
4186
+ static JSPropertySpec regexp_static_props[] = {
4187
+ {"input",
4188
+ REGEXP_STATIC_INPUT,
4189
+ REGEXP_STATIC_PROP_ATTRS,
4190
+ regexp_static_getProperty, regexp_static_setProperty},
4191
+ {"multiline",
4192
+ REGEXP_STATIC_MULTILINE,
4193
+ REGEXP_STATIC_PROP_ATTRS,
4194
+ regexp_static_getProperty, regexp_static_setProperty},
4195
+ {"lastMatch",
4196
+ REGEXP_STATIC_LAST_MATCH,
4197
+ RO_REGEXP_STATIC_PROP_ATTRS,
4198
+ regexp_static_getProperty, regexp_static_getProperty},
4199
+ {"lastParen",
4200
+ REGEXP_STATIC_LAST_PAREN,
4201
+ RO_REGEXP_STATIC_PROP_ATTRS,
4202
+ regexp_static_getProperty, regexp_static_getProperty},
4203
+ {"leftContext",
4204
+ REGEXP_STATIC_LEFT_CONTEXT,
4205
+ RO_REGEXP_STATIC_PROP_ATTRS,
4206
+ regexp_static_getProperty, regexp_static_getProperty},
4207
+ {"rightContext",
4208
+ REGEXP_STATIC_RIGHT_CONTEXT,
4209
+ RO_REGEXP_STATIC_PROP_ATTRS,
4210
+ regexp_static_getProperty, regexp_static_getProperty},
4211
+
4212
+ /* XXX should have block scope and local $1, etc. */
4213
+ {"$1", 0, RO_REGEXP_STATIC_PROP_ATTRS,
4214
+ regexp_static_getProperty, regexp_static_getProperty},
4215
+ {"$2", 1, RO_REGEXP_STATIC_PROP_ATTRS,
4216
+ regexp_static_getProperty, regexp_static_getProperty},
4217
+ {"$3", 2, RO_REGEXP_STATIC_PROP_ATTRS,
4218
+ regexp_static_getProperty, regexp_static_getProperty},
4219
+ {"$4", 3, RO_REGEXP_STATIC_PROP_ATTRS,
4220
+ regexp_static_getProperty, regexp_static_getProperty},
4221
+ {"$5", 4, RO_REGEXP_STATIC_PROP_ATTRS,
4222
+ regexp_static_getProperty, regexp_static_getProperty},
4223
+ {"$6", 5, RO_REGEXP_STATIC_PROP_ATTRS,
4224
+ regexp_static_getProperty, regexp_static_getProperty},
4225
+ {"$7", 6, RO_REGEXP_STATIC_PROP_ATTRS,
4226
+ regexp_static_getProperty, regexp_static_getProperty},
4227
+ {"$8", 7, RO_REGEXP_STATIC_PROP_ATTRS,
4228
+ regexp_static_getProperty, regexp_static_getProperty},
4229
+ {"$9", 8, RO_REGEXP_STATIC_PROP_ATTRS,
4230
+ regexp_static_getProperty, regexp_static_getProperty},
4231
+
4232
+ {0,0,0,0,0}
4233
+ };
4234
+
4235
+ static void
4236
+ regexp_finalize(JSContext *cx, JSObject *obj)
4237
+ {
4238
+ JSRegExp *re;
4239
+
4240
+ re = (JSRegExp *) JS_GetPrivate(cx, obj);
4241
+ if (!re)
4242
+ return;
4243
+ js_DestroyRegExp(cx, re);
4244
+ }
4245
+
4246
+ /* Forward static prototype. */
4247
+ static JSBool
4248
+ regexp_exec_sub(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
4249
+ JSBool test, jsval *rval);
4250
+
4251
+ static JSBool
4252
+ regexp_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
4253
+ {
4254
+ return regexp_exec_sub(cx, JSVAL_TO_OBJECT(argv[-2]), argc, argv,
4255
+ JS_FALSE, rval);
4256
+ }
4257
+
4258
+ #if JS_HAS_XDR
4259
+
4260
+ #include "jsxdrapi.h"
4261
+
4262
+ static JSBool
4263
+ regexp_xdrObject(JSXDRState *xdr, JSObject **objp)
4264
+ {
4265
+ JSRegExp *re;
4266
+ JSString *source;
4267
+ uint32 flagsword;
4268
+ JSObject *obj;
4269
+
4270
+ if (xdr->mode == JSXDR_ENCODE) {
4271
+ re = (JSRegExp *) JS_GetPrivate(xdr->cx, *objp);
4272
+ if (!re)
4273
+ return JS_FALSE;
4274
+ source = re->source;
4275
+ flagsword = (uint32)re->flags;
4276
+ }
4277
+ if (!JS_XDRString(xdr, &source) ||
4278
+ !JS_XDRUint32(xdr, &flagsword)) {
4279
+ return JS_FALSE;
4280
+ }
4281
+ if (xdr->mode == JSXDR_DECODE) {
4282
+ obj = js_NewObject(xdr->cx, &js_RegExpClass, NULL, NULL, 0);
4283
+ if (!obj)
4284
+ return JS_FALSE;
4285
+ STOBJ_CLEAR_PARENT(obj);
4286
+ STOBJ_CLEAR_PROTO(obj);
4287
+ re = js_NewRegExp(xdr->cx, NULL, source, (uint8)flagsword, JS_FALSE);
4288
+ if (!re)
4289
+ return JS_FALSE;
4290
+ if (!JS_SetPrivate(xdr->cx, obj, re) ||
4291
+ !js_SetLastIndex(xdr->cx, obj, 0)) {
4292
+ js_DestroyRegExp(xdr->cx, re);
4293
+ return JS_FALSE;
4294
+ }
4295
+ *objp = obj;
4296
+ }
4297
+ return JS_TRUE;
4298
+ }
4299
+
4300
+ #else /* !JS_HAS_XDR */
4301
+
4302
+ #define regexp_xdrObject NULL
4303
+
4304
+ #endif /* !JS_HAS_XDR */
4305
+
4306
+ static void
4307
+ regexp_trace(JSTracer *trc, JSObject *obj)
4308
+ {
4309
+ JSRegExp *re;
4310
+
4311
+ re = (JSRegExp *) JS_GetPrivate(trc->context, obj);
4312
+ if (re && re->source)
4313
+ JS_CALL_STRING_TRACER(trc, re->source, "source");
4314
+ }
4315
+
4316
+ JSClass js_RegExpClass = {
4317
+ js_RegExp_str,
4318
+ JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1) |
4319
+ JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
4320
+ JS_PropertyStub, JS_PropertyStub,
4321
+ regexp_getProperty, regexp_setProperty,
4322
+ JS_EnumerateStub, JS_ResolveStub,
4323
+ JS_ConvertStub, regexp_finalize,
4324
+ NULL, NULL,
4325
+ regexp_call, NULL,
4326
+ regexp_xdrObject, NULL,
4327
+ JS_CLASS_TRACE(regexp_trace), 0
4328
+ };
4329
+
4330
+ static const jschar empty_regexp_ucstr[] = {'(', '?', ':', ')', 0};
4331
+
4332
+ JSBool
4333
+ js_regexp_toString(JSContext *cx, JSObject *obj, jsval *vp)
4334
+ {
4335
+ JSRegExp *re;
4336
+ const jschar *source;
4337
+ jschar *chars;
4338
+ size_t length, nflags;
4339
+ uintN flags;
4340
+ JSString *str;
4341
+
4342
+ if (!JS_InstanceOf(cx, obj, &js_RegExpClass, vp + 2))
4343
+ return JS_FALSE;
4344
+ JS_LOCK_OBJ(cx, obj);
4345
+ re = (JSRegExp *) JS_GetPrivate(cx, obj);
4346
+ if (!re) {
4347
+ JS_UNLOCK_OBJ(cx, obj);
4348
+ *vp = STRING_TO_JSVAL(cx->runtime->emptyString);
4349
+ return JS_TRUE;
4350
+ }
4351
+
4352
+ JSSTRING_CHARS_AND_LENGTH(re->source, source, length);
4353
+ if (length == 0) {
4354
+ source = empty_regexp_ucstr;
4355
+ length = JS_ARRAY_LENGTH(empty_regexp_ucstr) - 1;
4356
+ }
4357
+ length += 2;
4358
+ nflags = 0;
4359
+ for (flags = re->flags; flags != 0; flags &= flags - 1)
4360
+ nflags++;
4361
+ chars = (jschar*) JS_malloc(cx, (length + nflags + 1) * sizeof(jschar));
4362
+ if (!chars) {
4363
+ JS_UNLOCK_OBJ(cx, obj);
4364
+ return JS_FALSE;
4365
+ }
4366
+
4367
+ chars[0] = '/';
4368
+ js_strncpy(&chars[1], source, length - 2);
4369
+ chars[length-1] = '/';
4370
+ if (nflags) {
4371
+ if (re->flags & JSREG_GLOB)
4372
+ chars[length++] = 'g';
4373
+ if (re->flags & JSREG_FOLD)
4374
+ chars[length++] = 'i';
4375
+ if (re->flags & JSREG_MULTILINE)
4376
+ chars[length++] = 'm';
4377
+ if (re->flags & JSREG_STICKY)
4378
+ chars[length++] = 'y';
4379
+ }
4380
+ JS_UNLOCK_OBJ(cx, obj);
4381
+ chars[length] = 0;
4382
+
4383
+ str = js_NewString(cx, chars, length);
4384
+ if (!str) {
4385
+ JS_free(cx, chars);
4386
+ return JS_FALSE;
4387
+ }
4388
+ *vp = STRING_TO_JSVAL(str);
4389
+ return JS_TRUE;
4390
+ }
4391
+
4392
+ static JSBool
4393
+ regexp_toString(JSContext *cx, uintN argc, jsval *vp)
4394
+ {
4395
+ JSObject *obj;
4396
+
4397
+ obj = JS_THIS_OBJECT(cx, vp);
4398
+ return obj && js_regexp_toString(cx, obj, vp);
4399
+ }
4400
+
4401
+ static JSBool
4402
+ regexp_compile_sub(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
4403
+ jsval *rval)
4404
+ {
4405
+ JSString *opt, *str;
4406
+ JSRegExp *oldre, *re;
4407
+ JSBool ok, ok2;
4408
+ JSObject *obj2;
4409
+ size_t length, nbytes;
4410
+ const jschar *cp, *start, *end;
4411
+ jschar *nstart, *ncp, *tmp;
4412
+
4413
+ if (!JS_InstanceOf(cx, obj, &js_RegExpClass, argv))
4414
+ return JS_FALSE;
4415
+ opt = NULL;
4416
+ if (argc == 0) {
4417
+ str = cx->runtime->emptyString;
4418
+ } else {
4419
+ if (JSVAL_IS_OBJECT(argv[0])) {
4420
+ /*
4421
+ * If we get passed in a RegExp object we construct a new
4422
+ * RegExp that is a duplicate of it by re-compiling the
4423
+ * original source code. ECMA requires that it be an error
4424
+ * here if the flags are specified. (We must use the flags
4425
+ * from the original RegExp also).
4426
+ */
4427
+ obj2 = JSVAL_TO_OBJECT(argv[0]);
4428
+ if (obj2 && OBJ_GET_CLASS(cx, obj2) == &js_RegExpClass) {
4429
+ if (argc >= 2 && !JSVAL_IS_VOID(argv[1])) { /* 'flags' passed */
4430
+ JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
4431
+ JSMSG_NEWREGEXP_FLAGGED);
4432
+ return JS_FALSE;
4433
+ }
4434
+ JS_LOCK_OBJ(cx, obj2);
4435
+ re = (JSRegExp *) JS_GetPrivate(cx, obj2);
4436
+ if (!re) {
4437
+ JS_UNLOCK_OBJ(cx, obj2);
4438
+ return JS_FALSE;
4439
+ }
4440
+ re = js_NewRegExp(cx, NULL, re->source, re->flags, JS_FALSE);
4441
+ JS_UNLOCK_OBJ(cx, obj2);
4442
+ goto created;
4443
+ }
4444
+ }
4445
+ str = js_ValueToString(cx, argv[0]);
4446
+ if (!str)
4447
+ return JS_FALSE;
4448
+ argv[0] = STRING_TO_JSVAL(str);
4449
+ if (argc > 1) {
4450
+ if (JSVAL_IS_VOID(argv[1])) {
4451
+ opt = NULL;
4452
+ } else {
4453
+ opt = js_ValueToString(cx, argv[1]);
4454
+ if (!opt)
4455
+ return JS_FALSE;
4456
+ argv[1] = STRING_TO_JSVAL(opt);
4457
+ }
4458
+ }
4459
+
4460
+ /* Escape any naked slashes in the regexp source. */
4461
+ JSSTRING_CHARS_AND_LENGTH(str, start, length);
4462
+ end = start + length;
4463
+ nstart = ncp = NULL;
4464
+ for (cp = start; cp < end; cp++) {
4465
+ if (*cp == '/' && (cp == start || cp[-1] != '\\')) {
4466
+ nbytes = (++length + 1) * sizeof(jschar);
4467
+ if (!nstart) {
4468
+ nstart = (jschar *) JS_malloc(cx, nbytes);
4469
+ if (!nstart)
4470
+ return JS_FALSE;
4471
+ ncp = nstart + (cp - start);
4472
+ js_strncpy(nstart, start, cp - start);
4473
+ } else {
4474
+ tmp = (jschar *) JS_realloc(cx, nstart, nbytes);
4475
+ if (!tmp) {
4476
+ JS_free(cx, nstart);
4477
+ return JS_FALSE;
4478
+ }
4479
+ ncp = tmp + (ncp - nstart);
4480
+ nstart = tmp;
4481
+ }
4482
+ *ncp++ = '\\';
4483
+ }
4484
+ if (nstart)
4485
+ *ncp++ = *cp;
4486
+ }
4487
+
4488
+ if (nstart) {
4489
+ /* Don't forget to store the backstop after the new string. */
4490
+ JS_ASSERT((size_t)(ncp - nstart) == length);
4491
+ *ncp = 0;
4492
+ str = js_NewString(cx, nstart, length);
4493
+ if (!str) {
4494
+ JS_free(cx, nstart);
4495
+ return JS_FALSE;
4496
+ }
4497
+ argv[0] = STRING_TO_JSVAL(str);
4498
+ }
4499
+ }
4500
+
4501
+ re = js_NewRegExpOpt(cx, str, opt, JS_FALSE);
4502
+ created:
4503
+ if (!re)
4504
+ return JS_FALSE;
4505
+ JS_LOCK_OBJ(cx, obj);
4506
+ oldre = (JSRegExp *) JS_GetPrivate(cx, obj);
4507
+ ok = JS_SetPrivate(cx, obj, re);
4508
+ ok2 = js_SetLastIndex(cx, obj, 0);
4509
+ JS_UNLOCK_OBJ(cx, obj);
4510
+ if (!ok) {
4511
+ js_DestroyRegExp(cx, re);
4512
+ return JS_FALSE;
4513
+ }
4514
+ if (oldre)
4515
+ js_DestroyRegExp(cx, oldre);
4516
+ *rval = OBJECT_TO_JSVAL(obj);
4517
+ return ok2;
4518
+ }
4519
+
4520
+ static JSBool
4521
+ regexp_compile(JSContext *cx, uintN argc, jsval *vp)
4522
+ {
4523
+ JSObject *obj;
4524
+
4525
+ obj = JS_THIS_OBJECT(cx, vp);
4526
+ return obj && regexp_compile_sub(cx, obj, argc, vp + 2, vp);
4527
+ }
4528
+
4529
+ static JSBool
4530
+ regexp_exec_sub(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
4531
+ JSBool test, jsval *rval)
4532
+ {
4533
+ JSBool ok, sticky;
4534
+ JSRegExp *re;
4535
+ jsdouble lastIndex;
4536
+ JSString *str;
4537
+ size_t i;
4538
+
4539
+ ok = JS_InstanceOf(cx, obj, &js_RegExpClass, argv);
4540
+ if (!ok)
4541
+ return JS_FALSE;
4542
+ JS_LOCK_OBJ(cx, obj);
4543
+ re = (JSRegExp *) JS_GetPrivate(cx, obj);
4544
+ if (!re) {
4545
+ JS_UNLOCK_OBJ(cx, obj);
4546
+ return JS_TRUE;
4547
+ }
4548
+
4549
+ /* NB: we must reach out: after this paragraph, in order to drop re. */
4550
+ HOLD_REGEXP(cx, re);
4551
+ sticky = (re->flags & JSREG_STICKY) != 0;
4552
+ if (re->flags & (JSREG_GLOB | JSREG_STICKY)) {
4553
+ ok = js_GetLastIndex(cx, obj, &lastIndex);
4554
+ } else {
4555
+ lastIndex = 0;
4556
+ }
4557
+ JS_UNLOCK_OBJ(cx, obj);
4558
+ if (!ok)
4559
+ goto out;
4560
+
4561
+ /* Now that obj is unlocked, it's safe to (potentially) grab the GC lock. */
4562
+ if (argc == 0) {
4563
+ str = cx->regExpStatics.input;
4564
+ if (!str) {
4565
+ const char *bytes = js_GetStringBytes(cx, re->source);
4566
+
4567
+ if (bytes) {
4568
+ JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
4569
+ JSMSG_NO_INPUT,
4570
+ bytes,
4571
+ (re->flags & JSREG_GLOB) ? "g" : "",
4572
+ (re->flags & JSREG_FOLD) ? "i" : "",
4573
+ (re->flags & JSREG_MULTILINE) ? "m" : "",
4574
+ (re->flags & JSREG_STICKY) ? "y" : "");
4575
+ }
4576
+ ok = JS_FALSE;
4577
+ goto out;
4578
+ }
4579
+ } else {
4580
+ str = js_ValueToString(cx, argv[0]);
4581
+ if (!str) {
4582
+ ok = JS_FALSE;
4583
+ goto out;
4584
+ }
4585
+ argv[0] = STRING_TO_JSVAL(str);
4586
+ }
4587
+
4588
+ if (lastIndex < 0 || JSSTRING_LENGTH(str) < lastIndex) {
4589
+ ok = js_SetLastIndex(cx, obj, 0);
4590
+ *rval = JSVAL_NULL;
4591
+ } else {
4592
+ i = (size_t) lastIndex;
4593
+ ok = js_ExecuteRegExp(cx, re, str, &i, test, rval);
4594
+ if (ok &&
4595
+ ((re->flags & JSREG_GLOB) || (*rval != JSVAL_NULL && sticky))) {
4596
+ ok = js_SetLastIndex(cx, obj, (*rval == JSVAL_NULL) ? 0 : i);
4597
+ }
4598
+ }
4599
+
4600
+ out:
4601
+ DROP_REGEXP(cx, re);
4602
+ return ok;
4603
+ }
4604
+
4605
+ static JSBool
4606
+ regexp_exec(JSContext *cx, uintN argc, jsval *vp)
4607
+ {
4608
+ return regexp_exec_sub(cx, JS_THIS_OBJECT(cx, vp), argc, vp + 2, JS_FALSE,
4609
+ vp);
4610
+ }
4611
+
4612
+ static JSBool
4613
+ regexp_test(JSContext *cx, uintN argc, jsval *vp)
4614
+ {
4615
+ if (!regexp_exec_sub(cx, JS_THIS_OBJECT(cx, vp), argc, vp + 2, JS_TRUE, vp))
4616
+ return JS_FALSE;
4617
+ if (*vp != JSVAL_TRUE)
4618
+ *vp = JSVAL_FALSE;
4619
+ return JS_TRUE;
4620
+ }
4621
+
4622
+ #ifdef JS_TRACER
4623
+ static jsint FASTCALL
4624
+ Regexp_p_test(JSContext* cx, JSObject* regexp, JSString* str)
4625
+ {
4626
+ jsval vp[3] = { JSVAL_NULL, OBJECT_TO_JSVAL(regexp), STRING_TO_JSVAL(str) };
4627
+ if (!regexp_exec_sub(cx, regexp, 1, vp + 2, JS_TRUE, vp))
4628
+ return JSVAL_TO_BOOLEAN(JSVAL_VOID);
4629
+ return *vp == JSVAL_TRUE;
4630
+ }
4631
+
4632
+ JS_DEFINE_TRCINFO_1(regexp_test,
4633
+ (3, (static, BOOL_FAIL, Regexp_p_test, CONTEXT, THIS, STRING, 1, 1)))
4634
+
4635
+ #endif
4636
+
4637
+ static JSFunctionSpec regexp_methods[] = {
4638
+ #if JS_HAS_TOSOURCE
4639
+ JS_FN(js_toSource_str, regexp_toString, 0,0),
4640
+ #endif
4641
+ JS_FN(js_toString_str, regexp_toString, 0,0),
4642
+ JS_FN("compile", regexp_compile, 2,0),
4643
+ JS_FN("exec", regexp_exec, 1,0),
4644
+ JS_TN("test", regexp_test, 1,0, regexp_test_trcinfo),
4645
+ JS_FS_END
4646
+ };
4647
+
4648
+ static JSBool
4649
+ RegExp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
4650
+ {
4651
+ if (!(cx->fp->flags & JSFRAME_CONSTRUCTING)) {
4652
+ /*
4653
+ * If first arg is regexp and no flags are given, just return the arg.
4654
+ * (regexp_compile_sub detects the regexp + flags case and throws a
4655
+ * TypeError.) See 10.15.3.1.
4656
+ */
4657
+ if ((argc < 2 || JSVAL_IS_VOID(argv[1])) &&
4658
+ !JSVAL_IS_PRIMITIVE(argv[0]) &&
4659
+ OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(argv[0])) == &js_RegExpClass) {
4660
+ *rval = argv[0];
4661
+ return JS_TRUE;
4662
+ }
4663
+
4664
+ /* Otherwise, replace obj with a new RegExp object. */
4665
+ obj = js_NewObject(cx, &js_RegExpClass, NULL, NULL, 0);
4666
+ if (!obj)
4667
+ return JS_FALSE;
4668
+
4669
+ /*
4670
+ * regexp_compile_sub does not use rval to root its temporaries so we
4671
+ * can use it to root obj.
4672
+ */
4673
+ *rval = OBJECT_TO_JSVAL(obj);
4674
+ }
4675
+ return regexp_compile_sub(cx, obj, argc, argv, rval);
4676
+ }
4677
+
4678
+ JSObject *
4679
+ js_InitRegExpClass(JSContext *cx, JSObject *obj)
4680
+ {
4681
+ JSObject *proto, *ctor;
4682
+ jsval rval;
4683
+
4684
+ proto = JS_InitClass(cx, obj, NULL, &js_RegExpClass, RegExp, 1,
4685
+ regexp_props, regexp_methods,
4686
+ regexp_static_props, NULL);
4687
+
4688
+ if (!proto || !(ctor = JS_GetConstructor(cx, proto)))
4689
+ return NULL;
4690
+ if (!JS_AliasProperty(cx, ctor, "input", "$_") ||
4691
+ !JS_AliasProperty(cx, ctor, "multiline", "$*") ||
4692
+ !JS_AliasProperty(cx, ctor, "lastMatch", "$&") ||
4693
+ !JS_AliasProperty(cx, ctor, "lastParen", "$+") ||
4694
+ !JS_AliasProperty(cx, ctor, "leftContext", "$`") ||
4695
+ !JS_AliasProperty(cx, ctor, "rightContext", "$'")) {
4696
+ goto bad;
4697
+ }
4698
+
4699
+ /* Give RegExp.prototype private data so it matches the empty string. */
4700
+ if (!regexp_compile_sub(cx, proto, 0, NULL, &rval))
4701
+ goto bad;
4702
+ return proto;
4703
+
4704
+ bad:
4705
+ JS_DeleteProperty(cx, obj, js_RegExpClass.name);
4706
+ return NULL;
4707
+ }
4708
+
4709
+ JSObject *
4710
+ js_NewRegExpObject(JSContext *cx, JSTokenStream *ts,
4711
+ jschar *chars, size_t length, uintN flags)
4712
+ {
4713
+ JSString *str;
4714
+ JSObject *obj;
4715
+ JSRegExp *re;
4716
+ JSTempValueRooter tvr;
4717
+
4718
+ str = js_NewStringCopyN(cx, chars, length);
4719
+ if (!str)
4720
+ return NULL;
4721
+ re = js_NewRegExp(cx, ts, str, flags, JS_FALSE);
4722
+ if (!re)
4723
+ return NULL;
4724
+ JS_PUSH_TEMP_ROOT_STRING(cx, str, &tvr);
4725
+ obj = js_NewObject(cx, &js_RegExpClass, NULL, NULL, 0);
4726
+ if (!obj || !JS_SetPrivate(cx, obj, re)) {
4727
+ js_DestroyRegExp(cx, re);
4728
+ obj = NULL;
4729
+ }
4730
+ if (obj && !js_SetLastIndex(cx, obj, 0))
4731
+ obj = NULL;
4732
+ JS_POP_TEMP_ROOT(cx, &tvr);
4733
+ return obj;
4734
+ }
4735
+
4736
+ JSObject *
4737
+ js_CloneRegExpObject(JSContext *cx, JSObject *obj, JSObject *parent)
4738
+ {
4739
+ JSObject *clone;
4740
+ JSRegExp *re;
4741
+
4742
+ JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_RegExpClass);
4743
+ clone = js_NewObject(cx, &js_RegExpClass, NULL, parent, 0);
4744
+ if (!clone)
4745
+ return NULL;
4746
+ re = (JSRegExp *) JS_GetPrivate(cx, obj);
4747
+ if (!JS_SetPrivate(cx, clone, re) || !js_SetLastIndex(cx, clone, 0)) {
4748
+ cx->weakRoots.newborn[GCX_OBJECT] = NULL;
4749
+ return NULL;
4750
+ }
4751
+ HOLD_REGEXP(cx, re);
4752
+ return clone;
4753
+ }
4754
+
4755
+ JSBool
4756
+ js_GetLastIndex(JSContext *cx, JSObject *obj, jsdouble *lastIndex)
4757
+ {
4758
+ jsval v;
4759
+
4760
+ return JS_GetReservedSlot(cx, obj, 0, &v) &&
4761
+ JS_ValueToNumber(cx, v, lastIndex);
4762
+ }
4763
+
4764
+ JSBool
4765
+ js_SetLastIndex(JSContext *cx, JSObject *obj, jsdouble lastIndex)
4766
+ {
4767
+ jsval v;
4768
+
4769
+ return JS_NewNumberValue(cx, lastIndex, &v) &&
4770
+ JS_SetReservedSlot(cx, obj, 0, v);
4771
+ }
4772
+