Re: NUMBER vs <number>

(12/05/22 4:28), Bjoern Hoehrmann wrote:
> * Bert Bos wrote:
>> So the actual edit to CSS 2.1 is easy, I think: just add that word 
>> "immediately" that css3-values already has. It goes into section 4.3.1.
> 
> The Recommendation says "COMMENT tokens do not occur in the grammar (to
> keep it readable), but any number of these tokens may appear anywhere
> outside other tokens." If the "-" and the "22em" are two tokens, then
> adding "immediately" somewhere is not sufficient to clarify that between
> these particular tokens COMMENTs are not allowed, given the quoted text.

Well, there is this sentence at the beginning of 4.1:

  # In this specification, the expressions "immediately before" or
  # "immediately after" mean with no intervening white space or
  # comments.

(By the way, the spec always uses "immediately followed" or "followed
immediately", so please consider this an editorial errata item:

  | In this specification, the expressions "immediately followed" or
  | "followed immediately" mean with no intervening white space or
  | comments.
)

In any case, I agree that having contradictory information in a spec is
very bad so we need to change the formal grammar as well as the prose here.

Otherwise, we can remove the above sentence. I should note that CSS3 V&U
doesn't have this yet.

(12/05/22 4:17), Tab Atkins Jr. wrote:
> The necessary edits are:
>
> - num [0-9]+|[0-9]*\.[0-9]+
> + num [-+]?([0-9]+|[0-9]*\.[0-9]+)
>
> The rest of 2.1 is fine as far as I know.

Not quite. As long as you care about Appendix G (if you don't, please
just drop it.),  you need

- unary_operator
-   : '-' | '+'
-   ;

and

term
-  : unary_operator?
-    [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* |
-      ANGLE S* | TIME S* | FREQ S* ]
+  : NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* |
+    ANGLE S* | TIME S* | FREQ S*

(I'd note that WebKit use these in it's implementation.)


Cheers,
Kenny

Received on Tuesday, 22 May 2012 03:43:21 UTC