Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Nested comments

1 view
Skip to first unread message

Felix Meschberger

unread,
Sep 27, 2001, 6:08:17 AM9/27/01
to
This may be a dump question, but I have a problem reading the standard :

In text it says 'Multi-line comments may not nest'. Thus this

/* mello /* yeloo */

is NOT allowed.

But reading the BNF for MultiLineComment would syntactically allow
me to do that.

What's wrong ?

Thanks for any help
Regards
Felix


Steven C. Cole

unread,
Sep 27, 2001, 1:16:41 PM9/27/01
to

"Felix Meschberger" <Felix.Me...@day.com> wrote in message
news:3bb2fa48$0$179$4d4e...@news.ch.uu.net...

> This may be a dump question, but I have a problem reading the standard :
>
> In text it says 'Multi-line comments may not nest'. Thus this
>
> /* mello /* yeloo */
>
> is NOT allowed.
>
> But reading the BNF for MultiLineComment would syntactically allow
> me to do that.
>
> What's wrong ?

Your example is not a nested comment. A nested comment would look like
/* foo /* bar */ baz */

And the 'baz' part would be interpreted as an identifier instead of a
comment, since the comment ended at the *first* "*/" instead of the second.

--Steven Cole
sc...@planetweb.com


Norris Boyd

unread,
Oct 1, 2001, 10:27:28 AM10/1/01
to Felix Meschberger, mozill...@mozilla.org
You're right, this is a bug in both Rhino and Spidermonkey. The script

var passed = true;
try {
eval("/* mello /* yello */");
} catch (e) {
passed = false;
}
print(passed);

should print "true", but prints false on both engines. I'll fix Rhino.
Could someone fix SpiderMonkey?

--Norris

Waldemar Horwat

unread,
Oct 1, 2001, 8:08:03 PM10/1/01
to mozill...@mozilla.org
This is a bug because eval("/* /* */3") doesn't work. However, where
does the ECMA standard state
that you can eval an empty program such as eval("/* mello /* yello */")?

Waldemar

Norris Boyd

unread,
Oct 1, 2001, 9:52:20 PM10/1/01
to Waldemar Horwat, mozill...@mozilla.org
Both SpiderMonkey and Rhino accept eval(""). Is this not correct?

--N

Waldemar Horwat

unread,
Oct 2, 2001, 2:25:57 PM10/2/01
to mozill...@mozilla.org
It's not legal ECMAScript; however, we could consider this to be a
JavaScript extension. I don't think fixing this is worth the
potential compatibility problems.

Waldemar

0 new messages