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
72 #define MT_ANNOTATIONS 268
75 #define MT_TRANSFERS 271
76 #define MT_PRECONDITIONS 272
77 #define MT_POSTCONDITIONS 273
78 #define MT_LOSEREFERENCE 274
86 #define MT_LBRACKET 282
87 #define MT_RBRACKET 283
96 #define MT_ANYTYPE 292
97 #define MT_INTEGRALTYPE 293
98 #define MT_UNSIGNEDINTEGRALTYPE 294
99 #define MT_SIGNEDINTEGRALTYPE 295
101 #define MT_VOLATILE 297
102 #define MT_STRINGLIT 298
105 #line 25 "mtgrammar.y"
108 # include "bison.reset"
109 # include "lclintMacros.nf"
110 # include "llbasic.h"
111 # include "mtincludes.h"
113 static /*@exits@*/ void mterror (char *);
115 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
116 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
119 # define YYPRINT(file, type, value) yyprint (file, type, value)
123 # include "bison.head"
126 #line 48 "mtgrammar.y"
129 mtDeclarationNode mtdecl;
130 mtDeclarationPiece mtpiece;
131 mtDeclarationPieces mtpieces;
132 mtContextNode mtcontext;
133 mtValuesNode mtvalues;
134 mtDefaultsNode mtdefaults;
135 mtDefaultsDeclList mtdeflist;
136 mtAnnotationsNode mtannotations;
137 mtAnnotationList mtannotlist;
138 mtAnnotationDecl mtannotdecl;
140 mtMergeItem mtmergeitem;
141 mtMergeClauseList mtmergeclauselist;
142 mtMergeClause mtmergeclause;
143 mtTransferClauseList mttransferclauselist;
144 mtTransferClause mttransferclause;
145 mtTransferAction mttransferaction;
146 mtLoseReferenceList mtlosereferencelist;
147 mtLoseReference mtlosereference;
149 /*@only@*/ cstringList cstringlist;
151 /*@only@*/ qtype qtyp;
169 #define YYFLAG -32768
172 #define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 89)
174 static const char yytranslate[] = { 0,
175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 1, 3, 4, 5, 6,
201 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
202 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
203 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
204 37, 38, 39, 40, 41, 42, 43, 44, 45
208 static const short yyprhs[] = { 0,
209 0, 1, 3, 7, 12, 15, 16, 19, 21, 23,
210 25, 27, 29, 31, 33, 35, 37, 39, 42, 43,
211 45, 48, 51, 54, 55, 57, 59, 62, 64, 68,
212 71, 72, 74, 76, 78, 81, 83, 86, 89, 93,
213 95, 97, 99, 102, 106, 109, 113, 115, 117, 119,
214 121, 123, 125, 127, 129, 131, 133, 135, 138, 140,
215 144, 147, 150, 154, 159, 162, 164, 167, 172, 175,
216 177, 180, 186, 188, 190, 193, 196, 199, 202, 204,
217 207, 211, 213, 216, 222, 224, 226, 228, 231
220 static const short yyrhs[] = { -1,
221 47, 0, 5, 48, 4, 0, 6, 5, 48, 4,
222 0, 45, 49, 0, 0, 50, 49, 0, 51, 0,
223 66, 0, 69, 0, 68, 0, 71, 0, 74, 0,
224 80, 0, 78, 0, 79, 0, 81, 0, 7, 53,
225 0, 0, 53, 0, 12, 54, 0, 11, 54, 0,
226 13, 54, 0, 0, 55, 0, 56, 0, 56, 59,
227 0, 57, 0, 56, 25, 55, 0, 64, 58, 0,
228 0, 56, 0, 60, 0, 63, 0, 60, 63, 0,
229 24, 0, 24, 62, 0, 24, 60, 0, 24, 62,
230 60, 0, 42, 0, 43, 0, 61, 0, 62, 61,
231 0, 26, 59, 27, 0, 28, 29, 0, 63, 28,
232 29, 0, 33, 0, 34, 0, 35, 0, 36, 0,
233 37, 0, 38, 0, 39, 0, 40, 0, 41, 0,
234 65, 0, 45, 0, 8, 67, 0, 45, 0, 45,
235 32, 67, 0, 10, 88, 0, 9, 70, 0, 53,
236 15, 88, 0, 53, 15, 88, 70, 0, 14, 72,
237 0, 73, 0, 73, 72, 0, 45, 52, 15, 88,
238 0, 16, 75, 0, 76, 0, 76, 75, 0, 77,
239 23, 77, 15, 86, 0, 88, 0, 24, 0, 18,
240 84, 0, 19, 84, 0, 17, 84, 0, 20, 82,
241 0, 83, 0, 83, 82, 0, 88, 15, 87, 0,
242 85, 0, 85, 84, 0, 88, 21, 88, 15, 86,
243 0, 88, 0, 87, 0, 22, 0, 22, 44, 0,
250 static const short yyrline[] = { 0,
251 144, 145, 148, 150, 154, 158, 159, 163, 164, 165,
252 166, 167, 168, 169, 170, 171, 172, 175, 179, 180,
253 183, 184, 185, 192, 193, 196, 197, 200, 201, 205,
254 208, 209, 213, 214, 215, 218, 219, 220, 221, 224,
255 225, 228, 229, 232, 233, 234, 241, 242, 243, 244,
256 245, 246, 247, 248, 249, 250, 256, 259, 262, 263,
257 267, 270, 273, 275, 279, 282, 283, 287, 291, 294,
258 295, 298, 302, 303, 306, 309, 312, 315, 318, 319,
259 322, 325, 326, 329, 333, 334, 337, 338, 341
264 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
266 static const char * const yytname[] = { "$","error","$undefined.","MT_BADTOK",
267 "MT_END","MT_STATE","MT_GLOBAL","MT_CONTEXT","MT_ONEOF","MT_DEFAULTS","MT_DEFAULT",
268 "MT_REFERENCE","MT_PARAMETER","MT_CLAUSE","MT_ANNOTATIONS","MT_ARROW","MT_MERGE",
269 "MT_TRANSFERS","MT_PRECONDITIONS","MT_POSTCONDITIONS","MT_LOSEREFERENCE","MT_AS",
270 "MT_ERROR","MT_PLUS","MT_STAR","MT_BAR","MT_LPAREN","MT_RPAREN","MT_LBRACKET",
271 "MT_RBRACKET","MT_LBRACE","MT_RBRACE","MT_COMMA","MT_CHAR","MT_INT","MT_FLOAT",
272 "MT_DOUBLE","MT_VOID","MT_ANYTYPE","MT_INTEGRALTYPE","MT_UNSIGNEDINTEGRALTYPE",
273 "MT_SIGNEDINTEGRALTYPE","MT_CONST","MT_VOLATILE","MT_STRINGLIT","MT_IDENT","file",
274 "mtsDeclaration","declarationNode","declarationPieces","declarationPiece","contextDeclaration",
275 "optContextSelection","contextSelection","optType","typeExpression","completeType",
276 "completeTypeAux","optCompleteType","abstractDecl","pointers","innerMods","innerModsList",
277 "abstractDeclBase","typeSpecifier","typeName","valuesDeclaration","valuesList",
278 "defaultNode","defaultsDeclaration","defaultDeclarationList","annotationsDeclaration",
279 "annotationsDeclarationList","annotationDeclaration","mergeDeclaration","mergeClauses",
280 "mergeClause","mergeItem","preconditionsDeclaration","postconditionsDeclaration",
281 "transfersDeclaration","loseReferenceDeclaration","lostClauses","lostClause",
282 "transferClauses","transferClause","transferAction","errorAction","valueChoice", NULL
286 static const short yyr1[] = { 0,
287 46, 46, 47, 47, 48, 49, 49, 50, 50, 50,
288 50, 50, 50, 50, 50, 50, 50, 51, 52, 52,
289 53, 53, 53, 54, 54, 55, 55, 56, 56, 57,
290 58, 58, 59, 59, 59, 60, 60, 60, 60, 61,
291 61, 62, 62, 63, 63, 63, 64, 64, 64, 64,
292 64, 64, 64, 64, 64, 64, 65, 66, 67, 67,
293 68, 69, 70, 70, 71, 72, 72, 73, 74, 75,
294 75, 76, 77, 77, 78, 79, 80, 81, 82, 82,
295 83, 84, 84, 85, 86, 86, 87, 87, 88
298 static const short yyr2[] = { 0,
299 0, 1, 3, 4, 2, 0, 2, 1, 1, 1,
300 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
301 2, 2, 2, 0, 1, 1, 2, 1, 3, 2,
302 0, 1, 1, 1, 2, 1, 2, 2, 3, 1,
303 1, 1, 2, 3, 2, 3, 1, 1, 1, 1,
304 1, 1, 1, 1, 1, 1, 1, 2, 1, 3,
305 2, 2, 3, 4, 2, 1, 2, 4, 2, 1,
306 2, 5, 1, 1, 2, 2, 2, 2, 1, 2,
307 3, 1, 2, 5, 1, 1, 1, 2, 1
310 static const short yydefact[] = { 1,
311 0, 0, 2, 6, 0, 0, 0, 0, 0, 0,
312 0, 0, 0, 0, 0, 0, 5, 6, 8, 9,
313 11, 10, 12, 13, 15, 16, 14, 17, 3, 0,
314 24, 24, 24, 18, 59, 58, 0, 62, 89, 61,
315 19, 65, 66, 74, 69, 70, 0, 73, 77, 82,
316 0, 75, 76, 78, 79, 0, 7, 4, 47, 48,
317 49, 50, 51, 52, 53, 54, 55, 57, 22, 25,
318 26, 28, 31, 56, 21, 23, 0, 0, 0, 20,
319 67, 71, 0, 83, 0, 80, 0, 36, 0, 0,
320 0, 27, 33, 34, 32, 30, 60, 63, 0, 0,
321 0, 87, 81, 40, 41, 38, 42, 37, 29, 0,
322 45, 35, 0, 64, 68, 0, 0, 88, 39, 43,
323 44, 46, 72, 86, 85, 84, 0, 0, 0
326 static const short yydefgoto[] = { 127,
327 3, 5, 17, 18, 19, 79, 37, 69, 70, 71,
328 72, 96, 92, 93, 107, 108, 94, 73, 74, 20,
329 36, 21, 22, 38, 23, 42, 43, 24, 45, 46,
330 47, 25, 26, 27, 28, 54, 55, 49, 50, 123,
334 static const short yypact[] = { 27,
335 -8, 29,-32768, 6, 40, -8, -2, 12, -2, 16,
336 17, -16, 16, 16, 16, 16,-32768, 6,-32768,-32768,
337 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 55,
338 13, 13, 13,-32768, 28,-32768, 48,-32768,-32768,-32768,
339 -2,-32768, 17,-32768,-32768, -16, 41,-32768,-32768, 16,
340 44,-32768,-32768,-32768, 16, 51,-32768,-32768,-32768,-32768,
341 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
342 -7,-32768, 13,-32768,-32768,-32768, 12, 16, 52,-32768,
343 -32768,-32768, -16,-32768, 16,-32768, 47, -12, 13, 14,
344 42,-32768, 15, 46, 45,-32768,-32768, -2, 16, 57,
345 61, 33,-32768,-32768,-32768,-32768,-32768, -12,-32768, 53,
346 -32768, 46, 49,-32768,-32768, -17, -17,-32768,-32768,-32768,
347 -32768,-32768,-32768,-32768,-32768,-32768, 79, 81,-32768
350 static const short yypgoto[] = {-32768,
351 -32768, 76, 65,-32768,-32768,-32768, -6, 23, -5, 18,
352 -32768,-32768, -4, -81, -23,-32768, -3,-32768,-32768,-32768,
353 10,-32768,-32768, -1,-32768, 50,-32768,-32768, 54,-32768,
354 5,-32768,-32768,-32768,-32768, 37,-32768, -11,-32768, -22,
362 static const short yytable[] = { 40,
363 34, 48, 52, 53, 102, 56, 106, 44, 31, 32,
364 33, 88, 7, 8, 9, 10, 88, 89, 90, 11,
365 91, 12, 13, 14, 15, 16, 119, 39, 39, 104,
366 105, 1, 2, 6, 80, 48, 4, 88, 84, 90,
367 90, 91, 91, 29, 56, 59, 60, 61, 62, 63,
368 64, 65, 66, 67, 75, 76, 35, 68, 58, 77,
369 39, 41, 78, 83, 85, 87, 99, 98, 102, 89,
370 111, 116, 48, 113, 101, 117, 118, 122, 128, 121,
371 129, 30, 57, 109, 120, 110, 97, 100, 115, 112,
372 95, 86, 81, 103, 126, 0, 114, 0, 0, 82,
373 0, 0, 0, 0, 0, 125, 125
376 static const short yycheck[] = { 10,
377 7, 12, 14, 15, 22, 16, 88, 24, 11, 12,
378 13, 24, 7, 8, 9, 10, 24, 25, 26, 14,
379 28, 16, 17, 18, 19, 20, 108, 45, 45, 42,
380 43, 5, 6, 5, 41, 46, 45, 24, 50, 26,
381 26, 28, 28, 4, 55, 33, 34, 35, 36, 37,
382 38, 39, 40, 41, 32, 33, 45, 45, 4, 32,
383 45, 45, 15, 23, 21, 15, 15, 78, 22, 25,
384 29, 15, 83, 28, 85, 15, 44, 29, 0, 27,
385 0, 6, 18, 89, 108, 90, 77, 83, 99, 93,
386 73, 55, 43, 87, 117, -1, 98, -1, -1, 46,
387 -1, -1, -1, -1, -1, 116, 117
391 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
392 #line 3 "/usr/lib/bison.simple"
393 /* This file comes from bison-1.28. */
395 /* Skeleton output parser for bison,
396 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
398 This program is free software; you can redistribute it and/or modify
399 it under the terms of the GNU General Public License as published by
400 the Free Software Foundation; either version 2, or (at your option)
403 This program is distributed in the hope that it will be useful,
404 but WITHOUT ANY WARRANTY; without even the implied warranty of
405 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
406 GNU General Public License for more details.
408 You should have received a copy of the GNU General Public License
409 along with this program; if not, write to the Free Software
410 Foundation, Inc., 59 Temple Place - Suite 330,
411 Boston, MA 02111-1307, USA. */
413 /* As a special exception, when this file is copied by Bison into a
414 Bison output file, you may use that output file without restriction.
415 This special exception was added by the Free Software Foundation
416 in version 1.24 of Bison. */
418 /* This is the parser code that is written into each bison parser
419 when the %semantic_parser declaration is not specified in the grammar.
420 It was written by Richard Stallman by simplifying the hairy parser
421 used when %semantic_parser is specified. */
423 #ifndef YYSTACK_USE_ALLOCA
425 #define YYSTACK_USE_ALLOCA
426 #else /* alloca not defined */
428 #define YYSTACK_USE_ALLOCA
429 #define alloca __builtin_alloca
430 #else /* not GNU C. */
431 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
432 #define YYSTACK_USE_ALLOCA
434 #else /* not sparc */
435 /* We think this test detects Watcom and Microsoft C. */
436 /* This used to test MSDOS, but that is a bad idea
437 since that symbol is in the user namespace. */
438 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
439 #if 0 /* No need for malloc.h, which pollutes the namespace;
440 instead, just don't use alloca. */
443 #else /* not MSDOS, or __TURBOC__ */
445 /* I don't know what this was needed for, but it pollutes the namespace.
446 So I turned it off. rms, 2 May 1997. */
447 /* #include <malloc.h> */
449 #define YYSTACK_USE_ALLOCA
450 #else /* not MSDOS, or __TURBOC__, or _AIX */
452 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
453 and on HPUX 10. Eventually we can turn this on. */
454 #define YYSTACK_USE_ALLOCA
455 #define alloca __builtin_alloca
458 #endif /* not _AIX */
459 #endif /* not MSDOS, or __TURBOC__ */
460 #endif /* not sparc */
461 #endif /* not GNU C */
462 #endif /* alloca not defined */
463 #endif /* YYSTACK_USE_ALLOCA not defined */
465 #ifdef YYSTACK_USE_ALLOCA
466 #define YYSTACK_ALLOC alloca
468 #define YYSTACK_ALLOC malloc
471 /* Note: there must be only one dollar sign in this file.
472 It is replaced by the list of actions, each action
473 as one case of the switch. */
475 #define yyerrok (yyerrstatus = 0)
476 #define yyclearin (yychar = YYEMPTY)
479 #define YYACCEPT goto yyacceptlab
480 #define YYABORT goto yyabortlab
481 #define YYERROR goto yyerrlab1
482 /* Like YYERROR except do call yyerror.
483 This remains here temporarily to ease the
484 transition to the new meaning of YYERROR, for GCC.
485 Once GCC version 2 has supplanted version 1, this can go. */
486 #define YYFAIL goto yyerrlab
487 #define YYRECOVERING() (!!yyerrstatus)
488 #define YYBACKUP(token, value) \
490 if (yychar == YYEMPTY && yylen == 1) \
491 { yychar = (token), yylval = (value); \
492 yychar1 = YYTRANSLATE (yychar); \
497 { yyerror ("syntax error: cannot back up"); YYERROR; } \
501 #define YYERRCODE 256
504 #define YYLEX yylex()
510 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
512 #define YYLEX yylex(&yylval, &yylloc)
514 #else /* not YYLSP_NEEDED */
516 #define YYLEX yylex(&yylval, YYLEX_PARAM)
518 #define YYLEX yylex(&yylval)
520 #endif /* not YYLSP_NEEDED */
523 /* If nonreentrant, generate the variables here */
527 int yychar; /* the lookahead symbol */
528 YYSTYPE yylval; /* the semantic value of the */
529 /* lookahead symbol */
532 YYLTYPE yylloc; /* location data for the lookahead */
536 int yynerrs; /* number of parse errors so far */
537 #endif /* not YYPURE */
540 int yydebug; /* nonzero means print parse trace */
541 /* Since this is uninitialized, it does not stop multiple parsers
545 /* YYINITDEPTH indicates the initial size of the parser's stacks */
548 #define YYINITDEPTH 200
551 /* YYMAXDEPTH is the maximum size the stacks can grow to
552 (effective only if the built-in stack extension method is used). */
559 #define YYMAXDEPTH 10000
562 /* Define __yy_memcpy. Note that the size argument
563 should be passed with type unsigned int, because that is what the non-GCC
564 definitions require. With GCC, __builtin_memcpy takes an arg
565 of type size_t, but it can handle unsigned int. */
567 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
568 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
569 #else /* not GNU C or C++ */
572 /* This is the most reliable way to avoid incompatibilities
573 in available built-in functions on various systems. */
575 __yy_memcpy (to, from, count)
580 register char *f = from;
581 register char *t = to;
582 register int i = count;
588 #else /* __cplusplus */
590 /* This is the most reliable way to avoid incompatibilities
591 in available built-in functions on various systems. */
593 __yy_memcpy (char *to, char *from, unsigned int count)
595 register char *t = to;
596 register char *f = from;
597 register int i = count;
606 #line 217 "/usr/lib/bison.simple"
608 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
609 into yyparse. The argument should have type void *.
610 It should actually point to an object.
611 Grammar actions can access the variable by casting it
612 to the proper pointer type. */
616 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
617 #define YYPARSE_PARAM_DECL
618 #else /* not __cplusplus */
619 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
620 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
621 #endif /* not __cplusplus */
622 #else /* not YYPARSE_PARAM */
623 #define YYPARSE_PARAM_ARG
624 #define YYPARSE_PARAM_DECL
625 #endif /* not YYPARSE_PARAM */
627 /* Prevent warning if -Wstrict-prototypes. */
630 int yyparse (void *);
637 yyparse(YYPARSE_PARAM_ARG)
640 register int yystate;
642 register short *yyssp;
643 register YYSTYPE *yyvsp;
644 int yyerrstatus; /* number of tokens to shift before error messages enabled */
645 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
647 short yyssa[YYINITDEPTH]; /* the state stack */
648 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
650 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
651 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
654 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
655 YYLTYPE *yyls = yylsa;
658 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
660 #define YYPOPSTACK (yyvsp--, yyssp--)
663 int yystacksize = YYINITDEPTH;
664 int yyfree_stacks = 0;
675 YYSTYPE yyval; /* the variable used to return */
676 /* semantic values from the action */
683 fprintf(stderr, "Starting parse\n");
689 yychar = YYEMPTY; /* Cause a token to be read. */
691 /* Initialize stack pointers.
692 Waste one element of value and location stack
693 so that they stay on the same level as the state stack.
694 The wasted elements are never initialized. */
702 /* Push a new state, which is found in yystate . */
703 /* In all cases, when you get here, the value and location stacks
704 have just been pushed. so pushing a state here evens the stacks. */
709 if (yyssp >= yyss + yystacksize - 1)
711 /* Give user a chance to reallocate the stack */
712 /* Use copies of these so that the &'s don't force the real ones into memory. */
713 YYSTYPE *yyvs1 = yyvs;
716 YYLTYPE *yyls1 = yyls;
719 /* Get the current used size of the three stacks, in elements. */
720 int size = yyssp - yyss + 1;
723 /* Each stack pointer address is followed by the size of
724 the data in use in that stack, in bytes. */
726 /* This used to be a conditional around just the two extra args,
727 but that might be undefined if yyoverflow is a macro. */
728 yyoverflow("parser stack overflow",
729 &yyss1, size * sizeof (*yyssp),
730 &yyvs1, size * sizeof (*yyvsp),
731 &yyls1, size * sizeof (*yylsp),
734 yyoverflow("parser stack overflow",
735 &yyss1, size * sizeof (*yyssp),
736 &yyvs1, size * sizeof (*yyvsp),
740 yyss = yyss1; yyvs = yyvs1;
744 #else /* no yyoverflow */
745 /* Extend the stack our own way. */
746 if (yystacksize >= YYMAXDEPTH)
748 yyerror("parser stack overflow");
760 if (yystacksize > YYMAXDEPTH)
761 yystacksize = YYMAXDEPTH;
762 #ifndef YYSTACK_USE_ALLOCA
765 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
766 __yy_memcpy ((char *)yyss, (char *)yyss1,
767 size * (unsigned int) sizeof (*yyssp));
768 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
769 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
770 size * (unsigned int) sizeof (*yyvsp));
772 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
773 __yy_memcpy ((char *)yyls, (char *)yyls1,
774 size * (unsigned int) sizeof (*yylsp));
776 #endif /* no yyoverflow */
778 yyssp = yyss + size - 1;
779 yyvsp = yyvs + size - 1;
781 yylsp = yyls + size - 1;
786 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
789 if (yyssp >= yyss + yystacksize - 1)
795 fprintf(stderr, "Entering state %d\n", yystate);
801 /* Do appropriate processing given the current state. */
802 /* Read a lookahead token if we need one and don't already have one. */
805 /* First try to decide what to do without reference to lookahead token. */
807 yyn = yypact[yystate];
811 /* Not known => get a lookahead token if don't already have one. */
813 /* yychar is either YYEMPTY or YYEOF
814 or a valid token in external form. */
816 if (yychar == YYEMPTY)
820 fprintf(stderr, "Reading a token: ");
825 /* Convert token to internal form (in yychar1) for indexing tables with */
827 if (yychar <= 0) /* This means end of input. */
830 yychar = YYEOF; /* Don't call YYLEX any more */
834 fprintf(stderr, "Now at end of input.\n");
839 yychar1 = YYTRANSLATE(yychar);
844 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
845 /* Give the individual parser a way to print the precise meaning
846 of a token, for further debugging info. */
848 YYPRINT (stderr, yychar, yylval);
850 fprintf (stderr, ")\n");
856 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
861 /* yyn is what to do for this token type in this state.
862 Negative => reduce, -yyn is rule number.
863 Positive => shift, yyn is new state.
864 New state is final state => don't bother to shift,
866 0, or most negative number => error. */
881 /* Shift the lookahead token. */
885 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
888 /* Discard the token being shifted unless it is eof. */
897 /* count tokens shifted since error; after three, turn off error status. */
898 if (yyerrstatus) yyerrstatus--;
903 /* Do the default action for the current state. */
906 yyn = yydefact[yystate];
910 /* Do a reduction. yyn is the number of a rule to reduce with. */
914 yyval = yyvsp[1-yylen]; /* implement default value of the action */
921 fprintf (stderr, "Reducing via rule %d (line %d), ",
924 /* Print the symbols being reduced, and their result. */
925 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
926 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
927 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
935 #line 144 "mtgrammar.y"
939 #line 145 "mtgrammar.y"
943 #line 149 "mtgrammar.y"
944 { mtreader_processDeclaration (yyvsp[-1].mtdecl); ;
947 #line 151 "mtgrammar.y"
948 { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ;
951 #line 155 "mtgrammar.y"
952 { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ;
955 #line 158 "mtgrammar.y"
956 { yyval.mtpieces = mtDeclarationPieces_create (); ;
959 #line 160 "mtgrammar.y"
960 { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ;
963 #line 163 "mtgrammar.y"
964 { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ;
967 #line 164 "mtgrammar.y"
968 { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ;
971 #line 165 "mtgrammar.y"
972 { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ;
975 #line 166 "mtgrammar.y"
976 { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ;
979 #line 167 "mtgrammar.y"
980 { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ;
983 #line 168 "mtgrammar.y"
984 { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ;
987 #line 169 "mtgrammar.y"
988 { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ;
991 #line 170 "mtgrammar.y"
992 { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ;
995 #line 171 "mtgrammar.y"
996 { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ;
999 #line 172 "mtgrammar.y"
1000 { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ;
1003 #line 175 "mtgrammar.y"
1004 { yyval.mtcontext = yyvsp[0].mtcontext; ;
1007 #line 179 "mtgrammar.y"
1008 { yyval.mtcontext = mtContextNode_createAny (); ;
1011 #line 183 "mtgrammar.y"
1012 { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ;
1015 #line 184 "mtgrammar.y"
1016 { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ;
1019 #line 185 "mtgrammar.y"
1020 { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ;
1023 #line 192 "mtgrammar.y"
1024 { yyval.ctyp = ctype_unknown; ;
1027 #line 193 "mtgrammar.y"
1028 { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ;
1031 #line 197 "mtgrammar.y"
1032 { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ;
1035 #line 200 "mtgrammar.y"
1036 { yyval.qtyp = yyvsp[0].qtyp; ;
1039 #line 202 "mtgrammar.y"
1040 { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ;
1043 #line 205 "mtgrammar.y"
1044 { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ;
1047 #line 208 "mtgrammar.y"
1048 { yyval.qtyp = qtype_unknown (); ;
1051 #line 209 "mtgrammar.y"
1052 { yyval.qtyp = yyvsp[0].qtyp; ;
1055 #line 213 "mtgrammar.y"
1056 { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ;
1059 #line 215 "mtgrammar.y"
1060 { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ;
1063 #line 218 "mtgrammar.y"
1064 { yyval.count = 1; ;
1067 #line 219 "mtgrammar.y"
1068 { yyval.count = 1; ;
1071 #line 220 "mtgrammar.y"
1072 { yyval.count = 1 + yyvsp[0].count; ;
1075 #line 221 "mtgrammar.y"
1076 { yyval.count = 1 + yyvsp[0].count; ;
1079 #line 224 "mtgrammar.y"
1080 { /* ignored for now */; ;
1083 #line 225 "mtgrammar.y"
1087 #line 228 "mtgrammar.y"
1091 #line 229 "mtgrammar.y"
1095 #line 232 "mtgrammar.y"
1096 { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ;
1099 #line 233 "mtgrammar.y"
1100 { yyval.ctyp = ctype_makeArray (ctype_unknown); ;
1103 #line 234 "mtgrammar.y"
1104 { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
1107 #line 241 "mtgrammar.y"
1108 { yyval.ctyp = ctype_char; ;
1111 #line 242 "mtgrammar.y"
1112 { yyval.ctyp = ctype_int; ;
1115 #line 243 "mtgrammar.y"
1116 { yyval.ctyp = ctype_float; ;
1119 #line 244 "mtgrammar.y"
1120 { yyval.ctyp = ctype_double; ;
1123 #line 245 "mtgrammar.y"
1124 { yyval.ctyp = ctype_void; ;
1127 #line 246 "mtgrammar.y"
1128 { yyval.ctyp = ctype_unknown; ;
1131 #line 247 "mtgrammar.y"
1132 { yyval.ctyp = ctype_anyintegral; ;
1135 #line 248 "mtgrammar.y"
1136 { yyval.ctyp = ctype_unsignedintegral; ;
1139 #line 249 "mtgrammar.y"
1140 { yyval.ctyp = ctype_signedintegral; ;
1143 #line 256 "mtgrammar.y"
1144 { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ;
1147 #line 259 "mtgrammar.y"
1148 { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ;
1151 #line 262 "mtgrammar.y"
1152 { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ;
1155 #line 264 "mtgrammar.y"
1156 { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ;
1159 #line 267 "mtgrammar.y"
1160 { yyval.tok = yyvsp[0].tok; ;
1163 #line 270 "mtgrammar.y"
1164 { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ;
1167 #line 274 "mtgrammar.y"
1168 { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ;
1171 #line 276 "mtgrammar.y"
1172 { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ;
1175 #line 279 "mtgrammar.y"
1176 { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ;
1179 #line 282 "mtgrammar.y"
1180 { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ;
1183 #line 284 "mtgrammar.y"
1184 { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ;
1187 #line 288 "mtgrammar.y"
1188 { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ;
1191 #line 291 "mtgrammar.y"
1192 { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ;
1195 #line 294 "mtgrammar.y"
1196 { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ;
1199 #line 295 "mtgrammar.y"
1200 { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ;
1203 #line 299 "mtgrammar.y"
1204 { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ;
1207 #line 302 "mtgrammar.y"
1208 { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ;
1211 #line 303 "mtgrammar.y"
1212 { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ;
1215 #line 306 "mtgrammar.y"
1216 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1219 #line 309 "mtgrammar.y"
1220 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1223 #line 312 "mtgrammar.y"
1224 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1227 #line 315 "mtgrammar.y"
1228 { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ;
1231 #line 318 "mtgrammar.y"
1232 { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ;
1235 #line 319 "mtgrammar.y"
1236 { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ;
1239 #line 322 "mtgrammar.y"
1240 { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1243 #line 325 "mtgrammar.y"
1244 { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ;
1247 #line 326 "mtgrammar.y"
1248 { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ;
1251 #line 330 "mtgrammar.y"
1252 { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1255 #line 333 "mtgrammar.y"
1256 { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ;
1259 #line 334 "mtgrammar.y"
1260 { yyval.mttransferaction = yyvsp[0].mttransferaction; ;
1263 #line 337 "mtgrammar.y"
1264 { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ;
1267 #line 338 "mtgrammar.y"
1268 { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ;
1271 #line 341 "mtgrammar.y"
1272 { yyval.tok = yyvsp[0].tok; ;
1275 /* the action file gets copied in in place of this dollarsign */
1276 #line 543 "/usr/lib/bison.simple"
1287 short *ssp1 = yyss - 1;
1288 fprintf (stderr, "state stack now");
1289 while (ssp1 != yyssp)
1290 fprintf (stderr, " %d", *++ssp1);
1291 fprintf (stderr, "\n");
1301 yylsp->first_line = yylloc.first_line;
1302 yylsp->first_column = yylloc.first_column;
1303 yylsp->last_line = (yylsp-1)->last_line;
1304 yylsp->last_column = (yylsp-1)->last_column;
1309 yylsp->last_line = (yylsp+yylen-1)->last_line;
1310 yylsp->last_column = (yylsp+yylen-1)->last_column;
1314 /* Now "shift" the result of the reduction.
1315 Determine what state that goes to,
1316 based on the state we popped back to
1317 and the rule number reduced by. */
1321 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1322 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1323 yystate = yytable[yystate];
1325 yystate = yydefgoto[yyn - YYNTBASE];
1329 yyerrlab: /* here on detecting error */
1332 /* If not already recovering from an error, report this error. */
1336 #ifdef YYERROR_VERBOSE
1337 yyn = yypact[yystate];
1339 if (yyn > YYFLAG && yyn < YYLAST)
1346 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1347 for (x = (yyn < 0 ? -yyn : 0);
1348 x < (sizeof(yytname) / sizeof(char *)); x++)
1349 if (yycheck[x + yyn] == x)
1350 size += strlen(yytname[x]) + 15, count++;
1351 msg = (char *) malloc(size + 15);
1354 strcpy(msg, "parse error");
1359 for (x = (yyn < 0 ? -yyn : 0);
1360 x < (sizeof(yytname) / sizeof(char *)); x++)
1361 if (yycheck[x + yyn] == x)
1363 strcat(msg, count == 0 ? ", expecting `" : " or `");
1364 strcat(msg, yytname[x]);
1373 yyerror ("parse error; also virtual memory exceeded");
1376 #endif /* YYERROR_VERBOSE */
1377 yyerror("parse error");
1381 yyerrlab1: /* here on error raised explicitly by an action */
1383 if (yyerrstatus == 3)
1385 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1387 /* return failure if at end of input */
1388 if (yychar == YYEOF)
1393 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1399 /* Else will try to reuse lookahead token
1400 after shifting the error token. */
1402 yyerrstatus = 3; /* Each real token shifted decrements this */
1406 yyerrdefault: /* current state does not do anything special for the error token. */
1409 /* This is wrong; only states that explicitly want error tokens
1410 should shift them. */
1411 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1412 if (yyn) goto yydefault;
1415 yyerrpop: /* pop the current state because it cannot handle the error token */
1417 if (yyssp == yyss) YYABORT;
1427 short *ssp1 = yyss - 1;
1428 fprintf (stderr, "Error: state stack now");
1429 while (ssp1 != yyssp)
1430 fprintf (stderr, " %d", *++ssp1);
1431 fprintf (stderr, "\n");
1437 yyn = yypact[yystate];
1442 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1461 fprintf(stderr, "Shifting error token, ");
1473 /* YYACCEPT comes here. */
1485 /* YYABORT comes here. */
1496 #line 343 "mtgrammar.y"
1499 # include "bison.reset"
1501 extern char *yytext;
1503 static void mterror (char *s)
1506 (cstring_makeLiteral
1507 ("There has been a problem in the .mts parser."));
1510 static void yyprint (FILE *file, int type, YYSTYPE value)
1512 cstring tname = mttok_unparse (value.tok);
1513 fprintf (file, " (%s)", cstring_toCharsSafe (tname));
1514 cstring_free (tname);
1521 ** Resets all flags in bison.head
1543 /*@=evalorderuncon@*/
1552 /*@=elseifcomplete@*/
1556 /*@=readonlytrans@*/
1559 /*@=systemunrecog@*/
1560 /*@=dependenttrans@*/
1561 /*@=unqualifiedtrans@*/