use of Rhino to parse the Javascript code

Discussion in 'Javascript' started by jackchang1@gmail.com, Feb 27, 2007.

  1. Guest

    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!
    , Feb 27, 2007
    #1
    1. Advertising

  2. Jeremy Guest

    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
    Jeremy, Feb 27, 2007
    #2
    1. Advertising

  3. Guest

    On Feb 26, 6:10 pm, Jeremy <> wrote:
    > 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


    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.
    , Feb 27, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil Powell
    Replies:
    0
    Views:
    537
    Phil Powell
    Nov 28, 2003
  2. Timasmith
    Replies:
    3
    Views:
    663
    Thomas Kellerer
    Mar 5, 2007
  3. Timasmith

    1.6 better than Rhino

    Timasmith, Mar 5, 2007, in forum: Java
    Replies:
    8
    Views:
    389
    Chris Uppal
    Mar 7, 2007
  4. Phil Powell
    Replies:
    0
    Views:
    107
    Phil Powell
    Nov 28, 2003
  5. Garrett Smith

    Non-Browser javascript Implementations - Rhino

    Garrett Smith, Apr 12, 2010, in forum: Javascript
    Replies:
    37
    Views:
    526
    Garrett Smith
    May 2, 2010
Loading...

Share This Page