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