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

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

Issue 14897004: Skipping {}, () and [] blocks while error recovering in CSS. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge Created 7 years, 7 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 | « LayoutTests/fast/css/parsing-expr-error-recovery-expected.txt ('k') | 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 %type <boolean> declarations_and_margins 293 %type <boolean> declarations_and_margins
294 294
295 %type <boolean> prio 295 %type <boolean> prio
296 296
297 %type <integer> match 297 %type <integer> match
298 %type <integer> unary_operator 298 %type <integer> unary_operator
299 %type <integer> maybe_unary_operator 299 %type <integer> maybe_unary_operator
300 %type <character> operator 300 %type <character> operator
301 301
302 %type <valueList> expr 302 %type <valueList> expr
303 %type <valueList> valid_expr
303 %type <value> term 304 %type <value> term
304 %type <value> unary_term 305 %type <value> unary_term
305 %type <value> function 306 %type <value> function
306 %type <value> calc_func_term 307 %type <value> calc_func_term
307 %type <character> calc_func_operator 308 %type <character> calc_func_operator
308 %type <valueList> calc_func_expr 309 %type <valueList> calc_func_expr
310 %type <valueList> valid_calc_func_expr
309 %type <valueList> calc_func_expr_list 311 %type <valueList> calc_func_expr_list
310 %type <valueList> calc_func_paren_expr 312 %type <valueList> calc_func_paren_expr
311 %type <value> calc_function 313 %type <value> calc_function
312 %type <string> min_or_max 314 %type <string> min_or_max
313 %type <value> min_or_max_function 315 %type <value> min_or_max_function
314 316
315 %type <string> element_name 317 %type <string> element_name
316 %type <string> attr_name 318 %type <string> attr_name
317 319
318 %type <location> error_location 320 %type <location> error_location
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 $$ = cssPropertyID($1); 1613 $$ = cssPropertyID($1);
1612 } 1614 }
1613 ; 1615 ;
1614 1616
1615 prio: 1617 prio:
1616 IMPORTANT_SYM maybe_space { $$ = true; } 1618 IMPORTANT_SYM maybe_space { $$ = true; }
1617 | /* empty */ { $$ = false; } 1619 | /* empty */ { $$ = false; }
1618 ; 1620 ;
1619 1621
1620 expr: 1622 expr:
1623 valid_expr
1624 | valid_expr expr_recovery { $$ = 0; }
1625 ;
1626
1627 valid_expr:
1621 term { 1628 term {
1622 $$ = parser->createFloatingValueList(); 1629 $$ = parser->createFloatingValueList();
1623 $$->addValue(parser->sinkFloatingValue($1)); 1630 $$->addValue(parser->sinkFloatingValue($1));
1624 } 1631 }
1625 | expr operator term { 1632 | valid_expr operator term {
1626 $$ = $1; 1633 $$ = $1;
1627 if ($$) { 1634 if ($$) {
1628 if ($2) { 1635 if ($2) {
1629 CSSParserValue v; 1636 CSSParserValue v;
1630 v.id = 0; 1637 v.id = 0;
1631 v.unit = CSSParserValue::Operator; 1638 v.unit = CSSParserValue::Operator;
1632 v.iValue = $2; 1639 v.iValue = $2;
1633 $$->addValue(v); 1640 $$->addValue(v);
1634 } 1641 }
1635 $$->addValue(parser->sinkFloatingValue($3)); 1642 $$->addValue(parser->sinkFloatingValue($3));
1636 } 1643 }
1637 } 1644 }
1638 | expr expr_recovery {
1639 $$ = 0;
1640 }
1641 ; 1645 ;
1642 1646
1643 expr_recovery: 1647 expr_recovery:
1644 error error_location error_recovery 1648 error error_location error_recovery
1645 ; 1649 ;
1646 1650
1647 operator: 1651 operator:
1648 '/' maybe_space { 1652 '/' maybe_space {
1649 $$ = '/'; 1653 $$ = '/';
1650 } 1654 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 v.iValue = '('; 1803 v.iValue = '(';
1800 $$->insertValueAt(0, v); 1804 $$->insertValueAt(0, v);
1801 v.iValue = ')'; 1805 v.iValue = ')';
1802 $$->addValue(v); 1806 $$->addValue(v);
1803 } else 1807 } else
1804 $$ = 0; 1808 $$ = 0;
1805 } 1809 }
1806 ; 1810 ;
1807 1811
1808 calc_func_expr: 1812 calc_func_expr:
1813 valid_calc_func_expr
1814 | valid_calc_func_expr expr_recovery { $$ = 0; }
1815 ;
1816
1817 valid_calc_func_expr:
1809 calc_func_term { 1818 calc_func_term {
1810 $$ = parser->createFloatingValueList(); 1819 $$ = parser->createFloatingValueList();
1811 $$->addValue(parser->sinkFloatingValue($1)); 1820 $$->addValue(parser->sinkFloatingValue($1));
1812 } 1821 }
1813 | calc_func_expr calc_func_operator calc_func_term { 1822 | calc_func_expr calc_func_operator calc_func_term {
1814 if ($1 && $2) { 1823 if ($1 && $2) {
1815 $$ = $1; 1824 $$ = $1;
1816 CSSParserValue v; 1825 CSSParserValue v;
1817 v.id = 0; 1826 v.id = 0;
1818 v.unit = CSSParserValue::Operator; 1827 v.unit = CSSParserValue::Operator;
(...skipping 10 matching lines...) Expand all
1829 CSSParserValue v; 1838 CSSParserValue v;
1830 v.id = 0; 1839 v.id = 0;
1831 v.unit = CSSParserValue::Operator; 1840 v.unit = CSSParserValue::Operator;
1832 v.iValue = $2; 1841 v.iValue = $2;
1833 $$->addValue(v); 1842 $$->addValue(v);
1834 $$->extend(*($3)); 1843 $$->extend(*($3));
1835 } else 1844 } else
1836 $$ = 0; 1845 $$ = 0;
1837 } 1846 }
1838 | calc_func_paren_expr 1847 | calc_func_paren_expr
1839 | calc_func_expr error {
1840 $$ = 0;
1841 }
1842 ; 1848 ;
1843 1849
1844 calc_func_expr_list: 1850 calc_func_expr_list:
1845 calc_func_expr calc_maybe_space { 1851 calc_func_expr calc_maybe_space {
1846 $$ = $1; 1852 $$ = $1;
1847 } 1853 }
1848 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space { 1854 | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
1849 if ($1 && $4) { 1855 if ($1 && $4) {
1850 $$ = $1; 1856 $$ = $1;
1851 CSSParserValue v; 1857 CSSParserValue v;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 | invalid_block_list error invalid_block 1955 | invalid_block_list error invalid_block
1950 ; 1956 ;
1951 1957
1952 error_location: { 1958 error_location: {
1953 $$ = parser->currentLocation(); 1959 $$ = parser->currentLocation();
1954 } 1960 }
1955 ; 1961 ;
1956 1962
1957 error_recovery: 1963 error_recovery:
1958 /* empty */ 1964 /* empty */
1959 | error_recovery invalid_block
1960 | error_recovery error 1965 | error_recovery error
1966 | error_recovery '{' error_recovery closing_brace { parser->invalidBlockHit(); }
1967 | error_recovery '[' error_recovery ']'
1968 | error_recovery '[' error_recovery TOKEN_EOF
1969 | error_recovery '(' error_recovery closing_parenthesis
1970 | error_recovery FUNCTION error_recovery closing_parenthesis
1971 | error_recovery CALCFUNCTION error_recovery closing_parenthesis
1972 | error_recovery VARFUNCTION error_recovery closing_parenthesis
1973 | error_recovery MINFUNCTION error_recovery closing_parenthesis
1974 | error_recovery MAXFUNCTION error_recovery closing_parenthesis
1975 | error_recovery ANYFUNCTION error_recovery closing_parenthesis
1976 | error_recovery NOTFUNCTION error_recovery closing_parenthesis
1961 ; 1977 ;
1962 1978
1963 %% 1979 %%
1964 1980
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/parsing-expr-error-recovery-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698