At least in our parser, it looks like StatementList and Statement cooperate to 
allow you to put certain statements together without an intervening semicolon.  
Surely an error in our grammar.  The fact that other JS's allow it makes me 
think that it might be a bug in the specification grammar.

On 2011-01-29, at 12:23, André Bargull wrote:

> Can anyone shed some lights on automatic semicolon insertion (ASI) and the 
> do-while statement?
> 
> Consider this function declaration:
>  function foo () {do {} while(0)(0)}
> 
> I'd expect a syntax error, because ASI does not apply in this case (cf. 7.9 
> ECMAScript3/5), but all major browsers I've tested with (Firefox, Opera, 
> Safari, IE) accept that function. Compiling the function declaration with the 
> Flex compiler generated a syntax error just as expected. Note: I've used the 
> plain html- resp. as-file for testing. Our parser accepts the declaration, 
> too, but it will also generate non-ambiguous code, therefore I wanted to use 
> plain files to verify our parser works correctly.
> 
> Generated code from our compiler:
> function foo () {
> /* -*- file: #3 -*- */
> do {
> 
> } while (0);
> /* -*- file: #3 -*- */
> 0
> }
> <asi-dowhile.lzx><asi_dowhile.as><asi-dowhile.html>


Reply via email to