diff -r ace8a08028f3 -r da76c71624de ThirdParty/Pygments/pygments/lexers/templates.py --- a/ThirdParty/Pygments/pygments/lexers/templates.py Sun Feb 17 19:05:40 2013 +0100 +++ b/ThirdParty/Pygments/pygments/lexers/templates.py Sun Feb 17 19:07:15 2013 +0100 @@ -5,14 +5,14 @@ Lexers for various template engines' markup. - :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexers.web import \ - PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer + PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer, LassoLexer from pygments.lexers.agile import PythonLexer, PerlLexer from pygments.lexers.compiled import JavaLexer from pygments.lexers.jvm import TeaLangLexer @@ -37,7 +37,8 @@ 'CheetahXmlLexer', 'CheetahJavascriptLexer', 'EvoqueLexer', 'EvoqueHtmlLexer', 'EvoqueXmlLexer', 'ColdfusionLexer', 'ColdfusionHtmlLexer', 'VelocityLexer', 'VelocityHtmlLexer', - 'VelocityXmlLexer', 'SspLexer', 'TeaTemplateLexer'] + 'VelocityXmlLexer', 'SspLexer', 'TeaTemplateLexer', 'LassoHtmlLexer', + 'LassoXmlLexer', 'LassoCssLexer', 'LassoJavascriptLexer'] class ErbLexer(Lexer): @@ -223,12 +224,14 @@ 'variable': [ (identifier, Name.Variable), (r'\(', Punctuation, 'funcparams'), - (r'(\.)(' + identifier + r')', bygroups(Punctuation, Name.Variable), '#push'), + (r'(\.)(' + identifier + r')', + bygroups(Punctuation, Name.Variable), '#push'), (r'\}', Punctuation, '#pop'), (r'', Other, '#pop') ], 'directiveparams': [ - (r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b', Operator), + (r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b', + Operator), (r'\[', Operator, 'rangeoperator'), (r'\b' + identifier + r'\b', Name.Function), include('funcparams') @@ -260,7 +263,8 @@ rv += 0.15 if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text): rv += 0.15 - if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text): + if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?' + r'(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text): rv += 0.01 return rv @@ -1504,6 +1508,7 @@ ], } + class ColdfusionMarkupLexer(RegexLexer): """ Coldfusion markup only @@ -1628,3 +1633,110 @@ if '<%' in text and '%>' in text: rv += 0.1 return rv + + +class LassoHtmlLexer(DelegatingLexer): + """ + Subclass of the `LassoLexer` which highlights unhandled data with the + `HtmlLexer`. + + Nested JavaScript and CSS is also highlighted. + + *New in Pygments 1.6.* + """ + + name = 'HTML+Lasso' + aliases = ['html+lasso'] + alias_filenames = ['*.html', '*.htm', '*.xhtml', '*.lasso', '*.lasso[89]', + '*.incl', '*.inc', '*.las'] + mimetypes = ['text/html+lasso', + 'application/x-httpd-lasso', + 'application/x-httpd-lasso[89]'] + + def __init__(self, **options): + super(LassoHtmlLexer, self).__init__(HtmlLexer, LassoLexer, **options) + + def analyse_text(text): + rv = LassoLexer.analyse_text(text) + if re.search(r'<\w+>', text, re.I): + rv += 0.2 + if html_doctype_matches(text): + rv += 0.5 + return rv + + +class LassoXmlLexer(DelegatingLexer): + """ + Subclass of the `LassoLexer` which highlights unhandled data with the + `XmlLexer`. + + *New in Pygments 1.6.* + """ + + name = 'XML+Lasso' + aliases = ['xml+lasso'] + alias_filenames = ['*.xml', '*.lasso', '*.lasso[89]', + '*.incl', '*.inc', '*.las'] + mimetypes = ['application/xml+lasso'] + + def __init__(self, **options): + super(LassoXmlLexer, self).__init__(XmlLexer, LassoLexer, **options) + + def analyse_text(text): + rv = LassoLexer.analyse_text(text) + if looks_like_xml(text): + rv += 0.5 + return rv + + +class LassoCssLexer(DelegatingLexer): + """ + Subclass of the `LassoLexer` which highlights unhandled data with the + `CssLexer`. + + *New in Pygments 1.6.* + """ + + name = 'CSS+Lasso' + aliases = ['css+lasso'] + alias_filenames = ['*.css'] + mimetypes = ['text/css+lasso'] + + def __init__(self, **options): + options['requiredelimiters'] = True + super(LassoCssLexer, self).__init__(CssLexer, LassoLexer, **options) + + def analyse_text(text): + rv = LassoLexer.analyse_text(text) + if re.search(r'\w+:.+;', text): + rv += 0.1 + if 'padding:' in text: + rv += 0.1 + return rv + + +class LassoJavascriptLexer(DelegatingLexer): + """ + Subclass of the `LassoLexer` which highlights unhandled data with the + `JavascriptLexer`. + + *New in Pygments 1.6.* + """ + + name = 'JavaScript+Lasso' + aliases = ['js+lasso', 'javascript+lasso'] + alias_filenames = ['*.js'] + mimetypes = ['application/x-javascript+lasso', + 'text/x-javascript+lasso', + 'text/javascript+lasso'] + + def __init__(self, **options): + options['requiredelimiters'] = True + super(LassoJavascriptLexer, self).__init__(JavascriptLexer, LassoLexer, + **options) + + def analyse_text(text): + rv = LassoLexer.analyse_text(text) + if 'function' in text: + rv += 0.2 + return rv