OLD | NEW |
| (Empty) |
1 %{ | |
2 | |
3 /* | |
4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) | |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App
le Inc. All rights reserved. | |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | |
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | |
8 * Copyright (C) 2012 Intel Corporation. All rights reserved. | |
9 * | |
10 * This library is free software; you can redistribute it and/or | |
11 * modify it under the terms of the GNU Lesser General Public | |
12 * License as published by the Free Software Foundation; either | |
13 * version 2 of the License, or (at your option) any later version. | |
14 * | |
15 * This library is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 * Lesser General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU Lesser General Public | |
21 * License along with this library; if not, write to the Free Software | |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | |
23 * | |
24 */ | |
25 | |
26 #include "config.h" | |
27 | |
28 #include "CSSPropertyNames.h" | |
29 #include "HTMLNames.h" | |
30 #include "core/css/CSSKeyframeRule.h" | |
31 #include "core/css/CSSKeyframesRule.h" | |
32 #include "core/css/parser/BisonCSSParser.h" | |
33 #include "core/css/CSSParserMode.h" | |
34 #include "core/css/CSSPrimitiveValue.h" | |
35 #include "core/css/CSSSelector.h" | |
36 #include "core/css/CSSSelectorList.h" | |
37 #include "core/css/MediaList.h" | |
38 #include "core/css/MediaQueryExp.h" | |
39 #include "core/css/StyleRule.h" | |
40 #include "core/css/StyleSheetContents.h" | |
41 #include "core/dom/Document.h" | |
42 #include "wtf/FastMalloc.h" | |
43 #include <stdlib.h> | |
44 #include <string.h> | |
45 | |
46 using namespace blink; | |
47 using namespace HTMLNames; | |
48 | |
49 #define YYMALLOC fastMalloc | |
50 #define YYFREE fastFree | |
51 | |
52 #define YYENABLE_NLS 0 | |
53 #define YYLTYPE_IS_TRIVIAL 1 | |
54 #define YYMAXDEPTH 10000 | |
55 #define YYDEBUG 0 | |
56 | |
57 #if YYDEBUG > 0 | |
58 #define YYPRINT(File,Type,Value) if (isCSSTokenAString(Type)) YYFPRINTF(File, "%
s", String((Value).string).utf8().data()) | |
59 #endif | |
60 | |
61 %} | |
62 | |
63 %pure-parser | |
64 | |
65 %parse-param { BisonCSSParser* parser } | |
66 %lex-param { BisonCSSParser* parser } | |
67 | |
68 %union { | |
69 bool boolean; | |
70 char character; | |
71 int integer; | |
72 double number; | |
73 CSSParserString string; | |
74 | |
75 StyleRuleBase* rule; | |
76 // The content of the three below HeapVectors are guaranteed to be kept aliv
e by | |
77 // the corresponding m_parsedRules, m_floatingMediaQueryExpList, and m_parse
dKeyFrames | |
78 // lists in BisonCSSParser.h. | |
79 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >* ruleList; | |
80 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* mediaQueryExpList; | |
81 WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >* keyframeRuleList; | |
82 CSSParserSelector* selector; | |
83 Vector<OwnPtr<CSSParserSelector> >* selectorList; | |
84 CSSSelector::MarginBoxType marginBox; | |
85 CSSSelector::Relation relation; | |
86 CSSSelector::AttributeMatchType attributeMatchType; | |
87 MediaQuerySet* mediaList; | |
88 MediaQuery* mediaQuery; | |
89 MediaQuery::Restrictor mediaQueryRestrictor; | |
90 MediaQueryExp* mediaQueryExp; | |
91 CSSParserValue value; | |
92 CSSParserValueList* valueList; | |
93 StyleKeyframe* keyframe; | |
94 float val; | |
95 CSSPropertyID id; | |
96 CSSParserLocation location; | |
97 } | |
98 | |
99 %{ | |
100 | |
101 static inline int cssyyerror(void*, const char*) | |
102 { | |
103 return 1; | |
104 } | |
105 | |
106 #if YYDEBUG > 0 | |
107 static inline bool isCSSTokenAString(int yytype) | |
108 { | |
109 switch (yytype) { | |
110 case IDENT: | |
111 case STRING: | |
112 case NTH: | |
113 case HEX: | |
114 case IDSEL: | |
115 case DIMEN: | |
116 case INVALIDDIMEN: | |
117 case URI: | |
118 case FUNCTION: | |
119 case ANYFUNCTION: | |
120 case HOSTFUNCTION: | |
121 case HOSTCONTEXTFUNCTION: | |
122 case NOTFUNCTION: | |
123 case CALCFUNCTION: | |
124 case UNICODERANGE: | |
125 return true; | |
126 default: | |
127 return false; | |
128 } | |
129 } | |
130 #endif | |
131 | |
132 inline static CSSParserValue makeOperatorValue(int value) | |
133 { | |
134 CSSParserValue v; | |
135 v.id = CSSValueInvalid; | |
136 v.isInt = false; | |
137 v.unit = CSSParserValue::Operator; | |
138 v.iValue = value; | |
139 return v; | |
140 } | |
141 | |
142 inline static CSSParserValue makeIdentValue(CSSParserString string) | |
143 { | |
144 CSSParserValue v; | |
145 v.id = cssValueKeywordID(string); | |
146 v.isInt = false; | |
147 v.unit = CSSPrimitiveValue::CSS_IDENT; | |
148 v.string = string; | |
149 return v; | |
150 } | |
151 | |
152 %} | |
153 | |
154 %expect 0 | |
155 | |
156 %nonassoc LOWEST_PREC | |
157 | |
158 %left UNIMPORTANT_TOK | |
159 | |
160 %token WHITESPACE SGML_CD | |
161 %token TOKEN_EOF 0 | |
162 | |
163 %token INCLUDES | |
164 %token DASHMATCH | |
165 %token BEGINSWITH | |
166 %token ENDSWITH | |
167 %token CONTAINS | |
168 | |
169 %token <string> STRING | |
170 %right <string> IDENT | |
171 %token <string> NTH | |
172 | |
173 %nonassoc <string> HEX | |
174 %nonassoc <string> IDSEL | |
175 %nonassoc ':' | |
176 %nonassoc '.' | |
177 %nonassoc '[' | |
178 %nonassoc <string> '*' | |
179 %nonassoc error | |
180 %left '|' | |
181 | |
182 %token IMPORT_SYM | |
183 %token PAGE_SYM | |
184 %token MEDIA_SYM | |
185 %token SUPPORTS_SYM | |
186 %token FONT_FACE_SYM | |
187 %token CHARSET_SYM | |
188 %token NAMESPACE_SYM | |
189 %token VIEWPORT_RULE_SYM | |
190 %token INTERNAL_DECLS_SYM | |
191 %token INTERNAL_MEDIALIST_SYM | |
192 %token INTERNAL_RULE_SYM | |
193 %token INTERNAL_SELECTOR_SYM | |
194 %token INTERNAL_VALUE_SYM | |
195 %token INTERNAL_KEYFRAME_RULE_SYM | |
196 %token INTERNAL_KEYFRAME_KEY_LIST_SYM | |
197 %token INTERNAL_SUPPORTS_CONDITION_SYM | |
198 %token KEYFRAMES_SYM | |
199 %token WEBKIT_KEYFRAMES_SYM | |
200 %token <marginBox> TOPLEFTCORNER_SYM | |
201 %token <marginBox> TOPLEFT_SYM | |
202 %token <marginBox> TOPCENTER_SYM | |
203 %token <marginBox> TOPRIGHT_SYM | |
204 %token <marginBox> TOPRIGHTCORNER_SYM | |
205 %token <marginBox> BOTTOMLEFTCORNER_SYM | |
206 %token <marginBox> BOTTOMLEFT_SYM | |
207 %token <marginBox> BOTTOMCENTER_SYM | |
208 %token <marginBox> BOTTOMRIGHT_SYM | |
209 %token <marginBox> BOTTOMRIGHTCORNER_SYM | |
210 %token <marginBox> LEFTTOP_SYM | |
211 %token <marginBox> LEFTMIDDLE_SYM | |
212 %token <marginBox> LEFTBOTTOM_SYM | |
213 %token <marginBox> RIGHTTOP_SYM | |
214 %token <marginBox> RIGHTMIDDLE_SYM | |
215 %token <marginBox> RIGHTBOTTOM_SYM | |
216 | |
217 %token ATKEYWORD | |
218 | |
219 %token IMPORTANT_SYM | |
220 %token MEDIA_ONLY | |
221 %token MEDIA_NOT | |
222 %token MEDIA_AND | |
223 %token MEDIA_OR | |
224 | |
225 %token SUPPORTS_NOT | |
226 %token SUPPORTS_AND | |
227 %token SUPPORTS_OR | |
228 | |
229 %token <number> REMS | |
230 %token <number> CHS | |
231 %token <number> QEMS | |
232 %token <number> EMS | |
233 %token <number> EXS | |
234 %token <number> PXS | |
235 %token <number> CMS | |
236 %token <number> MMS | |
237 %token <number> INS | |
238 %token <number> PTS | |
239 %token <number> PCS | |
240 %token <number> DEGS | |
241 %token <number> RADS | |
242 %token <number> GRADS | |
243 %token <number> TURNS | |
244 %token <number> MSECS | |
245 %token <number> SECS | |
246 %token <number> HERTZ | |
247 %token <number> KHERTZ | |
248 %token <string> DIMEN | |
249 %token <string> INVALIDDIMEN | |
250 %token <number> PERCENTAGE | |
251 %token <number> FLOATTOKEN | |
252 %token <number> INTEGER | |
253 %token <number> VW | |
254 %token <number> VH | |
255 %token <number> VMIN | |
256 %token <number> VMAX | |
257 %token <number> DPPX | |
258 %token <number> DPI | |
259 %token <number> DPCM | |
260 %token <number> FR | |
261 | |
262 %token <string> URI | |
263 %token <string> FUNCTION | |
264 %token <string> ANYFUNCTION | |
265 %token <string> CUEFUNCTION | |
266 %token <string> NOTFUNCTION | |
267 %token <string> DISTRIBUTEDFUNCTION | |
268 %token <string> CALCFUNCTION | |
269 %token <string> HOSTFUNCTION | |
270 %token <string> HOSTCONTEXTFUNCTION | |
271 | |
272 %token <string> UNICODERANGE | |
273 | |
274 %type <relation> combinator | |
275 | |
276 %type <rule> ruleset | |
277 %type <rule> media | |
278 %type <rule> import | |
279 %type <rule> namespace | |
280 %type <rule> page | |
281 %type <rule> margin_box | |
282 %type <rule> font_face | |
283 %type <rule> keyframes | |
284 %type <rule> rule | |
285 %type <rule> valid_rule | |
286 %type <ruleList> block_rule_body | |
287 %type <ruleList> block_rule_list | |
288 %type <rule> block_rule | |
289 %type <rule> block_valid_rule | |
290 %type <rule> supports | |
291 %type <rule> viewport | |
292 %type <boolean> keyframes_rule_start | |
293 | |
294 %type <string> maybe_ns_prefix | |
295 | |
296 %type <string> namespace_selector | |
297 | |
298 %type <string> string_or_uri | |
299 %type <string> ident_or_string | |
300 %type <string> medium | |
301 %type <marginBox> margin_sym | |
302 | |
303 %type <mediaList> media_list | |
304 %type <mediaList> maybe_media_list | |
305 %type <mediaList> mq_list | |
306 %type <mediaQuery> media_query | |
307 %type <mediaQuery> valid_media_query | |
308 %type <mediaQueryRestrictor> maybe_media_restrictor | |
309 %type <valueList> maybe_media_value | |
310 %type <mediaQueryExp> media_query_exp | |
311 %type <mediaQueryExpList> media_query_exp_list | |
312 %type <mediaQueryExpList> maybe_and_media_query_exp_list | |
313 | |
314 %type <boolean> supports_condition | |
315 %type <boolean> supports_condition_in_parens | |
316 %type <boolean> supports_negation | |
317 %type <boolean> supports_conjunction | |
318 %type <boolean> supports_disjunction | |
319 %type <boolean> supports_declaration_condition | |
320 | |
321 %type <string> keyframe_name | |
322 %type <keyframe> keyframe_rule | |
323 %type <keyframeRuleList> keyframes_rule | |
324 %type <keyframeRuleList> keyframe_rule_list | |
325 %type <valueList> key_list | |
326 %type <value> key | |
327 | |
328 %type <id> property | |
329 | |
330 %type <selector> specifier | |
331 %type <selector> specifier_list | |
332 %type <selector> simple_selector | |
333 %type <selector> selector | |
334 %type <selectorList> selector_list | |
335 %type <selectorList> simple_selector_list | |
336 %type <selector> class | |
337 %type <selector> attrib | |
338 %type <selector> pseudo | |
339 %type <selector> pseudo_page | |
340 %type <selector> page_selector | |
341 | |
342 %type <boolean> declaration_list | |
343 %type <boolean> decl_list | |
344 %type <boolean> declaration | |
345 %type <boolean> declarations_and_margins | |
346 | |
347 %type <boolean> prio | |
348 | |
349 %type <integer> match | |
350 %type <integer> unary_operator | |
351 %type <integer> maybe_unary_operator | |
352 %type <character> operator | |
353 | |
354 %type <valueList> expr | |
355 %type <value> term | |
356 %type <value> unary_term | |
357 %type <value> function | |
358 %type <value> calc_func_term | |
359 %type <character> calc_func_operator | |
360 %type <valueList> calc_func_expr | |
361 %type <valueList> calc_func_paren_expr | |
362 %type <value> calc_function | |
363 | |
364 %type <string> element_name | |
365 %type <string> attr_name | |
366 | |
367 %type <attributeMatchType> attr_match_type | |
368 %type <attributeMatchType> maybe_attr_match_type | |
369 | |
370 %type <location> error_location | |
371 | |
372 %type <valueList> ident_list | |
373 %type <value> track_names_list | |
374 | |
375 %% | |
376 | |
377 stylesheet: | |
378 maybe_charset maybe_sgml rule_list | |
379 | internal_decls | |
380 | internal_rule | |
381 | internal_selector | |
382 | internal_value | |
383 | internal_medialist | |
384 | internal_keyframe_rule | |
385 | internal_keyframe_key_list | |
386 | internal_supports_condition | |
387 ; | |
388 | |
389 internal_rule: | |
390 INTERNAL_RULE_SYM maybe_space valid_rule maybe_space TOKEN_EOF { | |
391 parser->m_rule = $3; | |
392 } | |
393 ; | |
394 | |
395 internal_keyframe_rule: | |
396 INTERNAL_KEYFRAME_RULE_SYM maybe_space keyframe_rule maybe_space TOKEN_EOF { | |
397 parser->m_keyframe = $3; | |
398 } | |
399 ; | |
400 | |
401 internal_keyframe_key_list: | |
402 INTERNAL_KEYFRAME_KEY_LIST_SYM maybe_space key_list TOKEN_EOF { | |
403 parser->m_valueList = parser->sinkFloatingValueList($3); | |
404 } | |
405 ; | |
406 | |
407 internal_decls: | |
408 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF
{ | |
409 /* can be empty */ | |
410 } | |
411 ; | |
412 | |
413 internal_value: | |
414 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { | |
415 parser->m_valueList = parser->sinkFloatingValueList($3); | |
416 int oldParsedProperties = parser->m_parsedProperties.size(); | |
417 if (!parser->parseValue(parser->m_id, parser->m_important)) | |
418 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o
ldParsedProperties); | |
419 parser->m_valueList = nullptr; | |
420 } | |
421 ; | |
422 | |
423 internal_medialist: | |
424 INTERNAL_MEDIALIST_SYM maybe_space location_label maybe_media_list TOKEN_EOF
{ | |
425 parser->m_mediaList = $4; | |
426 } | |
427 ; | |
428 | |
429 internal_selector: | |
430 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF { | |
431 if (parser->m_selectorListForParseSelector) | |
432 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3); | |
433 } | |
434 ; | |
435 | |
436 internal_supports_condition: | |
437 INTERNAL_SUPPORTS_CONDITION_SYM maybe_space supports_condition TOKEN_EOF { | |
438 parser->m_supportsCondition = $3; | |
439 } | |
440 ; | |
441 | |
442 space: | |
443 WHITESPACE | |
444 | space WHITESPACE | |
445 ; | |
446 | |
447 maybe_space: | |
448 /* empty */ %prec UNIMPORTANT_TOK | |
449 | space | |
450 ; | |
451 | |
452 maybe_sgml: | |
453 /* empty */ | |
454 | maybe_sgml SGML_CD | |
455 | maybe_sgml WHITESPACE | |
456 ; | |
457 | |
458 closing_brace: | |
459 '}' | |
460 | %prec LOWEST_PREC TOKEN_EOF | |
461 ; | |
462 | |
463 closing_parenthesis: | |
464 ')' | |
465 | %prec LOWEST_PREC TOKEN_EOF | |
466 ; | |
467 | |
468 closing_square_bracket: | |
469 ']' | |
470 | %prec LOWEST_PREC TOKEN_EOF | |
471 ; | |
472 | |
473 semi_or_eof: | |
474 ';' | |
475 | TOKEN_EOF | |
476 ; | |
477 | |
478 maybe_charset: | |
479 /* empty */ | |
480 | CHARSET_SYM maybe_space STRING maybe_space semi_or_eof { | |
481 if (parser->m_styleSheet) | |
482 parser->m_styleSheet->parserSetEncodingFromCharsetRule($3); | |
483 parser->startEndUnknownRule(); | |
484 } | |
485 | CHARSET_SYM at_rule_recovery | |
486 ; | |
487 | |
488 rule_list: | |
489 /* empty */ | |
490 | rule_list rule maybe_sgml { | |
491 if ($2 && parser->m_styleSheet) | |
492 parser->m_styleSheet->parserAppendRule($2); | |
493 } | |
494 ; | |
495 | |
496 valid_rule: | |
497 ruleset | |
498 | media | |
499 | page | |
500 | font_face | |
501 | keyframes | |
502 | namespace | |
503 | import | |
504 | supports | |
505 | viewport | |
506 ; | |
507 | |
508 before_rule: | |
509 /* empty */ { | |
510 parser->startRule(); | |
511 } | |
512 ; | |
513 | |
514 rule: | |
515 before_rule valid_rule { | |
516 $$ = $2; | |
517 parser->m_hadSyntacticallyValidCSSRule = true; | |
518 parser->endRule(!!$$); | |
519 } | |
520 | before_rule invalid_rule { | |
521 $$ = 0; | |
522 parser->endRule(false); | |
523 } | |
524 ; | |
525 | |
526 block_rule_body: | |
527 block_rule_list | |
528 | block_rule_list block_rule_recovery | |
529 ; | |
530 | |
531 block_rule_list: | |
532 /* empty */ { $$ = 0; } | |
533 | block_rule_list block_rule maybe_sgml { | |
534 $$ = parser->appendRule($1, $2); | |
535 } | |
536 ; | |
537 | |
538 block_rule_recovery: | |
539 before_rule invalid_rule_header { | |
540 parser->endRule(false); | |
541 } | |
542 ; | |
543 | |
544 block_valid_rule: | |
545 ruleset | |
546 | page | |
547 | font_face | |
548 | media | |
549 | keyframes | |
550 | supports | |
551 | viewport | |
552 | namespace | |
553 ; | |
554 | |
555 block_rule: | |
556 before_rule block_valid_rule { | |
557 $$ = $2; | |
558 parser->endRule(!!$$); | |
559 } | |
560 | before_rule invalid_rule { | |
561 $$ = 0; | |
562 parser->endRule(false); | |
563 } | |
564 ; | |
565 | |
566 before_import_rule: | |
567 /* empty */ { | |
568 parser->startRuleHeader(CSSRuleSourceData::IMPORT_RULE); | |
569 } | |
570 ; | |
571 | |
572 import_rule_start: | |
573 before_import_rule IMPORT_SYM maybe_space { | |
574 parser->endRuleHeader(); | |
575 parser->startRuleBody(); | |
576 } | |
577 ; | |
578 | |
579 import: | |
580 import_rule_start string_or_uri maybe_space location_label maybe_media_list
semi_or_eof { | |
581 $$ = parser->createImportRule($2, $5); | |
582 } | |
583 | import_rule_start string_or_uri maybe_space location_label maybe_media_list
invalid_block { | |
584 $$ = 0; | |
585 } | |
586 ; | |
587 | |
588 namespace: | |
589 NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space semi_or_
eof { | |
590 parser->addNamespace($3, $4); | |
591 $$ = 0; | |
592 } | |
593 ; | |
594 | |
595 maybe_ns_prefix: | |
596 /* empty */ { $$.clear(); } | |
597 | IDENT maybe_space | |
598 ; | |
599 | |
600 string_or_uri: | |
601 STRING | |
602 | URI | |
603 ; | |
604 | |
605 maybe_media_value: | |
606 /*empty*/ { | |
607 $$ = 0; | |
608 } | |
609 | ':' maybe_space expr { | |
610 $$ = $3; | |
611 } | |
612 ; | |
613 | |
614 media_query_exp: | |
615 '(' maybe_space IDENT maybe_space maybe_media_value closing_parenthesis { | |
616 parser->tokenToLowerCase($3); | |
617 $$ = parser->createFloatingMediaQueryExp($3, $5); | |
618 if (!$$) | |
619 YYERROR; | |
620 } | |
621 | '(' error error_recovery closing_parenthesis { | |
622 YYERROR; | |
623 } | |
624 ; | |
625 | |
626 media_query_exp_list: | |
627 media_query_exp { | |
628 $$ = parser->createFloatingMediaQueryExpList(); | |
629 $$->append(parser->sinkFloatingMediaQueryExp($1)); | |
630 } | |
631 | media_query_exp_list maybe_space MEDIA_AND maybe_space media_query_exp { | |
632 $$ = $1; | |
633 $$->append(parser->sinkFloatingMediaQueryExp($5)); | |
634 } | |
635 ; | |
636 | |
637 maybe_and_media_query_exp_list: | |
638 maybe_space { | |
639 $$ = parser->createFloatingMediaQueryExpList(); | |
640 } | |
641 | maybe_space MEDIA_AND maybe_space media_query_exp_list maybe_space { | |
642 $$ = $4; | |
643 } | |
644 ; | |
645 | |
646 maybe_media_restrictor: | |
647 /*empty*/ { | |
648 $$ = MediaQuery::None; | |
649 } | |
650 | MEDIA_ONLY maybe_space { | |
651 $$ = MediaQuery::Only; | |
652 } | |
653 | MEDIA_NOT maybe_space { | |
654 $$ = MediaQuery::Not; | |
655 } | |
656 ; | |
657 | |
658 valid_media_query: | |
659 media_query_exp_list maybe_space { | |
660 $$ = parser->createFloatingMediaQuery(parser->sinkFloatingMediaQueryExpL
ist($1)); | |
661 } | |
662 | maybe_media_restrictor medium maybe_and_media_query_exp_list { | |
663 parser->tokenToLowerCase($2); | |
664 $$ = parser->createFloatingMediaQuery($1, $2, parser->sinkFloatingMediaQ
ueryExpList($3)); | |
665 } | |
666 ; | |
667 | |
668 media_query: | |
669 valid_media_query | |
670 | valid_media_query error error_location rule_error_recovery { | |
671 parser->reportError(parser->lastLocationLabel(), InvalidMediaQueryCSSErr
or); | |
672 $$ = parser->createFloatingNotAllQuery(); | |
673 } | |
674 | error error_location rule_error_recovery { | |
675 parser->reportError(parser->lastLocationLabel(), InvalidMediaQueryCSSErr
or); | |
676 $$ = parser->createFloatingNotAllQuery(); | |
677 } | |
678 ; | |
679 | |
680 maybe_media_list: | |
681 /* empty */ { | |
682 $$ = parser->createMediaQuerySet(); | |
683 } | |
684 | media_list | |
685 ; | |
686 | |
687 media_list: | |
688 media_query { | |
689 $$ = parser->createMediaQuerySet(); | |
690 $$->addMediaQuery(parser->sinkFloatingMediaQuery($1)); | |
691 } | |
692 | mq_list media_query { | |
693 $$ = $1; | |
694 $$->addMediaQuery(parser->sinkFloatingMediaQuery($2)); | |
695 } | |
696 | mq_list { | |
697 $$ = $1; | |
698 $$->addMediaQuery(parser->sinkFloatingMediaQuery(parser->createFloatingN
otAllQuery())); | |
699 } | |
700 ; | |
701 | |
702 mq_list: | |
703 media_query ',' maybe_space location_label { | |
704 $$ = parser->createMediaQuerySet(); | |
705 $$->addMediaQuery(parser->sinkFloatingMediaQuery($1)); | |
706 } | |
707 | mq_list media_query ',' maybe_space location_label { | |
708 $$ = $1; | |
709 $$->addMediaQuery(parser->sinkFloatingMediaQuery($2)); | |
710 } | |
711 ; | |
712 | |
713 at_rule_body_start: | |
714 /* empty */ { | |
715 parser->startRuleBody(); | |
716 } | |
717 ; | |
718 | |
719 before_media_rule: | |
720 /* empty */ { | |
721 parser->startRuleHeader(CSSRuleSourceData::MEDIA_RULE); | |
722 } | |
723 ; | |
724 | |
725 at_rule_header_end_maybe_space: | |
726 maybe_space { | |
727 parser->endRuleHeader(); | |
728 } | |
729 ; | |
730 | |
731 media_rule_start: | |
732 before_media_rule MEDIA_SYM maybe_space; | |
733 | |
734 media: | |
735 media_rule_start maybe_media_list '{' at_rule_header_end at_rule_body_start
maybe_space block_rule_body closing_brace { | |
736 $$ = parser->createMediaRule($2, $7); | |
737 } | |
738 ; | |
739 | |
740 medium: | |
741 IDENT | |
742 ; | |
743 | |
744 supports: | |
745 before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports
_rule_header_end '{' at_rule_body_start maybe_space block_rule_body closing_brac
e { | |
746 $$ = parser->createSupportsRule($4, $9); | |
747 } | |
748 ; | |
749 | |
750 before_supports_rule: | |
751 /* empty */ { | |
752 parser->startRuleHeader(CSSRuleSourceData::SUPPORTS_RULE); | |
753 parser->markSupportsRuleHeaderStart(); | |
754 } | |
755 ; | |
756 | |
757 at_supports_rule_header_end: | |
758 /* empty */ { | |
759 parser->endRuleHeader(); | |
760 parser->markSupportsRuleHeaderEnd(); | |
761 } | |
762 ; | |
763 | |
764 supports_condition: | |
765 supports_condition_in_parens | |
766 | supports_negation | |
767 | supports_conjunction | |
768 | supports_disjunction | |
769 ; | |
770 | |
771 supports_negation: | |
772 SUPPORTS_NOT maybe_space supports_condition_in_parens { | |
773 $$ = !$3; | |
774 } | |
775 ; | |
776 | |
777 supports_conjunction: | |
778 supports_condition_in_parens SUPPORTS_AND maybe_space supports_condition_in_
parens { | |
779 $$ = $1 && $4; | |
780 } | |
781 | supports_conjunction SUPPORTS_AND maybe_space supports_condition_in_parens
{ | |
782 $$ = $1 && $4; | |
783 } | |
784 ; | |
785 | |
786 supports_disjunction: | |
787 supports_condition_in_parens SUPPORTS_OR maybe_space supports_condition_in_p
arens { | |
788 $$ = $1 || $4; | |
789 } | |
790 | supports_disjunction SUPPORTS_OR maybe_space supports_condition_in_parens
{ | |
791 $$ = $1 || $4; | |
792 } | |
793 ; | |
794 | |
795 supports_condition_in_parens: | |
796 '(' maybe_space supports_condition closing_parenthesis maybe_space { | |
797 $$ = $3; | |
798 } | |
799 | supports_declaration_condition | |
800 | '(' error error_location error_recovery closing_parenthesis maybe_space { | |
801 parser->reportError($3, InvalidSupportsConditionCSSError); | |
802 $$ = false; | |
803 } | |
804 ; | |
805 | |
806 supports_declaration_condition: | |
807 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio closing_parenthe
sis maybe_space { | |
808 $$ = false; | |
809 CSSPropertyID id = cssPropertyID($3); | |
810 if (id != CSSPropertyInvalid) { | |
811 parser->m_valueList = parser->sinkFloatingValueList($7); | |
812 int oldParsedProperties = parser->m_parsedProperties.size(); | |
813 $$ = parser->parseValue(id, $8); | |
814 // We just need to know if the declaration is supported as it is wri
tten. Rollback any additions. | |
815 if ($$) | |
816 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); | |
817 } | |
818 parser->m_valueList = nullptr; | |
819 parser->endProperty($8, false); | |
820 } | |
821 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo
sing_parenthesis maybe_space { | |
822 $$ = false; | |
823 parser->endProperty(false, false, GeneralCSSError); | |
824 } | |
825 ; | |
826 | |
827 before_keyframes_rule: | |
828 /* empty */ { | |
829 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); | |
830 } | |
831 ; | |
832 | |
833 keyframes_rule_start: | |
834 before_keyframes_rule KEYFRAMES_SYM maybe_space { | |
835 $$ = false; | |
836 } | |
837 | before_keyframes_rule WEBKIT_KEYFRAMES_SYM maybe_space { | |
838 $$ = true; | |
839 } | |
840 ; | |
841 | |
842 keyframes: | |
843 keyframes_rule_start keyframe_name at_rule_header_end_maybe_space '{' at_rul
e_body_start maybe_space location_label keyframes_rule closing_brace { | |
844 $$ = parser->createKeyframesRule($2, parser->sinkFloatingKeyframeVector(
$8), $1 /* isPrefixed */); | |
845 } | |
846 ; | |
847 | |
848 keyframe_name: | |
849 IDENT | |
850 | STRING | |
851 ; | |
852 | |
853 keyframes_rule: | |
854 keyframe_rule_list | |
855 | keyframe_rule_list keyframes_error_recovery { | |
856 parser->clearProperties(); | |
857 }; | |
858 | |
859 keyframe_rule_list: | |
860 /* empty */ { | |
861 $$ = parser->createFloatingKeyframeVector(); | |
862 parser->resumeErrorLogging(); | |
863 } | |
864 | keyframe_rule_list keyframe_rule maybe_space location_label { | |
865 $$ = $1; | |
866 $$->append($2); | |
867 } | |
868 | keyframe_rule_list keyframes_error_recovery invalid_block maybe_space loca
tion_label { | |
869 parser->clearProperties(); | |
870 parser->resumeErrorLogging(); | |
871 } | |
872 ; | |
873 | |
874 keyframe_rule: | |
875 key_list '{' maybe_space declaration_list closing_brace { | |
876 $$ = parser->createKeyframe($1); | |
877 } | |
878 ; | |
879 | |
880 key_list: | |
881 key maybe_space { | |
882 $$ = parser->createFloatingValueList(); | |
883 $$->addValue(parser->sinkFloatingValue($1)); | |
884 } | |
885 | key_list ',' maybe_space key maybe_space { | |
886 $$ = $1; | |
887 $$->addValue(parser->sinkFloatingValue($4)); | |
888 } | |
889 ; | |
890 | |
891 key: | |
892 maybe_unary_operator PERCENTAGE { | |
893 $$.setFromNumber($1 * $2); | |
894 } | |
895 | IDENT { | |
896 if ($1.equalIgnoringCase("from")) | |
897 $$.setFromNumber(0); | |
898 else if ($1.equalIgnoringCase("to")) | |
899 $$.setFromNumber(100); | |
900 else { | |
901 YYERROR; | |
902 } | |
903 } | |
904 ; | |
905 | |
906 keyframes_error_recovery: | |
907 error rule_error_recovery { | |
908 parser->reportError(parser->lastLocationLabel(), InvalidKeyframeSelector
CSSError); | |
909 } | |
910 ; | |
911 | |
912 before_page_rule: | |
913 /* empty */ { | |
914 parser->startRuleHeader(CSSRuleSourceData::PAGE_RULE); | |
915 } | |
916 ; | |
917 | |
918 page: | |
919 before_page_rule PAGE_SYM maybe_space page_selector at_rule_header_end | |
920 '{' at_rule_body_start maybe_space_before_declaration declarations_and_margi
ns closing_brace { | |
921 if ($4) | |
922 $$ = parser->createPageRule(parser->sinkFloatingSelector($4)); | |
923 else { | |
924 // Clear properties in the invalid @page rule. | |
925 parser->clearProperties(); | |
926 // Also clear margin at-rules here once we fully implement margin at
-rules parsing. | |
927 $$ = 0; | |
928 } | |
929 } | |
930 ; | |
931 | |
932 page_selector: | |
933 IDENT maybe_space { | |
934 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $
1, parser->m_defaultNamespace)); | |
935 $$->setForPage(); | |
936 } | |
937 | IDENT pseudo_page maybe_space { | |
938 $$ = $2; | |
939 $$->prependTagSelector(QualifiedName(nullAtom, $1, parser->m_defaultName
space)); | |
940 $$->setForPage(); | |
941 } | |
942 | pseudo_page maybe_space { | |
943 $$ = $1; | |
944 $$->setForPage(); | |
945 } | |
946 | /* empty */ { | |
947 $$ = parser->createFloatingSelector(); | |
948 $$->setForPage(); | |
949 } | |
950 ; | |
951 | |
952 declarations_and_margins: | |
953 declaration_list | |
954 | declarations_and_margins margin_box maybe_space declaration_list | |
955 ; | |
956 | |
957 margin_box: | |
958 margin_sym { | |
959 parser->startDeclarationsForMarginBox(); | |
960 } maybe_space '{' maybe_space declaration_list closing_brace { | |
961 $$ = parser->createMarginAtRule($1); | |
962 } | |
963 ; | |
964 | |
965 margin_sym : | |
966 TOPLEFTCORNER_SYM { | |
967 $$ = CSSSelector::TopLeftCornerMarginBox; | |
968 } | |
969 | TOPLEFT_SYM { | |
970 $$ = CSSSelector::TopLeftMarginBox; | |
971 } | |
972 | TOPCENTER_SYM { | |
973 $$ = CSSSelector::TopCenterMarginBox; | |
974 } | |
975 | TOPRIGHT_SYM { | |
976 $$ = CSSSelector::TopRightMarginBox; | |
977 } | |
978 | TOPRIGHTCORNER_SYM { | |
979 $$ = CSSSelector::TopRightCornerMarginBox; | |
980 } | |
981 | BOTTOMLEFTCORNER_SYM { | |
982 $$ = CSSSelector::BottomLeftCornerMarginBox; | |
983 } | |
984 | BOTTOMLEFT_SYM { | |
985 $$ = CSSSelector::BottomLeftMarginBox; | |
986 } | |
987 | BOTTOMCENTER_SYM { | |
988 $$ = CSSSelector::BottomCenterMarginBox; | |
989 } | |
990 | BOTTOMRIGHT_SYM { | |
991 $$ = CSSSelector::BottomRightMarginBox; | |
992 } | |
993 | BOTTOMRIGHTCORNER_SYM { | |
994 $$ = CSSSelector::BottomRightCornerMarginBox; | |
995 } | |
996 | LEFTTOP_SYM { | |
997 $$ = CSSSelector::LeftTopMarginBox; | |
998 } | |
999 | LEFTMIDDLE_SYM { | |
1000 $$ = CSSSelector::LeftMiddleMarginBox; | |
1001 } | |
1002 | LEFTBOTTOM_SYM { | |
1003 $$ = CSSSelector::LeftBottomMarginBox; | |
1004 } | |
1005 | RIGHTTOP_SYM { | |
1006 $$ = CSSSelector::RightTopMarginBox; | |
1007 } | |
1008 | RIGHTMIDDLE_SYM { | |
1009 $$ = CSSSelector::RightMiddleMarginBox; | |
1010 } | |
1011 | RIGHTBOTTOM_SYM { | |
1012 $$ = CSSSelector::RightBottomMarginBox; | |
1013 } | |
1014 ; | |
1015 | |
1016 before_font_face_rule: | |
1017 /* empty */ { | |
1018 parser->startRuleHeader(CSSRuleSourceData::FONT_FACE_RULE); | |
1019 } | |
1020 ; | |
1021 | |
1022 font_face: | |
1023 before_font_face_rule FONT_FACE_SYM at_rule_header_end_maybe_space | |
1024 '{' at_rule_body_start maybe_space_before_declaration declaration_list closi
ng_brace { | |
1025 $$ = parser->createFontFaceRule(); | |
1026 } | |
1027 ; | |
1028 | |
1029 before_viewport_rule: | |
1030 /* empty */ { | |
1031 parser->markViewportRuleBodyStart(); | |
1032 parser->startRuleHeader(CSSRuleSourceData::VIEWPORT_RULE); | |
1033 } | |
1034 ; | |
1035 | |
1036 viewport: | |
1037 before_viewport_rule VIEWPORT_RULE_SYM at_rule_header_end_maybe_space | |
1038 '{' at_rule_body_start maybe_space_before_declaration declaration_list closi
ng_brace { | |
1039 $$ = parser->createViewportRule(); | |
1040 parser->markViewportRuleBodyEnd(); | |
1041 } | |
1042 ; | |
1043 | |
1044 combinator: | |
1045 '+' maybe_space { $$ = CSSSelector::DirectAdjacent; } | |
1046 | '~' maybe_space { $$ = CSSSelector::IndirectAdjacent; } | |
1047 | '>' maybe_space { $$ = CSSSelector::Child; } | |
1048 | '/' IDENT '/' maybe_space { | |
1049 if ($2.equalIgnoringCase("deep")) | |
1050 $$ = CSSSelector::ShadowDeep; | |
1051 else | |
1052 YYERROR; | |
1053 } | |
1054 ; | |
1055 | |
1056 maybe_unary_operator: | |
1057 unary_operator | |
1058 | /* empty */ { $$ = 1; } | |
1059 ; | |
1060 | |
1061 unary_operator: | |
1062 '-' { $$ = -1; } | |
1063 | '+' { $$ = 1; } | |
1064 ; | |
1065 | |
1066 maybe_space_before_declaration: | |
1067 maybe_space { | |
1068 parser->startProperty(); | |
1069 } | |
1070 ; | |
1071 | |
1072 before_selector_list: | |
1073 /* empty */ { | |
1074 parser->startRuleHeader(CSSRuleSourceData::STYLE_RULE); | |
1075 parser->startSelector(); | |
1076 } | |
1077 ; | |
1078 | |
1079 at_rule_header_end: | |
1080 /* empty */ { | |
1081 parser->endRuleHeader(); | |
1082 } | |
1083 ; | |
1084 | |
1085 at_selector_end: | |
1086 /* empty */ { | |
1087 parser->endSelector(); | |
1088 } | |
1089 ; | |
1090 | |
1091 ruleset: | |
1092 before_selector_list selector_list at_selector_end at_rule_header_end '{' at
_rule_body_start maybe_space_before_declaration declaration_list closing_brace { | |
1093 $$ = parser->createStyleRule($2); | |
1094 } | |
1095 ; | |
1096 | |
1097 before_selector_group_item: | |
1098 /* empty */ { | |
1099 parser->startSelector(); | |
1100 } | |
1101 | |
1102 selector_list: | |
1103 selector %prec UNIMPORTANT_TOK { | |
1104 $$ = parser->reusableSelectorVector(); | |
1105 $$->shrink(0); | |
1106 $$->append(parser->sinkFloatingSelector($1)); | |
1107 } | |
1108 | selector_list at_selector_end ',' maybe_space before_selector_group_item s
elector %prec UNIMPORTANT_TOK { | |
1109 $$ = $1; | |
1110 $$->append(parser->sinkFloatingSelector($6)); | |
1111 } | |
1112 ; | |
1113 | |
1114 selector: | |
1115 simple_selector | |
1116 | selector WHITESPACE | |
1117 | selector WHITESPACE simple_selector | |
1118 { | |
1119 $$ = $3; | |
1120 CSSParserSelector* end = $$; | |
1121 while (end->tagHistory()) | |
1122 end = end->tagHistory(); | |
1123 end->setRelation(CSSSelector::Descendant); | |
1124 if ($1->isContentPseudoElement()) | |
1125 end->setRelationIsAffectedByPseudoContent(); | |
1126 end->setTagHistory(parser->sinkFloatingSelector($1)); | |
1127 } | |
1128 | selector combinator simple_selector { | |
1129 $$ = $3; | |
1130 CSSParserSelector* end = $$; | |
1131 while (end->tagHistory()) | |
1132 end = end->tagHistory(); | |
1133 end->setRelation($2); | |
1134 if ($1->isContentPseudoElement()) | |
1135 end->setRelationIsAffectedByPseudoContent(); | |
1136 end->setTagHistory(parser->sinkFloatingSelector($1)); | |
1137 } | |
1138 ; | |
1139 | |
1140 namespace_selector: | |
1141 /* empty */ '|' { $$.clear(); } | |
1142 | '*' '|' { static const LChar star = '*'; $$.init(&star, 1); } | |
1143 | IDENT '|' | |
1144 ; | |
1145 | |
1146 simple_selector: | |
1147 element_name { | |
1148 $$ = parser->createFloatingSelectorWithTagName(QualifiedName(nullAtom, $
1, parser->m_defaultNamespace)); | |
1149 } | |
1150 | element_name specifier_list { | |
1151 $$ = parser->rewriteSpecifiersWithElementName(nullAtom, $1, $2); | |
1152 if (!$$) | |
1153 YYERROR; | |
1154 } | |
1155 | specifier_list { | |
1156 $$ = parser->rewriteSpecifiersWithNamespaceIfNeeded($1); | |
1157 if (!$$) | |
1158 YYERROR; | |
1159 } | |
1160 | namespace_selector element_name { | |
1161 $$ = parser->createFloatingSelectorWithTagName(parser->determineNameInNa
mespace($1, $2)); | |
1162 if (!$$) | |
1163 YYERROR; | |
1164 } | |
1165 | namespace_selector element_name specifier_list { | |
1166 $$ = parser->rewriteSpecifiersWithElementName($1, $2, $3); | |
1167 if (!$$) | |
1168 YYERROR; | |
1169 } | |
1170 | namespace_selector specifier_list { | |
1171 $$ = parser->rewriteSpecifiersWithElementName($1, starAtom, $2); | |
1172 if (!$$) | |
1173 YYERROR; | |
1174 } | |
1175 ; | |
1176 | |
1177 simple_selector_list: | |
1178 simple_selector %prec UNIMPORTANT_TOK { | |
1179 $$ = parser->createFloatingSelectorVector(); | |
1180 $$->append(parser->sinkFloatingSelector($1)); | |
1181 } | |
1182 | simple_selector_list maybe_space ',' maybe_space simple_selector %prec UNI
MPORTANT_TOK { | |
1183 $$ = $1; | |
1184 $$->append(parser->sinkFloatingSelector($5)); | |
1185 } | |
1186 ; | |
1187 | |
1188 element_name: | |
1189 IDENT { | |
1190 if (parser->m_context.isHTMLDocument()) | |
1191 parser->tokenToLowerCase($1); | |
1192 $$ = $1; | |
1193 } | |
1194 | '*' { | |
1195 static const LChar star = '*'; | |
1196 $$.init(&star, 1); | |
1197 } | |
1198 ; | |
1199 | |
1200 specifier_list: | |
1201 specifier | |
1202 | specifier_list specifier { | |
1203 $$ = parser->rewriteSpecifiers($1, $2); | |
1204 } | |
1205 ; | |
1206 | |
1207 specifier: | |
1208 IDSEL { | |
1209 $$ = parser->createFloatingSelector(); | |
1210 $$->setMatch(CSSSelector::Id); | |
1211 if (isQuirksModeBehavior(parser->m_context.mode())) | |
1212 parser->tokenToLowerCase($1); | |
1213 $$->setValue($1); | |
1214 } | |
1215 | HEX { | |
1216 if ($1[0] >= '0' && $1[0] <= '9') { | |
1217 YYERROR; | |
1218 } else { | |
1219 $$ = parser->createFloatingSelector(); | |
1220 $$->setMatch(CSSSelector::Id); | |
1221 if (isQuirksModeBehavior(parser->m_context.mode())) | |
1222 parser->tokenToLowerCase($1); | |
1223 $$->setValue($1); | |
1224 } | |
1225 } | |
1226 | class | |
1227 | attrib | |
1228 | pseudo | |
1229 ; | |
1230 | |
1231 class: | |
1232 '.' IDENT { | |
1233 $$ = parser->createFloatingSelector(); | |
1234 $$->setMatch(CSSSelector::Class); | |
1235 if (isQuirksModeBehavior(parser->m_context.mode())) | |
1236 parser->tokenToLowerCase($2); | |
1237 $$->setValue($2); | |
1238 } | |
1239 ; | |
1240 | |
1241 attr_name: | |
1242 IDENT maybe_space { | |
1243 if (parser->m_context.isHTMLDocument()) | |
1244 parser->tokenToLowerCase($1); | |
1245 $$ = $1; | |
1246 } | |
1247 ; | |
1248 | |
1249 attr_match_type: | |
1250 IDENT maybe_space { | |
1251 CSSSelector::AttributeMatchType attrMatchType = CSSSelector::CaseSensiti
ve; | |
1252 if (!parser->parseAttributeMatchType(attrMatchType, $1)) | |
1253 YYERROR; | |
1254 $$ = attrMatchType; | |
1255 } | |
1256 ; | |
1257 | |
1258 maybe_attr_match_type: | |
1259 attr_match_type | |
1260 | /* empty */ { $$ = CSSSelector::CaseSensitive; } | |
1261 ; | |
1262 | |
1263 attrib: | |
1264 '[' maybe_space attr_name closing_square_bracket { | |
1265 $$ = parser->createFloatingSelector(); | |
1266 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom), CSSSelector::Cas
eSensitive); | |
1267 $$->setMatch(CSSSelector::Set); | |
1268 } | |
1269 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space ma
ybe_attr_match_type closing_square_bracket { | |
1270 $$ = parser->createFloatingSelector(); | |
1271 $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom), $8); | |
1272 $$->setMatch((CSSSelector::Match)$4); | |
1273 $$->setValue($6); | |
1274 } | |
1275 | '[' maybe_space namespace_selector attr_name closing_square_bracket { | |
1276 $$ = parser->createFloatingSelector(); | |
1277 $$->setAttribute(parser->determineNameInNamespace($3, $4), CSSSelector::
CaseSensitive); | |
1278 $$->setMatch(CSSSelector::Set); | |
1279 } | |
1280 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_st
ring maybe_space maybe_attr_match_type closing_square_bracket { | |
1281 $$ = parser->createFloatingSelector(); | |
1282 $$->setAttribute(parser->determineNameInNamespace($3, $4), $9); | |
1283 $$->setMatch((CSSSelector::Match)$5); | |
1284 $$->setValue($7); | |
1285 } | |
1286 | '[' selector_recovery closing_square_bracket { | |
1287 YYERROR; | |
1288 } | |
1289 ; | |
1290 | |
1291 match: | |
1292 '=' { | |
1293 $$ = CSSSelector::Exact; | |
1294 } | |
1295 | INCLUDES { | |
1296 $$ = CSSSelector::List; | |
1297 } | |
1298 | DASHMATCH { | |
1299 $$ = CSSSelector::Hyphen; | |
1300 } | |
1301 | BEGINSWITH { | |
1302 $$ = CSSSelector::Begin; | |
1303 } | |
1304 | ENDSWITH { | |
1305 $$ = CSSSelector::End; | |
1306 } | |
1307 | CONTAINS { | |
1308 $$ = CSSSelector::Contain; | |
1309 } | |
1310 ; | |
1311 | |
1312 ident_or_string: | |
1313 IDENT | |
1314 | STRING | |
1315 ; | |
1316 | |
1317 pseudo_page: | |
1318 ':' IDENT { | |
1319 if ($2.isFunction()) | |
1320 YYERROR; | |
1321 $$ = parser->createFloatingSelector(); | |
1322 $$->setMatch(CSSSelector::PagePseudoClass); | |
1323 parser->tokenToLowerCase($2); | |
1324 $$->setValue($2); | |
1325 CSSSelector::PseudoType type = $$->pseudoType(); | |
1326 if (type == CSSSelector::PseudoUnknown) | |
1327 YYERROR; | |
1328 } | |
1329 | |
1330 pseudo: | |
1331 ':' error_location IDENT { | |
1332 if ($3.isFunction()) | |
1333 YYERROR; | |
1334 $$ = parser->createFloatingSelector(); | |
1335 $$->setMatch(CSSSelector::PseudoClass); | |
1336 parser->tokenToLowerCase($3); | |
1337 $$->setValue($3); | |
1338 CSSSelector::PseudoType type = $$->pseudoType(); | |
1339 if (type == CSSSelector::PseudoUnknown) { | |
1340 parser->reportError($2, InvalidSelectorPseudoCSSError); | |
1341 YYERROR; | |
1342 } | |
1343 } | |
1344 | ':' ':' error_location IDENT { | |
1345 if ($4.isFunction()) | |
1346 YYERROR; | |
1347 $$ = parser->createFloatingSelector(); | |
1348 $$->setMatch(CSSSelector::PseudoElement); | |
1349 parser->tokenToLowerCase($4); | |
1350 $$->setValue($4); | |
1351 // FIXME: This call is needed to force selector to compute the pseudoTyp
e early enough. | |
1352 CSSSelector::PseudoType type = $$->pseudoType(); | |
1353 if (type == CSSSelector::PseudoUnknown) { | |
1354 parser->reportError($3, InvalidSelectorPseudoCSSError); | |
1355 YYERROR; | |
1356 } | |
1357 } | |
1358 // used by ::cue(:past/:future) | |
1359 | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space closing_p
arenthesis { | |
1360 $$ = parser->createFloatingSelector(); | |
1361 $$->setMatch(CSSSelector::PseudoElement); | |
1362 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($5)); | |
1363 $$->setValue($3); | |
1364 CSSSelector::PseudoType type = $$->pseudoType(); | |
1365 if (type != CSSSelector::PseudoCue) | |
1366 YYERROR; | |
1367 } | |
1368 | ':' ':' CUEFUNCTION selector_recovery closing_parenthesis { | |
1369 YYERROR; | |
1370 } | |
1371 // use by :-webkit-any. | |
1372 // FIXME: should we support generic selectors here or just simple_selectors? | |
1373 // Use simple_selector_list for now to match -moz-any. | |
1374 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for s
ome | |
1375 // related discussion with respect to :not. | |
1376 | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space closing_paren
thesis { | |
1377 $$ = parser->createFloatingSelector(); | |
1378 $$->setMatch(CSSSelector::PseudoClass); | |
1379 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); | |
1380 parser->tokenToLowerCase($2); | |
1381 $$->setValue($2); | |
1382 CSSSelector::PseudoType type = $$->pseudoType(); | |
1383 if (type != CSSSelector::PseudoAny) | |
1384 YYERROR; | |
1385 } | |
1386 | ':' ANYFUNCTION selector_recovery closing_parenthesis { | |
1387 YYERROR; | |
1388 } | |
1389 // used by :nth-*(ax+b) | |
1390 | ':' FUNCTION maybe_space NTH maybe_space closing_parenthesis { | |
1391 $$ = parser->createFloatingSelector(); | |
1392 $$->setMatch(CSSSelector::PseudoClass); | |
1393 $$->setArgument($4); | |
1394 $$->setValue($2); | |
1395 CSSSelector::PseudoType type = $$->pseudoType(); | |
1396 if (type == CSSSelector::PseudoUnknown) | |
1397 YYERROR; | |
1398 } | |
1399 // used by :nth-* | |
1400 | ':' FUNCTION maybe_space maybe_unary_operator INTEGER maybe_space closing_
parenthesis { | |
1401 $$ = parser->createFloatingSelector(); | |
1402 $$->setMatch(CSSSelector::PseudoClass); | |
1403 $$->setArgument(AtomicString::number($4 * $5)); | |
1404 $$->setValue($2); | |
1405 CSSSelector::PseudoType type = $$->pseudoType(); | |
1406 if (type == CSSSelector::PseudoUnknown) | |
1407 YYERROR; | |
1408 } | |
1409 // used by :nth-*(odd/even) and :lang | |
1410 | ':' FUNCTION maybe_space IDENT maybe_space closing_parenthesis { | |
1411 $$ = parser->createFloatingSelector(); | |
1412 $$->setMatch(CSSSelector::PseudoClass); | |
1413 $$->setArgument($4); | |
1414 parser->tokenToLowerCase($2); | |
1415 $$->setValue($2); | |
1416 CSSSelector::PseudoType type = $$->pseudoType(); | |
1417 if (type == CSSSelector::PseudoUnknown) | |
1418 YYERROR; | |
1419 else if (type == CSSSelector::PseudoNthChild || | |
1420 type == CSSSelector::PseudoNthOfType || | |
1421 type == CSSSelector::PseudoNthLastChild || | |
1422 type == CSSSelector::PseudoNthLastOfType) { | |
1423 if (!isValidNthToken($4)) | |
1424 YYERROR; | |
1425 } | |
1426 } | |
1427 | ':' FUNCTION selector_recovery closing_parenthesis { | |
1428 YYERROR; | |
1429 } | |
1430 // used by :not | |
1431 | ':' NOTFUNCTION maybe_space simple_selector maybe_space closing_parenthesi
s { | |
1432 if (!$4->isSimple()) | |
1433 YYERROR; | |
1434 else { | |
1435 $$ = parser->createFloatingSelector(); | |
1436 $$->setMatch(CSSSelector::PseudoClass); | |
1437 | |
1438 Vector<OwnPtr<CSSParserSelector> > selectorVector; | |
1439 selectorVector.append(parser->sinkFloatingSelector($4)); | |
1440 $$->adoptSelectorVector(selectorVector); | |
1441 | |
1442 parser->tokenToLowerCase($2); | |
1443 $$->setValue($2); | |
1444 } | |
1445 } | |
1446 | ':' NOTFUNCTION selector_recovery closing_parenthesis { | |
1447 YYERROR; | |
1448 } | |
1449 | ':' HOSTFUNCTION maybe_space simple_selector_list maybe_space closing_pare
nthesis { | |
1450 $$ = parser->createFloatingSelector(); | |
1451 $$->setMatch(CSSSelector::PseudoClass); | |
1452 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); | |
1453 parser->tokenToLowerCase($2); | |
1454 $$->setValue($2); | |
1455 CSSSelector::PseudoType type = $$->pseudoType(); | |
1456 if (type != CSSSelector::PseudoHost) | |
1457 YYERROR; | |
1458 } | |
1459 | ':' HOSTFUNCTION selector_recovery closing_parenthesis { | |
1460 YYERROR; | |
1461 } | |
1462 // used by :host-context() | |
1463 | ':' HOSTCONTEXTFUNCTION maybe_space simple_selector_list maybe_space closi
ng_parenthesis { | |
1464 $$ = parser->createFloatingSelector(); | |
1465 $$->setMatch(CSSSelector::PseudoClass); | |
1466 $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); | |
1467 parser->tokenToLowerCase($2); | |
1468 $$->setValue($2); | |
1469 CSSSelector::PseudoType type = $$->pseudoType(); | |
1470 if (type != CSSSelector::PseudoHostContext) | |
1471 YYERROR; | |
1472 } | |
1473 | ':' HOSTCONTEXTFUNCTION selector_recovery closing_parenthesis { | |
1474 YYERROR; | |
1475 } | |
1476 ; | |
1477 | |
1478 selector_recovery: | |
1479 error error_location error_recovery; | |
1480 | |
1481 declaration_list: | |
1482 /* empty */ { $$ = false; } | |
1483 | declaration | |
1484 | decl_list declaration { | |
1485 $$ = $1 || $2; | |
1486 } | |
1487 | decl_list | |
1488 ; | |
1489 | |
1490 decl_list: | |
1491 declaration ';' maybe_space { | |
1492 parser->startProperty(); | |
1493 $$ = $1; | |
1494 } | |
1495 | decl_list declaration ';' maybe_space { | |
1496 parser->startProperty(); | |
1497 $$ = $1 || $2; | |
1498 } | |
1499 ; | |
1500 | |
1501 declaration: | |
1502 property ':' maybe_space error_location expr prio { | |
1503 $$ = false; | |
1504 bool isPropertyParsed = false; | |
1505 if ($1 != CSSPropertyInvalid) { | |
1506 parser->m_valueList = parser->sinkFloatingValueList($5); | |
1507 int oldParsedProperties = parser->m_parsedProperties.size(); | |
1508 $$ = parser->parseValue($1, $6); | |
1509 if (!$$) { | |
1510 parser->rollbackLastProperties(parser->m_parsedProperties.size()
- oldParsedProperties); | |
1511 parser->reportError($4, InvalidPropertyValueCSSError); | |
1512 } else | |
1513 isPropertyParsed = true; | |
1514 parser->m_valueList = nullptr; | |
1515 } | |
1516 parser->endProperty($6, isPropertyParsed); | |
1517 } | |
1518 | | |
1519 property ':' maybe_space error_location expr prio error error_recovery { | |
1520 /* When we encounter something like p {color: red !important fail;} we s
hould drop the declaration */ | |
1521 parser->reportError($4, InvalidPropertyValueCSSError); | |
1522 parser->endProperty(false, false); | |
1523 $$ = false; | |
1524 } | |
1525 | | |
1526 property ':' maybe_space error_location error error_recovery { | |
1527 parser->reportError($4, InvalidPropertyValueCSSError); | |
1528 parser->endProperty(false, false); | |
1529 $$ = false; | |
1530 } | |
1531 | | |
1532 property error error_location error_recovery { | |
1533 parser->reportError($3, PropertyDeclarationCSSError); | |
1534 parser->endProperty(false, false, GeneralCSSError); | |
1535 $$ = false; | |
1536 } | |
1537 | | |
1538 error error_location error_recovery { | |
1539 parser->reportError($2, PropertyDeclarationCSSError); | |
1540 $$ = false; | |
1541 } | |
1542 ; | |
1543 | |
1544 property: | |
1545 error_location IDENT maybe_space { | |
1546 $$ = cssPropertyID($2); | |
1547 parser->setCurrentProperty($$); | |
1548 if ($$ == CSSPropertyInvalid) | |
1549 parser->reportError($1, InvalidPropertyCSSError); | |
1550 } | |
1551 ; | |
1552 | |
1553 prio: | |
1554 IMPORTANT_SYM maybe_space { $$ = true; } | |
1555 | /* empty */ { $$ = false; } | |
1556 ; | |
1557 | |
1558 ident_list: | |
1559 IDENT maybe_space { | |
1560 $$ = parser->createFloatingValueList(); | |
1561 $$->addValue(makeIdentValue($1)); | |
1562 } | |
1563 | ident_list IDENT maybe_space { | |
1564 $$ = $1; | |
1565 $$->addValue(makeIdentValue($2)); | |
1566 } | |
1567 ; | |
1568 | |
1569 track_names_list: | |
1570 '(' maybe_space closing_parenthesis { | |
1571 $$.setFromValueList(parser->sinkFloatingValueList(parser->createFloating
ValueList())); | |
1572 } | |
1573 | '(' maybe_space ident_list closing_parenthesis { | |
1574 $$.setFromValueList(parser->sinkFloatingValueList($3)); | |
1575 } | |
1576 | '(' maybe_space expr_recovery closing_parenthesis { | |
1577 YYERROR; | |
1578 } | |
1579 ; | |
1580 | |
1581 expr: | |
1582 term { | |
1583 $$ = parser->createFloatingValueList(); | |
1584 $$->addValue(parser->sinkFloatingValue($1)); | |
1585 } | |
1586 | expr operator term { | |
1587 $$ = $1; | |
1588 $$->addValue(makeOperatorValue($2)); | |
1589 $$->addValue(parser->sinkFloatingValue($3)); | |
1590 } | |
1591 | expr term { | |
1592 $$ = $1; | |
1593 $$->addValue(parser->sinkFloatingValue($2)); | |
1594 } | |
1595 ; | |
1596 | |
1597 expr_recovery: | |
1598 error error_location error_recovery { | |
1599 parser->reportError($2, PropertyDeclarationCSSError); | |
1600 } | |
1601 ; | |
1602 | |
1603 operator: | |
1604 '/' maybe_space { | |
1605 $$ = '/'; | |
1606 } | |
1607 | ',' maybe_space { | |
1608 $$ = ','; | |
1609 } | |
1610 ; | |
1611 | |
1612 term: | |
1613 unary_term maybe_space | |
1614 | unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } | |
1615 | STRING maybe_space { $$.id = CSSValueInvalid; $$.isInt = false; $$.string =
$1; $$.unit = CSSPrimitiveValue::CSS_STRING; } | |
1616 | IDENT maybe_space { $$ = makeIdentValue($1); } | |
1617 /* 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. */ | |
1618 | DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.isInt = fals
e; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | |
1619 | unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2;
$$.isInt = false; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | |
1620 | URI maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.isInt = false;
$$.unit = CSSPrimitiveValue::CSS_URI; } | |
1621 | UNICODERANGE maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.isInt
= false; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } | |
1622 | HEX maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.isInt = false;
$$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } | |
1623 | '#' maybe_space { $$.id = CSSValueInvalid; $$.string = CSSParserString(); $$
.isInt = false; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle er
ror case: "color: #;" */ | |
1624 /* FIXME: according to the specs a function can have a unary_operator in front
. I know no case where this makes sense */ | |
1625 | function maybe_space | |
1626 | calc_function maybe_space | |
1627 | '%' maybe_space { /* Handle width: %; */ | |
1628 $$.id = CSSValueInvalid; $$.isInt = false; $$.unit = 0; | |
1629 } | |
1630 | track_names_list maybe_space | |
1631 ; | |
1632 | |
1633 unary_term: | |
1634 INTEGER { $$.setFromNumber($1); $$.isInt = true; } | |
1635 | FLOATTOKEN { $$.setFromNumber($1); } | |
1636 | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); } | |
1637 | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); } | |
1638 | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); } | |
1639 | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); } | |
1640 | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); } | |
1641 | PTS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PT); } | |
1642 | PCS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PC); } | |
1643 | DEGS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DEG); } | |
1644 | RADS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_RAD); } | |
1645 | GRADS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_GRAD); } | |
1646 | TURNS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_TURN); } | |
1647 | MSECS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MS); } | |
1648 | SECS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_S); } | |
1649 | HERTZ { $$.setFromNumber($1, CSSPrimitiveValue::CSS_HZ); } | |
1650 | KHERTZ { $$.setFromNumber($1, CSSPrimitiveValue::CSS_KHZ); } | |
1651 | EMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EMS); } | |
1652 | QEMS { $$.setFromNumber($1, CSSParserValue::Q_EMS); } | |
1653 | EXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EXS); } | |
1654 | REMS { | |
1655 $$.setFromNumber($1, CSSPrimitiveValue::CSS_REMS); | |
1656 if (parser->m_styleSheet) | |
1657 parser->m_styleSheet->parserSetUsesRemUnits(true); | |
1658 } | |
1659 | CHS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CHS); } | |
1660 | VW { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VW); } | |
1661 | VH { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VH); } | |
1662 | VMIN { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VMIN); } | |
1663 | VMAX { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VMAX); } | |
1664 | DPPX { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPPX); } | |
1665 | DPI { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPI); } | |
1666 | DPCM { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPCM); } | |
1667 | FR { $$.setFromNumber($1, CSSPrimitiveValue::CSS_FR); } | |
1668 ; | |
1669 | |
1670 function: | |
1671 FUNCTION maybe_space expr closing_parenthesis { | |
1672 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati
ngValueList($3))); | |
1673 } | | |
1674 FUNCTION maybe_space closing_parenthesis { | |
1675 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati
ngValueList(parser->createFloatingValueList()))); | |
1676 } | | |
1677 FUNCTION maybe_space expr_recovery closing_parenthesis { | |
1678 YYERROR; | |
1679 } | |
1680 ; | |
1681 | |
1682 calc_func_term: | |
1683 unary_term | |
1684 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } | |
1685 ; | |
1686 | |
1687 calc_func_operator: | |
1688 space '+' space { | |
1689 $$ = '+'; | |
1690 } | |
1691 | space '-' space { | |
1692 $$ = '-'; | |
1693 } | |
1694 | calc_maybe_space '*' maybe_space { | |
1695 $$ = '*'; | |
1696 } | |
1697 | calc_maybe_space '/' maybe_space { | |
1698 $$ = '/'; | |
1699 } | |
1700 ; | |
1701 | |
1702 calc_maybe_space: | |
1703 /* empty */ | |
1704 | WHITESPACE | |
1705 ; | |
1706 | |
1707 calc_func_paren_expr: | |
1708 '(' maybe_space calc_func_expr calc_maybe_space closing_parenthesis { | |
1709 $$ = $3; | |
1710 $$->insertValueAt(0, makeOperatorValue('(')); | |
1711 $$->addValue(makeOperatorValue(')')); | |
1712 } | |
1713 | '(' maybe_space expr_recovery closing_parenthesis { | |
1714 YYERROR; | |
1715 } | |
1716 ; | |
1717 | |
1718 calc_func_expr: | |
1719 calc_func_term { | |
1720 $$ = parser->createFloatingValueList(); | |
1721 $$->addValue(parser->sinkFloatingValue($1)); | |
1722 } | |
1723 | calc_func_expr calc_func_operator calc_func_term { | |
1724 $$ = $1; | |
1725 $$->addValue(makeOperatorValue($2)); | |
1726 $$->addValue(parser->sinkFloatingValue($3)); | |
1727 } | |
1728 | calc_func_expr calc_func_operator calc_func_paren_expr { | |
1729 $$ = $1; | |
1730 $$->addValue(makeOperatorValue($2)); | |
1731 $$->stealValues(*($3)); | |
1732 } | |
1733 | calc_func_paren_expr | |
1734 ; | |
1735 | |
1736 calc_function: | |
1737 CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis
{ | |
1738 $$.setFromFunction(parser->createFloatingFunction($1, parser->sinkFloati
ngValueList($3))); | |
1739 } | |
1740 | CALCFUNCTION maybe_space expr_recovery closing_parenthesis { | |
1741 YYERROR; | |
1742 } | |
1743 ; | |
1744 | |
1745 | |
1746 invalid_at: | |
1747 ATKEYWORD | |
1748 | margin_sym | |
1749 ; | |
1750 | |
1751 at_rule_recovery: | |
1752 at_rule_header_recovery at_invalid_rule_header_end at_rule_end | |
1753 ; | |
1754 | |
1755 at_rule_header_recovery: | |
1756 error error_location rule_error_recovery { | |
1757 parser->reportError($2, InvalidRuleCSSError); | |
1758 } | |
1759 ; | |
1760 | |
1761 at_rule_end: | |
1762 at_invalid_rule_header_end semi_or_eof | |
1763 | at_invalid_rule_header_end invalid_block | |
1764 ; | |
1765 | |
1766 regular_invalid_at_rule_header: | |
1767 keyframes_rule_start at_rule_header_recovery | |
1768 | before_page_rule PAGE_SYM at_rule_header_recovery | |
1769 | before_font_face_rule FONT_FACE_SYM at_rule_header_recovery | |
1770 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery { | |
1771 parser->reportError($4, InvalidSupportsConditionCSSError); | |
1772 parser->popSupportsRuleData(); | |
1773 } | |
1774 | before_viewport_rule VIEWPORT_RULE_SYM at_rule_header_recovery { | |
1775 parser->markViewportRuleBodyEnd(); | |
1776 } | |
1777 | import_rule_start at_rule_header_recovery | |
1778 | NAMESPACE_SYM at_rule_header_recovery | |
1779 | error_location invalid_at at_rule_header_recovery { | |
1780 parser->resumeErrorLogging(); | |
1781 parser->reportError($1, InvalidRuleCSSError); | |
1782 } | |
1783 ; | |
1784 | |
1785 invalid_rule: | |
1786 error error_location rule_error_recovery at_invalid_rule_header_end invalid_
block { | |
1787 parser->reportError($2, InvalidRuleCSSError); | |
1788 } | |
1789 | regular_invalid_at_rule_header at_invalid_rule_header_end ';' | |
1790 | regular_invalid_at_rule_header at_invalid_rule_header_end invalid_block | |
1791 | media_rule_start maybe_media_list ';' | |
1792 ; | |
1793 | |
1794 invalid_rule_header: | |
1795 error error_location rule_error_recovery at_invalid_rule_header_end { | |
1796 parser->reportError($2, InvalidRuleCSSError); | |
1797 } | |
1798 | regular_invalid_at_rule_header at_invalid_rule_header_end | |
1799 | media_rule_start maybe_media_list | |
1800 ; | |
1801 | |
1802 at_invalid_rule_header_end: | |
1803 /* empty */ { | |
1804 parser->endInvalidRuleHeader(); | |
1805 } | |
1806 ; | |
1807 | |
1808 invalid_block: | |
1809 '{' error_recovery closing_brace { | |
1810 parser->invalidBlockHit(); | |
1811 } | |
1812 ; | |
1813 | |
1814 invalid_square_brackets_block: | |
1815 '[' error_recovery closing_square_bracket | |
1816 ; | |
1817 | |
1818 invalid_parentheses_block: | |
1819 opening_parenthesis error_recovery closing_parenthesis; | |
1820 | |
1821 opening_parenthesis: | |
1822 '(' | FUNCTION | CALCFUNCTION | ANYFUNCTION | NOTFUNCTION | CUEFUNCTION | DI
STRIBUTEDFUNCTION | HOSTFUNCTION | |
1823 ; | |
1824 | |
1825 error_location: { | |
1826 $$ = parser->currentLocation(); | |
1827 } | |
1828 ; | |
1829 | |
1830 location_label: { | |
1831 parser->setLocationLabel(parser->currentLocation()); | |
1832 } | |
1833 ; | |
1834 | |
1835 error_recovery: | |
1836 /* empty */ | |
1837 | error_recovery error | |
1838 | error_recovery invalid_block | |
1839 | error_recovery invalid_square_brackets_block | |
1840 | error_recovery invalid_parentheses_block | |
1841 ; | |
1842 | |
1843 rule_error_recovery: | |
1844 /* empty */ | |
1845 | rule_error_recovery error | |
1846 | rule_error_recovery invalid_square_brackets_block | |
1847 | rule_error_recovery invalid_parentheses_block | |
1848 ; | |
1849 | |
1850 %% | |
OLD | NEW |