>> 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 "<string>", line 5
    coccinelle.result = (re . match ( " , e ))
                                             ^
SyntaxError: EOL while scanning string literal


Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to