Nashorn comment nodes in the syntax tree

Sundararajan Athijegannathan sundararajan.athijegannathan at oracle.com
Mon Jun 13 03:31:01 UTC 2016


start and finish should not include comments around. If it does, it is a
bug. Please do file a bug and send us test case here and we'll file a bug

Thanks,

-Sundar


On 6/10/2016 9:05 PM, Emilian Bold wrote:
> BTW, jdk.nashorn.internal.ir.IdentNode (and other classes) seem to
> have the habit of "absorbing" the nearby comments and have incorrect
> start/finish offsets.
>
> Is this intentional or a bug?
>
> I haven't tested yet but I wonder if it propagates to the TreeAPI (ie.
> does IdentifierTree also swallow adjacent comments?)
>
>
>
> --emi
>
> On Wed, Apr 27, 2016 at 5:18 PM, Sundararajan Athijegannathan
> <sundararajan.athijegannathan at oracle.com
> <mailto:sundararajan.athijegannathan at oracle.com>> wrote:
>
>     Hi,
>
>     I filed an enhancement request:
>     https://bugs.openjdk.java.net/browse/JDK-8155242
>
>     Thanks,
>
>     -Sundar
>
>
>     On 4/27/2016 12:40 AM, Emilian Bold wrote:
>     > Hello,
>     >
>     > NetBeans used a modified Rhino that had useful features for an
>     IDE like
>     > comment nodes and parser-level sanitization.
>     >
>     > As far as I know there is no way to get the comments in the
>     Nashorn Tree
>     > API (created as part of JEP 236) or in the
>     jdk.nashorn.internal.ir <http://jdk.nashorn.internal.ir> Node
>     > subclasses.
>     >
>     > Obviously having access to comment contents and comment offsets
>     is very
>     > useful. An IDE, for example, would provide code folding for the
>     multiline
>     > comment.
>     >
>     > Am I missing some proper way to get this information?
>     >
>     > I believe an extra option for Parser.create() would be nice (plus a
>     > CommentTree and a visitComment method).
>     >
>     > --emi
>
>



More information about the nashorn-dev mailing list