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
57 #define YYBISON 1 /* Identify Bison output. */
59 #define yyparse mtparse
61 #define yyerror mterror
64 #define yydebug mtdebug
65 #define yynerrs mtnerrs
66 # define MT_BADTOK 257
69 # define MT_GLOBAL 260
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
76 # define MT_RESULT 267
77 # define MT_CLAUSE 268
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
92 # define MT_LPAREN 283
93 # define MT_RPAREN 284
94 # define MT_LBRACKET 285
95 # define MT_RBRACKET 286
96 # define MT_LBRACE 287
97 # define MT_RBRACE 288
101 # define MT_FLOAT 292
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
108 # define MT_CONST 299
109 # define MT_VOLATILE 300
110 # define MT_STRINGLIT 301
111 # define MT_IDENT 302
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 /*@noreturn@*/ void mterror (char *);
130 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
131 extern int mtlex () ;
132 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
135 # define YYPRINT(file, type, value) yyprint (file, type, value)
139 # include "bison.head"
144 mtDeclarationNode mtdecl;
145 mtDeclarationPiece mtpiece;
146 mtDeclarationPieces mtpieces;
147 mtContextNode mtcontext;
148 mtValuesNode mtvalues;
149 mtDefaultsNode mtdefaults;
150 mtDefaultsDeclList mtdeflist;
151 mtAnnotationsNode mtannotations;
152 mtAnnotationList mtannotlist;
153 mtAnnotationDecl mtannotdecl;
155 mtMergeItem mtmergeitem;
156 mtMergeClauseList mtmergeclauselist;
157 mtMergeClause mtmergeclause;
158 mtTransferClauseList mttransferclauselist;
159 mtTransferClause mttransferclause;
160 mtTransferAction mttransferaction;
161 mtLoseReferenceList mtlosereferencelist;
162 mtLoseReference mtlosereference;
164 /*@only@*/ cstringList cstringlist;
166 /*@only@*/ qtype qtyp;
178 #define YYFLAG -32768
181 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
182 #define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 92)
184 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
185 static const char yytranslate[] =
187 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
213 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
214 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
215 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
216 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
221 static const short yyprhs[] =
223 0, 0, 1, 3, 7, 12, 15, 16, 19, 21,
224 23, 25, 27, 29, 31, 33, 35, 37, 39, 42,
225 43, 45, 48, 51, 54, 57, 60, 63, 64, 66,
226 68, 71, 73, 77, 80, 81, 83, 85, 87, 90,
227 92, 95, 98, 102, 104, 106, 108, 111, 115, 118,
228 122, 124, 126, 128, 130, 132, 134, 136, 138, 140,
229 142, 144, 147, 149, 153, 156, 159, 163, 168, 171,
230 173, 176, 181, 184, 186, 189, 195, 197, 199, 202,
231 205, 208, 211, 213, 216, 220, 222, 225, 231, 233,
234 static const short yyrhs[] =
236 -1, 50, 0, 5, 51, 4, 0, 6, 5, 51,
237 4, 0, 48, 52, 0, 0, 53, 52, 0, 54,
238 0, 69, 0, 72, 0, 71, 0, 74, 0, 77,
239 0, 83, 0, 81, 0, 82, 0, 84, 0, 7,
240 56, 0, 0, 56, 0, 12, 57, 0, 11, 57,
241 0, 13, 57, 0, 14, 57, 0, 15, 57, 0,
242 16, 57, 0, 0, 58, 0, 59, 0, 59, 62,
243 0, 60, 0, 59, 28, 58, 0, 67, 61, 0,
244 0, 59, 0, 63, 0, 66, 0, 63, 66, 0,
245 27, 0, 27, 65, 0, 27, 63, 0, 27, 65,
246 63, 0, 45, 0, 46, 0, 64, 0, 65, 64,
247 0, 29, 62, 30, 0, 31, 32, 0, 66, 31,
248 32, 0, 36, 0, 37, 0, 38, 0, 39, 0,
249 40, 0, 41, 0, 42, 0, 43, 0, 44, 0,
250 68, 0, 48, 0, 8, 70, 0, 48, 0, 48,
251 35, 70, 0, 10, 91, 0, 9, 73, 0, 56,
252 18, 91, 0, 56, 18, 91, 73, 0, 17, 75,
253 0, 76, 0, 76, 75, 0, 48, 55, 18, 91,
254 0, 19, 78, 0, 79, 0, 79, 78, 0, 80,
255 26, 80, 18, 89, 0, 91, 0, 27, 0, 21,
256 87, 0, 22, 87, 0, 20, 87, 0, 23, 85,
257 0, 86, 0, 86, 85, 0, 91, 18, 90, 0,
258 88, 0, 88, 87, 0, 91, 24, 91, 18, 89,
259 0, 91, 0, 90, 0, 25, 0, 25, 47, 0,
266 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
267 static const short yyrline[] =
269 0, 158, 159, 162, 164, 168, 172, 173, 177, 178,
270 179, 180, 181, 182, 183, 184, 185, 186, 189, 193,
271 194, 197, 198, 199, 200, 201, 202, 209, 210, 213,
272 214, 217, 218, 222, 225, 226, 230, 231, 232, 235,
273 236, 237, 238, 241, 242, 245, 246, 249, 250, 251,
274 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
275 273, 276, 279, 280, 284, 287, 290, 292, 296, 299,
276 300, 304, 308, 311, 312, 315, 319, 320, 323, 326,
277 329, 332, 335, 336, 339, 342, 343, 346, 350, 351,
283 #if YYDEBUG != 0 || defined YYERROR_VERBOSE
285 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
286 static const char *const yytname[] =
288 "$", "error", "$undefined.", "MT_BADTOK", "MT_END", "MT_STATE",
289 "MT_GLOBAL", "MT_CONTEXT", "MT_ONEOF", "MT_DEFAULTS", "MT_DEFAULT",
290 "MT_REFERENCE", "MT_PARAMETER", "MT_RESULT", "MT_CLAUSE", "MT_LITERAL",
291 "MT_NULL", "MT_ANNOTATIONS", "MT_ARROW", "MT_MERGE", "MT_TRANSFERS",
292 "MT_PRECONDITIONS", "MT_POSTCONDITIONS", "MT_LOSEREFERENCE", "MT_AS",
293 "MT_ERROR", "MT_PLUS", "MT_STAR", "MT_BAR", "MT_LPAREN", "MT_RPAREN",
294 "MT_LBRACKET", "MT_RBRACKET", "MT_LBRACE", "MT_RBRACE", "MT_COMMA",
295 "MT_CHAR", "MT_INT", "MT_FLOAT", "MT_DOUBLE", "MT_VOID", "MT_ANYTYPE",
296 "MT_INTEGRALTYPE", "MT_UNSIGNEDINTEGRALTYPE", "MT_SIGNEDINTEGRALTYPE",
297 "MT_CONST", "MT_VOLATILE", "MT_STRINGLIT", "MT_IDENT", "file",
298 "mtsDeclaration", "declarationNode", "declarationPieces",
299 "declarationPiece", "contextDeclaration", "optContextSelection",
300 "contextSelection", "optType", "typeExpression", "completeType",
301 "completeTypeAux", "optCompleteType", "abstractDecl", "pointers",
302 "innerMods", "innerModsList", "abstractDeclBase", "typeSpecifier",
303 "typeName", "valuesDeclaration", "valuesList", "defaultNode",
304 "defaultsDeclaration", "defaultDeclarationList",
305 "annotationsDeclaration", "annotationsDeclarationList",
306 "annotationDeclaration", "mergeDeclaration", "mergeClauses",
307 "mergeClause", "mergeItem", "preconditionsDeclaration",
308 "postconditionsDeclaration", "transfersDeclaration",
309 "loseReferenceDeclaration", "lostClauses", "lostClause",
310 "transferClauses", "transferClause", "transferAction", "errorAction",
315 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
316 static const short yyr1[] =
318 0, 49, 49, 50, 50, 51, 52, 52, 53, 53,
319 53, 53, 53, 53, 53, 53, 53, 53, 54, 55,
320 55, 56, 56, 56, 56, 56, 56, 57, 57, 58,
321 58, 59, 59, 60, 61, 61, 62, 62, 62, 63,
322 63, 63, 63, 64, 64, 65, 65, 66, 66, 66,
323 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
324 68, 69, 70, 70, 71, 72, 73, 73, 74, 75,
325 75, 76, 77, 78, 78, 79, 80, 80, 81, 82,
326 83, 84, 85, 85, 86, 87, 87, 88, 89, 89,
330 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
331 static const short yyr2[] =
333 0, 0, 1, 3, 4, 2, 0, 2, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
335 1, 2, 2, 2, 2, 2, 2, 0, 1, 1,
336 2, 1, 3, 2, 0, 1, 1, 1, 2, 1,
337 2, 2, 3, 1, 1, 1, 2, 3, 2, 3,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 2, 1, 3, 2, 2, 3, 4, 2, 1,
340 2, 4, 2, 1, 2, 5, 1, 1, 2, 2,
341 2, 2, 1, 2, 3, 1, 2, 5, 1, 1,
345 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
346 doesn't specify something else to do. Zero means the default is an
348 static const short yydefact[] =
350 1, 0, 0, 2, 6, 0, 0, 0, 0, 0,
351 0, 0, 0, 0, 0, 0, 0, 5, 6, 8,
352 9, 11, 10, 12, 13, 15, 16, 14, 17, 3,
353 0, 27, 27, 27, 27, 27, 27, 18, 62, 61,
354 0, 65, 92, 64, 19, 68, 69, 77, 72, 73,
355 0, 76, 80, 85, 0, 78, 79, 81, 82, 0,
356 7, 4, 50, 51, 52, 53, 54, 55, 56, 57,
357 58, 60, 22, 28, 29, 31, 34, 59, 21, 23,
358 24, 25, 26, 0, 0, 0, 20, 70, 74, 0,
359 86, 0, 83, 0, 39, 0, 0, 0, 30, 36,
360 37, 35, 33, 63, 66, 0, 0, 0, 90, 84,
361 43, 44, 41, 45, 40, 32, 0, 48, 38, 0,
362 67, 71, 0, 0, 91, 42, 46, 47, 49, 75,
366 static const short yydefgoto[] =
368 133, 3, 5, 17, 18, 19, 85, 40, 72, 73,
369 74, 75, 102, 98, 99, 113, 114, 100, 76, 77,
370 20, 39, 21, 22, 41, 23, 45, 46, 24, 48,
371 49, 50, 25, 26, 27, 28, 57, 58, 52, 53,
375 static const short yypact[] =
377 4, -37, 35,-32768, 36, 37, -37, 21, 2, 21,
378 17, 18, -19, 17, 17, 17, 17,-32768, 36,-32768,
379 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
380 63, -23, -23, -23, -23, -23, -23,-32768, 33,-32768,
381 51,-32768,-32768,-32768, 21,-32768, 18,-32768,-32768, -19,
382 44,-32768,-32768, 17, 47,-32768,-32768,-32768, 17, 54,
383 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
384 -32768,-32768,-32768,-32768, -5,-32768, -23,-32768,-32768,-32768,
385 -32768,-32768,-32768, 2, 17, 55,-32768,-32768,-32768, -19,
386 -32768, 17,-32768, 50, -15, -23, 20, 45,-32768, 23,
387 49, 48,-32768,-32768, 21, 17, 60, 64, 38,-32768,
388 -32768,-32768,-32768,-32768, -15,-32768, 53,-32768, 49, 52,
389 -32768,-32768, -20, -20,-32768,-32768,-32768,-32768,-32768,-32768,
390 -32768,-32768,-32768, 86, 87,-32768
393 static const short yypgoto[] =
395 -32768,-32768, 82, 71,-32768,-32768,-32768, -6, 28, -4,
396 14,-32768,-32768, -3, -87, -22,-32768, -2,-32768,-32768,
397 -32768, 11,-32768,-32768, -8,-32768, 56,-32768,-32768, 57,
398 -32768, 9,-32768,-32768,-32768,-32768, 41,-32768, -11,-32768,
406 static const short yytable[] =
408 43, 37, 51, 55, 56, 108, 59, 112, 47, 1,
409 2, 4, 94, 62, 63, 64, 65, 66, 67, 68,
410 69, 70, 94, 95, 96, 71, 97, 125, 42, 42,
411 110, 111, 31, 32, 33, 34, 35, 36, 86, 51,
412 6, 29, 90, 7, 8, 9, 10, 94, 59, 96,
413 38, 97, 96, 11, 97, 12, 13, 14, 15, 16,
414 78, 79, 80, 81, 82, 42, 44, 61, 83, 84,
415 89, 91, 93, 105, 104, 108, 95, 117, 122, 51,
416 119, 107, 123, 127, 128, 124, 134, 135, 30, 60,
417 101, 115, 126, 116, 103, 121, 120, 118, 106, 92,
418 109, 0, 87, 0, 0, 132, 88, 0, 0, 0,
422 static const short yycheck[] =
424 10, 7, 12, 14, 15, 25, 16, 94, 27, 5,
425 6, 48, 27, 36, 37, 38, 39, 40, 41, 42,
426 43, 44, 27, 28, 29, 48, 31, 114, 48, 48,
427 45, 46, 11, 12, 13, 14, 15, 16, 44, 49,
428 5, 4, 53, 7, 8, 9, 10, 27, 58, 29,
429 48, 31, 29, 17, 31, 19, 20, 21, 22, 23,
430 32, 33, 34, 35, 36, 48, 48, 4, 35, 18,
431 26, 24, 18, 18, 84, 25, 28, 32, 18, 89,
432 31, 91, 18, 30, 32, 47, 0, 0, 6, 18,
433 76, 95, 114, 96, 83, 105, 104, 99, 89, 58,
434 93, -1, 46, -1, -1, 123, 49, -1, -1, -1,
439 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
441 /* Skeleton output parser for bison,
442 Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
444 This program is free software; you can redistribute it and/or modify
445 it under the terms of the GNU General Public License as published by
446 the Free Software Foundation; either version 2, or (at your option)
449 This program is distributed in the hope that it will be useful,
450 but WITHOUT ANY WARRANTY; without even the implied warranty of
451 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
452 GNU General Public License for more details.
454 You should have received a copy of the GNU General Public License
455 along with this program; if not, write to the Free Software
456 Foundation, Inc., 59 Temple Place - Suite 330,
457 Boston, MA 02111-1307, USA. */
459 /* As a special exception, when this file is copied by Bison into a
460 Bison output file, you may use that output file without restriction.
461 This special exception was added by the Free Software Foundation
462 in version 1.24 of Bison. */
464 /* This is the parser code that is written into each bison parser when
465 the %semantic_parser declaration is not specified in the grammar.
466 It was written by Richard Stallman by simplifying the hairy parser
467 used when %semantic_parser is specified. */
469 #ifndef YYSTACK_USE_ALLOCA
471 # define YYSTACK_USE_ALLOCA 1
472 # else /* alloca not defined */
474 # define YYSTACK_USE_ALLOCA 1
475 # define alloca __builtin_alloca
476 # else /* not GNU C. */
477 # if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
478 # define YYSTACK_USE_ALLOCA 1
480 # else /* not sparc */
481 /* We think this test detects Watcom and Microsoft C. */
482 /* This used to test MSDOS, but that is a bad idea since that
483 symbol is in the user namespace. */
484 # if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
486 /* No need for malloc.h, which pollutes the namespace; instead,
487 just don't use alloca. */
490 # else /* not MSDOS, or __TURBOC__ */
492 /* I don't know what this was needed for, but it pollutes the
493 namespace. So I turned it off. rms, 2 May 1997. */
494 /* #include <malloc.h> */
496 # define YYSTACK_USE_ALLOCA 1
497 # else /* not MSDOS, or __TURBOC__, or _AIX */
499 /* haible@ilog.fr says this works for HPUX 9.05 and up, and on
500 HPUX 10. Eventually we can turn this on. */
502 # define YYSTACK_USE_ALLOCA 1
503 # define alloca __builtin_alloca
506 # endif /* not _AIX */
507 # endif /* not MSDOS, or __TURBOC__ */
508 # endif /* not sparc */
509 # endif /* not GNU C */
510 # endif /* alloca not defined */
511 #endif /* YYSTACK_USE_ALLOCA not defined */
513 #ifndef YYSTACK_USE_ALLOCA
514 # define YYSTACK_USE_ALLOCA 0
517 #if YYSTACK_USE_ALLOCA
518 # define YYSTACK_ALLOC alloca
520 # define YYSTACK_ALLOC malloc
523 #define yyerrok (yyerrstatus = 0)
524 #define yyclearin (yychar = YYEMPTY)
527 #define YYACCEPT goto yyacceptlab
528 #define YYABORT goto yyabortlab
529 #define YYERROR goto yyerrlab1
530 /* Like YYERROR except do call yyerror. This remains here temporarily
531 to ease the transition to the new meaning of YYERROR, for GCC.
532 Once GCC version 2 has supplanted version 1, this can go. */
533 #define YYFAIL goto yyerrlab
534 #define YYRECOVERING() (!!yyerrstatus)
535 #define YYBACKUP(Token, Value) \
537 if (yychar == YYEMPTY && yylen == 1) \
541 yychar1 = YYTRANSLATE (yychar); \
547 yyerror ("syntax error: cannot back up"); \
553 #define YYERRCODE 256
556 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
559 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
560 first token. By default, to implement support for ranges, extend
561 its range to the last symbol. */
563 #ifndef YYLLOC_DEFAULT
564 # define YYLLOC_DEFAULT(Current, Rhs, N) \
565 Current.last_line = Rhs[N].last_line; \
566 Current.last_column = Rhs[N].last_column;
570 /* YYLEX -- calling `yylex' with the right arguments. */
575 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
577 # define YYLEX yylex (&yylval, &yylloc)
579 # else /* !YYLSP_NEEDED */
581 # define YYLEX yylex (&yylval, YYLEX_PARAM)
583 # define YYLEX yylex (&yylval)
585 # endif /* !YYLSP_NEEDED */
587 # define YYLEX yylex ()
591 /* Enable debugging if requested. */
593 # define YYDPRINTF(Args) \
598 /* Nonzero means print parse trace. [The following comment makes no
599 sense to me. Could someone clarify it? --akim] Since this is
600 uninitialized, it does not stop multiple parsers from coexisting.
604 # define YYDPRINTF(Args)
605 #endif /* !YYDEBUG */
607 /* YYINITDEPTH -- initial size of the parser's stacks. */
609 # define YYINITDEPTH 200
612 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
613 if the built-in stack extension method is used). */
619 # define YYMAXDEPTH 10000
622 /* Define __yy_memcpy. Note that the size argument
623 should be passed with type unsigned int, because that is what the non-GCC
624 definitions require. With GCC, __builtin_memcpy takes an arg
625 of type size_t, but it can handle unsigned int. */
627 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
628 # define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count)
629 #else /* not GNU C or C++ */
631 /* This is the most reliable way to avoid incompatibilities
632 in available built-in functions on various systems. */
635 __yy_memcpy (to, from, count)
639 # else /* __cplusplus */
640 __yy_memcpy (char *to, const char *from, unsigned int count)
643 register const char *f = from;
644 register char *t = to;
645 register int i = count;
655 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
656 into yyparse. The argument should have type void *.
657 It should actually point to an object.
658 Grammar actions can access the variable by casting it
659 to the proper pointer type. */
663 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
664 # define YYPARSE_PARAM_DECL
665 # else /* !__cplusplus */
666 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
667 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
668 # endif /* !__cplusplus */
669 #else /* !YYPARSE_PARAM */
670 # define YYPARSE_PARAM_ARG
671 # define YYPARSE_PARAM_DECL
672 #endif /* !YYPARSE_PARAM */
674 /* Prevent warning if -Wstrict-prototypes. */
676 # ifdef YYPARSE_PARAM
677 int yyparse (void *);
683 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
684 variables are global, or local to YYPARSE. */
686 #define _YY_DECL_VARIABLES \
687 /* The lookahead symbol. */ \
690 /* The semantic value of the lookahead symbol. */ \
693 /* Number of parse errors so far. */ \
697 # define YY_DECL_VARIABLES \
700 /* Location data for the lookahead symbol. */ \
703 # define YY_DECL_VARIABLES \
708 /* If nonreentrant, generate the variables here. */
715 yyparse (YYPARSE_PARAM_ARG)
718 /* If reentrant, generate the variables here. */
723 register int yystate;
725 /* Number of tokens to shift before error messages enabled. */
727 /* Lookahead token as an internal (translated) token number. */
730 /* Three stacks and their tools:
731 `yyss': related to states,
732 `yysv': related to semantic values,
733 `yyls': related to locations.
735 Refer to the stacks thru separate pointers, to allow yyoverflow
736 to reallocate them elsewhere. */
738 /* The state stack. */
739 short yyssa[YYINITDEPTH];
741 register short *yyssp;
743 /* The semantic value stack. */
744 YYSTYPE yyvsa[YYINITDEPTH];
745 YYSTYPE *yyvs = yyvsa;
746 register YYSTYPE *yyvsp;
749 /* The location stack. */
750 YYLTYPE yylsa[YYINITDEPTH];
751 YYLTYPE *yyls = yylsa;
756 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
758 # define YYPOPSTACK (yyvsp--, yyssp--)
761 int yystacksize = YYINITDEPTH;
762 int yyfree_stacks = 0;
765 /* The variables used to return semantic value and location from the
772 /* When reducing, the number of symbols on the RHS of the reduced
776 YYDPRINTF ((stderr, "Starting parse\n"));
781 yychar = YYEMPTY; /* Cause a token to be read. */
783 /* Initialize stack pointers.
784 Waste one element of value and location stack
785 so that they stay on the same level as the state stack.
786 The wasted elements are never initialized. */
795 /*------------------------------------------------------------.
796 | yynewstate -- Push a new state, which is found in yystate. |
797 `------------------------------------------------------------*/
799 /* In all cases, when you get here, the value and location stacks
800 have just been pushed. so pushing a state here evens the stacks.
807 if (yyssp >= yyss + yystacksize - 1)
809 /* Give user a chance to reallocate the stack. Use copies of
810 these so that the &'s don't force the real ones into memory.
812 YYSTYPE *yyvs1 = yyvs;
815 YYLTYPE *yyls1 = yyls;
818 /* Get the current used size of the three stacks, in elements. */
819 int size = yyssp - yyss + 1;
822 /* Each stack pointer address is followed by the size of the
823 data in use in that stack, in bytes. */
825 /* This used to be a conditional around just the two extra args,
826 but that might be undefined if yyoverflow is a macro. */
827 yyoverflow ("parser stack overflow",
828 &yyss1, size * sizeof (*yyssp),
829 &yyvs1, size * sizeof (*yyvsp),
830 &yyls1, size * sizeof (*yylsp),
833 yyoverflow ("parser stack overflow",
834 &yyss1, size * sizeof (*yyssp),
835 &yyvs1, size * sizeof (*yyvsp),
839 yyss = yyss1; yyvs = yyvs1;
843 #else /* no yyoverflow */
844 /* Extend the stack our own way. */
845 if (yystacksize >= YYMAXDEPTH)
847 yyerror ("parser stack overflow");
859 if (yystacksize > YYMAXDEPTH)
860 yystacksize = YYMAXDEPTH;
861 # if !YYSTACK_USE_ALLOCA
864 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
865 __yy_memcpy ((char *)yyss, (char *)yyss1,
866 size * (unsigned int) sizeof (*yyssp));
867 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
868 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
869 size * (unsigned int) sizeof (*yyvsp));
871 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
872 __yy_memcpy ((char *)yyls, (char *)yyls1,
873 size * (unsigned int) sizeof (*yylsp));
875 #endif /* no yyoverflow */
877 yyssp = yyss + size - 1;
878 yyvsp = yyvs + size - 1;
880 yylsp = yyls + size - 1;
883 YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize));
885 if (yyssp >= yyss + yystacksize - 1)
889 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
899 /* Do appropriate processing given the current state. */
900 /* Read a lookahead token if we need one and don't already have one. */
903 /* First try to decide what to do without reference to lookahead token. */
905 yyn = yypact[yystate];
909 /* Not known => get a lookahead token if don't already have one. */
911 /* yychar is either YYEMPTY or YYEOF
912 or a valid token in external form. */
914 if (yychar == YYEMPTY)
916 YYDPRINTF ((stderr, "Reading a token: "));
920 /* Convert token to internal form (in yychar1) for indexing tables with */
922 if (yychar <= 0) /* This means end of input. */
925 yychar = YYEOF; /* Don't call YYLEX any more */
927 YYDPRINTF ((stderr, "Now at end of input.\n"));
931 yychar1 = YYTRANSLATE (yychar);
934 /* We have to keep this `#if YYDEBUG', since we use variables
935 which are defined only if `YYDEBUG' is set. */
938 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
939 /* Give the individual parser a way to print the precise
940 meaning of a token, for further debugging info. */
942 YYPRINT (stderr, yychar, yylval);
944 fprintf (stderr, ")\n");
950 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
955 /* yyn is what to do for this token type in this state.
956 Negative => reduce, -yyn is rule number.
957 Positive => shift, yyn is new state.
958 New state is final state => don't bother to shift,
960 0, or most negative number => error. */
975 /* Shift the lookahead token. */
976 YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]));
978 /* Discard the token being shifted unless it is eof. */
987 /* Count tokens shifted since error; after three, turn off error
996 /*-----------------------------------------------------------.
997 | yydefault -- do the default action for the current state. |
998 `-----------------------------------------------------------*/
1000 yyn = yydefact[yystate];
1006 /*-----------------------------.
1007 | yyreduce -- Do a reduction. |
1008 `-----------------------------*/
1010 /* yyn is the number of a rule to reduce with. */
1013 /* If YYLEN is nonzero, implement the default value of the action:
1016 Otherwise, the following line sets YYVAL to the semantic value of
1017 the lookahead token. This behavior is undocumented and Bison
1018 users should not rely upon it. Assigning to YYVAL
1019 unconditionally makes the parser a bit smaller, and it avoids a
1020 GCC warning that YYVAL may be used uninitialized. */
1021 yyval = yyvsp[1-yylen];
1024 /* Similarly for the default location. Let the user run additional
1025 commands if for instance locations are ranges. */
1026 yyloc = yylsp[1-yylen];
1027 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1031 /* We have to keep this `#if YYDEBUG', since we use variables which
1032 are defined only if `YYDEBUG' is set. */
1037 fprintf (stderr, "Reducing via rule %d (line %d), ",
1040 /* Print the symbols being reduced, and their result. */
1041 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1042 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1043 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1056 { mtreader_processDeclaration (yyvsp[-1].mtdecl); ;
1059 { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ;
1062 { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ;
1065 { yyval.mtpieces = mtDeclarationPieces_create (); ;
1068 { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ;
1071 { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ;
1074 { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ;
1077 { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ;
1080 { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ;
1083 { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ;
1086 { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ;
1089 { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ;
1092 { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ;
1095 { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ;
1098 { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ;
1101 { yyval.mtcontext = yyvsp[0].mtcontext; ;
1104 { yyval.mtcontext = mtContextNode_createAny (); ;
1107 { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ;
1110 { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ;
1113 { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ;
1116 { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ;
1119 { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ;
1122 { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ;
1125 { yyval.ctyp = ctype_unknown; ;
1128 { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ;
1131 { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ;
1134 { yyval.qtyp = yyvsp[0].qtyp; ;
1137 { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ;
1140 { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ;
1143 { yyval.qtyp = qtype_unknown (); ;
1146 { yyval.qtyp = yyvsp[0].qtyp; ;
1149 { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ;
1152 { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ;
1155 { yyval.count = 1; ;
1158 { yyval.count = 1; ;
1161 { yyval.count = 1 + yyvsp[0].count; ;
1164 { yyval.count = 1 + yyvsp[0].count; ;
1167 { /* ignored for now */; ;
1179 { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ;
1182 { yyval.ctyp = ctype_makeArray (ctype_unknown); ;
1185 { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
1188 { yyval.ctyp = ctype_char; ;
1191 { yyval.ctyp = ctype_int; ;
1194 { yyval.ctyp = ctype_float; ;
1197 { yyval.ctyp = ctype_double; ;
1200 { yyval.ctyp = ctype_void; ;
1203 { yyval.ctyp = ctype_unknown; ;
1206 { yyval.ctyp = ctype_anyintegral; ;
1209 { yyval.ctyp = ctype_unsignedintegral; ;
1212 { yyval.ctyp = ctype_signedintegral; ;
1215 { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ;
1218 { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ;
1221 { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ;
1224 { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ;
1227 { yyval.tok = yyvsp[0].tok; ;
1230 { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ;
1233 { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ;
1236 { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ;
1239 { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ;
1242 { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ;
1245 { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ;
1248 { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ;
1251 { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ;
1254 { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ;
1257 { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ;
1260 { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ;
1263 { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ;
1266 { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ;
1269 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1272 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1275 { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ;
1278 { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ;
1281 { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ;
1284 { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ;
1287 { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1290 { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ;
1293 { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ;
1296 { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ;
1299 { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ;
1302 { yyval.mttransferaction = yyvsp[0].mttransferaction; ;
1305 { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ;
1308 { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ;
1323 short *ssp1 = yyss - 1;
1324 fprintf (stderr, "state stack now");
1325 while (ssp1 != yyssp)
1326 fprintf (stderr, " %d", *++ssp1);
1327 fprintf (stderr, "\n");
1336 /* Now `shift' the result of the reduction. Determine what state
1337 that goes to, based on the state we popped back to and the rule
1338 number reduced by. */
1342 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1343 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1344 yystate = yytable[yystate];
1346 yystate = yydefgoto[yyn - YYNTBASE];
1351 /*------------------------------------.
1352 | yyerrlab -- here on detecting error |
1353 `------------------------------------*/
1355 /* If not already recovering from an error, report this error. */
1360 #ifdef YYERROR_VERBOSE
1361 yyn = yypact[yystate];
1363 if (yyn > YYFLAG && yyn < YYLAST)
1370 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1371 for (x = (yyn < 0 ? -yyn : 0);
1372 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
1373 if (yycheck[x + yyn] == x)
1374 size += strlen (yytname[x]) + 15, count++;
1375 size += strlen ("parse error, unexpected `") + 1;
1376 size += strlen (yytname[YYTRANSLATE (yychar)]);
1377 msg = (char *) malloc (size);
1380 strcpy (msg, "parse error, unexpected `");
1381 strcat (msg, yytname[YYTRANSLATE (yychar)]);
1387 for (x = (yyn < 0 ? -yyn : 0);
1388 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
1389 if (yycheck[x + yyn] == x)
1391 strcat (msg, count == 0 ? ", expecting `" : " or `");
1392 strcat (msg, yytname[x]);
1401 yyerror ("parse error; also virtual memory exceeded");
1404 #endif /* YYERROR_VERBOSE */
1405 yyerror ("parse error");
1410 /*--------------------------------------------------.
1411 | yyerrlab1 -- error raised explicitly by an action |
1412 `--------------------------------------------------*/
1414 if (yyerrstatus == 3)
1416 /* If just tried and failed to reuse lookahead token after an
1417 error, discard it. */
1419 /* return failure if at end of input */
1420 if (yychar == YYEOF)
1422 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1423 yychar, yytname[yychar1]));
1427 /* Else will try to reuse lookahead token after shifting the error
1430 yyerrstatus = 3; /* Each real token shifted decrements this */
1435 /*-------------------------------------------------------------------.
1436 | yyerrdefault -- current state does not do anything special for the |
1438 `-------------------------------------------------------------------*/
1441 /* This is wrong; only states that explicitly want error tokens
1442 should shift them. */
1444 /* If its default is to accept any token, ok. Otherwise pop it. */
1445 yyn = yydefact[yystate];
1451 /*---------------------------------------------------------------.
1452 | yyerrpop -- pop the current state because it cannot handle the |
1454 `---------------------------------------------------------------*/
1467 short *ssp1 = yyss - 1;
1468 fprintf (stderr, "Error: state stack now");
1469 while (ssp1 != yyssp)
1470 fprintf (stderr, " %d", *++ssp1);
1471 fprintf (stderr, "\n");
1479 yyn = yypact[yystate];
1484 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1501 YYDPRINTF ((stderr, "Shifting error token, "));
1512 /*-------------------------------------.
1513 | yyacceptlab -- YYACCEPT comes here. |
1514 `-------------------------------------*/
1527 /*-----------------------------------.
1528 | yyabortlab -- YYABORT comes here. |
1529 `-----------------------------------*/
1543 # include "bison.reset"
1545 extern char *yytext;
1547 static void mterror (char *s)
1553 (message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
1558 (message ("Parse error in meta-state file"));
1563 static void yyprint (FILE *file, int type, YYSTYPE value)
1565 cstring tname = mttok_unparse (value.tok);
1566 fprintf (file, " (%s)", cstring_toCharsSafe (tname));
1567 cstring_free (tname);
1574 ** Resets all flags in bison.head
1596 /*@=evalorderuncon@*/
1605 /*@=elseifcomplete@*/
1609 /*@=readonlytrans@*/
1612 /*@=systemunrecog@*/
1613 /*@=dependenttrans@*/
1614 /*@=unqualifiedtrans@*/
1618 /*drl added 11/27/2001*/