| 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 1 | 90 %expect 0 |
| 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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 $$ = $1; | 1532 $$ = $1; |
| 1533 } | 1533 } |
| 1534 | decl_list declaration { | 1534 | decl_list declaration { |
| 1535 $$ = $1; | 1535 $$ = $1; |
| 1536 if ( $2 ) | 1536 if ( $2 ) |
| 1537 $$ = $2; | 1537 $$ = $2; |
| 1538 } | 1538 } |
| 1539 | decl_list { | 1539 | decl_list { |
| 1540 $$ = $1; | 1540 $$ = $1; |
| 1541 } | 1541 } |
| 1542 | decl_list_recovery { | |
| 1543 $$ = false; | |
| 1544 } | |
| 1545 | decl_list decl_list_recovery { | |
| 1546 $$ = $1; | |
| 1547 } | |
| 1548 ; | 1542 ; |
| 1549 | 1543 |
| 1550 decl_list: | 1544 decl_list: |
| 1551 declaration ';' maybe_space { | 1545 declaration ';' maybe_space { |
| 1552 parser->startProperty(); | 1546 parser->startProperty(); |
| 1553 $$ = $1; | 1547 $$ = $1; |
| 1554 } | 1548 } |
| 1555 | decl_list_recovery ';' maybe_space { | |
| 1556 parser->startProperty(); | |
| 1557 $$ = false; | |
| 1558 } | |
| 1559 | decl_list declaration ';' maybe_space { | 1549 | decl_list declaration ';' maybe_space { |
| 1560 parser->startProperty(); | 1550 parser->startProperty(); |
| 1561 $$ = $1; | 1551 $$ = $1; |
| 1562 if ($2) | 1552 if ($2) |
| 1563 $$ = $2; | 1553 $$ = $2; |
| 1564 } | 1554 } |
| 1565 | decl_list decl_list_recovery ';' maybe_space { | |
| 1566 parser->startProperty(); | |
| 1567 $$ = $1; | |
| 1568 } | |
| 1569 ; | |
| 1570 | |
| 1571 decl_list_recovery: | |
| 1572 error error_location error_recovery { | |
| 1573 parser->reportError($2, CSSParser::PropertyDeclarationError); | |
| 1574 } | |
| 1575 ; | 1555 ; |
| 1576 | 1556 |
| 1577 declaration: | 1557 declaration: |
| 1578 VAR_DEFINITION maybe_space ':' maybe_space expr prio { | 1558 VAR_DEFINITION maybe_space ':' maybe_space expr prio { |
| 1579 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5),
$6); | 1559 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5),
$6); |
| 1580 $$ = true; | 1560 $$ = true; |
| 1581 parser->endProperty($6, true); | 1561 parser->endProperty($6, true); |
| 1582 } | 1562 } |
| 1583 | | 1563 | |
| 1584 property ':' maybe_space error_location expr prio { | 1564 property ':' maybe_space error_location valid_expr prio { |
| 1585 $$ = false; | 1565 $$ = false; |
| 1586 bool isPropertyParsed = false; | 1566 bool isPropertyParsed = false; |
| 1587 if ($1 && $5) { | 1567 if ($1 && $5) { |
| 1588 parser->m_valueList = parser->sinkFloatingValueList($5); | 1568 parser->m_valueList = parser->sinkFloatingValueList($5); |
| 1589 int oldParsedProperties = parser->m_parsedProperties.size(); | 1569 int oldParsedProperties = parser->m_parsedProperties.size(); |
| 1590 $$ = parser->parseValue(static_cast<CSSPropertyID>($1), $6); | 1570 $$ = parser->parseValue(static_cast<CSSPropertyID>($1), $6); |
| 1591 if (!$$) { | 1571 if (!$$) { |
| 1592 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); | 1572 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); |
| 1593 parser->reportError($4, CSSParser::InvalidPropertyValueError); | 1573 parser->reportError($4, CSSParser::InvalidPropertyValueError); |
| 1594 } else | 1574 } else |
| 1595 isPropertyParsed = true; | 1575 isPropertyParsed = true; |
| 1596 parser->m_valueList = nullptr; | 1576 parser->m_valueList = nullptr; |
| 1597 } | 1577 } |
| 1598 parser->endProperty($6, isPropertyParsed); | 1578 parser->endProperty($6, isPropertyParsed); |
| 1599 } | 1579 } |
| 1600 | | 1580 | |
| 1601 property declaration_recovery { | 1581 property ':' maybe_space error_location valid_expr prio error error_recovery
{ |
| 1582 /* When we encounter something like p {color: red !important fail;} we s
hould drop the declaration */ |
| 1583 parser->reportError($4, CSSParser::InvalidPropertyValueError); |
| 1584 parser->endProperty(false, false); |
| 1585 $$ = false; |
| 1586 } |
| 1587 | |
| 1588 property ':' maybe_space error_location error error_recovery { |
| 1589 parser->reportError($4, CSSParser::InvalidPropertyValueError); |
| 1590 parser->endProperty(false, false); |
| 1591 $$ = false; |
| 1592 } |
| 1593 | |
| 1594 property error error_location error_recovery { |
| 1595 parser->reportError($3, CSSParser::PropertyDeclarationError); |
| 1602 parser->endProperty(false, false, CSSParser::GeneralError); | 1596 parser->endProperty(false, false, CSSParser::GeneralError); |
| 1603 $$ = false; | 1597 $$ = false; |
| 1604 } | 1598 } |
| 1605 | | 1599 | |
| 1606 property ':' maybe_space error_location expr prio declaration_recovery { | 1600 error error_location error_recovery { |
| 1607 /* When we encounter something like p {color: red !important fail;} we s
hould drop the declaration */ | 1601 parser->reportError($2, CSSParser::PropertyDeclarationError); |
| 1608 parser->endProperty(false, false); | |
| 1609 $$ = false; | |
| 1610 } | |
| 1611 | | |
| 1612 IMPORTANT_SYM maybe_space declaration_recovery { | |
| 1613 /* Handle this case: div { text-align: center; !important } Just reduce
away the stray !important. */ | |
| 1614 parser->endProperty(false, false, CSSParser::GeneralError); | |
| 1615 $$ = false; | |
| 1616 } | |
| 1617 | | |
| 1618 property ':' maybe_space declaration_recovery { | |
| 1619 /* if we come across rules with invalid values like this case: p { weigh
t: *; }, just discard the rule */ | |
| 1620 parser->endProperty(false, false); | |
| 1621 $$ = false; | 1602 $$ = false; |
| 1622 } | 1603 } |
| 1623 ; | 1604 ; |
| 1624 | 1605 |
| 1625 declaration_recovery: | |
| 1626 error error_location error_recovery { | |
| 1627 parser->reportError($2); | |
| 1628 } | |
| 1629 ; | |
| 1630 | |
| 1631 property: | 1606 property: |
| 1632 error_location IDENT maybe_space { | 1607 error_location IDENT maybe_space { |
| 1633 $$ = cssPropertyID($2); | 1608 $$ = cssPropertyID($2); |
| 1634 parser->setCurrentProperty($$); | 1609 parser->setCurrentProperty($$); |
| 1635 if ($$ == CSSPropertyInvalid) | 1610 if ($$ == CSSPropertyInvalid) |
| 1636 parser->reportError($1, CSSParser::InvalidPropertyError); | 1611 parser->reportError($1, CSSParser::InvalidPropertyError); |
| 1637 } | 1612 } |
| 1638 ; | 1613 ; |
| 1639 | 1614 |
| 1640 prio: | 1615 prio: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 | 1964 |
| 1990 rule_error_recovery: | 1965 rule_error_recovery: |
| 1991 /* empty */ | 1966 /* empty */ |
| 1992 | rule_error_recovery error | 1967 | rule_error_recovery error |
| 1993 | rule_error_recovery invalid_square_brackets_block | 1968 | rule_error_recovery invalid_square_brackets_block |
| 1994 | rule_error_recovery invalid_parentheses_block | 1969 | rule_error_recovery invalid_parentheses_block |
| 1995 ; | 1970 ; |
| 1996 | 1971 |
| 1997 %% | 1972 %% |
| 1998 | 1973 |
| OLD | NEW |