Ryan,

I've also found this problem about the loss of precission in the
NumberLiteral node; did you manage to correct it some way?

I was curious about how PMD has embedded rhino as in fact I have to
solve a similar problem. I need to transform Rhino's AST into my own
AST version which is required by the rest of our application. You've
done a good job with EcmascriptTreeBuilder. My approach is quite
similar to yours.

I need to generate original Javascript code from the AST so I think I
will find similar problems that you've found: keep track of positions,
maintain original indentation, etc.

Any suggestions and comments about Rhino's parser integration are very
welcome as I'm in an evaluation stage yet (perhaps Rhino cannot
accomplish all my requirements).

Cheers,

Iván

On 3 dic 2008, 07:34, "Ryan Gustafson" <[email protected]>
wrote:
> (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 onNumberLiteralw.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
  • New AST and PMD Ryan Gustafson
    • Re: New AST and PMD Iván Párraga García

Reply via email to