From 1610b1aafb9b7b3a7b54c853ed45c6cb1a3d0df2 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 20 Nov 2023 08:26:18 -0800 Subject: feat(python): `@string.regex` capture, injection improvements (#5697) * feat(python): `@string.regex` capture, injection improvements * fix(python): match regex only for first argument of re module * chore(python): remove unneeded capture Co-authored-by: Santos Gallegos * fix(python): only highlight string content itself as regex --------- Co-authored-by: Santos Gallegos --- queries/python/highlights.scm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'queries/python/highlights.scm') diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index de98dccbf..b09122dd9 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -346,3 +346,11 @@ ;; https://docs.python.org/3/library/stdtypes.html "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object")) + +;; Regex from the `re` module + +(call + function: (attribute + object: (identifier) @_re) + arguments: (argument_list . (string (string_content) @string.regex)) + (#eq? @_re "re")) -- cgit v1.2.3-70-g09d2