codemirror-rails 3.12 → 3.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/codemirror-rails.gemspec +1 -1
  3. data/lib/codemirror/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/codemirror.js +168 -116
  5. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +144 -0
  6. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +4 -4
  7. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +2 -2
  8. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +9 -3
  9. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +13 -13
  10. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +5 -1
  11. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +13 -1
  12. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +4 -4
  13. data/vendor/assets/javascripts/codemirror/addons/search/search.js +1 -1
  14. data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +15 -5
  15. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +6 -6
  16. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +89 -15
  17. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +451 -187
  18. data/vendor/assets/javascripts/codemirror/modes/clike.js +6 -3
  19. data/vendor/assets/javascripts/codemirror/modes/clojure.js +3 -1
  20. data/vendor/assets/javascripts/codemirror/modes/cobol.js +240 -0
  21. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -1
  22. data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +5 -1
  23. data/vendor/assets/javascripts/codemirror/modes/css.js +63 -24
  24. data/vendor/assets/javascripts/codemirror/modes/erlang.js +3 -2
  25. data/vendor/assets/javascripts/codemirror/modes/gas.js +5 -1
  26. data/vendor/assets/javascripts/codemirror/modes/go.js +4 -1
  27. data/vendor/assets/javascripts/codemirror/modes/haml.js +153 -0
  28. data/vendor/assets/javascripts/codemirror/modes/haskell.js +5 -1
  29. data/vendor/assets/javascripts/codemirror/modes/javascript.js +5 -1
  30. data/vendor/assets/javascripts/codemirror/modes/less.js +0 -8
  31. data/vendor/assets/javascripts/codemirror/modes/lua.js +5 -1
  32. data/vendor/assets/javascripts/codemirror/modes/markdown.js +2 -2
  33. data/vendor/assets/javascripts/codemirror/modes/ocaml.js +4 -1
  34. data/vendor/assets/javascripts/codemirror/modes/php.js +3 -0
  35. data/vendor/assets/javascripts/codemirror/modes/python.js +2 -1
  36. data/vendor/assets/javascripts/codemirror/modes/ruby.js +2 -1
  37. data/vendor/assets/javascripts/codemirror/modes/rust.js +4 -1
  38. data/vendor/assets/javascripts/codemirror/modes/sass.js +8 -27
  39. data/vendor/assets/javascripts/codemirror/modes/scheme.js +3 -1
  40. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +6 -4
  41. data/vendor/assets/javascripts/codemirror/modes/sql.js +3 -4
  42. data/vendor/assets/javascripts/codemirror/modes/stex.js +1 -1
  43. data/vendor/assets/javascripts/codemirror/modes/xml.js +2 -0
  44. data/vendor/assets/javascripts/codemirror/modes/yaml.js +3 -1
  45. data/vendor/assets/stylesheets/codemirror.css +7 -4
  46. data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +3 -3
  47. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +1 -1
  48. metadata +14 -6
  49. data/vendor/assets/javascripts/codemirror/modes/test.js +0 -64
@@ -150,12 +150,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
150
150
  if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
151
151
  var closing = firstChar == ctx.type;
152
152
  if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
153
- else if (dontAlignCalls && ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
154
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
153
+ else if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
154
+ else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
155
155
  else return ctx.indented + (closing ? 0 : indentUnit);
156
156
  },
157
157
 
158
- electricChars: "{}"
158
+ electricChars: "{}",
159
+ blockCommentStart: "/*",
160
+ blockCommentEnd: "*/",
161
+ lineComment: "//"
159
162
  };
160
163
  });
161
164
 
@@ -215,7 +215,9 @@ CodeMirror.defineMode("clojure", function () {
215
215
  indent: function (state) {
216
216
  if (state.indentStack == null) return state.indentation;
217
217
  return state.indentStack.indent;
218
- }
218
+ },
219
+
220
+ lineComment: ";;"
219
221
  };
220
222
  });
221
223
 
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Author: Gautam Mehta
3
+ * Branched from CodeMirror's Scheme mode
4
+ */
5
+ CodeMirror.defineMode("cobol", function () {
6
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
7
+ ATOM = "atom", NUMBER = "number", KEYWORD = "keyword", MODTAG = "header",
8
+ COBOLLINENUM = "def", PERIOD = "link";
9
+ function makeKeywords(str) {
10
+ var obj = {}, words = str.split(" ");
11
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
12
+ return obj;
13
+ }
14
+ var atoms = makeKeywords("TRUE FALSE ZEROES ZEROS ZERO SPACES SPACE LOW-VALUE LOW-VALUES ");
15
+ var keywords = makeKeywords(
16
+ "ACCEPT ACCESS ACQUIRE ADD ADDRESS " +
17
+ "ADVANCING AFTER ALIAS ALL ALPHABET " +
18
+ "ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED " +
19
+ "ALSO ALTER ALTERNATE AND ANY " +
20
+ "ARE AREA AREAS ARITHMETIC ASCENDING " +
21
+ "ASSIGN AT ATTRIBUTE AUTHOR AUTO " +
22
+ "AUTO-SKIP AUTOMATIC B-AND B-EXOR B-LESS " +
23
+ "B-NOT B-OR BACKGROUND-COLOR BACKGROUND-COLOUR BEEP " +
24
+ "BEFORE BELL BINARY BIT BITS " +
25
+ "BLANK BLINK BLOCK BOOLEAN BOTTOM " +
26
+ "BY CALL CANCEL CD CF " +
27
+ "CH CHARACTER CHARACTERS CLASS CLOCK-UNITS " +
28
+ "CLOSE COBOL CODE CODE-SET COL " +
29
+ "COLLATING COLUMN COMMA COMMIT COMMITMENT " +
30
+ "COMMON COMMUNICATION COMP COMP-0 COMP-1 " +
31
+ "COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 " +
32
+ "COMP-7 COMP-8 COMP-9 COMPUTATIONAL COMPUTATIONAL-0 " +
33
+ "COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 " +
34
+ "COMPUTATIONAL-6 COMPUTATIONAL-7 COMPUTATIONAL-8 COMPUTATIONAL-9 COMPUTE " +
35
+ "CONFIGURATION CONNECT CONSOLE CONTAINED CONTAINS " +
36
+ "CONTENT CONTINUE CONTROL CONTROL-AREA CONTROLS " +
37
+ "CONVERTING COPY CORR CORRESPONDING COUNT " +
38
+ "CRT CRT-UNDER CURRENCY CURRENT CURSOR " +
39
+ "DATA DATE DATE-COMPILED DATE-WRITTEN DAY " +
40
+ "DAY-OF-WEEK DB DB-ACCESS-CONTROL-KEY DB-DATA-NAME DB-EXCEPTION " +
41
+ "DB-FORMAT-NAME DB-RECORD-NAME DB-SET-NAME DB-STATUS DBCS " +
42
+ "DBCS-EDITED DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE " +
43
+ "DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING " +
44
+ "DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED " +
45
+ "DELIMITER DEPENDING DESCENDING DESCRIBED DESTINATION " +
46
+ "DETAIL DISABLE DISCONNECT DISPLAY DISPLAY-1 " +
47
+ "DISPLAY-2 DISPLAY-3 DISPLAY-4 DISPLAY-5 DISPLAY-6 " +
48
+ "DISPLAY-7 DISPLAY-8 DISPLAY-9 DIVIDE DIVISION " +
49
+ "DOWN DROP DUPLICATE DUPLICATES DYNAMIC " +
50
+ "EBCDIC EGI EJECT ELSE EMI " +
51
+ "EMPTY EMPTY-CHECK ENABLE END END. END-ACCEPT END-ACCEPT. " +
52
+ "END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY " +
53
+ "END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY " +
54
+ "END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN " +
55
+ "END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT " +
56
+ "END-UNSTRING END-WRITE END-XML ENTER ENTRY " +
57
+ "ENVIRONMENT EOP EQUAL EQUALS ERASE " +
58
+ "ERROR ESI EVALUATE EVERY EXCEEDS " +
59
+ "EXCEPTION EXCLUSIVE EXIT EXTEND EXTERNAL " +
60
+ "EXTERNALLY-DESCRIBED-KEY FD FETCH FILE FILE-CONTROL " +
61
+ "FILE-STREAM FILES FILLER FINAL FIND " +
62
+ "FINISH FIRST FOOTING FOR FOREGROUND-COLOR " +
63
+ "FOREGROUND-COLOUR FORMAT FREE FROM FULL " +
64
+ "FUNCTION GENERATE GET GIVING GLOBAL " +
65
+ "GO GOBACK GREATER GROUP HEADING " +
66
+ "HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL " +
67
+ "ID IDENTIFICATION IF IN INDEX " +
68
+ "INDEX-1 INDEX-2 INDEX-3 INDEX-4 INDEX-5 " +
69
+ "INDEX-6 INDEX-7 INDEX-8 INDEX-9 INDEXED " +
70
+ "INDIC INDICATE INDICATOR INDICATORS INITIAL " +
71
+ "INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT " +
72
+ "INSTALLATION INTO INVALID INVOKE IS " +
73
+ "JUST JUSTIFIED KANJI KEEP KEY " +
74
+ "LABEL LAST LD LEADING LEFT " +
75
+ "LEFT-JUSTIFY LENGTH LENGTH-CHECK LESS LIBRARY " +
76
+ "LIKE LIMIT LIMITS LINAGE LINAGE-COUNTER " +
77
+ "LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE " +
78
+ "LOCALE LOCALLY LOCK " +
79
+ "MEMBER MEMORY MERGE MESSAGE METACLASS " +
80
+ "MODE MODIFIED MODIFY MODULES MOVE " +
81
+ "MULTIPLE MULTIPLY NATIONAL NATIVE NEGATIVE " +
82
+ "NEXT NO NO-ECHO NONE NOT " +
83
+ "NULL NULL-KEY-MAP NULL-MAP NULLS NUMBER " +
84
+ "NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OCCURS " +
85
+ "OF OFF OMITTED ON ONLY " +
86
+ "OPEN OPTIONAL OR ORDER ORGANIZATION " +
87
+ "OTHER OUTPUT OVERFLOW OWNER PACKED-DECIMAL " +
88
+ "PADDING PAGE PAGE-COUNTER PARSE PERFORM " +
89
+ "PF PH PIC PICTURE PLUS " +
90
+ "POINTER POSITION POSITIVE PREFIX PRESENT " +
91
+ "PRINTING PRIOR PROCEDURE PROCEDURE-POINTER PROCEDURES " +
92
+ "PROCEED PROCESS PROCESSING PROGRAM PROGRAM-ID " +
93
+ "PROMPT PROTECTED PURGE QUEUE QUOTE " +
94
+ "QUOTES RANDOM RD READ READY " +
95
+ "REALM RECEIVE RECONNECT RECORD RECORD-NAME " +
96
+ "RECORDS RECURSIVE REDEFINES REEL REFERENCE " +
97
+ "REFERENCE-MONITOR REFERENCES RELATION RELATIVE RELEASE " +
98
+ "REMAINDER REMOVAL RENAMES REPEATED REPLACE " +
99
+ "REPLACING REPORT REPORTING REPORTS REPOSITORY " +
100
+ "REQUIRED RERUN RESERVE RESET RETAINING " +
101
+ "RETRIEVAL RETURN RETURN-CODE RETURNING REVERSE-VIDEO " +
102
+ "REVERSED REWIND REWRITE RF RH " +
103
+ "RIGHT RIGHT-JUSTIFY ROLLBACK ROLLING ROUNDED " +
104
+ "RUN SAME SCREEN SD SEARCH " +
105
+ "SECTION SECURE SECURITY SEGMENT SEGMENT-LIMIT " +
106
+ "SELECT SEND SENTENCE SEPARATE SEQUENCE " +
107
+ "SEQUENTIAL SET SHARED SIGN SIZE " +
108
+ "SKIP1 SKIP2 SKIP3 SORT SORT-MERGE " +
109
+ "SORT-RETURN SOURCE SOURCE-COMPUTER SPACE-FILL " +
110
+ "SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 " +
111
+ "START STARTING STATUS STOP STORE " +
112
+ "STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA " +
113
+ "SUBFILE SUBSTITUTE SUBTRACT SUM SUPPRESS " +
114
+ "SYMBOLIC SYNC SYNCHRONIZED SYSIN SYSOUT " +
115
+ "TABLE TALLYING TAPE TENANT TERMINAL " +
116
+ "TERMINATE TEST TEXT THAN THEN " +
117
+ "THROUGH THRU TIME TIMES TITLE " +
118
+ "TO TOP TRAILING TRAILING-SIGN TRANSACTION " +
119
+ "TYPE TYPEDEF UNDERLINE UNEQUAL UNIT " +
120
+ "UNSTRING UNTIL UP UPDATE UPON " +
121
+ "USAGE USAGE-MODE USE USING VALID " +
122
+ "VALIDATE VALUE VALUES VARYING VLR " +
123
+ "WAIT WHEN WHEN-COMPILED WITH WITHIN " +
124
+ "WORDS WORKING-STORAGE WRITE XML XML-CODE " +
125
+ "XML-EVENT XML-NTEXT XML-TEXT ZERO ZERO-FILL " );
126
+
127
+ var builtins = makeKeywords("- * ** / + < <= = > >= ");
128
+ var tests = {
129
+ digit: /\d/,
130
+ digit_or_colon: /[\d:]/,
131
+ hex: /[0-9a-f]/i,
132
+ sign: /[+-]/,
133
+ exponent: /e/i,
134
+ keyword_char: /[^\s\(\[\;\)\]]/,
135
+ symbol: /[\w*+\-]/
136
+ };
137
+ function isNumber(ch, stream){
138
+ // hex
139
+ if ( ch === '0' && stream.eat(/x/i) ) {
140
+ stream.eatWhile(tests.hex);
141
+ return true;
142
+ }
143
+ // leading sign
144
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
145
+ stream.eat(tests.sign);
146
+ ch = stream.next();
147
+ }
148
+ if ( tests.digit.test(ch) ) {
149
+ stream.eat(ch);
150
+ stream.eatWhile(tests.digit);
151
+ if ( '.' == stream.peek()) {
152
+ stream.eat('.');
153
+ stream.eatWhile(tests.digit);
154
+ }
155
+ if ( stream.eat(tests.exponent) ) {
156
+ stream.eat(tests.sign);
157
+ stream.eatWhile(tests.digit);
158
+ }
159
+ return true;
160
+ }
161
+ return false;
162
+ }
163
+ return {
164
+ startState: function () {
165
+ return {
166
+ indentStack: null,
167
+ indentation: 0,
168
+ mode: false
169
+ };
170
+ },
171
+ token: function (stream, state) {
172
+ if (state.indentStack == null && stream.sol()) {
173
+ // update indentation, but only if indentStack is empty
174
+ state.indentation = 6 ; //stream.indentation();
175
+ }
176
+ // skip spaces
177
+ if (stream.eatSpace()) {
178
+ return null;
179
+ }
180
+ var returnType = null;
181
+ switch(state.mode){
182
+ case "string": // multi-line string parsing mode
183
+ var next = false;
184
+ while ((next = stream.next()) != null) {
185
+ if (next == "\"" || next == "\'") {
186
+ state.mode = false;
187
+ break;
188
+ }
189
+ }
190
+ returnType = STRING; // continue on in string mode
191
+ break;
192
+ default: // default parsing mode
193
+ var ch = stream.next();
194
+ var col = stream.column();
195
+ if (col >= 0 && col <= 5) {
196
+ returnType = COBOLLINENUM;
197
+ } else if (col >= 72 && col <= 79) {
198
+ stream.skipToEnd();
199
+ returnType = MODTAG;
200
+ } else if (ch == "*" && col == 6) { // comment
201
+ stream.skipToEnd(); // rest of the line is a comment
202
+ returnType = COMMENT;
203
+ } else if (ch == "\"" || ch == "\'") {
204
+ state.mode = "string";
205
+ returnType = STRING;
206
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
207
+ returnType = ATOM;
208
+ } else if (ch == ".") {
209
+ returnType = PERIOD;
210
+ } else if (isNumber(ch,stream)){
211
+ returnType = NUMBER;
212
+ } else {
213
+ if (stream.current().match(tests.symbol)) {
214
+ while (col < 71) {
215
+ if (stream.eat(tests.symbol) === undefined) {
216
+ break;
217
+ } else {
218
+ col++;
219
+ }
220
+ }
221
+ }
222
+ if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
223
+ returnType = KEYWORD;
224
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) {
225
+ returnType = BUILTIN;
226
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current().toUpperCase())) {
227
+ returnType = ATOM;
228
+ } else returnType = null;
229
+ }
230
+ }
231
+ return returnType;
232
+ },
233
+ indent: function (state) {
234
+ if (state.indentStack == null) return state.indentation;
235
+ return state.indentStack.indent;
236
+ }
237
+ };
238
+ });
239
+
240
+ CodeMirror.defineMIME("text/x-cobol", "cobol");
@@ -337,8 +337,9 @@ CodeMirror.defineMode('coffeescript', function(conf) {
337
337
  }
338
338
 
339
339
  return state.scopes[0].offset;
340
- }
340
+ },
341
341
 
342
+ lineComment: "#"
342
343
  };
343
344
  return external;
344
345
  });
@@ -94,7 +94,11 @@ CodeMirror.defineMode("commonlisp", function (config) {
94
94
  indent: function (state, _textAfter) {
95
95
  var i = state.ctx.indentTo;
96
96
  return typeof i == "number" ? i : state.ctx.start + 1;
97
- }
97
+ },
98
+
99
+ lineComment: ";;",
100
+ blockCommentStart: "#|",
101
+ blockCommentEnd: "|#"
98
102
  };
99
103
  });
100
104
 
@@ -165,26 +165,27 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
165
165
  if (type == "variable-definition") state.stack.push("propertyValue");
166
166
  return "variable-2";
167
167
  } else if (style == "property") {
168
- if (context == "propertyValue"){
169
- if (valueKeywords[stream.current()]) {
168
+ var word = stream.current().toLowerCase();
169
+ if (context == "propertyValue") {
170
+ if (valueKeywords.hasOwnProperty(word)) {
170
171
  style = "string-2";
171
- } else if (colorKeywords[stream.current()]) {
172
+ } else if (colorKeywords.hasOwnProperty(word)) {
172
173
  style = "keyword";
173
174
  } else {
174
175
  style = "variable-2";
175
176
  }
176
177
  } else if (context == "rule") {
177
- if (!propertyKeywords[stream.current()]) {
178
+ if (!propertyKeywords.hasOwnProperty(word)) {
178
179
  style += " error";
179
180
  }
180
181
  } else if (context == "block") {
181
182
  // if a value is present in both property, value, or color, the order
182
183
  // of preference is property -> color -> value
183
- if (propertyKeywords[stream.current()]) {
184
+ if (propertyKeywords.hasOwnProperty(word)) {
184
185
  style = "property";
185
- } else if (colorKeywords[stream.current()]) {
186
+ } else if (colorKeywords.hasOwnProperty(word)) {
186
187
  style = "keyword";
187
- } else if (valueKeywords[stream.current()]) {
188
+ } else if (valueKeywords.hasOwnProperty(word)) {
188
189
  style = "string-2";
189
190
  } else {
190
191
  style = "tag";
@@ -194,42 +195,42 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
194
195
  } else if (context == "@media") {
195
196
  if (atMediaTypes[stream.current()]) {
196
197
  style = "attribute"; // Known attribute
197
- } else if (/^(only|not)$/i.test(stream.current())) {
198
+ } else if (/^(only|not)$/.test(word)) {
198
199
  style = "keyword";
199
- } else if (stream.current().toLowerCase() == "and") {
200
+ } else if (word == "and") {
200
201
  style = "error"; // "and" is only allowed in @mediaType
201
- } else if (atMediaFeatures[stream.current()]) {
202
+ } else if (atMediaFeatures.hasOwnProperty(word)) {
202
203
  style = "error"; // Known property, should be in @mediaType(
203
204
  } else {
204
205
  // Unknown, expecting keyword or attribute, assuming attribute
205
206
  style = "attribute error";
206
207
  }
207
208
  } else if (context == "@mediaType") {
208
- if (atMediaTypes[stream.current()]) {
209
+ if (atMediaTypes.hasOwnProperty(word)) {
209
210
  style = "attribute";
210
- } else if (stream.current().toLowerCase() == "and") {
211
+ } else if (word == "and") {
211
212
  style = "operator";
212
- } else if (/^(only|not)$/i.test(stream.current())) {
213
+ } else if (/^(only|not)$/.test(word)) {
213
214
  style = "error"; // Only allowed in @media
214
- } else if (atMediaFeatures[stream.current()]) {
215
- style = "error"; // Known property, should be in parentheses
216
215
  } else {
217
216
  // Unknown attribute or property, but expecting property (preceded
218
217
  // by "and"). Should be in parentheses
219
218
  style = "error";
220
219
  }
221
220
  } else if (context == "@mediaType(") {
222
- if (propertyKeywords[stream.current()]) {
221
+ if (propertyKeywords.hasOwnProperty(word)) {
223
222
  // do nothing, remains "property"
224
- } else if (atMediaTypes[stream.current()]) {
223
+ } else if (atMediaTypes.hasOwnProperty(word)) {
225
224
  style = "error"; // Known property, should be in parentheses
226
- } else if (stream.current().toLowerCase() == "and") {
225
+ } else if (word == "and") {
227
226
  style = "operator";
228
- } else if (/^(only|not)$/i.test(stream.current())) {
227
+ } else if (/^(only|not)$/.test(word)) {
229
228
  style = "error"; // Only allowed in @media
230
229
  } else {
231
230
  style += " error";
232
231
  }
232
+ } else if (context == "@import") {
233
+ style = "tag";
233
234
  } else {
234
235
  style = "error";
235
236
  }
@@ -266,6 +267,7 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
266
267
  }
267
268
  else if (type == "interpolation") state.stack.push("interpolation");
268
269
  else if (type == "@media") state.stack.push("@media");
270
+ else if (type == "@import") state.stack.push("@import");
269
271
  else if (context == "@media" && /\b(keyword|attribute)\b/.test(style))
270
272
  state.stack.push("@mediaType");
271
273
  else if (context == "@mediaType" && stream.current() == ",") state.stack.pop();
@@ -273,6 +275,7 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
273
275
  else if (context == "@mediaType(" && type == ")") state.stack.pop();
274
276
  else if ((context == "rule" || context == "block") && type == ":") state.stack.push("propertyValue");
275
277
  else if (context == "propertyValue" && type == ";") state.stack.pop();
278
+ else if (context == "@import" && type == ";") state.stack.pop();
276
279
  return style;
277
280
  },
278
281
 
@@ -283,7 +286,9 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
283
286
  return state.baseIndent + n * indentUnit;
284
287
  },
285
288
 
286
- electricChars: "}"
289
+ electricChars: "}",
290
+ blockCommentStart: "/*",
291
+ blockCommentEnd: "*/"
287
292
  };
288
293
  });
289
294
 
@@ -387,12 +392,46 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
387
392
  "vertical-align", "visibility", "voice-balance", "voice-duration",
388
393
  "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
389
394
  "voice-volume", "volume", "white-space", "widows", "width", "word-break",
390
- "word-spacing", "word-wrap", "z-index"
395
+ "word-spacing", "word-wrap", "z-index",
396
+ // SVG-specific
397
+ "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
398
+ "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
399
+ "color-interpolation", "color-interpolation-filters", "color-profile",
400
+ "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
401
+ "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
402
+ "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
403
+ "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
404
+ "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
405
+ "glyph-orientation-vertical", "kerning", "text-anchor", "writing-mode"
391
406
  ]);
392
407
 
393
408
  var colorKeywords = keySet([
394
- "black", "silver", "gray", "white", "maroon", "red", "purple", "fuchsia",
395
- "green", "lime", "olive", "yellow", "navy", "blue", "teal", "aqua"
409
+ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
410
+ "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
411
+ "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
412
+ "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
413
+ "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
414
+ "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
415
+ "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
416
+ "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
417
+ "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
418
+ "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew",
419
+ "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
420
+ "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
421
+ "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
422
+ "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
423
+ "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
424
+ "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
425
+ "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
426
+ "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
427
+ "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
428
+ "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
429
+ "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
430
+ "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon",
431
+ "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
432
+ "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
433
+ "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
434
+ "whitesmoke", "yellow", "yellowgreen"
396
435
  ]);
397
436
 
398
437
  var valueKeywords = keySet([
@@ -475,7 +514,7 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
475
514
  "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
476
515
  "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
477
516
  "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
478
- "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider",
517
+ "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
479
518
  "window", "windowframe", "windowtext", "x-large", "x-small", "xor",
480
519
  "xx-large", "xx-small"
481
520
  ]);