diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-06-07 13:13:24 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2020-06-15 11:51:28 +0200 |
| commit | a5fc7b13ccfbc189deea031e692ba14b0e686279 (patch) | |
| tree | bf195653c301c030ec0ddfa4b024c496b5da3afc | |
| parent | Add better highlighting for preprocessor functions in C highlights (diff) | |
| download | nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar.gz nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar.bz2 nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar.lz nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar.xz nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.tar.zst nvim-treesitter-a5fc7b13ccfbc189deea031e692ba14b0e686279.zip | |
Update C/C++ highlights to new query syntax
| -rw-r--r-- | queries/c/highlights.scm | 5 | ||||
| -rw-r--r-- | queries/c/locals.scm | 2 | ||||
| -rw-r--r-- | queries/cpp/highlights.scm | 22 | ||||
| -rw-r--r-- | queries/cpp/locals.scm | 4 |
4 files changed, 17 insertions, 16 deletions
diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 3c2123383..568ebaffa 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -94,10 +94,10 @@ (sized_type_specifier) @type ((identifier) @type - (match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((identifier) @constant - (match? @constant "^[A-Z][A-Z\\d_]+$")) + (#match? @constant "^[A-Z][A-Z\\d_]+$")) (comment) @comment @@ -109,3 +109,4 @@ (identifier)) @parameter (ERROR) @error + diff --git a/queries/c/locals.scm b/queries/c/locals.scm index f7a4b84d2..505db5b57 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -17,7 +17,7 @@ (declaration declarator: (identifier) @definition.var) (enum_specifier - name: (*) @definition.type + name: (_) @definition.type (enumerator_list (enumerator name: (identifier) @definition.var))) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index d98099185..68e5047ab 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,11 +1,11 @@ ((identifier) @field - (match? @field "^_")) + (#match? @field "^_")) ((identifier) @field - (match? @field "^m_")) + (#match? @field "^m_")) ((identifier) @field - (match? @field "_$")) + (#match? @field "_$")) ;(field_expression) @parameter ;; How to highlight this? (template_function @@ -21,12 +21,12 @@ (namespace_identifier) @constant ((namespace_identifier) @type - (match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((namespace_identifier) @constant - (match? @constant "^[A-Z][A-Z_1-9]*$")) + (#match? @constant "^[A-Z][A-Z_1-9]*$")) (destructor_name - name: (*) @function) + name: (_) @function) (function_declarator declarator: (scoped_identifier @@ -34,7 +34,7 @@ ((function_declarator declarator: (scoped_identifier name: (identifier) @constructor)) - (match? @constructor "^[A-Z]")) + (#match? @constructor "^[A-Z]")) (call_expression function: (scoped_identifier @@ -47,18 +47,18 @@ ((call_expression function: (scoped_identifier name: (identifier) @constructor)) -(match? @constructor "^[A-Z]")) +(#match? @constructor "^[A-Z]")) ((call_expression function: (field_expression - field: (field_identifier) @function)) -(match? @function "^[A-Z]")) + field: (field_identifier) @constructor)) +(#match? @function "^[A-Z]")) ;; constructing a type in a intizializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (match? @constructor "^[A-Z]")) + (#match? @constructor "^[A-Z]")) (auto) @keyword diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index 00268442c..061153c04 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -41,9 +41,9 @@ ;; Control structures (try_statement - body: (*) @scope) + body: (_) @scope) (catch_clause) @scope (destructor_name - name: (*) @constructor) + name: (_) @constructor) |
