Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: Source/core/css/CSSGrammar.y.in

Issue 17121007: Cleanup in CSSGrammar.y.in (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2012 Intel Corporation. All rights reserved. 6 * Copyright (C) 2012 Intel Corporation. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 %type <rule> namespace 227 %type <rule> namespace
228 %type <rule> page 228 %type <rule> page
229 %type <rule> margin_box 229 %type <rule> margin_box
230 %type <rule> font_face 230 %type <rule> font_face
231 %type <rule> host 231 %type <rule> host
232 %type <rule> keyframes 232 %type <rule> keyframes
233 %type <rule> invalid_rule 233 %type <rule> invalid_rule
234 %type <rule> rule 234 %type <rule> rule
235 %type <rule> valid_rule 235 %type <rule> valid_rule
236 %type <ruleList> block_rule_body 236 %type <ruleList> block_rule_body
237 %type <ruleList> block_rule_list 237 %type <ruleList> block_rule_list
238 %type <ruleList> region_block_rule_body 238 %type <ruleList> region_block_rule_body
239 %type <ruleList> region_block_rule_list 239 %type <ruleList> region_block_rule_list
240 %type <rule> block_rule 240 %type <rule> block_rule
241 %type <rule> block_valid_rule 241 %type <rule> block_valid_rule
242 %type <rule> region 242 %type <rule> region
243 %type <rule> supports 243 %type <rule> supports
244 %type <rule> viewport 244 %type <rule> viewport
245 %type <rule> filter 245 %type <rule> filter
246 246
247 %type <string> maybe_ns_prefix 247 %type <string> maybe_ns_prefix
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 parser->m_hadSyntacticallyValidCSSRule = true; 460 parser->m_hadSyntacticallyValidCSSRule = true;
461 } 461 }
462 | invalid_rule 462 | invalid_rule
463 ; 463 ;
464 464
465 block_rule_body: 465 block_rule_body:
466 block_rule_list 466 block_rule_list
467 | block_rule_list error error_location rule_error_recovery { 467 | block_rule_list error error_location rule_error_recovery {
468 parser->reportError($3, CSSParser::InvalidRuleError); 468 parser->reportError($3, CSSParser::InvalidRuleError);
469 } 469 }
470 ; 470 ;
471 471
472 block_rule_list: 472 block_rule_list:
473 /* empty */ { $$ = 0; } 473 /* empty */ { $$ = 0; }
474 | block_rule_list block_rule maybe_sgml { 474 | block_rule_list block_rule maybe_sgml {
475 $$ = $1; 475 $$ = 1;
apavlov 2013/06/19 14:02:19 $1, not 1
SeRya 2013/06/19 14:07:01 Done.
476 if ($2) { 476 if ($2) {
477 if (!$$) 477 if (!$$)
478 $$ = parser->createRuleList(); 478 $$ = parser->createRuleList();
479 $$->append($2); 479 $$->append($2);
480 } 480 }
481 } 481 }
482 ; 482 ;
483 483
484 region_block_rule_body: 484 region_block_rule_body:
485 region_block_rule_list 485 region_block_rule_list
486 | region_block_rule_list error error_location rule_error_recovery { 486 | region_block_rule_list error error_location rule_error_recovery {
487 parser->reportError($3, CSSParser::InvalidRuleError); 487 parser->reportError($3, CSSParser::InvalidRuleError);
488 } 488 }
489 ; 489 ;
490 490
491 region_block_rule_list: 491 region_block_rule_list:
492 /* empty */ { $$ = 0; } 492 /* empty */ { $$ = 0; }
493 | region_block_rule_list block_valid_rule maybe_sgml { 493 | region_block_rule_list block_valid_rule maybe_sgml {
494 $$ = $1;
495 if ($2) { 494 if ($2) {
496 if (!$$) 495 if (!$$)
497 $$ = parser->createRuleList(); 496 $$ = parser->createRuleList();
498 $$->append($2); 497 $$->append($2);
499 } 498 }
500 } 499 }
501 ; 500 ;
502 501
503 block_valid_rule: 502 block_valid_rule:
504 ruleset 503 ruleset
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur i maybe_space invalid_block { 559 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur i maybe_space invalid_block {
561 $$ = 0; 560 $$ = 0;
562 } 561 }
563 | before_namespace_rule NAMESPACE_SYM at_rule_recovery { 562 | before_namespace_rule NAMESPACE_SYM at_rule_recovery {
564 $$ = 0; 563 $$ = 0;
565 } 564 }
566 ; 565 ;
567 566
568 maybe_ns_prefix: 567 maybe_ns_prefix:
569 /* empty */ { $$.clear(); } 568 /* empty */ { $$.clear(); }
570 | IDENT maybe_space { $$ = $1; } 569 | IDENT maybe_space
571 ; 570 ;
572 571
573 string_or_uri: 572 string_or_uri:
574 STRING 573 STRING
575 | URI 574 | URI
576 ; 575 ;
577 576
578 maybe_media_value: 577 maybe_media_value:
579 /*empty*/ { 578 /*empty*/ {
580 $$ = 0; 579 $$ = 0;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 654 }
656 | media_list 655 | media_list
657 ; 656 ;
658 657
659 media_list: 658 media_list:
660 media_query { 659 media_query {
661 $$ = parser->createMediaQuerySet(); 660 $$ = parser->createMediaQuerySet();
662 $$->addMediaQuery(parser->sinkFloatingMediaQuery($1)); 661 $$->addMediaQuery(parser->sinkFloatingMediaQuery($1));
663 } 662 }
664 | mq_list media_query { 663 | mq_list media_query {
665 $$ = $1; 664 $$ = 1;
apavlov 2013/06/19 14:02:19 ditto
SeRya 2013/06/19 14:07:01 Done.
666 $$->addMediaQuery(parser->sinkFloatingMediaQuery($2)); 665 $$->addMediaQuery(parser->sinkFloatingMediaQuery($2));
667 } 666 }
668 | mq_list { 667 | mq_list {
669 $$ = $1; 668 $$ = $1;
670 $$->addMediaQuery(parser->sinkFloatingMediaQuery(parser->createFloatingN otAllQuery())); 669 $$->addMediaQuery(parser->sinkFloatingMediaQuery(parser->createFloatingN otAllQuery()));
671 } 670 }
672 ; 671 ;
673 672
674 mq_list: 673 mq_list:
675 media_query ',' maybe_space { 674 media_query ',' maybe_space {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 $$ = 0; 710 $$ = 0;
712 parser->endRuleBody(true); 711 parser->endRuleBody(true);
713 } 712 }
714 | before_media_rule MEDIA_SYM at_rule_recovery { 713 | before_media_rule MEDIA_SYM at_rule_recovery {
715 $$ = 0; 714 $$ = 0;
716 parser->endRuleBody(true); 715 parser->endRuleBody(true);
717 } 716 }
718 ; 717 ;
719 718
720 medium: 719 medium:
721 IDENT maybe_space { 720 IDENT maybe_space
722 $$ = $1;
723 }
724 ; 721 ;
725 722
726 supports: 723 supports:
727 before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports _rule_header_end '{' at_rule_body_start maybe_space block_rule_body closing_brac e { 724 before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports _rule_header_end '{' at_rule_body_start maybe_space block_rule_body closing_brac e {
728 $$ = parser->createSupportsRule($4, $9); 725 $$ = parser->createSupportsRule($4, $9);
729 } 726 }
730 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery at_rule_end { 727 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery at_rule_end {
731 $$ = 0; 728 $$ = 0;
732 parser->reportError($4, CSSParser::InvalidSupportsConditionError); 729 parser->reportError($4, CSSParser::InvalidSupportsConditionError);
733 parser->endRuleBody(true); 730 parser->endRuleBody(true);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 817
821 keyframes: 818 keyframes:
822 before_keyframes_rule WEBKIT_KEYFRAMES_SYM maybe_space keyframe_name at_rule _header_end_maybe_space '{' at_rule_body_start maybe_space keyframes_rule closin g_brace { 819 before_keyframes_rule WEBKIT_KEYFRAMES_SYM maybe_space keyframe_name at_rule _header_end_maybe_space '{' at_rule_body_start maybe_space keyframes_rule closin g_brace {
823 $$ = parser->createKeyframesRule($4, parser->sinkFloatingKeyframeVector( $9)); 820 $$ = parser->createKeyframesRule($4, parser->sinkFloatingKeyframeVector( $9));
824 } 821 }
825 | before_keyframes_rule WEBKIT_KEYFRAMES_SYM at_rule_recovery { 822 | before_keyframes_rule WEBKIT_KEYFRAMES_SYM at_rule_recovery {
826 $$ = 0; 823 $$ = 0;
827 parser->endRuleBody(true); 824 parser->endRuleBody(true);
828 } 825 }
829 ; 826 ;
830 827
831 keyframe_name: 828 keyframe_name:
832 IDENT 829 IDENT
833 | STRING 830 | STRING
834 ; 831 ;
835 832
836 keyframes_rule: 833 keyframes_rule:
837 keyframe_rule_list 834 keyframe_rule_list
838 | keyframe_rule_list keyframes_error_recovery { 835 | keyframe_rule_list keyframes_error_recovery {
839 parser->clearProperties(); 836 parser->clearProperties();
840 }; 837 };
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } 911 }
915 ; 912 ;
916 913
917 page_selector: 914 page_selector:
918 IDENT maybe_space { 915 IDENT maybe_space {
919 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace)); 916 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace));
920 $$->setForPage(); 917 $$->setForPage();
921 } 918 }
922 | IDENT pseudo_page maybe_space { 919 | IDENT pseudo_page maybe_space {
923 $$ = $2; 920 $$ = $2;
924 if ($$) { 921 $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_defaultName space));
925 $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_default Namespace)); 922 $$->setForPage();
926 $$->setForPage();
927 }
928 } 923 }
929 | pseudo_page maybe_space { 924 | pseudo_page maybe_space {
930 $$ = $1; 925 $$ = $1;
931 if ($$) 926 $$->setForPage();
932 $$->setForPage();
933 } 927 }
934 | /* empty */ { 928 | /* empty */ {
935 $$ = parser->createFloatingSelector(); 929 $$ = parser->createFloatingSelector();
936 $$->setForPage(); 930 $$->setForPage();
937 } 931 }
938 ; 932 ;
939 933
940 declarations_and_margins: 934 declarations_and_margins:
941 declaration_list 935 declaration_list
942 | declarations_and_margins margin_box maybe_space declaration_list 936 | declarations_and_margins margin_box maybe_space declaration_list
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 } 1090 }
1097 ; 1091 ;
1098 1092
1099 combinator: 1093 combinator:
1100 '+' maybe_space { $$ = CSSSelector::DirectAdjacent; } 1094 '+' maybe_space { $$ = CSSSelector::DirectAdjacent; }
1101 | '~' maybe_space { $$ = CSSSelector::IndirectAdjacent; } 1095 | '~' maybe_space { $$ = CSSSelector::IndirectAdjacent; }
1102 | '>' maybe_space { $$ = CSSSelector::Child; } 1096 | '>' maybe_space { $$ = CSSSelector::Child; }
1103 ; 1097 ;
1104 1098
1105 maybe_unary_operator: 1099 maybe_unary_operator:
1106 unary_operator { $$ = $1; } 1100 unary_operator
1107 | { $$ = 1; } 1101 | { $$ = 1; }
1108 ; 1102 ;
1109 1103
1110 unary_operator: 1104 unary_operator:
1111 '-' { $$ = -1; } 1105 '-' { $$ = -1; }
1112 | '+' { $$ = 1; } 1106 | '+' { $$ = 1; }
1113 ; 1107 ;
1114 1108
1115 maybe_space_before_declaration: 1109 maybe_space_before_declaration:
1116 maybe_space { 1110 maybe_space {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 while (end->tagHistory()) 1185 while (end->tagHistory())
1192 end = end->tagHistory(); 1186 end = end->tagHistory();
1193 end->setRelation($2); 1187 end->setRelation($2);
1194 end->setTagHistory(parser->sinkFloatingSelector($1)); 1188 end->setTagHistory(parser->sinkFloatingSelector($1));
1195 } 1189 }
1196 ; 1190 ;
1197 1191
1198 namespace_selector: 1192 namespace_selector:
1199 /* empty */ '|' { $$.clear(); } 1193 /* empty */ '|' { $$.clear(); }
1200 | '*' '|' { static LChar star = '*'; $$.init(&star, 1); } 1194 | '*' '|' { static LChar star = '*'; $$.init(&star, 1); }
1201 | IDENT '|' { $$ = $1; } 1195 | IDENT '|'
1202 ; 1196 ;
1203 1197
1204 simple_selector: 1198 simple_selector:
1205 element_name { 1199 element_name {
1206 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace)); 1200 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace));
1207 } 1201 }
1208 | element_name specifier_list { 1202 | element_name specifier_list {
1209 $$ = parser->rewriteSpecifiersWithElementName(nullAtom, $1, $2); 1203 $$ = parser->rewriteSpecifiersWithElementName(nullAtom, $1, $2);
1210 if (!$$) 1204 if (!$$)
1211 YYERROR; 1205 YYERROR;
1212 } 1206 }
1213 | specifier_list { 1207 | specifier_list {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 parser->tokenToLowerCase($1); 1243 parser->tokenToLowerCase($1);
1250 $$ = $1; 1244 $$ = $1;
1251 } 1245 }
1252 | '*' { 1246 | '*' {
1253 static LChar star = '*'; 1247 static LChar star = '*';
1254 $$.init(&star, 1); 1248 $$.init(&star, 1);
1255 } 1249 }
1256 ; 1250 ;
1257 1251
1258 specifier_list: 1252 specifier_list:
1259 specifier { 1253 specifier
1260 $$ = $1;
1261 }
1262 | specifier_list specifier { 1254 | specifier_list specifier {
1263 $$ = parser->rewriteSpecifiers($1, $2); 1255 $$ = parser->rewriteSpecifiers($1, $2);
1264 } 1256 }
1265 ; 1257 ;
1266 1258
1267 specifier: 1259 specifier:
1268 IDSEL { 1260 IDSEL {
1269 $$ = parser->createFloatingSelector(); 1261 $$ = parser->createFloatingSelector();
1270 $$->setMatch(CSSSelector::Id); 1262 $$->setMatch(CSSSelector::Id);
1271 if (parser->m_context.mode == CSSQuirksMode) 1263 if (parser->m_context.mode == CSSQuirksMode)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 | ':' NOTFUNCTION selector_recovery closing_parenthesis { 1484 | ':' NOTFUNCTION selector_recovery closing_parenthesis {
1493 YYERROR; 1485 YYERROR;
1494 } 1486 }
1495 ; 1487 ;
1496 1488
1497 selector_recovery: 1489 selector_recovery:
1498 error error_location error_recovery; 1490 error error_location error_recovery;
1499 1491
1500 declaration_list: 1492 declaration_list:
1501 /* empty */ { $$ = false; } 1493 /* empty */ { $$ = false; }
1502 | declaration { 1494 | declaration
1503 $$ = $1; 1495 | decl_list declaration {
1496 $$ = $1 || $2;
1504 } 1497 }
1505 | decl_list declaration { 1498 | decl_list
1506 $$ = $1;
1507 if ( $2 )
1508 $$ = $2;
1509 }
1510 | decl_list {
1511 $$ = $1;
1512 }
1513 ; 1499 ;
1514 1500
1515 decl_list: 1501 decl_list:
1516 declaration ';' maybe_space { 1502 declaration ';' maybe_space {
1517 parser->startProperty(); 1503 parser->startProperty();
1518 $$ = $1; 1504 $$ = $1;
1519 } 1505 }
1520 | decl_list declaration ';' maybe_space { 1506 | decl_list declaration ';' maybe_space {
1521 parser->startProperty(); 1507 parser->startProperty();
1522 $$ = $1; 1508 $$ = $1 || $2;
1523 if ($2)
1524 $$ = $2;
1525 } 1509 }
1526 ; 1510 ;
1527 1511
1528 declaration: 1512 declaration:
1529 VAR_DEFINITION maybe_space ':' maybe_space expr prio { 1513 VAR_DEFINITION maybe_space ':' maybe_space expr prio {
1530 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5), $6); 1514 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5), $6);
1531 $$ = true; 1515 $$ = true;
1532 parser->endProperty($6, true); 1516 parser->endProperty($6, true);
1533 } 1517 }
1534 | 1518 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 | /* empty */ { $$ = false; } 1572 | /* empty */ { $$ = false; }
1589 ; 1573 ;
1590 1574
1591 expr: 1575 expr:
1592 term { 1576 term {
1593 $$ = parser->createFloatingValueList(); 1577 $$ = parser->createFloatingValueList();
1594 $$->addValue(parser->sinkFloatingValue($1)); 1578 $$->addValue(parser->sinkFloatingValue($1));
1595 } 1579 }
1596 | expr operator term { 1580 | expr operator term {
1597 $$ = $1; 1581 $$ = $1;
1598 if ($2) 1582 $$->addValue(makeOperatorValue($2));
1599 $$->addValue(makeOperatorValue($2));
1600 $$->addValue(parser->sinkFloatingValue($3)); 1583 $$->addValue(parser->sinkFloatingValue($3));
1601 } 1584 }
1585 | expr term {
1586 $$ = $1;
1587 $$->addValue(parser->sinkFloatingValue($2));
1588 }
1602 ; 1589 ;
1603 1590
1604 expr_recovery: 1591 expr_recovery:
1605 error error_location error_recovery { 1592 error error_location error_recovery {
1606 parser->reportError($2, CSSParser::PropertyDeclarationError); 1593 parser->reportError($2, CSSParser::PropertyDeclarationError);
1607 } 1594 }
1608 ; 1595 ;
1609 1596
1610 operator: 1597 operator:
1611 '/' maybe_space { 1598 '/' maybe_space {
1612 $$ = '/'; 1599 $$ = '/';
1613 } 1600 }
1614 | ',' maybe_space { 1601 | ',' maybe_space {
1615 $$ = ','; 1602 $$ = ',';
1616 } 1603 }
1617 | /* empty */ {
1618 $$ = 0;
1619 }
1620 ; 1604 ;
1621 1605
1622 term: 1606 term:
1623 unary_term maybe_space { $$ = $1; } 1607 unary_term maybe_space
1624 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } 1608 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; }
1625 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; } 1609 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; }
1626 | IDENT maybe_space { 1610 | IDENT maybe_space {
1627 $$.id = cssValueKeywordID($1); 1611 $$.id = cssValueKeywordID($1);
1628 $$.unit = CSSPrimitiveValue::CSS_IDENT; 1612 $$.unit = CSSPrimitiveValue::CSS_IDENT;
1629 $$.string = $1; 1613 $$.string = $1;
1630 } 1614 }
1631 /* We might need to actually parse the number from a dimension, but we can't j ust put something that uses $$.string into unary_term. */ 1615 /* We might need to actually parse the number from a dimension, but we can't j ust put something that uses $$.string into unary_term. */
1632 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; } 1616 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; }
1633 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } 1617 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; }
1634 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; } 1618 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; }
1635 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } 1619 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
1636 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; } 1620 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; }
1637 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ 1621 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
1638 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { 1622 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
1639 $$.id = CSSValueInvalid; 1623 $$.id = CSSValueInvalid;
1640 $$.string = $3; 1624 $$.string = $3;
1641 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1625 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1642 } 1626 }
1643 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */ 1627 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */
1644 | function maybe_space { 1628 | function maybe_space
1645 $$ = $1; 1629 | calc_function maybe_space
1646 } 1630 | min_or_max_function maybe_space
1647 | calc_function maybe_space {
1648 $$ = $1;
1649 }
1650 | min_or_max_function maybe_space {
1651 $$ = $1;
1652 }
1653 | '%' maybe_space { /* Handle width: %; */ 1631 | '%' maybe_space { /* Handle width: %; */
1654 $$.id = CSSValueInvalid; $$.unit = 0; 1632 $$.id = CSSValueInvalid; $$.unit = 0;
1655 } 1633 }
1656 ; 1634 ;
1657 1635
1658 unary_term: 1636 unary_term:
1659 INTEGER { $$.setFromNumber($1); $$.isInt = true; } 1637 INTEGER { $$.setFromNumber($1); $$.isInt = true; }
1660 | FLOATTOKEN { $$.setFromNumber($1); } 1638 | FLOATTOKEN { $$.setFromNumber($1); }
1661 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } 1639 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); }
1662 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } 1640 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 } | 1676 } |
1699 FUNCTION maybe_space closing_parenthesis { 1677 FUNCTION maybe_space closing_parenthesis {
1700 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList(parser->createFloatingValueList()))); 1678 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList(parser->createFloatingValueList())));
1701 } | 1679 } |
1702 FUNCTION maybe_space expr_recovery closing_parenthesis { 1680 FUNCTION maybe_space expr_recovery closing_parenthesis {
1703 YYERROR; 1681 YYERROR;
1704 } 1682 }
1705 ; 1683 ;
1706 1684
1707 calc_func_term: 1685 calc_func_term:
1708 unary_term { $$ = $1; } 1686 unary_term
1709 | VARFUNCTION maybe_space IDENT closing_parenthesis { 1687 | VARFUNCTION maybe_space IDENT closing_parenthesis {
1710 $$.id = CSSValueInvalid; 1688 $$.id = CSSValueInvalid;
1711 $$.string = $3; 1689 $$.string = $3;
1712 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1690 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1713 } 1691 }
1714 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } 1692 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; }
1715 ; 1693 ;
1716 1694
1717 calc_func_operator: 1695 calc_func_operator:
1718 WHITESPACE '+' WHITESPACE { 1696 WHITESPACE '+' WHITESPACE {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 } 1735 }
1758 | calc_func_expr calc_func_operator calc_func_paren_expr { 1736 | calc_func_expr calc_func_operator calc_func_paren_expr {
1759 $$ = $1; 1737 $$ = $1;
1760 $$->addValue(makeOperatorValue($2)); 1738 $$->addValue(makeOperatorValue($2));
1761 $$->extend(*($3)); 1739 $$->extend(*($3));
1762 } 1740 }
1763 | calc_func_paren_expr 1741 | calc_func_paren_expr
1764 ; 1742 ;
1765 1743
1766 calc_func_expr_list: 1744 calc_func_expr_list:
1767 calc_func_expr calc_maybe_space { 1745 calc_func_expr calc_maybe_space
1768 $$ = $1;
1769 }
1770 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space { 1746 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
1771 $$ = $1; 1747 $$ = $1;
1772 $$->addValue(makeOperatorValue(',')); 1748 $$->addValue(makeOperatorValue(','));
1773 $$->extend(*($4)); 1749 $$->extend(*($4));
1774 } 1750 }
1775 ; 1751 ;
1776 1752
1777 calc_function: 1753 calc_function:
1778 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis { 1754 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
1779 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3))); 1755 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3)));
1780 } 1756 }
1781 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis { 1757 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
1782 YYERROR; 1758 YYERROR;
1783 } 1759 }
1784 ; 1760 ;
1785 1761
1786 1762
1787 min_or_max: 1763 min_or_max:
1788 MINFUNCTION { 1764 MINFUNCTION
1789 $$ = $1; 1765 | MAXFUNCTION
1790 }
1791 | MAXFUNCTION {
1792 $$ = $1;
1793 }
1794 ; 1766 ;
1795 1767
1796 min_or_max_function: 1768 min_or_max_function:
1797 min_or_max maybe_space calc_func_expr_list closing_parenthesis { 1769 min_or_max maybe_space calc_func_expr_list closing_parenthesis {
1798 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3))); 1770 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3)));
1799 } 1771 }
1800 | min_or_max maybe_space expr_recovery closing_parenthesis { 1772 | min_or_max maybe_space expr_recovery closing_parenthesis {
1801 YYERROR; 1773 YYERROR;
1802 } 1774 }
1803 ; 1775 ;
1804 1776
1805 invalid_at: 1777 invalid_at:
1806 ATKEYWORD 1778 ATKEYWORD
1807 | margin_sym 1779 | margin_sym
1808 ; 1780 ;
1809 1781
1810 at_rule_recovery: 1782 at_rule_recovery:
1811 at_rule_header_recovery at_invalid_rule_header_end at_rule_end 1783 at_rule_header_recovery at_invalid_rule_header_end at_rule_end
1812 ; 1784 ;
1813 1785
1814 at_rule_header_recovery: 1786 at_rule_header_recovery:
1815 error error_location rule_error_recovery { 1787 error error_location rule_error_recovery {
1816 parser->reportError($2, CSSParser::InvalidRuleError); 1788 parser->reportError($2, CSSParser::InvalidRuleError);
1817 } 1789 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 1844
1873 rule_error_recovery: 1845 rule_error_recovery:
1874 /* empty */ 1846 /* empty */
1875 | rule_error_recovery error 1847 | rule_error_recovery error
1876 | rule_error_recovery invalid_square_brackets_block 1848 | rule_error_recovery invalid_square_brackets_block
1877 | rule_error_recovery invalid_parentheses_block 1849 | rule_error_recovery invalid_parentheses_block
1878 ; 1850 ;
1879 1851
1880 %% 1852 %%
1881 1853
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698