On Sat, Dec 25, 2010 at 2:32 PM, Joel Reymont <[email protected]> wrote:

> What I'd like to do is programmatically get hold of the string
> "SyntaxError: Unexpected token ;" and of the location of that caret (^)
> above. This is so that I can highlight the word "return" in the window where
> the user typed the code and display the error message in the status line.
>
> Is this possible?
>


Below is a link to some code where i've done something similar to this. This
code by itself won't give you enough info to be able to highlight the exact
word where the error happened (because it only knows about the position of
the error, not the semantics of the token at that position), but
demonstrates how to get the line/column information, which should be enough
info for you to mark the error location clearly in a text editor widget:

http://code.google.com/p/v8-juice/source/browse/trunk/src/lib/juice/JuiceShell.cc?r=1231#152

That code is largely an adaptation from the sample v8 shell app, and
produces results similar (if not identical) to what you've shown above.

i hope this helps.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to