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

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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 %type <rule> namespace 228 %type <rule> namespace
229 %type <rule> page 229 %type <rule> page
230 %type <rule> margin_box 230 %type <rule> margin_box
231 %type <rule> font_face 231 %type <rule> font_face
232 %type <rule> host 232 %type <rule> host
233 %type <rule> keyframes 233 %type <rule> keyframes
234 %type <rule> invalid_rule 234 %type <rule> invalid_rule
235 %type <rule> rule 235 %type <rule> rule
236 %type <rule> valid_rule 236 %type <rule> valid_rule
237 %type <ruleList> block_rule_body 237 %type <ruleList> block_rule_body
238 %type <ruleList> block_rule_list 238 %type <ruleList> block_rule_list
239 %type <ruleList> region_block_rule_body 239 %type <ruleList> region_block_rule_body
240 %type <ruleList> region_block_rule_list 240 %type <ruleList> region_block_rule_list
241 %type <rule> block_rule 241 %type <rule> block_rule
242 %type <rule> block_valid_rule 242 %type <rule> block_valid_rule
243 %type <rule> region 243 %type <rule> region
244 %type <rule> supports 244 %type <rule> supports
245 %type <rule> viewport 245 %type <rule> viewport
246 %type <rule> filter 246 %type <rule> filter
247 247
248 %type <string> maybe_ns_prefix 248 %type <string> maybe_ns_prefix
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 parser->m_hadSyntacticallyValidCSSRule = true; 461 parser->m_hadSyntacticallyValidCSSRule = true;
462 } 462 }
463 | invalid_rule 463 | invalid_rule
464 ; 464 ;
465 465
466 block_rule_body: 466 block_rule_body:
467 block_rule_list 467 block_rule_list
468 | block_rule_list error error_location rule_error_recovery { 468 | block_rule_list error error_location rule_error_recovery {
469 parser->reportError($3, CSSParser::InvalidRuleError); 469 parser->reportError($3, CSSParser::InvalidRuleError);
470 } 470 }
471 ; 471 ;
472 472
473 block_rule_list: 473 block_rule_list:
474 /* empty */ { $$ = 0; } 474 /* empty */ { $$ = 0; }
475 | block_rule_list block_rule maybe_sgml { 475 | block_rule_list block_rule maybe_sgml {
476 $$ = $1; 476 $$ = $1;
477 if ($2) { 477 if ($2) {
478 if (!$$) 478 if (!$$)
479 $$ = parser->createRuleList(); 479 $$ = parser->createRuleList();
480 $$->append($2); 480 $$->append($2);
481 } 481 }
482 } 482 }
483 ; 483 ;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur i maybe_space invalid_block { 561 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur i maybe_space invalid_block {
562 $$ = 0; 562 $$ = 0;
563 } 563 }
564 | before_namespace_rule NAMESPACE_SYM at_rule_recovery { 564 | before_namespace_rule NAMESPACE_SYM at_rule_recovery {
565 $$ = 0; 565 $$ = 0;
566 } 566 }
567 ; 567 ;
568 568
569 maybe_ns_prefix: 569 maybe_ns_prefix:
570 /* empty */ { $$.clear(); } 570 /* empty */ { $$.clear(); }
571 | IDENT maybe_space { $$ = $1; } 571 | IDENT maybe_space
572 ; 572 ;
573 573
574 string_or_uri: 574 string_or_uri:
575 STRING 575 STRING
576 | URI 576 | URI
577 ; 577 ;
578 578
579 maybe_media_value: 579 maybe_media_value:
580 /*empty*/ { 580 /*empty*/ {
581 $$ = 0; 581 $$ = 0;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 $$ = 0; 712 $$ = 0;
713 parser->endRuleBody(true); 713 parser->endRuleBody(true);
714 } 714 }
715 | before_media_rule MEDIA_SYM at_rule_recovery { 715 | before_media_rule MEDIA_SYM at_rule_recovery {
716 $$ = 0; 716 $$ = 0;
717 parser->endRuleBody(true); 717 parser->endRuleBody(true);
718 } 718 }
719 ; 719 ;
720 720
721 medium: 721 medium:
722 IDENT maybe_space { 722 IDENT maybe_space
723 $$ = $1;
724 }
725 ; 723 ;
726 724
727 supports: 725 supports:
728 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 { 726 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 {
729 $$ = parser->createSupportsRule($4, $9); 727 $$ = parser->createSupportsRule($4, $9);
730 } 728 }
731 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery at_rule_end { 729 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery at_rule_end {
732 $$ = 0; 730 $$ = 0;
733 parser->reportError($4, CSSParser::InvalidSupportsConditionError); 731 parser->reportError($4, CSSParser::InvalidSupportsConditionError);
734 parser->endRuleBody(true); 732 parser->endRuleBody(true);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 819
822 keyframes: 820 keyframes:
823 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 { 821 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 {
824 $$ = parser->createKeyframesRule($4, parser->sinkFloatingKeyframeVector( $9)); 822 $$ = parser->createKeyframesRule($4, parser->sinkFloatingKeyframeVector( $9));
825 } 823 }
826 | before_keyframes_rule WEBKIT_KEYFRAMES_SYM at_rule_recovery { 824 | before_keyframes_rule WEBKIT_KEYFRAMES_SYM at_rule_recovery {
827 $$ = 0; 825 $$ = 0;
828 parser->endRuleBody(true); 826 parser->endRuleBody(true);
829 } 827 }
830 ; 828 ;
831 829
832 keyframe_name: 830 keyframe_name:
833 IDENT 831 IDENT
834 | STRING 832 | STRING
835 ; 833 ;
836 834
837 keyframes_rule: 835 keyframes_rule:
838 keyframe_rule_list 836 keyframe_rule_list
839 | keyframe_rule_list keyframes_error_recovery { 837 | keyframe_rule_list keyframes_error_recovery {
840 parser->clearProperties(); 838 parser->clearProperties();
841 }; 839 };
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } 913 }
916 ; 914 ;
917 915
918 page_selector: 916 page_selector:
919 IDENT maybe_space { 917 IDENT maybe_space {
920 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace)); 918 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace));
921 $$->setForPage(); 919 $$->setForPage();
922 } 920 }
923 | IDENT pseudo_page maybe_space { 921 | IDENT pseudo_page maybe_space {
924 $$ = $2; 922 $$ = $2;
925 if ($$) { 923 $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_defaultName space));
926 $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_default Namespace)); 924 $$->setForPage();
927 $$->setForPage();
928 }
929 } 925 }
930 | pseudo_page maybe_space { 926 | pseudo_page maybe_space {
931 $$ = $1; 927 $$ = $1;
932 if ($$) 928 $$->setForPage();
933 $$->setForPage();
934 } 929 }
935 | /* empty */ { 930 | /* empty */ {
936 $$ = parser->createFloatingSelector(); 931 $$ = parser->createFloatingSelector();
937 $$->setForPage(); 932 $$->setForPage();
938 } 933 }
939 ; 934 ;
940 935
941 declarations_and_margins: 936 declarations_and_margins:
942 declaration_list 937 declaration_list
943 | declarations_and_margins margin_box maybe_space declaration_list 938 | declarations_and_margins margin_box maybe_space declaration_list
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 } 1092 }
1098 ; 1093 ;
1099 1094
1100 combinator: 1095 combinator:
1101 '+' maybe_space { $$ = CSSSelector::DirectAdjacent; } 1096 '+' maybe_space { $$ = CSSSelector::DirectAdjacent; }
1102 | '~' maybe_space { $$ = CSSSelector::IndirectAdjacent; } 1097 | '~' maybe_space { $$ = CSSSelector::IndirectAdjacent; }
1103 | '>' maybe_space { $$ = CSSSelector::Child; } 1098 | '>' maybe_space { $$ = CSSSelector::Child; }
1104 ; 1099 ;
1105 1100
1106 maybe_unary_operator: 1101 maybe_unary_operator:
1107 unary_operator { $$ = $1; } 1102 unary_operator
1108 | { $$ = 1; } 1103 | /* empty */ { $$ = 1; }
1109 ; 1104 ;
1110 1105
1111 unary_operator: 1106 unary_operator:
1112 '-' { $$ = -1; } 1107 '-' { $$ = -1; }
1113 | '+' { $$ = 1; } 1108 | '+' { $$ = 1; }
1114 ; 1109 ;
1115 1110
1116 maybe_space_before_declaration: 1111 maybe_space_before_declaration:
1117 maybe_space { 1112 maybe_space {
1118 parser->startProperty(); 1113 parser->startProperty();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 while (end->tagHistory()) 1187 while (end->tagHistory())
1193 end = end->tagHistory(); 1188 end = end->tagHistory();
1194 end->setRelation($2); 1189 end->setRelation($2);
1195 end->setTagHistory(parser->sinkFloatingSelector($1)); 1190 end->setTagHistory(parser->sinkFloatingSelector($1));
1196 } 1191 }
1197 ; 1192 ;
1198 1193
1199 namespace_selector: 1194 namespace_selector:
1200 /* empty */ '|' { $$.clear(); } 1195 /* empty */ '|' { $$.clear(); }
1201 | '*' '|' { static LChar star = '*'; $$.init(&star, 1); } 1196 | '*' '|' { static LChar star = '*'; $$.init(&star, 1); }
1202 | IDENT '|' { $$ = $1; } 1197 | IDENT '|'
1203 ; 1198 ;
1204 1199
1205 simple_selector: 1200 simple_selector:
1206 element_name { 1201 element_name {
1207 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace)); 1202 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $ 1, parser->m_defaultNamespace));
1208 } 1203 }
1209 | element_name specifier_list { 1204 | element_name specifier_list {
1210 $$ = parser->rewriteSpecifiersWithElementName(nullAtom, $1, $2); 1205 $$ = parser->rewriteSpecifiersWithElementName(nullAtom, $1, $2);
1211 if (!$$) 1206 if (!$$)
1212 YYERROR; 1207 YYERROR;
1213 } 1208 }
1214 | specifier_list { 1209 | specifier_list {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 parser->tokenToLowerCase($1); 1245 parser->tokenToLowerCase($1);
1251 $$ = $1; 1246 $$ = $1;
1252 } 1247 }
1253 | '*' { 1248 | '*' {
1254 static LChar star = '*'; 1249 static LChar star = '*';
1255 $$.init(&star, 1); 1250 $$.init(&star, 1);
1256 } 1251 }
1257 ; 1252 ;
1258 1253
1259 specifier_list: 1254 specifier_list:
1260 specifier { 1255 specifier
1261 $$ = $1;
1262 }
1263 | specifier_list specifier { 1256 | specifier_list specifier {
1264 $$ = parser->rewriteSpecifiers($1, $2); 1257 $$ = parser->rewriteSpecifiers($1, $2);
1265 } 1258 }
1266 ; 1259 ;
1267 1260
1268 specifier: 1261 specifier:
1269 IDSEL { 1262 IDSEL {
1270 $$ = parser->createFloatingSelector(); 1263 $$ = parser->createFloatingSelector();
1271 $$->setMatch(CSSSelector::Id); 1264 $$->setMatch(CSSSelector::Id);
1272 if (parser->m_context.mode == CSSQuirksMode) 1265 if (parser->m_context.mode == CSSQuirksMode)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 | ':' NOTFUNCTION selector_recovery closing_parenthesis { 1486 | ':' NOTFUNCTION selector_recovery closing_parenthesis {
1494 YYERROR; 1487 YYERROR;
1495 } 1488 }
1496 ; 1489 ;
1497 1490
1498 selector_recovery: 1491 selector_recovery:
1499 error error_location error_recovery; 1492 error error_location error_recovery;
1500 1493
1501 declaration_list: 1494 declaration_list:
1502 /* empty */ { $$ = false; } 1495 /* empty */ { $$ = false; }
1503 | declaration { 1496 | declaration
1504 $$ = $1; 1497 | decl_list declaration {
1498 $$ = $1 || $2;
1505 } 1499 }
1506 | decl_list declaration { 1500 | decl_list
1507 $$ = $1;
1508 if ( $2 )
1509 $$ = $2;
1510 }
1511 | decl_list {
1512 $$ = $1;
1513 }
1514 ; 1501 ;
1515 1502
1516 decl_list: 1503 decl_list:
1517 declaration ';' maybe_space { 1504 declaration ';' maybe_space {
1518 parser->startProperty(); 1505 parser->startProperty();
1519 $$ = $1; 1506 $$ = $1;
1520 } 1507 }
1521 | decl_list declaration ';' maybe_space { 1508 | decl_list declaration ';' maybe_space {
1522 parser->startProperty(); 1509 parser->startProperty();
1523 $$ = $1; 1510 $$ = $1 || $2;
1524 if ($2)
1525 $$ = $2;
1526 } 1511 }
1527 ; 1512 ;
1528 1513
1529 declaration: 1514 declaration:
1530 VAR_DEFINITION maybe_space ':' maybe_space expr prio { 1515 VAR_DEFINITION maybe_space ':' maybe_space expr prio {
1531 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5), $6); 1516 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5), $6);
1532 $$ = true; 1517 $$ = true;
1533 parser->endProperty($6, true); 1518 parser->endProperty($6, true);
1534 } 1519 }
1535 | 1520 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 | /* empty */ { $$ = false; } 1574 | /* empty */ { $$ = false; }
1590 ; 1575 ;
1591 1576
1592 expr: 1577 expr:
1593 term { 1578 term {
1594 $$ = parser->createFloatingValueList(); 1579 $$ = parser->createFloatingValueList();
1595 $$->addValue(parser->sinkFloatingValue($1)); 1580 $$->addValue(parser->sinkFloatingValue($1));
1596 } 1581 }
1597 | expr operator term { 1582 | expr operator term {
1598 $$ = $1; 1583 $$ = $1;
1599 if ($2) 1584 $$->addValue(makeOperatorValue($2));
1600 $$->addValue(makeOperatorValue($2));
1601 $$->addValue(parser->sinkFloatingValue($3)); 1585 $$->addValue(parser->sinkFloatingValue($3));
1602 } 1586 }
1587 | expr term {
1588 $$ = $1;
1589 $$->addValue(parser->sinkFloatingValue($2));
1590 }
1603 ; 1591 ;
1604 1592
1605 expr_recovery: 1593 expr_recovery:
1606 error error_location error_recovery { 1594 error error_location error_recovery {
1607 parser->reportError($2, CSSParser::PropertyDeclarationError); 1595 parser->reportError($2, CSSParser::PropertyDeclarationError);
1608 } 1596 }
1609 ; 1597 ;
1610 1598
1611 operator: 1599 operator:
1612 '/' maybe_space { 1600 '/' maybe_space {
1613 $$ = '/'; 1601 $$ = '/';
1614 } 1602 }
1615 | ',' maybe_space { 1603 | ',' maybe_space {
1616 $$ = ','; 1604 $$ = ',';
1617 } 1605 }
1618 | /* empty */ {
1619 $$ = 0;
1620 }
1621 ; 1606 ;
1622 1607
1623 term: 1608 term:
1624 unary_term maybe_space { $$ = $1; } 1609 unary_term maybe_space
1625 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } 1610 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; }
1626 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; } 1611 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; }
1627 | IDENT maybe_space { 1612 | IDENT maybe_space {
1628 $$.id = cssValueKeywordID($1); 1613 $$.id = cssValueKeywordID($1);
1629 $$.unit = CSSPrimitiveValue::CSS_IDENT; 1614 $$.unit = CSSPrimitiveValue::CSS_IDENT;
1630 $$.string = $1; 1615 $$.string = $1;
1631 } 1616 }
1632 /* 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. */ 1617 /* 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. */
1633 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; } 1618 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; }
1634 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } 1619 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; }
1635 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; } 1620 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; }
1636 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } 1621 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
1637 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; } 1622 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; }
1638 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ 1623 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
1639 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { 1624 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
1640 $$.id = CSSValueInvalid; 1625 $$.id = CSSValueInvalid;
1641 $$.string = $3; 1626 $$.string = $3;
1642 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1627 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1643 } 1628 }
1644 | VARFUNCTION maybe_space expr_recovery closing_parenthesis { 1629 | VARFUNCTION maybe_space expr_recovery closing_parenthesis {
1645 YYERROR; 1630 YYERROR;
1646 } 1631 }
1647 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */ 1632 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */
1648 | function maybe_space { 1633 | function maybe_space
1649 $$ = $1; 1634 | calc_function maybe_space
1650 } 1635 | min_or_max_function maybe_space
1651 | calc_function maybe_space {
1652 $$ = $1;
1653 }
1654 | min_or_max_function maybe_space {
1655 $$ = $1;
1656 }
1657 | '%' maybe_space { /* Handle width: %; */ 1636 | '%' maybe_space { /* Handle width: %; */
1658 $$.id = CSSValueInvalid; $$.unit = 0; 1637 $$.id = CSSValueInvalid; $$.unit = 0;
1659 } 1638 }
1660 ; 1639 ;
1661 1640
1662 unary_term: 1641 unary_term:
1663 INTEGER { $$.setFromNumber($1); $$.isInt = true; } 1642 INTEGER { $$.setFromNumber($1); $$.isInt = true; }
1664 | FLOATTOKEN { $$.setFromNumber($1); } 1643 | FLOATTOKEN { $$.setFromNumber($1); }
1665 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } 1644 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); }
1666 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } 1645 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 } | 1681 } |
1703 FUNCTION maybe_space closing_parenthesis { 1682 FUNCTION maybe_space closing_parenthesis {
1704 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList(parser->createFloatingValueList()))); 1683 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList(parser->createFloatingValueList())));
1705 } | 1684 } |
1706 FUNCTION maybe_space expr_recovery closing_parenthesis { 1685 FUNCTION maybe_space expr_recovery closing_parenthesis {
1707 YYERROR; 1686 YYERROR;
1708 } 1687 }
1709 ; 1688 ;
1710 1689
1711 calc_func_term: 1690 calc_func_term:
1712 unary_term { $$ = $1; } 1691 unary_term
1713 | VARFUNCTION maybe_space IDENT closing_parenthesis { 1692 | VARFUNCTION maybe_space IDENT closing_parenthesis {
1714 $$.id = CSSValueInvalid; 1693 $$.id = CSSValueInvalid;
1715 $$.string = $3; 1694 $$.string = $3;
1716 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1695 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1717 } 1696 }
1718 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } 1697 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; }
1719 ; 1698 ;
1720 1699
1721 calc_func_operator: 1700 calc_func_operator:
1722 WHITESPACE '+' WHITESPACE { 1701 WHITESPACE '+' WHITESPACE {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1740 }
1762 | calc_func_expr calc_func_operator calc_func_paren_expr { 1741 | calc_func_expr calc_func_operator calc_func_paren_expr {
1763 $$ = $1; 1742 $$ = $1;
1764 $$->addValue(makeOperatorValue($2)); 1743 $$->addValue(makeOperatorValue($2));
1765 $$->extend(*($3)); 1744 $$->extend(*($3));
1766 } 1745 }
1767 | calc_func_paren_expr 1746 | calc_func_paren_expr
1768 ; 1747 ;
1769 1748
1770 calc_func_expr_list: 1749 calc_func_expr_list:
1771 calc_func_expr calc_maybe_space { 1750 calc_func_expr calc_maybe_space
1772 $$ = $1;
1773 }
1774 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space { 1751 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
1775 $$ = $1; 1752 $$ = $1;
1776 $$->addValue(makeOperatorValue(',')); 1753 $$->addValue(makeOperatorValue(','));
1777 $$->extend(*($4)); 1754 $$->extend(*($4));
1778 } 1755 }
1779 ; 1756 ;
1780 1757
1781 calc_function: 1758 calc_function:
1782 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis { 1759 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
1783 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3))); 1760 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3)));
1784 } 1761 }
1785 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis { 1762 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
1786 YYERROR; 1763 YYERROR;
1787 } 1764 }
1788 ; 1765 ;
1789 1766
1790 1767
1791 min_or_max: 1768 min_or_max:
1792 MINFUNCTION { 1769 MINFUNCTION
1793 $$ = $1; 1770 | MAXFUNCTION
1794 }
1795 | MAXFUNCTION {
1796 $$ = $1;
1797 }
1798 ; 1771 ;
1799 1772
1800 min_or_max_function: 1773 min_or_max_function:
1801 min_or_max maybe_space calc_func_expr_list closing_parenthesis { 1774 min_or_max maybe_space calc_func_expr_list closing_parenthesis {
1802 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3))); 1775 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati ngValueList($3)));
1803 } 1776 }
1804 | min_or_max maybe_space expr_recovery closing_parenthesis { 1777 | min_or_max maybe_space expr_recovery closing_parenthesis {
1805 YYERROR; 1778 YYERROR;
1806 } 1779 }
1807 ; 1780 ;
1808 1781
1809 invalid_at: 1782 invalid_at:
1810 ATKEYWORD 1783 ATKEYWORD
1811 | margin_sym 1784 | margin_sym
1812 ; 1785 ;
1813 1786
1814 at_rule_recovery: 1787 at_rule_recovery:
1815 at_rule_header_recovery at_invalid_rule_header_end at_rule_end 1788 at_rule_header_recovery at_invalid_rule_header_end at_rule_end
1816 ; 1789 ;
1817 1790
1818 at_rule_header_recovery: 1791 at_rule_header_recovery:
1819 error error_location rule_error_recovery { 1792 error error_location rule_error_recovery {
1820 parser->reportError($2, CSSParser::InvalidRuleError); 1793 parser->reportError($2, CSSParser::InvalidRuleError);
1821 } 1794 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 1849
1877 rule_error_recovery: 1850 rule_error_recovery:
1878 /* empty */ 1851 /* empty */
1879 | rule_error_recovery error 1852 | rule_error_recovery error
1880 | rule_error_recovery invalid_square_brackets_block 1853 | rule_error_recovery invalid_square_brackets_block
1881 | rule_error_recovery invalid_parentheses_block 1854 | rule_error_recovery invalid_parentheses_block
1882 ; 1855 ;
1883 1856
1884 %% 1857 %%
1885 1858
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