Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: Source/core/css/CSSGrammar.y.in

Issue 16387006: Simplifying error recovery in declaration list. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSGrammar.y.in
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index 008756f09231fa0a51fe087b31269f7845bcee65..c8b7fc05d572cafc41812932e04a79c5b58daf6f 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -87,7 +87,7 @@ static inline bool isCSSTokenAString(int yytype)
%}
-%expect 1
+%expect 0
%nonassoc LOWEST_PREC
@@ -1539,12 +1539,6 @@ declaration_list:
| decl_list {
$$ = $1;
}
- | decl_list_recovery {
- $$ = false;
- }
- | decl_list decl_list_recovery {
- $$ = $1;
- }
;
decl_list:
@@ -1552,26 +1546,12 @@ decl_list:
parser->startProperty();
$$ = $1;
}
- | decl_list_recovery ';' maybe_space {
- parser->startProperty();
- $$ = false;
- }
| decl_list declaration ';' maybe_space {
parser->startProperty();
$$ = $1;
if ($2)
$$ = $2;
}
- | decl_list decl_list_recovery ';' maybe_space {
- parser->startProperty();
- $$ = $1;
- }
- ;
-
-decl_list_recovery:
- error error_location error_recovery {
- parser->reportError($2, CSSParser::PropertyDeclarationError);
- }
;
declaration:
@@ -1581,7 +1561,7 @@ declaration:
parser->endProperty($6, true);
}
|
- property ':' maybe_space error_location expr prio {
+ property ':' maybe_space error_location valid_expr prio {
$$ = false;
bool isPropertyParsed = false;
if ($1 && $5) {
@@ -1598,33 +1578,28 @@ declaration:
parser->endProperty($6, isPropertyParsed);
}
|
- property declaration_recovery {
- parser->endProperty(false, false, CSSParser::GeneralError);
+ property ':' maybe_space error_location valid_expr prio error error_recovery {
+ /* When we encounter something like p {color: red !important fail;} we should drop the declaration */
+ parser->reportError($4, CSSParser::InvalidPropertyValueError);
+ parser->endProperty(false, false);
$$ = false;
}
|
- property ':' maybe_space error_location expr prio declaration_recovery {
- /* When we encounter something like p {color: red !important fail;} we should drop the declaration */
+ property ':' maybe_space error_location error error_recovery {
+ parser->reportError($4, CSSParser::InvalidPropertyValueError);
parser->endProperty(false, false);
$$ = false;
}
|
- IMPORTANT_SYM maybe_space declaration_recovery {
- /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */
+ property error error_location error_recovery {
+ parser->reportError($3, CSSParser::PropertyDeclarationError);
parser->endProperty(false, false, CSSParser::GeneralError);
$$ = false;
}
|
- property ':' maybe_space declaration_recovery {
- /* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */
- parser->endProperty(false, false);
- $$ = false;
- }
- ;
-
-declaration_recovery:
error error_location error_recovery {
- parser->reportError($2);
+ parser->reportError($2, CSSParser::PropertyDeclarationError);
+ $$ = false;
}
;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698