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

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

Issue 14969002: CSS parsing recovery in function. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged 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-error-recovery.html ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 case VAR_DEFINITION: 80 case VAR_DEFINITION:
81 case UNICODERANGE: 81 case UNICODERANGE:
82 return true; 82 return true;
83 default: 83 default:
84 return false; 84 return false;
85 } 85 }
86 } 86 }
87 87
88 %} 88 %}
89 89
90 %expect 33 90 %expect 32
91 91
92 %nonassoc LOWEST_PREC 92 %nonassoc LOWEST_PREC
93 93
94 %left UNIMPORTANT_TOK 94 %left UNIMPORTANT_TOK
95 95
96 %token WHITESPACE SGML_CD 96 %token WHITESPACE SGML_CD
97 %token TOKEN_EOF 0 97 %token TOKEN_EOF 0
98 98
99 %token INCLUDES 99 %token INCLUDES
100 %token DASHMATCH 100 %token DASHMATCH
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS S_URI; } 1671 | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS S_URI; }
1672 | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitive Value::CSS_UNICODE_RANGE; } 1672 | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitive Value::CSS_UNICODE_RANGE; }
1673 | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS S_PARSER_HEXCOLOR; } 1673 | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS S_PARSER_HEXCOLOR; }
1674 | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPri mitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ 1674 | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPri mitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
1675 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { 1675 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
1676 $$.id = 0; 1676 $$.id = 0;
1677 $$.string = $3; 1677 $$.string = $3;
1678 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; 1678 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
1679 } 1679 }
1680 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */ 1680 /* FIXME: according to the specs a function can have a unary_operator in front . I know no case where this makes sense */
1681 | function { 1681 | function maybe_space {
1682 $$ = $1; 1682 $$ = $1;
1683 } 1683 }
1684 | calc_function { 1684 | calc_function maybe_space {
1685 $$ = $1; 1685 $$ = $1;
1686 } 1686 }
1687 | min_or_max_function { 1687 | min_or_max_function maybe_space {
1688 $$ = $1; 1688 $$ = $1;
1689 } 1689 }
1690 | '%' maybe_space { /* Handle width: %; */ 1690 | '%' maybe_space { /* Handle width: %; */
1691 $$.id = 0; $$.unit = 0; 1691 $$.id = 0; $$.unit = 0;
1692 } 1692 }
1693 ; 1693 ;
1694 1694
1695 unary_term: 1695 unary_term:
1696 INTEGER { $$.id = 0; $$.isInt = true; $$.fValue = $1; $$.unit = CSSPrimitiveVa lue::CSS_NUMBER; } 1696 INTEGER { $$.id = 0; $$.isInt = true; $$.fValue = $1; $$.unit = CSSPrimitiveVa lue::CSS_NUMBER; }
1697 | FLOATTOKEN { $$.id = 0; $$.isInt = false; $$.fValue = $1; $$.unit = CSSPrimi tiveValue::CSS_NUMBER; } 1697 | FLOATTOKEN { $$.id = 0; $$.isInt = false; $$.fValue = $1; $$.unit = CSSPrimi tiveValue::CSS_NUMBER; }
(...skipping 27 matching lines...) Expand all
1725 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } 1725 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
1726 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } 1726 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
1727 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; } 1727 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; }
1728 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; } 1728 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
1729 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; } 1729 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; }
1730 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; } 1730 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; }
1731 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; } 1731 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; }
1732 ; 1732 ;
1733 1733
1734 function: 1734 function:
1735 FUNCTION maybe_space expr closing_parenthesis maybe_space { 1735 FUNCTION maybe_space expr closing_parenthesis {
1736 CSSParserFunction* f = parser->createFloatingFunction(); 1736 CSSParserFunction* f = parser->createFloatingFunction();
1737 f->name = $1; 1737 f->name = $1;
1738 f->args = parser->sinkFloatingValueList($3); 1738 f->args = parser->sinkFloatingValueList($3);
1739 $$.id = 0; 1739 $$.id = 0;
1740 $$.unit = CSSParserValue::Function; 1740 $$.unit = CSSParserValue::Function;
1741 $$.function = f; 1741 $$.function = f;
1742 } | 1742 } |
1743 FUNCTION maybe_space closing_parenthesis maybe_space { 1743 FUNCTION maybe_space closing_parenthesis {
1744 CSSParserFunction* f = parser->createFloatingFunction(); 1744 CSSParserFunction* f = parser->createFloatingFunction();
1745 f->name = $1; 1745 f->name = $1;
1746 CSSParserValueList* valueList = parser->createFloatingValueList(); 1746 CSSParserValueList* valueList = parser->createFloatingValueList();
1747 f->args = parser->sinkFloatingValueList(valueList); 1747 f->args = parser->sinkFloatingValueList(valueList);
1748 $$.id = 0; 1748 $$.id = 0;
1749 $$.unit = CSSParserValue::Function; 1749 $$.unit = CSSParserValue::Function;
1750 $$.function = f; 1750 $$.function = f;
1751 } | 1751 } |
1752 FUNCTION maybe_space error { 1752 FUNCTION maybe_space expr_recovery closing_parenthesis {
1753 CSSParserFunction* f = parser->createFloatingFunction(); 1753 CSSParserFunction* f = parser->createFloatingFunction();
1754 f->name = $1; 1754 f->name = $1;
1755 f->args = nullptr; 1755 f->args = nullptr;
1756 $$.id = 0; 1756 $$.id = 0;
1757 $$.unit = CSSParserValue::Function; 1757 $$.unit = CSSParserValue::Function;
1758 $$.function = f; 1758 $$.function = f;
1759 } 1759 }
1760 ; 1760 ;
1761 1761
1762 calc_func_term: 1762 calc_func_term:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 v.unit = CSSParserValue::Operator; 1853 v.unit = CSSParserValue::Operator;
1854 v.iValue = ','; 1854 v.iValue = ',';
1855 $$->addValue(v); 1855 $$->addValue(v);
1856 $$->extend(*($4)); 1856 $$->extend(*($4));
1857 } else 1857 } else
1858 $$ = 0; 1858 $$ = 0;
1859 } 1859 }
1860 ; 1860 ;
1861 1861
1862 calc_function: 1862 calc_function:
1863 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis maybe_space { 1863 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
1864 CSSParserFunction* f = parser->createFloatingFunction(); 1864 CSSParserFunction* f = parser->createFloatingFunction();
1865 f->name = $1; 1865 f->name = $1;
1866 f->args = parser->sinkFloatingValueList($3); 1866 f->args = parser->sinkFloatingValueList($3);
1867 $$.id = 0; 1867 $$.id = 0;
1868 $$.unit = CSSParserValue::Function; 1868 $$.unit = CSSParserValue::Function;
1869 $$.function = f; 1869 $$.function = f;
1870 } 1870 }
1871 | CALCFUNCTION maybe_space error { 1871 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
1872 YYERROR; 1872 YYERROR;
1873 } 1873 }
1874 ; 1874 ;
1875 1875
1876 1876
1877 min_or_max: 1877 min_or_max:
1878 MINFUNCTION { 1878 MINFUNCTION {
1879 $$ = $1; 1879 $$ = $1;
1880 } 1880 }
1881 | MAXFUNCTION { 1881 | MAXFUNCTION {
1882 $$ = $1; 1882 $$ = $1;
1883 } 1883 }
1884 ; 1884 ;
1885 1885
1886 min_or_max_function: 1886 min_or_max_function:
1887 min_or_max maybe_space calc_func_expr_list closing_parenthesis maybe_space { 1887 min_or_max maybe_space calc_func_expr_list closing_parenthesis {
1888 CSSParserFunction* f = parser->createFloatingFunction(); 1888 CSSParserFunction* f = parser->createFloatingFunction();
1889 f->name = $1; 1889 f->name = $1;
1890 f->args = parser->sinkFloatingValueList($3); 1890 f->args = parser->sinkFloatingValueList($3);
1891 $$.id = 0; 1891 $$.id = 0;
1892 $$.unit = CSSParserValue::Function; 1892 $$.unit = CSSParserValue::Function;
1893 $$.function = f; 1893 $$.function = f;
1894 } 1894 }
1895 | min_or_max maybe_space error { 1895 | min_or_max maybe_space expr_recovery closing_parenthesis {
1896 YYERROR; 1896 YYERROR;
1897 } 1897 }
1898 ; 1898 ;
1899 1899
1900 /* error handling rules */ 1900 /* error handling rules */
1901 1901
1902 save_block: 1902 save_block:
1903 closing_brace { 1903 closing_brace {
1904 $$ = 0; 1904 $$ = 0;
1905 } 1905 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 ; 1955 ;
1956 1956
1957 error_recovery: 1957 error_recovery:
1958 /* empty */ 1958 /* empty */
1959 | error_recovery invalid_block 1959 | error_recovery invalid_block
1960 | error_recovery error 1960 | error_recovery error
1961 ; 1961 ;
1962 1962
1963 %% 1963 %%
1964 1964
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/parsing-error-recovery.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698