use esprima to parse the file instead of searching for sub-strings

The previous implementation had a lot of false negatives.
For example, 'xit' is a sub-string of 'exit'.