I would like to use ParseKit for analyzing some javascript code. I got the framework setup with a javascript grammar, but I can't really get my head around what route to take to analyze the code. The thing is, i would like in the end to for example get an array of all globally declared var's (so var's that are defined outside a function). But i can't really see how i can get that result! I've been reading a lot of questions here on stack overflow, and can see that I somehow probably should use the stack and target of the assembler, but the thing is that the function callback is called when it reaches the functions block end, so all the var definitions get's callbacked before. How do i know when i get a callback on a var inside a function, that its inside?
var i = 0;
function test(){
var u = 0;
}
Here i want to find i for example, not u. But the callbacks are
#1 Found var i
#2 Found var u
#3 Found func test
Jonas