From f5f3b7a847e723e2826bf47f1f0290c9830e7e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 4 Sep 2022 16:59:18 +0200 Subject: [PATCH] Add soft keywords to Python keyword list and update to Python 3.10 Closes #3263. --- data/filedefs/filetypes.python.in | 4 ++-- scripts/update-python-identifiers.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/filedefs/filetypes.python.in b/data/filedefs/filetypes.python.in index ea344ec523..922d821d7a 100644 --- a/data/filedefs/filetypes.python.in +++ b/data/filedefs/filetypes.python.in @@ -26,10 +26,10 @@ ftripledouble=string_2 # all items must be in one line # both primary and identifiers are auto-generated by scripts/update-python-identifiers.sh # Python 3 keywords -primary=False None True __peg_parser__ and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield +primary=False None True _ and as assert async await break case class continue def del elif else except finally for from global if import in is lambda match nonlocal not or pass raise return try while with yield # additional keywords, will be highlighted with style "word2" # Python 3 builtins (minus ones in primary) -identifiers=ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError DeprecationWarning EOFError Ellipsis EnvironmentError Exception FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError NotADirectoryError NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__ abs all any ascii bin bool breakpoint bytearray bytes callable chr classmethod compile complex copyright credits delattr dict dir divmod enumerate eval exec exit filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len license list locals map max memoryview min next object oct open ord pow print property quit range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip +identifiers=ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError DeprecationWarning EOFError Ellipsis EncodingWarning EnvironmentError Exception FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError NotADirectoryError NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__ abs aiter all anext any ascii bin bool breakpoint bytearray bytes callable chr classmethod compile complex copyright credits delattr dict dir divmod enumerate eval exec exit filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len license list locals map max memoryview min next object oct open ord pow print property quit range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip [lexer_properties] fold.quotes.python=1 diff --git a/scripts/update-python-identifiers.sh b/scripts/update-python-identifiers.sh index 35c58bca98..bd3cff58d8 100644 --- a/scripts/update-python-identifiers.sh +++ b/scripts/update-python-identifiers.sh @@ -4,7 +4,7 @@ # License: GPL v2 or later # # Updates the `identifiers` entry in data/filetypes.python.in. -# Requires Python 3. +# Requires Python 3.10+. set -e @@ -22,7 +22,7 @@ print(" ".join(sorted([i for i in items if i not in exclude]))) ' } -keywords=$(python3 -c 'from keyword import kwlist; print("\n".join(kwlist))') +keywords=$(python3 -c 'from keyword import kwlist, softkwlist; print("\n".join(kwlist + softkwlist))') builtins=$(python3 -c 'print("\n".join(dir(__builtins__)))') primary=$(echo "$keywords" | sort_filter)