Source information for multiple .Run() operations

Dec 16, 2010 at 6:40 PM

Hi,

Perhaps like many, I use the Jint engine to load (Run()) multiple scripts into a JintEngine instance and then .Run() the main scripts. This supports the idea of having script libraries which can be loaded into the runtime and then running the main script which references code in the libraries.

The problem I have, is that error information only reports a line/char position and there is no way to relate that to a particular script introduced via .Run(). I suspect this may be the underlying issue that this: http://jint.codeplex.com/workitem/6870 is trying to solve where they concatenate the scripts together in order to be able to relate line #s to actual script sources when debugging.

In looking at Antlr and the Jint source, it seems, at least on the surface, possible to pass what Antlr calls a 'SourceName' into the compile step and then flow that name back via the ExtractSourceCode() method in the parser to Jint.Debugger.SourceCodeDescriptor. When an error occurs, JintEngine would have access to this name via vistor.CurrentStatement.Source.

I would actually like to also see JintException expose properties for the source, line, and position rather than just formatting them into a message. That way, users of JintEngine.Run() don't have to parse these values out of the message in order to use them.

Does this seem reasonable? Are there other options?

Paul.