> After some research, I could create a Python function called
> fmt_replace_by_pos() to replace the %fmt by the Indice position.

I imagine that this development direction can become more interesting.

Now I would like to point a few implementation details out
which can be improved in the shown SmPL script.


> REG = re.compile('([^%]|%%)*(%[^%])')

* I suggest to move the compilation for such a regular expression
  into the initialisation rule.

* I find the need for the alternation unclear.

* The data processing approach can become nicer if Coccinelle's programming 
interface
  would support also format lists directly.


> retval[i] = { 'idx': idx, 'fmt': fmt }

I wonder about the need for a separate Python dictionary here.


> print("** ERROR: Something wrong in fmt_replace_by_pos():\n
> {}\n".format(str(e)))

Would you like to use the output channel “standard error” instead?


> @main depends on s1 && r1@

The explicit dependency specification can probably be omitted.

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to