marty 2.4.7 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile.dummy +8 -5
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -0
  5. data/app/assets/javascripts/marty/application.js +1 -0
  6. data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
  7. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
  8. data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
  9. data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
  10. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
  11. data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
  12. data/app/assets/stylesheets/marty/application.css +1 -13
  13. data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
  14. data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
  15. data/app/components/marty/auth_app/client/auth_app.js +82 -80
  16. data/app/components/marty/data_grid_view.rb +1 -54
  17. data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
  18. data/app/components/marty/form.rb +1 -5
  19. data/app/components/marty/form/client/form.js +5 -0
  20. data/app/components/marty/grid.rb +1 -146
  21. data/app/components/marty/grid/client/grid.js +146 -0
  22. data/app/components/marty/import_view.rb +1 -32
  23. data/app/components/marty/import_view/client/import_view.js +32 -0
  24. data/app/components/marty/live_search_grid_panel.rb +1 -21
  25. data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
  26. data/app/components/marty/main_auth_app.rb +4 -145
  27. data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
  28. data/app/components/marty/mcfly_grid_panel.rb +1 -17
  29. data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
  30. data/app/components/marty/new_posting_form.rb +1 -6
  31. data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
  32. data/app/components/marty/panel.rb +1 -5
  33. data/app/components/marty/panel/client/panel.js +5 -0
  34. data/app/components/marty/posting_grid.rb +4 -55
  35. data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
  36. data/app/components/marty/promise_view.rb +2 -75
  37. data/app/components/marty/promise_view/client/promise_view.css +12 -9
  38. data/app/components/marty/promise_view/client/promise_view.js +57 -0
  39. data/app/components/marty/report_form.rb +3 -69
  40. data/app/components/marty/report_form/client/report_form.js +78 -0
  41. data/app/components/marty/report_select.rb +1 -45
  42. data/app/components/marty/report_select/client/report_select.js +50 -0
  43. data/app/components/marty/reporting.rb +1 -8
  44. data/app/components/marty/reporting/client/reporting.js +8 -0
  45. data/app/components/marty/script_form.rb +2 -63
  46. data/app/components/marty/script_form/client/script_form.js +44 -0
  47. data/app/components/marty/script_tester.rb +1 -7
  48. data/app/components/marty/script_tester/client/script_tester.js +7 -0
  49. data/app/components/marty/scripting.rb +1 -55
  50. data/app/components/marty/scripting/client/scripting.js +62 -0
  51. data/app/components/marty/simple_app/client/simple_app.js +21 -13
  52. data/app/models/marty/promise.rb +22 -1
  53. data/app/views/layouts/marty/application.html.erb +8 -6
  54. data/docker-compose.dummy.yml +2 -0
  55. data/lib/marty/monkey.rb +0 -16
  56. data/lib/marty/version.rb +1 -1
  57. data/spec/dummy/config/initializers/assets.rb +1 -0
  58. data/spec/features/reporting_spec.rb +1 -0
  59. data/spec/features/scripting_spec.rb +4 -4
  60. data/spec/spec_helper.rb +1 -0
  61. data/spec/support/chromedriver.rb +5 -1
  62. data/spec/support/shared_connection_db_helpers.rb +42 -2
  63. metadata +29 -168
  64. data/app/assets/images/marty/.gitkeep +0 -0
  65. data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
  66. data/app/components/marty/script_form/client/codemirror.css +0 -172
  67. data/app/components/marty/script_form/client/codemirror.js +0 -3130
  68. data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
  69. data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
  70. data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
  71. data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
  72. data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
  73. data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
  74. data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
  75. data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
  76. data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
  77. data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
  78. data/app/components/marty/script_form/client/mode/css/css.js +0 -448
  79. data/app/components/marty/script_form/client/mode/css/index.html +0 -58
  80. data/app/components/marty/script_form/client/mode/css/test.js +0 -501
  81. data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
  82. data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
  83. data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
  84. data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
  85. data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
  86. data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
  87. data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
  88. data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
  89. data/app/components/marty/script_form/client/mode/go/go.js +0 -170
  90. data/app/components/marty/script_form/client/mode/go/index.html +0 -73
  91. data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
  92. data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
  93. data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
  94. data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
  95. data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
  96. data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
  97. data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
  98. data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
  99. data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
  100. data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
  101. data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
  102. data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
  103. data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
  104. data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
  105. data/app/components/marty/script_form/client/mode/less/index.html +0 -740
  106. data/app/components/marty/script_form/client/mode/less/less.js +0 -266
  107. data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
  108. data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
  109. data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
  110. data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
  111. data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
  112. data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
  113. data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
  114. data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
  115. data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
  116. data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
  117. data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
  118. data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
  119. data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
  120. data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
  121. data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
  122. data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
  123. data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
  124. data/app/components/marty/script_form/client/mode/php/index.html +0 -49
  125. data/app/components/marty/script_form/client/mode/php/php.js +0 -148
  126. data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
  127. data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
  128. data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
  129. data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
  130. data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
  131. data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
  132. data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
  133. data/app/components/marty/script_form/client/mode/python/index.html +0 -123
  134. data/app/components/marty/script_form/client/mode/python/python.js +0 -338
  135. data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
  136. data/app/components/marty/script_form/client/mode/r/index.html +0 -74
  137. data/app/components/marty/script_form/client/mode/r/r.js +0 -141
  138. data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
  139. data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
  140. data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
  141. data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
  142. data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
  143. data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
  144. data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
  145. data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
  146. data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
  147. data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
  148. data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
  149. data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
  150. data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
  151. data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
  152. data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
  153. data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
  154. data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
  155. data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
  156. data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
  157. data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
  158. data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
  159. data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
  160. data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
  161. data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
  162. data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
  163. data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
  164. data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
  165. data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
  166. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
  167. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
  168. data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
  169. data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
  170. data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
  171. data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
  172. data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
  173. data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
  174. data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
  175. data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
  176. data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
  177. data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
  178. data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
  179. data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
  180. data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
  181. data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
  182. data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
  183. data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
  184. data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
  185. data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
  186. data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
  187. data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
  188. data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
  189. data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
  190. data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
  191. data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
  192. data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
  193. data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
  194. data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
  195. data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
  196. data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
  197. data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
  198. data/app/components/marty/script_form/client/theme/elegant.css +0 -10
  199. data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
  200. data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
  201. data/app/components/marty/script_form/client/theme/monokai.css +0 -28
  202. data/app/components/marty/script_form/client/theme/neat.css +0 -9
  203. data/app/components/marty/script_form/client/theme/night.css +0 -21
  204. data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
  205. data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
  206. data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
  207. data/app/components/marty/script_form/client/util/closetag.js +0 -164
  208. data/app/components/marty/script_form/client/util/dialog.css +0 -27
  209. data/app/components/marty/script_form/client/util/dialog.js +0 -70
  210. data/app/components/marty/script_form/client/util/foldcode.js +0 -196
  211. data/app/components/marty/script_form/client/util/formatting.js +0 -193
  212. data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
  213. data/app/components/marty/script_form/client/util/loadmode.js +0 -51
  214. data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
  215. data/app/components/marty/script_form/client/util/multiplex.js +0 -77
  216. data/app/components/marty/script_form/client/util/overlay.js +0 -54
  217. data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
  218. data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
  219. data/app/components/marty/script_form/client/util/runmode.js +0 -53
  220. data/app/components/marty/script_form/client/util/search.js +0 -118
  221. data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
  222. data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
  223. data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
  224. data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
  225. data/lib/marty/javascript/grid_view_in_form.js +0 -81
@@ -1,210 +0,0 @@
1
- CodeMirror.defineMode("groovy", function(config, parserConfig) {
2
- function words(str) {
3
- var obj = {}, words = str.split(" ");
4
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
5
- return obj;
6
- }
7
- var keywords = words(
8
- "abstract as assert boolean break byte case catch char class const continue def default " +
9
- "do double else enum extends final finally float for goto if implements import in " +
10
- "instanceof int interface long native new package private protected public return " +
11
- "short static strictfp super switch synchronized threadsafe throw throws transient " +
12
- "try void volatile while");
13
- var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
14
- var atoms = words("null true false this");
15
-
16
- var curPunc;
17
- function tokenBase(stream, state) {
18
- var ch = stream.next();
19
- if (ch == '"' || ch == "'") {
20
- return startString(ch, stream, state);
21
- }
22
- if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
23
- curPunc = ch;
24
- return null;
25
- }
26
- if (/\d/.test(ch)) {
27
- stream.eatWhile(/[\w\.]/);
28
- if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
29
- return "number";
30
- }
31
- if (ch == "/") {
32
- if (stream.eat("*")) {
33
- state.tokenize.push(tokenComment);
34
- return tokenComment(stream, state);
35
- }
36
- if (stream.eat("/")) {
37
- stream.skipToEnd();
38
- return "comment";
39
- }
40
- if (expectExpression(state.lastToken)) {
41
- return startString(ch, stream, state);
42
- }
43
- }
44
- if (ch == "-" && stream.eat(">")) {
45
- curPunc = "->";
46
- return null;
47
- }
48
- if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
49
- stream.eatWhile(/[+\-*&%=<>|~]/);
50
- return "operator";
51
- }
52
- stream.eatWhile(/[\w\$_]/);
53
- if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
54
- if (state.lastToken == ".") return "property";
55
- if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
56
- var cur = stream.current();
57
- if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
58
- if (keywords.propertyIsEnumerable(cur)) {
59
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
60
- return "keyword";
61
- }
62
- return "variable";
63
- }
64
- tokenBase.isBase = true;
65
-
66
- function startString(quote, stream, state) {
67
- var tripleQuoted = false;
68
- if (quote != "/" && stream.eat(quote)) {
69
- if (stream.eat(quote)) tripleQuoted = true;
70
- else return "string";
71
- }
72
- function t(stream, state) {
73
- var escaped = false, next, end = !tripleQuoted;
74
- while ((next = stream.next()) != null) {
75
- if (next == quote && !escaped) {
76
- if (!tripleQuoted) { break; }
77
- if (stream.match(quote + quote)) { end = true; break; }
78
- }
79
- if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
80
- state.tokenize.push(tokenBaseUntilBrace());
81
- return "string";
82
- }
83
- escaped = !escaped && next == "\\";
84
- }
85
- if (end) state.tokenize.pop();
86
- return "string";
87
- }
88
- state.tokenize.push(t);
89
- return t(stream, state);
90
- }
91
-
92
- function tokenBaseUntilBrace() {
93
- var depth = 1;
94
- function t(stream, state) {
95
- if (stream.peek() == "}") {
96
- depth--;
97
- if (depth == 0) {
98
- state.tokenize.pop();
99
- return state.tokenize[state.tokenize.length-1](stream, state);
100
- }
101
- } else if (stream.peek() == "{") {
102
- depth++;
103
- }
104
- return tokenBase(stream, state);
105
- }
106
- t.isBase = true;
107
- return t;
108
- }
109
-
110
- function tokenComment(stream, state) {
111
- var maybeEnd = false, ch;
112
- while (ch = stream.next()) {
113
- if (ch == "/" && maybeEnd) {
114
- state.tokenize.pop();
115
- break;
116
- }
117
- maybeEnd = (ch == "*");
118
- }
119
- return "comment";
120
- }
121
-
122
- function expectExpression(last) {
123
- return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
124
- last == "newstatement" || last == "keyword" || last == "proplabel";
125
- }
126
-
127
- function Context(indented, column, type, align, prev) {
128
- this.indented = indented;
129
- this.column = column;
130
- this.type = type;
131
- this.align = align;
132
- this.prev = prev;
133
- }
134
- function pushContext(state, col, type) {
135
- return state.context = new Context(state.indented, col, type, null, state.context);
136
- }
137
- function popContext(state) {
138
- var t = state.context.type;
139
- if (t == ")" || t == "]" || t == "}")
140
- state.indented = state.context.indented;
141
- return state.context = state.context.prev;
142
- }
143
-
144
- // Interface
145
-
146
- return {
147
- startState: function(basecolumn) {
148
- return {
149
- tokenize: [tokenBase],
150
- context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
151
- indented: 0,
152
- startOfLine: true,
153
- lastToken: null
154
- };
155
- },
156
-
157
- token: function(stream, state) {
158
- var ctx = state.context;
159
- if (stream.sol()) {
160
- if (ctx.align == null) ctx.align = false;
161
- state.indented = stream.indentation();
162
- state.startOfLine = true;
163
- // Automatic semicolon insertion
164
- if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
165
- popContext(state); ctx = state.context;
166
- }
167
- }
168
- if (stream.eatSpace()) return null;
169
- curPunc = null;
170
- var style = state.tokenize[state.tokenize.length-1](stream, state);
171
- if (style == "comment") return style;
172
- if (ctx.align == null) ctx.align = true;
173
-
174
- if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
175
- // Handle indentation for {x -> \n ... }
176
- else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
177
- popContext(state);
178
- state.context.align = false;
179
- }
180
- else if (curPunc == "{") pushContext(state, stream.column(), "}");
181
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
182
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
183
- else if (curPunc == "}") {
184
- while (ctx.type == "statement") ctx = popContext(state);
185
- if (ctx.type == "}") ctx = popContext(state);
186
- while (ctx.type == "statement") ctx = popContext(state);
187
- }
188
- else if (curPunc == ctx.type) popContext(state);
189
- else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
190
- pushContext(state, stream.column(), "statement");
191
- state.startOfLine = false;
192
- state.lastToken = curPunc || style;
193
- return style;
194
- },
195
-
196
- indent: function(state, textAfter) {
197
- if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
198
- var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
199
- if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
200
- var closing = firstChar == ctx.type;
201
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
202
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
203
- else return ctx.indented + (closing ? 0 : config.indentUnit);
204
- },
205
-
206
- electricChars: "{}"
207
- };
208
- });
209
-
210
- CodeMirror.defineMIME("text/x-groovy", "groovy");
@@ -1,72 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>CodeMirror: Groovy mode</title>
6
- <link rel="stylesheet" href="../../lib/codemirror.css">
7
- <script src="../../lib/codemirror.js"></script>
8
- <script src="groovy.js"></script>
9
- <link rel="stylesheet" href="../../doc/docs.css">
10
- <style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
11
- </head>
12
- <body>
13
- <h1>CodeMirror: Groovy mode</h1>
14
-
15
- <form><textarea id="code" name="code">
16
- //Pattern for groovy script
17
- def p = ~/.*\.groovy/
18
- new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
19
- // imports list
20
- def imports = []
21
- f.eachLine {
22
- // condition to detect an import instruction
23
- ln -> if ( ln =~ '^import .*' ) {
24
- imports << "${ln - 'import '}"
25
- }
26
- }
27
- // print thmen
28
- if ( ! imports.empty ) {
29
- println f
30
- imports.each{ println " $it" }
31
- }
32
- }
33
-
34
- /* Coin changer demo code from http://groovy.codehaus.org */
35
-
36
- enum UsCoin {
37
- quarter(25), dime(10), nickel(5), penny(1)
38
- UsCoin(v) { value = v }
39
- final value
40
- }
41
-
42
- enum OzzieCoin {
43
- fifty(50), twenty(20), ten(10), five(5)
44
- OzzieCoin(v) { value = v }
45
- final value
46
- }
47
-
48
- def plural(word, count) {
49
- if (count == 1) return word
50
- word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
51
- }
52
-
53
- def change(currency, amount) {
54
- currency.values().inject([]){ list, coin ->
55
- int count = amount / coin.value
56
- amount = amount % coin.value
57
- list += "$count ${plural(coin.toString(), count)}"
58
- }
59
- }
60
- </textarea></form>
61
-
62
- <script>
63
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
64
- lineNumbers: true,
65
- matchBrackets: true,
66
- mode: "text/x-groovy"
67
- });
68
- </script>
69
-
70
- <p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
71
- </body>
72
- </html>
@@ -1,242 +0,0 @@
1
- CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
2
-
3
- function switchState(source, setState, f) {
4
- setState(f);
5
- return f(source, setState);
6
- }
7
-
8
- // These should all be Unicode extended, as per the Haskell 2010 report
9
- var smallRE = /[a-z_]/;
10
- var largeRE = /[A-Z]/;
11
- var digitRE = /[0-9]/;
12
- var hexitRE = /[0-9A-Fa-f]/;
13
- var octitRE = /[0-7]/;
14
- var idRE = /[a-z_A-Z0-9']/;
15
- var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
16
- var specialRE = /[(),;[\]`{}]/;
17
- var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
18
-
19
- function normal(source, setState) {
20
- if (source.eatWhile(whiteCharRE)) {
21
- return null;
22
- }
23
-
24
- var ch = source.next();
25
- if (specialRE.test(ch)) {
26
- if (ch == '{' && source.eat('-')) {
27
- var t = "comment";
28
- if (source.eat('#')) {
29
- t = "meta";
30
- }
31
- return switchState(source, setState, ncomment(t, 1));
32
- }
33
- return null;
34
- }
35
-
36
- if (ch == '\'') {
37
- if (source.eat('\\')) {
38
- source.next(); // should handle other escapes here
39
- }
40
- else {
41
- source.next();
42
- }
43
- if (source.eat('\'')) {
44
- return "string";
45
- }
46
- return "error";
47
- }
48
-
49
- if (ch == '"') {
50
- return switchState(source, setState, stringLiteral);
51
- }
52
-
53
- if (largeRE.test(ch)) {
54
- source.eatWhile(idRE);
55
- if (source.eat('.')) {
56
- return "qualifier";
57
- }
58
- return "variable-2";
59
- }
60
-
61
- if (smallRE.test(ch)) {
62
- source.eatWhile(idRE);
63
- return "variable";
64
- }
65
-
66
- if (digitRE.test(ch)) {
67
- if (ch == '0') {
68
- if (source.eat(/[xX]/)) {
69
- source.eatWhile(hexitRE); // should require at least 1
70
- return "integer";
71
- }
72
- if (source.eat(/[oO]/)) {
73
- source.eatWhile(octitRE); // should require at least 1
74
- return "number";
75
- }
76
- }
77
- source.eatWhile(digitRE);
78
- var t = "number";
79
- if (source.eat('.')) {
80
- t = "number";
81
- source.eatWhile(digitRE); // should require at least 1
82
- }
83
- if (source.eat(/[eE]/)) {
84
- t = "number";
85
- source.eat(/[-+]/);
86
- source.eatWhile(digitRE); // should require at least 1
87
- }
88
- return t;
89
- }
90
-
91
- if (symbolRE.test(ch)) {
92
- if (ch == '-' && source.eat(/-/)) {
93
- source.eatWhile(/-/);
94
- if (!source.eat(symbolRE)) {
95
- source.skipToEnd();
96
- return "comment";
97
- }
98
- }
99
- var t = "variable";
100
- if (ch == ':') {
101
- t = "variable-2";
102
- }
103
- source.eatWhile(symbolRE);
104
- return t;
105
- }
106
-
107
- return "error";
108
- }
109
-
110
- function ncomment(type, nest) {
111
- if (nest == 0) {
112
- return normal;
113
- }
114
- return function(source, setState) {
115
- var currNest = nest;
116
- while (!source.eol()) {
117
- var ch = source.next();
118
- if (ch == '{' && source.eat('-')) {
119
- ++currNest;
120
- }
121
- else if (ch == '-' && source.eat('}')) {
122
- --currNest;
123
- if (currNest == 0) {
124
- setState(normal);
125
- return type;
126
- }
127
- }
128
- }
129
- setState(ncomment(type, currNest));
130
- return type;
131
- };
132
- }
133
-
134
- function stringLiteral(source, setState) {
135
- while (!source.eol()) {
136
- var ch = source.next();
137
- if (ch == '"') {
138
- setState(normal);
139
- return "string";
140
- }
141
- if (ch == '\\') {
142
- if (source.eol() || source.eat(whiteCharRE)) {
143
- setState(stringGap);
144
- return "string";
145
- }
146
- if (source.eat('&')) {
147
- }
148
- else {
149
- source.next(); // should handle other escapes here
150
- }
151
- }
152
- }
153
- setState(normal);
154
- return "error";
155
- }
156
-
157
- function stringGap(source, setState) {
158
- if (source.eat('\\')) {
159
- return switchState(source, setState, stringLiteral);
160
- }
161
- source.next();
162
- setState(normal);
163
- return "error";
164
- }
165
-
166
-
167
- var wellKnownWords = (function() {
168
- var wkw = {};
169
- function setType(t) {
170
- return function () {
171
- for (var i = 0; i < arguments.length; i++)
172
- wkw[arguments[i]] = t;
173
- };
174
- }
175
-
176
- setType("keyword")(
177
- "case", "class", "data", "default", "deriving", "do", "else", "foreign",
178
- "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
179
- "module", "newtype", "of", "then", "type", "where", "_");
180
-
181
- setType("keyword")(
182
- "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
183
-
184
- setType("builtin")(
185
- "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
186
- "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
187
-
188
- setType("builtin")(
189
- "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
190
- "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
191
- "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
192
- "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
193
- "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
194
- "String", "True");
195
-
196
- setType("builtin")(
197
- "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
198
- "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
199
- "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
200
- "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
201
- "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
202
- "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
203
- "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
204
- "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
205
- "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
206
- "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
207
- "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
208
- "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
209
- "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
210
- "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
211
- "otherwise", "pi", "pred", "print", "product", "properFraction",
212
- "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
213
- "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
214
- "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
215
- "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
216
- "sequence", "sequence_", "show", "showChar", "showList", "showParen",
217
- "showString", "shows", "showsPrec", "significand", "signum", "sin",
218
- "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
219
- "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
220
- "toRational", "truncate", "uncurry", "undefined", "unlines", "until",
221
- "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
222
- "zip3", "zipWith", "zipWith3");
223
-
224
- return wkw;
225
- })();
226
-
227
-
228
-
229
- return {
230
- startState: function () { return { f: normal }; },
231
- copyState: function (s) { return { f: s.f }; },
232
-
233
- token: function(stream, state) {
234
- var t = state.f(stream, function(s) { state.f = s; });
235
- var w = stream.current();
236
- return (w in wellKnownWords) ? wellKnownWords[w] : t;
237
- }
238
- };
239
-
240
- });
241
-
242
- CodeMirror.defineMIME("text/x-haskell", "haskell");