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,144 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: Q mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="../../addon/edit/matchbrackets.js"></script>
10
+ <script src="q.js"></script>
11
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
12
+ <div id=nav>
13
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
14
+
15
+ <ul>
16
+ <li><a href="../../index.html">Home</a>
17
+ <li><a href="../../doc/manual.html">Manual</a>
18
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
19
+ </ul>
20
+ <ul>
21
+ <li><a href="../index.html">Language modes</a>
22
+ <li><a class=active href="#">Q</a>
23
+ </ul>
24
+ </div>
25
+
26
+ <article>
27
+ <h2>Q mode</h2>
28
+
29
+
30
+ <div><textarea id="code" name="code">
31
+ / utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q
32
+ / 2009.09.20 - updated to match latest csvguess.q
33
+
34
+ / .csv.colhdrs[file] - return a list of colhdrs from file
35
+ / info:.csv.info[file] - return a table of information about the file
36
+ / columns are:
37
+ / c - column name; ci - column index; t - load type; mw - max width;
38
+ / dchar - distinct characters in values; rule - rule that caught the type
39
+ / maybe - needs checking, _could_ be say a date, but perhaps just a float?
40
+ / .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols>
41
+ / example:
42
+ / info:.csv.info0[file;(.csv.colhdrs file)like"*price"]
43
+ / info:.csv.infolike[file;"*price"]
44
+ / show delete from info where t=" "
45
+ / .csv.data[file;info] - use the info from .csv.info to read the data
46
+ / .csv.data10[file;info] - like .csv.data but only returns the first 10 rows
47
+ / bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() )
48
+ / .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading
49
+
50
+ \d .csv
51
+ DELIM:","
52
+ ZAPHDRS:0b / lowercase and remove _ from colhdrs (junk characters are always removed)
53
+ WIDTHHDR:25000 / number of characters read to get the header
54
+ READLINES:222 / number of lines read and used to guess the types
55
+ SYMMAXWIDTH:11 / character columns narrower than this are stored as symbols
56
+ SYMMAXGR:10 / max symbol granularity% before we give up and keep as a * string
57
+ FORCECHARWIDTH:30 / every field (of any type) with values this wide or more is forced to character "*"
58
+ DISCARDEMPTY:0b / completely ignore empty columns if true else set them to "C"
59
+ CHUNKSIZE:50000000 / used in fs2 (modified .Q.fs)
60
+
61
+ k)nameltrim:{$[~@x;.z.s'x;~(*x)in aA:.Q.a,.Q.A;(+/&\~x in aA)_x;x]}
62
+ k)fs2:{[f;s]((-7!s)>){[f;s;x]i:1+last@&0xa=r:1:(s;x;CHUNKSIZE);f@`\:i#r;x+i}[f;s]/0j}
63
+ cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an}
64
+ cancast:{nw:x$"";if[not x in"BXCS";nw:(min 0#;max 0#;::)@\:nw];$[not any nw in x$(11&count y)#y;$[11<count y;not any nw in x$y;1b];0b]}
65
+
66
+ read:{[file]data[file;info[file]]}
67
+ read10:{[file]data10[file;info[file]]}
68
+
69
+ colhdrs:{[file]
70
+ `$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))}
71
+ data:{[file;info]
72
+ (exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file}
73
+ data10:{[file;info]
74
+ data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))}
75
+ info0:{[file;onlycols]
76
+ colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR));
77
+ loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"];
78
+ breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head);
79
+ nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks);
80
+ info:([]c:key flip as;v:value flip as);as:();
81
+ reserved:key`.q;reserved,:.Q.res;reserved,:`i;
82
+ info:update res:c in reserved from info;
83
+ info:update ci:i,t:"?",ipa:0b,mdot:0,mw:0,rule:0,gr:0,ndv:0,maybe:0b,empty:0b,j10:0b,j12:0b from info;
84
+ info:update ci:`s#ci from info;
85
+ if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols];
86
+ info:update sdv:{string(distinct x)except`}peach v from info;
87
+ info:update ndv:count each sdv from info;
88
+ info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv;
89
+ info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values
90
+ info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns
91
+ info:update dchar:{asc distinct raze x}peach sdv from info where t="?";
92
+ info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar;
93
+ info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric..
94
+ info:update t:"I",rule:50,ipa:1b from info where t="n",mw within 7 15,mdot=3,{all x in".0123456789"}each dchar,.csv.cancast["I"]peach sdv; / ip-address
95
+ info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv;
96
+ info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv;
97
+ info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv;
98
+ info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv;
99
+ info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9;
100
+ info:update t:"M",rule:110,maybe:1b from info where t in"nIHEF",mdot<2,mw within 4 7,.csv.cancast["M"]peach sdv;
101
+ info:update t:"D",rule:120,maybe:1b from info where t in"nI",mdot in 0 2,mw within 6 11,.csv.cancast["D"]peach sdv;
102
+ info:update t:"V",rule:130,maybe:1b from info where t="I",mw in 5 6,7<count each dchar,{all x like"*[0-9][0-5][0-9][0-5][0-9]"}peach sdv,.csv.cancast["V"]peach sdv; / 235959 12345
103
+ info:update t:"U",rule:140,maybe:1b from info where t="H",mw in 3 4,7<count each dchar,{all x like"*[0-9][0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv; /2359
104
+ info:update t:"U",rule:150,maybe:0b from info where t="n",mw in 4 5,mdot=0,{all x like"*[0-9]:[0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv;
105
+ info:update t:"T",rule:160,maybe:0b from info where t="n",mw within 7 12,mdot<2,{all x like"*[0-9]:[0-5][0-9]:[0-5][0-9]*"}peach sdv,.csv.cancast["T"]peach sdv;
106
+ info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv;
107
+ info:update t:"T",rule:180,maybe:1b from info where t in"EF",mw within 7 10,mdot=1,{all x like"*[0-9][0-5][0-9][0-5][0-9].*"}peach sdv,.csv.cancast["T"]peach sdv;
108
+ info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv;
109
+ info:update t:"P",rule:200,maybe:1b from info where t="n",mw within 12 29,mdot<4,{all x like"[12]*"}peach sdv,.csv.cancast["P"]peach sdv;
110
+ info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv;
111
+ info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric
112
+ info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char
113
+ info:update t:"B",rule:240,maybe:0b from info where t in"HC",mw=1,mdot=0,{$[all x in"01tTfFyYnN";(any"0fFnN"in x)and any"1tTyY"in x;0b]}each dchar; / boolean
114
+ info:update t:"B",rule:250,maybe:1b from info where t in"HC",mw=1,mdot=0,{all x in"01tTfFyYnN"}each dchar; / boolean
115
+ info:update t:"X",rule:260,maybe:0b from info where t="?",mw=2,{$[all x in"0123456789abcdefABCDEF";(any .Q.n in x)and any"abcdefABCDEF"in x;0b]}each dchar; /hex
116
+ info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting)
117
+ info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings
118
+ / flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols
119
+ info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar;
120
+ info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar;
121
+ select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info}
122
+ info:info0[;()] / by default don't restrict columns
123
+ infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"]
124
+
125
+ \d .
126
+ / DATA:()
127
+ bulkload:{[file;info]
128
+ if[not`DATA in system"v";'`DATA.not.defined];
129
+ if[count DATA;'`DATA.not.empty];
130
+ loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info;
131
+ .csv.fs2[{[file;loadhdrs;loadfmts] `DATA insert $[count DATA;flip loadhdrs!(loadfmts;.csv.DELIM)0:file;loadhdrs xcol(loadfmts;enlist .csv.DELIM)0:file]}[file;loadhdrs;loadfmts]];
132
+ count DATA}
133
+ @[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file
134
+ </textarea></div>
135
+
136
+ <script>
137
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
138
+ lineNumbers: true,
139
+ matchBrackets: true
140
+ });
141
+ </script>
142
+
143
+ <p><strong>MIME type defined:</strong> <code>text/x-q</code>.</p>
144
+ </article>
@@ -0,0 +1,124 @@
1
+ CodeMirror.defineMode("q",function(config){
2
+ var indentUnit=config.indentUnit,
3
+ curPunc,
4
+ keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]),
5
+ E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;
6
+ function buildRE(w){return new RegExp("^("+w.join("|")+")$");}
7
+ function tokenBase(stream,state){
8
+ var sol=stream.sol(),c=stream.next();
9
+ curPunc=null;
10
+ if(sol)
11
+ if(c=="/")
12
+ return(state.tokenize=tokenLineComment)(stream,state);
13
+ else if(c=="\\"){
14
+ if(stream.eol()||/\s/.test(stream.peek()))
15
+ return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream, state):state.tokenize=tokenBase,"comment";
16
+ else
17
+ return state.tokenize=tokenBase,"builtin";
18
+ }
19
+ if(/\s/.test(c))
20
+ return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"whitespace";
21
+ if(c=='"')
22
+ return(state.tokenize=tokenString)(stream,state);
23
+ if(c=='`')
24
+ return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol";
25
+ if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){
26
+ var t=null;
27
+ stream.backUp(1);
28
+ if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
29
+ || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)
30
+ || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)
31
+ || stream.match(/^\d+[ptuv]{1}/))
32
+ t="temporal";
33
+ else if(stream.match(/^0[NwW]{1}/)
34
+ || stream.match(/^0x[\d|a-f|A-F]*/)
35
+ || stream.match(/^[0|1]+[b]{1}/)
36
+ || stream.match(/^\d+[chijn]{1}/)
37
+ || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))
38
+ t="number";
39
+ return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error");
40
+ }
41
+ if(/[A-Z|a-z]|\./.test(c))
42
+ return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/),keywords.test(stream.current())?"keyword":"variable";
43
+ if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c))
44
+ return null;
45
+ if(/[{}\(\[\]\)]/.test(c))
46
+ return null;
47
+ return"error";
48
+ }
49
+ function tokenLineComment(stream,state){
50
+ return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment";
51
+ }
52
+ function tokenBlockComment(stream,state){
53
+ var f=stream.sol()&&stream.peek()=="\\";
54
+ stream.skipToEnd();
55
+ if(f&&/^\\\s*$/.test(stream.current()))
56
+ state.tokenize=tokenBase;
57
+ return"comment";
58
+ }
59
+ function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";}
60
+ function tokenString(stream,state){
61
+ var escaped=false,next,end=false;
62
+ while((next=stream.next())){
63
+ if(next=="\""&&!escaped){end=true;break;}
64
+ escaped=!escaped&&next=="\\";
65
+ }
66
+ if(end)state.tokenize=tokenBase;
67
+ return"string";
68
+ }
69
+ function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};}
70
+ function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;}
71
+ return{
72
+ startState:function(){
73
+ return{tokenize:tokenBase,
74
+ context:null,
75
+ indent:0,
76
+ col:0};
77
+ },
78
+ token:function(stream,state){
79
+ if(stream.sol()){
80
+ if(state.context&&state.context.align==null)
81
+ state.context.align=false;
82
+ state.indent=stream.indentation();
83
+ }
84
+ //if (stream.eatSpace()) return null;
85
+ var style=state.tokenize(stream,state);
86
+ if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){
87
+ state.context.align=true;
88
+ }
89
+ if(curPunc=="(")pushContext(state,")",stream.column());
90
+ else if(curPunc=="[")pushContext(state,"]",stream.column());
91
+ else if(curPunc=="{")pushContext(state,"}",stream.column());
92
+ else if(/[\]\}\)]/.test(curPunc)){
93
+ while(state.context&&state.context.type=="pattern")popContext(state);
94
+ if(state.context&&curPunc==state.context.type)popContext(state);
95
+ }
96
+ else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state);
97
+ else if(/atom|string|variable/.test(style)&&state.context){
98
+ if(/[\}\]]/.test(state.context.type))
99
+ pushContext(state,"pattern",stream.column());
100
+ else if(state.context.type=="pattern"&&!state.context.align){
101
+ state.context.align=true;
102
+ state.context.col=stream.column();
103
+ }
104
+ }
105
+ return style;
106
+ },
107
+ indent:function(state,textAfter){
108
+ var firstChar=textAfter&&textAfter.charAt(0);
109
+ var context=state.context;
110
+ if(/[\]\}]/.test(firstChar))
111
+ while (context&&context.type=="pattern")context=context.prev;
112
+ var closing=context&&firstChar==context.type;
113
+ if(!context)
114
+ return 0;
115
+ else if(context.type=="pattern")
116
+ return context.col;
117
+ else if(context.align)
118
+ return context.col+(closing?0:1);
119
+ else
120
+ return context.indent+(closing?0:indentUnit);
121
+ }
122
+ };
123
+ });
124
+ CodeMirror.defineMIME("text/x-q","q");
@@ -0,0 +1,86 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: R mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="r.js"></script>
10
+ <style>
11
+ .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
12
+ .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
13
+ .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
14
+ .cm-s-default span.cm-arrow { color: brown; }
15
+ .cm-s-default span.cm-arg-is { color: brown; }
16
+ </style>
17
+ <div id=nav>
18
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
19
+
20
+ <ul>
21
+ <li><a href="../../index.html">Home</a>
22
+ <li><a href="../../doc/manual.html">Manual</a>
23
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
24
+ </ul>
25
+ <ul>
26
+ <li><a href="../index.html">Language modes</a>
27
+ <li><a class=active href="#">R</a>
28
+ </ul>
29
+ </div>
30
+
31
+ <article>
32
+ <h2>R mode</h2>
33
+ <form><textarea id="code" name="code">
34
+ # Code from http://www.mayin.org/ajayshah/KB/R/
35
+
36
+ # FIRST LEARN ABOUT LISTS --
37
+ X = list(height=5.4, weight=54)
38
+ print("Use default printing --")
39
+ print(X)
40
+ print("Accessing individual elements --")
41
+ cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
42
+
43
+ # FUNCTIONS --
44
+ square <- function(x) {
45
+ return(x*x)
46
+ }
47
+ cat("The square of 3 is ", square(3), "\n")
48
+
49
+ # default value of the arg is set to 5.
50
+ cube <- function(x=5) {
51
+ return(x*x*x);
52
+ }
53
+ cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
54
+ cat("Calling cube : ", cube(), "\n") # will default to 5^3.
55
+
56
+ # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
57
+ powers <- function(x) {
58
+ parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
59
+ return(parcel);
60
+ }
61
+
62
+ X = powers(3);
63
+ print("Showing powers of 3 --"); print(X);
64
+
65
+ # WRITING THIS COMPACTLY (4 lines instead of 7)
66
+
67
+ powerful <- function(x) {
68
+ return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
69
+ }
70
+ print("Showing powers of 3 --"); print(powerful(3));
71
+
72
+ # In R, the last expression in a function is, by default, what is
73
+ # returned. So you could equally just say:
74
+ powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
75
+ </textarea></form>
76
+ <script>
77
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
78
+ </script>
79
+
80
+ <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
81
+
82
+ <p>Development of the CodeMirror R mode was kindly sponsored
83
+ by <a href="http://ubalo.com/">Ubalo</a>, who hold
84
+ the <a href="LICENSE">license</a>.</p>
85
+
86
+ </article>
@@ -0,0 +1,141 @@
1
+ CodeMirror.defineMode("r", function(config) {
2
+ function wordObj(str) {
3
+ var words = str.split(" "), res = {};
4
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
5
+ return res;
6
+ }
7
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
8
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
9
+ var keywords = wordObj("if else repeat while function for in next break");
10
+ var blockkeywords = wordObj("if else repeat while function for");
11
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
12
+ var curPunc;
13
+
14
+ function tokenBase(stream, state) {
15
+ curPunc = null;
16
+ var ch = stream.next();
17
+ if (ch == "#") {
18
+ stream.skipToEnd();
19
+ return "comment";
20
+ } else if (ch == "0" && stream.eat("x")) {
21
+ stream.eatWhile(/[\da-f]/i);
22
+ return "number";
23
+ } else if (ch == "." && stream.eat(/\d/)) {
24
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
25
+ return "number";
26
+ } else if (/\d/.test(ch)) {
27
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
28
+ return "number";
29
+ } else if (ch == "'" || ch == '"') {
30
+ state.tokenize = tokenString(ch);
31
+ return "string";
32
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
33
+ return "keyword";
34
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
35
+ stream.eatWhile(/[\w\.]/);
36
+ var word = stream.current();
37
+ if (atoms.propertyIsEnumerable(word)) return "atom";
38
+ if (keywords.propertyIsEnumerable(word)) {
39
+ if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
40
+ return "keyword";
41
+ }
42
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
43
+ return "variable";
44
+ } else if (ch == "%") {
45
+ if (stream.skipTo("%")) stream.next();
46
+ return "variable-2";
47
+ } else if (ch == "<" && stream.eat("-")) {
48
+ return "arrow";
49
+ } else if (ch == "=" && state.ctx.argList) {
50
+ return "arg-is";
51
+ } else if (opChars.test(ch)) {
52
+ if (ch == "$") return "dollar";
53
+ stream.eatWhile(opChars);
54
+ return "operator";
55
+ } else if (/[\(\){}\[\];]/.test(ch)) {
56
+ curPunc = ch;
57
+ if (ch == ";") return "semi";
58
+ return null;
59
+ } else {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ function tokenString(quote) {
65
+ return function(stream, state) {
66
+ if (stream.eat("\\")) {
67
+ var ch = stream.next();
68
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
69
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
70
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
71
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
72
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
73
+ return "string-2";
74
+ } else {
75
+ var next;
76
+ while ((next = stream.next()) != null) {
77
+ if (next == quote) { state.tokenize = tokenBase; break; }
78
+ if (next == "\\") { stream.backUp(1); break; }
79
+ }
80
+ return "string";
81
+ }
82
+ };
83
+ }
84
+
85
+ function push(state, type, stream) {
86
+ state.ctx = {type: type,
87
+ indent: state.indent,
88
+ align: null,
89
+ column: stream.column(),
90
+ prev: state.ctx};
91
+ }
92
+ function pop(state) {
93
+ state.indent = state.ctx.indent;
94
+ state.ctx = state.ctx.prev;
95
+ }
96
+
97
+ return {
98
+ startState: function() {
99
+ return {tokenize: tokenBase,
100
+ ctx: {type: "top",
101
+ indent: -config.indentUnit,
102
+ align: false},
103
+ indent: 0,
104
+ afterIdent: false};
105
+ },
106
+
107
+ token: function(stream, state) {
108
+ if (stream.sol()) {
109
+ if (state.ctx.align == null) state.ctx.align = false;
110
+ state.indent = stream.indentation();
111
+ }
112
+ if (stream.eatSpace()) return null;
113
+ var style = state.tokenize(stream, state);
114
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
115
+
116
+ var ctype = state.ctx.type;
117
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
118
+ if (curPunc == "{") push(state, "}", stream);
119
+ else if (curPunc == "(") {
120
+ push(state, ")", stream);
121
+ if (state.afterIdent) state.ctx.argList = true;
122
+ }
123
+ else if (curPunc == "[") push(state, "]", stream);
124
+ else if (curPunc == "block") push(state, "block", stream);
125
+ else if (curPunc == ctype) pop(state);
126
+ state.afterIdent = style == "variable" || style == "keyword";
127
+ return style;
128
+ },
129
+
130
+ indent: function(state, textAfter) {
131
+ if (state.tokenize != tokenBase) return 0;
132
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
133
+ closing = firstChar == ctx.type;
134
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
135
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
136
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
137
+ }
138
+ };
139
+ });
140
+
141
+ CodeMirror.defineMIME("text/x-rsrc", "r");