eric6/ThirdParty/Pygments/pygments/lexers/css.py

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.css 3 pygments.lexers.css
4 ~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for CSS and related stylesheet formats. 6 Lexers for CSS and related stylesheet formats.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 import copy 13 import copy
287 (r'(\.)([\w-]+)', bygroups(Punctuation, Name.Class)), 287 (r'(\.)([\w-]+)', bygroups(Punctuation, Name.Class)),
288 (r'(\#)([\w-]+)', bygroups(Punctuation, Name.Namespace)), 288 (r'(\#)([\w-]+)', bygroups(Punctuation, Name.Namespace)),
289 (r'(@)([\w-]+)', bygroups(Punctuation, Keyword), 'atrule'), 289 (r'(@)([\w-]+)', bygroups(Punctuation, Keyword), 'atrule'),
290 (r'[\w-]+', Name.Tag), 290 (r'[\w-]+', Name.Tag),
291 (r'[~^*!%&$\[\]()<>|+=@:;,./?-]', Operator), 291 (r'[~^*!%&$\[\]()<>|+=@:;,./?-]', Operator),
292 (r'"(\\\\|\\"|[^"])*"', String.Double), 292 (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
293 (r"'(\\\\|\\'|[^'])*'", String.Single) 293 (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
294 ], 294 ],
295 'atrule': [ 295 'atrule': [
296 (r'\{', Punctuation, 'atcontent'), 296 (r'\{', Punctuation, 'atcontent'),
297 (r';', Punctuation, '#pop'), 297 (r';', Punctuation, '#pop'),
298 include('basics'), 298 include('basics'),
308 (r'^@.*?$', Comment.Preproc), 308 (r'^@.*?$', Comment.Preproc),
309 309
310 (words(_vendor_prefixes,), Keyword.Pseudo), 310 (words(_vendor_prefixes,), Keyword.Pseudo),
311 (r'('+r'|'.join(_css_properties)+r')(\s*)(\:)', 311 (r'('+r'|'.join(_css_properties)+r')(\s*)(\:)',
312 bygroups(Keyword, Text, Punctuation), 'value-start'), 312 bygroups(Keyword, Text, Punctuation), 'value-start'),
313 (r'([-]+[a-zA-Z_][\w-]*)(\s*)(\:)', bygroups(Name.Variable, Text, Punctuation),
314 'value-start'),
313 (r'([a-zA-Z_][\w-]*)(\s*)(\:)', bygroups(Name, Text, Punctuation), 315 (r'([a-zA-Z_][\w-]*)(\s*)(\:)', bygroups(Name, Text, Punctuation),
314 'value-start'), 316 'value-start'),
315 317
316 (r'/\*(?:.|\n)*?\*/', Comment), 318 (r'/\*(?:.|\n)*?\*/', Comment),
317 ], 319 ],
333 335
334 include('numeric-values'), 336 include('numeric-values'),
335 337
336 (r'[~^*!%&<>|+=@:./?-]+', Operator), 338 (r'[~^*!%&<>|+=@:./?-]+', Operator),
337 (r'[\[\](),]+', Punctuation), 339 (r'[\[\](),]+', Punctuation),
338 (r'"(\\\\|\\"|[^"])*"', String.Double), 340 (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
339 (r"'(\\\\|\\'|[^'])*'", String.Single), 341 (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
340 (r'[a-zA-Z_][\w-]*', Name), 342 (r'[a-zA-Z_][\w-]*', Name),
341 (r';', Punctuation, '#pop'), 343 (r';', Punctuation, '#pop'),
342 (r'\}', Punctuation, '#pop:2'), 344 (r'\}', Punctuation, '#pop:2'),
343 ], 345 ],
344 'function-start': [ 346 'function-start': [
345 (r'\s+', Text), 347 (r'\s+', Text),
348 (r'[-]+([\w+]+[-]*)+', Name.Variable),
346 include('urls'), 349 include('urls'),
347 (words(_vendor_prefixes,), Keyword.Pseudo), 350 (words(_vendor_prefixes,), Keyword.Pseudo),
348 (words(_keyword_values, suffix=r'\b'), Keyword.Constant), 351 (words(_keyword_values, suffix=r'\b'), Keyword.Constant),
349 (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant), 352 (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant),
350 (words(_color_keywords, suffix=r'\b'), Keyword.Constant), 353 (words(_color_keywords, suffix=r'\b'), Keyword.Constant),
357 360
358 (r'/\*(?:.|\n)*?\*/', Comment), 361 (r'/\*(?:.|\n)*?\*/', Comment),
359 include('numeric-values'), 362 include('numeric-values'),
360 (r'[*+/-]', Operator), 363 (r'[*+/-]', Operator),
361 (r',', Punctuation), 364 (r',', Punctuation),
362 (r'"(\\\\|\\"|[^"])*"', String.Double), 365 (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
363 (r"'(\\\\|\\'|[^'])*'", String.Single), 366 (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
364 (r'[a-zA-Z_-]\w*', Name), 367 (r'[a-zA-Z_-]\w*', Name),
365 (r'\)', Punctuation, '#pop'), 368 (r'\)', Punctuation, '#pop'),
366 ], 369 ],
367 'urls': [ 370 'urls': [
368 (r'(url)(\()(".*?")(\))', bygroups(Name.Builtin, Punctuation, 371 (r'(url)(\()(".*?")(\))', bygroups(Name.Builtin, Punctuation,

eric ide

mercurial