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_STRINGLIT 301
115 # include "bison.reset"
116 # include "splintMacros.nf"
117 # include "llbasic.h"
120 extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ;
123 /*@i523@*/ /* can't include these here
124 # include "mtgrammar.h"
125 # include "mtscanner.h"
128 static /*@exits@*/ void mterror (char *);
130 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
131 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
134 # define YYPRINT(file, type, value) yyprint (file, type, value)
138 # include "bison.head"
143 mtDeclarationNode mtdecl;
144 mtDeclarationPiece mtpiece;
145 mtDeclarationPieces mtpieces;
146 mtContextNode mtcontext;
147 mtValuesNode mtvalues;
148 mtDefaultsNode mtdefaults;
149 mtDefaultsDeclList mtdeflist;
150 mtAnnotationsNode mtannotations;
151 mtAnnotationList mtannotlist;
152 mtAnnotationDecl mtannotdecl;
154 mtMergeItem mtmergeitem;
155 mtMergeClauseList mtmergeclauselist;
156 mtMergeClause mtmergeclause;
157 mtTransferClauseList mttransferclauselist;
158 mtTransferClause mttransferclause;
159 mtTransferAction mttransferaction;
160 mtLoseReferenceList mtlosereferencelist;
161 mtLoseReference mtlosereference;
163 /*@only@*/ cstringList cstringlist;
165 /*@only@*/ qtype qtyp;
183 #define YYFLAG -32768
186 #define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 92)
188 static const char yytranslate[] = { 0,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
215 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
216 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
217 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
218 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
223 static const short yyprhs[] = { 0,
224 0, 1, 3, 7, 12, 15, 16, 19, 21, 23,
225 25, 27, 29, 31, 33, 35, 37, 39, 42, 43,
226 45, 48, 51, 54, 57, 60, 63, 64, 66, 68,
227 71, 73, 77, 80, 81, 83, 85, 87, 90, 92,
228 95, 98, 102, 104, 106, 108, 111, 115, 118, 122,
229 124, 126, 128, 130, 132, 134, 136, 138, 140, 142,
230 144, 147, 149, 153, 156, 159, 163, 168, 171, 173,
231 176, 181, 184, 186, 189, 195, 197, 199, 202, 205,
232 208, 211, 213, 216, 220, 222, 225, 231, 233, 235,
236 static const short yyrhs[] = { -1,
237 50, 0, 5, 51, 4, 0, 6, 5, 51, 4,
238 0, 48, 52, 0, 0, 53, 52, 0, 54, 0,
239 69, 0, 72, 0, 71, 0, 74, 0, 77, 0,
240 83, 0, 81, 0, 82, 0, 84, 0, 7, 56,
241 0, 0, 56, 0, 12, 57, 0, 11, 57, 0,
242 13, 57, 0, 14, 57, 0, 15, 57, 0, 16,
243 57, 0, 0, 58, 0, 59, 0, 59, 62, 0,
244 60, 0, 59, 28, 58, 0, 67, 61, 0, 0,
245 59, 0, 63, 0, 66, 0, 63, 66, 0, 27,
246 0, 27, 65, 0, 27, 63, 0, 27, 65, 63,
247 0, 45, 0, 46, 0, 64, 0, 65, 64, 0,
248 29, 62, 30, 0, 31, 32, 0, 66, 31, 32,
249 0, 36, 0, 37, 0, 38, 0, 39, 0, 40,
250 0, 41, 0, 42, 0, 43, 0, 44, 0, 68,
251 0, 48, 0, 8, 70, 0, 48, 0, 48, 35,
252 70, 0, 10, 91, 0, 9, 73, 0, 56, 18,
253 91, 0, 56, 18, 91, 73, 0, 17, 75, 0,
254 76, 0, 76, 75, 0, 48, 55, 18, 91, 0,
255 19, 78, 0, 79, 0, 79, 78, 0, 80, 26,
256 80, 18, 89, 0, 91, 0, 27, 0, 21, 87,
257 0, 22, 87, 0, 20, 87, 0, 23, 85, 0,
258 86, 0, 86, 85, 0, 91, 18, 90, 0, 88,
259 0, 88, 87, 0, 91, 24, 91, 18, 89, 0,
260 91, 0, 90, 0, 25, 0, 25, 47, 0, 48,
267 static const short yyrline[] = { 0,
268 157, 158, 161, 163, 167, 171, 172, 176, 177, 178,
269 179, 180, 181, 182, 183, 184, 185, 188, 192, 193,
270 196, 197, 198, 199, 200, 201, 208, 209, 212, 213,
271 216, 217, 221, 224, 225, 229, 230, 231, 234, 235,
272 236, 237, 240, 241, 244, 245, 248, 249, 250, 257,
273 258, 259, 260, 261, 262, 263, 264, 265, 266, 272,
274 275, 278, 279, 283, 286, 289, 291, 295, 298, 299,
275 303, 307, 310, 311, 314, 318, 319, 322, 325, 328,
276 331, 334, 335, 338, 341, 342, 345, 349, 350, 353,
282 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
284 static const char * const yytname[] = { "$","error","$undefined.","MT_BADTOK",
285 "MT_END","MT_STATE","MT_GLOBAL","MT_CONTEXT","MT_ONEOF","MT_DEFAULTS","MT_DEFAULT",
286 "MT_REFERENCE","MT_PARAMETER","MT_RESULT","MT_CLAUSE","MT_LITERAL","MT_NULL",
287 "MT_ANNOTATIONS","MT_ARROW","MT_MERGE","MT_TRANSFERS","MT_PRECONDITIONS","MT_POSTCONDITIONS",
288 "MT_LOSEREFERENCE","MT_AS","MT_ERROR","MT_PLUS","MT_STAR","MT_BAR","MT_LPAREN",
289 "MT_RPAREN","MT_LBRACKET","MT_RBRACKET","MT_LBRACE","MT_RBRACE","MT_COMMA","MT_CHAR",
290 "MT_INT","MT_FLOAT","MT_DOUBLE","MT_VOID","MT_ANYTYPE","MT_INTEGRALTYPE","MT_UNSIGNEDINTEGRALTYPE",
291 "MT_SIGNEDINTEGRALTYPE","MT_CONST","MT_VOLATILE","MT_STRINGLIT","MT_IDENT","file",
292 "mtsDeclaration","declarationNode","declarationPieces","declarationPiece","contextDeclaration",
293 "optContextSelection","contextSelection","optType","typeExpression","completeType",
294 "completeTypeAux","optCompleteType","abstractDecl","pointers","innerMods","innerModsList",
295 "abstractDeclBase","typeSpecifier","typeName","valuesDeclaration","valuesList",
296 "defaultNode","defaultsDeclaration","defaultDeclarationList","annotationsDeclaration",
297 "annotationsDeclarationList","annotationDeclaration","mergeDeclaration","mergeClauses",
298 "mergeClause","mergeItem","preconditionsDeclaration","postconditionsDeclaration",
299 "transfersDeclaration","loseReferenceDeclaration","lostClauses","lostClause",
300 "transferClauses","transferClause","transferAction","errorAction","valueChoice", NULL
304 static const short yyr1[] = { 0,
305 49, 49, 50, 50, 51, 52, 52, 53, 53, 53,
306 53, 53, 53, 53, 53, 53, 53, 54, 55, 55,
307 56, 56, 56, 56, 56, 56, 57, 57, 58, 58,
308 59, 59, 60, 61, 61, 62, 62, 62, 63, 63,
309 63, 63, 64, 64, 65, 65, 66, 66, 66, 67,
310 67, 67, 67, 67, 67, 67, 67, 67, 67, 68,
311 69, 70, 70, 71, 72, 73, 73, 74, 75, 75,
312 76, 77, 78, 78, 79, 80, 80, 81, 82, 83,
313 84, 85, 85, 86, 87, 87, 88, 89, 89, 90,
317 static const short yyr2[] = { 0,
318 0, 1, 3, 4, 2, 0, 2, 1, 1, 1,
319 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
320 2, 2, 2, 2, 2, 2, 0, 1, 1, 2,
321 1, 3, 2, 0, 1, 1, 1, 2, 1, 2,
322 2, 3, 1, 1, 1, 2, 3, 2, 3, 1,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 2, 1, 3, 2, 2, 3, 4, 2, 1, 2,
325 4, 2, 1, 2, 5, 1, 1, 2, 2, 2,
326 2, 1, 2, 3, 1, 2, 5, 1, 1, 1,
330 static const short yydefact[] = { 1,
331 0, 0, 2, 6, 0, 0, 0, 0, 0, 0,
332 0, 0, 0, 0, 0, 0, 5, 6, 8, 9,
333 11, 10, 12, 13, 15, 16, 14, 17, 3, 0,
334 27, 27, 27, 27, 27, 27, 18, 62, 61, 0,
335 65, 92, 64, 19, 68, 69, 77, 72, 73, 0,
336 76, 80, 85, 0, 78, 79, 81, 82, 0, 7,
337 4, 50, 51, 52, 53, 54, 55, 56, 57, 58,
338 60, 22, 28, 29, 31, 34, 59, 21, 23, 24,
339 25, 26, 0, 0, 0, 20, 70, 74, 0, 86,
340 0, 83, 0, 39, 0, 0, 0, 30, 36, 37,
341 35, 33, 63, 66, 0, 0, 0, 90, 84, 43,
342 44, 41, 45, 40, 32, 0, 48, 38, 0, 67,
343 71, 0, 0, 91, 42, 46, 47, 49, 75, 89,
347 static const short yydefgoto[] = { 133,
348 3, 5, 17, 18, 19, 85, 40, 72, 73, 74,
349 75, 102, 98, 99, 113, 114, 100, 76, 77, 20,
350 39, 21, 22, 41, 23, 45, 46, 24, 48, 49,
351 50, 25, 26, 27, 28, 57, 58, 52, 53, 129,
355 static const short yypact[] = { 4,
356 -37, 35,-32768, 36, 37, -37, 21, 2, 21, 17,
357 18, -19, 17, 17, 17, 17,-32768, 36,-32768,-32768,
358 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 63,
359 -23, -23, -23, -23, -23, -23,-32768, 33,-32768, 51,
360 -32768,-32768,-32768, 21,-32768, 18,-32768,-32768, -19, 44,
361 -32768,-32768, 17, 47,-32768,-32768,-32768, 17, 54,-32768,
362 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
363 -32768,-32768,-32768, -5,-32768, -23,-32768,-32768,-32768,-32768,
364 -32768,-32768, 2, 17, 55,-32768,-32768,-32768, -19,-32768,
365 17,-32768, 50, -15, -23, 20, 45,-32768, 23, 49,
366 48,-32768,-32768, 21, 17, 60, 64, 38,-32768,-32768,
367 -32768,-32768,-32768, -15,-32768, 53,-32768, 49, 52,-32768,
368 -32768, -20, -20,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
369 -32768,-32768, 86, 87,-32768
372 static const short yypgoto[] = {-32768,
373 -32768, 82, 71,-32768,-32768,-32768, -6, 28, -4, 14,
374 -32768,-32768, -3, -87, -22,-32768, -2,-32768,-32768,-32768,
375 11,-32768,-32768, -8,-32768, 56,-32768,-32768, 57,-32768,
376 9,-32768,-32768,-32768,-32768, 41,-32768, -11,-32768, -18,
384 static const short yytable[] = { 43,
385 37, 51, 55, 56, 108, 59, 112, 47, 1, 2,
386 4, 94, 62, 63, 64, 65, 66, 67, 68, 69,
387 70, 94, 95, 96, 71, 97, 125, 42, 42, 110,
388 111, 31, 32, 33, 34, 35, 36, 86, 51, 6,
389 29, 90, 7, 8, 9, 10, 94, 59, 96, 38,
390 97, 96, 11, 97, 12, 13, 14, 15, 16, 78,
391 79, 80, 81, 82, 42, 44, 61, 83, 84, 89,
392 91, 93, 105, 104, 108, 95, 117, 122, 51, 119,
393 107, 123, 127, 128, 124, 134, 135, 30, 60, 101,
394 115, 126, 116, 103, 121, 120, 118, 106, 92, 109,
395 0, 87, 0, 0, 132, 88, 0, 0, 0, 0,
399 static const short yycheck[] = { 10,
400 7, 12, 14, 15, 25, 16, 94, 27, 5, 6,
401 48, 27, 36, 37, 38, 39, 40, 41, 42, 43,
402 44, 27, 28, 29, 48, 31, 114, 48, 48, 45,
403 46, 11, 12, 13, 14, 15, 16, 44, 49, 5,
404 4, 53, 7, 8, 9, 10, 27, 58, 29, 48,
405 31, 29, 17, 31, 19, 20, 21, 22, 23, 32,
406 33, 34, 35, 36, 48, 48, 4, 35, 18, 26,
407 24, 18, 18, 84, 25, 28, 32, 18, 89, 31,
408 91, 18, 30, 32, 47, 0, 0, 6, 18, 76,
409 95, 114, 96, 83, 105, 104, 99, 89, 58, 93,
410 -1, 46, -1, -1, 123, 49, -1, -1, -1, -1,
415 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
417 /* This file comes from bison-1.28. */
419 /* Skeleton output parser for bison,
420 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
422 This program is free software; you can redistribute it and/or modify
423 it under the terms of the GNU General Public License as published by
424 the Free Software Foundation; either version 2, or (at your option)
427 This program is distributed in the hope that it will be useful,
428 but WITHOUT ANY WARRANTY; without even the implied warranty of
429 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
430 GNU General Public License for more details.
432 You should have received a copy of the GNU General Public License
433 along with this program; if not, write to the Free Software
434 Foundation, Inc., 59 Temple Place - Suite 330,
435 Boston, MA 02111-1307, USA. */
437 /* As a special exception, when this file is copied by Bison into a
438 Bison output file, you may use that output file without restriction.
439 This special exception was added by the Free Software Foundation
440 in version 1.24 of Bison. */
442 /* This is the parser code that is written into each bison parser
443 when the %semantic_parser declaration is not specified in the grammar.
444 It was written by Richard Stallman by simplifying the hairy parser
445 used when %semantic_parser is specified. */
447 #ifndef YYSTACK_USE_ALLOCA
449 #define YYSTACK_USE_ALLOCA
450 #else /* alloca not defined */
452 #define YYSTACK_USE_ALLOCA
453 #define alloca __builtin_alloca
454 #else /* not GNU C. */
455 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
456 #define YYSTACK_USE_ALLOCA
458 #else /* not sparc */
459 /* We think this test detects Watcom and Microsoft C. */
460 /* This used to test MSDOS, but that is a bad idea
461 since that symbol is in the user namespace. */
462 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
463 #if 0 /* No need for malloc.h, which pollutes the namespace;
464 instead, just don't use alloca. */
467 #else /* not MSDOS, or __TURBOC__ */
469 /* I don't know what this was needed for, but it pollutes the namespace.
470 So I turned it off. rms, 2 May 1997. */
471 /* #include <malloc.h> */
473 #define YYSTACK_USE_ALLOCA
474 #else /* not MSDOS, or __TURBOC__, or _AIX */
476 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
477 and on HPUX 10. Eventually we can turn this on. */
478 #define YYSTACK_USE_ALLOCA
479 #define alloca __builtin_alloca
482 #endif /* not _AIX */
483 #endif /* not MSDOS, or __TURBOC__ */
484 #endif /* not sparc */
485 #endif /* not GNU C */
486 #endif /* alloca not defined */
487 #endif /* YYSTACK_USE_ALLOCA not defined */
489 #ifdef YYSTACK_USE_ALLOCA
490 #define YYSTACK_ALLOC alloca
492 #define YYSTACK_ALLOC malloc
495 /* Note: there must be only one dollar sign in this file.
496 It is replaced by the list of actions, each action
497 as one case of the switch. */
499 #define yyerrok (yyerrstatus = 0)
500 #define yyclearin (yychar = YYEMPTY)
503 #define YYACCEPT goto yyacceptlab
504 #define YYABORT goto yyabortlab
505 #define YYERROR goto yyerrlab1
506 /* Like YYERROR except do call yyerror.
507 This remains here temporarily to ease the
508 transition to the new meaning of YYERROR, for GCC.
509 Once GCC version 2 has supplanted version 1, this can go. */
510 #define YYFAIL goto yyerrlab
511 #define YYRECOVERING() (!!yyerrstatus)
512 #define YYBACKUP(token, value) \
514 if (yychar == YYEMPTY && yylen == 1) \
515 { yychar = (token), yylval = (value); \
516 yychar1 = YYTRANSLATE (yychar); \
521 { yyerror ("syntax error: cannot back up"); YYERROR; } \
525 #define YYERRCODE 256
528 #define YYLEX yylex()
534 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
536 #define YYLEX yylex(&yylval, &yylloc)
538 #else /* not YYLSP_NEEDED */
540 #define YYLEX yylex(&yylval, YYLEX_PARAM)
542 #define YYLEX yylex(&yylval)
544 #endif /* not YYLSP_NEEDED */
547 /* If nonreentrant, generate the variables here */
551 int yychar; /* the lookahead symbol */
552 YYSTYPE yylval; /* the semantic value of the */
553 /* lookahead symbol */
556 YYLTYPE yylloc; /* location data for the lookahead */
560 int yynerrs; /* number of parse errors so far */
561 #endif /* not YYPURE */
564 int yydebug; /* nonzero means print parse trace */
565 /* Since this is uninitialized, it does not stop multiple parsers
569 /* YYINITDEPTH indicates the initial size of the parser's stacks */
572 #define YYINITDEPTH 200
575 /* YYMAXDEPTH is the maximum size the stacks can grow to
576 (effective only if the built-in stack extension method is used). */
583 #define YYMAXDEPTH 10000
586 /* Define __yy_memcpy. Note that the size argument
587 should be passed with type unsigned int, because that is what the non-GCC
588 definitions require. With GCC, __builtin_memcpy takes an arg
589 of type size_t, but it can handle unsigned int. */
591 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
592 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
593 #else /* not GNU C or C++ */
596 /* This is the most reliable way to avoid incompatibilities
597 in available built-in functions on various systems. */
599 __yy_memcpy (to, from, count)
604 register char *f = from;
605 register char *t = to;
606 register int i = count;
612 #else /* __cplusplus */
614 /* This is the most reliable way to avoid incompatibilities
615 in available built-in functions on various systems. */
617 __yy_memcpy (char *to, char *from, unsigned int count)
619 register char *t = to;
620 register char *f = from;
621 register int i = count;
632 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
633 into yyparse. The argument should have type void *.
634 It should actually point to an object.
635 Grammar actions can access the variable by casting it
636 to the proper pointer type. */
640 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
641 #define YYPARSE_PARAM_DECL
642 #else /* not __cplusplus */
643 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
644 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
645 #endif /* not __cplusplus */
646 #else /* not YYPARSE_PARAM */
647 #define YYPARSE_PARAM_ARG
648 #define YYPARSE_PARAM_DECL
649 #endif /* not YYPARSE_PARAM */
651 /* Prevent warning if -Wstrict-prototypes. */
654 int yyparse (void *);
661 yyparse(YYPARSE_PARAM_ARG)
664 register int yystate;
666 register short *yyssp;
667 register YYSTYPE *yyvsp;
668 int yyerrstatus; /* number of tokens to shift before error messages enabled */
669 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
671 short yyssa[YYINITDEPTH]; /* the state stack */
672 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
674 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
675 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
678 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
679 YYLTYPE *yyls = yylsa;
682 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
684 #define YYPOPSTACK (yyvsp--, yyssp--)
687 int yystacksize = YYINITDEPTH;
688 int yyfree_stacks = 0;
699 YYSTYPE yyval; /* the variable used to return */
700 /* semantic values from the action */
707 fprintf(stderr, "Starting parse\n");
713 yychar = YYEMPTY; /* Cause a token to be read. */
715 /* Initialize stack pointers.
716 Waste one element of value and location stack
717 so that they stay on the same level as the state stack.
718 The wasted elements are never initialized. */
726 /* Push a new state, which is found in yystate . */
727 /* In all cases, when you get here, the value and location stacks
728 have just been pushed. so pushing a state here evens the stacks. */
733 if (yyssp >= yyss + yystacksize - 1)
735 /* Give user a chance to reallocate the stack */
736 /* Use copies of these so that the &'s don't force the real ones into memory. */
737 YYSTYPE *yyvs1 = yyvs;
740 YYLTYPE *yyls1 = yyls;
743 /* Get the current used size of the three stacks, in elements. */
744 int size = yyssp - yyss + 1;
747 /* Each stack pointer address is followed by the size of
748 the data in use in that stack, in bytes. */
750 /* This used to be a conditional around just the two extra args,
751 but that might be undefined if yyoverflow is a macro. */
752 yyoverflow("parser stack overflow",
753 &yyss1, size * sizeof (*yyssp),
754 &yyvs1, size * sizeof (*yyvsp),
755 &yyls1, size * sizeof (*yylsp),
758 yyoverflow("parser stack overflow",
759 &yyss1, size * sizeof (*yyssp),
760 &yyvs1, size * sizeof (*yyvsp),
764 yyss = yyss1; yyvs = yyvs1;
768 #else /* no yyoverflow */
769 /* Extend the stack our own way. */
770 if (yystacksize >= YYMAXDEPTH)
772 yyerror("parser stack overflow");
784 if (yystacksize > YYMAXDEPTH)
785 yystacksize = YYMAXDEPTH;
786 #ifndef YYSTACK_USE_ALLOCA
789 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
790 __yy_memcpy ((char *)yyss, (char *)yyss1,
791 size * (unsigned int) sizeof (*yyssp));
792 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
793 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
794 size * (unsigned int) sizeof (*yyvsp));
796 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
797 __yy_memcpy ((char *)yyls, (char *)yyls1,
798 size * (unsigned int) sizeof (*yylsp));
800 #endif /* no yyoverflow */
802 yyssp = yyss + size - 1;
803 yyvsp = yyvs + size - 1;
805 yylsp = yyls + size - 1;
810 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
813 if (yyssp >= yyss + yystacksize - 1)
819 fprintf(stderr, "Entering state %d\n", yystate);
825 /* Do appropriate processing given the current state. */
826 /* Read a lookahead token if we need one and don't already have one. */
829 /* First try to decide what to do without reference to lookahead token. */
831 yyn = yypact[yystate];
835 /* Not known => get a lookahead token if don't already have one. */
837 /* yychar is either YYEMPTY or YYEOF
838 or a valid token in external form. */
840 if (yychar == YYEMPTY)
844 fprintf(stderr, "Reading a token: ");
849 /* Convert token to internal form (in yychar1) for indexing tables with */
851 if (yychar <= 0) /* This means end of input. */
854 yychar = YYEOF; /* Don't call YYLEX any more */
858 fprintf(stderr, "Now at end of input.\n");
863 yychar1 = YYTRANSLATE(yychar);
868 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
869 /* Give the individual parser a way to print the precise meaning
870 of a token, for further debugging info. */
872 YYPRINT (stderr, yychar, yylval);
874 fprintf (stderr, ")\n");
880 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
885 /* yyn is what to do for this token type in this state.
886 Negative => reduce, -yyn is rule number.
887 Positive => shift, yyn is new state.
888 New state is final state => don't bother to shift,
890 0, or most negative number => error. */
905 /* Shift the lookahead token. */
909 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
912 /* Discard the token being shifted unless it is eof. */
921 /* count tokens shifted since error; after three, turn off error status. */
922 if (yyerrstatus) yyerrstatus--;
927 /* Do the default action for the current state. */
930 yyn = yydefact[yystate];
934 /* Do a reduction. yyn is the number of a rule to reduce with. */
938 yyval = yyvsp[1-yylen]; /* implement default value of the action */
945 fprintf (stderr, "Reducing via rule %d (line %d), ",
948 /* Print the symbols being reduced, and their result. */
949 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
950 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
951 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
965 { mtreader_processDeclaration (yyvsp[-1].mtdecl); ;
968 { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ;
971 { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ;
974 { yyval.mtpieces = mtDeclarationPieces_create (); ;
977 { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ;
980 { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ;
983 { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ;
986 { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ;
989 { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ;
992 { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ;
995 { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ;
998 { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ;
1001 { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ;
1004 { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ;
1007 { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ;
1010 { yyval.mtcontext = yyvsp[0].mtcontext; ;
1013 { yyval.mtcontext = mtContextNode_createAny (); ;
1016 { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ;
1019 { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ;
1022 { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ;
1025 { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ;
1028 { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ;
1031 { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ;
1034 { yyval.ctyp = ctype_unknown; ;
1037 { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ;
1040 { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ;
1043 { yyval.qtyp = yyvsp[0].qtyp; ;
1046 { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ;
1049 { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ;
1052 { yyval.qtyp = qtype_unknown (); ;
1055 { yyval.qtyp = yyvsp[0].qtyp; ;
1058 { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ;
1061 { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ;
1064 { yyval.count = 1; ;
1067 { yyval.count = 1; ;
1070 { yyval.count = 1 + yyvsp[0].count; ;
1073 { yyval.count = 1 + yyvsp[0].count; ;
1076 { /* ignored for now */; ;
1088 { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ;
1091 { yyval.ctyp = ctype_makeArray (ctype_unknown); ;
1094 { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
1097 { yyval.ctyp = ctype_char; ;
1100 { yyval.ctyp = ctype_int; ;
1103 { yyval.ctyp = ctype_float; ;
1106 { yyval.ctyp = ctype_double; ;
1109 { yyval.ctyp = ctype_void; ;
1112 { yyval.ctyp = ctype_unknown; ;
1115 { yyval.ctyp = ctype_anyintegral; ;
1118 { yyval.ctyp = ctype_unsignedintegral; ;
1121 { yyval.ctyp = ctype_signedintegral; ;
1124 { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ;
1127 { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ;
1130 { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ;
1133 { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ;
1136 { yyval.tok = yyvsp[0].tok; ;
1139 { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ;
1142 { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ;
1145 { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ;
1148 { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ;
1151 { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ;
1154 { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ;
1157 { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ;
1160 { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ;
1163 { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ;
1166 { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ;
1169 { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ;
1172 { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ;
1175 { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ;
1178 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1181 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1184 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1187 { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ;
1190 { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ;
1193 { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ;
1196 { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1199 { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ;
1202 { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ;
1205 { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1208 { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ;
1211 { yyval.mttransferaction = yyvsp[0].mttransferaction; ;
1214 { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ;
1217 { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ;
1220 /* the action file gets copied in in place of this dollarsign */
1232 short *ssp1 = yyss - 1;
1233 fprintf (stderr, "state stack now");
1234 while (ssp1 != yyssp)
1235 fprintf (stderr, " %d", *++ssp1);
1236 fprintf (stderr, "\n");
1246 yylsp->first_line = yylloc.first_line;
1247 yylsp->first_column = yylloc.first_column;
1248 yylsp->last_line = (yylsp-1)->last_line;
1249 yylsp->last_column = (yylsp-1)->last_column;
1254 yylsp->last_line = (yylsp+yylen-1)->last_line;
1255 yylsp->last_column = (yylsp+yylen-1)->last_column;
1259 /* Now "shift" the result of the reduction.
1260 Determine what state that goes to,
1261 based on the state we popped back to
1262 and the rule number reduced by. */
1266 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1267 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1268 yystate = yytable[yystate];
1270 yystate = yydefgoto[yyn - YYNTBASE];
1274 yyerrlab: /* here on detecting error */
1277 /* If not already recovering from an error, report this error. */
1281 #ifdef YYERROR_VERBOSE
1282 yyn = yypact[yystate];
1284 if (yyn > YYFLAG && yyn < YYLAST)
1291 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1292 for (x = (yyn < 0 ? -yyn : 0);
1293 x < (sizeof(yytname) / sizeof(char *)); x++)
1294 if (yycheck[x + yyn] == x)
1295 size += strlen(yytname[x]) + 15, count++;
1296 msg = (char *) malloc(size + 15);
1299 strcpy(msg, "parse error");
1304 for (x = (yyn < 0 ? -yyn : 0);
1305 x < (sizeof(yytname) / sizeof(char *)); x++)
1306 if (yycheck[x + yyn] == x)
1308 strcat(msg, count == 0 ? ", expecting `" : " or `");
1309 strcat(msg, yytname[x]);
1318 yyerror ("parse error; also virtual memory exceeded");
1321 #endif /* YYERROR_VERBOSE */
1322 yyerror("parse error");
1326 yyerrlab1: /* here on error raised explicitly by an action */
1328 if (yyerrstatus == 3)
1330 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1332 /* return failure if at end of input */
1333 if (yychar == YYEOF)
1338 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1344 /* Else will try to reuse lookahead token
1345 after shifting the error token. */
1347 yyerrstatus = 3; /* Each real token shifted decrements this */
1351 yyerrdefault: /* current state does not do anything special for the error token. */
1354 /* This is wrong; only states that explicitly want error tokens
1355 should shift them. */
1356 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1357 if (yyn) goto yydefault;
1360 yyerrpop: /* pop the current state because it cannot handle the error token */
1362 if (yyssp == yyss) YYABORT;
1372 short *ssp1 = yyss - 1;
1373 fprintf (stderr, "Error: state stack now");
1374 while (ssp1 != yyssp)
1375 fprintf (stderr, " %d", *++ssp1);
1376 fprintf (stderr, "\n");
1382 yyn = yypact[yystate];
1387 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1406 fprintf(stderr, "Shifting error token, ");
1418 /* YYACCEPT comes here. */
1430 /* YYABORT comes here. */
1443 # include "bison.reset"
1445 extern char *yytext;
1447 static void mterror (char *s)
1453 (message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
1458 (message ("Parse error in meta-state file"));
1463 static void yyprint (FILE *file, int type, YYSTYPE value)
1465 cstring tname = mttok_unparse (value.tok);
1466 fprintf (file, " (%s)", cstring_toCharsSafe (tname));
1467 cstring_free (tname);
1474 ** Resets all flags in bison.head
1496 /*@=evalorderuncon@*/
1505 /*@=elseifcomplete@*/
1509 /*@=readonlytrans@*/
1512 /*@=systemunrecog@*/
1513 /*@=dependenttrans@*/
1514 /*@=unqualifiedtrans@*/
1518 /*drl added 11/27/2001*/