On Mon, 5 Apr 2021, Markus Elfring wrote: > >> I would like to avoid the repetition of parsing efforts as much as possible. > >> Under which circumstances can replacement lists be taken better into account? > > > > Why does my suggestion involve a repetition of parsing effort? > > The selection of the applied programming interfaces has got significant influences > on the run time behaviour. > > See also: > https://github.com/coccinelle/coccinelle/issues/200#issuecomment-653775288 > > > > You want to use a regexp. > > This view depends on some factors. > I would prefer to search for string literals (and their exclusion) by higher level means. > > > > I'm asking you to put the regexp in a python function. > > How do you think about to improve the following software situation > besides the application of regular expressions? > > @initialize:python@ > @@ > import re > > @display@ > identifier i =~ "^(?:[A-Z]+_){3,3}[A-Z]+"; > expression e : script:python() { re.match('"', e) }; > @@ > *#define i e > > > elfring@Sonne:~/Projekte/PipeWire/lokal> spatch ~/Projekte/Coccinelle/janitor/show_define_usage7.cocci spa/include/spa/node/type-info.h > … > File "", line 5 > coccinelle.result = (re . match ( " , e )) > ^ > SyntaxError: EOL while scanning string literal This looks like a problem. Thanks for the report. julia