Using Nashorn for a general-purpose JavaScript AST handler?

A. Sundararajan sundararajan.athijegannathan at
Tue Feb 10 02:03:08 UTC 2015


Nashorn parser API (  will be pushed 
shortly to jdk9.  That should help with these use cases.

In the meanwhile, there is script API for parsing. This is loaded and 
called using


and calling top level function "parse".

For a sample, please try this one:

Hope this helps,

On Tuesday 10 February 2015 03:16 AM, KARR, DAVID wrote:
>  From time to time, I've looked at using PMD for various metadata scanners for Java code.  It's very easy to define callbacks for various syntax elements and then gather data from those found elements.  I'm starting to see people looking at doing similar things for JavaScript code.  Is there a straightforward way to use Nashorn to do this kind of thing?

More information about the nashorn-dev mailing list