diff options
author | Tim Hatch <tim@timhatch.com> | 2015-10-13 11:02:55 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2015-10-13 11:02:55 -0700 |
commit | fa973263efa00282bf309656a508b41fc4b7ffce (patch) | |
tree | 3473b209a6796d640c75dedea47c7966c4c0cdfd /pygments/lexers/css.py | |
parent | ee3d1f6a66f2d54d2d4360993d275241e2072043 (diff) | |
download | pygments-fa973263efa00282bf309656a508b41fc4b7ffce.tar.gz |
Fixup SuperCollider, split out LessCss.
Diffstat (limited to 'pygments/lexers/css.py')
-rw-r--r-- | pygments/lexers/css.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/pygments/lexers/css.py b/pygments/lexers/css.py index 616667a3..4165bcc1 100644 --- a/pygments/lexers/css.py +++ b/pygments/lexers/css.py @@ -13,12 +13,12 @@ import re 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): @@ -27,8 +27,8 @@ class CssLexer(RegexLexer): """ name = 'CSS' - aliases = ['css', 'less'] - filenames = ['*.css', '*.less'] + aliases = ['css'] + filenames = ['*.css'] mimetypes = ['text/css'] tokens = { @@ -497,3 +497,27 @@ class ScssLexer(RegexLexer): 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, + ], + } |