| 776 |
lars |
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
|
2 |
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
3 |
|
|
|
4 |
(function(mod) {
|
|
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
|
6 |
mod(require("../../lib/codemirror"));
|
|
|
7 |
else if (typeof define == "function" && define.amd) // AMD
|
|
|
8 |
define(["../../lib/codemirror"], mod);
|
|
|
9 |
else // Plain browser env
|
|
|
10 |
mod(CodeMirror);
|
|
|
11 |
})(function(CodeMirror) {
|
|
|
12 |
"use strict";
|
|
|
13 |
|
|
|
14 |
CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
|
15 |
var provided = parserConfig;
|
|
|
16 |
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
|
|
17 |
parserConfig.inline = provided.inline;
|
|
|
18 |
|
|
|
19 |
var indentUnit = config.indentUnit,
|
|
|
20 |
tokenHooks = parserConfig.tokenHooks,
|
|
|
21 |
documentTypes = parserConfig.documentTypes || {},
|
|
|
22 |
mediaTypes = parserConfig.mediaTypes || {},
|
|
|
23 |
mediaFeatures = parserConfig.mediaFeatures || {},
|
|
|
24 |
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
|
|
|
25 |
propertyKeywords = parserConfig.propertyKeywords || {},
|
|
|
26 |
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
|
|
27 |
fontProperties = parserConfig.fontProperties || {},
|
|
|
28 |
counterDescriptors = parserConfig.counterDescriptors || {},
|
|
|
29 |
colorKeywords = parserConfig.colorKeywords || {},
|
|
|
30 |
valueKeywords = parserConfig.valueKeywords || {},
|
|
|
31 |
allowNested = parserConfig.allowNested;
|
|
|
32 |
|
|
|
33 |
var type, override;
|
|
|
34 |
function ret(style, tp) { type = tp; return style; }
|
|
|
35 |
|
|
|
36 |
// Tokenizers
|
|
|
37 |
|
|
|
38 |
function tokenBase(stream, state) {
|
|
|
39 |
var ch = stream.next();
|
|
|
40 |
if (tokenHooks[ch]) {
|
|
|
41 |
var result = tokenHooks[ch](stream, state);
|
|
|
42 |
if (result !== false) return result;
|
|
|
43 |
}
|
|
|
44 |
if (ch == "@") {
|
|
|
45 |
stream.eatWhile(/[\w\\\-]/);
|
|
|
46 |
return ret("def", stream.current());
|
|
|
47 |
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
|
|
48 |
return ret(null, "compare");
|
|
|
49 |
} else if (ch == "\"" || ch == "'") {
|
|
|
50 |
state.tokenize = tokenString(ch);
|
|
|
51 |
return state.tokenize(stream, state);
|
|
|
52 |
} else if (ch == "#") {
|
|
|
53 |
stream.eatWhile(/[\w\\\-]/);
|
|
|
54 |
return ret("atom", "hash");
|
|
|
55 |
} else if (ch == "!") {
|
|
|
56 |
stream.match(/^\s*\w*/);
|
|
|
57 |
return ret("keyword", "important");
|
|
|
58 |
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
|
|
59 |
stream.eatWhile(/[\w.%]/);
|
|
|
60 |
return ret("number", "unit");
|
|
|
61 |
} else if (ch === "-") {
|
|
|
62 |
if (/[\d.]/.test(stream.peek())) {
|
|
|
63 |
stream.eatWhile(/[\w.%]/);
|
|
|
64 |
return ret("number", "unit");
|
|
|
65 |
} else if (stream.match(/^-[\w\\\-]+/)) {
|
|
|
66 |
stream.eatWhile(/[\w\\\-]/);
|
|
|
67 |
if (stream.match(/^\s*:/, false))
|
|
|
68 |
return ret("variable-2", "variable-definition");
|
|
|
69 |
return ret("variable-2", "variable");
|
|
|
70 |
} else if (stream.match(/^\w+-/)) {
|
|
|
71 |
return ret("meta", "meta");
|
|
|
72 |
}
|
|
|
73 |
} else if (/[,+>*\/]/.test(ch)) {
|
|
|
74 |
return ret(null, "select-op");
|
|
|
75 |
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
|
|
76 |
return ret("qualifier", "qualifier");
|
|
|
77 |
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
|
|
78 |
return ret(null, ch);
|
|
|
79 |
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
|
|
80 |
(ch == "d" && stream.match("omain(")) ||
|
|
|
81 |
(ch == "r" && stream.match("egexp("))) {
|
|
|
82 |
stream.backUp(1);
|
|
|
83 |
state.tokenize = tokenParenthesized;
|
|
|
84 |
return ret("property", "word");
|
|
|
85 |
} else if (/[\w\\\-]/.test(ch)) {
|
|
|
86 |
stream.eatWhile(/[\w\\\-]/);
|
|
|
87 |
return ret("property", "word");
|
|
|
88 |
} else {
|
|
|
89 |
return ret(null, null);
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
function tokenString(quote) {
|
|
|
94 |
return function(stream, state) {
|
|
|
95 |
var escaped = false, ch;
|
|
|
96 |
while ((ch = stream.next()) != null) {
|
|
|
97 |
if (ch == quote && !escaped) {
|
|
|
98 |
if (quote == ")") stream.backUp(1);
|
|
|
99 |
break;
|
|
|
100 |
}
|
|
|
101 |
escaped = !escaped && ch == "\\";
|
|
|
102 |
}
|
|
|
103 |
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
|
|
104 |
return ret("string", "string");
|
|
|
105 |
};
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
function tokenParenthesized(stream, state) {
|
|
|
109 |
stream.next(); // Must be '('
|
|
|
110 |
if (!stream.match(/\s*[\"\')]/, false))
|
|
|
111 |
state.tokenize = tokenString(")");
|
|
|
112 |
else
|
|
|
113 |
state.tokenize = null;
|
|
|
114 |
return ret(null, "(");
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
// Context management
|
|
|
118 |
|
|
|
119 |
function Context(type, indent, prev) {
|
|
|
120 |
this.type = type;
|
|
|
121 |
this.indent = indent;
|
|
|
122 |
this.prev = prev;
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
function pushContext(state, stream, type) {
|
|
|
126 |
state.context = new Context(type, stream.indentation() + indentUnit, state.context);
|
|
|
127 |
return type;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
function popContext(state) {
|
|
|
131 |
state.context = state.context.prev;
|
|
|
132 |
return state.context.type;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
function pass(type, stream, state) {
|
|
|
136 |
return states[state.context.type](type, stream, state);
|
|
|
137 |
}
|
|
|
138 |
function popAndPass(type, stream, state, n) {
|
|
|
139 |
for (var i = n || 1; i > 0; i--)
|
|
|
140 |
state.context = state.context.prev;
|
|
|
141 |
return pass(type, stream, state);
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
// Parser
|
|
|
145 |
|
|
|
146 |
function wordAsValue(stream) {
|
|
|
147 |
var word = stream.current().toLowerCase();
|
|
|
148 |
if (valueKeywords.hasOwnProperty(word))
|
|
|
149 |
override = "atom";
|
|
|
150 |
else if (colorKeywords.hasOwnProperty(word))
|
|
|
151 |
override = "keyword";
|
|
|
152 |
else
|
|
|
153 |
override = "variable";
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
var states = {};
|
|
|
157 |
|
|
|
158 |
states.top = function(type, stream, state) {
|
|
|
159 |
if (type == "{") {
|
|
|
160 |
return pushContext(state, stream, "block");
|
|
|
161 |
} else if (type == "}" && state.context.prev) {
|
|
|
162 |
return popContext(state);
|
|
|
163 |
} else if (/@(media|supports|(-moz-)?document)/.test(type)) {
|
|
|
164 |
return pushContext(state, stream, "atBlock");
|
|
|
165 |
} else if (/@(font-face|counter-style)/.test(type)) {
|
|
|
166 |
state.stateArg = type;
|
|
|
167 |
return "restricted_atBlock_before";
|
|
|
168 |
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
|
|
169 |
return "keyframes";
|
|
|
170 |
} else if (type && type.charAt(0) == "@") {
|
|
|
171 |
return pushContext(state, stream, "at");
|
|
|
172 |
} else if (type == "hash") {
|
|
|
173 |
override = "builtin";
|
|
|
174 |
} else if (type == "word") {
|
|
|
175 |
override = "tag";
|
|
|
176 |
} else if (type == "variable-definition") {
|
|
|
177 |
return "maybeprop";
|
|
|
178 |
} else if (type == "interpolation") {
|
|
|
179 |
return pushContext(state, stream, "interpolation");
|
|
|
180 |
} else if (type == ":") {
|
|
|
181 |
return "pseudo";
|
|
|
182 |
} else if (allowNested && type == "(") {
|
|
|
183 |
return pushContext(state, stream, "parens");
|
|
|
184 |
}
|
|
|
185 |
return state.context.type;
|
|
|
186 |
};
|
|
|
187 |
|
|
|
188 |
states.block = function(type, stream, state) {
|
|
|
189 |
if (type == "word") {
|
|
|
190 |
var word = stream.current().toLowerCase();
|
|
|
191 |
if (propertyKeywords.hasOwnProperty(word)) {
|
|
|
192 |
override = "property";
|
|
|
193 |
return "maybeprop";
|
|
|
194 |
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
|
|
195 |
override = "string-2";
|
|
|
196 |
return "maybeprop";
|
|
|
197 |
} else if (allowNested) {
|
|
|
198 |
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
|
|
199 |
return "block";
|
|
|
200 |
} else {
|
|
|
201 |
override += " error";
|
|
|
202 |
return "maybeprop";
|
|
|
203 |
}
|
|
|
204 |
} else if (type == "meta") {
|
|
|
205 |
return "block";
|
|
|
206 |
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
|
|
207 |
override = "error";
|
|
|
208 |
return "block";
|
|
|
209 |
} else {
|
|
|
210 |
return states.top(type, stream, state);
|
|
|
211 |
}
|
|
|
212 |
};
|
|
|
213 |
|
|
|
214 |
states.maybeprop = function(type, stream, state) {
|
|
|
215 |
if (type == ":") return pushContext(state, stream, "prop");
|
|
|
216 |
return pass(type, stream, state);
|
|
|
217 |
};
|
|
|
218 |
|
|
|
219 |
states.prop = function(type, stream, state) {
|
|
|
220 |
if (type == ";") return popContext(state);
|
|
|
221 |
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
|
|
222 |
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
|
|
223 |
if (type == "(") return pushContext(state, stream, "parens");
|
|
|
224 |
|
|
|
225 |
if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
|
|
|
226 |
override += " error";
|
|
|
227 |
} else if (type == "word") {
|
|
|
228 |
wordAsValue(stream);
|
|
|
229 |
} else if (type == "interpolation") {
|
|
|
230 |
return pushContext(state, stream, "interpolation");
|
|
|
231 |
}
|
|
|
232 |
return "prop";
|
|
|
233 |
};
|
|
|
234 |
|
|
|
235 |
states.propBlock = function(type, _stream, state) {
|
|
|
236 |
if (type == "}") return popContext(state);
|
|
|
237 |
if (type == "word") { override = "property"; return "maybeprop"; }
|
|
|
238 |
return state.context.type;
|
|
|
239 |
};
|
|
|
240 |
|
|
|
241 |
states.parens = function(type, stream, state) {
|
|
|
242 |
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
|
|
243 |
if (type == ")") return popContext(state);
|
|
|
244 |
if (type == "(") return pushContext(state, stream, "parens");
|
|
|
245 |
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
|
|
246 |
if (type == "word") wordAsValue(stream);
|
|
|
247 |
return "parens";
|
|
|
248 |
};
|
|
|
249 |
|
|
|
250 |
states.pseudo = function(type, stream, state) {
|
|
|
251 |
if (type == "word") {
|
|
|
252 |
override = "variable-3";
|
|
|
253 |
return state.context.type;
|
|
|
254 |
}
|
|
|
255 |
return pass(type, stream, state);
|
|
|
256 |
};
|
|
|
257 |
|
|
|
258 |
states.atBlock = function(type, stream, state) {
|
|
|
259 |
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
|
|
260 |
if (type == "}") return popAndPass(type, stream, state);
|
|
|
261 |
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
|
|
262 |
|
|
|
263 |
if (type == "word") {
|
|
|
264 |
var word = stream.current().toLowerCase();
|
|
|
265 |
if (word == "only" || word == "not" || word == "and" || word == "or")
|
|
|
266 |
override = "keyword";
|
|
|
267 |
else if (documentTypes.hasOwnProperty(word))
|
|
|
268 |
override = "tag";
|
|
|
269 |
else if (mediaTypes.hasOwnProperty(word))
|
|
|
270 |
override = "attribute";
|
|
|
271 |
else if (mediaFeatures.hasOwnProperty(word))
|
|
|
272 |
override = "property";
|
|
|
273 |
else if (mediaValueKeywords.hasOwnProperty(word))
|
|
|
274 |
override = "keyword";
|
|
|
275 |
else if (propertyKeywords.hasOwnProperty(word))
|
|
|
276 |
override = "property";
|
|
|
277 |
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
|
|
278 |
override = "string-2";
|
|
|
279 |
else if (valueKeywords.hasOwnProperty(word))
|
|
|
280 |
override = "atom";
|
|
|
281 |
else if (colorKeywords.hasOwnProperty(word))
|
|
|
282 |
override = "keyword";
|
|
|
283 |
else
|
|
|
284 |
override = "error";
|
|
|
285 |
}
|
|
|
286 |
return state.context.type;
|
|
|
287 |
};
|
|
|
288 |
|
|
|
289 |
states.atBlock_parens = function(type, stream, state) {
|
|
|
290 |
if (type == ")") return popContext(state);
|
|
|
291 |
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
|
|
292 |
return states.atBlock(type, stream, state);
|
|
|
293 |
};
|
|
|
294 |
|
|
|
295 |
states.restricted_atBlock_before = function(type, stream, state) {
|
|
|
296 |
if (type == "{")
|
|
|
297 |
return pushContext(state, stream, "restricted_atBlock");
|
|
|
298 |
if (type == "word" && state.stateArg == "@counter-style") {
|
|
|
299 |
override = "variable";
|
|
|
300 |
return "restricted_atBlock_before";
|
|
|
301 |
}
|
|
|
302 |
return pass(type, stream, state);
|
|
|
303 |
};
|
|
|
304 |
|
|
|
305 |
states.restricted_atBlock = function(type, stream, state) {
|
|
|
306 |
if (type == "}") {
|
|
|
307 |
state.stateArg = null;
|
|
|
308 |
return popContext(state);
|
|
|
309 |
}
|
|
|
310 |
if (type == "word") {
|
|
|
311 |
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
|
|
312 |
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
|
|
313 |
override = "error";
|
|
|
314 |
else
|
|
|
315 |
override = "property";
|
|
|
316 |
return "maybeprop";
|
|
|
317 |
}
|
|
|
318 |
return "restricted_atBlock";
|
|
|
319 |
};
|
|
|
320 |
|
|
|
321 |
states.keyframes = function(type, stream, state) {
|
|
|
322 |
if (type == "word") { override = "variable"; return "keyframes"; }
|
|
|
323 |
if (type == "{") return pushContext(state, stream, "top");
|
|
|
324 |
return pass(type, stream, state);
|
|
|
325 |
};
|
|
|
326 |
|
|
|
327 |
states.at = function(type, stream, state) {
|
|
|
328 |
if (type == ";") return popContext(state);
|
|
|
329 |
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
|
|
330 |
if (type == "word") override = "tag";
|
|
|
331 |
else if (type == "hash") override = "builtin";
|
|
|
332 |
return "at";
|
|
|
333 |
};
|
|
|
334 |
|
|
|
335 |
states.interpolation = function(type, stream, state) {
|
|
|
336 |
if (type == "}") return popContext(state);
|
|
|
337 |
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
|
|
338 |
if (type == "word") override = "variable";
|
|
|
339 |
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
|
|
340 |
return "interpolation";
|
|
|
341 |
};
|
|
|
342 |
|
|
|
343 |
return {
|
|
|
344 |
startState: function(base) {
|
|
|
345 |
return {tokenize: null,
|
|
|
346 |
state: parserConfig.inline ? "block" : "top",
|
|
|
347 |
stateArg: null,
|
|
|
348 |
context: new Context(parserConfig.inline ? "block" : "top", base || 0, null)};
|
|
|
349 |
},
|
|
|
350 |
|
|
|
351 |
token: function(stream, state) {
|
|
|
352 |
if (!state.tokenize && stream.eatSpace()) return null;
|
|
|
353 |
var style = (state.tokenize || tokenBase)(stream, state);
|
|
|
354 |
if (style && typeof style == "object") {
|
|
|
355 |
type = style[1];
|
|
|
356 |
style = style[0];
|
|
|
357 |
}
|
|
|
358 |
override = style;
|
|
|
359 |
state.state = states[state.state](type, stream, state);
|
|
|
360 |
return override;
|
|
|
361 |
},
|
|
|
362 |
|
|
|
363 |
indent: function(state, textAfter) {
|
|
|
364 |
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
|
|
365 |
var indent = cx.indent;
|
|
|
366 |
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
|
|
367 |
if (cx.prev &&
|
|
|
368 |
(ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") ||
|
|
|
369 |
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
|
|
370 |
ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) {
|
|
|
371 |
indent = cx.indent - indentUnit;
|
|
|
372 |
cx = cx.prev;
|
|
|
373 |
}
|
|
|
374 |
return indent;
|
|
|
375 |
},
|
|
|
376 |
|
|
|
377 |
electricChars: "}",
|
|
|
378 |
blockCommentStart: "/*",
|
|
|
379 |
blockCommentEnd: "*/",
|
|
|
380 |
fold: "brace"
|
|
|
381 |
};
|
|
|
382 |
});
|
|
|
383 |
|
|
|
384 |
function keySet(array) {
|
|
|
385 |
var keys = {};
|
|
|
386 |
for (var i = 0; i < array.length; ++i) {
|
|
|
387 |
keys[array[i]] = true;
|
|
|
388 |
}
|
|
|
389 |
return keys;
|
|
|
390 |
}
|
|
|
391 |
|
|
|
392 |
var documentTypes_ = [
|
|
|
393 |
"domain", "regexp", "url", "url-prefix"
|
|
|
394 |
], documentTypes = keySet(documentTypes_);
|
|
|
395 |
|
|
|
396 |
var mediaTypes_ = [
|
|
|
397 |
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
|
|
398 |
"tty", "tv", "embossed"
|
|
|
399 |
], mediaTypes = keySet(mediaTypes_);
|
|
|
400 |
|
|
|
401 |
var mediaFeatures_ = [
|
|
|
402 |
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
|
|
403 |
"device-width", "min-device-width", "max-device-width", "device-height",
|
|
|
404 |
"min-device-height", "max-device-height", "aspect-ratio",
|
|
|
405 |
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
|
|
406 |
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
|
|
407 |
"max-color", "color-index", "min-color-index", "max-color-index",
|
|
|
408 |
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
|
|
409 |
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
|
|
410 |
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
|
|
411 |
"pointer", "any-pointer", "hover", "any-hover"
|
|
|
412 |
], mediaFeatures = keySet(mediaFeatures_);
|
|
|
413 |
|
|
|
414 |
var mediaValueKeywords_ = [
|
|
|
415 |
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
|
|
416 |
"interlace", "progressive"
|
|
|
417 |
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
|
|
418 |
|
|
|
419 |
var propertyKeywords_ = [
|
|
|
420 |
"align-content", "align-items", "align-self", "alignment-adjust",
|
|
|
421 |
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
|
|
422 |
"animation-direction", "animation-duration", "animation-fill-mode",
|
|
|
423 |
"animation-iteration-count", "animation-name", "animation-play-state",
|
|
|
424 |
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
|
|
425 |
"background", "background-attachment", "background-clip", "background-color",
|
|
|
426 |
"background-image", "background-origin", "background-position",
|
|
|
427 |
"background-repeat", "background-size", "baseline-shift", "binding",
|
|
|
428 |
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
|
|
429 |
"bookmark-target", "border", "border-bottom", "border-bottom-color",
|
|
|
430 |
"border-bottom-left-radius", "border-bottom-right-radius",
|
|
|
431 |
"border-bottom-style", "border-bottom-width", "border-collapse",
|
|
|
432 |
"border-color", "border-image", "border-image-outset",
|
|
|
433 |
"border-image-repeat", "border-image-slice", "border-image-source",
|
|
|
434 |
"border-image-width", "border-left", "border-left-color",
|
|
|
435 |
"border-left-style", "border-left-width", "border-radius", "border-right",
|
|
|
436 |
"border-right-color", "border-right-style", "border-right-width",
|
|
|
437 |
"border-spacing", "border-style", "border-top", "border-top-color",
|
|
|
438 |
"border-top-left-radius", "border-top-right-radius", "border-top-style",
|
|
|
439 |
"border-top-width", "border-width", "bottom", "box-decoration-break",
|
|
|
440 |
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
|
|
441 |
"caption-side", "clear", "clip", "color", "color-profile", "column-count",
|
|
|
442 |
"column-fill", "column-gap", "column-rule", "column-rule-color",
|
|
|
443 |
"column-rule-style", "column-rule-width", "column-span", "column-width",
|
|
|
444 |
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
|
|
|
445 |
"cue-after", "cue-before", "cursor", "direction", "display",
|
|
|
446 |
"dominant-baseline", "drop-initial-after-adjust",
|
|
|
447 |
"drop-initial-after-align", "drop-initial-before-adjust",
|
|
|
448 |
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
|
|
449 |
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
|
|
450 |
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
|
|
451 |
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
|
|
452 |
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
|
|
453 |
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
|
|
454 |
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
|
|
455 |
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
|
|
456 |
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
|
|
457 |
"grid-auto-position", "grid-auto-rows", "grid-column", "grid-column-end",
|
|
|
458 |
"grid-column-start", "grid-row", "grid-row-end", "grid-row-start",
|
|
|
459 |
"grid-template", "grid-template-areas", "grid-template-columns",
|
|
|
460 |
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
|
|
461 |
"icon", "image-orientation", "image-rendering", "image-resolution",
|
|
|
462 |
"inline-box-align", "justify-content", "left", "letter-spacing",
|
|
|
463 |
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
|
|
464 |
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
|
|
465 |
"list-style-image", "list-style-position", "list-style-type", "margin",
|
|
|
466 |
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
|
|
467 |
"marker-offset", "marks", "marquee-direction", "marquee-loop",
|
|
|
468 |
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
|
|
469 |
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
|
|
470 |
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
|
|
471 |
"opacity", "order", "orphans", "outline",
|
|
|
472 |
"outline-color", "outline-offset", "outline-style", "outline-width",
|
|
|
473 |
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
|
|
474 |
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
|
|
475 |
"page", "page-break-after", "page-break-before", "page-break-inside",
|
|
|
476 |
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
|
|
477 |
"perspective-origin", "pitch", "pitch-range", "play-during", "position",
|
|
|
478 |
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
|
|
479 |
"region-break-before", "region-break-inside", "region-fragment",
|
|
|
480 |
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
|
|
481 |
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
|
|
482 |
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
|
|
483 |
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
|
|
484 |
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
|
|
485 |
"tab-size", "table-layout", "target", "target-name", "target-new",
|
|
|
486 |
"target-position", "text-align", "text-align-last", "text-decoration",
|
|
|
487 |
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
|
|
488 |
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
|
|
489 |
"text-emphasis-position", "text-emphasis-style", "text-height",
|
|
|
490 |
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
|
|
491 |
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
|
|
492 |
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
|
|
493 |
"transition", "transition-delay", "transition-duration",
|
|
|
494 |
"transition-property", "transition-timing-function", "unicode-bidi",
|
|
|
495 |
"vertical-align", "visibility", "voice-balance", "voice-duration",
|
|
|
496 |
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
|
|
497 |
"voice-volume", "volume", "white-space", "widows", "width", "word-break",
|
|
|
498 |
"word-spacing", "word-wrap", "z-index",
|
|
|
499 |
// SVG-specific
|
|
|
500 |
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
|
|
501 |
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
|
|
502 |
"color-interpolation", "color-interpolation-filters",
|
|
|
503 |
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
|
|
504 |
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
|
|
505 |
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
|
|
506 |
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
|
|
507 |
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
|
|
508 |
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
|
|
509 |
], propertyKeywords = keySet(propertyKeywords_);
|
|
|
510 |
|
|
|
511 |
var nonStandardPropertyKeywords_ = [
|
|
|
512 |
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
|
|
513 |
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
|
|
514 |
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
|
|
515 |
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
|
|
516 |
"searchfield-results-decoration", "zoom"
|
|
|
517 |
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
|
|
518 |
|
|
|
519 |
var fontProperties_ = [
|
|
|
520 |
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
|
|
521 |
"font-stretch", "font-weight", "font-style"
|
|
|
522 |
], fontProperties = keySet(fontProperties_);
|
|
|
523 |
|
|
|
524 |
var counterDescriptors_ = [
|
|
|
525 |
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
|
|
526 |
"speak-as", "suffix", "symbols", "system"
|
|
|
527 |
], counterDescriptors = keySet(counterDescriptors_);
|
|
|
528 |
|
|
|
529 |
var colorKeywords_ = [
|
|
|
530 |
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
|
|
|
531 |
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
|
|
|
532 |
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
|
|
|
533 |
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
|
|
|
534 |
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
|
|
535 |
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
|
|
536 |
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
|
|
537 |
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
|
|
538 |
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
|
|
539 |
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
|
|
540 |
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
|
|
541 |
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
|
|
542 |
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
|
|
543 |
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
|
|
544 |
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
|
|
|
545 |
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
|
|
|
546 |
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
|
|
547 |
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
|
|
548 |
"navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
|
|
|
549 |
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
|
|
550 |
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
|
|
551 |
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
|
|
|
552 |
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
|
|
|
553 |
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
|
|
|
554 |
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
|
|
555 |
"whitesmoke", "yellow", "yellowgreen"
|
|
|
556 |
], colorKeywords = keySet(colorKeywords_);
|
|
|
557 |
|
|
|
558 |
var valueKeywords_ = [
|
|
|
559 |
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
|
|
560 |
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
|
|
561 |
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
|
|
562 |
"arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page",
|
|
|
563 |
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
|
|
564 |
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
|
|
565 |
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
|
|
566 |
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
|
|
567 |
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
|
|
568 |
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
|
|
569 |
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
|
|
570 |
"col-resize", "collapse", "column", "column-reverse", "compact", "condensed", "contain", "content",
|
|
|
571 |
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
|
|
572 |
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
|
|
|
573 |
"decimal-leading-zero", "default", "default-button", "destination-atop",
|
|
|
574 |
"destination-in", "destination-out", "destination-over", "devanagari",
|
|
|
575 |
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
|
|
576 |
"dot-dash", "dot-dot-dash",
|
|
|
577 |
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
|
|
578 |
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
|
|
579 |
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
|
|
580 |
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
|
|
581 |
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
|
|
582 |
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
|
|
583 |
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
|
|
584 |
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
|
|
585 |
"ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
|
|
|
586 |
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
|
|
587 |
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
|
|
|
588 |
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
|
|
|
589 |
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
|
|
590 |
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
|
|
|
591 |
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
|
|
592 |
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
|
|
593 |
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
|
|
|
594 |
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
|
|
595 |
"katakana", "katakana-iroha", "keep-all", "khmer",
|
|
|
596 |
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
|
|
597 |
"landscape", "lao", "large", "larger", "left", "level", "lighter",
|
|
|
598 |
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
|
|
599 |
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
|
|
600 |
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
|
|
601 |
"lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
|
|
|
602 |
"media-controls-background", "media-current-time-display",
|
|
|
603 |
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
|
|
604 |
"media-return-to-realtime-button", "media-rewind-button",
|
|
|
605 |
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
|
|
606 |
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
|
|
607 |
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
|
|
608 |
"menu", "menulist", "menulist-button", "menulist-text",
|
|
|
609 |
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
|
|
610 |
"mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
|
|
|
611 |
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
|
|
612 |
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
|
|
613 |
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
|
|
|
614 |
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
|
|
615 |
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
|
|
616 |
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
|
|
617 |
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
|
|
618 |
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
|
|
619 |
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
|
|
620 |
"relative", "repeat", "repeating-linear-gradient",
|
|
|
621 |
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
|
|
622 |
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
|
|
623 |
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
|
|
|
624 |
"s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
|
|
|
625 |
"scroll", "scrollbar", "se-resize", "searchfield",
|
|
|
626 |
"searchfield-cancel-button", "searchfield-decoration",
|
|
|
627 |
"searchfield-results-button", "searchfield-results-decoration",
|
|
|
628 |
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
|
|
629 |
"simp-chinese-formal", "simp-chinese-informal", "single",
|
|
|
630 |
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
|
|
631 |
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
|
|
632 |
"small", "small-caps", "small-caption", "smaller", "solid", "somali",
|
|
|
633 |
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
|
|
|
634 |
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
|
|
635 |
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
|
|
|
636 |
"table-caption", "table-cell", "table-column", "table-column-group",
|
|
|
637 |
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
|
|
638 |
"tamil",
|
|
|
639 |
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
|
|
640 |
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
|
|
641 |
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
|
|
642 |
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
|
|
643 |
"trad-chinese-formal", "trad-chinese-informal",
|
|
|
644 |
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
|
|
645 |
"transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
|
|
|
646 |
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
|
|
647 |
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
|
|
648 |
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
|
|
649 |
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
|
|
650 |
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
|
|
|
651 |
"xx-large", "xx-small"
|
|
|
652 |
], valueKeywords = keySet(valueKeywords_);
|
|
|
653 |
|
|
|
654 |
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
|
|
|
655 |
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
|
|
|
656 |
.concat(valueKeywords_);
|
|
|
657 |
CodeMirror.registerHelper("hintWords", "css", allWords);
|
|
|
658 |
|
|
|
659 |
function tokenCComment(stream, state) {
|
|
|
660 |
var maybeEnd = false, ch;
|
|
|
661 |
while ((ch = stream.next()) != null) {
|
|
|
662 |
if (maybeEnd && ch == "/") {
|
|
|
663 |
state.tokenize = null;
|
|
|
664 |
break;
|
|
|
665 |
}
|
|
|
666 |
maybeEnd = (ch == "*");
|
|
|
667 |
}
|
|
|
668 |
return ["comment", "comment"];
|
|
|
669 |
}
|
|
|
670 |
|
|
|
671 |
CodeMirror.defineMIME("text/css", {
|
|
|
672 |
documentTypes: documentTypes,
|
|
|
673 |
mediaTypes: mediaTypes,
|
|
|
674 |
mediaFeatures: mediaFeatures,
|
|
|
675 |
mediaValueKeywords: mediaValueKeywords,
|
|
|
676 |
propertyKeywords: propertyKeywords,
|
|
|
677 |
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
678 |
fontProperties: fontProperties,
|
|
|
679 |
counterDescriptors: counterDescriptors,
|
|
|
680 |
colorKeywords: colorKeywords,
|
|
|
681 |
valueKeywords: valueKeywords,
|
|
|
682 |
tokenHooks: {
|
|
|
683 |
"/": function(stream, state) {
|
|
|
684 |
if (!stream.eat("*")) return false;
|
|
|
685 |
state.tokenize = tokenCComment;
|
|
|
686 |
return tokenCComment(stream, state);
|
|
|
687 |
}
|
|
|
688 |
},
|
|
|
689 |
name: "css"
|
|
|
690 |
});
|
|
|
691 |
|
|
|
692 |
CodeMirror.defineMIME("text/x-scss", {
|
|
|
693 |
mediaTypes: mediaTypes,
|
|
|
694 |
mediaFeatures: mediaFeatures,
|
|
|
695 |
mediaValueKeywords: mediaValueKeywords,
|
|
|
696 |
propertyKeywords: propertyKeywords,
|
|
|
697 |
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
698 |
colorKeywords: colorKeywords,
|
|
|
699 |
valueKeywords: valueKeywords,
|
|
|
700 |
fontProperties: fontProperties,
|
|
|
701 |
allowNested: true,
|
|
|
702 |
tokenHooks: {
|
|
|
703 |
"/": function(stream, state) {
|
|
|
704 |
if (stream.eat("/")) {
|
|
|
705 |
stream.skipToEnd();
|
|
|
706 |
return ["comment", "comment"];
|
|
|
707 |
} else if (stream.eat("*")) {
|
|
|
708 |
state.tokenize = tokenCComment;
|
|
|
709 |
return tokenCComment(stream, state);
|
|
|
710 |
} else {
|
|
|
711 |
return ["operator", "operator"];
|
|
|
712 |
}
|
|
|
713 |
},
|
|
|
714 |
":": function(stream) {
|
|
|
715 |
if (stream.match(/\s*\{/))
|
|
|
716 |
return [null, "{"];
|
|
|
717 |
return false;
|
|
|
718 |
},
|
|
|
719 |
"$": function(stream) {
|
|
|
720 |
stream.match(/^[\w-]+/);
|
|
|
721 |
if (stream.match(/^\s*:/, false))
|
|
|
722 |
return ["variable-2", "variable-definition"];
|
|
|
723 |
return ["variable-2", "variable"];
|
|
|
724 |
},
|
|
|
725 |
"#": function(stream) {
|
|
|
726 |
if (!stream.eat("{")) return false;
|
|
|
727 |
return [null, "interpolation"];
|
|
|
728 |
}
|
|
|
729 |
},
|
|
|
730 |
name: "css",
|
|
|
731 |
helperType: "scss"
|
|
|
732 |
});
|
|
|
733 |
|
|
|
734 |
CodeMirror.defineMIME("text/x-less", {
|
|
|
735 |
mediaTypes: mediaTypes,
|
|
|
736 |
mediaFeatures: mediaFeatures,
|
|
|
737 |
mediaValueKeywords: mediaValueKeywords,
|
|
|
738 |
propertyKeywords: propertyKeywords,
|
|
|
739 |
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
740 |
colorKeywords: colorKeywords,
|
|
|
741 |
valueKeywords: valueKeywords,
|
|
|
742 |
fontProperties: fontProperties,
|
|
|
743 |
allowNested: true,
|
|
|
744 |
tokenHooks: {
|
|
|
745 |
"/": function(stream, state) {
|
|
|
746 |
if (stream.eat("/")) {
|
|
|
747 |
stream.skipToEnd();
|
|
|
748 |
return ["comment", "comment"];
|
|
|
749 |
} else if (stream.eat("*")) {
|
|
|
750 |
state.tokenize = tokenCComment;
|
|
|
751 |
return tokenCComment(stream, state);
|
|
|
752 |
} else {
|
|
|
753 |
return ["operator", "operator"];
|
|
|
754 |
}
|
|
|
755 |
},
|
|
|
756 |
"@": function(stream) {
|
|
|
757 |
if (stream.eat("{")) return [null, "interpolation"];
|
|
|
758 |
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
|
|
759 |
stream.eatWhile(/[\w\\\-]/);
|
|
|
760 |
if (stream.match(/^\s*:/, false))
|
|
|
761 |
return ["variable-2", "variable-definition"];
|
|
|
762 |
return ["variable-2", "variable"];
|
|
|
763 |
},
|
|
|
764 |
"&": function() {
|
|
|
765 |
return ["atom", "atom"];
|
|
|
766 |
}
|
|
|
767 |
},
|
|
|
768 |
name: "css",
|
|
|
769 |
helperType: "less"
|
|
|
770 |
});
|
|
|
771 |
|
|
|
772 |
});
|