ja********@gmail.com wrote:
Hi
I want to develop a Java application to check the syntax of Javascript
code and I am thinking about using Rhino. But I don't know where to
start and there is no document for this. Has anybody done this before?
or can Rhino be embedded in my Java application to check the syntax of
JavaScript code? I thought it is possible.
Thanks!
Rhino can certainly be embedded into your application to run javascript
code. To just check syntax, it's really overkill. What you really want
to do is use a Javascript grammar to parse the code that you want to
check (you can probably find the grammar, or even the ready-made lexer
and parser, in the rhino package).
Your parser can then tell you if any errors were encountered during
parsing (indicating a syntax error).
Jeremy