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