[英]Print javascript function tree
I need to parse some javascript code and print a tree of function declarations and calls (and nothing else). 我需要解析一些javascript代码并打印功能声明和调用的树(仅此而已)。
Something like this: 像这样:
function test3()
function test()
declares
function test2()
calls test3()
calls test2()
What is the fastest and easies way to do this ? 最快,最简便的方法是什么? I have multiple functions and files. 我有多个功能和文件。
I've tried using Antlr, spent 2 days and finally gave up, it's too complicated for me. 我尝试使用Antlr,花了2天,最后放弃了,这对我来说太复杂了。
Any help will be appreciated. 任何帮助将不胜感激。
Esprima是一个JavaScript解析器,可让您获取所需的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.