Parse JavaScript to instrument code

前端 未结 5 1428
醉酒成梦
醉酒成梦 2021-02-09 05:56

I need to split a JavaScript file into single instructions. For example

a = 2;
foo()
function bar() {
    b = 5;
    print(\"spam\");
}

has to

5条回答
  •  佛祖请我去吃肉
    2021-02-09 06:25

    Why not use a JavaScript parser? There are lots, including a Python API for ANTLR and a Python wrapper around SpiderMonkey.

提交回复
热议问题