| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 case VAR_DEFINITION: | 80 case VAR_DEFINITION: |
| 81 case UNICODERANGE: | 81 case UNICODERANGE: |
| 82 return true; | 82 return true; |
| 83 default: | 83 default: |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 %} | 88 %} |
| 89 | 89 |
| 90 %expect 35 | 90 %expect 34 |
| 91 | 91 |
| 92 %nonassoc LOWEST_PREC | 92 %nonassoc LOWEST_PREC |
| 93 | 93 |
| 94 %left UNIMPORTANT_TOK | 94 %left UNIMPORTANT_TOK |
| 95 | 95 |
| 96 %token WHITESPACE SGML_CD | 96 %token WHITESPACE SGML_CD |
| 97 %token TOKEN_EOF 0 | 97 %token TOKEN_EOF 0 |
| 98 | 98 |
| 99 %token INCLUDES | 99 %token INCLUDES |
| 100 %token DASHMATCH | 100 %token DASHMATCH |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 %type <boolean> declarations_and_margins | 293 %type <boolean> declarations_and_margins |
| 294 | 294 |
| 295 %type <boolean> prio | 295 %type <boolean> prio |
| 296 | 296 |
| 297 %type <integer> match | 297 %type <integer> match |
| 298 %type <integer> unary_operator | 298 %type <integer> unary_operator |
| 299 %type <integer> maybe_unary_operator | 299 %type <integer> maybe_unary_operator |
| 300 %type <character> operator | 300 %type <character> operator |
| 301 | 301 |
| 302 %type <valueList> expr | 302 %type <valueList> expr |
| 303 %type <valueList> valid_expr |
| 303 %type <value> term | 304 %type <value> term |
| 304 %type <value> unary_term | 305 %type <value> unary_term |
| 305 %type <value> function | 306 %type <value> function |
| 306 %type <value> calc_func_term | 307 %type <value> calc_func_term |
| 307 %type <character> calc_func_operator | 308 %type <character> calc_func_operator |
| 308 %type <valueList> calc_func_expr | 309 %type <valueList> calc_func_expr |
| 309 %type <valueList> calc_func_expr_list | 310 %type <valueList> calc_func_expr_list |
| 310 %type <valueList> calc_func_paren_expr | 311 %type <valueList> calc_func_paren_expr |
| 311 %type <value> calc_function | 312 %type <value> calc_function |
| 312 %type <string> min_or_max | 313 %type <string> min_or_max |
| (...skipping 11 matching lines...) Expand all Loading... |
| 324 | internal_decls maybe_space | 325 | internal_decls maybe_space |
| 325 | internal_rule maybe_space | 326 | internal_rule maybe_space |
| 326 | internal_selector maybe_space | 327 | internal_selector maybe_space |
| 327 | internal_value maybe_space | 328 | internal_value maybe_space |
| 328 | webkit_mediaquery maybe_space | 329 | webkit_mediaquery maybe_space |
| 329 | webkit_keyframe_rule maybe_space | 330 | webkit_keyframe_rule maybe_space |
| 330 | webkit_supports_condition maybe_space | 331 | webkit_supports_condition maybe_space |
| 331 ; | 332 ; |
| 332 | 333 |
| 333 internal_rule: | 334 internal_rule: |
| 334 INTERNAL_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { | 335 INTERNAL_RULE_SYM '{' maybe_space valid_rule maybe_space closing_brace { |
| 335 parser->m_rule = $4; | 336 parser->m_rule = $4; |
| 336 } | 337 } |
| 337 ; | 338 ; |
| 338 | 339 |
| 339 webkit_keyframe_rule: | 340 webkit_keyframe_rule: |
| 340 WEBKIT_KEYFRAME_RULE_SYM '{' maybe_space keyframe_rule maybe_space '}' { | 341 WEBKIT_KEYFRAME_RULE_SYM '{' maybe_space keyframe_rule maybe_space closing_b
race{ |
| 341 parser->m_keyframe = $4; | 342 parser->m_keyframe = $4; |
| 342 } | 343 } |
| 343 ; | 344 ; |
| 344 | 345 |
| 345 internal_decls: | 346 internal_decls: |
| 346 INTERNAL_DECLS_SYM '{' maybe_space_before_declaration declaration_list '}' { | 347 INTERNAL_DECLS_SYM '{' maybe_space_before_declaration declaration_list closi
ng_brace { |
| 347 /* can be empty */ | 348 /* can be empty */ |
| 348 } | 349 } |
| 349 ; | 350 ; |
| 350 | 351 |
| 351 internal_value: | 352 internal_value: |
| 352 INTERNAL_VALUE_SYM '{' maybe_space expr '}' { | 353 INTERNAL_VALUE_SYM '{' maybe_space expr closing_brace { |
| 353 if ($4) { | 354 if ($4) { |
| 354 parser->m_valueList = parser->sinkFloatingValueList($4); | 355 parser->m_valueList = parser->sinkFloatingValueList($4); |
| 355 int oldParsedProperties = parser->m_parsedProperties.size(); | 356 int oldParsedProperties = parser->m_parsedProperties.size(); |
| 356 if (!parser->parseValue(parser->m_id, parser->m_important)) | 357 if (!parser->parseValue(parser->m_id, parser->m_important)) |
| 357 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); | 358 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); |
| 358 parser->m_valueList = nullptr; | 359 parser->m_valueList = nullptr; |
| 359 } | 360 } |
| 360 } | 361 } |
| 361 ; | 362 ; |
| 362 | 363 |
| 363 webkit_mediaquery: | 364 webkit_mediaquery: |
| 364 WEBKIT_MEDIAQUERY_SYM WHITESPACE maybe_space media_query '}' { | 365 WEBKIT_MEDIAQUERY_SYM WHITESPACE maybe_space media_query closing_brace { |
| 365 parser->m_mediaQuery = parser->sinkFloatingMediaQuery($4); | 366 parser->m_mediaQuery = parser->sinkFloatingMediaQuery($4); |
| 366 } | 367 } |
| 367 ; | 368 ; |
| 368 | 369 |
| 369 internal_selector: | 370 internal_selector: |
| 370 INTERNAL_SELECTOR_SYM '{' maybe_space selector_list '}' { | 371 INTERNAL_SELECTOR_SYM '{' maybe_space selector_list closing_brace { |
| 371 if ($4) { | 372 if ($4) { |
| 372 if (parser->m_selectorListForParseSelector) | 373 if (parser->m_selectorListForParseSelector) |
| 373 parser->m_selectorListForParseSelector->adoptSelectorVector(*$4)
; | 374 parser->m_selectorListForParseSelector->adoptSelectorVector(*$4)
; |
| 374 } | 375 } |
| 375 } | 376 } |
| 376 ; | 377 ; |
| 377 | 378 |
| 378 webkit_supports_condition: | 379 webkit_supports_condition: |
| 379 WEBKIT_SUPPORTS_CONDITION_SYM '{' maybe_space supports_condition '}' { | 380 WEBKIT_SUPPORTS_CONDITION_SYM '{' maybe_space supports_condition closing_bra
ce { |
| 380 parser->m_supportsCondition = $4; | 381 parser->m_supportsCondition = $4; |
| 381 } | 382 } |
| 382 ; | 383 ; |
| 383 | 384 |
| 384 maybe_space: | 385 maybe_space: |
| 385 /* empty */ %prec UNIMPORTANT_TOK | 386 /* empty */ %prec UNIMPORTANT_TOK |
| 386 | maybe_space WHITESPACE | 387 | maybe_space WHITESPACE |
| 387 ; | 388 ; |
| 388 | 389 |
| 389 maybe_sgml: | 390 maybe_sgml: |
| 390 /* empty */ | 391 /* empty */ |
| 391 | maybe_sgml SGML_CD | 392 | maybe_sgml SGML_CD |
| 392 | maybe_sgml WHITESPACE | 393 | maybe_sgml WHITESPACE |
| 393 ; | 394 ; |
| 394 | 395 |
| 395 maybe_charset: | 396 maybe_charset: |
| 396 /* empty */ | 397 /* empty */ |
| 397 | charset { | 398 | charset { |
| 398 } | 399 } |
| 399 ; | 400 ; |
| 400 | 401 |
| 401 closing_brace: | 402 closing_brace: |
| 402 '}' | 403 '}' |
| 403 | %prec LOWEST_PREC TOKEN_EOF | 404 | %prec LOWEST_PREC TOKEN_EOF |
| 404 ; | 405 ; |
| 405 | 406 |
| 407 closing_parenthesis: |
| 408 ')' |
| 409 | %prec LOWEST_PREC TOKEN_EOF |
| 410 ; |
| 411 |
| 406 charset: | 412 charset: |
| 407 CHARSET_SYM maybe_space STRING maybe_space ';' { | 413 CHARSET_SYM maybe_space STRING maybe_space ';' { |
| 408 if (parser->m_styleSheet) | 414 if (parser->m_styleSheet) |
| 409 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); | 415 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); |
| 410 parser->startEndUnknownRule(); | 416 parser->startEndUnknownRule(); |
| 411 $$ = 0; | 417 $$ = 0; |
| 412 } | 418 } |
| 413 | CHARSET_SYM error invalid_block { | 419 | CHARSET_SYM error invalid_block { |
| 414 } | 420 } |
| 415 | CHARSET_SYM error ';' { | 421 | CHARSET_SYM error ';' { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 maybe_media_value: | 581 maybe_media_value: |
| 576 /*empty*/ { | 582 /*empty*/ { |
| 577 $$ = 0; | 583 $$ = 0; |
| 578 } | 584 } |
| 579 | ':' maybe_space expr maybe_space { | 585 | ':' maybe_space expr maybe_space { |
| 580 $$ = $3; | 586 $$ = $3; |
| 581 } | 587 } |
| 582 ; | 588 ; |
| 583 | 589 |
| 584 media_query_exp: | 590 media_query_exp: |
| 585 maybe_media_restrictor maybe_space '(' maybe_space media_feature maybe_space
maybe_media_value ')' maybe_space { | 591 maybe_media_restrictor maybe_space '(' maybe_space media_feature maybe_space
maybe_media_value closing_parenthesis maybe_space { |
| 586 // If restrictor is specified, media query expression is invalid. | 592 // If restrictor is specified, media query expression is invalid. |
| 587 // Create empty media query expression and continue parsing media query. | 593 // Create empty media query expression and continue parsing media query. |
| 588 if ($1 != MediaQuery::None) | 594 if ($1 != MediaQuery::None) |
| 589 $$ = parser->createFloatingMediaQueryExp("", 0); | 595 $$ = parser->createFloatingMediaQueryExp("", 0); |
| 590 else { | 596 else { |
| 591 $5.lower(); | 597 $5.lower(); |
| 592 $$ = parser->createFloatingMediaQueryExp($5, $7); | 598 $$ = parser->createFloatingMediaQueryExp($5, $7); |
| 593 } | 599 } |
| 594 } | 600 } |
| 595 ; | 601 ; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 supports_disjunction: | 762 supports_disjunction: |
| 757 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p
arens { | 763 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p
arens { |
| 758 $$ = $1 || $4; | 764 $$ = $1 || $4; |
| 759 } | 765 } |
| 760 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens
{ | 766 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens
{ |
| 761 $$ = $1 || $4; | 767 $$ = $1 || $4; |
| 762 } | 768 } |
| 763 ; | 769 ; |
| 764 | 770 |
| 765 supports_condition_in_parens: | 771 supports_condition_in_parens: |
| 766 '(' maybe_space supports_condition ')' maybe_space { | 772 '(' maybe_space supports_condition closing_parenthesis maybe_space { |
| 767 $$ = $3; | 773 $$ = $3; |
| 768 } | 774 } |
| 769 | supports_declaration_condition | 775 | supports_declaration_condition |
| 770 | '(' error ')' { | 776 | '(' error closing_parenthesis { |
| 771 $$ = false; | 777 $$ = false; |
| 772 } | 778 } |
| 773 ; | 779 ; |
| 774 | 780 |
| 775 supports_declaration_condition: | 781 supports_declaration_condition: |
| 776 '(' maybe_space property ':' maybe_space expr prio ')' maybe_space { | 782 '(' maybe_space property ':' maybe_space expr prio closing_parenthesis maybe
_space { |
| 777 $$ = false; | 783 $$ = false; |
| 778 CSSParser* p = static_cast<CSSParser*>(parser); | 784 CSSParser* p = static_cast<CSSParser*>(parser); |
| 779 if ($3 && $6) { | 785 if ($3 && $6) { |
| 780 p->m_valueList = p->sinkFloatingValueList($6); | 786 p->m_valueList = p->sinkFloatingValueList($6); |
| 781 int oldParsedProperties = p->m_parsedProperties.size(); | 787 int oldParsedProperties = p->m_parsedProperties.size(); |
| 782 $$ = p->parseValue(static_cast<CSSPropertyID>($3), $7); | 788 $$ = p->parseValue(static_cast<CSSPropertyID>($3), $7); |
| 783 // We just need to know if the declaration is supported as it is wri
tten. Rollback any additions. | 789 // We just need to know if the declaration is supported as it is wri
tten. Rollback any additions. |
| 784 if ($$) | 790 if ($$) |
| 785 p->rollbackLastProperties(p->m_parsedProperties.size() - oldPars
edProperties); | 791 p->rollbackLastProperties(p->m_parsedProperties.size() - oldPars
edProperties); |
| 786 p->m_valueList = nullptr; | 792 p->m_valueList = nullptr; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 809 keyframes_rule: | 815 keyframes_rule: |
| 810 /* empty */ { $$ = parser->createFloatingKeyframeVector(); } | 816 /* empty */ { $$ = parser->createFloatingKeyframeVector(); } |
| 811 | keyframes_rule keyframe_rule maybe_space { | 817 | keyframes_rule keyframe_rule maybe_space { |
| 812 $$ = $1; | 818 $$ = $1; |
| 813 if ($2) | 819 if ($2) |
| 814 $$->append($2); | 820 $$->append($2); |
| 815 } | 821 } |
| 816 ; | 822 ; |
| 817 | 823 |
| 818 keyframe_rule: | 824 keyframe_rule: |
| 819 key_list maybe_space '{' maybe_space declaration_list '}' { | 825 key_list maybe_space '{' maybe_space declaration_list closing_brace { |
| 820 $$ = parser->createKeyframe($1); | 826 $$ = parser->createKeyframe($1); |
| 821 } | 827 } |
| 822 ; | 828 ; |
| 823 | 829 |
| 824 key_list: | 830 key_list: |
| 825 key { | 831 key { |
| 826 $$ = parser->createFloatingValueList(); | 832 $$ = parser->createFloatingValueList(); |
| 827 $$->addValue(parser->sinkFloatingValue($1)); | 833 $$->addValue(parser->sinkFloatingValue($1)); |
| 828 } | 834 } |
| 829 | key_list maybe_space ',' maybe_space key { | 835 | key_list maybe_space ',' maybe_space key { |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 $$ = parser->createFloatingSelector(); | 1402 $$ = parser->createFloatingSelector(); |
| 1397 $$->setMatch(CSSSelector::PseudoElement); | 1403 $$->setMatch(CSSSelector::PseudoElement); |
| 1398 $3.lower(); | 1404 $3.lower(); |
| 1399 $$->setValue($3); | 1405 $$->setValue($3); |
| 1400 // FIXME: This call is needed to force selector to compute the pseudoTyp
e early enough. | 1406 // FIXME: This call is needed to force selector to compute the pseudoTyp
e early enough. |
| 1401 CSSSelector::PseudoType type = $$->pseudoType(); | 1407 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1402 if (type == CSSSelector::PseudoUnknown) | 1408 if (type == CSSSelector::PseudoUnknown) |
| 1403 $$ = 0; | 1409 $$ = 0; |
| 1404 } | 1410 } |
| 1405 // used by ::cue(:past/:future) | 1411 // used by ::cue(:past/:future) |
| 1406 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' { | 1412 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_p
arenthesis { |
| 1407 if ($5) { | 1413 if ($5) { |
| 1408 $$ = parser->createFloatingSelector(); | 1414 $$ = parser->createFloatingSelector(); |
| 1409 $$->setMatch(CSSSelector::PseudoClass); | 1415 $$->setMatch(CSSSelector::PseudoClass); |
| 1410 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); | 1416 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); |
| 1411 $$->setValue($3); | 1417 $$->setValue($3); |
| 1412 CSSSelector::PseudoType type = $$->pseudoType(); | 1418 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1413 if (type != CSSSelector::PseudoCue) | 1419 if (type != CSSSelector::PseudoCue) |
| 1414 $$ = 0; | 1420 $$ = 0; |
| 1415 } else | 1421 } else |
| 1416 $$ = 0; | 1422 $$ = 0; |
| 1417 } | 1423 } |
| 1418 | ':' ':' DISTRIBUTEDFUNCTION maybe_space selector maybe_space ')' { | 1424 | ':' ':' DISTRIBUTEDFUNCTION maybe_space selector maybe_space closing_paren
thesis { |
| 1419 if (!$5) | 1425 if (!$5) |
| 1420 $$ = 0; | 1426 $$ = 0; |
| 1421 else { | 1427 else { |
| 1422 $$ = parser->createFloatingSelector(); | 1428 $$ = parser->createFloatingSelector(); |
| 1423 $$->setMatch(CSSSelector::PseudoElement); | 1429 $$->setMatch(CSSSelector::PseudoElement); |
| 1424 $$->setFunctionArgumentSelector($5); | 1430 $$->setFunctionArgumentSelector($5); |
| 1425 $3.lower(); | 1431 $3.lower(); |
| 1426 $$->setValue($3); | 1432 $$->setValue($3); |
| 1427 } | 1433 } |
| 1428 } | 1434 } |
| 1429 // use by :-webkit-any. | 1435 // use by :-webkit-any. |
| 1430 // FIXME: should we support generic selectors here or just simple_selectors? | 1436 // FIXME: should we support generic selectors here or just simple_selectors? |
| 1431 // Use simple_selector_list for now to match -moz-any. | 1437 // Use simple_selector_list for now to match -moz-any. |
| 1432 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s
ome | 1438 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s
ome |
| 1433 // related discussion with respect to :not. | 1439 // related discussion with respect to :not. |
| 1434 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space ')' { | 1440 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space closing_paren
thesis { |
| 1435 if ($4) { | 1441 if ($4) { |
| 1436 $$ = parser->createFloatingSelector(); | 1442 $$ = parser->createFloatingSelector(); |
| 1437 $$->setMatch(CSSSelector::PseudoClass); | 1443 $$->setMatch(CSSSelector::PseudoClass); |
| 1438 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); | 1444 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); |
| 1439 $2.lower(); | 1445 $2.lower(); |
| 1440 $$->setValue($2); | 1446 $$->setValue($2); |
| 1441 CSSSelector::PseudoType type = $$->pseudoType(); | 1447 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1442 if (type != CSSSelector::PseudoAny) | 1448 if (type != CSSSelector::PseudoAny) |
| 1443 $$ = 0; | 1449 $$ = 0; |
| 1444 } else | 1450 } else |
| 1445 $$ = 0; | 1451 $$ = 0; |
| 1446 } | 1452 } |
| 1447 // used by :nth-*(ax+b) | 1453 // used by :nth-*(ax+b) |
| 1448 | ':' FUNCTION maybe_space NTH maybe_space ')' { | 1454 | ':' FUNCTION maybe_space NTH maybe_space closing_parenthesis { |
| 1449 $$ = parser->createFloatingSelector(); | 1455 $$ = parser->createFloatingSelector(); |
| 1450 $$->setMatch(CSSSelector::PseudoClass); | 1456 $$->setMatch(CSSSelector::PseudoClass); |
| 1451 $$->setArgument($4); | 1457 $$->setArgument($4); |
| 1452 $$->setValue($2); | 1458 $$->setValue($2); |
| 1453 CSSSelector::PseudoType type = $$->pseudoType(); | 1459 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1454 if (type == CSSSelector::PseudoUnknown) | 1460 if (type == CSSSelector::PseudoUnknown) |
| 1455 $$ = 0; | 1461 $$ = 0; |
| 1456 } | 1462 } |
| 1457 // used by :nth-* | 1463 // used by :nth-* |
| 1458 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space ')' { | 1464 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space closing_
parenthesis { |
| 1459 $$ = parser->createFloatingSelector(); | 1465 $$ = parser->createFloatingSelector(); |
| 1460 $$->setMatch(CSSSelector::PseudoClass); | 1466 $$->setMatch(CSSSelector::PseudoClass); |
| 1461 $$->setArgument(String::number($4 * $5)); | 1467 $$->setArgument(String::number($4 * $5)); |
| 1462 $$->setValue($2); | 1468 $$->setValue($2); |
| 1463 CSSSelector::PseudoType type = $$->pseudoType(); | 1469 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1464 if (type == CSSSelector::PseudoUnknown) | 1470 if (type == CSSSelector::PseudoUnknown) |
| 1465 $$ = 0; | 1471 $$ = 0; |
| 1466 } | 1472 } |
| 1467 // used by :nth-*(odd/even) and :lang | 1473 // used by :nth-*(odd/even) and :lang |
| 1468 | ':' FUNCTION maybe_space IDENT maybe_space ')' { | 1474 | ':' FUNCTION maybe_space IDENT maybe_space closing_parenthesis { |
| 1469 $$ = parser->createFloatingSelector(); | 1475 $$ = parser->createFloatingSelector(); |
| 1470 $$->setMatch(CSSSelector::PseudoClass); | 1476 $$->setMatch(CSSSelector::PseudoClass); |
| 1471 $$->setArgument($4); | 1477 $$->setArgument($4); |
| 1472 $2.lower(); | 1478 $2.lower(); |
| 1473 $$->setValue($2); | 1479 $$->setValue($2); |
| 1474 CSSSelector::PseudoType type = $$->pseudoType(); | 1480 CSSSelector::PseudoType type = $$->pseudoType(); |
| 1475 if (type == CSSSelector::PseudoUnknown) | 1481 if (type == CSSSelector::PseudoUnknown) |
| 1476 $$ = 0; | 1482 $$ = 0; |
| 1477 else if (type == CSSSelector::PseudoNthChild || | 1483 else if (type == CSSSelector::PseudoNthChild || |
| 1478 type == CSSSelector::PseudoNthOfType || | 1484 type == CSSSelector::PseudoNthOfType || |
| 1479 type == CSSSelector::PseudoNthLastChild || | 1485 type == CSSSelector::PseudoNthLastChild || |
| 1480 type == CSSSelector::PseudoNthLastOfType) { | 1486 type == CSSSelector::PseudoNthLastOfType) { |
| 1481 if (!isValidNthToken($4)) | 1487 if (!isValidNthToken($4)) |
| 1482 $$ = 0; | 1488 $$ = 0; |
| 1483 } | 1489 } |
| 1484 } | 1490 } |
| 1485 // used by :not | 1491 // used by :not |
| 1486 | ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' { | 1492 | ':' NOTFUNCTION maybe_space simple_selector maybe_space closing_parenthesi
s { |
| 1487 if (!$4 || !$4->isSimple()) | 1493 if (!$4 || !$4->isSimple()) |
| 1488 $$ = 0; | 1494 $$ = 0; |
| 1489 else { | 1495 else { |
| 1490 $$ = parser->createFloatingSelector(); | 1496 $$ = parser->createFloatingSelector(); |
| 1491 $$->setMatch(CSSSelector::PseudoClass); | 1497 $$->setMatch(CSSSelector::PseudoClass); |
| 1492 | 1498 |
| 1493 Vector<OwnPtr<CSSParserSelector> > selectorVector; | 1499 Vector<OwnPtr<CSSParserSelector> > selectorVector; |
| 1494 selectorVector.append(parser->sinkFloatingSelector($4)); | 1500 selectorVector.append(parser->sinkFloatingSelector($4)); |
| 1495 $$->adoptSelectorVector(selectorVector); | 1501 $$->adoptSelectorVector(selectorVector); |
| 1496 | 1502 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 if ($2) | 1542 if ($2) |
| 1537 $$ = $2; | 1543 $$ = $2; |
| 1538 } | 1544 } |
| 1539 | decl_list decl_list_recovery ';' maybe_space { | 1545 | decl_list decl_list_recovery ';' maybe_space { |
| 1540 parser->startProperty(); | 1546 parser->startProperty(); |
| 1541 $$ = $1; | 1547 $$ = $1; |
| 1542 } | 1548 } |
| 1543 ; | 1549 ; |
| 1544 | 1550 |
| 1545 decl_list_recovery: | 1551 decl_list_recovery: |
| 1546 error error_location { | 1552 error error_location error_recovery { |
| 1547 parser->syntaxError($2, CSSParser::PropertyDeclarationError); | 1553 parser->syntaxError($2, CSSParser::PropertyDeclarationError); |
| 1548 } | 1554 } |
| 1549 | decl_list_recovery invalid_block | |
| 1550 | decl_list_recovery error | |
| 1551 ; | 1555 ; |
| 1552 | 1556 |
| 1553 declaration: | 1557 declaration: |
| 1554 VAR_DEFINITION ':' maybe_space expr prio { | 1558 VAR_DEFINITION ':' maybe_space expr prio { |
| 1555 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($4),
$5); | 1559 parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($4),
$5); |
| 1556 $$ = true; | 1560 $$ = true; |
| 1557 parser->endProperty($5, true); | 1561 parser->endProperty($5, true); |
| 1558 } | 1562 } |
| 1559 | | 1563 | |
| 1560 property ':' maybe_space expr prio { | 1564 property ':' maybe_space expr prio { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1591 } | 1595 } |
| 1592 | | 1596 | |
| 1593 property ':' maybe_space declaration_recovery { | 1597 property ':' maybe_space declaration_recovery { |
| 1594 /* if we come across rules with invalid values like this case: p { weigh
t: *; }, just discard the rule */ | 1598 /* if we come across rules with invalid values like this case: p { weigh
t: *; }, just discard the rule */ |
| 1595 parser->endProperty(false, false); | 1599 parser->endProperty(false, false); |
| 1596 $$ = false; | 1600 $$ = false; |
| 1597 } | 1601 } |
| 1598 ; | 1602 ; |
| 1599 | 1603 |
| 1600 declaration_recovery: | 1604 declaration_recovery: |
| 1601 error error_location { | 1605 error error_location error_recovery { |
| 1602 parser->syntaxError($2); | 1606 parser->syntaxError($2); |
| 1603 } | 1607 } |
| 1604 | declaration_recovery invalid_block | |
| 1605 | declaration_recovery error | |
| 1606 ; | 1608 ; |
| 1607 | 1609 |
| 1608 property: | 1610 property: |
| 1609 IDENT maybe_space { | 1611 IDENT maybe_space { |
| 1610 $$ = cssPropertyID($1); | 1612 $$ = cssPropertyID($1); |
| 1611 } | 1613 } |
| 1612 ; | 1614 ; |
| 1613 | 1615 |
| 1614 prio: | 1616 prio: |
| 1615 IMPORTANT_SYM maybe_space { $$ = true; } | 1617 IMPORTANT_SYM maybe_space { $$ = true; } |
| 1616 | /* empty */ { $$ = false; } | 1618 | /* empty */ { $$ = false; } |
| 1617 ; | 1619 ; |
| 1618 | 1620 |
| 1619 expr: | 1621 expr: |
| 1622 valid_expr { |
| 1623 $$ = $1; |
| 1624 } |
| 1625 | valid_expr expr_recovery { |
| 1626 $$ = 0; |
| 1627 } |
| 1628 ; |
| 1629 |
| 1630 valid_expr: |
| 1620 term { | 1631 term { |
| 1621 $$ = parser->createFloatingValueList(); | 1632 $$ = parser->createFloatingValueList(); |
| 1622 $$->addValue(parser->sinkFloatingValue($1)); | 1633 $$->addValue(parser->sinkFloatingValue($1)); |
| 1623 } | 1634 } |
| 1624 | expr operator term { | 1635 | valid_expr operator term { |
| 1625 $$ = $1; | 1636 $$ = $1; |
| 1626 if ($$) { | 1637 if ($$) { |
| 1627 if ($2) { | 1638 if ($2) { |
| 1628 CSSParserValue v; | 1639 CSSParserValue v; |
| 1629 v.id = 0; | 1640 v.id = 0; |
| 1630 v.unit = CSSParserValue::Operator; | 1641 v.unit = CSSParserValue::Operator; |
| 1631 v.iValue = $2; | 1642 v.iValue = $2; |
| 1632 $$->addValue(v); | 1643 $$->addValue(v); |
| 1633 } | 1644 } |
| 1634 $$->addValue(parser->sinkFloatingValue($3)); | 1645 $$->addValue(parser->sinkFloatingValue($3)); |
| 1635 } | 1646 } |
| 1636 } | 1647 } |
| 1637 | expr invalid_block_list { | 1648 ; |
| 1638 $$ = 0; | 1649 |
| 1639 } | 1650 expr_recovery: |
| 1640 | expr invalid_block_list error { | 1651 error error_location error_recovery |
| 1641 $$ = 0; | |
| 1642 } | |
| 1643 | expr error { | |
| 1644 $$ = 0; | |
| 1645 } | |
| 1646 ; | 1652 ; |
| 1647 | 1653 |
| 1648 operator: | 1654 operator: |
| 1649 '/' maybe_space { | 1655 '/' maybe_space { |
| 1650 $$ = '/'; | 1656 $$ = '/'; |
| 1651 } | 1657 } |
| 1652 | ',' maybe_space { | 1658 | ',' maybe_space { |
| 1653 $$ = ','; | 1659 $$ = ','; |
| 1654 } | 1660 } |
| 1655 | /* empty */ { | 1661 | /* empty */ { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1666 $$.unit = CSSPrimitiveValue::CSS_IDENT; | 1672 $$.unit = CSSPrimitiveValue::CSS_IDENT; |
| 1667 $$.string = $1; | 1673 $$.string = $1; |
| 1668 } | 1674 } |
| 1669 /* We might need to actually parse the number from a dimension, but we can't j
ust put something that uses $$.string into unary_term. */ | 1675 /* We might need to actually parse the number from a dimension, but we can't j
ust put something that uses $$.string into unary_term. */ |
| 1670 | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::
CSS_DIMENSION; } | 1676 | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::
CSS_DIMENSION; } |
| 1671 | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSP
rimitiveValue::CSS_DIMENSION; } | 1677 | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSP
rimitiveValue::CSS_DIMENSION; } |
| 1672 | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS
S_URI; } | 1678 | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS
S_URI; } |
| 1673 | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitive
Value::CSS_UNICODE_RANGE; } | 1679 | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitive
Value::CSS_UNICODE_RANGE; } |
| 1674 | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS
S_PARSER_HEXCOLOR; } | 1680 | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CS
S_PARSER_HEXCOLOR; } |
| 1675 | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPri
mitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ | 1681 | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPri
mitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ |
| 1676 | VARFUNCTION maybe_space IDENT ')' maybe_space { | 1682 | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space { |
| 1677 $$.id = 0; | 1683 $$.id = 0; |
| 1678 $$.string = $3; | 1684 $$.string = $3; |
| 1679 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; | 1685 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; |
| 1680 } | 1686 } |
| 1681 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ | 1687 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ |
| 1682 | function { | 1688 | function { |
| 1683 $$ = $1; | 1689 $$ = $1; |
| 1684 } | 1690 } |
| 1685 | calc_function { | 1691 | calc_function { |
| 1686 $$ = $1; | 1692 $$ = $1; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } | 1732 | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } |
| 1727 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } | 1733 | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } |
| 1728 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; } | 1734 | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; } |
| 1729 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; } | 1735 | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; } |
| 1730 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; } | 1736 | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; } |
| 1731 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; } | 1737 | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; } |
| 1732 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; } | 1738 | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; } |
| 1733 ; | 1739 ; |
| 1734 | 1740 |
| 1735 function: | 1741 function: |
| 1736 FUNCTION maybe_space expr ')' maybe_space { | 1742 FUNCTION maybe_space expr closing_parenthesis maybe_space { |
| 1737 CSSParserFunction* f = parser->createFloatingFunction(); | 1743 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1738 f->name = $1; | 1744 f->name = $1; |
| 1739 f->args = parser->sinkFloatingValueList($3); | 1745 f->args = parser->sinkFloatingValueList($3); |
| 1740 $$.id = 0; | |
| 1741 $$.unit = CSSParserValue::Function; | |
| 1742 $$.function = f; | |
| 1743 } | | |
| 1744 FUNCTION maybe_space expr TOKEN_EOF { | |
| 1745 CSSParserFunction* f = parser->createFloatingFunction(); | |
| 1746 f->name = $1; | |
| 1747 f->args = parser->sinkFloatingValueList($3); | |
| 1748 $$.id = 0; | 1746 $$.id = 0; |
| 1749 $$.unit = CSSParserValue::Function; | 1747 $$.unit = CSSParserValue::Function; |
| 1750 $$.function = f; | 1748 $$.function = f; |
| 1751 } | | 1749 } | |
| 1752 FUNCTION maybe_space ')' maybe_space { | 1750 FUNCTION maybe_space closing_parenthesis maybe_space { |
| 1753 CSSParserFunction* f = parser->createFloatingFunction(); | 1751 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1754 f->name = $1; | 1752 f->name = $1; |
| 1755 CSSParserValueList* valueList = parser->createFloatingValueList(); | 1753 CSSParserValueList* valueList = parser->createFloatingValueList(); |
| 1756 f->args = parser->sinkFloatingValueList(valueList); | 1754 f->args = parser->sinkFloatingValueList(valueList); |
| 1757 $$.id = 0; | 1755 $$.id = 0; |
| 1758 $$.unit = CSSParserValue::Function; | 1756 $$.unit = CSSParserValue::Function; |
| 1759 $$.function = f; | 1757 $$.function = f; |
| 1760 } | | 1758 } | |
| 1761 FUNCTION maybe_space error { | 1759 FUNCTION maybe_space expr_recovery closing_parenthesis maybe_space { |
| 1762 CSSParserFunction* f = parser->createFloatingFunction(); | 1760 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1763 f->name = $1; | 1761 f->name = $1; |
| 1764 f->args = nullptr; | 1762 f->args = nullptr; |
| 1765 $$.id = 0; | 1763 $$.id = 0; |
| 1766 $$.unit = CSSParserValue::Function; | 1764 $$.unit = CSSParserValue::Function; |
| 1767 $$.function = f; | 1765 $$.function = f; |
| 1768 } | 1766 } |
| 1769 ; | 1767 ; |
| 1770 | 1768 |
| 1771 calc_func_term: | 1769 calc_func_term: |
| 1772 unary_term { $$ = $1; } | 1770 unary_term { $$ = $1; } |
| 1773 | VARFUNCTION maybe_space IDENT ')' { | 1771 | VARFUNCTION maybe_space IDENT closing_parenthesis { |
| 1774 $$.id = 0; | 1772 $$.id = 0; |
| 1775 $$.string = $3; | 1773 $$.string = $3; |
| 1776 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; | 1774 $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME; |
| 1777 } | 1775 } |
| 1778 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } | 1776 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } |
| 1779 ; | 1777 ; |
| 1780 | 1778 |
| 1781 calc_func_operator: | 1779 calc_func_operator: |
| 1782 WHITESPACE '+' WHITESPACE { | 1780 WHITESPACE '+' WHITESPACE { |
| 1783 $$ = '+'; | 1781 $$ = '+'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1808 v.unit = CSSParserValue::Operator; | 1806 v.unit = CSSParserValue::Operator; |
| 1809 v.iValue = '('; | 1807 v.iValue = '('; |
| 1810 $$->insertValueAt(0, v); | 1808 $$->insertValueAt(0, v); |
| 1811 v.iValue = ')'; | 1809 v.iValue = ')'; |
| 1812 $$->addValue(v); | 1810 $$->addValue(v); |
| 1813 } else | 1811 } else |
| 1814 $$ = 0; | 1812 $$ = 0; |
| 1815 } | 1813 } |
| 1816 | 1814 |
| 1817 calc_closing_paren: | 1815 calc_closing_paren: |
| 1818 WHITESPACE ')' | 1816 WHITESPACE closing_parenthesis |
| 1819 | ')' | 1817 | closing_parenthesis |
| 1820 | 1818 |
| 1821 calc_func_expr: | 1819 calc_func_expr: |
| 1822 calc_func_term { | 1820 calc_func_term { |
| 1823 $$ = parser->createFloatingValueList(); | 1821 $$ = parser->createFloatingValueList(); |
| 1824 $$->addValue(parser->sinkFloatingValue($1)); | 1822 $$->addValue(parser->sinkFloatingValue($1)); |
| 1825 } | 1823 } |
| 1826 | calc_func_expr calc_func_operator calc_func_term { | 1824 | calc_func_expr calc_func_operator calc_func_term { |
| 1827 if ($1 && $2) { | 1825 if ($1 && $2) { |
| 1828 $$ = $1; | 1826 $$ = $1; |
| 1829 CSSParserValue v; | 1827 CSSParserValue v; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 min_or_max: | 1903 min_or_max: |
| 1906 MINFUNCTION { | 1904 MINFUNCTION { |
| 1907 $$ = $1; | 1905 $$ = $1; |
| 1908 } | 1906 } |
| 1909 | MAXFUNCTION { | 1907 | MAXFUNCTION { |
| 1910 $$ = $1; | 1908 $$ = $1; |
| 1911 } | 1909 } |
| 1912 ; | 1910 ; |
| 1913 | 1911 |
| 1914 min_or_max_function: | 1912 min_or_max_function: |
| 1915 min_or_max maybe_space calc_func_expr_list ')' maybe_space { | 1913 min_or_max maybe_space calc_func_expr_list closing_parenthesis maybe_space { |
| 1916 CSSParserFunction* f = parser->createFloatingFunction(); | 1914 CSSParserFunction* f = parser->createFloatingFunction(); |
| 1917 f->name = $1; | 1915 f->name = $1; |
| 1918 f->args = parser->sinkFloatingValueList($3); | 1916 f->args = parser->sinkFloatingValueList($3); |
| 1919 $$.id = 0; | 1917 $$.id = 0; |
| 1920 $$.unit = CSSParserValue::Function; | 1918 $$.unit = CSSParserValue::Function; |
| 1921 $$.function = f; | 1919 $$.function = f; |
| 1922 } | 1920 } |
| 1923 | min_or_max maybe_space error { | 1921 | min_or_max maybe_space error { |
| 1924 YYERROR; | 1922 YYERROR; |
| 1925 } | 1923 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 invalid_block_list: | 1973 invalid_block_list: |
| 1976 invalid_block | 1974 invalid_block |
| 1977 | invalid_block_list error invalid_block | 1975 | invalid_block_list error invalid_block |
| 1978 ; | 1976 ; |
| 1979 | 1977 |
| 1980 error_location: { | 1978 error_location: { |
| 1981 $$ = parser->currentLocation(); | 1979 $$ = parser->currentLocation(); |
| 1982 } | 1980 } |
| 1983 ; | 1981 ; |
| 1984 | 1982 |
| 1983 error_recovery: |
| 1984 /* empty */ |
| 1985 | error_recovery error |
| 1986 | error_recovery '{' error_recovery closing_brace |
| 1987 | error_recovery '(' error_recovery closing_parenthesis |
| 1988 | error_recovery FUNCTION error_recovery closing_parenthesis |
| 1989 | error_recovery CALCFUNCTION error_recovery closing_parenthesis |
| 1990 | error_recovery VARFUNCTION error_recovery closing_parenthesis |
| 1991 | error_recovery MINFUNCTION error_recovery closing_parenthesis |
| 1992 | error_recovery MAXFUNCTION error_recovery closing_parenthesis |
| 1993 | error_recovery ANYFUNCTION error_recovery closing_parenthesis |
| 1994 | error_recovery NOTFUNCTION error_recovery closing_parenthesis |
| 1995 ; |
| 1996 |
| 1985 %% | 1997 %% |
| 1986 | 1998 |
| OLD | NEW |