Changeset 150804 in webkit


Ignore:
Timestamp:
May 28, 2013 7:37:34 AM (11 years ago)
Author:
sergio@webkit.org
Message:

Refactoring CSS grammar
https://bugs.webkit.org/show_bug.cgi?id=116679

Reviewed by Andreas Kling.

From Blink r149948 by <serya@chromium.org>

Added "closing_parenthesis:" and "error_recovery:" to avoid code
duplication in a couple of error recovery rules. Some other rules
were also refactored which allows to reduce the the number of
shift/reduce conflicts by 2.

No new tests required as this is just a refactoring, no new
functionality added.

  • css/CSSGrammar.y.in:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150803 r150804  
     12013-05-28  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Refactoring CSS grammar
     4        https://bugs.webkit.org/show_bug.cgi?id=116679
     5
     6        Reviewed by Andreas Kling.
     7
     8        From Blink r149948 by <serya@chromium.org>
     9
     10        Added "closing_parenthesis:" and "error_recovery:" to avoid code
     11        duplication in a couple of error recovery rules. Some other rules
     12        were also refactored which allows to reduce the the number of
     13        shift/reduce conflicts by 2.
     14
     15        No new tests required as this is just a refactoring, no new
     16        functionality added.
     17
     18        * css/CSSGrammar.y.in:
     19
    1202013-05-28  Sergio Villar Senin  <svillar@igalia.com>
    221
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r150803 r150804  
    8989
    9090#if ENABLE_SHADOW_DOM
    91 %expect 65
     91%expect 63
    9292#else
    93 %expect 64
     93%expect 62
    9494#endif
    9595
     
    429429  ;
    430430
     431closing_parenthesis:
     432    ')'
     433  | %prec LOWEST_PREC TOKEN_EOF
     434  ;
     435
    431436charset:
    432437  CHARSET_SYM maybe_space STRING maybe_space ';' {
     
    15621567
    15631568decl_list_recovery:
    1564     error error_location {
     1569    error error_location error_recovery {
    15651570        parser->syntaxError($2, CSSParser::PropertyDeclarationError);
    15661571    }
    1567     | decl_list_recovery invalid_block
    1568     | decl_list_recovery error
    15691572    ;
    15701573
     
    16191622
    16201623declaration_recovery:
    1621     error error_location {
     1624    error error_location error_recovery {
    16221625        parser->syntaxError($2);
    16231626    }
    1624     | declaration_recovery invalid_block
    1625     | declaration_recovery error
    16261627  ;
    16271628
     
    16551656        }
    16561657    }
    1657     | expr invalid_block_list {
    1658         $$ = 0;
    1659     }
    1660     | expr invalid_block_list error {
    1661         $$ = 0;
    1662     }
    1663     | expr error {
    1664         $$ = 0;
    1665     }
     1658    | expr expr_recovery {
     1659        $$ = 0;
     1660    }
     1661  ;
     1662
     1663expr_recovery:
     1664    error error_location error_recovery
    16661665  ;
    16671666
     
    17551754
    17561755function:
    1757     FUNCTION maybe_space expr ')' maybe_space {
     1756    FUNCTION maybe_space expr closing_parenthesis maybe_space {
    17581757        CSSParserFunction* f = parser->createFloatingFunction();
    17591758        f->name = $1;
     
    17631762        $$.function = f;
    17641763    } |
    1765     FUNCTION maybe_space expr TOKEN_EOF {
    1766         CSSParserFunction* f = parser->createFloatingFunction();
    1767         f->name = $1;
    1768         f->args = parser->sinkFloatingValueList($3);
    1769         $$.id = 0;
    1770         $$.unit = CSSParserValue::Function;
    1771         $$.function = f;
    1772     } |
    1773     FUNCTION maybe_space ')' maybe_space {
     1764    FUNCTION maybe_space closing_parenthesis maybe_space {
    17741765        CSSParserFunction* f = parser->createFloatingFunction();
    17751766        f->name = $1;
     
    17891780  }
    17901781  ;
    1791  
     1782
    17921783calc_func_term:
    17931784  unary_term { $$ = $1; }
     
    19811972    ;
    19821973
     1974error_recovery:
     1975    /* empty */
     1976  | error_recovery invalid_block
     1977  | error_recovery error
     1978    ;
     1979
    19831980%%
    19841981
Note: See TracChangeset for help on using the changeset viewer.