On Sat, Jul 13, 2013 at 11:16 AM, Rick Waldron <[email protected]> wrote:
>
>
>
> On Fri, Jul 12, 2013 at 8:09 PM, Andrew Fedoniouk
> <[email protected]> wrote:
>>
>> On Fri, Jul 12, 2013 at 4:17 PM, Tab Atkins Jr. <[email protected]>
>> wrote:
....
>> > In other words, ASI only happens when a semicolon is *required*, not
>> > when one is *possible*.
>>
>> Your hypothesis would be true if not this case:
>
>
> Tab's response is not a hypothesis, it's a generalization of the
> specification. ASI rules are defined, unambiguously, in the ECMAScript spec.
>
>>
>>
>> return
>> { a:1 };
>>
>> Why it injects ';' after the return?  This
>>
>>   return { a:1 };
>>
>> is perfectly valid construction.
>
>
> For the same reason I've mentioned several times in this thread: a [no
> LineTerminator here], which exists between return and the optional
> Expression:
>
>   return [no LineTerminator here] Expression (optional);
>

OK, what about this definition then

[name] [no LineTerminator here] [literal object declaration];

So this:

foo.bar {
   one:1,
   two:1
};

will be parse as a method call: foo.bar {one:1,two:1};

And this:

foo.bar
{
   one:1,
   two:1
};

as in case of 'return' will be parsed with ASI in effect:

foo.bar;
{
   one:1,
   two:1,
};

Any other discussions about attempts to transform Java/C/C++/D grammar
(where '\n' is just a space) to FORTRAN/BASIC-derived line oriented grammars
(Python/Ruby/Lua/etc) I'll left for off-list conversations.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to