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

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

Issue 23528004: [CSS Grid Layout] Update named grid lines syntax to the last version of the specs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@named
Patch Set: Patch for landing v2 Created 7 years, 1 month 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
OLDNEW
1 %{ 1 %{
2 2
3 /* 3 /*
4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2012 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 inline static CSSParserValue makeOperatorValue(int value) 131 inline static CSSParserValue makeOperatorValue(int value)
132 { 132 {
133 CSSParserValue v; 133 CSSParserValue v;
134 v.id = CSSValueInvalid; 134 v.id = CSSValueInvalid;
135 v.unit = CSSParserValue::Operator; 135 v.unit = CSSParserValue::Operator;
136 v.iValue = value; 136 v.iValue = value;
137 return v; 137 return v;
138 } 138 }
139 139
140 inline static CSSParserValue makeIdentValue(CSSParserString string)
141 {
142 CSSParserValue v;
143 v.id = cssValueKeywordID(string);
144 v.unit = CSSPrimitiveValue::CSS_IDENT;
145 v.string = string;
146 return v;
147 }
148
140 %} 149 %}
141 150
142 %expect 0 151 %expect 0
143 152
144 %nonassoc LOWEST_PREC 153 %nonassoc LOWEST_PREC
145 154
146 %left UNIMPORTANT_TOK 155 %left UNIMPORTANT_TOK
147 156
148 %token WHITESPACE SGML_CD 157 %token WHITESPACE SGML_CD
149 %token TOKEN_EOF 0 158 %token TOKEN_EOF 0
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 %type <valueList> calc_func_paren_expr 374 %type <valueList> calc_func_paren_expr
366 %type <value> calc_function 375 %type <value> calc_function
367 %type <string> min_or_max 376 %type <string> min_or_max
368 %type <value> min_or_max_function 377 %type <value> min_or_max_function
369 378
370 %type <string> element_name 379 %type <string> element_name
371 %type <string> attr_name 380 %type <string> attr_name
372 381
373 %type <location> error_location 382 %type <location> error_location
374 383
384 %type <valueList> ident_list
385 %type <value> track_names_list
386
375 %% 387 %%
376 388
377 stylesheet: 389 stylesheet:
378 maybe_charset maybe_sgml rule_list 390 maybe_charset maybe_sgml rule_list
379 | internal_decls 391 | internal_decls
380 | internal_rule 392 | internal_rule
381 | internal_selector 393 | internal_selector
382 | internal_value 394 | internal_value
383 | internal_medialist 395 | internal_medialist
384 | internal_keyframe_rule 396 | internal_keyframe_rule
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 if ($$ == CSSPropertyInvalid) 1710 if ($$ == CSSPropertyInvalid)
1699 parser->reportError($1, CSSParser::InvalidPropertyError); 1711 parser->reportError($1, CSSParser::InvalidPropertyError);
1700 } 1712 }
1701 ; 1713 ;
1702 1714
1703 prio: 1715 prio:
1704 IMPORTANT_SYM maybe_space { $$ = true; } 1716 IMPORTANT_SYM maybe_space { $$ = true; }
1705 | /* empty */ { $$ = false; } 1717 | /* empty */ { $$ = false; }
1706 ; 1718 ;
1707 1719
1720 ident_list:
1721 IDENT maybe_space {
1722 $$ = parser->createFloatingValueList();
1723 $$->addValue(makeIdentValue($1));
1724 }
1725 | ident_list IDENT maybe_space {
1726 $$ = $1;
1727 $$->addValue(makeIdentValue($2));
1728 }
1729 ;
1730
1731 track_names_list:
1732 '(' maybe_space closing_parenthesis {
1733 $$.setFromValueList(parser->sinkFloatingValueList(parser->createFloating ValueList()));
1734 }
1735 | '(' maybe_space ident_list closing_parenthesis {
1736 $$.setFromValueList(parser->sinkFloatingValueList($3));
1737 }
1738 | '(' maybe_space expr_recovery closing_parenthesis {
1739 YYERROR;
1740 }
1741 ;
1742
1708 expr: 1743 expr:
1709 term { 1744 term {
1710 $$ = parser->createFloatingValueList(); 1745 $$ = parser->createFloatingValueList();
1711 $$->addValue(parser->sinkFloatingValue($1)); 1746 $$->addValue(parser->sinkFloatingValue($1));
1712 } 1747 }
1713 | expr operator term { 1748 | expr operator term {
1714 $$ = $1; 1749 $$ = $1;
1715 $$->addValue(makeOperatorValue($2)); 1750 $$->addValue(makeOperatorValue($2));
1716 $$->addValue(parser->sinkFloatingValue($3)); 1751 $$->addValue(parser->sinkFloatingValue($3));
1717 } 1752 }
(...skipping 15 matching lines...) Expand all
1733 } 1768 }
1734 | ',' maybe_space { 1769 | ',' maybe_space {
1735 $$ = ','; 1770 $$ = ',';
1736 } 1771 }
1737 ; 1772 ;
1738 1773
1739 term: 1774 term:
1740 unary_term maybe_space 1775 unary_term maybe_space
1741 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } 1776 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; }
1742 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; } 1777 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; }
1743 | IDENT maybe_space { 1778 | IDENT maybe_space { $$ = makeIdentValue($1); }
1744 $$.id = cssValueKeywordID($1);
1745 $$.unit = CSSPrimitiveValue::CSS_IDENT;
1746 $$.string = $1;
1747 }
1748 /* 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. */ 1779 /* 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. */
1749 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; } 1780 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; }
1750 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } 1781 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; }
1751 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; } 1782 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; }
1752 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } 1783 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
1753 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; } 1784 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; }
1754 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ 1785 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
1755 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { 1786 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
1756 $$.id = CSSValueInvalid; 1787 $$.id = CSSValueInvalid;
1757 $$.string = $3; 1788 $$.string = $3;
1758 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1789 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1759 } 1790 }
1760 | VARFUNCTION maybe_space expr_recovery closing_parenthesis { 1791 | VARFUNCTION maybe_space expr_recovery closing_parenthesis {
1761 YYERROR; 1792 YYERROR;
1762 } 1793 }
1763 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */ 1794 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */
1764 | function maybe_space 1795 | function maybe_space
1765 | calc_function maybe_space 1796 | calc_function maybe_space
1766 | min_or_max_function maybe_space 1797 | min_or_max_function maybe_space
1767 | '%' maybe_space { /* Handle width: %; */ 1798 | '%' maybe_space { /* Handle width: %; */
1768 $$.id = CSSValueInvalid; $$.unit = 0; 1799 $$.id = CSSValueInvalid; $$.unit = 0;
1769 } 1800 }
1801 | track_names_list maybe_space
1770 ; 1802 ;
1771 1803
1772 unary_term: 1804 unary_term:
1773 INTEGER { $$.setFromNumber($1); $$.isInt = true; } 1805 INTEGER { $$.setFromNumber($1); $$.isInt = true; }
1774 | FLOATTOKEN { $$.setFromNumber($1); } 1806 | FLOATTOKEN { $$.setFromNumber($1); }
1775 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } 1807 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); }
1776 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } 1808 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); }
1777 | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); } 1809 | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); }
1778 | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); } 1810 | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); }
1779 | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); } 1811 | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 2017
1986 rule_error_recovery: 2018 rule_error_recovery:
1987 /* empty */ 2019 /* empty */
1988 | rule_error_recovery error 2020 | rule_error_recovery error
1989 | rule_error_recovery invalid_square_brackets_block 2021 | rule_error_recovery invalid_square_brackets_block
1990 | rule_error_recovery invalid_parentheses_block 2022 | rule_error_recovery invalid_parentheses_block
1991 ; 2023 ;
1992 2024
1993 %% 2025 %%
1994 2026
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSGridLineNamesValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698