Skip to content

Commit 66733fd

Browse files
authored
Update Python syntax highlighting keyword list. (#1938)
- Added some keywords defined in version 3.11.4. - https://docs.python.org/3/reference/index.html - https://docs.python.org/3/library/index.html
1 parent f49a03c commit 66733fd

File tree

1 file changed

+217
-6
lines changed

1 file changed

+217
-6
lines changed

Externals/crystaledit/editlib/parsers/python.cpp

Lines changed: 217 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
#define new DEBUG_NEW
2424
#endif
2525

26-
// Python 2.6 keywords
26+
// Python 3.11.4 Keywords
27+
// (See https://docs.python.org/3/reference/index.html and https://docs.python.org/3/library/index.html)
2728
static const tchar_t * s_apszPythonKeywordList[] =
2829
{
2930
_T ("and"),
3031
_T ("as"),
3132
_T ("assert"),
33+
_T ("async"),
34+
_T ("await"),
3235
_T ("break"),
3336
_T ("class"),
3437
_T ("continue"),
@@ -37,7 +40,6 @@ static const tchar_t * s_apszPythonKeywordList[] =
3740
_T ("elif"),
3841
_T ("else"),
3942
_T ("except"),
40-
_T ("exec"),
4143
_T ("finally"),
4244
_T ("for"),
4345
_T ("from"),
@@ -47,45 +49,100 @@ static const tchar_t * s_apszPythonKeywordList[] =
4749
_T ("in"),
4850
_T ("is"),
4951
_T ("lambda"),
52+
_T ("nonlocal"),
5053
_T ("not"),
5154
_T ("or"),
5255
_T ("pass"),
53-
_T ("print"),
5456
_T ("raise"),
5557
_T ("return"),
5658
_T ("try"),
5759
_T ("while"),
58-
_T ("whith"),
60+
_T ("with"),
5961
_T ("yield"),
6062
};
6163

6264
static const tchar_t * s_apszUser1KeywordList[] =
6365
{
66+
_T ("ArithmeticError"),
67+
_T ("AssertionError"),
6468
_T ("AttributeError"),
69+
_T ("BaseException"),
70+
_T ("BaseExceptionGroup"),
71+
_T ("BlockingIOError"),
72+
_T ("BrokenPipeError"),
73+
_T ("BufferError"),
74+
_T ("BytesWarning"),
75+
_T ("ChildProcessError"),
76+
_T ("ConnectionAbortedError"),
77+
_T ("ConnectionError"),
78+
_T ("ConnectionRefusedError"),
79+
_T ("ConnectionResetError"),
80+
_T ("DeprecationWarning"),
6581
_T ("EOFError"),
6682
_T ("Ellipsis"),
83+
_T ("EncodingWarning"),
84+
_T ("EnvironmentError"),
85+
_T ("Exception"),
86+
_T ("ExceptionGroup"),
6787
_T ("False"),
88+
_T ("FileExistsError"),
89+
_T ("FileNotFoundError"),
90+
_T ("FloatingPointError"),
91+
_T ("FutureWarning"),
92+
_T ("GeneratorExit"),
6893
_T ("IOError"),
6994
_T ("ImportError"),
95+
_T ("ImportWarning"),
96+
_T ("IndentationError"),
7097
_T ("IndexError"),
98+
_T ("InterruptedError"),
99+
_T ("IsADirectoryError"),
71100
_T ("KeyError"),
72101
_T ("KeyboardInterrupt"),
102+
_T ("LookupError"),
73103
_T ("MemoryError"),
104+
_T ("ModuleNotFoundError"),
74105
_T ("NameError"),
75106
_T ("None"),
107+
_T ("NotADirectoryError"),
76108
_T ("NotImplemented"),
109+
_T ("NotImplementedError"),
110+
_T ("OSError"),
77111
_T ("OverflowError"),
112+
_T ("PendingDeprecationWarning"),
113+
_T ("PermissionError"),
114+
_T ("ProcessLookupError"),
115+
_T ("RecursionError"),
116+
_T ("ReferenceError"),
117+
_T ("ResourceWarning"),
78118
_T ("RuntimeError"),
119+
_T ("RuntimeWarning"),
120+
_T ("StopAsyncIteration"),
121+
_T ("StopIteration"),
79122
_T ("SyntaxError"),
123+
_T ("SyntaxWarning"),
80124
_T ("SystemError"),
81125
_T ("SystemExit"),
126+
_T ("TabError"),
127+
_T ("TimeoutError"),
82128
_T ("True"),
83129
_T ("TypeError"),
130+
_T ("UnboundLocalError"),
131+
_T ("UnicodeDecodeError"),
132+
_T ("UnicodeEncodeError"),
133+
_T ("UnicodeError"),
134+
_T ("UnicodeTranslateError"),
135+
_T ("UnicodeWarning"),
136+
_T ("UserWarning"),
84137
_T ("ValueError"),
138+
_T ("Warning"),
139+
_T ("WindowsError"),
85140
_T ("ZeroDivisionError"),
86141
_T ("__debug__"),
87142
_T ("argv"),
88143
_T ("builtin_module_names"),
144+
_T ("copyright"),
145+
_T ("credits"),
89146
_T ("exc_traceback"),
90147
_T ("exc_type"),
91148
_T ("exc_value"),
@@ -94,10 +151,12 @@ static const tchar_t * s_apszUser1KeywordList[] =
94151
_T ("last_traceback"),
95152
_T ("last_type"),
96153
_T ("last_value"),
154+
_T ("license"),
97155
_T ("modules"),
98156
_T ("path"),
99157
_T ("ps1"),
100158
_T ("ps2"),
159+
_T ("quit"),
101160
_T ("setprofile"),
102161
_T ("settrace"),
103162
_T ("stderr"),
@@ -110,57 +169,209 @@ static const tchar_t * s_apszUser2KeywordList[] =
110169
{
111170
_T ("__abs__"),
112171
_T ("__add__"),
172+
_T ("__aenter__"),
173+
_T ("__aexit__"),
174+
_T ("__aiter__"),
113175
_T ("__and__"),
176+
_T ("__anext__"),
177+
_T ("__annotations__"),
178+
_T ("__await__"),
114179
_T ("__bases__"),
180+
_T ("__bool__"),
181+
_T ("__bytes__"),
182+
_T ("__cached__"),
183+
_T ("__call__"),
184+
_T ("__ceil__"),
115185
_T ("__class__"),
186+
_T ("__class_getitem__"),
187+
_T ("__closure__"),
116188
_T ("__cmp__"),
189+
_T ("__code__"),
117190
_T ("__coerce__"),
191+
_T ("__complex__"),
192+
_T ("__contains__"),
193+
_T ("__defaults__"),
118194
_T ("__del__"),
195+
_T ("__delattr__"),
196+
_T ("__delete__"),
197+
_T ("__delitem__"),
119198
_T ("__dict__"),
199+
_T ("__dir__"),
120200
_T ("__div__"),
121201
_T ("__divmod__"),
202+
_T ("__doc__"),
203+
_T ("__enter__"),
204+
_T ("__eq__"),
205+
_T ("__exit__"),
206+
_T ("__file__"),
122207
_T ("__float__"),
123-
_T ("__float__"),
208+
_T ("__floor__"),
209+
_T ("__floordiv__"),
210+
_T ("__format__"),
211+
_T ("__ge__"),
212+
_T ("__get__"),
213+
_T ("__getattr__"),
214+
_T ("__getattribute__"),
124215
_T ("__getitem__"),
216+
_T ("__globals__"),
217+
_T ("__gt__"),
125218
_T ("__hash__"),
126219
_T ("__hex__"),
220+
_T ("__iadd__"),
221+
_T ("__iand__"),
222+
_T ("__ifloordiv__"),
223+
_T ("__ilshift__"),
224+
_T ("__imatmul__"),
225+
_T ("__imod__"),
226+
_T ("__import__"),
227+
_T ("__imul__"),
228+
_T ("__index__"),
127229
_T ("__init__"),
230+
_T ("__init_subclass__"),
231+
_T ("__instancecheck__"),
128232
_T ("__int__"),
129233
_T ("__invert__"),
234+
_T ("__ior__"),
235+
_T ("__ipow__"),
236+
_T ("__irshift__"),
237+
_T ("__isub__"),
238+
_T ("__iter__"),
239+
_T ("__itruediv__"),
240+
_T ("__ixor__"),
241+
_T ("__kwdefaults__"),
242+
_T ("__le__"),
130243
_T ("__len__"),
244+
_T ("__length_hint__"),
245+
_T ("__loader__"),
131246
_T ("__long__"),
132247
_T ("__lshift__"),
248+
_T ("__lt__"),
249+
_T ("__match_args__"),
250+
_T ("__matmul__"),
133251
_T ("__members__"),
134252
_T ("__methods__"),
253+
_T ("__missing__"),
135254
_T ("__mod__"),
255+
_T ("__module__"),
256+
_T ("__mro_entries__"),
136257
_T ("__mul__"),
258+
_T ("__name__"),
259+
_T ("__ne__"),
137260
_T ("__neg__"),
261+
_T ("__new__"),
262+
_T ("__next__"),
138263
_T ("__nonzero__"),
139264
_T ("__oct__"),
140265
_T ("__or__"),
266+
_T ("__package__"),
267+
_T ("__path__"),
141268
_T ("__pos__"),
142269
_T ("__pow__"),
270+
_T ("__qualname__"),
271+
_T ("__radd__"),
272+
_T ("__rand__"),
273+
_T ("__rdivmod__"),
143274
_T ("__repr__"),
275+
_T ("__reversed__"),
276+
_T ("__rfloordiv__"),
277+
_T ("__rlshift__"),
278+
_T ("__rmatmul__"),
279+
_T ("__rmod__"),
280+
_T ("__rmul__"),
281+
_T ("__ror__"),
282+
_T ("__round__"),
283+
_T ("__rpow__"),
284+
_T ("__rrshift__"),
144285
_T ("__rshift__"),
286+
_T ("__rsub__"),
287+
_T ("__rtruediv__"),
288+
_T ("__rxor__"),
289+
_T ("__set__"),
290+
_T ("__set_name__"),
291+
_T ("__setattr__"),
292+
_T ("__setitem__"),
293+
_T ("__slots__"),
294+
_T ("__spec__"),
145295
_T ("__str__"),
146296
_T ("__sub__"),
297+
_T ("__subclasscheck__"),
298+
_T ("__truediv__"),
299+
_T ("__trunc__"),
147300
_T ("__xor__"),
148301
_T ("abs"),
302+
_T ("aiter"),
303+
_T ("all"),
304+
_T ("anext"),
305+
_T ("any"),
306+
_T ("ascii"),
307+
_T ("bin"),
308+
_T ("bool"),
309+
_T ("breakpoint"),
310+
_T ("bytearray"),
311+
_T ("bytes"),
312+
_T ("callable"),
313+
_T ("chr"),
314+
_T ("classmethod"),
149315
_T ("coerce"),
316+
_T ("compile"),
317+
_T ("complex"),
318+
_T ("delattr"),
319+
_T ("dict"),
320+
_T ("dir"),
150321
_T ("divmod"),
322+
_T ("enumerate"),
323+
_T ("eval"),
324+
_T ("exec"),
325+
_T ("filter"),
151326
_T ("float"),
152-
_T ("float"),
327+
_T ("format"),
328+
_T ("frozenset"),
329+
_T ("getattr"),
330+
_T ("globals"),
331+
_T ("hasattr"),
332+
_T ("hash"),
333+
_T ("help"),
153334
_T ("hex"),
154335
_T ("id"),
336+
_T ("input"),
155337
_T ("int"),
338+
_T ("isinstance"),
339+
_T ("issubclass"),
340+
_T ("iter"),
156341
_T ("len"),
342+
_T ("list"),
343+
_T ("locals"),
157344
_T ("long"),
345+
_T ("map"),
346+
_T ("max"),
347+
_T ("memoryview"),
348+
_T ("min"),
349+
_T ("next"),
158350
_T ("nonzero"),
351+
_T ("object"),
159352
_T ("oct"),
353+
_T ("open"),
354+
_T ("ord"),
160355
_T ("pow"),
356+
_T ("print"),
357+
_T ("property"),
161358
_T ("range"),
359+
_T ("repr"),
360+
_T ("reversed"),
162361
_T ("round"),
362+
_T ("set"),
363+
_T ("setattr"),
364+
_T ("slice"),
365+
_T ("sorted"),
366+
_T ("staticmethod"),
367+
_T ("str"),
368+
_T ("sum"),
369+
_T ("super"),
370+
_T ("tuple"),
371+
_T ("type"),
372+
_T ("vars"),
163373
_T ("xrange"),
374+
_T ("zip"),
164375
};
165376

166377
static bool

0 commit comments

Comments
 (0)