microsoft/ClearScript

Whether ClearScript acts as a parser.

Rison-Hub opened this issue · 2 comments

Does ClearScript parse JavaScript code into ASTs (Abstract Syntax Trees), allowing you to traverse and analyze code structures more easily.
Example:

let IFstr_TYbox="A";
function Test1() {
	zp.Print(GlobalPara); }
}
function Test2() {
	zp.Print(GlobalPara); } function Test2() { zp.
}

function Main() {
	zp.Print(GlobalPara); } function Main() { zp.
}
Main().

I want to iterate through and extract all the function code

Hi @Rison-Hub,

ClearScript uses V8 or JScript to execute JavaScript code. Parsing is part of that, but neither ClearScript nor the script engines themselves expose JavaScript parsing services to the host.

You can use a library such as Esprima to parse and inspect JavaScript code.

Good luck!

Oh, that's a shame. But thank you very much.