On Tue, 21 May 2019, Markus Elfring wrote:

> Message repetition from 2019-05-16 because of a temporary technical difficulty
> with the mailing list services:
>
> =====
>
> Hello,
>
> The semantic patch language can handle several rules which can contain
> remarkable amounts of source code search specifications.
> It can happen then that a few of these SmPL rules contain a bit of
> common specifications.
>
> Example:
> @one@
> @@
> code_area_1
> code_area_2
>
> @two@
> @@
> code_area_1
> code_area_3
>
>
> Now I would like to clarify possibilities again to reduce unwanted
> code duplication at such places.
> The common code part can be moved to another SmPL rule.
>
> @start@
> @@
> code_area_1
>
>
> Subsequent SmPL rules can refer to metavariables from previous rules.
> But how can be achieved that the code search will be continued at a place
> after the position where a previous rule ended its search
> (without extra code repetition)?
>
> Can the splitting and recombination of such rules become more convenient
> with extensions for the Coccinelle software?

In general it can't.  Coccinelle doesn't have the goal of minimizing the
number of characters in te semantic patch.  It has the goal of making
readable specifications that follow the structure of the matched code.

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

Reply via email to