File: m_py.fte

package info (click to toggle)
fte 0.50.2-1.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,696 kB
  • ctags: 6,486
  • sloc: cpp: 48,178; ansic: 2,795; perl: 808; sh: 112; makefile: 106
file content (231 lines) | stat: -rw-r--r-- 9,180 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# This Config is mostly just for colour syntax highlighting, there is
# no auto-indent support in this mode.
#
# My python miscellany page is: http://www.vex.net/~x/python_stuff.html
# Edited by Bastian Kleineidam <calvin@users.sourceforge.net>
#
# Small changes/fixes by Jon Svendsen (jsvendsen@bergen.frisurf.no)

colorize PYTHON {
    SyntaxParser = 'SIMPLE';

    color {
        { 'Normal',        'Editor_Default' },
        { 'Keyword',       'Editor_Keywords'},
        { 'Number',        'Lang_DecimalNumber' },
        { 'HexNumber',     'Lang_Number' },
        { 'Punctuation',   'Lang_Punctuation' },
        { 'String',        'Lang_String' },
        { 'Comment',       'Lang_Comment' },
        { 'CPreprocessor', 'Lang_Preprocessor' },
        { 'Function',      'Lang_Function' },
        { 'Label',         'Lang_Label' },
        { 'Command',       'Lang_Command' }, # assembler
    };

    keyword "Editor_Keywords" { # reserved words as of Python 2.3b1
        "and", "assert", "break", "class", "continue", "def", "del",
        "elif", "else", "except", "exec", "finally", "for", "from",
        "global", "if", "import", "in", "is", "lambda", "not", "None",
        "or", "pass", "print", "raise", "return", "try", "while",
        "yield", "True", "False",
    };

    keyword "Editor_Keywords2" { # built-in functions as of Python 2.2.2
        "__import__", "abs", "apply", "buffer", "callable", "chr", "cmp",
        "coerce", "compile", "complex", "delattr", "dir", "divmod", "eval",
        "execfile", "file", "filter", "float", "getattr", "globals",
        "hasattr", "hash", "help", "hex", "id", "input", "intern", "int",
        "isinstance", "issubclass", "iter", "len", "list", "locals", "long",
        "map", "max", "min", "oct", "open", "ord", "pow", "range",
        "raw_input", "reduce", "reload", "repr", "round", "setattr", "slice",
        "str", "tuple", "type", "unichr", "unicode", "vars", "xrange", "zip",
    };

    keyword "Editor_Keywords3" { # standard modules as of Python 2.2.2
        # Python Runtime Services
        "sys", "gc", "weakref", "fpectl", "atexit", "types",
        "UserDict", "UserList", "UserString", "operator", "inspect",
        "traceback", "linecache", "pickle", "cPickle", "copy_reg",
        "shelve", "copy", "marshal", "warnings", "imp", "code", "codeop",
        "pprint", "repr", "new", "site", "user", "__builtin__", "__main__",
        # String Services
        "string", "re", "struct", "difflib", "fpformat", "StringIO",
        "cStringIO", "codecs", "unicodedata",
        # Miscellaneous Services
        "pydoc", "doctest", "unittest", "math", "cmath", "random",
        "whrandom", "bisect", "array", "ConfigParser", "fileinput",
        "xreadlines", "calendar", "cmd", "shlex",
        # Generic Operating System Services
        "os", "dircache", "stat", "statcache", "statvfs",
        "filecmp", "popen2", "time", "sched", "mutex", "getpass",
        "curses", "getopt", "tempfile", "errno", "glob", "fnmatch",
        "shutil", "locale", "gettext",
        # Optional Operating System Services
        "signal", "socket", "select", "thread", "threading", "Queue",
        "mmap", "anydbm", "dumbdbm", "dbhash", "whichdb", "bsddb",
        "zlib", "gzip", "zipfile", "readline", "rlcompleter",
        # Unix Specific Services
        "posix", "pwd", "grp", "crypt", "dl", "dbm", "gdbm", "termios",
        "TERMIOS", "tty", "pty", "fcntl", "pipes", "posixfile",
        "resource", "nis", "syslog", "commands",
        # Internet Protocols and Support
        "webbrowser", "cgi", "cgitb", "urllib", "urllib2", "httplib",
        "ftplib", "gopherlib", "poplib", "imaplib", "nntplib",
        "smtplib", "telnetlib", "urlparse", "SocketServer",
        "BaseHTTPServer", "SimpleHTTPServer", "CGIHTTPServer",
        "Cookie", "xmlrpclib", "SimpleXMLRPCServer", "asyncore",
        # Internet Data Handling
        "formatter", "email", "mailcap", "mailbox", "mhlib",
        "mimetools", "mimetypes", "MimeWriter", "mimify", "multifile",
        "rfc822", "base64", "binascii", "binhex", "quopri", "uu",
        "xdrlib", "netrc", "robotparser",
        # Structured Markup Processing Tools
        "HTMLParser", "sgmllib", "htmllib", "htmlentitydefs",
        "xml", "xmllib",
        # Multimedia Services
        "audioop", "imageop", "aifc", "sunau", "wave", "chunk",
        "colorsys", "rgbimg", "imghdr", "sndhdr",
        # Cryptographic Services
        "hmac", "md5", "sha", "mpz", "rotor",
        # Graphical User Interfaces with Tk
        "Tkinter", "Tix", "ScrolledText", "turtle", "Idle", 
        # Restricted Execution
        "rexec", "Bastion",
        # Python Language Services
        "parser", "symbol", "token", "keyword", "tokenize", "tabnanny",
        "pyclbr", "py_compile", "compileall", "dis", "distutils",
        # SGI IRIX Specific Services
        "al", "AL", "cd", "fl", "FL", "flp", "fm", "gl", "DEVICE", "GL",
        "imgfile", "jpeg",
        # SunOS Specific Services
        "sunaudiodev", "SUNAUDIODEV",
        # MS Windows Specific Services
        "msvcrt", "_winreg", "winsound",
    };

    keyword "Editor_Keywords4" { # built-in exceptions as of Python 2.2.2
        # Exceptions
        "Exception", "StandardError", "ArithmeticError",
        "LookupError", "EnvironmentError", "AssertionError",
        "AttributeError", "EOFError", "FloatingPointError",
        "IOError", "ImportError", "IndexError",
        "KeyError", "KeywordError", "MemoryError",
        "NameError", "NotImplementedError", "OSError",
        "OverflowError", "ReferenceError", "RuntimeError", "StopIteration",
        "SyntaxError", "SystemError", "SystemExit", "TypeError",
        "UnboundLocalError", "UnicodeError",
        "ValueError", "WindowsError", "ZeroDivisionError",
        # Warnings
        "Warning", "UserWarning", "DeprecationWarning",
        "SyntaxWarning", "RuntimeWarning",
    };

    keyword "Lang_Assembler" {
        "self", "spam", "monty", "python", "lemon_curry",
        "silly_walks", "Chapman", "Cleese", "Gilliam", "Idle",
        "Jones", "Palin",
    };

    h_state 0 { 'Normal' }
    h_trans { 8, '', 'def ', 'Keyword' }
    h_trans { 9, '', 'class ', 'Keyword' }
    h_trans { 1, '<', '#', 'Comment' }
    h_trans { 2, '<i', 'u"""', 'String' }    
    h_trans { 2, '<i', 'r"""', 'String' }    
    h_trans { 2, '<', '"""', 'String' }
    h_trans { 10, '<i', 'u\'\'\'', 'String' }
    h_trans { 10, '<i', 'r\'\'\'', 'String' }
    h_trans { 10, '<', '\'\'\'', 'String' }
    h_trans { 3, '<i', 'u"', 'String' }
    h_trans { 3, '<i', 'r"', 'String' }
    h_trans { 3, '<', '"', 'String' }
    h_trans { 4, '<i', 'u\'', 'String' }
    h_trans { 4, '<i', 'r\'', 'String' }
    h_trans { 4, '<', '\'', 'String' }
    h_trans { 5, '-s', 'a-zA-Z_', 'Normal' }
    h_trans { 6, '<', '0x', 'HexNumber' }
    h_trans { 7, '<s', '0-9', 'Number' }
    h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' }

    h_state 1 { 'Comment' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 2 { 'String' }
    h_trans { 2, '>', '\\\\', 'String' }
    h_trans { 2, '>', '\\"', 'String' }
    h_trans { 0, '>', '"""', 'String' }

    h_state 3 { 'String' }
    h_trans { 3, '>', '\\\\', 'String' } #special case for strings like "\\"
    h_trans { 3, '>', '\\"', 'String' }
    h_trans { 11, '>', '\\', 'String' }
    h_trans { 0, '>', '"', 'String' }
    h_trans { 0, '$', '', 'String' }

    h_state 4 { 'String' }
    h_trans { 4, '>', '\\\\', 'String' } #special case for strings like '\\'
    h_trans { 4, '>', '\\\'', 'String' }
    h_trans { 12, '>', '\\', 'String' }
    h_trans { 0, '>', '\'', 'String' }
    h_trans { 0, '$', '', 'String' }

    h_state 5 { 'Normal' }
    h_trans { 0, '$', '', 'Normal' }
    h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' }

    h_state 6 { 'HexNumber' }
    h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 7 { 'Number' }
    h_trans { 0, '-S', '0-9', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 8 { 'Command' }
    h_trans { 0, '', '(', 'Punctuation' }

    h_state 9 { 'Command' }
    h_trans { 0, '', ':', 'Punctuation' }

    h_state 10 { 'String' }
    h_trans { 10, '>', '\\\\', 'String' }
    h_trans { 10, '>', '\\\'', 'String' }
    h_trans { 0, '>', '\'\'\'', 'String' }

    h_state 11 { 'String' }
    h_trans { 3, '>', '', 'String' }

    h_state 12 { 'String' }
    h_trans { 4, '>', '', 'String' }

}

mode PYTHON: PLAIN {
    FileNameRx          = /\.\cPY$/;
    HilitOn             = 1;
    Colorizer           = "PYTHON";
    IndentMode          = "PLAIN";
    AutoIndent          = 1;
    MultiLineHilit      = 1;
    AutoHilitParen      = 1;
    Trim                = 1;
    SpaceTabs           = 1;
    MatchCase           = 1;
#    WordWrap            = 0;
#    ToggleAutoIndent    = 1;

    FirstLineRx         = /^\#\!.*python/;
    RoutineRegexp       = /def[ ]+[^ ]/;

    SaveFolds           = 2;      # save fold info at end of line

    CommentStart        = " #";
    CommentEnd          = "";
}


# problems...
#     we have no indent support at all )-:
#     is block comment/uncomment possible via macro?