Podświetlanie składni w edytorze XML dzięki editArea. Closes #17. Niestety dla tekstó...
[redakcja.git] / project / static / js / reg_syntax / python.js
diff --git a/project/static/js/reg_syntax/python.js b/project/static/js/reg_syntax/python.js
new file mode 100755 (executable)
index 0000000..4b0acf2
--- /dev/null
@@ -0,0 +1,144 @@
+/**\r
+ * Python syntax v 1.1 \r
+ * \r
+ * v1.1 by Andre Roberge (2006/12/27)\r
+ *   \r
+**/\r
+editAreaLoader.load_syntax["python"] = {\r
+       'COMMENT_SINGLE' : {1 : '#'}\r
+       ,'COMMENT_MULTI' : {}\r
+       ,'QUOTEMARKS' : {1: "'", 2: '"'}\r
+       ,'KEYWORD_CASE_SENSITIVE' : true\r
+       ,'KEYWORDS' : {\r
+               /*\r
+               ** Set 1: reserved words\r
+               ** http://python.org/doc/current/ref/keywords.html\r
+               ** Note: 'as' and 'with' have been added starting with Python 2.5\r
+               */\r
+               'reserved' : [\r
+                       'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',\r
+                       'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', \r
+                       'import', 'is', 'in', 'lambda', 'not', 'or', 'pass', 'print', 'raise',\r
+                       'return', 'try', 'while', 'with', 'yield'\r
+                       //the following are *almost* reserved; we'll treat them as such\r
+                       , 'False', 'True', 'None'\r
+               ]\r
+               /*\r
+               ** Set 2: builtins\r
+               ** http://python.org/doc/current/lib/built-in-funcs.html\r
+               */      \r
+               ,'builtins' : [\r
+                       '__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp', \r
+                       'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', \r
+                       'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',\r
+                       'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals',\r
+                       'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',\r
+                       'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',\r
+                       'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', \r
+                       'vars', 'xrange', 'zip',\r
+                       // Built-in constants: http://www.python.org/doc/2.4.1/lib/node35.html\r
+                       //'False', 'True', 'None' have been included in 'reserved'\r
+                       'NotImplemented', 'Ellipsis',\r
+                       // Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html\r
+                       'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError',\r
+                       'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError',\r
+                       'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError',\r
+                       'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError',\r
+                       'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError',\r
+                       'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError',\r
+                       'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning',\r
+                       'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning',\r
+                       'RuntimeWarning', 'FutureWarning',              \r
+                       // we will include the string methods as well\r
+                       // http://python.org/doc/current/lib/string-methods.html\r
+                       'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs',\r
+                       'find', 'index', 'isalnum', 'isaplpha', 'isdigit', 'islower', 'isspace', 'istitle',\r
+                       'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',\r
+                       'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',\r
+                       'translate', 'upper', 'zfill'\r
+               ]\r
+               /*\r
+               ** Set 3: standard library\r
+               ** http://python.org/doc/current/lib/modindex.html\r
+               */\r
+               ,'stdlib' : [\r
+                       '__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm',\r
+                       'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer',\r
+                       'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi',\r
+                       'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',\r
+                       'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler',\r
+                       'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt',\r
+                       'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE',\r
+                       'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm',\r
+                       'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl',\r
+                       'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl',\r
+                       'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob',\r
+                       'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib',\r
+                       'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect',\r
+                       'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap',\r
+                       'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify',\r
+                       'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator',\r
+                       'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes',\r
+                       'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile',\r
+                       'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random',\r
+                       're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter',\r
+                       'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve',\r
+                       'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd',\r
+                       'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string',\r
+                       'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev',\r
+                       'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',\r
+                       'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token',\r
+                       'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2',\r
+                       'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings',\r
+                       'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml',\r
+                       'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib'\r
+\r
+               ]\r
+               /*\r
+               ** Set 4: special methods\r
+               ** http://python.org/doc/current/ref/specialnames.html\r
+               */\r
+               ,'special' : [\r
+                       // Basic customization: http://python.org/doc/current/ref/customization.html\r
+                       '__new__', '__init__', '__del__', '__repr__', '__str__', \r
+                       '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__',\r
+                       '__hash__', '__nonzero__', '__unicode__', '__dict__',\r
+                       // Attribute access: http://python.org/doc/current/ref/attribute-access.html\r
+                       '__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__',\r
+                       '__delete__', '__slots__',\r
+                       // Class creation, callable objects\r
+                       '__metaclass__', '__call__', \r
+                       // Container types: http://python.org/doc/current/ref/sequence-types.html\r
+                       '__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',\r
+                       '__getslice__', '__setslice__', '__delslice__',\r
+                       // Numeric types: http://python.org/doc/current/ref/numeric-types.html\r
+                       '__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',\r
+                       '__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',\r
+                       '__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',\r
+                       '__long__','__lshift__',\r
+                       '__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',\r
+                       '__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',\r
+                       '__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__',\r
+                       '__sub__','__xor__'\r
+               ]\r
+       }\r
+       ,'OPERATORS' :[\r
+               '+', '-', '/', '*', '=', '<', '>', '%', '!', '&', ';', '?', '`', ':', ','\r
+       ]\r
+       ,'DELIMITERS' :[\r
+               '(', ')', '[', ']', '{', '}'\r
+       ]\r
+       ,'STYLES' : {\r
+               'COMMENTS': 'color: #AAAAAA;'\r
+               ,'QUOTESMARKS': 'color: #660066;'\r
+               ,'KEYWORDS' : {\r
+                       'reserved' : 'color: #0000FF;'\r
+                       ,'builtins' : 'color: #009900;'\r
+                       ,'stdlib' : 'color: #009900;'\r
+                       ,'special': 'color: #006666;'\r
+                       }\r
+               ,'OPERATORS' : 'color: #993300;'\r
+               ,'DELIMITERS' : 'color: #993300;'\r
+                               \r
+       }\r
+};\r