]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/less.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / less.js
1 /*! `less` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 const MODES = (hljs) => {
6 return {
7 IMPORTANT: {
8 scope: 'meta',
9 begin: '!important'
10 },
11 BLOCK_COMMENT: hljs.C_BLOCK_COMMENT_MODE,
12 HEXCOLOR: {
13 scope: 'number',
14 begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
15 },
16 FUNCTION_DISPATCH: {
17 className: "built_in",
18 begin: /[\w-]+(?=\()/
19 },
20 ATTRIBUTE_SELECTOR_MODE: {
21 scope: 'selector-attr',
22 begin: /\[/,
23 end: /\]/,
24 illegal: '$',
25 contains: [
26 hljs.APOS_STRING_MODE,
27 hljs.QUOTE_STRING_MODE
28 ]
29 },
30 CSS_NUMBER_MODE: {
31 scope: 'number',
32 begin: hljs.NUMBER_RE + '(' +
33 '%|em|ex|ch|rem' +
34 '|vw|vh|vmin|vmax' +
35 '|cm|mm|in|pt|pc|px' +
36 '|deg|grad|rad|turn' +
37 '|s|ms' +
38 '|Hz|kHz' +
39 '|dpi|dpcm|dppx' +
40 ')?',
41 relevance: 0
42 },
43 CSS_VARIABLE: {
44 className: "attr",
45 begin: /--[A-Za-z_][A-Za-z0-9_-]*/
46 }
47 };
48 };
49
50 const HTML_TAGS = [
51 'a',
52 'abbr',
53 'address',
54 'article',
55 'aside',
56 'audio',
57 'b',
58 'blockquote',
59 'body',
60 'button',
61 'canvas',
62 'caption',
63 'cite',
64 'code',
65 'dd',
66 'del',
67 'details',
68 'dfn',
69 'div',
70 'dl',
71 'dt',
72 'em',
73 'fieldset',
74 'figcaption',
75 'figure',
76 'footer',
77 'form',
78 'h1',
79 'h2',
80 'h3',
81 'h4',
82 'h5',
83 'h6',
84 'header',
85 'hgroup',
86 'html',
87 'i',
88 'iframe',
89 'img',
90 'input',
91 'ins',
92 'kbd',
93 'label',
94 'legend',
95 'li',
96 'main',
97 'mark',
98 'menu',
99 'nav',
100 'object',
101 'ol',
102 'optgroup',
103 'option',
104 'p',
105 'picture',
106 'q',
107 'quote',
108 'samp',
109 'section',
110 'select',
111 'source',
112 'span',
113 'strong',
114 'summary',
115 'sup',
116 'table',
117 'tbody',
118 'td',
119 'textarea',
120 'tfoot',
121 'th',
122 'thead',
123 'time',
124 'tr',
125 'ul',
126 'var',
127 'video'
128 ];
129
130 const SVG_TAGS = [
131 'defs',
132 'g',
133 'marker',
134 'mask',
135 'pattern',
136 'svg',
137 'switch',
138 'symbol',
139 'feBlend',
140 'feColorMatrix',
141 'feComponentTransfer',
142 'feComposite',
143 'feConvolveMatrix',
144 'feDiffuseLighting',
145 'feDisplacementMap',
146 'feFlood',
147 'feGaussianBlur',
148 'feImage',
149 'feMerge',
150 'feMorphology',
151 'feOffset',
152 'feSpecularLighting',
153 'feTile',
154 'feTurbulence',
155 'linearGradient',
156 'radialGradient',
157 'stop',
158 'circle',
159 'ellipse',
160 'image',
161 'line',
162 'path',
163 'polygon',
164 'polyline',
165 'rect',
166 'text',
167 'use',
168 'textPath',
169 'tspan',
170 'foreignObject',
171 'clipPath'
172 ];
173
174 const TAGS = [
175 ...HTML_TAGS,
176 ...SVG_TAGS,
177 ];
178
179 // Sorting, then reversing makes sure longer attributes/elements like
180 // `font-weight` are matched fully instead of getting false positives on say `font`
181
182 const MEDIA_FEATURES = [
183 'any-hover',
184 'any-pointer',
185 'aspect-ratio',
186 'color',
187 'color-gamut',
188 'color-index',
189 'device-aspect-ratio',
190 'device-height',
191 'device-width',
192 'display-mode',
193 'forced-colors',
194 'grid',
195 'height',
196 'hover',
197 'inverted-colors',
198 'monochrome',
199 'orientation',
200 'overflow-block',
201 'overflow-inline',
202 'pointer',
203 'prefers-color-scheme',
204 'prefers-contrast',
205 'prefers-reduced-motion',
206 'prefers-reduced-transparency',
207 'resolution',
208 'scan',
209 'scripting',
210 'update',
211 'width',
212 // TODO: find a better solution?
213 'min-width',
214 'max-width',
215 'min-height',
216 'max-height'
217 ].sort().reverse();
218
219 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
220 const PSEUDO_CLASSES = [
221 'active',
222 'any-link',
223 'blank',
224 'checked',
225 'current',
226 'default',
227 'defined',
228 'dir', // dir()
229 'disabled',
230 'drop',
231 'empty',
232 'enabled',
233 'first',
234 'first-child',
235 'first-of-type',
236 'fullscreen',
237 'future',
238 'focus',
239 'focus-visible',
240 'focus-within',
241 'has', // has()
242 'host', // host or host()
243 'host-context', // host-context()
244 'hover',
245 'indeterminate',
246 'in-range',
247 'invalid',
248 'is', // is()
249 'lang', // lang()
250 'last-child',
251 'last-of-type',
252 'left',
253 'link',
254 'local-link',
255 'not', // not()
256 'nth-child', // nth-child()
257 'nth-col', // nth-col()
258 'nth-last-child', // nth-last-child()
259 'nth-last-col', // nth-last-col()
260 'nth-last-of-type', //nth-last-of-type()
261 'nth-of-type', //nth-of-type()
262 'only-child',
263 'only-of-type',
264 'optional',
265 'out-of-range',
266 'past',
267 'placeholder-shown',
268 'read-only',
269 'read-write',
270 'required',
271 'right',
272 'root',
273 'scope',
274 'target',
275 'target-within',
276 'user-invalid',
277 'valid',
278 'visited',
279 'where' // where()
280 ].sort().reverse();
281
282 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
283 const PSEUDO_ELEMENTS = [
284 'after',
285 'backdrop',
286 'before',
287 'cue',
288 'cue-region',
289 'first-letter',
290 'first-line',
291 'grammar-error',
292 'marker',
293 'part',
294 'placeholder',
295 'selection',
296 'slotted',
297 'spelling-error'
298 ].sort().reverse();
299
300 const ATTRIBUTES = [
301 'accent-color',
302 'align-content',
303 'align-items',
304 'align-self',
305 'alignment-baseline',
306 'all',
307 'anchor-name',
308 'animation',
309 'animation-composition',
310 'animation-delay',
311 'animation-direction',
312 'animation-duration',
313 'animation-fill-mode',
314 'animation-iteration-count',
315 'animation-name',
316 'animation-play-state',
317 'animation-range',
318 'animation-range-end',
319 'animation-range-start',
320 'animation-timeline',
321 'animation-timing-function',
322 'appearance',
323 'aspect-ratio',
324 'backdrop-filter',
325 'backface-visibility',
326 'background',
327 'background-attachment',
328 'background-blend-mode',
329 'background-clip',
330 'background-color',
331 'background-image',
332 'background-origin',
333 'background-position',
334 'background-position-x',
335 'background-position-y',
336 'background-repeat',
337 'background-size',
338 'baseline-shift',
339 'block-size',
340 'border',
341 'border-block',
342 'border-block-color',
343 'border-block-end',
344 'border-block-end-color',
345 'border-block-end-style',
346 'border-block-end-width',
347 'border-block-start',
348 'border-block-start-color',
349 'border-block-start-style',
350 'border-block-start-width',
351 'border-block-style',
352 'border-block-width',
353 'border-bottom',
354 'border-bottom-color',
355 'border-bottom-left-radius',
356 'border-bottom-right-radius',
357 'border-bottom-style',
358 'border-bottom-width',
359 'border-collapse',
360 'border-color',
361 'border-end-end-radius',
362 'border-end-start-radius',
363 'border-image',
364 'border-image-outset',
365 'border-image-repeat',
366 'border-image-slice',
367 'border-image-source',
368 'border-image-width',
369 'border-inline',
370 'border-inline-color',
371 'border-inline-end',
372 'border-inline-end-color',
373 'border-inline-end-style',
374 'border-inline-end-width',
375 'border-inline-start',
376 'border-inline-start-color',
377 'border-inline-start-style',
378 'border-inline-start-width',
379 'border-inline-style',
380 'border-inline-width',
381 'border-left',
382 'border-left-color',
383 'border-left-style',
384 'border-left-width',
385 'border-radius',
386 'border-right',
387 'border-right-color',
388 'border-right-style',
389 'border-right-width',
390 'border-spacing',
391 'border-start-end-radius',
392 'border-start-start-radius',
393 'border-style',
394 'border-top',
395 'border-top-color',
396 'border-top-left-radius',
397 'border-top-right-radius',
398 'border-top-style',
399 'border-top-width',
400 'border-width',
401 'bottom',
402 'box-align',
403 'box-decoration-break',
404 'box-direction',
405 'box-flex',
406 'box-flex-group',
407 'box-lines',
408 'box-ordinal-group',
409 'box-orient',
410 'box-pack',
411 'box-shadow',
412 'box-sizing',
413 'break-after',
414 'break-before',
415 'break-inside',
416 'caption-side',
417 'caret-color',
418 'clear',
419 'clip',
420 'clip-path',
421 'clip-rule',
422 'color',
423 'color-interpolation',
424 'color-interpolation-filters',
425 'color-profile',
426 'color-rendering',
427 'color-scheme',
428 'column-count',
429 'column-fill',
430 'column-gap',
431 'column-rule',
432 'column-rule-color',
433 'column-rule-style',
434 'column-rule-width',
435 'column-span',
436 'column-width',
437 'columns',
438 'contain',
439 'contain-intrinsic-block-size',
440 'contain-intrinsic-height',
441 'contain-intrinsic-inline-size',
442 'contain-intrinsic-size',
443 'contain-intrinsic-width',
444 'container',
445 'container-name',
446 'container-type',
447 'content',
448 'content-visibility',
449 'counter-increment',
450 'counter-reset',
451 'counter-set',
452 'cue',
453 'cue-after',
454 'cue-before',
455 'cursor',
456 'cx',
457 'cy',
458 'direction',
459 'display',
460 'dominant-baseline',
461 'empty-cells',
462 'enable-background',
463 'field-sizing',
464 'fill',
465 'fill-opacity',
466 'fill-rule',
467 'filter',
468 'flex',
469 'flex-basis',
470 'flex-direction',
471 'flex-flow',
472 'flex-grow',
473 'flex-shrink',
474 'flex-wrap',
475 'float',
476 'flood-color',
477 'flood-opacity',
478 'flow',
479 'font',
480 'font-display',
481 'font-family',
482 'font-feature-settings',
483 'font-kerning',
484 'font-language-override',
485 'font-optical-sizing',
486 'font-palette',
487 'font-size',
488 'font-size-adjust',
489 'font-smooth',
490 'font-smoothing',
491 'font-stretch',
492 'font-style',
493 'font-synthesis',
494 'font-synthesis-position',
495 'font-synthesis-small-caps',
496 'font-synthesis-style',
497 'font-synthesis-weight',
498 'font-variant',
499 'font-variant-alternates',
500 'font-variant-caps',
501 'font-variant-east-asian',
502 'font-variant-emoji',
503 'font-variant-ligatures',
504 'font-variant-numeric',
505 'font-variant-position',
506 'font-variation-settings',
507 'font-weight',
508 'forced-color-adjust',
509 'gap',
510 'glyph-orientation-horizontal',
511 'glyph-orientation-vertical',
512 'grid',
513 'grid-area',
514 'grid-auto-columns',
515 'grid-auto-flow',
516 'grid-auto-rows',
517 'grid-column',
518 'grid-column-end',
519 'grid-column-start',
520 'grid-gap',
521 'grid-row',
522 'grid-row-end',
523 'grid-row-start',
524 'grid-template',
525 'grid-template-areas',
526 'grid-template-columns',
527 'grid-template-rows',
528 'hanging-punctuation',
529 'height',
530 'hyphenate-character',
531 'hyphenate-limit-chars',
532 'hyphens',
533 'icon',
534 'image-orientation',
535 'image-rendering',
536 'image-resolution',
537 'ime-mode',
538 'initial-letter',
539 'initial-letter-align',
540 'inline-size',
541 'inset',
542 'inset-area',
543 'inset-block',
544 'inset-block-end',
545 'inset-block-start',
546 'inset-inline',
547 'inset-inline-end',
548 'inset-inline-start',
549 'isolation',
550 'justify-content',
551 'justify-items',
552 'justify-self',
553 'kerning',
554 'left',
555 'letter-spacing',
556 'lighting-color',
557 'line-break',
558 'line-height',
559 'line-height-step',
560 'list-style',
561 'list-style-image',
562 'list-style-position',
563 'list-style-type',
564 'margin',
565 'margin-block',
566 'margin-block-end',
567 'margin-block-start',
568 'margin-bottom',
569 'margin-inline',
570 'margin-inline-end',
571 'margin-inline-start',
572 'margin-left',
573 'margin-right',
574 'margin-top',
575 'margin-trim',
576 'marker',
577 'marker-end',
578 'marker-mid',
579 'marker-start',
580 'marks',
581 'mask',
582 'mask-border',
583 'mask-border-mode',
584 'mask-border-outset',
585 'mask-border-repeat',
586 'mask-border-slice',
587 'mask-border-source',
588 'mask-border-width',
589 'mask-clip',
590 'mask-composite',
591 'mask-image',
592 'mask-mode',
593 'mask-origin',
594 'mask-position',
595 'mask-repeat',
596 'mask-size',
597 'mask-type',
598 'masonry-auto-flow',
599 'math-depth',
600 'math-shift',
601 'math-style',
602 'max-block-size',
603 'max-height',
604 'max-inline-size',
605 'max-width',
606 'min-block-size',
607 'min-height',
608 'min-inline-size',
609 'min-width',
610 'mix-blend-mode',
611 'nav-down',
612 'nav-index',
613 'nav-left',
614 'nav-right',
615 'nav-up',
616 'none',
617 'normal',
618 'object-fit',
619 'object-position',
620 'offset',
621 'offset-anchor',
622 'offset-distance',
623 'offset-path',
624 'offset-position',
625 'offset-rotate',
626 'opacity',
627 'order',
628 'orphans',
629 'outline',
630 'outline-color',
631 'outline-offset',
632 'outline-style',
633 'outline-width',
634 'overflow',
635 'overflow-anchor',
636 'overflow-block',
637 'overflow-clip-margin',
638 'overflow-inline',
639 'overflow-wrap',
640 'overflow-x',
641 'overflow-y',
642 'overlay',
643 'overscroll-behavior',
644 'overscroll-behavior-block',
645 'overscroll-behavior-inline',
646 'overscroll-behavior-x',
647 'overscroll-behavior-y',
648 'padding',
649 'padding-block',
650 'padding-block-end',
651 'padding-block-start',
652 'padding-bottom',
653 'padding-inline',
654 'padding-inline-end',
655 'padding-inline-start',
656 'padding-left',
657 'padding-right',
658 'padding-top',
659 'page',
660 'page-break-after',
661 'page-break-before',
662 'page-break-inside',
663 'paint-order',
664 'pause',
665 'pause-after',
666 'pause-before',
667 'perspective',
668 'perspective-origin',
669 'place-content',
670 'place-items',
671 'place-self',
672 'pointer-events',
673 'position',
674 'position-anchor',
675 'position-visibility',
676 'print-color-adjust',
677 'quotes',
678 'r',
679 'resize',
680 'rest',
681 'rest-after',
682 'rest-before',
683 'right',
684 'rotate',
685 'row-gap',
686 'ruby-align',
687 'ruby-position',
688 'scale',
689 'scroll-behavior',
690 'scroll-margin',
691 'scroll-margin-block',
692 'scroll-margin-block-end',
693 'scroll-margin-block-start',
694 'scroll-margin-bottom',
695 'scroll-margin-inline',
696 'scroll-margin-inline-end',
697 'scroll-margin-inline-start',
698 'scroll-margin-left',
699 'scroll-margin-right',
700 'scroll-margin-top',
701 'scroll-padding',
702 'scroll-padding-block',
703 'scroll-padding-block-end',
704 'scroll-padding-block-start',
705 'scroll-padding-bottom',
706 'scroll-padding-inline',
707 'scroll-padding-inline-end',
708 'scroll-padding-inline-start',
709 'scroll-padding-left',
710 'scroll-padding-right',
711 'scroll-padding-top',
712 'scroll-snap-align',
713 'scroll-snap-stop',
714 'scroll-snap-type',
715 'scroll-timeline',
716 'scroll-timeline-axis',
717 'scroll-timeline-name',
718 'scrollbar-color',
719 'scrollbar-gutter',
720 'scrollbar-width',
721 'shape-image-threshold',
722 'shape-margin',
723 'shape-outside',
724 'shape-rendering',
725 'speak',
726 'speak-as',
727 'src', // @font-face
728 'stop-color',
729 'stop-opacity',
730 'stroke',
731 'stroke-dasharray',
732 'stroke-dashoffset',
733 'stroke-linecap',
734 'stroke-linejoin',
735 'stroke-miterlimit',
736 'stroke-opacity',
737 'stroke-width',
738 'tab-size',
739 'table-layout',
740 'text-align',
741 'text-align-all',
742 'text-align-last',
743 'text-anchor',
744 'text-combine-upright',
745 'text-decoration',
746 'text-decoration-color',
747 'text-decoration-line',
748 'text-decoration-skip',
749 'text-decoration-skip-ink',
750 'text-decoration-style',
751 'text-decoration-thickness',
752 'text-emphasis',
753 'text-emphasis-color',
754 'text-emphasis-position',
755 'text-emphasis-style',
756 'text-indent',
757 'text-justify',
758 'text-orientation',
759 'text-overflow',
760 'text-rendering',
761 'text-shadow',
762 'text-size-adjust',
763 'text-transform',
764 'text-underline-offset',
765 'text-underline-position',
766 'text-wrap',
767 'text-wrap-mode',
768 'text-wrap-style',
769 'timeline-scope',
770 'top',
771 'touch-action',
772 'transform',
773 'transform-box',
774 'transform-origin',
775 'transform-style',
776 'transition',
777 'transition-behavior',
778 'transition-delay',
779 'transition-duration',
780 'transition-property',
781 'transition-timing-function',
782 'translate',
783 'unicode-bidi',
784 'user-modify',
785 'user-select',
786 'vector-effect',
787 'vertical-align',
788 'view-timeline',
789 'view-timeline-axis',
790 'view-timeline-inset',
791 'view-timeline-name',
792 'view-transition-name',
793 'visibility',
794 'voice-balance',
795 'voice-duration',
796 'voice-family',
797 'voice-pitch',
798 'voice-range',
799 'voice-rate',
800 'voice-stress',
801 'voice-volume',
802 'white-space',
803 'white-space-collapse',
804 'widows',
805 'width',
806 'will-change',
807 'word-break',
808 'word-spacing',
809 'word-wrap',
810 'writing-mode',
811 'x',
812 'y',
813 'z-index',
814 'zoom'
815 ].sort().reverse();
816
817 // some grammars use them all as a single group
818 const PSEUDO_SELECTORS = PSEUDO_CLASSES.concat(PSEUDO_ELEMENTS).sort().reverse();
819
820 /*
821 Language: Less
822 Description: It's CSS, with just a little more.
823 Author: Max Mikhailov <seven.phases.max@gmail.com>
824 Website: http://lesscss.org
825 Category: common, css, web
826 */
827
828
829 /** @type LanguageFn */
830 function less(hljs) {
831 const modes = MODES(hljs);
832 const PSEUDO_SELECTORS$1 = PSEUDO_SELECTORS;
833
834 const AT_MODIFIERS = "and or not only";
835 const IDENT_RE = '[\\w-]+'; // yes, Less identifiers may begin with a digit
836 const INTERP_IDENT_RE = '(' + IDENT_RE + '|@\\{' + IDENT_RE + '\\})';
837
838 /* Generic Modes */
839
840 const RULES = []; const VALUE_MODES = []; // forward def. for recursive modes
841
842 const STRING_MODE = function(c) {
843 return {
844 // Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
845 className: 'string',
846 begin: '~?' + c + '.*?' + c
847 };
848 };
849
850 const IDENT_MODE = function(name, begin, relevance) {
851 return {
852 className: name,
853 begin: begin,
854 relevance: relevance
855 };
856 };
857
858 const AT_KEYWORDS = {
859 $pattern: /[a-z-]+/,
860 keyword: AT_MODIFIERS,
861 attribute: MEDIA_FEATURES.join(" ")
862 };
863
864 const PARENS_MODE = {
865 // used only to properly balance nested parens inside mixin call, def. arg list
866 begin: '\\(',
867 end: '\\)',
868 contains: VALUE_MODES,
869 keywords: AT_KEYWORDS,
870 relevance: 0
871 };
872
873 // generic Less highlighter (used almost everywhere except selectors):
874 VALUE_MODES.push(
875 hljs.C_LINE_COMMENT_MODE,
876 hljs.C_BLOCK_COMMENT_MODE,
877 STRING_MODE("'"),
878 STRING_MODE('"'),
879 modes.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
880 {
881 begin: '(url|data-uri)\\(',
882 starts: {
883 className: 'string',
884 end: '[\\)\\n]',
885 excludeEnd: true
886 }
887 },
888 modes.HEXCOLOR,
889 PARENS_MODE,
890 IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
891 IDENT_MODE('variable', '@\\{' + IDENT_RE + '\\}'),
892 IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
893 { // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
894 className: 'attribute',
895 begin: IDENT_RE + '\\s*:',
896 end: ':',
897 returnBegin: true,
898 excludeEnd: true
899 },
900 modes.IMPORTANT,
901 { beginKeywords: 'and not' },
902 modes.FUNCTION_DISPATCH
903 );
904
905 const VALUE_WITH_RULESETS = VALUE_MODES.concat({
906 begin: /\{/,
907 end: /\}/,
908 contains: RULES
909 });
910
911 const MIXIN_GUARD_MODE = {
912 beginKeywords: 'when',
913 endsWithParent: true,
914 contains: [ { beginKeywords: 'and not' } ].concat(VALUE_MODES) // using this form to override VALUE’s 'function' match
915 };
916
917 /* Rule-Level Modes */
918
919 const RULE_MODE = {
920 begin: INTERP_IDENT_RE + '\\s*:',
921 returnBegin: true,
922 end: /[;}]/,
923 relevance: 0,
924 contains: [
925 { begin: /-(webkit|moz|ms|o)-/ },
926 modes.CSS_VARIABLE,
927 {
928 className: 'attribute',
929 begin: '\\b(' + ATTRIBUTES.join('|') + ')\\b',
930 end: /(?=:)/,
931 starts: {
932 endsWithParent: true,
933 illegal: '[<=$]',
934 relevance: 0,
935 contains: VALUE_MODES
936 }
937 }
938 ]
939 };
940
941 const AT_RULE_MODE = {
942 className: 'keyword',
943 begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
944 starts: {
945 end: '[;{}]',
946 keywords: AT_KEYWORDS,
947 returnEnd: true,
948 contains: VALUE_MODES,
949 relevance: 0
950 }
951 };
952
953 // variable definitions and calls
954 const VAR_RULE_MODE = {
955 className: 'variable',
956 variants: [
957 // using more strict pattern for higher relevance to increase chances of Less detection.
958 // this is *the only* Less specific statement used in most of the sources, so...
959 // (we’ll still often loose to the css-parser unless there's '//' comment,
960 // simply because 1 variable just can't beat 99 properties :)
961 {
962 begin: '@' + IDENT_RE + '\\s*:',
963 relevance: 15
964 },
965 { begin: '@' + IDENT_RE }
966 ],
967 starts: {
968 end: '[;}]',
969 returnEnd: true,
970 contains: VALUE_WITH_RULESETS
971 }
972 };
973
974 const SELECTOR_MODE = {
975 // first parse unambiguous selectors (i.e. those not starting with tag)
976 // then fall into the scary lookahead-discriminator variant.
977 // this mode also handles mixin definitions and calls
978 variants: [
979 {
980 begin: '[\\.#:&\\[>]',
981 end: '[;{}]' // mixin calls end with ';'
982 },
983 {
984 begin: INTERP_IDENT_RE,
985 end: /\{/
986 }
987 ],
988 returnBegin: true,
989 returnEnd: true,
990 illegal: '[<=\'$"]',
991 relevance: 0,
992 contains: [
993 hljs.C_LINE_COMMENT_MODE,
994 hljs.C_BLOCK_COMMENT_MODE,
995 MIXIN_GUARD_MODE,
996 IDENT_MODE('keyword', 'all\\b'),
997 IDENT_MODE('variable', '@\\{' + IDENT_RE + '\\}'), // otherwise it’s identified as tag
998
999 {
1000 begin: '\\b(' + TAGS.join('|') + ')\\b',
1001 className: 'selector-tag'
1002 },
1003 modes.CSS_NUMBER_MODE,
1004 IDENT_MODE('selector-tag', INTERP_IDENT_RE, 0),
1005 IDENT_MODE('selector-id', '#' + INTERP_IDENT_RE),
1006 IDENT_MODE('selector-class', '\\.' + INTERP_IDENT_RE, 0),
1007 IDENT_MODE('selector-tag', '&', 0),
1008 modes.ATTRIBUTE_SELECTOR_MODE,
1009 {
1010 className: 'selector-pseudo',
1011 begin: ':(' + PSEUDO_CLASSES.join('|') + ')'
1012 },
1013 {
1014 className: 'selector-pseudo',
1015 begin: ':(:)?(' + PSEUDO_ELEMENTS.join('|') + ')'
1016 },
1017 {
1018 begin: /\(/,
1019 end: /\)/,
1020 relevance: 0,
1021 contains: VALUE_WITH_RULESETS
1022 }, // argument list of parametric mixins
1023 { begin: '!important' }, // eat !important after mixin call or it will be colored as tag
1024 modes.FUNCTION_DISPATCH
1025 ]
1026 };
1027
1028 const PSEUDO_SELECTOR_MODE = {
1029 begin: IDENT_RE + ':(:)?' + `(${PSEUDO_SELECTORS$1.join('|')})`,
1030 returnBegin: true,
1031 contains: [ SELECTOR_MODE ]
1032 };
1033
1034 RULES.push(
1035 hljs.C_LINE_COMMENT_MODE,
1036 hljs.C_BLOCK_COMMENT_MODE,
1037 AT_RULE_MODE,
1038 VAR_RULE_MODE,
1039 PSEUDO_SELECTOR_MODE,
1040 RULE_MODE,
1041 SELECTOR_MODE,
1042 MIXIN_GUARD_MODE,
1043 modes.FUNCTION_DISPATCH
1044 );
1045
1046 return {
1047 name: 'Less',
1048 case_insensitive: true,
1049 illegal: '[=>\'/<($"]',
1050 contains: RULES
1051 };
1052 }
1053
1054 return less;
1055
1056 })();
1057 ;
1058 export default hljsGrammar;