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,340 @@
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 = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
9
+ var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
10
+ var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
11
+ var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
12
+ var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
13
+ var 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.version && parseInt(parserConf.version, 10) === 3) {
40
+ commonkeywords = commonkeywords.concat(py3.keywords);
41
+ commonBuiltins = commonBuiltins.concat(py3.builtins);
42
+ var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
43
+ } else {
44
+ commonkeywords = commonkeywords.concat(py2.keywords);
45
+ commonBuiltins = commonBuiltins.concat(py2.builtins);
46
+ var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
47
+ }
48
+ var keywords = wordRegexp(commonkeywords);
49
+ var builtins = wordRegexp(commonBuiltins);
50
+
51
+ var indentInfo = null;
52
+
53
+ // tokenizers
54
+ function tokenBase(stream, state) {
55
+ // Handle scope changes
56
+ if (stream.sol()) {
57
+ var scopeOffset = state.scopes[0].offset;
58
+ if (stream.eatSpace()) {
59
+ var lineOffset = stream.indentation();
60
+ if (lineOffset > scopeOffset) {
61
+ indentInfo = 'indent';
62
+ } else if (lineOffset < scopeOffset) {
63
+ indentInfo = 'dedent';
64
+ }
65
+ return null;
66
+ } else {
67
+ if (scopeOffset > 0) {
68
+ dedent(stream, state);
69
+ }
70
+ }
71
+ }
72
+ if (stream.eatSpace()) {
73
+ return null;
74
+ }
75
+
76
+ var ch = stream.peek();
77
+
78
+ // Handle Comments
79
+ if (ch === '#') {
80
+ stream.skipToEnd();
81
+ return 'comment';
82
+ }
83
+
84
+ // Handle Number Literals
85
+ if (stream.match(/^[0-9\.]/, false)) {
86
+ var floatLiteral = false;
87
+ // Floats
88
+ if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
89
+ if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
90
+ if (stream.match(/^\.\d+/)) { floatLiteral = true; }
91
+ if (floatLiteral) {
92
+ // Float literals may be "imaginary"
93
+ stream.eat(/J/i);
94
+ return 'number';
95
+ }
96
+ // Integers
97
+ var intLiteral = false;
98
+ // Hex
99
+ if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
100
+ // Binary
101
+ if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
102
+ // Octal
103
+ if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
104
+ // Decimal
105
+ if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
106
+ // Decimal literals may be "imaginary"
107
+ stream.eat(/J/i);
108
+ // TODO - Can you have imaginary longs?
109
+ intLiteral = true;
110
+ }
111
+ // Zero by itself with no other piece of number.
112
+ if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
113
+ if (intLiteral) {
114
+ // Integer literals may be "long"
115
+ stream.eat(/L/i);
116
+ return 'number';
117
+ }
118
+ }
119
+
120
+ // Handle Strings
121
+ if (stream.match(stringPrefixes)) {
122
+ state.tokenize = tokenStringFactory(stream.current());
123
+ return state.tokenize(stream, state);
124
+ }
125
+
126
+ // Handle operators and Delimiters
127
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
128
+ return null;
129
+ }
130
+ if (stream.match(doubleOperators)
131
+ || stream.match(singleOperators)
132
+ || stream.match(wordOperators)) {
133
+ return 'operator';
134
+ }
135
+ if (stream.match(singleDelimiters)) {
136
+ return null;
137
+ }
138
+
139
+ if (stream.match(keywords)) {
140
+ return 'keyword';
141
+ }
142
+
143
+ if (stream.match(builtins)) {
144
+ return 'builtin';
145
+ }
146
+
147
+ if (stream.match(identifiers)) {
148
+ return 'variable';
149
+ }
150
+
151
+ // Handle non-detected items
152
+ stream.next();
153
+ return ERRORCLASS;
154
+ }
155
+
156
+ function tokenStringFactory(delimiter) {
157
+ while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
158
+ delimiter = delimiter.substr(1);
159
+ }
160
+ var singleline = delimiter.length == 1;
161
+ var OUTCLASS = 'string';
162
+
163
+ function tokenString(stream, state) {
164
+ while (!stream.eol()) {
165
+ stream.eatWhile(/[^'"\\]/);
166
+ if (stream.eat('\\')) {
167
+ stream.next();
168
+ if (singleline && stream.eol()) {
169
+ return OUTCLASS;
170
+ }
171
+ } else if (stream.match(delimiter)) {
172
+ state.tokenize = tokenBase;
173
+ return OUTCLASS;
174
+ } else {
175
+ stream.eat(/['"]/);
176
+ }
177
+ }
178
+ if (singleline) {
179
+ if (parserConf.singleLineStringErrors) {
180
+ return ERRORCLASS;
181
+ } else {
182
+ state.tokenize = tokenBase;
183
+ }
184
+ }
185
+ return OUTCLASS;
186
+ }
187
+ tokenString.isString = true;
188
+ return tokenString;
189
+ }
190
+
191
+ function indent(stream, state, type) {
192
+ type = type || 'py';
193
+ var indentUnit = 0;
194
+ if (type === 'py') {
195
+ if (state.scopes[0].type !== 'py') {
196
+ state.scopes[0].offset = stream.indentation();
197
+ return;
198
+ }
199
+ for (var i = 0; i < state.scopes.length; ++i) {
200
+ if (state.scopes[i].type === 'py') {
201
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
202
+ break;
203
+ }
204
+ }
205
+ } else {
206
+ indentUnit = stream.column() + stream.current().length;
207
+ }
208
+ state.scopes.unshift({
209
+ offset: indentUnit,
210
+ type: type
211
+ });
212
+ }
213
+
214
+ function dedent(stream, state, type) {
215
+ type = type || 'py';
216
+ if (state.scopes.length == 1) return;
217
+ if (state.scopes[0].type === 'py') {
218
+ var _indent = stream.indentation();
219
+ var _indent_index = -1;
220
+ for (var i = 0; i < state.scopes.length; ++i) {
221
+ if (_indent === state.scopes[i].offset) {
222
+ _indent_index = i;
223
+ break;
224
+ }
225
+ }
226
+ if (_indent_index === -1) {
227
+ return true;
228
+ }
229
+ while (state.scopes[0].offset !== _indent) {
230
+ state.scopes.shift();
231
+ }
232
+ return false;
233
+ } else {
234
+ if (type === 'py') {
235
+ state.scopes[0].offset = stream.indentation();
236
+ return false;
237
+ } else {
238
+ if (state.scopes[0].type != type) {
239
+ return true;
240
+ }
241
+ state.scopes.shift();
242
+ return false;
243
+ }
244
+ }
245
+ }
246
+
247
+ function tokenLexer(stream, state) {
248
+ indentInfo = null;
249
+ var style = state.tokenize(stream, state);
250
+ var current = stream.current();
251
+
252
+ // Handle '.' connected identifiers
253
+ if (current === '.') {
254
+ style = stream.match(identifiers, false) ? null : ERRORCLASS;
255
+ if (style === null && state.lastToken === 'meta') {
256
+ // Apply 'meta' style to '.' connected identifiers when
257
+ // appropriate.
258
+ style = 'meta';
259
+ }
260
+ return style;
261
+ }
262
+
263
+ // Handle decorators
264
+ if (current === '@') {
265
+ return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
266
+ }
267
+
268
+ if ((style === 'variable' || style === 'builtin')
269
+ && state.lastToken === 'meta') {
270
+ style = 'meta';
271
+ }
272
+
273
+ // Handle scope changes.
274
+ if (current === 'pass' || current === 'return') {
275
+ state.dedent += 1;
276
+ }
277
+ if (current === 'lambda') state.lambda = true;
278
+ if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
279
+ || indentInfo === 'indent') {
280
+ indent(stream, state);
281
+ }
282
+ var delimiter_index = '[({'.indexOf(current);
283
+ if (delimiter_index !== -1) {
284
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
285
+ }
286
+ if (indentInfo === 'dedent') {
287
+ if (dedent(stream, state)) {
288
+ return ERRORCLASS;
289
+ }
290
+ }
291
+ delimiter_index = '])}'.indexOf(current);
292
+ if (delimiter_index !== -1) {
293
+ if (dedent(stream, state, current)) {
294
+ return ERRORCLASS;
295
+ }
296
+ }
297
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
298
+ if (state.scopes.length > 1) state.scopes.shift();
299
+ state.dedent -= 1;
300
+ }
301
+
302
+ return style;
303
+ }
304
+
305
+ var external = {
306
+ startState: function(basecolumn) {
307
+ return {
308
+ tokenize: tokenBase,
309
+ scopes: [{offset:basecolumn || 0, type:'py'}],
310
+ lastToken: null,
311
+ lambda: false,
312
+ dedent: 0
313
+ };
314
+ },
315
+
316
+ token: function(stream, state) {
317
+ var style = tokenLexer(stream, state);
318
+
319
+ state.lastToken = style;
320
+
321
+ if (stream.eol() && stream.lambda) {
322
+ state.lambda = false;
323
+ }
324
+
325
+ return style;
326
+ },
327
+
328
+ indent: function(state) {
329
+ if (state.tokenize != tokenBase) {
330
+ return state.tokenize.isString ? CodeMirror.Pass : 0;
331
+ }
332
+
333
+ return state.scopes[0].offset;
334
+ }
335
+
336
+ };
337
+ return external;
338
+ });
339
+
340
+ CodeMirror.defineMIME("text/x-python", "python");
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2011, Ubalo, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Ubalo, Inc nor the names of its
12
+ contributors may be used to endorse or promote products derived
13
+ from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,74 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>CodeMirror: R mode</title>
6
+ <link rel="stylesheet" href="../../lib/codemirror.css">
7
+ <script src="../../lib/codemirror.js"></script>
8
+ <script src="r.js"></script>
9
+ <style>
10
+ .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
11
+ .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
12
+ .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
13
+ .cm-s-default span.cm-arrow { color: brown; }
14
+ .cm-s-default span.cm-arg-is { color: brown; }
15
+ </style>
16
+ <link rel="stylesheet" href="../../doc/docs.css">
17
+ </head>
18
+ <body>
19
+ <h1>CodeMirror: R mode</h1>
20
+ <form><textarea id="code" name="code">
21
+ # Code from http://www.mayin.org/ajayshah/KB/R/
22
+
23
+ # FIRST LEARN ABOUT LISTS --
24
+ X = list(height=5.4, weight=54)
25
+ print("Use default printing --")
26
+ print(X)
27
+ print("Accessing individual elements --")
28
+ cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
29
+
30
+ # FUNCTIONS --
31
+ square <- function(x) {
32
+ return(x*x)
33
+ }
34
+ cat("The square of 3 is ", square(3), "\n")
35
+
36
+ # default value of the arg is set to 5.
37
+ cube <- function(x=5) {
38
+ return(x*x*x);
39
+ }
40
+ cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
41
+ cat("Calling cube : ", cube(), "\n") # will default to 5^3.
42
+
43
+ # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
44
+ powers <- function(x) {
45
+ parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
46
+ return(parcel);
47
+ }
48
+
49
+ X = powers(3);
50
+ print("Showing powers of 3 --"); print(X);
51
+
52
+ # WRITING THIS COMPACTLY (4 lines instead of 7)
53
+
54
+ powerful <- function(x) {
55
+ return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
56
+ }
57
+ print("Showing powers of 3 --"); print(powerful(3));
58
+
59
+ # In R, the last expression in a function is, by default, what is
60
+ # returned. So you could equally just say:
61
+ powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
62
+ </textarea></form>
63
+ <script>
64
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
65
+ </script>
66
+
67
+ <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
68
+
69
+ <p>Development of the CodeMirror R mode was kindly sponsored
70
+ by <a href="http://ubalo.com/">Ubalo</a>, who hold
71
+ the <a href="LICENSE">license</a>.</p>
72
+
73
+ </body>
74
+ </html>
@@ -0,0 +1,141 @@
1
+ CodeMirror.defineMode("r", function(config) {
2
+ function wordObj(str) {
3
+ var words = str.split(" "), res = {};
4
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
5
+ return res;
6
+ }
7
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
8
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
9
+ var keywords = wordObj("if else repeat while function for in next break");
10
+ var blockkeywords = wordObj("if else repeat while function for");
11
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
12
+ var curPunc;
13
+
14
+ function tokenBase(stream, state) {
15
+ curPunc = null;
16
+ var ch = stream.next();
17
+ if (ch == "#") {
18
+ stream.skipToEnd();
19
+ return "comment";
20
+ } else if (ch == "0" && stream.eat("x")) {
21
+ stream.eatWhile(/[\da-f]/i);
22
+ return "number";
23
+ } else if (ch == "." && stream.eat(/\d/)) {
24
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
25
+ return "number";
26
+ } else if (/\d/.test(ch)) {
27
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
28
+ return "number";
29
+ } else if (ch == "'" || ch == '"') {
30
+ state.tokenize = tokenString(ch);
31
+ return "string";
32
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
33
+ return "keyword";
34
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
35
+ stream.eatWhile(/[\w\.]/);
36
+ var word = stream.current();
37
+ if (atoms.propertyIsEnumerable(word)) return "atom";
38
+ if (keywords.propertyIsEnumerable(word)) {
39
+ if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
40
+ return "keyword";
41
+ }
42
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
43
+ return "variable";
44
+ } else if (ch == "%") {
45
+ if (stream.skipTo("%")) stream.next();
46
+ return "variable-2";
47
+ } else if (ch == "<" && stream.eat("-")) {
48
+ return "arrow";
49
+ } else if (ch == "=" && state.ctx.argList) {
50
+ return "arg-is";
51
+ } else if (opChars.test(ch)) {
52
+ if (ch == "$") return "dollar";
53
+ stream.eatWhile(opChars);
54
+ return "operator";
55
+ } else if (/[\(\){}\[\];]/.test(ch)) {
56
+ curPunc = ch;
57
+ if (ch == ";") return "semi";
58
+ return null;
59
+ } else {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ function tokenString(quote) {
65
+ return function(stream, state) {
66
+ if (stream.eat("\\")) {
67
+ var ch = stream.next();
68
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
69
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
70
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
71
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
72
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
73
+ return "string-2";
74
+ } else {
75
+ var next;
76
+ while ((next = stream.next()) != null) {
77
+ if (next == quote) { state.tokenize = tokenBase; break; }
78
+ if (next == "\\") { stream.backUp(1); break; }
79
+ }
80
+ return "string";
81
+ }
82
+ };
83
+ }
84
+
85
+ function push(state, type, stream) {
86
+ state.ctx = {type: type,
87
+ indent: state.indent,
88
+ align: null,
89
+ column: stream.column(),
90
+ prev: state.ctx};
91
+ }
92
+ function pop(state) {
93
+ state.indent = state.ctx.indent;
94
+ state.ctx = state.ctx.prev;
95
+ }
96
+
97
+ return {
98
+ startState: function() {
99
+ return {tokenize: tokenBase,
100
+ ctx: {type: "top",
101
+ indent: -config.indentUnit,
102
+ align: false},
103
+ indent: 0,
104
+ afterIdent: false};
105
+ },
106
+
107
+ token: function(stream, state) {
108
+ if (stream.sol()) {
109
+ if (state.ctx.align == null) state.ctx.align = false;
110
+ state.indent = stream.indentation();
111
+ }
112
+ if (stream.eatSpace()) return null;
113
+ var style = state.tokenize(stream, state);
114
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
115
+
116
+ var ctype = state.ctx.type;
117
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
118
+ if (curPunc == "{") push(state, "}", stream);
119
+ else if (curPunc == "(") {
120
+ push(state, ")", stream);
121
+ if (state.afterIdent) state.ctx.argList = true;
122
+ }
123
+ else if (curPunc == "[") push(state, "]", stream);
124
+ else if (curPunc == "block") push(state, "block", stream);
125
+ else if (curPunc == ctype) pop(state);
126
+ state.afterIdent = style == "variable" || style == "keyword";
127
+ return style;
128
+ },
129
+
130
+ indent: function(state, textAfter) {
131
+ if (state.tokenize != tokenBase) return 0;
132
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
133
+ closing = firstChar == ctx.type;
134
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
135
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
136
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
137
+ }
138
+ };
139
+ });
140
+
141
+ CodeMirror.defineMIME("text/x-rsrc", "r");