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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2012 Intel Corporation. All rights reserved. 6 * Copyright (C) 2012 Intel Corporation. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 %token HOST_SYM 123 %token HOST_SYM
124 %token CHARSET_SYM 124 %token CHARSET_SYM
125 %token NAMESPACE_SYM 125 %token NAMESPACE_SYM
126 %token VARFUNCTION 126 %token VARFUNCTION
127 %token VIEWPORT_RULE_SYM 127 %token VIEWPORT_RULE_SYM
128 %token INTERNAL_DECLS_SYM 128 %token INTERNAL_DECLS_SYM
129 %token INTERNAL_MEDIALIST_SYM 129 %token INTERNAL_MEDIALIST_SYM
130 %token INTERNAL_RULE_SYM 130 %token INTERNAL_RULE_SYM
131 %token INTERNAL_SELECTOR_SYM 131 %token INTERNAL_SELECTOR_SYM
132 %token INTERNAL_VALUE_SYM 132 %token INTERNAL_VALUE_SYM
133 %token WEBKIT_KEYFRAME_RULE_SYM 133 %token INTERNAL_KEYFRAME_RULE_SYM
134 %token INTERNAL_SUPPORTS_CONDITION_SYM
134 %token WEBKIT_KEYFRAMES_SYM 135 %token WEBKIT_KEYFRAMES_SYM
135 %token WEBKIT_REGION_RULE_SYM 136 %token WEBKIT_REGION_RULE_SYM
136 %token WEBKIT_SUPPORTS_CONDITION_SYM
137 %token WEBKIT_FILTER_RULE_SYM 137 %token WEBKIT_FILTER_RULE_SYM
138 %token <marginBox> TOPLEFTCORNER_SYM 138 %token <marginBox> TOPLEFTCORNER_SYM
139 %token <marginBox> TOPLEFT_SYM 139 %token <marginBox> TOPLEFT_SYM
140 %token <marginBox> TOPCENTER_SYM 140 %token <marginBox> TOPCENTER_SYM
141 %token <marginBox> TOPRIGHT_SYM 141 %token <marginBox> TOPRIGHT_SYM
142 %token <marginBox> TOPRIGHTCORNER_SYM 142 %token <marginBox> TOPRIGHTCORNER_SYM
143 %token <marginBox> BOTTOMLEFTCORNER_SYM 143 %token <marginBox> BOTTOMLEFTCORNER_SYM
144 %token <marginBox> BOTTOMLEFT_SYM 144 %token <marginBox> BOTTOMLEFT_SYM
145 %token <marginBox> BOTTOMCENTER_SYM 145 %token <marginBox> BOTTOMCENTER_SYM
146 %token <marginBox> BOTTOMRIGHT_SYM 146 %token <marginBox> BOTTOMRIGHT_SYM
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 %type <string> element_name 313 %type <string> element_name
314 %type <string> attr_name 314 %type <string> attr_name
315 315
316 %type <location> error_location 316 %type <location> error_location
317 317
318 %% 318 %%
319 319
320 stylesheet: 320 stylesheet:
321 maybe_charset maybe_sgml rule_list 321 maybe_charset maybe_sgml rule_list
322 | internal_decls maybe_space 322 | internal_decls
323 | internal_rule maybe_space 323 | internal_rule
324 | internal_selector maybe_space 324 | internal_selector
325 | internal_value maybe_space 325 | internal_value
326 | internal_medialist 326 | internal_medialist
327 | webkit_keyframe_rule maybe_space 327 | internal_keyframe_rule
328 | webkit_supports_condition maybe_space 328 | internal_supports_condition
329 ; 329 ;
330 330
331 internal_rule: 331 internal_rule:
332 INTERNAL_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { 332 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
333 parser->m_rule = $4; 333 parser->m_rule = $3;
334 } 334 }
335 ; 335 ;
336 336
337 webkit_keyframe_rule: 337 internal_keyframe_rule:
338 WEBKIT_KEYFRAME_RULE_SYM '{' maybe_space keyframe_rule maybe_space '}' { 338 INTERNAL_KEYFRAME_RULE_SYM maybe_space keyframe_rule maybe_space TOKEN_EOF {
339 parser->m_keyframe = $4; 339 parser->m_keyframe = $3;
340 } 340 }
341 ; 341 ;
342 342
343 internal_decls: 343 internal_decls:
344 INTERNAL_DECLS_SYM '{' maybe_space_before_declaration declaration_list '}' { 344 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF {
345 /* can be empty */ 345 /* can be empty */
346 } 346 }
347 ; 347 ;
348 348
349 internal_value: 349 internal_value:
350 INTERNAL_VALUE_SYM '{' maybe_space expr '}' { 350 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF {
351 if ($4) { 351 if ($3) {
352 parser->m_valueList = parser->sinkFloatingValueList($4); 352 parser->m_valueList = parser->sinkFloatingValueList($3);
353 int oldParsedProperties = parser->m_parsedProperties.size(); 353 int oldParsedProperties = parser->m_parsedProperties.size();
354 if (!parser->parseValue(parser->m_id, parser->m_important)) 354 if (!parser->parseValue(parser->m_id, parser->m_important))
355 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties); 355 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
356 parser->m_valueList = nullptr; 356 parser->m_valueList = nullptr;
357 } 357 }
358 } 358 }
359 ; 359 ;
360 360
361 internal_medialist: 361 internal_medialist:
362 INTERNAL_MEDIALIST_SYM maybe_space maybe_media_list TOKEN_EOF { 362 INTERNAL_MEDIALIST_SYM maybe_space maybe_media_list TOKEN_EOF {
363 parser->m_mediaList = $3; 363 parser->m_mediaList = $3;
364 } 364 }
365 ; 365 ;
366 366
367 internal_selector: 367 internal_selector:
368 INTERNAL_SELECTOR_SYM '{' maybe_space selector_list '}' { 368 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF {
369 if ($4) { 369 if ($3) {
370 if (parser->m_selectorListForParseSelector) 370 if (parser->m_selectorListForParseSelector)
371 parser->m_selectorListForParseSelector->adoptSelectorVector(*$4) ; 371 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3) ;
372 } 372 }
373 } 373 }
374 ; 374 ;
375 375
376 webkit_supports_condition: 376 internal_supports_condition:
377 WEBKIT_SUPPORTS_CONDITION_SYM '{' maybe_space supports_condition '}' { 377 INTERNAL_SUPPORTS_CONDITION_SYM maybe_space supports_condition TOKEN_EOF {
378 parser->m_supportsCondition = $4; 378 parser->m_supportsCondition = $3;
379 } 379 }
380 ; 380 ;
381 381
382 maybe_space: 382 maybe_space:
383 /* empty */ %prec UNIMPORTANT_TOK 383 /* empty */ %prec UNIMPORTANT_TOK
384 | maybe_space WHITESPACE 384 | maybe_space WHITESPACE
385 ; 385 ;
386 386
387 maybe_sgml: 387 maybe_sgml:
388 /* empty */ 388 /* empty */
(...skipping 10 matching lines...) Expand all
399 closing_brace: 399 closing_brace:
400 '}' 400 '}'
401 | %prec LOWEST_PREC TOKEN_EOF 401 | %prec LOWEST_PREC TOKEN_EOF
402 ; 402 ;
403 403
404 closing_parenthesis: 404 closing_parenthesis:
405 ')' 405 ')'
406 | %prec LOWEST_PREC TOKEN_EOF 406 | %prec LOWEST_PREC TOKEN_EOF
407 ; 407 ;
408 408
409 closing_square_bracket:
410 ']'
411 | %prec LOWEST_PREC TOKEN_EOF
412 ;
413
414 semi_or_eof:
415 ';'
416 | TOKEN_EOF
417 ;
418
409 charset: 419 charset:
410 CHARSET_SYM maybe_space STRING maybe_space ';' { 420 CHARSET_SYM maybe_space STRING maybe_space semi_or_eof {
411 if (parser->m_styleSheet) 421 if (parser->m_styleSheet)
412 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); 422 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3);
413 parser->startEndUnknownRule(); 423 parser->startEndUnknownRule();
414 $$ = 0; 424 $$ = 0;
415 } 425 }
416 | CHARSET_SYM at_rule_recovery { 426 | CHARSET_SYM at_rule_recovery {
417 } 427 }
418 ; 428 ;
419 429
420 rule_list: 430 rule_list:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 515 }
506 ; 516 ;
507 517
508 before_import_rule: 518 before_import_rule:
509 /* empty */ { 519 /* empty */ {
510 parser->startRuleHeader(CSSRuleSourceData::IMPORT_RULE); 520 parser->startRuleHeader(CSSRuleSourceData::IMPORT_RULE);
511 } 521 }
512 ; 522 ;
513 523
514 import: 524 import:
515 before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list ';' { 525 before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list semi_or_eof {
516 $$ = parser->createImportRule($4, $6);
517 }
518 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list TOKEN_EOF {
519 $$ = parser->createImportRule($4, $6); 526 $$ = parser->createImportRule($4, $6);
520 } 527 }
521 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list invalid_block { 528 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri maybe_space maybe_media_list invalid_block {
522 $$ = 0; 529 $$ = 0;
523 parser->endRuleBody(true); 530 parser->endRuleBody(true);
524 } 531 }
525 | before_import_rule IMPORT_SYM at_rule_recovery { 532 | before_import_rule IMPORT_SYM at_rule_recovery {
526 $$ = 0; 533 $$ = 0;
527 parser->endRuleBody(true); 534 parser->endRuleBody(true);
528 } 535 }
529 ; 536 ;
530 537
531 namespace: 538 namespace:
532 NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { 539 NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space semi_or_eof {
533 parser->addNamespace($3, $4); 540 parser->addNamespace($3, $4);
534 $$ = 0; 541 $$ = 0;
535 } 542 }
536 | NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_bl ock { 543 | NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_bl ock {
537 $$ = 0; 544 $$ = 0;
538 } 545 }
539 | NAMESPACE_SYM at_rule_recovery { 546 | NAMESPACE_SYM at_rule_recovery {
540 $$ = 0; 547 $$ = 0;
541 } 548 }
542 ; 549 ;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 685 }
679 ; 686 ;
680 687
681 media: 688 media:
682 before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at _rule_body_start maybe_space block_rule_body closing_brace { 689 before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at _rule_body_start maybe_space block_rule_body closing_brace {
683 $$ = parser->createMediaRule($4, $9); 690 $$ = parser->createMediaRule($4, $9);
684 } 691 }
685 | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_bod y_start maybe_space block_rule_body closing_brace { 692 | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_bod y_start maybe_space block_rule_body closing_brace {
686 $$ = parser->createMediaRule(0, $7); 693 $$ = parser->createMediaRule(0, $7);
687 } 694 }
688 | before_media_rule MEDIA_SYM maybe_space media_list ';' { 695 | before_media_rule MEDIA_SYM maybe_space media_list semi_or_eof {
689 $$ = 0; 696 $$ = 0;
690 parser->endRuleBody(true); 697 parser->endRuleBody(true);
691 } 698 }
692 | before_media_rule MEDIA_SYM at_rule_recovery { 699 | before_media_rule MEDIA_SYM at_rule_recovery {
693 $$ = 0; 700 $$ = 0;
694 parser->endRuleBody(true); 701 parser->endRuleBody(true);
695 } 702 }
696 ; 703 ;
697 704
698 medium: 705 medium:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 supports_disjunction: 759 supports_disjunction:
753 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p arens { 760 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p arens {
754 $$ = $1 || $4; 761 $$ = $1 || $4;
755 } 762 }
756 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens { 763 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens {
757 $$ = $1 || $4; 764 $$ = $1 || $4;
758 } 765 }
759 ; 766 ;
760 767
761 supports_condition_in_parens: 768 supports_condition_in_parens:
762 '(' maybe_space supports_condition ')' maybe_space { 769 '(' maybe_space supports_condition closing_parenthesis maybe_space {
763 $$ = $3; 770 $$ = $3;
764 } 771 }
765 | supports_declaration_condition 772 | supports_declaration_condition
766 | '(' error error_location error_recovery ')' maybe_space { 773 | '(' error error_location error_recovery closing_parenthesis maybe_space {
767 parser->reportError($3, CSSParser::InvalidSupportsConditionError); 774 parser->reportError($3, CSSParser::InvalidSupportsConditionError);
768 $$ = false; 775 $$ = false;
769 } 776 }
770 ; 777 ;
771 778
772 supports_declaration_condition: 779 supports_declaration_condition:
773 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio ')' maybe_space { 780 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio closing_parenthe sis maybe_space {
774 $$ = false; 781 $$ = false;
775 CSSPropertyID id = cssPropertyID($3); 782 CSSPropertyID id = cssPropertyID($3);
776 if (id != CSSPropertyInvalid) { 783 if (id != CSSPropertyInvalid) {
777 parser->m_valueList = parser->sinkFloatingValueList($7); 784 parser->m_valueList = parser->sinkFloatingValueList($7);
778 int oldParsedProperties = parser->m_parsedProperties.size(); 785 int oldParsedProperties = parser->m_parsedProperties.size();
779 $$ = parser->parseValue(id, $8); 786 $$ = parser->parseValue(id, $8);
780 // We just need to know if the declaration is supported as it is wri tten. Rollback any additions. 787 // We just need to know if the declaration is supported as it is wri tten. Rollback any additions.
781 if ($$) 788 if ($$)
782 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties); 789 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
783 } 790 }
784 parser->m_valueList = nullptr; 791 parser->m_valueList = nullptr;
785 parser->endProperty($8, false); 792 parser->endProperty($8, false);
786 } 793 }
787 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery ')' maybe_space { 794 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo sing_parenthesis maybe_space {
788 $$ = false; 795 $$ = false;
789 parser->endProperty(false, false, CSSParser::GeneralError); 796 parser->endProperty(false, false, CSSParser::GeneralError);
790 } 797 }
791 ; 798 ;
792 799
793 before_keyframes_rule: 800 before_keyframes_rule:
794 /* empty */ { 801 /* empty */ {
795 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); 802 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE);
796 } 803 }
797 ; 804 ;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1316
1310 attr_name: 1317 attr_name:
1311 IDENT maybe_space { 1318 IDENT maybe_space {
1312 if (parser->m_context.isHTMLDocument) 1319 if (parser->m_context.isHTMLDocument)
1313 parser->tokenToLowerCase($1); 1320 parser->tokenToLowerCase($1);
1314 $$ = $1; 1321 $$ = $1;
1315 } 1322 }
1316 ; 1323 ;
1317 1324
1318 attrib: 1325 attrib:
1319 '[' maybe_space attr_name ']' { 1326 '[' maybe_space attr_name closing_square_bracket {
1320 $$ = parser->createFloatingSelector(); 1327 $$ = parser->createFloatingSelector();
1321 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); 1328 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
1322 $$->setMatch(CSSSelector::Set); 1329 $$->setMatch(CSSSelector::Set);
1323 } 1330 }
1324 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space '] ' { 1331 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space cl osing_square_bracket {
1325 $$ = parser->createFloatingSelector(); 1332 $$ = parser->createFloatingSelector();
1326 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); 1333 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
1327 $$->setMatch((CSSSelector::Match)$4); 1334 $$->setMatch((CSSSelector::Match)$4);
1328 $$->setValue($6); 1335 $$->setValue($6);
1329 } 1336 }
1330 | '[' maybe_space namespace_selector attr_name ']' { 1337 | '[' maybe_space namespace_selector attr_name closing_square_bracket {
1331 $$ = parser->createFloatingSelector(); 1338 $$ = parser->createFloatingSelector();
1332 $$->setAttribute(parser->determineNameInNamespace($3, $4)); 1339 $$->setAttribute(parser->determineNameInNamespace($3, $4));
1333 $$->setMatch(CSSSelector::Set); 1340 $$->setMatch(CSSSelector::Set);
1334 } 1341 }
1335 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_st ring maybe_space ']' { 1342 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_st ring maybe_space closing_square_bracket {
1336 $$ = parser->createFloatingSelector(); 1343 $$ = parser->createFloatingSelector();
1337 $$->setAttribute(parser->determineNameInNamespace($3, $4)); 1344 $$->setAttribute(parser->determineNameInNamespace($3, $4));
1338 $$->setMatch((CSSSelector::Match)$5); 1345 $$->setMatch((CSSSelector::Match)$5);
1339 $$->setValue($7); 1346 $$->setValue($7);
1340 } 1347 }
1341 | '[' selector_recovery ']' { 1348 | '[' selector_recovery closing_square_bracket {
1342 YYERROR; 1349 YYERROR;
1343 } 1350 }
1344 ; 1351 ;
1345 1352
1346 match: 1353 match:
1347 '=' { 1354 '=' {
1348 $$ = CSSSelector::Exact; 1355 $$ = CSSSelector::Exact;
1349 } 1356 }
1350 | INCLUDES { 1357 | INCLUDES {
1351 $$ = CSSSelector::List; 1358 $$ = CSSSelector::List;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 $$ = parser->createFloatingSelector(); 1401 $$ = parser->createFloatingSelector();
1395 $$->setMatch(CSSSelector::PseudoElement); 1402 $$->setMatch(CSSSelector::PseudoElement);
1396 parser->tokenToLowerCase($3); 1403 parser->tokenToLowerCase($3);
1397 $$->setValue($3); 1404 $$->setValue($3);
1398 // FIXME: This call is needed to force selector to compute the pseudoTyp e early enough. 1405 // FIXME: This call is needed to force selector to compute the pseudoTyp e early enough.
1399 CSSSelector::PseudoType type = $$->pseudoType(); 1406 CSSSelector::PseudoType type = $$->pseudoType();
1400 if (type == CSSSelector::PseudoUnknown) 1407 if (type == CSSSelector::PseudoUnknown)
1401 $$ = 0; 1408 $$ = 0;
1402 } 1409 }
1403 // used by ::cue(:past/:future) 1410 // used by ::cue(:past/:future)
1404 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' { 1411 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_p arenthesis {
1405 if ($5) { 1412 if ($5) {
1406 $$ = parser->createFloatingSelector(); 1413 $$ = parser->createFloatingSelector();
1407 $$->setMatch(CSSSelector::PseudoClass); 1414 $$->setMatch(CSSSelector::PseudoClass);
1408 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); 1415 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5));
1409 $$->setValue($3); 1416 $$->setValue($3);
1410 CSSSelector::PseudoType type = $$->pseudoType(); 1417 CSSSelector::PseudoType type = $$->pseudoType();
1411 if (type != CSSSelector::PseudoCue) 1418 if (type != CSSSelector::PseudoCue)
1412 $$ = 0; 1419 $$ = 0;
1413 } else 1420 } else
1414 $$ = 0; 1421 $$ = 0;
1415 } 1422 }
1416 | ':' ':' CUEFUNCTION selector_recovery ')' { 1423 | ':' ':' CUEFUNCTION selector_recovery closing_parenthesis {
1417 YYERROR; 1424 YYERROR;
1418 } 1425 }
1419 | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector ')' { 1426 | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector closing_parenthe sis {
1420 if (!$5) 1427 if (!$5)
1421 $$ = 0; 1428 $$ = 0;
1422 else { 1429 else {
1423 $$ = parser->createFloatingSelector(); 1430 $$ = parser->createFloatingSelector();
1424 $$->setMatch(CSSSelector::PseudoElement); 1431 $$->setMatch(CSSSelector::PseudoElement);
1425 $$->setFunctionArgumentSelector($5); 1432 $$->setFunctionArgumentSelector($5);
1426 parser->tokenToLowerCase($3); 1433 parser->tokenToLowerCase($3);
1427 $$->setValue($3); 1434 $$->setValue($3);
1428 } 1435 }
1429 } 1436 }
1430 | ':' ':' DISTRIBUTEDFUNCTION selector_recovery ')' { 1437 | ':' ':' DISTRIBUTEDFUNCTION selector_recovery closing_parenthesis {
1431 YYERROR; 1438 YYERROR;
1432 } 1439 }
1433 // use by :-webkit-any. 1440 // use by :-webkit-any.
1434 // FIXME: should we support generic selectors here or just simple_selectors? 1441 // FIXME: should we support generic selectors here or just simple_selectors?
1435 // Use simple_selector_list for now to match -moz-any. 1442 // Use simple_selector_list for now to match -moz-any.
1436 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s ome 1443 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s ome
1437 // related discussion with respect to :not. 1444 // related discussion with respect to :not.
1438 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space ')' { 1445 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space closing_paren thesis {
1439 if ($4) { 1446 if ($4) {
1440 $$ = parser->createFloatingSelector(); 1447 $$ = parser->createFloatingSelector();
1441 $$->setMatch(CSSSelector::PseudoClass); 1448 $$->setMatch(CSSSelector::PseudoClass);
1442 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); 1449 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4));
1443 parser->tokenToLowerCase($2); 1450 parser->tokenToLowerCase($2);
1444 $$->setValue($2); 1451 $$->setValue($2);
1445 CSSSelector::PseudoType type = $$->pseudoType(); 1452 CSSSelector::PseudoType type = $$->pseudoType();
1446 if (type != CSSSelector::PseudoAny) 1453 if (type != CSSSelector::PseudoAny)
1447 $$ = 0; 1454 $$ = 0;
1448 } else 1455 } else
1449 $$ = 0; 1456 $$ = 0;
1450 } 1457 }
1451 | ':' ANYFUNCTION selector_recovery ')' { 1458 | ':' ANYFUNCTION selector_recovery closing_parenthesis {
1452 YYERROR; 1459 YYERROR;
1453 } 1460 }
1454 // used by :nth-*(ax+b) 1461 // used by :nth-*(ax+b)
1455 | ':' FUNCTION maybe_space NTH maybe_space ')' { 1462 | ':' FUNCTION maybe_space NTH maybe_space closing_parenthesis {
1456 $$ = parser->createFloatingSelector(); 1463 $$ = parser->createFloatingSelector();
1457 $$->setMatch(CSSSelector::PseudoClass); 1464 $$->setMatch(CSSSelector::PseudoClass);
1458 $$->setArgument($4); 1465 $$->setArgument($4);
1459 $$->setValue($2); 1466 $$->setValue($2);
1460 CSSSelector::PseudoType type = $$->pseudoType(); 1467 CSSSelector::PseudoType type = $$->pseudoType();
1461 if (type == CSSSelector::PseudoUnknown) 1468 if (type == CSSSelector::PseudoUnknown)
1462 $$ = 0; 1469 $$ = 0;
1463 } 1470 }
1464 // used by :nth-* 1471 // used by :nth-*
1465 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space ')' { 1472 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space closing_ parenthesis {
1466 $$ = parser->createFloatingSelector(); 1473 $$ = parser->createFloatingSelector();
1467 $$->setMatch(CSSSelector::PseudoClass); 1474 $$->setMatch(CSSSelector::PseudoClass);
1468 $$->setArgument(String::number($4 * $5)); 1475 $$->setArgument(String::number($4 * $5));
1469 $$->setValue($2); 1476 $$->setValue($2);
1470 CSSSelector::PseudoType type = $$->pseudoType(); 1477 CSSSelector::PseudoType type = $$->pseudoType();
1471 if (type == CSSSelector::PseudoUnknown) 1478 if (type == CSSSelector::PseudoUnknown)
1472 $$ = 0; 1479 $$ = 0;
1473 } 1480 }
1474 // used by :nth-*(odd/even) and :lang 1481 // used by :nth-*(odd/even) and :lang
1475 | ':' FUNCTION maybe_space IDENT maybe_space ')' { 1482 | ':' FUNCTION maybe_space IDENT maybe_space closing_parenthesis {
1476 $$ = parser->createFloatingSelector(); 1483 $$ = parser->createFloatingSelector();
1477 $$->setMatch(CSSSelector::PseudoClass); 1484 $$->setMatch(CSSSelector::PseudoClass);
1478 $$->setArgument($4); 1485 $$->setArgument($4);
1479 parser->tokenToLowerCase($2); 1486 parser->tokenToLowerCase($2);
1480 $$->setValue($2); 1487 $$->setValue($2);
1481 CSSSelector::PseudoType type = $$->pseudoType(); 1488 CSSSelector::PseudoType type = $$->pseudoType();
1482 if (type == CSSSelector::PseudoUnknown) 1489 if (type == CSSSelector::PseudoUnknown)
1483 $$ = 0; 1490 $$ = 0;
1484 else if (type == CSSSelector::PseudoNthChild || 1491 else if (type == CSSSelector::PseudoNthChild ||
1485 type == CSSSelector::PseudoNthOfType || 1492 type == CSSSelector::PseudoNthOfType ||
1486 type == CSSSelector::PseudoNthLastChild || 1493 type == CSSSelector::PseudoNthLastChild ||
1487 type == CSSSelector::PseudoNthLastOfType) { 1494 type == CSSSelector::PseudoNthLastOfType) {
1488 if (!isValidNthToken($4)) 1495 if (!isValidNthToken($4))
1489 $$ = 0; 1496 $$ = 0;
1490 } 1497 }
1491 } 1498 }
1492 | ':' FUNCTION selector_recovery ')' { 1499 | ':' FUNCTION selector_recovery closing_parenthesis {
1493 YYERROR; 1500 YYERROR;
1494 } 1501 }
1495 // used by :not 1502 // used by :not
1496 | ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' { 1503 | ':' NOTFUNCTION maybe_space simple_selector maybe_space closing_parenthesi s {
1497 if (!$4 || !$4->isSimple()) 1504 if (!$4 || !$4->isSimple())
1498 $$ = 0; 1505 $$ = 0;
1499 else { 1506 else {
1500 $$ = parser->createFloatingSelector(); 1507 $$ = parser->createFloatingSelector();
1501 $$->setMatch(CSSSelector::PseudoClass); 1508 $$->setMatch(CSSSelector::PseudoClass);
1502 1509
1503 Vector<OwnPtr<CSSParserSelector> > selectorVector; 1510 Vector<OwnPtr<CSSParserSelector> > selectorVector;
1504 selectorVector.append(parser->sinkFloatingSelector($4)); 1511 selectorVector.append(parser->sinkFloatingSelector($4));
1505 $$->adoptSelectorVector(selectorVector); 1512 $$->adoptSelectorVector(selectorVector);
1506 1513
1507 parser->tokenToLowerCase($2); 1514 parser->tokenToLowerCase($2);
1508 $$->setValue($2); 1515 $$->setValue($2);
1509 } 1516 }
1510 } 1517 }
1511 | ':' NOTFUNCTION selector_recovery ')' { 1518 | ':' NOTFUNCTION selector_recovery closing_parenthesis {
1512 YYERROR; 1519 YYERROR;
1513 } 1520 }
1514 ; 1521 ;
1515 1522
1516 selector_recovery: 1523 selector_recovery:
1517 error error_location error_recovery; 1524 error error_location error_recovery;
1518 1525
1519 declaration_list: 1526 declaration_list:
1520 /* empty */ { $$ = false; } 1527 /* empty */ { $$ = false; }
1521 | declaration { 1528 | declaration {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 invalid_at: 1874 invalid_at:
1868 ATKEYWORD at_rule_recovery 1875 ATKEYWORD at_rule_recovery
1869 | margin_sym at_rule_recovery 1876 | margin_sym at_rule_recovery
1870 | error CHARSET_SYM at_rule_recovery 1877 | error CHARSET_SYM at_rule_recovery
1871 ; 1878 ;
1872 1879
1873 at_rule_recovery: 1880 at_rule_recovery:
1874 error rule_error_recovery at_rule_end; 1881 error rule_error_recovery at_rule_end;
1875 1882
1876 at_rule_end: 1883 at_rule_end:
1877 at_invalid_rule_header_end ';' 1884 at_invalid_rule_header_end semi_or_eof
1878 | at_invalid_rule_header_end invalid_block 1885 | at_invalid_rule_header_end invalid_block
1879 ; 1886 ;
1880 1887
1881 invalid_rule: 1888 invalid_rule:
1882 error rule_error_recovery at_invalid_rule_header_end invalid_block { 1889 error rule_error_recovery at_invalid_rule_header_end invalid_block {
1883 $$ = 0; 1890 $$ = 0;
1884 } 1891 }
1885 | invalid_at { 1892 | invalid_at {
1886 $$ = 0; 1893 $$ = 0;
1887 } 1894 }
1888 ; 1895 ;
1889 1896
1890 at_invalid_rule_header_end: 1897 at_invalid_rule_header_end:
1891 /* empty */ { 1898 /* empty */ {
1892 parser->endInvalidRuleHeader(); 1899 parser->endInvalidRuleHeader();
1893 } 1900 }
1894 ; 1901 ;
1895 1902
1896 invalid_block: 1903 invalid_block:
1897 '{' error_recovery closing_brace { 1904 '{' error_recovery closing_brace {
1898 parser->invalidBlockHit(); 1905 parser->invalidBlockHit();
1899 } 1906 }
1900 ; 1907 ;
1901 1908
1902 invalid_square_brackets_block: 1909 invalid_square_brackets_block:
1903 '[' error_recovery ']' 1910 '[' error_recovery closing_square_bracket
1904 | '[' error_recovery TOKEN_EOF
1905 ; 1911 ;
1906 1912
1907 invalid_parentheses_block: 1913 invalid_parentheses_block:
1908 opening_parenthesis error_recovery closing_parenthesis; 1914 opening_parenthesis error_recovery closing_parenthesis;
1909 1915
1910 opening_parenthesis: 1916 opening_parenthesis:
1911 '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | AN YFUNCTION | NOTFUNCTION | CUEFUNCTION | DISTRIBUTEDFUNCTION 1917 '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | AN YFUNCTION | NOTFUNCTION | CUEFUNCTION | DISTRIBUTEDFUNCTION
1912 ; 1918 ;
1913 1919
1914 error_location: { 1920 error_location: {
(...skipping 11 matching lines...) Expand all
1926 1932
1927 rule_error_recovery: 1933 rule_error_recovery:
1928 /* empty */ 1934 /* empty */
1929 | rule_error_recovery error 1935 | rule_error_recovery error
1930 | rule_error_recovery invalid_square_brackets_block 1936 | rule_error_recovery invalid_square_brackets_block
1931 | rule_error_recovery invalid_parentheses_block 1937 | rule_error_recovery invalid_parentheses_block
1932 ; 1938 ;
1933 1939
1934 %% 1940 %%
1935 1941
OLDNEW
« 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