On Sun, 28 Mar 2021, Markus Elfring wrote: > >> Another SmPL script example: > >> > >> @display2@ > >> identifier i; > >> expression e; > >> @@ > >> *#define i e > >> > >> > >> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch show_define_usage2.cocci /usr/include/pipewire-0.3/pipewire/client.h > >> … > >> -#define PW_CLIENT_EVENT_INFO 0 > >> … > > > > And what is the problem here? > > Can you help anyhow according to dealing with the longest common substring problem > in combination with discussed capabilities of the semantic patch language? You can implement whatever you want in python. > > > > This may (or may not) give you the right grouping, but you will still have > > to ensure that the elements end up in the right order, unless you want to > > provide all the values explicitly. > > Some information from #define directives can be imported into symbol tables > for later transformations (on demand). > Source code positions need to be recorded accordingly, don't they? If you want to record the position of something you can use a position variable. julia