do-while grammar

Mark S. Miller erights at google.com
Tue Feb 8 14:01:02 PST 2011


Does anyone know of any other syntax that all major JS engines accept that
are not in the official ES5.1 grammar?

Does anyone know of any places on the web attempting to accumulate such
exceptions?

The other one I know of is nested named function declarations <
http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls>.
And there was an ASI mis-description for "break" and "continue" that was
corrected between ES5 and ES5.1.

We really need a complete codification of the consensus ES5.1 grammar.
Starting from the official grammar, the Caja <
http://caja.appspot.com/trycaja/index.html?input=do%20{%3b}%20while%28false%29%20false>
and
ES-Lab <http://es-lab.googlecode.com/svn/trunk/site/esparser/index.html>
parsers both reject "do {;} while (false) false;" because we didn't know any
better. I expect there are many other independent parsers (minimizers,
linters, etc) that make the same mistake.

Even if such "corrections" do not make it into future errata, I would like
to see them recorded on the ecmascript wiki.


On Tue, Feb 8, 2011 at 12:12 PM, André Bargull <andre.bargull at udo.edu>wrote:

>  Just for the record, here's a link to the bug report on bugzilla
> concerning ASI for do-while:
> https://bugzilla.mozilla.org/show_bug.cgi?id=238945
>
> (Interesting that I came across the very same issue in January while
> working on the OpenLaszlo parser code :-)
>
> FWIW, JavaScriptCore provides automatic semicolon insertion after all
> do-while statements in all contexts. We made this change for web
> compatibility, mimicking a Firefox quirk.
>
>  Geoff
>
> On Feb 8, 2011, at 11:53 AM, Dave Fugate wrote:
>
>   Just to confirm, do-while iteration statements do in fact require a
> semi-colon at the end as indicated in 12.6.1 of ES5, correct?  That is, a
> production of the nature:
>                 do {;} while (false) *false*;
>
> would be invalid JavaScript as doesn’t meet any of the three rules set out
> in 7.9.1,  right?
>
> Thanks,
>
> Dave
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110208/ffba8a6b/attachment.html>


More information about the es-discuss mailing list