3 pygments.lexers.dotnet |
3 pygments.lexers.dotnet |
4 ~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for .net languages. |
6 Lexers for .net languages. |
7 |
7 |
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 import re |
11 import re |
12 |
12 |
13 from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \ |
13 from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \ |
505 aliases = ['aspx-cs'] |
505 aliases = ['aspx-cs'] |
506 filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] |
506 filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] |
507 mimetypes = [] |
507 mimetypes = [] |
508 |
508 |
509 def __init__(self, **options): |
509 def __init__(self, **options): |
510 super(CSharpAspxLexer, self).__init__(CSharpLexer, GenericAspxLexer, |
510 super().__init__(CSharpLexer, GenericAspxLexer, **options) |
511 **options) |
|
512 |
511 |
513 def analyse_text(text): |
512 def analyse_text(text): |
514 if re.search(r'Page\s*Language="C#"', text, re.I) is not None: |
513 if re.search(r'Page\s*Language="C#"', text, re.I) is not None: |
515 return 0.2 |
514 return 0.2 |
516 elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None: |
515 elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None: |
526 aliases = ['aspx-vb'] |
525 aliases = ['aspx-vb'] |
527 filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] |
526 filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] |
528 mimetypes = [] |
527 mimetypes = [] |
529 |
528 |
530 def __init__(self, **options): |
529 def __init__(self, **options): |
531 super(VbNetAspxLexer, self).__init__(VbNetLexer, GenericAspxLexer, |
530 super().__init__(VbNetLexer, GenericAspxLexer, **options) |
532 **options) |
|
533 |
531 |
534 def analyse_text(text): |
532 def analyse_text(text): |
535 if re.search(r'Page\s*Language="Vb"', text, re.I) is not None: |
533 if re.search(r'Page\s*Language="Vb"', text, re.I) is not None: |
536 return 0.2 |
534 return 0.2 |
537 elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None: |
535 elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None: |