--- a/ThirdParty/Pygments/pygments/lexers/css.py Sun Jan 24 16:15:58 2016 +0100 +++ b/ThirdParty/Pygments/pygments/lexers/css.py Sun Jan 24 19:28:37 2016 +0100 @@ -5,7 +5,7 @@ Lexers for CSS and related stylesheet formats. - :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -13,12 +13,12 @@ import copy from pygments.lexer import ExtendedRegexLexer, RegexLexer, include, bygroups, \ - default, words + default, words, inherit from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation from pygments.util import iteritems -__all__ = ['CssLexer', 'SassLexer', 'ScssLexer'] +__all__ = ['CssLexer', 'SassLexer', 'ScssLexer', 'LessCssLexer'] class CssLexer(RegexLexer): @@ -41,7 +41,7 @@ (r'\{', Punctuation, 'content'), (r'\:[\w-]+', Name.Decorator), (r'\.[\w-]+', Name.Class), - (r'\#[\w-]+', Name.Function), + (r'\#[\w-]+', Name.Namespace), (r'@[\w-]+', Keyword, 'atrule'), (r'[\w-]+', Name.Tag), (r'[~^*!%&$\[\]()<>|+=@:;,./?-]', Operator), @@ -120,7 +120,7 @@ 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url', 'visible', 'w-resize', 'wait', 'wider', 'x-fast', 'x-high', 'x-large', 'x-loud', 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small', 'yes'), suffix=r'\b'), - Keyword), + Name.Builtin), (words(( 'indigo', 'gold', 'firebrick', 'indianred', 'yellow', 'darkolivegreen', 'darkseagreen', 'mediumvioletred', 'mediumorchid', 'chartreuse', @@ -475,8 +475,9 @@ (r'(@media)(\s+)', bygroups(Keyword, Text), 'value'), (r'@[\w-]+', Keyword, 'selector'), (r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'), - (r'(?=[^;{}][;}])', Name.Attribute, 'attr'), - (r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'), + # TODO: broken, and prone to infinite loops. + #(r'(?=[^;{}][;}])', Name.Attribute, 'attr'), + #(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'), default('selector'), ], @@ -484,6 +485,7 @@ (r'[^\s:="\[]+', Name.Attribute), (r'#\{', String.Interpol, 'interpolation'), (r'[ \t]*:', Operator, 'value'), + default('#pop'), ], 'inline-comment': [ @@ -496,3 +498,27 @@ tokens[group] = copy.copy(common) tokens['value'].extend([(r'\n', Text), (r'[;{}]', Punctuation, '#pop')]) tokens['selector'].extend([(r'\n', Text), (r'[;{}]', Punctuation, '#pop')]) + + +class LessCssLexer(CssLexer): + """ + For `LESS <http://lesscss.org/>`_ styleshets. + + .. versionadded:: 2.1 + """ + + name = 'LessCss' + aliases = ['less'] + filenames = ['*.less'] + mimetypes = ['text/x-less-css'] + + tokens = { + 'root': [ + (r'@\w+', Name.Variable), + inherit, + ], + 'content': [ + (r'{', Punctuation, '#push'), + inherit, + ], + }