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

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

Issue 17129003: Auto-closing at unexpected EOF for all entry points. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Patch Set 2 onto master 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
Index: Source/core/css/CSSGrammar.y.in
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index 9a4c5db224f44c570c8b782107d5d87697342248..c9cbca285bf025f50fb2f621b88d5133cf6c9878 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -139,10 +139,10 @@ inline static CSSParserValue makeOperatorValue(int value)
%token INTERNAL_RULE_SYM
%token INTERNAL_SELECTOR_SYM
%token INTERNAL_VALUE_SYM
-%token WEBKIT_KEYFRAME_RULE_SYM
+%token INTERNAL_KEYFRAME_RULE_SYM
+%token INTERNAL_SUPPORTS_CONDITION_SYM
%token WEBKIT_KEYFRAMES_SYM
%token WEBKIT_REGION_RULE_SYM
-%token WEBKIT_SUPPORTS_CONDITION_SYM
%token WEBKIT_FILTER_RULE_SYM
%token <marginBox> TOPLEFTCORNER_SYM
%token <marginBox> TOPLEFT_SYM
@@ -328,36 +328,36 @@ inline static CSSParserValue makeOperatorValue(int value)
stylesheet:
maybe_charset maybe_sgml rule_list
- | internal_decls maybe_space
- | internal_rule maybe_space
- | internal_selector maybe_space
- | internal_value maybe_space
+ | internal_decls
+ | internal_rule
+ | internal_selector
+ | internal_value
| internal_medialist
- | webkit_keyframe_rule maybe_space
- | webkit_supports_condition maybe_space
+ | internal_keyframe_rule
+ | internal_supports_condition
;
internal_rule:
- INTERNAL_RULE_SYM '{' maybe_space valid_rule maybe_space '}' {
- parser->m_rule = $4;
+ INTERNAL_RULE_SYM maybe_space valid_rule maybe_space TOKEN_EOF {
+ parser->m_rule = $3;
}
;
-webkit_keyframe_rule:
- WEBKIT_KEYFRAME_RULE_SYM '{' maybe_space keyframe_rule maybe_space '}' {
- parser->m_keyframe = $4;
+internal_keyframe_rule:
+ INTERNAL_KEYFRAME_RULE_SYM maybe_space keyframe_rule maybe_space TOKEN_EOF {
+ parser->m_keyframe = $3;
}
;
internal_decls:
- INTERNAL_DECLS_SYM '{' maybe_space_before_declaration declaration_list '}' {
+ INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF {
/* can be empty */
}
;
internal_value:
- INTERNAL_VALUE_SYM '{' maybe_space expr '}' {
- parser->m_valueList = parser->sinkFloatingValueList($4);
+ INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF {
+ parser->m_valueList = parser->sinkFloatingValueList($3);
int oldParsedProperties = parser->m_parsedProperties.size();
if (!parser->parseValue(parser->m_id, parser->m_important))
parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
@@ -372,15 +372,15 @@ internal_medialist:
;
internal_selector:
- INTERNAL_SELECTOR_SYM '{' maybe_space selector_list '}' {
+ INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF {
if (parser->m_selectorListForParseSelector)
- parser->m_selectorListForParseSelector->adoptSelectorVector(*$4);
+ parser->m_selectorListForParseSelector->adoptSelectorVector(*$3);
}
;
-webkit_supports_condition:
- WEBKIT_SUPPORTS_CONDITION_SYM '{' maybe_space supports_condition '}' {
- parser->m_supportsCondition = $4;
+internal_supports_condition:
+ INTERNAL_SUPPORTS_CONDITION_SYM maybe_space supports_condition TOKEN_EOF {
+ parser->m_supportsCondition = $3;
}
;
@@ -410,8 +410,18 @@ closing_parenthesis:
| %prec LOWEST_PREC TOKEN_EOF
;
+closing_square_bracket:
+ ']'
+ | %prec LOWEST_PREC TOKEN_EOF
+ ;
+
+semi_or_eof:
+ ';'
+ | TOKEN_EOF
+ ;
+
charset:
- CHARSET_SYM maybe_space STRING maybe_space ';' {
+ CHARSET_SYM maybe_space STRING maybe_space semi_or_eof {
if (parser->m_styleSheet)
parser->m_styleSheet->parserSetEncodingFromCharsetRule($3);
parser->startEndUnknownRule();
@@ -523,10 +533,7 @@ before_import_rule:
;
import:
- before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list ';' {
- $$ = parser->createImportRule($4, $6);
- }
- | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list TOKEN_EOF {
+ before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list semi_or_eof {
$$ = parser->createImportRule($4, $6);
}
| before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list invalid_block {
@@ -546,7 +553,7 @@ before_namespace_rule:
;
namespace:
- before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' {
+ before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space semi_or_eof {
parser->addNamespace($4, $5);
$$ = 0;
}
@@ -703,7 +710,7 @@ media:
| before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space block_rule_body closing_brace {
$$ = parser->createMediaRule(0, $7);
}
- | before_media_rule MEDIA_SYM maybe_space media_list ';' {
+ | before_media_rule MEDIA_SYM maybe_space media_list semi_or_eof {
$$ = 0;
parser->endRuleBody(true);
}
@@ -777,18 +784,18 @@ supports_disjunction:
;
supports_condition_in_parens:
- '(' maybe_space supports_condition ')' maybe_space {
+ '(' maybe_space supports_condition closing_parenthesis maybe_space {
$$ = $3;
}
| supports_declaration_condition
- | '(' error error_location error_recovery ')' maybe_space {
+ | '(' error error_location error_recovery closing_parenthesis maybe_space {
parser->reportError($3, CSSParser::InvalidSupportsConditionError);
$$ = false;
}
;
supports_declaration_condition:
- '(' maybe_space IDENT maybe_space ':' maybe_space expr prio ')' maybe_space {
+ '(' maybe_space IDENT maybe_space ':' maybe_space expr prio closing_parenthesis maybe_space {
$$ = false;
CSSPropertyID id = cssPropertyID($3);
if (id != CSSPropertyInvalid) {
@@ -802,7 +809,7 @@ supports_declaration_condition:
parser->m_valueList = nullptr;
parser->endProperty($8, false);
}
- | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery ')' maybe_space {
+ | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery closing_parenthesis maybe_space {
$$ = false;
parser->endProperty(false, false, CSSParser::GeneralError);
}
@@ -1303,29 +1310,29 @@ attr_name:
;
attrib:
- '[' maybe_space attr_name ']' {
+ '[' maybe_space attr_name closing_square_bracket {
$$ = parser->createFloatingSelector();
$$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
$$->setMatch(CSSSelector::Set);
}
- | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space ']' {
+ | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space closing_square_bracket {
$$ = parser->createFloatingSelector();
$$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
$$->setMatch((CSSSelector::Match)$4);
$$->setValue($6);
}
- | '[' maybe_space namespace_selector attr_name ']' {
+ | '[' maybe_space namespace_selector attr_name closing_square_bracket {
$$ = parser->createFloatingSelector();
$$->setAttribute(parser->determineNameInNamespace($3, $4));
$$->setMatch(CSSSelector::Set);
}
- | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space ']' {
+ | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space closing_square_bracket {
$$ = parser->createFloatingSelector();
$$->setAttribute(parser->determineNameInNamespace($3, $4));
$$->setMatch((CSSSelector::Match)$5);
$$->setValue($7);
}
- | '[' selector_recovery ']' {
+ | '[' selector_recovery closing_square_bracket {
YYERROR;
}
;
@@ -1388,7 +1395,7 @@ pseudo:
YYERROR;
}
// used by ::cue(:past/:future)
- | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' {
+ | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5));
@@ -1397,17 +1404,17 @@ pseudo:
if (type != CSSSelector::PseudoCue)
YYERROR;
}
- | ':' ':' CUEFUNCTION selector_recovery ')' {
+ | ':' ':' CUEFUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
- | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector ')' {
+ | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoElement);
$$->setFunctionArgumentSelector($5);
parser->tokenToLowerCase($3);
$$->setValue($3);
}
- | ':' ':' DISTRIBUTEDFUNCTION selector_recovery ')' {
+ | ':' ':' DISTRIBUTEDFUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
// use by :-webkit-any.
@@ -1415,7 +1422,7 @@ pseudo:
// Use simple_selector_list for now to match -moz-any.
// See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for some
// related discussion with respect to :not.
- | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space ')' {
+ | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4));
@@ -1425,11 +1432,11 @@ pseudo:
if (type != CSSSelector::PseudoAny)
YYERROR;
}
- | ':' ANYFUNCTION selector_recovery ')' {
+ | ':' ANYFUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
// used by :nth-*(ax+b)
- | ':' FUNCTION maybe_space NTH maybe_space ')' {
+ | ':' FUNCTION maybe_space NTH maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->setArgument($4);
@@ -1439,7 +1446,7 @@ pseudo:
YYERROR;
}
// used by :nth-*
- | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space ')' {
+ | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->setArgument(String::number($4 * $5));
@@ -1449,7 +1456,7 @@ pseudo:
YYERROR;
}
// used by :nth-*(odd/even) and :lang
- | ':' FUNCTION maybe_space IDENT maybe_space ')' {
+ | ':' FUNCTION maybe_space IDENT maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->setArgument($4);
@@ -1466,11 +1473,11 @@ pseudo:
YYERROR;
}
}
- | ':' FUNCTION selector_recovery ')' {
+ | ':' FUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
// used by :not
- | ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' {
+ | ':' NOTFUNCTION maybe_space simple_selector maybe_space closing_parenthesis {
if (!$4->isSimple())
YYERROR;
else {
@@ -1485,7 +1492,7 @@ pseudo:
$$->setValue($2);
}
}
- | ':' NOTFUNCTION selector_recovery ')' {
+ | ':' NOTFUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
;
@@ -1814,7 +1821,7 @@ at_rule_header_recovery:
;
at_rule_end:
- at_invalid_rule_header_end ';'
+ at_invalid_rule_header_end semi_or_eof
| at_invalid_rule_header_end invalid_block
;
@@ -1843,8 +1850,7 @@ invalid_block:
;
invalid_square_brackets_block:
- '[' error_recovery ']'
- | '[' error_recovery TOKEN_EOF
+ '[' error_recovery closing_square_bracket
;
invalid_parentheses_block:
« no previous file with comments | « LayoutTests/virtual/gpu/canvas/philip/tests/2d.fillStyle.parse.rgba-eof-expected.txt ('k') | Source/core/css/CSSParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698