blob: 9151bc5321b1b55169d9cfd3ec78082b5752593d (
plain) (
blame)
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
50
51
52
53
54
55
56
57
58
|
;; TODO: supported by official Tree-sitter if (_)* is more than one node
;; Neovim: will only match if (_) is exactly one node
;(function_definition
;body: (compound_statement
;("{" (_)* @function.inner "}"))?) @function.outer
(function_definition
body: (compound_statement) @function.inner) @function.outer
(struct_specifier
body: (_) @class.inner) @class.outer
; conditional
(if_statement
consequence: (_)? @conditional.inner
alternative: (_)? @conditional.inner
) @conditional.outer
(if_statement
condition: (_) @conditional.inner)
; loops
(for_statement
(_)? @loop.inner) @loop.outer
(while_statement
(_)? @loop.inner) @loop.outer
(do_statement
(_)? @loop.inner) @loop.outer
(compound_statement) @block.outer
(comment) @comment.outer
(call_expression) @call.outer
(call_expression (_) @call.inner)
; Statements
;(expression_statement ;; this is what we actually want to capture in most cases (";" is missing) probaly
;(_) @statement.inner) ;; the otther statement like node type is declaration but declaration has a ";"
(compound_statement
(_) @statement.outer)
(field_declaration_list
(_) @statement.outer)
(preproc_if
(_) @statement.outer)
(preproc_elif
(_) @statement.outer)
(preproc_else
(_) @statement.outer)
(parameter_list
(parameter_declaration) @parameter.inner)
|