views:

52

answers:

1

Possible Duplicate:
how to parse javascript file?

Hi All ,

I have a scenario where I am getting my JavaScript file content in the form of text , now I need to parse that text into meaningful objects so that i can identify the objects & events associated with them for that i need a parser to parse this text in JavaScript . Can Anyone tell me how to approach this problem .

Thanks in Advance ,

Vinay

+3  A: 

Use the javascript method eval(String) to do so.

http://www.w3schools.com/jsref/jsref_eval.asp http://www.devguru.com/technologies/ecmascript/quickref/eval.html

Yves M.
Addition: Don't forget about try{..}catch(e){..}
Falcon
Hey , I dont need to exexute the javascript , I just need to parse it so that i can use it contents.
Vinay