- From: Matthew Brealey <thelawnet@yahoo.com>
- Date: Tue, 14 Dec 1999 06:26:49 -0800 (PST)
- To: www-style <www-style@w3.org>
stylesheet : [ CHARSET_SYM [comment|S]* STRING [comment|S]* ';' ]? [comment|S|CDO|CDC]* [ import [comment|S|CDO|CDC]* ]* [ [ ruleset | media | page | font_face ] [comment|S|CDO|CDC]* ]* ; import : IMPORT_SYM [comment|S]* [STRING|URI] [comment|S]* [ medium [ ',' [comment|S]* medium]* ]? ';' [comment|S]* ; media : MEDIA_SYM [comment|S]* medium [ ',' [comment|S]* medium ]* '{' [comment|S]* ruleset* '}' [comment|S]* ; medium : IDENT [comment|S]* ; page : PAGE_SYM [comment|S]* IDENT? pseudo_page? [comment|S]* '{' [comment|S]* declaration [ ';' [comment|S]* declaration ]* '}' [commnent|S]* ; pseudo_page : ':' IDENT ; font_face : FONT_FACE_SYM [comment|S]* '{' [comment|S]* declaration [ ';' [comment|S]* declaration ]* '}' [comment|S]* ; operator : '/' [comment|S]* | ',' [comment|S]* | /* empty */ ; combinator : '+' [comment|S]* | '>' [comment|S]* | /* empty */ ; unary_operator : '-' | '+' ; property : IDENT [comment|S]* ; ruleset : selector [ ',' [comment|S]* selector ]* '{' [comment|S]* declaration [ ';' [comment|S]* declaration ]* '}' [comment|S]* ; selector : simple_selector [ combinator simple_selector ]* ; simple_selector : element_name? [comment]* [ HASH | class | attrib | pseudo ]* [comment|S*] ; class : '.' [comment]* IDENT ; element_name : IDENT | '*' ; attrib : '[' [comment|S]* IDENT [comment|S]* [ [ '=' | INCLUDES | DASHMATCH ] [comment|S]* [ IDENT | STRING ] [comment|S]* ]? ']' ; pseudo : ':' [comment]* [ IDENT | FUNCTION [comment|S]* IDENT [comment|S]* ')' ] ; declaration : property ':' expr [prio [comment|S]*]? | /* empty */ ; prio : IMPORTANT_SYM S* ; expr : term [ operator term ]* ; term : unary_operator? [ NUMBER [comment|S]* | PERCENTAGE [comment|S]* | LENGTH [comment|S]* | EMS [comment|S]* | EXS [comment|S]* | ANGLE [comment|S]* | TIME [comment|S]* | FREQ [comment|S]* | function ] | STRING [comment|S]* | IDENT [comment|S]* | URI [comment|S]* | RGB [comment|S]* | UNICODERANGE [comment|S]* | hexcolor ; function : FUNCTION [comment|S]* expr ')' [comment|S]* ; /* * There is a constraint on the color that it must * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) * after the "#"; e.g., "#000" is OK, but "#abcd" is not. */ hexcolor : HASH [comment|S]* ; comment : '/*' COMMMENTDATA '*/' ; This seems a better approach, although there is a different (and IMHO better) option: 1. define SEMICOLON, OPENCURLYBRACKET, etc., tokens so that everything is a series of tokens. Note that the above grammar would change the validity of certain comment locations - at present, P/* comment */.class isn't valid, since it is element_name followed by class, where element_name is an IDENT token and class is a '.' literal and an IDENT token. It seems that two things must be done: 1. make everything into tokens 2. include comments in the grammar - it is claimed that they are left out for readability, but the CSS grammar is hardly a page turner - readability is not very important, but ease of use by parsers is, and the ambiguity resulting from omission of comments and incomplete use of tokens is serious. ===== ---------------------------------------------------------- From Matthew Brealey (http://members.tripod.co.uk/lawnet (for law)or http://members.tripod.co.uk/lawnet/WEBFRAME.HTM (for CSS)) __________________________________________________ Do You Yahoo!? Thousands of Stores. Millions of Products. All in one place. Yahoo! Shopping: http://shopping.yahoo.com
Received on Tuesday, 14 December 1999 09:27:20 UTC