diff options
| -rw-r--r-- | queries/lua/highlights.scm | 20 | ||||
| -rw-r--r-- | queries/luau/highlights.scm | 26 | ||||
| -rw-r--r-- | queries/query/highlights.scm | 16 |
3 files changed, 62 insertions, 0 deletions
diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 1af8e9aec..2f12d3ce2 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -247,3 +247,23 @@ (string) @string (escape_sequence) @string.escape + +; string.match("123", "%d+") +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "find" "match" "gmatch" "gsub")) + arguments: (arguments + . (_) + . + (string + content: (string_content) @string.regex))) + +;("123"):match("%d+") +(function_call + (method_index_expression + method: (identifier) @_method + (#any-of? @_method "find" "match" "gmatch" "gsub")) + arguments: (arguments + . (string + content: (string_content) @string.regex))) diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index 7a6bc2e35..a175276a7 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -246,3 +246,29 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-](%s?)@")) + +; string.match("123", "%d+") +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "find" "format" "match")) + arguments: (arguments (_) . (string content: _ @string.regex))) + +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "gmatch" "gsub")) + arguments: (arguments (_) (string content: _ @string.regex))) + +; ("123"):match("%d+") +(function_call + (method_index_expression + method: (identifier) @_method + (#any-of? @_method "find" "format" "match")) + arguments: (arguments . (string content: _ @string.regex))) + +(function_call + (method_index_expression + method: (identifier) @_method + (#any-of? @_method "gmatch" "gsub")) + arguments: (arguments (string content: _ @string.regex))) diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index c7f0d891a..ccf13a6c8 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -32,3 +32,19 @@ ((program . (comment)* . (comment) @preproc) (#lua-match? @preproc "^;+ *extends *$")) + +((predicate + name: (identifier) @_name + parameters: (parameters (string "\"" @string "\"" @string) @string.regex)) + (#any-of? @_name + "match" + "not-match" + "vim-match" + "not-vim-match" + "lua-match" + "not-lua-match")) + +((predicate + name: (identifier) @_name + parameters: (parameters (string "\"" @string "\"" @string) @string.regex . (string) .)) + (#any-of? @_name "gsub" "not-gsub")) |
