diff options
author | Jon Denning <gfxcoder> | 2022-04-21 05:30:14 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-21 05:35:41 +0300 |
commit | c6ed879f9aa7cd863f146cc7104f16cfe8a73e8a (patch) | |
tree | 8e150a749bae81605b9cb68677b86846065e3ac4 /source/blender/draw | |
parent | 5fc488559ca4af16beb9955d614cacc6d4cc5163 (diff) |
Text Editor: add Python 3.10 soft keywords to `builtinfunc` list
Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.
The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.
Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).
This patch also updates the commented Python code for creating the list
of keywords, for convenience.
Before:
{F13012878}
After:
{F13012880}
Example from PEP-636 [1]
Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.
[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html
Ref D14707
Diffstat (limited to 'source/blender/draw')
0 files changed, 0 insertions, 0 deletions