2 ** Inserted at beginning of c files generated by bison
3 ** REMEMBER: Change bison.reset too.
42 /*@-unqualifiedtrans@*/
49 /*drl added 11/27/2001*/
51 /* < end of bison.head > */
54 /* A Bison parser, made from mtgrammar.y
55 by GNU Bison version 1.28 */
57 #define YYBISON 1 /* Identify Bison output. */
59 #define yyparse mtparse
61 #define yyerror mterror
64 #define yydebug mtdebug
65 #define yynerrs mtnerrs
70 #define MT_CONTEXT 261
72 #define MT_DEFAULTS 263
73 #define MT_DEFAULT 264
74 #define MT_REFERENCE 265
75 #define MT_PARAMETER 266
78 #define MT_LITERAL 269
80 #define MT_ANNOTATIONS 271
83 #define MT_TRANSFERS 274
84 #define MT_PRECONDITIONS 275
85 #define MT_POSTCONDITIONS 276
86 #define MT_LOSEREFERENCE 277
94 #define MT_LBRACKET 285
95 #define MT_RBRACKET 286
102 #define MT_DOUBLE 293
104 #define MT_ANYTYPE 295
105 #define MT_INTEGRALTYPE 296
106 #define MT_UNSIGNEDINTEGRALTYPE 297
107 #define MT_SIGNEDINTEGRALTYPE 298
109 #define MT_VOLATILE 300
110 #define MT_RESTRICT 301
111 #define MT_STRINGLIT 302
116 # include "bison.reset"
117 # include "splintMacros.nf"
118 # include "llbasic.h"
121 extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ;
124 /*@i523@*/ /* can't include these here
125 # include "mtgrammar.h"
126 # include "mtscanner.h"
129 static /*@noreturn@*/ void mterror (char *);
131 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
132 extern int mtlex () ;
133 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
136 # define YYPRINT(file, type, value) yyprint (file, type, value)
140 # include "bison.head"
145 mtDeclarationNode mtdecl;
146 mtDeclarationPiece mtpiece;
147 mtDeclarationPieces mtpieces;
148 mtContextNode mtcontext;
149 mtValuesNode mtvalues;
150 mtDefaultsNode mtdefaults;
151 mtDefaultsDeclList mtdeflist;
152 mtAnnotationsNode mtannotations;
153 mtAnnotationList mtannotlist;
154 mtAnnotationDecl mtannotdecl;
156 mtMergeItem mtmergeitem;
157 mtMergeClauseList mtmergeclauselist;
158 mtMergeClause mtmergeclause;
159 mtTransferClauseList mttransferclauselist;
160 mtTransferClause mttransferclause;
161 mtTransferAction mttransferaction;
162 mtLoseReferenceList mtlosereferencelist;
163 mtLoseReference mtlosereference;
165 /*@only@*/ cstringList cstringlist;
167 /*@only@*/ qtype qtyp;
186 #define YYFLAG -32768
189 #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 93)
191 static const char yytranslate[] = { 0,
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, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
218 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
219 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
220 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
221 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
226 static const short yyprhs[] = { 0,
227 0, 1, 3, 7, 12, 15, 16, 19, 21, 23,
228 25, 27, 29, 31, 33, 35, 37, 39, 42, 43,
229 45, 48, 51, 54, 57, 60, 63, 64, 66, 68,
230 71, 73, 77, 80, 81, 83, 85, 87, 90, 92,
231 95, 98, 102, 104, 106, 108, 110, 113, 117, 120,
232 124, 126, 128, 130, 132, 134, 136, 138, 140, 142,
233 144, 146, 149, 151, 155, 158, 161, 165, 170, 173,
234 175, 178, 183, 186, 188, 191, 197, 199, 201, 204,
235 207, 210, 213, 215, 218, 222, 224, 227, 233, 235,
239 static const short yyrhs[] = { -1,
240 51, 0, 5, 52, 4, 0, 6, 5, 52, 4,
241 0, 49, 53, 0, 0, 54, 53, 0, 55, 0,
242 70, 0, 73, 0, 72, 0, 75, 0, 78, 0,
243 84, 0, 82, 0, 83, 0, 85, 0, 7, 57,
244 0, 0, 57, 0, 12, 58, 0, 11, 58, 0,
245 13, 58, 0, 14, 58, 0, 15, 58, 0, 16,
246 58, 0, 0, 59, 0, 60, 0, 60, 63, 0,
247 61, 0, 60, 28, 59, 0, 68, 62, 0, 0,
248 60, 0, 64, 0, 67, 0, 64, 67, 0, 27,
249 0, 27, 66, 0, 27, 64, 0, 27, 66, 64,
250 0, 45, 0, 46, 0, 47, 0, 65, 0, 66,
251 65, 0, 29, 63, 30, 0, 31, 32, 0, 67,
252 31, 32, 0, 36, 0, 37, 0, 38, 0, 39,
253 0, 40, 0, 41, 0, 42, 0, 43, 0, 44,
254 0, 69, 0, 49, 0, 8, 71, 0, 49, 0,
255 49, 35, 71, 0, 10, 92, 0, 9, 74, 0,
256 57, 18, 92, 0, 57, 18, 92, 74, 0, 17,
257 76, 0, 77, 0, 77, 76, 0, 49, 56, 18,
258 92, 0, 19, 79, 0, 80, 0, 80, 79, 0,
259 81, 26, 81, 18, 90, 0, 92, 0, 27, 0,
260 21, 88, 0, 22, 88, 0, 20, 88, 0, 23,
261 86, 0, 87, 0, 87, 86, 0, 92, 18, 91,
262 0, 89, 0, 89, 88, 0, 92, 24, 92, 18,
263 90, 0, 92, 0, 91, 0, 25, 0, 25, 48,
270 static const short yyrline[] = { 0,
271 160, 161, 164, 166, 170, 174, 175, 179, 180, 181,
272 182, 183, 184, 185, 186, 187, 188, 191, 195, 196,
273 199, 200, 201, 202, 203, 204, 211, 212, 215, 216,
274 219, 220, 224, 227, 228, 232, 233, 234, 237, 238,
275 239, 240, 243, 244, 245, 248, 249, 252, 253, 254,
276 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
277 276, 279, 282, 283, 287, 290, 293, 295, 299, 302,
278 303, 307, 311, 314, 315, 318, 322, 323, 326, 329,
279 332, 335, 338, 339, 342, 345, 346, 349, 353, 354,
285 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
287 static const char * const yytname[] = { "$","error","$undefined.","MT_BADTOK",
288 "MT_END","MT_STATE","MT_GLOBAL","MT_CONTEXT","MT_ONEOF","MT_DEFAULTS","MT_DEFAULT",
289 "MT_REFERENCE","MT_PARAMETER","MT_RESULT","MT_CLAUSE","MT_LITERAL","MT_NULL",
290 "MT_ANNOTATIONS","MT_ARROW","MT_MERGE","MT_TRANSFERS","MT_PRECONDITIONS","MT_POSTCONDITIONS",
291 "MT_LOSEREFERENCE","MT_AS","MT_ERROR","MT_PLUS","MT_STAR","MT_BAR","MT_LPAREN",
292 "MT_RPAREN","MT_LBRACKET","MT_RBRACKET","MT_LBRACE","MT_RBRACE","MT_COMMA","MT_CHAR",
293 "MT_INT","MT_FLOAT","MT_DOUBLE","MT_VOID","MT_ANYTYPE","MT_INTEGRALTYPE","MT_UNSIGNEDINTEGRALTYPE",
294 "MT_SIGNEDINTEGRALTYPE","MT_CONST","MT_VOLATILE","MT_RESTRICT","MT_STRINGLIT",
295 "MT_IDENT","file","mtsDeclaration","declarationNode","declarationPieces","declarationPiece",
296 "contextDeclaration","optContextSelection","contextSelection","optType","typeExpression",
297 "completeType","completeTypeAux","optCompleteType","abstractDecl","pointers",
298 "innerMods","innerModsList","abstractDeclBase","typeSpecifier","typeName","valuesDeclaration",
299 "valuesList","defaultNode","defaultsDeclaration","defaultDeclarationList","annotationsDeclaration",
300 "annotationsDeclarationList","annotationDeclaration","mergeDeclaration","mergeClauses",
301 "mergeClause","mergeItem","preconditionsDeclaration","postconditionsDeclaration",
302 "transfersDeclaration","loseReferenceDeclaration","lostClauses","lostClause",
303 "transferClauses","transferClause","transferAction","errorAction","valueChoice", NULL
307 static const short yyr1[] = { 0,
308 50, 50, 51, 51, 52, 53, 53, 54, 54, 54,
309 54, 54, 54, 54, 54, 54, 54, 55, 56, 56,
310 57, 57, 57, 57, 57, 57, 58, 58, 59, 59,
311 60, 60, 61, 62, 62, 63, 63, 63, 64, 64,
312 64, 64, 65, 65, 65, 66, 66, 67, 67, 67,
313 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
314 69, 70, 71, 71, 72, 73, 74, 74, 75, 76,
315 76, 77, 78, 79, 79, 80, 81, 81, 82, 83,
316 84, 85, 86, 86, 87, 88, 88, 89, 90, 90,
320 static const short yyr2[] = { 0,
321 0, 1, 3, 4, 2, 0, 2, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
323 2, 2, 2, 2, 2, 2, 0, 1, 1, 2,
324 1, 3, 2, 0, 1, 1, 1, 2, 1, 2,
325 2, 3, 1, 1, 1, 1, 2, 3, 2, 3,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 2, 1, 3, 2, 2, 3, 4, 2, 1,
328 2, 4, 2, 1, 2, 5, 1, 1, 2, 2,
329 2, 2, 1, 2, 3, 1, 2, 5, 1, 1,
333 static const short yydefact[] = { 1,
334 0, 0, 2, 6, 0, 0, 0, 0, 0, 0,
335 0, 0, 0, 0, 0, 0, 5, 6, 8, 9,
336 11, 10, 12, 13, 15, 16, 14, 17, 3, 0,
337 27, 27, 27, 27, 27, 27, 18, 63, 62, 0,
338 66, 93, 65, 19, 69, 70, 78, 73, 74, 0,
339 77, 81, 86, 0, 79, 80, 82, 83, 0, 7,
340 4, 51, 52, 53, 54, 55, 56, 57, 58, 59,
341 61, 22, 28, 29, 31, 34, 60, 21, 23, 24,
342 25, 26, 0, 0, 0, 20, 71, 75, 0, 87,
343 0, 84, 0, 39, 0, 0, 0, 30, 36, 37,
344 35, 33, 64, 67, 0, 0, 0, 91, 85, 43,
345 44, 45, 41, 46, 40, 32, 0, 49, 38, 0,
346 68, 72, 0, 0, 92, 42, 47, 48, 50, 76,
350 static const short yydefgoto[] = { 134,
351 3, 5, 17, 18, 19, 85, 40, 72, 73, 74,
352 75, 102, 98, 99, 114, 115, 100, 76, 77, 20,
353 39, 21, 22, 41, 23, 45, 46, 24, 48, 49,
354 50, 25, 26, 27, 28, 57, 58, 52, 53, 130,
358 static const short yypact[] = { 21,
359 -29, 30,-32768, 2, 33, -29, 52, -9, 52, -8,
360 -3, -19, -8, -8, -8, -8,-32768, 2,-32768,-32768,
361 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 54,
362 13, 13, 13, 13, 13, 13,-32768, 24,-32768, 43,
363 -32768,-32768,-32768, 52,-32768, -3,-32768,-32768, -19, 34,
364 -32768,-32768, -8, 46,-32768,-32768,-32768, -8, 57,-32768,
365 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
366 -32768,-32768,-32768, 16,-32768, 13,-32768,-32768,-32768,-32768,
367 -32768,-32768, -9, -8, 58,-32768,-32768,-32768, -19,-32768,
368 -8,-32768, 47, -14, 13, 42, 45,-32768, 5, 49,
369 50,-32768,-32768, 52, -8, 64, 65, 36,-32768,-32768,
370 -32768,-32768,-32768,-32768, -14,-32768, 55,-32768, 49, 56,
371 -32768,-32768, -20, -20,-32768,-32768,-32768,-32768,-32768,-32768,
372 -32768,-32768,-32768, 86, 87,-32768
375 static const short yypgoto[] = {-32768,
376 -32768, 83, 72,-32768,-32768,-32768, -6, -18, -4, 17,
377 -32768,-32768, -2, -87, -23,-32768, -1,-32768,-32768,-32768,
378 14,-32768,-32768, -5,-32768, 59,-32768,-32768, 51,-32768,
379 7,-32768,-32768,-32768,-32768, 44,-32768, -11,-32768, -21,
387 static const short yytable[] = { 43,
388 37, 51, 55, 56, 108, 59, 113, 47, 7, 8,
389 9, 10, 94, 78, 79, 80, 81, 82, 11, 4,
390 12, 13, 14, 15, 16, 1, 2, 126, 42, 42,
391 110, 111, 112, 96, 6, 97, 29, 86, 51, 38,
392 42, 90, 94, 95, 96, 44, 97, 59, 62, 63,
393 64, 65, 66, 67, 68, 69, 70, 61, 83, 89,
394 84, 71, 31, 32, 33, 34, 35, 36, 94, 91,
395 96, 108, 97, 104, 93, 105, 118, 95, 51, 120,
396 107, 123, 124, 125, 128, 135, 136, 129, 30, 60,
397 116, 127, 101, 117, 122, 106, 103, 119, 121, 88,
398 109, 92, 133, 0, 87, 0, 0, 0, 0, 0,
402 static const short yycheck[] = { 10,
403 7, 12, 14, 15, 25, 16, 94, 27, 7, 8,
404 9, 10, 27, 32, 33, 34, 35, 36, 17, 49,
405 19, 20, 21, 22, 23, 5, 6, 115, 49, 49,
406 45, 46, 47, 29, 5, 31, 4, 44, 49, 49,
407 49, 53, 27, 28, 29, 49, 31, 58, 36, 37,
408 38, 39, 40, 41, 42, 43, 44, 4, 35, 26,
409 18, 49, 11, 12, 13, 14, 15, 16, 27, 24,
410 29, 25, 31, 84, 18, 18, 32, 28, 89, 31,
411 91, 18, 18, 48, 30, 0, 0, 32, 6, 18,
412 95, 115, 76, 96, 105, 89, 83, 99, 104, 49,
413 93, 58, 124, -1, 46, -1, -1, -1, -1, -1,
418 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
420 /* This file comes from bison-1.28. */
422 /* Skeleton output parser for bison,
423 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
425 This program is free software; you can redistribute it and/or modify
426 it under the terms of the GNU General Public License as published by
427 the Free Software Foundation; either version 2, or (at your option)
430 This program is distributed in the hope that it will be useful,
431 but WITHOUT ANY WARRANTY; without even the implied warranty of
432 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
433 GNU General Public License for more details.
435 You should have received a copy of the GNU General Public License
436 along with this program; if not, write to the Free Software
437 Foundation, Inc., 59 Temple Place - Suite 330,
438 Boston, MA 02111-1307, USA. */
440 /* As a special exception, when this file is copied by Bison into a
441 Bison output file, you may use that output file without restriction.
442 This special exception was added by the Free Software Foundation
443 in version 1.24 of Bison. */
445 /* This is the parser code that is written into each bison parser
446 when the %semantic_parser declaration is not specified in the grammar.
447 It was written by Richard Stallman by simplifying the hairy parser
448 used when %semantic_parser is specified. */
450 #ifndef YYSTACK_USE_ALLOCA
452 #define YYSTACK_USE_ALLOCA
453 #else /* alloca not defined */
455 #define YYSTACK_USE_ALLOCA
456 #define alloca __builtin_alloca
457 #else /* not GNU C. */
458 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
459 #define YYSTACK_USE_ALLOCA
461 #else /* not sparc */
462 /* We think this test detects Watcom and Microsoft C. */
463 /* This used to test MSDOS, but that is a bad idea
464 since that symbol is in the user namespace. */
465 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
466 #if 0 /* No need for malloc.h, which pollutes the namespace;
467 instead, just don't use alloca. */
470 #else /* not MSDOS, or __TURBOC__ */
472 /* I don't know what this was needed for, but it pollutes the namespace.
473 So I turned it off. rms, 2 May 1997. */
474 /* #include <malloc.h> */
476 #define YYSTACK_USE_ALLOCA
477 #else /* not MSDOS, or __TURBOC__, or _AIX */
479 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
480 and on HPUX 10. Eventually we can turn this on. */
481 #define YYSTACK_USE_ALLOCA
482 #define alloca __builtin_alloca
485 #endif /* not _AIX */
486 #endif /* not MSDOS, or __TURBOC__ */
487 #endif /* not sparc */
488 #endif /* not GNU C */
489 #endif /* alloca not defined */
490 #endif /* YYSTACK_USE_ALLOCA not defined */
492 #ifdef YYSTACK_USE_ALLOCA
493 #define YYSTACK_ALLOC alloca
495 #define YYSTACK_ALLOC malloc
498 /* Note: there must be only one dollar sign in this file.
499 It is replaced by the list of actions, each action
500 as one case of the switch. */
502 #define yyerrok (yyerrstatus = 0)
503 #define yyclearin (yychar = YYEMPTY)
506 #define YYACCEPT goto yyacceptlab
507 #define YYABORT goto yyabortlab
508 #define YYERROR goto yyerrlab1
509 /* Like YYERROR except do call yyerror.
510 This remains here temporarily to ease the
511 transition to the new meaning of YYERROR, for GCC.
512 Once GCC version 2 has supplanted version 1, this can go. */
513 #define YYFAIL goto yyerrlab
514 #define YYRECOVERING() (!!yyerrstatus)
515 #define YYBACKUP(token, value) \
517 if (yychar == YYEMPTY && yylen == 1) \
518 { yychar = (token), yylval = (value); \
519 yychar1 = YYTRANSLATE (yychar); \
524 { yyerror ("syntax error: cannot back up"); YYERROR; } \
528 #define YYERRCODE 256
531 #define YYLEX yylex()
537 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
539 #define YYLEX yylex(&yylval, &yylloc)
541 #else /* not YYLSP_NEEDED */
543 #define YYLEX yylex(&yylval, YYLEX_PARAM)
545 #define YYLEX yylex(&yylval)
547 #endif /* not YYLSP_NEEDED */
550 /* If nonreentrant, generate the variables here */
554 int yychar; /* the lookahead symbol */
555 YYSTYPE yylval; /* the semantic value of the */
556 /* lookahead symbol */
559 YYLTYPE yylloc; /* location data for the lookahead */
563 int yynerrs; /* number of parse errors so far */
564 #endif /* not YYPURE */
567 int yydebug; /* nonzero means print parse trace */
568 /* Since this is uninitialized, it does not stop multiple parsers
572 /* YYINITDEPTH indicates the initial size of the parser's stacks */
575 #define YYINITDEPTH 200
578 /* YYMAXDEPTH is the maximum size the stacks can grow to
579 (effective only if the built-in stack extension method is used). */
586 #define YYMAXDEPTH 10000
589 /* Define __yy_memcpy. Note that the size argument
590 should be passed with type unsigned int, because that is what the non-GCC
591 definitions require. With GCC, __builtin_memcpy takes an arg
592 of type size_t, but it can handle unsigned int. */
594 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
595 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
596 #else /* not GNU C or C++ */
599 /* This is the most reliable way to avoid incompatibilities
600 in available built-in functions on various systems. */
602 __yy_memcpy (to, from, count)
607 register char *f = from;
608 register char *t = to;
609 register int i = count;
615 #else /* __cplusplus */
617 /* This is the most reliable way to avoid incompatibilities
618 in available built-in functions on various systems. */
620 __yy_memcpy (char *to, char *from, unsigned int count)
622 register char *t = to;
623 register char *f = from;
624 register int i = count;
635 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
636 into yyparse. The argument should have type void *.
637 It should actually point to an object.
638 Grammar actions can access the variable by casting it
639 to the proper pointer type. */
643 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
644 #define YYPARSE_PARAM_DECL
645 #else /* not __cplusplus */
646 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
647 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
648 #endif /* not __cplusplus */
649 #else /* not YYPARSE_PARAM */
650 #define YYPARSE_PARAM_ARG
651 #define YYPARSE_PARAM_DECL
652 #endif /* not YYPARSE_PARAM */
654 /* Prevent warning if -Wstrict-prototypes. */
657 int yyparse (void *);
664 yyparse(YYPARSE_PARAM_ARG)
667 register int yystate;
669 register short *yyssp;
670 register YYSTYPE *yyvsp;
671 int yyerrstatus; /* number of tokens to shift before error messages enabled */
672 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
674 short yyssa[YYINITDEPTH]; /* the state stack */
675 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
677 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
678 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
681 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
682 YYLTYPE *yyls = yylsa;
685 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
687 #define YYPOPSTACK (yyvsp--, yyssp--)
690 int yystacksize = YYINITDEPTH;
691 int yyfree_stacks = 0;
702 YYSTYPE yyval; /* the variable used to return */
703 /* semantic values from the action */
710 fprintf(stderr, "Starting parse\n");
716 yychar = YYEMPTY; /* Cause a token to be read. */
718 /* Initialize stack pointers.
719 Waste one element of value and location stack
720 so that they stay on the same level as the state stack.
721 The wasted elements are never initialized. */
729 /* Push a new state, which is found in yystate . */
730 /* In all cases, when you get here, the value and location stacks
731 have just been pushed. so pushing a state here evens the stacks. */
736 if (yyssp >= yyss + yystacksize - 1)
738 /* Give user a chance to reallocate the stack */
739 /* Use copies of these so that the &'s don't force the real ones into memory. */
740 YYSTYPE *yyvs1 = yyvs;
743 YYLTYPE *yyls1 = yyls;
746 /* Get the current used size of the three stacks, in elements. */
747 int size = yyssp - yyss + 1;
750 /* Each stack pointer address is followed by the size of
751 the data in use in that stack, in bytes. */
753 /* This used to be a conditional around just the two extra args,
754 but that might be undefined if yyoverflow is a macro. */
755 yyoverflow("parser stack overflow",
756 &yyss1, size * sizeof (*yyssp),
757 &yyvs1, size * sizeof (*yyvsp),
758 &yyls1, size * sizeof (*yylsp),
761 yyoverflow("parser stack overflow",
762 &yyss1, size * sizeof (*yyssp),
763 &yyvs1, size * sizeof (*yyvsp),
767 yyss = yyss1; yyvs = yyvs1;
771 #else /* no yyoverflow */
772 /* Extend the stack our own way. */
773 if (yystacksize >= YYMAXDEPTH)
775 yyerror("parser stack overflow");
787 if (yystacksize > YYMAXDEPTH)
788 yystacksize = YYMAXDEPTH;
789 #ifndef YYSTACK_USE_ALLOCA
792 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
793 __yy_memcpy ((char *)yyss, (char *)yyss1,
794 size * (unsigned int) sizeof (*yyssp));
795 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
796 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
797 size * (unsigned int) sizeof (*yyvsp));
799 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
800 __yy_memcpy ((char *)yyls, (char *)yyls1,
801 size * (unsigned int) sizeof (*yylsp));
803 #endif /* no yyoverflow */
805 yyssp = yyss + size - 1;
806 yyvsp = yyvs + size - 1;
808 yylsp = yyls + size - 1;
813 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
816 if (yyssp >= yyss + yystacksize - 1)
822 fprintf(stderr, "Entering state %d\n", yystate);
828 /* Do appropriate processing given the current state. */
829 /* Read a lookahead token if we need one and don't already have one. */
832 /* First try to decide what to do without reference to lookahead token. */
834 yyn = yypact[yystate];
838 /* Not known => get a lookahead token if don't already have one. */
840 /* yychar is either YYEMPTY or YYEOF
841 or a valid token in external form. */
843 if (yychar == YYEMPTY)
847 fprintf(stderr, "Reading a token: ");
852 /* Convert token to internal form (in yychar1) for indexing tables with */
854 if (yychar <= 0) /* This means end of input. */
857 yychar = YYEOF; /* Don't call YYLEX any more */
861 fprintf(stderr, "Now at end of input.\n");
866 yychar1 = YYTRANSLATE(yychar);
871 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
872 /* Give the individual parser a way to print the precise meaning
873 of a token, for further debugging info. */
875 YYPRINT (stderr, yychar, yylval);
877 fprintf (stderr, ")\n");
883 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
888 /* yyn is what to do for this token type in this state.
889 Negative => reduce, -yyn is rule number.
890 Positive => shift, yyn is new state.
891 New state is final state => don't bother to shift,
893 0, or most negative number => error. */
908 /* Shift the lookahead token. */
912 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
915 /* Discard the token being shifted unless it is eof. */
924 /* count tokens shifted since error; after three, turn off error status. */
925 if (yyerrstatus) yyerrstatus--;
930 /* Do the default action for the current state. */
933 yyn = yydefact[yystate];
937 /* Do a reduction. yyn is the number of a rule to reduce with. */
941 yyval = yyvsp[1-yylen]; /* implement default value of the action */
948 fprintf (stderr, "Reducing via rule %d (line %d), ",
951 /* Print the symbols being reduced, and their result. */
952 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
953 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
954 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
968 { mtreader_processDeclaration (yyvsp[-1].mtdecl); ;
971 { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ;
974 { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ;
977 { yyval.mtpieces = mtDeclarationPieces_create (); ;
980 { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ;
983 { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ;
986 { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ;
989 { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ;
992 { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ;
995 { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ;
998 { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ;
1001 { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ;
1004 { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ;
1007 { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ;
1010 { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ;
1013 { yyval.mtcontext = yyvsp[0].mtcontext; ;
1016 { yyval.mtcontext = mtContextNode_createAny (); ;
1019 { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ;
1022 { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ;
1025 { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ;
1028 { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ;
1031 { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ;
1034 { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ;
1037 { yyval.ctyp = ctype_unknown; ;
1040 { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ;
1043 { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ;
1046 { yyval.qtyp = yyvsp[0].qtyp; ;
1049 { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ;
1052 { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ;
1055 { yyval.qtyp = qtype_unknown (); ;
1058 { yyval.qtyp = yyvsp[0].qtyp; ;
1061 { yyval.ctyp = ctype_adjustPointers (yyvsp[0].pointers, ctype_unknown); ;
1064 { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].pointers, yyvsp[0].ctyp); ;
1067 { yyval.pointers = pointers_createMt (yyvsp[0].tok); ;
1070 { yyval.pointers = pointers_createModsMt (yyvsp[-1].tok, yyvsp[0].quals); ;
1073 { yyval.pointers = pointers_extend (pointers_createMt (yyvsp[-1].tok), yyvsp[0].pointers); ;
1076 { yyval.pointers = pointers_extend (pointers_createModsMt (yyvsp[-2].tok, yyvsp[-1].quals), yyvsp[0].pointers); ;
1079 { yyval.qual = qual_createConst (); ;
1082 { yyval.qual = qual_createVolatile (); ;
1085 { yyval.qual = qual_createRestrict (); ;
1088 { yyval.quals = qualList_single (yyvsp[0].qual); ;
1091 { yyval.quals = qualList_add (yyvsp[-1].quals, yyvsp[0].qual); ;
1094 { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ;
1097 { yyval.ctyp = ctype_makeArray (ctype_unknown); ;
1100 { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
1103 { yyval.ctyp = ctype_char; ;
1106 { yyval.ctyp = ctype_int; ;
1109 { yyval.ctyp = ctype_float; ;
1112 { yyval.ctyp = ctype_double; ;
1115 { yyval.ctyp = ctype_void; ;
1118 { yyval.ctyp = ctype_unknown; ;
1121 { yyval.ctyp = ctype_anyintegral; ;
1124 { yyval.ctyp = ctype_unsignedintegral; ;
1127 { yyval.ctyp = ctype_signedintegral; ;
1130 { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ;
1133 { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ;
1136 { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ;
1139 { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ;
1142 { yyval.tok = yyvsp[0].tok; ;
1145 { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ;
1148 { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ;
1151 { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ;
1154 { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ;
1157 { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ;
1160 { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ;
1163 { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ;
1166 { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ;
1169 { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ;
1172 { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ;
1175 { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ;
1178 { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ;
1181 { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ;
1184 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1187 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1190 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1193 { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ;
1196 { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ;
1199 { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ;
1202 { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1205 { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ;
1208 { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ;
1211 { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1214 { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ;
1217 { yyval.mttransferaction = yyvsp[0].mttransferaction; ;
1220 { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ;
1223 { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ;
1226 /* the action file gets copied in in place of this dollarsign */
1238 short *ssp1 = yyss - 1;
1239 fprintf (stderr, "state stack now");
1240 while (ssp1 != yyssp)
1241 fprintf (stderr, " %d", *++ssp1);
1242 fprintf (stderr, "\n");
1252 yylsp->first_line = yylloc.first_line;
1253 yylsp->first_column = yylloc.first_column;
1254 yylsp->last_line = (yylsp-1)->last_line;
1255 yylsp->last_column = (yylsp-1)->last_column;
1260 yylsp->last_line = (yylsp+yylen-1)->last_line;
1261 yylsp->last_column = (yylsp+yylen-1)->last_column;
1265 /* Now "shift" the result of the reduction.
1266 Determine what state that goes to,
1267 based on the state we popped back to
1268 and the rule number reduced by. */
1272 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1273 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1274 yystate = yytable[yystate];
1276 yystate = yydefgoto[yyn - YYNTBASE];
1280 yyerrlab: /* here on detecting error */
1283 /* If not already recovering from an error, report this error. */
1287 #ifdef YYERROR_VERBOSE
1288 yyn = yypact[yystate];
1290 if (yyn > YYFLAG && yyn < YYLAST)
1297 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1298 for (x = (yyn < 0 ? -yyn : 0);
1299 x < (sizeof(yytname) / sizeof(char *)); x++)
1300 if (yycheck[x + yyn] == x)
1301 size += strlen(yytname[x]) + 15, count++;
1302 msg = (char *) malloc(size + 15);
1305 strcpy(msg, "parse error");
1310 for (x = (yyn < 0 ? -yyn : 0);
1311 x < (sizeof(yytname) / sizeof(char *)); x++)
1312 if (yycheck[x + yyn] == x)
1314 strcat(msg, count == 0 ? ", expecting `" : " or `");
1315 strcat(msg, yytname[x]);
1324 yyerror ("parse error; also virtual memory exceeded");
1327 #endif /* YYERROR_VERBOSE */
1328 yyerror("parse error");
1332 yyerrlab1: /* here on error raised explicitly by an action */
1334 if (yyerrstatus == 3)
1336 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1338 /* return failure if at end of input */
1339 if (yychar == YYEOF)
1344 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1350 /* Else will try to reuse lookahead token
1351 after shifting the error token. */
1353 yyerrstatus = 3; /* Each real token shifted decrements this */
1357 yyerrdefault: /* current state does not do anything special for the error token. */
1360 /* This is wrong; only states that explicitly want error tokens
1361 should shift them. */
1362 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1363 if (yyn) goto yydefault;
1366 yyerrpop: /* pop the current state because it cannot handle the error token */
1368 if (yyssp == yyss) YYABORT;
1378 short *ssp1 = yyss - 1;
1379 fprintf (stderr, "Error: state stack now");
1380 while (ssp1 != yyssp)
1381 fprintf (stderr, " %d", *++ssp1);
1382 fprintf (stderr, "\n");
1388 yyn = yypact[yystate];
1393 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1412 fprintf(stderr, "Shifting error token, ");
1424 /* YYACCEPT comes here. */
1436 /* YYABORT comes here. */
1449 # include "bison.reset"
1451 extern char *yytext;
1453 static void mterror (char *s)
1459 (message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
1464 (message ("Parse error in meta-state file"));
1469 static void yyprint (FILE *file, int type, YYSTYPE value)
1471 cstring tname = mttok_unparse (value.tok);
1472 fprintf (file, " (%s)", cstring_toCharsSafe (tname));
1473 cstring_free (tname);
1480 ** Resets all flags in bison.head
1502 /*@=evalorderuncon@*/
1511 /*@=elseifcomplete@*/
1515 /*@=readonlytrans@*/
1518 /*@=systemunrecog@*/
1519 /*@=dependenttrans@*/
1520 /*@=unqualifiedtrans@*/
1524 /*drl added 11/27/2001*/