gkz / grasp

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

TemplateLiteral vs. Literal #121

Open adros opened 7 years ago

adros commented 7 years ago

Aren't template literals also literals?

They are mentioned in chapter 'Literals' in JS grammar, so I suppose they are. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Literals

So if they are, your matching seems to be buggy, because template literals are not match with query literal.

$ echo 'var y=`y`' | grasp literal

$ echo 'var y=`y`' | grasp TemplateLiteral
1:var y=`y`

(or should this issue be addressed to underlying ACORN parser?)