swagr 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. data/bin/swagr +15 -0
  2. data/examples/examples01/app.rb +6 -2
  3. data/examples/examples01/coffee/data_port.coffee +2 -0
  4. data/examples/examples01/static/css/codemirror.css +1247 -0
  5. data/examples/examples01/static/js/codemirror-compressed-3-0.js +5 -0
  6. data/examples/examples01/static/js/codemirror/keymap/emacs.js +30 -0
  7. data/examples/examples01/static/js/codemirror/keymap/vim.js +2298 -0
  8. data/examples/examples01/static/js/codemirror/lib/codemirror.css +239 -0
  9. data/examples/examples01/static/js/codemirror/lib/codemirror.js +4553 -0
  10. data/examples/examples01/static/js/codemirror/lib/util/closetag.js +85 -0
  11. data/examples/examples01/static/js/codemirror/lib/util/colorize.js +29 -0
  12. data/examples/examples01/static/js/codemirror/lib/util/continuecomment.js +36 -0
  13. data/examples/examples01/static/js/codemirror/lib/util/continuelist.js +28 -0
  14. data/examples/examples01/static/js/codemirror/lib/util/dialog.css +32 -0
  15. data/examples/examples01/static/js/codemirror/lib/util/dialog.js +75 -0
  16. data/examples/examples01/static/js/codemirror/lib/util/foldcode.js +182 -0
  17. data/examples/examples01/static/js/codemirror/lib/util/formatting.js +108 -0
  18. data/examples/examples01/static/js/codemirror/lib/util/javascript-hint.js +137 -0
  19. data/examples/examples01/static/js/codemirror/lib/util/loadmode.js +51 -0
  20. data/examples/examples01/static/js/codemirror/lib/util/match-highlighter.js +46 -0
  21. data/examples/examples01/static/js/codemirror/lib/util/matchbrackets.js +63 -0
  22. data/examples/examples01/static/js/codemirror/lib/util/multiplex.js +95 -0
  23. data/examples/examples01/static/js/codemirror/lib/util/overlay.js +59 -0
  24. data/examples/examples01/static/js/codemirror/lib/util/pig-hint.js +117 -0
  25. data/examples/examples01/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
  26. data/examples/examples01/static/js/codemirror/lib/util/runmode.js +52 -0
  27. data/examples/examples01/static/js/codemirror/lib/util/search.js +119 -0
  28. data/examples/examples01/static/js/codemirror/lib/util/searchcursor.js +119 -0
  29. data/examples/examples01/static/js/codemirror/lib/util/simple-hint.css +16 -0
  30. data/examples/examples01/static/js/codemirror/lib/util/simple-hint.js +102 -0
  31. data/examples/examples01/static/js/codemirror/lib/util/xml-hint.js +131 -0
  32. data/examples/examples01/static/js/codemirror/mode/clike/clike.js +300 -0
  33. data/examples/examples01/static/js/codemirror/mode/clike/index.html +103 -0
  34. data/examples/examples01/static/js/codemirror/mode/clike/scala.html +767 -0
  35. data/examples/examples01/static/js/codemirror/mode/clojure/clojure.js +206 -0
  36. data/examples/examples01/static/js/codemirror/mode/clojure/index.html +67 -0
  37. data/examples/examples01/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
  38. data/examples/examples01/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
  39. data/examples/examples01/static/js/codemirror/mode/coffeescript/index.html +728 -0
  40. data/examples/examples01/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
  41. data/examples/examples01/static/js/codemirror/mode/commonlisp/index.html +165 -0
  42. data/examples/examples01/static/js/codemirror/mode/css/css.js +465 -0
  43. data/examples/examples01/static/js/codemirror/mode/css/index.html +58 -0
  44. data/examples/examples01/static/js/codemirror/mode/css/test.js +501 -0
  45. data/examples/examples01/static/js/codemirror/mode/diff/diff.js +32 -0
  46. data/examples/examples01/static/js/codemirror/mode/diff/index.html +105 -0
  47. data/examples/examples01/static/js/codemirror/mode/ecl/ecl.js +192 -0
  48. data/examples/examples01/static/js/codemirror/mode/ecl/index.html +39 -0
  49. data/examples/examples01/static/js/codemirror/mode/erlang/erlang.js +463 -0
  50. data/examples/examples01/static/js/codemirror/mode/erlang/index.html +64 -0
  51. data/examples/examples01/static/js/codemirror/mode/gfm/gfm.js +94 -0
  52. data/examples/examples01/static/js/codemirror/mode/gfm/index.html +70 -0
  53. data/examples/examples01/static/js/codemirror/mode/gfm/test.js +225 -0
  54. data/examples/examples01/static/js/codemirror/mode/go/go.js +165 -0
  55. data/examples/examples01/static/js/codemirror/mode/go/index.html +74 -0
  56. data/examples/examples01/static/js/codemirror/mode/groovy/groovy.js +210 -0
  57. data/examples/examples01/static/js/codemirror/mode/groovy/index.html +73 -0
  58. data/examples/examples01/static/js/codemirror/mode/haskell/haskell.js +242 -0
  59. data/examples/examples01/static/js/codemirror/mode/haskell/index.html +62 -0
  60. data/examples/examples01/static/js/codemirror/mode/haxe/haxe.js +429 -0
  61. data/examples/examples01/static/js/codemirror/mode/haxe/index.html +90 -0
  62. data/examples/examples01/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  63. data/examples/examples01/static/js/codemirror/mode/htmlembedded/index.html +49 -0
  64. data/examples/examples01/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
  65. data/examples/examples01/static/js/codemirror/mode/htmlmixed/index.html +52 -0
  66. data/examples/examples01/static/js/codemirror/mode/http/http.js +98 -0
  67. data/examples/examples01/static/js/codemirror/mode/http/index.html +32 -0
  68. data/examples/examples01/static/js/codemirror/mode/javascript/index.html +88 -0
  69. data/examples/examples01/static/js/codemirror/mode/javascript/javascript.js +411 -0
  70. data/examples/examples01/static/js/codemirror/mode/javascript/typescript.html +48 -0
  71. data/examples/examples01/static/js/codemirror/mode/jinja2/index.html +38 -0
  72. data/examples/examples01/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
  73. data/examples/examples01/static/js/codemirror/mode/less/index.html +741 -0
  74. data/examples/examples01/static/js/codemirror/mode/less/less.js +266 -0
  75. data/examples/examples01/static/js/codemirror/mode/lua/index.html +74 -0
  76. data/examples/examples01/static/js/codemirror/mode/lua/lua.js +140 -0
  77. data/examples/examples01/static/js/codemirror/mode/markdown/index.html +344 -0
  78. data/examples/examples01/static/js/codemirror/mode/markdown/markdown.js +474 -0
  79. data/examples/examples01/static/js/codemirror/mode/markdown/test.js +1266 -0
  80. data/examples/examples01/static/js/codemirror/mode/mysql/index.html +41 -0
  81. data/examples/examples01/static/js/codemirror/mode/mysql/mysql.js +203 -0
  82. data/examples/examples01/static/js/codemirror/mode/ntriples/index.html +33 -0
  83. data/examples/examples01/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
  84. data/examples/examples01/static/js/codemirror/mode/ocaml/index.html +131 -0
  85. data/examples/examples01/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
  86. data/examples/examples01/static/js/codemirror/mode/pascal/LICENSE +7 -0
  87. data/examples/examples01/static/js/codemirror/mode/pascal/index.html +48 -0
  88. data/examples/examples01/static/js/codemirror/mode/pascal/pascal.js +94 -0
  89. data/examples/examples01/static/js/codemirror/mode/perl/LICENSE +19 -0
  90. data/examples/examples01/static/js/codemirror/mode/perl/index.html +62 -0
  91. data/examples/examples01/static/js/codemirror/mode/perl/perl.js +816 -0
  92. data/examples/examples01/static/js/codemirror/mode/php/index.html +51 -0
  93. data/examples/examples01/static/js/codemirror/mode/php/php.js +129 -0
  94. data/examples/examples01/static/js/codemirror/mode/pig/index.html +42 -0
  95. data/examples/examples01/static/js/codemirror/mode/pig/pig.js +171 -0
  96. data/examples/examples01/static/js/codemirror/mode/plsql/index.html +62 -0
  97. data/examples/examples01/static/js/codemirror/mode/plsql/plsql.js +216 -0
  98. data/examples/examples01/static/js/codemirror/mode/properties/index.html +41 -0
  99. data/examples/examples01/static/js/codemirror/mode/properties/properties.js +63 -0
  100. data/examples/examples01/static/js/codemirror/mode/python/LICENSE.txt +21 -0
  101. data/examples/examples01/static/js/codemirror/mode/python/index.html +124 -0
  102. data/examples/examples01/static/js/codemirror/mode/python/python.js +340 -0
  103. data/examples/examples01/static/js/codemirror/mode/r/LICENSE +24 -0
  104. data/examples/examples01/static/js/codemirror/mode/r/index.html +74 -0
  105. data/examples/examples01/static/js/codemirror/mode/r/r.js +141 -0
  106. data/examples/examples01/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
  107. data/examples/examples01/static/js/codemirror/mode/rpm/changes/index.html +53 -0
  108. data/examples/examples01/static/js/codemirror/mode/rpm/spec/index.html +99 -0
  109. data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
  110. data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
  111. data/examples/examples01/static/js/codemirror/mode/rst/index.html +526 -0
  112. data/examples/examples01/static/js/codemirror/mode/rst/rst.js +314 -0
  113. data/examples/examples01/static/js/codemirror/mode/ruby/LICENSE +24 -0
  114. data/examples/examples01/static/js/codemirror/mode/ruby/index.html +173 -0
  115. data/examples/examples01/static/js/codemirror/mode/ruby/ruby.js +195 -0
  116. data/examples/examples01/static/js/codemirror/mode/rust/index.html +48 -0
  117. data/examples/examples01/static/js/codemirror/mode/rust/rust.js +432 -0
  118. data/examples/examples01/static/js/codemirror/mode/scheme/index.html +65 -0
  119. data/examples/examples01/static/js/codemirror/mode/scheme/scheme.js +230 -0
  120. data/examples/examples01/static/js/codemirror/mode/shell/index.html +51 -0
  121. data/examples/examples01/static/js/codemirror/mode/shell/shell.js +118 -0
  122. data/examples/examples01/static/js/codemirror/mode/sieve/LICENSE +23 -0
  123. data/examples/examples01/static/js/codemirror/mode/sieve/index.html +81 -0
  124. data/examples/examples01/static/js/codemirror/mode/sieve/sieve.js +156 -0
  125. data/examples/examples01/static/js/codemirror/mode/smalltalk/index.html +57 -0
  126. data/examples/examples01/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
  127. data/examples/examples01/static/js/codemirror/mode/smarty/index.html +83 -0
  128. data/examples/examples01/static/js/codemirror/mode/smarty/smarty.js +148 -0
  129. data/examples/examples01/static/js/codemirror/mode/sparql/index.html +42 -0
  130. data/examples/examples01/static/js/codemirror/mode/sparql/sparql.js +143 -0
  131. data/examples/examples01/static/js/codemirror/mode/stex/index.html +98 -0
  132. data/examples/examples01/static/js/codemirror/mode/stex/stex.js +175 -0
  133. data/examples/examples01/static/js/codemirror/mode/stex/test.js +343 -0
  134. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
  135. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  136. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  137. data/examples/examples01/static/js/codemirror/mode/tiki/index.html +81 -0
  138. data/examples/examples01/static/js/codemirror/mode/tiki/tiki.css +26 -0
  139. data/examples/examples01/static/js/codemirror/mode/tiki/tiki.js +309 -0
  140. data/examples/examples01/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
  141. data/examples/examples01/static/js/codemirror/mode/vb/index.html +88 -0
  142. data/examples/examples01/static/js/codemirror/mode/vb/vb.js +260 -0
  143. data/examples/examples01/static/js/codemirror/mode/vbscript/index.html +42 -0
  144. data/examples/examples01/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
  145. data/examples/examples01/static/js/codemirror/mode/velocity/index.html +103 -0
  146. data/examples/examples01/static/js/codemirror/mode/velocity/velocity.js +144 -0
  147. data/examples/examples01/static/js/codemirror/mode/verilog/index.html +210 -0
  148. data/examples/examples01/static/js/codemirror/mode/verilog/verilog.js +182 -0
  149. data/examples/examples01/static/js/codemirror/mode/xml/index.html +45 -0
  150. data/examples/examples01/static/js/codemirror/mode/xml/xml.js +324 -0
  151. data/examples/examples01/static/js/codemirror/mode/xquery/LICENSE +20 -0
  152. data/examples/examples01/static/js/codemirror/mode/xquery/index.html +221 -0
  153. data/examples/examples01/static/js/codemirror/mode/xquery/test.js +77 -0
  154. data/examples/examples01/static/js/codemirror/mode/xquery/xquery.js +450 -0
  155. data/examples/examples01/static/js/codemirror/mode/yaml/index.html +68 -0
  156. data/examples/examples01/static/js/codemirror/mode/yaml/yaml.js +95 -0
  157. data/examples/examples01/static/js/codemirror/mode/z80/index.html +39 -0
  158. data/examples/examples01/static/js/codemirror/mode/z80/z80.js +113 -0
  159. data/examples/examples01/static/js/codemirror/theme/ambiance-mobile.css +6 -0
  160. data/examples/examples01/static/js/codemirror/theme/ambiance.css +76 -0
  161. data/examples/examples01/static/js/codemirror/theme/blackboard.css +25 -0
  162. data/examples/examples01/static/js/codemirror/theme/cobalt.css +18 -0
  163. data/examples/examples01/static/js/codemirror/theme/eclipse.css +25 -0
  164. data/examples/examples01/static/js/codemirror/theme/elegant.css +10 -0
  165. data/examples/examples01/static/js/codemirror/theme/erlang-dark.css +21 -0
  166. data/examples/examples01/static/js/codemirror/theme/lesser-dark.css +44 -0
  167. data/examples/examples01/static/js/codemirror/theme/monokai.css +28 -0
  168. data/examples/examples01/static/js/codemirror/theme/neat.css +9 -0
  169. data/examples/examples01/static/js/codemirror/theme/night.css +21 -0
  170. data/examples/examples01/static/js/codemirror/theme/rubyblue.css +21 -0
  171. data/examples/examples01/static/js/codemirror/theme/solarized.css +207 -0
  172. data/examples/examples01/static/js/codemirror/theme/twilight.css +26 -0
  173. data/examples/examples01/static/js/codemirror/theme/vibrant-ink.css +27 -0
  174. data/examples/examples01/static/js/codemirror/theme/xq-dark.css +46 -0
  175. data/examples/examples01/static/js/d3.v3.min.js +2 -2
  176. data/examples/examples01/static/test/cm.html +33 -0
  177. data/examples/examples01/views/about.slim +15 -0
  178. data/examples/examples01/views/index.slim +1 -1
  179. data/examples/examples01/views/layout.slim +1 -0
  180. data/examples/examples01/views/layout_cm.slim +17 -0
  181. data/examples/examples01/views/navbar.slim +4 -4
  182. data/lib/swagr/version.rb +1 -1
  183. data/templates/app.rb +4 -0
  184. data/templates/static/js/codemirror/keymap/emacs.js +30 -0
  185. data/templates/static/js/codemirror/keymap/vim.js +2298 -0
  186. data/templates/static/js/codemirror/lib/codemirror.css +239 -0
  187. data/templates/static/js/codemirror/lib/codemirror.js +4553 -0
  188. data/templates/static/js/codemirror/lib/util/closetag.js +85 -0
  189. data/templates/static/js/codemirror/lib/util/colorize.js +29 -0
  190. data/templates/static/js/codemirror/lib/util/continuecomment.js +36 -0
  191. data/templates/static/js/codemirror/lib/util/continuelist.js +28 -0
  192. data/templates/static/js/codemirror/lib/util/dialog.css +32 -0
  193. data/templates/static/js/codemirror/lib/util/dialog.js +75 -0
  194. data/templates/static/js/codemirror/lib/util/foldcode.js +182 -0
  195. data/templates/static/js/codemirror/lib/util/formatting.js +108 -0
  196. data/templates/static/js/codemirror/lib/util/javascript-hint.js +137 -0
  197. data/templates/static/js/codemirror/lib/util/loadmode.js +51 -0
  198. data/templates/static/js/codemirror/lib/util/match-highlighter.js +46 -0
  199. data/templates/static/js/codemirror/lib/util/matchbrackets.js +63 -0
  200. data/templates/static/js/codemirror/lib/util/multiplex.js +95 -0
  201. data/templates/static/js/codemirror/lib/util/overlay.js +59 -0
  202. data/templates/static/js/codemirror/lib/util/pig-hint.js +117 -0
  203. data/templates/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
  204. data/templates/static/js/codemirror/lib/util/runmode.js +52 -0
  205. data/templates/static/js/codemirror/lib/util/search.js +119 -0
  206. data/templates/static/js/codemirror/lib/util/searchcursor.js +119 -0
  207. data/templates/static/js/codemirror/lib/util/simple-hint.css +16 -0
  208. data/templates/static/js/codemirror/lib/util/simple-hint.js +102 -0
  209. data/templates/static/js/codemirror/lib/util/xml-hint.js +131 -0
  210. data/templates/static/js/codemirror/mode/clike/clike.js +300 -0
  211. data/templates/static/js/codemirror/mode/clike/index.html +103 -0
  212. data/templates/static/js/codemirror/mode/clike/scala.html +767 -0
  213. data/templates/static/js/codemirror/mode/clojure/clojure.js +206 -0
  214. data/templates/static/js/codemirror/mode/clojure/index.html +67 -0
  215. data/templates/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
  216. data/templates/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
  217. data/templates/static/js/codemirror/mode/coffeescript/index.html +728 -0
  218. data/templates/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
  219. data/templates/static/js/codemirror/mode/commonlisp/index.html +165 -0
  220. data/templates/static/js/codemirror/mode/css/css.js +465 -0
  221. data/templates/static/js/codemirror/mode/css/index.html +58 -0
  222. data/templates/static/js/codemirror/mode/css/test.js +501 -0
  223. data/templates/static/js/codemirror/mode/diff/diff.js +32 -0
  224. data/templates/static/js/codemirror/mode/diff/index.html +105 -0
  225. data/templates/static/js/codemirror/mode/ecl/ecl.js +192 -0
  226. data/templates/static/js/codemirror/mode/ecl/index.html +39 -0
  227. data/templates/static/js/codemirror/mode/erlang/erlang.js +463 -0
  228. data/templates/static/js/codemirror/mode/erlang/index.html +64 -0
  229. data/templates/static/js/codemirror/mode/gfm/gfm.js +94 -0
  230. data/templates/static/js/codemirror/mode/gfm/index.html +70 -0
  231. data/templates/static/js/codemirror/mode/gfm/test.js +225 -0
  232. data/templates/static/js/codemirror/mode/go/go.js +165 -0
  233. data/templates/static/js/codemirror/mode/go/index.html +74 -0
  234. data/templates/static/js/codemirror/mode/groovy/groovy.js +210 -0
  235. data/templates/static/js/codemirror/mode/groovy/index.html +73 -0
  236. data/templates/static/js/codemirror/mode/haskell/haskell.js +242 -0
  237. data/templates/static/js/codemirror/mode/haskell/index.html +62 -0
  238. data/templates/static/js/codemirror/mode/haxe/haxe.js +429 -0
  239. data/templates/static/js/codemirror/mode/haxe/index.html +90 -0
  240. data/templates/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  241. data/templates/static/js/codemirror/mode/htmlembedded/index.html +49 -0
  242. data/templates/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
  243. data/templates/static/js/codemirror/mode/htmlmixed/index.html +52 -0
  244. data/templates/static/js/codemirror/mode/http/http.js +98 -0
  245. data/templates/static/js/codemirror/mode/http/index.html +32 -0
  246. data/templates/static/js/codemirror/mode/javascript/index.html +88 -0
  247. data/templates/static/js/codemirror/mode/javascript/javascript.js +411 -0
  248. data/templates/static/js/codemirror/mode/javascript/typescript.html +48 -0
  249. data/templates/static/js/codemirror/mode/jinja2/index.html +38 -0
  250. data/templates/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
  251. data/templates/static/js/codemirror/mode/less/index.html +741 -0
  252. data/templates/static/js/codemirror/mode/less/less.js +266 -0
  253. data/templates/static/js/codemirror/mode/lua/index.html +74 -0
  254. data/templates/static/js/codemirror/mode/lua/lua.js +140 -0
  255. data/templates/static/js/codemirror/mode/markdown/index.html +344 -0
  256. data/templates/static/js/codemirror/mode/markdown/markdown.js +474 -0
  257. data/templates/static/js/codemirror/mode/markdown/test.js +1266 -0
  258. data/templates/static/js/codemirror/mode/mysql/index.html +41 -0
  259. data/templates/static/js/codemirror/mode/mysql/mysql.js +203 -0
  260. data/templates/static/js/codemirror/mode/ntriples/index.html +33 -0
  261. data/templates/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
  262. data/templates/static/js/codemirror/mode/ocaml/index.html +131 -0
  263. data/templates/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
  264. data/templates/static/js/codemirror/mode/pascal/LICENSE +7 -0
  265. data/templates/static/js/codemirror/mode/pascal/index.html +48 -0
  266. data/templates/static/js/codemirror/mode/pascal/pascal.js +94 -0
  267. data/templates/static/js/codemirror/mode/perl/LICENSE +19 -0
  268. data/templates/static/js/codemirror/mode/perl/index.html +62 -0
  269. data/templates/static/js/codemirror/mode/perl/perl.js +816 -0
  270. data/templates/static/js/codemirror/mode/php/index.html +51 -0
  271. data/templates/static/js/codemirror/mode/php/php.js +129 -0
  272. data/templates/static/js/codemirror/mode/pig/index.html +42 -0
  273. data/templates/static/js/codemirror/mode/pig/pig.js +171 -0
  274. data/templates/static/js/codemirror/mode/plsql/index.html +62 -0
  275. data/templates/static/js/codemirror/mode/plsql/plsql.js +216 -0
  276. data/templates/static/js/codemirror/mode/properties/index.html +41 -0
  277. data/templates/static/js/codemirror/mode/properties/properties.js +63 -0
  278. data/templates/static/js/codemirror/mode/python/LICENSE.txt +21 -0
  279. data/templates/static/js/codemirror/mode/python/index.html +124 -0
  280. data/templates/static/js/codemirror/mode/python/python.js +340 -0
  281. data/templates/static/js/codemirror/mode/r/LICENSE +24 -0
  282. data/templates/static/js/codemirror/mode/r/index.html +74 -0
  283. data/templates/static/js/codemirror/mode/r/r.js +141 -0
  284. data/templates/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
  285. data/templates/static/js/codemirror/mode/rpm/changes/index.html +53 -0
  286. data/templates/static/js/codemirror/mode/rpm/spec/index.html +99 -0
  287. data/templates/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
  288. data/templates/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
  289. data/templates/static/js/codemirror/mode/rst/index.html +526 -0
  290. data/templates/static/js/codemirror/mode/rst/rst.js +314 -0
  291. data/templates/static/js/codemirror/mode/ruby/LICENSE +24 -0
  292. data/templates/static/js/codemirror/mode/ruby/index.html +173 -0
  293. data/templates/static/js/codemirror/mode/ruby/ruby.js +195 -0
  294. data/templates/static/js/codemirror/mode/rust/index.html +48 -0
  295. data/templates/static/js/codemirror/mode/rust/rust.js +432 -0
  296. data/templates/static/js/codemirror/mode/scheme/index.html +65 -0
  297. data/templates/static/js/codemirror/mode/scheme/scheme.js +230 -0
  298. data/templates/static/js/codemirror/mode/shell/index.html +51 -0
  299. data/templates/static/js/codemirror/mode/shell/shell.js +118 -0
  300. data/templates/static/js/codemirror/mode/sieve/LICENSE +23 -0
  301. data/templates/static/js/codemirror/mode/sieve/index.html +81 -0
  302. data/templates/static/js/codemirror/mode/sieve/sieve.js +156 -0
  303. data/templates/static/js/codemirror/mode/smalltalk/index.html +57 -0
  304. data/templates/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
  305. data/templates/static/js/codemirror/mode/smarty/index.html +83 -0
  306. data/templates/static/js/codemirror/mode/smarty/smarty.js +148 -0
  307. data/templates/static/js/codemirror/mode/sparql/index.html +42 -0
  308. data/templates/static/js/codemirror/mode/sparql/sparql.js +143 -0
  309. data/templates/static/js/codemirror/mode/stex/index.html +98 -0
  310. data/templates/static/js/codemirror/mode/stex/stex.js +175 -0
  311. data/templates/static/js/codemirror/mode/stex/test.js +343 -0
  312. data/templates/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
  313. data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  314. data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  315. data/templates/static/js/codemirror/mode/tiki/index.html +81 -0
  316. data/templates/static/js/codemirror/mode/tiki/tiki.css +26 -0
  317. data/templates/static/js/codemirror/mode/tiki/tiki.js +309 -0
  318. data/templates/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
  319. data/templates/static/js/codemirror/mode/vb/index.html +88 -0
  320. data/templates/static/js/codemirror/mode/vb/vb.js +260 -0
  321. data/templates/static/js/codemirror/mode/vbscript/index.html +42 -0
  322. data/templates/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
  323. data/templates/static/js/codemirror/mode/velocity/index.html +103 -0
  324. data/templates/static/js/codemirror/mode/velocity/velocity.js +144 -0
  325. data/templates/static/js/codemirror/mode/verilog/index.html +210 -0
  326. data/templates/static/js/codemirror/mode/verilog/verilog.js +182 -0
  327. data/templates/static/js/codemirror/mode/xml/index.html +45 -0
  328. data/templates/static/js/codemirror/mode/xml/xml.js +324 -0
  329. data/templates/static/js/codemirror/mode/xquery/LICENSE +20 -0
  330. data/templates/static/js/codemirror/mode/xquery/index.html +221 -0
  331. data/templates/static/js/codemirror/mode/xquery/test.js +77 -0
  332. data/templates/static/js/codemirror/mode/xquery/xquery.js +450 -0
  333. data/templates/static/js/codemirror/mode/yaml/index.html +68 -0
  334. data/templates/static/js/codemirror/mode/yaml/yaml.js +95 -0
  335. data/templates/static/js/codemirror/mode/z80/index.html +39 -0
  336. data/templates/static/js/codemirror/mode/z80/z80.js +113 -0
  337. data/templates/static/js/codemirror/theme/ambiance-mobile.css +6 -0
  338. data/templates/static/js/codemirror/theme/ambiance.css +76 -0
  339. data/templates/static/js/codemirror/theme/blackboard.css +25 -0
  340. data/templates/static/js/codemirror/theme/cobalt.css +18 -0
  341. data/templates/static/js/codemirror/theme/eclipse.css +25 -0
  342. data/templates/static/js/codemirror/theme/elegant.css +10 -0
  343. data/templates/static/js/codemirror/theme/erlang-dark.css +21 -0
  344. data/templates/static/js/codemirror/theme/lesser-dark.css +44 -0
  345. data/templates/static/js/codemirror/theme/monokai.css +28 -0
  346. data/templates/static/js/codemirror/theme/neat.css +9 -0
  347. data/templates/static/js/codemirror/theme/night.css +21 -0
  348. data/templates/static/js/codemirror/theme/rubyblue.css +21 -0
  349. data/templates/static/js/codemirror/theme/solarized.css +207 -0
  350. data/templates/static/js/codemirror/theme/twilight.css +26 -0
  351. data/templates/static/js/codemirror/theme/vibrant-ink.css +27 -0
  352. data/templates/static/js/codemirror/theme/xq-dark.css +46 -0
  353. data/templates/static/js/d3.v3.min.js +2 -2
  354. data/templates/static/test/cm.html +33 -0
  355. data/templates/views/about.slim +15 -0
  356. data/templates/views/index.slim +1 -1
  357. data/templates/views/layout.slim +1 -0
  358. data/templates/views/navbar.slim +4 -4
  359. metadata +347 -2
@@ -0,0 +1,195 @@
1
+ CodeMirror.defineMode("ruby", function(config) {
2
+ function wordObj(words) {
3
+ var o = {};
4
+ for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
5
+ return o;
6
+ }
7
+ var keywords = wordObj([
8
+ "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
9
+ "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
10
+ "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
11
+ "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
12
+ "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
13
+ "require_relative", "extend", "autoload"
14
+ ]);
15
+ var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
16
+ "catch", "loop", "proc", "begin"]);
17
+ var dedentWords = wordObj(["end", "until"]);
18
+ var matching = {"[": "]", "{": "}", "(": ")"};
19
+ var curPunc;
20
+
21
+ function chain(newtok, stream, state) {
22
+ state.tokenize.push(newtok);
23
+ return newtok(stream, state);
24
+ }
25
+
26
+ function tokenBase(stream, state) {
27
+ curPunc = null;
28
+ if (stream.sol() && stream.match("=begin") && stream.eol()) {
29
+ state.tokenize.push(readBlockComment);
30
+ return "comment";
31
+ }
32
+ if (stream.eatSpace()) return null;
33
+ var ch = stream.next(), m;
34
+ if (ch == "`" || ch == "'" || ch == '"' ||
35
+ (ch == "/" && !stream.eol() && stream.peek() != " ")) {
36
+ return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
37
+ } else if (ch == "%") {
38
+ var style, embed = false;
39
+ if (stream.eat("s")) style = "atom";
40
+ else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
41
+ else if (stream.eat(/[wxqr]/)) style = "string";
42
+ var delim = stream.eat(/[^\w\s]/);
43
+ if (!delim) return "operator";
44
+ if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
45
+ return chain(readQuoted(delim, style, embed, true), stream, state);
46
+ } else if (ch == "#") {
47
+ stream.skipToEnd();
48
+ return "comment";
49
+ } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
50
+ return chain(readHereDoc(m[1]), stream, state);
51
+ } else if (ch == "0") {
52
+ if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
53
+ else if (stream.eat("b")) stream.eatWhile(/[01]/);
54
+ else stream.eatWhile(/[0-7]/);
55
+ return "number";
56
+ } else if (/\d/.test(ch)) {
57
+ stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
58
+ return "number";
59
+ } else if (ch == "?") {
60
+ while (stream.match(/^\\[CM]-/)) {}
61
+ if (stream.eat("\\")) stream.eatWhile(/\w/);
62
+ else stream.next();
63
+ return "string";
64
+ } else if (ch == ":") {
65
+ if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
66
+ if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
67
+ stream.eatWhile(/[\w\?]/);
68
+ return "atom";
69
+ } else if (ch == "@") {
70
+ stream.eat("@");
71
+ stream.eatWhile(/[\w\?]/);
72
+ return "variable-2";
73
+ } else if (ch == "$") {
74
+ stream.next();
75
+ stream.eatWhile(/[\w\?]/);
76
+ return "variable-3";
77
+ } else if (/\w/.test(ch)) {
78
+ stream.eatWhile(/[\w\?]/);
79
+ if (stream.eat(":")) return "atom";
80
+ return "ident";
81
+ } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
82
+ curPunc = "|";
83
+ return null;
84
+ } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
85
+ curPunc = ch;
86
+ return null;
87
+ } else if (ch == "-" && stream.eat(">")) {
88
+ return "arrow";
89
+ } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
90
+ stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
91
+ return "operator";
92
+ } else {
93
+ return null;
94
+ }
95
+ }
96
+
97
+ function tokenBaseUntilBrace() {
98
+ var depth = 1;
99
+ return function(stream, state) {
100
+ if (stream.peek() == "}") {
101
+ depth--;
102
+ if (depth == 0) {
103
+ state.tokenize.pop();
104
+ return state.tokenize[state.tokenize.length-1](stream, state);
105
+ }
106
+ } else if (stream.peek() == "{") {
107
+ depth++;
108
+ }
109
+ return tokenBase(stream, state);
110
+ };
111
+ }
112
+ function readQuoted(quote, style, embed, unescaped) {
113
+ return function(stream, state) {
114
+ var escaped = false, ch;
115
+ while ((ch = stream.next()) != null) {
116
+ if (ch == quote && (unescaped || !escaped)) {
117
+ state.tokenize.pop();
118
+ break;
119
+ }
120
+ if (embed && ch == "#" && !escaped && stream.eat("{")) {
121
+ state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
122
+ break;
123
+ }
124
+ escaped = !escaped && ch == "\\";
125
+ }
126
+ return style;
127
+ };
128
+ }
129
+ function readHereDoc(phrase) {
130
+ return function(stream, state) {
131
+ if (stream.match(phrase)) state.tokenize.pop();
132
+ else stream.skipToEnd();
133
+ return "string";
134
+ };
135
+ }
136
+ function readBlockComment(stream, state) {
137
+ if (stream.sol() && stream.match("=end") && stream.eol())
138
+ state.tokenize.pop();
139
+ stream.skipToEnd();
140
+ return "comment";
141
+ }
142
+
143
+ return {
144
+ startState: function() {
145
+ return {tokenize: [tokenBase],
146
+ indented: 0,
147
+ context: {type: "top", indented: -config.indentUnit},
148
+ continuedLine: false,
149
+ lastTok: null,
150
+ varList: false};
151
+ },
152
+
153
+ token: function(stream, state) {
154
+ if (stream.sol()) state.indented = stream.indentation();
155
+ var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
156
+ if (style == "ident") {
157
+ var word = stream.current();
158
+ style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
159
+ : /^[A-Z]/.test(word) ? "tag"
160
+ : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
161
+ : "variable";
162
+ if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
163
+ else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
164
+ else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
165
+ kwtype = "indent";
166
+ }
167
+ if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
168
+ if (curPunc == "|") state.varList = !state.varList;
169
+
170
+ if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
171
+ state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
172
+ else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
173
+ state.context = state.context.prev;
174
+
175
+ if (stream.eol())
176
+ state.continuedLine = (curPunc == "\\" || style == "operator");
177
+ return style;
178
+ },
179
+
180
+ indent: function(state, textAfter) {
181
+ if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
182
+ var firstChar = textAfter && textAfter.charAt(0);
183
+ var ct = state.context;
184
+ var closing = ct.type == matching[firstChar] ||
185
+ ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
186
+ return ct.indented + (closing ? 0 : config.indentUnit) +
187
+ (state.continuedLine ? config.indentUnit : 0);
188
+ },
189
+ electricChars: "}de" // enD and rescuE
190
+
191
+ };
192
+ });
193
+
194
+ CodeMirror.defineMIME("text/x-ruby", "ruby");
195
+
@@ -0,0 +1,48 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>CodeMirror: Rust mode</title>
6
+ <link rel="stylesheet" href="../../lib/codemirror.css">
7
+ <script src="../../lib/codemirror.js"></script>
8
+ <script src="rust.js"></script>
9
+ <link rel="stylesheet" href="../../doc/docs.css">
10
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11
+ </head>
12
+ <body>
13
+ <h1>CodeMirror: Rust mode</h1>
14
+
15
+ <div><textarea id="code" name="code">
16
+ // Demo code.
17
+
18
+ type foo<T> = int;
19
+ enum bar {
20
+ some(int, foo<float>),
21
+ none
22
+ }
23
+
24
+ fn check_crate(x: int) {
25
+ let v = 10;
26
+ alt foo {
27
+ 1 to 3 {
28
+ print_foo();
29
+ if x {
30
+ blah() + 10;
31
+ }
32
+ }
33
+ (x, y) { "bye" }
34
+ _ { "hi" }
35
+ }
36
+ }
37
+ </textarea></div>
38
+
39
+ <script>
40
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
41
+ lineNumbers: true,
42
+ tabMode: "indent"
43
+ });
44
+ </script>
45
+
46
+ <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
47
+ </body>
48
+ </html>
@@ -0,0 +1,432 @@
1
+ CodeMirror.defineMode("rust", function() {
2
+ var indentUnit = 4, altIndentUnit = 2;
3
+ var valKeywords = {
4
+ "if": "if-style", "while": "if-style", "else": "else-style",
5
+ "do": "else-style", "ret": "else-style", "fail": "else-style",
6
+ "break": "atom", "cont": "atom", "const": "let", "resource": "fn",
7
+ "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface",
8
+ "impl": "impl", "type": "type", "enum": "enum", "mod": "mod",
9
+ "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op",
10
+ "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style",
11
+ "export": "else-style", "copy": "op", "log": "op", "log_err": "op",
12
+ "use": "op", "bind": "op", "self": "atom"
13
+ };
14
+ var typeKeywords = function() {
15
+ var keywords = {"fn": "fn", "block": "fn", "obj": "obj"};
16
+ var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" ");
17
+ for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom";
18
+ return keywords;
19
+ }();
20
+ var operatorChar = /[+\-*&%=<>!?|\.@]/;
21
+
22
+ // Tokenizer
23
+
24
+ // Used as scratch variable to communicate multiple values without
25
+ // consing up tons of objects.
26
+ var tcat, content;
27
+ function r(tc, style) {
28
+ tcat = tc;
29
+ return style;
30
+ }
31
+
32
+ function tokenBase(stream, state) {
33
+ var ch = stream.next();
34
+ if (ch == '"') {
35
+ state.tokenize = tokenString;
36
+ return state.tokenize(stream, state);
37
+ }
38
+ if (ch == "'") {
39
+ tcat = "atom";
40
+ if (stream.eat("\\")) {
41
+ if (stream.skipTo("'")) { stream.next(); return "string"; }
42
+ else { return "error"; }
43
+ } else {
44
+ stream.next();
45
+ return stream.eat("'") ? "string" : "error";
46
+ }
47
+ }
48
+ if (ch == "/") {
49
+ if (stream.eat("/")) { stream.skipToEnd(); return "comment"; }
50
+ if (stream.eat("*")) {
51
+ state.tokenize = tokenComment(1);
52
+ return state.tokenize(stream, state);
53
+ }
54
+ }
55
+ if (ch == "#") {
56
+ if (stream.eat("[")) { tcat = "open-attr"; return null; }
57
+ stream.eatWhile(/\w/);
58
+ return r("macro", "meta");
59
+ }
60
+ if (ch == ":" && stream.match(":<")) {
61
+ return r("op", null);
62
+ }
63
+ if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) {
64
+ var flp = false;
65
+ if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) {
66
+ stream.eatWhile(/\d/);
67
+ if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); }
68
+ if (stream.match(/^e[+\-]?\d+/i)) { flp = true; }
69
+ }
70
+ if (flp) stream.match(/^f(?:32|64)/);
71
+ else stream.match(/^[ui](?:8|16|32|64)/);
72
+ return r("atom", "number");
73
+ }
74
+ if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null);
75
+ if (ch == "-" && stream.eat(">")) return r("->", null);
76
+ if (ch.match(operatorChar)) {
77
+ stream.eatWhile(operatorChar);
78
+ return r("op", null);
79
+ }
80
+ stream.eatWhile(/\w/);
81
+ content = stream.current();
82
+ if (stream.match(/^::\w/)) {
83
+ stream.backUp(1);
84
+ return r("prefix", "variable-2");
85
+ }
86
+ if (state.keywords.propertyIsEnumerable(content))
87
+ return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword");
88
+ return r("name", "variable");
89
+ }
90
+
91
+ function tokenString(stream, state) {
92
+ var ch, escaped = false;
93
+ while (ch = stream.next()) {
94
+ if (ch == '"' && !escaped) {
95
+ state.tokenize = tokenBase;
96
+ return r("atom", "string");
97
+ }
98
+ escaped = !escaped && ch == "\\";
99
+ }
100
+ // Hack to not confuse the parser when a string is split in
101
+ // pieces.
102
+ return r("op", "string");
103
+ }
104
+
105
+ function tokenComment(depth) {
106
+ return function(stream, state) {
107
+ var lastCh = null, ch;
108
+ while (ch = stream.next()) {
109
+ if (ch == "/" && lastCh == "*") {
110
+ if (depth == 1) {
111
+ state.tokenize = tokenBase;
112
+ break;
113
+ } else {
114
+ state.tokenize = tokenComment(depth - 1);
115
+ return state.tokenize(stream, state);
116
+ }
117
+ }
118
+ if (ch == "*" && lastCh == "/") {
119
+ state.tokenize = tokenComment(depth + 1);
120
+ return state.tokenize(stream, state);
121
+ }
122
+ lastCh = ch;
123
+ }
124
+ return "comment";
125
+ };
126
+ }
127
+
128
+ // Parser
129
+
130
+ var cx = {state: null, stream: null, marked: null, cc: null};
131
+ function pass() {
132
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
133
+ }
134
+ function cont() {
135
+ pass.apply(null, arguments);
136
+ return true;
137
+ }
138
+
139
+ function pushlex(type, info) {
140
+ var result = function() {
141
+ var state = cx.state;
142
+ state.lexical = {indented: state.indented, column: cx.stream.column(),
143
+ type: type, prev: state.lexical, info: info};
144
+ };
145
+ result.lex = true;
146
+ return result;
147
+ }
148
+ function poplex() {
149
+ var state = cx.state;
150
+ if (state.lexical.prev) {
151
+ if (state.lexical.type == ")")
152
+ state.indented = state.lexical.indented;
153
+ state.lexical = state.lexical.prev;
154
+ }
155
+ }
156
+ function typecx() { cx.state.keywords = typeKeywords; }
157
+ function valcx() { cx.state.keywords = valKeywords; }
158
+ poplex.lex = typecx.lex = valcx.lex = true;
159
+
160
+ function commasep(comb, end) {
161
+ function more(type) {
162
+ if (type == ",") return cont(comb, more);
163
+ if (type == end) return cont();
164
+ return cont(more);
165
+ }
166
+ return function(type) {
167
+ if (type == end) return cont();
168
+ return pass(comb, more);
169
+ };
170
+ }
171
+
172
+ function stat_of(comb, tag) {
173
+ return cont(pushlex("stat", tag), comb, poplex, block);
174
+ }
175
+ function block(type) {
176
+ if (type == "}") return cont();
177
+ if (type == "let") return stat_of(letdef1, "let");
178
+ if (type == "fn") return stat_of(fndef);
179
+ if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block);
180
+ if (type == "enum") return stat_of(enumdef);
181
+ if (type == "mod") return stat_of(mod);
182
+ if (type == "iface") return stat_of(iface);
183
+ if (type == "impl") return stat_of(impl);
184
+ if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex);
185
+ if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block);
186
+ return pass(pushlex("stat"), expression, poplex, endstatement, block);
187
+ }
188
+ function endstatement(type) {
189
+ if (type == ";") return cont();
190
+ return pass();
191
+ }
192
+ function expression(type) {
193
+ if (type == "atom" || type == "name") return cont(maybeop);
194
+ if (type == "{") return cont(pushlex("}"), exprbrace, poplex);
195
+ if (type.match(/[\[\(]/)) return matchBrackets(type, expression);
196
+ if (type.match(/[\]\)\};,]/)) return pass();
197
+ if (type == "if-style") return cont(expression, expression);
198
+ if (type == "else-style" || type == "op") return cont(expression);
199
+ if (type == "for") return cont(pattern, maybetype, inop, expression, expression);
200
+ if (type == "alt") return cont(expression, altbody);
201
+ if (type == "fn") return cont(fndef);
202
+ if (type == "macro") return cont(macro);
203
+ return cont();
204
+ }
205
+ function maybeop(type) {
206
+ if (content == ".") return cont(maybeprop);
207
+ if (content == "::<"){return cont(typarams, maybeop);}
208
+ if (type == "op" || content == ":") return cont(expression);
209
+ if (type == "(" || type == "[") return matchBrackets(type, expression);
210
+ return pass();
211
+ }
212
+ function maybeprop() {
213
+ if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);}
214
+ return pass(expression);
215
+ }
216
+ function exprbrace(type) {
217
+ if (type == "op") {
218
+ if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
219
+ if (content == "||") return cont(poplex, pushlex("}", "block"), block);
220
+ }
221
+ if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
222
+ && !cx.stream.match("::", false)))
223
+ return pass(record_of(expression));
224
+ return pass(block);
225
+ }
226
+ function record_of(comb) {
227
+ function ro(type) {
228
+ if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
229
+ if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
230
+ if (type == ":") return cont(comb, ro);
231
+ if (type == "}") return cont();
232
+ return cont(ro);
233
+ }
234
+ return ro;
235
+ }
236
+ function blockvars(type) {
237
+ if (type == "name") {cx.marked = "def"; return cont(blockvars);}
238
+ if (type == "op" && content == "|") return cont();
239
+ return cont(blockvars);
240
+ }
241
+
242
+ function letdef1(type) {
243
+ if (type.match(/[\]\)\};]/)) return cont();
244
+ if (content == "=") return cont(expression, letdef2);
245
+ if (type == ",") return cont(letdef1);
246
+ return pass(pattern, maybetype, letdef1);
247
+ }
248
+ function letdef2(type) {
249
+ if (type.match(/[\]\)\};,]/)) return pass(letdef1);
250
+ else return pass(expression, letdef2);
251
+ }
252
+ function maybetype(type) {
253
+ if (type == ":") return cont(typecx, rtype, valcx);
254
+ return pass();
255
+ }
256
+ function inop(type) {
257
+ if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();}
258
+ return pass();
259
+ }
260
+ function fndef(type) {
261
+ if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);}
262
+ if (type == "name") {cx.marked = "def"; return cont(fndef);}
263
+ if (content == "<") return cont(typarams, fndef);
264
+ if (type == "{") return pass(expression);
265
+ if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef);
266
+ if (type == "->") return cont(typecx, rtype, valcx, fndef);
267
+ if (type == ";") return cont();
268
+ return cont(fndef);
269
+ }
270
+ function tydef(type) {
271
+ if (type == "name") {cx.marked = "def"; return cont(tydef);}
272
+ if (content == "<") return cont(typarams, tydef);
273
+ if (content == "=") return cont(typecx, rtype, valcx);
274
+ return cont(tydef);
275
+ }
276
+ function enumdef(type) {
277
+ if (type == "name") {cx.marked = "def"; return cont(enumdef);}
278
+ if (content == "<") return cont(typarams, enumdef);
279
+ if (content == "=") return cont(typecx, rtype, valcx, endstatement);
280
+ if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex);
281
+ return cont(enumdef);
282
+ }
283
+ function enumblock(type) {
284
+ if (type == "}") return cont();
285
+ if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock);
286
+ if (content.match(/^\w+$/)) cx.marked = "def";
287
+ return cont(enumblock);
288
+ }
289
+ function mod(type) {
290
+ if (type == "name") {cx.marked = "def"; return cont(mod);}
291
+ if (type == "{") return cont(pushlex("}"), block, poplex);
292
+ return pass();
293
+ }
294
+ function iface(type) {
295
+ if (type == "name") {cx.marked = "def"; return cont(iface);}
296
+ if (content == "<") return cont(typarams, iface);
297
+ if (type == "{") return cont(pushlex("}"), block, poplex);
298
+ return pass();
299
+ }
300
+ function impl(type) {
301
+ if (content == "<") return cont(typarams, impl);
302
+ if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);}
303
+ if (type == "name") {cx.marked = "def"; return cont(impl);}
304
+ if (type == "{") return cont(pushlex("}"), block, poplex);
305
+ return pass();
306
+ }
307
+ function typarams() {
308
+ if (content == ">") return cont();
309
+ if (content == ",") return cont(typarams);
310
+ if (content == ":") return cont(rtype, typarams);
311
+ return pass(rtype, typarams);
312
+ }
313
+ function argdef(type) {
314
+ if (type == "name") {cx.marked = "def"; return cont(argdef);}
315
+ if (type == ":") return cont(typecx, rtype, valcx);
316
+ return pass();
317
+ }
318
+ function rtype(type) {
319
+ if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
320
+ if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
321
+ if (type == "atom") return cont(rtypemaybeparam);
322
+ if (type == "op" || type == "obj") return cont(rtype);
323
+ if (type == "fn") return cont(fntype);
324
+ if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex);
325
+ return matchBrackets(type, rtype);
326
+ }
327
+ function rtypemaybeparam() {
328
+ if (content == "<") return cont(typarams);
329
+ return pass();
330
+ }
331
+ function fntype(type) {
332
+ if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype);
333
+ if (type == "->") return cont(rtype);
334
+ return pass();
335
+ }
336
+ function pattern(type) {
337
+ if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);}
338
+ if (type == "atom") return cont(patternmaybeop);
339
+ if (type == "op") return cont(pattern);
340
+ if (type.match(/[\]\)\};,]/)) return pass();
341
+ return matchBrackets(type, pattern);
342
+ }
343
+ function patternmaybeop(type) {
344
+ if (type == "op" && content == ".") return cont();
345
+ if (content == "to") {cx.marked = "keyword"; return cont(pattern);}
346
+ else return pass();
347
+ }
348
+ function altbody(type) {
349
+ if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex);
350
+ return pass();
351
+ }
352
+ function altblock1(type) {
353
+ if (type == "}") return cont();
354
+ if (type == "|") return cont(altblock1);
355
+ if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);}
356
+ if (type.match(/[\]\);,]/)) return cont(altblock1);
357
+ return pass(pattern, altblock2);
358
+ }
359
+ function altblock2(type) {
360
+ if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1);
361
+ else return pass(altblock1);
362
+ }
363
+
364
+ function macro(type) {
365
+ if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression);
366
+ return pass();
367
+ }
368
+ function matchBrackets(type, comb) {
369
+ if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex);
370
+ if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex);
371
+ if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex);
372
+ return cont();
373
+ }
374
+
375
+ function parse(state, stream, style) {
376
+ var cc = state.cc;
377
+ // Communicate our context to the combinators.
378
+ // (Less wasteful than consing up a hundred closures on every call.)
379
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
380
+
381
+ while (true) {
382
+ var combinator = cc.length ? cc.pop() : block;
383
+ if (combinator(tcat)) {
384
+ while(cc.length && cc[cc.length - 1].lex)
385
+ cc.pop()();
386
+ return cx.marked || style;
387
+ }
388
+ }
389
+ }
390
+
391
+ return {
392
+ startState: function() {
393
+ return {
394
+ tokenize: tokenBase,
395
+ cc: [],
396
+ lexical: {indented: -indentUnit, column: 0, type: "top", align: false},
397
+ keywords: valKeywords,
398
+ indented: 0
399
+ };
400
+ },
401
+
402
+ token: function(stream, state) {
403
+ if (stream.sol()) {
404
+ if (!state.lexical.hasOwnProperty("align"))
405
+ state.lexical.align = false;
406
+ state.indented = stream.indentation();
407
+ }
408
+ if (stream.eatSpace()) return null;
409
+ tcat = content = null;
410
+ var style = state.tokenize(stream, state);
411
+ if (style == "comment") return style;
412
+ if (!state.lexical.hasOwnProperty("align"))
413
+ state.lexical.align = true;
414
+ if (tcat == "prefix") return style;
415
+ if (!content) content = stream.current();
416
+ return parse(state, stream, style);
417
+ },
418
+
419
+ indent: function(state, textAfter) {
420
+ if (state.tokenize != tokenBase) return 0;
421
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
422
+ type = lexical.type, closing = firstChar == type;
423
+ if (type == "stat") return lexical.indented + indentUnit;
424
+ if (lexical.align) return lexical.column + (closing ? 0 : 1);
425
+ return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit));
426
+ },
427
+
428
+ electricChars: "{}"
429
+ };
430
+ });
431
+
432
+ CodeMirror.defineMIME("text/x-rustsrc", "rust");