Re: [CSS21] [4.2 Rules for handling parsing errors] Unexpected end of string questions

Le 17/08/2012 06:34, "Gérard Talbot" a écrit :
> The modified test - and this is my mistake - looks/seems now still doubtful:
>
> http://test.csswg.org/suites/css2.1/nightly-unstable/html4/unterminated-string-001.htm
>
>
> div
>              {
>                  color: green;
>                  font-family: 'Courier;
>                  color: red;
>              }
>
>
> If I understand the parsing rules, error handling rules, the declaration
> block
> font-family: 'Courier;
> should be dropped and only such declaration block (which ends with a
> semicolon). The
> color: red;
> declaration block should*not*  be dropped. And therefore, the div's text
> should be red!
>
> Is my reasoning correct?

I think not. The semicolon after Courier is part of the BAD_STRING token 
which ends at the unescaped newline, so there is no DELIM semicolon 
token to end the declaration. The tokens in the property value for this 
declaration are S BAD_STRING S IDENT : S IDENT.


> The test would be much better (in as for parsing errors and error
> handling) and more precise if it had/if it was:
>
> div
>              {
>                  color: green;
>                  font-family: 'Courier
>                  color: red;
>              }
>
> Am I correct ?

This yields the same tokens as above, but might better show its intent. 
But there are two errors in this test: the un-terminated string and the 
missing semi-colon. I don’t know if such tests exist already but the 
handling of the two errors could be tested separately:


/* Valid declaration with an invalid IDENT S IDENT : S IDENT value
    for 'color' */
div {
   color: green;
   color: red
   color: red;
}

/* Un-terminated string */
div:before {
   content: 'PASS'
      ;
   content: 'FAIL
      ;
}


-- 
Simon Sapin

Received on Friday, 17 August 2012 07:00:47 UTC