You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the syntax highlight doesn't support /* ... */ as a comment. They can be used to comment cocci blocks.
Here's a big cocci block I'm working on to refactor xnec2c . The rest of the vim highlight works quite well except for the commented @ add_copy @ section:
// Match the variable definition:@ struct_name @typedef cm_t, cmag_t, crnt_t, ct1m_t, ct2m_t, data_t, dataj_t, fpat_t, ggrid_t, gnd_t, gwav_t, impedance_data_t, incom_t, matpar_t, near_field_t, netcx_t, save_t, segj_t, smat_t, zload_t, vsorc_t;type T = {cm_t, cmag_t, crnt_t, ct1m_t, ct2m_t, data_t, dataj_t, fpat_t, ggrid_t, gnd_t, gwav_t, impedance_data_t, incom_t, matpar_t, near_field_t, netcx_t, save_t, segj_t, smat_t, zload_t, vsorc_t};identifier I;@@
T I;
/*
// Add the 2nd copy@ add_copy @identifier struct_name.I;type struct_name.T;fresh identifier P = "prev_"##I;@@
void diff_structures()
{
}
*/// Add the compare_T() function call and compare_T function definition for each typedef:@ r2 @identifier struct_name.I;type struct_name.T;fresh identifier compare_FN = "compare_"##I;fresh identifier print_FN = "print_"##I;fresh identifier P = "prev_"##I;@@
void diff_structures()
{
(
++T P;
)
(
++FN(&I, &P);+
)
}
++void compare_FN(T *a, T *b){}++void print_FN(T *a){}// Match scalar types:@ scalars @type struct_name.T;type scalar_T = {char, int, double, double complex};identifier F;@@
typedef struct
{
...
scalar_T F;
...
} T;
// Match ptrs:@ ptrs @type ptr_T;identifier F;type struct_name.T;@@
typedef struct
{
...
ptr_T *F;
...
} T;
// Add the comparisons for scalars:@ r3 @identifier r2.compare_FN;identifier struct_name.I;identifier scalars.F;@@
void compare_FN(...)
{
...++ if (a->F != b->F) NOMATCH(a, b, I, F);
}
// Add the comparisons for ptrs:@ r4 @identifier r2.compare_FN;identifier struct_name.I;identifier ptrs.F;@@
void compare_FN()
{
++ if (mem_bcmp(a->F, b->F)) NOMATCH(a, b, I, F);
}
The text was updated successfully, but these errors were encountered:
Hello, thank you for writing this plugin!
It looks like the syntax highlight doesn't support /* ... */ as a comment. They can be used to comment cocci blocks.
Here's a big cocci block I'm working on to refactor xnec2c . The rest of the vim highlight works quite well except for the commented
@ add_copy @
section:The text was updated successfully, but these errors were encountered: