I vote for 1.  Let's not insert any more automatic semicolons than strictly 
required.  I can't see any justification for being more liberal here.  It's not 
like we have to accept legacy web practice.

On 2011-01-30, at 08:13, André Bargull wrote:

> I found a similar bug on bugzilla [1], apparently specification and 
> real-world implementation just doesn't match. Since our grammar for do-while 
> is broken anyway [2], it's now the perfect to time to decide how to fix the 
> grammar:
> 1) Be strict and make it compliant to the specification (Flex compiler 
> behaviour)
> 2) Be more loose and make it similar to the implementation in browsers
> 
> A bit more formal:
> 1) Semicolon with ASI
> DoWhileStatement ::= "do" Statement() "while" "(" Expression ")" ";"
> 
> 2) Optional semicolon without ASI
> DoWhileStatement ::= "do" Statement() "while" "(" Expression ")" (";")?
> 
> 
> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=238945
> [2] http://jira.openlaszlo.org/jira/browse/LPP-9719
> 
> 
> On 1/29/2011 9:00 PM, P T Withington wrote:
>> 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