~ubuntu-branches/ubuntu/precise/moin/precise-updates

« back to all changes in this revision

Viewing changes to MoinMoin/support/pygments/lexers/agile.py

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2010-08-11 12:35:34 UTC
  • mfrom: (0.1.19 sid)
  • Revision ID: james.westby@ubuntu.com-20100811123534-q8zu7qrwqul6cvec
Tags: 1.9.3-1ubuntu1
* Merge from Debian unstable (LP: #586518). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason 
   for us to pull this in by default currently. Note: fckeditor has a
   number of security problems and so this change probably needs to be
   carried indefinitely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
"""
11
11
 
12
12
import re
13
 
try:
14
 
    set
15
 
except NameError:
16
 
    from sets import Set as set
17
13
 
18
14
from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, \
19
15
     LexerContext, include, combined, do_insertions, bygroups, using
41
37
 
42
38
    name = 'Python'
43
39
    aliases = ['python', 'py']
44
 
    filenames = ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript']
 
40
    filenames = ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac']
45
41
    mimetypes = ['text/x-python', 'application/x-python']
46
42
 
47
43
    tokens = {
659
655
                 r'(?<=^match\s)|'
660
656
                 r'(?<=^if\s)|'
661
657
                 r'(?<=^elsif\s)'
662
 
             r')(\s*)(/)(?!=)', bygroups(Text, String.Regex), 'multiline-regex'),
 
658
             r')(\s*)(/)', bygroups(Text, String.Regex), 'multiline-regex'),
663
659
            # multiline regex (in method calls)
664
660
            (r'(?<=\(|,)/', String.Regex, 'multiline-regex'),
665
661
            # multiline regex (this time the funny no whitespace rule)
835
831
            (r'@(\\\\|\\\@|[^\@])*@[egimosx]*', String.Regex, '#pop'),
836
832
            (r'%(\\\\|\\\%|[^\%])*%[egimosx]*', String.Regex, '#pop'),
837
833
            (r'\$(\\\\|\\\$|[^\$])*\$[egimosx]*', String.Regex, '#pop'),
838
 
            (r'!(\\\\|\\!|[^!])*![egimosx]*', String.Regex, '#pop'),
839
834
        ],
840
835
        'root': [
841
836
            (r'\#.*?$', Comment.Single),
859
854
            (r's\((\\\\|\\\)|[^\)])*\)\s*', String.Regex, 'balanced-regex'),
860
855
 
861
856
            (r'm?/(\\\\|\\/|[^/\n])*/[gcimosx]*', String.Regex),
 
857
            (r'm(?=[/!\\{<\[\(@%\$])', String.Regex, 'balanced-regex'),
862
858
            (r'((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[gcimosx]*', String.Regex),
863
859
            (r'\s+', Text),
864
860
            (r'(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|'
906
902
            (r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'),
907
903
            (r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'),
908
904
            (r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
909
 
            (r'(q|qq|qw|qr|qx)(.)[.\n]*?\1', String.Other),
 
905
            (r'(q|qq|qw|qr|qx)([^a-zA-Z0-9])(.|\n)*?\2', String.Other),
910
906
            (r'package\s+', Keyword, 'modulename'),
911
907
            (r'sub\s+', Keyword, 'funcname'),
912
908
            (r'(\[\]|\*\*|::|<<|>>|>=|<=|<=>|={3}|!=|=~|'
970
966
            (r'\\', String.Other),
971
967
            (r'\<', String.Other, 'lt-string'),
972
968
            (r'\>', String.Other, '#pop'),
973
 
            (r'[^\<\>]]+', String.Other)
 
969
            (r'[^\<\>]+', String.Other)
974
970
        ],
975
971
        'end-part': [
976
972
            (r'.+', Comment.Preproc, '#pop')
1015
1011
 
1016
1012
    tokens = {
1017
1013
        'root': [
 
1014
            # lua allows a file to start with a shebang
 
1015
            (r'#!(.*?)$', Comment.Preproc),
 
1016
            (r'', Text, 'base'),
 
1017
        ],
 
1018
        'base': [
1018
1019
            (r'(?s)--\[(=*)\[.*?\]\1\]', Comment.Multiline),
1019
1020
            ('--.*$', Comment.Single),
1020
1021
 
1263
1264
            include('command'),
1264
1265
            include('basic'),
1265
1266
            include('data'),
 
1267
            (r'}', Keyword),  # HACK: somehow we miscounted our braces
1266
1268
        ],
1267
1269
        'command': _gen_command_rules(keyword_cmds_re, builtin_cmds_re),
1268
1270
        'command-in-brace': _gen_command_rules(keyword_cmds_re,
1441
1443
            # strings, symbols and characters
1442
1444
            (r'"(\\\\|\\"|[^"])*"', String),
1443
1445
            (r"'" + valid_name, String.Symbol),
1444
 
            (r"\\([()/'\".'_!§$%& ?;=+-]{1}|[a-zA-Z0-9]+)", String.Char),
 
1446
            (r"\\([()/'\".'_!§$%& ?;=#+-]{1}|[a-zA-Z0-9]+)", String.Char),
1445
1447
 
1446
1448
            # constants
1447
1449
            (r'(#t|#f)', Name.Constant),