codemirror-rails 2.3 → 2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/README.md +0 -16
  2. data/codemirror-rails.gemspec +1 -1
  3. data/lib/codemirror/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/codemirror.js +323 -687
  5. data/vendor/assets/javascripts/codemirror/modes/clike.js +3 -40
  6. data/vendor/assets/javascripts/codemirror/modes/clojure.js +14 -14
  7. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +0 -6
  8. data/vendor/assets/javascripts/codemirror/modes/css.js +1 -1
  9. data/vendor/assets/javascripts/codemirror/modes/diff.js +5 -24
  10. data/vendor/assets/javascripts/codemirror/modes/gfm.js +4 -40
  11. data/vendor/assets/javascripts/codemirror/modes/go.js +22 -20
  12. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +1 -1
  13. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -4
  14. data/vendor/assets/javascripts/codemirror/modes/javascript.js +7 -8
  15. data/vendor/assets/javascripts/codemirror/modes/less.js +54 -100
  16. data/vendor/assets/javascripts/codemirror/modes/markdown.js +49 -52
  17. data/vendor/assets/javascripts/codemirror/modes/pascal.js +46 -2
  18. data/vendor/assets/javascripts/codemirror/modes/perl.js +1 -1
  19. data/vendor/assets/javascripts/codemirror/modes/php.js +25 -54
  20. data/vendor/assets/javascripts/codemirror/modes/python.js +16 -14
  21. data/vendor/assets/javascripts/codemirror/modes/rpm-spec.js +1 -1
  22. data/vendor/assets/javascripts/codemirror/modes/rst.js +1 -1
  23. data/vendor/assets/javascripts/codemirror/modes/ruby.js +9 -4
  24. data/vendor/assets/javascripts/codemirror/modes/scheme.js +46 -74
  25. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +16 -16
  26. data/vendor/assets/javascripts/codemirror/modes/stex.js +6 -21
  27. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +45 -55
  28. data/vendor/assets/javascripts/codemirror/modes/xml.js +14 -79
  29. data/vendor/assets/javascripts/codemirror/{utils/overlay.js → overlay.js} +2 -3
  30. data/vendor/assets/javascripts/codemirror/runmode.js +27 -0
  31. data/vendor/assets/stylesheets/codemirror.css +2 -63
  32. data/vendor/assets/stylesheets/codemirror/modes/tiddlywiki.css +21 -14
  33. data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +1 -1
  34. data/vendor/assets/stylesheets/codemirror/themes/elegant.css +2 -2
  35. data/vendor/assets/stylesheets/codemirror/themes/neat.css +3 -3
  36. data/vendor/assets/stylesheets/codemirror/themes/night.css +1 -1
  37. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +2 -2
  38. metadata +6 -39
  39. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +0 -29
  40. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +0 -766
  41. data/vendor/assets/javascripts/codemirror/modes/ecl.js +0 -203
  42. data/vendor/assets/javascripts/codemirror/modes/erlang.js +0 -251
  43. data/vendor/assets/javascripts/codemirror/modes/pig.js +0 -172
  44. data/vendor/assets/javascripts/codemirror/modes/properties.js +0 -63
  45. data/vendor/assets/javascripts/codemirror/modes/shell.js +0 -103
  46. data/vendor/assets/javascripts/codemirror/modes/smarty.js +0 -148
  47. data/vendor/assets/javascripts/codemirror/modes/tiki.js +0 -316
  48. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +0 -26
  49. data/vendor/assets/javascripts/codemirror/modes/xquery.js +0 -448
  50. data/vendor/assets/javascripts/codemirror/utils/closetag.js +0 -146
  51. data/vendor/assets/javascripts/codemirror/utils/dialog.js +0 -63
  52. data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -196
  53. data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -297
  54. data/vendor/assets/javascripts/codemirror/utils/javascript-hint.js +0 -134
  55. data/vendor/assets/javascripts/codemirror/utils/loadmode.js +0 -51
  56. data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -44
  57. data/vendor/assets/javascripts/codemirror/utils/multiplex.js +0 -72
  58. data/vendor/assets/javascripts/codemirror/utils/pig-hint.js +0 -123
  59. data/vendor/assets/javascripts/codemirror/utils/runmode.js +0 -49
  60. data/vendor/assets/javascripts/codemirror/utils/search.js +0 -118
  61. data/vendor/assets/javascripts/codemirror/utils/searchcursor.js +0 -117
  62. data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -72
  63. data/vendor/assets/stylesheets/codemirror/modes/tiki.css +0 -26
  64. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -81
  65. data/vendor/assets/stylesheets/codemirror/themes/blackboard.css +0 -25
  66. data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +0 -21
  67. data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +0 -44
  68. data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +0 -27
  69. data/vendor/assets/stylesheets/codemirror/themes/xq-dark.css +0 -46
  70. data/vendor/assets/stylesheets/codemirror/utils/dialog.css +0 -23
  71. data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -1,203 +0,0 @@
1
- CodeMirror.defineMode("ecl", function(config) {
2
-
3
- function words(str) {
4
- var obj = {}, words = str.split(" ");
5
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
6
- return obj;
7
- }
8
-
9
- function metaHook(stream, state) {
10
- if (!state.startOfLine) return false;
11
- stream.skipToEnd();
12
- return "meta";
13
- }
14
-
15
- function tokenAtString(stream, state) {
16
- var next;
17
- while ((next = stream.next()) != null) {
18
- if (next == '"' && !stream.eat('"')) {
19
- state.tokenize = null;
20
- break;
21
- }
22
- }
23
- return "string";
24
- }
25
-
26
- var indentUnit = config.indentUnit;
27
- var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode");
28
- var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
29
- var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath");
30
- var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode");
31
- var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when");
32
- var blockKeywords = words("catch class do else finally for if switch try while");
33
- var atoms = words("true false null");
34
- var hooks = {"#": metaHook};
35
- var multiLineStrings;
36
- var isOperatorChar = /[+\-*&%=<>!?|\/]/;
37
-
38
- var curPunc;
39
-
40
- function tokenBase(stream, state) {
41
- var ch = stream.next();
42
- if (hooks[ch]) {
43
- var result = hooks[ch](stream, state);
44
- if (result !== false) return result;
45
- }
46
- if (ch == '"' || ch == "'") {
47
- state.tokenize = tokenString(ch);
48
- return state.tokenize(stream, state);
49
- }
50
- if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
51
- curPunc = ch;
52
- return null
53
- }
54
- if (/\d/.test(ch)) {
55
- stream.eatWhile(/[\w\.]/);
56
- return "number";
57
- }
58
- if (ch == "/") {
59
- if (stream.eat("*")) {
60
- state.tokenize = tokenComment;
61
- return tokenComment(stream, state);
62
- }
63
- if (stream.eat("/")) {
64
- stream.skipToEnd();
65
- return "comment";
66
- }
67
- }
68
- if (isOperatorChar.test(ch)) {
69
- stream.eatWhile(isOperatorChar);
70
- return "operator";
71
- }
72
- stream.eatWhile(/[\w\$_]/);
73
- var cur = stream.current().toLowerCase();
74
- if (keyword.propertyIsEnumerable(cur)) {
75
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
76
- return "keyword";
77
- } else if (variable.propertyIsEnumerable(cur)) {
78
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
79
- return "variable";
80
- } else if (variable_2.propertyIsEnumerable(cur)) {
81
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
82
- return "variable-2";
83
- } else if (variable_3.propertyIsEnumerable(cur)) {
84
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
85
- return "variable-3";
86
- } else if (builtin.propertyIsEnumerable(cur)) {
87
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
88
- return "builtin";
89
- } else { //Data types are of from KEYWORD##
90
- var i = cur.length - 1;
91
- while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
92
- --i;
93
-
94
- if (i > 0) {
95
- var cur2 = cur.substr(0, i + 1);
96
- if (variable_3.propertyIsEnumerable(cur2)) {
97
- if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
98
- return "variable-3";
99
- }
100
- }
101
- }
102
- if (atoms.propertyIsEnumerable(cur)) return "atom";
103
- return "word";
104
- }
105
-
106
- function tokenString(quote) {
107
- return function(stream, state) {
108
- var escaped = false, next, end = false;
109
- while ((next = stream.next()) != null) {
110
- if (next == quote && !escaped) {end = true; break;}
111
- escaped = !escaped && next == "\\";
112
- }
113
- if (end || !(escaped || multiLineStrings))
114
- state.tokenize = tokenBase;
115
- return "string";
116
- };
117
- }
118
-
119
- function tokenComment(stream, state) {
120
- var maybeEnd = false, ch;
121
- while (ch = stream.next()) {
122
- if (ch == "/" && maybeEnd) {
123
- state.tokenize = tokenBase;
124
- break;
125
- }
126
- maybeEnd = (ch == "*");
127
- }
128
- return "comment";
129
- }
130
-
131
- function Context(indented, column, type, align, prev) {
132
- this.indented = indented;
133
- this.column = column;
134
- this.type = type;
135
- this.align = align;
136
- this.prev = prev;
137
- }
138
- function pushContext(state, col, type) {
139
- return state.context = new Context(state.indented, col, type, null, state.context);
140
- }
141
- function popContext(state) {
142
- var t = state.context.type;
143
- if (t == ")" || t == "]" || t == "}")
144
- state.indented = state.context.indented;
145
- return state.context = state.context.prev;
146
- }
147
-
148
- // Interface
149
-
150
- return {
151
- startState: function(basecolumn) {
152
- return {
153
- tokenize: null,
154
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
155
- indented: 0,
156
- startOfLine: true
157
- };
158
- },
159
-
160
- token: function(stream, state) {
161
- var ctx = state.context;
162
- if (stream.sol()) {
163
- if (ctx.align == null) ctx.align = false;
164
- state.indented = stream.indentation();
165
- state.startOfLine = true;
166
- }
167
- if (stream.eatSpace()) return null;
168
- curPunc = null;
169
- var style = (state.tokenize || tokenBase)(stream, state);
170
- if (style == "comment" || style == "meta") return style;
171
- if (ctx.align == null) ctx.align = true;
172
-
173
- if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
174
- else if (curPunc == "{") pushContext(state, stream.column(), "}");
175
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
176
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
177
- else if (curPunc == "}") {
178
- while (ctx.type == "statement") ctx = popContext(state);
179
- if (ctx.type == "}") ctx = popContext(state);
180
- while (ctx.type == "statement") ctx = popContext(state);
181
- }
182
- else if (curPunc == ctx.type) popContext(state);
183
- else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
184
- pushContext(state, stream.column(), "statement");
185
- state.startOfLine = false;
186
- return style;
187
- },
188
-
189
- indent: function(state, textAfter) {
190
- if (state.tokenize != tokenBase && state.tokenize != null) return 0;
191
- var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
192
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
193
- var closing = firstChar == ctx.type;
194
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
195
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
196
- else return ctx.indented + (closing ? 0 : indentUnit);
197
- },
198
-
199
- electricChars: "{}"
200
- };
201
- });
202
-
203
- CodeMirror.defineMIME("text/x-ecl", "ecl");
@@ -1,251 +0,0 @@
1
- // erlang -> CodeMirror tag
2
- //
3
- // atom -> atom
4
- // attribute -> attribute
5
- // builtin -> builtin
6
- // comment -> comment
7
- // error -> error
8
- // fun -> meta
9
- // function -> tag
10
- // guard -> property
11
- // keyword -> keyword
12
- // macro -> variable-2
13
- // number -> number
14
- // operator -> operator
15
- // record -> bracket
16
- // string -> string
17
- // type -> def
18
- // variable -> variable
19
-
20
- CodeMirror.defineMIME("text/x-erlang", "erlang");
21
-
22
- CodeMirror.defineMode("erlang", function(cmCfg, modeCfg) {
23
-
24
- var typeWords = [
25
- "-type", "-spec", "-export_type", "-opaque"];
26
-
27
- var keywordWords = [
28
- "after","begin","catch","case","cond","end","fun","if",
29
- "let","of","query","receive","try","when"];
30
-
31
- var operatorWords = [
32
- "and","andalso","band","bnot","bor","bsl","bsr","bxor",
33
- "div","not","or","orelse","rem","xor"];
34
-
35
- var operatorSymbols = [
36
- "+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-"];
37
-
38
- var guardWords = [
39
- "is_atom","is_binary","is_bitstring","is_boolean","is_float",
40
- "is_function","is_integer","is_list","is_number","is_pid",
41
- "is_port","is_record","is_reference","is_tuple",
42
- "atom","binary","bitstring","boolean","function","integer","list",
43
- "number","pid","port","record","reference","tuple"];
44
-
45
- var bifWords = [
46
- "abs","adler32","adler32_combine","alive","apply","atom_to_binary",
47
- "atom_to_list","binary_to_atom","binary_to_existing_atom",
48
- "binary_to_list","binary_to_term","bit_size","bitstring_to_list",
49
- "byte_size","check_process_code","contact_binary","crc32",
50
- "crc32_combine","date","decode_packet","delete_module",
51
- "disconnect_node","element","erase","exit","float","float_to_list",
52
- "garbage_collect","get","get_keys","group_leader","halt","hd",
53
- "integer_to_list","internal_bif","iolist_size","iolist_to_binary",
54
- "is_alive","is_atom","is_binary","is_bitstring","is_boolean",
55
- "is_float","is_function","is_integer","is_list","is_number","is_pid",
56
- "is_port","is_process_alive","is_record","is_reference","is_tuple",
57
- "length","link","list_to_atom","list_to_binary","list_to_bitstring",
58
- "list_to_existing_atom","list_to_float","list_to_integer",
59
- "list_to_pid","list_to_tuple","load_module","make_ref","module_loaded",
60
- "monitor_node","node","node_link","node_unlink","nodes","notalive",
61
- "now","open_port","pid_to_list","port_close","port_command",
62
- "port_connect","port_control","pre_loaded","process_flag",
63
- "process_info","processes","purge_module","put","register",
64
- "registered","round","self","setelement","size","spawn","spawn_link",
65
- "spawn_monitor","spawn_opt","split_binary","statistics",
66
- "term_to_binary","time","throw","tl","trunc","tuple_size",
67
- "tuple_to_list","unlink","unregister","whereis"];
68
-
69
- function isMember(element,list) {
70
- return (-1 < list.indexOf(element));
71
- }
72
-
73
- function isPrev(stream,string) {
74
- var start = stream.start;
75
- var len = string.length;
76
- if (len <= start) {
77
- var word = stream.string.slice(start-len,start);
78
- return word == string;
79
- }else{
80
- return false;
81
- }
82
- }
83
-
84
- var smallRE = /[a-z_]/;
85
- var largeRE = /[A-Z_]/;
86
- var digitRE = /[0-9]/;
87
- var octitRE = /[0-7]/;
88
- var idRE = /[a-z_A-Z0-9]/;
89
-
90
- function tokenize(stream, state) {
91
- if (stream.eatSpace()) {
92
- return null;
93
- }
94
-
95
- // attributes and type specs
96
- if (stream.sol() && stream.peek() == '-') {
97
- stream.next();
98
- if (stream.eat(smallRE) && stream.eatWhile(idRE)) {
99
- if (stream.peek() == "(") {
100
- return "attribute";
101
- }else if (isMember(stream.current(),typeWords)) {
102
- return "def";
103
- }else{
104
- return null;
105
- }
106
- }
107
- stream.backUp(1);
108
- }
109
-
110
- var ch = stream.next();
111
-
112
- // comment
113
- if (ch == '%') {
114
- stream.skipToEnd();
115
- return "comment";
116
- }
117
-
118
- // macro
119
- if (ch == '?') {
120
- stream.eatWhile(idRE);
121
- return "variable-2";
122
- }
123
-
124
- // record
125
- if ( ch == "#") {
126
- stream.eatWhile(idRE);
127
- return "bracket";
128
- }
129
-
130
- // char
131
- if ( ch == "$") {
132
- if (stream.next() == "\\") {
133
- if (!stream.eatWhile(octitRE)) {
134
- stream.next();
135
- }
136
- }
137
- return "string";
138
- }
139
-
140
- // quoted atom
141
- if (ch == '\'') {
142
- return singleQuote(stream);
143
- }
144
-
145
- // string
146
- if (ch == '"') {
147
- return doubleQuote(stream);
148
- }
149
-
150
- // variable
151
- if (largeRE.test(ch)) {
152
- stream.eatWhile(idRE);
153
- return "variable";
154
- }
155
-
156
- // atom/keyword/BIF/function
157
- if (smallRE.test(ch)) {
158
- stream.eatWhile(idRE);
159
-
160
- if (stream.peek() == "/") {
161
- stream.next();
162
- if (stream.eatWhile(digitRE)) {
163
- return "meta"; // f/0 style fun
164
- }else{
165
- stream.backUp(1);
166
- return "atom";
167
- }
168
- }
169
-
170
- var w = stream.current();
171
-
172
- if (isMember(w,keywordWords)) {
173
- return "keyword"; // keyword
174
- }
175
- if (stream.peek() == "(") {
176
- if (isMember(w,bifWords) &&
177
- (!isPrev(stream,":") || isPrev(stream,"erlang:"))) {
178
- return "builtin"; // BIF
179
- }else{
180
- return "tag"; // function
181
- }
182
- }
183
- if (isMember(w,guardWords)) {
184
- return "property"; // guard
185
- }
186
- if (isMember(w,operatorWords)) {
187
- return "operator"; // operator
188
- }
189
-
190
-
191
- if (stream.peek() == ":") {
192
- if (w == "erlang") { // f:now() is highlighted incorrectly
193
- return "builtin";
194
- } else {
195
- return "tag"; // function application
196
- }
197
- }
198
-
199
- return "atom";
200
- }
201
-
202
- // number
203
- if (digitRE.test(ch)) {
204
- stream.eatWhile(digitRE);
205
- if (stream.eat('#')) {
206
- stream.eatWhile(digitRE); // 16#10 style integer
207
- } else {
208
- if (stream.eat('.')) { // float
209
- stream.eatWhile(digitRE);
210
- }
211
- if (stream.eat(/[eE]/)) {
212
- stream.eat(/[-+]/); // float with exponent
213
- stream.eatWhile(digitRE);
214
- }
215
- }
216
- return "number"; // normal integer
217
- }
218
-
219
- return null;
220
- }
221
-
222
- function doubleQuote(stream) {
223
- return Quote(stream, '"', '\\', "string");
224
- }
225
-
226
- function singleQuote(stream) {
227
- return Quote(stream,'\'','\\',"atom");
228
- }
229
-
230
- function Quote(stream,quoteChar,escapeChar,tag) {
231
- while (!stream.eol()) {
232
- var ch = stream.next();
233
- if (ch == quoteChar) {
234
- return tag;
235
- }else if (ch == escapeChar) {
236
- stream.next();
237
- }
238
- }
239
- return "error";
240
- }
241
-
242
- return {
243
- startState: function() {
244
- return {};
245
- },
246
-
247
- token: function(stream, state) {
248
- return tokenize(stream, state);
249
- }
250
- };
251
- });