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