Re: Question on parsing of "font" property

Ernest Cline wrote:
> The problem is with the grammar as given in CSS 2.1, it looks
> like when the 'font' rule includes the slash to separate <font-size>
> and <line-height> that the result is something which going strictly by
> the tokenizer isn't tokenizable

http://www.w3.org/TR/CSS21/grammar.html#q1 has:

operator
   : '/' S* | COMMA S* | /* empty */

term
   : unary_operator?
     [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
       TIME S* | FREQ S* | function ]
   | STRING S* | IDENT S* | URI S* | hexcolor

expr
   : term [ operator term ]*

declaration
   : property ':' S* expr prio?
   | /* empty */

So "10px /20px Times, Helvetica" would be tokenized as:

term(LENGTH): 10px
operator: /
term(LENGTH): 20px
operator:
term(IDENT): Times
operator: COMMA
term(ident) Helvetica

as far as I can see.

The question is what to do with that token stream afterwards.

-Boris

Received on Tuesday, 18 May 2004 22:36:23 UTC