On Sun, 24 May 2020, Markus Elfring wrote:
> >> @movement@
> >> expression E;
> >> identifier V1, V2, Vx;
> >> statement S;
> >> type T1, T2;
> >> @@
> >> T1 V1;
> >> ... when any
> >> T2 V2
> >> - = \( <+... Vx ...+> \& E \)
> >
> > What is Vx for? He wants an expression that involves a.
>
> I chose a slightly more unique metavariable identifier for the desired
> clarification of this use case.
>
> a ⇔ Vx
> (Or should the identifier “V1” be used instead?)
Vx is not bound to anything. It will match any identifier.
>
>
> >> ;
> >> ... when any
> >> when != S
> >> ++ V2 = E;
> >
> > What do you expect this code to be added on to?
>
> I imagine that we would like to determine the end of the code block
> for variable declarations somehow.
>
>
> >> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci
> >> convert_variable_initialisation_to_assignment.cocci
> >> …
> >> plus: parse error:
> >> File "convert_variable_initialisation_to_assignment.cocci", line 10,
> >> column 9, charpos = 117
> >> around = '\(',
> >> whole content = - = \( <+... Vx ...+> \& E \)
> >>
> >>
> >> I have tried another SmPL code variation out then.
> >>
> >> -T2 V2 = \( <+... Vx ...+> \& E \)
> >> +T2 V2
> >> ;
> >>
> >> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci
> >> convert_variable_initialisation_to_assignment2.cocci
> >> …
> >> 14: no available token to attach to
>
> Will the mentioned error messages get any more attention?
I already asked above what you expected the ++ code to be attached to.
All added code has to be attached to something.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci