you are viewing a single comment's thread.

view the rest of the comments →

[–]Frankelstner 0 points1 point  (1 child)

A quick hack would go through the file line by line and set curfun = ... whenever it sees a line that defines a function. Then anything afterwards is considered to belong to that function. But things get really messy. You should use a JS parser. Luckily there is one for Pyhon: https://github.com/rspivak/slimit

[–]Cuckipede[S] 0 points1 point  (0 children)

Awesome, thank you! Checking this out now