]>
Commit | Line | Data |
---|---|---|
8e37b772 | 1 | /* |
2 | ** Inserted at beginning of c files generated by bison | |
3 | ** REMEMBER: Change bison.reset too. | |
4 | */ | |
5 | ||
6 | /*@-allmacros@*/ | |
7 | /*@+boolint@*/ | |
8 | /*@+charint@*/ | |
9 | /*@-macroparams@*/ | |
10 | /*@-macroundef@*/ | |
11 | /*@-unreachable@*/ | |
12 | /*@-macrospec@*/ | |
13 | /*@-varuse@*/ | |
14 | /*@+ignorequals@*/ | |
15 | /*@-macrostmt@*/ | |
16 | /*@-noeffect@*/ | |
17 | /*@-shadow@*/ | |
18 | /*@-exitarg@*/ | |
19 | /*@-macroredef@*/ | |
20 | /*@-uniondef@*/ | |
21 | /*@-compdef@*/ | |
22 | /*@-matchfields@*/ | |
23 | /*@-exportlocal@*/ | |
24 | /*@-evalorderuncon@*/ | |
25 | /*@-exportheader@*/ | |
26 | /*@-typeuse@*/ | |
27 | /*@-redecl@*/ | |
28 | /*@-redef@*/ | |
29 | /*@-noparams@*/ | |
30 | /*@-ansireserved@*/ | |
31 | /*@-fielduse@*/ | |
32 | /*@-ifblock@*/ | |
33 | /*@-elseifcomplete@*/ | |
34 | /*@-whileblock@*/ | |
35 | /*@-forblock@*/ | |
36 | /*@-branchstate@*/ | |
37 | /*@-readonlytrans@*/ | |
38 | /*@-namechecks@*/ | |
39 | /*@-usedef@*/ | |
40 | /*@-systemunrecog@*/ | |
41 | /*@-dependenttrans@*/ | |
42 | /*@-unqualifiedtrans@*/ | |
43 | /*@-nullassign@*/ | |
bb7c2085 | 44 | /*@-nullpass@*/ |
45 | /*@-nullptrarith*/ | |
46 | /*@-usereleased@*/ | |
8e37b772 | 47 | /*@-declundef@*/ |
48 | ||
bbed3d50 | 49 | /*drl added 11/27/2001*/ |
bb7c2085 | 50 | /*@-bounds@*/ |
8e37b772 | 51 | /* < end of bison.head > */ |
52 | ||
53 | ||
e55c0c6d | 54 | /* A Bison parser, made from mtgrammar.y |
55 | by GNU bison 1.30. */ | |
8e37b772 | 56 | |
57 | #define YYBISON 1 /* Identify Bison output. */ | |
58 | ||
59 | #define yyparse mtparse | |
60 | #define yylex mtlex | |
61 | #define yyerror mterror | |
62 | #define yylval mtlval | |
63 | #define yychar mtchar | |
64 | #define yydebug mtdebug | |
65 | #define yynerrs mtnerrs | |
e55c0c6d | 66 | # define MT_BADTOK 257 |
67 | # define MT_END 258 | |
68 | # define MT_STATE 259 | |
69 | # define MT_GLOBAL 260 | |
70 | # define MT_CONTEXT 261 | |
71 | # define MT_ONEOF 262 | |
72 | # define MT_DEFAULTS 263 | |
73 | # define MT_DEFAULT 264 | |
74 | # define MT_REFERENCE 265 | |
75 | # define MT_PARAMETER 266 | |
76 | # define MT_RESULT 267 | |
77 | # define MT_CLAUSE 268 | |
78 | # define MT_LITERAL 269 | |
79 | # define MT_NULL 270 | |
80 | # define MT_ANNOTATIONS 271 | |
81 | # define MT_ARROW 272 | |
82 | # define MT_MERGE 273 | |
83 | # define MT_TRANSFERS 274 | |
84 | # define MT_PRECONDITIONS 275 | |
85 | # define MT_POSTCONDITIONS 276 | |
86 | # define MT_LOSEREFERENCE 277 | |
87 | # define MT_AS 278 | |
88 | # define MT_ERROR 279 | |
89 | # define MT_PLUS 280 | |
90 | # define MT_STAR 281 | |
91 | # define MT_BAR 282 | |
92 | # define MT_LPAREN 283 | |
93 | # define MT_RPAREN 284 | |
94 | # define MT_LBRACKET 285 | |
95 | # define MT_RBRACKET 286 | |
96 | # define MT_LBRACE 287 | |
97 | # define MT_RBRACE 288 | |
98 | # define MT_COMMA 289 | |
99 | # define MT_CHAR 290 | |
100 | # define MT_INT 291 | |
101 | # define MT_FLOAT 292 | |
102 | # define MT_DOUBLE 293 | |
103 | # define MT_VOID 294 | |
104 | # define MT_ANYTYPE 295 | |
105 | # define MT_INTEGRALTYPE 296 | |
106 | # define MT_UNSIGNEDINTEGRALTYPE 297 | |
107 | # define MT_SIGNEDINTEGRALTYPE 298 | |
108 | # define MT_CONST 299 | |
109 | # define MT_VOLATILE 300 | |
110 | # define MT_STRINGLIT 301 | |
111 | # define MT_IDENT 302 | |
8e37b772 | 112 | |
8e37b772 | 113 | |
114 | ||
115 | # include "bison.reset" | |
1b8ae690 | 116 | # include "splintMacros.nf" |
8e37b772 | 117 | # include "llbasic.h" |
118 | ||
3e3ec469 | 119 | # ifndef S_SPLINT_S |
8e37b772 | 120 | extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ; |
121 | # endif | |
122 | ||
123 | /*@i523@*/ /* can't include these here | |
124 | # include "mtgrammar.h" | |
125 | # include "mtscanner.h" | |
126 | */ | |
127 | ||
4dd72714 | 128 | static /*@noreturn@*/ void mterror (char *); |
8e37b772 | 129 | |
130 | /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ | |
4dd72714 | 131 | extern int mtlex () ; |
8e37b772 | 132 | static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); |
133 | /*@=noparams@*/ | |
134 | ||
135 | # define YYPRINT(file, type, value) yyprint (file, type, value) | |
136 | ||
137 | # define YYDEBUG 1 | |
138 | ||
139 | # include "bison.head" | |
140 | ||
141 | ||
8e37b772 | 142 | typedef union { |
143 | mttok tok; | |
144 | mtDeclarationNode mtdecl; | |
145 | mtDeclarationPiece mtpiece; | |
146 | mtDeclarationPieces mtpieces; | |
147 | mtContextNode mtcontext; | |
148 | mtValuesNode mtvalues; | |
149 | mtDefaultsNode mtdefaults; | |
150 | mtDefaultsDeclList mtdeflist; | |
151 | mtAnnotationsNode mtannotations; | |
152 | mtAnnotationList mtannotlist; | |
153 | mtAnnotationDecl mtannotdecl; | |
154 | mtMergeNode mtmerge; | |
155 | mtMergeItem mtmergeitem; | |
156 | mtMergeClauseList mtmergeclauselist; | |
157 | mtMergeClause mtmergeclause; | |
158 | mtTransferClauseList mttransferclauselist; | |
159 | mtTransferClause mttransferclause; | |
160 | mtTransferAction mttransferaction; | |
161 | mtLoseReferenceList mtlosereferencelist; | |
162 | mtLoseReference mtlosereference; | |
163 | ||
164 | /*@only@*/ cstringList cstringlist; | |
165 | ctype ctyp; | |
166 | /*@only@*/ qtype qtyp; | |
167 | int count; | |
168 | } YYSTYPE; | |
169 | #ifndef YYDEBUG | |
e55c0c6d | 170 | # define YYDEBUG 1 |
8e37b772 | 171 | #endif |
172 | ||
173 | #include <stdio.h> | |
174 | ||
8e37b772 | 175 | |
176 | ||
177 | #define YYFINAL 135 | |
178 | #define YYFLAG -32768 | |
179 | #define YYNTBASE 49 | |
180 | ||
e55c0c6d | 181 | /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ |
8e37b772 | 182 | #define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 92) |
183 | ||
e55c0c6d | 184 | /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ |
185 | static const char yytranslate[] = | |
186 | { | |
187 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
188 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
189 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
190 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
191 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
192 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
193 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
194 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
195 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
196 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
197 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
198 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
199 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
200 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
201 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
202 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
203 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
204 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
205 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
206 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
207 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
208 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
209 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
210 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
211 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
212 | 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, | |
213 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
214 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |
215 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, | |
216 | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, | |
217 | 46, 47, 48 | |
8e37b772 | 218 | }; |
219 | ||
220 | #if YYDEBUG != 0 | |
e55c0c6d | 221 | static const short yyprhs[] = |
222 | { | |
223 | 0, 0, 1, 3, 7, 12, 15, 16, 19, 21, | |
224 | 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, | |
225 | 43, 45, 48, 51, 54, 57, 60, 63, 64, 66, | |
226 | 68, 71, 73, 77, 80, 81, 83, 85, 87, 90, | |
227 | 92, 95, 98, 102, 104, 106, 108, 111, 115, 118, | |
228 | 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, | |
229 | 142, 144, 147, 149, 153, 156, 159, 163, 168, 171, | |
230 | 173, 176, 181, 184, 186, 189, 195, 197, 199, 202, | |
231 | 205, 208, 211, 213, 216, 220, 222, 225, 231, 233, | |
232 | 235, 237, 240 | |
8e37b772 | 233 | }; |
e55c0c6d | 234 | static const short yyrhs[] = |
235 | { | |
236 | -1, 50, 0, 5, 51, 4, 0, 6, 5, 51, | |
237 | 4, 0, 48, 52, 0, 0, 53, 52, 0, 54, | |
238 | 0, 69, 0, 72, 0, 71, 0, 74, 0, 77, | |
239 | 0, 83, 0, 81, 0, 82, 0, 84, 0, 7, | |
240 | 56, 0, 0, 56, 0, 12, 57, 0, 11, 57, | |
241 | 0, 13, 57, 0, 14, 57, 0, 15, 57, 0, | |
242 | 16, 57, 0, 0, 58, 0, 59, 0, 59, 62, | |
243 | 0, 60, 0, 59, 28, 58, 0, 67, 61, 0, | |
244 | 0, 59, 0, 63, 0, 66, 0, 63, 66, 0, | |
245 | 27, 0, 27, 65, 0, 27, 63, 0, 27, 65, | |
246 | 63, 0, 45, 0, 46, 0, 64, 0, 65, 64, | |
247 | 0, 29, 62, 30, 0, 31, 32, 0, 66, 31, | |
248 | 32, 0, 36, 0, 37, 0, 38, 0, 39, 0, | |
249 | 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, | |
250 | 68, 0, 48, 0, 8, 70, 0, 48, 0, 48, | |
251 | 35, 70, 0, 10, 91, 0, 9, 73, 0, 56, | |
252 | 18, 91, 0, 56, 18, 91, 73, 0, 17, 75, | |
253 | 0, 76, 0, 76, 75, 0, 48, 55, 18, 91, | |
254 | 0, 19, 78, 0, 79, 0, 79, 78, 0, 80, | |
255 | 26, 80, 18, 89, 0, 91, 0, 27, 0, 21, | |
256 | 87, 0, 22, 87, 0, 20, 87, 0, 23, 85, | |
257 | 0, 86, 0, 86, 85, 0, 91, 18, 90, 0, | |
258 | 88, 0, 88, 87, 0, 91, 24, 91, 18, 89, | |
259 | 0, 91, 0, 90, 0, 25, 0, 25, 47, 0, | |
260 | 48, 0 | |
8e37b772 | 261 | }; |
262 | ||
263 | #endif | |
264 | ||
265 | #if YYDEBUG != 0 | |
e55c0c6d | 266 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
267 | static const short yyrline[] = | |
268 | { | |
269 | 0, 158, 159, 162, 164, 168, 172, 173, 177, 178, | |
270 | 179, 180, 181, 182, 183, 184, 185, 186, 189, 193, | |
271 | 194, 197, 198, 199, 200, 201, 202, 209, 210, 213, | |
272 | 214, 217, 218, 222, 225, 226, 230, 231, 232, 235, | |
273 | 236, 237, 238, 241, 242, 245, 246, 249, 250, 251, | |
274 | 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, | |
275 | 273, 276, 279, 280, 284, 287, 290, 292, 296, 299, | |
276 | 300, 304, 308, 311, 312, 315, 319, 320, 323, 326, | |
277 | 329, 332, 335, 336, 339, 342, 343, 346, 350, 351, | |
278 | 354, 355, 358 | |
8e37b772 | 279 | }; |
280 | #endif | |
281 | ||
282 | ||
e55c0c6d | 283 | #if YYDEBUG != 0 || defined YYERROR_VERBOSE |
284 | ||
285 | /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ | |
286 | static const char *const yytname[] = | |
287 | { | |
288 | "$", "error", "$undefined.", "MT_BADTOK", "MT_END", "MT_STATE", | |
289 | "MT_GLOBAL", "MT_CONTEXT", "MT_ONEOF", "MT_DEFAULTS", "MT_DEFAULT", | |
290 | "MT_REFERENCE", "MT_PARAMETER", "MT_RESULT", "MT_CLAUSE", "MT_LITERAL", | |
291 | "MT_NULL", "MT_ANNOTATIONS", "MT_ARROW", "MT_MERGE", "MT_TRANSFERS", | |
292 | "MT_PRECONDITIONS", "MT_POSTCONDITIONS", "MT_LOSEREFERENCE", "MT_AS", | |
293 | "MT_ERROR", "MT_PLUS", "MT_STAR", "MT_BAR", "MT_LPAREN", "MT_RPAREN", | |
294 | "MT_LBRACKET", "MT_RBRACKET", "MT_LBRACE", "MT_RBRACE", "MT_COMMA", | |
295 | "MT_CHAR", "MT_INT", "MT_FLOAT", "MT_DOUBLE", "MT_VOID", "MT_ANYTYPE", | |
296 | "MT_INTEGRALTYPE", "MT_UNSIGNEDINTEGRALTYPE", "MT_SIGNEDINTEGRALTYPE", | |
297 | "MT_CONST", "MT_VOLATILE", "MT_STRINGLIT", "MT_IDENT", "file", | |
298 | "mtsDeclaration", "declarationNode", "declarationPieces", | |
299 | "declarationPiece", "contextDeclaration", "optContextSelection", | |
300 | "contextSelection", "optType", "typeExpression", "completeType", | |
301 | "completeTypeAux", "optCompleteType", "abstractDecl", "pointers", | |
302 | "innerMods", "innerModsList", "abstractDeclBase", "typeSpecifier", | |
303 | "typeName", "valuesDeclaration", "valuesList", "defaultNode", | |
304 | "defaultsDeclaration", "defaultDeclarationList", | |
305 | "annotationsDeclaration", "annotationsDeclarationList", | |
306 | "annotationDeclaration", "mergeDeclaration", "mergeClauses", | |
307 | "mergeClause", "mergeItem", "preconditionsDeclaration", | |
308 | "postconditionsDeclaration", "transfersDeclaration", | |
309 | "loseReferenceDeclaration", "lostClauses", "lostClause", | |
310 | "transferClauses", "transferClause", "transferAction", "errorAction", | |
311 | "valueChoice", NULL | |
8e37b772 | 312 | }; |
313 | #endif | |
314 | ||
e55c0c6d | 315 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
316 | static const short yyr1[] = | |
317 | { | |
318 | 0, 49, 49, 50, 50, 51, 52, 52, 53, 53, | |
319 | 53, 53, 53, 53, 53, 53, 53, 53, 54, 55, | |
320 | 55, 56, 56, 56, 56, 56, 56, 57, 57, 58, | |
321 | 58, 59, 59, 60, 61, 61, 62, 62, 62, 63, | |
322 | 63, 63, 63, 64, 64, 65, 65, 66, 66, 66, | |
323 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | |
324 | 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, | |
325 | 75, 76, 77, 78, 78, 79, 80, 80, 81, 82, | |
326 | 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, | |
327 | 90, 90, 91 | |
8e37b772 | 328 | }; |
329 | ||
e55c0c6d | 330 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
331 | static const short yyr2[] = | |
332 | { | |
333 | 0, 0, 1, 3, 4, 2, 0, 2, 1, 1, | |
334 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, | |
335 | 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, | |
336 | 2, 1, 3, 2, 0, 1, 1, 1, 2, 1, | |
337 | 2, 2, 3, 1, 1, 1, 2, 3, 2, 3, | |
338 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
339 | 1, 2, 1, 3, 2, 2, 3, 4, 2, 1, | |
340 | 2, 4, 2, 1, 2, 5, 1, 1, 2, 2, | |
341 | 2, 2, 1, 2, 3, 1, 2, 5, 1, 1, | |
342 | 1, 2, 1 | |
8e37b772 | 343 | }; |
344 | ||
e55c0c6d | 345 | /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE |
346 | doesn't specify something else to do. Zero means the default is an | |
347 | error. */ | |
348 | static const short yydefact[] = | |
349 | { | |
350 | 1, 0, 0, 2, 6, 0, 0, 0, 0, 0, | |
351 | 0, 0, 0, 0, 0, 0, 0, 5, 6, 8, | |
352 | 9, 11, 10, 12, 13, 15, 16, 14, 17, 3, | |
353 | 0, 27, 27, 27, 27, 27, 27, 18, 62, 61, | |
354 | 0, 65, 92, 64, 19, 68, 69, 77, 72, 73, | |
355 | 0, 76, 80, 85, 0, 78, 79, 81, 82, 0, | |
356 | 7, 4, 50, 51, 52, 53, 54, 55, 56, 57, | |
357 | 58, 60, 22, 28, 29, 31, 34, 59, 21, 23, | |
358 | 24, 25, 26, 0, 0, 0, 20, 70, 74, 0, | |
359 | 86, 0, 83, 0, 39, 0, 0, 0, 30, 36, | |
360 | 37, 35, 33, 63, 66, 0, 0, 0, 90, 84, | |
361 | 43, 44, 41, 45, 40, 32, 0, 48, 38, 0, | |
362 | 67, 71, 0, 0, 91, 42, 46, 47, 49, 75, | |
363 | 89, 88, 87, 0, 0, 0 | |
8e37b772 | 364 | }; |
365 | ||
e55c0c6d | 366 | static const short yydefgoto[] = |
367 | { | |
368 | 133, 3, 5, 17, 18, 19, 85, 40, 72, 73, | |
369 | 74, 75, 102, 98, 99, 113, 114, 100, 76, 77, | |
370 | 20, 39, 21, 22, 41, 23, 45, 46, 24, 48, | |
371 | 49, 50, 25, 26, 27, 28, 57, 58, 52, 53, | |
372 | 129, 130, 54 | |
8e37b772 | 373 | }; |
374 | ||
e55c0c6d | 375 | static const short yypact[] = |
376 | { | |
377 | 4, -37, 35,-32768, 36, 37, -37, 21, 2, 21, | |
378 | 17, 18, -19, 17, 17, 17, 17,-32768, 36,-32768, | |
379 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
380 | 63, -23, -23, -23, -23, -23, -23,-32768, 33,-32768, | |
381 | 51,-32768,-32768,-32768, 21,-32768, 18,-32768,-32768, -19, | |
382 | 44,-32768,-32768, 17, 47,-32768,-32768,-32768, 17, 54, | |
383 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
384 | -32768,-32768,-32768,-32768, -5,-32768, -23,-32768,-32768,-32768, | |
385 | -32768,-32768,-32768, 2, 17, 55,-32768,-32768,-32768, -19, | |
386 | -32768, 17,-32768, 50, -15, -23, 20, 45,-32768, 23, | |
387 | 49, 48,-32768,-32768, 21, 17, 60, 64, 38,-32768, | |
388 | -32768,-32768,-32768,-32768, -15,-32768, 53,-32768, 49, 52, | |
389 | -32768,-32768, -20, -20,-32768,-32768,-32768,-32768,-32768,-32768, | |
390 | -32768,-32768,-32768, 86, 87,-32768 | |
8e37b772 | 391 | }; |
392 | ||
e55c0c6d | 393 | static const short yypgoto[] = |
394 | { | |
395 | -32768,-32768, 82, 71,-32768,-32768,-32768, -6, 28, -4, | |
396 | 14,-32768,-32768, -3, -87, -22,-32768, -2,-32768,-32768, | |
397 | -32768, 11,-32768,-32768, -8,-32768, 56,-32768,-32768, 57, | |
398 | -32768, 9,-32768,-32768,-32768,-32768, 41,-32768, -11,-32768, | |
399 | -18, 7, -10 | |
8e37b772 | 400 | }; |
401 | ||
402 | ||
403 | #define YYLAST 113 | |
404 | ||
405 | ||
e55c0c6d | 406 | static const short yytable[] = |
407 | { | |
408 | 43, 37, 51, 55, 56, 108, 59, 112, 47, 1, | |
409 | 2, 4, 94, 62, 63, 64, 65, 66, 67, 68, | |
410 | 69, 70, 94, 95, 96, 71, 97, 125, 42, 42, | |
411 | 110, 111, 31, 32, 33, 34, 35, 36, 86, 51, | |
412 | 6, 29, 90, 7, 8, 9, 10, 94, 59, 96, | |
413 | 38, 97, 96, 11, 97, 12, 13, 14, 15, 16, | |
414 | 78, 79, 80, 81, 82, 42, 44, 61, 83, 84, | |
415 | 89, 91, 93, 105, 104, 108, 95, 117, 122, 51, | |
416 | 119, 107, 123, 127, 128, 124, 134, 135, 30, 60, | |
417 | 101, 115, 126, 116, 103, 121, 120, 118, 106, 92, | |
418 | 109, 0, 87, 0, 0, 132, 88, 0, 0, 0, | |
419 | 0, 0, 131, 131 | |
8e37b772 | 420 | }; |
421 | ||
e55c0c6d | 422 | static const short yycheck[] = |
423 | { | |
424 | 10, 7, 12, 14, 15, 25, 16, 94, 27, 5, | |
425 | 6, 48, 27, 36, 37, 38, 39, 40, 41, 42, | |
426 | 43, 44, 27, 28, 29, 48, 31, 114, 48, 48, | |
427 | 45, 46, 11, 12, 13, 14, 15, 16, 44, 49, | |
428 | 5, 4, 53, 7, 8, 9, 10, 27, 58, 29, | |
429 | 48, 31, 29, 17, 31, 19, 20, 21, 22, 23, | |
430 | 32, 33, 34, 35, 36, 48, 48, 4, 35, 18, | |
431 | 26, 24, 18, 18, 84, 25, 28, 32, 18, 89, | |
432 | 31, 91, 18, 30, 32, 47, 0, 0, 6, 18, | |
433 | 76, 95, 114, 96, 83, 105, 104, 99, 89, 58, | |
434 | 93, -1, 46, -1, -1, 123, 49, -1, -1, -1, | |
435 | -1, -1, 122, 123 | |
8e37b772 | 436 | }; |
437 | #define YYPURE 1 | |
438 | ||
439 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
3e3ec469 | 440 | |
8e37b772 | 441 | /* Skeleton output parser for bison, |
e55c0c6d | 442 | Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc. |
8e37b772 | 443 | |
444 | This program is free software; you can redistribute it and/or modify | |
445 | it under the terms of the GNU General Public License as published by | |
446 | the Free Software Foundation; either version 2, or (at your option) | |
447 | any later version. | |
448 | ||
449 | This program is distributed in the hope that it will be useful, | |
450 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
451 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
452 | GNU General Public License for more details. | |
453 | ||
454 | You should have received a copy of the GNU General Public License | |
455 | along with this program; if not, write to the Free Software | |
456 | Foundation, Inc., 59 Temple Place - Suite 330, | |
457 | Boston, MA 02111-1307, USA. */ | |
458 | ||
459 | /* As a special exception, when this file is copied by Bison into a | |
460 | Bison output file, you may use that output file without restriction. | |
461 | This special exception was added by the Free Software Foundation | |
462 | in version 1.24 of Bison. */ | |
463 | ||
e55c0c6d | 464 | /* This is the parser code that is written into each bison parser when |
465 | the %semantic_parser declaration is not specified in the grammar. | |
466 | It was written by Richard Stallman by simplifying the hairy parser | |
467 | used when %semantic_parser is specified. */ | |
8e37b772 | 468 | |
469 | #ifndef YYSTACK_USE_ALLOCA | |
e55c0c6d | 470 | # ifdef alloca |
471 | # define YYSTACK_USE_ALLOCA 1 | |
472 | # else /* alloca not defined */ | |
473 | # ifdef __GNUC__ | |
474 | # define YYSTACK_USE_ALLOCA 1 | |
475 | # define alloca __builtin_alloca | |
476 | # else /* not GNU C. */ | |
477 | # if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | |
478 | # define YYSTACK_USE_ALLOCA 1 | |
479 | # include <alloca.h> | |
480 | # else /* not sparc */ | |
481 | /* We think this test detects Watcom and Microsoft C. */ | |
482 | /* This used to test MSDOS, but that is a bad idea since that | |
483 | symbol is in the user namespace. */ | |
484 | # if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
485 | # if 0 | |
486 | /* No need for malloc.h, which pollutes the namespace; instead, | |
487 | just don't use alloca. */ | |
488 | # include <malloc.h> | |
489 | # endif | |
490 | # else /* not MSDOS, or __TURBOC__ */ | |
491 | # if defined(_AIX) | |
492 | /* I don't know what this was needed for, but it pollutes the | |
493 | namespace. So I turned it off. rms, 2 May 1997. */ | |
494 | /* #include <malloc.h> */ | |
8e37b772 | 495 | #pragma alloca |
e55c0c6d | 496 | # define YYSTACK_USE_ALLOCA 1 |
497 | # else /* not MSDOS, or __TURBOC__, or _AIX */ | |
498 | # if 0 | |
499 | /* haible@ilog.fr says this works for HPUX 9.05 and up, and on | |
500 | HPUX 10. Eventually we can turn this on. */ | |
501 | # ifdef __hpux | |
502 | # define YYSTACK_USE_ALLOCA 1 | |
503 | # define alloca __builtin_alloca | |
504 | # endif /* __hpux */ | |
505 | # endif | |
506 | # endif /* not _AIX */ | |
507 | # endif /* not MSDOS, or __TURBOC__ */ | |
508 | # endif /* not sparc */ | |
509 | # endif /* not GNU C */ | |
510 | # endif /* alloca not defined */ | |
8e37b772 | 511 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
512 | ||
e55c0c6d | 513 | #ifndef YYSTACK_USE_ALLOCA |
514 | # define YYSTACK_USE_ALLOCA 0 | |
8e37b772 | 515 | #endif |
516 | ||
e55c0c6d | 517 | #if YYSTACK_USE_ALLOCA |
518 | # define YYSTACK_ALLOC alloca | |
519 | #else | |
520 | # define YYSTACK_ALLOC malloc | |
521 | #endif | |
8e37b772 | 522 | |
523 | #define yyerrok (yyerrstatus = 0) | |
524 | #define yyclearin (yychar = YYEMPTY) | |
525 | #define YYEMPTY -2 | |
526 | #define YYEOF 0 | |
527 | #define YYACCEPT goto yyacceptlab | |
528 | #define YYABORT goto yyabortlab | |
529 | #define YYERROR goto yyerrlab1 | |
e55c0c6d | 530 | /* Like YYERROR except do call yyerror. This remains here temporarily |
531 | to ease the transition to the new meaning of YYERROR, for GCC. | |
8e37b772 | 532 | Once GCC version 2 has supplanted version 1, this can go. */ |
533 | #define YYFAIL goto yyerrlab | |
534 | #define YYRECOVERING() (!!yyerrstatus) | |
e55c0c6d | 535 | #define YYBACKUP(Token, Value) \ |
8e37b772 | 536 | do \ |
537 | if (yychar == YYEMPTY && yylen == 1) \ | |
e55c0c6d | 538 | { \ |
539 | yychar = (Token); \ | |
540 | yylval = (Value); \ | |
8e37b772 | 541 | yychar1 = YYTRANSLATE (yychar); \ |
542 | YYPOPSTACK; \ | |
543 | goto yybackup; \ | |
544 | } \ | |
545 | else \ | |
e55c0c6d | 546 | { \ |
547 | yyerror ("syntax error: cannot back up"); \ | |
548 | YYERROR; \ | |
549 | } \ | |
8e37b772 | 550 | while (0) |
551 | ||
552 | #define YYTERROR 1 | |
553 | #define YYERRCODE 256 | |
554 | ||
8e37b772 | 555 | |
e55c0c6d | 556 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
557 | are run). | |
8e37b772 | 558 | |
e55c0c6d | 559 | When YYLLOC_DEFAULT is run, CURRENT is set the location of the |
560 | first token. By default, to implement support for ranges, extend | |
561 | its range to the last symbol. */ | |
8e37b772 | 562 | |
e55c0c6d | 563 | #ifndef YYLLOC_DEFAULT |
564 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |
565 | Current.last_line = Rhs[N].last_line; \ | |
566 | Current.last_column = Rhs[N].last_column; | |
8e37b772 | 567 | #endif |
568 | ||
8e37b772 | 569 | |
e55c0c6d | 570 | /* YYLEX -- calling `yylex' with the right arguments. */ |
571 | ||
572 | #if YYPURE | |
573 | # if YYLSP_NEEDED | |
574 | # ifdef YYLEX_PARAM | |
575 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) | |
576 | # else | |
577 | # define YYLEX yylex (&yylval, &yylloc) | |
578 | # endif | |
579 | # else /* !YYLSP_NEEDED */ | |
580 | # ifdef YYLEX_PARAM | |
581 | # define YYLEX yylex (&yylval, YYLEX_PARAM) | |
582 | # else | |
583 | # define YYLEX yylex (&yylval) | |
584 | # endif | |
585 | # endif /* !YYLSP_NEEDED */ | |
586 | #else /* !YYPURE */ | |
587 | # define YYLEX yylex () | |
588 | #endif /* !YYPURE */ | |
589 | ||
590 | ||
591 | /* Enable debugging if requested. */ | |
592 | #if YYDEBUG | |
593 | # define YYDPRINTF(Args) \ | |
594 | do { \ | |
595 | if (yydebug) \ | |
596 | fprintf Args; \ | |
597 | } while (0) | |
598 | /* Nonzero means print parse trace. [The following comment makes no | |
599 | sense to me. Could someone clarify it? --akim] Since this is | |
600 | uninitialized, it does not stop multiple parsers from coexisting. | |
601 | */ | |
602 | int yydebug; | |
603 | #else /* !YYDEBUG */ | |
604 | # define YYDPRINTF(Args) | |
605 | #endif /* !YYDEBUG */ | |
606 | ||
607 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
8e37b772 | 608 | #ifndef YYINITDEPTH |
e55c0c6d | 609 | # define YYINITDEPTH 200 |
8e37b772 | 610 | #endif |
611 | ||
e55c0c6d | 612 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
613 | if the built-in stack extension method is used). */ | |
8e37b772 | 614 | #if YYMAXDEPTH == 0 |
e55c0c6d | 615 | # undef YYMAXDEPTH |
8e37b772 | 616 | #endif |
617 | ||
618 | #ifndef YYMAXDEPTH | |
e55c0c6d | 619 | # define YYMAXDEPTH 10000 |
8e37b772 | 620 | #endif |
621 | \f | |
622 | /* Define __yy_memcpy. Note that the size argument | |
623 | should be passed with type unsigned int, because that is what the non-GCC | |
624 | definitions require. With GCC, __builtin_memcpy takes an arg | |
625 | of type size_t, but it can handle unsigned int. */ | |
626 | ||
627 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
e55c0c6d | 628 | # define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count) |
8e37b772 | 629 | #else /* not GNU C or C++ */ |
8e37b772 | 630 | |
631 | /* This is the most reliable way to avoid incompatibilities | |
632 | in available built-in functions on various systems. */ | |
633 | static void | |
e55c0c6d | 634 | # ifndef __cplusplus |
8e37b772 | 635 | __yy_memcpy (to, from, count) |
636 | char *to; | |
e55c0c6d | 637 | const char *from; |
8e37b772 | 638 | unsigned int count; |
e55c0c6d | 639 | # else /* __cplusplus */ |
640 | __yy_memcpy (char *to, const char *from, unsigned int count) | |
641 | # endif | |
8e37b772 | 642 | { |
e55c0c6d | 643 | register const char *f = from; |
8e37b772 | 644 | register char *t = to; |
8e37b772 | 645 | register int i = count; |
646 | ||
647 | while (i-- > 0) | |
648 | *t++ = *f++; | |
649 | } | |
650 | ||
8e37b772 | 651 | #endif |
652 | \f | |
3e3ec469 | 653 | |
8e37b772 | 654 | |
655 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
656 | into yyparse. The argument should have type void *. | |
657 | It should actually point to an object. | |
658 | Grammar actions can access the variable by casting it | |
659 | to the proper pointer type. */ | |
660 | ||
661 | #ifdef YYPARSE_PARAM | |
e55c0c6d | 662 | # ifdef __cplusplus |
663 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
664 | # define YYPARSE_PARAM_DECL | |
665 | # else /* !__cplusplus */ | |
666 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
667 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
668 | # endif /* !__cplusplus */ | |
669 | #else /* !YYPARSE_PARAM */ | |
670 | # define YYPARSE_PARAM_ARG | |
671 | # define YYPARSE_PARAM_DECL | |
672 | #endif /* !YYPARSE_PARAM */ | |
8e37b772 | 673 | |
674 | /* Prevent warning if -Wstrict-prototypes. */ | |
675 | #ifdef __GNUC__ | |
e55c0c6d | 676 | # ifdef YYPARSE_PARAM |
8e37b772 | 677 | int yyparse (void *); |
e55c0c6d | 678 | # else |
8e37b772 | 679 | int yyparse (void); |
e55c0c6d | 680 | # endif |
8e37b772 | 681 | #endif |
e55c0c6d | 682 | |
683 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser, | |
684 | variables are global, or local to YYPARSE. */ | |
685 | ||
686 | #define _YY_DECL_VARIABLES \ | |
687 | /* The lookahead symbol. */ \ | |
688 | int yychar; \ | |
689 | \ | |
690 | /* The semantic value of the lookahead symbol. */ \ | |
691 | YYSTYPE yylval; \ | |
692 | \ | |
693 | /* Number of parse errors so far. */ \ | |
694 | int yynerrs; | |
695 | ||
696 | #if YYLSP_NEEDED | |
697 | # define YY_DECL_VARIABLES \ | |
698 | _YY_DECL_VARIABLES \ | |
699 | \ | |
700 | /* Location data for the lookahead symbol. */ \ | |
701 | YYLTYPE yylloc; | |
702 | #else | |
703 | # define YY_DECL_VARIABLES \ | |
704 | _YY_DECL_VARIABLES | |
8e37b772 | 705 | #endif |
706 | ||
e55c0c6d | 707 | |
708 | /* If nonreentrant, generate the variables here. */ | |
709 | ||
710 | #if !YYPURE | |
711 | YY_DECL_VARIABLES | |
712 | #endif /* !YYPURE */ | |
713 | ||
8e37b772 | 714 | int |
e55c0c6d | 715 | yyparse (YYPARSE_PARAM_ARG) |
8e37b772 | 716 | YYPARSE_PARAM_DECL |
717 | { | |
e55c0c6d | 718 | /* If reentrant, generate the variables here. */ |
719 | #if YYPURE | |
720 | YY_DECL_VARIABLES | |
721 | #endif /* !YYPURE */ | |
722 | ||
8e37b772 | 723 | register int yystate; |
724 | register int yyn; | |
e55c0c6d | 725 | /* Number of tokens to shift before error messages enabled. */ |
726 | int yyerrstatus; | |
727 | /* Lookahead token as an internal (translated) token number. */ | |
728 | int yychar1 = 0; | |
729 | ||
730 | /* Three stacks and their tools: | |
731 | `yyss': related to states, | |
732 | `yysv': related to semantic values, | |
733 | `yyls': related to locations. | |
734 | ||
735 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
736 | to reallocate them elsewhere. */ | |
737 | ||
738 | /* The state stack. */ | |
739 | short yyssa[YYINITDEPTH]; | |
740 | short *yyss = yyssa; | |
8e37b772 | 741 | register short *yyssp; |
8e37b772 | 742 | |
e55c0c6d | 743 | /* The semantic value stack. */ |
744 | YYSTYPE yyvsa[YYINITDEPTH]; | |
745 | YYSTYPE *yyvs = yyvsa; | |
746 | register YYSTYPE *yyvsp; | |
8e37b772 | 747 | |
e55c0c6d | 748 | #if YYLSP_NEEDED |
749 | /* The location stack. */ | |
750 | YYLTYPE yylsa[YYINITDEPTH]; | |
8e37b772 | 751 | YYLTYPE *yyls = yylsa; |
752 | YYLTYPE *yylsp; | |
e55c0c6d | 753 | #endif |
8e37b772 | 754 | |
e55c0c6d | 755 | #if YYLSP_NEEDED |
756 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
8e37b772 | 757 | #else |
e55c0c6d | 758 | # define YYPOPSTACK (yyvsp--, yyssp--) |
8e37b772 | 759 | #endif |
760 | ||
761 | int yystacksize = YYINITDEPTH; | |
762 | int yyfree_stacks = 0; | |
763 | ||
8e37b772 | 764 | |
e55c0c6d | 765 | /* The variables used to return semantic value and location from the |
766 | action routines. */ | |
767 | YYSTYPE yyval; | |
768 | # if YYLSP_NEEDED | |
769 | YYLTYPE yyloc; | |
770 | # endif | |
8e37b772 | 771 | |
e55c0c6d | 772 | /* When reducing, the number of symbols on the RHS of the reduced |
773 | rule. */ | |
8e37b772 | 774 | int yylen; |
775 | ||
e55c0c6d | 776 | YYDPRINTF ((stderr, "Starting parse\n")); |
8e37b772 | 777 | |
778 | yystate = 0; | |
779 | yyerrstatus = 0; | |
780 | yynerrs = 0; | |
781 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
782 | ||
783 | /* Initialize stack pointers. | |
784 | Waste one element of value and location stack | |
785 | so that they stay on the same level as the state stack. | |
786 | The wasted elements are never initialized. */ | |
787 | ||
e55c0c6d | 788 | yyssp = yyss; |
8e37b772 | 789 | yyvsp = yyvs; |
e55c0c6d | 790 | #if YYLSP_NEEDED |
8e37b772 | 791 | yylsp = yyls; |
792 | #endif | |
e55c0c6d | 793 | goto yysetstate; |
8e37b772 | 794 | |
e55c0c6d | 795 | /*------------------------------------------------------------. |
796 | | yynewstate -- Push a new state, which is found in yystate. | | |
797 | `------------------------------------------------------------*/ | |
798 | yynewstate: | |
799 | /* In all cases, when you get here, the value and location stacks | |
800 | have just been pushed. so pushing a state here evens the stacks. | |
801 | */ | |
802 | yyssp++; | |
8e37b772 | 803 | |
e55c0c6d | 804 | yysetstate: |
805 | *yyssp = yystate; | |
8e37b772 | 806 | |
807 | if (yyssp >= yyss + yystacksize - 1) | |
808 | { | |
e55c0c6d | 809 | /* Give user a chance to reallocate the stack. Use copies of |
810 | these so that the &'s don't force the real ones into memory. | |
811 | */ | |
8e37b772 | 812 | YYSTYPE *yyvs1 = yyvs; |
813 | short *yyss1 = yyss; | |
e55c0c6d | 814 | #if YYLSP_NEEDED |
8e37b772 | 815 | YYLTYPE *yyls1 = yyls; |
816 | #endif | |
817 | ||
818 | /* Get the current used size of the three stacks, in elements. */ | |
819 | int size = yyssp - yyss + 1; | |
820 | ||
821 | #ifdef yyoverflow | |
e55c0c6d | 822 | /* Each stack pointer address is followed by the size of the |
823 | data in use in that stack, in bytes. */ | |
824 | # if YYLSP_NEEDED | |
8e37b772 | 825 | /* This used to be a conditional around just the two extra args, |
826 | but that might be undefined if yyoverflow is a macro. */ | |
e55c0c6d | 827 | yyoverflow ("parser stack overflow", |
828 | &yyss1, size * sizeof (*yyssp), | |
829 | &yyvs1, size * sizeof (*yyvsp), | |
830 | &yyls1, size * sizeof (*yylsp), | |
831 | &yystacksize); | |
832 | # else | |
833 | yyoverflow ("parser stack overflow", | |
834 | &yyss1, size * sizeof (*yyssp), | |
835 | &yyvs1, size * sizeof (*yyvsp), | |
836 | &yystacksize); | |
837 | # endif | |
8e37b772 | 838 | |
839 | yyss = yyss1; yyvs = yyvs1; | |
e55c0c6d | 840 | # if YYLSP_NEEDED |
8e37b772 | 841 | yyls = yyls1; |
e55c0c6d | 842 | # endif |
8e37b772 | 843 | #else /* no yyoverflow */ |
844 | /* Extend the stack our own way. */ | |
845 | if (yystacksize >= YYMAXDEPTH) | |
846 | { | |
e55c0c6d | 847 | yyerror ("parser stack overflow"); |
8e37b772 | 848 | if (yyfree_stacks) |
849 | { | |
850 | free (yyss); | |
851 | free (yyvs); | |
e55c0c6d | 852 | # if YYLSP_NEEDED |
8e37b772 | 853 | free (yyls); |
e55c0c6d | 854 | # endif |
8e37b772 | 855 | } |
856 | return 2; | |
857 | } | |
858 | yystacksize *= 2; | |
859 | if (yystacksize > YYMAXDEPTH) | |
860 | yystacksize = YYMAXDEPTH; | |
e55c0c6d | 861 | # if !YYSTACK_USE_ALLOCA |
8e37b772 | 862 | yyfree_stacks = 1; |
e55c0c6d | 863 | # endif |
8e37b772 | 864 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
865 | __yy_memcpy ((char *)yyss, (char *)yyss1, | |
866 | size * (unsigned int) sizeof (*yyssp)); | |
867 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); | |
868 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, | |
869 | size * (unsigned int) sizeof (*yyvsp)); | |
e55c0c6d | 870 | # if YYLSP_NEEDED |
8e37b772 | 871 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
872 | __yy_memcpy ((char *)yyls, (char *)yyls1, | |
873 | size * (unsigned int) sizeof (*yylsp)); | |
e55c0c6d | 874 | # endif |
8e37b772 | 875 | #endif /* no yyoverflow */ |
876 | ||
877 | yyssp = yyss + size - 1; | |
878 | yyvsp = yyvs + size - 1; | |
e55c0c6d | 879 | #if YYLSP_NEEDED |
8e37b772 | 880 | yylsp = yyls + size - 1; |
881 | #endif | |
882 | ||
e55c0c6d | 883 | YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize)); |
8e37b772 | 884 | |
885 | if (yyssp >= yyss + yystacksize - 1) | |
886 | YYABORT; | |
887 | } | |
888 | ||
e55c0c6d | 889 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
8e37b772 | 890 | |
891 | goto yybackup; | |
e55c0c6d | 892 | |
893 | ||
894 | /*-----------. | |
895 | | yybackup. | | |
896 | `-----------*/ | |
897 | yybackup: | |
8e37b772 | 898 | |
899 | /* Do appropriate processing given the current state. */ | |
900 | /* Read a lookahead token if we need one and don't already have one. */ | |
901 | /* yyresume: */ | |
902 | ||
903 | /* First try to decide what to do without reference to lookahead token. */ | |
904 | ||
905 | yyn = yypact[yystate]; | |
906 | if (yyn == YYFLAG) | |
907 | goto yydefault; | |
908 | ||
909 | /* Not known => get a lookahead token if don't already have one. */ | |
910 | ||
911 | /* yychar is either YYEMPTY or YYEOF | |
912 | or a valid token in external form. */ | |
913 | ||
914 | if (yychar == YYEMPTY) | |
915 | { | |
e55c0c6d | 916 | YYDPRINTF ((stderr, "Reading a token: ")); |
8e37b772 | 917 | yychar = YYLEX; |
918 | } | |
919 | ||
920 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
921 | ||
922 | if (yychar <= 0) /* This means end of input. */ | |
923 | { | |
924 | yychar1 = 0; | |
925 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
926 | ||
e55c0c6d | 927 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
8e37b772 | 928 | } |
929 | else | |
930 | { | |
e55c0c6d | 931 | yychar1 = YYTRANSLATE (yychar); |
8e37b772 | 932 | |
e55c0c6d | 933 | #if YYDEBUG |
934 | /* We have to keep this `#if YYDEBUG', since we use variables | |
935 | which are defined only if `YYDEBUG' is set. */ | |
8e37b772 | 936 | if (yydebug) |
937 | { | |
938 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
e55c0c6d | 939 | /* Give the individual parser a way to print the precise |
940 | meaning of a token, for further debugging info. */ | |
941 | # ifdef YYPRINT | |
8e37b772 | 942 | YYPRINT (stderr, yychar, yylval); |
e55c0c6d | 943 | # endif |
8e37b772 | 944 | fprintf (stderr, ")\n"); |
945 | } | |
946 | #endif | |
947 | } | |
948 | ||
949 | yyn += yychar1; | |
950 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
951 | goto yydefault; | |
952 | ||
953 | yyn = yytable[yyn]; | |
954 | ||
955 | /* yyn is what to do for this token type in this state. | |
956 | Negative => reduce, -yyn is rule number. | |
957 | Positive => shift, yyn is new state. | |
958 | New state is final state => don't bother to shift, | |
959 | just return success. | |
960 | 0, or most negative number => error. */ | |
961 | ||
962 | if (yyn < 0) | |
963 | { | |
964 | if (yyn == YYFLAG) | |
965 | goto yyerrlab; | |
966 | yyn = -yyn; | |
967 | goto yyreduce; | |
968 | } | |
969 | else if (yyn == 0) | |
970 | goto yyerrlab; | |
971 | ||
972 | if (yyn == YYFINAL) | |
973 | YYACCEPT; | |
974 | ||
975 | /* Shift the lookahead token. */ | |
e55c0c6d | 976 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); |
8e37b772 | 977 | |
978 | /* Discard the token being shifted unless it is eof. */ | |
979 | if (yychar != YYEOF) | |
980 | yychar = YYEMPTY; | |
981 | ||
982 | *++yyvsp = yylval; | |
e55c0c6d | 983 | #if YYLSP_NEEDED |
8e37b772 | 984 | *++yylsp = yylloc; |
985 | #endif | |
986 | ||
e55c0c6d | 987 | /* Count tokens shifted since error; after three, turn off error |
988 | status. */ | |
989 | if (yyerrstatus) | |
990 | yyerrstatus--; | |
8e37b772 | 991 | |
992 | yystate = yyn; | |
993 | goto yynewstate; | |
994 | ||
8e37b772 | 995 | |
e55c0c6d | 996 | /*-----------------------------------------------------------. |
997 | | yydefault -- do the default action for the current state. | | |
998 | `-----------------------------------------------------------*/ | |
999 | yydefault: | |
8e37b772 | 1000 | yyn = yydefact[yystate]; |
1001 | if (yyn == 0) | |
1002 | goto yyerrlab; | |
e55c0c6d | 1003 | goto yyreduce; |
8e37b772 | 1004 | |
e55c0c6d | 1005 | |
1006 | /*-----------------------------. | |
1007 | | yyreduce -- Do a reduction. | | |
1008 | `-----------------------------*/ | |
8e37b772 | 1009 | yyreduce: |
e55c0c6d | 1010 | /* yyn is the number of a rule to reduce with. */ |
8e37b772 | 1011 | yylen = yyr2[yyn]; |
8e37b772 | 1012 | |
e55c0c6d | 1013 | /* If YYLEN is nonzero, implement the default value of the action: |
1014 | `$$ = $1'. | |
1015 | ||
1016 | Otherwise, the following line sets YYVAL to the semantic value of | |
1017 | the lookahead token. This behavior is undocumented and Bison | |
1018 | users should not rely upon it. Assigning to YYVAL | |
1019 | unconditionally makes the parser a bit smaller, and it avoids a | |
1020 | GCC warning that YYVAL may be used uninitialized. */ | |
1021 | yyval = yyvsp[1-yylen]; | |
1022 | ||
1023 | #if YYLSP_NEEDED | |
1024 | /* Similarly for the default location. Let the user run additional | |
1025 | commands if for instance locations are ranges. */ | |
1026 | yyloc = yylsp[1-yylen]; | |
1027 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | |
1028 | #endif | |
1029 | ||
1030 | #if YYDEBUG | |
1031 | /* We have to keep this `#if YYDEBUG', since we use variables which | |
1032 | are defined only if `YYDEBUG' is set. */ | |
8e37b772 | 1033 | if (yydebug) |
1034 | { | |
1035 | int i; | |
1036 | ||
1037 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
1038 | yyn, yyrline[yyn]); | |
1039 | ||
1040 | /* Print the symbols being reduced, and their result. */ | |
1041 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
1042 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
1043 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
1044 | } | |
1045 | #endif | |
1046 | ||
8e37b772 | 1047 | switch (yyn) { |
1048 | ||
1049 | case 1: | |
8e37b772 | 1050 | {; |
1051 | break;} | |
1052 | case 2: | |
8e37b772 | 1053 | {; |
1054 | break;} | |
1055 | case 3: | |
8e37b772 | 1056 | { mtreader_processDeclaration (yyvsp[-1].mtdecl); ; |
1057 | break;} | |
1058 | case 4: | |
8e37b772 | 1059 | { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ; |
1060 | break;} | |
1061 | case 5: | |
8e37b772 | 1062 | { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ; |
1063 | break;} | |
1064 | case 6: | |
8e37b772 | 1065 | { yyval.mtpieces = mtDeclarationPieces_create (); ; |
1066 | break;} | |
1067 | case 7: | |
8e37b772 | 1068 | { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ; |
1069 | break;} | |
1070 | case 8: | |
8e37b772 | 1071 | { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ; |
1072 | break;} | |
1073 | case 9: | |
8e37b772 | 1074 | { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ; |
1075 | break;} | |
1076 | case 10: | |
8e37b772 | 1077 | { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ; |
1078 | break;} | |
1079 | case 11: | |
8e37b772 | 1080 | { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ; |
1081 | break;} | |
1082 | case 12: | |
8e37b772 | 1083 | { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ; |
1084 | break;} | |
1085 | case 13: | |
8e37b772 | 1086 | { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ; |
1087 | break;} | |
1088 | case 14: | |
8e37b772 | 1089 | { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ; |
1090 | break;} | |
1091 | case 15: | |
8e37b772 | 1092 | { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ; |
1093 | break;} | |
1094 | case 16: | |
8e37b772 | 1095 | { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ; |
1096 | break;} | |
1097 | case 17: | |
8e37b772 | 1098 | { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ; |
1099 | break;} | |
1100 | case 18: | |
8e37b772 | 1101 | { yyval.mtcontext = yyvsp[0].mtcontext; ; |
1102 | break;} | |
1103 | case 19: | |
8e37b772 | 1104 | { yyval.mtcontext = mtContextNode_createAny (); ; |
1105 | break;} | |
1106 | case 21: | |
8e37b772 | 1107 | { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ; |
1108 | break;} | |
1109 | case 22: | |
8e37b772 | 1110 | { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ; |
1111 | break;} | |
1112 | case 23: | |
8e37b772 | 1113 | { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ; |
1114 | break;} | |
1115 | case 24: | |
8e37b772 | 1116 | { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ; |
1117 | break;} | |
1118 | case 25: | |
8e37b772 | 1119 | { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ; |
1120 | break;} | |
1121 | case 26: | |
8e37b772 | 1122 | { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ; |
1123 | break;} | |
1124 | case 27: | |
8e37b772 | 1125 | { yyval.ctyp = ctype_unknown; ; |
1126 | break;} | |
1127 | case 28: | |
8e37b772 | 1128 | { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ; |
1129 | break;} | |
1130 | case 30: | |
8e37b772 | 1131 | { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ; |
1132 | break;} | |
1133 | case 31: | |
8e37b772 | 1134 | { yyval.qtyp = yyvsp[0].qtyp; ; |
1135 | break;} | |
1136 | case 32: | |
8e37b772 | 1137 | { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ; |
1138 | break;} | |
1139 | case 33: | |
8e37b772 | 1140 | { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ; |
1141 | break;} | |
1142 | case 34: | |
8e37b772 | 1143 | { yyval.qtyp = qtype_unknown (); ; |
1144 | break;} | |
1145 | case 35: | |
8e37b772 | 1146 | { yyval.qtyp = yyvsp[0].qtyp; ; |
1147 | break;} | |
1148 | case 36: | |
8e37b772 | 1149 | { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ; |
1150 | break;} | |
1151 | case 38: | |
8e37b772 | 1152 | { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ; |
1153 | break;} | |
1154 | case 39: | |
8e37b772 | 1155 | { yyval.count = 1; ; |
1156 | break;} | |
1157 | case 40: | |
8e37b772 | 1158 | { yyval.count = 1; ; |
1159 | break;} | |
1160 | case 41: | |
8e37b772 | 1161 | { yyval.count = 1 + yyvsp[0].count; ; |
1162 | break;} | |
1163 | case 42: | |
8e37b772 | 1164 | { yyval.count = 1 + yyvsp[0].count; ; |
1165 | break;} | |
1166 | case 43: | |
8e37b772 | 1167 | { /* ignored for now */; ; |
1168 | break;} | |
1169 | case 44: | |
8e37b772 | 1170 | { ; ; |
1171 | break;} | |
1172 | case 45: | |
8e37b772 | 1173 | { ; ; |
1174 | break;} | |
1175 | case 46: | |
8e37b772 | 1176 | { ; ; |
1177 | break;} | |
1178 | case 47: | |
8e37b772 | 1179 | { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ; |
1180 | break;} | |
1181 | case 48: | |
8e37b772 | 1182 | { yyval.ctyp = ctype_makeArray (ctype_unknown); ; |
1183 | break;} | |
1184 | case 49: | |
8e37b772 | 1185 | { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ; |
1186 | break;} | |
1187 | case 50: | |
8e37b772 | 1188 | { yyval.ctyp = ctype_char; ; |
1189 | break;} | |
1190 | case 51: | |
8e37b772 | 1191 | { yyval.ctyp = ctype_int; ; |
1192 | break;} | |
1193 | case 52: | |
8e37b772 | 1194 | { yyval.ctyp = ctype_float; ; |
1195 | break;} | |
1196 | case 53: | |
8e37b772 | 1197 | { yyval.ctyp = ctype_double; ; |
1198 | break;} | |
1199 | case 54: | |
8e37b772 | 1200 | { yyval.ctyp = ctype_void; ; |
1201 | break;} | |
1202 | case 55: | |
8e37b772 | 1203 | { yyval.ctyp = ctype_unknown; ; |
1204 | break;} | |
1205 | case 56: | |
8e37b772 | 1206 | { yyval.ctyp = ctype_anyintegral; ; |
1207 | break;} | |
1208 | case 57: | |
8e37b772 | 1209 | { yyval.ctyp = ctype_unsignedintegral; ; |
1210 | break;} | |
1211 | case 58: | |
8e37b772 | 1212 | { yyval.ctyp = ctype_signedintegral; ; |
1213 | break;} | |
1214 | case 60: | |
8e37b772 | 1215 | { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ; |
1216 | break;} | |
1217 | case 61: | |
8e37b772 | 1218 | { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ; |
1219 | break;} | |
1220 | case 62: | |
8e37b772 | 1221 | { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ; |
1222 | break;} | |
1223 | case 63: | |
8e37b772 | 1224 | { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ; |
1225 | break;} | |
1226 | case 64: | |
8e37b772 | 1227 | { yyval.tok = yyvsp[0].tok; ; |
1228 | break;} | |
1229 | case 65: | |
8e37b772 | 1230 | { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ; |
1231 | break;} | |
1232 | case 66: | |
8e37b772 | 1233 | { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ; |
1234 | break;} | |
1235 | case 67: | |
8e37b772 | 1236 | { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ; |
1237 | break;} | |
1238 | case 68: | |
8e37b772 | 1239 | { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ; |
1240 | break;} | |
1241 | case 69: | |
8e37b772 | 1242 | { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ; |
1243 | break;} | |
1244 | case 70: | |
8e37b772 | 1245 | { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ; |
1246 | break;} | |
1247 | case 71: | |
8e37b772 | 1248 | { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ; |
1249 | break;} | |
1250 | case 72: | |
8e37b772 | 1251 | { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ; |
1252 | break;} | |
1253 | case 73: | |
8e37b772 | 1254 | { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ; |
1255 | break;} | |
1256 | case 74: | |
8e37b772 | 1257 | { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ; |
1258 | break;} | |
1259 | case 75: | |
8e37b772 | 1260 | { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ; |
1261 | break;} | |
1262 | case 76: | |
8e37b772 | 1263 | { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ; |
1264 | break;} | |
1265 | case 77: | |
8e37b772 | 1266 | { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ; |
1267 | break;} | |
1268 | case 78: | |
8e37b772 | 1269 | { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; |
1270 | break;} | |
1271 | case 79: | |
8e37b772 | 1272 | { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; |
1273 | break;} | |
1274 | case 80: | |
8e37b772 | 1275 | { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; |
1276 | break;} | |
1277 | case 81: | |
8e37b772 | 1278 | { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ; |
1279 | break;} | |
1280 | case 82: | |
8e37b772 | 1281 | { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ; |
1282 | break;} | |
1283 | case 83: | |
8e37b772 | 1284 | { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ; |
1285 | break;} | |
1286 | case 84: | |
8e37b772 | 1287 | { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ; |
1288 | break;} | |
1289 | case 85: | |
8e37b772 | 1290 | { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ; |
1291 | break;} | |
1292 | case 86: | |
8e37b772 | 1293 | { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ; |
1294 | break;} | |
1295 | case 87: | |
8e37b772 | 1296 | { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ; |
1297 | break;} | |
1298 | case 88: | |
8e37b772 | 1299 | { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ; |
1300 | break;} | |
1301 | case 89: | |
8e37b772 | 1302 | { yyval.mttransferaction = yyvsp[0].mttransferaction; ; |
1303 | break;} | |
1304 | case 90: | |
8e37b772 | 1305 | { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ; |
1306 | break;} | |
1307 | case 91: | |
8e37b772 | 1308 | { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ; |
1309 | break;} | |
1310 | } | |
e55c0c6d | 1311 | |
3e3ec469 | 1312 | |
8e37b772 | 1313 | \f |
1314 | yyvsp -= yylen; | |
1315 | yyssp -= yylen; | |
e55c0c6d | 1316 | #if YYLSP_NEEDED |
8e37b772 | 1317 | yylsp -= yylen; |
1318 | #endif | |
1319 | ||
e55c0c6d | 1320 | #if YYDEBUG |
8e37b772 | 1321 | if (yydebug) |
1322 | { | |
1323 | short *ssp1 = yyss - 1; | |
1324 | fprintf (stderr, "state stack now"); | |
1325 | while (ssp1 != yyssp) | |
1326 | fprintf (stderr, " %d", *++ssp1); | |
1327 | fprintf (stderr, "\n"); | |
1328 | } | |
1329 | #endif | |
1330 | ||
1331 | *++yyvsp = yyval; | |
e55c0c6d | 1332 | #if YYLSP_NEEDED |
1333 | *++yylsp = yyloc; | |
8e37b772 | 1334 | #endif |
1335 | ||
e55c0c6d | 1336 | /* Now `shift' the result of the reduction. Determine what state |
1337 | that goes to, based on the state we popped back to and the rule | |
1338 | number reduced by. */ | |
8e37b772 | 1339 | |
1340 | yyn = yyr1[yyn]; | |
1341 | ||
1342 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
1343 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
1344 | yystate = yytable[yystate]; | |
1345 | else | |
1346 | yystate = yydefgoto[yyn - YYNTBASE]; | |
1347 | ||
1348 | goto yynewstate; | |
1349 | ||
8e37b772 | 1350 | |
e55c0c6d | 1351 | /*------------------------------------. |
1352 | | yyerrlab -- here on detecting error | | |
1353 | `------------------------------------*/ | |
1354 | yyerrlab: | |
1355 | /* If not already recovering from an error, report this error. */ | |
1356 | if (!yyerrstatus) | |
8e37b772 | 1357 | { |
1358 | ++yynerrs; | |
1359 | ||
1360 | #ifdef YYERROR_VERBOSE | |
1361 | yyn = yypact[yystate]; | |
1362 | ||
1363 | if (yyn > YYFLAG && yyn < YYLAST) | |
1364 | { | |
1365 | int size = 0; | |
1366 | char *msg; | |
1367 | int x, count; | |
1368 | ||
1369 | count = 0; | |
1370 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
1371 | for (x = (yyn < 0 ? -yyn : 0); | |
e55c0c6d | 1372 | x < (int) (sizeof (yytname) / sizeof (char *)); x++) |
8e37b772 | 1373 | if (yycheck[x + yyn] == x) |
e55c0c6d | 1374 | size += strlen (yytname[x]) + 15, count++; |
1375 | size += strlen ("parse error, unexpected `") + 1; | |
1376 | size += strlen (yytname[YYTRANSLATE (yychar)]); | |
1377 | msg = (char *) malloc (size); | |
8e37b772 | 1378 | if (msg != 0) |
1379 | { | |
e55c0c6d | 1380 | strcpy (msg, "parse error, unexpected `"); |
1381 | strcat (msg, yytname[YYTRANSLATE (yychar)]); | |
1382 | strcat (msg, "'"); | |
8e37b772 | 1383 | |
1384 | if (count < 5) | |
1385 | { | |
1386 | count = 0; | |
1387 | for (x = (yyn < 0 ? -yyn : 0); | |
e55c0c6d | 1388 | x < (int) (sizeof (yytname) / sizeof (char *)); x++) |
8e37b772 | 1389 | if (yycheck[x + yyn] == x) |
1390 | { | |
e55c0c6d | 1391 | strcat (msg, count == 0 ? ", expecting `" : " or `"); |
1392 | strcat (msg, yytname[x]); | |
1393 | strcat (msg, "'"); | |
8e37b772 | 1394 | count++; |
1395 | } | |
1396 | } | |
e55c0c6d | 1397 | yyerror (msg); |
1398 | free (msg); | |
8e37b772 | 1399 | } |
1400 | else | |
1401 | yyerror ("parse error; also virtual memory exceeded"); | |
1402 | } | |
1403 | else | |
1404 | #endif /* YYERROR_VERBOSE */ | |
e55c0c6d | 1405 | yyerror ("parse error"); |
8e37b772 | 1406 | } |
8e37b772 | 1407 | goto yyerrlab1; |
8e37b772 | 1408 | |
e55c0c6d | 1409 | |
1410 | /*--------------------------------------------------. | |
1411 | | yyerrlab1 -- error raised explicitly by an action | | |
1412 | `--------------------------------------------------*/ | |
1413 | yyerrlab1: | |
8e37b772 | 1414 | if (yyerrstatus == 3) |
1415 | { | |
e55c0c6d | 1416 | /* If just tried and failed to reuse lookahead token after an |
1417 | error, discard it. */ | |
8e37b772 | 1418 | |
1419 | /* return failure if at end of input */ | |
1420 | if (yychar == YYEOF) | |
1421 | YYABORT; | |
e55c0c6d | 1422 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
1423 | yychar, yytname[yychar1])); | |
8e37b772 | 1424 | yychar = YYEMPTY; |
1425 | } | |
1426 | ||
e55c0c6d | 1427 | /* Else will try to reuse lookahead token after shifting the error |
1428 | token. */ | |
8e37b772 | 1429 | |
1430 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
1431 | ||
1432 | goto yyerrhandle; | |
1433 | ||
8e37b772 | 1434 | |
e55c0c6d | 1435 | /*-------------------------------------------------------------------. |
1436 | | yyerrdefault -- current state does not do anything special for the | | |
1437 | | error token. | | |
1438 | `-------------------------------------------------------------------*/ | |
1439 | yyerrdefault: | |
8e37b772 | 1440 | #if 0 |
1441 | /* This is wrong; only states that explicitly want error tokens | |
1442 | should shift them. */ | |
e55c0c6d | 1443 | |
1444 | /* If its default is to accept any token, ok. Otherwise pop it. */ | |
1445 | yyn = yydefact[yystate]; | |
1446 | if (yyn) | |
1447 | goto yydefault; | |
8e37b772 | 1448 | #endif |
1449 | ||
8e37b772 | 1450 | |
e55c0c6d | 1451 | /*---------------------------------------------------------------. |
1452 | | yyerrpop -- pop the current state because it cannot handle the | | |
1453 | | error token | | |
1454 | `---------------------------------------------------------------*/ | |
1455 | yyerrpop: | |
1456 | if (yyssp == yyss) | |
1457 | YYABORT; | |
8e37b772 | 1458 | yyvsp--; |
1459 | yystate = *--yyssp; | |
e55c0c6d | 1460 | #if YYLSP_NEEDED |
8e37b772 | 1461 | yylsp--; |
1462 | #endif | |
1463 | ||
e55c0c6d | 1464 | #if YYDEBUG |
8e37b772 | 1465 | if (yydebug) |
1466 | { | |
1467 | short *ssp1 = yyss - 1; | |
1468 | fprintf (stderr, "Error: state stack now"); | |
1469 | while (ssp1 != yyssp) | |
1470 | fprintf (stderr, " %d", *++ssp1); | |
1471 | fprintf (stderr, "\n"); | |
1472 | } | |
1473 | #endif | |
1474 | ||
e55c0c6d | 1475 | /*--------------. |
1476 | | yyerrhandle. | | |
1477 | `--------------*/ | |
8e37b772 | 1478 | yyerrhandle: |
8e37b772 | 1479 | yyn = yypact[yystate]; |
1480 | if (yyn == YYFLAG) | |
1481 | goto yyerrdefault; | |
1482 | ||
1483 | yyn += YYTERROR; | |
1484 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
1485 | goto yyerrdefault; | |
1486 | ||
1487 | yyn = yytable[yyn]; | |
1488 | if (yyn < 0) | |
1489 | { | |
1490 | if (yyn == YYFLAG) | |
1491 | goto yyerrpop; | |
1492 | yyn = -yyn; | |
1493 | goto yyreduce; | |
1494 | } | |
1495 | else if (yyn == 0) | |
1496 | goto yyerrpop; | |
1497 | ||
1498 | if (yyn == YYFINAL) | |
1499 | YYACCEPT; | |
1500 | ||
e55c0c6d | 1501 | YYDPRINTF ((stderr, "Shifting error token, ")); |
8e37b772 | 1502 | |
1503 | *++yyvsp = yylval; | |
e55c0c6d | 1504 | #if YYLSP_NEEDED |
8e37b772 | 1505 | *++yylsp = yylloc; |
1506 | #endif | |
1507 | ||
1508 | yystate = yyn; | |
1509 | goto yynewstate; | |
1510 | ||
e55c0c6d | 1511 | |
1512 | /*-------------------------------------. | |
1513 | | yyacceptlab -- YYACCEPT comes here. | | |
1514 | `-------------------------------------*/ | |
1515 | yyacceptlab: | |
8e37b772 | 1516 | if (yyfree_stacks) |
1517 | { | |
1518 | free (yyss); | |
1519 | free (yyvs); | |
e55c0c6d | 1520 | #if YYLSP_NEEDED |
8e37b772 | 1521 | free (yyls); |
1522 | #endif | |
1523 | } | |
1524 | return 0; | |
1525 | ||
e55c0c6d | 1526 | |
1527 | /*-----------------------------------. | |
1528 | | yyabortlab -- YYABORT comes here. | | |
1529 | `-----------------------------------*/ | |
1530 | yyabortlab: | |
8e37b772 | 1531 | if (yyfree_stacks) |
1532 | { | |
1533 | free (yyss); | |
1534 | free (yyvs); | |
e55c0c6d | 1535 | #if YYLSP_NEEDED |
8e37b772 | 1536 | free (yyls); |
1537 | #endif | |
1538 | } | |
1539 | return 1; | |
1540 | } | |
8e37b772 | 1541 | |
1542 | ||
1543 | # include "bison.reset" | |
1544 | ||
1545 | extern char *yytext; | |
1546 | ||
1547 | static void mterror (char *s) | |
1548 | { | |
1549 | ||
1550 | if (s != NULL) | |
1551 | { | |
1552 | llparseerror | |
1553 | (message ("Parse error in meta-state file: %s", cstring_fromChars (s))); | |
1554 | } | |
1555 | else | |
1556 | { | |
1557 | llparseerror | |
1558 | (message ("Parse error in meta-state file")); | |
1559 | } | |
1560 | ||
1561 | } | |
1562 | ||
1563 | static void yyprint (FILE *file, int type, YYSTYPE value) | |
1564 | { | |
1565 | cstring tname = mttok_unparse (value.tok); | |
1566 | fprintf (file, " (%s)", cstring_toCharsSafe (tname)); | |
1567 | cstring_free (tname); | |
1568 | } | |
1569 | ||
1570 | ||
1571 | ||
1572 | ||
1573 | /* | |
1574 | ** Resets all flags in bison.head | |
1575 | */ | |
1576 | ||
1577 | ||
1578 | /*@=allmacros@*/ | |
1579 | /*@=boolint@*/ | |
1580 | /*@=charint@*/ | |
1581 | /*@=macroparams@*/ | |
1582 | /*@=macroundef@*/ | |
1583 | /*@=unreachable@*/ | |
1584 | /*@=macrospec@*/ | |
1585 | /*@=varuse@*/ | |
1586 | /*@=ignorequals@*/ | |
1587 | /*@=macrostmt@*/ | |
1588 | /*@=noeffect@*/ | |
1589 | /*@=shadow@*/ | |
1590 | /*@=exitarg@*/ | |
1591 | /*@=macroredef@*/ | |
1592 | /*@=uniondef@*/ | |
1593 | /*@=compdef@*/ | |
1594 | /*@=matchfields@*/ | |
1595 | /*@=exportlocal@*/ | |
1596 | /*@=evalorderuncon@*/ | |
1597 | /*@=exportheader@*/ | |
1598 | /*@=typeuse@*/ | |
1599 | /*@=redecl@*/ | |
1600 | /*@=redef@*/ | |
1601 | /*@=noparams@*/ | |
1602 | /*@=ansireserved@*/ | |
1603 | /*@=fielduse@*/ | |
1604 | /*@=ifblock@*/ | |
1605 | /*@=elseifcomplete@*/ | |
1606 | /*@=whileblock@*/ | |
1607 | /*@=forblock@*/ | |
1608 | /*@=branchstate@*/ | |
1609 | /*@=readonlytrans@*/ | |
1610 | /*@=namechecks@*/ | |
1611 | /*@=usedef@*/ | |
1612 | /*@=systemunrecog@*/ | |
1613 | /*@=dependenttrans@*/ | |
1614 | /*@=unqualifiedtrans@*/ | |
1615 | /*@=declundef@*/ | |
bbed3d50 | 1616 | |
1617 | ||
1618 | /*drl added 11/27/2001*/ | |
bb7c2085 | 1619 | /*@=bounds@*/ |