Re: [Cocci] Using the same replacement for different source code

2019-11-14 Thread Markus Elfring
> OK, so we have an example that works. Probably not only for a simple parsing test. > What doesn't work that you are asking about? We got different development views around applications of SmPL disjunctions for source code replacements. * Which open issues will still be reconsidered here? *

Re: [Cocci] Using the same replacement for different source code

2019-11-14 Thread Julia Lawall
On Thu, 14 Nov 2019, Markus Elfring wrote: > >> @replacement@ > >> binary operator bo = { +, * }; > >> expression x, y; > >> @@ > >> +compute( > >> x > >> -bo > >> +, > >> y > >> + ) > > > > I can't figure out what this is an example of? > > It shows just

Re: [Cocci] Using the same replacement for different source code

2019-11-14 Thread Markus Elfring
>> @replacement@ >> binary operator bo = { +, * }; >> expression x, y; >> @@ >> +compute( >> x >> -bo >> +, >> y >> + ) > > I can't figure out what this is an example of? It shows just a possible transformation specification where a SmPL constraint is applie

Re: [Cocci] Using the same replacement for different source code

2019-11-14 Thread Julia Lawall
On Thu, 14 Nov 2019, Markus Elfring wrote: > I am looking for possibilities to reduce undesirable code duplication > also for applications of the semantic patch language. > How much common code can be put into SmPL constraints for this purpose > (when the usage of SmPL disjunctions shows limita

Re: [Cocci] Using the same replacement for different source code

2019-11-13 Thread Markus Elfring
I am looking for possibilities to reduce undesirable code duplication also for applications of the semantic patch language. How much common code can be put into SmPL constraints for this purpose (when the usage of SmPL disjunctions shows limitations so far)? Example: @replacement@ binary operator

Re: [Cocci] Using the same replacement for different source code

2019-11-12 Thread Julia Lawall
On Tue, 12 Nov 2019, Markus Elfring wrote: > 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 duplicat

[Cocci] Using the same replacement for different source code

2019-11-12 Thread Markus Elfring
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 furt

[Cocci] Using the same replacement for different source code

2019-11-12 Thread Markus Elfring
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 furt