CSS rgammar refacoring.
Reducing CSS code duplication in declaration list error recovery.
BUG=140608
Review URL: https://codereview.chromium.org/13986009
git-svn-id: svn://svn.chromium.org/blink/trunk@148974 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index 7fc5abc..a818447 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -1512,19 +1512,11 @@
| decl_list {
$$ = $1;
}
- | errors invalid_block_list error {
+ | errors decl_list_recovery {
parser->syntaxError($1, CSSParser::PropertyDeclarationError);
$$ = false;
}
- | errors {
- parser->syntaxError($1, CSSParser::PropertyDeclarationError);
- $$ = false;
- }
- | decl_list errors {
- parser->syntaxError($2, CSSParser::PropertyDeclarationError);
- $$ = $1;
- }
- | decl_list errors invalid_block_list error {
+ | decl_list errors decl_list_recovery {
parser->syntaxError($2, CSSParser::PropertyDeclarationError);
$$ = $1;
}
@@ -1545,12 +1537,7 @@
parser->startProperty();
$$ = false;
}
- | errors ';' maybe_space {
- parser->syntaxError($1, CSSParser::PropertyDeclarationError);
- parser->startProperty();
- $$ = false;
- }
- | errors invalid_block_list error ';' maybe_space {
+ | errors decl_list_recovery ';' maybe_space {
parser->syntaxError($1, CSSParser::PropertyDeclarationError);
parser->startProperty();
$$ = false;
@@ -1561,16 +1548,16 @@
if ($2)
$$ = $2;
}
- | decl_list errors ';' maybe_space {
+ | decl_list errors decl_list_recovery ';' maybe_space {
parser->syntaxError($2, CSSParser::PropertyDeclarationError);
parser->startProperty();
$$ = $1;
}
- | decl_list errors invalid_block_list error ';' maybe_space {
- parser->syntaxError($2, CSSParser::PropertyDeclarationError);
- parser->startProperty();
- $$ = $1;
- }
+ ;
+
+decl_list_recovery:
+ invalid_block_list error
+ | /* empty */
;
declaration: