(This is a resend of my mistaken mailing to dev-tech-js-engine)

Hi,

I just wanted to comment on the great work done recently on the Rhino
AST support.  It is a very useful change.  I'm a dev on the PMD
project, a static analysis tool.  Currently we working on improving
the guts of PMD for the next major release so our Language support can
expanded.  Over this past holiday weekend, I was able to wrap the
Rhino AST, into the generic PMD AST structure, thereby allowing me to
write a few beginning PMD Rules for Javascript code (both XPath and
Java based Rules).  Things are working excellently!  I'm very happy to
be able to leverage the parser expertise in Rhino to support
Javascript in PMD, and not try to come up with yet another JS parser.

I did encounter a few minor inconsistencies with some of the AST node
behavior.  There is also a loss of detail on NumberLiteral w.r.t the
original source and whether the literal was specified
octal/decimal/hexidecimal, etc.  I plan to submit test cases and
perhaps patches in the near future.

The most vexing issue, however, is related to line number and
length/position data on the Rhino AST.  I thought I had it figured
out, but I seem to get rather curious results at times.  I will boil
this down to test cases I can submit later.  For reference, PMD uses
JavaCC as a parser for our existing Languages, which automatically
produces begin/end lines and columns on the AST.  I think PMD needs to
generalize support for different models like those use on Rhino (e.g.
line number with start/end offsets from beginning of source file?).
Perhaps I'm just interpreting these numbers on the Rhino AST
incorrectly.

I plan to explore options for JSDoc integration with Rhino at some
point, perhaps they already exists, perhaps not.  There seems to be
some mutterings in the rhino archives.  Regardless, a project like PMD
can leverage this to allow more intelligent analysis.  If I end up
doing something for PMD, I'll be sure to share it back with the Rhino
community in case other folks find it useful.

Keep up the great work with Rhino!

--Ryan

P.S. If anyone is curious, PMD 5.0 snapshots are available on the
website (http://pmd.sourceforge.net/), if anyone wishes to experiment
with writing Javascript Rules, or play around with PMD in general.
Ant and command line support are always working.  Maven2 might be
there, I'm not sure though, I don't use it myself.  We are actively
working on the Eclipse plugin at this time, I personally want this
working ASAP.
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to