2 /* A Bison parser, made from signature.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse lslparse
9 #define yyerror lslerror
10 #define yylval lsllval
11 #define yychar lslchar
12 #define yydebug lsldebug
13 #define yynerrs lslnerrs
14 #define LST_SIMPLEID 257
15 #define LST_LOGICALOP 258
17 #define LST_SIMPLEOP 260
18 #define LST_MAPSYM 261
19 #define LST_FIELDMAPSYM 262
20 #define LST_MARKERSYM 263
21 #define LST_ifTOKEN 264
22 #define LST_thenTOKEN 265
23 #define LST_elseTOKEN 266
24 #define LST_LBRACKET 267
25 #define LST_RBRACKET 268
26 #define LST_SELECTSYM 269
27 #define LST_SEPSYM 270
28 #define LST_OPENSYM 271
29 #define LST_CLOSESYM 272
33 #define LST_COMMENTSYM 276
34 #define LST_WHITESPACE 277
35 #define LST_QUANTIFIERSYM 278
36 #define LST_EQUATIONSYM 279
37 #define LST_EQSEPSYM 280
38 #define LST_COMPOSESYM 281
41 #define LST_assertsTOKEN 284
42 #define LST_assumesTOKEN 285
43 #define LST_byTOKEN 286
44 #define LST_convertsTOKEN 287
45 #define LST_enumerationTOKEN 288
46 #define LST_equationsTOKEN 289
47 #define LST_exemptingTOKEN 290
48 #define LST_forTOKEN 291
49 #define LST_generatedTOKEN 292
50 #define LST_impliesTOKEN 293
51 #define LST_includesTOKEN 294
52 #define LST_introducesTOKEN 295
53 #define LST_ofTOKEN 296
54 #define LST_partitionedTOKEN 297
55 #define LST_traitTOKEN 298
56 #define LST_tupleTOKEN 299
57 #define LST_unionTOKEN 300
58 #define LST_BADTOKEN 301
60 #line 36 "signature.y"
63 # include "bison.reset"
66 # include "lclintMacros.nf"
68 # include "lslparse.h"
69 # include "signature.h"
71 void lslerror (char *);
72 /*@dependent@*/ /*@null@*/ lslOp importedlslOp;
74 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
75 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
78 # define YYPRINT(file, type, value) yyprint (file, type, value)
82 # include "bison.head"
85 #line 73 "signature.y"
87 ltoken ltok; /* a leaf is also an ltoken */
89 /*@only@*/ ltokenList ltokenList;
90 /*@only@*/ opFormNode opform;
91 /*@owned@*/ sigNode signature;
92 /*@only@*/ nameNode name;
93 /*@owned@*/ lslOp operator;
94 /*@only@*/ lslOpList operators;
111 #define YYFLAG -32768
114 #define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 62)
116 static const char yytranslate[] = { 0,
117 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
143 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
144 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
145 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
146 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
151 static const short yyprhs[] = { 0,
152 0, 2, 4, 7, 11, 13, 15, 22, 24, 27,
153 30, 34, 38, 43, 48, 54, 58, 63, 68, 74,
154 77, 81, 85, 87, 89, 91, 92, 94, 96, 100,
155 102, 104, 108, 109, 111, 113, 117, 119
158 static const short yyrhs[] = { 49,
159 0, 50, 0, 49, 50, 0, 51, 19, 57, 0,
160 61, 0, 52, 0, 10, 9, 11, 9, 12, 9,
161 0, 53, 0, 9, 53, 0, 53, 9, 0, 9,
162 53, 9, 0, 17, 54, 18, 0, 9, 17, 54,
163 18, 0, 17, 54, 18, 9, 0, 9, 17, 54,
164 18, 9, 0, 13, 54, 14, 0, 9, 13, 54,
165 14, 0, 13, 54, 14, 9, 0, 9, 13, 54,
166 14, 9, 0, 15, 3, 0, 9, 15, 3, 0,
167 9, 8, 3, 0, 6, 0, 4, 0, 5, 0,
168 0, 55, 0, 9, 0, 55, 56, 9, 0, 20,
169 0, 16, 0, 58, 7, 60, 0, 0, 59, 0,
170 60, 0, 59, 20, 60, 0, 3, 0, 3, 0
176 static const short yyrline[] = { 0,
177 139, 141, 146, 150, 156, 158, 162, 164, 166, 168,
178 170, 172, 174, 176, 178, 181, 184, 187, 190, 193,
179 196, 201, 206, 208, 210, 213, 215, 218, 220, 223,
180 225, 228, 231, 233, 236, 238, 241, 247
185 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
187 static const char * const yytname[] = { "$","error","$undefined.","LST_SIMPLEID",
188 "LST_LOGICALOP","LST_EQOP","LST_SIMPLEOP","LST_MAPSYM","LST_FIELDMAPSYM","LST_MARKERSYM",
189 "LST_ifTOKEN","LST_thenTOKEN","LST_elseTOKEN","LST_LBRACKET","LST_RBRACKET",
190 "LST_SELECTSYM","LST_SEPSYM","LST_OPENSYM","LST_CLOSESYM","LST_COLON","LST_COMMA",
191 "LST_EOL","LST_COMMENTSYM","LST_WHITESPACE","LST_QUANTIFIERSYM","LST_EQUATIONSYM",
192 "LST_EQSEPSYM","LST_COMPOSESYM","LST_LPAR","LST_RPAR","LST_assertsTOKEN","LST_assumesTOKEN",
193 "LST_byTOKEN","LST_convertsTOKEN","LST_enumerationTOKEN","LST_equationsTOKEN",
194 "LST_exemptingTOKEN","LST_forTOKEN","LST_generatedTOKEN","LST_impliesTOKEN",
195 "LST_includesTOKEN","LST_introducesTOKEN","LST_ofTOKEN","LST_partitionedTOKEN",
196 "LST_traitTOKEN","LST_tupleTOKEN","LST_unionTOKEN","LST_BADTOKEN","top","operatorList",
197 "operator","name","opForm","anyOp","middle","placeList","separator","signature",
198 "domain","sortList","sortId","opId", NULL
202 static const short yyr1[] = { 0,
203 48, 49, 49, 50, 51, 51, 52, 52, 52, 52,
204 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
205 52, 52, 53, 53, 53, 54, 54, 55, 55, 56,
206 56, 57, 58, 58, 59, 59, 60, 61
209 static const short yyr2[] = { 0,
210 1, 1, 2, 3, 1, 1, 6, 1, 2, 2,
211 3, 3, 4, 4, 5, 3, 4, 4, 5, 2,
212 3, 3, 1, 1, 1, 0, 1, 1, 3, 1,
213 1, 3, 0, 1, 1, 3, 1, 1
216 static const short yydefact[] = { 0,
217 38, 24, 25, 23, 0, 0, 26, 0, 26, 1,
218 2, 0, 6, 8, 5, 0, 26, 0, 26, 9,
219 0, 28, 0, 27, 20, 0, 3, 33, 10, 22,
220 0, 21, 0, 11, 0, 16, 31, 30, 0, 12,
221 37, 4, 0, 34, 35, 17, 13, 0, 18, 29,
222 14, 0, 0, 19, 15, 0, 32, 36, 7, 0,
226 static const short yydefgoto[] = { 60,
227 10, 11, 12, 13, 14, 23, 24, 39, 42, 43,
231 static const short yypact[] = { -3,
232 -32768,-32768,-32768,-32768, 11, -4, 0, 8, 0, -3,
233 -32768, -1,-32768, 13,-32768, 17, 0, 22, 0, 18,
234 20,-32768, 19, -12,-32768, 14,-32768, 31,-32768,-32768,
235 21,-32768, 23,-32768, 27, 28,-32768,-32768, 29, 30,
236 -32768,-32768, 33, 24,-32768, 34, 36, 35,-32768,-32768,
237 -32768, 31, 31,-32768,-32768, 37,-32768,-32768,-32768, 42,
241 static const short yypgoto[] = {-32768,
242 -32768, 39,-32768,-32768, 45, 4,-32768,-32768,-32768,-32768,
250 static const short yytable[] = { 1,
251 2, 3, 4, 37, 21, 5, 6, 38, 22, 7,
252 25, 8, 26, 9, 2, 3, 4, 28, 16, 30,
253 31, 29, 33, 17, 32, 18, 34, 19, 57, 58,
254 35, 40, 36, 41, 46, 48, 49, 50, 51, 52,
255 47, 61, 54, 53, 55, 59, 56, 62, 27, 20
258 static const short yycheck[] = { 3,
259 4, 5, 6, 16, 9, 9, 10, 20, 9, 13,
260 3, 15, 9, 17, 4, 5, 6, 19, 8, 3,
261 17, 9, 19, 13, 3, 15, 9, 17, 52, 53,
262 11, 18, 14, 3, 14, 9, 9, 9, 9, 7,
263 18, 0, 9, 20, 9, 9, 12, 0, 10, 5
267 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
268 #line 3 "/usr/lib/bison.simple"
269 /* This file comes from bison-1.28. */
271 /* Skeleton output parser for bison,
272 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
274 This program is free software; you can redistribute it and/or modify
275 it under the terms of the GNU General Public License as published by
276 the Free Software Foundation; either version 2, or (at your option)
279 This program is distributed in the hope that it will be useful,
280 but WITHOUT ANY WARRANTY; without even the implied warranty of
281 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
282 GNU General Public License for more details.
284 You should have received a copy of the GNU General Public License
285 along with this program; if not, write to the Free Software
286 Foundation, Inc., 59 Temple Place - Suite 330,
287 Boston, MA 02111-1307, USA. */
289 /* As a special exception, when this file is copied by Bison into a
290 Bison output file, you may use that output file without restriction.
291 This special exception was added by the Free Software Foundation
292 in version 1.24 of Bison. */
294 /* This is the parser code that is written into each bison parser
295 when the %semantic_parser declaration is not specified in the grammar.
296 It was written by Richard Stallman by simplifying the hairy parser
297 used when %semantic_parser is specified. */
299 #ifndef YYSTACK_USE_ALLOCA
301 #define YYSTACK_USE_ALLOCA
302 #else /* alloca not defined */
304 #define YYSTACK_USE_ALLOCA
305 #define alloca __builtin_alloca
306 #else /* not GNU C. */
307 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
308 #define YYSTACK_USE_ALLOCA
310 #else /* not sparc */
311 /* We think this test detects Watcom and Microsoft C. */
312 /* This used to test MSDOS, but that is a bad idea
313 since that symbol is in the user namespace. */
314 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
315 #if 0 /* No need for malloc.h, which pollutes the namespace;
316 instead, just don't use alloca. */
319 #else /* not MSDOS, or __TURBOC__ */
321 /* I don't know what this was needed for, but it pollutes the namespace.
322 So I turned it off. rms, 2 May 1997. */
323 /* #include <malloc.h> */
325 #define YYSTACK_USE_ALLOCA
326 #else /* not MSDOS, or __TURBOC__, or _AIX */
328 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
329 and on HPUX 10. Eventually we can turn this on. */
330 #define YYSTACK_USE_ALLOCA
331 #define alloca __builtin_alloca
334 #endif /* not _AIX */
335 #endif /* not MSDOS, or __TURBOC__ */
336 #endif /* not sparc */
337 #endif /* not GNU C */
338 #endif /* alloca not defined */
339 #endif /* YYSTACK_USE_ALLOCA not defined */
341 #ifdef YYSTACK_USE_ALLOCA
342 #define YYSTACK_ALLOC alloca
344 #define YYSTACK_ALLOC malloc
347 /* Note: there must be only one dollar sign in this file.
348 It is replaced by the list of actions, each action
349 as one case of the switch. */
351 #define yyerrok (yyerrstatus = 0)
352 #define yyclearin (yychar = YYEMPTY)
355 #define YYACCEPT goto yyacceptlab
356 #define YYABORT goto yyabortlab
357 #define YYERROR goto yyerrlab1
358 /* Like YYERROR except do call yyerror.
359 This remains here temporarily to ease the
360 transition to the new meaning of YYERROR, for GCC.
361 Once GCC version 2 has supplanted version 1, this can go. */
362 #define YYFAIL goto yyerrlab
363 #define YYRECOVERING() (!!yyerrstatus)
364 #define YYBACKUP(token, value) \
366 if (yychar == YYEMPTY && yylen == 1) \
367 { yychar = (token), yylval = (value); \
368 yychar1 = YYTRANSLATE (yychar); \
373 { yyerror ("syntax error: cannot back up"); YYERROR; } \
377 #define YYERRCODE 256
380 #define YYLEX yylex()
386 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
388 #define YYLEX yylex(&yylval, &yylloc)
390 #else /* not YYLSP_NEEDED */
392 #define YYLEX yylex(&yylval, YYLEX_PARAM)
394 #define YYLEX yylex(&yylval)
396 #endif /* not YYLSP_NEEDED */
399 /* If nonreentrant, generate the variables here */
403 int yychar; /* the lookahead symbol */
404 YYSTYPE yylval; /* the semantic value of the */
405 /* lookahead symbol */
408 YYLTYPE yylloc; /* location data for the lookahead */
412 int yynerrs; /* number of parse errors so far */
413 #endif /* not YYPURE */
416 int yydebug; /* nonzero means print parse trace */
417 /* Since this is uninitialized, it does not stop multiple parsers
421 /* YYINITDEPTH indicates the initial size of the parser's stacks */
424 #define YYINITDEPTH 200
427 /* YYMAXDEPTH is the maximum size the stacks can grow to
428 (effective only if the built-in stack extension method is used). */
435 #define YYMAXDEPTH 10000
438 /* Define __yy_memcpy. Note that the size argument
439 should be passed with type unsigned int, because that is what the non-GCC
440 definitions require. With GCC, __builtin_memcpy takes an arg
441 of type size_t, but it can handle unsigned int. */
443 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
444 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
445 #else /* not GNU C or C++ */
448 /* This is the most reliable way to avoid incompatibilities
449 in available built-in functions on various systems. */
451 __yy_memcpy (to, from, count)
456 register char *f = from;
457 register char *t = to;
458 register int i = count;
464 #else /* __cplusplus */
466 /* This is the most reliable way to avoid incompatibilities
467 in available built-in functions on various systems. */
469 __yy_memcpy (char *to, char *from, unsigned int count)
471 register char *t = to;
472 register char *f = from;
473 register int i = count;
482 #line 217 "/usr/lib/bison.simple"
484 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
485 into yyparse. The argument should have type void *.
486 It should actually point to an object.
487 Grammar actions can access the variable by casting it
488 to the proper pointer type. */
492 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
493 #define YYPARSE_PARAM_DECL
494 #else /* not __cplusplus */
495 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
496 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
497 #endif /* not __cplusplus */
498 #else /* not YYPARSE_PARAM */
499 #define YYPARSE_PARAM_ARG
500 #define YYPARSE_PARAM_DECL
501 #endif /* not YYPARSE_PARAM */
503 /* Prevent warning if -Wstrict-prototypes. */
506 int yyparse (void *);
513 yyparse(YYPARSE_PARAM_ARG)
516 register int yystate;
518 register short *yyssp;
519 register YYSTYPE *yyvsp;
520 int yyerrstatus; /* number of tokens to shift before error messages enabled */
521 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
523 short yyssa[YYINITDEPTH]; /* the state stack */
524 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
526 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
527 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
530 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
531 YYLTYPE *yyls = yylsa;
534 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
536 #define YYPOPSTACK (yyvsp--, yyssp--)
539 int yystacksize = YYINITDEPTH;
540 int yyfree_stacks = 0;
551 YYSTYPE yyval; /* the variable used to return */
552 /* semantic values from the action */
559 fprintf(stderr, "Starting parse\n");
565 yychar = YYEMPTY; /* Cause a token to be read. */
567 /* Initialize stack pointers.
568 Waste one element of value and location stack
569 so that they stay on the same level as the state stack.
570 The wasted elements are never initialized. */
578 /* Push a new state, which is found in yystate . */
579 /* In all cases, when you get here, the value and location stacks
580 have just been pushed. so pushing a state here evens the stacks. */
585 if (yyssp >= yyss + yystacksize - 1)
587 /* Give user a chance to reallocate the stack */
588 /* Use copies of these so that the &'s don't force the real ones into memory. */
589 YYSTYPE *yyvs1 = yyvs;
592 YYLTYPE *yyls1 = yyls;
595 /* Get the current used size of the three stacks, in elements. */
596 int size = yyssp - yyss + 1;
599 /* Each stack pointer address is followed by the size of
600 the data in use in that stack, in bytes. */
602 /* This used to be a conditional around just the two extra args,
603 but that might be undefined if yyoverflow is a macro. */
604 yyoverflow("parser stack overflow",
605 &yyss1, size * sizeof (*yyssp),
606 &yyvs1, size * sizeof (*yyvsp),
607 &yyls1, size * sizeof (*yylsp),
610 yyoverflow("parser stack overflow",
611 &yyss1, size * sizeof (*yyssp),
612 &yyvs1, size * sizeof (*yyvsp),
616 yyss = yyss1; yyvs = yyvs1;
620 #else /* no yyoverflow */
621 /* Extend the stack our own way. */
622 if (yystacksize >= YYMAXDEPTH)
624 yyerror("parser stack overflow");
636 if (yystacksize > YYMAXDEPTH)
637 yystacksize = YYMAXDEPTH;
638 #ifndef YYSTACK_USE_ALLOCA
641 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
642 __yy_memcpy ((char *)yyss, (char *)yyss1,
643 size * (unsigned int) sizeof (*yyssp));
644 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
645 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
646 size * (unsigned int) sizeof (*yyvsp));
648 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
649 __yy_memcpy ((char *)yyls, (char *)yyls1,
650 size * (unsigned int) sizeof (*yylsp));
652 #endif /* no yyoverflow */
654 yyssp = yyss + size - 1;
655 yyvsp = yyvs + size - 1;
657 yylsp = yyls + size - 1;
662 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
665 if (yyssp >= yyss + yystacksize - 1)
671 fprintf(stderr, "Entering state %d\n", yystate);
677 /* Do appropriate processing given the current state. */
678 /* Read a lookahead token if we need one and don't already have one. */
681 /* First try to decide what to do without reference to lookahead token. */
683 yyn = yypact[yystate];
687 /* Not known => get a lookahead token if don't already have one. */
689 /* yychar is either YYEMPTY or YYEOF
690 or a valid token in external form. */
692 if (yychar == YYEMPTY)
696 fprintf(stderr, "Reading a token: ");
701 /* Convert token to internal form (in yychar1) for indexing tables with */
703 if (yychar <= 0) /* This means end of input. */
706 yychar = YYEOF; /* Don't call YYLEX any more */
710 fprintf(stderr, "Now at end of input.\n");
715 yychar1 = YYTRANSLATE(yychar);
720 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
721 /* Give the individual parser a way to print the precise meaning
722 of a token, for further debugging info. */
724 YYPRINT (stderr, yychar, yylval);
726 fprintf (stderr, ")\n");
732 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
737 /* yyn is what to do for this token type in this state.
738 Negative => reduce, -yyn is rule number.
739 Positive => shift, yyn is new state.
740 New state is final state => don't bother to shift,
742 0, or most negative number => error. */
757 /* Shift the lookahead token. */
761 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
764 /* Discard the token being shifted unless it is eof. */
773 /* count tokens shifted since error; after three, turn off error status. */
774 if (yyerrstatus) yyerrstatus--;
779 /* Do the default action for the current state. */
782 yyn = yydefact[yystate];
786 /* Do a reduction. yyn is the number of a rule to reduce with. */
790 yyval = yyvsp[1-yylen]; /* implement default value of the action */
797 fprintf (stderr, "Reducing via rule %d (line %d), ",
800 /* Print the symbols being reduced, and their result. */
801 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
802 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
803 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
811 #line 139 "signature.y"
812 { lslOpList_free (yyvsp[0].operators); ;
815 #line 142 "signature.y"
816 { lslOpList x = lslOpList_new ();
817 g_importedlslOp = yyvsp[0].operator;
818 lslOpList_add (x, yyvsp[0].operator);
819 yyval.operators = x; ;
822 #line 147 "signature.y"
823 { lslOpList_add (yyvsp[-1].operators, yyvsp[0].operator);
824 yyval.operators = yyvsp[-1].operators; ;
827 #line 151 "signature.y"
828 { yyval.operator = makelslOpNode (yyvsp[-2].name, yyvsp[0].signature); ;
831 #line 157 "signature.y"
832 { yyval.name = makeNameNodeId (yyvsp[0].ltok); ;
835 #line 159 "signature.y"
836 { yyval.name = makeNameNodeForm (yyvsp[0].opform); ;
839 #line 163 "signature.y"
840 { yyval.opform = makeOpFormNode (yyvsp[-5].ltok, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;
843 #line 165 "signature.y"
844 { yyval.opform = makeOpFormNode (yyvsp[0].ltok, OPF_ANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
847 #line 167 "signature.y"
848 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_MANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
851 #line 169 "signature.y"
852 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_ANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
855 #line 171 "signature.y"
856 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ;
859 #line 173 "signature.y"
860 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
863 #line 175 "signature.y"
864 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
867 #line 177 "signature.y"
868 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MIDDLEM, opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
871 #line 179 "signature.y"
872 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MMIDDLEM,
873 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
876 #line 182 "signature.y"
877 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMIDDLE,
878 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
881 #line 185 "signature.y"
882 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMMIDDLE,
883 opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ;
886 #line 188 "signature.y"
887 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMIDDLEM,
888 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
891 #line 191 "signature.y"
892 { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMMIDDLEM,
893 opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ;
896 #line 194 "signature.y"
897 { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_SELECT,
898 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
901 #line 197 "signature.y"
902 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MSELECT,
903 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
906 #line 202 "signature.y"
907 { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMAP,
908 opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ;
911 #line 207 "signature.y"
912 { yyval.ltok = yyvsp[0].ltok; ;
915 #line 209 "signature.y"
916 { yyval.ltok = yyvsp[0].ltok; ;
919 #line 211 "signature.y"
920 { yyval.ltok = yyvsp[0].ltok; ;
923 #line 214 "signature.y"
927 #line 216 "signature.y"
928 { yyval.count = yyvsp[0].count; ;
931 #line 219 "signature.y"
935 #line 221 "signature.y"
936 { yyval.count = yyvsp[-2].count + 1; ;
939 #line 224 "signature.y"
940 { yyval.ltok = yyvsp[0].ltok; ;
943 #line 226 "signature.y"
944 { yyval.ltok = yyvsp[0].ltok; ;
947 #line 229 "signature.y"
948 { yyval.signature = makesigNode (yyvsp[-1].ltok, yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
951 #line 232 "signature.y"
952 { yyval.ltokenList = ltokenList_new (); ;
955 #line 234 "signature.y"
956 { yyval.ltokenList = yyvsp[0].ltokenList; ;
959 #line 237 "signature.y"
960 { yyval.ltokenList = ltokenList_singleton (yyvsp[0].ltok); ;
963 #line 239 "signature.y"
964 { yyval.ltokenList = ltokenList_push (yyvsp[-2].ltokenList, yyvsp[0].ltok); ;
967 #line 242 "signature.y"
969 yyval.ltok = yyvsp[0].ltok;
970 ltoken_setText (yyval.ltok, processTraitSortId (ltoken_getText (yyvsp[0].ltok)));
974 #line 248 "signature.y"
975 { yyval.ltok = yyvsp[0].ltok; ;
978 /* the action file gets copied in in place of this dollarsign */
979 #line 543 "/usr/lib/bison.simple"
990 short *ssp1 = yyss - 1;
991 fprintf (stderr, "state stack now");
992 while (ssp1 != yyssp)
993 fprintf (stderr, " %d", *++ssp1);
994 fprintf (stderr, "\n");
1004 yylsp->first_line = yylloc.first_line;
1005 yylsp->first_column = yylloc.first_column;
1006 yylsp->last_line = (yylsp-1)->last_line;
1007 yylsp->last_column = (yylsp-1)->last_column;
1012 yylsp->last_line = (yylsp+yylen-1)->last_line;
1013 yylsp->last_column = (yylsp+yylen-1)->last_column;
1017 /* Now "shift" the result of the reduction.
1018 Determine what state that goes to,
1019 based on the state we popped back to
1020 and the rule number reduced by. */
1024 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1025 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1026 yystate = yytable[yystate];
1028 yystate = yydefgoto[yyn - YYNTBASE];
1032 yyerrlab: /* here on detecting error */
1035 /* If not already recovering from an error, report this error. */
1039 #ifdef YYERROR_VERBOSE
1040 yyn = yypact[yystate];
1042 if (yyn > YYFLAG && yyn < YYLAST)
1049 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1050 for (x = (yyn < 0 ? -yyn : 0);
1051 x < (sizeof(yytname) / sizeof(char *)); x++)
1052 if (yycheck[x + yyn] == x)
1053 size += strlen(yytname[x]) + 15, count++;
1054 msg = (char *) malloc(size + 15);
1057 strcpy(msg, "parse error");
1062 for (x = (yyn < 0 ? -yyn : 0);
1063 x < (sizeof(yytname) / sizeof(char *)); x++)
1064 if (yycheck[x + yyn] == x)
1066 strcat(msg, count == 0 ? ", expecting `" : " or `");
1067 strcat(msg, yytname[x]);
1076 yyerror ("parse error; also virtual memory exceeded");
1079 #endif /* YYERROR_VERBOSE */
1080 yyerror("parse error");
1084 yyerrlab1: /* here on error raised explicitly by an action */
1086 if (yyerrstatus == 3)
1088 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1090 /* return failure if at end of input */
1091 if (yychar == YYEOF)
1096 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1102 /* Else will try to reuse lookahead token
1103 after shifting the error token. */
1105 yyerrstatus = 3; /* Each real token shifted decrements this */
1109 yyerrdefault: /* current state does not do anything special for the error token. */
1112 /* This is wrong; only states that explicitly want error tokens
1113 should shift them. */
1114 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1115 if (yyn) goto yydefault;
1118 yyerrpop: /* pop the current state because it cannot handle the error token */
1120 if (yyssp == yyss) YYABORT;
1130 short *ssp1 = yyss - 1;
1131 fprintf (stderr, "Error: state stack now");
1132 while (ssp1 != yyssp)
1133 fprintf (stderr, " %d", *++ssp1);
1134 fprintf (stderr, "\n");
1140 yyn = yypact[yystate];
1145 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1164 fprintf(stderr, "Shifting error token, ");
1176 /* YYACCEPT comes here. */
1188 /* YYABORT comes here. */
1199 #line 249 "signature.y"
1202 # include "bison.reset"
1204 extern char *yytext;
1206 void lslerror (char *s)
1209 (cstring_makeLiteral
1210 ("There has been a problem parsing an LSL signature. This is believed to "
1211 "result from a problem with gcc version 2.95 optimizations, "
1212 "but it has not been confirmed. Please try rebuidling LCLint "
1213 "without the -O<n> option."));
1217 static void yyprint (FILE *file, int type, YYSTYPE value)
1219 fprintf (file, " (%u:%u type: %d; text: %s) ",
1220 ltoken_getLine (value.ltok),
1221 ltoken_getCol (value.ltok),
1223 ltoken_getRawTextChars (value.ltok));
1226 extern void PrintToken (ltoken tok) {
1229 switch (ltoken_getCode (tok))
1231 case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break;
1232 case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break;
1233 case LST_LOGICALOP: codStr = "LOGICALOP: "; break;
1234 case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break;
1235 case LST_OPENSYM: codStr = "LST_OPENSYM"; break;
1236 case LST_SEPSYM: codStr = "SEPSYM"; break;
1237 case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break;
1238 case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break;
1239 case LST_MAPSYM: codStr = "MAPSYM"; break;
1240 case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break;
1241 case LST_COMMENTSYM: codStr = "COMMENTSYM"; break;
1242 case LST_SIMPLEOP: codStr = "SIMPLEOP"; break;
1243 case LST_COLON: codStr = "LST_COLON"; break;
1244 case LST_COMMA: codStr = "COMMA"; break;
1245 case LST_LBRACKET: codStr = "LST_LBRACKET"; break;
1246 case LST_LPAR: codStr = "LST_LPAR"; break;
1247 case LST_RBRACKET: codStr = "LST_RBRACKET"; break;
1248 case LST_RPAR: codStr = "LST_RPAR"; break;
1249 case LST_EQOP: codStr = "LST_EQOP"; break;
1250 case LST_WHITESPACE: codStr = "WHITESPACE,"; break;
1251 case LST_EOL: codStr = "LST_EOL"; break;
1252 case LST_elseTOKEN: codStr = "elseTOKEN"; break;
1253 case LST_ifTOKEN: codStr = "ifTOKEN"; break;
1254 case LST_thenTOKEN: codStr = "thenTOKEN"; break;
1255 case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break;
1256 case LEOFTOKEN: /* can't reach LEOFTOKEN easily */
1257 codStr = "LEOFTOKEN"; break;
1259 codStr = "*** invalid token code ***";
1263 /* only used for debugging */
1264 printf ("%u:%u: Token Code (%u): %s",
1265 ltoken_getLine (tok), ltoken_getCol (tok),
1266 ltoken_getCode (tok), codStr);
1267 if (ltoken_getRawText (tok) != 0)
1269 printf (", Token String (%lu): %s\n",
1270 ltoken_getRawText (tok), ltoken_getRawTextChars (tok));