python.php

gehe zur Dokumentation dieser Datei
00001 <?php
00002 /*************************************************************************************
00003  * python.php
00004  * ----------
00005  * Author: Roberto Rossi (rsoftware@altervista.org)
00006  * Copyright: (c) 2004 Roberto Rossi (http://rsoftware.altervista.org), Nigel McNie (http://qbnz.com/highlighter)
00007  * Release Version: 1.0.7.20
00008  * Date Started: 2004/08/30
00009  *
00010  * Python language file for GeSHi.
00011  *
00012  * CHANGES
00013  * -------
00014  * 2005/05/26
00015  *  -  Modifications by Tim (tim@skreak.com): added more keyword categories, tweaked colors
00016  * 2004/11/27 (1.0.1)
00017  *  -  Added support for multiple object splitters
00018  * 2004/08/30 (1.0.0)
00019  *  -  First Release
00020  *
00021  * TODO (updated 2004/11/27)
00022  * -------------------------
00023  *
00024  *************************************************************************************
00025  *
00026  *     This file is part of GeSHi.
00027  *
00028  *   GeSHi is free software; you can redistribute it and/or modify
00029  *   it under the terms of the GNU General Public License as published by
00030  *   the Free Software Foundation; either version 2 of the License, or
00031  *   (at your option) any later version.
00032  *
00033  *   GeSHi is distributed in the hope that it will be useful,
00034  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00035  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00036  *   GNU General Public License for more details.
00037  *
00038  *   You should have received a copy of the GNU General Public License
00039  *   along with GeSHi; if not, write to the Free Software
00040  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00041  *
00042  ************************************************************************************/
00043 
00044 $language_data = array (
00045      'LANG_NAME' => 'Python',
00046      'COMMENT_SINGLE' => array(1 => '#'),
00047      'COMMENT_MULTI' => array(),
00048      'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
00049      'QUOTEMARKS' => array('"', "'", '"""'),
00050      'ESCAPE_CHAR' => '\\',
00051      'KEYWORDS' => array(
00052 
00053           /*
00054           ** Set 1: reserved words
00055           ** http://python.org/doc/current/ref/keywords.html
00056           */
00057           1 => array(
00058                'and', 'del', 'for', 'is', 'raise', 'assert', 'elif', 'from', 'lambda', 'return', 'break',
00059                'else', 'global', 'not', 'try', 'class', 'except', 'if', 'or', 'while', 'continue', 'exec',
00060                'import', 'pass', 'yield', 'def', 'finally', 'in', 'print'
00061                ),
00062 
00063           /*
00064           ** Set 2: builtins
00065           ** http://python.org/doc/current/lib/built-in-funcs.html
00066           */
00067           2 => array(
00068                '__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp', 
00069                'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 
00070                'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
00071                'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals',
00072                'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
00073                'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
00074                'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 
00075                'vars', 'xrange', 'zip',
00076                // Built-in constants: http://python.org/doc/current/lib/node35.html
00077                'False', 'True', 'None', 'NotImplemented', 'Ellipsis',
00078                // Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html
00079                'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError',
00080                'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError',
00081                'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError',
00082                'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError',
00083                'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError',
00084                'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError',
00085                'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning',
00086                'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning',
00087                'RuntimeWarning', 'FutureWarning',
00088                // self: this is a common python convention (but not a reserved word)
00089                'self'
00090                ),
00091 
00092           /*
00093           ** Set 3: standard library
00094           ** http://python.org/doc/current/lib/modindex.html
00095           */
00096           3 => array(
00097                '__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm',
00098                'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer',
00099                'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi',
00100                'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',
00101                'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler',
00102                'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt',
00103                'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE',
00104                'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm',
00105                'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl',
00106                'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl',
00107                'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob',
00108                'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib',
00109                'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect',
00110                'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap',
00111                'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify',
00112                'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator',
00113                'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes',
00114                'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile',
00115                'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random',
00116                're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter',
00117                'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve',
00118                'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd',
00119                'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string',
00120                'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev',
00121                'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',
00122                'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token',
00123                'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2',
00124                'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings',
00125                'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml',
00126                'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib'
00127                ),
00128 
00129           /*
00130           ** Set 4: special methods
00131           ** http://python.org/doc/current/ref/specialnames.html
00132           */
00133           4 => array(
00134                /*
00135                // Iterator types: http://python.org/doc/current/lib/typeiter.html
00136                '__iter__', 'next',
00137                // String types: http://python.org/doc/current/lib/string-methods.html
00138                'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs',
00139                'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
00140                'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',
00141                'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
00142                'translate', 'upper', 'zfill',
00143                */
00144                // Basic customization: http://python.org/doc/current/ref/customization.html
00145                '__new__', '__init__', '__del__', '__repr__', '__str__', 
00146                '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__',
00147                '__hash__', '__nonzero__', '__unicode__', '__dict__',
00148                // Attribute access: http://python.org/doc/current/ref/attribute-access.html
00149                '__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__',
00150                '__delete__', '__slots__',
00151                // Class creation, callable objects
00152                '__metaclass__', '__call__', 
00153                // Container types: http://python.org/doc/current/ref/sequence-types.html
00154                '__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',
00155                '__getslice__', '__setslice__', '__delslice__',
00156                // Numeric types: http://python.org/doc/current/ref/numeric-types.html
00157                '__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',
00158                '__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',
00159                '__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',
00160                '__long__','__lshift__',
00161                '__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',
00162                '__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',
00163                '__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__',
00164                '__sub__','__xor__'
00165                )
00166 
00167           ),
00168      'SYMBOLS' => array(
00169                '(', ')', '[', ']', '{', '}', '*', '&', '%', '!', ';', '<', '>', '?', '`'
00170           ),
00171      'CASE_SENSITIVE' => array(
00172           GESHI_COMMENTS => true,
00173           1 => true,
00174         2 => true,
00175         3 => true,
00176         4 => true
00177           ),
00178      'STYLES' => array(
00179           'KEYWORDS' => array(
00180                1 => 'color: #ff7700;font-weight:bold;',     // Reserved
00181                2 => 'color: #008000;',                           // Built-ins + self
00182                3 => 'color: #dc143c;',                           // Standard lib
00183                4 => 'color: #0000cd;'                            // Special methods
00184                ),
00185           'COMMENTS' => array(
00186                1 => 'color: #808080; font-style: italic;',
00187                'MULTI' => 'color: #808080; font-style: italic;'
00188                ),
00189           'ESCAPE_CHAR' => array(
00190                0 => 'color: #000099; font-weight: bold;'
00191                ),
00192           'BRACKETS' => array(
00193                0 => 'color: black;'
00194                ),
00195           'STRINGS' => array(
00196                0 => 'color: #483d8b;'
00197                ),
00198           'NUMBERS' => array(
00199                0 => 'color: #ff4500;'
00200                ),
00201           'METHODS' => array(
00202                1 => 'color: black;'
00203                ),
00204           'SYMBOLS' => array(
00205                0 => 'color: #66cc66;'
00206                ),
00207           'REGEXPS' => array(
00208                ),
00209           'SCRIPT' => array(
00210                )
00211           ),
00212      'URLS' => array(
00213           ),
00214      'OOLANG' => true,
00215      'OBJECT_SPLITTERS' => array(
00216           1 => '.'
00217           ),
00218      'REGEXPS' => array(
00219           ),
00220      'STRICT_MODE_APPLIES' => GESHI_NEVER,
00221      'SCRIPT_DELIMITERS' => array(
00222           ),
00223      'HIGHLIGHT_STRICT_BLOCK' => array(
00224           )
00225 );
00226 
00227 ?>

Erzeugt am Thu May 14 00:55:48 2009 für OpenRat von  doxygen 1.5.8