Re: [css3-syntax] Consumation of comment tokens during tree construction

On Wed, Jan 23, 2013 at 09:45:40AM +0100, Simon Sapin wrote:

> As much as I dislike having to do this, shouldn’t some comment
> tokens be preserved where the tree has "lists of primitives" so it
> can be serialized back correctly? Namely:
> 
> * at-rule prelude
> * selector
> * declaration value
> 
> Example of pathological input:
> border: 1px/**/solid

One possible answer is that it's the job of the serializer to insert a
comment token if asked to serialize the sequence DIMENSION IDENT, whether
or not we strip out comment tokens.

(This issue is already foreseen in comments in libcroco tokenizer source,
and may well similarly be already foreseen by code elsewhere that does
serialization.)

Another possible answer might be that this spec doesn't have to care
about serialization; is there or might there in future be a CSS spec that
covers serialization of a CSS core grammar token stream defined in terms
of css3-syntax, perhaps something related to CSSOM?  If the spec only
needs to give the right parse rather than the right re-serialization,
then this spec can omit the comment tokens.

For each of the above possible answers, there are counter-arguments
related to reducing bugs in practice.  I'm not expressing a preference
either way, I'm just making sure the decision gets made knowing that
there's a choice.

pjrm.

Received on Wednesday, 23 January 2013 12:03:51 UTC