Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python syntax highlighting keyword list. #1938

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
223 changes: 217 additions & 6 deletions Externals/crystaledit/editlib/parsers/python.cpp
Expand Up @@ -23,12 +23,15 @@
#define new DEBUG_NEW
#endif

// Python 2.6 keywords
// Python 3.11.4 Keywords
// (See https://docs.python.org/3/reference/index.html and https://docs.python.org/3/library/index.html)
static const tchar_t * s_apszPythonKeywordList[] =
{
_T ("and"),
_T ("as"),
_T ("assert"),
_T ("async"),
_T ("await"),
_T ("break"),
_T ("class"),
_T ("continue"),
Expand All @@ -37,7 +40,6 @@ static const tchar_t * s_apszPythonKeywordList[] =
_T ("elif"),
_T ("else"),
_T ("except"),
_T ("exec"),
_T ("finally"),
_T ("for"),
_T ("from"),
Expand All @@ -47,45 +49,100 @@ static const tchar_t * s_apszPythonKeywordList[] =
_T ("in"),
_T ("is"),
_T ("lambda"),
_T ("nonlocal"),
_T ("not"),
_T ("or"),
_T ("pass"),
_T ("print"),
_T ("raise"),
_T ("return"),
_T ("try"),
_T ("while"),
_T ("whith"),
_T ("with"),
_T ("yield"),
};

static const tchar_t * s_apszUser1KeywordList[] =
{
_T ("ArithmeticError"),
_T ("AssertionError"),
_T ("AttributeError"),
_T ("BaseException"),
_T ("BaseExceptionGroup"),
_T ("BlockingIOError"),
_T ("BrokenPipeError"),
_T ("BufferError"),
_T ("BytesWarning"),
_T ("ChildProcessError"),
_T ("ConnectionAbortedError"),
_T ("ConnectionError"),
_T ("ConnectionRefusedError"),
_T ("ConnectionResetError"),
_T ("DeprecationWarning"),
_T ("EOFError"),
_T ("Ellipsis"),
_T ("EncodingWarning"),
_T ("EnvironmentError"),
_T ("Exception"),
_T ("ExceptionGroup"),
_T ("False"),
_T ("FileExistsError"),
_T ("FileNotFoundError"),
_T ("FloatingPointError"),
_T ("FutureWarning"),
_T ("GeneratorExit"),
_T ("IOError"),
_T ("ImportError"),
_T ("ImportWarning"),
_T ("IndentationError"),
_T ("IndexError"),
_T ("InterruptedError"),
_T ("IsADirectoryError"),
_T ("KeyError"),
_T ("KeyboardInterrupt"),
_T ("LookupError"),
_T ("MemoryError"),
_T ("ModuleNotFoundError"),
_T ("NameError"),
_T ("None"),
_T ("NotADirectoryError"),
_T ("NotImplemented"),
_T ("NotImplementedError"),
_T ("OSError"),
_T ("OverflowError"),
_T ("PendingDeprecationWarning"),
_T ("PermissionError"),
_T ("ProcessLookupError"),
_T ("RecursionError"),
_T ("ReferenceError"),
_T ("ResourceWarning"),
_T ("RuntimeError"),
_T ("RuntimeWarning"),
_T ("StopAsyncIteration"),
_T ("StopIteration"),
_T ("SyntaxError"),
_T ("SyntaxWarning"),
_T ("SystemError"),
_T ("SystemExit"),
_T ("TabError"),
_T ("TimeoutError"),
_T ("True"),
_T ("TypeError"),
_T ("UnboundLocalError"),
_T ("UnicodeDecodeError"),
_T ("UnicodeEncodeError"),
_T ("UnicodeError"),
_T ("UnicodeTranslateError"),
_T ("UnicodeWarning"),
_T ("UserWarning"),
_T ("ValueError"),
_T ("Warning"),
_T ("WindowsError"),
_T ("ZeroDivisionError"),
_T ("__debug__"),
_T ("argv"),
_T ("builtin_module_names"),
_T ("copyright"),
_T ("credits"),
_T ("exc_traceback"),
_T ("exc_type"),
_T ("exc_value"),
Expand All @@ -94,10 +151,12 @@ static const tchar_t * s_apszUser1KeywordList[] =
_T ("last_traceback"),
_T ("last_type"),
_T ("last_value"),
_T ("license"),
_T ("modules"),
_T ("path"),
_T ("ps1"),
_T ("ps2"),
_T ("quit"),
_T ("setprofile"),
_T ("settrace"),
_T ("stderr"),
Expand All @@ -110,57 +169,209 @@ static const tchar_t * s_apszUser2KeywordList[] =
{
_T ("__abs__"),
_T ("__add__"),
_T ("__aenter__"),
_T ("__aexit__"),
_T ("__aiter__"),
_T ("__and__"),
_T ("__anext__"),
_T ("__annotations__"),
_T ("__await__"),
_T ("__bases__"),
_T ("__bool__"),
_T ("__bytes__"),
_T ("__cached__"),
_T ("__call__"),
_T ("__ceil__"),
_T ("__class__"),
_T ("__class_getitem__"),
_T ("__closure__"),
_T ("__cmp__"),
_T ("__code__"),
_T ("__coerce__"),
_T ("__complex__"),
_T ("__contains__"),
_T ("__defaults__"),
_T ("__del__"),
_T ("__delattr__"),
_T ("__delete__"),
_T ("__delitem__"),
_T ("__dict__"),
_T ("__dir__"),
_T ("__div__"),
_T ("__divmod__"),
_T ("__doc__"),
_T ("__enter__"),
_T ("__eq__"),
_T ("__exit__"),
_T ("__file__"),
_T ("__float__"),
_T ("__float__"),
_T ("__floor__"),
_T ("__floordiv__"),
_T ("__format__"),
_T ("__ge__"),
_T ("__get__"),
_T ("__getattr__"),
_T ("__getattribute__"),
_T ("__getitem__"),
_T ("__globals__"),
_T ("__gt__"),
_T ("__hash__"),
_T ("__hex__"),
_T ("__iadd__"),
_T ("__iand__"),
_T ("__ifloordiv__"),
_T ("__ilshift__"),
_T ("__imatmul__"),
_T ("__imod__"),
_T ("__import__"),
_T ("__imul__"),
_T ("__index__"),
_T ("__init__"),
_T ("__init_subclass__"),
_T ("__instancecheck__"),
_T ("__int__"),
_T ("__invert__"),
_T ("__ior__"),
_T ("__ipow__"),
_T ("__irshift__"),
_T ("__isub__"),
_T ("__iter__"),
_T ("__itruediv__"),
_T ("__ixor__"),
_T ("__kwdefaults__"),
_T ("__le__"),
_T ("__len__"),
_T ("__length_hint__"),
_T ("__loader__"),
_T ("__long__"),
_T ("__lshift__"),
_T ("__lt__"),
_T ("__match_args__"),
_T ("__matmul__"),
_T ("__members__"),
_T ("__methods__"),
_T ("__missing__"),
_T ("__mod__"),
_T ("__module__"),
_T ("__mro_entries__"),
_T ("__mul__"),
_T ("__name__"),
_T ("__ne__"),
_T ("__neg__"),
_T ("__new__"),
_T ("__next__"),
_T ("__nonzero__"),
_T ("__oct__"),
_T ("__or__"),
_T ("__package__"),
_T ("__path__"),
_T ("__pos__"),
_T ("__pow__"),
_T ("__qualname__"),
_T ("__radd__"),
_T ("__rand__"),
_T ("__rdivmod__"),
_T ("__repr__"),
_T ("__reversed__"),
_T ("__rfloordiv__"),
_T ("__rlshift__"),
_T ("__rmatmul__"),
_T ("__rmod__"),
_T ("__rmul__"),
_T ("__ror__"),
_T ("__round__"),
_T ("__rpow__"),
_T ("__rrshift__"),
_T ("__rshift__"),
_T ("__rsub__"),
_T ("__rtruediv__"),
_T ("__rxor__"),
_T ("__set__"),
_T ("__set_name__"),
_T ("__setattr__"),
_T ("__setitem__"),
_T ("__slots__"),
_T ("__spec__"),
_T ("__str__"),
_T ("__sub__"),
_T ("__subclasscheck__"),
_T ("__truediv__"),
_T ("__trunc__"),
_T ("__xor__"),
_T ("abs"),
_T ("aiter"),
_T ("all"),
_T ("anext"),
_T ("any"),
_T ("ascii"),
_T ("bin"),
_T ("bool"),
_T ("breakpoint"),
_T ("bytearray"),
_T ("bytes"),
_T ("callable"),
_T ("chr"),
_T ("classmethod"),
_T ("coerce"),
_T ("compile"),
_T ("complex"),
_T ("delattr"),
_T ("dict"),
_T ("dir"),
_T ("divmod"),
_T ("enumerate"),
_T ("eval"),
_T ("exec"),
_T ("filter"),
_T ("float"),
_T ("float"),
_T ("format"),
_T ("frozenset"),
_T ("getattr"),
_T ("globals"),
_T ("hasattr"),
_T ("hash"),
_T ("help"),
_T ("hex"),
_T ("id"),
_T ("input"),
_T ("int"),
_T ("isinstance"),
_T ("issubclass"),
_T ("iter"),
_T ("len"),
_T ("list"),
_T ("locals"),
_T ("long"),
_T ("map"),
_T ("max"),
_T ("memoryview"),
_T ("min"),
_T ("next"),
_T ("nonzero"),
_T ("object"),
_T ("oct"),
_T ("open"),
_T ("ord"),
_T ("pow"),
_T ("print"),
_T ("property"),
_T ("range"),
_T ("repr"),
_T ("reversed"),
_T ("round"),
_T ("set"),
_T ("setattr"),
_T ("slice"),
_T ("sorted"),
_T ("staticmethod"),
_T ("str"),
_T ("sum"),
_T ("super"),
_T ("tuple"),
_T ("type"),
_T ("vars"),
_T ("xrange"),
_T ("zip"),
};

static bool
Expand Down