OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 ident_list closing_parenthesis { |
| 1733 $$.setFromValueList(parser->sinkFloatingValueList($3)); |
| 1734 } |
| 1735 | '(' maybe_space expr_recovery closing_parenthesis { |
| 1736 YYERROR; |
| 1737 } |
| 1738 ; |
| 1739 |
1708 expr: | 1740 expr: |
1709 term { | 1741 term { |
1710 $$ = parser->createFloatingValueList(); | 1742 $$ = parser->createFloatingValueList(); |
1711 $$->addValue(parser->sinkFloatingValue($1)); | 1743 $$->addValue(parser->sinkFloatingValue($1)); |
1712 } | 1744 } |
1713 | expr operator term { | 1745 | expr operator term { |
1714 $$ = $1; | 1746 $$ = $1; |
1715 $$->addValue(makeOperatorValue($2)); | 1747 $$->addValue(makeOperatorValue($2)); |
1716 $$->addValue(parser->sinkFloatingValue($3)); | 1748 $$->addValue(parser->sinkFloatingValue($3)); |
1717 } | 1749 } |
(...skipping 15 matching lines...) Expand all Loading... |
1733 } | 1765 } |
1734 | ',' maybe_space { | 1766 | ',' maybe_space { |
1735 $$ = ','; | 1767 $$ = ','; |
1736 } | 1768 } |
1737 ; | 1769 ; |
1738 | 1770 |
1739 term: | 1771 term: |
1740 unary_term maybe_space | 1772 unary_term maybe_space |
1741 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } | 1773 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } |
1742 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP
rimitiveValue::CSS_STRING; } | 1774 | STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSP
rimitiveValue::CSS_STRING; } |
1743 | IDENT maybe_space { | 1775 | 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. */ | 1776 /* 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; } | 1777 | 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; } | 1778 | 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; } | 1779 | 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; } | 1780 | 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; } | 1781 | 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:
#;" */ | 1782 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$
.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color:
#;" */ |
1755 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { | 1783 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { |
1756 $$.id = CSSValueInvalid; | 1784 $$.id = CSSValueInvalid; |
1757 $$.string = $3; | 1785 $$.string = $3; |
1758 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; | 1786 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; |
1759 } | 1787 } |
1760 | VARFUNCTION maybe_space expr_recovery closing_parenthesis { | 1788 | VARFUNCTION maybe_space expr_recovery closing_parenthesis { |
1761 YYERROR; | 1789 YYERROR; |
1762 } | 1790 } |
1763 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ | 1791 /* 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 | 1792 | function maybe_space |
1765 | calc_function maybe_space | 1793 | calc_function maybe_space |
1766 | min_or_max_function maybe_space | 1794 | min_or_max_function maybe_space |
1767 | '%' maybe_space { /* Handle width: %; */ | 1795 | '%' maybe_space { /* Handle width: %; */ |
1768 $$.id = CSSValueInvalid; $$.unit = 0; | 1796 $$.id = CSSValueInvalid; $$.unit = 0; |
1769 } | 1797 } |
| 1798 | track_names_list maybe_space |
1770 ; | 1799 ; |
1771 | 1800 |
1772 unary_term: | 1801 unary_term: |
1773 INTEGER { $$.setFromNumber($1); $$.isInt = true; } | 1802 INTEGER { $$.setFromNumber($1); $$.isInt = true; } |
1774 | FLOATTOKEN { $$.setFromNumber($1); } | 1803 | FLOATTOKEN { $$.setFromNumber($1); } |
1775 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } | 1804 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } |
1776 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } | 1805 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } |
1777 | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); } | 1806 | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); } |
1778 | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); } | 1807 | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); } |
1779 | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); } | 1808 | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 | 2014 |
1986 rule_error_recovery: | 2015 rule_error_recovery: |
1987 /* empty */ | 2016 /* empty */ |
1988 | rule_error_recovery error | 2017 | rule_error_recovery error |
1989 | rule_error_recovery invalid_square_brackets_block | 2018 | rule_error_recovery invalid_square_brackets_block |
1990 | rule_error_recovery invalid_parentheses_block | 2019 | rule_error_recovery invalid_parentheses_block |
1991 ; | 2020 ; |
1992 | 2021 |
1993 %% | 2022 %% |
1994 | 2023 |
OLD | NEW |