echo094 / decode-js

JS混淆代码的AST分析工具 AST analysis tool for obfuscated JS code
MIT License
548 stars 295 forks source link

Cannot parse code: InvalidOrUnexpectedToken #91

Open GithubRookieZ opened 2 months ago

GithubRookieZ commented 2 months ago

I want to anti-obfuscate a JS file, but prompt that the error is Cannot parse code: InvalidOrUnexpectedToken. How can I solve this situation?

微信图片_20240512100508

echo094 commented 2 months ago

This message indicates that the @babel/parser plugin cannot process your file correctly, and it throws the InvalidOrUnexpectedToken error:

https://github.com/babel/babel/blob/1199e6aca1df0db81074cc99fa3f89a54f02810d/packages/babel-parser/src/tokenizer/index.ts#L1051-L1057

The possible reason is that the file was edited accidentally, e.g., the insertion of extra characters. The @babel/parser cannot process a code block that is unable to run properly.