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,243 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ /**
5
+ * Author: Hans Engel
6
+ * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
7
+ */
8
+
9
+ (function(mod) {
10
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
11
+ mod(require("../../lib/codemirror"));
12
+ else if (typeof define == "function" && define.amd) // AMD
13
+ define(["../../lib/codemirror"], mod);
14
+ else // Plain browser env
15
+ mod(CodeMirror);
16
+ })(function(CodeMirror) {
17
+ "use strict";
18
+
19
+ CodeMirror.defineMode("clojure", function (options) {
20
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHARACTER = "string-2",
21
+ ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", VAR = "variable";
22
+ var INDENT_WORD_SKIP = options.indentUnit || 2;
23
+ var NORMAL_INDENT_UNIT = options.indentUnit || 2;
24
+
25
+ function makeKeywords(str) {
26
+ var obj = {}, words = str.split(" ");
27
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
28
+ return obj;
29
+ }
30
+
31
+ var atoms = makeKeywords("true false nil");
32
+
33
+ var keywords = makeKeywords(
34
+ "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle");
35
+
36
+ var builtins = makeKeywords(
37
+ "* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>");
38
+
39
+ var indentKeys = makeKeywords(
40
+ // Built-ins
41
+ "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch " +
42
+
43
+ // Binding forms
44
+ "let letfn binding loop for doseq dotimes when-let if-let " +
45
+
46
+ // Data structures
47
+ "defstruct struct-map assoc " +
48
+
49
+ // clojure.test
50
+ "testing deftest " +
51
+
52
+ // contrib
53
+ "handler-case handle dotrace deftrace");
54
+
55
+ var tests = {
56
+ digit: /\d/,
57
+ digit_or_colon: /[\d:]/,
58
+ hex: /[0-9a-f]/i,
59
+ sign: /[+-]/,
60
+ exponent: /e/i,
61
+ keyword_char: /[^\s\(\[\;\)\]]/,
62
+ symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/
63
+ };
64
+
65
+ function stateStack(indent, type, prev) { // represents a state stack object
66
+ this.indent = indent;
67
+ this.type = type;
68
+ this.prev = prev;
69
+ }
70
+
71
+ function pushStack(state, indent, type) {
72
+ state.indentStack = new stateStack(indent, type, state.indentStack);
73
+ }
74
+
75
+ function popStack(state) {
76
+ state.indentStack = state.indentStack.prev;
77
+ }
78
+
79
+ function isNumber(ch, stream){
80
+ // hex
81
+ if ( ch === '0' && stream.eat(/x/i) ) {
82
+ stream.eatWhile(tests.hex);
83
+ return true;
84
+ }
85
+
86
+ // leading sign
87
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
88
+ stream.eat(tests.sign);
89
+ ch = stream.next();
90
+ }
91
+
92
+ if ( tests.digit.test(ch) ) {
93
+ stream.eat(ch);
94
+ stream.eatWhile(tests.digit);
95
+
96
+ if ( '.' == stream.peek() ) {
97
+ stream.eat('.');
98
+ stream.eatWhile(tests.digit);
99
+ }
100
+
101
+ if ( stream.eat(tests.exponent) ) {
102
+ stream.eat(tests.sign);
103
+ stream.eatWhile(tests.digit);
104
+ }
105
+
106
+ return true;
107
+ }
108
+
109
+ return false;
110
+ }
111
+
112
+ // Eat character that starts after backslash \
113
+ function eatCharacter(stream) {
114
+ var first = stream.next();
115
+ // Read special literals: backspace, newline, space, return.
116
+ // Just read all lowercase letters.
117
+ if (first && first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) {
118
+ return;
119
+ }
120
+ // Read unicode character: \u1000 \uA0a1
121
+ if (first === "u") {
122
+ stream.match(/[0-9a-z]{4}/i, true);
123
+ }
124
+ }
125
+
126
+ return {
127
+ startState: function () {
128
+ return {
129
+ indentStack: null,
130
+ indentation: 0,
131
+ mode: false
132
+ };
133
+ },
134
+
135
+ token: function (stream, state) {
136
+ if (state.indentStack == null && stream.sol()) {
137
+ // update indentation, but only if indentStack is empty
138
+ state.indentation = stream.indentation();
139
+ }
140
+
141
+ // skip spaces
142
+ if (stream.eatSpace()) {
143
+ return null;
144
+ }
145
+ var returnType = null;
146
+
147
+ switch(state.mode){
148
+ case "string": // multi-line string parsing mode
149
+ var next, escaped = false;
150
+ while ((next = stream.next()) != null) {
151
+ if (next == "\"" && !escaped) {
152
+
153
+ state.mode = false;
154
+ break;
155
+ }
156
+ escaped = !escaped && next == "\\";
157
+ }
158
+ returnType = STRING; // continue on in string mode
159
+ break;
160
+ default: // default parsing mode
161
+ var ch = stream.next();
162
+
163
+ if (ch == "\"") {
164
+ state.mode = "string";
165
+ returnType = STRING;
166
+ } else if (ch == "\\") {
167
+ eatCharacter(stream);
168
+ returnType = CHARACTER;
169
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
170
+ returnType = ATOM;
171
+ } else if (ch == ";") { // comment
172
+ stream.skipToEnd(); // rest of the line is a comment
173
+ returnType = COMMENT;
174
+ } else if (isNumber(ch,stream)){
175
+ returnType = NUMBER;
176
+ } else if (ch == "(" || ch == "[" || ch == "{" ) {
177
+ var keyWord = '', indentTemp = stream.column(), letter;
178
+ /**
179
+ Either
180
+ (indent-word ..
181
+ (non-indent-word ..
182
+ (;something else, bracket, etc.
183
+ */
184
+
185
+ if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != null) {
186
+ keyWord += letter;
187
+ }
188
+
189
+ if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) ||
190
+ /^(?:def|with)/.test(keyWord))) { // indent-word
191
+ pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
192
+ } else { // non-indent word
193
+ // we continue eating the spaces
194
+ stream.eatSpace();
195
+ if (stream.eol() || stream.peek() == ";") {
196
+ // nothing significant after
197
+ // we restart indentation the user defined spaces after
198
+ pushStack(state, indentTemp + NORMAL_INDENT_UNIT, ch);
199
+ } else {
200
+ pushStack(state, indentTemp + stream.current().length, ch); // else we match
201
+ }
202
+ }
203
+ stream.backUp(stream.current().length - 1); // undo all the eating
204
+
205
+ returnType = BRACKET;
206
+ } else if (ch == ")" || ch == "]" || ch == "}") {
207
+ returnType = BRACKET;
208
+ if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : (ch == "]" ? "[" :"{"))) {
209
+ popStack(state);
210
+ }
211
+ } else if ( ch == ":" ) {
212
+ stream.eatWhile(tests.symbol);
213
+ return ATOM;
214
+ } else {
215
+ stream.eatWhile(tests.symbol);
216
+
217
+ if (keywords && keywords.propertyIsEnumerable(stream.current())) {
218
+ returnType = KEYWORD;
219
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current())) {
220
+ returnType = BUILTIN;
221
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current())) {
222
+ returnType = ATOM;
223
+ } else {
224
+ returnType = VAR;
225
+ }
226
+ }
227
+ }
228
+
229
+ return returnType;
230
+ },
231
+
232
+ indent: function (state) {
233
+ if (state.indentStack == null) return state.indentation;
234
+ return state.indentStack.indent;
235
+ },
236
+
237
+ lineComment: ";;"
238
+ };
239
+ });
240
+
241
+ CodeMirror.defineMIME("text/x-clojure", "clojure");
242
+
243
+ });
@@ -0,0 +1,255 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ /**
5
+ * Author: Gautam Mehta
6
+ * Branched from CodeMirror's Scheme mode
7
+ */
8
+ (function(mod) {
9
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
10
+ mod(require("../../lib/codemirror"));
11
+ else if (typeof define == "function" && define.amd) // AMD
12
+ define(["../../lib/codemirror"], mod);
13
+ else // Plain browser env
14
+ mod(CodeMirror);
15
+ })(function(CodeMirror) {
16
+ "use strict";
17
+
18
+ CodeMirror.defineMode("cobol", function () {
19
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
20
+ ATOM = "atom", NUMBER = "number", KEYWORD = "keyword", MODTAG = "header",
21
+ COBOLLINENUM = "def", PERIOD = "link";
22
+ function makeKeywords(str) {
23
+ var obj = {}, words = str.split(" ");
24
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
25
+ return obj;
26
+ }
27
+ var atoms = makeKeywords("TRUE FALSE ZEROES ZEROS ZERO SPACES SPACE LOW-VALUE LOW-VALUES ");
28
+ var keywords = makeKeywords(
29
+ "ACCEPT ACCESS ACQUIRE ADD ADDRESS " +
30
+ "ADVANCING AFTER ALIAS ALL ALPHABET " +
31
+ "ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED " +
32
+ "ALSO ALTER ALTERNATE AND ANY " +
33
+ "ARE AREA AREAS ARITHMETIC ASCENDING " +
34
+ "ASSIGN AT ATTRIBUTE AUTHOR AUTO " +
35
+ "AUTO-SKIP AUTOMATIC B-AND B-EXOR B-LESS " +
36
+ "B-NOT B-OR BACKGROUND-COLOR BACKGROUND-COLOUR BEEP " +
37
+ "BEFORE BELL BINARY BIT BITS " +
38
+ "BLANK BLINK BLOCK BOOLEAN BOTTOM " +
39
+ "BY CALL CANCEL CD CF " +
40
+ "CH CHARACTER CHARACTERS CLASS CLOCK-UNITS " +
41
+ "CLOSE COBOL CODE CODE-SET COL " +
42
+ "COLLATING COLUMN COMMA COMMIT COMMITMENT " +
43
+ "COMMON COMMUNICATION COMP COMP-0 COMP-1 " +
44
+ "COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 " +
45
+ "COMP-7 COMP-8 COMP-9 COMPUTATIONAL COMPUTATIONAL-0 " +
46
+ "COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 " +
47
+ "COMPUTATIONAL-6 COMPUTATIONAL-7 COMPUTATIONAL-8 COMPUTATIONAL-9 COMPUTE " +
48
+ "CONFIGURATION CONNECT CONSOLE CONTAINED CONTAINS " +
49
+ "CONTENT CONTINUE CONTROL CONTROL-AREA CONTROLS " +
50
+ "CONVERTING COPY CORR CORRESPONDING COUNT " +
51
+ "CRT CRT-UNDER CURRENCY CURRENT CURSOR " +
52
+ "DATA DATE DATE-COMPILED DATE-WRITTEN DAY " +
53
+ "DAY-OF-WEEK DB DB-ACCESS-CONTROL-KEY DB-DATA-NAME DB-EXCEPTION " +
54
+ "DB-FORMAT-NAME DB-RECORD-NAME DB-SET-NAME DB-STATUS DBCS " +
55
+ "DBCS-EDITED DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE " +
56
+ "DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING " +
57
+ "DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED " +
58
+ "DELIMITER DEPENDING DESCENDING DESCRIBED DESTINATION " +
59
+ "DETAIL DISABLE DISCONNECT DISPLAY DISPLAY-1 " +
60
+ "DISPLAY-2 DISPLAY-3 DISPLAY-4 DISPLAY-5 DISPLAY-6 " +
61
+ "DISPLAY-7 DISPLAY-8 DISPLAY-9 DIVIDE DIVISION " +
62
+ "DOWN DROP DUPLICATE DUPLICATES DYNAMIC " +
63
+ "EBCDIC EGI EJECT ELSE EMI " +
64
+ "EMPTY EMPTY-CHECK ENABLE END END. END-ACCEPT END-ACCEPT. " +
65
+ "END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY " +
66
+ "END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY " +
67
+ "END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN " +
68
+ "END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT " +
69
+ "END-UNSTRING END-WRITE END-XML ENTER ENTRY " +
70
+ "ENVIRONMENT EOP EQUAL EQUALS ERASE " +
71
+ "ERROR ESI EVALUATE EVERY EXCEEDS " +
72
+ "EXCEPTION EXCLUSIVE EXIT EXTEND EXTERNAL " +
73
+ "EXTERNALLY-DESCRIBED-KEY FD FETCH FILE FILE-CONTROL " +
74
+ "FILE-STREAM FILES FILLER FINAL FIND " +
75
+ "FINISH FIRST FOOTING FOR FOREGROUND-COLOR " +
76
+ "FOREGROUND-COLOUR FORMAT FREE FROM FULL " +
77
+ "FUNCTION GENERATE GET GIVING GLOBAL " +
78
+ "GO GOBACK GREATER GROUP HEADING " +
79
+ "HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL " +
80
+ "ID IDENTIFICATION IF IN INDEX " +
81
+ "INDEX-1 INDEX-2 INDEX-3 INDEX-4 INDEX-5 " +
82
+ "INDEX-6 INDEX-7 INDEX-8 INDEX-9 INDEXED " +
83
+ "INDIC INDICATE INDICATOR INDICATORS INITIAL " +
84
+ "INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT " +
85
+ "INSTALLATION INTO INVALID INVOKE IS " +
86
+ "JUST JUSTIFIED KANJI KEEP KEY " +
87
+ "LABEL LAST LD LEADING LEFT " +
88
+ "LEFT-JUSTIFY LENGTH LENGTH-CHECK LESS LIBRARY " +
89
+ "LIKE LIMIT LIMITS LINAGE LINAGE-COUNTER " +
90
+ "LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE " +
91
+ "LOCALE LOCALLY LOCK " +
92
+ "MEMBER MEMORY MERGE MESSAGE METACLASS " +
93
+ "MODE MODIFIED MODIFY MODULES MOVE " +
94
+ "MULTIPLE MULTIPLY NATIONAL NATIVE NEGATIVE " +
95
+ "NEXT NO NO-ECHO NONE NOT " +
96
+ "NULL NULL-KEY-MAP NULL-MAP NULLS NUMBER " +
97
+ "NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OCCURS " +
98
+ "OF OFF OMITTED ON ONLY " +
99
+ "OPEN OPTIONAL OR ORDER ORGANIZATION " +
100
+ "OTHER OUTPUT OVERFLOW OWNER PACKED-DECIMAL " +
101
+ "PADDING PAGE PAGE-COUNTER PARSE PERFORM " +
102
+ "PF PH PIC PICTURE PLUS " +
103
+ "POINTER POSITION POSITIVE PREFIX PRESENT " +
104
+ "PRINTING PRIOR PROCEDURE PROCEDURE-POINTER PROCEDURES " +
105
+ "PROCEED PROCESS PROCESSING PROGRAM PROGRAM-ID " +
106
+ "PROMPT PROTECTED PURGE QUEUE QUOTE " +
107
+ "QUOTES RANDOM RD READ READY " +
108
+ "REALM RECEIVE RECONNECT RECORD RECORD-NAME " +
109
+ "RECORDS RECURSIVE REDEFINES REEL REFERENCE " +
110
+ "REFERENCE-MONITOR REFERENCES RELATION RELATIVE RELEASE " +
111
+ "REMAINDER REMOVAL RENAMES REPEATED REPLACE " +
112
+ "REPLACING REPORT REPORTING REPORTS REPOSITORY " +
113
+ "REQUIRED RERUN RESERVE RESET RETAINING " +
114
+ "RETRIEVAL RETURN RETURN-CODE RETURNING REVERSE-VIDEO " +
115
+ "REVERSED REWIND REWRITE RF RH " +
116
+ "RIGHT RIGHT-JUSTIFY ROLLBACK ROLLING ROUNDED " +
117
+ "RUN SAME SCREEN SD SEARCH " +
118
+ "SECTION SECURE SECURITY SEGMENT SEGMENT-LIMIT " +
119
+ "SELECT SEND SENTENCE SEPARATE SEQUENCE " +
120
+ "SEQUENTIAL SET SHARED SIGN SIZE " +
121
+ "SKIP1 SKIP2 SKIP3 SORT SORT-MERGE " +
122
+ "SORT-RETURN SOURCE SOURCE-COMPUTER SPACE-FILL " +
123
+ "SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 " +
124
+ "START STARTING STATUS STOP STORE " +
125
+ "STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA " +
126
+ "SUBFILE SUBSTITUTE SUBTRACT SUM SUPPRESS " +
127
+ "SYMBOLIC SYNC SYNCHRONIZED SYSIN SYSOUT " +
128
+ "TABLE TALLYING TAPE TENANT TERMINAL " +
129
+ "TERMINATE TEST TEXT THAN THEN " +
130
+ "THROUGH THRU TIME TIMES TITLE " +
131
+ "TO TOP TRAILING TRAILING-SIGN TRANSACTION " +
132
+ "TYPE TYPEDEF UNDERLINE UNEQUAL UNIT " +
133
+ "UNSTRING UNTIL UP UPDATE UPON " +
134
+ "USAGE USAGE-MODE USE USING VALID " +
135
+ "VALIDATE VALUE VALUES VARYING VLR " +
136
+ "WAIT WHEN WHEN-COMPILED WITH WITHIN " +
137
+ "WORDS WORKING-STORAGE WRITE XML XML-CODE " +
138
+ "XML-EVENT XML-NTEXT XML-TEXT ZERO ZERO-FILL " );
139
+
140
+ var builtins = makeKeywords("- * ** / + < <= = > >= ");
141
+ var tests = {
142
+ digit: /\d/,
143
+ digit_or_colon: /[\d:]/,
144
+ hex: /[0-9a-f]/i,
145
+ sign: /[+-]/,
146
+ exponent: /e/i,
147
+ keyword_char: /[^\s\(\[\;\)\]]/,
148
+ symbol: /[\w*+\-]/
149
+ };
150
+ function isNumber(ch, stream){
151
+ // hex
152
+ if ( ch === '0' && stream.eat(/x/i) ) {
153
+ stream.eatWhile(tests.hex);
154
+ return true;
155
+ }
156
+ // leading sign
157
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
158
+ stream.eat(tests.sign);
159
+ ch = stream.next();
160
+ }
161
+ if ( tests.digit.test(ch) ) {
162
+ stream.eat(ch);
163
+ stream.eatWhile(tests.digit);
164
+ if ( '.' == stream.peek()) {
165
+ stream.eat('.');
166
+ stream.eatWhile(tests.digit);
167
+ }
168
+ if ( stream.eat(tests.exponent) ) {
169
+ stream.eat(tests.sign);
170
+ stream.eatWhile(tests.digit);
171
+ }
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+ return {
177
+ startState: function () {
178
+ return {
179
+ indentStack: null,
180
+ indentation: 0,
181
+ mode: false
182
+ };
183
+ },
184
+ token: function (stream, state) {
185
+ if (state.indentStack == null && stream.sol()) {
186
+ // update indentation, but only if indentStack is empty
187
+ state.indentation = 6 ; //stream.indentation();
188
+ }
189
+ // skip spaces
190
+ if (stream.eatSpace()) {
191
+ return null;
192
+ }
193
+ var returnType = null;
194
+ switch(state.mode){
195
+ case "string": // multi-line string parsing mode
196
+ var next = false;
197
+ while ((next = stream.next()) != null) {
198
+ if (next == "\"" || next == "\'") {
199
+ state.mode = false;
200
+ break;
201
+ }
202
+ }
203
+ returnType = STRING; // continue on in string mode
204
+ break;
205
+ default: // default parsing mode
206
+ var ch = stream.next();
207
+ var col = stream.column();
208
+ if (col >= 0 && col <= 5) {
209
+ returnType = COBOLLINENUM;
210
+ } else if (col >= 72 && col <= 79) {
211
+ stream.skipToEnd();
212
+ returnType = MODTAG;
213
+ } else if (ch == "*" && col == 6) { // comment
214
+ stream.skipToEnd(); // rest of the line is a comment
215
+ returnType = COMMENT;
216
+ } else if (ch == "\"" || ch == "\'") {
217
+ state.mode = "string";
218
+ returnType = STRING;
219
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
220
+ returnType = ATOM;
221
+ } else if (ch == ".") {
222
+ returnType = PERIOD;
223
+ } else if (isNumber(ch,stream)){
224
+ returnType = NUMBER;
225
+ } else {
226
+ if (stream.current().match(tests.symbol)) {
227
+ while (col < 71) {
228
+ if (stream.eat(tests.symbol) === undefined) {
229
+ break;
230
+ } else {
231
+ col++;
232
+ }
233
+ }
234
+ }
235
+ if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
236
+ returnType = KEYWORD;
237
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) {
238
+ returnType = BUILTIN;
239
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current().toUpperCase())) {
240
+ returnType = ATOM;
241
+ } else returnType = null;
242
+ }
243
+ }
244
+ return returnType;
245
+ },
246
+ indent: function (state) {
247
+ if (state.indentStack == null) return state.indentation;
248
+ return state.indentStack.indent;
249
+ }
250
+ };
251
+ });
252
+
253
+ CodeMirror.defineMIME("text/x-cobol", "cobol");
254
+
255
+ });