gkz / grasp

JavaScript structural search, replace, and refactor
http://graspjs.com
MIT License
1.28k stars 33 forks source link

Bug when replacing overlapping matches #4

Closed phadej closed 10 years ago

phadej commented 10 years ago

with d.js as:

console.log(a + b + c);

and

$ grasp bi --replace '{{.r}}-{{.l}}' d.js
console.lob-a + b);

Another example:

$ cat c.js
f(x < y, x == z - w);
$ grasp bi --replace '{{.r}}+{{.l}}' c.js
f(y+x, z - w+z