fluentd-ui 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/javascripts/application.js +2 -0
  5. data/app/assets/javascripts/codemirror.js +29 -0
  6. data/app/assets/javascripts/codemirror_fluentd.js +59 -0
  7. data/app/assets/stylesheets/application.css +6 -0
  8. data/app/views/fluentd/settings/edit.html.haml +1 -1
  9. data/app/views/shared/vue/_setting.html.erb +1 -1
  10. data/bower.json +2 -1
  11. data/lib/fluentd-ui/version.rb +1 -1
  12. data/spec/features/source_and_output_spec.rb +16 -6
  13. data/vendor/assets/javascripts/bower/codemirror/.bower.json +29 -0
  14. data/vendor/assets/javascripts/bower/codemirror/AUTHORS +423 -0
  15. data/vendor/assets/javascripts/bower/codemirror/CONTRIBUTING.md +76 -0
  16. data/vendor/assets/javascripts/bower/codemirror/LICENSE +19 -0
  17. data/vendor/assets/javascripts/bower/codemirror/README.md +11 -0
  18. data/vendor/assets/javascripts/bower/codemirror/addon/comment/comment.js +183 -0
  19. data/vendor/assets/javascripts/bower/codemirror/addon/comment/continuecomment.js +85 -0
  20. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.css +32 -0
  21. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.js +155 -0
  22. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.css +6 -0
  23. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.js +41 -0
  24. data/vendor/assets/javascripts/bower/codemirror/addon/display/panel.js +94 -0
  25. data/vendor/assets/javascripts/bower/codemirror/addon/display/placeholder.js +58 -0
  26. data/vendor/assets/javascripts/bower/codemirror/addon/display/rulers.js +64 -0
  27. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closebrackets.js +159 -0
  28. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closetag.js +159 -0
  29. data/vendor/assets/javascripts/bower/codemirror/addon/edit/continuelist.js +51 -0
  30. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchbrackets.js +120 -0
  31. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchtags.js +66 -0
  32. data/vendor/assets/javascripts/bower/codemirror/addon/edit/trailingspace.js +27 -0
  33. data/vendor/assets/javascripts/bower/codemirror/addon/fold/brace-fold.js +105 -0
  34. data/vendor/assets/javascripts/bower/codemirror/addon/fold/comment-fold.js +57 -0
  35. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldcode.js +145 -0
  36. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.css +20 -0
  37. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.js +134 -0
  38. data/vendor/assets/javascripts/bower/codemirror/addon/fold/indent-fold.js +44 -0
  39. data/vendor/assets/javascripts/bower/codemirror/addon/fold/markdown-fold.js +49 -0
  40. data/vendor/assets/javascripts/bower/codemirror/addon/fold/xml-fold.js +182 -0
  41. data/vendor/assets/javascripts/bower/codemirror/addon/hint/anyword-hint.js +41 -0
  42. data/vendor/assets/javascripts/bower/codemirror/addon/hint/css-hint.js +56 -0
  43. data/vendor/assets/javascripts/bower/codemirror/addon/hint/html-hint.js +348 -0
  44. data/vendor/assets/javascripts/bower/codemirror/addon/hint/javascript-hint.js +146 -0
  45. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.css +38 -0
  46. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.js +389 -0
  47. data/vendor/assets/javascripts/bower/codemirror/addon/hint/sql-hint.js +197 -0
  48. data/vendor/assets/javascripts/bower/codemirror/addon/hint/xml-hint.js +110 -0
  49. data/vendor/assets/javascripts/bower/codemirror/addon/lint/coffeescript-lint.js +41 -0
  50. data/vendor/assets/javascripts/bower/codemirror/addon/lint/css-lint.js +35 -0
  51. data/vendor/assets/javascripts/bower/codemirror/addon/lint/javascript-lint.js +136 -0
  52. data/vendor/assets/javascripts/bower/codemirror/addon/lint/json-lint.js +31 -0
  53. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.css +73 -0
  54. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.js +204 -0
  55. data/vendor/assets/javascripts/bower/codemirror/addon/lint/yaml-lint.js +28 -0
  56. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.css +112 -0
  57. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.js +643 -0
  58. data/vendor/assets/javascripts/bower/codemirror/addon/mode/loadmode.js +64 -0
  59. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex.js +118 -0
  60. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex_test.js +33 -0
  61. data/vendor/assets/javascripts/bower/codemirror/addon/mode/overlay.js +85 -0
  62. data/vendor/assets/javascripts/bower/codemirror/addon/mode/simple.js +213 -0
  63. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/colorize.js +40 -0
  64. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode-standalone.js +157 -0
  65. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.js +72 -0
  66. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.node.js +120 -0
  67. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/annotatescrollbar.js +76 -0
  68. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/scrollpastend.js +46 -0
  69. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.css +66 -0
  70. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.js +139 -0
  71. data/vendor/assets/javascripts/bower/codemirror/addon/search/match-highlighter.js +128 -0
  72. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.css +8 -0
  73. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.js +90 -0
  74. data/vendor/assets/javascripts/bower/codemirror/addon/search/search.js +164 -0
  75. data/vendor/assets/javascripts/bower/codemirror/addon/search/searchcursor.js +189 -0
  76. data/vendor/assets/javascripts/bower/codemirror/addon/selection/active-line.js +71 -0
  77. data/vendor/assets/javascripts/bower/codemirror/addon/selection/mark-selection.js +118 -0
  78. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.css +86 -0
  79. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.js +670 -0
  80. data/vendor/assets/javascripts/bower/codemirror/addon/tern/worker.js +44 -0
  81. data/vendor/assets/javascripts/bower/codemirror/addon/wrap/hardwrap.js +139 -0
  82. data/vendor/assets/javascripts/bower/codemirror/bower.json +16 -0
  83. data/vendor/assets/javascripts/bower/codemirror/keymap/emacs.js +411 -0
  84. data/vendor/assets/javascripts/bower/codemirror/keymap/sublime.js +540 -0
  85. data/vendor/assets/javascripts/bower/codemirror/keymap/vim.js +4901 -0
  86. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +309 -0
  87. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +8029 -0
  88. data/vendor/assets/javascripts/bower/codemirror/mode/apl/apl.js +175 -0
  89. data/vendor/assets/javascripts/bower/codemirror/mode/asterisk/asterisk.js +198 -0
  90. data/vendor/assets/javascripts/bower/codemirror/mode/clike/clike.js +489 -0
  91. data/vendor/assets/javascripts/bower/codemirror/mode/clike/scala.html +767 -0
  92. data/vendor/assets/javascripts/bower/codemirror/mode/clojure/clojure.js +243 -0
  93. data/vendor/assets/javascripts/bower/codemirror/mode/cobol/cobol.js +255 -0
  94. data/vendor/assets/javascripts/bower/codemirror/mode/coffeescript/coffeescript.js +369 -0
  95. data/vendor/assets/javascripts/bower/codemirror/mode/commonlisp/commonlisp.js +122 -0
  96. data/vendor/assets/javascripts/bower/codemirror/mode/css/css.js +717 -0
  97. data/vendor/assets/javascripts/bower/codemirror/mode/css/less.html +152 -0
  98. data/vendor/assets/javascripts/bower/codemirror/mode/css/less_test.js +51 -0
  99. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss.html +157 -0
  100. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss_test.js +110 -0
  101. data/vendor/assets/javascripts/bower/codemirror/mode/css/test.js +135 -0
  102. data/vendor/assets/javascripts/bower/codemirror/mode/cypher/cypher.js +146 -0
  103. data/vendor/assets/javascripts/bower/codemirror/mode/d/d.js +218 -0
  104. data/vendor/assets/javascripts/bower/codemirror/mode/dart/dart.js +50 -0
  105. data/vendor/assets/javascripts/bower/codemirror/mode/diff/diff.js +47 -0
  106. data/vendor/assets/javascripts/bower/codemirror/mode/django/django.js +67 -0
  107. data/vendor/assets/javascripts/bower/codemirror/mode/dockerfile/dockerfile.js +76 -0
  108. data/vendor/assets/javascripts/bower/codemirror/mode/dtd/dtd.js +142 -0
  109. data/vendor/assets/javascripts/bower/codemirror/mode/dylan/dylan.js +299 -0
  110. data/vendor/assets/javascripts/bower/codemirror/mode/ebnf/ebnf.js +195 -0
  111. data/vendor/assets/javascripts/bower/codemirror/mode/ecl/ecl.js +207 -0
  112. data/vendor/assets/javascripts/bower/codemirror/mode/eiffel/eiffel.js +162 -0
  113. data/vendor/assets/javascripts/bower/codemirror/mode/erlang/erlang.js +622 -0
  114. data/vendor/assets/javascripts/bower/codemirror/mode/fortran/fortran.js +188 -0
  115. data/vendor/assets/javascripts/bower/codemirror/mode/gas/gas.js +345 -0
  116. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/gfm.js +123 -0
  117. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/test.js +213 -0
  118. data/vendor/assets/javascripts/bower/codemirror/mode/gherkin/gherkin.js +178 -0
  119. data/vendor/assets/javascripts/bower/codemirror/mode/go/go.js +184 -0
  120. data/vendor/assets/javascripts/bower/codemirror/mode/groovy/groovy.js +226 -0
  121. data/vendor/assets/javascripts/bower/codemirror/mode/haml/haml.js +159 -0
  122. data/vendor/assets/javascripts/bower/codemirror/mode/haml/test.js +97 -0
  123. data/vendor/assets/javascripts/bower/codemirror/mode/haskell/haskell.js +267 -0
  124. data/vendor/assets/javascripts/bower/codemirror/mode/haxe/haxe.js +518 -0
  125. data/vendor/assets/javascripts/bower/codemirror/mode/htmlembedded/htmlembedded.js +86 -0
  126. data/vendor/assets/javascripts/bower/codemirror/mode/htmlmixed/htmlmixed.js +121 -0
  127. data/vendor/assets/javascripts/bower/codemirror/mode/http/http.js +113 -0
  128. data/vendor/assets/javascripts/bower/codemirror/mode/idl/idl.js +290 -0
  129. data/vendor/assets/javascripts/bower/codemirror/mode/jade/jade.js +590 -0
  130. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/javascript.js +686 -0
  131. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/json-ld.html +72 -0
  132. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/test.js +200 -0
  133. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/typescript.html +61 -0
  134. data/vendor/assets/javascripts/bower/codemirror/mode/jinja2/jinja2.js +142 -0
  135. data/vendor/assets/javascripts/bower/codemirror/mode/julia/julia.js +301 -0
  136. data/vendor/assets/javascripts/bower/codemirror/mode/kotlin/kotlin.js +280 -0
  137. data/vendor/assets/javascripts/bower/codemirror/mode/livescript/livescript.js +280 -0
  138. data/vendor/assets/javascripts/bower/codemirror/mode/lua/lua.js +159 -0
  139. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/markdown.js +765 -0
  140. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/test.js +754 -0
  141. data/vendor/assets/javascripts/bower/codemirror/mode/meta.js +165 -0
  142. data/vendor/assets/javascripts/bower/codemirror/mode/mirc/mirc.js +193 -0
  143. data/vendor/assets/javascripts/bower/codemirror/mode/mllike/mllike.js +205 -0
  144. data/vendor/assets/javascripts/bower/codemirror/mode/modelica/modelica.js +245 -0
  145. data/vendor/assets/javascripts/bower/codemirror/mode/nginx/nginx.js +178 -0
  146. data/vendor/assets/javascripts/bower/codemirror/mode/ntriples/ntriples.js +186 -0
  147. data/vendor/assets/javascripts/bower/codemirror/mode/octave/octave.js +135 -0
  148. data/vendor/assets/javascripts/bower/codemirror/mode/pascal/pascal.js +109 -0
  149. data/vendor/assets/javascripts/bower/codemirror/mode/pegjs/pegjs.js +114 -0
  150. data/vendor/assets/javascripts/bower/codemirror/mode/perl/perl.js +832 -0
  151. data/vendor/assets/javascripts/bower/codemirror/mode/php/php.js +226 -0
  152. data/vendor/assets/javascripts/bower/codemirror/mode/php/test.js +154 -0
  153. data/vendor/assets/javascripts/bower/codemirror/mode/pig/pig.js +188 -0
  154. data/vendor/assets/javascripts/bower/codemirror/mode/properties/properties.js +78 -0
  155. data/vendor/assets/javascripts/bower/codemirror/mode/puppet/puppet.js +220 -0
  156. data/vendor/assets/javascripts/bower/codemirror/mode/python/python.js +359 -0
  157. data/vendor/assets/javascripts/bower/codemirror/mode/q/q.js +139 -0
  158. data/vendor/assets/javascripts/bower/codemirror/mode/r/r.js +162 -0
  159. data/vendor/assets/javascripts/bower/codemirror/mode/rpm/rpm.js +101 -0
  160. data/vendor/assets/javascripts/bower/codemirror/mode/rst/rst.js +557 -0
  161. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/ruby.js +285 -0
  162. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/test.js +14 -0
  163. data/vendor/assets/javascripts/bower/codemirror/mode/rust/rust.js +451 -0
  164. data/vendor/assets/javascripts/bower/codemirror/mode/sass/sass.js +327 -0
  165. data/vendor/assets/javascripts/bower/codemirror/mode/scheme/scheme.js +248 -0
  166. data/vendor/assets/javascripts/bower/codemirror/mode/shell/shell.js +139 -0
  167. data/vendor/assets/javascripts/bower/codemirror/mode/shell/test.js +58 -0
  168. data/vendor/assets/javascripts/bower/codemirror/mode/sieve/sieve.js +193 -0
  169. data/vendor/assets/javascripts/bower/codemirror/mode/slim/slim.js +575 -0
  170. data/vendor/assets/javascripts/bower/codemirror/mode/slim/test.js +96 -0
  171. data/vendor/assets/javascripts/bower/codemirror/mode/smalltalk/smalltalk.js +168 -0
  172. data/vendor/assets/javascripts/bower/codemirror/mode/smarty/smarty.js +221 -0
  173. data/vendor/assets/javascripts/bower/codemirror/mode/smartymixed/smartymixed.js +197 -0
  174. data/vendor/assets/javascripts/bower/codemirror/mode/solr/solr.js +104 -0
  175. data/vendor/assets/javascripts/bower/codemirror/mode/soy/soy.js +198 -0
  176. data/vendor/assets/javascripts/bower/codemirror/mode/sparql/sparql.js +174 -0
  177. data/vendor/assets/javascripts/bower/codemirror/mode/spreadsheet/spreadsheet.js +109 -0
  178. data/vendor/assets/javascripts/bower/codemirror/mode/sql/sql.js +391 -0
  179. data/vendor/assets/javascripts/bower/codemirror/mode/stex/stex.js +251 -0
  180. data/vendor/assets/javascripts/bower/codemirror/mode/stex/test.js +123 -0
  181. data/vendor/assets/javascripts/bower/codemirror/mode/tcl/tcl.js +147 -0
  182. data/vendor/assets/javascripts/bower/codemirror/mode/textile/test.js +417 -0
  183. data/vendor/assets/javascripts/bower/codemirror/mode/textile/textile.js +469 -0
  184. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  185. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.js +369 -0
  186. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.css +26 -0
  187. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.js +323 -0
  188. data/vendor/assets/javascripts/bower/codemirror/mode/toml/toml.js +88 -0
  189. data/vendor/assets/javascripts/bower/codemirror/mode/tornado/tornado.js +68 -0
  190. data/vendor/assets/javascripts/bower/codemirror/mode/turtle/turtle.js +162 -0
  191. data/vendor/assets/javascripts/bower/codemirror/mode/vb/vb.js +274 -0
  192. data/vendor/assets/javascripts/bower/codemirror/mode/vbscript/vbscript.js +350 -0
  193. data/vendor/assets/javascripts/bower/codemirror/mode/velocity/velocity.js +201 -0
  194. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/test.js +273 -0
  195. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/verilog.js +364 -0
  196. data/vendor/assets/javascripts/bower/codemirror/mode/xml/test.js +51 -0
  197. data/vendor/assets/javascripts/bower/codemirror/mode/xml/xml.js +384 -0
  198. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/test.js +67 -0
  199. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/xquery.js +447 -0
  200. data/vendor/assets/javascripts/bower/codemirror/mode/yaml/yaml.js +117 -0
  201. data/vendor/assets/javascripts/bower/codemirror/mode/z80/z80.js +100 -0
  202. data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +38 -0
  203. data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +37 -0
  204. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +5 -0
  205. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +77 -0
  206. data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +36 -0
  207. data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +36 -0
  208. data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +30 -0
  209. data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +23 -0
  210. data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +23 -0
  211. data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +13 -0
  212. data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +32 -0
  213. data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +45 -0
  214. data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +35 -0
  215. data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +44 -0
  216. data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +45 -0
  217. data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +31 -0
  218. data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +12 -0
  219. data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +43 -0
  220. data/vendor/assets/javascripts/bower/codemirror/theme/night.css +26 -0
  221. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +36 -0
  222. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +36 -0
  223. data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +50 -0
  224. data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +23 -0
  225. data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +165 -0
  226. data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +28 -0
  227. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +35 -0
  228. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +36 -0
  229. data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +30 -0
  230. data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +32 -0
  231. data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +51 -0
  232. data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +43 -0
  233. data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +37 -0
  234. metadata +225 -2
@@ -0,0 +1,139 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("q",function(config){
15
+ var indentUnit=config.indentUnit,
16
+ curPunc,
17
+ keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]),
18
+ E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;
19
+ function buildRE(w){return new RegExp("^("+w.join("|")+")$");}
20
+ function tokenBase(stream,state){
21
+ var sol=stream.sol(),c=stream.next();
22
+ curPunc=null;
23
+ if(sol)
24
+ if(c=="/")
25
+ return(state.tokenize=tokenLineComment)(stream,state);
26
+ else if(c=="\\"){
27
+ if(stream.eol()||/\s/.test(stream.peek()))
28
+ return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream, state):state.tokenize=tokenBase,"comment";
29
+ else
30
+ return state.tokenize=tokenBase,"builtin";
31
+ }
32
+ if(/\s/.test(c))
33
+ return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"whitespace";
34
+ if(c=='"')
35
+ return(state.tokenize=tokenString)(stream,state);
36
+ if(c=='`')
37
+ return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol";
38
+ if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){
39
+ var t=null;
40
+ stream.backUp(1);
41
+ if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
42
+ || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)
43
+ || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)
44
+ || stream.match(/^\d+[ptuv]{1}/))
45
+ t="temporal";
46
+ else if(stream.match(/^0[NwW]{1}/)
47
+ || stream.match(/^0x[\d|a-f|A-F]*/)
48
+ || stream.match(/^[0|1]+[b]{1}/)
49
+ || stream.match(/^\d+[chijn]{1}/)
50
+ || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))
51
+ t="number";
52
+ return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error");
53
+ }
54
+ if(/[A-Z|a-z]|\./.test(c))
55
+ return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/),keywords.test(stream.current())?"keyword":"variable";
56
+ if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c))
57
+ return null;
58
+ if(/[{}\(\[\]\)]/.test(c))
59
+ return null;
60
+ return"error";
61
+ }
62
+ function tokenLineComment(stream,state){
63
+ return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment";
64
+ }
65
+ function tokenBlockComment(stream,state){
66
+ var f=stream.sol()&&stream.peek()=="\\";
67
+ stream.skipToEnd();
68
+ if(f&&/^\\\s*$/.test(stream.current()))
69
+ state.tokenize=tokenBase;
70
+ return"comment";
71
+ }
72
+ function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";}
73
+ function tokenString(stream,state){
74
+ var escaped=false,next,end=false;
75
+ while((next=stream.next())){
76
+ if(next=="\""&&!escaped){end=true;break;}
77
+ escaped=!escaped&&next=="\\";
78
+ }
79
+ if(end)state.tokenize=tokenBase;
80
+ return"string";
81
+ }
82
+ function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};}
83
+ function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;}
84
+ return{
85
+ startState:function(){
86
+ return{tokenize:tokenBase,
87
+ context:null,
88
+ indent:0,
89
+ col:0};
90
+ },
91
+ token:function(stream,state){
92
+ if(stream.sol()){
93
+ if(state.context&&state.context.align==null)
94
+ state.context.align=false;
95
+ state.indent=stream.indentation();
96
+ }
97
+ //if (stream.eatSpace()) return null;
98
+ var style=state.tokenize(stream,state);
99
+ if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){
100
+ state.context.align=true;
101
+ }
102
+ if(curPunc=="(")pushContext(state,")",stream.column());
103
+ else if(curPunc=="[")pushContext(state,"]",stream.column());
104
+ else if(curPunc=="{")pushContext(state,"}",stream.column());
105
+ else if(/[\]\}\)]/.test(curPunc)){
106
+ while(state.context&&state.context.type=="pattern")popContext(state);
107
+ if(state.context&&curPunc==state.context.type)popContext(state);
108
+ }
109
+ else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state);
110
+ else if(/atom|string|variable/.test(style)&&state.context){
111
+ if(/[\}\]]/.test(state.context.type))
112
+ pushContext(state,"pattern",stream.column());
113
+ else if(state.context.type=="pattern"&&!state.context.align){
114
+ state.context.align=true;
115
+ state.context.col=stream.column();
116
+ }
117
+ }
118
+ return style;
119
+ },
120
+ indent:function(state,textAfter){
121
+ var firstChar=textAfter&&textAfter.charAt(0);
122
+ var context=state.context;
123
+ if(/[\]\}]/.test(firstChar))
124
+ while (context&&context.type=="pattern")context=context.prev;
125
+ var closing=context&&firstChar==context.type;
126
+ if(!context)
127
+ return 0;
128
+ else if(context.type=="pattern")
129
+ return context.col;
130
+ else if(context.align)
131
+ return context.col+(closing?0:1);
132
+ else
133
+ return context.indent+(closing?0:indentUnit);
134
+ }
135
+ };
136
+ });
137
+ CodeMirror.defineMIME("text/x-q","q");
138
+
139
+ });
@@ -0,0 +1,162 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("r", function(config) {
15
+ function wordObj(str) {
16
+ var words = str.split(" "), res = {};
17
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
18
+ return res;
19
+ }
20
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
21
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
22
+ var keywords = wordObj("if else repeat while function for in next break");
23
+ var blockkeywords = wordObj("if else repeat while function for");
24
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
25
+ var curPunc;
26
+
27
+ function tokenBase(stream, state) {
28
+ curPunc = null;
29
+ var ch = stream.next();
30
+ if (ch == "#") {
31
+ stream.skipToEnd();
32
+ return "comment";
33
+ } else if (ch == "0" && stream.eat("x")) {
34
+ stream.eatWhile(/[\da-f]/i);
35
+ return "number";
36
+ } else if (ch == "." && stream.eat(/\d/)) {
37
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
38
+ return "number";
39
+ } else if (/\d/.test(ch)) {
40
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
41
+ return "number";
42
+ } else if (ch == "'" || ch == '"') {
43
+ state.tokenize = tokenString(ch);
44
+ return "string";
45
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
46
+ return "keyword";
47
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
48
+ stream.eatWhile(/[\w\.]/);
49
+ var word = stream.current();
50
+ if (atoms.propertyIsEnumerable(word)) return "atom";
51
+ if (keywords.propertyIsEnumerable(word)) {
52
+ // Block keywords start new blocks, except 'else if', which only starts
53
+ // one new block for the 'if', no block for the 'else'.
54
+ if (blockkeywords.propertyIsEnumerable(word) &&
55
+ !stream.match(/\s*if(\s+|$)/, false))
56
+ curPunc = "block";
57
+ return "keyword";
58
+ }
59
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
60
+ return "variable";
61
+ } else if (ch == "%") {
62
+ if (stream.skipTo("%")) stream.next();
63
+ return "variable-2";
64
+ } else if (ch == "<" && stream.eat("-")) {
65
+ return "arrow";
66
+ } else if (ch == "=" && state.ctx.argList) {
67
+ return "arg-is";
68
+ } else if (opChars.test(ch)) {
69
+ if (ch == "$") return "dollar";
70
+ stream.eatWhile(opChars);
71
+ return "operator";
72
+ } else if (/[\(\){}\[\];]/.test(ch)) {
73
+ curPunc = ch;
74
+ if (ch == ";") return "semi";
75
+ return null;
76
+ } else {
77
+ return null;
78
+ }
79
+ }
80
+
81
+ function tokenString(quote) {
82
+ return function(stream, state) {
83
+ if (stream.eat("\\")) {
84
+ var ch = stream.next();
85
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
86
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
87
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
88
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
89
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
90
+ return "string-2";
91
+ } else {
92
+ var next;
93
+ while ((next = stream.next()) != null) {
94
+ if (next == quote) { state.tokenize = tokenBase; break; }
95
+ if (next == "\\") { stream.backUp(1); break; }
96
+ }
97
+ return "string";
98
+ }
99
+ };
100
+ }
101
+
102
+ function push(state, type, stream) {
103
+ state.ctx = {type: type,
104
+ indent: state.indent,
105
+ align: null,
106
+ column: stream.column(),
107
+ prev: state.ctx};
108
+ }
109
+ function pop(state) {
110
+ state.indent = state.ctx.indent;
111
+ state.ctx = state.ctx.prev;
112
+ }
113
+
114
+ return {
115
+ startState: function() {
116
+ return {tokenize: tokenBase,
117
+ ctx: {type: "top",
118
+ indent: -config.indentUnit,
119
+ align: false},
120
+ indent: 0,
121
+ afterIdent: false};
122
+ },
123
+
124
+ token: function(stream, state) {
125
+ if (stream.sol()) {
126
+ if (state.ctx.align == null) state.ctx.align = false;
127
+ state.indent = stream.indentation();
128
+ }
129
+ if (stream.eatSpace()) return null;
130
+ var style = state.tokenize(stream, state);
131
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
132
+
133
+ var ctype = state.ctx.type;
134
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
135
+ if (curPunc == "{") push(state, "}", stream);
136
+ else if (curPunc == "(") {
137
+ push(state, ")", stream);
138
+ if (state.afterIdent) state.ctx.argList = true;
139
+ }
140
+ else if (curPunc == "[") push(state, "]", stream);
141
+ else if (curPunc == "block") push(state, "block", stream);
142
+ else if (curPunc == ctype) pop(state);
143
+ state.afterIdent = style == "variable" || style == "keyword";
144
+ return style;
145
+ },
146
+
147
+ indent: function(state, textAfter) {
148
+ if (state.tokenize != tokenBase) return 0;
149
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
150
+ closing = firstChar == ctx.type;
151
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
152
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
153
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
154
+ },
155
+
156
+ lineComment: "#"
157
+ };
158
+ });
159
+
160
+ CodeMirror.defineMIME("text/x-rsrc", "r");
161
+
162
+ });
@@ -0,0 +1,101 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("rpm-changes", function() {
15
+ var headerSeperator = /^-+$/;
16
+ var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
17
+ var simpleEmail = /^[\w+.-]+@[\w.-]+/;
18
+
19
+ return {
20
+ token: function(stream) {
21
+ if (stream.sol()) {
22
+ if (stream.match(headerSeperator)) { return 'tag'; }
23
+ if (stream.match(headerLine)) { return 'tag'; }
24
+ }
25
+ if (stream.match(simpleEmail)) { return 'string'; }
26
+ stream.next();
27
+ return null;
28
+ }
29
+ };
30
+ });
31
+
32
+ CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
33
+
34
+ // Quick and dirty spec file highlighting
35
+
36
+ CodeMirror.defineMode("rpm-spec", function() {
37
+ var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
38
+
39
+ var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
40
+ var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
41
+ var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
42
+ var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
43
+ var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
44
+
45
+ return {
46
+ startState: function () {
47
+ return {
48
+ controlFlow: false,
49
+ macroParameters: false,
50
+ section: false
51
+ };
52
+ },
53
+ token: function (stream, state) {
54
+ var ch = stream.peek();
55
+ if (ch == "#") { stream.skipToEnd(); return "comment"; }
56
+
57
+ if (stream.sol()) {
58
+ if (stream.match(preamble)) { return "preamble"; }
59
+ if (stream.match(section)) { return "section"; }
60
+ }
61
+
62
+ if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
63
+ if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
64
+
65
+ if (stream.match(control_flow_simple)) { return "keyword"; }
66
+ if (stream.match(control_flow_complex)) {
67
+ state.controlFlow = true;
68
+ return "keyword";
69
+ }
70
+ if (state.controlFlow) {
71
+ if (stream.match(operators)) { return "operator"; }
72
+ if (stream.match(/^(\d+)/)) { return "number"; }
73
+ if (stream.eol()) { state.controlFlow = false; }
74
+ }
75
+
76
+ if (stream.match(arch)) { return "number"; }
77
+
78
+ // Macros like '%make_install' or '%attr(0775,root,root)'
79
+ if (stream.match(/^%[\w]+/)) {
80
+ if (stream.match(/^\(/)) { state.macroParameters = true; }
81
+ return "macro";
82
+ }
83
+ if (state.macroParameters) {
84
+ if (stream.match(/^\d+/)) { return "number";}
85
+ if (stream.match(/^\)/)) {
86
+ state.macroParameters = false;
87
+ return "macro";
88
+ }
89
+ }
90
+ if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
91
+
92
+ //TODO: Include bash script sub-parser (CodeMirror supports that)
93
+ stream.next();
94
+ return null;
95
+ }
96
+ };
97
+ });
98
+
99
+ CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec");
100
+
101
+ });
@@ -0,0 +1,557 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode('rst', function (config, options) {
15
+
16
+ var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/;
17
+ var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/;
18
+ var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/;
19
+
20
+ var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/;
21
+ var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/;
22
+ var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/;
23
+
24
+ var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://";
25
+ var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})";
26
+ var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*";
27
+ var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path);
28
+
29
+ var overlay = {
30
+ token: function (stream) {
31
+
32
+ if (stream.match(rx_strong) && stream.match (/\W+|$/, false))
33
+ return 'strong';
34
+ if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false))
35
+ return 'em';
36
+ if (stream.match(rx_literal) && stream.match (/\W+|$/, false))
37
+ return 'string-2';
38
+ if (stream.match(rx_number))
39
+ return 'number';
40
+ if (stream.match(rx_positive))
41
+ return 'positive';
42
+ if (stream.match(rx_negative))
43
+ return 'negative';
44
+ if (stream.match(rx_uri))
45
+ return 'link';
46
+
47
+ while (stream.next() != null) {
48
+ if (stream.match(rx_strong, false)) break;
49
+ if (stream.match(rx_emphasis, false)) break;
50
+ if (stream.match(rx_literal, false)) break;
51
+ if (stream.match(rx_number, false)) break;
52
+ if (stream.match(rx_positive, false)) break;
53
+ if (stream.match(rx_negative, false)) break;
54
+ if (stream.match(rx_uri, false)) break;
55
+ }
56
+
57
+ return null;
58
+ }
59
+ };
60
+
61
+ var mode = CodeMirror.getMode(
62
+ config, options.backdrop || 'rst-base'
63
+ );
64
+
65
+ return CodeMirror.overlayMode(mode, overlay, true); // combine
66
+ }, 'python', 'stex');
67
+
68
+ ///////////////////////////////////////////////////////////////////////////////
69
+ ///////////////////////////////////////////////////////////////////////////////
70
+
71
+ CodeMirror.defineMode('rst-base', function (config) {
72
+
73
+ ///////////////////////////////////////////////////////////////////////////
74
+ ///////////////////////////////////////////////////////////////////////////
75
+
76
+ function format(string) {
77
+ var args = Array.prototype.slice.call(arguments, 1);
78
+ return string.replace(/{(\d+)}/g, function (match, n) {
79
+ return typeof args[n] != 'undefined' ? args[n] : match;
80
+ });
81
+ }
82
+
83
+ ///////////////////////////////////////////////////////////////////////////
84
+ ///////////////////////////////////////////////////////////////////////////
85
+
86
+ var mode_python = CodeMirror.getMode(config, 'python');
87
+ var mode_stex = CodeMirror.getMode(config, 'stex');
88
+
89
+ ///////////////////////////////////////////////////////////////////////////
90
+ ///////////////////////////////////////////////////////////////////////////
91
+
92
+ var SEPA = "\\s+";
93
+ var TAIL = "(?:\\s*|\\W|$)",
94
+ rx_TAIL = new RegExp(format('^{0}', TAIL));
95
+
96
+ var NAME =
97
+ "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)",
98
+ rx_NAME = new RegExp(format('^{0}', NAME));
99
+ var NAME_WWS =
100
+ "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)";
101
+ var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS);
102
+
103
+ var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)";
104
+ var TEXT2 = "(?:[^\\`]+)",
105
+ rx_TEXT2 = new RegExp(format('^{0}', TEXT2));
106
+
107
+ var rx_section = new RegExp(
108
+ "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$");
109
+ var rx_explicit = new RegExp(
110
+ format('^\\.\\.{0}', SEPA));
111
+ var rx_link = new RegExp(
112
+ format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL));
113
+ var rx_directive = new RegExp(
114
+ format('^{0}::{1}', REF_NAME, TAIL));
115
+ var rx_substitution = new RegExp(
116
+ format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL));
117
+ var rx_footnote = new RegExp(
118
+ format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL));
119
+ var rx_citation = new RegExp(
120
+ format('^\\[{0}\\]{1}', REF_NAME, TAIL));
121
+
122
+ var rx_substitution_ref = new RegExp(
123
+ format('^\\|{0}\\|', TEXT1));
124
+ var rx_footnote_ref = new RegExp(
125
+ format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME));
126
+ var rx_citation_ref = new RegExp(
127
+ format('^\\[{0}\\]_', REF_NAME));
128
+ var rx_link_ref1 = new RegExp(
129
+ format('^{0}__?', REF_NAME));
130
+ var rx_link_ref2 = new RegExp(
131
+ format('^`{0}`_', TEXT2));
132
+
133
+ var rx_role_pre = new RegExp(
134
+ format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL));
135
+ var rx_role_suf = new RegExp(
136
+ format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL));
137
+ var rx_role = new RegExp(
138
+ format('^:{0}:{1}', NAME, TAIL));
139
+
140
+ var rx_directive_name = new RegExp(format('^{0}', REF_NAME));
141
+ var rx_directive_tail = new RegExp(format('^::{0}', TAIL));
142
+ var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1));
143
+ var rx_substitution_sepa = new RegExp(format('^{0}', SEPA));
144
+ var rx_substitution_name = new RegExp(format('^{0}', REF_NAME));
145
+ var rx_substitution_tail = new RegExp(format('^::{0}', TAIL));
146
+ var rx_link_head = new RegExp("^_");
147
+ var rx_link_name = new RegExp(format('^{0}|_', REF_NAME));
148
+ var rx_link_tail = new RegExp(format('^:{0}', TAIL));
149
+
150
+ var rx_verbatim = new RegExp('^::\\s*$');
151
+ var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s');
152
+
153
+ ///////////////////////////////////////////////////////////////////////////
154
+ ///////////////////////////////////////////////////////////////////////////
155
+
156
+ function to_normal(stream, state) {
157
+ var token = null;
158
+
159
+ if (stream.sol() && stream.match(rx_examples, false)) {
160
+ change(state, to_mode, {
161
+ mode: mode_python, local: CodeMirror.startState(mode_python)
162
+ });
163
+ } else if (stream.sol() && stream.match(rx_explicit)) {
164
+ change(state, to_explicit);
165
+ token = 'meta';
166
+ } else if (stream.sol() && stream.match(rx_section)) {
167
+ change(state, to_normal);
168
+ token = 'header';
169
+ } else if (phase(state) == rx_role_pre ||
170
+ stream.match(rx_role_pre, false)) {
171
+
172
+ switch (stage(state)) {
173
+ case 0:
174
+ change(state, to_normal, context(rx_role_pre, 1));
175
+ stream.match(/^:/);
176
+ token = 'meta';
177
+ break;
178
+ case 1:
179
+ change(state, to_normal, context(rx_role_pre, 2));
180
+ stream.match(rx_NAME);
181
+ token = 'keyword';
182
+
183
+ if (stream.current().match(/^(?:math|latex)/)) {
184
+ state.tmp_stex = true;
185
+ }
186
+ break;
187
+ case 2:
188
+ change(state, to_normal, context(rx_role_pre, 3));
189
+ stream.match(/^:`/);
190
+ token = 'meta';
191
+ break;
192
+ case 3:
193
+ if (state.tmp_stex) {
194
+ state.tmp_stex = undefined; state.tmp = {
195
+ mode: mode_stex, local: CodeMirror.startState(mode_stex)
196
+ };
197
+ }
198
+
199
+ if (state.tmp) {
200
+ if (stream.peek() == '`') {
201
+ change(state, to_normal, context(rx_role_pre, 4));
202
+ state.tmp = undefined;
203
+ break;
204
+ }
205
+
206
+ token = state.tmp.mode.token(stream, state.tmp.local);
207
+ break;
208
+ }
209
+
210
+ change(state, to_normal, context(rx_role_pre, 4));
211
+ stream.match(rx_TEXT2);
212
+ token = 'string';
213
+ break;
214
+ case 4:
215
+ change(state, to_normal, context(rx_role_pre, 5));
216
+ stream.match(/^`/);
217
+ token = 'meta';
218
+ break;
219
+ case 5:
220
+ change(state, to_normal, context(rx_role_pre, 6));
221
+ stream.match(rx_TAIL);
222
+ break;
223
+ default:
224
+ change(state, to_normal);
225
+ }
226
+ } else if (phase(state) == rx_role_suf ||
227
+ stream.match(rx_role_suf, false)) {
228
+
229
+ switch (stage(state)) {
230
+ case 0:
231
+ change(state, to_normal, context(rx_role_suf, 1));
232
+ stream.match(/^`/);
233
+ token = 'meta';
234
+ break;
235
+ case 1:
236
+ change(state, to_normal, context(rx_role_suf, 2));
237
+ stream.match(rx_TEXT2);
238
+ token = 'string';
239
+ break;
240
+ case 2:
241
+ change(state, to_normal, context(rx_role_suf, 3));
242
+ stream.match(/^`:/);
243
+ token = 'meta';
244
+ break;
245
+ case 3:
246
+ change(state, to_normal, context(rx_role_suf, 4));
247
+ stream.match(rx_NAME);
248
+ token = 'keyword';
249
+ break;
250
+ case 4:
251
+ change(state, to_normal, context(rx_role_suf, 5));
252
+ stream.match(/^:/);
253
+ token = 'meta';
254
+ break;
255
+ case 5:
256
+ change(state, to_normal, context(rx_role_suf, 6));
257
+ stream.match(rx_TAIL);
258
+ break;
259
+ default:
260
+ change(state, to_normal);
261
+ }
262
+ } else if (phase(state) == rx_role || stream.match(rx_role, false)) {
263
+
264
+ switch (stage(state)) {
265
+ case 0:
266
+ change(state, to_normal, context(rx_role, 1));
267
+ stream.match(/^:/);
268
+ token = 'meta';
269
+ break;
270
+ case 1:
271
+ change(state, to_normal, context(rx_role, 2));
272
+ stream.match(rx_NAME);
273
+ token = 'keyword';
274
+ break;
275
+ case 2:
276
+ change(state, to_normal, context(rx_role, 3));
277
+ stream.match(/^:/);
278
+ token = 'meta';
279
+ break;
280
+ case 3:
281
+ change(state, to_normal, context(rx_role, 4));
282
+ stream.match(rx_TAIL);
283
+ break;
284
+ default:
285
+ change(state, to_normal);
286
+ }
287
+ } else if (phase(state) == rx_substitution_ref ||
288
+ stream.match(rx_substitution_ref, false)) {
289
+
290
+ switch (stage(state)) {
291
+ case 0:
292
+ change(state, to_normal, context(rx_substitution_ref, 1));
293
+ stream.match(rx_substitution_text);
294
+ token = 'variable-2';
295
+ break;
296
+ case 1:
297
+ change(state, to_normal, context(rx_substitution_ref, 2));
298
+ if (stream.match(/^_?_?/)) token = 'link';
299
+ break;
300
+ default:
301
+ change(state, to_normal);
302
+ }
303
+ } else if (stream.match(rx_footnote_ref)) {
304
+ change(state, to_normal);
305
+ token = 'quote';
306
+ } else if (stream.match(rx_citation_ref)) {
307
+ change(state, to_normal);
308
+ token = 'quote';
309
+ } else if (stream.match(rx_link_ref1)) {
310
+ change(state, to_normal);
311
+ if (!stream.peek() || stream.peek().match(/^\W$/)) {
312
+ token = 'link';
313
+ }
314
+ } else if (phase(state) == rx_link_ref2 ||
315
+ stream.match(rx_link_ref2, false)) {
316
+
317
+ switch (stage(state)) {
318
+ case 0:
319
+ if (!stream.peek() || stream.peek().match(/^\W$/)) {
320
+ change(state, to_normal, context(rx_link_ref2, 1));
321
+ } else {
322
+ stream.match(rx_link_ref2);
323
+ }
324
+ break;
325
+ case 1:
326
+ change(state, to_normal, context(rx_link_ref2, 2));
327
+ stream.match(/^`/);
328
+ token = 'link';
329
+ break;
330
+ case 2:
331
+ change(state, to_normal, context(rx_link_ref2, 3));
332
+ stream.match(rx_TEXT2);
333
+ break;
334
+ case 3:
335
+ change(state, to_normal, context(rx_link_ref2, 4));
336
+ stream.match(/^`_/);
337
+ token = 'link';
338
+ break;
339
+ default:
340
+ change(state, to_normal);
341
+ }
342
+ } else if (stream.match(rx_verbatim)) {
343
+ change(state, to_verbatim);
344
+ }
345
+
346
+ else {
347
+ if (stream.next()) change(state, to_normal);
348
+ }
349
+
350
+ return token;
351
+ }
352
+
353
+ ///////////////////////////////////////////////////////////////////////////
354
+ ///////////////////////////////////////////////////////////////////////////
355
+
356
+ function to_explicit(stream, state) {
357
+ var token = null;
358
+
359
+ if (phase(state) == rx_substitution ||
360
+ stream.match(rx_substitution, false)) {
361
+
362
+ switch (stage(state)) {
363
+ case 0:
364
+ change(state, to_explicit, context(rx_substitution, 1));
365
+ stream.match(rx_substitution_text);
366
+ token = 'variable-2';
367
+ break;
368
+ case 1:
369
+ change(state, to_explicit, context(rx_substitution, 2));
370
+ stream.match(rx_substitution_sepa);
371
+ break;
372
+ case 2:
373
+ change(state, to_explicit, context(rx_substitution, 3));
374
+ stream.match(rx_substitution_name);
375
+ token = 'keyword';
376
+ break;
377
+ case 3:
378
+ change(state, to_explicit, context(rx_substitution, 4));
379
+ stream.match(rx_substitution_tail);
380
+ token = 'meta';
381
+ break;
382
+ default:
383
+ change(state, to_normal);
384
+ }
385
+ } else if (phase(state) == rx_directive ||
386
+ stream.match(rx_directive, false)) {
387
+
388
+ switch (stage(state)) {
389
+ case 0:
390
+ change(state, to_explicit, context(rx_directive, 1));
391
+ stream.match(rx_directive_name);
392
+ token = 'keyword';
393
+
394
+ if (stream.current().match(/^(?:math|latex)/))
395
+ state.tmp_stex = true;
396
+ else if (stream.current().match(/^python/))
397
+ state.tmp_py = true;
398
+ break;
399
+ case 1:
400
+ change(state, to_explicit, context(rx_directive, 2));
401
+ stream.match(rx_directive_tail);
402
+ token = 'meta';
403
+
404
+ if (stream.match(/^latex\s*$/) || state.tmp_stex) {
405
+ state.tmp_stex = undefined; change(state, to_mode, {
406
+ mode: mode_stex, local: CodeMirror.startState(mode_stex)
407
+ });
408
+ }
409
+ break;
410
+ case 2:
411
+ change(state, to_explicit, context(rx_directive, 3));
412
+ if (stream.match(/^python\s*$/) || state.tmp_py) {
413
+ state.tmp_py = undefined; change(state, to_mode, {
414
+ mode: mode_python, local: CodeMirror.startState(mode_python)
415
+ });
416
+ }
417
+ break;
418
+ default:
419
+ change(state, to_normal);
420
+ }
421
+ } else if (phase(state) == rx_link || stream.match(rx_link, false)) {
422
+
423
+ switch (stage(state)) {
424
+ case 0:
425
+ change(state, to_explicit, context(rx_link, 1));
426
+ stream.match(rx_link_head);
427
+ stream.match(rx_link_name);
428
+ token = 'link';
429
+ break;
430
+ case 1:
431
+ change(state, to_explicit, context(rx_link, 2));
432
+ stream.match(rx_link_tail);
433
+ token = 'meta';
434
+ break;
435
+ default:
436
+ change(state, to_normal);
437
+ }
438
+ } else if (stream.match(rx_footnote)) {
439
+ change(state, to_normal);
440
+ token = 'quote';
441
+ } else if (stream.match(rx_citation)) {
442
+ change(state, to_normal);
443
+ token = 'quote';
444
+ }
445
+
446
+ else {
447
+ stream.eatSpace();
448
+ if (stream.eol()) {
449
+ change(state, to_normal);
450
+ } else {
451
+ stream.skipToEnd();
452
+ change(state, to_comment);
453
+ token = 'comment';
454
+ }
455
+ }
456
+
457
+ return token;
458
+ }
459
+
460
+ ///////////////////////////////////////////////////////////////////////////
461
+ ///////////////////////////////////////////////////////////////////////////
462
+
463
+ function to_comment(stream, state) {
464
+ return as_block(stream, state, 'comment');
465
+ }
466
+
467
+ function to_verbatim(stream, state) {
468
+ return as_block(stream, state, 'meta');
469
+ }
470
+
471
+ function as_block(stream, state, token) {
472
+ if (stream.eol() || stream.eatSpace()) {
473
+ stream.skipToEnd();
474
+ return token;
475
+ } else {
476
+ change(state, to_normal);
477
+ return null;
478
+ }
479
+ }
480
+
481
+ ///////////////////////////////////////////////////////////////////////////
482
+ ///////////////////////////////////////////////////////////////////////////
483
+
484
+ function to_mode(stream, state) {
485
+
486
+ if (state.ctx.mode && state.ctx.local) {
487
+
488
+ if (stream.sol()) {
489
+ if (!stream.eatSpace()) change(state, to_normal);
490
+ return null;
491
+ }
492
+
493
+ return state.ctx.mode.token(stream, state.ctx.local);
494
+ }
495
+
496
+ change(state, to_normal);
497
+ return null;
498
+ }
499
+
500
+ ///////////////////////////////////////////////////////////////////////////
501
+ ///////////////////////////////////////////////////////////////////////////
502
+
503
+ function context(phase, stage, mode, local) {
504
+ return {phase: phase, stage: stage, mode: mode, local: local};
505
+ }
506
+
507
+ function change(state, tok, ctx) {
508
+ state.tok = tok;
509
+ state.ctx = ctx || {};
510
+ }
511
+
512
+ function stage(state) {
513
+ return state.ctx.stage || 0;
514
+ }
515
+
516
+ function phase(state) {
517
+ return state.ctx.phase;
518
+ }
519
+
520
+ ///////////////////////////////////////////////////////////////////////////
521
+ ///////////////////////////////////////////////////////////////////////////
522
+
523
+ return {
524
+ startState: function () {
525
+ return {tok: to_normal, ctx: context(undefined, 0)};
526
+ },
527
+
528
+ copyState: function (state) {
529
+ var ctx = state.ctx, tmp = state.tmp;
530
+ if (ctx.local)
531
+ ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)};
532
+ if (tmp)
533
+ tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)};
534
+ return {tok: state.tok, ctx: ctx, tmp: tmp};
535
+ },
536
+
537
+ innerMode: function (state) {
538
+ return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode}
539
+ : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode}
540
+ : null;
541
+ },
542
+
543
+ token: function (stream, state) {
544
+ return state.tok(stream, state);
545
+ }
546
+ };
547
+ }, 'python', 'stex');
548
+
549
+ ///////////////////////////////////////////////////////////////////////////////
550
+ ///////////////////////////////////////////////////////////////////////////////
551
+
552
+ CodeMirror.defineMIME('text/x-rst', 'rst');
553
+
554
+ ///////////////////////////////////////////////////////////////////////////////
555
+ ///////////////////////////////////////////////////////////////////////////////
556
+
557
+ });