- From: Simon Sapin <simon.sapin@kozea.fr>
- Date: Tue, 11 Dec 2012 09:19:02 +0100
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: Simon Pieters <simonp@opera.com>, "www-style@w3.org" <www-style@w3.org>
Hi,
Here is a proposed new grammar for @supports. It accepts the and(, or(
and not( FUNCTION tokens as equivalent to an IDENT followed by '(', but
should otherwise be equivalent.
(I also changed the grouping parens from () to [] in order to
distinguish from '(' and ')' tokens, and to match CSS 2.1 Appendix G
that this extends.)
Additional tokens:
{N}{O}{T}"(" {return NOT_FUNCTION;}
{A}{N}{D}"(" {return AND_FUNCTION;}
{O}{R}"(" {return OR_FUNCTION;}
New grammar:
supports_rule
: SUPPORTS_SYM S* supports_condition group_rule_body
;
supports_condition
: supports_negation | supports_conjunction | supports_disjunction |
supports_condition_enclosed
;
supports_condition_enclosed
: [ '(' S* supports_condition_nested | FUNCTION supports_unknown ]
')' S*
;
supports_condition_nested
: supports_condition | declaration | supports_unknown
;
supports_unknown
: [any|unused]*
;
supports_conjunction
: supports_condition_enclosed supports_conjunction_clause+
;
supports_disjunction
: supports_condition_enclosed supports_disjunction_clause+
;
supports_conjunction_clause
: AND S* supports_condition_enclosed |
: AND_FUNCTION S* supports_condition_nested ')' S*
;
supports_disjunction_clause
: OR S* supports_condition_enclosed |
: OR_FUNCTION S* supports_condition_nested ')' S* ]
;
supports_negation
: NOT S* supports_condition_enclosed |
: NOT_FUNCTION S* supports_condition_nested ')' S*
;
Cheers,
--
Simon Sapin
Received on Tuesday, 11 December 2012 08:19:55 UTC