I released something similar to this, jsgrep, but the query syntax is actual JS with special variables marking the placeholders. I think the patch syntax makes more intuitive sense in jsgrep; although it is more limited:
$ cat c.js
f(x < y, x == z);
$ grasp bi --replace '{{.r}}+{{.l}}' c.js
f(y+x, z+x);
In jsgrep, the same substitution could be made by: -f(A < B, B == C)
+f(A + B, B + C)
jsgrep: https://github.com/facebook/jsgrep