use of Rhino to parse the Javascript code

J

jackchang1

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!
 
J

Jeremy

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
 
J

jackchang1

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

thanks for your prompted reply!

yeah, that is what I am looking for. The class in Rhino that does the
grammer parsing so that I can reuse the class in my Java application.
But I didn't find this or its related document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top