Re: [css-variables] ...let's change the syntax

Simon Sapin:
> On 16/03/2014 07:49, Tab Atkins Jr. wrote:
> >On Sat, Mar 15, 2014 at 1:54 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> >>I don't forsee "--" as needing any changes to our CSS parser, so it
> >>shouldn't be any harder to switch to than "_".
> 
> Really? My reading on nsCSSScanner.cpp is that we correctly
> implement the spec, and a token that starts with "--" can not be a
> eCSSToken_Ident
> 
> http://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSScanner.cpp?rev=a2cb9d6adebc#1275

You are right; I was working off memory.

> So I believe this would requires a change in the tokenizer. Are we
> ready to make the same change to all CSS identifiers?

What’s the reasoning behind disallowing it?

> >But yeah, -- as a prefix works just fine
> >for me - it's easy to type, easy to see/notice, has a nice parallel
> >with the old vendor prefixes, and as a special bonus, simplifies the
> >definition of <ident-token> slightly.
> 
> Does it? As I understand it, the current definition of <ident-token>
> is designed to not overlap with numbers:
> 
> * An optional ASCII hyphen
> * Followed by one name-start code point or escape
> * Followed by zero or more name code points or escapes
> 
> (The non-overlap with numbers, including negative, is achieved by
> having "name-start" not contain the ASCII hyphen or digits)
> 
> What would be the new one?

1. An ASCII hyphen followed by either:
     (a) * a name-start code point or escape
         * followed by zero or more name code points or escapes; or
     (b) * an ASCII hyphen
         * followed by zero (one?) or more name code points or escapes.
  Or
2. * A name-start code point or escape
   * Followed by zero or more name code points or escapes

So it wouldn’t be simpler.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Sunday, 16 March 2014 07:43:26 UTC