Open n-riesco opened 7 years ago
Babel's parser doesn't detect incomplete code:
> require("babel-core").transform("{");
SyntaxError: unknown: Unexpected token (1:1)
> 1 | {
| ^
at Parser.pp$5.raise (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:4373:13)
at Parser.pp.unexpected (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:1716:8)
at Parser.pp$3.parseExprAtom (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3683:12)
at Parser.pp$3.parseExprSubscripts (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3427:19)
at Parser.pp$3.parseMaybeUnary (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3407:19)
at Parser.pp$3.parseExprOps (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3337:19)
at Parser.pp$3.parseMaybeConditional (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3314:19)
at Parser.pp$3.parseMaybeAssign (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3277:19)
at Parser.pp$3.parseExpression (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:3239:19)
at Parser.pp$1.parseStatement (/home/user/node_modules/babel-core/node_modules/babylon/lib/index.js:1861:19)
What exactly are you asking o.p.? If you want a solution which is what I think you want please reference a solid point of entry to get started (=
@Announcement The issue is described in the comment linked above (and here for your convenience).
By default, babel
uses the parser babylon, which throws the same type of error for invalid and incomplete expressions. See:
> var babylon = require("babylon");
> babylon.parse("{")
SyntaxError: Unexpected token (1:1)
> babylon.parse("}")
SyntaxError: Unexpected token (1:0)
Other parsers, e.g. esprima, throw different type of errors:
> var exprima = require("exprima");
> esprima.parse("{")
Error: Line 1: Unexpected end of input
> esprima.parse("}")
Error: Line 1: Unexpected token }
Anyway, I'm going to remove the label help wanted
since after some thought I have an idea for a workaround.
Hi,Sir.I can not run it.The kernel dead. error log: Kernel started: 24cae8e1-a8e7-4bfd-960a-b629a2f7c99d internal/modules/cjs/loader.js:605 throw err; ^
Error: Cannot find module '../build/Release/zmq.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.
Thanks
@youyiqin I'm guessing you've updated Node.js recently. If you did, then you need to reinstall IJavascript.
If reinstalling IJavascript doesn't fix the problem, please, open a new issue and include the commands you are running to install IJavascript.
@n-riesco Thanks!! Yes,I have updated nodejs and npm.And I also reinstalled ijavascript.It works well unless new create a jp-babel work page.
Invalid code should return
is_complete_reply.status: 'invalid'
.Moved from https://github.com/n-riesco/jp-babel/issues/13#issuecomment-294376267 .