Maybe this will help you:

@r@
format list d;
@@

"%@d@"

@script:ocaml s@
d << r.d;
res;
@@
res := make_expr ("\""^(String.concat "%s" (Str.split_delim
(Str.regexp_string "%d") d))^"\"")


@@
format list r.d;
expression s.res;
@@

-"%@d@"
+res

---------------

Example:

int main() {
  printf("some %d more\n", 12);
}

int main() {
  printf("%d more\n", 12);
}

int main() {
  printf("more %d\n", 12);
}

int main() {
  printf("%d more %d\n", 12);
}

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to