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

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 77d56691c27d12b5653215bc4bdbf322931767f0..87c6866b715979879f42ee4e5375dd9bda859f9b 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -234,7 +234,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
@@ -467,12 +467,12 @@ 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;
+ $$ = 1;
apavlov 2013/06/19 14:02:19 $1, not 1
SeRya 2013/06/19 14:07:01 Done.
if ($2) {
if (!$$)
$$ = parser->createRuleList();
@@ -491,7 +491,6 @@ region_block_rule_body:
region_block_rule_list:
/* empty */ { $$ = 0; }
| region_block_rule_list block_valid_rule maybe_sgml {
- $$ = $1;
if ($2) {
if (!$$)
$$ = parser->createRuleList();
@@ -567,7 +566,7 @@ namespace:
maybe_ns_prefix:
/* empty */ { $$.clear(); }
-| IDENT maybe_space { $$ = $1; }
+| IDENT maybe_space
;
string_or_uri:
@@ -662,7 +661,7 @@ media_list:
$$->addMediaQuery(parser->sinkFloatingMediaQuery($1));
}
| mq_list media_query {
- $$ = $1;
+ $$ = 1;
apavlov 2013/06/19 14:02:19 ditto
SeRya 2013/06/19 14:07:01 Done.
$$->addMediaQuery(parser->sinkFloatingMediaQuery($2));
}
| mq_list {
@@ -718,9 +717,7 @@ media:
;
medium:
- IDENT maybe_space {
- $$ = $1;
- }
+ IDENT maybe_space
;
supports:
@@ -827,7 +824,7 @@ keyframes:
parser->endRuleBody(true);
}
;
-
+
keyframe_name:
IDENT
| STRING
@@ -921,15 +918,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();
@@ -1103,7 +1097,7 @@ combinator:
;
maybe_unary_operator:
- unary_operator { $$ = $1; }
+ unary_operator
| { $$ = 1; }
;
@@ -1198,9 +1192,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));
@@ -1256,9 +1250,7 @@ element_name:
;
specifier_list:
- specifier {
- $$ = $1;
- }
+ specifier
| specifier_list specifier {
$$ = parser->rewriteSpecifiers($1, $2);
}
@@ -1499,17 +1491,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:
@@ -1519,9 +1505,7 @@ decl_list:
}
| decl_list declaration ';' maybe_space {
parser->startProperty();
- $$ = $1;
- if ($2)
- $$ = $2;
+ $$ = $1 || $2;
}
;
@@ -1595,10 +1579,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:
@@ -1614,13 +1601,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 {
@@ -1641,15 +1625,9 @@ term:
$$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
}
/* 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;
}
@@ -1705,7 +1683,7 @@ function:
;
calc_func_term:
- unary_term { $$ = $1; }
+ unary_term
| VARFUNCTION maybe_space IDENT closing_parenthesis {
$$.id = CSSValueInvalid;
$$.string = $3;
@@ -1764,9 +1742,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(','));
@@ -1785,18 +1761,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;
}
@@ -1804,7 +1776,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