Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15622

Re: Semicolons and the do..while statement

From BGB <cr88192@hotmail.com>
Newsgroups comp.lang.javascript
Subject Re: Semicolons and the do..while statement
Date 2012-08-30 11:17 -0500
Organization albasani.net
Message-ID <k1o3sn$6o6$1@news.albasani.net> (permalink)
References (1 earlier) <k1lopg$qsm$1@news.albasani.net> <4191624.W6QT1uhmCP@PointedEars.de> <KwGUp1Cpm2PQFwgv@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <2708624.1MEYokBNaJ@PointedEars.de> <2DfkyKFfY4PQFwEP@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>

Show all headers | View raw


On 8/30/2012 10:26 AM, John G Harris wrote:
> On Thu, 30 Aug 2012 at 15:59:43, in comp.lang.javascript, Thomas
> 'PointedEars' Lahn wrote:
>
>    <snip>
>> For crying out loud…
>>
>> | 2 Conformance
>> |
>> | […]
>> | A conforming implementation of ECMAScript is permitted to support program
>> | and regular expression syntax not described in this specification.  […]
>>
>> This, if nothing else, is sufficient to make it standards-compliant.
>
> For crying out loud, it's still a syntax error!
>
> Unless, of course, you have made it clear you are talking about the
> syntax spec for the browser, if, of course, the browser maker has
> published one that shows this feature, which it hasn't.
>
> If you'd said it's a permitted browser deviation we would have agreed,
> and then pointed out that it's a bloody stupid deviation.
>

my original point could be restated another way:
is it at least possible that people could have implemented their parsers 
in ways where they didn't notice that the semicolon was missing?...


digging through the V8 source (blarg, the code is hard to read) 
apparently it is an explicit feature. they eat the semicolon in this 
case, and then have a big comment to justify doing so (although for 
whatever reason they use the word "consume" rather than "eat", but 
either way...).

similarly, their logic for "ExpectSemicolon()" is very similar to what I 
call "EatSemicolon()".

IOW: no semicolon is (actually) inserted into the token-stream, rather 
the parser merely behaves as-if the semicolon were present (if it sees a 
linebreak or similar instead).

reference, in V8 code (at least for the version I have at-hand, dated 
2011-03-03):
v8/src/parser.cc:3775

and for the explicit do/while case:
v8/src/parser.cc:2191


checking:
Mozilla apparently also uses the same basic strategy as well:
for function "MatchOrInsertSemicolon()"
mozilla-central/js/src/jsparse.cpp:2020


this seems like irony.

the "insert" seems more symbolic in this case.


or such...

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Semicolons and the do..while statement BGB <cr88192@hotmail.com> - 2012-08-29 13:55 -0500
  Re: Semicolons and the do..while statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-29 22:20 +0200
    Re: Semicolons and the do..while statement BGB <cr88192@hotmail.com> - 2012-08-29 20:02 -0500
    Re: Semicolons and the do..while statement RobG <rgqld@iinet.net.au> - 2012-08-29 18:27 -0700
      Re: Semicolons and the do..while statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-30 12:37 +0200
    Re: Semicolons and the do..while statement John G Harris <john@nospam.demon.co.uk> - 2012-08-30 14:24 +0100
      Re: Semicolons and the do..while statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-30 15:59 +0200
        Re: Semicolons and the do..while statement John G Harris <john@nospam.demon.co.uk> - 2012-08-30 16:26 +0100
          Re: Semicolons and the do..while statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-30 17:47 +0200
            Re: Semicolons and the do..while statement John G Harris <john@nospam.demon.co.uk> - 2012-09-01 11:40 +0100
              Re: Semicolons and the do..while statement Dr J R Stockton <reply1235@merlyn.demon.co.uk.invalid> - 2012-09-02 19:54 +0100
          Re: Semicolons and the do..while statement BGB <cr88192@hotmail.com> - 2012-08-30 11:17 -0500
      Re: Semicolons and the do..while statement Gene Wirchenko <genew@ocis.net> - 2012-08-30 10:25 -0700
        Re: Semicolons and the do..while statement Dr J R Stockton <reply1235@merlyn.demon.co.uk.invalid> - 2012-08-31 23:20 +0100
          Re: Semicolons and the do..while statement Gene Wirchenko <genew@ocis.net> - 2012-08-31 16:03 -0700
  Re: Semicolons and the do..while statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-29 22:30 +0200

csiph-web