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

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

Issue 17121007: Cleanup in CSSGrammar.y.in (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 75786d133c70685e6606ac23f93b8346c8e0edf2..5e77a4ec51d4729e28b10d811ed9ec7deeebc5a6 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -235,7 +235,7 @@ inline static CSSParserValue makeOperatorValue(int value)
%type <rule> rule
%type <rule> valid_rule
%type <ruleList> block_rule_body
-%type <ruleList> block_rule_list
+%type <ruleList> block_rule_list
%type <ruleList> region_block_rule_body
%type <ruleList> region_block_rule_list
%type <rule> block_rule
@@ -468,9 +468,9 @@ block_rule_body:
| block_rule_list error error_location rule_error_recovery {
parser->reportError($3, CSSParser::InvalidRuleError);
}
- ;
+ ;
-block_rule_list:
+block_rule_list:
/* empty */ { $$ = 0; }
| block_rule_list block_rule maybe_sgml {
$$ = $1;
@@ -568,7 +568,7 @@ namespace:
maybe_ns_prefix:
/* empty */ { $$.clear(); }
-| IDENT maybe_space { $$ = $1; }
+| IDENT maybe_space
;
string_or_uri:
@@ -719,9 +719,7 @@ media:
;
medium:
- IDENT maybe_space {
- $$ = $1;
- }
+ IDENT maybe_space
;
supports:
@@ -828,7 +826,7 @@ keyframes:
parser->endRuleBody(true);
}
;
-
+
keyframe_name:
IDENT
| STRING
@@ -922,15 +920,12 @@ page_selector:
}
| IDENT pseudo_page maybe_space {
$$ = $2;
- if ($$) {
- $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_defaultNamespace));
- $$->setForPage();
- }
+ $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_defaultNamespace));
+ $$->setForPage();
}
| pseudo_page maybe_space {
$$ = $1;
- if ($$)
- $$->setForPage();
+ $$->setForPage();
}
| /* empty */ {
$$ = parser->createFloatingSelector();
@@ -1104,8 +1099,8 @@ combinator:
;
maybe_unary_operator:
- unary_operator { $$ = $1; }
- | { $$ = 1; }
+ unary_operator
+ | /* empty */ { $$ = 1; }
;
unary_operator:
@@ -1199,9 +1194,9 @@ selector:
namespace_selector:
/* empty */ '|' { $$.clear(); }
| '*' '|' { static LChar star = '*'; $$.init(&star, 1); }
- | IDENT '|' { $$ = $1; }
-;
-
+ | IDENT '|'
+ ;
+
simple_selector:
element_name {
$$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $1, parser->m_defaultNamespace));
@@ -1257,9 +1252,7 @@ element_name:
;
specifier_list:
- specifier {
- $$ = $1;
- }
+ specifier
| specifier_list specifier {
$$ = parser->rewriteSpecifiers($1, $2);
}
@@ -1500,17 +1493,11 @@ selector_recovery:
declaration_list:
/* empty */ { $$ = false; }
- | declaration {
- $$ = $1;
- }
+ | declaration
| decl_list declaration {
- $$ = $1;
- if ( $2 )
- $$ = $2;
- }
- | decl_list {
- $$ = $1;
+ $$ = $1 || $2;
}
+ | decl_list
;
decl_list:
@@ -1520,9 +1507,7 @@ decl_list:
}
| decl_list declaration ';' maybe_space {
parser->startProperty();
- $$ = $1;
- if ($2)
- $$ = $2;
+ $$ = $1 || $2;
}
;
@@ -1596,10 +1581,13 @@ expr:
}
| expr operator term {
$$ = $1;
- if ($2)
- $$->addValue(makeOperatorValue($2));
+ $$->addValue(makeOperatorValue($2));
$$->addValue(parser->sinkFloatingValue($3));
}
+ | expr term {
+ $$ = $1;
+ $$->addValue(parser->sinkFloatingValue($2));
+ }
;
expr_recovery:
@@ -1615,13 +1603,10 @@ operator:
| ',' maybe_space {
$$ = ',';
}
- | /* empty */ {
- $$ = 0;
- }
;
term:
- unary_term maybe_space { $$ = $1; }
+ unary_term maybe_space
| unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; }
| STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_STRING; }
| IDENT maybe_space {
@@ -1645,15 +1630,9 @@ term:
YYERROR;
}
/* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
- | function maybe_space {
- $$ = $1;
- }
- | calc_function maybe_space {
- $$ = $1;
- }
- | min_or_max_function maybe_space {
- $$ = $1;
- }
+ | function maybe_space
+ | calc_function maybe_space
+ | min_or_max_function maybe_space
| '%' maybe_space { /* Handle width: %; */
$$.id = CSSValueInvalid; $$.unit = 0;
}
@@ -1709,7 +1688,7 @@ function:
;
calc_func_term:
- unary_term { $$ = $1; }
+ unary_term
| VARFUNCTION maybe_space IDENT closing_parenthesis {
$$.id = CSSValueInvalid;
$$.string = $3;
@@ -1768,9 +1747,7 @@ calc_func_expr:
;
calc_func_expr_list:
- calc_func_expr calc_maybe_space {
- $$ = $1;
- }
+ calc_func_expr calc_maybe_space
| calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
$$ = $1;
$$->addValue(makeOperatorValue(','));
@@ -1789,18 +1766,14 @@ calc_function:
min_or_max:
- MINFUNCTION {
- $$ = $1;
- }
- | MAXFUNCTION {
- $$ = $1;
- }
+ MINFUNCTION
+ | MAXFUNCTION
;
min_or_max_function:
min_or_max maybe_space calc_func_expr_list closing_parenthesis {
$$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloatingValueList($3)));
- }
+ }
| min_or_max maybe_space expr_recovery closing_parenthesis {
YYERROR;
}
@@ -1808,7 +1781,7 @@ min_or_max_function:
invalid_at:
ATKEYWORD
- | margin_sym
+ | margin_sym
;
at_rule_recovery:
« 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