Changeset 13560 in webkit
- Timestamp:
- Mar 29, 2006 9:37:43 AM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r13559 r13560 1 2006-03-29 Alexey Proskuryakov <ap@nypop.com> 2 3 Reviewed by Darin. 4 5 - http://bugzilla.opendarwin.org/show_bug.cgi?id=8055 6 Fix most CSS grammar conflicts. 7 8 Gets the number of shift/reduce and reduce/reduce conflicts down from 37+4 to 7+0. 9 10 I have fixed the reduce/reduce conflicts, then noticed that two of the fixes 11 were already made in KDE tree (the other two are different because declaration 12 blocks are described in quite different ways). Shift/reduce fixes are just 13 merged from KDE, r332845 by Michael Matz. 14 15 * css/CSSGrammar.y: 16 1 17 2006-03-29 Alexey Proskuryakov <ap@nypop.com> 2 18 -
trunk/WebCore/css/CSSGrammar.y
r13559 r13560 145 145 //%expect 37 146 146 147 %left UNIMPORTANT_TOK 148 147 149 %token WHITESPACE SGML_CD 148 150 … … 155 157 %token <string> STRING 156 158 157 %token <string> IDENT 158 159 %token <string> HASH 160 %token ':' 161 %token '.' 162 %token '[' 163 164 %token <string> '*' 159 %right <string> IDENT 160 161 %nonassoc <string> HASH 162 %nonassoc ':' 163 %nonassoc '.' 164 %nonassoc '[' 165 %nonassoc <string> '*' 166 %nonassoc error 167 %left '|' 165 168 166 169 %token IMPORT_SYM … … 290 293 291 294 maybe_space: 292 /* empty */ 295 /* empty */ %prec UNIMPORTANT_TOK 293 296 | maybe_space WHITESPACE 294 297 ; … … 381 384 382 385 media_list: 383 /* empty */ { 384 $$ = 0; 385 } 386 | medium { 386 medium { 387 387 $$ = static_cast<CSSParser*>(parser)->createMediaList(); 388 388 $$->appendMedium( domString($1).lower() ); … … 401 401 MEDIA_SYM maybe_space media_list '{' maybe_space ruleset_list '}' { 402 402 $$ = static_cast<CSSParser*>(parser)->createMediaRule($3, $6); 403 } 404 | MEDIA_SYM maybe_space '{' maybe_space ruleset_list '}' { 405 $$ = static_cast<CSSParser*>(parser)->createMediaRule(0, $5); 403 406 } 404 407 ; … … 475 478 476 479 selector_list: 477 selector {478 $$ = $1; 479 } 480 | selector_list ',' maybe_space selector {480 selector %prec UNIMPORTANT_TOK { 481 $$ = $1; 482 } 483 | selector_list ',' maybe_space selector %prec UNIMPORTANT_TOK { 481 484 if ($1 && $4) { 482 485 CSSParser* p = static_cast<CSSParser*>(parser); … … 523 526 524 527 namespace_selector: 525 /* empty */ { $$.string = 0; $$.length = 0; }526 | '*' { static unsigned short star = '*'; $$.string = ☆ $$.length = 1; }527 | IDENT { $$ = $1; }528 /* empty */ '|' { $$.string = 0; $$.length = 0; } 529 | '*' '|' { static unsigned short star = '*'; $$.string = ☆ $$.length = 1; } 530 | IDENT '|' { $$ = $1; } 528 531 ; 529 532 … … 547 550 $$->tag = QualifiedName(nullAtom, starAtom, p->defaultNamespace); 548 551 } 549 | namespace_selector '|'element_name maybe_space {552 | namespace_selector element_name maybe_space { 550 553 AtomicString namespacePrefix = atomicString($1); 551 554 CSSParser *p = static_cast<CSSParser *>(parser); … … 553 556 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 554 557 $$->tag = QualifiedName(namespacePrefix, 555 atomicString($ 3),558 atomicString($2), 556 559 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 557 560 else // FIXME: Shouldn't this case be an error? 558 $$->tag = QualifiedName(nullAtom, atomicString($ 3), p->defaultNamespace);559 } 560 | namespace_selector '|'element_name specifier_list maybe_space {561 $$ = $ 4;561 $$->tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace); 562 } 563 | namespace_selector element_name specifier_list maybe_space { 564 $$ = $3; 562 565 if ($$) { 563 566 AtomicString namespacePrefix = atomicString($1); … … 565 568 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 566 569 $$->tag = QualifiedName(namespacePrefix, 567 atomicString($ 3),570 atomicString($2), 568 571 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 569 572 else // FIXME: Shouldn't this case be an error? 570 $$->tag = QualifiedName(nullAtom, atomicString($ 3), p->defaultNamespace);571 } 572 } 573 | namespace_selector '|'specifier_list maybe_space {574 $$ = $ 3;573 $$->tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace); 574 } 575 } 576 | namespace_selector specifier_list maybe_space { 577 $$ = $2; 575 578 if ($$) { 576 579 AtomicString namespacePrefix = atomicString($1); … … 670 673 $$->value = atomicString($6); 671 674 } 672 | '[' maybe_space namespace_selector '|'attr_name ']' {675 | '[' maybe_space namespace_selector attr_name ']' { 673 676 AtomicString namespacePrefix = atomicString($3); 674 677 CSSParser *p = static_cast<CSSParser *>(parser); 675 678 $$ = p->createFloatingSelector(); 676 679 $$->attr = QualifiedName(namespacePrefix, 677 atomicString($ 5),680 atomicString($4), 678 681 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 679 682 $$->match = CSSSelector::Set; 680 683 } 681 | '[' maybe_space namespace_selector '|'attr_name match maybe_space ident_or_string maybe_space ']' {684 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space ']' { 682 685 AtomicString namespacePrefix = atomicString($3); 683 686 CSSParser *p = static_cast<CSSParser *>(parser); 684 687 $$ = p->createFloatingSelector(); 685 688 $$->attr = QualifiedName(namespacePrefix, 686 atomicString($ 5),689 atomicString($4), 687 690 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 688 $$->match = (CSSSelector::Match)$ 6;689 $$->value = atomicString($ 8);691 $$->match = (CSSSelector::Match)$5; 692 $$->value = atomicString($7); 690 693 } 691 694 ; … … 819 822 } 820 823 | 821 prio{824 IMPORTANT_SYM maybe_space { 822 825 /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */ 823 826 $$ = false;
Note: See TracChangeset
for help on using the changeset viewer.