forked from ScoDoc/ScoDoc
313 lines
5.3 KiB
Python
313 lines
5.3 KiB
Python
|
specials = [
|
||
|
"Ellipsis",
|
||
|
"False",
|
||
|
"None",
|
||
|
"NotImplemented",
|
||
|
"True",
|
||
|
"__abs__",
|
||
|
"__add__",
|
||
|
"__and__",
|
||
|
"__base__",
|
||
|
"__bases__",
|
||
|
"__basicsize__",
|
||
|
"__builtins__",
|
||
|
"__call__",
|
||
|
"__class__",
|
||
|
"__cmp__",
|
||
|
"__coerce__",
|
||
|
"__contains__",
|
||
|
"__debug__",
|
||
|
"__del__",
|
||
|
"__delattr__",
|
||
|
"__delete__",
|
||
|
"__delitem__",
|
||
|
"__delslice__",
|
||
|
"__dict__",
|
||
|
"__dictoffset__",
|
||
|
"__div__",
|
||
|
"__divmod__",
|
||
|
"__doc__",
|
||
|
"__eq__",
|
||
|
"__flags__",
|
||
|
"__float__",
|
||
|
"__floordiv__",
|
||
|
"__ge__",
|
||
|
"__get__",
|
||
|
"__getattr__",
|
||
|
"__getattribute__",
|
||
|
"__getitem__",
|
||
|
"__getnewargs__",
|
||
|
"__getslice__",
|
||
|
"__gt__",
|
||
|
"__hash__",
|
||
|
"__hex__",
|
||
|
"__iadd__",
|
||
|
"__iand__",
|
||
|
"__idiv__",
|
||
|
"__ifloordiv__",
|
||
|
"__ilshift__",
|
||
|
"__imod__",
|
||
|
"__import__",
|
||
|
"__imul__",
|
||
|
"__init__",
|
||
|
"__int__",
|
||
|
"__invert__",
|
||
|
"__ior__",
|
||
|
"__ipow__",
|
||
|
"__irshift__",
|
||
|
"__isub__",
|
||
|
"__itemsize__",
|
||
|
"__iter__",
|
||
|
"__itruediv__",
|
||
|
"__ixor__",
|
||
|
"__le__",
|
||
|
"__len__",
|
||
|
"__long__",
|
||
|
"__lshift__",
|
||
|
"__lt__",
|
||
|
"__main__",
|
||
|
"__mod__",
|
||
|
"__module__",
|
||
|
"__mro__",
|
||
|
"__mul__",
|
||
|
"__name__",
|
||
|
"__ne__",
|
||
|
"__neg__",
|
||
|
"__new__",
|
||
|
"__nonzero__",
|
||
|
"__oct__",
|
||
|
"__or__",
|
||
|
"__pos__",
|
||
|
"__pow__",
|
||
|
"__radd__",
|
||
|
"__rand__",
|
||
|
"__rdiv__",
|
||
|
"__rdivmod__",
|
||
|
"__reduce__",
|
||
|
"__reduce_ex__",
|
||
|
"__repr__",
|
||
|
"__rfloordiv__",
|
||
|
"__rlshift__",
|
||
|
"__rmod__",
|
||
|
"__rmul__",
|
||
|
"__ror__",
|
||
|
"__rpow__",
|
||
|
"__rrshift__",
|
||
|
"__rshift__",
|
||
|
"__rsub__",
|
||
|
"__rtruediv__",
|
||
|
"__rxor__",
|
||
|
"__set__",
|
||
|
"__setattr__",
|
||
|
"__setitem__",
|
||
|
"__setslice__",
|
||
|
"__str__",
|
||
|
"__sub__",
|
||
|
"__truediv__",
|
||
|
"__weakrefoffset__",
|
||
|
"__xor__",
|
||
|
"abs",
|
||
|
"apply",
|
||
|
"basestring",
|
||
|
"bool",
|
||
|
"buffer",
|
||
|
"callable",
|
||
|
"capitalize",
|
||
|
"center",
|
||
|
"chr",
|
||
|
"classmethod",
|
||
|
"cmp",
|
||
|
"coerce",
|
||
|
"compile",
|
||
|
"complex",
|
||
|
"count",
|
||
|
"decode",
|
||
|
"delattr",
|
||
|
"dict",
|
||
|
"dir",
|
||
|
"divmod",
|
||
|
"encode",
|
||
|
"endswith",
|
||
|
"enumerate",
|
||
|
"eval",
|
||
|
"execfile",
|
||
|
"exit",
|
||
|
"expandtabs",
|
||
|
"file",
|
||
|
"filter",
|
||
|
"find",
|
||
|
"float",
|
||
|
"frozenset",
|
||
|
"getattr",
|
||
|
"globals",
|
||
|
"hasattr",
|
||
|
"hash",
|
||
|
"hex",
|
||
|
"id",
|
||
|
"index",
|
||
|
"input",
|
||
|
"int",
|
||
|
"intern",
|
||
|
"isalnum",
|
||
|
"isalpha",
|
||
|
"isdigit",
|
||
|
"isinstance",
|
||
|
"islower",
|
||
|
"isspace",
|
||
|
"issubclass",
|
||
|
"istitle",
|
||
|
"isupper",
|
||
|
"iter",
|
||
|
"join",
|
||
|
"len",
|
||
|
"list",
|
||
|
"ljust",
|
||
|
"locals",
|
||
|
"long",
|
||
|
"lower",
|
||
|
"lstrip",
|
||
|
"map",
|
||
|
"max",
|
||
|
"min",
|
||
|
"next",
|
||
|
"object",
|
||
|
"oct",
|
||
|
"open",
|
||
|
"ord",
|
||
|
"pow",
|
||
|
"property",
|
||
|
"quit",
|
||
|
"range",
|
||
|
"raw_input",
|
||
|
"reduce",
|
||
|
"reload",
|
||
|
"replace",
|
||
|
"repr",
|
||
|
"reversed",
|
||
|
"rfind",
|
||
|
"rindex",
|
||
|
"rjust",
|
||
|
"round",
|
||
|
"rsplit",
|
||
|
"rstrip",
|
||
|
"set",
|
||
|
"setattr",
|
||
|
"slice",
|
||
|
"sorted",
|
||
|
"split",
|
||
|
"splitlines",
|
||
|
"startswith",
|
||
|
"staticmethod",
|
||
|
"str",
|
||
|
"strip",
|
||
|
"sum",
|
||
|
"super",
|
||
|
"swapcase",
|
||
|
"title",
|
||
|
"translate",
|
||
|
"tuple",
|
||
|
"type",
|
||
|
"unichr",
|
||
|
"unicode",
|
||
|
"upper",
|
||
|
"vars",
|
||
|
"xrange",
|
||
|
"zfill",
|
||
|
"zip"
|
||
|
]
|
||
|
|
||
|
exceptions = [
|
||
|
"Exception",
|
||
|
"SystemExit",
|
||
|
"StopIteration",
|
||
|
"StandardError",
|
||
|
"KeyboardInterrupt",
|
||
|
"ImportError",
|
||
|
"EnvironmentError",
|
||
|
"IOError",
|
||
|
"OSError",
|
||
|
"WindowsError",
|
||
|
"EOFError",
|
||
|
"RuntimeError",
|
||
|
"NotImplementedError",
|
||
|
"NameError",
|
||
|
"UnboundLocalError",
|
||
|
"AttributeError",
|
||
|
"SyntaxError",
|
||
|
"IndentationError",
|
||
|
"TabError",
|
||
|
"TypeError",
|
||
|
"AssertionError",
|
||
|
"LookupError",
|
||
|
"IndexError",
|
||
|
"KeyError",
|
||
|
"ArithmeticError",
|
||
|
"OverflowError",
|
||
|
"ZeroDivisionError",
|
||
|
"FloatingPointError",
|
||
|
"ValueError",
|
||
|
"UnicodeError",
|
||
|
"UnicodeEncodeError",
|
||
|
"UnicodeDecodeError",
|
||
|
"UnicodeTranslateError",
|
||
|
"ReferenceError",
|
||
|
"SystemError",
|
||
|
"MemoryError",
|
||
|
"Warning",
|
||
|
"UserWarning",
|
||
|
"DeprecationWarning",
|
||
|
"PendingDeprecationWarning",
|
||
|
"SyntaxWarning",
|
||
|
"OverflowWarning", # not generated in 2.4; won't exist in 2.5
|
||
|
"RuntimeWarning",
|
||
|
"FutureWarning"
|
||
|
]
|
||
|
|
||
|
reserved_words = [
|
||
|
"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"
|
||
|
]
|
||
|
|
||
|
print '<keywords region="pyWord">'
|
||
|
for word in sorted(reserved_words):
|
||
|
print ' <word name="%s"/>' % word
|
||
|
print '</keywords>'
|
||
|
|
||
|
print '<keywords region="pyException">'
|
||
|
for exc in sorted(exceptions):
|
||
|
print ' <word name="%s"/>' % exc
|
||
|
print '</keywords>'
|
||
|
|
||
|
print '<keywords region="pyBuiltins">'
|
||
|
for special in sorted(specials):
|
||
|
print ' <word name="%s"/>' % special
|
||
|
print '</keywords>'
|
||
|
|