Add more c queries

Co-authored-by: Alejandro Sanchez <hiphish@posteo.de>
This commit is contained in:
Danielkonge 2023-12-15 20:14:51 +01:00
parent 0b4c1ab672
commit 63d52b0f23
2 changed files with 38 additions and 7 deletions

View file

@ -1,10 +1,10 @@
(parameter_list
"(" @delimiter
")" @delimiter @sentinel) @container
"(" @delimiter
")" @delimiter @sentinel) @container
(argument_list
"(" @delimiter
")" @delimiter @sentinel) @container
"(" @delimiter
")" @delimiter @sentinel) @container
(parenthesized_expression
"(" @delimiter
@ -26,8 +26,8 @@
"]" @delimiter @sentinel) @container
(field_declaration_list
"{" @delimiter
"}" @delimiter @sentinel) @container
"{" @delimiter
"}" @delimiter @sentinel) @container
(array_declarator
"[" @delimiter
@ -49,3 +49,19 @@
(enumerator_list
"{" @delimiter
"}" @delimiter @sentinel) @container
(macro_type_specifier
"(" @delimiter
")" @delimiter @sentinel) @container
(preproc_params
"(" @delimiter
")" @delimiter @sentinel) @container
(compound_literal_expression
"(" @delimiter
")" @delimiter @sentinel) @container
(parenthesized_declarator
"(" @delimiter
")" @delimiter @sentinel) @container

View file

@ -1,6 +1,19 @@
#include <stdio.h>
#define MACRO 0
#define PI 3.14
/* These aren't highlight correctly. A problem with the parser? */
#define TESTMACRO (-1)
#define min(X,Y) ((X) < (Y) ? (X) : (Y))
/* Declaration with parentheses, a function pointer */
static void (*callback)(int);
int c_init() { return 1; }
/* Macro type specifier */
#define Map int Foo
static Map(char *c_str) {return 4;}
typedef enum {
E1,
@ -17,6 +30,8 @@ struct Point2D {
int y;
};
/* Compound literal expression */
struct Point2D v = (struct Point2D){ 0, 0 };
/* A function definition */
int add(int x, int y) {