OLD | NEW |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 %token HOST_SYM | 132 %token HOST_SYM |
133 %token CHARSET_SYM | 133 %token CHARSET_SYM |
134 %token NAMESPACE_SYM | 134 %token NAMESPACE_SYM |
135 %token VARFUNCTION | 135 %token VARFUNCTION |
136 %token VIEWPORT_RULE_SYM | 136 %token VIEWPORT_RULE_SYM |
137 %token INTERNAL_DECLS_SYM | 137 %token INTERNAL_DECLS_SYM |
138 %token INTERNAL_MEDIALIST_SYM | 138 %token INTERNAL_MEDIALIST_SYM |
139 %token INTERNAL_RULE_SYM | 139 %token INTERNAL_RULE_SYM |
140 %token INTERNAL_SELECTOR_SYM | 140 %token INTERNAL_SELECTOR_SYM |
141 %token INTERNAL_VALUE_SYM | 141 %token INTERNAL_VALUE_SYM |
142 %token WEBKIT_KEYFRAME_RULE_SYM | 142 %token INTERNAL_KEYFRAME_RULE_SYM |
| 143 %token INTERNAL_SUPPORTS_CONDITION_SYM |
143 %token WEBKIT_KEYFRAMES_SYM | 144 %token WEBKIT_KEYFRAMES_SYM |
144 %token WEBKIT_REGION_RULE_SYM | 145 %token WEBKIT_REGION_RULE_SYM |
145 %token WEBKIT_SUPPORTS_CONDITION_SYM | |
146 %token WEBKIT_FILTER_RULE_SYM | 146 %token WEBKIT_FILTER_RULE_SYM |
147 %token <marginBox> TOPLEFTCORNER_SYM | 147 %token <marginBox> TOPLEFTCORNER_SYM |
148 %token <marginBox> TOPLEFT_SYM | 148 %token <marginBox> TOPLEFT_SYM |
149 %token <marginBox> TOPCENTER_SYM | 149 %token <marginBox> TOPCENTER_SYM |
150 %token <marginBox> TOPRIGHT_SYM | 150 %token <marginBox> TOPRIGHT_SYM |
151 %token <marginBox> TOPRIGHTCORNER_SYM | 151 %token <marginBox> TOPRIGHTCORNER_SYM |
152 %token <marginBox> BOTTOMLEFTCORNER_SYM | 152 %token <marginBox> BOTTOMLEFTCORNER_SYM |
153 %token <marginBox> BOTTOMLEFT_SYM | 153 %token <marginBox> BOTTOMLEFT_SYM |
154 %token <marginBox> BOTTOMCENTER_SYM | 154 %token <marginBox> BOTTOMCENTER_SYM |
155 %token <marginBox> BOTTOMRIGHT_SYM | 155 %token <marginBox> BOTTOMRIGHT_SYM |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 %type <string> element_name | 322 %type <string> element_name |
323 %type <string> attr_name | 323 %type <string> attr_name |
324 | 324 |
325 %type <location> error_location | 325 %type <location> error_location |
326 | 326 |
327 %% | 327 %% |
328 | 328 |
329 stylesheet: | 329 stylesheet: |
330 maybe_charset maybe_sgml rule_list | 330 maybe_charset maybe_sgml rule_list |
331 | internal_decls maybe_space | 331 | internal_decls |
332 | internal_rule maybe_space | 332 | internal_rule |
333 | internal_selector maybe_space | 333 | internal_selector |
334 | internal_value maybe_space | 334 | internal_value |
335 | internal_medialist | 335 | internal_medialist |
336 | webkit_keyframe_rule maybe_space | 336 | internal_keyframe_rule |
337 | webkit_supports_condition maybe_space | 337 | internal_supports_condition |
338 ; | 338 ; |
339 | 339 |
340 internal_rule: | 340 internal_rule: |
341 INTERNAL_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { | 341 INTERNAL_RULE_SYM maybe_space valid_rule maybe_space TOKEN_EOF { |
342 parser->m_rule = $4; | 342 parser->m_rule = $3; |
343 } | 343 } |
344 ; | 344 ; |
345 | 345 |
346 webkit_keyframe_rule: | 346 internal_keyframe_rule: |
347 WEBKIT_KEYFRAME_RULE_SYM '{' maybe_space keyframe_rule maybe_space '}' { | 347 INTERNAL_KEYFRAME_RULE_SYM maybe_space keyframe_rule maybe_space TOKEN_EOF { |
348 parser->m_keyframe = $4; | 348 parser->m_keyframe = $3; |
349 } | 349 } |
350 ; | 350 ; |
351 | 351 |
352 internal_decls: | 352 internal_decls: |
353 INTERNAL_DECLS_SYM '{' maybe_space_before_declaration declaration_list '}' { | 353 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF
{ |
354 /* can be empty */ | 354 /* can be empty */ |
355 } | 355 } |
356 ; | 356 ; |
357 | 357 |
358 internal_value: | 358 internal_value: |
359 INTERNAL_VALUE_SYM '{' maybe_space expr '}' { | 359 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { |
360 parser->m_valueList = parser->sinkFloatingValueList($4); | 360 parser->m_valueList = parser->sinkFloatingValueList($3); |
361 int oldParsedProperties = parser->m_parsedProperties.size(); | 361 int oldParsedProperties = parser->m_parsedProperties.size(); |
362 if (!parser->parseValue(parser->m_id, parser->m_important)) | 362 if (!parser->parseValue(parser->m_id, parser->m_important)) |
363 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o
ldParsedProperties); | 363 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o
ldParsedProperties); |
364 parser->m_valueList = nullptr; | 364 parser->m_valueList = nullptr; |
365 } | 365 } |
366 ; | 366 ; |
367 | 367 |
368 internal_medialist: | 368 internal_medialist: |
369 INTERNAL_MEDIALIST_SYM maybe_space maybe_media_list TOKEN_EOF { | 369 INTERNAL_MEDIALIST_SYM maybe_space maybe_media_list TOKEN_EOF { |
370 parser->m_mediaList = $3; | 370 parser->m_mediaList = $3; |
371 } | 371 } |
372 ; | 372 ; |
373 | 373 |
374 internal_selector: | 374 internal_selector: |
375 INTERNAL_SELECTOR_SYM '{' maybe_space selector_list '}' { | 375 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF { |
376 if (parser->m_selectorListForParseSelector) | 376 if (parser->m_selectorListForParseSelector) |
377 parser->m_selectorListForParseSelector->adoptSelectorVector(*$4); | 377 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3); |
378 } | 378 } |
379 ; | 379 ; |
380 | 380 |
381 webkit_supports_condition: | 381 internal_supports_condition: |
382 WEBKIT_SUPPORTS_CONDITION_SYM '{' maybe_space supports_condition '}' { | 382 INTERNAL_SUPPORTS_CONDITION_SYM maybe_space supports_condition TOKEN_EOF { |
383 parser->m_supportsCondition = $4; | 383 parser->m_supportsCondition = $3; |
384 } | 384 } |
385 ; | 385 ; |
386 | 386 |
387 maybe_space: | 387 maybe_space: |
388 /* empty */ %prec UNIMPORTANT_TOK | 388 /* empty */ %prec UNIMPORTANT_TOK |
389 | maybe_space WHITESPACE | 389 | maybe_space WHITESPACE |
390 ; | 390 ; |
391 | 391 |
392 maybe_sgml: | 392 maybe_sgml: |
393 /* empty */ | 393 /* empty */ |
394 | maybe_sgml SGML_CD | 394 | maybe_sgml SGML_CD |
395 | maybe_sgml WHITESPACE | 395 | maybe_sgml WHITESPACE |
396 ; | 396 ; |
397 | 397 |
398 maybe_charset: | 398 maybe_charset: |
399 /* empty */ | 399 /* empty */ |
400 | charset | 400 | charset |
401 ; | 401 ; |
402 | 402 |
403 closing_brace: | 403 closing_brace: |
404 '}' | 404 '}' |
405 | %prec LOWEST_PREC TOKEN_EOF | 405 | %prec LOWEST_PREC TOKEN_EOF |
406 ; | 406 ; |
407 | 407 |
408 closing_parenthesis: | 408 closing_parenthesis: |
409 ')' | 409 ')' |
410 | %prec LOWEST_PREC TOKEN_EOF | 410 | %prec LOWEST_PREC TOKEN_EOF |
411 ; | 411 ; |
412 | 412 |
| 413 closing_square_bracket: |
| 414 ']' |
| 415 | %prec LOWEST_PREC TOKEN_EOF |
| 416 ; |
| 417 |
| 418 semi_or_eof: |
| 419 ';' |
| 420 | TOKEN_EOF |
| 421 ; |
| 422 |
413 charset: | 423 charset: |
414 CHARSET_SYM maybe_space STRING maybe_space ';' { | 424 CHARSET_SYM maybe_space STRING maybe_space semi_or_eof { |
415 if (parser->m_styleSheet) | 425 if (parser->m_styleSheet) |
416 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); | 426 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); |
417 parser->startEndUnknownRule(); | 427 parser->startEndUnknownRule(); |
418 $$ = 0; | 428 $$ = 0; |
419 } | 429 } |
420 | CHARSET_SYM at_rule_recovery { | 430 | CHARSET_SYM at_rule_recovery { |
421 $$ = 0; | 431 $$ = 0; |
422 } | 432 } |
423 ; | 433 ; |
424 | 434 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } | 526 } |
517 ; | 527 ; |
518 | 528 |
519 before_import_rule: | 529 before_import_rule: |
520 /* empty */ { | 530 /* empty */ { |
521 parser->startRuleHeader(CSSRuleSourceData::IMPORT_RULE); | 531 parser->startRuleHeader(CSSRuleSourceData::IMPORT_RULE); |
522 } | 532 } |
523 ; | 533 ; |
524 | 534 |
525 import: | 535 import: |
526 before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri
maybe_space maybe_media_list ';' { | 536 before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri
maybe_space maybe_media_list semi_or_eof { |
527 $$ = parser->createImportRule($4, $6); | |
528 } | |
529 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri
maybe_space maybe_media_list TOKEN_EOF { | |
530 $$ = parser->createImportRule($4, $6); | 537 $$ = parser->createImportRule($4, $6); |
531 } | 538 } |
532 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri
maybe_space maybe_media_list invalid_block { | 539 | before_import_rule IMPORT_SYM at_import_header_end_maybe_space string_or_uri
maybe_space maybe_media_list invalid_block { |
533 $$ = 0; | 540 $$ = 0; |
534 parser->endRuleBody(true); | 541 parser->endRuleBody(true); |
535 } | 542 } |
536 | before_import_rule IMPORT_SYM at_rule_recovery { | 543 | before_import_rule IMPORT_SYM at_rule_recovery { |
537 $$ = 0; | 544 $$ = 0; |
538 parser->endRuleBody(true); | 545 parser->endRuleBody(true); |
539 } | 546 } |
540 ; | 547 ; |
541 | 548 |
542 before_namespace_rule: | 549 before_namespace_rule: |
543 /* empty */ { | 550 /* empty */ { |
544 // FIXME: There should be parser->startRuleHeader. | 551 // FIXME: There should be parser->startRuleHeader. |
545 } | 552 } |
546 ; | 553 ; |
547 | 554 |
548 namespace: | 555 namespace: |
549 before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur
i maybe_space ';' { | 556 before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur
i maybe_space semi_or_eof { |
550 parser->addNamespace($4, $5); | 557 parser->addNamespace($4, $5); |
551 $$ = 0; | 558 $$ = 0; |
552 } | 559 } |
553 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur
i maybe_space invalid_block { | 560 | before_namespace_rule NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_ur
i maybe_space invalid_block { |
554 $$ = 0; | 561 $$ = 0; |
555 } | 562 } |
556 | before_namespace_rule NAMESPACE_SYM at_rule_recovery { | 563 | before_namespace_rule NAMESPACE_SYM at_rule_recovery { |
557 $$ = 0; | 564 $$ = 0; |
558 } | 565 } |
559 ; | 566 ; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 703 } |
697 ; | 704 ; |
698 | 705 |
699 media: | 706 media: |
700 before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at
_rule_body_start maybe_space block_rule_body closing_brace { | 707 before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at
_rule_body_start maybe_space block_rule_body closing_brace { |
701 $$ = parser->createMediaRule($4, $9); | 708 $$ = parser->createMediaRule($4, $9); |
702 } | 709 } |
703 | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_bod
y_start maybe_space block_rule_body closing_brace { | 710 | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_bod
y_start maybe_space block_rule_body closing_brace { |
704 $$ = parser->createMediaRule(0, $7); | 711 $$ = parser->createMediaRule(0, $7); |
705 } | 712 } |
706 | before_media_rule MEDIA_SYM maybe_space media_list ';' { | 713 | before_media_rule MEDIA_SYM maybe_space media_list semi_or_eof { |
707 $$ = 0; | 714 $$ = 0; |
708 parser->endRuleBody(true); | 715 parser->endRuleBody(true); |
709 } | 716 } |
710 | before_media_rule MEDIA_SYM at_rule_recovery { | 717 | before_media_rule MEDIA_SYM at_rule_recovery { |
711 $$ = 0; | 718 $$ = 0; |
712 parser->endRuleBody(true); | 719 parser->endRuleBody(true); |
713 } | 720 } |
714 ; | 721 ; |
715 | 722 |
716 medium: | 723 medium: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 supports_disjunction: | 777 supports_disjunction: |
771 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p
arens { | 778 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p
arens { |
772 $$ = $1 || $4; | 779 $$ = $1 || $4; |
773 } | 780 } |
774 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens
{ | 781 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens
{ |
775 $$ = $1 || $4; | 782 $$ = $1 || $4; |
776 } | 783 } |
777 ; | 784 ; |
778 | 785 |
779 supports_condition_in_parens: | 786 supports_condition_in_parens: |
780 '(' maybe_space supports_condition ')' maybe_space { | 787 '(' maybe_space supports_condition closing_parenthesis maybe_space { |
781 $$ = $3; | 788 $$ = $3; |
782 } | 789 } |
783 | supports_declaration_condition | 790 | supports_declaration_condition |
784 | '(' error error_location error_recovery ')' maybe_space { | 791 | '(' error error_location error_recovery closing_parenthesis maybe_space { |
785 parser->reportError($3, CSSParser::InvalidSupportsConditionError); | 792 parser->reportError($3, CSSParser::InvalidSupportsConditionError); |
786 $$ = false; | 793 $$ = false; |
787 } | 794 } |
788 ; | 795 ; |
789 | 796 |
790 supports_declaration_condition: | 797 supports_declaration_condition: |
791 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio ')' maybe_space
{ | 798 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio closing_parenthe
sis maybe_space { |
792 $$ = false; | 799 $$ = false; |
793 CSSPropertyID id = cssPropertyID($3); | 800 CSSPropertyID id = cssPropertyID($3); |
794 if (id != CSSPropertyInvalid) { | 801 if (id != CSSPropertyInvalid) { |
795 parser->m_valueList = parser->sinkFloatingValueList($7); | 802 parser->m_valueList = parser->sinkFloatingValueList($7); |
796 int oldParsedProperties = parser->m_parsedProperties.size(); | 803 int oldParsedProperties = parser->m_parsedProperties.size(); |
797 $$ = parser->parseValue(id, $8); | 804 $$ = parser->parseValue(id, $8); |
798 // We just need to know if the declaration is supported as it is wri
tten. Rollback any additions. | 805 // We just need to know if the declaration is supported as it is wri
tten. Rollback any additions. |
799 if ($$) | 806 if ($$) |
800 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); | 807 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); |
801 } | 808 } |
802 parser->m_valueList = nullptr; | 809 parser->m_valueList = nullptr; |
803 parser->endProperty($8, false); | 810 parser->endProperty($8, false); |
804 } | 811 } |
805 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery ')'
maybe_space { | 812 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo
sing_parenthesis maybe_space { |
806 $$ = false; | 813 $$ = false; |
807 parser->endProperty(false, false, CSSParser::GeneralError); | 814 parser->endProperty(false, false, CSSParser::GeneralError); |
808 } | 815 } |
809 ; | 816 ; |
810 | 817 |
811 before_keyframes_rule: | 818 before_keyframes_rule: |
812 /* empty */ { | 819 /* empty */ { |
813 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); | 820 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); |
814 } | 821 } |
815 ; | 822 ; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 | 1303 |
1297 attr_name: | 1304 attr_name: |
1298 IDENT maybe_space { | 1305 IDENT maybe_space { |
1299 if (parser->m_context.isHTMLDocument) | 1306 if (parser->m_context.isHTMLDocument) |
1300 parser->tokenToLowerCase($1); | 1307 parser->tokenToLowerCase($1); |
1301 $$ = $1; | 1308 $$ = $1; |
1302 } | 1309 } |
1303 ; | 1310 ; |
1304 | 1311 |
1305 attrib: | 1312 attrib: |
1306 '[' maybe_space attr_name ']' { | 1313 '[' maybe_space attr_name closing_square_bracket { |
1307 $$ = parser->createFloatingSelector(); | 1314 $$ = parser->createFloatingSelector(); |
1308 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); | 1315 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); |
1309 $$->setMatch(CSSSelector::Set); | 1316 $$->setMatch(CSSSelector::Set); |
1310 } | 1317 } |
1311 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space ']
' { | 1318 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space cl
osing_square_bracket { |
1312 $$ = parser->createFloatingSelector(); | 1319 $$ = parser->createFloatingSelector(); |
1313 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); | 1320 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom)); |
1314 $$->setMatch((CSSSelector::Match)$4); | 1321 $$->setMatch((CSSSelector::Match)$4); |
1315 $$->setValue($6); | 1322 $$->setValue($6); |
1316 } | 1323 } |
1317 | '[' maybe_space namespace_selector attr_name ']' { | 1324 | '[' maybe_space namespace_selector attr_name closing_square_bracket { |
1318 $$ = parser->createFloatingSelector(); | 1325 $$ = parser->createFloatingSelector(); |
1319 $$->setAttribute(parser->determineNameInNamespace($3, $4)); | 1326 $$->setAttribute(parser->determineNameInNamespace($3, $4)); |
1320 $$->setMatch(CSSSelector::Set); | 1327 $$->setMatch(CSSSelector::Set); |
1321 } | 1328 } |
1322 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_st
ring maybe_space ']' { | 1329 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_st
ring maybe_space closing_square_bracket { |
1323 $$ = parser->createFloatingSelector(); | 1330 $$ = parser->createFloatingSelector(); |
1324 $$->setAttribute(parser->determineNameInNamespace($3, $4)); | 1331 $$->setAttribute(parser->determineNameInNamespace($3, $4)); |
1325 $$->setMatch((CSSSelector::Match)$5); | 1332 $$->setMatch((CSSSelector::Match)$5); |
1326 $$->setValue($7); | 1333 $$->setValue($7); |
1327 } | 1334 } |
1328 | '[' selector_recovery ']' { | 1335 | '[' selector_recovery closing_square_bracket { |
1329 YYERROR; | 1336 YYERROR; |
1330 } | 1337 } |
1331 ; | 1338 ; |
1332 | 1339 |
1333 match: | 1340 match: |
1334 '=' { | 1341 '=' { |
1335 $$ = CSSSelector::Exact; | 1342 $$ = CSSSelector::Exact; |
1336 } | 1343 } |
1337 | INCLUDES { | 1344 | INCLUDES { |
1338 $$ = CSSSelector::List; | 1345 $$ = CSSSelector::List; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 $$ = parser->createFloatingSelector(); | 1388 $$ = parser->createFloatingSelector(); |
1382 $$->setMatch(CSSSelector::PseudoElement); | 1389 $$->setMatch(CSSSelector::PseudoElement); |
1383 parser->tokenToLowerCase($3); | 1390 parser->tokenToLowerCase($3); |
1384 $$->setValue($3); | 1391 $$->setValue($3); |
1385 // FIXME: This call is needed to force selector to compute the pseudoTyp
e early enough. | 1392 // FIXME: This call is needed to force selector to compute the pseudoTyp
e early enough. |
1386 CSSSelector::PseudoType type = $$->pseudoType(); | 1393 CSSSelector::PseudoType type = $$->pseudoType(); |
1387 if (type == CSSSelector::PseudoUnknown) | 1394 if (type == CSSSelector::PseudoUnknown) |
1388 YYERROR; | 1395 YYERROR; |
1389 } | 1396 } |
1390 // used by ::cue(:past/:future) | 1397 // used by ::cue(:past/:future) |
1391 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' { | 1398 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_p
arenthesis { |
1392 $$ = parser->createFloatingSelector(); | 1399 $$ = parser->createFloatingSelector(); |
1393 $$->setMatch(CSSSelector::PseudoClass); | 1400 $$->setMatch(CSSSelector::PseudoClass); |
1394 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); | 1401 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); |
1395 $$->setValue($3); | 1402 $$->setValue($3); |
1396 CSSSelector::PseudoType type = $$->pseudoType(); | 1403 CSSSelector::PseudoType type = $$->pseudoType(); |
1397 if (type != CSSSelector::PseudoCue) | 1404 if (type != CSSSelector::PseudoCue) |
1398 YYERROR; | 1405 YYERROR; |
1399 } | 1406 } |
1400 | ':' ':' CUEFUNCTION selector_recovery ')' { | 1407 | ':' ':' CUEFUNCTION selector_recovery closing_parenthesis { |
1401 YYERROR; | 1408 YYERROR; |
1402 } | 1409 } |
1403 | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector ')' { | 1410 | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector closing_parenthe
sis { |
1404 $$ = parser->createFloatingSelector(); | 1411 $$ = parser->createFloatingSelector(); |
1405 $$->setMatch(CSSSelector::PseudoElement); | 1412 $$->setMatch(CSSSelector::PseudoElement); |
1406 $$->setFunctionArgumentSelector($5); | 1413 $$->setFunctionArgumentSelector($5); |
1407 parser->tokenToLowerCase($3); | 1414 parser->tokenToLowerCase($3); |
1408 $$->setValue($3); | 1415 $$->setValue($3); |
1409 } | 1416 } |
1410 | ':' ':' DISTRIBUTEDFUNCTION selector_recovery ')' { | 1417 | ':' ':' DISTRIBUTEDFUNCTION selector_recovery closing_parenthesis { |
1411 YYERROR; | 1418 YYERROR; |
1412 } | 1419 } |
1413 // use by :-webkit-any. | 1420 // use by :-webkit-any. |
1414 // FIXME: should we support generic selectors here or just simple_selectors? | 1421 // FIXME: should we support generic selectors here or just simple_selectors? |
1415 // Use simple_selector_list for now to match -moz-any. | 1422 // Use simple_selector_list for now to match -moz-any. |
1416 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s
ome | 1423 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s
ome |
1417 // related discussion with respect to :not. | 1424 // related discussion with respect to :not. |
1418 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space ')' { | 1425 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space closing_paren
thesis { |
1419 $$ = parser->createFloatingSelector(); | 1426 $$ = parser->createFloatingSelector(); |
1420 $$->setMatch(CSSSelector::PseudoClass); | 1427 $$->setMatch(CSSSelector::PseudoClass); |
1421 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); | 1428 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); |
1422 parser->tokenToLowerCase($2); | 1429 parser->tokenToLowerCase($2); |
1423 $$->setValue($2); | 1430 $$->setValue($2); |
1424 CSSSelector::PseudoType type = $$->pseudoType(); | 1431 CSSSelector::PseudoType type = $$->pseudoType(); |
1425 if (type != CSSSelector::PseudoAny) | 1432 if (type != CSSSelector::PseudoAny) |
1426 YYERROR; | 1433 YYERROR; |
1427 } | 1434 } |
1428 | ':' ANYFUNCTION selector_recovery ')' { | 1435 | ':' ANYFUNCTION selector_recovery closing_parenthesis { |
1429 YYERROR; | 1436 YYERROR; |
1430 } | 1437 } |
1431 // used by :nth-*(ax+b) | 1438 // used by :nth-*(ax+b) |
1432 | ':' FUNCTION maybe_space NTH maybe_space ')' { | 1439 | ':' FUNCTION maybe_space NTH maybe_space closing_parenthesis { |
1433 $$ = parser->createFloatingSelector(); | 1440 $$ = parser->createFloatingSelector(); |
1434 $$->setMatch(CSSSelector::PseudoClass); | 1441 $$->setMatch(CSSSelector::PseudoClass); |
1435 $$->setArgument($4); | 1442 $$->setArgument($4); |
1436 $$->setValue($2); | 1443 $$->setValue($2); |
1437 CSSSelector::PseudoType type = $$->pseudoType(); | 1444 CSSSelector::PseudoType type = $$->pseudoType(); |
1438 if (type == CSSSelector::PseudoUnknown) | 1445 if (type == CSSSelector::PseudoUnknown) |
1439 YYERROR; | 1446 YYERROR; |
1440 } | 1447 } |
1441 // used by :nth-* | 1448 // used by :nth-* |
1442 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space ')' { | 1449 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space closing_
parenthesis { |
1443 $$ = parser->createFloatingSelector(); | 1450 $$ = parser->createFloatingSelector(); |
1444 $$->setMatch(CSSSelector::PseudoClass); | 1451 $$->setMatch(CSSSelector::PseudoClass); |
1445 $$->setArgument(String::number($4 * $5)); | 1452 $$->setArgument(String::number($4 * $5)); |
1446 $$->setValue($2); | 1453 $$->setValue($2); |
1447 CSSSelector::PseudoType type = $$->pseudoType(); | 1454 CSSSelector::PseudoType type = $$->pseudoType(); |
1448 if (type == CSSSelector::PseudoUnknown) | 1455 if (type == CSSSelector::PseudoUnknown) |
1449 YYERROR; | 1456 YYERROR; |
1450 } | 1457 } |
1451 // used by :nth-*(odd/even) and :lang | 1458 // used by :nth-*(odd/even) and :lang |
1452 | ':' FUNCTION maybe_space IDENT maybe_space ')' { | 1459 | ':' FUNCTION maybe_space IDENT maybe_space closing_parenthesis { |
1453 $$ = parser->createFloatingSelector(); | 1460 $$ = parser->createFloatingSelector(); |
1454 $$->setMatch(CSSSelector::PseudoClass); | 1461 $$->setMatch(CSSSelector::PseudoClass); |
1455 $$->setArgument($4); | 1462 $$->setArgument($4); |
1456 parser->tokenToLowerCase($2); | 1463 parser->tokenToLowerCase($2); |
1457 $$->setValue($2); | 1464 $$->setValue($2); |
1458 CSSSelector::PseudoType type = $$->pseudoType(); | 1465 CSSSelector::PseudoType type = $$->pseudoType(); |
1459 if (type == CSSSelector::PseudoUnknown) | 1466 if (type == CSSSelector::PseudoUnknown) |
1460 YYERROR; | 1467 YYERROR; |
1461 else if (type == CSSSelector::PseudoNthChild || | 1468 else if (type == CSSSelector::PseudoNthChild || |
1462 type == CSSSelector::PseudoNthOfType || | 1469 type == CSSSelector::PseudoNthOfType || |
1463 type == CSSSelector::PseudoNthLastChild || | 1470 type == CSSSelector::PseudoNthLastChild || |
1464 type == CSSSelector::PseudoNthLastOfType) { | 1471 type == CSSSelector::PseudoNthLastOfType) { |
1465 if (!isValidNthToken($4)) | 1472 if (!isValidNthToken($4)) |
1466 YYERROR; | 1473 YYERROR; |
1467 } | 1474 } |
1468 } | 1475 } |
1469 | ':' FUNCTION selector_recovery ')' { | 1476 | ':' FUNCTION selector_recovery closing_parenthesis { |
1470 YYERROR; | 1477 YYERROR; |
1471 } | 1478 } |
1472 // used by :not | 1479 // used by :not |
1473 | ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' { | 1480 | ':' NOTFUNCTION maybe_space simple_selector maybe_space closing_parenthesi
s { |
1474 if (!$4->isSimple()) | 1481 if (!$4->isSimple()) |
1475 YYERROR; | 1482 YYERROR; |
1476 else { | 1483 else { |
1477 $$ = parser->createFloatingSelector(); | 1484 $$ = parser->createFloatingSelector(); |
1478 $$->setMatch(CSSSelector::PseudoClass); | 1485 $$->setMatch(CSSSelector::PseudoClass); |
1479 | 1486 |
1480 Vector<OwnPtr<CSSParserSelector> > selectorVector; | 1487 Vector<OwnPtr<CSSParserSelector> > selectorVector; |
1481 selectorVector.append(parser->sinkFloatingSelector($4)); | 1488 selectorVector.append(parser->sinkFloatingSelector($4)); |
1482 $$->adoptSelectorVector(selectorVector); | 1489 $$->adoptSelectorVector(selectorVector); |
1483 | 1490 |
1484 parser->tokenToLowerCase($2); | 1491 parser->tokenToLowerCase($2); |
1485 $$->setValue($2); | 1492 $$->setValue($2); |
1486 } | 1493 } |
1487 } | 1494 } |
1488 | ':' NOTFUNCTION selector_recovery ')' { | 1495 | ':' NOTFUNCTION selector_recovery closing_parenthesis { |
1489 YYERROR; | 1496 YYERROR; |
1490 } | 1497 } |
1491 ; | 1498 ; |
1492 | 1499 |
1493 selector_recovery: | 1500 selector_recovery: |
1494 error error_location error_recovery; | 1501 error error_location error_recovery; |
1495 | 1502 |
1496 declaration_list: | 1503 declaration_list: |
1497 /* empty */ { $$ = false; } | 1504 /* empty */ { $$ = false; } |
1498 | declaration { | 1505 | declaration { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 at_rule_header_recovery at_invalid_rule_header_end at_rule_end | 1814 at_rule_header_recovery at_invalid_rule_header_end at_rule_end |
1808 ; | 1815 ; |
1809 | 1816 |
1810 at_rule_header_recovery: | 1817 at_rule_header_recovery: |
1811 error error_location rule_error_recovery { | 1818 error error_location rule_error_recovery { |
1812 parser->reportError($2, CSSParser::InvalidRuleError); | 1819 parser->reportError($2, CSSParser::InvalidRuleError); |
1813 } | 1820 } |
1814 ; | 1821 ; |
1815 | 1822 |
1816 at_rule_end: | 1823 at_rule_end: |
1817 at_invalid_rule_header_end ';' | 1824 at_invalid_rule_header_end semi_or_eof |
1818 | at_invalid_rule_header_end invalid_block | 1825 | at_invalid_rule_header_end invalid_block |
1819 ; | 1826 ; |
1820 | 1827 |
1821 invalid_rule: | 1828 invalid_rule: |
1822 error error_location rule_error_recovery at_invalid_rule_header_end invalid_
block { | 1829 error error_location rule_error_recovery at_invalid_rule_header_end invalid_
block { |
1823 parser->reportError($2, CSSParser::InvalidRuleError); | 1830 parser->reportError($2, CSSParser::InvalidRuleError); |
1824 $$ = 0; | 1831 $$ = 0; |
1825 } | 1832 } |
1826 | error_location invalid_at rule_error_recovery at_invalid_rule_header_end at_
rule_end { | 1833 | error_location invalid_at rule_error_recovery at_invalid_rule_header_end at_
rule_end { |
1827 parser->resumeErrorLogging(); | 1834 parser->resumeErrorLogging(); |
1828 parser->reportError($1, CSSParser::InvalidRuleError); | 1835 parser->reportError($1, CSSParser::InvalidRuleError); |
1829 $$ = 0; | 1836 $$ = 0; |
1830 } | 1837 } |
1831 ; | 1838 ; |
1832 | 1839 |
1833 at_invalid_rule_header_end: | 1840 at_invalid_rule_header_end: |
1834 /* empty */ { | 1841 /* empty */ { |
1835 parser->endInvalidRuleHeader(); | 1842 parser->endInvalidRuleHeader(); |
1836 } | 1843 } |
1837 ; | 1844 ; |
1838 | 1845 |
1839 invalid_block: | 1846 invalid_block: |
1840 '{' error_recovery closing_brace { | 1847 '{' error_recovery closing_brace { |
1841 parser->invalidBlockHit(); | 1848 parser->invalidBlockHit(); |
1842 } | 1849 } |
1843 ; | 1850 ; |
1844 | 1851 |
1845 invalid_square_brackets_block: | 1852 invalid_square_brackets_block: |
1846 '[' error_recovery ']' | 1853 '[' error_recovery closing_square_bracket |
1847 | '[' error_recovery TOKEN_EOF | |
1848 ; | 1854 ; |
1849 | 1855 |
1850 invalid_parentheses_block: | 1856 invalid_parentheses_block: |
1851 opening_parenthesis error_recovery closing_parenthesis; | 1857 opening_parenthesis error_recovery closing_parenthesis; |
1852 | 1858 |
1853 opening_parenthesis: | 1859 opening_parenthesis: |
1854 '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | AN
YFUNCTION | NOTFUNCTION | CUEFUNCTION | DISTRIBUTEDFUNCTION | 1860 '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | AN
YFUNCTION | NOTFUNCTION | CUEFUNCTION | DISTRIBUTEDFUNCTION |
1855 ; | 1861 ; |
1856 | 1862 |
1857 error_location: { | 1863 error_location: { |
(...skipping 11 matching lines...) Expand all Loading... |
1869 | 1875 |
1870 rule_error_recovery: | 1876 rule_error_recovery: |
1871 /* empty */ | 1877 /* empty */ |
1872 | rule_error_recovery error | 1878 | rule_error_recovery error |
1873 | rule_error_recovery invalid_square_brackets_block | 1879 | rule_error_recovery invalid_square_brackets_block |
1874 | rule_error_recovery invalid_parentheses_block | 1880 | rule_error_recovery invalid_parentheses_block |
1875 ; | 1881 ; |
1876 | 1882 |
1877 %% | 1883 %% |
1878 | 1884 |
OLD | NEW |