Open tolkushkin opened 4 years ago
Hi @tolkushkin, thanks for the report.
Did you try it on https://esprima.org/demo/parse.html to see if it works there? When I did that and use the following (note that I added the closing curly brace), everything works as expected.
isImage=function(e){return/^image\//.test(e.type)}
Also, for using the pure tokenizer, the same thing happens (working as expected) from the command line (try it with https://npm.runkit.com/esprima):
esprima.tokenize('isImage=function(e){return/^image\//.test(e.type)}')
Hi @ariya , It would be better to know which branch was being used in web https://esprima.org/demo/parse.html
Certain code is being parsed in web but throws errors while using npm or direct source code
Eg: esprima/dist/esprima.js:3781 throw e; ^
Error: Line 2: Unexpected reserved word
Unexpected token ILLEGAL on /^
I try parse following js
and get ParserExeption Line 1: Unexpected token ILLEGAL This code works in chrome without any errors. Code to parse