简体   繁体   中英

Print javascript function tree

I need to parse some javascript code and print a tree of function declarations and calls (and nothing else).

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.

Any help will be appreciated.

Esprima是一个JavaScript解析器,可让您获取所需的信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM