This project has moved and is read-only. For the latest updates, please go here.

How can I parse JavaScript even if it has exceptions ?

Jun 26, 2013 at 8:47 PM
Basically the question is in the title...

Here is some situation:

I got some javascript from code from html document. I need to get all local data from this script, but it's also contains global variables (I don't need those).

How can I say to interpretotor ignore exceptions and goes ahead... or just parse all local variables...


Thank you...
Jun 27, 2013 at 11:12 PM
It's not possible to ignore exceptions, unfortunately. In theory you could modify the parser to catch exceptions and discard statements with errors (for example, in Parser.Parse), but in practice it is likely to cause cascading errors (where subsequent statements rely on an earlier statement that was discarded).