home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_2371 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  43.4 KB  |  1,196 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5. from pygments.lexers.web import PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer
  6. from pygments.lexers.agile import PythonLexer
  7. from pygments.lexers.compiled import JavaLexer
  8. from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, include, using, this
  9. from pygments.token import Error, Punctuation, Text, Comment, Operator, Keyword, Name, String, Number, Other, Token
  10. from pygments.util import html_doctype_matches, looks_like_xml
  11. __all__ = [
  12.     'HtmlPhpLexer',
  13.     'XmlPhpLexer',
  14.     'CssPhpLexer',
  15.     'JavascriptPhpLexer',
  16.     'ErbLexer',
  17.     'RhtmlLexer',
  18.     'XmlErbLexer',
  19.     'CssErbLexer',
  20.     'JavascriptErbLexer',
  21.     'SmartyLexer',
  22.     'HtmlSmartyLexer',
  23.     'XmlSmartyLexer',
  24.     'CssSmartyLexer',
  25.     'JavascriptSmartyLexer',
  26.     'DjangoLexer',
  27.     'HtmlDjangoLexer',
  28.     'CssDjangoLexer',
  29.     'XmlDjangoLexer',
  30.     'JavascriptDjangoLexer',
  31.     'GenshiLexer',
  32.     'HtmlGenshiLexer',
  33.     'GenshiTextLexer',
  34.     'CssGenshiLexer',
  35.     'JavascriptGenshiLexer',
  36.     'MyghtyLexer',
  37.     'MyghtyHtmlLexer',
  38.     'MyghtyXmlLexer',
  39.     'MyghtyCssLexer',
  40.     'MyghtyJavascriptLexer',
  41.     'MakoLexer',
  42.     'MakoHtmlLexer',
  43.     'MakoXmlLexer',
  44.     'MakoJavascriptLexer',
  45.     'MakoCssLexer',
  46.     'JspLexer',
  47.     'CheetahLexer',
  48.     'CheetahHtmlLexer',
  49.     'CheetahXmlLexer',
  50.     'CheetahJavascriptLexer',
  51.     'EvoqueLexer',
  52.     'EvoqueHtmlLexer',
  53.     'EvoqueXmlLexer',
  54.     'ColdfusionLexer',
  55.     'ColdfusionHtmlLexer']
  56.  
  57. class ErbLexer(Lexer):
  58.     name = 'ERB'
  59.     aliases = [
  60.         'erb']
  61.     mimetypes = [
  62.         'application/x-ruby-templating']
  63.     _block_re = re.compile('(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)', re.M)
  64.     
  65.     def __init__(self, **options):
  66.         RubyLexer = RubyLexer
  67.         import pygments.lexers.agile
  68.         self.ruby_lexer = RubyLexer(**options)
  69.         Lexer.__init__(self, **options)
  70.  
  71.     
  72.     def get_tokens_unprocessed(self, text):
  73.         tokens = self._block_re.split(text)
  74.         tokens.reverse()
  75.         state = idx = 0
  76.         
  77.         try:
  78.             while True:
  79.                 if state == 0:
  80.                     val = tokens.pop()
  81.                     yield (idx, Other, val)
  82.                     idx += len(val)
  83.                     state = 1
  84.                     continue
  85.                 if state == 1:
  86.                     tag = tokens.pop()
  87.                     if tag in ('<%%', '%%>'):
  88.                         yield (idx, Other, tag)
  89.                         idx += 3
  90.                         state = 0
  91.                     elif tag == '<%#':
  92.                         yield (idx, Comment.Preproc, tag)
  93.                         val = tokens.pop()
  94.                         yield (idx + 3, Comment, val)
  95.                         idx += 3 + len(val)
  96.                         state = 2
  97.                     elif tag in ('<%', '<%=', '<%-'):
  98.                         yield (idx, Comment.Preproc, tag)
  99.                         idx += len(tag)
  100.                         data = tokens.pop()
  101.                         r_idx = 0
  102.                         for r_idx, r_token, r_value in self.ruby_lexer.get_tokens_unprocessed(data):
  103.                             yield (r_idx + idx, r_token, r_value)
  104.                         
  105.                         idx += len(data)
  106.                         state = 2
  107.                     elif tag in ('%>', '-%>'):
  108.                         yield (idx, Error, tag)
  109.                         idx += len(tag)
  110.                         state = 0
  111.                     else:
  112.                         yield (idx, Comment.Preproc, tag[0])
  113.                         r_idx = 0
  114.                         for r_idx, r_token, r_value in self.ruby_lexer.get_tokens_unprocessed(tag[1:]):
  115.                             yield (idx + 1 + r_idx, r_token, r_value)
  116.                         
  117.                         idx += len(tag)
  118.                         state = 0
  119.                 tag in ('<%%', '%%>')
  120.                 if state == 2:
  121.                     tag = tokens.pop()
  122.                     if tag not in ('%>', '-%>'):
  123.                         yield (idx, Other, tag)
  124.                     else:
  125.                         yield (idx, Comment.Preproc, tag)
  126.                     idx += len(tag)
  127.                     state = 0
  128.                     continue
  129.         except IndexError:
  130.             return None
  131.  
  132.  
  133.     
  134.     def analyse_text(text):
  135.         if '<%' in text and '%>' in text:
  136.             return 0.4
  137.  
  138.  
  139.  
  140. class SmartyLexer(RegexLexer):
  141.     name = 'Smarty'
  142.     aliases = [
  143.         'smarty']
  144.     filenames = [
  145.         '*.tpl']
  146.     mimetypes = [
  147.         'application/x-smarty']
  148.     flags = re.MULTILINE | re.DOTALL
  149.     tokens = {
  150.         'root': [
  151.             ('[^{]+', Other),
  152.             ('(\\{)(\\*.*?\\*)(\\})', bygroups(Comment.Preproc, Comment, Comment.Preproc)),
  153.             ('(\\{php\\})(.*?)(\\{/php\\})', bygroups(Comment.Preproc, using(PhpLexer, startinline = True), Comment.Preproc)),
  154.             ('(\\{)(/?[a-zA-Z_][a-zA-Z0-9_]*)(\\s*)', bygroups(Comment.Preproc, Name.Function, Text), 'smarty'),
  155.             ('\\{', Comment.Preproc, 'smarty')],
  156.         'smarty': [
  157.             ('\\s+', Text),
  158.             ('\\}', Comment.Preproc, '#pop'),
  159.             ('#[a-zA-Z_][a-zA-Z0-9_]*#', Name.Variable),
  160.             ('\\$[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z0-9_]+)*', Name.Variable),
  161.             ('[~!%^&*()+=|\\[\\]:;,.<>/?{}@-]', Operator),
  162.             ('(true|false|null)\x08', Keyword.Constant),
  163.             ('[0-9](\\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?', Number),
  164.             ('"(\\\\\\\\|\\\\"|[^"])*"', String.Double),
  165.             ("'(\\\\\\\\|\\\\'|[^'])*'", String.Single),
  166.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Attribute)] }
  167.     
  168.     def analyse_text(text):
  169.         rv = 0
  170.         if re.search('\\{if\\s+.*?\\}.*?\\{/if\\}', text):
  171.             rv += 0.15
  172.         
  173.         if re.search('\\{include\\s+file=.*?\\}', text):
  174.             rv += 0.15
  175.         
  176.         if re.search('\\{foreach\\s+.*?\\}.*?\\{/foreach\\}', text):
  177.             rv += 0.15
  178.         
  179.         if re.search('\\{\\$.*?\\}', text):
  180.             rv += 0.01
  181.         
  182.         return rv
  183.  
  184.  
  185.  
  186. class DjangoLexer(RegexLexer):
  187.     name = 'Django/Jinja'
  188.     aliases = [
  189.         'django',
  190.         'jinja']
  191.     mimetypes = [
  192.         'application/x-django-templating',
  193.         'application/x-jinja']
  194.     flags = re.M | re.S
  195.     tokens = {
  196.         'root': [
  197.             ('[^{]+', Other),
  198.             ('\\{\\{', Comment.Preproc, 'var'),
  199.             ('\\{[*#].*?[*#]\\}', Comment),
  200.             ('(\\{%)(-?\\s*)(comment)(\\s*-?)(%\\})(.*?)(\\{%)(-?\\s*)(endcomment)(\\s*-?)(%\\})', bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc, Comment, Comment.Preproc, Text, Keyword, Text, Comment.Preproc)),
  201.             ('(\\{%)(-?\\s*)(raw)(\\s*-?)(%\\})(.*?)(\\{%)(-?\\s*)(endraw)(\\s*-?)(%\\})', bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc, Text, Comment.Preproc, Text, Keyword, Text, Comment.Preproc)),
  202.             ('(\\{%)(-?\\s*)(filter)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Comment.Preproc, Text, Keyword, Text, Name.Function), 'block'),
  203.             ('(\\{%)(-?\\s*)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Comment.Preproc, Text, Keyword), 'block'),
  204.             ('\\{', Other)],
  205.         'varnames': [
  206.             ('(\\|)(\\s*)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Text, Name.Function)),
  207.             ('(is)(\\s+)(not)?(\\s+)?([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Keyword, Text, Keyword, Text, Name.Function)),
  208.             ('(_|true|false|none|True|False|None)\\b', Keyword.Pseudo),
  209.             ('(in|as|reversed|recursive|not|and|or|is|if|else|import|with(?:(?:out)?\\s*context)?|scoped|ignore\\s+missing)\\b', Keyword),
  210.             ('(loop|block|super|forloop)\\b', Name.Builtin),
  211.             ('[a-zA-Z][a-zA-Z0-9_]*', Name.Variable),
  212.             ('\\.[a-zA-Z0-9_]+', Name.Variable),
  213.             (':?"(\\\\\\\\|\\\\"|[^"])*"', String.Double),
  214.             (":?'(\\\\\\\\|\\\\'|[^'])*'", String.Single),
  215.             ('([{}()\\[\\]+\\-*/,:~]|[><=]=?)', Operator),
  216.             ('[0-9](\\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?', Number)],
  217.         'var': [
  218.             ('\\s+', Text),
  219.             ('(-?)(\\}\\})', bygroups(Text, Comment.Preproc), '#pop'),
  220.             include('varnames')],
  221.         'block': [
  222.             ('\\s+', Text),
  223.             ('(-?)(%\\})', bygroups(Text, Comment.Preproc), '#pop'),
  224.             include('varnames'),
  225.             ('.', Punctuation)] }
  226.     
  227.     def analyse_text(text):
  228.         rv = 0
  229.         if re.search('\\{%\\s*(block|extends)', text) is not None:
  230.             rv += 0.4
  231.         
  232.         if re.search('\\{%\\s*if\\s*.*?%\\}', text) is not None:
  233.             rv += 0.1
  234.         
  235.         if re.search('\\{\\{.*?\\}\\}', text) is not None:
  236.             rv += 0.1
  237.         
  238.         return rv
  239.  
  240.  
  241.  
  242. class MyghtyLexer(RegexLexer):
  243.     name = 'Myghty'
  244.     aliases = [
  245.         'myghty']
  246.     filenames = [
  247.         '*.myt',
  248.         'autodelegate']
  249.     mimetypes = [
  250.         'application/x-myghty']
  251.     tokens = {
  252.         'root': [
  253.             ('\\s+', Text),
  254.             ('(<%(def|method))(\\s*)(.*?)(>)(.*?)(</%\\2\\s*>)(?s)', bygroups(Name.Tag, None, Text, Name.Function, Name.Tag, using(this), Name.Tag)),
  255.             ('(<%(\\w+))(.*?)(>)(.*?)(</%\\2\\s*>)(?s)', bygroups(Name.Tag, None, Name.Function, Name.Tag, using(PythonLexer), Name.Tag)),
  256.             ('(<&[^|])(.*?)(,.*?)?(&>)', bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
  257.             ('(<&\\|)(.*?)(,.*?)?(&>)(?s)', bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
  258.             ('</&>', Name.Tag),
  259.             ('(<%!?)(.*?)(%>)(?s)', bygroups(Name.Tag, using(PythonLexer), Name.Tag)),
  260.             ('(?<=^)#[^\\n]*(\\n|\\Z)', Comment),
  261.             ('(?<=^)(%)([^\\n]*)(\\n|\\Z)', bygroups(Name.Tag, using(PythonLexer), Other)),
  262.             ("(?sx)\n                 (.+?)               # anything, followed by:\n                 (?:\n                  (?<=\\n)(?=[%#]) |  # an eval or comment line\n                  (?=</?[%&]) |      # a substitution or block or\n                                     # call start or end\n                                     # - don't consume\n                  (\\\\\\n) |           # an escaped newline\n                  \\Z                 # end of string\n                 )", bygroups(Other, Operator))] }
  263.  
  264.  
  265. class MyghtyHtmlLexer(DelegatingLexer):
  266.     name = 'HTML+Myghty'
  267.     aliases = [
  268.         'html+myghty']
  269.     mimetypes = [
  270.         'text/html+myghty']
  271.     
  272.     def __init__(self, **options):
  273.         super(MyghtyHtmlLexer, self).__init__(HtmlLexer, MyghtyLexer, **options)
  274.  
  275.  
  276.  
  277. class MyghtyXmlLexer(DelegatingLexer):
  278.     name = 'XML+Myghty'
  279.     aliases = [
  280.         'xml+myghty']
  281.     mimetypes = [
  282.         'application/xml+myghty']
  283.     
  284.     def __init__(self, **options):
  285.         super(MyghtyXmlLexer, self).__init__(XmlLexer, MyghtyLexer, **options)
  286.  
  287.  
  288.  
  289. class MyghtyJavascriptLexer(DelegatingLexer):
  290.     name = 'JavaScript+Myghty'
  291.     aliases = [
  292.         'js+myghty',
  293.         'javascript+myghty']
  294.     mimetypes = [
  295.         'application/x-javascript+myghty',
  296.         'text/x-javascript+myghty',
  297.         'text/javascript+mygthy']
  298.     
  299.     def __init__(self, **options):
  300.         super(MyghtyJavascriptLexer, self).__init__(JavascriptLexer, MyghtyLexer, **options)
  301.  
  302.  
  303.  
  304. class MyghtyCssLexer(DelegatingLexer):
  305.     name = 'CSS+Myghty'
  306.     aliases = [
  307.         'css+myghty']
  308.     mimetypes = [
  309.         'text/css+myghty']
  310.     
  311.     def __init__(self, **options):
  312.         super(MyghtyCssLexer, self).__init__(CssLexer, MyghtyLexer, **options)
  313.  
  314.  
  315.  
  316. class MakoLexer(RegexLexer):
  317.     name = 'Mako'
  318.     aliases = [
  319.         'mako']
  320.     filenames = [
  321.         '*.mao']
  322.     mimetypes = [
  323.         'application/x-mako']
  324.     tokens = {
  325.         'root': [
  326.             ('(\\s*)(%)(\\s*end(?:\\w+))(\\n|\\Z)', bygroups(Text, Comment.Preproc, Keyword, Other)),
  327.             ('(\\s*)(%)([^\\n]*)(\\n|\\Z)', bygroups(Text, Comment.Preproc, using(PythonLexer), Other)),
  328.             ('(\\s*)(##[^\\n]*)(\\n|\\Z)', bygroups(Text, Comment.Preproc, Other)),
  329.             ('(?s)<%doc>.*?</%doc>', Comment.Preproc),
  330.             ('(<%)([\\w\\.\\:]+)', bygroups(Comment.Preproc, Name.Builtin), 'tag'),
  331.             ('(</%)([\\w\\.\\:]+)(>)', bygroups(Comment.Preproc, Name.Builtin, Comment.Preproc)),
  332.             ('<%(?=([\\w\\.\\:]+))', Comment.Preproc, 'ondeftags'),
  333.             ('(<%(?:!?))(.*?)(%>)(?s)', bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
  334.             ('(\\$\\{)(.*?)(\\})', bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
  335.             ("(?sx)\n                (.+?)                # anything, followed by:\n                (?:\n                 (?<=\\n)(?=%|\\#\\#) | # an eval or comment line\n                 (?=\\#\\*) |          # multiline comment\n                 (?=</?%) |          # a python block\n                                     # call start or end\n                 (?=\\$\\{) |          # a substitution\n                 (?<=\\n)(?=\\s*%) |\n                                     # - don't consume\n                 (\\\\\\n) |            # an escaped newline\n                 \\Z                  # end of string\n                )\n            ", bygroups(Other, Operator)),
  336.             ('\\s+', Text)],
  337.         'ondeftags': [
  338.             ('<%', Comment.Preproc),
  339.             ('(?<=<%)(include|inherit|namespace|page)', Name.Builtin),
  340.             include('tag')],
  341.         'tag': [
  342.             ('((?:\\w+)\\s*=)\\s*(".*?")', bygroups(Name.Attribute, String)),
  343.             ('/?\\s*>', Comment.Preproc, '#pop'),
  344.             ('\\s+', Text)],
  345.         'attr': [
  346.             ('".*?"', String, '#pop'),
  347.             ("'.*?'", String, '#pop'),
  348.             ('[^\\s>]+', String, '#pop')] }
  349.  
  350.  
  351. class MakoHtmlLexer(DelegatingLexer):
  352.     name = 'HTML+Mako'
  353.     aliases = [
  354.         'html+mako']
  355.     mimetypes = [
  356.         'text/html+mako']
  357.     
  358.     def __init__(self, **options):
  359.         super(MakoHtmlLexer, self).__init__(HtmlLexer, MakoLexer, **options)
  360.  
  361.  
  362.  
  363. class MakoXmlLexer(DelegatingLexer):
  364.     name = 'XML+Mako'
  365.     aliases = [
  366.         'xml+mako']
  367.     mimetypes = [
  368.         'application/xml+mako']
  369.     
  370.     def __init__(self, **options):
  371.         super(MakoXmlLexer, self).__init__(XmlLexer, MakoLexer, **options)
  372.  
  373.  
  374.  
  375. class MakoJavascriptLexer(DelegatingLexer):
  376.     name = 'JavaScript+Mako'
  377.     aliases = [
  378.         'js+mako',
  379.         'javascript+mako']
  380.     mimetypes = [
  381.         'application/x-javascript+mako',
  382.         'text/x-javascript+mako',
  383.         'text/javascript+mako']
  384.     
  385.     def __init__(self, **options):
  386.         super(MakoJavascriptLexer, self).__init__(JavascriptLexer, MakoLexer, **options)
  387.  
  388.  
  389.  
  390. class MakoCssLexer(DelegatingLexer):
  391.     name = 'CSS+Mako'
  392.     aliases = [
  393.         'css+mako']
  394.     mimetypes = [
  395.         'text/css+mako']
  396.     
  397.     def __init__(self, **options):
  398.         super(MakoCssLexer, self).__init__(CssLexer, MakoLexer, **options)
  399.  
  400.  
  401.  
  402. class CheetahPythonLexer(Lexer):
  403.     
  404.     def get_tokens_unprocessed(self, text):
  405.         pylexer = PythonLexer(**self.options)
  406.         for pos, type_, value in pylexer.get_tokens_unprocessed(text):
  407.             if type_ == Token.Error and value == '$':
  408.                 type_ = Comment.Preproc
  409.             
  410.             yield (pos, type_, value)
  411.         
  412.  
  413.  
  414.  
  415. class CheetahLexer(RegexLexer):
  416.     name = 'Cheetah'
  417.     aliases = [
  418.         'cheetah',
  419.         'spitfire']
  420.     filenames = [
  421.         '*.tmpl',
  422.         '*.spt']
  423.     mimetypes = [
  424.         'application/x-cheetah',
  425.         'application/x-spitfire']
  426.     tokens = {
  427.         'root': [
  428.             ('(##[^\\n]*)$', bygroups(Comment)),
  429.             ('#[*](.|\\n)*?[*]#', Comment),
  430.             ('#end[^#\\n]*(?:#|$)', Comment.Preproc),
  431.             ('#slurp$', Comment.Preproc),
  432.             ('(#[a-zA-Z]+)([^#\\n]*)(#|$)', bygroups(Comment.Preproc, using(CheetahPythonLexer), Comment.Preproc)),
  433.             ('(\\$)([a-zA-Z_][a-zA-Z0-9_\\.]*[a-zA-Z0-9_])', bygroups(Comment.Preproc, using(CheetahPythonLexer))),
  434.             ('(\\$\\{!?)(.*?)(\\})(?s)', bygroups(Comment.Preproc, using(CheetahPythonLexer), Comment.Preproc)),
  435.             ('(?sx)\n                (.+?)               # anything, followed by:\n                (?:\n                 (?=[#][#a-zA-Z]*) |   # an eval comment\n                 (?=\\$[a-zA-Z_{]) | # a substitution\n                 \\Z                 # end of string\n                )\n            ', Other),
  436.             ('\\s+', Text)] }
  437.  
  438.  
  439. class CheetahHtmlLexer(DelegatingLexer):
  440.     name = 'HTML+Cheetah'
  441.     aliases = [
  442.         'html+cheetah',
  443.         'html+spitfire']
  444.     mimetypes = [
  445.         'text/html+cheetah',
  446.         'text/html+spitfire']
  447.     
  448.     def __init__(self, **options):
  449.         super(CheetahHtmlLexer, self).__init__(HtmlLexer, CheetahLexer, **options)
  450.  
  451.  
  452.  
  453. class CheetahXmlLexer(DelegatingLexer):
  454.     name = 'XML+Cheetah'
  455.     aliases = [
  456.         'xml+cheetah',
  457.         'xml+spitfire']
  458.     mimetypes = [
  459.         'application/xml+cheetah',
  460.         'application/xml+spitfire']
  461.     
  462.     def __init__(self, **options):
  463.         super(CheetahXmlLexer, self).__init__(XmlLexer, CheetahLexer, **options)
  464.  
  465.  
  466.  
  467. class CheetahJavascriptLexer(DelegatingLexer):
  468.     name = 'JavaScript+Cheetah'
  469.     aliases = [
  470.         'js+cheetah',
  471.         'javascript+cheetah',
  472.         'js+spitfire',
  473.         'javascript+spitfire']
  474.     mimetypes = [
  475.         'application/x-javascript+cheetah',
  476.         'text/x-javascript+cheetah',
  477.         'text/javascript+cheetah',
  478.         'application/x-javascript+spitfire',
  479.         'text/x-javascript+spitfire',
  480.         'text/javascript+spitfire']
  481.     
  482.     def __init__(self, **options):
  483.         super(CheetahJavascriptLexer, self).__init__(JavascriptLexer, CheetahLexer, **options)
  484.  
  485.  
  486.  
  487. class GenshiTextLexer(RegexLexer):
  488.     name = 'Genshi Text'
  489.     aliases = [
  490.         'genshitext']
  491.     mimetypes = [
  492.         'application/x-genshi-text',
  493.         'text/x-genshi']
  494.     tokens = {
  495.         'root': [
  496.             ('[^#\\$\\s]+', Other),
  497.             ('^(\\s*)(##.*)$', bygroups(Text, Comment)),
  498.             ('^(\\s*)(#)', bygroups(Text, Comment.Preproc), 'directive'),
  499.             include('variable'),
  500.             ('[#\\$\\s]', Other)],
  501.         'directive': [
  502.             ('\\n', Text, '#pop'),
  503.             ('(?:def|for|if)\\s+.*', using(PythonLexer), '#pop'),
  504.             ('(choose|when|with)([^\\S\\n]+)(.*)', bygroups(Keyword, Text, using(PythonLexer)), '#pop'),
  505.             ('(choose|otherwise)\\b', Keyword, '#pop'),
  506.             ('(end\\w*)([^\\S\\n]*)(.*)', bygroups(Keyword, Text, Comment), '#pop')],
  507.         'variable': [
  508.             ('(?<!\\$)(\\$\\{)(.+?)(\\})', bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
  509.             ('(?<!\\$)(\\$)([a-zA-Z_][a-zA-Z0-9_\\.]*)', Name.Variable)] }
  510.  
  511.  
  512. class GenshiMarkupLexer(RegexLexer):
  513.     flags = re.DOTALL
  514.     tokens = {
  515.         'root': [
  516.             ('[^<\\$]+', Other),
  517.             ('(<\\?python)(.*?)(\\?>)', bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
  518.             ('<\\s*(script|style)\\s*.*?>.*?<\\s*/\\1\\s*>', Other),
  519.             ('<\\s*py:[a-zA-Z0-9]+', Name.Tag, 'pytag'),
  520.             ('<\\s*[a-zA-Z0-9:]+', Name.Tag, 'tag'),
  521.             include('variable'),
  522.             ('[<\\$]', Other)],
  523.         'pytag': [
  524.             ('\\s+', Text),
  525.             ('[a-zA-Z0-9_:-]+\\s*=', Name.Attribute, 'pyattr'),
  526.             ('/?\\s*>', Name.Tag, '#pop')],
  527.         'pyattr': [
  528.             ('(")(.*?)(")', bygroups(String, using(PythonLexer), String), '#pop'),
  529.             ("(')(.*?)(')", bygroups(String, using(PythonLexer), String), '#pop'),
  530.             ('[^\\s>]+', String, '#pop')],
  531.         'tag': [
  532.             ('\\s+', Text),
  533.             ('py:[a-zA-Z0-9_-]+\\s*=', Name.Attribute, 'pyattr'),
  534.             ('[a-zA-Z0-9_:-]+\\s*=', Name.Attribute, 'attr'),
  535.             ('/?\\s*>', Name.Tag, '#pop')],
  536.         'attr': [
  537.             ('"', String, 'attr-dstring'),
  538.             ("'", String, 'attr-sstring'),
  539.             ('[^\\s>]*', String, '#pop')],
  540.         'attr-dstring': [
  541.             ('"', String, '#pop'),
  542.             include('strings'),
  543.             ("'", String)],
  544.         'attr-sstring': [
  545.             ("'", String, '#pop'),
  546.             include('strings'),
  547.             ("'", String)],
  548.         'strings': [
  549.             ('[^"\'$]+', String),
  550.             include('variable')],
  551.         'variable': [
  552.             ('(?<!\\$)(\\$\\{)(.+?)(\\})', bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
  553.             ('(?<!\\$)(\\$)([a-zA-Z_][a-zA-Z0-9_\\.]*)', Name.Variable)] }
  554.  
  555.  
  556. class HtmlGenshiLexer(DelegatingLexer):
  557.     name = 'HTML+Genshi'
  558.     aliases = [
  559.         'html+genshi',
  560.         'html+kid']
  561.     alias_filenames = [
  562.         '*.html',
  563.         '*.htm',
  564.         '*.xhtml']
  565.     mimetypes = [
  566.         'text/html+genshi']
  567.     
  568.     def __init__(self, **options):
  569.         super(HtmlGenshiLexer, self).__init__(HtmlLexer, GenshiMarkupLexer, **options)
  570.  
  571.     
  572.     def analyse_text(text):
  573.         rv = 0
  574.         if re.search('\\$\\{.*?\\}', text) is not None:
  575.             rv += 0.2
  576.         
  577.         if re.search('py:(.*?)=["\']', text) is not None:
  578.             rv += 0.2
  579.         
  580.         return rv + HtmlLexer.analyse_text(text) - 0.01
  581.  
  582.  
  583.  
  584. class GenshiLexer(DelegatingLexer):
  585.     name = 'Genshi'
  586.     aliases = [
  587.         'genshi',
  588.         'kid',
  589.         'xml+genshi',
  590.         'xml+kid']
  591.     filenames = [
  592.         '*.kid']
  593.     alias_filenames = [
  594.         '*.xml']
  595.     mimetypes = [
  596.         'application/x-genshi',
  597.         'application/x-kid']
  598.     
  599.     def __init__(self, **options):
  600.         super(GenshiLexer, self).__init__(XmlLexer, GenshiMarkupLexer, **options)
  601.  
  602.     
  603.     def analyse_text(text):
  604.         rv = 0
  605.         if re.search('\\$\\{.*?\\}', text) is not None:
  606.             rv += 0.2
  607.         
  608.         if re.search('py:(.*?)=["\']', text) is not None:
  609.             rv += 0.2
  610.         
  611.         return rv + XmlLexer.analyse_text(text) - 0.01
  612.  
  613.  
  614.  
  615. class JavascriptGenshiLexer(DelegatingLexer):
  616.     name = 'JavaScript+Genshi Text'
  617.     aliases = [
  618.         'js+genshitext',
  619.         'js+genshi',
  620.         'javascript+genshitext',
  621.         'javascript+genshi']
  622.     alias_filenames = [
  623.         '*.js']
  624.     mimetypes = [
  625.         'application/x-javascript+genshi',
  626.         'text/x-javascript+genshi',
  627.         'text/javascript+genshi']
  628.     
  629.     def __init__(self, **options):
  630.         super(JavascriptGenshiLexer, self).__init__(JavascriptLexer, GenshiTextLexer, **options)
  631.  
  632.     
  633.     def analyse_text(text):
  634.         return GenshiLexer.analyse_text(text) - 0.05
  635.  
  636.  
  637.  
  638. class CssGenshiLexer(DelegatingLexer):
  639.     name = 'CSS+Genshi Text'
  640.     aliases = [
  641.         'css+genshitext',
  642.         'css+genshi']
  643.     alias_filenames = [
  644.         '*.css']
  645.     mimetypes = [
  646.         'text/css+genshi']
  647.     
  648.     def __init__(self, **options):
  649.         super(CssGenshiLexer, self).__init__(CssLexer, GenshiTextLexer, **options)
  650.  
  651.     
  652.     def analyse_text(text):
  653.         return GenshiLexer.analyse_text(text) - 0.05
  654.  
  655.  
  656.  
  657. class RhtmlLexer(DelegatingLexer):
  658.     name = 'RHTML'
  659.     aliases = [
  660.         'rhtml',
  661.         'html+erb',
  662.         'html+ruby']
  663.     filenames = [
  664.         '*.rhtml']
  665.     alias_filenames = [
  666.         '*.html',
  667.         '*.htm',
  668.         '*.xhtml']
  669.     mimetypes = [
  670.         'text/html+ruby']
  671.     
  672.     def __init__(self, **options):
  673.         super(RhtmlLexer, self).__init__(HtmlLexer, ErbLexer, **options)
  674.  
  675.     
  676.     def analyse_text(text):
  677.         rv = ErbLexer.analyse_text(text) - 0.01
  678.         if html_doctype_matches(text):
  679.             rv += 0.5
  680.         
  681.         return rv
  682.  
  683.  
  684.  
  685. class XmlErbLexer(DelegatingLexer):
  686.     name = 'XML+Ruby'
  687.     aliases = [
  688.         'xml+erb',
  689.         'xml+ruby']
  690.     alias_filenames = [
  691.         '*.xml']
  692.     mimetypes = [
  693.         'application/xml+ruby']
  694.     
  695.     def __init__(self, **options):
  696.         super(XmlErbLexer, self).__init__(XmlLexer, ErbLexer, **options)
  697.  
  698.     
  699.     def analyse_text(text):
  700.         rv = ErbLexer.analyse_text(text) - 0.01
  701.         if looks_like_xml(text):
  702.             rv += 0.4
  703.         
  704.         return rv
  705.  
  706.  
  707.  
  708. class CssErbLexer(DelegatingLexer):
  709.     name = 'CSS+Ruby'
  710.     aliases = [
  711.         'css+erb',
  712.         'css+ruby']
  713.     alias_filenames = [
  714.         '*.css']
  715.     mimetypes = [
  716.         'text/css+ruby']
  717.     
  718.     def __init__(self, **options):
  719.         super(CssErbLexer, self).__init__(CssLexer, ErbLexer, **options)
  720.  
  721.     
  722.     def analyse_text(text):
  723.         return ErbLexer.analyse_text(text) - 0.05
  724.  
  725.  
  726.  
  727. class JavascriptErbLexer(DelegatingLexer):
  728.     name = 'JavaScript+Ruby'
  729.     aliases = [
  730.         'js+erb',
  731.         'javascript+erb',
  732.         'js+ruby',
  733.         'javascript+ruby']
  734.     alias_filenames = [
  735.         '*.js']
  736.     mimetypes = [
  737.         'application/x-javascript+ruby',
  738.         'text/x-javascript+ruby',
  739.         'text/javascript+ruby']
  740.     
  741.     def __init__(self, **options):
  742.         super(JavascriptErbLexer, self).__init__(JavascriptLexer, ErbLexer, **options)
  743.  
  744.     
  745.     def analyse_text(text):
  746.         return ErbLexer.analyse_text(text) - 0.05
  747.  
  748.  
  749.  
  750. class HtmlPhpLexer(DelegatingLexer):
  751.     name = 'HTML+PHP'
  752.     aliases = [
  753.         'html+php']
  754.     filenames = [
  755.         '*.phtml']
  756.     alias_filenames = [
  757.         '*.php',
  758.         '*.html',
  759.         '*.htm',
  760.         '*.xhtml',
  761.         '*.php[345]']
  762.     mimetypes = [
  763.         'application/x-php',
  764.         'application/x-httpd-php',
  765.         'application/x-httpd-php3',
  766.         'application/x-httpd-php4',
  767.         'application/x-httpd-php5']
  768.     
  769.     def __init__(self, **options):
  770.         super(HtmlPhpLexer, self).__init__(HtmlLexer, PhpLexer, **options)
  771.  
  772.     
  773.     def analyse_text(text):
  774.         rv = PhpLexer.analyse_text(text) - 0.01
  775.         if html_doctype_matches(text):
  776.             rv += 0.5
  777.         
  778.         return rv
  779.  
  780.  
  781.  
  782. class XmlPhpLexer(DelegatingLexer):
  783.     name = 'XML+PHP'
  784.     aliases = [
  785.         'xml+php']
  786.     alias_filenames = [
  787.         '*.xml',
  788.         '*.php',
  789.         '*.php[345]']
  790.     mimetypes = [
  791.         'application/xml+php']
  792.     
  793.     def __init__(self, **options):
  794.         super(XmlPhpLexer, self).__init__(XmlLexer, PhpLexer, **options)
  795.  
  796.     
  797.     def analyse_text(text):
  798.         rv = PhpLexer.analyse_text(text) - 0.01
  799.         if looks_like_xml(text):
  800.             rv += 0.4
  801.         
  802.         return rv
  803.  
  804.  
  805.  
  806. class CssPhpLexer(DelegatingLexer):
  807.     name = 'CSS+PHP'
  808.     aliases = [
  809.         'css+php']
  810.     alias_filenames = [
  811.         '*.css']
  812.     mimetypes = [
  813.         'text/css+php']
  814.     
  815.     def __init__(self, **options):
  816.         super(CssPhpLexer, self).__init__(CssLexer, PhpLexer, **options)
  817.  
  818.     
  819.     def analyse_text(text):
  820.         return PhpLexer.analyse_text(text) - 0.05
  821.  
  822.  
  823.  
  824. class JavascriptPhpLexer(DelegatingLexer):
  825.     name = 'JavaScript+PHP'
  826.     aliases = [
  827.         'js+php',
  828.         'javascript+php']
  829.     alias_filenames = [
  830.         '*.js']
  831.     mimetypes = [
  832.         'application/x-javascript+php',
  833.         'text/x-javascript+php',
  834.         'text/javascript+php']
  835.     
  836.     def __init__(self, **options):
  837.         super(JavascriptPhpLexer, self).__init__(JavascriptLexer, PhpLexer, **options)
  838.  
  839.     
  840.     def analyse_text(text):
  841.         return PhpLexer.analyse_text(text)
  842.  
  843.  
  844.  
  845. class HtmlSmartyLexer(DelegatingLexer):
  846.     name = 'HTML+Smarty'
  847.     aliases = [
  848.         'html+smarty']
  849.     alias_filenames = [
  850.         '*.html',
  851.         '*.htm',
  852.         '*.xhtml',
  853.         '*.tpl']
  854.     mimetypes = [
  855.         'text/html+smarty']
  856.     
  857.     def __init__(self, **options):
  858.         super(HtmlSmartyLexer, self).__init__(HtmlLexer, SmartyLexer, **options)
  859.  
  860.     
  861.     def analyse_text(text):
  862.         rv = SmartyLexer.analyse_text(text) - 0.01
  863.         if html_doctype_matches(text):
  864.             rv += 0.5
  865.         
  866.         return rv
  867.  
  868.  
  869.  
  870. class XmlSmartyLexer(DelegatingLexer):
  871.     name = 'XML+Smarty'
  872.     aliases = [
  873.         'xml+smarty']
  874.     alias_filenames = [
  875.         '*.xml',
  876.         '*.tpl']
  877.     mimetypes = [
  878.         'application/xml+smarty']
  879.     
  880.     def __init__(self, **options):
  881.         super(XmlSmartyLexer, self).__init__(XmlLexer, SmartyLexer, **options)
  882.  
  883.     
  884.     def analyse_text(text):
  885.         rv = SmartyLexer.analyse_text(text) - 0.01
  886.         if looks_like_xml(text):
  887.             rv += 0.4
  888.         
  889.         return rv
  890.  
  891.  
  892.  
  893. class CssSmartyLexer(DelegatingLexer):
  894.     name = 'CSS+Smarty'
  895.     aliases = [
  896.         'css+smarty']
  897.     alias_filenames = [
  898.         '*.css',
  899.         '*.tpl']
  900.     mimetypes = [
  901.         'text/css+smarty']
  902.     
  903.     def __init__(self, **options):
  904.         super(CssSmartyLexer, self).__init__(CssLexer, SmartyLexer, **options)
  905.  
  906.     
  907.     def analyse_text(text):
  908.         return SmartyLexer.analyse_text(text) - 0.05
  909.  
  910.  
  911.  
  912. class JavascriptSmartyLexer(DelegatingLexer):
  913.     name = 'JavaScript+Smarty'
  914.     aliases = [
  915.         'js+smarty',
  916.         'javascript+smarty']
  917.     alias_filenames = [
  918.         '*.js',
  919.         '*.tpl']
  920.     mimetypes = [
  921.         'application/x-javascript+smarty',
  922.         'text/x-javascript+smarty',
  923.         'text/javascript+smarty']
  924.     
  925.     def __init__(self, **options):
  926.         super(JavascriptSmartyLexer, self).__init__(JavascriptLexer, SmartyLexer, **options)
  927.  
  928.     
  929.     def analyse_text(text):
  930.         return SmartyLexer.analyse_text(text) - 0.05
  931.  
  932.  
  933.  
  934. class HtmlDjangoLexer(DelegatingLexer):
  935.     name = 'HTML+Django/Jinja'
  936.     aliases = [
  937.         'html+django',
  938.         'html+jinja']
  939.     alias_filenames = [
  940.         '*.html',
  941.         '*.htm',
  942.         '*.xhtml']
  943.     mimetypes = [
  944.         'text/html+django',
  945.         'text/html+jinja']
  946.     
  947.     def __init__(self, **options):
  948.         super(HtmlDjangoLexer, self).__init__(HtmlLexer, DjangoLexer, **options)
  949.  
  950.     
  951.     def analyse_text(text):
  952.         rv = DjangoLexer.analyse_text(text) - 0.01
  953.         if html_doctype_matches(text):
  954.             rv += 0.5
  955.         
  956.         return rv
  957.  
  958.  
  959.  
  960. class XmlDjangoLexer(DelegatingLexer):
  961.     name = 'XML+Django/Jinja'
  962.     aliases = [
  963.         'xml+django',
  964.         'xml+jinja']
  965.     alias_filenames = [
  966.         '*.xml']
  967.     mimetypes = [
  968.         'application/xml+django',
  969.         'application/xml+jinja']
  970.     
  971.     def __init__(self, **options):
  972.         super(XmlDjangoLexer, self).__init__(XmlLexer, DjangoLexer, **options)
  973.  
  974.     
  975.     def analyse_text(text):
  976.         rv = DjangoLexer.analyse_text(text) - 0.01
  977.         if looks_like_xml(text):
  978.             rv += 0.4
  979.         
  980.         return rv
  981.  
  982.  
  983.  
  984. class CssDjangoLexer(DelegatingLexer):
  985.     name = 'CSS+Django/Jinja'
  986.     aliases = [
  987.         'css+django',
  988.         'css+jinja']
  989.     alias_filenames = [
  990.         '*.css']
  991.     mimetypes = [
  992.         'text/css+django',
  993.         'text/css+jinja']
  994.     
  995.     def __init__(self, **options):
  996.         super(CssDjangoLexer, self).__init__(CssLexer, DjangoLexer, **options)
  997.  
  998.     
  999.     def analyse_text(text):
  1000.         return DjangoLexer.analyse_text(text) - 0.05
  1001.  
  1002.  
  1003.  
  1004. class JavascriptDjangoLexer(DelegatingLexer):
  1005.     name = 'JavaScript+Django/Jinja'
  1006.     aliases = [
  1007.         'js+django',
  1008.         'javascript+django',
  1009.         'js+jinja',
  1010.         'javascript+jinja']
  1011.     alias_filenames = [
  1012.         '*.js']
  1013.     mimetypes = [
  1014.         'application/x-javascript+django',
  1015.         'application/x-javascript+jinja',
  1016.         'text/x-javascript+django',
  1017.         'text/x-javascript+jinja',
  1018.         'text/javascript+django',
  1019.         'text/javascript+jinja']
  1020.     
  1021.     def __init__(self, **options):
  1022.         super(JavascriptDjangoLexer, self).__init__(JavascriptLexer, DjangoLexer, **options)
  1023.  
  1024.     
  1025.     def analyse_text(text):
  1026.         return DjangoLexer.analyse_text(text) - 0.05
  1027.  
  1028.  
  1029.  
  1030. class JspRootLexer(RegexLexer):
  1031.     tokens = {
  1032.         'root': [
  1033.             ('<%\\S?', Keyword, 'sec'),
  1034.             ('</?jsp:(forward|getProperty|include|plugin|setProperty|useBean).*?>', Keyword),
  1035.             ('[^<]+', Other),
  1036.             ('<', Other)],
  1037.         'sec': [
  1038.             ('%>', Keyword, '#pop'),
  1039.             ('[\\w\\W]+?(?=%>|\\Z)', using(JavaLexer))] }
  1040.  
  1041.  
  1042. class JspLexer(DelegatingLexer):
  1043.     name = 'Java Server Page'
  1044.     aliases = [
  1045.         'jsp']
  1046.     filenames = [
  1047.         '*.jsp']
  1048.     mimetypes = [
  1049.         'application/x-jsp']
  1050.     
  1051.     def __init__(self, **options):
  1052.         super(JspLexer, self).__init__(XmlLexer, JspRootLexer, **options)
  1053.  
  1054.     
  1055.     def analyse_text(text):
  1056.         rv = JavaLexer.analyse_text(text) - 0.01
  1057.         if looks_like_xml(text):
  1058.             rv += 0.4
  1059.         
  1060.         if '<%' in text and '%>' in text:
  1061.             rv += 0.1
  1062.         
  1063.         return rv
  1064.  
  1065.  
  1066.  
  1067. class EvoqueLexer(RegexLexer):
  1068.     name = 'Evoque'
  1069.     aliases = [
  1070.         'evoque']
  1071.     filenames = [
  1072.         '*.evoque']
  1073.     mimetypes = [
  1074.         'application/x-evoque']
  1075.     flags = re.DOTALL
  1076.     tokens = {
  1077.         'root': [
  1078.             ('[^#$]+', Other),
  1079.             ('#\\[', Comment.Multiline, 'comment'),
  1080.             ('\\$\\$', Other),
  1081.             ('\\$\\w+:[^$\\n]*\\$', Comment.Multiline),
  1082.             ('(\\$)(begin|end)(\\{(%)?)(.*?)((?(4)%)\\})', bygroups(Punctuation, Name.Builtin, Punctuation, None, String, Punctuation, None)),
  1083.             ('(\\$)(evoque|overlay)(\\{(%)?)(\\s*[#\\w\\-"\\\'.]+[^=,%}]+?)?(.*?)((?(4)%)\\})', bygroups(Punctuation, Name.Builtin, Punctuation, None, String, using(PythonLexer), Punctuation, None)),
  1084.             ('(\\$)(\\w+)(\\{(%)?)(.*?)((?(4)%)\\})', bygroups(Punctuation, Name.Builtin, Punctuation, None, using(PythonLexer), Punctuation, None)),
  1085.             ('(\\$)(else|rof|fi)', bygroups(Punctuation, Name.Builtin)),
  1086.             ('(\\$\\{(%)?)(.*?)((!)(.*?))?((?(2)%)\\})', bygroups(Punctuation, None, using(PythonLexer), Name.Builtin, None, None, Punctuation, None)),
  1087.             ('#', Other)],
  1088.         'comment': [
  1089.             ('[^\\]#]', Comment.Multiline),
  1090.             ('#\\[', Comment.Multiline, '#push'),
  1091.             ('\\]#', Comment.Multiline, '#pop'),
  1092.             ('[\\]#]', Comment.Multiline)] }
  1093.  
  1094.  
  1095. class EvoqueHtmlLexer(DelegatingLexer):
  1096.     name = 'HTML+Evoque'
  1097.     aliases = [
  1098.         'html+evoque']
  1099.     filenames = [
  1100.         '*.html']
  1101.     mimetypes = [
  1102.         'text/html+evoque']
  1103.     
  1104.     def __init__(self, **options):
  1105.         super(EvoqueHtmlLexer, self).__init__(HtmlLexer, EvoqueLexer, **options)
  1106.  
  1107.  
  1108.  
  1109. class EvoqueXmlLexer(DelegatingLexer):
  1110.     name = 'XML+Evoque'
  1111.     aliases = [
  1112.         'xml+evoque']
  1113.     filenames = [
  1114.         '*.xml']
  1115.     mimetypes = [
  1116.         'application/xml+evoque']
  1117.     
  1118.     def __init__(self, **options):
  1119.         super(EvoqueXmlLexer, self).__init__(XmlLexer, EvoqueLexer, **options)
  1120.  
  1121.  
  1122.  
  1123. class ColdfusionLexer(RegexLexer):
  1124.     name = 'cfstatement'
  1125.     aliases = [
  1126.         'cfs']
  1127.     filenames = []
  1128.     mimetypes = []
  1129.     flags = re.IGNORECASE | re.MULTILINE
  1130.     tokens = {
  1131.         'root': [
  1132.             ('//.*', Comment),
  1133.             ('\\+\\+|--', Operator),
  1134.             ('[-+*/^&=!]', Operator),
  1135.             ('<=|>=|<|>', Operator),
  1136.             ('mod\\b', Operator),
  1137.             ('(eq|lt|gt|lte|gte|not|is|and|or)\\b', Operator),
  1138.             ('\\|\\||&&', Operator),
  1139.             ('"', String.Double, 'string'),
  1140.             ("'.*?'", String.Single),
  1141.             ('\\d+', Number),
  1142.             ('(if|else|len|var|case|default|break|switch)\\b', Keyword),
  1143.             ('([A-Za-z_$][A-Za-z0-9_.]*)\\s*(\\()', bygroups(Name.Function, Punctuation)),
  1144.             ('[A-Za-z_$][A-Za-z0-9_.]*', Name.Variable),
  1145.             ('[()\\[\\]{};:,.\\\\]', Punctuation),
  1146.             ('\\s+', Text)],
  1147.         'string': [
  1148.             ('""', String.Double),
  1149.             ('#.+?#', String.Interp),
  1150.             ('[^"#]+', String.Double),
  1151.             ('#', String.Double),
  1152.             ('"', String.Double, '#pop')] }
  1153.  
  1154.  
  1155. class ColdfusionMarkupLexer(RegexLexer):
  1156.     name = 'Coldfusion'
  1157.     aliases = [
  1158.         'cf']
  1159.     filenames = []
  1160.     mimetypes = []
  1161.     tokens = {
  1162.         'root': [
  1163.             ('[^<]+', Other),
  1164.             include('tags'),
  1165.             ('<[^<>]*', Other)],
  1166.         'tags': [
  1167.             ('(?s)<!---.*?--->', Comment.Multiline),
  1168.             ('(?s)<!--.*?-->', Comment),
  1169.             ('<cfoutput.*?>', Name.Builtin, 'cfoutput'),
  1170.             ('(?s)(<cfscript.*?>)(.+?)(</cfscript.*?>)', bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
  1171.             ('(?s)(</?cf(?:component|include|if|else|elseif|loop|return|dbinfo|dump|abort|location|invoke|throw|file|savecontent|mailpart|mail|header|content|zip|image|lock|argument|try|catch|break|directory|http|set|function|param)\\b)(.*?)((?<!\\\\)>)', bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin))],
  1172.         'cfoutput': [
  1173.             ('[^#<]+', Other),
  1174.             ('(#)(.*?)(#)', bygroups(Punctuation, using(ColdfusionLexer), Punctuation)),
  1175.             ('</cfoutput.*?>', Name.Builtin, '#pop'),
  1176.             include('tags'),
  1177.             ('(?s)<[^<>]*', Other),
  1178.             ('#', Other)] }
  1179.  
  1180.  
  1181. class ColdfusionHtmlLexer(DelegatingLexer):
  1182.     name = 'Coldufsion HTML'
  1183.     aliases = [
  1184.         'cfm']
  1185.     filenames = [
  1186.         '*.cfm',
  1187.         '*.cfml',
  1188.         '*.cfc']
  1189.     mimetypes = [
  1190.         'application/x-coldfusion']
  1191.     
  1192.     def __init__(self, **options):
  1193.         super(ColdfusionHtmlLexer, self).__init__(HtmlLexer, ColdfusionMarkupLexer, **options)
  1194.  
  1195.  
  1196.