2 ** Inserted at beginning of c files generated by bison
3 ** REMEMBER: Change bison.reset too.
42 /*@-unqualifiedtrans@*/
49 /*drl added 11/27/2001*/
52 /*drl added 12/11/2002*/
55 /* < end of bison.head > */
58 /* A Bison parser, made from signature.y
59 by GNU Bison version 1.28 */
61 #define YYBISON 1 /* Identify Bison output. */
63 #define yyparse lslparse
65 #define yyerror lslerror
66 #define yylval lsllval
67 #define yychar lslchar
68 #define yydebug lsldebug
69 #define yynerrs lslnerrs
70 #define LST_SIMPLEID 257
71 #define LST_LOGICALOP 258
73 #define LST_SIMPLEOP 260
74 #define LST_MAPSYM 261
75 #define LST_FIELDMAPSYM 262
76 #define LST_MARKERSYM 263
77 #define LST_ifTOKEN 264
78 #define LST_thenTOKEN 265
79 #define LST_elseTOKEN 266
80 #define LST_LBRACKET 267
81 #define LST_RBRACKET 268
82 #define LST_SELECTSYM 269
83 #define LST_SEPSYM 270
84 #define LST_OPENSYM 271
85 #define LST_CLOSESYM 272
89 #define LST_COMMENTSYM 276
90 #define LST_WHITESPACE 277
91 #define LST_QUANTIFIERSYM 278
92 #define LST_EQUATIONSYM 279
93 #define LST_EQSEPSYM 280
94 #define LST_COMPOSESYM 281
97 #define LST_assertsTOKEN 284
98 #define LST_assumesTOKEN 285
99 #define LST_byTOKEN 286
100 #define LST_convertsTOKEN 287
101 #define LST_enumerationTOKEN 288
102 #define LST_equationsTOKEN 289
103 #define LST_exemptingTOKEN 290
104 #define LST_forTOKEN 291
105 #define LST_generatedTOKEN 292
106 #define LST_impliesTOKEN 293
107 #define LST_includesTOKEN 294
108 #define LST_introducesTOKEN 295
109 #define LST_ofTOKEN 296
110 #define LST_partitionedTOKEN 297
111 #define LST_traitTOKEN 298
112 #define LST_tupleTOKEN 299
113 #define LST_unionTOKEN 300
114 #define LST_BADTOKEN 301
119 # include "splintMacros.nf"
120 # include "llbasic.h"
121 # include "lslparse.h"
122 # include "signature.h"
124 static void lslerror (char *);
125 extern int lsllex ();
127 /*@dependent@*/ /*@null@*/ lslOp importedlslOp;
129 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
130 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
133 # define YYPRINT(file, type, value) yyprint (file, type, value)
143 ltoken ltok; /* a leaf is also an ltoken */
145 /*@only@*/ ltokenList ltokenList;
146 /*@only@*/ opFormNode opform;
147 /*@owned@*/ sigNode signature;
148 /*@only@*/ nameNode name;
149 /*@owned@*/ lslOp operator;
150 /*@only@*/ lslOpList operators;
151 /*@-redef@*/ /*@-matchfields@*/
168 #define YYFLAG -32768
171 #define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 62)
173 static const char yytranslate[] = { 0,
174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
200 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
201 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
202 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
203 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
208 static const short yyprhs[] = { 0,
209 0, 2, 4, 7, 11, 13, 15, 22, 24, 27,
210 30, 34, 38, 43, 48, 54, 58, 63, 68, 74,
211 77, 81, 85, 87, 89, 91, 92, 94, 96, 100,
212 102, 104, 108, 109, 111, 113, 117, 119
215 static const short yyrhs[] = { 49,
216 0, 50, 0, 49, 50, 0, 51, 19, 57, 0,
217 61, 0, 52, 0, 10, 9, 11, 9, 12, 9,
218 0, 53, 0, 9, 53, 0, 53, 9, 0, 9,
219 53, 9, 0, 17, 54, 18, 0, 9, 17, 54,
220 18, 0, 17, 54, 18, 9, 0, 9, 17, 54,
221 18, 9, 0, 13, 54, 14, 0, 9, 13, 54,
222 14, 0, 13, 54, 14, 9, 0, 9, 13, 54,
223 14, 9, 0, 15, 3, 0, 9, 15, 3, 0,
224 9, 8, 3, 0, 6, 0, 4, 0, 5, 0,
225 0, 55, 0, 9, 0, 55, 56, 9, 0, 20,
226 0, 16, 0, 58, 7, 60, 0, 0, 59, 0,
227 60, 0, 59, 20, 60, 0, 3, 0, 3, 0
233 static const short yyrline[] = { 0,
234 139, 142, 147, 152, 159, 161, 166, 168, 170, 172,
235 174, 176, 178, 180, 182, 185, 188, 191, 194, 197,
236 200, 205, 210, 212, 214, 218, 220, 224, 226, 230,
237 232, 236, 240, 242, 246, 248, 252, 259
242 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
244 static const char * const yytname[] = { "$","error","$undefined.","LST_SIMPLEID",
245 "LST_LOGICALOP","LST_EQOP","LST_SIMPLEOP","LST_MAPSYM","LST_FIELDMAPSYM","LST_MARKERSYM",
246 "LST_ifTOKEN","LST_thenTOKEN","LST_elseTOKEN","LST_LBRACKET","LST_RBRACKET",
247 "LST_SELECTSYM","LST_SEPSYM","LST_OPENSYM","LST_CLOSESYM","LST_COLON","LST_COMMA",
248 "LST_EOL","LST_COMMENTSYM","LST_WHITESPACE","LST_QUANTIFIERSYM","LST_EQUATIONSYM",
249 "LST_EQSEPSYM","LST_COMPOSESYM","LST_LPAR","LST_RPAR","LST_assertsTOKEN","LST_assumesTOKEN",
250 "LST_byTOKEN","LST_convertsTOKEN","LST_enumerationTOKEN","LST_equationsTOKEN",
251 "LST_exemptingTOKEN","LST_forTOKEN","LST_generatedTOKEN","LST_impliesTOKEN",
252 "LST_includesTOKEN","LST_introducesTOKEN","LST_ofTOKEN","LST_partitionedTOKEN",
253 "LST_traitTOKEN","LST_tupleTOKEN","LST_unionTOKEN","LST_BADTOKEN","top","operatorList",
254 "operator","name","opForm","anyOp","middle","placeList","separator","signature",
255 "domain","sortList","sortId","opId", NULL
259 static const short yyr1[] = { 0,
260 48, 49, 49, 50, 51, 51, 52, 52, 52, 52,
261 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
262 52, 52, 53, 53, 53, 54, 54, 55, 55, 56,
263 56, 57, 58, 58, 59, 59, 60, 61
266 static const short yyr2[] = { 0,
267 1, 1, 2, 3, 1, 1, 6, 1, 2, 2,
268 3, 3, 4, 4, 5, 3, 4, 4, 5, 2,
269 3, 3, 1, 1, 1, 0, 1, 1, 3, 1,
270 1, 3, 0, 1, 1, 3, 1, 1
273 static const short yydefact[] = { 0,
274 38, 24, 25, 23, 0, 0, 26, 0, 26, 1,
275 2, 0, 6, 8, 5, 0, 26, 0, 26, 9,
276 0, 28, 0, 27, 20, 0, 3, 33, 10, 22,
277 0, 21, 0, 11, 0, 16, 31, 30, 0, 12,
278 37, 4, 0, 34, 35, 17, 13, 0, 18, 29,
279 14, 0, 0, 19, 15, 0, 32, 36, 7, 0,
283 static const short yydefgoto[] = { 60,
284 10, 11, 12, 13, 14, 23, 24, 39, 42, 43,
288 static const short yypact[] = { -3,
289 -32768,-32768,-32768,-32768, 11, -4, 0, 8, 0, -3,
290 -32768, -1,-32768, 13,-32768, 17, 0, 22, 0, 18,
291 20,-32768, 19, -12,-32768, 14,-32768, 31,-32768,-32768,
292 21,-32768, 23,-32768, 27, 28,-32768,-32768, 29, 30,
293 -32768,-32768, 33, 24,-32768, 34, 36, 35,-32768,-32768,
294 -32768, 31, 31,-32768,-32768, 37,-32768,-32768,-32768, 42,
298 static const short yypgoto[] = {-32768,
299 -32768, 39,-32768,-32768, 45, 4,-32768,-32768,-32768,-32768,
307 static const short yytable[] = { 1,
308 2, 3, 4, 37, 21, 5, 6, 38, 22, 7,
309 25, 8, 26, 9, 2, 3, 4, 28, 16, 30,
310 31, 29, 33, 17, 32, 18, 34, 19, 57, 58,
311 35, 40, 36, 41, 46, 48, 49, 50, 51, 52,
312 47, 61, 54, 53, 55, 59, 56, 62, 27, 20
315 static const short yycheck[] = { 3,
316 4, 5, 6, 16, 9, 9, 10, 20, 9, 13,
317 3, 15, 9, 17, 4, 5, 6, 19, 8, 3,
318 17, 9, 19, 13, 3, 15, 9, 17, 52, 53,
319 11, 18, 14, 3, 14, 9, 9, 9, 9, 7,
320 18, 0, 9, 20, 9, 9, 12, 0, 10, 5
324 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
326 /* This file comes from bison-1.28. */
328 /* Skeleton output parser for bison,
329 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
331 This program is free software; you can redistribute it and/or modify
332 it under the terms of the GNU General Public License as published by
333 the Free Software Foundation; either version 2, or (at your option)
336 This program is distributed in the hope that it will be useful,
337 but WITHOUT ANY WARRANTY; without even the implied warranty of
338 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
339 GNU General Public License for more details.
341 You should have received a copy of the GNU General Public License
342 along with this program; if not, write to the Free Software
343 Foundation, Inc., 59 Temple Place - Suite 330,
344 Boston, MA 02111-1307, USA. */
346 /* As a special exception, when this file is copied by Bison into a
347 Bison output file, you may use that output file without restriction.
348 This special exception was added by the Free Software Foundation
349 in version 1.24 of Bison. */
351 /* This is the parser code that is written into each bison parser
352 when the %semantic_parser declaration is not specified in the grammar.
353 It was written by Richard Stallman by simplifying the hairy parser
354 used when %semantic_parser is specified. */
356 #ifndef YYSTACK_USE_ALLOCA
358 #define YYSTACK_USE_ALLOCA
359 #else /* alloca not defined */
361 #define YYSTACK_USE_ALLOCA
362 #define alloca __builtin_alloca
363 #else /* not GNU C. */
364 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
365 #define YYSTACK_USE_ALLOCA
367 #else /* not sparc */
368 /* We think this test detects Watcom and Microsoft C. */
369 /* This used to test MSDOS, but that is a bad idea
370 since that symbol is in the user namespace. */
371 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
372 #if 0 /* No need for malloc.h, which pollutes the namespace;
373 instead, just don't use alloca. */
376 #else /* not MSDOS, or __TURBOC__ */
378 /* I don't know what this was needed for, but it pollutes the namespace.
379 So I turned it off. rms, 2 May 1997. */
380 /* #include <malloc.h> */
382 #define YYSTACK_USE_ALLOCA
383 #else /* not MSDOS, or __TURBOC__, or _AIX */
385 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
386 and on HPUX 10. Eventually we can turn this on. */
387 #define YYSTACK_USE_ALLOCA
388 #define alloca __builtin_alloca
391 #endif /* not _AIX */
392 #endif /* not MSDOS, or __TURBOC__ */
393 #endif /* not sparc */
394 #endif /* not GNU C */
395 #endif /* alloca not defined */
396 #endif /* YYSTACK_USE_ALLOCA not defined */
398 #ifdef YYSTACK_USE_ALLOCA
399 #define YYSTACK_ALLOC alloca
401 #define YYSTACK_ALLOC malloc
404 /* Note: there must be only one dollar sign in this file.
405 It is replaced by the list of actions, each action
406 as one case of the switch. */
408 #define yyerrok (yyerrstatus = 0)
409 #define yyclearin (yychar = YYEMPTY)
412 #define YYACCEPT goto yyacceptlab
413 #define YYABORT goto yyabortlab
414 #define YYERROR goto yyerrlab1
415 /* Like YYERROR except do call yyerror.
416 This remains here temporarily to ease the
417 transition to the new meaning of YYERROR, for GCC.
418 Once GCC version 2 has supplanted version 1, this can go. */
419 #define YYFAIL goto yyerrlab
420 #define YYRECOVERING() (!!yyerrstatus)
421 #define YYBACKUP(token, value) \
423 if (yychar == YYEMPTY && yylen == 1) \
424 { yychar = (token), yylval = (value); \
425 yychar1 = YYTRANSLATE (yychar); \
430 { yyerror ("syntax error: cannot back up"); YYERROR; } \
434 #define YYERRCODE 256
437 #define YYLEX yylex()
443 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
445 #define YYLEX yylex(&yylval, &yylloc)
447 #else /* not YYLSP_NEEDED */
449 #define YYLEX yylex(&yylval, YYLEX_PARAM)
451 #define YYLEX yylex(&yylval)
453 #endif /* not YYLSP_NEEDED */
456 /* If nonreentrant, generate the variables here */
460 int yychar; /* the lookahead symbol */
461 YYSTYPE yylval; /* the semantic value of the */
462 /* lookahead symbol */
465 YYLTYPE yylloc; /* location data for the lookahead */
469 int yynerrs; /* number of parse errors so far */
470 #endif /* not YYPURE */
473 int yydebug; /* nonzero means print parse trace */
474 /* Since this is uninitialized, it does not stop multiple parsers
478 /* YYINITDEPTH indicates the initial size of the parser's stacks */
481 #define YYINITDEPTH 200
484 /* YYMAXDEPTH is the maximum size the stacks can grow to
485 (effective only if the built-in stack extension method is used). */
492 #define YYMAXDEPTH 10000
495 /* Define __yy_memcpy. Note that the size argument
496 should be passed with type unsigned int, because that is what the non-GCC
497 definitions require. With GCC, __builtin_memcpy takes an arg
498 of type size_t, but it can handle unsigned int. */
500 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
501 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
502 #else /* not GNU C or C++ */
505 /* This is the most reliable way to avoid incompatibilities
506 in available built-in functions on various systems. */
508 __yy_memcpy (to, from, count)
513 register char *f = from;
514 register char *t = to;
515 register int i = count;
521 #else /* __cplusplus */
523 /* This is the most reliable way to avoid incompatibilities
524 in available built-in functions on various systems. */
526 __yy_memcpy (char *to, char *from, unsigned int count)
528 register char *t = to;
529 register char *f = from;
530 register int i = count;
541 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
542 into yyparse. The argument should have type void *.
543 It should actually point to an object.
544 Grammar actions can access the variable by casting it
545 to the proper pointer type. */
549 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
550 #define YYPARSE_PARAM_DECL
551 #else /* not __cplusplus */
552 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
553 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
554 #endif /* not __cplusplus */
555 #else /* not YYPARSE_PARAM */
556 #define YYPARSE_PARAM_ARG
557 #define YYPARSE_PARAM_DECL
558 #endif /* not YYPARSE_PARAM */
560 /* Prevent warning if -Wstrict-prototypes. */
563 int yyparse (void *);
570 yyparse(YYPARSE_PARAM_ARG)
573 register int yystate;
575 register short *yyssp;
576 register YYSTYPE *yyvsp;
577 int yyerrstatus; /* number of tokens to shift before error messages enabled */
578 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
580 short yyssa[YYINITDEPTH]; /* the state stack */
581 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
583 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
584 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
587 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
588 YYLTYPE *yyls = yylsa;
591 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
593 #define YYPOPSTACK (yyvsp--, yyssp--)
596 int yystacksize = YYINITDEPTH;
597 int yyfree_stacks = 0;
608 YYSTYPE yyval; /* the variable used to return */
609 /* semantic values from the action */
616 fprintf(stderr, "Starting parse\n");
622 yychar = YYEMPTY; /* Cause a token to be read. */
624 /* Initialize stack pointers.
625 Waste one element of value and location stack
626 so that they stay on the same level as the state stack.
627 The wasted elements are never initialized. */
635 /* Push a new state, which is found in yystate . */
636 /* In all cases, when you get here, the value and location stacks
637 have just been pushed. so pushing a state here evens the stacks. */
642 if (yyssp >= yyss + yystacksize - 1)
644 /* Give user a chance to reallocate the stack */
645 /* Use copies of these so that the &'s don't force the real ones into memory. */
646 YYSTYPE *yyvs1 = yyvs;
649 YYLTYPE *yyls1 = yyls;
652 /* Get the current used size of the three stacks, in elements. */
653 int size = yyssp - yyss + 1;
656 /* Each stack pointer address is followed by the size of
657 the data in use in that stack, in bytes. */
659 /* This used to be a conditional around just the two extra args,
660 but that might be undefined if yyoverflow is a macro. */
661 yyoverflow("parser stack overflow",
662 &yyss1, size * sizeof (*yyssp),
663 &yyvs1, size * sizeof (*yyvsp),
664 &yyls1, size * sizeof (*yylsp),
667 yyoverflow("parser stack overflow",
668 &yyss1, size * sizeof (*yyssp),
669 &yyvs1, size * sizeof (*yyvsp),
673 yyss = yyss1; yyvs = yyvs1;
677 #else /* no yyoverflow */
678 /* Extend the stack our own way. */
679 if (yystacksize >= YYMAXDEPTH)
681 yyerror("parser stack overflow");
693 if (yystacksize > YYMAXDEPTH)
694 yystacksize = YYMAXDEPTH;
695 #ifndef YYSTACK_USE_ALLOCA
698 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
699 __yy_memcpy ((char *)yyss, (char *)yyss1,
700 size * (unsigned int) sizeof (*yyssp));
701 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
702 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
703 size * (unsigned int) sizeof (*yyvsp));
705 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
706 __yy_memcpy ((char *)yyls, (char *)yyls1,
707 size * (unsigned int) sizeof (*yylsp));
709 #endif /* no yyoverflow */
711 yyssp = yyss + size - 1;
712 yyvsp = yyvs + size - 1;
714 yylsp = yyls + size - 1;
719 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
722 if (yyssp >= yyss + yystacksize - 1)
728 fprintf(stderr, "Entering state %d\n", yystate);
734 /* Do appropriate processing given the current state. */
735 /* Read a lookahead token if we need one and don't already have one. */
738 /* First try to decide what to do without reference to lookahead token. */
740 yyn = yypact[yystate];
744 /* Not known => get a lookahead token if don't already have one. */
746 /* yychar is either YYEMPTY or YYEOF
747 or a valid token in external form. */
749 if (yychar == YYEMPTY)
753 fprintf(stderr, "Reading a token: ");
758 /* Convert token to internal form (in yychar1) for indexing tables with */
760 if (yychar <= 0) /* This means end of input. */
763 yychar = YYEOF; /* Don't call YYLEX any more */
767 fprintf(stderr, "Now at end of input.\n");
772 yychar1 = YYTRANSLATE(yychar);
777 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
778 /* Give the individual parser a way to print the precise meaning
779 of a token, for further debugging info. */
781 YYPRINT (stderr, yychar, yylval);
783 fprintf (stderr, ")\n");
789 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
794 /* yyn is what to do for this token type in this state.
795 Negative => reduce, -yyn is rule number.
796 Positive => shift, yyn is new state.
797 New state is final state => don't bother to shift,
799 0, or most negative number => error. */
814 /* Shift the lookahead token. */
818 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
821 /* Discard the token being shifted unless it is eof. */
830 /* count tokens shifted since error; after three, turn off error status. */
831 if (yyerrstatus) yyerrstatus--;
836 /* Do the default action for the current state. */
839 yyn = yydefact[yystate];
843 /* Do a reduction. yyn is the number of a rule to reduce with. */
847 yyval = yyvsp[1-yylen]; /* implement default value of the action */
854 fprintf (stderr, "Reducing via rule %d (line %d), ",
857 /* Print the symbols being reduced, and their result. */
858 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
859 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
860 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
868 { lslOpList_free (yyvsp[0].operators); ;
871 { lslOpList x = lslOpList_new ();
872 g_importedlslOp = yyvsp[0].operator;
873 lslOpList_add (x, yyvsp[0].operator);
874 yyval.operators = x; ;
877 { lslOpList_add (yyvsp[-1].operators, yyvsp[0].operator);
878 yyval.operators = yyvsp[-1].operators; ;
881 { yyval.operator = makelslOpNode (yyvsp[-2].name, yyvsp[0].signature); ;
884 { yyval.name = makeNameNodeId (yyvsp[0].ltok); ;
887 { yyval.name = makeNameNodeForm (yyvsp[0].opform); ;
890 { yyval.opform = makeOpFormNode (yyvsp[-5].ltok, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;
893 { yyval.opform = makeOpFormNode (yyvsp[0].ltok, OPF_ANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
896 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_MANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
899 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_ANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
902 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
905 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
908 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
911 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MIDDLEM, opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
914 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MMIDDLEM,
915 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
918 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMIDDLE,
919 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
922 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMMIDDLE,
923 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
926 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMIDDLEM,
927 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
930 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMMIDDLEM,
931 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
934 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_SELECT,
935 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
938 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MSELECT,
939 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
942 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMAP,
943 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
946 { yyval.ltok = yyvsp[0].ltok; ;
949 { yyval.ltok = yyvsp[0].ltok; ;
952 { yyval.ltok = yyvsp[0].ltok; ;
958 { yyval.count = yyvsp[0].count; ;
964 { yyval.count = yyvsp[-2].count + 1; ;
967 { yyval.ltok = yyvsp[0].ltok; ;
970 { yyval.ltok = yyvsp[0].ltok; ;
973 { yyval.signature = makesigNode (yyvsp[-1].ltok, yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
976 { yyval.ltokenList = ltokenList_new (); ;
979 { yyval.ltokenList = yyvsp[0].ltokenList; ;
982 { yyval.ltokenList = ltokenList_singleton (yyvsp[0].ltok); ;
985 { yyval.ltokenList = ltokenList_push (yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
989 yyval.ltok = yyvsp[0].ltok;
990 ltoken_setText (yyval.ltok, processTraitSortId (ltoken_getText (yyvsp[0].ltok)));
994 { yyval.ltok = yyvsp[0].ltok; ;
997 /* the action file gets copied in in place of this dollarsign */
1009 short *ssp1 = yyss - 1;
1010 fprintf (stderr, "state stack now");
1011 while (ssp1 != yyssp)
1012 fprintf (stderr, " %d", *++ssp1);
1013 fprintf (stderr, "\n");
1023 yylsp->first_line = yylloc.first_line;
1024 yylsp->first_column = yylloc.first_column;
1025 yylsp->last_line = (yylsp-1)->last_line;
1026 yylsp->last_column = (yylsp-1)->last_column;
1031 yylsp->last_line = (yylsp+yylen-1)->last_line;
1032 yylsp->last_column = (yylsp+yylen-1)->last_column;
1036 /* Now "shift" the result of the reduction.
1037 Determine what state that goes to,
1038 based on the state we popped back to
1039 and the rule number reduced by. */
1043 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1044 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1045 yystate = yytable[yystate];
1047 yystate = yydefgoto[yyn - YYNTBASE];
1051 yyerrlab: /* here on detecting error */
1054 /* If not already recovering from an error, report this error. */
1058 #ifdef YYERROR_VERBOSE
1059 yyn = yypact[yystate];
1061 if (yyn > YYFLAG && yyn < YYLAST)
1068 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1069 for (x = (yyn < 0 ? -yyn : 0);
1070 x < (sizeof(yytname) / sizeof(char *)); x++)
1071 if (yycheck[x + yyn] == x)
1072 size += strlen(yytname[x]) + 15, count++;
1073 msg = (char *) malloc(size + 15);
1076 strcpy(msg, "parse error");
1081 for (x = (yyn < 0 ? -yyn : 0);
1082 x < (sizeof(yytname) / sizeof(char *)); x++)
1083 if (yycheck[x + yyn] == x)
1085 strcat(msg, count == 0 ? ", expecting `" : " or `");
1086 strcat(msg, yytname[x]);
1095 yyerror ("parse error; also virtual memory exceeded");
1098 #endif /* YYERROR_VERBOSE */
1099 yyerror("parse error");
1103 yyerrlab1: /* here on error raised explicitly by an action */
1105 if (yyerrstatus == 3)
1107 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1109 /* return failure if at end of input */
1110 if (yychar == YYEOF)
1115 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1121 /* Else will try to reuse lookahead token
1122 after shifting the error token. */
1124 yyerrstatus = 3; /* Each real token shifted decrements this */
1128 yyerrdefault: /* current state does not do anything special for the error token. */
1131 /* This is wrong; only states that explicitly want error tokens
1132 should shift them. */
1133 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1134 if (yyn) goto yydefault;
1137 yyerrpop: /* pop the current state because it cannot handle the error token */
1139 if (yyssp == yyss) YYABORT;
1149 short *ssp1 = yyss - 1;
1150 fprintf (stderr, "Error: state stack now");
1151 while (ssp1 != yyssp)
1152 fprintf (stderr, " %d", *++ssp1);
1153 fprintf (stderr, "\n");
1159 yyn = yypact[yystate];
1164 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1183 fprintf(stderr, "Shifting error token, ");
1195 /* YYACCEPT comes here. */
1207 /* YYABORT comes here. */
1220 # include "bison.reset"
1222 extern char *yytext;
1224 void lslerror (char *s)
1227 (cstring_makeLiteral
1228 ("There has been a problem in the parser with LSL signatures. This is believed to result "
1229 "from a problem with bison v. 1.25. Please try rebuidling Splint "
1230 "using the pre-compiled grammar files by commenting out the "
1231 "BISON= line in the top-level Makefile."));
1234 static void yyprint (FILE *file, int type, YYSTYPE value)
1236 fprintf (file, " (%u:%u type: %d; text: %s) ",
1237 ltoken_getLine (value.ltok),
1238 ltoken_getCol (value.ltok),
1240 ltoken_getRawTextChars (value.ltok));
1243 extern void PrintToken (ltoken tok) {
1246 switch (ltoken_getCode (tok))
1248 case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break;
1249 case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break;
1250 case LST_LOGICALOP: codStr = "LOGICALOP: "; break;
1251 case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break;
1252 case LST_OPENSYM: codStr = "LST_OPENSYM"; break;
1253 case LST_SEPSYM: codStr = "SEPSYM"; break;
1254 case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break;
1255 case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break;
1256 case LST_MAPSYM: codStr = "MAPSYM"; break;
1257 case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break;
1258 case LST_COMMENTSYM: codStr = "COMMENTSYM"; break;
1259 case LST_SIMPLEOP: codStr = "SIMPLEOP"; break;
1260 case LST_COLON: codStr = "LST_COLON"; break;
1261 case LST_COMMA: codStr = "COMMA"; break;
1262 case LST_LBRACKET: codStr = "LST_LBRACKET"; break;
1263 case LST_LPAR: codStr = "LST_LPAR"; break;
1264 case LST_RBRACKET: codStr = "LST_RBRACKET"; break;
1265 case LST_RPAR: codStr = "LST_RPAR"; break;
1266 case LST_EQOP: codStr = "LST_EQOP"; break;
1267 case LST_WHITESPACE: codStr = "WHITESPACE,"; break;
1268 case LST_EOL: codStr = "LST_EOL"; break;
1269 case LST_elseTOKEN: codStr = "elseTOKEN"; break;
1270 case LST_ifTOKEN: codStr = "ifTOKEN"; break;
1271 case LST_thenTOKEN: codStr = "thenTOKEN"; break;
1272 case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break;
1273 case LEOFTOKEN: /* can't reach LEOFTOKEN easily */
1274 codStr = "LEOFTOKEN"; break;
1276 codStr = "*** invalid token code ***";
1280 /* only used for debugging */
1281 printf ("%u:%u: Token Code (%u): %s",
1282 ltoken_getLine (tok), ltoken_getCol (tok),
1283 ltoken_getCode (tok), codStr);
1284 if (ltoken_getRawText (tok) != 0)
1286 printf (", Token String (%lu): %s\n",
1287 ltoken_getRawText (tok), ltoken_getRawTextChars (tok));
1296 ** Resets all flags in bison.head
1318 /*@=evalorderuncon@*/
1327 /*@=elseifcomplete@*/
1331 /*@=readonlytrans@*/
1334 /*@=systemunrecog@*/
1335 /*@=dependenttrans@*/
1336 /*@=unqualifiedtrans@*/
1340 /*drl added 11/27/2001*/
1343 /*drl added 12/11/2002*/