gump 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +71 -0
  6. data/Rakefile +2 -0
  7. data/bin/gump +37 -0
  8. data/gump.gemspec +17 -0
  9. data/lib/gump.rb +50 -0
  10. data/lib/version.rb +3 -0
  11. data/server/assets/css/style.css +6949 -0
  12. data/server/assets/images/arrow.png +0 -0
  13. data/server/assets/images/logo.png +0 -0
  14. data/server/assets/js/bootstrap/dist/css/bootstrap-theme.css +347 -0
  15. data/server/assets/js/bootstrap/dist/css/bootstrap-theme.css.map +1 -0
  16. data/server/assets/js/bootstrap/dist/css/bootstrap-theme.min.css +7 -0
  17. data/server/assets/js/bootstrap/dist/css/bootstrap.css +5785 -0
  18. data/server/assets/js/bootstrap/dist/css/bootstrap.css.map +1 -0
  19. data/server/assets/js/bootstrap/dist/css/bootstrap.min.css +7 -0
  20. data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  21. data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  22. data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  23. data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  24. data/server/assets/js/bootstrap/dist/js/bootstrap.js +1951 -0
  25. data/server/assets/js/bootstrap/dist/js/bootstrap.min.js +6 -0
  26. data/server/assets/js/jquery.codemirror/.gitattributes +8 -0
  27. data/server/assets/js/jquery.codemirror/.gitignore +6 -0
  28. data/server/assets/js/jquery.codemirror/.travis.yml +3 -0
  29. data/server/assets/js/jquery.codemirror/AUTHORS +255 -0
  30. data/server/assets/js/jquery.codemirror/CONTRIBUTING.md +72 -0
  31. data/server/assets/js/jquery.codemirror/LICENSE +19 -0
  32. data/server/assets/js/jquery.codemirror/README.md +11 -0
  33. data/server/assets/js/jquery.codemirror/addon/comment/comment.js +145 -0
  34. data/server/assets/js/jquery.codemirror/addon/comment/continuecomment.js +54 -0
  35. data/server/assets/js/jquery.codemirror/addon/dialog/dialog.css +32 -0
  36. data/server/assets/js/jquery.codemirror/addon/dialog/dialog.js +121 -0
  37. data/server/assets/js/jquery.codemirror/addon/display/fullscreen.css +6 -0
  38. data/server/assets/js/jquery.codemirror/addon/display/fullscreen.js +31 -0
  39. data/server/assets/js/jquery.codemirror/addon/display/placeholder.js +48 -0
  40. data/server/assets/js/jquery.codemirror/addon/edit/closebrackets.js +82 -0
  41. data/server/assets/js/jquery.codemirror/addon/edit/closetag.js +89 -0
  42. data/server/assets/js/jquery.codemirror/addon/edit/continuelist.js +25 -0
  43. data/server/assets/js/jquery.codemirror/addon/edit/matchbrackets.js +87 -0
  44. data/server/assets/js/jquery.codemirror/addon/edit/matchtags.js +56 -0
  45. data/server/assets/js/jquery.codemirror/addon/edit/trailingspace.js +15 -0
  46. data/server/assets/js/jquery.codemirror/addon/fold/brace-fold.js +93 -0
  47. data/server/assets/js/jquery.codemirror/addon/fold/comment-fold.js +40 -0
  48. data/server/assets/js/jquery.codemirror/addon/fold/foldcode.js +75 -0
  49. data/server/assets/js/jquery.codemirror/addon/fold/foldgutter.css +21 -0
  50. data/server/assets/js/jquery.codemirror/addon/fold/foldgutter.js +124 -0
  51. data/server/assets/js/jquery.codemirror/addon/fold/indent-fold.js +30 -0
  52. data/server/assets/js/jquery.codemirror/addon/fold/xml-fold.js +167 -0
  53. data/server/assets/js/jquery.codemirror/addon/hint/anyword-hint.js +34 -0
  54. data/server/assets/js/jquery.codemirror/addon/hint/css-hint.js +50 -0
  55. data/server/assets/js/jquery.codemirror/addon/hint/html-hint.js +337 -0
  56. data/server/assets/js/jquery.codemirror/addon/hint/javascript-hint.js +131 -0
  57. data/server/assets/js/jquery.codemirror/addon/hint/pig-hint.js +121 -0
  58. data/server/assets/js/jquery.codemirror/addon/hint/python-hint.js +95 -0
  59. data/server/assets/js/jquery.codemirror/addon/hint/show-hint.css +38 -0
  60. data/server/assets/js/jquery.codemirror/addon/hint/show-hint.js +286 -0
  61. data/server/assets/js/jquery.codemirror/addon/hint/sql-hint.js +105 -0
  62. data/server/assets/js/jquery.codemirror/addon/hint/xml-hint.js +69 -0
  63. data/server/assets/js/jquery.codemirror/addon/lint/coffeescript-lint.js +27 -0
  64. data/server/assets/js/jquery.codemirror/addon/lint/css-lint.js +19 -0
  65. data/server/assets/js/jquery.codemirror/addon/lint/javascript-lint.js +126 -0
  66. data/server/assets/js/jquery.codemirror/addon/lint/json-lint.js +17 -0
  67. data/server/assets/js/jquery.codemirror/addon/lint/lint.css +73 -0
  68. data/server/assets/js/jquery.codemirror/addon/lint/lint.js +203 -0
  69. data/server/assets/js/jquery.codemirror/addon/merge/dep/diff_match_patch.js +50 -0
  70. data/server/assets/js/jquery.codemirror/addon/merge/merge.css +92 -0
  71. data/server/assets/js/jquery.codemirror/addon/merge/merge.js +474 -0
  72. data/server/assets/js/jquery.codemirror/addon/mode/loadmode.js +51 -0
  73. data/server/assets/js/jquery.codemirror/addon/mode/multiplex.js +101 -0
  74. data/server/assets/js/jquery.codemirror/addon/mode/multiplex_test.js +30 -0
  75. data/server/assets/js/jquery.codemirror/addon/mode/overlay.js +59 -0
  76. data/server/assets/js/jquery.codemirror/addon/runmode/colorize.js +29 -0
  77. data/server/assets/js/jquery.codemirror/addon/runmode/runmode-standalone.js +136 -0
  78. data/server/assets/js/jquery.codemirror/addon/runmode/runmode.js +56 -0
  79. data/server/assets/js/jquery.codemirror/addon/runmode/runmode.node.js +103 -0
  80. data/server/assets/js/jquery.codemirror/addon/scroll/scrollpastend.js +34 -0
  81. data/server/assets/js/jquery.codemirror/addon/search/match-highlighter.js +91 -0
  82. data/server/assets/js/jquery.codemirror/addon/search/search.js +133 -0
  83. data/server/assets/js/jquery.codemirror/addon/search/searchcursor.js +143 -0
  84. data/server/assets/js/jquery.codemirror/addon/selection/active-line.js +39 -0
  85. data/server/assets/js/jquery.codemirror/addon/selection/mark-selection.js +108 -0
  86. data/server/assets/js/jquery.codemirror/addon/tern/tern.css +85 -0
  87. data/server/assets/js/jquery.codemirror/addon/tern/tern.js +632 -0
  88. data/server/assets/js/jquery.codemirror/addon/tern/worker.js +41 -0
  89. data/server/assets/js/jquery.codemirror/addon/wrap/hardwrap.js +99 -0
  90. data/server/assets/js/jquery.codemirror/bin/authors.sh +6 -0
  91. data/server/assets/js/jquery.codemirror/bin/compress +92 -0
  92. data/server/assets/js/jquery.codemirror/bin/lint +16 -0
  93. data/server/assets/js/jquery.codemirror/bin/source-highlight +61 -0
  94. data/server/assets/js/jquery.codemirror/bower.json +15 -0
  95. data/server/assets/js/jquery.codemirror/demo/activeline.html +78 -0
  96. data/server/assets/js/jquery.codemirror/demo/anywordhint.html +79 -0
  97. data/server/assets/js/jquery.codemirror/demo/bidi.html +74 -0
  98. data/server/assets/js/jquery.codemirror/demo/btree.html +86 -0
  99. data/server/assets/js/jquery.codemirror/demo/buffers.html +109 -0
  100. data/server/assets/js/jquery.codemirror/demo/changemode.html +59 -0
  101. data/server/assets/js/jquery.codemirror/demo/closebrackets.html +63 -0
  102. data/server/assets/js/jquery.codemirror/demo/closetag.html +40 -0
  103. data/server/assets/js/jquery.codemirror/demo/complete.html +80 -0
  104. data/server/assets/js/jquery.codemirror/demo/emacs.html +75 -0
  105. data/server/assets/js/jquery.codemirror/demo/folding.html +75 -0
  106. data/server/assets/js/jquery.codemirror/demo/fullscreen.html +130 -0
  107. data/server/assets/js/jquery.codemirror/demo/hardwrap.html +69 -0
  108. data/server/assets/js/jquery.codemirror/demo/html5complete.html +54 -0
  109. data/server/assets/js/jquery.codemirror/demo/indentwrap.html +58 -0
  110. data/server/assets/js/jquery.codemirror/demo/lint.html +171 -0
  111. data/server/assets/js/jquery.codemirror/demo/loadmode.html +49 -0
  112. data/server/assets/js/jquery.codemirror/demo/marker.html +52 -0
  113. data/server/assets/js/jquery.codemirror/demo/markselection.html +45 -0
  114. data/server/assets/js/jquery.codemirror/demo/matchhighlighter.html +47 -0
  115. data/server/assets/js/jquery.codemirror/demo/matchtags.html +49 -0
  116. data/server/assets/js/jquery.codemirror/demo/merge.html +82 -0
  117. data/server/assets/js/jquery.codemirror/demo/multiplex.html +75 -0
  118. data/server/assets/js/jquery.codemirror/demo/mustache.html +68 -0
  119. data/server/assets/js/jquery.codemirror/demo/placeholder.html +45 -0
  120. data/server/assets/js/jquery.codemirror/demo/preview.html +88 -0
  121. data/server/assets/js/jquery.codemirror/demo/resize.html +58 -0
  122. data/server/assets/js/jquery.codemirror/demo/runmode.html +62 -0
  123. data/server/assets/js/jquery.codemirror/demo/search.html +94 -0
  124. data/server/assets/js/jquery.codemirror/demo/spanaffectswrapping_shim.html +85 -0
  125. data/server/assets/js/jquery.codemirror/demo/tern.html +129 -0
  126. data/server/assets/js/jquery.codemirror/demo/theme.html +121 -0
  127. data/server/assets/js/jquery.codemirror/demo/trailingspace.html +48 -0
  128. data/server/assets/js/jquery.codemirror/demo/variableheight.html +67 -0
  129. data/server/assets/js/jquery.codemirror/demo/vim.html +74 -0
  130. data/server/assets/js/jquery.codemirror/demo/visibletabs.html +62 -0
  131. data/server/assets/js/jquery.codemirror/demo/widget.html +85 -0
  132. data/server/assets/js/jquery.codemirror/demo/xmlcomplete.html +116 -0
  133. data/server/assets/js/jquery.codemirror/index.html +192 -0
  134. data/server/assets/js/jquery.codemirror/keymap/emacs.js +387 -0
  135. data/server/assets/js/jquery.codemirror/keymap/extra.js +43 -0
  136. data/server/assets/js/jquery.codemirror/keymap/vim.js +3703 -0
  137. data/server/assets/js/jquery.codemirror/lib/codemirror.css +263 -0
  138. data/server/assets/js/jquery.codemirror/lib/codemirror.js +5944 -0
  139. data/server/assets/js/jquery.codemirror/mode/apl/apl.js +160 -0
  140. data/server/assets/js/jquery.codemirror/mode/apl/index.html +72 -0
  141. data/server/assets/js/jquery.codemirror/mode/asterisk/asterisk.js +183 -0
  142. data/server/assets/js/jquery.codemirror/mode/asterisk/index.html +154 -0
  143. data/server/assets/js/jquery.codemirror/mode/clike/clike.js +362 -0
  144. data/server/assets/js/jquery.codemirror/mode/clike/index.html +195 -0
  145. data/server/assets/js/jquery.codemirror/mode/clike/scala.html +767 -0
  146. data/server/assets/js/jquery.codemirror/mode/clojure/clojure.js +224 -0
  147. data/server/assets/js/jquery.codemirror/mode/clojure/index.html +88 -0
  148. data/server/assets/js/jquery.codemirror/mode/cobol/cobol.js +240 -0
  149. data/server/assets/js/jquery.codemirror/mode/cobol/index.html +210 -0
  150. data/server/assets/js/jquery.codemirror/mode/coffeescript/coffeescript.js +354 -0
  151. data/server/assets/js/jquery.codemirror/mode/coffeescript/index.html +740 -0
  152. data/server/assets/js/jquery.codemirror/mode/commonlisp/commonlisp.js +105 -0
  153. data/server/assets/js/jquery.codemirror/mode/commonlisp/index.html +177 -0
  154. data/server/assets/js/jquery.codemirror/mode/css/css.js +639 -0
  155. data/server/assets/js/jquery.codemirror/mode/css/index.html +70 -0
  156. data/server/assets/js/jquery.codemirror/mode/css/scss.html +157 -0
  157. data/server/assets/js/jquery.codemirror/mode/css/scss_test.js +93 -0
  158. data/server/assets/js/jquery.codemirror/mode/css/test.js +142 -0
  159. data/server/assets/js/jquery.codemirror/mode/d/d.js +205 -0
  160. data/server/assets/js/jquery.codemirror/mode/d/index.html +273 -0
  161. data/server/assets/js/jquery.codemirror/mode/diff/diff.js +32 -0
  162. data/server/assets/js/jquery.codemirror/mode/diff/index.html +117 -0
  163. data/server/assets/js/jquery.codemirror/mode/dtd/dtd.js +127 -0
  164. data/server/assets/js/jquery.codemirror/mode/dtd/index.html +89 -0
  165. data/server/assets/js/jquery.codemirror/mode/ecl/ecl.js +192 -0
  166. data/server/assets/js/jquery.codemirror/mode/ecl/index.html +52 -0
  167. data/server/assets/js/jquery.codemirror/mode/eiffel/eiffel.js +147 -0
  168. data/server/assets/js/jquery.codemirror/mode/eiffel/index.html +430 -0
  169. data/server/assets/js/jquery.codemirror/mode/erlang/erlang.js +484 -0
  170. data/server/assets/js/jquery.codemirror/mode/erlang/index.html +75 -0
  171. data/server/assets/js/jquery.codemirror/mode/fortran/fortran.js +173 -0
  172. data/server/assets/js/jquery.codemirror/mode/fortran/index.html +81 -0
  173. data/server/assets/js/jquery.codemirror/mode/gas/gas.js +330 -0
  174. data/server/assets/js/jquery.codemirror/mode/gas/index.html +68 -0
  175. data/server/assets/js/jquery.codemirror/mode/gfm/gfm.js +97 -0
  176. data/server/assets/js/jquery.codemirror/mode/gfm/index.html +82 -0
  177. data/server/assets/js/jquery.codemirror/mode/gfm/test.js +112 -0
  178. data/server/assets/js/jquery.codemirror/mode/gherkin/gherkin.js +168 -0
  179. data/server/assets/js/jquery.codemirror/mode/gherkin/index.html +48 -0
  180. data/server/assets/js/jquery.codemirror/mode/go/go.js +168 -0
  181. data/server/assets/js/jquery.codemirror/mode/go/index.html +85 -0
  182. data/server/assets/js/jquery.codemirror/mode/groovy/groovy.js +211 -0
  183. data/server/assets/js/jquery.codemirror/mode/groovy/index.html +84 -0
  184. data/server/assets/js/jquery.codemirror/mode/haml/haml.js +153 -0
  185. data/server/assets/js/jquery.codemirror/mode/haml/index.html +79 -0
  186. data/server/assets/js/jquery.codemirror/mode/haml/test.js +94 -0
  187. data/server/assets/js/jquery.codemirror/mode/haskell/haskell.js +250 -0
  188. data/server/assets/js/jquery.codemirror/mode/haskell/index.html +73 -0
  189. data/server/assets/js/jquery.codemirror/mode/haxe/haxe.js +429 -0
  190. data/server/assets/js/jquery.codemirror/mode/haxe/index.html +103 -0
  191. data/server/assets/js/jquery.codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  192. data/server/assets/js/jquery.codemirror/mode/htmlembedded/index.html +60 -0
  193. data/server/assets/js/jquery.codemirror/mode/htmlmixed/htmlmixed.js +104 -0
  194. data/server/assets/js/jquery.codemirror/mode/htmlmixed/index.html +85 -0
  195. data/server/assets/js/jquery.codemirror/mode/http/http.js +98 -0
  196. data/server/assets/js/jquery.codemirror/mode/http/index.html +45 -0
  197. data/server/assets/js/jquery.codemirror/mode/index.html +114 -0
  198. data/server/assets/js/jquery.codemirror/mode/jade/index.html +66 -0
  199. data/server/assets/js/jquery.codemirror/mode/jade/jade.js +90 -0
  200. data/server/assets/js/jquery.codemirror/mode/javascript/index.html +107 -0
  201. data/server/assets/js/jquery.codemirror/mode/javascript/javascript.js +617 -0
  202. data/server/assets/js/jquery.codemirror/mode/javascript/test.js +72 -0
  203. data/server/assets/js/jquery.codemirror/mode/javascript/typescript.html +61 -0
  204. data/server/assets/js/jquery.codemirror/mode/jinja2/index.html +50 -0
  205. data/server/assets/js/jquery.codemirror/mode/jinja2/jinja2.js +42 -0
  206. data/server/assets/js/jquery.codemirror/mode/julia/index.html +187 -0
  207. data/server/assets/js/jquery.codemirror/mode/julia/julia.js +262 -0
  208. data/server/assets/js/jquery.codemirror/mode/less/index.html +753 -0
  209. data/server/assets/js/jquery.codemirror/mode/less/less.js +346 -0
  210. data/server/assets/js/jquery.codemirror/mode/livescript/index.html +459 -0
  211. data/server/assets/js/jquery.codemirror/mode/livescript/livescript.js +267 -0
  212. data/server/assets/js/jquery.codemirror/mode/livescript/livescript.ls +266 -0
  213. data/server/assets/js/jquery.codemirror/mode/lua/index.html +86 -0
  214. data/server/assets/js/jquery.codemirror/mode/lua/lua.js +144 -0
  215. data/server/assets/js/jquery.codemirror/mode/markdown/index.html +359 -0
  216. data/server/assets/js/jquery.codemirror/mode/markdown/markdown.js +560 -0
  217. data/server/assets/js/jquery.codemirror/mode/markdown/test.js +664 -0
  218. data/server/assets/js/jquery.codemirror/mode/meta.js +91 -0
  219. data/server/assets/js/jquery.codemirror/mode/mirc/index.html +161 -0
  220. data/server/assets/js/jquery.codemirror/mode/mirc/mirc.js +177 -0
  221. data/server/assets/js/jquery.codemirror/mode/nginx/index.html +181 -0
  222. data/server/assets/js/jquery.codemirror/mode/nginx/nginx.js +163 -0
  223. data/server/assets/js/jquery.codemirror/mode/ntriples/index.html +45 -0
  224. data/server/assets/js/jquery.codemirror/mode/ntriples/ntriples.js +170 -0
  225. data/server/assets/js/jquery.codemirror/mode/ocaml/index.html +146 -0
  226. data/server/assets/js/jquery.codemirror/mode/ocaml/ocaml.js +116 -0
  227. data/server/assets/js/jquery.codemirror/mode/octave/index.html +95 -0
  228. data/server/assets/js/jquery.codemirror/mode/octave/octave.js +118 -0
  229. data/server/assets/js/jquery.codemirror/mode/pascal/index.html +61 -0
  230. data/server/assets/js/jquery.codemirror/mode/pascal/pascal.js +94 -0
  231. data/server/assets/js/jquery.codemirror/mode/pegjs/index.html +66 -0
  232. data/server/assets/js/jquery.codemirror/mode/pegjs/pegjs.js +103 -0
  233. data/server/assets/js/jquery.codemirror/mode/perl/index.html +75 -0
  234. data/server/assets/js/jquery.codemirror/mode/perl/perl.js +816 -0
  235. data/server/assets/js/jquery.codemirror/mode/php/index.html +62 -0
  236. data/server/assets/js/jquery.codemirror/mode/php/php.js +132 -0
  237. data/server/assets/js/jquery.codemirror/mode/pig/index.html +55 -0
  238. data/server/assets/js/jquery.codemirror/mode/pig/pig.js +171 -0
  239. data/server/assets/js/jquery.codemirror/mode/properties/index.html +53 -0
  240. data/server/assets/js/jquery.codemirror/mode/properties/properties.js +63 -0
  241. data/server/assets/js/jquery.codemirror/mode/python/index.html +187 -0
  242. data/server/assets/js/jquery.codemirror/mode/python/python.js +368 -0
  243. data/server/assets/js/jquery.codemirror/mode/q/index.html +144 -0
  244. data/server/assets/js/jquery.codemirror/mode/q/q.js +124 -0
  245. data/server/assets/js/jquery.codemirror/mode/r/index.html +86 -0
  246. data/server/assets/js/jquery.codemirror/mode/r/r.js +141 -0
  247. data/server/assets/js/jquery.codemirror/mode/rpm/changes/changes.js +19 -0
  248. data/server/assets/js/jquery.codemirror/mode/rpm/changes/index.html +67 -0
  249. data/server/assets/js/jquery.codemirror/mode/rpm/spec/index.html +114 -0
  250. data/server/assets/js/jquery.codemirror/mode/rpm/spec/spec.css +5 -0
  251. data/server/assets/js/jquery.codemirror/mode/rpm/spec/spec.js +66 -0
  252. data/server/assets/js/jquery.codemirror/mode/rst/index.html +534 -0
  253. data/server/assets/js/jquery.codemirror/mode/rst/rst.js +560 -0
  254. data/server/assets/js/jquery.codemirror/mode/ruby/index.html +185 -0
  255. data/server/assets/js/jquery.codemirror/mode/ruby/ruby.js +247 -0
  256. data/server/assets/js/jquery.codemirror/mode/rust/index.html +61 -0
  257. data/server/assets/js/jquery.codemirror/mode/rust/rust.js +436 -0
  258. data/server/assets/js/jquery.codemirror/mode/sass/index.html +66 -0
  259. data/server/assets/js/jquery.codemirror/mode/sass/sass.js +330 -0
  260. data/server/assets/js/jquery.codemirror/mode/scheme/index.html +77 -0
  261. data/server/assets/js/jquery.codemirror/mode/scheme/scheme.js +232 -0
  262. data/server/assets/js/jquery.codemirror/mode/shell/index.html +66 -0
  263. data/server/assets/js/jquery.codemirror/mode/shell/shell.js +118 -0
  264. data/server/assets/js/jquery.codemirror/mode/sieve/index.html +93 -0
  265. data/server/assets/js/jquery.codemirror/mode/sieve/sieve.js +183 -0
  266. data/server/assets/js/jquery.codemirror/mode/smalltalk/index.html +68 -0
  267. data/server/assets/js/jquery.codemirror/mode/smalltalk/smalltalk.js +151 -0
  268. data/server/assets/js/jquery.codemirror/mode/smarty/index.html +136 -0
  269. data/server/assets/js/jquery.codemirror/mode/smarty/smarty.js +205 -0
  270. data/server/assets/js/jquery.codemirror/mode/smartymixed/index.html +114 -0
  271. data/server/assets/js/jquery.codemirror/mode/smartymixed/smartymixed.js +175 -0
  272. data/server/assets/js/jquery.codemirror/mode/sparql/index.html +54 -0
  273. data/server/assets/js/jquery.codemirror/mode/sparql/sparql.js +145 -0
  274. data/server/assets/js/jquery.codemirror/mode/sql/index.html +75 -0
  275. data/server/assets/js/jquery.codemirror/mode/sql/sql.js +365 -0
  276. data/server/assets/js/jquery.codemirror/mode/stex/index.html +110 -0
  277. data/server/assets/js/jquery.codemirror/mode/stex/stex.js +246 -0
  278. data/server/assets/js/jquery.codemirror/mode/stex/test.js +120 -0
  279. data/server/assets/js/jquery.codemirror/mode/tcl/index.html +143 -0
  280. data/server/assets/js/jquery.codemirror/mode/tcl/tcl.js +131 -0
  281. data/server/assets/js/jquery.codemirror/mode/tiddlywiki/index.html +155 -0
  282. data/server/assets/js/jquery.codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  283. data/server/assets/js/jquery.codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  284. data/server/assets/js/jquery.codemirror/mode/tiki/index.html +95 -0
  285. data/server/assets/js/jquery.codemirror/mode/tiki/tiki.css +26 -0
  286. data/server/assets/js/jquery.codemirror/mode/tiki/tiki.js +308 -0
  287. data/server/assets/js/jquery.codemirror/mode/toml/index.html +73 -0
  288. data/server/assets/js/jquery.codemirror/mode/toml/toml.js +71 -0
  289. data/server/assets/js/jquery.codemirror/mode/turtle/index.html +51 -0
  290. data/server/assets/js/jquery.codemirror/mode/turtle/turtle.js +145 -0
  291. data/server/assets/js/jquery.codemirror/mode/vb/index.html +103 -0
  292. data/server/assets/js/jquery.codemirror/mode/vb/vb.js +259 -0
  293. data/server/assets/js/jquery.codemirror/mode/vbscript/index.html +55 -0
  294. data/server/assets/js/jquery.codemirror/mode/vbscript/vbscript.js +334 -0
  295. data/server/assets/js/jquery.codemirror/mode/velocity/index.html +119 -0
  296. data/server/assets/js/jquery.codemirror/mode/velocity/velocity.js +186 -0
  297. data/server/assets/js/jquery.codemirror/mode/verilog/index.html +132 -0
  298. data/server/assets/js/jquery.codemirror/mode/verilog/verilog.js +182 -0
  299. data/server/assets/js/jquery.codemirror/mode/xml/index.html +57 -0
  300. data/server/assets/js/jquery.codemirror/mode/xml/xml.js +345 -0
  301. data/server/assets/js/jquery.codemirror/mode/xquery/index.html +210 -0
  302. data/server/assets/js/jquery.codemirror/mode/xquery/test.js +64 -0
  303. data/server/assets/js/jquery.codemirror/mode/xquery/xquery.js +432 -0
  304. data/server/assets/js/jquery.codemirror/mode/yaml/index.html +80 -0
  305. data/server/assets/js/jquery.codemirror/mode/yaml/yaml.js +97 -0
  306. data/server/assets/js/jquery.codemirror/mode/z80/index.html +52 -0
  307. data/server/assets/js/jquery.codemirror/mode/z80/z80.js +85 -0
  308. data/server/assets/js/jquery.codemirror/package.json +19 -0
  309. data/server/assets/js/jquery.codemirror/test/comment_test.js +51 -0
  310. data/server/assets/js/jquery.codemirror/test/doc_test.js +329 -0
  311. data/server/assets/js/jquery.codemirror/test/driver.js +139 -0
  312. data/server/assets/js/jquery.codemirror/test/emacs_test.js +135 -0
  313. data/server/assets/js/jquery.codemirror/test/index.html +209 -0
  314. data/server/assets/js/jquery.codemirror/test/lint/acorn.js +1593 -0
  315. data/server/assets/js/jquery.codemirror/test/lint/lint.js +139 -0
  316. data/server/assets/js/jquery.codemirror/test/lint/walk.js +216 -0
  317. data/server/assets/js/jquery.codemirror/test/mode_test.css +10 -0
  318. data/server/assets/js/jquery.codemirror/test/mode_test.js +200 -0
  319. data/server/assets/js/jquery.codemirror/test/phantom_driver.js +31 -0
  320. data/server/assets/js/jquery.codemirror/test/run.js +34 -0
  321. data/server/assets/js/jquery.codemirror/test/test.js +1562 -0
  322. data/server/assets/js/jquery.codemirror/test/vim_test.js +2391 -0
  323. data/server/assets/js/jquery.codemirror/theme/3024-day.css +34 -0
  324. data/server/assets/js/jquery.codemirror/theme/3024-night.css +34 -0
  325. data/server/assets/js/jquery.codemirror/theme/ambiance-mobile.css +5 -0
  326. data/server/assets/js/jquery.codemirror/theme/ambiance.css +70 -0
  327. data/server/assets/js/jquery.codemirror/theme/base16-dark.css +34 -0
  328. data/server/assets/js/jquery.codemirror/theme/base16-light.css +34 -0
  329. data/server/assets/js/jquery.codemirror/theme/blackboard.css +28 -0
  330. data/server/assets/js/jquery.codemirror/theme/cobalt.css +21 -0
  331. data/server/assets/js/jquery.codemirror/theme/eclipse.css +23 -0
  332. data/server/assets/js/jquery.codemirror/theme/elegant.css +13 -0
  333. data/server/assets/js/jquery.codemirror/theme/erlang-dark.css +30 -0
  334. data/server/assets/js/jquery.codemirror/theme/lesser-dark.css +47 -0
  335. data/server/assets/js/jquery.codemirror/theme/mbo.css +37 -0
  336. data/server/assets/js/jquery.codemirror/theme/midnight.css +43 -0
  337. data/server/assets/js/jquery.codemirror/theme/monokai.css +29 -0
  338. data/server/assets/js/jquery.codemirror/theme/neat.css +12 -0
  339. data/server/assets/js/jquery.codemirror/theme/night.css +24 -0
  340. data/server/assets/js/jquery.codemirror/theme/paraiso-dark.css +34 -0
  341. data/server/assets/js/jquery.codemirror/theme/paraiso-light.css +34 -0
  342. data/server/assets/js/jquery.codemirror/theme/rubyblue.css +23 -0
  343. data/server/assets/js/jquery.codemirror/theme/solarized.css +180 -0
  344. data/server/assets/js/jquery.codemirror/theme/the-matrix.css +26 -0
  345. data/server/assets/js/jquery.codemirror/theme/tomorrow-night-eighties.css +34 -0
  346. data/server/assets/js/jquery.codemirror/theme/twilight.css +28 -0
  347. data/server/assets/js/jquery.codemirror/theme/vibrant-ink.css +30 -0
  348. data/server/assets/js/jquery.codemirror/theme/xq-dark.css +49 -0
  349. data/server/assets/js/jquery.codemirror/theme/xq-light.css +43 -0
  350. data/server/assets/js/jquery.js +4 -0
  351. data/server/assets/js/jquery.nanoscroller/jquery.nanoscroller.js +2 -0
  352. data/server/assets/js/jquery.nanoscroller/nanoscroller.css +49 -0
  353. data/server/assets/js/tester.js +161 -0
  354. data/server/config.ru +2 -0
  355. data/server/server.rb +41 -0
  356. data/server/views/_content.erb +65 -0
  357. data/server/views/_sidebar.erb +32 -0
  358. data/server/views/index.erb +40 -0
  359. metadata +402 -0
@@ -0,0 +1,64 @@
1
+ // Don't take these too seriously -- the expected results appear to be
2
+ // based on the results of actual runs without any serious manual
3
+ // verification. If a change you made causes them to fail, the test is
4
+ // as likely to wrong as the code.
5
+
6
+ (function() {
7
+ var mode = CodeMirror.getMode({tabSize: 4}, "xquery");
8
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
9
+
10
+ MT("eviltest",
11
+ "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]",
12
+ " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func&gt][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]",
13
+ " [keyword let] [variable $joe][keyword :=][atom 1]",
14
+ " [keyword return] [keyword element] [variable element] {",
15
+ " [keyword attribute] [variable attribute] { [atom 1] },",
16
+ " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },",
17
+ " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],",
18
+ " [keyword //][variable x] } [comment (: a more 'evil' test :)]",
19
+ " [comment (: Modified Blakeley example (: with nested comment :) ... :)]",
20
+ " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]",
21
+ " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]",
22
+ " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]",
23
+ " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]",
24
+ " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]",
25
+ " [keyword return] [keyword element] [variable element] {",
26
+ " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },",
27
+ " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },",
28
+ " [keyword element] [variable text] { [keyword text] { [variable "text"] } },",
29
+ " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],",
30
+ " [keyword //][variable fn:doc]",
31
+ " }");
32
+
33
+ MT("testEmptySequenceKeyword",
34
+ "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()");
35
+
36
+ MT("testMultiAttr",
37
+ "[tag <p ][attribute a1]=[string \"foo\"] [attribute a2]=[string \"bar\"][tag >][variable hello] [variable world][tag </p>]");
38
+
39
+ MT("test namespaced variable",
40
+ "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]");
41
+
42
+ MT("test EQName variable",
43
+ "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]",
44
+ "[tag <out>]{[variable $\"http://www.example.com/ns/my\":var]}[tag </out>]");
45
+
46
+ MT("test EQName function",
47
+ "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
48
+ " [variable $a] [keyword +] [atom 2]",
49
+ "}[variable ;]",
50
+ "[tag <out>]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag </out>]");
51
+
52
+ MT("test EQName function with single quotes",
53
+ "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
54
+ " [variable $a] [keyword +] [atom 2]",
55
+ "}[variable ;]",
56
+ "[tag <out>]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag </out>]");
57
+
58
+ MT("testProcessingInstructions",
59
+ "[def&variable data]([comment&meta <?target content?>]) [keyword instance] [keyword of] [atom xs:string]");
60
+
61
+ MT("testQuoteEscapeDouble",
62
+ "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]",
63
+ "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])");
64
+ })();
@@ -0,0 +1,432 @@
1
+ CodeMirror.defineMode("xquery", function() {
2
+
3
+ // The keywords object is set to the result of this self executing
4
+ // function. Each keyword is a property of the keywords object whose
5
+ // value is {type: atype, style: astyle}
6
+ var keywords = function(){
7
+ // conveinence functions used to build keywords object
8
+ function kw(type) {return {type: type, style: "keyword"};}
9
+ var A = kw("keyword a")
10
+ , B = kw("keyword b")
11
+ , C = kw("keyword c")
12
+ , operator = kw("operator")
13
+ , atom = {type: "atom", style: "atom"}
14
+ , punctuation = {type: "punctuation", style: null}
15
+ , qualifier = {type: "axis_specifier", style: "qualifier"};
16
+
17
+ // kwObj is what is return from this function at the end
18
+ var kwObj = {
19
+ 'if': A, 'switch': A, 'while': A, 'for': A,
20
+ 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B,
21
+ 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C,
22
+ 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C,
23
+ ',': punctuation,
24
+ 'null': atom, 'fn:false()': atom, 'fn:true()': atom
25
+ };
26
+
27
+ // a list of 'basic' keywords. For each add a property to kwObj with the value of
28
+ // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
29
+ var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before',
30
+ 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self',
31
+ 'descending','document','document-node','element','else','eq','every','except','external','following',
32
+ 'following-sibling','follows','for','function','if','import','in','instance','intersect','item',
33
+ 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding',
34
+ 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element',
35
+ 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where',
36
+ 'xquery', 'empty-sequence'];
37
+ for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
38
+
39
+ // a list of types. For each add a property to kwObj with the value of
40
+ // {type: "atom", style: "atom"}
41
+ var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime',
42
+ 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary',
43
+ 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration'];
44
+ for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
45
+
46
+ // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
47
+ var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
48
+ for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;};
49
+
50
+ // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
51
+ var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
52
+ "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
53
+ for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; };
54
+
55
+ return kwObj;
56
+ }();
57
+
58
+ // Used as scratch variables to communicate multiple values without
59
+ // consing up tons of objects.
60
+ var type, content;
61
+
62
+ function ret(tp, style, cont) {
63
+ type = tp; content = cont;
64
+ return style;
65
+ }
66
+
67
+ function chain(stream, state, f) {
68
+ state.tokenize = f;
69
+ return f(stream, state);
70
+ }
71
+
72
+ // the primary mode tokenizer
73
+ function tokenBase(stream, state) {
74
+ var ch = stream.next(),
75
+ mightBeFunction = false,
76
+ isEQName = isEQNameAhead(stream);
77
+
78
+ // an XML tag (if not in some sub, chained tokenizer)
79
+ if (ch == "<") {
80
+ if(stream.match("!--", true))
81
+ return chain(stream, state, tokenXMLComment);
82
+
83
+ if(stream.match("![CDATA", false)) {
84
+ state.tokenize = tokenCDATA;
85
+ return ret("tag", "tag");
86
+ }
87
+
88
+ if(stream.match("?", false)) {
89
+ return chain(stream, state, tokenPreProcessing);
90
+ }
91
+
92
+ var isclose = stream.eat("/");
93
+ stream.eatSpace();
94
+ var tagName = "", c;
95
+ while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
96
+
97
+ return chain(stream, state, tokenTag(tagName, isclose));
98
+ }
99
+ // start code block
100
+ else if(ch == "{") {
101
+ pushStateStack(state,{ type: "codeblock"});
102
+ return ret("", null);
103
+ }
104
+ // end code block
105
+ else if(ch == "}") {
106
+ popStateStack(state);
107
+ return ret("", null);
108
+ }
109
+ // if we're in an XML block
110
+ else if(isInXmlBlock(state)) {
111
+ if(ch == ">")
112
+ return ret("tag", "tag");
113
+ else if(ch == "/" && stream.eat(">")) {
114
+ popStateStack(state);
115
+ return ret("tag", "tag");
116
+ }
117
+ else
118
+ return ret("word", "variable");
119
+ }
120
+ // if a number
121
+ else if (/\d/.test(ch)) {
122
+ stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
123
+ return ret("number", "atom");
124
+ }
125
+ // comment start
126
+ else if (ch === "(" && stream.eat(":")) {
127
+ pushStateStack(state, { type: "comment"});
128
+ return chain(stream, state, tokenComment);
129
+ }
130
+ // quoted string
131
+ else if ( !isEQName && (ch === '"' || ch === "'"))
132
+ return chain(stream, state, tokenString(ch));
133
+ // variable
134
+ else if(ch === "$") {
135
+ return chain(stream, state, tokenVariable);
136
+ }
137
+ // assignment
138
+ else if(ch ===":" && stream.eat("=")) {
139
+ return ret("operator", "keyword");
140
+ }
141
+ // open paren
142
+ else if(ch === "(") {
143
+ pushStateStack(state, { type: "paren"});
144
+ return ret("", null);
145
+ }
146
+ // close paren
147
+ else if(ch === ")") {
148
+ popStateStack(state);
149
+ return ret("", null);
150
+ }
151
+ // open paren
152
+ else if(ch === "[") {
153
+ pushStateStack(state, { type: "bracket"});
154
+ return ret("", null);
155
+ }
156
+ // close paren
157
+ else if(ch === "]") {
158
+ popStateStack(state);
159
+ return ret("", null);
160
+ }
161
+ else {
162
+ var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
163
+
164
+ // if there's a EQName ahead, consume the rest of the string portion, it's likely a function
165
+ if(isEQName && ch === '\"') while(stream.next() !== '"'){}
166
+ if(isEQName && ch === '\'') while(stream.next() !== '\''){}
167
+
168
+ // gobble up a word if the character is not known
169
+ if(!known) stream.eatWhile(/[\w\$_-]/);
170
+
171
+ // gobble a colon in the case that is a lib func type call fn:doc
172
+ var foundColon = stream.eat(":");
173
+
174
+ // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
175
+ // which should get matched as a keyword
176
+ if(!stream.eat(":") && foundColon) {
177
+ stream.eatWhile(/[\w\$_-]/);
178
+ }
179
+ // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
180
+ if(stream.match(/^[ \t]*\(/, false)) {
181
+ mightBeFunction = true;
182
+ }
183
+ // is the word a keyword?
184
+ var word = stream.current();
185
+ known = keywords.propertyIsEnumerable(word) && keywords[word];
186
+
187
+ // if we think it's a function call but not yet known,
188
+ // set style to variable for now for lack of something better
189
+ if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"};
190
+
191
+ // if the previous word was element, attribute, axis specifier, this word should be the name of that
192
+ if(isInXmlConstructor(state)) {
193
+ popStateStack(state);
194
+ return ret("word", "variable", word);
195
+ }
196
+ // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
197
+ // push the stack so we know to look for it on the next word
198
+ if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
199
+
200
+ // if the word is known, return the details of that else just call this a generic 'word'
201
+ return known ? ret(known.type, known.style, word) :
202
+ ret("word", "variable", word);
203
+ }
204
+ }
205
+
206
+ // handle comments, including nested
207
+ function tokenComment(stream, state) {
208
+ var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
209
+ while (ch = stream.next()) {
210
+ if (ch == ")" && maybeEnd) {
211
+ if(nestedCount > 0)
212
+ nestedCount--;
213
+ else {
214
+ popStateStack(state);
215
+ break;
216
+ }
217
+ }
218
+ else if(ch == ":" && maybeNested) {
219
+ nestedCount++;
220
+ }
221
+ maybeEnd = (ch == ":");
222
+ maybeNested = (ch == "(");
223
+ }
224
+
225
+ return ret("comment", "comment");
226
+ }
227
+
228
+ // tokenizer for string literals
229
+ // optionally pass a tokenizer function to set state.tokenize back to when finished
230
+ function tokenString(quote, f) {
231
+ return function(stream, state) {
232
+ var ch;
233
+
234
+ if(isInString(state) && stream.current() == quote) {
235
+ popStateStack(state);
236
+ if(f) state.tokenize = f;
237
+ return ret("string", "string");
238
+ }
239
+
240
+ pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
241
+
242
+ // if we're in a string and in an XML block, allow an embedded code block
243
+ if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
244
+ state.tokenize = tokenBase;
245
+ return ret("string", "string");
246
+ }
247
+
248
+
249
+ while (ch = stream.next()) {
250
+ if (ch == quote) {
251
+ popStateStack(state);
252
+ if(f) state.tokenize = f;
253
+ break;
254
+ }
255
+ else {
256
+ // if we're in a string and in an XML block, allow an embedded code block in an attribute
257
+ if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
258
+ state.tokenize = tokenBase;
259
+ return ret("string", "string");
260
+ }
261
+
262
+ }
263
+ }
264
+
265
+ return ret("string", "string");
266
+ };
267
+ }
268
+
269
+ // tokenizer for variables
270
+ function tokenVariable(stream, state) {
271
+ var isVariableChar = /[\w\$_-]/;
272
+
273
+ // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
274
+ if(stream.eat("\"")) {
275
+ while(stream.next() !== '\"'){};
276
+ stream.eat(":");
277
+ } else {
278
+ stream.eatWhile(isVariableChar);
279
+ if(!stream.match(":=", false)) stream.eat(":");
280
+ }
281
+ stream.eatWhile(isVariableChar);
282
+ state.tokenize = tokenBase;
283
+ return ret("variable", "variable");
284
+ }
285
+
286
+ // tokenizer for XML tags
287
+ function tokenTag(name, isclose) {
288
+ return function(stream, state) {
289
+ stream.eatSpace();
290
+ if(isclose && stream.eat(">")) {
291
+ popStateStack(state);
292
+ state.tokenize = tokenBase;
293
+ return ret("tag", "tag");
294
+ }
295
+ // self closing tag without attributes?
296
+ if(!stream.eat("/"))
297
+ pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
298
+ if(!stream.eat(">")) {
299
+ state.tokenize = tokenAttribute;
300
+ return ret("tag", "tag");
301
+ }
302
+ else {
303
+ state.tokenize = tokenBase;
304
+ }
305
+ return ret("tag", "tag");
306
+ };
307
+ }
308
+
309
+ // tokenizer for XML attributes
310
+ function tokenAttribute(stream, state) {
311
+ var ch = stream.next();
312
+
313
+ if(ch == "/" && stream.eat(">")) {
314
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
315
+ if(isInXmlBlock(state)) popStateStack(state);
316
+ return ret("tag", "tag");
317
+ }
318
+ if(ch == ">") {
319
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
320
+ return ret("tag", "tag");
321
+ }
322
+ if(ch == "=")
323
+ return ret("", null);
324
+ // quoted string
325
+ if (ch == '"' || ch == "'")
326
+ return chain(stream, state, tokenString(ch, tokenAttribute));
327
+
328
+ if(!isInXmlAttributeBlock(state))
329
+ pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
330
+
331
+ stream.eat(/[a-zA-Z_:]/);
332
+ stream.eatWhile(/[-a-zA-Z0-9_:.]/);
333
+ stream.eatSpace();
334
+
335
+ // the case where the attribute has not value and the tag was closed
336
+ if(stream.match(">", false) || stream.match("/", false)) {
337
+ popStateStack(state);
338
+ state.tokenize = tokenBase;
339
+ }
340
+
341
+ return ret("attribute", "attribute");
342
+ }
343
+
344
+ // handle comments, including nested
345
+ function tokenXMLComment(stream, state) {
346
+ var ch;
347
+ while (ch = stream.next()) {
348
+ if (ch == "-" && stream.match("->", true)) {
349
+ state.tokenize = tokenBase;
350
+ return ret("comment", "comment");
351
+ }
352
+ }
353
+ }
354
+
355
+
356
+ // handle CDATA
357
+ function tokenCDATA(stream, state) {
358
+ var ch;
359
+ while (ch = stream.next()) {
360
+ if (ch == "]" && stream.match("]", true)) {
361
+ state.tokenize = tokenBase;
362
+ return ret("comment", "comment");
363
+ }
364
+ }
365
+ }
366
+
367
+ // handle preprocessing instructions
368
+ function tokenPreProcessing(stream, state) {
369
+ var ch;
370
+ while (ch = stream.next()) {
371
+ if (ch == "?" && stream.match(">", true)) {
372
+ state.tokenize = tokenBase;
373
+ return ret("comment", "comment meta");
374
+ }
375
+ }
376
+ }
377
+
378
+
379
+ // functions to test the current context of the state
380
+ function isInXmlBlock(state) { return isIn(state, "tag"); }
381
+ function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
382
+ function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
383
+ function isInString(state) { return isIn(state, "string"); }
384
+
385
+ function isEQNameAhead(stream) {
386
+ // assume we've already eaten a quote (")
387
+ if(stream.current() === '"')
388
+ return stream.match(/^[^\"]+\"\:/, false);
389
+ else if(stream.current() === '\'')
390
+ return stream.match(/^[^\"]+\'\:/, false);
391
+ else
392
+ return false;
393
+ }
394
+
395
+ function isIn(state, type) {
396
+ return (state.stack.length && state.stack[state.stack.length - 1].type == type);
397
+ }
398
+
399
+ function pushStateStack(state, newState) {
400
+ state.stack.push(newState);
401
+ }
402
+
403
+ function popStateStack(state) {
404
+ state.stack.pop();
405
+ var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
406
+ state.tokenize = reinstateTokenize || tokenBase;
407
+ }
408
+
409
+ // the interface for the mode API
410
+ return {
411
+ startState: function() {
412
+ return {
413
+ tokenize: tokenBase,
414
+ cc: [],
415
+ stack: []
416
+ };
417
+ },
418
+
419
+ token: function(stream, state) {
420
+ if (stream.eatSpace()) return null;
421
+ var style = state.tokenize(stream, state);
422
+ return style;
423
+ },
424
+
425
+ blockCommentStart: "(:",
426
+ blockCommentEnd: ":)"
427
+
428
+ };
429
+
430
+ });
431
+
432
+ CodeMirror.defineMIME("application/xquery", "xquery");