Whether there is js AST to json format with scope ?
For example:
Stmt(if (((((document.location).href).indexOf)("default="))>=0) Stmt({ Decl(var Binding(lang = ((((document.location).href).substring)((((((document.location).href).indexOf)("default="))+8))))) Stmt((document.write)((((("<option value='"+lang)+"'>")+(decodeURI(lang)))+"</option>"))) Stmt((document.write)("<option value='' disabled='disabled'>----</option>")) })) Stmt((document.write)("<option value='English'>English</option>")) Stmt((document.write)("<option value='French'>French</option>")) Stmt((document.write)("<option value='Spanish'>Spanish</option>")) Stmt((document.write)("<option value='German'>German</option>"))
to
"Stmt":{ "xxx":"xxxx" ......... }
I don't understand what you need. What problem do you have? You can only convert object or array literals (and decimal, string, true, false, null literals) to JSON...
I don't understand what you need. What problem do you have? You can only convert object or array literals (and decimal, string, true, false, null literals) to JSON...
This actually involves the ast standard of js, which called estree .I think it an json format and can use for many other tools
Do you want this library to be able to generate an AST tree according to the estree standard? What do you expect it to produce? Can you give me an example?
Do you want this library to be able to generate an AST tree according to the estree standard? What do you expect it to produce? Can you give me an example?
You can refer to this link https://astexplorer.net/ ,and we can do it together if you want .Although my level is limited
You can output JSON by calling ast.JSONString() (string, error) or using the JSON(io.Writer) error interfaces on all AST nodes. Considering this issue fixed.