Chromium Code Reviews| Index: Source/core/css/CSSGrammar.y.in |
| diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in |
| index a476ac48a46efa08c114137e585c3d6086dc7eaf..ac1fbeced58904a539cd25f7f026910b3e49dc31 100644 |
| --- a/Source/core/css/CSSGrammar.y.in |
| +++ b/Source/core/css/CSSGrammar.y.in |
| @@ -130,10 +130,10 @@ static inline bool isCSSTokenAString(int yytype) |
| %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 |
| @@ -319,37 +319,37 @@ static inline bool isCSSTokenAString(int yytype) |
| 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 { |
|
SeRya
2013/06/16 09:52:37
Wouldn't it work equally fine without TOKEN_EOF at
|
| + 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 '}' { |
| - if ($4) { |
| - parser->m_valueList = parser->sinkFloatingValueList($4); |
| + INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { |
| + if ($3) { |
| + 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); |
| @@ -365,17 +365,17 @@ internal_medialist: |
| ; |
| internal_selector: |
| - INTERNAL_SELECTOR_SYM '{' maybe_space selector_list '}' { |
| - if ($4) { |
| + INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF { |
| + if ($3) { |
| 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; |
| } |
| ; |
| @@ -406,8 +406,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(); |
| @@ -512,10 +522,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 { |
| @@ -529,7 +536,7 @@ import: |
| ; |
| namespace: |
| -NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { |
| +NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space semi_or_eof { |
| parser->addNamespace($3, $4); |
| $$ = 0; |
| } |
| @@ -685,7 +692,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); |
| } |
| @@ -759,18 +766,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) { |
| @@ -784,7 +791,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); |
| } |
| @@ -1316,29 +1323,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; |
| } |
| ; |
| @@ -1401,7 +1408,7 @@ pseudo: |
| $$ = 0; |
| } |
| // used by ::cue(:past/:future) |
| - | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' { |
| + | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis { |
| if ($5) { |
| $$ = parser->createFloatingSelector(); |
| $$->setMatch(CSSSelector::PseudoClass); |
| @@ -1413,10 +1420,10 @@ pseudo: |
| } else |
| $$ = 0; |
| } |
| - | ':' ':' CUEFUNCTION selector_recovery ')' { |
| + | ':' ':' CUEFUNCTION selector_recovery closing_parenthesis { |
| YYERROR; |
| } |
| - | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector ')' { |
| + | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector closing_parenthesis { |
| if (!$5) |
| $$ = 0; |
| else { |
| @@ -1427,7 +1434,7 @@ pseudo: |
| $$->setValue($3); |
| } |
| } |
| - | ':' ':' DISTRIBUTEDFUNCTION selector_recovery ')' { |
| + | ':' ':' DISTRIBUTEDFUNCTION selector_recovery closing_parenthesis { |
| YYERROR; |
| } |
| // use by :-webkit-any. |
| @@ -1435,7 +1442,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 { |
| if ($4) { |
| $$ = parser->createFloatingSelector(); |
| $$->setMatch(CSSSelector::PseudoClass); |
| @@ -1448,11 +1455,11 @@ pseudo: |
| } else |
| $$ = 0; |
| } |
| - | ':' 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); |
| @@ -1462,7 +1469,7 @@ pseudo: |
| $$ = 0; |
| } |
| // 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)); |
| @@ -1472,7 +1479,7 @@ pseudo: |
| $$ = 0; |
| } |
| // 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); |
| @@ -1489,11 +1496,11 @@ pseudo: |
| $$ = 0; |
| } |
| } |
| - | ':' 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 || !$4->isSimple()) |
| $$ = 0; |
| else { |
| @@ -1508,7 +1515,7 @@ pseudo: |
| $$->setValue($2); |
| } |
| } |
| - | ':' NOTFUNCTION selector_recovery ')' { |
| + | ':' NOTFUNCTION selector_recovery closing_parenthesis { |
| YYERROR; |
| } |
| ; |
| @@ -1874,7 +1881,7 @@ at_rule_recovery: |
| error rule_error_recovery at_rule_end; |
| at_rule_end: |
| - at_invalid_rule_header_end ';' |
| + at_invalid_rule_header_end semi_or_eof |
| | at_invalid_rule_header_end invalid_block |
| ; |
| @@ -1900,8 +1907,7 @@ invalid_block: |
| ; |
| invalid_square_brackets_block: |
| - '[' error_recovery ']' |
| - | '[' error_recovery TOKEN_EOF |
| + '[' error_recovery closing_square_bracket |
| ; |
| invalid_parentheses_block: |