123 'voice-volume', 'volume', 'white-space', 'widows', 'width', 'will-change', |
123 'voice-volume', 'volume', 'white-space', 'widows', 'width', 'will-change', |
124 'word-break', 'word-spacing', 'word-wrap', 'wrap-after', 'wrap-before', |
124 'word-break', 'word-spacing', 'word-wrap', 'wrap-after', 'wrap-before', |
125 'wrap-flow', 'wrap-inside', 'wrap-through', 'writing-mode', 'z-index', |
125 'wrap-flow', 'wrap-inside', 'wrap-through', 'writing-mode', 'z-index', |
126 ) |
126 ) |
127 |
127 |
128 # List of keyword values obtained from: |
128 # List of keyword values obtained from: |
129 # http://cssvalues.com/ |
129 # http://cssvalues.com/ |
130 _keyword_values = ( |
130 _keyword_values = ( |
131 'absolute', 'alias', 'all', 'all-petite-caps', 'all-scroll', |
131 'absolute', 'alias', 'all', 'all-petite-caps', 'all-scroll', |
132 'all-small-caps', 'allow-end', 'alpha', 'alternate', 'alternate-reverse', |
132 'all-small-caps', 'allow-end', 'alpha', 'alternate', 'alternate-reverse', |
133 'always', 'armenian', 'auto', 'avoid', 'avoid-column', 'avoid-page', |
133 'always', 'armenian', 'auto', 'avoid', 'avoid-column', 'avoid-page', |
320 (r'\s+', Text), |
320 (r'\s+', Text), |
321 (words(_vendor_prefixes,), Name.Builtin.Pseudo), |
321 (words(_vendor_prefixes,), Name.Builtin.Pseudo), |
322 include('urls'), |
322 include('urls'), |
323 (r'('+r'|'.join(_functional_notation_keyword_values)+r')(\()', |
323 (r'('+r'|'.join(_functional_notation_keyword_values)+r')(\()', |
324 bygroups(Name.Builtin, Punctuation), 'function-start'), |
324 bygroups(Name.Builtin, Punctuation), 'function-start'), |
325 (r'([a-zA-Z_][\w-]+)(\()', bygroups(Name.Function, Punctuation), 'function-start'), |
325 (r'([a-zA-Z_][\w-]+)(\()', |
|
326 bygroups(Name.Function, Punctuation), 'function-start'), |
326 (words(_keyword_values, suffix=r'\b'), Keyword.Constant), |
327 (words(_keyword_values, suffix=r'\b'), Keyword.Constant), |
327 (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant), |
328 (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant), |
328 (words(_color_keywords, suffix=r'\b'), Keyword.Constant), |
329 (words(_color_keywords, suffix=r'\b'), Keyword.Constant), |
329 (words(_css_properties, suffix=r'\b'), Keyword), # for transition-property etc. |
330 # for transition-property etc. |
|
331 (words(_css_properties, suffix=r'\b'), Keyword), |
330 (r'\!important', Comment.Preproc), |
332 (r'\!important', Comment.Preproc), |
331 (r'/\*(?:.|\n)*?\*/', Comment), |
333 (r'/\*(?:.|\n)*?\*/', Comment), |
332 |
334 |
333 include('numeric-values'), |
335 include('numeric-values'), |
334 |
336 |
335 (r'[~^*!%&<>|+=@:./?-]+', Operator), |
337 (r'[~^*!%&<>|+=@:./?-]+', Operator), |
336 (r'[\[\](),]+', Punctuation), |
338 (r'[\[\](),]+', Punctuation), |
337 (r'"(\\\\|\\"|[^"])*"', String.Double), |
339 (r'"(\\\\|\\"|[^"])*"', String.Double), |
338 (r"'(\\\\|\\'|[^'])*'", String.Single), |
340 (r"'(\\\\|\\'|[^'])*'", String.Single), |
339 (r'[a-zA-Z_][\w-]*', Name), |
341 (r'[a-zA-Z_][\w-]*', Name), |
349 (words(_color_keywords, suffix=r'\b'), Keyword.Constant), |
351 (words(_color_keywords, suffix=r'\b'), Keyword.Constant), |
350 |
352 |
351 # function-start may be entered recursively |
353 # function-start may be entered recursively |
352 (r'(' + r'|'.join(_functional_notation_keyword_values) + r')(\()', |
354 (r'(' + r'|'.join(_functional_notation_keyword_values) + r')(\()', |
353 bygroups(Name.Builtin, Punctuation), 'function-start'), |
355 bygroups(Name.Builtin, Punctuation), 'function-start'), |
354 (r'([a-zA-Z_][\w-]+)(\()', bygroups(Name.Function, Punctuation), 'function-start'), |
356 (r'([a-zA-Z_][\w-]+)(\()', |
|
357 bygroups(Name.Function, Punctuation), 'function-start'), |
355 |
358 |
356 (r'/\*(?:.|\n)*?\*/', Comment), |
359 (r'/\*(?:.|\n)*?\*/', Comment), |
357 include('numeric-values'), |
360 include('numeric-values'), |
358 (r'[*+/-]', Operator), |
361 (r'[*+/-]', Operator), |
359 (r'[,]', Punctuation), |
362 (r'[,]', Punctuation), |
371 String.Other, Punctuation)), |
374 String.Other, Punctuation)), |
372 ], |
375 ], |
373 'numeric-values': [ |
376 'numeric-values': [ |
374 (r'\#[a-zA-Z0-9]{1,6}', Number.Hex), |
377 (r'\#[a-zA-Z0-9]{1,6}', Number.Hex), |
375 (r'[+\-]?[0-9]*[.][0-9]+', Number.Float, 'numeric-end'), |
378 (r'[+\-]?[0-9]*[.][0-9]+', Number.Float, 'numeric-end'), |
376 (r'[+\-]?[0-9]+', Number.Integer, 'numeric-end'), |
379 (r'[+\-]?[0-9]+', Number.Integer, 'numeric-end'), |
377 ], |
380 ], |
378 'numeric-end': [ |
381 'numeric-end': [ |
379 (words(_all_units, suffix=r'\b'), Keyword.Type), |
382 (words(_all_units, suffix=r'\b'), Keyword.Type), |
380 (r'%', Keyword.Type), |
383 (r'%', Keyword.Type), |
381 default('#pop'), |
384 default('#pop'), |
382 ], |
385 ], |
464 (r'#\{', String.Interpol, 'interpolation'), |
467 (r'#\{', String.Interpol, 'interpolation'), |
465 (r'"', String.Double, '#pop'), |
468 (r'"', String.Double, '#pop'), |
466 ], |
469 ], |
467 |
470 |
468 'string-single': [ |
471 'string-single': [ |
469 (r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Double), |
472 (r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Single), |
470 (r'#\{', String.Interpol, 'interpolation'), |
473 (r'#\{', String.Interpol, 'interpolation'), |
471 (r"'", String.Double, '#pop'), |
474 (r"'", String.Single, '#pop'), |
472 ], |
475 ], |
473 |
476 |
474 'string-url': [ |
477 'string-url': [ |
475 (r'(\\#|#(?=[^\n{])|[^\n#)])+', String.Other), |
478 (r'(\\#|#(?=[^\n{])|[^\n#)])+', String.Other), |
476 (r'#\{', String.Interpol, 'interpolation'), |
479 (r'#\{', String.Interpol, 'interpolation'), |