From cb568af5393241e5dbc9c19157c5df5e9ca9af2d Mon Sep 17 00:00:00 2001 From: George Harker Date: Mon, 20 Mar 2023 14:44:39 -0700 Subject: use indent.X syntax for captures and properties of set directives update CONTRIBUTING.md adjust indents for bass fix doc capture comment --- queries/c/indents.scm | 61 ++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'queries/c') 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 -- cgit v1.2.3-70-g09d2