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

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

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: Added some new tests Created 7 years, 3 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
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 inline static CSSParserValue makeOperatorValue(int value) 90 inline static CSSParserValue makeOperatorValue(int value)
91 { 91 {
92 CSSParserValue v; 92 CSSParserValue v;
93 v.id = CSSValueInvalid; 93 v.id = CSSValueInvalid;
94 v.unit = CSSParserValue::Operator; 94 v.unit = CSSParserValue::Operator;
95 v.iValue = value; 95 v.iValue = value;
96 return v; 96 return v;
97 } 97 }
98 98
99 inline static CSSParserValue makeIdentValue(CSSParserString string)
100 {
101 CSSParserValue v;
102 v.id = cssValueKeywordID(string);
103 v.unit = CSSPrimitiveValue::CSS_IDENT;
104 v.string = string;
105 return v;
106 }
107
99 %} 108 %}
100 109
101 %expect 0 110 %expect 0
102 111
103 %nonassoc LOWEST_PREC 112 %nonassoc LOWEST_PREC
104 113
105 %left UNIMPORTANT_TOK 114 %left UNIMPORTANT_TOK
106 115
107 %token WHITESPACE SGML_CD 116 %token WHITESPACE SGML_CD
108 %token TOKEN_EOF 0 117 %token TOKEN_EOF 0
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 %type <valueList> calc_func_paren_expr 331 %type <valueList> calc_func_paren_expr
323 %type <value> calc_function 332 %type <value> calc_function
324 %type <string> min_or_max 333 %type <string> min_or_max
325 %type <value> min_or_max_function 334 %type <value> min_or_max_function
326 335
327 %type <string> element_name 336 %type <string> element_name
328 %type <string> attr_name 337 %type <string> attr_name
329 338
330 %type <location> error_location 339 %type <location> error_location
331 340
341 %type <valueList> ident_list
342 %type <valueList> track_names_list
343
332 %% 344 %%
333 345
334 stylesheet: 346 stylesheet:
335 maybe_charset maybe_sgml rule_list 347 maybe_charset maybe_sgml rule_list
336 | internal_decls 348 | internal_decls
337 | internal_rule 349 | internal_rule
338 | internal_selector 350 | internal_selector
339 | internal_value 351 | internal_value
340 | internal_medialist 352 | internal_medialist
341 | internal_keyframe_rule 353 | internal_keyframe_rule
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 if ($$ == CSSPropertyInvalid) 1639 if ($$ == CSSPropertyInvalid)
1628 parser->reportError($1, CSSParser::InvalidPropertyError); 1640 parser->reportError($1, CSSParser::InvalidPropertyError);
1629 } 1641 }
1630 ; 1642 ;
1631 1643
1632 prio: 1644 prio:
1633 IMPORTANT_SYM maybe_space { $$ = true; } 1645 IMPORTANT_SYM maybe_space { $$ = true; }
1634 | /* empty */ { $$ = false; } 1646 | /* empty */ { $$ = false; }
1635 ; 1647 ;
1636 1648
1649 ident_list:
1650 IDENT maybe_space {
1651 $$ = parser->createFloatingValueList();
1652 $$->addValue(makeIdentValue($1));
1653 }
1654 | ident_list IDENT maybe_space {
1655 $$ = $1;
1656 $$->addValue(makeIdentValue($2));
1657 }
1658 ;
1659
1660 track_names_list:
1661 '(' maybe_space ident_list closing_parenthesis maybe_space {
1662 $$ = $3;
1663 $$->insertValueAt(0, makeOperatorValue('('));
Julien - ping for review 2013/11/12 07:33:17 I wonder if we couldn't simplify the code by makin
svillar 2013/11/12 07:45:04 I can take a look again, and maybe the changes pro
Julien - ping for review 2013/11/12 07:49:38 Agreed but the proposal was to insert the list as-
1664 $$->addValue(makeOperatorValue(')'));
1665 }
1666 ;
1667
1637 expr: 1668 expr:
1638 term { 1669 term {
1639 $$ = parser->createFloatingValueList(); 1670 $$ = parser->createFloatingValueList();
1640 $$->addValue(parser->sinkFloatingValue($1)); 1671 $$->addValue(parser->sinkFloatingValue($1));
1641 } 1672 }
1673 | track_names_list {
1674 $$ = $1;
1675 }
1676 | expr track_names_list {
1677 $$ = $1;
1678 $$->extend(*($2));
rune 2013/09/10 11:30:19 $2, which comes from is createFloatingValueList()
1679 }
1642 | expr operator term { 1680 | expr operator term {
1643 $$ = $1; 1681 $$ = $1;
1644 $$->addValue(makeOperatorValue($2)); 1682 $$->addValue(makeOperatorValue($2));
1645 $$->addValue(parser->sinkFloatingValue($3)); 1683 $$->addValue(parser->sinkFloatingValue($3));
1646 } 1684 }
1685 | expr operator track_names_list {
1686 $$ = $1;
1687 $$->addValue(makeOperatorValue($2));
1688 $$->extend(*($3));
1689 }
1647 | expr term { 1690 | expr term {
1648 $$ = $1; 1691 $$ = $1;
1649 $$->addValue(parser->sinkFloatingValue($2)); 1692 $$->addValue(parser->sinkFloatingValue($2));
1650 } 1693 }
1651 ; 1694 ;
1652 1695
1653 expr_recovery: 1696 expr_recovery:
1654 error error_location error_recovery { 1697 error error_location error_recovery {
1655 parser->reportError($2, CSSParser::PropertyDeclarationError); 1698 parser->reportError($2, CSSParser::PropertyDeclarationError);
1656 } 1699 }
1657 ; 1700 ;
1658 1701
1659 operator: 1702 operator:
1660 '/' maybe_space { 1703 '/' maybe_space {
1661 $$ = '/'; 1704 $$ = '/';
1662 } 1705 }
1663 | ',' maybe_space { 1706 | ',' maybe_space {
1664 $$ = ','; 1707 $$ = ',';
1665 } 1708 }
1666 ; 1709 ;
1667 1710
1668 term: 1711 term:
1669 unary_term maybe_space 1712 unary_term maybe_space
1670 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } 1713 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; }
1671 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; } 1714 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP rimitiveValue::CSS_STRING; }
1672 | IDENT maybe_space { 1715 | IDENT maybe_space { $$ = makeIdentValue($1); }
1673 $$.id = cssValueKeywordID($1);
1674 $$.unit = CSSPrimitiveValue::CSS_IDENT;
1675 $$.string = $1;
1676 }
1677 /* 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. */ 1716 /* 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. */
1678 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; } 1717 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPr imitiveValue::CSS_DIMENSION; }
1679 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } 1718 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; }
1680 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; } 1719 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_URI; }
1681 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } 1720 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
1682 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; } 1721 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrim itiveValue::CSS_PARSER_HEXCOLOR; }
1683 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ 1722 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$ .unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
1684 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { 1723 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
1685 $$.id = CSSValueInvalid; 1724 $$.id = CSSValueInvalid;
1686 $$.string = $3; 1725 $$.string = $3;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 1953
1915 rule_error_recovery: 1954 rule_error_recovery:
1916 /* empty */ 1955 /* empty */
1917 | rule_error_recovery error 1956 | rule_error_recovery error
1918 | rule_error_recovery invalid_square_brackets_block 1957 | rule_error_recovery invalid_square_brackets_block
1919 | rule_error_recovery invalid_parentheses_block 1958 | rule_error_recovery invalid_parentheses_block
1920 ; 1959 ;
1921 1960
1922 %% 1961 %%
1923 1962
OLDNEW
« no previous file with comments | « LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js ('k') | Source/core/css/CSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698