php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
parser.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020-2022 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
7#include "lexbor/css/css.h"
8#include "lexbor/css/state.h"
12
13
14static const lxb_css_syntax_token_t lxb_css_syntax_token_terminated =
15{
16 .types.terminated = {.begin = NULL, .length = 0, .user_id = 0},
18 .offset = 0,
19 .cloned = false
20};
21
22
23static const lxb_css_syntax_token_t *
24lxb_css_syntax_parser_list_rules(lxb_css_parser_t *parser,
25 const lxb_css_syntax_token_t *token,
27
28static const lxb_css_syntax_token_t *
29lxb_css_syntax_parser_list_rules_at(lxb_css_parser_t *parser,
30 const lxb_css_syntax_token_t *token,
32
33static const lxb_css_syntax_token_t *
34lxb_css_syntax_parser_list_rules_qualified(lxb_css_parser_t *parser,
35 const lxb_css_syntax_token_t *token,
37
38static bool
39lxb_css_syntax_parser_list_rules_back(lxb_css_parser_t *parser,
40 const lxb_css_syntax_token_t *token, void *ctx);
41
42static const lxb_css_syntax_token_t *
43lxb_css_syntax_parser_at_rule(lxb_css_parser_t *parser,
44 const lxb_css_syntax_token_t *token,
46
47static const lxb_css_syntax_token_t *
48lxb_css_syntax_parser_qualified_rule(lxb_css_parser_t *parser,
49 const lxb_css_syntax_token_t *token,
51
52static const lxb_css_syntax_token_t *
53lxb_css_syntax_parser_declarations(lxb_css_parser_t *parser,
54 const lxb_css_syntax_token_t *token,
56
57static bool
58lxb_css_syntax_parser_declarations_back(lxb_css_parser_t *parser,
59 const lxb_css_syntax_token_t *token, void *ctx);
60
61static const lxb_css_syntax_token_t *
62lxb_css_syntax_parser_declarations_name(lxb_css_parser_t *parser,
63 const lxb_css_syntax_token_t *token,
65
66static const lxb_css_syntax_token_t *
67lxb_css_syntax_parser_declarations_value(lxb_css_parser_t *parser,
68 const lxb_css_syntax_token_t *token,
70
71static const lxb_css_syntax_token_t *
72lxb_css_syntax_parser_declarations_next(lxb_css_parser_t *parser,
73 const lxb_css_syntax_token_t *token,
75
76static const lxb_css_syntax_token_t *
77lxb_css_syntax_parser_declarations_drop(lxb_css_parser_t *parser,
78 const lxb_css_syntax_token_t *token,
80
81static const lxb_css_syntax_token_t *
82lxb_css_syntax_parser_declarations_end(lxb_css_parser_t *parser,
83 const lxb_css_syntax_token_t *token,
85
86static const lxb_css_syntax_token_t *
87lxb_css_syntax_parser_components(lxb_css_parser_t *parser,
88 const lxb_css_syntax_token_t *token,
90
91static const lxb_css_syntax_token_t *
92lxb_css_syntax_parser_function(lxb_css_parser_t *parser,
93 const lxb_css_syntax_token_t *token,
95
96static const lxb_css_syntax_token_t *
97lxb_css_syntax_parser_block(lxb_css_parser_t *parser,
98 const lxb_css_syntax_token_t *token,
100
101static const lxb_css_syntax_token_t *
102lxb_css_syntax_parser_pipe(lxb_css_parser_t *parser,
103 const lxb_css_syntax_token_t *token,
105
106
113
114
117{
118 const lxb_css_syntax_token_t *token;
119
120 parser->loop = true;
121
122 do {
123 token = lxb_css_syntax_parser_token(parser);
124 if (token == NULL) {
125 if (parser->fake_null) {
126 parser->fake_null = false;
127 continue;
128 }
129
130 return parser->status;
131 }
132
133 while (parser->rules->state(parser, token,
134 parser->rules->context) == false) {};
135 }
136 while (parser->loop);
137
138 return parser->status;
139}
140
143{
145 lxb_css_syntax_rule_t *rule = parser->rules;
146
147 token = lxb_css_syntax_token(parser->tkz);
148 if (token == NULL) {
149 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
150 }
151
152 return rule->phase(parser, token, rule);
153}
154
157{
158 const lxb_css_syntax_token_t *token;
159
160 token = lxb_css_syntax_parser_token(parser);
161
162 if (token != NULL && token->type == LXB_CSS_SYNTAX_TOKEN_WHITESPACE) {
164 return lxb_css_syntax_parser_token(parser);
165 }
166
167 return token;
168}
169
170void
172{
173 if (!parser->rules->skip_consume) {
175 }
176}
177
180 const lxb_char_t **data, const lxb_char_t **end,
181 void *ctx)
182{
183 size_t length, size;
184 lxb_char_t *new_data;
186 lxb_css_parser_t *parser = ctx;
187
188 if (parser->pos == NULL) {
189 return parser->chunk_cb(tkz, data, end, parser->chunk_ctx);
190 }
191
192 length = (size_t) (*end - parser->pos);
193
194 if (SIZE_MAX - parser->str.length < length) {
196 }
197
198 if (parser->str.length + length >= parser->str_size) {
199 size = parser->str.length + length + 1;
200
201 new_data = lexbor_realloc(parser->str.data, size);
202 if (new_data == NULL) {
204 }
205
206 parser->str.data = new_data;
207 parser->str_size = size;
208 }
209
210 memcpy(parser->str.data + parser->str.length, parser->pos, length);
211
212 status = parser->chunk_cb(tkz, data, end, parser->chunk_ctx);
213 parser->str.length += length;
214 parser->pos = *data;
215
216 return status;
217}
218
221 const lxb_css_syntax_token_t *token,
222 lxb_css_parser_state_f state_back,
223 const lxb_css_syntax_cb_list_rules_t *cb_rules,
224 void *ctx, bool top_level,
226{
229
230 lxb_css_parser_offset_set(parser, token);
231
233 if (status != LXB_STATUS_OK) {
234 parser->status = status;
235 return NULL;
236 }
237
239
240 rule = ++parser->rules;
241
242 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
243
244 rule->phase = lxb_css_syntax_parser_list_rules;
245 rule->state = cb_rules->cb.state;
246 rule->state_back = state_back;
247 rule->back = lxb_css_syntax_parser_list_rules;
248 rule->cbx.list_rules = cb_rules;
249 rule->context = ctx;
250 rule->block_end = stop;
251 rule->top_level = top_level;
252
253 if (token != NULL) {
254 rule->u.list_rules.begin = token->offset;
255 }
256
257 parser->context = NULL;
258
259 return rule;
260}
261
264 const lxb_css_syntax_token_t *token,
265 lxb_css_parser_state_f state_back,
266 const lxb_css_syntax_cb_at_rule_t *at_rule,
267 void *ctx, lxb_css_syntax_token_type_t stop)
268{
272
273 lxb_css_parser_offset_set(parser, token);
274
276 if (status != LXB_STATUS_OK) {
277 parser->status = status;
278 return NULL;
279 }
280
282
283 rule = ++parser->rules;
284
285 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
286
287 rule->phase = lxb_css_syntax_parser_at_rule;
288 rule->state = at_rule->state;
289 rule->state_back = state_back;
290 rule->back = lxb_css_syntax_parser_at_rule;
291 rule->cbx.at_rule = at_rule;
292 rule->context = ctx;
293 rule->block_end = stop;
294
295 if (token != NULL) {
296 at = &rule->u.at_rule;
297
298 at->name = token->offset;
299 at->prelude = token->offset + lxb_css_syntax_token_base(token)->length;
300 }
301
302 parser->context = NULL;
303
304 return rule;
305}
306
309 const lxb_css_syntax_token_t *token,
310 lxb_css_parser_state_f state_back,
311 const lxb_css_syntax_cb_qualified_rule_t *qualified,
312 void *ctx, lxb_css_syntax_token_type_t stop)
313{
316
317 lxb_css_parser_offset_set(parser, token);
318
320 if (status != LXB_STATUS_OK) {
321 parser->status = status;
322 return NULL;
323 }
324
326
327 rule = ++parser->rules;
328
329 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
330
331 rule->phase = lxb_css_syntax_parser_qualified_rule;
332 rule->state = qualified->state;
333 rule->state_back = state_back;
334 rule->back = lxb_css_syntax_parser_qualified_rule;
335 rule->cbx.qualified_rule = qualified;
336 rule->context = ctx;
337 rule->block_end = stop;
338
339 if (token != NULL) {
340 rule->u.qualified.prelude = token->offset;
341 }
342
343 parser->context = NULL;
344
345 return rule;
346}
347
350 const lxb_css_syntax_token_t *token,
351 lxb_css_parser_state_f state_back,
352 const lxb_css_syntax_cb_declarations_t *declarations,
353 void *ctx, lxb_css_syntax_token_type_t stop)
354{
357
358 lxb_css_parser_offset_set(parser, token);
359
361 if (status != LXB_STATUS_OK) {
362 parser->status = status;
363 return NULL;
364 }
365
367
368 rule = ++parser->rules;
369
370 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
371
372 rule->phase = lxb_css_syntax_parser_declarations;
373 rule->state = declarations->cb.state;
374 rule->state_back = state_back;
375 rule->back = lxb_css_syntax_parser_declarations;
376 rule->cbx.declarations = declarations;
377 rule->context = ctx;
378 rule->block_end = stop;
379
380 if (token != NULL) {
381 rule->u.declarations.begin = token->offset;
382 }
383
384 parser->context = NULL;
385
386 return rule;
387}
388
391 const lxb_css_syntax_token_t *token,
392 lxb_css_parser_state_f state_back,
394 void *ctx, lxb_css_syntax_token_type_t stop)
395{
398
399 lxb_css_parser_offset_set(parser, token);
400
402 if (status != LXB_STATUS_OK) {
403 parser->status = status;
404 return NULL;
405 }
406
408
409 rule = ++parser->rules;
410
411 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
412
413 rule->phase = lxb_css_syntax_parser_components;
414 rule->state = comp->state;
415 rule->state_back = state_back;
416 rule->back = lxb_css_syntax_parser_components;
417 rule->cbx.components = comp;
418 rule->context = ctx;
419 rule->block_end = stop;
420
421 parser->context = NULL;
422
423 return rule;
424}
425
428 const lxb_css_syntax_token_t *token,
429 lxb_css_parser_state_f state_back,
431 void *ctx)
432{
435
436 if (token == NULL || token->type != LXB_CSS_SYNTAX_TOKEN_FUNCTION) {
438 return NULL;
439 }
440
441 if (parser->rules > parser->rules_begin) {
442 rule = parser->rules;
443
444 if (rule->deep != 0
446 {
447 rule->deep--;
448 parser->types_pos--;
449 }
450 }
451
453
454 lxb_css_parser_offset_set(parser, token);
455
457 if (status != LXB_STATUS_OK) {
458 parser->status = status;
459 return NULL;
460 }
461
462 rule = ++parser->rules;
463
464 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
465
466 rule->phase = lxb_css_syntax_parser_function;
467 rule->state = func->state;
468 rule->state_back = state_back;
469 rule->back = lxb_css_syntax_parser_function;
470 rule->cbx.func = func;
471 rule->context = ctx;
472
473 parser->context = NULL;
474
475 return rule;
476}
477
480 const lxb_css_syntax_token_t *token,
481 lxb_css_parser_state_f state_back,
482 const lxb_css_syntax_cb_block_t *block,
483 void *ctx)
484{
488
489 if (token == NULL) {
491 return NULL;
492 }
493
494 switch (token->type) {
497 break;
498
502 break;
503
506 break;
507
508 default:
510 return NULL;
511 }
512
513 if (parser->rules > parser->rules_begin) {
514 rule = parser->rules;
515
516 if (rule->deep != 0 && parser->types_pos[-1] == block_end) {
517 rule->deep--;
518 parser->types_pos--;
519 }
520 }
521
523
524 lxb_css_parser_offset_set(parser, token);
525
527 if (status != LXB_STATUS_OK) {
528 parser->status = status;
529 return NULL;
530 }
531
532 rule = ++parser->rules;
533
534 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
535
536 rule->phase = lxb_css_syntax_parser_block;
537 rule->state = block->state;
538 rule->state_back = state_back;
539 rule->back = lxb_css_syntax_parser_block;
540 rule->cbx.block = block;
541 rule->context = ctx;
542 rule->block_end = block_end;
543
544 parser->context = NULL;
545
546 return rule;
547}
548
551 lxb_css_parser_state_f state_back,
552 const lxb_css_syntax_cb_pipe_t *pipe,
553 void *ctx, lxb_css_syntax_token_type_t stop)
554{
557
559 if (status != LXB_STATUS_OK) {
560 parser->status = status;
561 return NULL;
562 }
563
565
566 rule = ++parser->rules;
567
568 memset(rule, 0x00, sizeof(lxb_css_syntax_rule_t));
569
570 rule->phase = lxb_css_syntax_parser_pipe;
571 rule->state = pipe->state;
572 rule->state_back = state_back;
573 rule->back = lxb_css_syntax_parser_pipe;
574 rule->cbx.pipe = pipe;
575 rule->context = ctx;
576 rule->block_end = stop;
577
578 parser->context = NULL;
579
580 return rule;
581}
582
585{
586 return parser->rules--;
587}
588
589static const lxb_css_syntax_token_t *
590lxb_css_syntax_parser_list_rules(lxb_css_parser_t *parser,
591 const lxb_css_syntax_token_t *token,
593{
594 if (rule->offset > token->offset) {
595 return token;
596 }
597
598begin:
599
600 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
601
602 switch (token->type) {
605
606 token = lxb_css_syntax_token(parser->tkz);
607 if (token == NULL) {
608 return lxb_css_syntax_parser_failed(parser,
609 parser->tkz->status);
610 }
611
612 goto begin;
613
615 rule->phase = lxb_css_syntax_parser_list_rules_at;
616 break;
617
619 goto done;
620
623 if (rule->top_level) {
625
626 token = lxb_css_syntax_token(parser->tkz);
627 if (token == NULL) {
628 return lxb_css_syntax_parser_failed(parser,
629 parser->tkz->status);
630 }
631
632 goto begin;
633 }
634
635 /* fall through */
636
637 default:
638 if (rule->block_end == token->type && rule->deep == 0) {
639 goto done;
640 }
641
642 rule->phase = lxb_css_syntax_parser_list_rules_qualified;
643 break;
644 }
645
646 return token;
647
648done:
649
651 rule->skip_consume = true;
652
653 rule->u.list_rules.end = token->offset;
654
655 return &lxb_css_syntax_token_terminated;
656}
657
658static const lxb_css_syntax_token_t *
659lxb_css_syntax_parser_list_rules_at(lxb_css_parser_t *parser,
660 const lxb_css_syntax_token_t *token,
662{
663 if (rule->state != lxb_css_state_success) {
664 return token;
665 }
666
667 rule = lxb_css_syntax_parser_at_rule_push(parser, token,
668 lxb_css_syntax_parser_list_rules_back,
669 rule->cbx.list_rules->at_rule,
670 rule->context, rule->block_end);
671 if (rule == NULL) {
672 return NULL;
673 }
674
675 parser->fake_null = true;
676
677 return NULL;
678}
679
680static const lxb_css_syntax_token_t *
681lxb_css_syntax_parser_list_rules_qualified(lxb_css_parser_t *parser,
682 const lxb_css_syntax_token_t *token,
684{
685 if (rule->state != lxb_css_state_success) {
686 return token;
687 }
688
689 rule = lxb_css_syntax_parser_qualified_push(parser, token,
690 lxb_css_syntax_parser_list_rules_back,
692 rule->context, rule->block_end);
693 if (rule == NULL) {
694 return NULL;
695 }
696
697 parser->fake_null = true;
698
699 return NULL;
700}
701
702static bool
703lxb_css_syntax_parser_list_rules_back(lxb_css_parser_t *parser,
704 const lxb_css_syntax_token_t *token, void *ctx)
705{
707
708 if (token->type == LXB_CSS_SYNTAX_TOKEN__END) {
709 return lxb_css_parser_success(parser);
710 }
711
712 rule = parser->rules;
713 rule->state = rule->cbx.list_rules->next;
714
715 return false;
716}
717
718static const lxb_css_syntax_token_t *
719lxb_css_syntax_parser_at_rule(lxb_css_parser_t *parser,
720 const lxb_css_syntax_token_t *token,
722{
724
725 if (rule->offset > token->offset) {
726 return token;
727 }
728
729 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
730
731 if (rule->block_end == token->type && rule->deep == 0) {
732 rule->skip_ending = true;
733 goto done;
734 }
735
736 switch (token->type) {
740 break;
741
746 break;
747
749 if (rule->deep == 0) {
751
752 rule->u.at_rule.prelude_end = token->offset;
753 rule->u.at_rule.block = token->offset
754 + lxb_css_syntax_token_base(token)->length;
755
756 rule->skip_consume = true;
757
758 parser->block = rule->cbx.cb->block;
759
761
762 token = lxb_css_syntax_token(parser->tkz);
763 if (token == NULL) {
764 return lxb_css_syntax_parser_failed(parser,
765 parser->tkz->status);
766 }
767
768 token = &lxb_css_syntax_token_terminated;
769 }
770
773 break;
774
776 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
777 if (rule->deep == 1) {
778 goto done;
779 }
780
781 parser->types_pos--;
782 rule->deep--;
783 }
784
785 return token;
786
789 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
790 parser->types_pos--;
791 rule->deep--;
792 }
793
794 return token;
795
797 if (rule->deep == 0) {
798 goto done;
799 }
800
801 return token;
802
804 goto done;
805
806 default:
807 return token;
808 }
809
810 if (status != LXB_STATUS_OK) {
811 return lxb_css_syntax_parser_failed(parser, status);
812 }
813
814 rule->deep++;
815
816 return token;
817
818done:
819
821 rule->skip_consume = true;
822
823 if (rule->u.at_rule.prelude_end != 0) {
824 rule->u.at_rule.block_end = token->offset;
825 }
826 else {
827 rule->u.at_rule.prelude_end = token->offset;
828 }
829
830 return &lxb_css_syntax_token_terminated;
831}
832
833static const lxb_css_syntax_token_t *
834lxb_css_syntax_parser_qualified_rule(lxb_css_parser_t *parser,
835 const lxb_css_syntax_token_t *token,
837{
839
840 /* It is necessary to avoid re-entry of the token into the phase. */
841
842 if (rule->offset > token->offset) {
843 return token;
844 }
845
846 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
847
848 if (rule->block_end == token->type && rule->deep == 0) {
849 rule->skip_ending = true;
850 goto done;
851 }
852
853 switch (token->type) {
857 break;
858
863 break;
864
866 if (rule->deep == 0) {
868
869 rule->u.qualified.prelude_end = token->offset;
870 rule->u.qualified.block = token->offset
871 + lxb_css_syntax_token_base(token)->length;
872
873 rule->skip_consume = true;
874
875 parser->block = rule->cbx.cb->block;
876
878
879 token = lxb_css_syntax_token(parser->tkz);
880 if (token == NULL) {
881 return lxb_css_syntax_parser_failed(parser,
882 parser->tkz->status);
883 }
884
885 token = &lxb_css_syntax_token_terminated;
886 }
887
890 break;
891
893 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
894 if (rule->deep == 1) {
895 goto done;
896 }
897
898 parser->types_pos--;
899 rule->deep--;
900 }
901
902 return token;
903
906 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
907 parser->types_pos--;
908 rule->deep--;
909 }
910
911 return token;
912
914 goto done;
915
916 default:
917 return token;
918 }
919
920 if (status != LXB_STATUS_OK) {
921 return lxb_css_syntax_parser_failed(parser, status);
922 }
923
924 rule->deep++;
925
926 return token;
927
928done:
929
931 rule->skip_consume = true;
932
933 if (rule->u.qualified.block != 0) {
934 rule->u.qualified.block_end = token->offset;
935 }
936 else {
937 rule->u.qualified.prelude_end = token->offset;
938 }
939
940 return &lxb_css_syntax_token_terminated;
941}
942
943static const lxb_css_syntax_token_t *
944lxb_css_syntax_parser_declarations(lxb_css_parser_t *parser,
945 const lxb_css_syntax_token_t *token,
947{
948 if (rule->offset > token->offset) {
949 return token;
950 }
951
952begin:
953
954 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
955
956 if (rule->block_end == token->type && rule->deep == 0) {
957 rule->skip_ending = true;
958 goto done;
959 }
960
961 switch (token->type) {
965
966 token = lxb_css_syntax_token(parser->tkz);
967 if (token == NULL) {
968 return lxb_css_syntax_parser_failed(parser,
969 parser->tkz->status);
970 }
971
972 goto begin;
973
975 rule->u.declarations.name_begin = token->offset;
976
978 rule->phase = lxb_css_syntax_parser_declarations_name;
979 parser->block = rule->cbx.cb->block;
980
981 return token;
982 }
983
984 rule->state = rule->cbx.cb->failed;
985 rule->phase = lxb_css_syntax_parser_declarations_drop;
986 rule->failed = true;
987
988 break;
989
991 rule->u.declarations.name_begin = 0;
992
993 rule = lxb_css_syntax_parser_at_rule_push(parser, token,
994 lxb_css_syntax_parser_declarations_back,
995 rule->cbx.declarations->at_rule, rule->context,
996 rule->block_end);
997 if (rule != NULL) {
998 parser->fake_null = true;
999 }
1000
1001 return NULL;
1002
1004 goto done;
1005
1006 default:
1007 rule->state = rule->cbx.cb->failed;
1008 rule->phase = lxb_css_syntax_parser_declarations_drop;
1009 rule->failed = true;
1010
1011 rule->u.declarations.name_begin = token->offset;
1012 break;
1013 }
1014
1015 parser->fake_null = true;
1016
1017 return NULL;
1018
1019done:
1020
1023 rule->skip_consume = true;
1024
1025 rule->u.declarations.name_begin = 0;
1026 rule->u.declarations.end = token->offset;
1027
1028 parser->fake_null = true;
1029
1030 return NULL;
1031}
1032
1033static bool
1034lxb_css_syntax_parser_declarations_back(lxb_css_parser_t *parser,
1035 const lxb_css_syntax_token_t *token, void *ctx)
1036{
1037 lxb_css_syntax_rule_t *rules = parser->rules;
1038
1039 rules->state = rules->cbx.declarations->cb.state;
1040
1041 return rules->state(parser, token, ctx);
1042}
1043
1044static const lxb_css_syntax_token_t *
1045lxb_css_syntax_parser_declarations_name(lxb_css_parser_t *parser,
1046 const lxb_css_syntax_token_t *token,
1048{
1049 if (rule->offset > token->offset) {
1050 return token;
1051 }
1052
1053 if (rule->state != lxb_css_state_success) {
1054 rule->skip_consume = true;
1055
1056 return &lxb_css_syntax_token_terminated;
1057 }
1058
1059 rule->skip_consume = false;
1060
1061 /* 1. */
1062
1063 if (token->type == LXB_CSS_SYNTAX_TOKEN_WHITESPACE) {
1065
1066 token = lxb_css_syntax_token(parser->tkz);
1067 if (token == NULL) {
1068 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1069 }
1070 }
1071
1072 /* 2. */
1073
1074 if (token->type != LXB_CSS_SYNTAX_TOKEN_COLON) {
1075 /* Parse error. */
1076
1077 /*
1078 * It can't be.
1079 *
1080 * Before entering the lxb_css_syntax_parser_declarations_name()
1081 * function, data validation takes place. In fact, these checks are not
1082 * needed here.
1083 */
1084
1085 /*
1086 * But it's good for validation, if we come here it means we're
1087 * doing badly.
1088 */
1089
1090 return NULL;
1091 }
1092
1093 rule->u.declarations.name_end = token->offset;
1094
1096
1097 token = lxb_css_syntax_token(parser->tkz);
1098 if (token == NULL) {
1099 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1100 }
1101
1102 /* 3. */
1103
1104 if (token->type == LXB_CSS_SYNTAX_TOKEN_WHITESPACE) {
1106
1107 token = lxb_css_syntax_token(parser->tkz);
1108 if (token == NULL) {
1109 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1110 }
1111 }
1112
1113 rule->u.declarations.value_begin = token->offset;
1114
1115 /* 4. */
1116
1117 rule->phase = lxb_css_syntax_parser_declarations_value;
1118 rule->state = parser->block;
1119
1120 return lxb_css_syntax_parser_declarations_value(parser, token, rule);
1121}
1122
1123static const lxb_css_syntax_token_t *
1124lxb_css_syntax_parser_declarations_value(lxb_css_parser_t *parser,
1125 const lxb_css_syntax_token_t *token,
1127{
1128 bool imp;
1129 uintptr_t before_important;
1131
1132 if (rule->offset > token->offset) {
1133 return token;
1134 }
1135
1136again:
1137
1138 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
1139
1140 if (rule->block_end == token->type && rule->deep == 0) {
1141 rule->skip_ending = true;
1142 goto done;
1143 }
1144
1145 switch (token->type) {
1147 if (rule->deep != 0) {
1148 return token;
1149 }
1150
1152 rule->block_end,
1153 (rule->block_end == LXB_CSS_SYNTAX_TOKEN_RC_BRACKET) ? 0x7D : 0x00);
1154
1155 if (!imp) {
1156 return token;
1157 }
1158
1159 before_important = token->offset;
1160
1162
1163 token = lxb_css_syntax_token(parser->tkz);
1164 if (token == NULL) {
1165 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1166 }
1167
1168 /* Have !important? */
1169
1170 if (token->type == LXB_CSS_SYNTAX_TOKEN_DELIM) {
1171 rule->important = true;
1172 rule->u.declarations.before_important = before_important;
1173
1175
1176 /* Skip important */
1177
1178 token = lxb_css_syntax_token(parser->tkz);
1179 if (token == NULL) {
1180 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1181 }
1183
1184 token = lxb_css_syntax_token(parser->tkz);
1185 if (token == NULL) {
1186 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1187 }
1188
1189 if (token->type == LXB_CSS_SYNTAX_TOKEN_WHITESPACE) {
1191
1192 token = lxb_css_syntax_token(parser->tkz);
1193 if (token == NULL) {
1194 return lxb_css_syntax_parser_failed(parser,
1195 parser->tkz->status);
1196 }
1197 }
1198 }
1199
1200 goto again;
1201
1203 if (rule->deep == 0) {
1204 rule->phase = lxb_css_syntax_parser_declarations_next;
1205
1206 rule->u.declarations.value_end = token->offset;
1207
1209
1210 token = lxb_css_syntax_token(parser->tkz);
1211 if (token == NULL) {
1212 return lxb_css_syntax_parser_failed(parser,
1213 parser->tkz->status);
1214 }
1215
1216 return &lxb_css_syntax_token_terminated;
1217 }
1218
1219 return token;
1220
1222 if (lxb_css_syntax_token_delim(token)->character != '!') {
1223 return token;
1224 }
1225
1227 rule->block_end,
1228 (rule->block_end == LXB_CSS_SYNTAX_TOKEN_RC_BRACKET) ? 0x7D : 0x00);
1229
1230 if (!imp) {
1231 return token;
1232 }
1233
1234 rule->u.declarations.before_important = token->offset;
1235 rule->important = true;
1236
1238
1239 token = lxb_css_syntax_token(parser->tkz);
1240 if (token == NULL) {
1241 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1242 }
1243
1245
1246 token = lxb_css_syntax_token(parser->tkz);
1247 if (token == NULL) {
1248 return lxb_css_syntax_parser_failed(parser, parser->tkz->status);
1249 }
1250
1251 if (token->type == LXB_CSS_SYNTAX_TOKEN_WHITESPACE) {
1253
1254 token = lxb_css_syntax_token(parser->tkz);
1255 if (token == NULL) {
1256 return lxb_css_syntax_parser_failed(parser,
1257 parser->tkz->status);
1258 }
1259 }
1260
1261 goto again;
1262
1266 break;
1267
1272 break;
1273
1277 break;
1278
1282 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
1283 parser->types_pos--;
1284 rule->deep--;
1285 }
1286
1287 return token;
1288
1290 goto done;
1291
1292 default:
1293 return token;
1294 }
1295
1296 if (status != LXB_STATUS_OK) {
1297 return lxb_css_syntax_parser_failed(parser, status);
1298 }
1299
1300 rule->deep++;
1301
1302 return token;
1303
1304done:
1305
1306 rule->phase = lxb_css_syntax_parser_declarations_end;
1307 rule->skip_consume = true;
1308
1309 rule->u.declarations.value_end = token->offset;
1310 rule->u.declarations.end = token->offset;
1311
1312 return &lxb_css_syntax_token_terminated;
1313}
1314
1315static const lxb_css_syntax_token_t *
1316lxb_css_syntax_parser_declarations_next(lxb_css_parser_t *parser,
1317 const lxb_css_syntax_token_t *token,
1319{
1322
1323 if (rule->state != lxb_css_state_success) {
1324 rule->skip_consume = true;
1325
1326 return &lxb_css_syntax_token_terminated;
1327 }
1328
1329 status = rule->cbx.declarations->declaration_end(parser, rule->context,
1330 rule->important,
1331 rule->failed);
1332 if (status != LXB_STATUS_OK) {
1333 return lxb_css_syntax_parser_failed(parser, status);
1334 }
1335
1336 rule->phase = lxb_css_syntax_parser_declarations;
1337 rule->state = rule->cbx.cb->state;
1338
1339 rule->skip_consume = false;
1340 rule->important = false;
1341 rule->failed = false;
1342
1343 decl = &rule->u.declarations;
1344
1345 decl->name_begin = 0;
1346 decl->name_end = 0;
1347 decl->value_begin = 0;
1348 decl->before_important = 0;
1349 decl->value_end = 0;
1350
1351 return lxb_css_syntax_parser_declarations(parser, token, rule);
1352}
1353
1354static const lxb_css_syntax_token_t *
1355lxb_css_syntax_parser_declarations_drop(lxb_css_parser_t *parser,
1356 const lxb_css_syntax_token_t *token,
1358{
1360
1361 /* It is necessary to avoid re-entry of the token into the phase. */
1362
1363 if (rule->offset > token->offset) {
1364 return token;
1365 }
1366
1367 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
1368
1369 if (rule->block_end == token->type && rule->deep == 0) {
1370 rule->skip_ending = true;
1371 goto done;
1372 }
1373
1374 switch (token->type) {
1376 if (rule->deep == 0) {
1377 rule->phase = lxb_css_syntax_parser_declarations_next;
1378
1379 rule->u.declarations.name_end = token->offset;
1380
1382
1383 token = lxb_css_syntax_token(parser->tkz);
1384 if (token == NULL) {
1385 return lxb_css_syntax_parser_failed(parser,
1386 parser->tkz->status);
1387 }
1388
1389 rule->skip_consume = true;
1390
1391 return &lxb_css_syntax_token_terminated;
1392 }
1393
1394 return token;
1395
1399 break;
1400
1405 break;
1406
1410 break;
1411
1415 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
1416 parser->types_pos--;
1417 rule->deep--;
1418 }
1419
1420 return token;
1421
1423 goto done;
1424
1425 default:
1426 return token;
1427 }
1428
1429 if (status != LXB_STATUS_OK) {
1430 return lxb_css_syntax_parser_failed(parser, status);
1431 }
1432
1433 rule->deep++;
1434
1435 return token;
1436
1437done:
1438
1439 rule->phase = lxb_css_syntax_parser_declarations_end;
1440 rule->skip_consume = true;
1441
1442 rule->u.declarations.name_end = token->offset;
1443 rule->u.declarations.end = token->offset;
1444
1445 return &lxb_css_syntax_token_terminated;
1446}
1447
1448static const lxb_css_syntax_token_t *
1449lxb_css_syntax_parser_declarations_end(lxb_css_parser_t *parser,
1450 const lxb_css_syntax_token_t *token,
1452{
1454 lxb_css_syntax_rule_t *rules;
1455
1456 if (rule->state != lxb_css_state_success) {
1457 rule->skip_consume = true;
1458
1459 return &lxb_css_syntax_token_terminated;
1460 }
1461
1462 status = rule->cbx.declarations->declaration_end(parser, rule->context,
1463 rule->important,
1464 rule->failed);
1465 if (status != LXB_STATUS_OK) {
1466 return lxb_css_syntax_parser_failed(parser, status);
1467 }
1468
1469 /* This code will be called exclusively from the lxb_css_parser_run(...). */
1470
1471 status = rule->cbx.cb->end(parser, token, rule->context, false);
1472 if (status != LXB_STATUS_OK) {
1473 return lxb_css_syntax_parser_failed(parser, status);
1474 }
1475
1476 if (!rule->skip_ending) {
1478
1479 token = lxb_css_syntax_token(parser->tkz);
1480 if (token == NULL) {
1481 return lxb_css_syntax_parser_failed(parser,
1482 parser->tkz->status);
1483 }
1484 }
1485
1487
1488 rules = parser->rules;
1489
1490 if (parser->rules <= parser->rules_begin) {
1491 rules->state = lxb_css_state_stop;
1492 return token;
1493 }
1494
1495 rules->phase = rules->back;
1496
1497 return rules->phase(parser, token, rules);
1498}
1499
1500static const lxb_css_syntax_token_t *
1501lxb_css_syntax_parser_components(lxb_css_parser_t *parser,
1502 const lxb_css_syntax_token_t *token,
1504{
1506
1507 if (rule->offset > token->offset) {
1508 return token;
1509 }
1510
1511 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
1512
1513 if (rule->block_end == token->type && rule->deep == 0) {
1514 rule->skip_ending = true;
1515 goto done;
1516 }
1517
1518 switch (token->type) {
1522 break;
1523
1528 break;
1529
1533 break;
1534
1538 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
1539 parser->types_pos--;
1540 rule->deep--;
1541 }
1542
1543 return token;
1544
1546 goto done;
1547
1548 default:
1549 return token;
1550 }
1551
1552 if (status != LXB_STATUS_OK) {
1553 return lxb_css_syntax_parser_failed(parser, status);
1554 }
1555
1556 rule->deep++;
1557
1558 return token;
1559
1560done:
1561
1563 rule->skip_consume = true;
1564
1565 return &lxb_css_syntax_token_terminated;
1566}
1567
1568static const lxb_css_syntax_token_t *
1569lxb_css_syntax_parser_function(lxb_css_parser_t *parser,
1570 const lxb_css_syntax_token_t *token,
1572{
1574
1575 if (rule->offset > token->offset) {
1576 return token;
1577 }
1578
1579 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
1580
1581 switch (token->type) {
1585 break;
1586
1591 break;
1592
1596 break;
1597
1599 if (rule->deep != 0) {
1600 if (parser->types_pos[-1] == token->type) {
1601 parser->types_pos--;
1602 rule->deep--;
1603 }
1604 }
1605 else {
1606 goto done;
1607 }
1608
1609 return token;
1610
1613 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
1614 parser->types_pos--;
1615 rule->deep--;
1616 }
1617
1618 return token;
1619
1621 goto done;
1622
1623 default:
1624 return token;
1625 }
1626
1627 if (status != LXB_STATUS_OK) {
1628 return lxb_css_syntax_parser_failed(parser, status);
1629 }
1630
1631 rule->deep++;
1632
1633 return token;
1634
1635done:
1636
1638 rule->skip_consume = true;
1639
1640 return &lxb_css_syntax_token_terminated;
1641}
1642
1643static const lxb_css_syntax_token_t *
1644lxb_css_syntax_parser_block(lxb_css_parser_t *parser,
1645 const lxb_css_syntax_token_t *token,
1647{
1649
1650 if (rule->offset > token->offset) {
1651 return token;
1652 }
1653
1654 rule->offset = token->offset + lxb_css_syntax_token_base(token)->length;
1655
1656 if (rule->block_end == token->type && rule->deep == 0) {
1657 goto done;
1658 }
1659
1660 switch (token->type) {
1664 break;
1665
1670 break;
1671
1675 break;
1676
1680 if (rule->deep != 0 && parser->types_pos[-1] == token->type) {
1681 parser->types_pos--;
1682 rule->deep--;
1683 }
1684
1685 return token;
1686
1688 goto done;
1689
1690 default:
1691 return token;
1692 }
1693
1694 if (status != LXB_STATUS_OK) {
1695 return lxb_css_syntax_parser_failed(parser, status);
1696 }
1697
1698 rule->deep++;
1699
1700 return token;
1701
1702done:
1703
1705 rule->skip_consume = true;
1706
1707 return &lxb_css_syntax_token_terminated;
1708}
1709
1710static const lxb_css_syntax_token_t *
1711lxb_css_syntax_parser_pipe(lxb_css_parser_t *parser,
1712 const lxb_css_syntax_token_t *token,
1714{
1715 if ((rule->block_end == token->type && rule->deep == 0)
1716 || token->type == LXB_CSS_SYNTAX_TOKEN__EOF)
1717 {
1719 rule->skip_consume = true;
1720
1721 return &lxb_css_syntax_token_terminated;
1722 }
1723
1724 return token;
1725}
1726
1729 const lxb_css_syntax_token_t *token,
1731{
1732 if (rule->state != lxb_css_state_success) {
1733 rule->skip_consume = true;
1734
1735 return &lxb_css_syntax_token_terminated;
1736 }
1737
1738 /* This code will be called exclusively from the lxb_css_parser_run(...). */
1739
1740 rule->skip_consume = false;
1741
1742 rule->phase = rule->back;
1743 rule->state = parser->block;
1744
1745 return rule->back(parser, token, rule);
1746}
1747
1750 const lxb_css_syntax_token_t *token,
1752{
1754 lxb_css_syntax_rule_t *rules;
1756
1757 if (rule->state != lxb_css_state_success) {
1758 rule->skip_consume = true;
1759
1760 return &lxb_css_syntax_token_terminated;
1761 }
1762
1763 /* This code will be called exclusively from the lxb_css_parser_run(...). */
1764
1765 base = rule->cbx.user;
1766
1767 status = base->end(parser, token, rule->context, rule->failed);
1768 if (status != LXB_STATUS_OK) {
1769 return lxb_css_syntax_parser_failed(parser, status);
1770 }
1771
1772 if (!rule->skip_ending) {
1774
1775 token = lxb_css_syntax_token(parser->tkz);
1776 if (token == NULL) {
1777 return lxb_css_syntax_parser_failed(parser,
1778 parser->tkz->status);
1779 }
1780 }
1781
1783
1784 rules = parser->rules;
1785
1786 if (parser->rules <= parser->rules_begin) {
1787 rules->state = lxb_css_state_stop;
1788 return token;
1789 }
1790
1791 rules->phase = rules->back;
1792 rules->state = rule->state_back;
1793
1794 return rules->phase(parser, token, rules);
1795}
@ LXB_STATUS_ERROR_MEMORY_ALLOCATION
Definition base.h:51
@ LXB_STATUS_ERROR_WRONG_ARGS
Definition base.h:58
@ LXB_STATUS_OK
Definition base.h:49
@ LXB_STATUS_ERROR_OVERFLOW
Definition base.h:62
struct lxb_css_syntax_token lxb_css_syntax_token_t
Definition base.h:46
bool(* lxb_css_parser_state_f)(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, void *ctx)
Definition base.h:49
struct lxb_css_syntax_tokenizer lxb_css_syntax_tokenizer_t
Definition base.h:45
struct lxb_css_parser lxb_css_parser_t
Definition base.h:41
lxb_status_t lxb_css_parser_types_push(lxb_css_parser_t *parser, lxb_css_syntax_token_type_t type)
Definition parser.c:225
bool lxb_css_parser_success(lxb_css_parser_t *parser)
Definition parser.c:279
lxb_inline void lxb_css_parser_offset_set(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token)
Definition parser.h:472
bool lxb_css_state_success(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, void *ctx)
Definition state.c:13
bool lxb_css_state_stop(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, void *ctx)
Definition state.c:47
lxb_css_syntax_rule_t * lxb_css_syntax_parser_block_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_block_t *block, void *ctx)
Definition parser.c:479
const lxb_css_syntax_token_t * lxb_css_syntax_parser_end(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_syntax_rule_t *rule)
Definition parser.c:1749
lxb_css_syntax_rule_t * lxb_css_syntax_parser_declarations_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_declarations_t *declarations, void *ctx, lxb_css_syntax_token_type_t stop)
Definition parser.c:349
lxb_css_syntax_rule_t * lxb_css_syntax_parser_components_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_components_t *comp, void *ctx, lxb_css_syntax_token_type_t stop)
Definition parser.c:390
lxb_css_syntax_rule_t * lxb_css_syntax_parser_qualified_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_qualified_rule_t *qualified, void *ctx, lxb_css_syntax_token_type_t stop)
Definition parser.c:308
const lxb_css_syntax_token_t * lxb_css_syntax_parser_token_wo_ws(lxb_css_parser_t *parser)
Definition parser.c:156
lxb_css_syntax_rule_t * lxb_css_syntax_parser_pipe_push(lxb_css_parser_t *parser, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_pipe_t *pipe, void *ctx, lxb_css_syntax_token_type_t stop)
Definition parser.c:550
lxb_css_syntax_rule_t * lxb_css_syntax_parser_at_rule_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_at_rule_t *at_rule, void *ctx, lxb_css_syntax_token_type_t stop)
Definition parser.c:263
const lxb_css_syntax_token_t * lxb_css_syntax_parser_start_block(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_syntax_rule_t *rule)
Definition parser.c:1728
lxb_status_t lxb_css_syntax_parser_tkz_cb(lxb_css_syntax_tokenizer_t *tkz, const lxb_char_t **data, const lxb_char_t **end, void *ctx)
Definition parser.c:179
lxb_inline const lxb_css_syntax_token_t * lxb_css_syntax_parser_failed(lxb_css_parser_t *parser, lxb_status_t status)
Definition parser.c:108
lxb_css_syntax_rule_t * lxb_css_syntax_parser_function_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_function_t *func, void *ctx)
Definition parser.c:427
lxb_status_t lxb_css_syntax_parser_run(lxb_css_parser_t *parser)
Definition parser.c:116
const lxb_css_syntax_token_t * lxb_css_syntax_parser_token(lxb_css_parser_t *parser)
Definition parser.c:142
void lxb_css_syntax_parser_consume(lxb_css_parser_t *parser)
Definition parser.c:171
lxb_css_syntax_rule_t * lxb_css_syntax_parser_stack_pop(lxb_css_parser_t *parser)
Definition parser.c:584
lxb_css_syntax_rule_t * lxb_css_syntax_parser_list_rules_push(lxb_css_parser_t *parser, const lxb_css_syntax_token_t *token, lxb_css_parser_state_f state_back, const lxb_css_syntax_cb_list_rules_t *cb_rules, void *ctx, bool top_level, lxb_css_syntax_token_type_t stop)
Definition parser.c:220
lxb_css_syntax_token_t * lxb_css_syntax_token(lxb_css_syntax_tokenizer_t *tkz)
Definition token.c:45
void lxb_css_syntax_token_consume(lxb_css_syntax_tokenizer_t *tkz)
Definition token.c:63
#define lxb_css_syntax_token_base(token)
Definition token.h:20
lxb_css_syntax_token_type_t
Definition token.h:68
@ LXB_CSS_SYNTAX_TOKEN_FUNCTION
Definition token.h:73
@ LXB_CSS_SYNTAX_TOKEN_LS_BRACKET
Definition token.h:95
@ LXB_CSS_SYNTAX_TOKEN_RC_BRACKET
Definition token.h:100
@ LXB_CSS_SYNTAX_TOKEN__EOF
Definition token.h:101
@ LXB_CSS_SYNTAX_TOKEN_CDO
Definition token.h:90
@ LXB_CSS_SYNTAX_TOKEN_CDC
Definition token.h:91
@ LXB_CSS_SYNTAX_TOKEN_DELIM
Definition token.h:87
@ LXB_CSS_SYNTAX_TOKEN_COLON
Definition token.h:92
@ LXB_CSS_SYNTAX_TOKEN_RS_BRACKET
Definition token.h:96
@ LXB_CSS_SYNTAX_TOKEN_AT_KEYWORD
Definition token.h:74
@ LXB_CSS_SYNTAX_TOKEN_IDENT
Definition token.h:72
@ LXB_CSS_SYNTAX_TOKEN_WHITESPACE
Definition token.h:81
@ LXB_CSS_SYNTAX_TOKEN_LC_BRACKET
Definition token.h:99
@ LXB_CSS_SYNTAX_TOKEN_L_PARENTHESIS
Definition token.h:97
@ LXB_CSS_SYNTAX_TOKEN_R_PARENTHESIS
Definition token.h:98
@ LXB_CSS_SYNTAX_TOKEN_SEMICOLON
Definition token.h:93
@ LXB_CSS_SYNTAX_TOKEN__END
Definition token.h:103
#define lxb_css_syntax_token_delim(token)
Definition token.h:29
DNS_STATUS status
Definition dns_win32.c:49
bool lxb_css_syntax_tokenizer_lookup_important(lxb_css_syntax_tokenizer_t *tkz, lxb_css_syntax_token_type_t stop, const lxb_char_t stop_ch)
Definition tokenizer.c:486
bool lxb_css_syntax_tokenizer_lookup_colon(lxb_css_syntax_tokenizer_t *tkz)
Definition tokenizer.c:424
bool lxb_css_syntax_tokenizer_lookup_declaration_ws_end(lxb_css_syntax_tokenizer_t *tkz, lxb_css_syntax_token_type_t stop, const lxb_char_t stop_ch)
Definition tokenizer.c:649
int begin
Definition eaw_table.h:20
new_type size
Definition ffi.c:4365
memcpy(ptr1, ptr2, size)
memset(ptr, 0, type->size)
#define SIZE_MAX
Definition funcs.c:51
#define NULL
Definition gdcache.h:45
LXB_API void * lexbor_realloc(void *dst, size_t size)
Definition memory.c:21
unsigned const char * end
Definition php_ffi.h:51
zend_constant * data
lxb_char_t * data
Definition str.h:47
size_t length
Definition str.h:48
lxb_css_parser_state_f block
Definition parser.h:132
size_t str_size
Definition parser.h:166
void * chunk_ctx
Definition parser.h:160
lxb_css_syntax_token_type_t * types_pos
Definition parser.h:157
lxb_status_t status
Definition parser.h:177
void * context
Definition parser.h:133
lxb_css_syntax_rule_t * rules
Definition parser.h:147
lxb_css_syntax_tokenizer_chunk_f chunk_cb
Definition parser.h:159
const lxb_char_t * pos
Definition parser.h:162
lexbor_str_t str
Definition parser.h:165
lxb_css_syntax_tokenizer_t * tkz
Definition parser.h:136
bool fake_null
Definition parser.h:173
lxb_css_syntax_rule_t * rules_begin
Definition parser.h:145
lxb_css_parser_state_f failed
Definition syntax.h:70
lxb_css_syntax_cb_done_f end
Definition syntax.h:71
lxb_css_parser_state_f state
Definition syntax.h:68
lxb_css_parser_state_f block
Definition syntax.h:69
lxb_css_syntax_cb_base_t cb
Definition syntax.h:83
lxb_css_syntax_declaration_end_f declaration_end
Definition syntax.h:84
const lxb_css_syntax_cb_at_rule_t * at_rule
Definition syntax.h:85
lxb_css_syntax_cb_base_t cb
Definition syntax.h:90
const lxb_css_syntax_cb_at_rule_t * at_rule
Definition syntax.h:92
lxb_css_parser_state_f next
Definition syntax.h:91
const lxb_css_syntax_cb_qualified_rule_t * qualified_rule
Definition syntax.h:93
const lxb_css_syntax_cb_list_rules_t * list_rules
Definition syntax.h:105
lxb_css_parser_state_f state_back
Definition syntax.h:100
const lxb_css_syntax_cb_pipe_t * pipe
Definition syntax.h:112
const lxb_css_syntax_cb_at_rule_t * at_rule
Definition syntax.h:106
const lxb_css_syntax_cb_qualified_rule_t * qualified_rule
Definition syntax.h:107
union lxb_css_syntax_rule::@203345256314064163344113041244217160314313024330 u
lxb_css_syntax_token_type_t block_end
Definition syntax.h:120
lxb_css_syntax_state_f phase
Definition syntax.h:98
const lxb_css_syntax_cb_declarations_t * declarations
Definition syntax.h:108
const lxb_css_syntax_cb_base_t * cb
Definition syntax.h:104
lxb_css_parser_state_f state
Definition syntax.h:99
uintptr_t offset
Definition syntax.h:118
const lxb_css_syntax_cb_components_t * components
Definition syntax.h:109
lxb_css_syntax_state_f back
Definition syntax.h:101
const lxb_css_syntax_cb_function_t * func
Definition syntax.h:110
union lxb_css_syntax_rule::@073363174301106057201275360263214332217111046371 cbx
lxb_css_syntax_qualified_offset_t qualified
Definition syntax.h:130
const lxb_css_syntax_cb_block_t * block
Definition syntax.h:111
lxb_css_syntax_token_type_t type
Definition token.h:192
uintptr_t offset
Definition token.h:193
lxb_status_t lxb_css_syntax_stack_expand(lxb_css_parser_t *parser, size_t count)
Definition syntax.c:67
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_components_t
Definition syntax.h:78
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_block_t
Definition syntax.h:76
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_at_rule_t
Definition syntax.h:79
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_pipe_t
Definition syntax.h:75
struct lxb_css_syntax_rule lxb_css_syntax_rule_t
Definition syntax.h:17
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_qualified_rule_t
Definition syntax.h:80
lxb_css_syntax_cb_base_t lxb_css_syntax_cb_function_t
Definition syntax.h:77
unsigned int lxb_status_t
Definition types.h:28
#define lxb_inline
Definition types.h:21
unsigned char lxb_char_t
Definition types.h:27
execute_data func
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)