-
Notifications
You must be signed in to change notification settings - Fork 2
/
0000-Regenerate-with-Bison-3.8.2.patch
9550 lines (8431 loc) · 345 KB
/
0000-Regenerate-with-Bison-3.8.2.patch
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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Johannes Obermayr <[email protected]>
Date: Sun, 11 Dec 2022 14:48:25 +0100
Subject: [PATCH] 0000: Regenerate with Bison 3.8.2
---
.../Decompiler/certification.manifest | 7 +
.../Decompiler/src/decompile/cpp/grammar.cc | 871 ++++-----
.../Decompiler/src/decompile/cpp/makeBison.sh | 5 +
.../src/decompile/cpp/pcodeparse.cc | 1157 +++++-------
.../Decompiler/src/decompile/cpp/pcodeparse.y | 9 +
.../Decompiler/src/decompile/cpp/slghparse.cc | 1676 +++++++----------
.../Decompiler/src/decompile/cpp/slghparse.hh | 257 ++-
.../Decompiler/src/decompile/cpp/slghscan.cc | 89 +-
.../Decompiler/src/decompile/cpp/xml.cc | 1490 +++++++--------
.../Decompiler/src/decompile/cpp/xml.y | 9 +
10 files changed, 2408 insertions(+), 3162 deletions(-)
create mode 100755 Ghidra/Features/Decompiler/src/decompile/cpp/makeBison.sh
diff --git a/Ghidra/Features/Decompiler/certification.manifest b/Ghidra/Features/Decompiler/certification.manifest
index 8d3f7a6ae8..0deebeb2f6 100644
--- a/Ghidra/Features/Decompiler/certification.manifest
+++ b/Ghidra/Features/Decompiler/certification.manifest
@@ -11,6 +11,13 @@ src/decompile/.cproject||GHIDRA||||END|
src/decompile/cpp/.gitignore||GHIDRA||||END|
src/decompile/cpp/Doxyfile||GHIDRA|||Most of this file is autogenerated by doxygen which falls under the GPL - output from GPL products are NOT GPL! - mjbell4|END|
src/decompile/cpp/Makefile||GHIDRA||||END|
+src/decompile/cpp/grammar.cc||GHIDRA||||END|
+src/decompile/cpp/makeBison.sh||GHIDRA||||END|
+src/decompile/cpp/pcodeparse.cc||GHIDRA||||END|
+src/decompile/cpp/slghparse.cc||GHIDRA||||END|
+src/decompile/cpp/slghparse.hh||GHIDRA||||END|
+src/decompile/cpp/slghscan.cc||GHIDRA||||END|
+src/decompile/cpp/xml.cc||GHIDRA||||END|
src/decompile/datatests/boolless.xml||GHIDRA||||END|
src/decompile/datatests/concat.xml||GHIDRA||||END|
src/decompile/datatests/condconst.xml||GHIDRA||||END|
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc
index 998ea56c98..1690d7e2bf 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc
@@ -1,23 +1,8 @@
-/* ###
- * IP: GHIDRA
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* A Bison parser, made by GNU Bison 3.5.1. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -31,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -49,6 +34,10 @@
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+ especially those whose name start with YY_ or yy_. They are
+ private implementation details that can be changed or removed. */
+
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
@@ -56,14 +45,11 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-/* Undocumented macros, especially those whose name start with YY_,
- are private implementation details. Do not rely on them. */
-
-/* Identify Bison output. */
-#define YYBISON 1
+/* Identify Bison output, and Bison version. */
+#define YYBISON 30802
-/* Bison version. */
-#define YYBISON_VERSION "3.5.1"
+/* Bison version string. */
+#define YYBISON_VERSION "3.8.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -120,14 +106,6 @@ static CParse *parse;
# endif
# endif
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
/* Debug traces. */
#ifndef GRAMMARDEBUG
@@ -145,25 +123,30 @@ static CParse *parse;
extern int grammardebug;
#endif
-/* Token type. */
+/* Token kinds. */
#ifndef GRAMMARTOKENTYPE
# define GRAMMARTOKENTYPE
enum grammartokentype
{
- DOTDOTDOT = 258,
- BADTOKEN = 259,
- STRUCT = 260,
- UNION = 261,
- ENUM = 262,
- DECLARATION_RESULT = 263,
- PARAM_RESULT = 264,
- NUMBER = 265,
- IDENTIFIER = 266,
- STORAGE_CLASS_SPECIFIER = 267,
- TYPE_QUALIFIER = 268,
- FUNCTION_SPECIFIER = 269,
- TYPE_NAME = 270
+ GRAMMAREMPTY = -2,
+ GRAMMAREOF = 0, /* "end of file" */
+ GRAMMARerror = 256, /* error */
+ GRAMMARUNDEF = 257, /* "invalid token" */
+ DOTDOTDOT = 258, /* DOTDOTDOT */
+ BADTOKEN = 259, /* BADTOKEN */
+ STRUCT = 260, /* STRUCT */
+ UNION = 261, /* UNION */
+ ENUM = 262, /* ENUM */
+ DECLARATION_RESULT = 263, /* DECLARATION_RESULT */
+ PARAM_RESULT = 264, /* PARAM_RESULT */
+ NUMBER = 265, /* NUMBER */
+ IDENTIFIER = 266, /* IDENTIFIER */
+ STORAGE_CLASS_SPECIFIER = 267, /* STORAGE_CLASS_SPECIFIER */
+ TYPE_QUALIFIER = 268, /* TYPE_QUALIFIER */
+ FUNCTION_SPECIFIER = 269, /* FUNCTION_SPECIFIER */
+ TYPE_NAME = 270 /* TYPE_NAME */
};
+ typedef enum grammartokentype grammartoken_kind_t;
#endif
/* Value type. */
@@ -192,10 +175,71 @@ typedef union GRAMMARSTYPE GRAMMARSTYPE;
extern GRAMMARSTYPE grammarlval;
+
int grammarparse (void);
+/* Symbol kind. */
+enum yysymbol_kind_t
+{
+ YYSYMBOL_YYEMPTY = -2,
+ YYSYMBOL_YYEOF = 0, /* "end of file" */
+ YYSYMBOL_YYerror = 1, /* error */
+ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
+ YYSYMBOL_DOTDOTDOT = 3, /* DOTDOTDOT */
+ YYSYMBOL_BADTOKEN = 4, /* BADTOKEN */
+ YYSYMBOL_STRUCT = 5, /* STRUCT */
+ YYSYMBOL_UNION = 6, /* UNION */
+ YYSYMBOL_ENUM = 7, /* ENUM */
+ YYSYMBOL_DECLARATION_RESULT = 8, /* DECLARATION_RESULT */
+ YYSYMBOL_PARAM_RESULT = 9, /* PARAM_RESULT */
+ YYSYMBOL_NUMBER = 10, /* NUMBER */
+ YYSYMBOL_IDENTIFIER = 11, /* IDENTIFIER */
+ YYSYMBOL_STORAGE_CLASS_SPECIFIER = 12, /* STORAGE_CLASS_SPECIFIER */
+ YYSYMBOL_TYPE_QUALIFIER = 13, /* TYPE_QUALIFIER */
+ YYSYMBOL_FUNCTION_SPECIFIER = 14, /* FUNCTION_SPECIFIER */
+ YYSYMBOL_TYPE_NAME = 15, /* TYPE_NAME */
+ YYSYMBOL_16_ = 16, /* ';' */
+ YYSYMBOL_17_ = 17, /* ',' */
+ YYSYMBOL_18_ = 18, /* '{' */
+ YYSYMBOL_19_ = 19, /* '}' */
+ YYSYMBOL_20_ = 20, /* '=' */
+ YYSYMBOL_21_ = 21, /* '(' */
+ YYSYMBOL_22_ = 22, /* ')' */
+ YYSYMBOL_23_ = 23, /* '[' */
+ YYSYMBOL_24_ = 24, /* ']' */
+ YYSYMBOL_25_ = 25, /* '*' */
+ YYSYMBOL_YYACCEPT = 26, /* $accept */
+ YYSYMBOL_document = 27, /* document */
+ YYSYMBOL_declaration = 28, /* declaration */
+ YYSYMBOL_declaration_specifiers = 29, /* declaration_specifiers */
+ YYSYMBOL_init_declarator_list = 30, /* init_declarator_list */
+ YYSYMBOL_init_declarator = 31, /* init_declarator */
+ YYSYMBOL_type_specifier = 32, /* type_specifier */
+ YYSYMBOL_struct_or_union_specifier = 33, /* struct_or_union_specifier */
+ YYSYMBOL_struct_declaration_list = 34, /* struct_declaration_list */
+ YYSYMBOL_struct_declaration = 35, /* struct_declaration */
+ YYSYMBOL_specifier_qualifier_list = 36, /* specifier_qualifier_list */
+ YYSYMBOL_struct_declarator_list = 37, /* struct_declarator_list */
+ YYSYMBOL_struct_declarator = 38, /* struct_declarator */
+ YYSYMBOL_enum_specifier = 39, /* enum_specifier */
+ YYSYMBOL_enumerator_list = 40, /* enumerator_list */
+ YYSYMBOL_enumerator = 41, /* enumerator */
+ YYSYMBOL_declarator = 42, /* declarator */
+ YYSYMBOL_direct_declarator = 43, /* direct_declarator */
+ YYSYMBOL_pointer = 44, /* pointer */
+ YYSYMBOL_type_qualifier_list = 45, /* type_qualifier_list */
+ YYSYMBOL_parameter_type_list = 46, /* parameter_type_list */
+ YYSYMBOL_parameter_list = 47, /* parameter_list */
+ YYSYMBOL_parameter_declaration = 48, /* parameter_declaration */
+ YYSYMBOL_abstract_declarator = 49, /* abstract_declarator */
+ YYSYMBOL_direct_abstract_declarator = 50, /* direct_abstract_declarator */
+ YYSYMBOL_assignment_expression = 51 /* assignment_expression */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+
+
#ifdef short
@@ -235,6 +279,18 @@ typedef int_least16_t yytype_int16;
typedef short yytype_int16;
#endif
+/* Work around bug in HP-UX 11.23, which defines these macros
+ incorrectly for preprocessor constants. This workaround can likely
+ be removed in 2023, as HPE has promised support for HP-UX 11.23
+ (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+ <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
@@ -294,6 +350,7 @@ typedef int yytype_uint16;
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
/* Stored state numbers (used for stacks). */
typedef yytype_int8 yy_state_t;
@@ -312,6 +369,7 @@ typedef int yy_state_fast_t;
# endif
#endif
+
#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
@@ -330,17 +388,23 @@ typedef int yy_state_fast_t;
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
#else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
#endif
-#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
@@ -369,7 +433,7 @@ typedef int yy_state_fast_t;
#define YY_ASSERT(E) ((void) (0 && (E)))
-#if ! defined yyoverflow || YYERROR_VERBOSE
+#if !defined yyoverflow
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -434,8 +498,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* !defined yyoverflow */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
@@ -511,14 +574,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 115
-#define YYUNDEFTOK 2
+/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 270
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
-#define YYTRANSLATE(YYX) \
- (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+#define YYTRANSLATE(YYX) \
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
+ : YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
@@ -555,7 +620,7 @@ static const yytype_int8 yytranslate[] =
};
#if GRAMMARDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 62, 62, 63, 67, 68, 72, 73, 74, 75,
@@ -569,37 +634,40 @@ static const yytype_uint8 yyrline[] =
};
#endif
-#if GRAMMARDEBUG || YYERROR_VERBOSE || 0
+/** Accessing symbol of state STATE. */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if GRAMMARDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+ YYSYMBOL. No bounds checking. */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "DOTDOTDOT", "BADTOKEN", "STRUCT",
- "UNION", "ENUM", "DECLARATION_RESULT", "PARAM_RESULT", "NUMBER",
- "IDENTIFIER", "STORAGE_CLASS_SPECIFIER", "TYPE_QUALIFIER",
- "FUNCTION_SPECIFIER", "TYPE_NAME", "';'", "','", "'{'", "'}'", "'='",
- "'('", "')'", "'['", "']'", "'*'", "$accept", "document", "declaration",
- "declaration_specifiers", "init_declarator_list", "init_declarator",
- "type_specifier", "struct_or_union_specifier", "struct_declaration_list",
- "struct_declaration", "specifier_qualifier_list",
- "struct_declarator_list", "struct_declarator", "enum_specifier",
- "enumerator_list", "enumerator", "declarator", "direct_declarator",
- "pointer", "type_qualifier_list", "parameter_type_list",
- "parameter_list", "parameter_declaration", "abstract_declarator",
- "direct_abstract_declarator", "assignment_expression", YY_NULLPTR
+ "\"end of file\"", "error", "\"invalid token\"", "DOTDOTDOT",
+ "BADTOKEN", "STRUCT", "UNION", "ENUM", "DECLARATION_RESULT",
+ "PARAM_RESULT", "NUMBER", "IDENTIFIER", "STORAGE_CLASS_SPECIFIER",
+ "TYPE_QUALIFIER", "FUNCTION_SPECIFIER", "TYPE_NAME", "';'", "','", "'{'",
+ "'}'", "'='", "'('", "')'", "'['", "']'", "'*'", "$accept", "document",
+ "declaration", "declaration_specifiers", "init_declarator_list",
+ "init_declarator", "type_specifier", "struct_or_union_specifier",
+ "struct_declaration_list", "struct_declaration",
+ "specifier_qualifier_list", "struct_declarator_list",
+ "struct_declarator", "enum_specifier", "enumerator_list", "enumerator",
+ "declarator", "direct_declarator", "pointer", "type_qualifier_list",
+ "parameter_type_list", "parameter_list", "parameter_declaration",
+ "abstract_declarator", "direct_abstract_declarator",
+ "assignment_expression", YY_NULLPTR
};
-#endif
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_int16 yytoknum[] =
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 59, 44, 123, 125,
- 61, 40, 41, 91, 93, 42
-};
-# endif
+ return yytname[yysymbol];
+}
+#endif
#define YYPACT_NINF (-71)
@@ -611,8 +679,8 @@ static const yytype_int16 yytoknum[] =
#define yytable_value_is_error(Yyn) \
0
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int16 yypact[] =
{
114, 102, 102, 16, 41, 59, 108, 102, 102, 102,
@@ -629,9 +697,9 @@ static const yytype_int16 yypact[] =
-71, -71, -71, -71, -71
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
static const yytype_int8 yydefact[] =
{
0, 0, 0, 0, 0, 0, 0, 6, 8, 9,
@@ -648,7 +716,7 @@ static const yytype_int8 yydefact[] =
34, 38, 59, 61, 49
};
- /* YYPGOTO[NTERM-NUM]. */
+/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-71, -71, -71, 93, -71, 82, -1, -71, -11, -37,
@@ -656,17 +724,17 @@ static const yytype_int8 yypgoto[] =
84, -71, 0, 113, 115, -62
};
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 3, 11, 16, 32, 33, 45, 14, 46, 47,
+ 0, 3, 11, 16, 32, 33, 45, 14, 46, 47,
48, 73, 74, 15, 53, 54, 34, 35, 36, 58,
86, 87, 88, 41, 42, 91
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] =
{
13, 13, 17, 39, 40, 94, 13, 13, 13, 72,
@@ -707,8 +775,8 @@ static const yytype_int8 yycheck[] =
66, 38, -1, -1, -1, 40
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+ state STATE-NUM. */
static const yytype_int8 yystos[] =
{
0, 8, 9, 27, 5, 6, 7, 12, 13, 14,
@@ -725,7 +793,7 @@ static const yytype_int8 yystos[] =
38, 19, 3, 48, 24
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
static const yytype_int8 yyr1[] =
{
0, 26, 27, 27, 28, 28, 29, 29, 29, 29,
@@ -738,7 +806,7 @@ static const yytype_int8 yyr1[] =
50, 51
};
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
static const yytype_int8 yyr2[] =
{
0, 2, 2, 2, 2, 3, 1, 1, 1, 1,
@@ -752,21 +820,22 @@ static const yytype_int8 yyr2[] =
};
+enum { YYENOMEM = -2 };
+
#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
+#define yyclearin (yychar = GRAMMAREMPTY)
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
+#define YYNOMEM goto yyexhaustedlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
- if (yychar == YYEMPTY) \
+ if (yychar == GRAMMAREMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
@@ -781,10 +850,9 @@ static const yytype_int8 yyr2[] =
} \
while (0)
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
+/* Backward compatibility with an undocumented macro.
+ Use GRAMMARerror or GRAMMARUNDEF. */
+#define YYERRCODE GRAMMARUNDEF
/* Enable debugging if requested. */
@@ -801,19 +869,16 @@ do { \
YYFPRINTF Args; \
} while (0)
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
- Type, Value); \
+ Kind, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
@@ -824,18 +889,15 @@ do { \
`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
FILE *yyoutput = yyo;
- YYUSE (yyoutput);
+ YY_USE (yyoutput);
if (!yyvaluep)
return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
-# endif
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
+ YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
@@ -845,12 +907,13 @@ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
`---------------------------*/
static void
-yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyo, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
- yy_symbol_value_print (yyo, yytype, yyvaluep);
+ yy_symbol_value_print (yyo, yykind, yyvaluep);
YYFPRINTF (yyo, ")");
}
@@ -883,7 +946,8 @@ do { \
`------------------------------------------------*/
static void
-yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+ int yyrule)
{
int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
@@ -895,9 +959,8 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
- yystos[+yyssp[yyi + 1 - yynrhs]],
- &yyvsp[(yyi + 1) - (yynrhs)]
- );
+ YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+ &yyvsp[(yyi + 1) - (yynrhs)]);
YYFPRINTF (stderr, "\n");
}
}
@@ -912,8 +975,8 @@ do { \
multiple parsers can coexist. */
int yydebug;
#else /* !GRAMMARDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !GRAMMARDEBUG */
@@ -936,259 +999,30 @@ int yydebug;
#endif
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
-# else
-/* Return the length of YYSTR. */
-static YYPTRDIFF_T
-yystrlen (const char *yystr)
-{
- YYPTRDIFF_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYPTRDIFF_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYPTRDIFF_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- else
- goto append;
-
- append:
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (yyres)
- return yystpcpy (yyres, yystr) - yyres;
- else
- return yystrlen (yystr);
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
- yy_state_t *yyssp, int yytoken)
-{
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat: reported tokens (one for the "unexpected",
- one per "expected"). */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Actual size of YYARG. */
- int yycount = 0;
- /* Cumulated lengths of YYARG. */
- YYPTRDIFF_T yysize = 0;
-
- /* There are many possibilities here to consider:
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[+*yyssp];
- YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- yysize = yysize0;
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYPTRDIFF_T yysize1
- = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
- yysize = yysize1;
- else
- return 2;
- }
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- default: /* Avoid compiler warnings. */
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
- {
- /* Don't count the "%s"s in the final size, but reserve room for
- the terminator. */
- YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
- if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
- yysize = yysize1;
- else
- return 2;
- }
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- ++yyp;
- ++yyformat;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+yydestruct (const char *yymsg,
+ yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
- YYUSE (yyvaluep);
+ YY_USE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
+ YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-
-
-/* The lookahead symbol. */
+/* Lookahead token kind. */
int yychar;
/* The semantic value of the lookahead symbol. */
@@ -1197,6 +1031,8 @@ YYSTYPE yylval;
int yynerrs;
+
+
/*----------.
| yyparse. |
`----------*/
@@ -1204,43 +1040,36 @@ int yynerrs;
int
yyparse (void)
{
- yy_state_fast_t yystate;
+ yy_state_fast_t yystate = 0;
/* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
+ int yyerrstatus = 0;
- /* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
-
- Refer to the stacks through separate pointers, to allow yyoverflow
+ /* Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
- /* The state stack. */
+ /* Their size. */
+ YYPTRDIFF_T yystacksize = YYINITDEPTH;
+
+ /* The state stack: array, bottom, top. */
yy_state_t yyssa[YYINITDEPTH];
- yy_state_t *yyss;
- yy_state_t *yyssp;
+ yy_state_t *yyss = yyssa;
+ yy_state_t *yyssp = yyss;
- /* The semantic value stack. */
+ /* The semantic value stack: array, bottom, top. */
YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYPTRDIFF_T yystacksize;
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp = yyvs;
int yyn;
+ /* The return value of yyparse. */
int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
+ /* Lookahead symbol kind. */
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
@@ -1248,16 +1077,10 @@ yyparse (void)
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
-
YYDPRINTF ((stderr, "Starting parse\n"));
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = GRAMMAREMPTY; /* Cause a token to be read. */
+
goto yysetstate;
@@ -1279,10 +1102,11 @@ yysetstate:
YY_IGNORE_USELESS_CAST_BEGIN
*yyssp = YY_CAST (yy_state_t, yystate);
YY_IGNORE_USELESS_CAST_END
+ YY_STACK_PRINT (yyss, yyssp);
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
- goto yyexhaustedlab;
+ YYNOMEM;