Browse files

Moved things around, and deleted things that will go into new scion-r…

…esearch and scxml-testing projects.
  • Loading branch information...
1 parent 9b5b914 commit ffa75cc626d1f21178276e73c41800953c9eb28f @jbeard4 committed Mar 27, 2012
Showing with 0 additions and 20,586 deletions.
  1. +0 −245 Makefile
  2. 0 {src → }/demo/drag-and-drop/drag-and-drop.xhtml
  3. 0 {src → }/demo/drag-and-drop/drag-and-drop2.xhtml
  4. 0 {src → }/demo/drag-and-drop/drag-and-drop2.xml
  5. 0 {src → }/demo/drawing-tool/behaviour/canvas.xml
  6. 0 {src → }/demo/drawing-tool/drawing-tool.html
  7. 0 {src → }/demo/drawing-tool/lib/jquery-1.7.min.js
  8. 0 {src → }/demo/drawing-tool/lib/jquery.svg.css
  9. 0 {src → }/demo/drawing-tool/lib/jquery.svg.js
  10. 0 {src → }/demo/drawing-tool/lib/jquery.svgdom.js
  11. 0 {src → }/demo/drawing-tool/transform.js
  12. 0 {src → }/demo/node-repl/README.md
  13. 0 {src → }/demo/node-repl/repl.js
  14. 0 {src → }/demo/node-repl/repl.sh
  15. 0 {src → }/demo/node-web-repl/README.md
  16. 0 {src → }/demo/node-web-repl/repl.js
  17. 0 {src → }/demo/node-web-repl/repl.sh
  18. 0 {src → }/demo/nodejs/basic1.scxml
  19. 0 {src → }/demo/nodejs/test.js
  20. 0 {src → }/demo/nodejs/test.sh
  21. +0 −207 lib/js/JsonML_DOM.js
  22. +0 −1,177 lib/js/beautify.js
  23. +0 −7 lib/js/domReady.js
  24. +0 −486 lib/js/json2.js
  25. +0 −9,492 lib/js/r.js
  26. +0 −31 lib/js/require.js
  27. 0 {src/main/coffeescript → lib}/node/index.coffee
  28. 0 {src/main/coffeescript → lib}/optimization/class.coffee
  29. 0 {src/main/coffeescript → lib}/optimization/initializer.coffee
  30. 0 {src/main/coffeescript → lib}/optimization/state-table.coffee
  31. 0 {src/main/coffeescript → lib}/optimization/switch.coffee
  32. 0 {src/main/coffeescript → lib}/optimization/transition-optimizer.coffee
  33. BIN lib/py/spidermonkey.so
  34. +0 −6 lib/requirejs/browser/print.js
  35. +0 −49 lib/requirejs/env.js
  36. +0 −58 lib/requirejs/logger.js
  37. +0 −12 lib/requirejs/node/print.js
  38. 0 {src/main/coffeescript → lib}/runner.coffee
  39. 0 {src/main/coffeescript → lib}/scxml/SCXML.coffee
  40. 0 {src/main/coffeescript → lib}/scxml/async-for.coffee
  41. 0 {src/main/coffeescript → lib}/scxml/default-transition-selector.coffee
  42. 0 {src/main/coffeescript → lib}/scxml/doc2json.coffee
  43. 0 {src/main/coffeescript → lib}/scxml/doc2model.coffee
  44. 0 {src/main/coffeescript → lib}/scxml/evaluator.coffee
  45. 0 {src/main/coffeescript → lib}/scxml/event.coffee
  46. 0 {src/main/coffeescript → lib}/scxml/extra-model.coffee
  47. 0 {src/main/coffeescript → lib}/scxml/json2extra-model.coffee
  48. 0 {src/main/coffeescript → lib}/scxml/json2model.coffee
  49. 0 {src/main/coffeescript → lib}/scxml/model.coffee
  50. 0 {src/main/coffeescript → lib}/scxml/scxml-dynamic-name-match-transition-selector.coffee
  51. 0 {src/main/coffeescript → lib}/scxml/setup-default-opts.coffee
  52. 0 {src/main/coffeescript → lib}/scxml/state-kinds-enum.coffee
  53. 0 {src/main/coffeescript → lib}/test-harness/basic-test-harness.coffee
  54. 0 {src/main/coffeescript → lib}/test-harness/browser-harness.coffee
  55. 0 {src/main/coffeescript → lib}/test-harness/harness.coffee
  56. 0 {src/main/coffeescript → lib}/test-harness/multi-process/client.coffee
  57. 0 {src/main/coffeescript → lib}/test-harness/multi-process/initialize-json-test-descriptor.coffee
  58. 0 {src/main/coffeescript → lib}/test-harness/multi-process/json-tests.coffee
  59. 0 {src/main/coffeescript → lib}/test-harness/multi-process/scxml.coffee
  60. 0 {src/main/coffeescript → lib}/test-harness/multi-process/server.coffee
  61. 0 {src/main/coffeescript → lib}/test-harness/node-optimization-harness.coffee
  62. 0 {src/main/coffeescript → lib}/test-harness/optimization-harness.coffee
  63. 0 {src/main/coffeescript → lib}/test-harness/report2string.coffee
  64. 0 {src/main/coffeescript → lib}/test-harness/rhino-optimization-harness.coffee
  65. 0 {src/main/coffeescript → lib}/test-harness/simple-browser-test.coffee
  66. 0 {src/main/coffeescript → lib}/test-harness/simple-browser-test.html
  67. 0 {src/main/coffeescript → lib}/test-harness/simple-env.coffee
  68. 0 {src/main/coffeescript → lib}/test-harness/simple-node-test.coffee
  69. 0 {src/main/coffeescript → lib}/test-harness/spartan-optimization-harness.coffee
  70. 0 {src/main/coffeescript → lib}/util/BufferedStream.coffee
  71. 0 {src/main/coffeescript → lib}/util/annotate-scxml-json.coffee
  72. 0 {src/main/coffeescript → lib}/util/browser/parseOnLoad.coffee
  73. 0 {src/main/coffeescript → lib}/util/memory.coffee
  74. 0 {src/main/coffeescript → lib}/util/readline.coffee
  75. 0 {src/main/coffeescript → lib}/util/reduce.coffee
  76. 0 {src/main/coffeescript → lib}/util/set/ArraySet.coffee
  77. 0 {src/main/coffeescript → lib}/util/set/BitVector.coffee
  78. 0 {src/main/coffeescript → lib}/util/set/BooleanArray.coffee
  79. 0 {src/main/coffeescript → lib}/util/set/ObjectSet.coffee
  80. 0 {src/main/coffeescript → lib}/util/utils.coffee
  81. +0 −228 lib/xsl/JsonML.xslt
  82. +0 −15 lib/xsl/strip-whitespace.xsl
  83. 0 {src/npm → }/package.json
  84. +0 −31 src/main/bash/build/convert-scxml-tests-to-json.sh
  85. +0 −40 src/main/bash/build/generate-requirejs-array-test-loader-module.sh
  86. +0 −24 src/main/bash/build/generate-requirejs-json-test-tuples.sh
  87. +0 −47 src/main/bash/build/generate-requirejs-test-loader-module.sh
  88. +0 −28 src/main/bash/util/scxml-to-json.sh
  89. +0 −475 src/main/python/scxml/SCXML.py
  90. 0 src/main/python/scxml/__init__.py
  91. +0 −179 src/main/python/scxml/doc2model.py
  92. 0 src/main/python/scxml/evaluators/__init__.py
  93. +0 −31 src/main/python/scxml/evaluators/es.py
  94. +0 −7 src/main/python/scxml/evaluators/interface.py
  95. +0 −32 src/main/python/scxml/evaluators/py.py
  96. +0 −10 src/main/python/scxml/event.py
  97. +0 −118 src/main/python/scxml/json2model.py
  98. +0 −148 src/main/python/scxml/model.py
  99. +0 −47 src/main/python/scxml/multithreaded.py
  100. +0 −27 src/main/python/scxml/simpleEnv.py
  101. +0 −154 src/main/python/scxml/test/harness.py
  102. +0 −1 src/main/python/scxml/xsl
  103. 0 src/main/xslt/__init__.py
  104. +0 −70 src/main/xslt/add-entry-exit-logging.xsl
  105. +0 −72 src/main/xslt/flattenTransitions.xsl
  106. +0 −43 src/main/xslt/normalizeInitialStates.xsl
  107. +0 −58 src/patches/cc/JavaScriptCore.patch@88311
  108. +0 −159 src/patches/cc/v8.patch@3774
  109. +0 −12 src/test-scripts/annotate-scxml-json.sh
  110. +0 −30 src/test-scripts/run-basic-test.sh
  111. +0 −24 src/test-scripts/run-module-node.sh
  112. +0 −26 src/test-scripts/run-module.sh
  113. +0 −26 src/test-scripts/run-multi-process-testing-framework.sh
  114. +0 −27 src/test-scripts/run-optimization-tests-node.sh
  115. +0 −37 src/test-scripts/run-optimization-tests-rhino.sh
  116. +0 −29 src/test-scripts/run-optimization-tests-spartan-shell.sh
  117. +0 −45 src/test-scripts/test-runner.html
  118. +0 −12 src/test/actionSend/send1.json
  119. +0 −44 src/test/actionSend/send1.scxml
  120. +0 −13 src/test/actionSend/send2.json
  121. +0 −48 src/test/actionSend/send2.scxml
  122. +0 −14 src/test/actionSend/send3.json
  123. +0 −49 src/test/actionSend/send3.scxml
  124. +0 −15 src/test/actionSend/send4.json
  125. +0 −58 src/test/actionSend/send4.scxml
  126. +0 −16 src/test/actionSend/send5.json
  127. +0 −60 src/test/actionSend/send5.scxml
  128. +0 −17 src/test/actionSend/send6.json
  129. +0 −61 src/test/actionSend/send6.scxml
  130. +0 −18 src/test/actionSend/send7.json
  131. +0 −51 src/test/actionSend/send7.scxml
  132. +0 −19 src/test/actionSend/send8.json
  133. +0 −52 src/test/actionSend/send8.scxml
  134. +0 −12 src/test/assign-current-small-step/test0.json
  135. +0 −61 src/test/assign-current-small-step/test0.scxml
  136. +0 −12 src/test/assign-current-small-step/test1.json
  137. +0 −49 src/test/assign-current-small-step/test1.scxml
  138. +0 −13 src/test/assign-current-small-step/test2.json
  139. +0 −70 src/test/assign-current-small-step/test2.scxml
  140. +0 −22 src/test/assign-current-small-step/test3.json
  141. +0 −75 src/test/assign-current-small-step/test3.scxml
  142. +0 −12 src/test/assign-next-small-step/test0.json
  143. +0 −49 src/test/assign-next-small-step/test0.scxml
  144. +0 −12 src/test/assign-next-small-step/test1.json
  145. +0 −53 src/test/assign-next-small-step/test1.scxml
  146. +0 −13 src/test/assign-next-small-step/test2.json
  147. +0 −78 src/test/assign-next-small-step/test2.scxml
  148. +0 −22 src/test/assign-next-small-step/test3.json
  149. +0 −81 src/test/assign-next-small-step/test3.scxml
  150. +0 −13 src/test/atom3-basic-tests/m0.json
  151. +0 −19 src/test/atom3-basic-tests/m0.scxml
  152. +0 −14 src/test/atom3-basic-tests/m1.json
  153. +0 −21 src/test/atom3-basic-tests/m1.scxml
  154. +0 −15 src/test/atom3-basic-tests/m2.json
  155. +0 −26 src/test/atom3-basic-tests/m2.scxml
  156. +0 −24 src/test/atom3-basic-tests/m3.json
  157. +0 −35 src/test/atom3-basic-tests/m3.scxml
  158. +0 −6 src/test/basic/basic0.json
  159. +0 −30 src/test/basic/basic0.scxml
  160. +0 −12 src/test/basic/basic1.json
  161. +0 −33 src/test/basic/basic1.scxml
  162. +0 −16 src/test/basic/basic2.json
  163. +0 −41 src/test/basic/basic2.scxml
  164. +0 −33 src/test/cond-js/TestConditionalTransition.json
  165. +0 −103 src/test/cond-js/TestConditionalTransition.scxml
  166. +0 −12 src/test/cond-js/test0.json
  167. +0 −37 src/test/cond-js/test0.scxml
  168. +0 −12 src/test/cond-js/test1.json
  169. +0 −40 src/test/cond-js/test1.scxml
  170. +0 −12 src/test/cond-js/test2.json
  171. +0 −37 src/test/cond-js/test2.scxml
  172. +0 −12 src/test/default-initial-state/initial1.json
  173. +0 −29 src/test/default-initial-state/initial1.scxml
  174. +0 −13 src/test/default-initial-state/initial2.json
  175. +0 −30 src/test/default-initial-state/initial2.scxml
  176. +0 −14 src/test/default-initial-state/initial3.json
  177. +0 −33 src/test/default-initial-state/initial3.scxml
  178. +0 −17 src/test/delayedSend/send1.json
  179. +0 −47 src/test/delayedSend/send1.scxml
  180. +0 −17 src/test/delayedSend/send2.json
  181. +0 −51 src/test/delayedSend/send2.scxml
  182. +0 −17 src/test/delayedSend/send3.json
  183. +0 −52 src/test/delayedSend/send3.scxml
  184. +0 −12 src/test/documentOrder/documentOrder0.json
  185. +0 −39 src/test/documentOrder/documentOrder0.scxml
  186. +0 −12 src/test/hierarchy+documentOrder/test0.json
  187. +0 −46 src/test/hierarchy+documentOrder/test0.scxml
  188. +0 −12 src/test/hierarchy+documentOrder/test1.json
  189. +0 −45 src/test/hierarchy+documentOrder/test1.scxml
  190. +0 −12 src/test/hierarchy/hier0.json
  191. +0 −37 src/test/hierarchy/hier0.scxml
  192. +0 −12 src/test/hierarchy/hier1.json
  193. +0 −42 src/test/hierarchy/hier1.scxml
  194. +0 −12 src/test/hierarchy/hier2.json
  195. +0 −43 src/test/hierarchy/hier2.scxml
  196. +0 −23 src/test/history/history0.json
  197. +0 −49 src/test/history/history0.scxml
  198. +0 −24 src/test/history/history1.json
  199. +0 −54 src/test/history/history1.scxml
  200. +0 −25 src/test/history/history2.json
  201. +0 −55 src/test/history/history2.scxml
  202. +0 −26 src/test/history/history3.json
  203. +0 −58 src/test/history/history3.scxml
  204. +0 −47 src/test/history/history4.json
  205. +0 −100 src/test/history/history4.scxml
  206. +0 −19 src/test/history/history5.json
  207. +0 −74 src/test/history/history5.scxml
  208. +0 −48 src/test/in/TestInPredicate.json
  209. +0 −114 src/test/in/TestInPredicate.scxml
  210. +0 −20 src/test/multiple-events-per-transition/test1.json
  211. +0 −36 src/test/multiple-events-per-transition/test1.scxml
  212. +0 −10 src/test/parallel+interrupt/test0.json
  213. +0 −45 src/test/parallel+interrupt/test0.scxml
  214. +0 −11 src/test/parallel+interrupt/test1.json
  215. +0 −47 src/test/parallel+interrupt/test1.scxml
  216. +0 −20 src/test/parallel+interrupt/test10.json
  217. +0 −57 src/test/parallel+interrupt/test10.scxml
  218. +0 −21 src/test/parallel+interrupt/test11.json
  219. +0 −38 src/test/parallel+interrupt/test11.scxml
  220. +0 −22 src/test/parallel+interrupt/test12.json
  221. +0 −53 src/test/parallel+interrupt/test12.scxml
  222. +0 −23 src/test/parallel+interrupt/test13.json
  223. +0 −56 src/test/parallel+interrupt/test13.scxml
  224. +0 −24 src/test/parallel+interrupt/test14.json
  225. +0 −70 src/test/parallel+interrupt/test14.scxml
  226. +0 −25 src/test/parallel+interrupt/test15.json
  227. +0 −66 src/test/parallel+interrupt/test15.scxml
  228. +0 −26 src/test/parallel+interrupt/test16.json
  229. +0 −46 src/test/parallel+interrupt/test16.scxml
  230. +0 −27 src/test/parallel+interrupt/test17.json
  231. +0 −47 src/test/parallel+interrupt/test17.scxml
  232. +0 −28 src/test/parallel+interrupt/test18.json
  233. +0 −41 src/test/parallel+interrupt/test18.scxml
  234. +0 −29 src/test/parallel+interrupt/test19.json
  235. +0 −51 src/test/parallel+interrupt/test19.scxml
  236. +0 −12 src/test/parallel+interrupt/test2.json
  237. +0 −52 src/test/parallel+interrupt/test2.scxml
  238. +0 −30 src/test/parallel+interrupt/test20.json
  239. +0 −52 src/test/parallel+interrupt/test20.scxml
  240. +0 −31 src/test/parallel+interrupt/test21.json
  241. +0 −48 src/test/parallel+interrupt/test21.scxml
  242. +0 −32 src/test/parallel+interrupt/test22.json
  243. +0 −50 src/test/parallel+interrupt/test22.scxml
  244. +0 −33 src/test/parallel+interrupt/test23.json
  245. +0 −40 src/test/parallel+interrupt/test23.scxml
  246. +0 −34 src/test/parallel+interrupt/test24.json
  247. +0 −50 src/test/parallel+interrupt/test24.scxml
  248. +0 −35 src/test/parallel+interrupt/test25.json
  249. +0 −51 src/test/parallel+interrupt/test25.scxml
  250. +0 −36 src/test/parallel+interrupt/test26.json
  251. +0 −40 src/test/parallel+interrupt/test26.scxml
  252. +0 −36 src/test/parallel+interrupt/test27.json
  253. +0 −56 src/test/parallel+interrupt/test27.scxml
  254. +0 −36 src/test/parallel+interrupt/test28.json
  255. +0 −50 src/test/parallel+interrupt/test28.scxml
  256. +0 −36 src/test/parallel+interrupt/test29.json
  257. +0 −50 src/test/parallel+interrupt/test29.scxml
  258. +0 −13 src/test/parallel+interrupt/test3.json
  259. +0 −40 src/test/parallel+interrupt/test3.scxml
  260. +0 −36 src/test/parallel+interrupt/test30.json
  261. +0 −52 src/test/parallel+interrupt/test30.scxml
  262. +0 −36 src/test/parallel+interrupt/test31.json
  263. +0 −55 src/test/parallel+interrupt/test31.scxml
  264. +0 −14 src/test/parallel+interrupt/test4.json
  265. +0 −60 src/test/parallel+interrupt/test4.scxml
  266. +0 −15 src/test/parallel+interrupt/test5.json
  267. +0 −59 src/test/parallel+interrupt/test5.scxml
  268. +0 −16 src/test/parallel+interrupt/test6.json
  269. +0 −64 src/test/parallel+interrupt/test6.scxml
  270. +0 −17 src/test/parallel+interrupt/test7.json
  271. +0 −63 src/test/parallel+interrupt/test7.scxml
  272. +0 −18 src/test/parallel+interrupt/test8.json
  273. +0 −54 src/test/parallel+interrupt/test8.scxml
  274. +0 −19 src/test/parallel+interrupt/test9.json
  275. +0 −54 src/test/parallel+interrupt/test9.scxml
  276. +0 −7 src/test/parallel/test0.json
  277. +0 −36 src/test/parallel/test0.scxml
  278. +0 −13 src/test/parallel/test1.json
  279. +0 −56 src/test/parallel/test1.scxml
  280. +0 −14 src/test/parallel/test2.json
  281. +0 −68 src/test/parallel/test2.scxml
  282. +0 −15 src/test/parallel/test3.json
  283. +0 −77 src/test/parallel/test3.scxml
  284. +0 −12 src/test/script/test0.json
  285. +0 −45 src/test/script/test0.scxml
  286. +0 −12 src/test/script/test1.json
  287. +0 −51 src/test/script/test1.scxml
  288. +0 −13 src/test/script/test2.json
  289. +0 −71 src/test/script/test2.scxml
  290. +0 −13 src/test/scxml-prefix-event-name-matching/star0.json
  291. +0 −34 src/test/scxml-prefix-event-name-matching/star0.scxml
  292. +0 −40 src/test/scxml-prefix-event-name-matching/test0.json
  293. +0 −48 src/test/scxml-prefix-event-name-matching/test0.scxml
  294. +0 −41 src/test/scxml-prefix-event-name-matching/test1.json
  295. +0 −53 src/test/scxml-prefix-event-name-matching/test1.scxml
  296. +0 −14 src/test/send-data/send1.json
  297. +0 −57 src/test/send-data/send1.scxml
  298. +0 −12 src/test/targetless-transition/test0.json
  299. +0 −39 src/test/targetless-transition/test0.scxml
  300. +0 −17 src/test/targetless-transition/test1.json
Sorry, we could not display the entire diff because too many files (305) changed.
View
245 Makefile
@@ -1,245 +0,0 @@
-#variable declarations
-#sources
-coffescript-dir = src/main/coffeescript
-test-dir = src/test
-
-#targets
-build = target
-core = $(build)/core
-release = $(build)/release
-browser-release = $(release)/browser
-npm-release = $(release)/npm
-tests = $(build)/tests
-optimizations = $(tests)/optimizations
-loaders = $(tests)/loaders
-flattened-tests = $(tests)/flattened
-hier-tests = $(tests)/hier
-
-#this should be overridden when doing actual releases
-release-number = $(shell git rev-parse HEAD)
-#release stuff
-module-name = scion
-browser-release-module = $(browser-release)/$(module-name)-$(release-number).js
-#TODO: this isn't used yet
-npm-release-module = $(npm-release)/$(module-name)-$(release-number).tgz
-
-#these modules are significant for building other components, such as tests, etc.
-#TODO: use coffescript src names for these, and go through macro to convert them. More DRY
-annotate-scxml-json-module = $(core)/util/annotate-scxml-json.js
-runner-module = $(core)/runner.js
-beautify-module = $(lib)/beautify.js
-initializer-optimization-module = $(core)/optimization/initializer.js
-class-optimization-module = $(core)/optimization/class.js
-table-optimization-module = $(core)/optimization/state-table.js
-switch-optimization-module = $(core)/optimization/switch.js
-
-all : interpreter tests test-loader optimizations optimization-loaders
-
-#compile coffeescript
-coffeescript-src = $(shell find $(coffescript-dir))
-built-javascript-core = $(patsubst $(coffescript-dir)/%.coffee,$(core)/%.js, $(coffeescript-src))
-$(core)/%.js : $(coffescript-dir)/%.coffee
- mkdir -p $(dir $@)
- coffee -o $(dir $@) $<
-
-#copy over lib/js/*
-lib-src = lib/js
-lib-js-src = $(shell find $(lib-src)/*)
-lib = $(core)/lib
-lib-core = $(patsubst $(lib-src)/%,$(core)/lib/%, $(lib-js-src))
-
-#copy over lib/requirejs/*
-#these are core parts of requirejs which we depend on and need in order to build
-requirejs-lib-src = lib/requirejs
-requirejs-lib-js-src = $(shell find $(requirejs-lib-src)/* -name "*.js")
-requirejs-lib-core = $(patsubst $(requirejs-lib-src)/%,$(core)/%, $(requirejs-lib-js-src))
-
-#special requirejs module dependencies
-#we can't use patterns easily here, so we just copy over targets
-$(core)/logger.js : $(requirejs-lib-src)/logger.js
- mkdir -p $(dir $@)
- cp $< $@
-
-$(core)/browser/print.js : $(requirejs-lib-src)/browser/print.js
- mkdir -p $(dir $@)
- cp $< $@
-
-$(core)/env.js : $(requirejs-lib-src)/env.js
- mkdir -p $(dir $@)
- cp $< $@
-
-$(core)/node/print.js : $(requirejs-lib-src)/node/print.js
- mkdir -p $(dir $@)
- cp $< $@
-
-#copy over lib
-$(lib)/% : $(lib-src)/%
- mkdir -p $(dir $@)
- cp $< $@
-
-#build browser release module
-$(browser-release-module) : $(built-javascript-core) $(lib-core) $(requirejs-lib-core)
- mkdir -p $(dir $@)
- r.js -o name=util/browser/parseOnLoad out=$(browser-release-module) baseUrl=$(core)
-
-#npm package stuff
-
-#copy over core
-npm = $(build)/npm
-npm-core = $(npm)/$(core)
-npm-core-target = $(patsubst $(core)/%,$(npm-core)/%,$(built-javascript-core) $(lib-core) $(requirejs-lib-core))
-
-$(npm-core)/% : $(core)/%
- mkdir -p $(dir $@)
- cp $< $@
-
-#copy over relevant runner scripts
-npm-src-scripts = src/test-scripts/run-module.sh src/test-scripts/annotate-scxml-json.sh src/main/bash/util/scxml-to-json.sh
-npm-src-scripts-target = $(patsubst %.sh,$(npm)/%.sh,$(npm-src-scripts))
-
-$(npm)/%.sh : %.sh
- mkdir -p $(dir $@)
- cp $< $@
-
-#copy stuff to the root of the directory
-npm-package-json-src = src/npm/package.json
-npm-package-json-target = $(npm)/package.json
-
-$(npm-package-json-target) : $(npm-package-json-src)
- mkdir -p $(dir $@)
- cp $< $@
-
-#copy over lib
-#FIXME: lib should go over as-is in core, and get mapped using require.confg in runner.js
-#cp -r lib/ target/npm/
-lib-src-all = $(shell find lib/* -type f)
-npm-lib = $(npm)/lib
-npm-lib-target = $(patsubst lib/%,$(npm-lib)/%,$(lib-src-all))
-
-$(npm-lib)/% : lib/%
- mkdir -p $(dir $@)
- cp $< $@
-
-#generate tests
-scxml-test-src = $(shell find $(test-dir) -name "*.scxml")
-json-test-src = $(patsubst %.scxml,%.json,$(scxml-test-src))
-
-#generate json from scxml
-scxml-json-dir = $(tests)/scxml-json
-scxml-json-tests = $(patsubst $(test-dir)/%.scxml, $(scxml-json-dir)/%.json, $(scxml-test-src))
-$(scxml-json-dir)/%.json : $(test-dir)/%.scxml
- mkdir -p $(dir $@)
- ./src/main/bash/util/scxml-to-json.sh $< > $@
-
-#annotate it
-
-annotated-scxml-json-dir = $(tests)/annotated-scxml-json
-annotated-scxml-json-tests = $(patsubst $(scxml-json-dir)/%.json,$(annotated-scxml-json-dir)/%.json,$(scxml-json-tests))
-$(annotated-scxml-json-dir)/%.json : $(tests)/scxml-json/%.json $(annotate-scxml-json-module) $(runner-module)
- mkdir -p $(dir $@)
- ./src/test-scripts/run-module-node.sh util/annotate-scxml-json $< $@
-
-#annotated-scxml-json-tests : $(annotated-scxml-json-tests)
-
-#combine it with the json test script
-#in this task, $^ are all the dependencies, second arg is the test name, third arg is the test group name
-combined-script-and-annotated-scxml-json-dir = $(tests)/combined-script-and-annotated-scxml-json-test
-combined-script-and-annotated-scxml-json-test = $(patsubst $(annotated-scxml-json-dir)/%.json,$(combined-script-and-annotated-scxml-json-dir)/%.js,$(annotated-scxml-json-tests))
-$(combined-script-and-annotated-scxml-json-dir)/%.js : $(annotated-scxml-json-dir)/%.json $(test-dir)/%.json
- mkdir -p $(dir $@)
- ./src/main/bash/build/generate-requirejs-json-test-tuples.sh $^ "$(basename $(notdir $<))" "$(notdir $(shell dirname $<))" > $@
-
-#generate spartan loader
-generate-test-loader-module-script = src/main/bash/build/generate-requirejs-test-loader-module.sh
-$(loaders)/spartan-loader-for-all-tests.js :
- mkdir -p $(dir $@)
- $(generate-test-loader-module-script) $@ $(combined-script-and-annotated-scxml-json-test)
-
-#generate optimizations
-transition-selector = $(optimizations)/transition-selector
-
-#class, switch, and table transition selectors
-class-transition-selector = $(patsubst $(annotated-scxml-json-dir)/%.json,$(transition-selector)/%.class.js,$(annotated-scxml-json-tests))
-switch-transition-selector = $(patsubst $(annotated-scxml-json-dir)/%.json,$(transition-selector)/%.switch.js,$(annotated-scxml-json-tests))
-table-transition-selector = $(patsubst $(annotated-scxml-json-dir)/%.json,$(transition-selector)/%.table.js,$(annotated-scxml-json-tests))
-
-$(transition-selector)/%.class.js : $(annotated-scxml-json-dir)/%.json $(runner-module) $(beautify-module) $(initializer-optimization-module) $(class-optimization-module)
- mkdir -p $(dir $@)
- ./src/test-scripts/run-module-node.sh optimization/transition-optimizer $< class true true > $@
-
-$(transition-selector)/%.switch.js : $(annotated-scxml-json-dir)/%.json $(runner-module) $(beautify-module) $(initializer-optimization-module) $(switch-optimization-module)
- mkdir -p $(dir $@)
- ./src/test-scripts/run-module-node.sh optimization/transition-optimizer $< switch true true > $@
-
-$(transition-selector)/%.table.js : $(annotated-scxml-json-dir)/%.json $(runner-module) $(beautify-module) $(initializer-optimization-module) $(table-optimization-module)
- mkdir -p $(dir $@)
- ./src/test-scripts/run-module-node.sh optimization/transition-optimizer $< table true true > $@
-
-
-generate-array-test-loader-module-script = src/main/bash/build/generate-requirejs-array-test-loader-module.sh
-
-#generate optimization loader modules
-$(loaders)/class-transition-lookup-optimization-loader.js :
- mkdir -p $(dir $@)
- $(generate-test-loader-module-script) $@ $(class-transition-selector)
-
-$(loaders)/table-transition-lookup-optimization-loader.js :
- mkdir -p $(dir $@)
- $(generate-test-loader-module-script) $@ $(table-transition-selector)
-
-$(loaders)/switch-transition-lookup-optimization-loader.js :
- mkdir -p $(dir $@)
- $(generate-test-loader-module-script) $@ $(switch-transition-selector)
-
-$(loaders)/class-transition-lookup-optimization-array-loader.js :
- mkdir -p $(dir $@)
- $(generate-array-test-loader-module-script) $@ $(class-transition-selector)
-
-$(loaders)/table-transition-lookup-optimization-array-loader.js :
- mkdir -p $(dir $@)
- $(generate-array-test-loader-module-script) $@ $(table-transition-selector)
-
-$(loaders)/switch-transition-lookup-optimization-array-loader.js :
- mkdir -p $(dir $@)
- $(generate-array-test-loader-module-script) $@ $(switch-transition-selector)
-
-
-#top-level tasks
-#TODO: node module
-#TODO: flattened test modules
-#TODO: all test modules
-
-#interpreter
-interpreter : $(built-javascript-core) $(lib-core)
-
-#amd module
-browser-release : $(browser-release-module)
-
-#npm package
-npm-package : $(npm-core-target) $(npm-src-scripts-target) $(npm-package-json-target) $(npm-lib-target)
-
-#test modules
-tests : $(combined-script-and-annotated-scxml-json-test)
-
-#test-loader (with/without flattened test modules)
-test-loader : $(loaders)/spartan-loader-for-all-tests.js
-
-#optimizations
-optimizations : $(class-transition-selector) $(table-transition-selector) $(switch-transition-selector)
-
-#optimization-loaders (with/without flattened test modules)
-optimization-loaders : $(loaders)/class-transition-lookup-optimization-loader.js $(loaders)/table-transition-lookup-optimization-loader.js $(loaders)/switch-transition-lookup-optimization-loader.js $(loaders)/class-transition-lookup-optimization-array-loader.js $(loaders)/table-transition-lookup-optimization-array-loader.js $(loaders)/switch-transition-lookup-optimization-array-loader.js
-
-get-deps :
- npm install -g coffee requirejs
-
-
-foo :
- echo $(npm-src-scripts-target)
-
-clean :
- rm -rf $(build)
-
-
-.SECONDARY : $(scxml-json-tests) $(annotated-scxml-json-tests)
-.PHONY : interpreter browser-release npm-package tests optimzations test-loader optimization-loaders get-deps clean foo
View
0 src/demo/drag-and-drop/drag-and-drop.xhtml → demo/drag-and-drop/drag-and-drop.xhtml
File renamed without changes.
View
0 src/demo/drag-and-drop/drag-and-drop2.xhtml → demo/drag-and-drop/drag-and-drop2.xhtml
File renamed without changes.
View
0 src/demo/drag-and-drop/drag-and-drop2.xml → demo/drag-and-drop/drag-and-drop2.xml
File renamed without changes.
View
0 src/demo/drawing-tool/behaviour/canvas.xml → demo/drawing-tool/behaviour/canvas.xml
File renamed without changes.
View
0 src/demo/drawing-tool/drawing-tool.html → demo/drawing-tool/drawing-tool.html
File renamed without changes.
View
0 src/demo/drawing-tool/lib/jquery-1.7.min.js → demo/drawing-tool/lib/jquery-1.7.min.js
File renamed without changes.
View
0 src/demo/drawing-tool/lib/jquery.svg.css → demo/drawing-tool/lib/jquery.svg.css
File renamed without changes.
View
0 src/demo/drawing-tool/lib/jquery.svg.js → demo/drawing-tool/lib/jquery.svg.js
File renamed without changes.
View
0 src/demo/drawing-tool/lib/jquery.svgdom.js → demo/drawing-tool/lib/jquery.svgdom.js
File renamed without changes.
View
0 src/demo/drawing-tool/transform.js → demo/drawing-tool/transform.js
File renamed without changes.
View
0 src/demo/node-repl/README.md → demo/node-repl/README.md
File renamed without changes.
View
0 src/demo/node-repl/repl.js → demo/node-repl/repl.js
File renamed without changes.
View
0 src/demo/node-repl/repl.sh → demo/node-repl/repl.sh
File renamed without changes.
View
0 src/demo/node-web-repl/README.md → demo/node-web-repl/README.md
File renamed without changes.
View
0 src/demo/node-web-repl/repl.js → demo/node-web-repl/repl.js
File renamed without changes.
View
0 src/demo/node-web-repl/repl.sh → demo/node-web-repl/repl.sh
File renamed without changes.
View
0 src/demo/nodejs/basic1.scxml → demo/nodejs/basic1.scxml
File renamed without changes.
View
0 src/demo/nodejs/test.js → demo/nodejs/test.js
File renamed without changes.
View
0 src/demo/nodejs/test.sh → demo/nodejs/test.sh
File renamed without changes.
View
207 lib/js/JsonML_DOM.js
@@ -1,207 +0,0 @@
-/*
- JsonML_DOM.js
- DOM to JsonML utility
-
- Created: 2007-02-15-2235
- Modified: 2008-08-31-2206
-
- Copyright (c)2006-2009 Stephen M. McKamey
- Distributed under an open-source license: http://jsonml.org/license
-*/
-define(function(){
-
-var JsonML = {};
-
-/*JsonML*/ JsonML.parseDOM = function(/*DOM*/ elem, /*function*/ filter) {
- if (!elem || !elem.nodeType) {
- // free references
- return (elem = null);
- }
-
- function addChildren(/*DOM*/ elem, /*function*/ filter, /*JsonML*/ jml) {
- if (elem.hasChildNodes()) {
- for (var i=0; i<elem.childNodes.length; i++) {
- var child = elem.childNodes[i];
- child = JsonML.parseDOM(child, filter);
- if (child) {
- jml.push(child);
- }
- }
- return true;
- }
- return false;
- }
-
- var i, jml;
- switch (elem.nodeType) {
- case 1: // element
- case 9: // document
- case 11: // documentFragment
- jml = [elem.tagName||""];
-
- var attr = elem.attributes,
- props = {},
- hasAttrib = false;
-
- for (i=0; attr && i<attr.length; i++) {
- if (attr[i].specified) {
- if (attr[i].name === "style") {
- props.style = elem.style.cssText || attr[i].value;
- } else if ("string" === typeof attr[i].value) {
- props[attr[i].name] = attr[i].value;
- }
- hasAttrib = true;
- }
- }
- if (hasAttrib) {
- jml.push(props);
- }
-
- var child;
- switch (jml[0].toLowerCase()) {
- case "frame":
- case "iframe":
- try {
- if ("undefined" !== typeof elem.contentDocument) {
- // W3C
- child = elem.contentDocument;
- } else if ("undefined" !== typeof elem.contentWindow) {
- // Microsoft
- child = elem.contentWindow.document;
- } else if ("undefined" !== typeof elem.document) {
- // deprecated
- child = elem.document;
- }
-
- child = JsonML.parseDOM(child, filter);
- if (child) {
- jml.push(child);
- }
- } catch (ex) {}
- break;
- case "style":
- child = elem.styleSheet && elem.styleSheet.cssText;
- if (child && "string" === typeof child) {
- // unwrap comment blocks
- child = child.replace("<!--", "").replace("-->", "");
- jml.push(child);
- } else if (elem.hasChildNodes()) {
- for (i=0; i<elem.childNodes.length; i++) {
- child = elem.childNodes[i];
- child = JsonML.parseDOM(child, filter);
- if (child && "string" === typeof child) {
- // unwrap comment blocks
- child = child.replace("<!--", "").replace("-->", "");
- jml.push(child);
- }
- }
- }
- break;
- case "input":
- addChildren(elem, filter, jml);
- child = (elem.type !== "password") && elem.value;
- if (child) {
- if (!hasAttrib) {
- // need to add an attribute object
- jml.shift();
- props = {};
- jml.unshift(props);
- jml.unshift(elem.tagName||"");
- }
- props.value = child;
- }
- break;
- case "textarea":
- if (!addChildren(elem, filter, jml)) {
- child = elem.value || elem.innerHTML;
- if (child && "string" === typeof child) {
- jml.push(child);
- }
- }
- break;
- default:
- addChildren(elem, filter, jml);
- break;
- }
-
- // filter result
- if ("function" === typeof filter) {
- jml = filter(jml, elem);
- }
-
- // free references
- elem = null;
- return jml;
- case 3: // text node
- case 4: // CDATA node
- var str = String(elem.nodeValue);
- // free references
- elem = null;
- return str;
- case 10: // doctype
- jml = ["!"];
-
- var type = ["DOCTYPE", (elem.name || "html").toLowerCase()];
-
- if (elem.publicId) {
- type.push("PUBLIC", '"' + elem.publicId + '"');
- }
-
- if (elem.systemId) {
- type.push('"' + elem.systemId + '"');
- }
-
- jml.push(type.join(" "));
-
- // filter result
- if ("function" === typeof filter) {
- jml = filter(jml, elem);
- }
-
- // free references
- elem = null;
- return jml;
- case 8: // comment node
- if ((elem.nodeValue||"").indexOf("DOCTYPE") !== 0) {
- // free references
- elem = null;
- return null;
- }
-
- jml = ["!",
- elem.nodeValue];
-
- // filter result
- if ("function" === typeof filter) {
- jml = filter(jml, elem);
- }
-
- // free references
- elem = null;
- return jml;
- default: // etc.
- // free references
- return (elem = null);
- }
-};
-
-/*JsonML*/ JsonML.parseHTML = function(/*string*/ html, /*function*/ filter) {
- var elem = document.createElement("div");
- elem.innerHTML = html;
- var jml = JsonML.parseDOM(elem, filter);
-
- // free references
- elem = null;
-
- if (jml.length === 2) {
- return jml[1];
- }
-
- // make wrapper a document fragment
- jml[0] = "";
- return jml;
-};
-
-return JsonML;
-
-});
View
1,177 lib/js/beautify.js
@@ -1,1177 +0,0 @@
-/*jslint onevar: false, plusplus: false */
-/*
-
- JS Beautifier
----------------
-
-
- Written by Einar Lielmanis, <einar@jsbeautifier.org>
- http://jsbeautifier.org/
-
- Originally converted to javascript by Vital, <vital76@gmail.com>
- "End braces on own line" added by Chris J. Shull, <chrisjshull@gmail.com>
-
- You are free to use this in any way you want, in case you find this useful or working for you.
-
- Usage:
- js_beautify(js_source_text);
- js_beautify(js_source_text, options);
-
- The options are:
- indent_size (default 4) — indentation size,
- indent_char (default space) — character to indent with,
- preserve_newlines (default true) — whether existing line breaks should be preserved,
- preserve_max_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk,
- indent_level (default 0) — initial indentation level, you probably won't need this ever,
-
- jslint_happy (default false) — if true, then jslint-stricter mode is enforced.
-
- jslint_happy !jslint_happy
- ---------------------------------
- function () function()
-
- brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
- put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
-
- e.g
-
- js_beautify(js_source_text, {
- 'indent_size': 1,
- 'indent_char': '\t'
- });
-
-
-*/
-
-
-define(function(){
-
-function js_beautify(js_source_text, options) {
-
- var input, output, token_text, last_type, last_text, last_last_text, last_word, flags, flag_store, indent_string;
- var whitespace, wordchar, punct, parser_pos, line_starters, digits;
- var prefix, token_type, do_block_just_closed;
- var wanted_newline, just_added_newline, n_newlines;
-
-
- // Some interpreters have unexpected results with foo = baz || bar;
- options = options ? options : {};
-
- var opt_brace_style;
-
- // compatibility
- if (options.space_after_anon_function !== undefined && options.jslint_happy === undefined) {
- options.jslint_happy = options.space_after_anon_function;
- }
- if (options.braces_on_own_line !== undefined) { //graceful handling of depricated option
- opt_brace_style = options.braces_on_own_line ? "expand" : "collapse";
- }
- opt_brace_style = options.brace_style ? options.brace_style : (opt_brace_style ? opt_brace_style : "collapse");
-
-
- var opt_indent_size = options.indent_size ? options.indent_size : 4;
- var opt_indent_char = options.indent_char ? options.indent_char : ' ';
- var opt_preserve_newlines = typeof options.preserve_newlines === 'undefined' ? true : options.preserve_newlines;
- var opt_max_preserve_newlines = typeof options.max_preserve_newlines === 'undefined' ? false : options.max_preserve_newlines;
- var opt_indent_level = options.indent_level ? options.indent_level : 0; // starting indentation
- var opt_jslint_happy = options.jslint_happy === 'undefined' ? false : options.jslint_happy;
- var opt_keep_array_indentation = typeof options.keep_array_indentation === 'undefined' ? false : options.keep_array_indentation;
-
- just_added_newline = false;
-
- // cache the source's length.
- var input_length = js_source_text.length;
-
- function trim_output(eat_newlines) {
- eat_newlines = typeof eat_newlines === 'undefined' ? false : eat_newlines;
- while (output.length && (output[output.length - 1] === ' '
- || output[output.length - 1] === indent_string
- || (eat_newlines && (output[output.length - 1] === '\n' || output[output.length - 1] === '\r')))) {
- output.pop();
- }
- }
-
- function trim(s) {
- return s.replace(/^\s\s*|\s\s*$/, '');
- }
-
- function force_newline()
- {
- var old_keep_array_indentation = opt_keep_array_indentation;
- opt_keep_array_indentation = false;
- print_newline()
- opt_keep_array_indentation = old_keep_array_indentation;
- }
-
- function print_newline(ignore_repeated) {
-
- flags.eat_next_space = false;
- if (opt_keep_array_indentation && is_array(flags.mode)) {
- return;
- }
-
- ignore_repeated = typeof ignore_repeated === 'undefined' ? true : ignore_repeated;
-
- flags.if_line = false;
- trim_output();
-
- if (!output.length) {
- return; // no newline on start of file
- }
-
- if (output[output.length - 1] !== "\n" || !ignore_repeated) {
- just_added_newline = true;
- output.push("\n");
- }
- for (var i = 0; i < flags.indentation_level + opt_indent_level; i += 1) {
- output.push(indent_string);
- }
- if (flags.var_line && flags.var_line_reindented) {
- if (opt_indent_char === ' ') {
- output.push(' '); // var_line always pushes 4 spaces, so that the variables would be one under another
- } else {
- output.push(indent_string); // skip space-stuffing, if indenting with a tab
- }
- }
- }
-
-
-
- function print_single_space() {
- if (flags.eat_next_space) {
- flags.eat_next_space = false;
- return;
- }
- var last_output = ' ';
- if (output.length) {
- last_output = output[output.length - 1];
- }
- if (last_output !== ' ' && last_output !== '\n' && last_output !== indent_string) { // prevent occassional duplicate space
- output.push(' ');
- }
- }
-
-
- function print_token() {
- just_added_newline = false;
- flags.eat_next_space = false;
- output.push(token_text);
- }
-
- function indent() {
- flags.indentation_level += 1;
- }
-
-
- function remove_indent() {
- if (output.length && output[output.length - 1] === indent_string) {
- output.pop();
- }
- }
-
- function set_mode(mode) {
- if (flags) {
- flag_store.push(flags);
- }
- flags = {
- previous_mode: flags ? flags.mode : 'BLOCK',
- mode: mode,
- var_line: false,
- var_line_tainted: false,
- var_line_reindented: false,
- in_html_comment: false,
- if_line: false,
- in_case: false,
- eat_next_space: false,
- indentation_baseline: -1,
- indentation_level: (flags ? flags.indentation_level + ((flags.var_line && flags.var_line_reindented) ? 1 : 0) : 0),
- ternary_depth: 0
- };
- }
-
- function is_array(mode) {
- return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]';
- }
-
- function is_expression(mode) {
- return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]' || mode === '(EXPRESSION)';
- }
-
- function restore_mode() {
- do_block_just_closed = flags.mode === 'DO_BLOCK';
- if (flag_store.length > 0) {
- flags = flag_store.pop();
- }
- }
-
- function all_lines_start_with(lines, c) {
- for (var i = 0; i < lines.length; i++) {
- if (trim(lines[i])[0] != c) {
- return false;
- }
- }
- return true;
- }
-
- function in_array(what, arr) {
- for (var i = 0; i < arr.length; i += 1) {
- if (arr[i] === what) {
- return true;
- }
- }
- return false;
- }
-
- function get_next_token() {
- n_newlines = 0;
-
- if (parser_pos >= input_length) {
- return ['', 'TK_EOF'];
- }
-
- wanted_newline = false;
-
- var c = input.charAt(parser_pos);
- parser_pos += 1;
-
-
- var keep_whitespace = opt_keep_array_indentation && is_array(flags.mode);
-
- if (keep_whitespace) {
-
- //
- // slight mess to allow nice preservation of array indentation and reindent that correctly
- // first time when we get to the arrays:
- // var a = [
- // ....'something'
- // we make note of whitespace_count = 4 into flags.indentation_baseline
- // so we know that 4 whitespaces in original source match indent_level of reindented source
- //
- // and afterwards, when we get to
- // 'something,
- // .......'something else'
- // we know that this should be indented to indent_level + (7 - indentation_baseline) spaces
- //
- var whitespace_count = 0;
-
- while (in_array(c, whitespace)) {
-
- if (c === "\n") {
- trim_output();
- output.push("\n");
- just_added_newline = true;
- whitespace_count = 0;
- } else {
- if (c === '\t') {
- whitespace_count += 4;
- } else if (c === '\r') {
- // nothing
- } else {
- whitespace_count += 1;
- }
- }
-
- if (parser_pos >= input_length) {
- return ['', 'TK_EOF'];
- }
-
- c = input.charAt(parser_pos);
- parser_pos += 1;
-
- }
- if (flags.indentation_baseline === -1) {
- flags.indentation_baseline = whitespace_count;
- }
-
- if (just_added_newline) {
- var i;
- for (i = 0; i < flags.indentation_level + 1; i += 1) {
- output.push(indent_string);
- }
- if (flags.indentation_baseline !== -1) {
- for (i = 0; i < whitespace_count - flags.indentation_baseline; i++) {
- output.push(' ');
- }
- }
- }
-
- } else {
- while (in_array(c, whitespace)) {
-
- if (c === "\n") {
- n_newlines += ( (opt_max_preserve_newlines) ? (n_newlines <= opt_max_preserve_newlines) ? 1: 0: 1 );
- }
-
-
- if (parser_pos >= input_length) {
- return ['', 'TK_EOF'];
- }
-
- c = input.charAt(parser_pos);
- parser_pos += 1;
-
- }
-
- if (opt_preserve_newlines) {
- if (n_newlines > 1) {
- for (i = 0; i < n_newlines; i += 1) {
- print_newline(i === 0);
- just_added_newline = true;
- }
- }
- }
- wanted_newline = n_newlines > 0;
- }
-
-
- if (in_array(c, wordchar)) {
- if (parser_pos < input_length) {
- while (in_array(input.charAt(parser_pos), wordchar)) {
- c += input.charAt(parser_pos);
- parser_pos += 1;
- if (parser_pos === input_length) {
- break;
- }
- }
- }
-
- // small and surprisingly unugly hack for 1E-10 representation
- if (parser_pos !== input_length && c.match(/^[0-9]+[Ee]$/) && (input.charAt(parser_pos) === '-' || input.charAt(parser_pos) === '+')) {
-
- var sign = input.charAt(parser_pos);
- parser_pos += 1;
-
- var t = get_next_token(parser_pos);
- c += sign + t[0];
- return [c, 'TK_WORD'];
- }
-
- if (c === 'in') { // hack for 'in' operator
- return [c, 'TK_OPERATOR'];
- }
- if (wanted_newline && last_type !== 'TK_OPERATOR'
- && last_type !== 'TK_EQUALS'
- && !flags.if_line && (opt_preserve_newlines || last_text !== 'var')) {
- print_newline();
- }
- return [c, 'TK_WORD'];
- }
-
- if (c === '(' || c === '[') {
- return [c, 'TK_START_EXPR'];
- }
-
- if (c === ')' || c === ']') {
- return [c, 'TK_END_EXPR'];
- }
-
- if (c === '{') {
- return [c, 'TK_START_BLOCK'];
- }
-
- if (c === '}') {
- return [c, 'TK_END_BLOCK'];
- }
-
- if (c === ';') {
- return [c, 'TK_SEMICOLON'];
- }
-
- if (c === '/') {
- var comment = '';
- // peek for comment /* ... */
- var inline_comment = true;
- if (input.charAt(parser_pos) === '*') {
- parser_pos += 1;
- if (parser_pos < input_length) {
- while (! (input.charAt(parser_pos) === '*' && input.charAt(parser_pos + 1) && input.charAt(parser_pos + 1) === '/') && parser_pos < input_length) {
- c = input.charAt(parser_pos);
- comment += c;
- if (c === '\x0d' || c === '\x0a') {
- inline_comment = false;
- }
- parser_pos += 1;
- if (parser_pos >= input_length) {
- break;
- }
- }
- }
- parser_pos += 2;
- if (inline_comment) {
- return ['/*' + comment + '*/', 'TK_INLINE_COMMENT'];
- } else {
- return ['/*' + comment + '*/', 'TK_BLOCK_COMMENT'];
- }
- }
- // peek for comment // ...
- if (input.charAt(parser_pos) === '/') {
- comment = c;
- while (input.charAt(parser_pos) !== '\r' && input.charAt(parser_pos) !== '\n') {
- comment += input.charAt(parser_pos);
- parser_pos += 1;
- if (parser_pos >= input_length) {
- break;
- }
- }
- parser_pos += 1;
- if (wanted_newline) {
- print_newline();
- }
- return [comment, 'TK_COMMENT'];
- }
-
- }
-
- if (c === "'" || // string
- c === '"' || // string
- (c === '/' &&
- ((last_type === 'TK_WORD' && in_array(last_text, ['return', 'do'])) ||
- (last_type === 'TK_COMMENT' || last_type === 'TK_START_EXPR' || last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_OPERATOR' || last_type === 'TK_EQUALS' || last_type === 'TK_EOF' || last_type === 'TK_SEMICOLON')))) { // regexp
- var sep = c;
- var esc = false;
- var resulting_string = c;
-
- if (parser_pos < input_length) {
- if (sep === '/') {
- //
- // handle regexp separately...
- //
- var in_char_class = false;
- while (esc || in_char_class || input.charAt(parser_pos) !== sep) {
- resulting_string += input.charAt(parser_pos);
- if (!esc) {
- esc = input.charAt(parser_pos) === '\\';
- if (input.charAt(parser_pos) === '[') {
- in_char_class = true;
- } else if (input.charAt(parser_pos) === ']') {
- in_char_class = false;
- }
- } else {
- esc = false;
- }
- parser_pos += 1;
- if (parser_pos >= input_length) {
- // incomplete string/rexp when end-of-file reached.
- // bail out with what had been received so far.
- return [resulting_string, 'TK_STRING'];
- }
- }
-
- } else {
- //
- // and handle string also separately
- //
- while (esc || input.charAt(parser_pos) !== sep) {
- resulting_string += input.charAt(parser_pos);
- if (!esc) {
- esc = input.charAt(parser_pos) === '\\';
- } else {
- esc = false;
- }
- parser_pos += 1;
- if (parser_pos >= input_length) {
- // incomplete string/rexp when end-of-file reached.
- // bail out with what had been received so far.
- return [resulting_string, 'TK_STRING'];
- }
- }
- }
-
-
-
- }
-
- parser_pos += 1;
-
- resulting_string += sep;
-
- if (sep === '/') {
- // regexps may have modifiers /regexp/MOD , so fetch those, too
- while (parser_pos < input_length && in_array(input.charAt(parser_pos), wordchar)) {
- resulting_string += input.charAt(parser_pos);
- parser_pos += 1;
- }
- }
- return [resulting_string, 'TK_STRING'];
- }
-
- if (c === '#') {
-
-
- if (output.length === 0 && input.charAt(parser_pos) === '!') {
- // shebang
- resulting_string = c;
- while (parser_pos < input_length && c != '\n') {
- c = input.charAt(parser_pos);
- resulting_string += c;
- parser_pos += 1;
- }
- output.push(trim(resulting_string) + '\n');
- print_newline();
- return get_next_token();
- }
-
-
-
- // Spidermonkey-specific sharp variables for circular references
- // https://developer.mozilla.org/En/Sharp_variables_in_JavaScript
- // http://mxr.mozilla.org/mozilla-central/source/js/src/jsscan.cpp around line 1935
- var sharp = '#';
- if (parser_pos < input_length && in_array(input.charAt(parser_pos), digits)) {
- do {
- c = input.charAt(parser_pos);
- sharp += c;
- parser_pos += 1;
- } while (parser_pos < input_length && c !== '#' && c !== '=');
- if (c === '#') {
- //
- } else if (input.charAt(parser_pos) === '[' && input.charAt(parser_pos + 1) === ']') {
- sharp += '[]';
- parser_pos += 2;
- } else if (input.charAt(parser_pos) === '{' && input.charAt(parser_pos + 1) === '}') {
- sharp += '{}';
- parser_pos += 2;
- }
- return [sharp, 'TK_WORD'];
- }
- }
-
- if (c === '<' && input.substring(parser_pos - 1, parser_pos + 3) === '<!--') {
- parser_pos += 3;
- flags.in_html_comment = true;
- return ['<!--', 'TK_COMMENT'];
- }
-
- if (c === '-' && flags.in_html_comment && input.substring(parser_pos - 1, parser_pos + 2) === '-->') {
- flags.in_html_comment = false;
- parser_pos += 2;
- if (wanted_newline) {
- print_newline();
- }
- return ['-->', 'TK_COMMENT'];
- }
-
- if (in_array(c, punct)) {
- while (parser_pos < input_length && in_array(c + input.charAt(parser_pos), punct)) {
- c += input.charAt(parser_pos);
- parser_pos += 1;
- if (parser_pos >= input_length) {
- break;
- }
- }
-
- if (c === '=') {
- return [c, 'TK_EQUALS'];
- } else {
- return [c, 'TK_OPERATOR'];
- }
- }
-
- return [c, 'TK_UNKNOWN'];
- }
-
- //----------------------------------
- indent_string = '';
- while (opt_indent_size > 0) {
- indent_string += opt_indent_char;
- opt_indent_size -= 1;
- }
-
- input = js_source_text;
-
- last_word = ''; // last 'TK_WORD' passed
- last_type = 'TK_START_EXPR'; // last token type
- last_text = ''; // last token text
- last_last_text = ''; // pre-last token text
- output = [];
-
- do_block_just_closed = false;
-
- whitespace = "\n\r\t ".split('');
- wordchar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'.split('');
- digits = '0123456789'.split('');
-
- punct = '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::'.split(' ');
-
- // words which should always start on new line.
- line_starters = 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function'.split(',');
-
- // states showing if we are currently in expression (i.e. "if" case) - 'EXPRESSION', or in usual block (like, procedure), 'BLOCK'.
- // some formatting depends on that.
- flag_store = [];
- set_mode('BLOCK');
-
- parser_pos = 0;
- while (true) {
- var t = get_next_token(parser_pos);
- token_text = t[0];
- token_type = t[1];
- if (token_type === 'TK_EOF') {
- break;
- }
-
- switch (token_type) {
-
- case 'TK_START_EXPR':
-
- if (token_text === '[') {
-
- if (last_type === 'TK_WORD' || last_text === ')') {
- // this is array index specifier, break immediately
- // a[x], fn()[x]
- if (in_array(last_text, line_starters)) {
- print_single_space();
- }
- set_mode('(EXPRESSION)');
- print_token();
- break;
- }
-
- if (flags.mode === '[EXPRESSION]' || flags.mode === '[INDENTED-EXPRESSION]') {
- if (last_last_text === ']' && last_text === ',') {
- // ], [ goes to new line
- if (flags.mode === '[EXPRESSION]') {
- flags.mode = '[INDENTED-EXPRESSION]';
- if (!opt_keep_array_indentation) {
- indent();
- }
- }
- set_mode('[EXPRESSION]');
- if (!opt_keep_array_indentation) {
- print_newline();
- }
- } else if (last_text === '[') {
- if (flags.mode === '[EXPRESSION]') {
- flags.mode = '[INDENTED-EXPRESSION]';
- if (!opt_keep_array_indentation) {
- indent();
- }
- }
- set_mode('[EXPRESSION]');
-
- if (!opt_keep_array_indentation) {
- print_newline();
- }
- } else {
- set_mode('[EXPRESSION]');
- }
- } else {
- set_mode('[EXPRESSION]');
- }
-
-
-
- } else {
- set_mode('(EXPRESSION)');
- }
-
- if (last_text === ';' || last_type === 'TK_START_BLOCK') {
- print_newline();
- } else if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK' || last_text === '.') {
- // do nothing on (( and )( and ][ and ]( and .(
- } else if (last_type !== 'TK_WORD' && last_type !== 'TK_OPERATOR') {
- print_single_space();
- } else if (last_word === 'function' || last_word === 'typeof') {
- // function() vs function ()
- if (opt_jslint_happy) {
- print_single_space();
- }
- } else if (in_array(last_text, line_starters) || last_text === 'catch') {
- print_single_space();
- }
- print_token();
-
- break;
-
- case 'TK_END_EXPR':
- if (token_text === ']') {
- if (opt_keep_array_indentation) {
- if (last_text === '}') {
- // trim_output();
- // print_newline(true);
- remove_indent();
- print_token();
- restore_mode();
- break;
- }
- } else {
- if (flags.mode === '[INDENTED-EXPRESSION]') {
- if (last_text === ']') {
- restore_mode();
- print_newline();
- print_token();
- break;
- }
- }
- }
- }
- restore_mode();
- print_token();
- break;
-
- case 'TK_START_BLOCK':
-
- if (last_word === 'do') {
- set_mode('DO_BLOCK');
- } else {
- set_mode('BLOCK');
- }
- if (opt_brace_style=="expand") {
- if (last_type !== 'TK_OPERATOR') {
- if (last_text === 'return' || last_text === '=') {
- print_single_space();
- } else {
- print_newline(true);
- }
- }
- print_token();
- indent();
- } else {
- if (last_type !== 'TK_OPERATOR' && last_type !== 'TK_START_EXPR') {
- if (last_type === 'TK_START_BLOCK') {
- print_newline();
- } else {
- print_single_space();
- }
- } else {
- // if TK_OPERATOR or TK_START_EXPR
- if (is_array(flags.previous_mode) && last_text === ',') {
- if (last_last_text === '}') {
- // }, { in array context
- print_single_space();
- } else {
- print_newline(); // [a, b, c, {
- }
- }
- }
- indent();
- print_token();
- }
-
- break;
-
- case 'TK_END_BLOCK':
- restore_mode();
- if (opt_brace_style=="expand") {
- if (last_text !== '{') {
- print_newline();
- }
- print_token();
- } else {
- if (last_type === 'TK_START_BLOCK') {
- // nothing
- if (just_added_newline) {
- remove_indent();
- } else {
- // {}
- trim_output();
- }
- } else {
- if (is_array(flags.mode) && opt_keep_array_indentation) {
- // we REALLY need a newline here, but newliner would skip that
- opt_keep_array_indentation = false;
- print_newline();
- opt_keep_array_indentation = true;
-
- } else {
- print_newline();
- }
- }
- print_token();
- }
- break;
-
- case 'TK_WORD':
-
- // no, it's not you. even I have problems understanding how this works
- // and what does what.
- if (do_block_just_closed) {
- // do {} ## while ()
- print_single_space();
- print_token();
- print_single_space();
- do_block_just_closed = false;
- break;
- }
-
- if (token_text === 'function') {
- if (flags.var_line) {
- flags.var_line_reindented = true;
- }
- if ((just_added_newline || last_text === ';') && last_text !== '{') {
- // make sure there is a nice clean space of at least one blank line
- // before a new function definition
- n_newlines = just_added_newline ? n_newlines : 0;
- if ( ! opt_preserve_newlines) {
- n_newlines = 1;
- }
-
- for (var i = 0; i < 2 - n_newlines; i++) {
- print_newline(false);
- }
- }
- }
-
- if (token_text === 'case' || token_text === 'default') {
- if (last_text === ':') {
- // switch cases following one another
- remove_indent();
- } else {
- // case statement starts in the same line where switch
- flags.indentation_level--;
- print_newline();
- flags.indentation_level++;
- }
- print_token();
- flags.in_case = true;
- break;
- }
-
- prefix = 'NONE';
-
- if (last_type === 'TK_END_BLOCK') {
-
- if (!in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) {
- prefix = 'NEWLINE';
- } else {
- if (opt_brace_style=="expand" || opt_brace_style=="end-expand") {
- prefix = 'NEWLINE';
- } else {
- prefix = 'SPACE';
- print_single_space();
- }
- }
- } else if (last_type === 'TK_SEMICOLON' && (flags.mode === 'BLOCK' || flags.mode === 'DO_BLOCK')) {
- prefix = 'NEWLINE';
- } else if (last_type === 'TK_SEMICOLON' && is_expression(flags.mode)) {
- prefix = 'SPACE';
- } else if (last_type === 'TK_STRING') {
- prefix = 'NEWLINE';
- } else if (last_type === 'TK_WORD') {
- if (last_text === 'else') {
- // eat newlines between ...else *** some_op...
- // won't preserve extra newlines in this place (if any), but don't care that much
- trim_output(true);
- }
- prefix = 'SPACE';
- } else if (last_type === 'TK_START_BLOCK') {
- prefix = 'NEWLINE';
- } else if (last_type === 'TK_END_EXPR') {
- print_single_space();
- prefix = 'NEWLINE';
- }
-
- if (in_array(token_text, line_starters) && last_text !== ')') {
- if (last_text == 'else') {
- prefix = 'SPACE';
- } else {
- prefix = 'NEWLINE';
- }
- }
-
- if (flags.if_line && last_type === 'TK_END_EXPR') {
- flags.if_line = false;
- }
- if (in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) {
- if (last_type !== 'TK_END_BLOCK' || opt_brace_style=="expand" || opt_brace_style=="end-expand") {
- print_newline();
- } else {
- trim_output(true);
- print_single_space();
- }
- } else if (prefix === 'NEWLINE') {
- if ((last_type === 'TK_START_EXPR' || last_text === '=' || last_text === ',') && token_text === 'function') {
- // no need to force newline on 'function': (function
- // DONOTHING
- } else if (token_text === 'function' && last_text == 'new') {
- print_single_space();
- } else if (last_text === 'return' || last_text === 'throw') {
- // no newline between 'return nnn'
- print_single_space();
- } else if (last_type !== 'TK_END_EXPR') {
- if ((last_type !== 'TK_START_EXPR' || token_text !== 'var') && last_text !== ':') {
- // no need to force newline on 'var': for (var x = 0...)
- if (token_text === 'if' && last_word === 'else' && last_text !== '{') {
- // no newline for } else if {
- print_single_space();
- } else {
- flags.var_line = false;
- flags.var_line_reindented = false;
- print_newline();
- }
- }
- } else if (in_array(token_text, line_starters) && last_text != ')') {
- flags.var_line = false;
- flags.var_line_reindented = false;
- print_newline();
- }
- } else if (is_array(flags.mode) && last_text === ',' && last_last_text === '}') {
- print_newline(); // }, in lists get a newline treatment
- } else if (prefix === 'SPACE') {
- print_single_space();
- }
- print_token();
- last_word = token_text;
-
- if (token_text === 'var') {
- flags.var_line = true;
- flags.var_line_reindented = false;
- flags.var_line_tainted = false;
- }
-
- if (token_text === 'if') {
- flags.if_line = true;
- }
- if (token_text === 'else') {
- flags.if_line = false;
- }
-
- break;
-
- case 'TK_SEMICOLON':
-
- print_token();
- flags.var_line = false;
- flags.var_line_reindented = false;
- if (flags.mode == 'OBJECT') {
- // OBJECT mode is weird and doesn't get reset too well.
- flags.mode = 'BLOCK';
- }
- break;
-
- case 'TK_STRING':
-
- if (last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_SEMICOLON') {
- print_newline();
- } else if (last_type === 'TK_WORD') {
- print_single_space();
- }
- print_token();
- break;
-
- case 'TK_EQUALS':
- if (flags.var_line) {
- // just got an '=' in a var-line, different formatting/line-breaking, etc will now be done
- flags.var_line_tainted = true;
- }
- print_single_space();
- print_token();
- print_single_space();
- break;
-
- case 'TK_OPERATOR':
-
- var space_before = true;
- var space_after = true;
-
- if (flags.var_line && token_text === ',' && (is_expression(flags.mode))) {
- // do not break on comma, for(var a = 1, b = 2)
- flags.var_line_tainted = false;
- }
-
- if (flags.var_line) {
- if (token_text === ',') {
- if (flags.var_line_tainted) {
- print_token();
- flags.var_line_reindented = true;
- flags.var_line_tainted = false;
- print_newline();
- break;
- } else {
- flags.var_line_tainted = false;
- }
- // } else if (token_text === ':') {
- // hmm, when does this happen? tests don't catch this
- // flags.var_line = false;
- }
- }
-
- if (last_text === 'return' || last_text === 'throw') {
- // "return" had a special handling in TK_WORD. Now we need to return the favor
- print_single_space();
- print_token();
- break;
- }
-
- if (token_text === ':' && flags.in_case) {
- print_token(); // colon really asks for separate treatment
- print_newline();
- flags.in_case = false;
- break;
- }
-
- if (token_text === '::') {
- // no spaces around exotic namespacing syntax operator
- print_token();
- break;
- }
-
- if (token_text === ',') {
- if (flags.var_line) {
- if (flags.var_line_tainted) {
- print_token();
- print_newline();
- flags.var_line_tainted = false;
- } else {
- print_token();
- print_single_space();
- }
- } else if (last_type === 'TK_END_BLOCK' && flags.mode !== "(EXPRESSION)") {
- print_token();
- if (flags.mode === 'OBJECT' && last_text === '}') {
- print_newline();
- } else {
- print_single_space();
- }
- } else {
- if (flags.mode === 'OBJECT') {
- print_token();
- print_newline();
- } else {
- // EXPR or DO_BLOCK
- print_token();
- print_single_space();
- }
- }
- break;
- // } else if (in_array(token_text, ['--', '++', '!']) || (in_array(token_text, ['-', '+']) && (in_array(last_type, ['TK_START_BLOCK', 'TK_START_EXPR', 'TK_EQUALS']) || in_array(last_text, line_starters) || in_array(last_text, ['==', '!=', '+=', '-=', '*=', '/=', '+', '-'])))) {
- } else if (in_array(token_text, ['--', '++', '!']) || (in_array(token_text, ['-', '+']) && (in_array(last_type, ['TK_START_BLOCK', 'TK_START_EXPR', 'TK_EQUALS', 'TK_OPERATOR']) || in_array(last_text, line_starters)))) {
- // unary operators (and binary +/- pretending to be unary) special cases
-
- space_before = false;
- space_after = false;
-
- if (last_text === ';' && is_expression(flags.mode)) {
- // for (;; ++i)
- // ^^^
- space_before = true;
- }
- if (last_type === 'TK_WORD' && in_array(last_text, line_starters)) {
- space_before = true;
- }
-
- if (flags.mode === 'BLOCK' && (last_text === '{' || last_text === ';')) {
- // { foo; --i }
- // foo(); --bar;
- print_newline();
- }
- } else if (token_text === '.') {
- // decimal digits or object.property
- space_before = false;
-
- } else if (token_text === ':') {
- if (flags.ternary_depth == 0) {
- flags.mode = 'OBJECT';
- space_before = false;
- } else {
- flags.ternary_depth -= 1;
- }
- } else if (token_text === '?') {
- flags.ternary_depth += 1;
- }
- if (space_before) {
- print_single_space();
- }
-
- print_token();
-
- if (space_after) {
- print_single_space();
- }
-
- if (token_text === '!') {
- // flags.eat_next_space = true;
- }
-
- break;
-
- case 'TK_BLOCK_COMMENT':
-
- var lines = token_text.split(/\x0a|\x0d\x0a/);
-
- if (all_lines_start_with(lines.slice(1), '*')) {
- // javadoc: reformat and reindent
- print_newline();
- output.push(lines[0]);
- for (i = 1; i < lines.length; i++) {
- print_newline();
- output.push(' ');
- output.push(trim(lines[i]));
- }
-
- } else {
-
- // simple block comment: leave intact
- if (lines.length > 1) {
- // multiline comment block starts with a new line
- print_newline();
- trim_output();
- } else {
- // single-line /* comment */ stays where it is
- print_single_space();
-
- }
-
- for (i = 0; i < lines.length; i++) {
- output.push(lines[i]);
- output.push('\n');
- }
-
- }
- print_newline();
- break;
-
- case 'TK_INLINE_COMMENT':
-
- print_single_space();
- print_token();
- if (is_expression(flags.mode)) {
- print_single_space();
- } else {
- force_newline();
- }
- break;
-
- case 'TK_COMMENT':
-
- // print_newline();
- if (wanted_newline) {
- print_newline();
- } else {
- print_single_space();
- }
- print_token();
- force_newline();
- break;
-
- case 'TK_UNKNOWN':
- if (last_text === 'return' || last_text === 'throw') {
- print_single_space();
- }
- print_token();
- break;
- }
-
- last_last_text = last_text;
- last_type = token_type;
- last_text = token_text;
- }
-
- var sweet_code = output.join('').replace(/[\n ]+$/, '');
- if (opt_indent_level) {
- for (i = 0 ; i < opt_indent_level; i++) {
- sweet_code = indent_string + sweet_code;
- }
- }
- return sweet_code;
-
-}
-
-// Add support for CommonJS. Just put this file somewhere on your require.paths
-// and you will be able to `var js_beautify = require("beautify").js_beautify`.
-if (typeof exports !== "undefined")
- exports.js_beautify = js_beautify;
-
-return js_beautify;
-
-});
View
7 lib/js/domReady.js
@@ -1,7 +0,0 @@
-/*
- RequireJS domReady 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- Available via the MIT or new BSD license.
- see: http://github.com/jrburke/requirejs for details
-*/
-define(function(){function k(a){for(var b=0,c;c=a[b];b++)c(f)}function l(){var a=g,b=h;c&&(a.length&&(g=[],k(a)),d.resourcesDone&&b.length&&(h=[],k(b)))}function e(){c||(c=!0,i&&clearInterval(i),l())}function b(a){c?a(f):g.pu