1 CodeMirror.defineMode("css", function(config) {
2 return CodeMirror.getMode(config, "text/css");
5 CodeMirror.defineMode("css-base", function(config, parserConfig) {
8 var indentUnit = config.indentUnit,
9 hooks = parserConfig.hooks || {},
10 atMediaTypes = parserConfig.atMediaTypes || {},
11 atMediaFeatures = parserConfig.atMediaFeatures || {},
12 propertyKeywords = parserConfig.propertyKeywords || {},
13 colorKeywords = parserConfig.colorKeywords || {},
14 valueKeywords = parserConfig.valueKeywords || {},
15 allowNested = !!parserConfig.allowNested,
18 function ret(style, tp) { type = tp; return style; }
20 function tokenBase(stream, state) {
21 var ch = stream.next();
23 // result[0] is style and result[1] is type
24 var result = hooks[ch](stream, state);
25 if (result !== false) return result;
27 if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current());}
28 else if (ch == "=") ret(null, "compare");
29 else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
30 else if (ch == "\"" || ch == "'") {
31 state.tokenize = tokenString(ch);
32 return state.tokenize(stream, state);
35 stream.eatWhile(/[\w\\\-]/);
36 return ret("atom", "hash");
39 stream.match(/^\s*\w*/);
40 return ret("keyword", "important");
42 else if (/\d/.test(ch)) {
43 stream.eatWhile(/[\w.%]/);
44 return ret("number", "unit");
46 else if (ch === "-") {
47 if (/\d/.test(stream.peek())) {
48 stream.eatWhile(/[\w.%]/);
49 return ret("number", "unit");
50 } else if (stream.match(/^[^-]+-/)) {
51 return ret("meta", "meta");
54 else if (/[,+>*\/]/.test(ch)) {
55 return ret(null, "select-op");
57 else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
58 return ret("qualifier", "qualifier");
61 return ret("operator", ch);
63 else if (/[;{}\[\]\(\)]/.test(ch)) {
66 else if (ch == "u" && stream.match("rl(")) {
68 state.tokenize = tokenParenthesized;
69 return ret("property", "variable");
72 stream.eatWhile(/[\w\\\-]/);
73 return ret("property", "variable");
77 function tokenString(quote, nonInclusive) {
78 return function(stream, state) {
79 var escaped = false, ch;
80 while ((ch = stream.next()) != null) {
81 if (ch == quote && !escaped)
83 escaped = !escaped && ch == "\\";
86 if (nonInclusive) stream.backUp(1);
87 state.tokenize = tokenBase;
89 return ret("string", "string");
93 function tokenParenthesized(stream, state) {
94 stream.next(); // Must be '('
95 if (!stream.match(/\s*[\"\']/, false))
96 state.tokenize = tokenString(")", true);
98 state.tokenize = tokenBase;
99 return ret(null, "(");
103 startState: function(base) {
104 return {tokenize: tokenBase,
105 baseIndent: base || 0,
110 token: function(stream, state) {
112 // Use these terms when applicable (see http://www.xanthir.com/blog/b4E50)
114 // rule** or **ruleset:
115 // A selector + braces combo, or an at-rule.
117 // declaration block:
118 // A sequence of declarations.
121 // A property + colon + value combo.
124 // The entire value of a property.
127 // A single piece of a property value. Like the 5px in
128 // text-shadow: 0 0 5px blue;. Can also refer to things that are
129 // multiple terms, like the 1-4 terms that make up the background-size
130 // portion of the background shorthand.
133 // The basic unit of author-facing CSS, like a single number (5),
134 // dimension (5px), string ("foo"), or function. Officially defined
135 // by the CSS 2.1 grammar (look for the 'term' production)
139 // A single atomic selector, like a type selector, an attr selector, a
140 // class selector, etc.
142 // compound selector:
143 // One or more simple selectors without a combinator. div.example is
144 // compound, div > .example is not.
147 // One or more compound selectors chained with combinators.
150 // The parts of selectors that express relationships. There are four
151 // currently - the space (descendant combinator), the greater-than
152 // bracket (child combinator), the plus sign (next sibling combinator),
153 // and the tilda (following sibling combinator).
155 // sequence of selectors:
156 // One or more of the named type of selector chained with commas.
158 state.tokenize = state.tokenize || tokenBase;
159 if (state.tokenize == tokenBase && stream.eatSpace()) return null;
160 var style = state.tokenize(stream, state);
161 if (style && typeof style != "string") style = ret(style[0], style[1]);
163 // Changing style returned based on context
164 var context = state.stack[state.stack.length-1];
165 if (style == "variable") {
166 if (type == "variable-definition") state.stack.push("propertyValue");
167 return state.lastToken = "variable-2";
168 } else if (style == "property") {
169 var word = stream.current().toLowerCase();
170 if (context == "propertyValue") {
171 if (valueKeywords.hasOwnProperty(word)) {
173 } else if (colorKeywords.hasOwnProperty(word)) {
176 style = "variable-2";
178 } else if (context == "rule") {
179 if (!propertyKeywords.hasOwnProperty(word)) {
182 } else if (context == "block") {
183 // if a value is present in both property, value, or color, the order
184 // of preference is property -> color -> value
185 if (propertyKeywords.hasOwnProperty(word)) {
187 } else if (colorKeywords.hasOwnProperty(word)) {
189 } else if (valueKeywords.hasOwnProperty(word)) {
194 } else if (!context || context == "@media{") {
196 } else if (context == "@media") {
197 if (atMediaTypes[stream.current()]) {
198 style = "attribute"; // Known attribute
199 } else if (/^(only|not)$/.test(word)) {
201 } else if (word == "and") {
202 style = "error"; // "and" is only allowed in @mediaType
203 } else if (atMediaFeatures.hasOwnProperty(word)) {
204 style = "error"; // Known property, should be in @mediaType(
206 // Unknown, expecting keyword or attribute, assuming attribute
207 style = "attribute error";
209 } else if (context == "@mediaType") {
210 if (atMediaTypes.hasOwnProperty(word)) {
212 } else if (word == "and") {
214 } else if (/^(only|not)$/.test(word)) {
215 style = "error"; // Only allowed in @media
217 // Unknown attribute or property, but expecting property (preceded
218 // by "and"). Should be in parentheses
221 } else if (context == "@mediaType(") {
222 if (propertyKeywords.hasOwnProperty(word)) {
223 // do nothing, remains "property"
224 } else if (atMediaTypes.hasOwnProperty(word)) {
225 style = "error"; // Known property, should be in parentheses
226 } else if (word == "and") {
228 } else if (/^(only|not)$/.test(word)) {
229 style = "error"; // Only allowed in @media
233 } else if (context == "@import") {
238 } else if (style == "atom") {
239 if(!context || context == "@media{" || context == "block") {
241 } else if (context == "propertyValue") {
242 if (!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
248 } else if (context == "@media" && type == "{") {
252 // Push/pop context stack
254 if (context == "@media" || context == "@mediaType") {
255 state.stack[state.stack.length-1] = "@media{";
258 var newContext = allowNested ? "block" : "rule";
259 state.stack.push(newContext);
262 else if (type == "}") {
263 if (context == "interpolation") style = "operator";
265 if (context == "propertyValue") state.stack.pop();
267 else if (type == "interpolation") state.stack.push("interpolation");
268 else if (type == "@media") state.stack.push("@media");
269 else if (type == "@import") state.stack.push("@import");
270 else if (context == "@media" && /\b(keyword|attribute)\b/.test(style))
271 state.stack[state.stack.length-1] = "@mediaType";
272 else if (context == "@mediaType" && stream.current() == ",")
273 state.stack[state.stack.length-1] = "@media";
274 else if (type == "(") {
275 if (context == "@media" || context == "@mediaType") {
276 // Make sure @mediaType is used to avoid error on {
277 state.stack[state.stack.length-1] = "@mediaType";
278 state.stack.push("@mediaType(");
281 else if (type == ")") {
282 if (context == "propertyValue" && state.stack[state.stack.length-2] == "@mediaType(") {
283 // In @mediaType( without closing ; after propertyValue
287 else if (context == "@mediaType(") {
291 else if (type == ":" && state.lastToken == "property") state.stack.push("propertyValue");
292 else if (context == "propertyValue" && type == ";") state.stack.pop();
293 else if (context == "@import" && type == ";") state.stack.pop();
295 return state.lastToken = style;
298 indent: function(state, textAfter) {
299 var n = state.stack.length;
300 if (/^\}/.test(textAfter))
301 n -= state.stack[n-1] == "propertyValue" ? 2 : 1;
302 return state.baseIndent + n * indentUnit;
306 blockCommentStart: "/*",
307 blockCommentEnd: "*/",
313 function keySet(array) {
315 for (var i = 0; i < array.length; ++i) {
316 keys[array[i]] = true;
321 var atMediaTypes = keySet([
322 "all", "aural", "braille", "handheld", "print", "projection", "screen",
323 "tty", "tv", "embossed"
326 var atMediaFeatures = keySet([
327 "width", "min-width", "max-width", "height", "min-height", "max-height",
328 "device-width", "min-device-width", "max-device-width", "device-height",
329 "min-device-height", "max-device-height", "aspect-ratio",
330 "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
331 "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
332 "max-color", "color-index", "min-color-index", "max-color-index",
333 "monochrome", "min-monochrome", "max-monochrome", "resolution",
334 "min-resolution", "max-resolution", "scan", "grid"
337 var propertyKeywords = keySet([
338 "align-content", "align-items", "align-self", "alignment-adjust",
339 "alignment-baseline", "anchor-point", "animation", "animation-delay",
340 "animation-direction", "animation-duration", "animation-iteration-count",
341 "animation-name", "animation-play-state", "animation-timing-function",
342 "appearance", "azimuth", "backface-visibility", "background",
343 "background-attachment", "background-clip", "background-color",
344 "background-image", "background-origin", "background-position",
345 "background-repeat", "background-size", "baseline-shift", "binding",
346 "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
347 "bookmark-target", "border", "border-bottom", "border-bottom-color",
348 "border-bottom-left-radius", "border-bottom-right-radius",
349 "border-bottom-style", "border-bottom-width", "border-collapse",
350 "border-color", "border-image", "border-image-outset",
351 "border-image-repeat", "border-image-slice", "border-image-source",
352 "border-image-width", "border-left", "border-left-color",
353 "border-left-style", "border-left-width", "border-radius", "border-right",
354 "border-right-color", "border-right-style", "border-right-width",
355 "border-spacing", "border-style", "border-top", "border-top-color",
356 "border-top-left-radius", "border-top-right-radius", "border-top-style",
357 "border-top-width", "border-width", "bottom", "box-decoration-break",
358 "box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
359 "caption-side", "clear", "clip", "color", "color-profile", "column-count",
360 "column-fill", "column-gap", "column-rule", "column-rule-color",
361 "column-rule-style", "column-rule-width", "column-span", "column-width",
362 "columns", "content", "counter-increment", "counter-reset", "crop", "cue",
363 "cue-after", "cue-before", "cursor", "direction", "display",
364 "dominant-baseline", "drop-initial-after-adjust",
365 "drop-initial-after-align", "drop-initial-before-adjust",
366 "drop-initial-before-align", "drop-initial-size", "drop-initial-value",
367 "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
368 "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
369 "float", "float-offset", "font", "font-feature-settings", "font-family",
370 "font-kerning", "font-language-override", "font-size", "font-size-adjust",
371 "font-stretch", "font-style", "font-synthesis", "font-variant",
372 "font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
373 "font-variant-ligatures", "font-variant-numeric", "font-variant-position",
374 "font-weight", "grid-cell", "grid-column", "grid-column-align",
375 "grid-column-sizing", "grid-column-span", "grid-columns", "grid-flow",
376 "grid-row", "grid-row-align", "grid-row-sizing", "grid-row-span",
377 "grid-rows", "grid-template", "hanging-punctuation", "height", "hyphens",
378 "icon", "image-orientation", "image-rendering", "image-resolution",
379 "inline-box-align", "justify-content", "left", "letter-spacing",
380 "line-break", "line-height", "line-stacking", "line-stacking-ruby",
381 "line-stacking-shift", "line-stacking-strategy", "list-style",
382 "list-style-image", "list-style-position", "list-style-type", "margin",
383 "margin-bottom", "margin-left", "margin-right", "margin-top",
384 "marker-offset", "marks", "marquee-direction", "marquee-loop",
385 "marquee-play-count", "marquee-speed", "marquee-style", "max-height",
386 "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
387 "nav-left", "nav-right", "nav-up", "opacity", "order", "orphans", "outline",
388 "outline-color", "outline-offset", "outline-style", "outline-width",
389 "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
390 "padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
391 "page", "page-break-after", "page-break-before", "page-break-inside",
392 "page-policy", "pause", "pause-after", "pause-before", "perspective",
393 "perspective-origin", "pitch", "pitch-range", "play-during", "position",
394 "presentation-level", "punctuation-trim", "quotes", "rendering-intent",
395 "resize", "rest", "rest-after", "rest-before", "richness", "right",
396 "rotation", "rotation-point", "ruby-align", "ruby-overhang",
397 "ruby-position", "ruby-span", "size", "speak", "speak-as", "speak-header",
398 "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
399 "tab-size", "table-layout", "target", "target-name", "target-new",
400 "target-position", "text-align", "text-align-last", "text-decoration",
401 "text-decoration-color", "text-decoration-line", "text-decoration-skip",
402 "text-decoration-style", "text-emphasis", "text-emphasis-color",
403 "text-emphasis-position", "text-emphasis-style", "text-height",
404 "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
405 "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
406 "text-wrap", "top", "transform", "transform-origin", "transform-style",
407 "transition", "transition-delay", "transition-duration",
408 "transition-property", "transition-timing-function", "unicode-bidi",
409 "vertical-align", "visibility", "voice-balance", "voice-duration",
410 "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
411 "voice-volume", "volume", "white-space", "widows", "width", "word-break",
412 "word-spacing", "word-wrap", "z-index", "zoom",
414 "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
415 "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
416 "color-interpolation", "color-interpolation-filters", "color-profile",
417 "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
418 "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
419 "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
420 "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
421 "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
422 "glyph-orientation-vertical", "kerning", "text-anchor", "writing-mode"
425 var colorKeywords = keySet([
426 "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
427 "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
428 "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
429 "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
430 "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
431 "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
432 "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
433 "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
434 "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
435 "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew",
436 "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
437 "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
438 "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
439 "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
440 "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
441 "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
442 "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
443 "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
444 "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
445 "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
446 "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
447 "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon",
448 "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
449 "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
450 "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
451 "whitesmoke", "yellow", "yellowgreen"
454 var valueKeywords = keySet([
455 "above", "absolute", "activeborder", "activecaption", "afar",
456 "after-white-space", "ahead", "alias", "all", "all-scroll", "alternate",
457 "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
458 "arabic-indic", "armenian", "asterisks", "auto", "avoid", "background",
459 "backwards", "baseline", "below", "bidi-override", "binary", "bengali",
460 "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
461 "both", "bottom", "break-all", "break-word", "button", "button-bevel",
462 "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian",
463 "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
464 "cell", "center", "checkbox", "circle", "cjk-earthly-branch",
465 "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
466 "col-resize", "collapse", "compact", "condensed", "contain", "content",
467 "content-box", "context-menu", "continuous", "copy", "cover", "crop",
468 "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal",
469 "decimal-leading-zero", "default", "default-button", "destination-atop",
470 "destination-in", "destination-out", "destination-over", "devanagari",
471 "disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted",
472 "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
473 "element", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
474 "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
475 "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
476 "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
477 "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
478 "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
479 "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et",
480 "ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed",
481 "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes",
482 "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
483 "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
484 "help", "hidden", "hide", "higher", "highlight", "highlighttext",
485 "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
486 "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
487 "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
488 "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert",
489 "italic", "justify", "kannada", "katakana", "katakana-iroha", "khmer",
490 "landscape", "lao", "large", "larger", "left", "level", "lighter",
491 "line-through", "linear", "lines", "list-item", "listbox", "listitem",
492 "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
493 "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
494 "lower-roman", "lowercase", "ltr", "malayalam", "match",
495 "media-controls-background", "media-current-time-display",
496 "media-fullscreen-button", "media-mute-button", "media-play-button",
497 "media-return-to-realtime-button", "media-rewind-button",
498 "media-seek-back-button", "media-seek-forward-button", "media-slider",
499 "media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
500 "media-volume-slider-container", "media-volume-sliderthumb", "medium",
501 "menu", "menulist", "menulist-button", "menulist-text",
502 "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
503 "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
504 "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
505 "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
506 "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
507 "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
508 "outside", "overlay", "overline", "padding", "padding-box", "painted",
509 "paused", "persian", "plus-darker", "plus-lighter", "pointer", "portrait",
510 "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button",
511 "radio", "read-only", "read-write", "read-write-plaintext-only", "relative",
512 "repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba",
513 "ridge", "right", "round", "row-resize", "rtl", "run-in", "running",
514 "s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield",
515 "searchfield-cancel-button", "searchfield-decoration",
516 "searchfield-results-button", "searchfield-results-decoration",
517 "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
518 "single", "skip-white-space", "slide", "slider-horizontal",
519 "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
520 "small", "small-caps", "small-caption", "smaller", "solid", "somali",
521 "source-atop", "source-in", "source-out", "source-over", "space", "square",
522 "square-button", "start", "static", "status-bar", "stretch", "stroke",
523 "sub", "subpixel-antialiased", "super", "sw-resize", "table",
524 "table-caption", "table-cell", "table-column", "table-column-group",
525 "table-footer-group", "table-header-group", "table-row", "table-row-group",
526 "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
527 "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
528 "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
529 "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
530 "transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
531 "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
532 "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
533 "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
534 "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
535 "window", "windowframe", "windowtext", "x-large", "x-small", "xor",
536 "xx-large", "xx-small"
539 function tokenCComment(stream, state) {
540 var maybeEnd = false, ch;
541 while ((ch = stream.next()) != null) {
542 if (maybeEnd && ch == "/") {
543 state.tokenize = null;
546 maybeEnd = (ch == "*");
548 return ["comment", "comment"];
551 CodeMirror.defineMIME("text/css", {
552 atMediaTypes: atMediaTypes,
553 atMediaFeatures: atMediaFeatures,
554 propertyKeywords: propertyKeywords,
555 colorKeywords: colorKeywords,
556 valueKeywords: valueKeywords,
558 "<": function(stream, state) {
559 function tokenSGMLComment(stream, state) {
561 while ((ch = stream.next()) != null) {
562 if (dashes >= 2 && ch == ">") {
563 state.tokenize = null;
566 dashes = (ch == "-") ? dashes + 1 : 0;
568 return ["comment", "comment"];
570 if (stream.eat("!")) {
571 state.tokenize = tokenSGMLComment;
572 return tokenSGMLComment(stream, state);
575 "/": function(stream, state) {
576 if (stream.eat("*")) {
577 state.tokenize = tokenCComment;
578 return tokenCComment(stream, state);
586 CodeMirror.defineMIME("text/x-scss", {
587 atMediaTypes: atMediaTypes,
588 atMediaFeatures: atMediaFeatures,
589 propertyKeywords: propertyKeywords,
590 colorKeywords: colorKeywords,
591 valueKeywords: valueKeywords,
594 "$": function(stream) {
595 stream.match(/^[\w-]+/);
596 if (stream.peek() == ":") {
597 return ["variable", "variable-definition"];
599 return ["variable", "variable"];
601 "/": function(stream, state) {
602 if (stream.eat("/")) {
604 return ["comment", "comment"];
605 } else if (stream.eat("*")) {
606 state.tokenize = tokenCComment;
607 return tokenCComment(stream, state);
609 return ["operator", "operator"];
612 "#": function(stream) {
613 if (stream.eat("{")) {
614 return ["operator", "interpolation"];
616 stream.eatWhile(/[\w\\\-]/);
617 return ["atom", "hash"];