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

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

Issue 14917019: Refactoring CSS grammar (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 3be5c2c9a51e4303e3b4261ec81a4dac65485bc1..f9cd738e00f12c95fb974a0efce3b85bccd5d959 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 35
+%expect 33
%nonassoc LOWEST_PREC
@@ -403,6 +403,11 @@ closing_brace:
| %prec LOWEST_PREC TOKEN_EOF
;
+closing_parenthesis:
+ ')'
+ | %prec LOWEST_PREC TOKEN_EOF
+ ;
+
charset:
CHARSET_SYM maybe_space STRING maybe_space ';' {
if (parser->m_styleSheet)
@@ -1543,11 +1548,9 @@ decl_list:
;
decl_list_recovery:
- error error_location {
+ error error_location error_recovery {
parser->syntaxError($2, CSSParser::PropertyDeclarationError);
}
- | decl_list_recovery invalid_block
- | decl_list_recovery error
;
declaration:
@@ -1598,11 +1601,9 @@ declaration:
;
declaration_recovery:
- error error_location {
+ error error_location error_recovery {
parser->syntaxError($2);
}
- | declaration_recovery invalid_block
- | declaration_recovery error
;
property:
@@ -1634,17 +1635,15 @@ expr:
$$->addValue(parser->sinkFloatingValue($3));
}
}
- | expr invalid_block_list {
- $$ = 0;
- }
- | expr invalid_block_list error {
- $$ = 0;
- }
- | expr error {
+ | expr expr_recovery {
$$ = 0;
}
;
+expr_recovery:
+ error error_location error_recovery
+ ;
+
operator:
'/' maybe_space {
$$ = '/';
@@ -1733,15 +1732,7 @@ unary_term:
;
function:
- FUNCTION maybe_space expr ')' maybe_space {
- CSSParserFunction* f = parser->createFloatingFunction();
- f->name = $1;
- f->args = parser->sinkFloatingValueList($3);
- $$.id = 0;
- $$.unit = CSSParserValue::Function;
- $$.function = f;
- } |
- FUNCTION maybe_space expr TOKEN_EOF {
+ FUNCTION maybe_space expr closing_parenthesis maybe_space {
CSSParserFunction* f = parser->createFloatingFunction();
f->name = $1;
f->args = parser->sinkFloatingValueList($3);
@@ -1749,7 +1740,7 @@ function:
$$.unit = CSSParserValue::Function;
$$.function = f;
} |
- FUNCTION maybe_space ')' maybe_space {
+ FUNCTION maybe_space closing_parenthesis maybe_space {
CSSParserFunction* f = parser->createFloatingFunction();
f->name = $1;
CSSParserValueList* valueList = parser->createFloatingValueList();
@@ -1767,7 +1758,7 @@ function:
$$.function = f;
}
;
-
+
calc_func_term:
unary_term { $$ = $1; }
| VARFUNCTION maybe_space IDENT ')' {
@@ -1963,5 +1954,11 @@ error_location: {
}
;
+error_recovery:
+ /* empty */
+ | error_recovery invalid_block
+ | error_recovery error
+ ;
+
%%
« 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