| OLD | NEW |
| 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 Loading... |
| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 20 matching lines...) Expand all Loading... |
| 1671 | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS
S_URI; } | 1675 | 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; } | 1676 | 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; } | 1677 | 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: #;" */ | 1678 | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPri
mitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ |
| 1675 | VARFUNCTION maybe_space IDENT ')' maybe_space { | 1679 | VARFUNCTION maybe_space IDENT ')' maybe_space { |
| 1676 $$.id = 0; | 1680 $$.id = 0; |
| 1677 $$.string = $3; | 1681 $$.string = $3; |
| 1678 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; | 1682 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; |
| 1679 } | 1683 } |
| 1680 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ | 1684 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ |
| 1681 | function { | 1685 | function maybe_space { |
| 1682 $$ = $1; | 1686 $$ = $1; |
| 1683 } | 1687 } |
| 1684 | calc_function { | 1688 | calc_function maybe_space { |
| 1685 $$ = $1; | 1689 $$ = $1; |
| 1686 } | 1690 } |
| 1687 | min_or_max_function { | 1691 | min_or_max_function maybe_space { |
| 1688 $$ = $1; | 1692 $$ = $1; |
| 1689 } | 1693 } |
| 1690 | '%' maybe_space { /* Handle width: %; */ | 1694 | '%' maybe_space { /* Handle width: %; */ |
| 1691 $$.id = 0; $$.unit = 0; | 1695 $$.id = 0; $$.unit = 0; |
| 1692 } | 1696 } |
| 1693 ; | 1697 ; |
| 1694 | 1698 |
| 1695 unary_term: | 1699 unary_term: |
| 1696 INTEGER { $$.id = 0; $$.isInt = true; $$.fValue = $1; $$.unit = CSSPrimitiveVa
lue::CSS_NUMBER; } | 1700 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; } | 1701 | FLOATTOKEN { $$.id = 0; $$.isInt = false; $$.fValue = $1; $$.unit = CSSPrimi
tiveValue::CSS_NUMBER; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1725 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } | 1729 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } |
| 1726 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } | 1730 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } |
| 1727 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; } | 1731 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; } |
| 1728 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; } | 1732 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; } |
| 1729 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; } | 1733 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; } |
| 1730 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; } | 1734 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; } |
| 1731 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; } | 1735 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; } |
| 1732 ; | 1736 ; |
| 1733 | 1737 |
| 1734 function: | 1738 function: |
| 1735 FUNCTION maybe_space expr closing_parenthesis maybe_space { | 1739 FUNCTION maybe_space expr closing_parenthesis { |
| 1736 CSSParserFunction* f = parser->createFloatingFunction(); | 1740 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1737 f->name = $1; | 1741 f->name = $1; |
| 1738 f->args = parser->sinkFloatingValueList($3); | 1742 f->args = parser->sinkFloatingValueList($3); |
| 1739 $$.id = 0; | 1743 $$.id = 0; |
| 1740 $$.unit = CSSParserValue::Function; | 1744 $$.unit = CSSParserValue::Function; |
| 1741 $$.function = f; | 1745 $$.function = f; |
| 1742 } | | 1746 } | |
| 1743 FUNCTION maybe_space closing_parenthesis maybe_space { | 1747 FUNCTION maybe_space closing_parenthesis { |
| 1744 CSSParserFunction* f = parser->createFloatingFunction(); | 1748 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1745 f->name = $1; | 1749 f->name = $1; |
| 1746 CSSParserValueList* valueList = parser->createFloatingValueList(); | 1750 CSSParserValueList* valueList = parser->createFloatingValueList(); |
| 1747 f->args = parser->sinkFloatingValueList(valueList); | 1751 f->args = parser->sinkFloatingValueList(valueList); |
| 1748 $$.id = 0; | 1752 $$.id = 0; |
| 1749 $$.unit = CSSParserValue::Function; | 1753 $$.unit = CSSParserValue::Function; |
| 1750 $$.function = f; | 1754 $$.function = f; |
| 1751 } | | 1755 } | |
| 1752 FUNCTION maybe_space error { | 1756 FUNCTION maybe_space expr_recovery closing_parenthesis { |
| 1753 CSSParserFunction* f = parser->createFloatingFunction(); | 1757 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1754 f->name = $1; | 1758 f->name = $1; |
| 1755 f->args = nullptr; | 1759 f->args = nullptr; |
| 1756 $$.id = 0; | 1760 $$.id = 0; |
| 1757 $$.unit = CSSParserValue::Function; | 1761 $$.unit = CSSParserValue::Function; |
| 1758 $$.function = f; | 1762 $$.function = f; |
| 1759 } | 1763 } |
| 1760 ; | 1764 ; |
| 1761 | 1765 |
| 1762 calc_func_term: | 1766 calc_func_term: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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; |
| 1852 v.id = 0; | 1858 v.id = 0; |
| 1853 v.unit = CSSParserValue::Operator; | 1859 v.unit = CSSParserValue::Operator; |
| 1854 v.iValue = ','; | 1860 v.iValue = ','; |
| 1855 $$->addValue(v); | 1861 $$->addValue(v); |
| 1856 $$->extend(*($4)); | 1862 $$->extend(*($4)); |
| 1857 } else | 1863 } else |
| 1858 $$ = 0; | 1864 $$ = 0; |
| 1859 } | 1865 } |
| 1860 ; | 1866 ; |
| 1861 | 1867 |
| 1862 calc_function: | 1868 calc_function: |
| 1863 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' maybe_space { | 1869 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' { |
| 1864 CSSParserFunction* f = parser->createFloatingFunction(); | 1870 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1865 f->name = $1; | 1871 f->name = $1; |
| 1866 f->args = parser->sinkFloatingValueList($3); | 1872 f->args = parser->sinkFloatingValueList($3); |
| 1867 $$.id = 0; | 1873 $$.id = 0; |
| 1868 $$.unit = CSSParserValue::Function; | 1874 $$.unit = CSSParserValue::Function; |
| 1869 $$.function = f; | 1875 $$.function = f; |
| 1870 } | 1876 } |
| 1871 | CALCFUNCTION maybe_space error { | 1877 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis { |
| 1872 YYERROR; | 1878 YYERROR; |
| 1873 } | 1879 } |
| 1874 ; | 1880 ; |
| 1875 | 1881 |
| 1876 | 1882 |
| 1877 min_or_max: | 1883 min_or_max: |
| 1878 MINFUNCTION { | 1884 MINFUNCTION { |
| 1879 $$ = $1; | 1885 $$ = $1; |
| 1880 } | 1886 } |
| 1881 | MAXFUNCTION { | 1887 | MAXFUNCTION { |
| 1882 $$ = $1; | 1888 $$ = $1; |
| 1883 } | 1889 } |
| 1884 ; | 1890 ; |
| 1885 | 1891 |
| 1886 min_or_max_function: | 1892 min_or_max_function: |
| 1887 min_or_max maybe_space calc_func_expr_list ')' maybe_space { | 1893 min_or_max maybe_space calc_func_expr_list ')' { |
| 1888 CSSParserFunction* f = parser->createFloatingFunction(); | 1894 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1889 f->name = $1; | 1895 f->name = $1; |
| 1890 f->args = parser->sinkFloatingValueList($3); | 1896 f->args = parser->sinkFloatingValueList($3); |
| 1891 $$.id = 0; | 1897 $$.id = 0; |
| 1892 $$.unit = CSSParserValue::Function; | 1898 $$.unit = CSSParserValue::Function; |
| 1893 $$.function = f; | 1899 $$.function = f; |
| 1894 } | 1900 } |
| 1895 | min_or_max maybe_space error { | 1901 | min_or_max maybe_space expr_recovery closing_parenthesis { |
| 1896 YYERROR; | 1902 YYERROR; |
| 1897 } | 1903 } |
| 1898 ; | 1904 ; |
| 1899 | 1905 |
| 1900 /* error handling rules */ | 1906 /* error handling rules */ |
| 1901 | 1907 |
| 1902 save_block: | 1908 save_block: |
| 1903 closing_brace { | 1909 closing_brace { |
| 1904 $$ = 0; | 1910 $$ = 0; |
| 1905 } | 1911 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |