summaryrefslogtreecommitdiff
path: root/queries/c/indents.scm
blob: 1931471b976b8d508f06d00494aac1b7b1dd4c62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[
  (compound_statement)
  (preproc_arg)
  (field_declaration_list)
  (case_statement)
  (enumerator_list)
  (struct_specifier)
  (compound_literal_expression)
  (initializer_list)
  (while_statement)
  (for_statement)
  (switch_statement)
  (expression_statement)
] @indent
(if_statement condition: (_) @indent)
((if_statement
  consequence: (_) @_consequence
  (#not-has-type? @_consequence compound_statement)
  ) @indent)
(init_declarator) @indent

(compound_statement "}" @indent_end)

[
  "else"
  ")"
  "}"
  (statement_identifier)
] @branch

[
  "#define"
  "#ifdef"
  "#if"
  "#else"
  "#endif"
] @zero_indent

[
  (preproc_arg)
  (string_literal)
] @ignore

((ERROR (parameter_declaration)) @aligned_indent
 (#set! "delimiter" "()"))
([(argument_list) (parameter_list)] @aligned_indent
  (#set! "delimiter" "()"))

(comment) @auto