W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] Error in Comment start dash state (8.2.4.19)

From: Philip Taylor <excors+whatwg@gmail.com>
Date: Sat, 13 Dec 2008 01:14:16 +0000
Message-ID: <ea09c0d10812121714p4eaf1020h310c939dc9bfa39@mail.gmail.com>
On Sat, Dec 13, 2008 at 1:01 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> On Fri, Dec 12, 2008 at 4:52 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>> Currently tokenizing the following string (starting at Data state)
>> "<!--foo" results in a parse error when hitting the 'f'. It seems like
>> the error is in the "Comment start dash state" (section 8.2.4.19). It
>> should switch to 'comment state' when a '-' is consumed, which is not
>> what it currently does.
>
> One more thing I forgot to mention. Several of the states regarding
> comments refer to outputting 'the comment token' and 'the comment
> tokens data'. However there is no mention that I could find for when
> the comment token is created. Maybe this isn't an error but a general
> pattern?

The comment tokens are created in:

  "8.2.4.17 Markup declaration open state
  ...
  If the next two characters are both U+002D HYPHEN-MINUS (-)
characters, consume those two characters, create a comment token whose
data is the empty string, and switch to the comment start state."

I believe that also deals with your first comment: the two dashes are
consumed before switching to the comment start state, and so they're
not going to be seen again in the comment start state or comment start
dash state. (Those states are there to handle <!---> and <!---->.)

-- 
Philip Taylor
excors at gmail.com
Received on Friday, 12 December 2008 17:14:16 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:46 UTC