aboutsummaryrefslogtreecommitdiffstats
path: root/queries/c
diff options
context:
space:
mode:
authorGeorge Harker <george@george-graphics.co.uk>2023-03-20 14:44:39 -0700
committerAmaan Qureshi <amaanq12@gmail.com>2023-03-24 13:07:53 -0400
commitcb568af5393241e5dbc9c19157c5df5e9ca9af2d (patch)
treee3a1848a3f1c7a03a4ecadd14f95022eaeb52f0f /queries/c
parentsplit delimiter into open_delimiter and close_delimiter (diff)
downloadnvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar.gz
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar.bz2
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar.lz
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar.xz
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.tar.zst
nvim-treesitter-cb568af5393241e5dbc9c19157c5df5e9ca9af2d.zip
use indent.X syntax for captures and properties of set directives
update CONTRIBUTING.md adjust indents for bass fix doc capture comment
Diffstat (limited to 'queries/c')
-rw-r--r--queries/c/indents.scm61
1 files changed, 31 insertions, 30 deletions
diff --git a/queries/c/indents.scm b/queries/c/indents.scm
index bb8903d3d..71f47ced1 100644
--- a/queries/c/indents.scm
+++ b/queries/c/indents.scm
@@ -7,66 +7,66 @@
(initializer_list)
(init_declarator)
(expression_statement)
-] @indent
+] @indent.begin
(
ERROR
- "for" "(" @indent ";" ";" ")" @indent_end)
+ "for" "(" @indent.begin ";" ";" ")" @indent.end)
(
(for_statement
body: (_) @_body
- ) @indent
+ ) @indent.begin
(#not-has-type? @_body compound_statement)
)
(
while_statement
- condition: (_) @indent
+ condition: (_) @indent.begin
)
(
(while_statement
body: (_) @_body
- ) @indent
+ ) @indent.begin
(#not-has-type? @_body compound_statement)
)
(
(if_statement)
- (ERROR "else") @indent
+ (ERROR "else") @indent.begin
)
(
if_statement
- condition: (_) @indent
+ condition: (_) @indent.begin
)
-;; Make sure all cases of if-else are tagged with @indent
+;; Make sure all cases of if-else are tagged with @indent.begin
;; So we will offset the indents for the else case
(
(if_statement
consequence: (compound_statement)
- "else" @branch
+ "else" @indent.branch
alternative:
[
- [ "{" "}" ] @branch
- (compound_statement ["{" "}"] @branch)
+ [ "{" "}" ] @indent.branch
+ (compound_statement ["{" "}"] @indent.branch)
(_)
]
- ) @indent
+ ) @indent.begin
)
(
(if_statement
- consequence: (_ ";" @indent_end) @_consequence
- ) @indent
+ consequence: (_ ";" @indent.end) @_consequence
+ ) @indent.begin
(#not-has-type? @_consequence compound_statement)
)
(
(if_statement
consequence: (_) @_consequence
- "else" @branch
+ "else" @indent.branch
alternative:
[
- [ "{" "}" ] @branch
- (compound_statement ["{" "}"] @branch)
+ [ "{" "}" ] @indent.branch
+ (compound_statement ["{" "}"] @indent.branch)
(_)
]
)
@@ -83,19 +83,19 @@
consequence: (_)
alternative:
[
- (if_statement consequence: (compound_statement) @dedent)
+ (if_statement consequence: (compound_statement) @indent.dedent)
(_)
- ] @dedent
+ ] @indent.dedent
)
)
-(compound_statement "}" @indent_end)
+(compound_statement "}" @indent.end)
[
")"
"}"
(statement_identifier)
-] @branch
+] @indent.branch
[
"#define"
@@ -105,18 +105,19 @@
"#if"
"#else"
"#endif"
-] @zero_indent
+] @indent.zero
[
(preproc_arg)
(string_literal)
-] @ignore
+] @indent.ignore
-((ERROR (parameter_declaration)) @aligned_indent
- (#set! "open_delimiter" "(")
- (#set! "close_delimiter" ")"))
-([(argument_list) (parameter_list)] @aligned_indent
- (#set! "open_delimiter" "(")
- (#set! "close_delimiter" ")"))
+((ERROR (parameter_declaration)) @indent.align
+ (#set! indent.open_delimiter "(")
+ (#set! indent.close_delimiter ")"))
+([(argument_list) (parameter_list)] @indent.align
+ (#set! indent.open_delimiter "(")
+ (#set! indent.close_delimiter ")"))
+
+(comment) @indent.auto
-(comment) @auto