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,63 @@
1
+ CodeMirror.defineMode("properties", function() {
2
+ return {
3
+ token: function(stream, state) {
4
+ var sol = stream.sol() || state.afterSection;
5
+ var eol = stream.eol();
6
+
7
+ state.afterSection = false;
8
+
9
+ if (sol) {
10
+ if (state.nextMultiline) {
11
+ state.inMultiline = true;
12
+ state.nextMultiline = false;
13
+ } else {
14
+ state.position = "def";
15
+ }
16
+ }
17
+
18
+ if (eol && ! state.nextMultiline) {
19
+ state.inMultiline = false;
20
+ state.position = "def";
21
+ }
22
+
23
+ if (sol) {
24
+ while(stream.eatSpace());
25
+ }
26
+
27
+ var ch = stream.next();
28
+
29
+ if (sol && (ch === "#" || ch === "!" || ch === ";")) {
30
+ state.position = "comment";
31
+ stream.skipToEnd();
32
+ return "comment";
33
+ } else if (sol && ch === "[") {
34
+ state.afterSection = true;
35
+ stream.skipTo("]"); stream.eat("]");
36
+ return "header";
37
+ } else if (ch === "=" || ch === ":") {
38
+ state.position = "quote";
39
+ return null;
40
+ } else if (ch === "\\" && state.position === "quote") {
41
+ if (stream.next() !== "u") { // u = Unicode sequence \u1234
42
+ // Multiline value
43
+ state.nextMultiline = true;
44
+ }
45
+ }
46
+
47
+ return state.position;
48
+ },
49
+
50
+ startState: function() {
51
+ return {
52
+ position : "def", // Current position, "def", "quote" or "comment"
53
+ nextMultiline : false, // Is the next line multiline value
54
+ inMultiline : false, // Is the current line a multiline value
55
+ afterSection : false // Did we just open a section
56
+ };
57
+ }
58
+
59
+ };
60
+ });
61
+
62
+ CodeMirror.defineMIME("text/x-properties", "properties");
63
+ CodeMirror.defineMIME("text/x-ini", "properties");
@@ -0,0 +1,187 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: Python 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="python.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="#">Python</a>
23
+ </ul>
24
+ </div>
25
+
26
+ <article>
27
+ <h2>Python mode</h2>
28
+
29
+ <div><textarea id="code" name="code">
30
+ # Literals
31
+ 1234
32
+ 0.0e101
33
+ .123
34
+ 0b01010011100
35
+ 0o01234567
36
+ 0x0987654321abcdef
37
+ 7
38
+ 2147483647
39
+ 3L
40
+ 79228162514264337593543950336L
41
+ 0x100000000L
42
+ 79228162514264337593543950336
43
+ 0xdeadbeef
44
+ 3.14j
45
+ 10.j
46
+ 10j
47
+ .001j
48
+ 1e100j
49
+ 3.14e-10j
50
+
51
+
52
+ # String Literals
53
+ 'For\''
54
+ "God\""
55
+ """so loved
56
+ the world"""
57
+ '''that he gave
58
+ his only begotten\' '''
59
+ 'that whosoever believeth \
60
+ in him'
61
+ ''
62
+
63
+ # Identifiers
64
+ __a__
65
+ a.b
66
+ a.b.c
67
+
68
+ # Operators
69
+ + - * / % & | ^ ~ < >
70
+ == != <= >= <> << >> // **
71
+ and or not in is
72
+
73
+ # Delimiters
74
+ () [] {} , : ` = ; @ . # Note that @ and . require the proper context.
75
+ += -= *= /= %= &= |= ^=
76
+ //= >>= <<= **=
77
+
78
+ # Keywords
79
+ as assert break class continue def del elif else except
80
+ finally for from global if import lambda pass raise
81
+ return try while with yield
82
+
83
+ # Python 2 Keywords (otherwise Identifiers)
84
+ exec print
85
+
86
+ # Python 3 Keywords (otherwise Identifiers)
87
+ nonlocal
88
+
89
+ # Types
90
+ bool classmethod complex dict enumerate float frozenset int list object
91
+ property reversed set slice staticmethod str super tuple type
92
+
93
+ # Python 2 Types (otherwise Identifiers)
94
+ basestring buffer file long unicode xrange
95
+
96
+ # Python 3 Types (otherwise Identifiers)
97
+ bytearray bytes filter map memoryview open range zip
98
+
99
+ # Some Example code
100
+ import os
101
+ from package import ParentClass
102
+
103
+ @nonsenseDecorator
104
+ def doesNothing():
105
+ pass
106
+
107
+ class ExampleClass(ParentClass):
108
+ @staticmethod
109
+ def example(inputStr):
110
+ a = list(inputStr)
111
+ a.reverse()
112
+ return ''.join(a)
113
+
114
+ def __init__(self, mixin = 'Hello'):
115
+ self.mixin = mixin
116
+
117
+ </textarea></div>
118
+
119
+
120
+ <h2>Cython mode</h2>
121
+
122
+ <div><textarea id="code-cython" name="code-cython">
123
+
124
+ import numpy as np
125
+ cimport cython
126
+ from libc.math cimport sqrt
127
+
128
+ @cython.boundscheck(False)
129
+ @cython.wraparound(False)
130
+ def pairwise_cython(double[:, ::1] X):
131
+ cdef int M = X.shape[0]
132
+ cdef int N = X.shape[1]
133
+ cdef double tmp, d
134
+ cdef double[:, ::1] D = np.empty((M, M), dtype=np.float64)
135
+ for i in range(M):
136
+ for j in range(M):
137
+ d = 0.0
138
+ for k in range(N):
139
+ tmp = X[i, k] - X[j, k]
140
+ d += tmp * tmp
141
+ D[i, j] = sqrt(d)
142
+ return np.asarray(D)
143
+
144
+ </textarea></div>
145
+
146
+ <script>
147
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
148
+ mode: {name: "python",
149
+ version: 2,
150
+ singleLineStringErrors: false},
151
+ lineNumbers: true,
152
+ indentUnit: 4,
153
+ tabMode: "shift",
154
+ matchBrackets: true
155
+ });
156
+
157
+ CodeMirror.fromTextArea(document.getElementById("code-cython"), {
158
+ mode: {name: "text/x-cython",
159
+ version: 2,
160
+ singleLineStringErrors: false},
161
+ lineNumbers: true,
162
+ indentUnit: 4,
163
+ tabMode: "shift",
164
+ matchBrackets: true
165
+ });
166
+ </script>
167
+ <h2>Configuration Options for Python mode:</h2>
168
+ <ul>
169
+ <li>version - 2/3 - The version of Python to recognize. Default is 2.</li>
170
+ <li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>
171
+ </ul>
172
+ <h2>Advanced Configuration Options:</h2>
173
+ <p>Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help</p>
174
+ <ul>
175
+ <li>singleOperators - RegEx - Regular Expression for single operator matching, default : <pre>^[\\+\\-\\*/%&amp;|\\^~&lt;&gt;!]</pre></li>
176
+ <li>singleDelimiters - RegEx - Regular Expression for single delimiter matching, default : <pre>^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]</pre></li>
177
+ <li>doubleOperators - RegEx - Regular Expression for double operators matching, default : <pre>^((==)|(!=)|(&lt;=)|(&gt;=)|(&lt;&gt;)|(&lt;&lt;)|(&gt;&gt;)|(//)|(\\*\\*))</pre></li>
178
+ <li>doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default : <pre>^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&amp;=)|(\\|=)|(\\^=))</pre></li>
179
+ <li>tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default : <pre>^((//=)|(&gt;&gt;=)|(&lt;&lt;=)|(\\*\\*=))</pre></li>
180
+ <li>identifiers - RegEx - Regular Expression for identifier, default : <pre>^[_A-Za-z][_A-Za-z0-9]*</pre></li>
181
+ <li>extra_keywords - list of string - List of extra words ton consider as keywords</li>
182
+ <li>extra_builtins - list of string - List of extra words ton consider as builtins</li>
183
+ </ul>
184
+
185
+
186
+ <p><strong>MIME types defined:</strong> <code>text/x-python</code> and <code>text/x-cython</code>.</p>
187
+ </article>
@@ -0,0 +1,368 @@
1
+ CodeMirror.defineMode("python", function(conf, parserConf) {
2
+ var ERRORCLASS = 'error';
3
+
4
+ function wordRegexp(words) {
5
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
6
+ }
7
+
8
+ var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
9
+ var singleDelimiters = parserConf.singleDelimiters || new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
10
+ var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
11
+ var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
12
+ var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
13
+ var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
14
+
15
+ var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
16
+ var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
17
+ 'def', 'del', 'elif', 'else', 'except', 'finally',
18
+ 'for', 'from', 'global', 'if', 'import',
19
+ 'lambda', 'pass', 'raise', 'return',
20
+ 'try', 'while', 'with', 'yield'];
21
+ var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
22
+ 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
23
+ 'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
24
+ 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
25
+ 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
26
+ 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
27
+ 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
28
+ 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
29
+ 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
30
+ 'type', 'vars', 'zip', '__import__', 'NotImplemented',
31
+ 'Ellipsis', '__debug__'];
32
+ var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
33
+ 'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
34
+ 'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
35
+ 'keywords': ['exec', 'print']};
36
+ var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
37
+ 'keywords': ['nonlocal', 'False', 'True', 'None']};
38
+
39
+ if(parserConf.extra_keywords != undefined){
40
+ commonkeywords = commonkeywords.concat(parserConf.extra_keywords);
41
+ }
42
+ if(parserConf.extra_builtins != undefined){
43
+ commonBuiltins = commonBuiltins.concat(parserConf.extra_builtins);
44
+ }
45
+ if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
46
+ commonkeywords = commonkeywords.concat(py3.keywords);
47
+ commonBuiltins = commonBuiltins.concat(py3.builtins);
48
+ var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
49
+ } else {
50
+ commonkeywords = commonkeywords.concat(py2.keywords);
51
+ commonBuiltins = commonBuiltins.concat(py2.builtins);
52
+ var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
53
+ }
54
+ var keywords = wordRegexp(commonkeywords);
55
+ var builtins = wordRegexp(commonBuiltins);
56
+
57
+ var indentInfo = null;
58
+
59
+ // tokenizers
60
+ function tokenBase(stream, state) {
61
+ // Handle scope changes
62
+ if (stream.sol()) {
63
+ var scopeOffset = state.scopes[0].offset;
64
+ if (stream.eatSpace()) {
65
+ var lineOffset = stream.indentation();
66
+ if (lineOffset > scopeOffset) {
67
+ indentInfo = 'indent';
68
+ } else if (lineOffset < scopeOffset) {
69
+ indentInfo = 'dedent';
70
+ }
71
+ return null;
72
+ } else {
73
+ if (scopeOffset > 0) {
74
+ dedent(stream, state);
75
+ }
76
+ }
77
+ }
78
+ if (stream.eatSpace()) {
79
+ return null;
80
+ }
81
+
82
+ var ch = stream.peek();
83
+
84
+ // Handle Comments
85
+ if (ch === '#') {
86
+ stream.skipToEnd();
87
+ return 'comment';
88
+ }
89
+
90
+ // Handle Number Literals
91
+ if (stream.match(/^[0-9\.]/, false)) {
92
+ var floatLiteral = false;
93
+ // Floats
94
+ if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
95
+ if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
96
+ if (stream.match(/^\.\d+/)) { floatLiteral = true; }
97
+ if (floatLiteral) {
98
+ // Float literals may be "imaginary"
99
+ stream.eat(/J/i);
100
+ return 'number';
101
+ }
102
+ // Integers
103
+ var intLiteral = false;
104
+ // Hex
105
+ if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
106
+ // Binary
107
+ if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
108
+ // Octal
109
+ if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
110
+ // Decimal
111
+ if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
112
+ // Decimal literals may be "imaginary"
113
+ stream.eat(/J/i);
114
+ // TODO - Can you have imaginary longs?
115
+ intLiteral = true;
116
+ }
117
+ // Zero by itself with no other piece of number.
118
+ if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
119
+ if (intLiteral) {
120
+ // Integer literals may be "long"
121
+ stream.eat(/L/i);
122
+ return 'number';
123
+ }
124
+ }
125
+
126
+ // Handle Strings
127
+ if (stream.match(stringPrefixes)) {
128
+ state.tokenize = tokenStringFactory(stream.current());
129
+ return state.tokenize(stream, state);
130
+ }
131
+
132
+ // Handle operators and Delimiters
133
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
134
+ return null;
135
+ }
136
+ if (stream.match(doubleOperators)
137
+ || stream.match(singleOperators)
138
+ || stream.match(wordOperators)) {
139
+ return 'operator';
140
+ }
141
+ if (stream.match(singleDelimiters)) {
142
+ return null;
143
+ }
144
+
145
+ if (stream.match(keywords)) {
146
+ return 'keyword';
147
+ }
148
+
149
+ if (stream.match(builtins)) {
150
+ return 'builtin';
151
+ }
152
+
153
+ if (stream.match(identifiers)) {
154
+ if (state.lastToken == 'def' || state.lastToken == 'class') {
155
+ return 'def';
156
+ }
157
+ return 'variable';
158
+ }
159
+
160
+ // Handle non-detected items
161
+ stream.next();
162
+ return ERRORCLASS;
163
+ }
164
+
165
+ function tokenStringFactory(delimiter) {
166
+ while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
167
+ delimiter = delimiter.substr(1);
168
+ }
169
+ var singleline = delimiter.length == 1;
170
+ var OUTCLASS = 'string';
171
+
172
+ function tokenString(stream, state) {
173
+ while (!stream.eol()) {
174
+ stream.eatWhile(/[^'"\\]/);
175
+ if (stream.eat('\\')) {
176
+ stream.next();
177
+ if (singleline && stream.eol()) {
178
+ return OUTCLASS;
179
+ }
180
+ } else if (stream.match(delimiter)) {
181
+ state.tokenize = tokenBase;
182
+ return OUTCLASS;
183
+ } else {
184
+ stream.eat(/['"]/);
185
+ }
186
+ }
187
+ if (singleline) {
188
+ if (parserConf.singleLineStringErrors) {
189
+ return ERRORCLASS;
190
+ } else {
191
+ state.tokenize = tokenBase;
192
+ }
193
+ }
194
+ return OUTCLASS;
195
+ }
196
+ tokenString.isString = true;
197
+ return tokenString;
198
+ }
199
+
200
+ function indent(stream, state, type) {
201
+ type = type || 'py';
202
+ var indentUnit = 0;
203
+ if (type === 'py') {
204
+ if (state.scopes[0].type !== 'py') {
205
+ state.scopes[0].offset = stream.indentation();
206
+ return;
207
+ }
208
+ for (var i = 0; i < state.scopes.length; ++i) {
209
+ if (state.scopes[i].type === 'py') {
210
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
211
+ break;
212
+ }
213
+ }
214
+ } else {
215
+ indentUnit = stream.column() + stream.current().length;
216
+ }
217
+ state.scopes.unshift({
218
+ offset: indentUnit,
219
+ type: type
220
+ });
221
+ }
222
+
223
+ function dedent(stream, state, type) {
224
+ type = type || 'py';
225
+ if (state.scopes.length == 1) return;
226
+ if (state.scopes[0].type === 'py') {
227
+ var _indent = stream.indentation();
228
+ var _indent_index = -1;
229
+ for (var i = 0; i < state.scopes.length; ++i) {
230
+ if (_indent === state.scopes[i].offset) {
231
+ _indent_index = i;
232
+ break;
233
+ }
234
+ }
235
+ if (_indent_index === -1) {
236
+ return true;
237
+ }
238
+ while (state.scopes[0].offset !== _indent) {
239
+ state.scopes.shift();
240
+ }
241
+ return false;
242
+ } else {
243
+ if (type === 'py') {
244
+ state.scopes[0].offset = stream.indentation();
245
+ return false;
246
+ } else {
247
+ if (state.scopes[0].type != type) {
248
+ return true;
249
+ }
250
+ state.scopes.shift();
251
+ return false;
252
+ }
253
+ }
254
+ }
255
+
256
+ function tokenLexer(stream, state) {
257
+ indentInfo = null;
258
+ var style = state.tokenize(stream, state);
259
+ var current = stream.current();
260
+
261
+ // Handle '.' connected identifiers
262
+ if (current === '.') {
263
+ style = stream.match(identifiers, false) ? null : ERRORCLASS;
264
+ if (style === null && state.lastStyle === 'meta') {
265
+ // Apply 'meta' style to '.' connected identifiers when
266
+ // appropriate.
267
+ style = 'meta';
268
+ }
269
+ return style;
270
+ }
271
+
272
+ // Handle decorators
273
+ if (current === '@') {
274
+ return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
275
+ }
276
+
277
+ if ((style === 'variable' || style === 'builtin')
278
+ && state.lastStyle === 'meta') {
279
+ style = 'meta';
280
+ }
281
+
282
+ // Handle scope changes.
283
+ if (current === 'pass' || current === 'return') {
284
+ state.dedent += 1;
285
+ }
286
+ if (current === 'lambda') state.lambda = true;
287
+ if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
288
+ || indentInfo === 'indent') {
289
+ indent(stream, state);
290
+ }
291
+ var delimiter_index = '[({'.indexOf(current);
292
+ if (delimiter_index !== -1) {
293
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
294
+ }
295
+ if (indentInfo === 'dedent') {
296
+ if (dedent(stream, state)) {
297
+ return ERRORCLASS;
298
+ }
299
+ }
300
+ delimiter_index = '])}'.indexOf(current);
301
+ if (delimiter_index !== -1) {
302
+ if (dedent(stream, state, current)) {
303
+ return ERRORCLASS;
304
+ }
305
+ }
306
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
307
+ if (state.scopes.length > 1) state.scopes.shift();
308
+ state.dedent -= 1;
309
+ }
310
+
311
+ return style;
312
+ }
313
+
314
+ var external = {
315
+ startState: function(basecolumn) {
316
+ return {
317
+ tokenize: tokenBase,
318
+ scopes: [{offset:basecolumn || 0, type:'py'}],
319
+ lastStyle: null,
320
+ lastToken: null,
321
+ lambda: false,
322
+ dedent: 0
323
+ };
324
+ },
325
+
326
+ token: function(stream, state) {
327
+ var style = tokenLexer(stream, state);
328
+
329
+ state.lastStyle = style;
330
+
331
+ var current = stream.current();
332
+ if (current && style) {
333
+ state.lastToken = current;
334
+ }
335
+
336
+ if (stream.eol() && state.lambda) {
337
+ state.lambda = false;
338
+ }
339
+ return style;
340
+ },
341
+
342
+ indent: function(state) {
343
+ if (state.tokenize != tokenBase) {
344
+ return state.tokenize.isString ? CodeMirror.Pass : 0;
345
+ }
346
+
347
+ return state.scopes[0].offset;
348
+ },
349
+
350
+ lineComment: "#",
351
+ fold: "indent"
352
+ };
353
+ return external;
354
+ });
355
+
356
+ CodeMirror.defineMIME("text/x-python", "python");
357
+
358
+ (function() {
359
+ "use strict";
360
+ var words = function(str){return str.split(' ');};
361
+
362
+ CodeMirror.defineMIME("text/x-cython", {
363
+ name: "python",
364
+ extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
365
+ "extern gil include nogil property public"+
366
+ "readonly struct union DEF IF ELIF ELSE")
367
+ });
368
+ })();