Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions queries/c/aerial.scm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
declarator: (type_identifier) @name
(#set! "kind" "Struct")) @start

((declaration) @root @start
.
(function_definition) @symbol @end
(#set! "kind" "Function"))

(function_definition
(#set! "kind" "Function")) @symbol @root
75 changes: 75 additions & 0 deletions tests/symbols/c_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,80 @@
"end_lnum": 19,
"lnum": 19
}
},
{
"col": 0,
"end_col": 1,
"end_lnum": 25,
"kind": "Function",
"level": 0,
"lnum": 23,
"name": "foo",
"selection_range": {
"col": 4,
"end_col": 7,
"end_lnum": 23,
"lnum": 23
}
},
{
"col": 0,
"end_col": 1,
"end_lnum": 29,
"kind": "Function",
"level": 0,
"lnum": 27,
"name": "bar",
"selection_range": {
"col": 4,
"end_col": 7,
"end_lnum": 27,
"lnum": 27
}
},
{
"col": 0,
"end_col": 1,
"end_lnum": 36,
"kind": "Function",
"level": 0,
"lnum": 32,
"name": "fn_kr",
"selection_range": {
"col": 4,
"end_col": 9,
"end_lnum": 32,
"lnum": 32
}
},
{
"col": 0,
"end_col": 1,
"end_lnum": 41,
"kind": "Function",
"level": 0,
"lnum": 39,
"name": "fn_specifiers",
"selection_range": {
"col": 18,
"end_col": 31,
"end_lnum": 39,
"lnum": 39
}
},
{
"col": 0,
"end_col": 1,
"end_lnum": 49,
"kind": "Function",
"level": 0,
"lnum": 44,
"name": "fn_macro_attributes",
"selection_range": {
"col": 7,
"end_col": 26,
"end_lnum": 44,
"lnum": 44
}
}
]
30 changes: 30 additions & 0 deletions tests/treesitter/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,33 @@ typedef enum {
typedef struct {
int field;
} St_1;

int var = 5;

int foo() {
return 0;
}

int bar() {
return 0;
}

// K&R style
int fn_kr(bar, baz, qux)
int bar, baz;
char *qux;
{
}

// specifiers after types
int static inline fn_specifiers(int arg1) {
return 5;
}

// fn definition with macro attributes
void * fn_macro_attributes(int arg1)
SOME_ATTR
SOME_ATTR(1)
{
return 5;
}