2 ** Inserted at beginning of c files generated by bison
3 ** REMEMBER: Change bison.reset too.
42 /*@-unqualifiedtrans@*/
46 /* < end of bison.head > */
49 /* A Bison parser, made from mtgrammar.y
50 by GNU Bison version 1.28 */
52 #define YYBISON 1 /* Identify Bison output. */
54 #define yyparse mtparse
56 #define yyerror mterror
59 #define yydebug mtdebug
60 #define yynerrs mtnerrs
65 #define MT_CONTEXT 261
67 #define MT_DEFAULTS 263
68 #define MT_DEFAULT 264
69 #define MT_REFERENCE 265
70 #define MT_PARAMETER 266
73 #define MT_ANNOTATIONS 269
76 #define MT_TRANSFERS 272
77 #define MT_PRECONDITIONS 273
78 #define MT_POSTCONDITIONS 274
79 #define MT_LOSEREFERENCE 275
87 #define MT_LBRACKET 283
88 #define MT_RBRACKET 284
97 #define MT_ANYTYPE 293
98 #define MT_INTEGRALTYPE 294
99 #define MT_UNSIGNEDINTEGRALTYPE 295
100 #define MT_SIGNEDINTEGRALTYPE 296
102 #define MT_VOLATILE 298
103 #define MT_STRINGLIT 299
106 #line 25 "mtgrammar.y"
109 # include "bison.reset"
110 # include "lclintMacros.nf"
111 # include "llbasic.h"
112 # include "mtincludes.h"
114 static /*@exits@*/ void mterror (char *);
116 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
117 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
120 # define YYPRINT(file, type, value) yyprint (file, type, value)
124 # include "bison.head"
127 #line 48 "mtgrammar.y"
130 mtDeclarationNode mtdecl;
131 mtDeclarationPiece mtpiece;
132 mtDeclarationPieces mtpieces;
133 mtContextNode mtcontext;
134 mtValuesNode mtvalues;
135 mtDefaultsNode mtdefaults;
136 mtDefaultsDeclList mtdeflist;
137 mtAnnotationsNode mtannotations;
138 mtAnnotationList mtannotlist;
139 mtAnnotationDecl mtannotdecl;
141 mtMergeItem mtmergeitem;
142 mtMergeClauseList mtmergeclauselist;
143 mtMergeClause mtmergeclause;
144 mtTransferClauseList mttransferclauselist;
145 mtTransferClause mttransferclause;
146 mtTransferAction mttransferaction;
147 mtLoseReferenceList mtlosereferencelist;
148 mtLoseReference mtlosereference;
150 /*@only@*/ cstringList cstringlist;
152 /*@only@*/ qtype qtyp;
170 #define YYFLAG -32768
173 #define YYTRANSLATE(x) ((unsigned)(x) <= 300 ? yytranslate[x] : 90)
175 static const char yytranslate[] = { 0,
176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 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, 1, 3, 4, 5, 6,
202 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
203 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
204 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
205 37, 38, 39, 40, 41, 42, 43, 44, 45, 46
209 static const short yyprhs[] = { 0,
210 0, 1, 3, 7, 12, 15, 16, 19, 21, 23,
211 25, 27, 29, 31, 33, 35, 37, 39, 42, 43,
212 45, 48, 51, 54, 57, 58, 60, 62, 65, 67,
213 71, 74, 75, 77, 79, 81, 84, 86, 89, 92,
214 96, 98, 100, 102, 105, 109, 112, 116, 118, 120,
215 122, 124, 126, 128, 130, 132, 134, 136, 138, 141,
216 143, 147, 150, 153, 157, 162, 165, 167, 170, 175,
217 178, 180, 183, 189, 191, 193, 196, 199, 202, 205,
218 207, 210, 214, 216, 219, 225, 227, 229, 231, 234
221 static const short yyrhs[] = { -1,
222 48, 0, 5, 49, 4, 0, 6, 5, 49, 4,
223 0, 46, 50, 0, 0, 51, 50, 0, 52, 0,
224 67, 0, 70, 0, 69, 0, 72, 0, 75, 0,
225 81, 0, 79, 0, 80, 0, 82, 0, 7, 54,
226 0, 0, 54, 0, 12, 55, 0, 11, 55, 0,
227 13, 55, 0, 14, 55, 0, 0, 56, 0, 57,
228 0, 57, 60, 0, 58, 0, 57, 26, 56, 0,
229 65, 59, 0, 0, 57, 0, 61, 0, 64, 0,
230 61, 64, 0, 25, 0, 25, 63, 0, 25, 61,
231 0, 25, 63, 61, 0, 43, 0, 44, 0, 62,
232 0, 63, 62, 0, 27, 60, 28, 0, 29, 30,
233 0, 64, 29, 30, 0, 34, 0, 35, 0, 36,
234 0, 37, 0, 38, 0, 39, 0, 40, 0, 41,
235 0, 42, 0, 66, 0, 46, 0, 8, 68, 0,
236 46, 0, 46, 33, 68, 0, 10, 89, 0, 9,
237 71, 0, 54, 16, 89, 0, 54, 16, 89, 71,
238 0, 15, 73, 0, 74, 0, 74, 73, 0, 46,
239 53, 16, 89, 0, 17, 76, 0, 77, 0, 77,
240 76, 0, 78, 24, 78, 16, 87, 0, 89, 0,
241 25, 0, 19, 85, 0, 20, 85, 0, 18, 85,
242 0, 21, 83, 0, 84, 0, 84, 83, 0, 89,
243 16, 88, 0, 86, 0, 86, 85, 0, 89, 22,
244 89, 16, 87, 0, 89, 0, 88, 0, 23, 0,
251 static const short yyrline[] = { 0,
252 144, 145, 148, 150, 154, 158, 159, 163, 164, 165,
253 166, 167, 168, 169, 170, 171, 172, 175, 179, 180,
254 183, 184, 185, 186, 193, 194, 197, 198, 201, 202,
255 206, 209, 210, 214, 215, 216, 219, 220, 221, 222,
256 225, 226, 229, 230, 233, 234, 235, 242, 243, 244,
257 245, 246, 247, 248, 249, 250, 251, 257, 260, 263,
258 264, 268, 271, 274, 276, 280, 283, 284, 288, 292,
259 295, 296, 299, 303, 304, 307, 310, 313, 316, 319,
260 320, 323, 326, 327, 330, 334, 335, 338, 339, 342
265 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
267 static const char * const yytname[] = { "$","error","$undefined.","MT_BADTOK",
268 "MT_END","MT_STATE","MT_GLOBAL","MT_CONTEXT","MT_ONEOF","MT_DEFAULTS","MT_DEFAULT",
269 "MT_REFERENCE","MT_PARAMETER","MT_RESULT","MT_CLAUSE","MT_ANNOTATIONS","MT_ARROW",
270 "MT_MERGE","MT_TRANSFERS","MT_PRECONDITIONS","MT_POSTCONDITIONS","MT_LOSEREFERENCE",
271 "MT_AS","MT_ERROR","MT_PLUS","MT_STAR","MT_BAR","MT_LPAREN","MT_RPAREN","MT_LBRACKET",
272 "MT_RBRACKET","MT_LBRACE","MT_RBRACE","MT_COMMA","MT_CHAR","MT_INT","MT_FLOAT",
273 "MT_DOUBLE","MT_VOID","MT_ANYTYPE","MT_INTEGRALTYPE","MT_UNSIGNEDINTEGRALTYPE",
274 "MT_SIGNEDINTEGRALTYPE","MT_CONST","MT_VOLATILE","MT_STRINGLIT","MT_IDENT","file",
275 "mtsDeclaration","declarationNode","declarationPieces","declarationPiece","contextDeclaration",
276 "optContextSelection","contextSelection","optType","typeExpression","completeType",
277 "completeTypeAux","optCompleteType","abstractDecl","pointers","innerMods","innerModsList",
278 "abstractDeclBase","typeSpecifier","typeName","valuesDeclaration","valuesList",
279 "defaultNode","defaultsDeclaration","defaultDeclarationList","annotationsDeclaration",
280 "annotationsDeclarationList","annotationDeclaration","mergeDeclaration","mergeClauses",
281 "mergeClause","mergeItem","preconditionsDeclaration","postconditionsDeclaration",
282 "transfersDeclaration","loseReferenceDeclaration","lostClauses","lostClause",
283 "transferClauses","transferClause","transferAction","errorAction","valueChoice", NULL
287 static const short yyr1[] = { 0,
288 47, 47, 48, 48, 49, 50, 50, 51, 51, 51,
289 51, 51, 51, 51, 51, 51, 51, 52, 53, 53,
290 54, 54, 54, 54, 55, 55, 56, 56, 57, 57,
291 58, 59, 59, 60, 60, 60, 61, 61, 61, 61,
292 62, 62, 63, 63, 64, 64, 64, 65, 65, 65,
293 65, 65, 65, 65, 65, 65, 65, 66, 67, 68,
294 68, 69, 70, 71, 71, 72, 73, 73, 74, 75,
295 76, 76, 77, 78, 78, 79, 80, 81, 82, 83,
296 83, 84, 85, 85, 86, 87, 87, 88, 88, 89
299 static const short yyr2[] = { 0,
300 0, 1, 3, 4, 2, 0, 2, 1, 1, 1,
301 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
302 2, 2, 2, 2, 0, 1, 1, 2, 1, 3,
303 2, 0, 1, 1, 1, 2, 1, 2, 2, 3,
304 1, 1, 1, 2, 3, 2, 3, 1, 1, 1,
305 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
306 3, 2, 2, 3, 4, 2, 1, 2, 4, 2,
307 1, 2, 5, 1, 1, 2, 2, 2, 2, 1,
308 2, 3, 1, 2, 5, 1, 1, 1, 2, 1
311 static const short yydefact[] = { 1,
312 0, 0, 2, 6, 0, 0, 0, 0, 0, 0,
313 0, 0, 0, 0, 0, 0, 5, 6, 8, 9,
314 11, 10, 12, 13, 15, 16, 14, 17, 3, 0,
315 25, 25, 25, 25, 18, 60, 59, 0, 63, 90,
316 62, 19, 66, 67, 75, 70, 71, 0, 74, 78,
317 83, 0, 76, 77, 79, 80, 0, 7, 4, 48,
318 49, 50, 51, 52, 53, 54, 55, 56, 58, 22,
319 26, 27, 29, 32, 57, 21, 23, 24, 0, 0,
320 0, 20, 68, 72, 0, 84, 0, 81, 0, 37,
321 0, 0, 0, 28, 34, 35, 33, 31, 61, 64,
322 0, 0, 0, 88, 82, 41, 42, 39, 43, 38,
323 30, 0, 46, 36, 0, 65, 69, 0, 0, 89,
324 40, 44, 45, 47, 73, 87, 86, 85, 0, 0,
328 static const short yydefgoto[] = { 129,
329 3, 5, 17, 18, 19, 81, 38, 70, 71, 72,
330 73, 98, 94, 95, 109, 110, 96, 74, 75, 20,
331 37, 21, 22, 39, 23, 43, 44, 24, 46, 47,
332 48, 25, 26, 27, 28, 55, 56, 50, 51, 125,
336 static const short yypact[] = { 33,
337 2, 45,-32768, 34, 53, 2, 21, 13, 21, 15,
338 16, -17, 15, 15, 15, 15,-32768, 34,-32768,-32768,
339 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 59,
340 -21, -21, -21, -21,-32768, 32,-32768, 48,-32768,-32768,
341 -32768, 21,-32768, 16,-32768,-32768, -17, 42,-32768,-32768,
342 15, 46,-32768,-32768,-32768, 15, 51,-32768,-32768,-32768,
343 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
344 -32768, -3,-32768, -21,-32768,-32768,-32768,-32768, 13, 15,
345 55,-32768,-32768,-32768, -17,-32768, 15,-32768, 49, -13,
346 -21, 31, 39,-32768, 18, 44, 50,-32768,-32768, 21,
347 15, 58, 62, 35,-32768,-32768,-32768,-32768,-32768, -13,
348 -32768, 54,-32768, 44, 56,-32768,-32768, -18, -18,-32768,
349 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 79, 81,
353 static const short yypgoto[] = {-32768,
354 -32768, 77, 66,-32768,-32768,-32768, -6, -23, -4, 11,
355 -32768,-32768, -2, -83, -22,-32768, -1,-32768,-32768,-32768,
356 10,-32768,-32768, -8,-32768, 52,-32768,-32768, 57,-32768,
357 8,-32768,-32768,-32768,-32768, 41,-32768, -11,-32768, -24,
365 static const short yytable[] = { 41,
366 35, 49, 53, 54, 104, 57, 108, 45, 76, 77,
367 78, 90, 60, 61, 62, 63, 64, 65, 66, 67,
368 68, 90, 91, 92, 69, 93, 121, 40, 40, 106,
369 107, 31, 32, 33, 34, 82, 49, 1, 2, 86,
370 7, 8, 9, 10, 92, 57, 93, 4, 11, 6,
371 12, 13, 14, 15, 16, 90, 29, 92, 36, 93,
372 40, 42, 59, 80, 79, 85, 89, 87, 113, 100,
373 101, 104, 115, 118, 49, 91, 103, 119, 130, 120,
374 131, 123, 30, 58, 97, 124, 111, 122, 99, 112,
375 117, 116, 102, 114, 128, 83, 88, 105, 0, 0,
376 0, 0, 0, 84, 0, 0, 0, 127, 127
379 static const short yycheck[] = { 10,
380 7, 12, 14, 15, 23, 16, 90, 25, 32, 33,
381 34, 25, 34, 35, 36, 37, 38, 39, 40, 41,
382 42, 25, 26, 27, 46, 29, 110, 46, 46, 43,
383 44, 11, 12, 13, 14, 42, 47, 5, 6, 51,
384 7, 8, 9, 10, 27, 56, 29, 46, 15, 5,
385 17, 18, 19, 20, 21, 25, 4, 27, 46, 29,
386 46, 46, 4, 16, 33, 24, 16, 22, 30, 80,
387 16, 23, 29, 16, 85, 26, 87, 16, 0, 45,
388 0, 28, 6, 18, 74, 30, 91, 110, 79, 92,
389 101, 100, 85, 95, 119, 44, 56, 89, -1, -1,
390 -1, -1, -1, 47, -1, -1, -1, 118, 119
394 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
395 #line 3 "/usr/lib/bison.simple"
396 /* This file comes from bison-1.28. */
398 /* Skeleton output parser for bison,
399 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
401 This program is free software; you can redistribute it and/or modify
402 it under the terms of the GNU General Public License as published by
403 the Free Software Foundation; either version 2, or (at your option)
406 This program is distributed in the hope that it will be useful,
407 but WITHOUT ANY WARRANTY; without even the implied warranty of
408 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
409 GNU General Public License for more details.
411 You should have received a copy of the GNU General Public License
412 along with this program; if not, write to the Free Software
413 Foundation, Inc., 59 Temple Place - Suite 330,
414 Boston, MA 02111-1307, USA. */
416 /* As a special exception, when this file is copied by Bison into a
417 Bison output file, you may use that output file without restriction.
418 This special exception was added by the Free Software Foundation
419 in version 1.24 of Bison. */
421 /* This is the parser code that is written into each bison parser
422 when the %semantic_parser declaration is not specified in the grammar.
423 It was written by Richard Stallman by simplifying the hairy parser
424 used when %semantic_parser is specified. */
426 #ifndef YYSTACK_USE_ALLOCA
428 #define YYSTACK_USE_ALLOCA
429 #else /* alloca not defined */
431 #define YYSTACK_USE_ALLOCA
432 #define alloca __builtin_alloca
433 #else /* not GNU C. */
434 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
435 #define YYSTACK_USE_ALLOCA
437 #else /* not sparc */
438 /* We think this test detects Watcom and Microsoft C. */
439 /* This used to test MSDOS, but that is a bad idea
440 since that symbol is in the user namespace. */
441 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
442 #if 0 /* No need for malloc.h, which pollutes the namespace;
443 instead, just don't use alloca. */
446 #else /* not MSDOS, or __TURBOC__ */
448 /* I don't know what this was needed for, but it pollutes the namespace.
449 So I turned it off. rms, 2 May 1997. */
450 /* #include <malloc.h> */
452 #define YYSTACK_USE_ALLOCA
453 #else /* not MSDOS, or __TURBOC__, or _AIX */
455 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
456 and on HPUX 10. Eventually we can turn this on. */
457 #define YYSTACK_USE_ALLOCA
458 #define alloca __builtin_alloca
461 #endif /* not _AIX */
462 #endif /* not MSDOS, or __TURBOC__ */
463 #endif /* not sparc */
464 #endif /* not GNU C */
465 #endif /* alloca not defined */
466 #endif /* YYSTACK_USE_ALLOCA not defined */
468 #ifdef YYSTACK_USE_ALLOCA
469 #define YYSTACK_ALLOC alloca
471 #define YYSTACK_ALLOC malloc
474 /* Note: there must be only one dollar sign in this file.
475 It is replaced by the list of actions, each action
476 as one case of the switch. */
478 #define yyerrok (yyerrstatus = 0)
479 #define yyclearin (yychar = YYEMPTY)
482 #define YYACCEPT goto yyacceptlab
483 #define YYABORT goto yyabortlab
484 #define YYERROR goto yyerrlab1
485 /* Like YYERROR except do call yyerror.
486 This remains here temporarily to ease the
487 transition to the new meaning of YYERROR, for GCC.
488 Once GCC version 2 has supplanted version 1, this can go. */
489 #define YYFAIL goto yyerrlab
490 #define YYRECOVERING() (!!yyerrstatus)
491 #define YYBACKUP(token, value) \
493 if (yychar == YYEMPTY && yylen == 1) \
494 { yychar = (token), yylval = (value); \
495 yychar1 = YYTRANSLATE (yychar); \
500 { yyerror ("syntax error: cannot back up"); YYERROR; } \
504 #define YYERRCODE 256
507 #define YYLEX yylex()
513 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
515 #define YYLEX yylex(&yylval, &yylloc)
517 #else /* not YYLSP_NEEDED */
519 #define YYLEX yylex(&yylval, YYLEX_PARAM)
521 #define YYLEX yylex(&yylval)
523 #endif /* not YYLSP_NEEDED */
526 /* If nonreentrant, generate the variables here */
530 int yychar; /* the lookahead symbol */
531 YYSTYPE yylval; /* the semantic value of the */
532 /* lookahead symbol */
535 YYLTYPE yylloc; /* location data for the lookahead */
539 int yynerrs; /* number of parse errors so far */
540 #endif /* not YYPURE */
543 int yydebug; /* nonzero means print parse trace */
544 /* Since this is uninitialized, it does not stop multiple parsers
548 /* YYINITDEPTH indicates the initial size of the parser's stacks */
551 #define YYINITDEPTH 200
554 /* YYMAXDEPTH is the maximum size the stacks can grow to
555 (effective only if the built-in stack extension method is used). */
562 #define YYMAXDEPTH 10000
565 /* Define __yy_memcpy. Note that the size argument
566 should be passed with type unsigned int, because that is what the non-GCC
567 definitions require. With GCC, __builtin_memcpy takes an arg
568 of type size_t, but it can handle unsigned int. */
570 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
571 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
572 #else /* not GNU C or C++ */
575 /* This is the most reliable way to avoid incompatibilities
576 in available built-in functions on various systems. */
578 __yy_memcpy (to, from, count)
583 register char *f = from;
584 register char *t = to;
585 register int i = count;
591 #else /* __cplusplus */
593 /* This is the most reliable way to avoid incompatibilities
594 in available built-in functions on various systems. */
596 __yy_memcpy (char *to, char *from, unsigned int count)
598 register char *t = to;
599 register char *f = from;
600 register int i = count;
609 #line 217 "/usr/lib/bison.simple"
611 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
612 into yyparse. The argument should have type void *.
613 It should actually point to an object.
614 Grammar actions can access the variable by casting it
615 to the proper pointer type. */
619 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
620 #define YYPARSE_PARAM_DECL
621 #else /* not __cplusplus */
622 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
623 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
624 #endif /* not __cplusplus */
625 #else /* not YYPARSE_PARAM */
626 #define YYPARSE_PARAM_ARG
627 #define YYPARSE_PARAM_DECL
628 #endif /* not YYPARSE_PARAM */
630 /* Prevent warning if -Wstrict-prototypes. */
633 int yyparse (void *);
640 yyparse(YYPARSE_PARAM_ARG)
643 register int yystate;
645 register short *yyssp;
646 register YYSTYPE *yyvsp;
647 int yyerrstatus; /* number of tokens to shift before error messages enabled */
648 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
650 short yyssa[YYINITDEPTH]; /* the state stack */
651 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
653 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
654 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
657 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
658 YYLTYPE *yyls = yylsa;
661 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
663 #define YYPOPSTACK (yyvsp--, yyssp--)
666 int yystacksize = YYINITDEPTH;
667 int yyfree_stacks = 0;
678 YYSTYPE yyval; /* the variable used to return */
679 /* semantic values from the action */
686 fprintf(stderr, "Starting parse\n");
692 yychar = YYEMPTY; /* Cause a token to be read. */
694 /* Initialize stack pointers.
695 Waste one element of value and location stack
696 so that they stay on the same level as the state stack.
697 The wasted elements are never initialized. */
705 /* Push a new state, which is found in yystate . */
706 /* In all cases, when you get here, the value and location stacks
707 have just been pushed. so pushing a state here evens the stacks. */
712 if (yyssp >= yyss + yystacksize - 1)
714 /* Give user a chance to reallocate the stack */
715 /* Use copies of these so that the &'s don't force the real ones into memory. */
716 YYSTYPE *yyvs1 = yyvs;
719 YYLTYPE *yyls1 = yyls;
722 /* Get the current used size of the three stacks, in elements. */
723 int size = yyssp - yyss + 1;
726 /* Each stack pointer address is followed by the size of
727 the data in use in that stack, in bytes. */
729 /* This used to be a conditional around just the two extra args,
730 but that might be undefined if yyoverflow is a macro. */
731 yyoverflow("parser stack overflow",
732 &yyss1, size * sizeof (*yyssp),
733 &yyvs1, size * sizeof (*yyvsp),
734 &yyls1, size * sizeof (*yylsp),
737 yyoverflow("parser stack overflow",
738 &yyss1, size * sizeof (*yyssp),
739 &yyvs1, size * sizeof (*yyvsp),
743 yyss = yyss1; yyvs = yyvs1;
747 #else /* no yyoverflow */
748 /* Extend the stack our own way. */
749 if (yystacksize >= YYMAXDEPTH)
751 yyerror("parser stack overflow");
763 if (yystacksize > YYMAXDEPTH)
764 yystacksize = YYMAXDEPTH;
765 #ifndef YYSTACK_USE_ALLOCA
768 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
769 __yy_memcpy ((char *)yyss, (char *)yyss1,
770 size * (unsigned int) sizeof (*yyssp));
771 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
772 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
773 size * (unsigned int) sizeof (*yyvsp));
775 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
776 __yy_memcpy ((char *)yyls, (char *)yyls1,
777 size * (unsigned int) sizeof (*yylsp));
779 #endif /* no yyoverflow */
781 yyssp = yyss + size - 1;
782 yyvsp = yyvs + size - 1;
784 yylsp = yyls + size - 1;
789 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
792 if (yyssp >= yyss + yystacksize - 1)
798 fprintf(stderr, "Entering state %d\n", yystate);
804 /* Do appropriate processing given the current state. */
805 /* Read a lookahead token if we need one and don't already have one. */
808 /* First try to decide what to do without reference to lookahead token. */
810 yyn = yypact[yystate];
814 /* Not known => get a lookahead token if don't already have one. */
816 /* yychar is either YYEMPTY or YYEOF
817 or a valid token in external form. */
819 if (yychar == YYEMPTY)
823 fprintf(stderr, "Reading a token: ");
828 /* Convert token to internal form (in yychar1) for indexing tables with */
830 if (yychar <= 0) /* This means end of input. */
833 yychar = YYEOF; /* Don't call YYLEX any more */
837 fprintf(stderr, "Now at end of input.\n");
842 yychar1 = YYTRANSLATE(yychar);
847 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
848 /* Give the individual parser a way to print the precise meaning
849 of a token, for further debugging info. */
851 YYPRINT (stderr, yychar, yylval);
853 fprintf (stderr, ")\n");
859 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
864 /* yyn is what to do for this token type in this state.
865 Negative => reduce, -yyn is rule number.
866 Positive => shift, yyn is new state.
867 New state is final state => don't bother to shift,
869 0, or most negative number => error. */
884 /* Shift the lookahead token. */
888 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
891 /* Discard the token being shifted unless it is eof. */
900 /* count tokens shifted since error; after three, turn off error status. */
901 if (yyerrstatus) yyerrstatus--;
906 /* Do the default action for the current state. */
909 yyn = yydefact[yystate];
913 /* Do a reduction. yyn is the number of a rule to reduce with. */
917 yyval = yyvsp[1-yylen]; /* implement default value of the action */
924 fprintf (stderr, "Reducing via rule %d (line %d), ",
927 /* Print the symbols being reduced, and their result. */
928 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
929 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
930 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
938 #line 144 "mtgrammar.y"
942 #line 145 "mtgrammar.y"
946 #line 149 "mtgrammar.y"
947 { mtreader_processDeclaration (yyvsp[-1].mtdecl); ;
950 #line 151 "mtgrammar.y"
951 { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ;
954 #line 155 "mtgrammar.y"
955 { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ;
958 #line 158 "mtgrammar.y"
959 { yyval.mtpieces = mtDeclarationPieces_create (); ;
962 #line 160 "mtgrammar.y"
963 { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ;
966 #line 163 "mtgrammar.y"
967 { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ;
970 #line 164 "mtgrammar.y"
971 { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ;
974 #line 165 "mtgrammar.y"
975 { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ;
978 #line 166 "mtgrammar.y"
979 { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ;
982 #line 167 "mtgrammar.y"
983 { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ;
986 #line 168 "mtgrammar.y"
987 { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ;
990 #line 169 "mtgrammar.y"
991 { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ;
994 #line 170 "mtgrammar.y"
995 { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ;
998 #line 171 "mtgrammar.y"
999 { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ;
1002 #line 172 "mtgrammar.y"
1003 { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ;
1006 #line 175 "mtgrammar.y"
1007 { yyval.mtcontext = yyvsp[0].mtcontext; ;
1010 #line 179 "mtgrammar.y"
1011 { yyval.mtcontext = mtContextNode_createAny (); ;
1014 #line 183 "mtgrammar.y"
1015 { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ;
1018 #line 184 "mtgrammar.y"
1019 { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ;
1022 #line 185 "mtgrammar.y"
1023 { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ;
1026 #line 186 "mtgrammar.y"
1027 { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ;
1030 #line 193 "mtgrammar.y"
1031 { yyval.ctyp = ctype_unknown; ;
1034 #line 194 "mtgrammar.y"
1035 { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ;
1038 #line 198 "mtgrammar.y"
1039 { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ;
1042 #line 201 "mtgrammar.y"
1043 { yyval.qtyp = yyvsp[0].qtyp; ;
1046 #line 203 "mtgrammar.y"
1047 { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ;
1050 #line 206 "mtgrammar.y"
1051 { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ;
1054 #line 209 "mtgrammar.y"
1055 { yyval.qtyp = qtype_unknown (); ;
1058 #line 210 "mtgrammar.y"
1059 { yyval.qtyp = yyvsp[0].qtyp; ;
1062 #line 214 "mtgrammar.y"
1063 { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ;
1066 #line 216 "mtgrammar.y"
1067 { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ;
1070 #line 219 "mtgrammar.y"
1071 { yyval.count = 1; ;
1074 #line 220 "mtgrammar.y"
1075 { yyval.count = 1; ;
1078 #line 221 "mtgrammar.y"
1079 { yyval.count = 1 + yyvsp[0].count; ;
1082 #line 222 "mtgrammar.y"
1083 { yyval.count = 1 + yyvsp[0].count; ;
1086 #line 225 "mtgrammar.y"
1087 { /* ignored for now */; ;
1090 #line 226 "mtgrammar.y"
1094 #line 229 "mtgrammar.y"
1098 #line 230 "mtgrammar.y"
1102 #line 233 "mtgrammar.y"
1103 { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ;
1106 #line 234 "mtgrammar.y"
1107 { yyval.ctyp = ctype_makeArray (ctype_unknown); ;
1110 #line 235 "mtgrammar.y"
1111 { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
1114 #line 242 "mtgrammar.y"
1115 { yyval.ctyp = ctype_char; ;
1118 #line 243 "mtgrammar.y"
1119 { yyval.ctyp = ctype_int; ;
1122 #line 244 "mtgrammar.y"
1123 { yyval.ctyp = ctype_float; ;
1126 #line 245 "mtgrammar.y"
1127 { yyval.ctyp = ctype_double; ;
1130 #line 246 "mtgrammar.y"
1131 { yyval.ctyp = ctype_void; ;
1134 #line 247 "mtgrammar.y"
1135 { yyval.ctyp = ctype_unknown; ;
1138 #line 248 "mtgrammar.y"
1139 { yyval.ctyp = ctype_anyintegral; ;
1142 #line 249 "mtgrammar.y"
1143 { yyval.ctyp = ctype_unsignedintegral; ;
1146 #line 250 "mtgrammar.y"
1147 { yyval.ctyp = ctype_signedintegral; ;
1150 #line 257 "mtgrammar.y"
1151 { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ;
1154 #line 260 "mtgrammar.y"
1155 { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ;
1158 #line 263 "mtgrammar.y"
1159 { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ;
1162 #line 265 "mtgrammar.y"
1163 { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ;
1166 #line 268 "mtgrammar.y"
1167 { yyval.tok = yyvsp[0].tok; ;
1170 #line 271 "mtgrammar.y"
1171 { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ;
1174 #line 275 "mtgrammar.y"
1175 { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ;
1178 #line 277 "mtgrammar.y"
1179 { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ;
1182 #line 280 "mtgrammar.y"
1183 { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ;
1186 #line 283 "mtgrammar.y"
1187 { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ;
1190 #line 285 "mtgrammar.y"
1191 { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ;
1194 #line 289 "mtgrammar.y"
1195 { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ;
1198 #line 292 "mtgrammar.y"
1199 { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ;
1202 #line 295 "mtgrammar.y"
1203 { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ;
1206 #line 296 "mtgrammar.y"
1207 { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ;
1210 #line 300 "mtgrammar.y"
1211 { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ;
1214 #line 303 "mtgrammar.y"
1215 { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ;
1218 #line 304 "mtgrammar.y"
1219 { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ;
1222 #line 307 "mtgrammar.y"
1223 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1226 #line 310 "mtgrammar.y"
1227 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1230 #line 313 "mtgrammar.y"
1231 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1234 #line 316 "mtgrammar.y"
1235 { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ;
1238 #line 319 "mtgrammar.y"
1239 { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ;
1242 #line 320 "mtgrammar.y"
1243 { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ;
1246 #line 323 "mtgrammar.y"
1247 { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1250 #line 326 "mtgrammar.y"
1251 { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ;
1254 #line 327 "mtgrammar.y"
1255 { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ;
1258 #line 331 "mtgrammar.y"
1259 { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1262 #line 334 "mtgrammar.y"
1263 { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ;
1266 #line 335 "mtgrammar.y"
1267 { yyval.mttransferaction = yyvsp[0].mttransferaction; ;
1270 #line 338 "mtgrammar.y"
1271 { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ;
1274 #line 339 "mtgrammar.y"
1275 { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ;
1278 /* the action file gets copied in in place of this dollarsign */
1279 #line 543 "/usr/lib/bison.simple"
1290 short *ssp1 = yyss - 1;
1291 fprintf (stderr, "state stack now");
1292 while (ssp1 != yyssp)
1293 fprintf (stderr, " %d", *++ssp1);
1294 fprintf (stderr, "\n");
1304 yylsp->first_line = yylloc.first_line;
1305 yylsp->first_column = yylloc.first_column;
1306 yylsp->last_line = (yylsp-1)->last_line;
1307 yylsp->last_column = (yylsp-1)->last_column;
1312 yylsp->last_line = (yylsp+yylen-1)->last_line;
1313 yylsp->last_column = (yylsp+yylen-1)->last_column;
1317 /* Now "shift" the result of the reduction.
1318 Determine what state that goes to,
1319 based on the state we popped back to
1320 and the rule number reduced by. */
1324 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1325 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1326 yystate = yytable[yystate];
1328 yystate = yydefgoto[yyn - YYNTBASE];
1332 yyerrlab: /* here on detecting error */
1335 /* If not already recovering from an error, report this error. */
1339 #ifdef YYERROR_VERBOSE
1340 yyn = yypact[yystate];
1342 if (yyn > YYFLAG && yyn < YYLAST)
1349 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1350 for (x = (yyn < 0 ? -yyn : 0);
1351 x < (sizeof(yytname) / sizeof(char *)); x++)
1352 if (yycheck[x + yyn] == x)
1353 size += strlen(yytname[x]) + 15, count++;
1354 msg = (char *) malloc(size + 15);
1357 strcpy(msg, "parse error");
1362 for (x = (yyn < 0 ? -yyn : 0);
1363 x < (sizeof(yytname) / sizeof(char *)); x++)
1364 if (yycheck[x + yyn] == x)
1366 strcat(msg, count == 0 ? ", expecting `" : " or `");
1367 strcat(msg, yytname[x]);
1376 yyerror ("parse error; also virtual memory exceeded");
1379 #endif /* YYERROR_VERBOSE */
1380 yyerror("parse error");
1384 yyerrlab1: /* here on error raised explicitly by an action */
1386 if (yyerrstatus == 3)
1388 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1390 /* return failure if at end of input */
1391 if (yychar == YYEOF)
1396 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1402 /* Else will try to reuse lookahead token
1403 after shifting the error token. */
1405 yyerrstatus = 3; /* Each real token shifted decrements this */
1409 yyerrdefault: /* current state does not do anything special for the error token. */
1412 /* This is wrong; only states that explicitly want error tokens
1413 should shift them. */
1414 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1415 if (yyn) goto yydefault;
1418 yyerrpop: /* pop the current state because it cannot handle the error token */
1420 if (yyssp == yyss) YYABORT;
1430 short *ssp1 = yyss - 1;
1431 fprintf (stderr, "Error: state stack now");
1432 while (ssp1 != yyssp)
1433 fprintf (stderr, " %d", *++ssp1);
1434 fprintf (stderr, "\n");
1440 yyn = yypact[yystate];
1445 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1464 fprintf(stderr, "Shifting error token, ");
1476 /* YYACCEPT comes here. */
1488 /* YYABORT comes here. */
1499 #line 344 "mtgrammar.y"
1502 # include "bison.reset"
1504 extern char *yytext;
1506 static void mterror (char *s)
1512 (message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
1517 (message ("Parse error in meta-state file"));
1522 static void yyprint (FILE *file, int type, YYSTYPE value)
1524 cstring tname = mttok_unparse (value.tok);
1525 fprintf (file, " (%s)", cstring_toCharsSafe (tname));
1526 cstring_free (tname);
1533 ** Resets all flags in bison.head
1555 /*@=evalorderuncon@*/
1564 /*@=elseifcomplete@*/
1568 /*@=readonlytrans@*/
1571 /*@=systemunrecog@*/
1572 /*@=dependenttrans@*/
1573 /*@=unqualifiedtrans@*/