You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>esprima.tokenize('/')
Error: Line 1: Invalidregular expression: missing/atErrorHandler.constructError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3396:22)atErrorHandler.createError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3414:27)atErrorHandler.throwError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3422:21)atScanner.throwUnexpectedToken(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3505:28)atScanner.scanRegExpBody(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:4510:19)atScanner.scanRegExp(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:4566:26)atTokenizer.getNextToken(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:6363:72)atObject.tokenize(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:136:36)
at repl:1:9atContextifyScript.Script.runInThisContext(vm.js:23:33)
Turning on the tolerant: true just dumps this as an error:
This raises the question: is this per design? Is an input consisting of a single solidus a correct token stream of one token (the division operator); or is it really the beginning of a malformed regular expression? (for my purposes, the former is far more convenient).
>esprima.tokenize('/=')
Error: Line 1: Invalidregular expression: missing/atErrorHandler.constructError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3396:22)atErrorHandler.createError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3414:27)atErrorHandler.throwError(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3422:21)atScanner.throwUnexpectedToken(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:3505:28)atScanner.scanRegExpBody(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:4510:19)atScanner.scanRegExp(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:4566:26)atTokenizer.getNextToken(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:6363:72)atObject.tokenize(/Users/eddieantonio/Projects/training-grammar-guru/tokenize-js/node_modules/esprima/dist/esprima.js:136:36)
at repl:1:9atContextifyScript.Script.runInThisContext(vm.js:23:33)
The text was updated successfully, but these errors were encountered:
Esprima: v3.1.3
Node: v7.5.0
When I try an input that is simply
/
, I getInvalid regular expression: missing /
.Here's Esprima working as expected (the input is not syntactically correct, but still produces tokens):
Simply remove the leading identifier and 💥:
Turning on the
tolerant: true
just dumps this as an error:This raises the question: is this per design? Is an input consisting of a single solidus a correct token stream of one token (the division operator); or is it really the beginning of a malformed regular expression? (for my purposes, the former is far more convenient).
Possibly related to #1516 and #1493.
EDIT: It fails for
/=
as well:The text was updated successfully, but these errors were encountered: