source: trunk/plugins/LocalFilesEditor/editarea/reg_syntax/python.js @ 5160

Last change on this file since 5160 was 5160, checked in by patdenice, 14 years ago

Editor
Update editarea to 0.8.2.
Remove CSS tab.
Fix jQuery path.

File size: 7.7 KB
Line 
1/**
2 * Python syntax v 1.1
3 *
4 * v1.1 by Andre Roberge (2006/12/27)
5 *   
6**/
7editAreaLoader.load_syntax["python"] = {
8        'DISPLAY_NAME' : 'Python'
9        ,'COMMENT_SINGLE' : {1 : '#'}
10        ,'COMMENT_MULTI' : {}
11        ,'QUOTEMARKS' : {1: "'", 2: '"'}
12        ,'KEYWORD_CASE_SENSITIVE' : true
13        ,'KEYWORDS' : {
14                /*
15                ** Set 1: reserved words
16                ** http://python.org/doc/current/ref/keywords.html
17                ** Note: 'as' and 'with' have been added starting with Python 2.5
18                */
19                'reserved' : [
20                        'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
21                        'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 
22                        'import', 'is', 'in', 'lambda', 'not', 'or', 'pass', 'print', 'raise',
23                        'return', 'try', 'while', 'with', 'yield'
24                        //the following are *almost* reserved; we'll treat them as such
25                        , 'False', 'True', 'None'
26                ]
27                /*
28                ** Set 2: builtins
29                ** http://python.org/doc/current/lib/built-in-funcs.html
30                */     
31                ,'builtins' : [
32                        '__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp', 
33                        'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 
34                        'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
35                        'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals',
36                        'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
37                        'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
38                        'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 
39                        'vars', 'xrange', 'zip',
40                        // Built-in constants: http://www.python.org/doc/2.4.1/lib/node35.html
41                        //'False', 'True', 'None' have been included in 'reserved'
42                        'NotImplemented', 'Ellipsis',
43                        // Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html
44                        'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError',
45                        'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError',
46                        'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError',
47                        'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError',
48                        'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError',
49                        'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError',
50                        'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning',
51                        'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning',
52                        'RuntimeWarning', 'FutureWarning',             
53                        // we will include the string methods as well
54                        // http://python.org/doc/current/lib/string-methods.html
55                        'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs',
56                        'find', 'index', 'isalnum', 'isaplpha', 'isdigit', 'islower', 'isspace', 'istitle',
57                        'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',
58                        'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
59                        'translate', 'upper', 'zfill'
60                ]
61                /*
62                ** Set 3: standard library
63                ** http://python.org/doc/current/lib/modindex.html
64                */
65                ,'stdlib' : [
66                        '__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm',
67                        'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer',
68                        'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi',
69                        'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',
70                        'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler',
71                        'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt',
72                        'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE',
73                        'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm',
74                        'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl',
75                        'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl',
76                        'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob',
77                        'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib',
78                        'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect',
79                        'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap',
80                        'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify',
81                        'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator',
82                        'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes',
83                        'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile',
84                        'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random',
85                        're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter',
86                        'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve',
87                        'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd',
88                        'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string',
89                        'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev',
90                        'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',
91                        'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token',
92                        'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2',
93                        'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings',
94                        'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml',
95                        'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib'
96
97                ]
98                /*
99                ** Set 4: special methods
100                ** http://python.org/doc/current/ref/specialnames.html
101                */
102                ,'special' : [
103                        // Basic customization: http://python.org/doc/current/ref/customization.html
104                        '__new__', '__init__', '__del__', '__repr__', '__str__', 
105                        '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__',
106                        '__hash__', '__nonzero__', '__unicode__', '__dict__',
107                        // Attribute access: http://python.org/doc/current/ref/attribute-access.html
108                        '__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__',
109                        '__delete__', '__slots__',
110                        // Class creation, callable objects
111                        '__metaclass__', '__call__', 
112                        // Container types: http://python.org/doc/current/ref/sequence-types.html
113                        '__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',
114                        '__getslice__', '__setslice__', '__delslice__',
115                        // Numeric types: http://python.org/doc/current/ref/numeric-types.html
116                        '__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',
117                        '__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',
118                        '__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',
119                        '__long__','__lshift__',
120                        '__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',
121                        '__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',
122                        '__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__',
123                        '__sub__','__xor__'
124                ]
125        }
126        ,'OPERATORS' :[
127                '+', '-', '/', '*', '=', '<', '>', '%', '!', '&', ';', '?', '`', ':', ','
128        ]
129        ,'DELIMITERS' :[
130                '(', ')', '[', ']', '{', '}'
131        ]
132        ,'STYLES' : {
133                'COMMENTS': 'color: #AAAAAA;'
134                ,'QUOTESMARKS': 'color: #660066;'
135                ,'KEYWORDS' : {
136                        'reserved' : 'color: #0000FF;'
137                        ,'builtins' : 'color: #009900;'
138                        ,'stdlib' : 'color: #009900;'
139                        ,'special': 'color: #006666;'
140                        }
141                ,'OPERATORS' : 'color: #993300;'
142                ,'DELIMITERS' : 'color: #993300;'
143                               
144        }
145};
Note: See TracBrowser for help on using the repository browser.