This repository was archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.c
1630 lines (1562 loc) · 35 KB
/
parser.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* THIS FILE HAS BEEN AUTOMATICALLY GENERATED BY LLnextgen. DO NOT EDIT */
#line 24 "parser.g"
#include "expression.h"
struct _t3_config_this;
T3_CONFIG_LOCAL int _t3_config_parse(parse_context_t * LLuserData);
T3_CONFIG_LOCAL int _t3_config_parse_include(parse_context_t * LLuserData);
T3_CONFIG_LOCAL int _t3_config_parse_constraint(parse_context_t * LLuserData);
T3_CONFIG_LOCAL void _t3_config_abort(struct _t3_config_this *, int);
#line 13 "parser.c"
#define LLsymb _t3_config_symb
#define LLmessage _t3_config_message
#define LLreissue _t3_config_reissue
#define LLabort _t3_config_abort
#define LL_MISSINGEOF (-1)
#define LL_DELETE (0)
#define LL_VERSION 0x000505L
#define LL_NEW_TOKEN (-2)
#define LL_THREAD_SAFE
#define LLthisType struct _t3_config_this
#define LLscnt (LLthis->LLscnt_)
#define LLtcnt (LLthis->LLtcnt_)
#define LLcsymb (LLthis->LLcsymb_)
#define LL_NTERMINALS 31
#define LL_NSETS 10
#define LL_SSETS 4
#define LLinset(LLx) (LLsets[LLx*LL_SSETS + (LLcsymb/8)] & (1<<(LLcsymb & 7)))
#define LL_SCANDONE(LLx) if (LLsymb != LLx) LLerror(LLx);
#include <string.h>
static const char LLsets[] = {
'\x6E', '\x20', '\x00', '\x00',
'\x60', '\x00', '\x00', '\x00',
'\x6E', '\x20', '\x02', '\x00',
'\x10', '\x10', '\x07', '\x00',
'\x10', '\x10', '\x00', '\x00',
'\x00', '\x10', '\x08', '\x00',
'\xFE', '\x23', '\xF1', '\x6F',
'\x80', '\x03', '\xF1', '\x03',
'\x7E', '\x20', '\x00', '\x6E',
'\xFE', '\x63', '\xF1', '\x6F',
0
};
static const int LLindex[] = { 0,
0, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 12, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, 26, -1, 30, -1, 29, 22, -1,
13, 15, -1, 11, 14, -1, -1, 25,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 19, 20, 16, 21, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, -1, 28, 24, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 17, 23, 18, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10};
#include "parser.h"
int _t3_config_yylex_wrapper(struct _t3_config_this *);
void LLmessage(struct _t3_config_this *, int);
static void LLread(LLthisType *LLthis) { LLcsymb = LLindex[(LLsymb = _t3_config_yylex_wrapper(LLthis)) + 1]; }
static int LLskip(LLthisType *LLthis) {
int LL_i;
if (LLcsymb >= 0) {
if (LLtcnt[LLcsymb] != 0) return 0;
for (LL_i = 0; LL_i < LL_NSETS; LL_i++)
if (LLscnt[LL_i] != 0 && LLinset(LL_i))
return 0;
}
for (;;) {
LLmessage(LLthis, 0 /* LL_DELETE */);
while ((LLcsymb = LLindex[(LLsymb = _t3_config_yylex_wrapper(LLthis)) + 1]) < 0) LLmessage(LLthis, 0 /* LL_DELETE */);
if (LLtcnt[LLcsymb] != 0)
return 1;
for (LL_i = 0; LL_i < LL_NSETS; LL_i++)
if (LLscnt[LL_i] != 0 && LLinset(LL_i))
return 1;
}
}
static void LLerror(LLthisType *LLthis, int LLtoken) {
if (LLtoken == 256 /* EOFILE */) {
LLmessage(LLthis, -1 /* LL_MISSINGEOF */);
while (LLindex[(LLsymb = _t3_config_yylex_wrapper(LLthis)) + 1] != 0) /*NOTHING*/ ;
return;
}
LLtcnt[LLindex[LLtoken + 1]]++;
LLskip(LLthis);
LLtcnt[LLindex[LLtoken + 1]]--;
if (LLsymb != LLtoken) { LLreissue = LLsymb; LLmessage(LLthis, LLtoken); }
}
void LLabort(LLthisType *LLthis, int LLretval) {
longjmp(LLthis->LLjmp_buf_, LLretval);
}
#define LLread() LLread(LLthis)
#define LLskip() LLskip(LLthis)
#define LLerror(LLx) LLerror(LLthis, LLx)
#line 34 "parser.g"
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
#include "config.h"
#include "util.h"
static t3_config_t *allocate_item(struct _t3_config_this *LLthis, t3_bool allocate_name) {
t3_config_t *result;
if ((result = (t3_config_t *) malloc(sizeof(t3_config_t))) == NULL)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
result->next = NULL;
result->type = T3_CONFIG_NONE;
result->line_number = _t3_config_data->line_number;
result->value.ptr = NULL;
result->file_name = _t3_config_ref_file_name(_t3_config_data->included);
if (allocate_name) {
if ((result->name = _t3_config_strdup(_t3_config_get_text(_t3_config_data->scanner))) == NULL)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
} else {
result->name = NULL;
}
return result;
}
static void set_value(struct _t3_config_this *LLthis, t3_config_t *item, t3_config_type_t type) {
switch (type) {
case T3_CONFIG_BOOL:
item->type = type;
item->value.boolean = LLsymb == BOOL_TRUE;
break;
case T3_CONFIG_INT: {
long value;
errno = 0;
value = strtol(_t3_config_get_text(_t3_config_data->scanner), NULL, 0);
/*
if (errno == ERANGE
#if T3_CONFIG_INT_MAX < LONG_MAX || T3_CONFIG_INT_MIN > LONG_MIN
|| value > T3_CONFIG_INT_MAX || value < T3_CONFIG_INT_MIN
#endif
)
LLabort(LLthis, T3_ERR_OUT_OF_RANGE);
*/
item->type = type;
item->value.integer = (int) value;
break;
}
case T3_CONFIG_NUMBER: {
double value;
errno = 0;
value = _t3_config_strtod(_t3_config_get_text(_t3_config_data->scanner));
/* if (errno == ERANGE)
LLabort(LLthis, T3_ERR_OUT_OF_RANGE);*/
item->type = type;
item->value.number = value;
break;
}
case T3_CONFIG_STRING: {
/* Don't need to allocate full yytext, because we drop the quotes. */
char *text = _t3_config_get_text(_t3_config_data->scanner);
char *value = malloc(strlen(text));
if (value == NULL)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
_t3_unescape(value, text);
item->type = type;
item->value.string = value;
break;
}
case T3_CONFIG_LIST:
case T3_CONFIG_SECTION:
item->type = type;
item->value.list = NULL;
break;
default:
LLabort(LLthis, T3_ERR_INTERNAL);
}
}
static t3_bool transform_percent_list(struct _t3_config_this *LLthis, t3_config_t *item, t3_config_t **last_dptr) {
t3_config_t *list;
if ((*last_dptr)->name[0] != '%')
return t3_false;
if ((list = t3_config_get(item, (*last_dptr)->name + 1)) == NULL) {
/* No existing list found. Transform the current item into new plist. */
list = allocate_item(LLthis, t3_false);
list->type = T3_CONFIG_PLIST;
list->name = (*last_dptr)->name;
(*last_dptr)->name = NULL;
memmove(list->name, list->name + 1, strlen(list->name));
list->value.list = *last_dptr;
*last_dptr = list;
return t3_false;
}
if (list->type != T3_CONFIG_PLIST) {
if (_t3_config_data->opts != NULL && (_t3_config_data->opts->flags & T3_CONFIG_VERBOSE_ERROR))
_t3_config_data->error_extra = _t3_config_strdup((*last_dptr)->name);
LLabort(LLthis, T3_ERR_DUPLICATE_KEY);
}
t3_config_add_existing(list, NULL, *last_dptr);
*last_dptr = NULL;
return t3_true;
}
T3_CONFIG_LOCAL int _t3_config_yylex_wrapper(struct _t3_config_this *LLthis);
int _t3_config_yylex_wrapper(struct _t3_config_this *LLthis) {
if (LLreissue == LL_NEW_TOKEN) {
/* Unfortunately, we have to initialize the LLthis member here, because
it may be used in the _t3_config_lex routine and this is the first
oportunity we have to initialize it. This does mean it will get set
over and over again, once for each token read. Unless we modify LLnextgen
to allow us to execute some code before the first LLread, we're stuck
with this. */
_t3_config_data->LLthis = LLthis;
/* Increase line number when the last token was a newline, instead of
when we find a newline, to improve error location reporting. */
if (LLsymb == '\n')
_t3_config_data->line_number++;
return _t3_config_lex(_t3_config_data->scanner);
} else {
int LLretval = LLreissue;
LLreissue = LL_NEW_TOKEN;
return LLretval;
}
}
T3_CONFIG_LOCAL void LLmessage(struct _t3_config_this *LLthis, int LLtoken);
void LLmessage(struct _t3_config_this *LLthis, int LLtoken) {
(void) LLtoken;
LLabort(LLthis, T3_ERR_PARSE_ERROR);
}
static file_name_t *new_file_name(const t3_config_t *config) {
file_name_t *result;
if ((result = malloc(sizeof(file_name_t))) == NULL)
return NULL;
if ((result->file_name = _t3_config_strdup(t3_config_get_string(config))) == NULL) {
free(result);
return NULL;
}
result->count = 1;
return result;
}
static void include_file(struct _t3_config_this *LLthis, t3_config_t *item, t3_config_t *include) {
/* Location to save data from current lexer. */
yyscan_t scanner;
int scan_type;
int line_number;
FILE *file;
t3_config_t *included;
yyscan_t new_scanner;
FILE *new_file;
int result;
for (included = _t3_config_data->included; included != NULL; included = included->next) {
if (strcmp(included->value.string, include->value.string) == 0) {
/* It is an error to use recursive includes. */
if (_t3_config_data->opts->flags & T3_CONFIG_VERBOSE_ERROR)
_t3_config_data->error_extra = t3_config_take_string(include);
/* Delete "include" because we no longer need it. */
t3_config_delete(include);
LLabort(LLthis, T3_ERR_RECURSIVE_INCLUDE);
}
}
include->next = _t3_config_data->included;
_t3_config_data->included = include;
_t3_config_unref_file_name(include);
if ((include->file_name = new_file_name(include)) == NULL)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
/* Use either the default or the user supplied include-callback function to open
the include file. */
if (_t3_config_data->opts->flags & T3_CONFIG_INCLUDE_DFLT)
new_file = t3_config_open_from_path(_t3_config_data->opts->include_callback.dflt.path,
include->value.string, _t3_config_data->opts->include_callback.dflt.flags);
else
new_file = _t3_config_data->opts->include_callback.user.open(include->value.string,
_t3_config_data->opts->include_callback.user.data);
/* Abort if the include file could not be found. */
if (new_file == NULL) {
if (_t3_config_data->opts->flags & T3_CONFIG_VERBOSE_ERROR)
_t3_config_data->error_extra = _t3_config_strdup(include->value.string);
LLabort(LLthis, T3_ERR_ERRNO);
}
/* Initialize a new lexer. */
if (_t3_config_lex_init_extra(_t3_config_data, &new_scanner) != 0)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
/* Replace the current context's lexer related values, after saving the current settings. */
scanner = _t3_config_data->scanner;
scan_type = _t3_config_data->scan_type;
file = _t3_config_data->file;
line_number = _t3_config_data->line_number;
_t3_config_data->scanner = new_scanner;
_t3_config_data->scan_type = SCAN_FILE;
_t3_config_data->file = new_file;
_t3_config_data->current_section = item;
_t3_config_data->line_number = 1;
/* Parse the included file. */
result = _t3_config_parse_include(_t3_config_data);
/* Destroy the new lexer, and reset all the lexer related values in the context. */
_t3_config_lex_destroy(new_scanner);
_t3_config_data->scanner = scanner;
_t3_config_data->scan_type = scan_type;
_t3_config_data->file = file;
/* Close the include file. */
fclose(new_file);
/* Abort if the parse of the include file was not successful. */
if (result != T3_ERR_SUCCESS)
LLabort(LLthis, result);
/* The line number may get used if LLabort is called above. Thus we only reset it
after we pass all possible LLabort calls. */
_t3_config_data->line_number = line_number;
/* Remove the current include from the list (stack) of included files. */
_t3_config_data->included = _t3_config_data->included->next;
/* Prevent deletion of the entire chain. */
include->next = NULL;
t3_config_delete(include);
}
#line 371 "parser.c"
static void _t3_config_0_config(LLthisType *LLthis) ;
static void _t3_config_1_include_config(LLthisType *LLthis) ;
static void _t3_config_2_value(LLthisType *LLthis,
#line 297 "parser.g"
t3_config_t *item
#line 377 "parser.c"
) ;
static void _t3_config_3_item(LLthisType *LLthis,
#line 366 "parser.g"
t3_config_t **item
#line 382 "parser.c"
) ;
static void _t3_config_4_section(LLthisType *LLthis,
#line 379 "parser.g"
t3_config_t *item
#line 387 "parser.c"
) ;
static void _t3_config_5_section_contents(LLthisType *LLthis,
#line 386 "parser.g"
t3_config_t *item
#line 392 "parser.c"
) ;
static void _t3_config_6_constraint(LLthisType *LLthis) ;
static void _t3_config_7_expression(LLthisType *LLthis,
#line 559 "parser.g"
int priority, expr_node_t **node
#line 398 "parser.c"
) ;
static void _t3_config_8_factor(LLthisType *LLthis,
#line 574 "parser.g"
expr_node_t **node
#line 403 "parser.c"
) ;
static void _t3_config_0_config(LLthisType *LLthis) {
#line 286 "parser.g"
_t3_config_data->result = allocate_item(LLthis, t3_false);
((t3_config_t *) _t3_config_data->result)->line_number = 0;
#line 411 "parser.c"
_t3_config_5_section_contents(LLthis,
#line 290 "parser.g"
_t3_config_data->result
#line 415 "parser.c"
);
}
static void _t3_config_1_include_config(LLthisType *LLthis) {
_t3_config_5_section_contents(LLthis,
#line 294 "parser.g"
_t3_config_data->current_section
#line 422 "parser.c"
);
}
static void _t3_config_2_value(LLthisType *LLthis,
#line 297 "parser.g"
t3_config_t *item
#line 428 "parser.c"
) {
#line 297 "parser.g"
t3_config_t **next_ptr;
#line 434 "parser.c"
LL_0:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_0;
/*FALLTHROUGH*/
case 1:/* INT */
LLscnt[0]--;
LL_SCANDONE(257);/* INT */
#line 301 "parser.g"
{
set_value(LLthis, item, T3_CONFIG_INT);
}
#line 448 "parser.c"
LLread();
break;
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
LLscnt[0]--;
LLscnt[1]++;
LL_1:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_1;
/*FALLTHROUGH*/
case 5:/* BOOL_TRUE */
LLscnt[1]--;
LL_SCANDONE(261);/* BOOL_TRUE */
break;
case 6:/* BOOL_FALSE */
LLscnt[1]--;
LL_SCANDONE(262);/* BOOL_FALSE */
break;
}
#line 306 "parser.g"
{
set_value(LLthis, item, T3_CONFIG_BOOL);
}
#line 474 "parser.c"
LLread();
break;
case 2:/* NUMBER */
LLscnt[0]--;
LL_SCANDONE(258);/* NUMBER */
#line 311 "parser.g"
{
set_value(LLthis, item, T3_CONFIG_NUMBER);
}
#line 484 "parser.c"
LLread();
break;
case 3:/* STRING */
LLscnt[0]--;
LLtcnt[11]++;
LL_SCANDONE(259);/* STRING */
#line 316 "parser.g"
{
set_value(LLthis, item, T3_CONFIG_STRING);
}
#line 495 "parser.c"
LLread();
for (;;) {
LL_2:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_2;
break;
case 0:/* <NUL> */
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 12:/* <NL> */
case 13:/* '(' */
case 14:/* ',' */
case 15:/* ')' */
case 17:/* '{' */
case 18:/* '}' */
case 19:/* ';' */
break;
case 11:/* '+' */
LLtcnt[12]++;
LLtcnt[3]++;
LL_SCANDONE(43);/* '+' */
LLread();
for (;;) {
LL_3:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_3;
break;
case 3:/* STRING */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
LLtcnt[3]--;
LL_SCANDONE(259);/* STRING */
#line 323 "parser.g"
{
/* We won't be adding the entire yytext, so we can safely ignore the
nul byte. */
char *text = _t3_config_get_text(_t3_config_data->scanner);
char *value = realloc(item->value.string, strlen(text) + strlen(item->value.string));
if (value == NULL)
LLabort(LLthis, T3_ERR_OUT_OF_MEMORY);
item->value.string = value;
value += strlen(value);
_t3_unescape(value, text);
}
#line 553 "parser.c"
LLread();
continue;
}
LLtcnt[11]--;
break;
}
break;
case 13:/* '(' */
LLscnt[0]--;
LLtcnt[12]++;
LLscnt[2]++;
LLtcnt[15]++;
LL_SCANDONE(40);/* '(' */
#line 338 "parser.g"
{
set_value(LLthis, item, T3_CONFIG_LIST);
item->value.list = NULL;
next_ptr = &item->value.list;
}
#line 573 "parser.c"
LLread();
for (;;) {
LL_4:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_4;
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 15:/* ')' */
case 17:/* '{' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
for (;;) {
LL_5:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_5;
break;
case 15:/* ')' */
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 17:/* '{' */
LLscnt[2]++;
LLtcnt[12]++;
LLtcnt[14]++;
#line 345 "parser.g"
{
*next_ptr = allocate_item(LLthis, t3_false);
}
#line 620 "parser.c"
LL_6:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_6;
/*FALLTHROUGH*/
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
LLscnt[2]--;
LLscnt[0]++;
_t3_config_2_value(LLthis,
#line 349 "parser.g"
*next_ptr
#line 638 "parser.c"
);
break;
case 17:/* '{' */
LLscnt[2]--;
_t3_config_4_section(LLthis,
#line 351 "parser.g"
*next_ptr
#line 646 "parser.c"
);
LLread();
break;
}
#line 353 "parser.g"
{
next_ptr = &(*next_ptr)->next;
}
#line 655 "parser.c"
for (;;) {
LL_7:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_7;
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 14:/* ',' */
case 15:/* ')' */
case 17:/* '{' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
for (;;) {
LL_8:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_8;
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 15:/* ')' */
case 17:/* '{' */
break;
case 14:/* ',' */
LLtcnt[12]++;
LLscnt[2]++;
LLtcnt[12]++;
LL_SCANDONE(44);/* ',' */
LLread();
for (;;) {
LL_9:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_9;
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 17:/* '{' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
#line 360 "parser.g"
{
*next_ptr = allocate_item(LLthis, t3_false);
}
#line 727 "parser.c"
LL_10:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_10;
/*FALLTHROUGH*/
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
LLscnt[2]--;
LLscnt[0]++;
_t3_config_2_value(LLthis,
#line 360 "parser.g"
*next_ptr
#line 745 "parser.c"
);
break;
case 17:/* '{' */
LLscnt[2]--;
_t3_config_4_section(LLthis,
#line 360 "parser.g"
*next_ptr
#line 753 "parser.c"
);
LLread();
break;
}
#line 360 "parser.g"
{
next_ptr = &(*next_ptr)->next;
}
#line 762 "parser.c"
for (;;) {
LL_11:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_11;
break;
case 1:/* INT */
case 2:/* NUMBER */
case 3:/* STRING */
case 5:/* BOOL_TRUE */
case 6:/* BOOL_FALSE */
case 13:/* '(' */
case 14:/* ',' */
case 15:/* ')' */
case 17:/* '{' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
continue;
}
LLtcnt[14]--;
break;
}
continue;
}
LLscnt[2]--;
break;
}
LLtcnt[15]--;
LL_SCANDONE(41);/* ')' */
LLread();
break;
}
}
static void _t3_config_3_item(LLthisType *LLthis,
#line 366 "parser.g"
t3_config_t **item
#line 806 "parser.c"
) {
LLscnt[3]++;
LL_SCANDONE(260);/* IDENTIFIER */
#line 368 "parser.g"
{
*item = allocate_item(LLthis, t3_true);
}
#line 814 "parser.c"
LLread();
LL_0:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_0;
/*FALLTHROUGH*/
case 17:/* '{' */
LLscnt[3]--;
_t3_config_4_section(LLthis,
#line 372 "parser.g"
*item
#line 827 "parser.c"
);
LLread();
break;
case 16:/* '=' */
LLscnt[3]--;
LLscnt[0]++;
LL_SCANDONE(61);/* '=' */
LLread();
_t3_config_2_value(LLthis,
#line 375 "parser.g"
*item
#line 839 "parser.c"
);
break;
}
}
static void _t3_config_4_section(LLthisType *LLthis,
#line 379 "parser.g"
t3_config_t *item
#line 847 "parser.c"
) {
LLscnt[4]++;
LLtcnt[18]++;
LL_SCANDONE(123);/* '{' */
LLread();
LLscnt[4]--;
_t3_config_5_section_contents(LLthis,
#line 382 "parser.g"
item
#line 857 "parser.c"
);
LLtcnt[18]--;
LL_SCANDONE(125);/* '}' */
}
static void _t3_config_5_section_contents(LLthisType *LLthis,
#line 386 "parser.g"
t3_config_t *item
#line 865 "parser.c"
) {
#line 386 "parser.g"
t3_config_t **next_ptr = &item->value.list;
item->type = T3_CONFIG_SECTION;
while (*next_ptr != NULL)
next_ptr = &(*next_ptr)->next;
#line 874 "parser.c"
LLtcnt[12]++;
LLtcnt[4]++;
for (;;) {
LL_0:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_0;
break;
case 0:/* <NUL> */
case 4:/* IDENTIFIER */
case 18:/* '}' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
for (;;) {
LL_1:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_1;
break;
case 0:/* <NUL> */
case 18:/* '}' */
break;
case 4:/* IDENTIFIER */
LLscnt[5]++;
_t3_config_3_item(LLthis,
#line 394 "parser.g"
next_ptr
#line 909 "parser.c"
);
#line 395 "parser.g"
{
if (_t3_config_data->opts != NULL && (_t3_config_data->opts->flags & (T3_CONFIG_INCLUDE_DFLT | T3_CONFIG_INCLUDE_USER)) &&
strcmp((*next_ptr)->name, "%include") == 0)
{
t3_config_t *include = *next_ptr;
*next_ptr = NULL;
include_file(LLthis, item, include);
while (*next_ptr != NULL)
next_ptr = &(*next_ptr)->next;
} else {
if (t3_config_get(item, (*next_ptr)->name) != *next_ptr) {
if (_t3_config_data->opts != NULL && (_t3_config_data->opts->flags & T3_CONFIG_VERBOSE_ERROR))
_t3_config_data->error_extra = _t3_config_strdup((*next_ptr)->name);
LLabort(LLthis, T3_ERR_DUPLICATE_KEY);
}
if (!transform_percent_list(LLthis, item, next_ptr))
next_ptr = &(*next_ptr)->next;
}
}
#line 931 "parser.c"
LL_2:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_2;
/*FALLTHROUGH*/
case 0:/* <NUL> */
case 18:/* '}' */
LLscnt[5]--;
break;
case 4:/* IDENTIFIER */
case 12:/* <NL> */
case 19:/* ';' */
LLscnt[5]--;
LLscnt[5]++;
LLtcnt[12]++;
LL_3:
switch (LLcsymb) {
default:
if (LLskip())
goto LL_3;
/*FALLTHROUGH*/
case 19:/* ';' */
LLscnt[5]--;
LL_SCANDONE(59);/* ';' */
break;
case 12:/* <NL> */
LLscnt[5]--;
LL_SCANDONE(10);/* <NL> */
break;
}
LLread();
for (;;) {
LL_4:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_4;
break;
case 0:/* <NUL> */
case 4:/* IDENTIFIER */
case 18:/* '}' */
break;
case 12:/* <NL> */
LL_SCANDONE(10);/* <NL> */
LLread();
continue;
}
LLtcnt[12]--;
break;
}
}
continue;
}
LLtcnt[4]--;
break;
}
}
#line 422 "parser.g"
static int get_priority(int operator) {
switch (operator) {
case '|':
case '^':
case '&':
return 0;
case '=':
case NE:
case '<':
case LE:
case '>':