Hello, The following change specification gets accepted by the Coccinelle software.
@replacement@ expression x, y; @@ ( -x + y +compute(x, y) | -x * y +compute(x, y) ) I would appreciate if the specification of duplicate SmPL code can be avoided also for such an use case. Thus I have tried further code variants out for the semantic patch language. @replacement@ expression x, y; @@ ( -x + y | -x * y ) +compute(x, y) An error message is reported then. elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci replacement_for_two_cases2.cocci … 9: no available token to attach to @replacement@ expression x, y; @@ - \( x + y \| x * y \) +compute(x, y) elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci replacement_for_two_cases3.cocci … 5: no available token to attach to Can such a transformation approach ever work for similar source code? Regards, Markus _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci