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 signature.y
57 #define YYBISON 1 /* Identify Bison output. */
59 #define yyparse lslparse
61 #define yyerror lslerror
62 #define yylval lsllval
63 #define yychar lslchar
64 #define yydebug lsldebug
65 #define yynerrs lslnerrs
66 # define LST_SIMPLEID 257
67 # define LST_LOGICALOP 258
69 # define LST_SIMPLEOP 260
70 # define LST_MAPSYM 261
71 # define LST_FIELDMAPSYM 262
72 # define LST_MARKERSYM 263
73 # define LST_ifTOKEN 264
74 # define LST_thenTOKEN 265
75 # define LST_elseTOKEN 266
76 # define LST_LBRACKET 267
77 # define LST_RBRACKET 268
78 # define LST_SELECTSYM 269
79 # define LST_SEPSYM 270
80 # define LST_OPENSYM 271
81 # define LST_CLOSESYM 272
82 # define LST_COLON 273
83 # define LST_COMMA 274
85 # define LST_COMMENTSYM 276
86 # define LST_WHITESPACE 277
87 # define LST_QUANTIFIERSYM 278
88 # define LST_EQUATIONSYM 279
89 # define LST_EQSEPSYM 280
90 # define LST_COMPOSESYM 281
93 # define LST_assertsTOKEN 284
94 # define LST_assumesTOKEN 285
95 # define LST_byTOKEN 286
96 # define LST_convertsTOKEN 287
97 # define LST_enumerationTOKEN 288
98 # define LST_equationsTOKEN 289
99 # define LST_exemptingTOKEN 290
100 # define LST_forTOKEN 291
101 # define LST_generatedTOKEN 292
102 # define LST_impliesTOKEN 293
103 # define LST_includesTOKEN 294
104 # define LST_introducesTOKEN 295
105 # define LST_ofTOKEN 296
106 # define LST_partitionedTOKEN 297
107 # define LST_traitTOKEN 298
108 # define LST_tupleTOKEN 299
109 # define LST_unionTOKEN 300
110 # define LST_BADTOKEN 301
115 # include "splintMacros.nf"
116 # include "llbasic.h"
117 # include "lslparse.h"
118 # include "signature.h"
120 static void lslerror (char *);
121 extern int lsllex ();
123 /*@dependent@*/ /*@null@*/ lslOp importedlslOp;
125 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
126 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
129 # define YYPRINT(file, type, value) yyprint (file, type, value)
139 ltoken ltok; /* a leaf is also an ltoken */
141 /*@only@*/ ltokenList ltokenList;
142 /*@only@*/ opFormNode opform;
143 /*@owned@*/ sigNode signature;
144 /*@only@*/ nameNode name;
145 /*@owned@*/ lslOp operator;
146 /*@only@*/ lslOpList operators;
147 /*@-redef@*/ /*@-matchfields@*/
158 #define YYFLAG -32768
161 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
162 #define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 62)
164 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
165 static const char yytranslate[] =
167 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
168 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
169 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
170 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
171 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 1, 3, 4, 5,
193 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
194 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
195 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
196 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
201 static const short yyprhs[] =
203 0, 0, 2, 4, 7, 11, 13, 15, 22, 24,
204 27, 30, 34, 38, 43, 48, 54, 58, 63, 68,
205 74, 77, 81, 85, 87, 89, 91, 92, 94, 96,
206 100, 102, 104, 108, 109, 111, 113, 117, 119
208 static const short yyrhs[] =
210 49, 0, 50, 0, 49, 50, 0, 51, 19, 57,
211 0, 61, 0, 52, 0, 10, 9, 11, 9, 12,
212 9, 0, 53, 0, 9, 53, 0, 53, 9, 0,
213 9, 53, 9, 0, 17, 54, 18, 0, 9, 17,
214 54, 18, 0, 17, 54, 18, 9, 0, 9, 17,
215 54, 18, 9, 0, 13, 54, 14, 0, 9, 13,
216 54, 14, 0, 13, 54, 14, 9, 0, 9, 13,
217 54, 14, 9, 0, 15, 3, 0, 9, 15, 3,
218 0, 9, 8, 3, 0, 6, 0, 4, 0, 5,
219 0, 0, 55, 0, 9, 0, 55, 56, 9, 0,
220 20, 0, 16, 0, 58, 7, 60, 0, 0, 59,
221 0, 60, 0, 59, 20, 60, 0, 3, 0, 3,
228 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
229 static const short yyrline[] =
231 0, 139, 141, 146, 150, 156, 158, 162, 164, 166,
232 168, 170, 172, 174, 176, 178, 181, 184, 187, 190,
233 193, 196, 201, 206, 208, 210, 213, 215, 218, 220,
234 223, 225, 228, 231, 233, 236, 238, 241, 247
239 #if YYDEBUG != 0 || defined YYERROR_VERBOSE
241 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
242 static const char *const yytname[] =
244 "$", "error", "$undefined.", "LST_SIMPLEID", "LST_LOGICALOP", "LST_EQOP",
245 "LST_SIMPLEOP", "LST_MAPSYM", "LST_FIELDMAPSYM", "LST_MARKERSYM",
246 "LST_ifTOKEN", "LST_thenTOKEN", "LST_elseTOKEN", "LST_LBRACKET",
247 "LST_RBRACKET", "LST_SELECTSYM", "LST_SEPSYM", "LST_OPENSYM",
248 "LST_CLOSESYM", "LST_COLON", "LST_COMMA", "LST_EOL", "LST_COMMENTSYM",
249 "LST_WHITESPACE", "LST_QUANTIFIERSYM", "LST_EQUATIONSYM",
250 "LST_EQSEPSYM", "LST_COMPOSESYM", "LST_LPAR", "LST_RPAR",
251 "LST_assertsTOKEN", "LST_assumesTOKEN", "LST_byTOKEN",
252 "LST_convertsTOKEN", "LST_enumerationTOKEN", "LST_equationsTOKEN",
253 "LST_exemptingTOKEN", "LST_forTOKEN", "LST_generatedTOKEN",
254 "LST_impliesTOKEN", "LST_includesTOKEN", "LST_introducesTOKEN",
255 "LST_ofTOKEN", "LST_partitionedTOKEN", "LST_traitTOKEN",
256 "LST_tupleTOKEN", "LST_unionTOKEN", "LST_BADTOKEN", "top",
257 "operatorList", "operator", "name", "opForm", "anyOp", "middle",
258 "placeList", "separator", "signature", "domain", "sortList", "sortId",
263 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
264 static const short yyr1[] =
266 0, 48, 49, 49, 50, 51, 51, 52, 52, 52,
267 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
268 52, 52, 52, 53, 53, 53, 54, 54, 55, 55,
269 56, 56, 57, 58, 58, 59, 59, 60, 61
272 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
273 static const short yyr2[] =
275 0, 1, 1, 2, 3, 1, 1, 6, 1, 2,
276 2, 3, 3, 4, 4, 5, 3, 4, 4, 5,
277 2, 3, 3, 1, 1, 1, 0, 1, 1, 3,
278 1, 1, 3, 0, 1, 1, 3, 1, 1
281 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
282 doesn't specify something else to do. Zero means the default is an
284 static const short yydefact[] =
286 0, 38, 24, 25, 23, 0, 0, 26, 0, 26,
287 1, 2, 0, 6, 8, 5, 0, 26, 0, 26,
288 9, 0, 28, 0, 27, 20, 0, 3, 33, 10,
289 22, 0, 21, 0, 11, 0, 16, 31, 30, 0,
290 12, 37, 4, 0, 34, 35, 17, 13, 0, 18,
291 29, 14, 0, 0, 19, 15, 0, 32, 36, 7,
295 static const short yydefgoto[] =
297 60, 10, 11, 12, 13, 14, 23, 24, 39, 42,
301 static const short yypact[] =
303 -3,-32768,-32768,-32768,-32768, 11, -4, 0, 8, 0,
304 -3,-32768, -1,-32768, 13,-32768, 17, 0, 22, 0,
305 18, 20,-32768, 19, -12,-32768, 14,-32768, 31,-32768,
306 -32768, 21,-32768, 23,-32768, 27, 28,-32768,-32768, 29,
307 30,-32768,-32768, 33, 24,-32768, 34, 36, 35,-32768,
308 -32768,-32768, 31, 31,-32768,-32768, 37,-32768,-32768,-32768,
312 static const short yypgoto[] =
314 -32768,-32768, 39,-32768,-32768, 45, 4,-32768,-32768,-32768,
315 -32768,-32768, -23,-32768
322 static const short yytable[] =
324 1, 2, 3, 4, 37, 21, 5, 6, 38, 22,
325 7, 25, 8, 26, 9, 2, 3, 4, 28, 16,
326 30, 31, 29, 33, 17, 32, 18, 34, 19, 57,
327 58, 35, 40, 36, 41, 46, 48, 49, 50, 51,
328 52, 47, 61, 54, 53, 55, 59, 56, 62, 27,
332 static const short yycheck[] =
334 3, 4, 5, 6, 16, 9, 9, 10, 20, 9,
335 13, 3, 15, 9, 17, 4, 5, 6, 19, 8,
336 3, 17, 9, 19, 13, 3, 15, 9, 17, 52,
337 53, 11, 18, 14, 3, 14, 9, 9, 9, 9,
338 7, 18, 0, 9, 20, 9, 9, 12, 0, 10,
343 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
345 /* Skeleton output parser for bison,
346 Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
348 This program is free software; you can redistribute it and/or modify
349 it under the terms of the GNU General Public License as published by
350 the Free Software Foundation; either version 2, or (at your option)
353 This program is distributed in the hope that it will be useful,
354 but WITHOUT ANY WARRANTY; without even the implied warranty of
355 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
356 GNU General Public License for more details.
358 You should have received a copy of the GNU General Public License
359 along with this program; if not, write to the Free Software
360 Foundation, Inc., 59 Temple Place - Suite 330,
361 Boston, MA 02111-1307, USA. */
363 /* As a special exception, when this file is copied by Bison into a
364 Bison output file, you may use that output file without restriction.
365 This special exception was added by the Free Software Foundation
366 in version 1.24 of Bison. */
368 /* This is the parser code that is written into each bison parser when
369 the %semantic_parser declaration is not specified in the grammar.
370 It was written by Richard Stallman by simplifying the hairy parser
371 used when %semantic_parser is specified. */
373 #ifndef YYSTACK_USE_ALLOCA
375 # define YYSTACK_USE_ALLOCA 1
376 # else /* alloca not defined */
378 # define YYSTACK_USE_ALLOCA 1
379 # define alloca __builtin_alloca
380 # else /* not GNU C. */
381 # if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
382 # define YYSTACK_USE_ALLOCA 1
384 # else /* not sparc */
385 /* We think this test detects Watcom and Microsoft C. */
386 /* This used to test MSDOS, but that is a bad idea since that
387 symbol is in the user namespace. */
388 # if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
390 /* No need for malloc.h, which pollutes the namespace; instead,
391 just don't use alloca. */
394 # else /* not MSDOS, or __TURBOC__ */
396 /* I don't know what this was needed for, but it pollutes the
397 namespace. So I turned it off. rms, 2 May 1997. */
398 /* #include <malloc.h> */
400 # define YYSTACK_USE_ALLOCA 1
401 # else /* not MSDOS, or __TURBOC__, or _AIX */
403 /* haible@ilog.fr says this works for HPUX 9.05 and up, and on
404 HPUX 10. Eventually we can turn this on. */
406 # define YYSTACK_USE_ALLOCA 1
407 # define alloca __builtin_alloca
410 # endif /* not _AIX */
411 # endif /* not MSDOS, or __TURBOC__ */
412 # endif /* not sparc */
413 # endif /* not GNU C */
414 # endif /* alloca not defined */
415 #endif /* YYSTACK_USE_ALLOCA not defined */
417 #ifndef YYSTACK_USE_ALLOCA
418 # define YYSTACK_USE_ALLOCA 0
421 #if YYSTACK_USE_ALLOCA
422 # define YYSTACK_ALLOC alloca
424 # define YYSTACK_ALLOC malloc
427 #define yyerrok (yyerrstatus = 0)
428 #define yyclearin (yychar = YYEMPTY)
431 #define YYACCEPT goto yyacceptlab
432 #define YYABORT goto yyabortlab
433 #define YYERROR goto yyerrlab1
434 /* Like YYERROR except do call yyerror. This remains here temporarily
435 to ease the transition to the new meaning of YYERROR, for GCC.
436 Once GCC version 2 has supplanted version 1, this can go. */
437 #define YYFAIL goto yyerrlab
438 #define YYRECOVERING() (!!yyerrstatus)
439 #define YYBACKUP(Token, Value) \
441 if (yychar == YYEMPTY && yylen == 1) \
445 yychar1 = YYTRANSLATE (yychar); \
451 yyerror ("syntax error: cannot back up"); \
457 #define YYERRCODE 256
460 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
463 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
464 first token. By default, to implement support for ranges, extend
465 its range to the last symbol. */
467 #ifndef YYLLOC_DEFAULT
468 # define YYLLOC_DEFAULT(Current, Rhs, N) \
469 Current.last_line = Rhs[N].last_line; \
470 Current.last_column = Rhs[N].last_column;
474 /* YYLEX -- calling `yylex' with the right arguments. */
479 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
481 # define YYLEX yylex (&yylval, &yylloc)
483 # else /* !YYLSP_NEEDED */
485 # define YYLEX yylex (&yylval, YYLEX_PARAM)
487 # define YYLEX yylex (&yylval)
489 # endif /* !YYLSP_NEEDED */
491 # define YYLEX yylex ()
495 /* Enable debugging if requested. */
497 # define YYDPRINTF(Args) \
502 /* Nonzero means print parse trace. [The following comment makes no
503 sense to me. Could someone clarify it? --akim] Since this is
504 uninitialized, it does not stop multiple parsers from coexisting.
508 # define YYDPRINTF(Args)
509 #endif /* !YYDEBUG */
511 /* YYINITDEPTH -- initial size of the parser's stacks. */
513 # define YYINITDEPTH 200
516 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
517 if the built-in stack extension method is used). */
523 # define YYMAXDEPTH 10000
526 /* Define __yy_memcpy. Note that the size argument
527 should be passed with type unsigned int, because that is what the non-GCC
528 definitions require. With GCC, __builtin_memcpy takes an arg
529 of type size_t, but it can handle unsigned int. */
531 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
532 # define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count)
533 #else /* not GNU C or C++ */
535 /* This is the most reliable way to avoid incompatibilities
536 in available built-in functions on various systems. */
539 __yy_memcpy (to, from, count)
543 # else /* __cplusplus */
544 __yy_memcpy (char *to, const char *from, unsigned int count)
547 register const char *f = from;
548 register char *t = to;
549 register int i = count;
559 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
560 into yyparse. The argument should have type void *.
561 It should actually point to an object.
562 Grammar actions can access the variable by casting it
563 to the proper pointer type. */
567 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
568 # define YYPARSE_PARAM_DECL
569 # else /* !__cplusplus */
570 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
571 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
572 # endif /* !__cplusplus */
573 #else /* !YYPARSE_PARAM */
574 # define YYPARSE_PARAM_ARG
575 # define YYPARSE_PARAM_DECL
576 #endif /* !YYPARSE_PARAM */
578 /* Prevent warning if -Wstrict-prototypes. */
580 # ifdef YYPARSE_PARAM
581 int yyparse (void *);
587 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
588 variables are global, or local to YYPARSE. */
590 #define _YY_DECL_VARIABLES \
591 /* The lookahead symbol. */ \
594 /* The semantic value of the lookahead symbol. */ \
597 /* Number of parse errors so far. */ \
601 # define YY_DECL_VARIABLES \
604 /* Location data for the lookahead symbol. */ \
607 # define YY_DECL_VARIABLES \
612 /* If nonreentrant, generate the variables here. */
619 yyparse (YYPARSE_PARAM_ARG)
622 /* If reentrant, generate the variables here. */
627 register int yystate;
629 /* Number of tokens to shift before error messages enabled. */
631 /* Lookahead token as an internal (translated) token number. */
634 /* Three stacks and their tools:
635 `yyss': related to states,
636 `yysv': related to semantic values,
637 `yyls': related to locations.
639 Refer to the stacks thru separate pointers, to allow yyoverflow
640 to reallocate them elsewhere. */
642 /* The state stack. */
643 short yyssa[YYINITDEPTH];
645 register short *yyssp;
647 /* The semantic value stack. */
648 YYSTYPE yyvsa[YYINITDEPTH];
649 YYSTYPE *yyvs = yyvsa;
650 register YYSTYPE *yyvsp;
653 /* The location stack. */
654 YYLTYPE yylsa[YYINITDEPTH];
655 YYLTYPE *yyls = yylsa;
660 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
662 # define YYPOPSTACK (yyvsp--, yyssp--)
665 int yystacksize = YYINITDEPTH;
666 int yyfree_stacks = 0;
669 /* The variables used to return semantic value and location from the
676 /* When reducing, the number of symbols on the RHS of the reduced
680 YYDPRINTF ((stderr, "Starting parse\n"));
685 yychar = YYEMPTY; /* Cause a token to be read. */
687 /* Initialize stack pointers.
688 Waste one element of value and location stack
689 so that they stay on the same level as the state stack.
690 The wasted elements are never initialized. */
699 /*------------------------------------------------------------.
700 | yynewstate -- Push a new state, which is found in yystate. |
701 `------------------------------------------------------------*/
703 /* In all cases, when you get here, the value and location stacks
704 have just been pushed. so pushing a state here evens the stacks.
711 if (yyssp >= yyss + yystacksize - 1)
713 /* Give user a chance to reallocate the stack. Use copies of
714 these so that the &'s don't force the real ones into memory.
716 YYSTYPE *yyvs1 = yyvs;
719 YYLTYPE *yyls1 = yyls;
722 /* Get the current used size of the three stacks, in elements. */
723 int size = yyssp - yyss + 1;
726 /* Each stack pointer address is followed by the size of the
727 data in use in that stack, in bytes. */
729 /* This used to be a conditional around just the two extra args,
730 but that might be undefined if yyoverflow is a macro. */
731 yyoverflow ("parser stack overflow",
732 &yyss1, size * sizeof (*yyssp),
733 &yyvs1, size * sizeof (*yyvsp),
734 &yyls1, size * sizeof (*yylsp),
737 yyoverflow ("parser stack overflow",
738 &yyss1, size * sizeof (*yyssp),
739 &yyvs1, size * sizeof (*yyvsp),
743 yyss = yyss1; yyvs = yyvs1;
747 #else /* no yyoverflow */
748 /* Extend the stack our own way. */
749 if (yystacksize >= YYMAXDEPTH)
751 yyerror ("parser stack overflow");
763 if (yystacksize > YYMAXDEPTH)
764 yystacksize = YYMAXDEPTH;
765 # if !YYSTACK_USE_ALLOCA
768 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
769 __yy_memcpy ((char *)yyss, (char *)yyss1,
770 size * (unsigned int) sizeof (*yyssp));
771 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
772 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
773 size * (unsigned int) sizeof (*yyvsp));
775 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
776 __yy_memcpy ((char *)yyls, (char *)yyls1,
777 size * (unsigned int) sizeof (*yylsp));
779 #endif /* no yyoverflow */
781 yyssp = yyss + size - 1;
782 yyvsp = yyvs + size - 1;
784 yylsp = yyls + size - 1;
787 YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize));
789 if (yyssp >= yyss + yystacksize - 1)
793 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
803 /* Do appropriate processing given the current state. */
804 /* Read a lookahead token if we need one and don't already have one. */
807 /* First try to decide what to do without reference to lookahead token. */
809 yyn = yypact[yystate];
813 /* Not known => get a lookahead token if don't already have one. */
815 /* yychar is either YYEMPTY or YYEOF
816 or a valid token in external form. */
818 if (yychar == YYEMPTY)
820 YYDPRINTF ((stderr, "Reading a token: "));
824 /* Convert token to internal form (in yychar1) for indexing tables with */
826 if (yychar <= 0) /* This means end of input. */
829 yychar = YYEOF; /* Don't call YYLEX any more */
831 YYDPRINTF ((stderr, "Now at end of input.\n"));
835 yychar1 = YYTRANSLATE (yychar);
838 /* We have to keep this `#if YYDEBUG', since we use variables
839 which are defined only if `YYDEBUG' is set. */
842 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
843 /* Give the individual parser a way to print the precise
844 meaning of a token, for further debugging info. */
846 YYPRINT (stderr, yychar, yylval);
848 fprintf (stderr, ")\n");
854 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
859 /* yyn is what to do for this token type in this state.
860 Negative => reduce, -yyn is rule number.
861 Positive => shift, yyn is new state.
862 New state is final state => don't bother to shift,
864 0, or most negative number => error. */
879 /* Shift the lookahead token. */
880 YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]));
882 /* Discard the token being shifted unless it is eof. */
891 /* Count tokens shifted since error; after three, turn off error
900 /*-----------------------------------------------------------.
901 | yydefault -- do the default action for the current state. |
902 `-----------------------------------------------------------*/
904 yyn = yydefact[yystate];
910 /*-----------------------------.
911 | yyreduce -- Do a reduction. |
912 `-----------------------------*/
914 /* yyn is the number of a rule to reduce with. */
917 /* If YYLEN is nonzero, implement the default value of the action:
920 Otherwise, the following line sets YYVAL to the semantic value of
921 the lookahead token. This behavior is undocumented and Bison
922 users should not rely upon it. Assigning to YYVAL
923 unconditionally makes the parser a bit smaller, and it avoids a
924 GCC warning that YYVAL may be used uninitialized. */
925 yyval = yyvsp[1-yylen];
928 /* Similarly for the default location. Let the user run additional
929 commands if for instance locations are ranges. */
930 yyloc = yylsp[1-yylen];
931 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
935 /* We have to keep this `#if YYDEBUG', since we use variables which
936 are defined only if `YYDEBUG' is set. */
941 fprintf (stderr, "Reducing via rule %d (line %d), ",
944 /* Print the symbols being reduced, and their result. */
945 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
946 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
947 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
954 { lslOpList_free (yyvsp[0].operators); ;
957 { lslOpList x = lslOpList_new ();
958 g_importedlslOp = yyvsp[0].operator;
959 lslOpList_add (x, yyvsp[0].operator);
960 yyval.operators = x; ;
963 { lslOpList_add (yyvsp[-1].operators, yyvsp[0].operator);
964 yyval.operators = yyvsp[-1].operators; ;
967 { yyval.operator = makelslOpNode (yyvsp[-2].name, yyvsp[0].signature); ;
970 { yyval.name = makeNameNodeId (yyvsp[0].ltok); ;
973 { yyval.name = makeNameNodeForm (yyvsp[0].opform); ;
976 { yyval.opform = makeOpFormNode (yyvsp[-5].ltok, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;
979 { yyval.opform = makeOpFormNode (yyvsp[0].ltok, OPF_ANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
982 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_MANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
985 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_ANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
988 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
991 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
994 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
997 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MIDDLEM, opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
1000 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MMIDDLEM,
1001 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
1004 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMIDDLE,
1005 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
1008 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMMIDDLE,
1009 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
1012 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMIDDLEM,
1013 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
1016 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMMIDDLEM,
1017 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
1020 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_SELECT,
1021 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
1024 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MSELECT,
1025 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
1028 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMAP,
1029 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
1032 { yyval.ltok = yyvsp[0].ltok; ;
1035 { yyval.ltok = yyvsp[0].ltok; ;
1038 { yyval.ltok = yyvsp[0].ltok; ;
1041 { yyval.count = 0; ;
1044 { yyval.count = yyvsp[0].count; ;
1047 { yyval.count = 1; ;
1050 { yyval.count = yyvsp[-2].count + 1; ;
1053 { yyval.ltok = yyvsp[0].ltok; ;
1056 { yyval.ltok = yyvsp[0].ltok; ;
1059 { yyval.signature = makesigNode (yyvsp[-1].ltok, yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
1062 { yyval.ltokenList = ltokenList_new (); ;
1065 { yyval.ltokenList = yyvsp[0].ltokenList; ;
1068 { yyval.ltokenList = ltokenList_singleton (yyvsp[0].ltok); ;
1071 { yyval.ltokenList = ltokenList_push (yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
1075 yyval.ltok = yyvsp[0].ltok;
1076 ltoken_setText (yyval.ltok, processTraitSortId (ltoken_getText (yyvsp[0].ltok)));
1080 { yyval.ltok = yyvsp[0].ltok; ;
1095 short *ssp1 = yyss - 1;
1096 fprintf (stderr, "state stack now");
1097 while (ssp1 != yyssp)
1098 fprintf (stderr, " %d", *++ssp1);
1099 fprintf (stderr, "\n");
1108 /* Now `shift' the result of the reduction. Determine what state
1109 that goes to, based on the state we popped back to and the rule
1110 number reduced by. */
1114 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1115 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1116 yystate = yytable[yystate];
1118 yystate = yydefgoto[yyn - YYNTBASE];
1123 /*------------------------------------.
1124 | yyerrlab -- here on detecting error |
1125 `------------------------------------*/
1127 /* If not already recovering from an error, report this error. */
1132 #ifdef YYERROR_VERBOSE
1133 yyn = yypact[yystate];
1135 if (yyn > YYFLAG && yyn < YYLAST)
1142 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1143 for (x = (yyn < 0 ? -yyn : 0);
1144 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
1145 if (yycheck[x + yyn] == x)
1146 size += strlen (yytname[x]) + 15, count++;
1147 size += strlen ("parse error, unexpected `") + 1;
1148 size += strlen (yytname[YYTRANSLATE (yychar)]);
1149 msg = (char *) malloc (size);
1152 strcpy (msg, "parse error, unexpected `");
1153 strcat (msg, yytname[YYTRANSLATE (yychar)]);
1159 for (x = (yyn < 0 ? -yyn : 0);
1160 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
1161 if (yycheck[x + yyn] == x)
1163 strcat (msg, count == 0 ? ", expecting `" : " or `");
1164 strcat (msg, yytname[x]);
1173 yyerror ("parse error; also virtual memory exceeded");
1176 #endif /* YYERROR_VERBOSE */
1177 yyerror ("parse error");
1182 /*--------------------------------------------------.
1183 | yyerrlab1 -- error raised explicitly by an action |
1184 `--------------------------------------------------*/
1186 if (yyerrstatus == 3)
1188 /* If just tried and failed to reuse lookahead token after an
1189 error, discard it. */
1191 /* return failure if at end of input */
1192 if (yychar == YYEOF)
1194 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1195 yychar, yytname[yychar1]));
1199 /* Else will try to reuse lookahead token after shifting the error
1202 yyerrstatus = 3; /* Each real token shifted decrements this */
1207 /*-------------------------------------------------------------------.
1208 | yyerrdefault -- current state does not do anything special for the |
1210 `-------------------------------------------------------------------*/
1213 /* This is wrong; only states that explicitly want error tokens
1214 should shift them. */
1216 /* If its default is to accept any token, ok. Otherwise pop it. */
1217 yyn = yydefact[yystate];
1223 /*---------------------------------------------------------------.
1224 | yyerrpop -- pop the current state because it cannot handle the |
1226 `---------------------------------------------------------------*/
1239 short *ssp1 = yyss - 1;
1240 fprintf (stderr, "Error: state stack now");
1241 while (ssp1 != yyssp)
1242 fprintf (stderr, " %d", *++ssp1);
1243 fprintf (stderr, "\n");
1251 yyn = yypact[yystate];
1256 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1273 YYDPRINTF ((stderr, "Shifting error token, "));
1284 /*-------------------------------------.
1285 | yyacceptlab -- YYACCEPT comes here. |
1286 `-------------------------------------*/
1299 /*-----------------------------------.
1300 | yyabortlab -- YYABORT comes here. |
1301 `-----------------------------------*/
1315 # include "bison.reset"
1317 extern char *yytext;
1319 void lslerror (char *s)
1322 (cstring_makeLiteral
1323 ("There has been a problem in the parser with LSL signatures. This is believed to result "
1324 "from a problem with bison v. 1.25. Please try rebuidling Splint "
1325 "using the pre-compiled grammar files by commenting out the "
1326 "BISON= line in the top-level Makefile."));
1329 static void yyprint (FILE *file, int type, YYSTYPE value)
1331 fprintf (file, " (%u:%u type: %d; text: %s) ",
1332 ltoken_getLine (value.ltok),
1333 ltoken_getCol (value.ltok),
1335 ltoken_getRawTextChars (value.ltok));
1338 extern void PrintToken (ltoken tok) {
1341 switch (ltoken_getCode (tok))
1343 case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break;
1344 case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break;
1345 case LST_LOGICALOP: codStr = "LOGICALOP: "; break;
1346 case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break;
1347 case LST_OPENSYM: codStr = "LST_OPENSYM"; break;
1348 case LST_SEPSYM: codStr = "SEPSYM"; break;
1349 case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break;
1350 case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break;
1351 case LST_MAPSYM: codStr = "MAPSYM"; break;
1352 case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break;
1353 case LST_COMMENTSYM: codStr = "COMMENTSYM"; break;
1354 case LST_SIMPLEOP: codStr = "SIMPLEOP"; break;
1355 case LST_COLON: codStr = "LST_COLON"; break;
1356 case LST_COMMA: codStr = "COMMA"; break;
1357 case LST_LBRACKET: codStr = "LST_LBRACKET"; break;
1358 case LST_LPAR: codStr = "LST_LPAR"; break;
1359 case LST_RBRACKET: codStr = "LST_RBRACKET"; break;
1360 case LST_RPAR: codStr = "LST_RPAR"; break;
1361 case LST_EQOP: codStr = "LST_EQOP"; break;
1362 case LST_WHITESPACE: codStr = "WHITESPACE,"; break;
1363 case LST_EOL: codStr = "LST_EOL"; break;
1364 case LST_elseTOKEN: codStr = "elseTOKEN"; break;
1365 case LST_ifTOKEN: codStr = "ifTOKEN"; break;
1366 case LST_thenTOKEN: codStr = "thenTOKEN"; break;
1367 case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break;
1368 case LEOFTOKEN: /* can't reach LEOFTOKEN easily */
1369 codStr = "LEOFTOKEN"; break;
1371 codStr = "*** invalid token code ***";
1375 /* only used for debugging */
1376 printf ("%u:%u: Token Code (%u): %s",
1377 ltoken_getLine (tok), ltoken_getCol (tok),
1378 ltoken_getCode (tok), codStr);
1379 if (ltoken_getRawText (tok) != 0)
1381 printf (", Token String (%lu): %s\n",
1382 ltoken_getRawText (tok), ltoken_getRawTextChars (tok));
1391 ** Resets all flags in bison.head
1413 /*@=evalorderuncon@*/
1422 /*@=elseifcomplete@*/
1426 /*@=readonlytrans@*/
1429 /*@=systemunrecog@*/
1430 /*@=dependenttrans@*/
1431 /*@=unqualifiedtrans@*/
1435 /*drl added 11/27/2001*/