mediawiki-extensions-Visual.../modules/syntaxhighlight/rules/python.json
Tongbo Sui 838eddaedb Expand highlighting support for syntaxhighlight module
Part of the ongoing effort to expand the amount of languages that can be
highlighted by syntaxhighlight module to match that of SyntaxHighlight
GeSHi extension.
The module now separates language names with their file names.

Change-Id: Iaf907ebeadc9432719a45f4e9e8d580bb32ca668
2013-10-17 22:42:52 -04:00

56 lines
7.1 KiB
JSON

{
"highlighter" :
[
{
"match" : "/(<|>|=|!|<\\=|>\\=|~|@|;|,|)/g",
"style" : "ve-ce-mwSynHi-symbol"
},
{
"match" : "/[\\W|^]((and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|with|as|nonlocal|__builtin__|__future__|__main__|_winreg|aifc|AL|al|anydbm|array|asynchat|asyncore|atexit|audioop|base64|BaseHTTPServer|Bastion|binascii|binhex|bisect|bsddb|bz2|calendar|cd|cgi|CGIHTTPServer|cgitb|chunk|cmath|cmd|code|codecs|codeop|collections|colorsys|commands|compileall|compiler|ConfigParser|Cookie|cookielib|copy|copy_reg|cPickle|crypt|cStringIO|csv|curses|datetime|dbhash|dbm|decimal|DEVICE|difflib|dircache|dis|distutils|dl|doctest|DocXMLRPCServer|dumbdbm|dummy_thread|dummy_threading|email|encodings|errno|exceptions|fcntl|filecmp|fileinput|FL|fl|flp|fm|fnmatch|formatter|fpectl|fpformat|ftplib|gc|gdbm|getopt|getpass|gettext|GL|gl|glob|gopherlib|grp|gzip|heapq|hmac|hotshot|htmlentitydefs|htmllib|HTMLParser|httplib|imageop|imaplib|imgfile|imghdr|imp|inspect|itertools|jpeg|keyword|linecache|locale|logging|mailbox|mailcap|marshal|math|md5|mhlib|mimetools|mimetypes|MimeWriter|mimify|mmap|msvcrt|multifile|mutex|netrc|new|nis|nntplib|operator|optparse|os|ossaudiodev|parser|pdb|pickle|pickletools|pipes|pkgutil|platform|popen2|poplib|posix|posixfile|pprint|profile|pstats|pty|pwd|py_compile|pyclbr|pydoc|Queue|quopri|random|re|readline|repr|resource|rexec|rfc822|rgbimg|rlcompleter|robotparser|sched|ScrolledText|select|sets|sgmllib|sha|shelve|shlex|shutil|signal|SimpleHTTPServer|SimpleXMLRPCServer|site|smtpd|smtplib|sndhdr|socket|SocketServer|stat|statcache|statvfs|string|StringIO|stringprep|struct|subprocess|sunau|SUNAUDIODEV|sunaudiodev|symbol|sys|syslog|tabnanny|tarfile|telnetlib|tempfile|termios|test|textwrap|thread|threading|time|timeit|Tix|Tkinter|token|tokenize|traceback|tty|turtle|types|unicodedata|unittest|urllib2|urllib|urlparse|user|UserDict|UserList|UserString|uu|warnings|wave|weakref|webbrowser|whichdb|whrandom|winsound|xdrlib|xml|xmllib|xmlrpclib|zipfile|zipimport|zlib|bytes|bytearray|self|any|all))(?!\\w)/gm",
"style" : "ve-ce-mwSynHi-keyword"
},
{
"match" : "/[\\W|^]((False|True|None|NotImplemented|Ellipsis|Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|SystemError|SystemExit|TypeError|UnboundlocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|WindowsError|ZeroDivisionError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-metaconstant"
},
{
"match" : "/[\\W|^]((__import__|abs|basestring|bool|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-magicwords"
},
{
"match" : "/[\\W|^]((__new__|__init__|__del__|__repr__|__str__|__lt__|__le__|__eq__|__ne__|__gt__|__ge__|__cmp__|__rcmp__|__hash__|__nonzero__|__unicode__|__dict__|__setattr__|__delattr__|__getattr__|__getattribute__|__get__|__set__|__delete__|__slots__|__metaclass__|__call__|__len__|__getitem__|__setitem__|__delitem__|__iter__|__contains__|__getslice__|__setslice__|__delslice__|__abs__|__add__|__and__|__coerce__|__div__|__divmod__|__float__|__hex__|__iadd__|__isub__|__imod__|__idiv__|__ipow__|__iand__|__ior__|__ixor__|__ilshift__|__irshift__|__invert__|__int__|__long__|__lshift__|__mod__|__mul__|__neg__|__oct__|__or__|__pos__|__pow__|__radd__|__rdiv__|__rdivmod__|__rmod__|__rpow__|__rlshift__|__rrshift__|__rshift__|__rsub__|__rmul__|__rand__|__rxor__|__ror__|__sub__|__xor__))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-reserved"
},
{
"match" : "/[\\W|^]((Abbrev|ArgumentError|Base64|Benchmark|Benchmark::Tms|Bignum|Binding|CGI|CGI::Cookie|CGI::HtmlExtension|CGI::QueryExtension|CGI::Session|CGI::Session::FileStore|CGI::Session::MemoryStore|Class|Comparable|Complex|ConditionVariable|Continuation|Data|Date|DateTime|Delegator|Dir|EOFError|ERB|ERB::Util|Enumerable|Enumerable::Enumerator|Errno|Exception|FalseClass|File|File::Constants|File::Stat|FileTest|FileUtils|FileUtils::DryRun|FileUtils::NoWrite|FileUtils::StreamUtils_|FileUtils::Verbose|Find|Fixnum|FloatDomainError|Forwardable|GC|Generator|Hash|IO|IOError|Iconv|Iconv::BrokenLibrary|Iconv::Failure|Iconv::IllegalSequence|Iconv::InvalidCharacter|Iconv::InvalidEncoding|Iconv::OutOfRange|IndexError|Interrupt|Kernel|LoadError|LocalJumpError|Logger|Logger::Application|Logger::Error|Logger::Formatter|Logger::LogDevice|Logger::LogDevice::LogDeviceMutex|Logger::Severity|Logger::ShiftingError|Marshal|MatchData|Math|Matrix|Method|Module|Mutex|NameError|NameError::message|NilClass|NoMemoryError|NoMethodError|NotImplementedError|Numeric|Object|ObjectSpace|Observable|PStore|PStore::Error|Pathname|Precision|Proc|Process|Process::GID|Process::Status|Process::Sys|Process::UID|Queue|Range|RangeError|Rational|Regexp|RegexpError|RuntimeError|ScriptError|SecurityError|Set|Shellwords|Signal|SignalException|SimpleDelegator|SingleForwardable|Singleton|SingletonClassMethods|SizedQueue|SortedSet|StandardError|StringIO|StringScanner|StringScanner::Error|Struct|Symbol|SyncEnumerator|SyntaxError|SystemCallError|SystemExit|SystemStackError|Tempfile|Test::Unit::TestCase|Test::Unit|Test|Thread|ThreadError|ThreadGroup|ThreadsWait|Time|TrueClass|TypeError|URI|URI::BadURIError|URI::Error|URI::Escape|URI::FTP|URI::Generic|URI::HTTP|URI::HTTPS|URI::InvalidComponentError|URI::InvalidURIError|URI::LDAP|URI::MailTo|URI::REGEXP|URI::REGEXP::PATTERN|UnboundMethod|Vector|YAML|ZeroDivisionError|Zlib|Zlib::BufError|Zlib::DataError|Zlib::Deflate|Zlib::Error|Zlib::GzipFile|Zlib::GzipFile::CRCError|Zlib::GzipFile::Error|Zlib::GzipFile::LengthError|Zlib::GzipFile::NoFooter|Zlib::GzipReader|Zlib::GzipWriter|Zlib::Inflate|Zlib::MemError|Zlib::NeedDict|Zlib::StreamEnd|Zlib::StreamError|Zlib::VersionError|Zlib::ZStream|HTML::Selector|HashWithIndifferentAccess|Inflector|Inflector::Inflections|Mime|Mime::Type|OCI8AutoRecover|TimeZone|XmlSimple))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-typeconstructor"
},
{
"match" : "/(\\\\)/g",
"style" : "ve-ce-mwSynHi-escape"
},
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\})/g",
"style" : "ve-ce-mwSynHi-bracket"
},
{
"match" : "/([`'\\\"][^]*?[`'\\\"])/g",
"style" : "ve-ce-mwSynHi-string"
},
{
"match" : "/\\W([0-9]+)(?!\\w)/g",
"style" : "ve-ce-mwSynHi-number"
},
{
"match" : "/(#.*$)/gm",
"style" : "ve-ce-mwSynHi-comment-single"
},
{
"match" : "/(['\\\"]{3}[^]*?['\\\"]{3})/g",
"style" : "ve-ce-mwSynHi-comment-multi"
}
],
"validator" :
[
]
}