Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
exparse.c
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 3.5.1. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47/* Identify Bison output. */
48#define YYBISON 1
49
50/* Bison version. */
51#define YYBISON_VERSION "3.5.1"
52
53/* Skeleton name. */
54#define YYSKELETON_NAME "yacc.c"
55
56/* Pure parsers. */
57#define YYPURE 0
58
59/* Push parsers. */
60#define YYPUSH 0
61
62/* Pull parsers. */
63#define YYPULL 1
64
65/* Substitute the type names. */
66#define YYSTYPE EX_STYPE
67/* Substitute the variable and function names. */
68#define yyparse ex_parse
69#define yylex ex_lex
70#define yyerror ex_error
71#define yydebug ex_debug
72#define yynerrs ex_nerrs
73#define yylval ex_lval
74#define yychar ex_char
75
76/* First part of user prologue. */
77#line 19 "../../lib/expr/exparse.y"
78
79
80/*
81 * Glenn Fowler
82 * AT&T Research
83 *
84 * expression library grammar and compiler
85 */
86
87#include <assert.h>
88#include <cgraph/gv_ctype.h>
89#include <cgraph/streq.h>
90#include <expr/exop.h>
91#include <stdio.h>
92#include <stdlib.h>
93#include <string.h>
94#include <ast/ast.h>
95
96
97#line 98 "exparse.c"
98
99# ifndef YY_CAST
100# ifdef __cplusplus
101# define YY_CAST(Type, Val) static_cast<Type> (Val)
102# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
103# else
104# define YY_CAST(Type, Val) ((Type) (Val))
105# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
106# endif
107# endif
108# ifndef YY_NULLPTR
109# if defined __cplusplus
110# if 201103L <= __cplusplus
111# define YY_NULLPTR nullptr
112# else
113# define YY_NULLPTR 0
114# endif
115# else
116# define YY_NULLPTR ((void*)0)
117# endif
118# endif
119
120/* Enabling verbose error messages. */
121#ifdef YYERROR_VERBOSE
122# undef YYERROR_VERBOSE
123# define YYERROR_VERBOSE 1
124#else
125# define YYERROR_VERBOSE 0
126#endif
127
128/* Use api.header.include to #include this header
129 instead of duplicating it here. */
130#ifndef YY_EX_EXPARSE_H_INCLUDED
131# define YY_EX_EXPARSE_H_INCLUDED
132/* Debug traces. */
133#ifndef EX_DEBUG
134# if defined YYDEBUG
135#if YYDEBUG
136# define EX_DEBUG 1
137# else
138# define EX_DEBUG 0
139# endif
140# else /* ! defined YYDEBUG */
141# define EX_DEBUG 1
142# endif /* ! defined YYDEBUG */
143#endif /* ! defined EX_DEBUG */
144#if EX_DEBUG
145extern int ex_debug;
146#endif
147
148/* Token type. */
149#ifndef EX_TOKENTYPE
150# define EX_TOKENTYPE
152 {
153 MINTOKEN = 258,
154 INTEGER = 259,
155 UNSIGNED = 260,
157 FLOATING = 262,
158 STRING = 263,
159 VOIDTYPE = 264,
160 STATIC = 265,
161 ADDRESS = 266,
162 ARRAY = 267,
163 BREAK = 268,
164 CALL = 269,
165 CASE = 270,
166 CONSTANT = 271,
167 CONTINUE = 272,
168 DECLARE = 273,
169 DEFAULT = 274,
170 DYNAMIC = 275,
171 ELSE = 276,
172 EXIT = 277,
173 FOR = 278,
174 FUNCTION = 279,
175 GSUB = 280,
176 ITERATE = 281,
177 ITERATER = 282,
178 ID = 283,
179 IF = 284,
180 LABEL = 285,
181 MEMBER = 286,
182 NAME = 287,
183 POS = 288,
184 PRAGMA = 289,
185 PRE = 290,
186 PRINT = 291,
187 PRINTF = 292,
189 QUERY = 294,
190 RAND = 295,
191 RETURN = 296,
192 SCANF = 297,
193 SPLIT = 298,
194 SPRINTF = 299,
195 SRAND = 300,
196 SSCANF = 301,
197 SUB = 302,
198 SUBSTR = 303,
199 SWITCH = 304,
200 TOKENS = 305,
201 UNSET = 306,
202 WHILE = 307,
203 F2I = 308,
204 F2S = 309,
205 I2F = 310,
206 I2S = 311,
207 S2B = 312,
208 S2F = 313,
209 S2I = 314,
210 F2X = 315,
211 I2X = 316,
212 S2X = 317,
213 X2F = 318,
214 X2I = 319,
215 X2S = 320,
216 X2X = 321,
217 XPRINT = 322,
218 OR = 323,
219 AND = 324,
220 EQ = 325,
221 NE = 326,
222 LE = 327,
223 GE = 328,
224 LSH = 329,
225 RSH = 330,
226 IN_OP = 331,
227 UNARY = 332,
228 INC = 333,
229 DEC = 334,
230 CAST = 335,
231 MAXTOKEN = 336
232 };
233#endif
234/* Tokens. */
235#define MINTOKEN 258
236#define INTEGER 259
237#define UNSIGNED 260
238#define CHARACTER 261
239#define FLOATING 262
240#define STRING 263
241#define VOIDTYPE 264
242#define STATIC 265
243#define ADDRESS 266
244#define ARRAY 267
245#define BREAK 268
246#define CALL 269
247#define CASE 270
248#define CONSTANT 271
249#define CONTINUE 272
250#define DECLARE 273
251#define DEFAULT 274
252#define DYNAMIC 275
253#define ELSE 276
254#define EXIT 277
255#define FOR 278
256#define FUNCTION 279
257#define GSUB 280
258#define ITERATE 281
259#define ITERATER 282
260#define ID 283
261#define IF 284
262#define LABEL 285
263#define MEMBER 286
264#define NAME 287
265#define POS 288
266#define PRAGMA 289
267#define PRE 290
268#define PRINT 291
269#define PRINTF 292
270#define PROCEDURE 293
271#define QUERY 294
272#define RAND 295
273#define RETURN 296
274#define SCANF 297
275#define SPLIT 298
276#define SPRINTF 299
277#define SRAND 300
278#define SSCANF 301
279#define SUB 302
280#define SUBSTR 303
281#define SWITCH 304
282#define TOKENS 305
283#define UNSET 306
284#define WHILE 307
285#define F2I 308
286#define F2S 309
287#define I2F 310
288#define I2S 311
289#define S2B 312
290#define S2F 313
291#define S2I 314
292#define F2X 315
293#define I2X 316
294#define S2X 317
295#define X2F 318
296#define X2I 319
297#define X2S 320
298#define X2X 321
299#define XPRINT 322
300#define OR 323
301#define AND 324
302#define EQ 325
303#define NE 326
304#define LE 327
305#define GE 328
306#define LSH 329
307#define RSH 330
308#define IN_OP 331
309#define UNARY 332
310#define INC 333
311#define DEC 334
312#define CAST 335
313#define MAXTOKEN 336
314
315/* Value type. */
316#if ! defined EX_STYPE && ! defined EX_STYPE_IS_DECLARED
318{
319#line 40 "../../lib/expr/exparse.y"
320
322 double floating;
324 struct Exid_s* id;
325 long long integer;
326 int op;
327 char* string;
328
329#line 330 "exparse.c"
330
331};
332typedef union EX_STYPE EX_STYPE;
333# define EX_STYPE_IS_TRIVIAL 1
334# define EX_STYPE_IS_DECLARED 1
335#endif
336
337
338extern EX_STYPE ex_lval;
339
340int ex_parse (void);
341
342#endif /* !YY_EX_EXPARSE_H_INCLUDED */
343
344/* Second part of user prologue. */
345#line 170 "../../lib/expr/exparse.y"
346
347
348#include <expr/exgram.h>
349
350void ex_error(const char *message);
351
352
353#line 354 "exparse.c"
354
355
356#ifdef short
357# undef short
358#endif
359
360/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
361 <limits.h> and (if available) <stdint.h> are included
362 so that the code can choose integer types of a good width. */
363
364#ifndef __PTRDIFF_MAX__
365# include <limits.h> /* INFRINGES ON USER NAME SPACE */
366# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
367# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
368# define YY_STDINT_H
369# endif
370#endif
371
372/* Narrow types that promote to a signed type and that can represent a
373 signed or unsigned integer of at least N bits. In tables they can
374 save space and decrease cache pressure. Promoting to a signed type
375 helps avoid bugs in integer arithmetic. */
376
377#ifdef __INT_LEAST8_MAX__
379#elif defined YY_STDINT_H
380typedef int_least8_t yytype_int8;
381#else
382typedef signed char yytype_int8;
383#endif
384
385#ifdef __INT_LEAST16_MAX__
387#elif defined YY_STDINT_H
388typedef int_least16_t yytype_int16;
389#else
390typedef short yytype_int16;
391#endif
392
393#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
395#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
396 && UINT_LEAST8_MAX <= INT_MAX)
397typedef uint_least8_t yytype_uint8;
398#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
399typedef unsigned char yytype_uint8;
400#else
401typedef short yytype_uint8;
402#endif
403
404#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
406#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
407 && UINT_LEAST16_MAX <= INT_MAX)
408typedef uint_least16_t yytype_uint16;
409#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
410typedef unsigned short yytype_uint16;
411#else
412typedef int yytype_uint16;
413#endif
414
415#ifndef YYPTRDIFF_T
416# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
417# define YYPTRDIFF_T __PTRDIFF_TYPE__
418# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
419# elif defined PTRDIFF_MAX
420# ifndef ptrdiff_t
421# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
422# endif
423# define YYPTRDIFF_T ptrdiff_t
424# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
425# else
426# define YYPTRDIFF_T long
427# define YYPTRDIFF_MAXIMUM LONG_MAX
428# endif
429#endif
430
431#ifndef YYSIZE_T
432# ifdef __SIZE_TYPE__
433# define YYSIZE_T __SIZE_TYPE__
434# elif defined size_t
435# define YYSIZE_T size_t
436# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
437# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
438# define YYSIZE_T size_t
439# else
440# define YYSIZE_T unsigned
441# endif
442#endif
443
444#define YYSIZE_MAXIMUM \
445 YY_CAST (YYPTRDIFF_T, \
446 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
447 ? YYPTRDIFF_MAXIMUM \
448 : YY_CAST (YYSIZE_T, -1)))
449
450#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
451
452/* Stored state numbers (used for stacks). */
454
455/* State numbers in computations. */
456typedef int yy_state_fast_t;
457
458#ifndef YY_
459# if defined YYENABLE_NLS && YYENABLE_NLS
460# if ENABLE_NLS
461# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
462# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
463# endif
464# endif
465# ifndef YY_
466# define YY_(Msgid) Msgid
467# endif
468#endif
469
470#ifndef YY_ATTRIBUTE_PURE
471# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
472# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
473# else
474# define YY_ATTRIBUTE_PURE
475# endif
476#endif
477
478#ifndef YY_ATTRIBUTE_UNUSED
479# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
480# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
481# else
482# define YY_ATTRIBUTE_UNUSED
483# endif
484#endif
485
486/* Suppress unused-variable warnings by "using" E. */
487#if ! defined lint || defined __GNUC__
488# define YYUSE(E) ((void) (E))
489#else
490# define YYUSE(E) /* empty */
491#endif
492
493#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
494/* Suppress an incorrect diagnostic about yylval being uninitialized. */
495# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
496 _Pragma ("GCC diagnostic push") \
497 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
498 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
499# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
500 _Pragma ("GCC diagnostic pop")
501#else
502# define YY_INITIAL_VALUE(Value) Value
503#endif
504#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
505# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
506# define YY_IGNORE_MAYBE_UNINITIALIZED_END
507#endif
508#ifndef YY_INITIAL_VALUE
509# define YY_INITIAL_VALUE(Value) /* Nothing. */
510#endif
511
512#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
513# define YY_IGNORE_USELESS_CAST_BEGIN \
514 _Pragma ("GCC diagnostic push") \
515 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
516# define YY_IGNORE_USELESS_CAST_END \
517 _Pragma ("GCC diagnostic pop")
518#endif
519#ifndef YY_IGNORE_USELESS_CAST_BEGIN
520# define YY_IGNORE_USELESS_CAST_BEGIN
521# define YY_IGNORE_USELESS_CAST_END
522#endif
523
524
525#define YY_ASSERT(E) ((void) (0 && (E)))
526
527#if ! defined yyoverflow || YYERROR_VERBOSE
528
529/* The parser invokes alloca or malloc; define the necessary symbols. */
530
531# ifdef YYSTACK_USE_ALLOCA
532# if YYSTACK_USE_ALLOCA
533# ifdef __GNUC__
534# define YYSTACK_ALLOC __builtin_alloca
535# elif defined __BUILTIN_VA_ARG_INCR
536# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
537# elif defined _AIX
538# define YYSTACK_ALLOC __alloca
539# elif defined _MSC_VER
540# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
541# define alloca _alloca
542# else
543# define YYSTACK_ALLOC alloca
544# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
545# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
546 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
547# ifndef EXIT_SUCCESS
548# define EXIT_SUCCESS 0
549# endif
550# endif
551# endif
552# endif
553# endif
554
555# ifdef YYSTACK_ALLOC
556 /* Pacify GCC's 'empty if-body' warning. */
557# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
558# ifndef YYSTACK_ALLOC_MAXIMUM
559 /* The OS might guarantee only one guard page at the bottom of the stack,
560 and a page size can be as small as 4096 bytes. So we cannot safely
561 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
562 to allow for a few compiler-allocated temporary stack slots. */
563# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
564# endif
565# else
566# define YYSTACK_ALLOC YYMALLOC
567# define YYSTACK_FREE YYFREE
568# ifndef YYSTACK_ALLOC_MAXIMUM
569# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
570# endif
571# if (defined __cplusplus && ! defined EXIT_SUCCESS \
572 && ! ((defined YYMALLOC || defined malloc) \
573 && (defined YYFREE || defined free)))
574# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
575# ifndef EXIT_SUCCESS
576# define EXIT_SUCCESS 0
577# endif
578# endif
579# ifndef YYMALLOC
580# define YYMALLOC malloc
581# if ! defined malloc && ! defined EXIT_SUCCESS
582void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
583# endif
584# endif
585# ifndef YYFREE
586# define YYFREE free
587# if ! defined free && ! defined EXIT_SUCCESS
588void free (void *); /* INFRINGES ON USER NAME SPACE */
589# endif
590# endif
591# endif
592#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
593
594
595#if (! defined yyoverflow \
596 && (! defined __cplusplus \
597 || (defined EX_STYPE_IS_TRIVIAL && EX_STYPE_IS_TRIVIAL)))
598
599/* A type that is properly aligned for any stack member. */
600union yyalloc
601{
602 yy_state_t yyss_alloc;
603 YYSTYPE yyvs_alloc;
604};
605
606/* The size of the maximum gap between one aligned stack and the next. */
607# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
608
609/* The size of an array large to enough to hold all stacks, each with
610 N elements. */
611# define YYSTACK_BYTES(N) \
612 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
613 + YYSTACK_GAP_MAXIMUM)
614
615# define YYCOPY_NEEDED 1
616
617/* Relocate STACK from its old location to the new one. The
618 local variables YYSIZE and YYSTACKSIZE give the old and new number of
619 elements in the stack, and YYPTR gives the new location of the
620 stack. Advance YYPTR to a properly aligned location for the next
621 stack. */
622# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
623 do \
624 { \
625 YYPTRDIFF_T yynewbytes; \
626 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
627 Stack = &yyptr->Stack_alloc; \
628 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
629 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
630 } \
631 while (0)
632
633#endif
634
635#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
636/* Copy COUNT objects from SRC to DST. The source and destination do
637 not overlap. */
638# ifndef YYCOPY
639# if defined __GNUC__ && 1 < __GNUC__
640# define YYCOPY(Dst, Src, Count) \
641 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
642# else
643# define YYCOPY(Dst, Src, Count) \
644 do \
645 { \
646 YYPTRDIFF_T yyi; \
647 for (yyi = 0; yyi < (Count); yyi++) \
648 (Dst)[yyi] = (Src)[yyi]; \
649 } \
650 while (0)
651# endif
652# endif
653#endif /* !YYCOPY_NEEDED */
654
655/* YYFINAL -- State number of the termination state. */
656#define YYFINAL 3
657/* YYLAST -- Last index in YYTABLE. */
658#define YYLAST 1112
659
660/* YYNTOKENS -- Number of terminals. */
661#define YYNTOKENS 107
662/* YYNNTS -- Number of nonterminals. */
663#define YYNNTS 44
664/* YYNRULES -- Number of rules. */
665#define YYNRULES 142
666/* YYNSTATES -- Number of states. */
667#define YYNSTATES 286
668
669#define YYUNDEFTOK 2
670#define YYMAXUTOK 336
671
672
673/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
674 as returned by yylex, with out-of-bounds checking. */
675#define YYTRANSLATE(YYX) \
676 (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
677
678/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
679 as returned by yylex. */
680static const yytype_int8 yytranslate[] =
681{
682 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
685 2, 2, 2, 91, 2, 93, 2, 90, 76, 2,
686 98, 103, 88, 85, 68, 86, 106, 89, 2, 2,
687 2, 2, 2, 2, 2, 2, 2, 2, 71, 102,
688 79, 69, 80, 70, 2, 2, 2, 2, 2, 2,
689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
691 2, 104, 2, 105, 75, 2, 2, 2, 2, 2,
692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
694 2, 2, 2, 100, 74, 101, 92, 2, 2, 2,
695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
706 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
707 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
708 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
709 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
710 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
711 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
712 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
713 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
714 65, 66, 67, 72, 73, 77, 78, 81, 82, 83,
715 84, 87, 94, 95, 96, 97, 99
716};
717
718#if EX_DEBUG
719 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
720static const yytype_int16 yyrline[] =
721{
722 0, 180, 180, 200, 201, 204, 204, 244, 247, 262,
723 266, 270, 270, 270, 275, 285, 298, 313, 326, 334,
724 345, 355, 355, 366, 378, 382, 395, 424, 427, 458,
725 459, 462, 481, 488, 491, 497, 498, 505, 505, 554,
726 555, 556, 557, 560, 561, 565, 568, 575, 578, 581,
727 585, 589, 642, 646, 650, 654, 658, 662, 666, 670,
728 674, 678, 682, 686, 690, 694, 698, 702, 715, 719,
729 729, 729, 729, 770, 790, 797, 801, 805, 809, 813,
730 817, 821, 825, 829, 833, 837, 841, 847, 851, 855,
731 861, 866, 870, 895, 931, 951, 959, 967, 978, 982,
732 986, 989, 990, 992, 1000, 1005, 1010, 1015, 1022, 1023,
733 1024, 1027, 1028, 1031, 1035, 1055, 1068, 1071, 1075, 1089,
734 1092, 1099, 1102, 1110, 1115, 1122, 1125, 1131, 1134, 1138,
735 1149, 1149, 1162, 1165, 1177, 1197, 1201, 1207, 1210, 1217,
736 1218, 1235, 1218
737};
738#endif
739
740#if EX_DEBUG || YYERROR_VERBOSE || 1
741/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
742 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
743static const char *const yytname[] =
744{
745 "$end", "error", "$undefined", "MINTOKEN", "INTEGER", "UNSIGNED",
746 "CHARACTER", "FLOATING", "STRING", "VOIDTYPE", "STATIC", "ADDRESS",
747 "ARRAY", "BREAK", "CALL", "CASE", "CONSTANT", "CONTINUE", "DECLARE",
748 "DEFAULT", "DYNAMIC", "ELSE", "EXIT", "FOR", "FUNCTION", "GSUB",
749 "ITERATE", "ITERATER", "ID", "IF", "LABEL", "MEMBER", "NAME", "POS",
750 "PRAGMA", "PRE", "PRINT", "PRINTF", "PROCEDURE", "QUERY", "RAND",
751 "RETURN", "SCANF", "SPLIT", "SPRINTF", "SRAND", "SSCANF", "SUB",
752 "SUBSTR", "SWITCH", "TOKENS", "UNSET", "WHILE", "F2I", "F2S", "I2F",
753 "I2S", "S2B", "S2F", "S2I", "F2X", "I2X", "S2X", "X2F", "X2I", "X2S",
754 "X2X", "XPRINT", "','", "'='", "'?'", "':'", "OR", "AND", "'|'", "'^'",
755 "'&'", "EQ", "NE", "'<'", "'>'", "LE", "GE", "LSH", "RSH", "'+'", "'-'",
756 "IN_OP", "'*'", "'/'", "'%'", "'!'", "'~'", "'#'", "UNARY", "INC", "DEC",
757 "CAST", "'('", "MAXTOKEN", "'{'", "'}'", "';'", "')'", "'['", "']'",
758 "'.'", "$accept", "program", "action_list", "action", "$@1",
759 "statement_list", "statement", "$@2", "$@3", "$@4", "switch_list",
760 "switch_item", "case_list", "case_item", "static", "dcl_list",
761 "dcl_item", "$@5", "dcl_name", "name", "else_opt", "expr_opt", "expr",
762 "$@6", "$@7", "splitop", "constant", "print", "scan", "variable",
763 "array", "index", "args", "arg_list", "formals", "formal_list",
764 "formal_item", "$@8", "members", "member", "assign", "initialize", "$@9",
765 "$@10", YY_NULLPTR
766};
767#endif
768
769# ifdef YYPRINT
770/* YYTOKNUM[NUM] -- (External) token number corresponding to the
771 (internal) symbol number NUM (which must be that of a token). */
772static const yytype_int16 yytoknum[] =
773{
774 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
775 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
776 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
777 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
778 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
779 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
780 315, 316, 317, 318, 319, 320, 321, 322, 44, 61,
781 63, 58, 323, 324, 124, 94, 38, 325, 326, 60,
782 62, 327, 328, 329, 330, 43, 45, 331, 42, 47,
783 37, 33, 126, 35, 332, 333, 334, 335, 40, 336,
784 123, 125, 59, 41, 91, 93, 46
785};
786# endif
787
788#define YYPACT_NINF (-144)
789
790#define yypact_value_is_default(Yyn) \
791 ((Yyn) == YYPACT_NINF)
792
793#define YYTABLE_NINF (-127)
794
795#define yytable_value_is_error(Yyn) \
796 ((Yyn) == YYTABLE_NINF)
797
798 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
799 STATE-NUM. */
800static const yytype_int16 yypact[] =
801{
802 -144, 9, 200, -144, -144, -144, -144, -144, -144, -89,
803 691, -144, 691, -80, -71, -64, -63, -43, -35, -27,
804 -11, -144, 11, -144, 16, -144, 20, 691, -144, -144,
805 -144, 23, -144, 31, 39, 41, -144, 56, 57, 1,
806 691, 691, 691, 691, 79, 1, 1, 596, -144, 92,
807 -144, -144, 49, 872, 58, -144, 60, 61, -37, 691,
808 65, 66, 691, -27, 691, 691, 691, 691, 1, -12,
809 -144, -144, 691, 691, 691, 59, 68, 88, 691, 691,
810 691, 140, 691, -144, -144, -144, -144, -144, -144, -144,
811 -144, 72, 284, 299, 100, -144, 158, -144, 691, -144,
812 691, 691, 691, 691, 691, 691, 691, 691, 691, 691,
813 691, 691, 691, 691, 691, 143, 691, 691, 691, 691,
814 691, 691, 691, -144, -144, -144, 916, 77, 109, -144,
815 -144, 185, -144, 383, 83, -56, 84, 85, 95, 93,
816 -144, 482, 97, 98, -144, -144, -144, 577, 106, 108,
817 872, -51, 672, 691, -144, -144, -144, -144, 916, 691,
818 934, 951, 967, 982, 996, 1010, 1010, 1022, 1022, 1022,
819 1022, 107, 107, 53, 53, -144, -144, -144, -144, 895,
820 111, 112, 916, -144, 691, -144, -144, 691, 497, -144,
821 -144, 497, 29, -144, 497, -144, -144, -144, -144, -144,
822 116, 691, -144, 497, -144, -144, 87, 849, 786, -144,
823 -144, 916, 124, -144, -144, -144, 168, 90, 767, -144,
824 200, -144, -144, -144, -144, -49, -144, -144, -144, -54,
825 691, 497, -144, -144, -144, 87, -144, 126, 691, 691,
826 -144, 128, -144, -7, -144, -16, -44, 916, 815, 497,
827 145, 162, -144, -144, 86, -144, 129, -144, -144, -144,
828 -144, -144, -144, 183, -144, 200, -144, -144, 238, -144,
829 174, -144, 210, -144, -10, 176, 262, -144, -144, -144,
830 181, -144, -144, -144, 398, -144
831};
832
833 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
834 Performed when YYTABLE does not specify something else to do. Zero
835 means the default is an error. */
836static const yytype_uint8 yydefact[] =
837{
838 7, 0, 3, 1, 105, 107, 104, 106, 34, 0,
839 47, 103, 47, 119, 0, 0, 0, 0, 0, 132,
840 0, 115, 0, 108, 0, 109, 0, 47, 111, 101,
841 110, 0, 112, 0, 0, 0, 102, 0, 0, 0,
842 0, 0, 0, 0, 0, 0, 0, 0, 7, 2,
843 8, 11, 0, 48, 0, 100, 0, 0, 137, 121,
844 0, 0, 0, 132, 0, 47, 121, 121, 0, 0,
845 113, 133, 0, 121, 121, 0, 0, 0, 121, 121,
846 0, 0, 0, 78, 77, 76, 73, 75, 74, 95,
847 98, 0, 0, 33, 0, 4, 0, 10, 0, 70,
848 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
849 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
850 121, 121, 0, 96, 99, 94, 123, 0, 122, 23,
851 24, 0, 114, 0, 0, 137, 0, 0, 0, 135,
852 136, 0, 0, 0, 87, 25, 88, 0, 0, 0,
853 21, 0, 0, 0, 49, 9, 5, 12, 69, 0,
854 68, 67, 64, 65, 63, 61, 62, 51, 58, 59,
855 60, 56, 57, 66, 52, 97, 53, 54, 55, 0,
856 0, 0, 138, 79, 0, 120, 86, 47, 33, 80,
857 81, 33, 0, 134, 33, 91, 90, 89, 82, 83,
858 0, 0, 18, 33, 50, 7, 0, 0, 0, 92,
859 93, 124, 0, 15, 17, 135, 45, 0, 0, 20,
860 6, 40, 42, 41, 39, 0, 35, 37, 71, 119,
861 47, 33, 14, 26, 19, 0, 13, 116, 0, 0,
862 84, 0, 46, 0, 36, 0, 137, 72, 0, 33,
863 0, 0, 22, 27, 7, 29, 0, 117, 140, 139,
864 38, 85, 16, 0, 32, 28, 30, 118, 125, 31,
865 130, 141, 127, 128, 0, 0, 0, 44, 43, 131,
866 0, 130, 129, 7, 33, 142
867};
868
869 /* YYPGOTO[NTERM-NUM]. */
870static const yytype_int16 yypgoto[] =
871{
872 -144, -144, -144, -144, -144, -48, -143, -144, -144, -144,
873 -144, -144, -144, 28, -144, -144, 48, -144, -144, -144,
874 -144, -9, -36, -144, -144, -144, 34, -144, -144, 101,
875 -144, -144, 24, -144, -144, -144, 12, -144, 224, 150,
876 51, -144, -144, -144
877};
878
879 /* YYDEFGOTO[NTERM-NUM]. */
880static const yytype_int16 yydefgoto[] =
881{
882 -1, 1, 49, 95, 205, 2, 50, 96, 206, 200,
883 243, 253, 254, 255, 51, 225, 226, 237, 227, 279,
884 232, 52, 53, 159, 238, 54, 55, 56, 57, 58,
885 246, 63, 127, 128, 271, 272, 273, 274, 70, 71,
886 125, 260, 268, 275
887};
888
889 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
890 positive, shift that token. If negative, reduce the rule whose
891 number is the opposite. If YYTABLE_NINF, syntax error. */
892static const yytype_int16 yytable[] =
893{
894 93, 60, 256, 61, 84, 85, 86, 87, 250, 3,
895 277, 92, 251, 122, 239, 59, 139, 201, 76, 235,
896 140, 13, 278, 126, 62, 122, 131, 64, 133, 19,
897 126, 126, 122, 21, 65, 66, 141, 126, 126, 123,
898 124, 147, 126, 126, 150, 213, 152, 188, 214, 240,
899 62, 216, 202, 236, 258, 67, 134, 215, 123, 124,
900 219, 140, 158, 68, 160, 161, 162, 163, 164, 165,
901 166, 167, 168, 169, 170, 171, 172, 173, 174, 69,
902 176, 177, 178, 179, 126, 126, 182, 72, 242, 257,
903 136, 137, 4, 5, 252, 6, 7, 142, 143, 88,
904 9, 250, 148, 149, 11, 251, 262, 221, 13, 73,
905 14, 222, 16, 17, 74, 223, 19, 204, 75, 224,
906 21, 77, 94, 207, 22, 23, 24, 25, 26, 78,
907 28, 29, 30, 31, 32, 33, 34, 79, 36, 80,
908 83, 116, 117, 118, 180, 181, 89, 90, 211, 4,
909 5, 97, 6, 7, 81, 82, 119, 220, 120, 121,
910 151, 11, 144, 175, 39, 218, 135, 129, 130, 138,
911 145, 156, 158, 40, 41, 153, 157, 184, 212, 42,
912 43, 44, 183, 45, 46, 187, 47, 189, 190, 231,
913 233, 146, 113, 114, 115, 116, 117, 118, 191, 192,
914 195, 196, 247, 248, 4, 5, 265, 6, 7, 198,
915 8, 199, 9, 10, 209, 210, 11, 12, -33, 217,
916 13, 241, 14, 15, 16, 17, 230, 18, 19, 20,
917 245, 249, 21, 264, 267, 284, 22, 23, 24, 25,
918 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
919 36, 37, 38, 98, 269, 99, 270, 100, 101, 102,
920 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
921 113, 114, 115, 116, 117, 118, 39, -126, 276, 280,
922 281, 283, 266, 244, 263, 40, 41, 132, 282, 193,
923 185, 42, 43, 44, 0, 45, 46, 259, 47, 0,
924 48, 0, -47, 4, 5, 0, 6, 7, 0, 8,
925 0, 9, 10, 0, 0, 11, 12, 0, 0, 13,
926 0, 14, 15, 16, 17, 0, 18, 19, 20, 0,
927 0, 21, 0, 0, 0, 22, 23, 24, 25, 26,
928 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
929 37, 38, 98, 0, 99, 0, 100, 101, 102, 103,
930 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
931 114, 115, 116, 117, 118, 39, 0, 0, 0, 0,
932 0, 0, 0, 0, 40, 41, 0, 154, 0, 0,
933 42, 43, 44, 0, 45, 46, 0, 47, 0, 48,
934 155, -47, 4, 5, 0, 6, 7, 0, 8, 0,
935 9, 10, 0, 0, 11, 12, 0, 0, 13, 0,
936 14, 15, 16, 17, 0, 18, 19, 20, 0, 0,
937 21, 0, 0, 0, 22, 23, 24, 25, 26, 27,
938 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
939 38, 98, 0, 99, 0, 100, 101, 102, 103, 104,
940 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
941 115, 116, 117, 118, 39, 0, 0, 0, 0, 0,
942 0, 0, 0, 40, 41, 0, 186, 0, 0, 42,
943 43, 44, 0, 45, 46, 0, 47, 0, 48, 285,
944 -47, 4, 5, 0, 6, 7, 0, 8, 0, 9,
945 10, 0, 0, 11, 12, 0, 0, 13, 0, 14,
946 15, 16, 17, 0, 18, 19, 20, 0, 0, 21,
947 0, 0, 0, 22, 23, 24, 25, 26, 27, 28,
948 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
949 98, 0, 99, 0, 100, 101, 102, 103, 104, 105,
950 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
951 116, 117, 118, 39, 0, 0, 0, 0, 0, 0,
952 0, 0, 40, 41, 0, 194, 0, 0, 42, 43,
953 44, 0, 45, 46, 0, 47, 0, 48, 0, -47,
954 4, 5, 0, 6, 7, 0, 0, 0, 9, 0,
955 0, 0, 11, 0, 91, 0, 13, 0, 14, 0,
956 16, 17, 0, 0, 19, 0, 0, 0, 21, 0,
957 0, 0, 22, 23, 24, 25, 26, 0, 28, 29,
958 30, 31, 32, 33, 34, 98, 36, 99, 0, 100,
959 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
960 111, 112, 113, 114, 115, 116, 117, 118, 0, 0,
961 0, 0, 39, 0, 0, 0, 0, 0, 0, 0,
962 197, 40, 41, 0, 0, 0, 0, 42, 43, 44,
963 0, 45, 46, 0, 47, 4, 5, 0, 6, 7,
964 0, 0, 0, 9, 0, 0, 0, 11, 0, 0,
965 0, 13, 0, 14, 0, 16, 17, 0, 0, 19,
966 0, 0, 0, 21, 0, 0, 0, 22, 23, 24,
967 25, 26, 0, 28, 29, 30, 31, 32, 33, 34,
968 98, 36, 99, 0, 100, 101, 102, 103, 104, 105,
969 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
970 116, 117, 118, 0, 0, 0, 0, 39, 0, 0,
971 0, 0, 0, 0, 0, 203, 40, 41, 0, 0,
972 0, 0, 42, 43, 44, 0, 45, 46, 0, 47,
973 4, 5, 0, 6, 7, 0, 0, 0, 9, 0,
974 0, 0, 11, 0, 0, 0, 229, 0, 14, 0,
975 16, 17, 0, 0, 19, 0, 0, 0, 21, 0,
976 0, 0, 22, 23, 24, 25, 26, 0, 28, 29,
977 30, 31, 32, 33, 34, 98, 36, 99, 0, 100,
978 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
979 111, 112, 113, 114, 115, 116, 117, 118, 0, 0,
980 0, 0, 39, 0, 0, 0, 0, 0, 0, 0,
981 234, 40, 41, 0, 0, 0, 0, 42, 43, 44,
982 0, 45, 46, 98, 47, 99, 0, 100, 101, 102,
983 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
984 113, 114, 115, 116, 117, 118, 0, 0, 0, 0,
985 0, 0, 0, 0, 0, 0, 0, 98, 261, 99,
986 228, 100, 101, 102, 103, 104, 105, 106, 107, 108,
987 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
988 98, 0, 99, 0, 100, 101, 102, 103, 104, 105,
989 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
990 116, 117, 118, 208, 0, 99, 0, 100, 101, 102,
991 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
992 113, 114, 115, 116, 117, 118, 99, 0, 100, 101,
993 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
994 112, 113, 114, 115, 116, 117, 118, 101, 102, 103,
995 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
996 114, 115, 116, 117, 118, 102, 103, 104, 105, 106,
997 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
998 117, 118, 103, 104, 105, 106, 107, 108, 109, 110,
999 111, 112, 113, 114, 115, 116, 117, 118, 104, 105,
1000 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
1001 116, 117, 118, 105, 106, 107, 108, 109, 110, 111,
1002 112, 113, 114, 115, 116, 117, 118, -127, -127, 107,
1003 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
1004 118, -127, -127, -127, -127, 111, 112, 113, 114, 115,
1005 116, 117, 118
1006};
1007
1008static const yytype_int16 yycheck[] =
1009{
1010 48, 10, 18, 12, 40, 41, 42, 43, 15, 0,
1011 20, 47, 19, 69, 68, 104, 28, 68, 27, 68,
1012 32, 20, 32, 59, 104, 69, 62, 98, 64, 28,
1013 66, 67, 69, 32, 98, 98, 72, 73, 74, 95,
1014 96, 77, 78, 79, 80, 188, 82, 103, 191, 103,
1015 104, 194, 103, 102, 98, 98, 65, 28, 95, 96,
1016 203, 32, 98, 98, 100, 101, 102, 103, 104, 105,
1017 106, 107, 108, 109, 110, 111, 112, 113, 114, 106,
1018 116, 117, 118, 119, 120, 121, 122, 98, 231, 105,
1019 66, 67, 4, 5, 101, 7, 8, 73, 74, 20,
1020 12, 15, 78, 79, 16, 19, 249, 20, 20, 98,
1021 22, 24, 24, 25, 98, 28, 28, 153, 98, 32,
1022 32, 98, 30, 159, 36, 37, 38, 39, 40, 98,
1023 42, 43, 44, 45, 46, 47, 48, 98, 50, 98,
1024 39, 88, 89, 90, 120, 121, 45, 46, 184, 4,
1025 5, 102, 7, 8, 98, 98, 98, 205, 98, 98,
1026 20, 16, 103, 20, 76, 201, 65, 102, 102, 68,
1027 102, 71, 208, 85, 86, 103, 18, 68, 187, 91,
1028 92, 93, 105, 95, 96, 102, 98, 103, 103, 21,
1029 100, 103, 85, 86, 87, 88, 89, 90, 103, 106,
1030 103, 103, 238, 239, 4, 5, 254, 7, 8, 103,
1031 10, 103, 12, 13, 103, 103, 16, 17, 18, 103,
1032 20, 230, 22, 23, 24, 25, 102, 27, 28, 29,
1033 104, 103, 32, 71, 105, 283, 36, 37, 38, 39,
1034 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1035 50, 51, 52, 68, 71, 70, 18, 72, 73, 74,
1036 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1037 85, 86, 87, 88, 89, 90, 76, 103, 68, 103,
1038 18, 100, 254, 235, 250, 85, 86, 63, 276, 139,
1039 105, 91, 92, 93, -1, 95, 96, 246, 98, -1,
1040 100, -1, 102, 4, 5, -1, 7, 8, -1, 10,
1041 -1, 12, 13, -1, -1, 16, 17, -1, -1, 20,
1042 -1, 22, 23, 24, 25, -1, 27, 28, 29, -1,
1043 -1, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1044 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1045 51, 52, 68, -1, 70, -1, 72, 73, 74, 75,
1046 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1047 86, 87, 88, 89, 90, 76, -1, -1, -1, -1,
1048 -1, -1, -1, -1, 85, 86, -1, 103, -1, -1,
1049 91, 92, 93, -1, 95, 96, -1, 98, -1, 100,
1050 101, 102, 4, 5, -1, 7, 8, -1, 10, -1,
1051 12, 13, -1, -1, 16, 17, -1, -1, 20, -1,
1052 22, 23, 24, 25, -1, 27, 28, 29, -1, -1,
1053 32, -1, -1, -1, 36, 37, 38, 39, 40, 41,
1054 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
1055 52, 68, -1, 70, -1, 72, 73, 74, 75, 76,
1056 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1057 87, 88, 89, 90, 76, -1, -1, -1, -1, -1,
1058 -1, -1, -1, 85, 86, -1, 103, -1, -1, 91,
1059 92, 93, -1, 95, 96, -1, 98, -1, 100, 101,
1060 102, 4, 5, -1, 7, 8, -1, 10, -1, 12,
1061 13, -1, -1, 16, 17, -1, -1, 20, -1, 22,
1062 23, 24, 25, -1, 27, 28, 29, -1, -1, 32,
1063 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1064 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
1065 68, -1, 70, -1, 72, 73, 74, 75, 76, 77,
1066 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1067 88, 89, 90, 76, -1, -1, -1, -1, -1, -1,
1068 -1, -1, 85, 86, -1, 103, -1, -1, 91, 92,
1069 93, -1, 95, 96, -1, 98, -1, 100, -1, 102,
1070 4, 5, -1, 7, 8, -1, -1, -1, 12, -1,
1071 -1, -1, 16, -1, 18, -1, 20, -1, 22, -1,
1072 24, 25, -1, -1, 28, -1, -1, -1, 32, -1,
1073 -1, -1, 36, 37, 38, 39, 40, -1, 42, 43,
1074 44, 45, 46, 47, 48, 68, 50, 70, -1, 72,
1075 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1076 83, 84, 85, 86, 87, 88, 89, 90, -1, -1,
1077 -1, -1, 76, -1, -1, -1, -1, -1, -1, -1,
1078 103, 85, 86, -1, -1, -1, -1, 91, 92, 93,
1079 -1, 95, 96, -1, 98, 4, 5, -1, 7, 8,
1080 -1, -1, -1, 12, -1, -1, -1, 16, -1, -1,
1081 -1, 20, -1, 22, -1, 24, 25, -1, -1, 28,
1082 -1, -1, -1, 32, -1, -1, -1, 36, 37, 38,
1083 39, 40, -1, 42, 43, 44, 45, 46, 47, 48,
1084 68, 50, 70, -1, 72, 73, 74, 75, 76, 77,
1085 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1086 88, 89, 90, -1, -1, -1, -1, 76, -1, -1,
1087 -1, -1, -1, -1, -1, 103, 85, 86, -1, -1,
1088 -1, -1, 91, 92, 93, -1, 95, 96, -1, 98,
1089 4, 5, -1, 7, 8, -1, -1, -1, 12, -1,
1090 -1, -1, 16, -1, -1, -1, 20, -1, 22, -1,
1091 24, 25, -1, -1, 28, -1, -1, -1, 32, -1,
1092 -1, -1, 36, 37, 38, 39, 40, -1, 42, 43,
1093 44, 45, 46, 47, 48, 68, 50, 70, -1, 72,
1094 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1095 83, 84, 85, 86, 87, 88, 89, 90, -1, -1,
1096 -1, -1, 76, -1, -1, -1, -1, -1, -1, -1,
1097 103, 85, 86, -1, -1, -1, -1, 91, 92, 93,
1098 -1, 95, 96, 68, 98, 70, -1, 72, 73, 74,
1099 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1100 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
1101 -1, -1, -1, -1, -1, -1, -1, 68, 103, 70,
1102 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1103 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
1104 68, -1, 70, -1, 72, 73, 74, 75, 76, 77,
1105 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1106 88, 89, 90, 68, -1, 70, -1, 72, 73, 74,
1107 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1108 85, 86, 87, 88, 89, 90, 70, -1, 72, 73,
1109 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
1110 84, 85, 86, 87, 88, 89, 90, 73, 74, 75,
1111 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1112 86, 87, 88, 89, 90, 74, 75, 76, 77, 78,
1113 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1114 89, 90, 75, 76, 77, 78, 79, 80, 81, 82,
1115 83, 84, 85, 86, 87, 88, 89, 90, 76, 77,
1116 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1117 88, 89, 90, 77, 78, 79, 80, 81, 82, 83,
1118 84, 85, 86, 87, 88, 89, 90, 77, 78, 79,
1119 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
1120 90, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1121 88, 89, 90
1122};
1123
1124 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1125 symbol of state STATE-NUM. */
1126static const yytype_uint8 yystos[] =
1127{
1128 0, 108, 112, 0, 4, 5, 7, 8, 10, 12,
1129 13, 16, 17, 20, 22, 23, 24, 25, 27, 28,
1130 29, 32, 36, 37, 38, 39, 40, 41, 42, 43,
1131 44, 45, 46, 47, 48, 49, 50, 51, 52, 76,
1132 85, 86, 91, 92, 93, 95, 96, 98, 100, 109,
1133 113, 121, 128, 129, 132, 133, 134, 135, 136, 104,
1134 128, 128, 104, 138, 98, 98, 98, 98, 98, 106,
1135 145, 146, 98, 98, 98, 98, 128, 98, 98, 98,
1136 98, 98, 98, 136, 129, 129, 129, 129, 20, 136,
1137 136, 18, 129, 112, 30, 110, 114, 102, 68, 70,
1138 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1139 82, 83, 84, 85, 86, 87, 88, 89, 90, 98,
1140 98, 98, 69, 95, 96, 147, 129, 139, 140, 102,
1141 102, 129, 145, 129, 128, 136, 139, 139, 136, 28,
1142 32, 129, 139, 139, 103, 102, 103, 129, 139, 139,
1143 129, 20, 129, 103, 103, 101, 71, 18, 129, 130,
1144 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
1145 129, 129, 129, 129, 129, 20, 129, 129, 129, 129,
1146 139, 139, 129, 105, 68, 105, 103, 102, 103, 103,
1147 103, 103, 106, 146, 103, 103, 103, 103, 103, 103,
1148 116, 68, 103, 103, 129, 111, 115, 129, 68, 103,
1149 103, 129, 128, 113, 113, 28, 113, 103, 129, 113,
1150 112, 20, 24, 28, 32, 122, 123, 125, 71, 20,
1151 102, 21, 127, 100, 103, 68, 102, 124, 131, 68,
1152 103, 128, 113, 117, 123, 104, 137, 129, 129, 103,
1153 15, 19, 101, 118, 119, 120, 18, 105, 98, 147,
1154 148, 103, 113, 133, 71, 112, 120, 105, 149, 71,
1155 18, 141, 142, 143, 144, 150, 68, 20, 32, 126,
1156 103, 18, 143, 100, 112, 101
1157};
1158
1159 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1160static const yytype_uint8 yyr1[] =
1161{
1162 0, 107, 108, 109, 109, 111, 110, 112, 112, 113,
1163 113, 114, 115, 113, 113, 113, 113, 113, 113, 113,
1164 113, 116, 113, 113, 113, 113, 117, 117, 118, 119,
1165 119, 120, 120, 121, 121, 122, 122, 124, 123, 125,
1166 125, 125, 125, 126, 126, 127, 127, 128, 128, 129,
1167 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
1168 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
1169 130, 131, 129, 129, 129, 129, 129, 129, 129, 129,
1170 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
1171 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
1172 129, 132, 132, 133, 133, 133, 133, 133, 134, 134,
1173 134, 135, 135, 136, 136, 136, 137, 137, 137, 138,
1174 138, 139, 139, 140, 140, 141, 141, 141, 142, 142,
1175 144, 143, 145, 145, 145, 146, 146, 147, 147, 148,
1176 149, 150, 148
1177};
1178
1179 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1180static const yytype_int8 yyr2[] =
1181{
1182 0, 2, 2, 0, 2, 0, 4, 0, 2, 3,
1183 2, 0, 0, 6, 6, 5, 9, 5, 4, 6,
1184 5, 0, 8, 3, 3, 3, 0, 2, 2, 1,
1185 2, 3, 2, 0, 1, 1, 3, 0, 4, 1,
1186 1, 1, 1, 1, 1, 0, 2, 0, 1, 3,
1187 4, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1188 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1189 0, 0, 7, 2, 2, 2, 2, 2, 2, 4,
1190 4, 4, 4, 4, 6, 8, 4, 3, 3, 4,
1191 4, 4, 4, 4, 2, 2, 2, 3, 2, 2,
1192 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1193 1, 1, 1, 2, 3, 1, 0, 2, 3, 0,
1194 3, 0, 1, 1, 3, 0, 1, 1, 1, 3,
1195 0, 3, 0, 1, 3, 2, 2, 0, 2, 1,
1196 0, 0, 8
1197};
1198
1199
1200#define yyerrok (yyerrstatus = 0)
1201#define yyclearin (yychar = YYEMPTY)
1202#define YYEMPTY (-2)
1203#define YYEOF 0
1204
1205#define YYACCEPT goto yyacceptlab
1206#define YYABORT goto yyabortlab
1207#define YYERROR goto yyerrorlab
1208
1209
1210#define YYRECOVERING() (!!yyerrstatus)
1211
1212#define YYBACKUP(Token, Value) \
1213 do \
1214 if (yychar == YYEMPTY) \
1215 { \
1216 yychar = (Token); \
1217 yylval = (Value); \
1218 YYPOPSTACK (yylen); \
1219 yystate = *yyssp; \
1220 goto yybackup; \
1221 } \
1222 else \
1223 { \
1224 yyerror (YY_("syntax error: cannot back up")); \
1225 YYERROR; \
1226 } \
1227 while (0)
1228
1229/* Error token number */
1230#define YYTERROR 1
1231#define YYERRCODE 256
1232
1233
1234
1235/* Enable debugging if requested. */
1236#if EX_DEBUG
1237
1238# ifndef YYFPRINTF
1239# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1240# define YYFPRINTF fprintf
1241# endif
1242
1243# define YYDPRINTF(Args) \
1244do { \
1245 if (yydebug) \
1246 YYFPRINTF Args; \
1247} while (0)
1248
1249/* This macro is provided for backward compatibility. */
1250#ifndef YY_LOCATION_PRINT
1251# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1252#endif
1253
1254
1255# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1256do { \
1257 if (yydebug) \
1258 { \
1259 YYFPRINTF (stderr, "%s ", Title); \
1260 yy_symbol_print (stderr, \
1261 Type, Value); \
1262 YYFPRINTF (stderr, "\n"); \
1263 } \
1264} while (0)
1265
1266
1267/*-----------------------------------.
1268| Print this symbol's value on YYO. |
1269`-----------------------------------*/
1270
1271static void
1272yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1273{
1274 FILE *yyoutput = yyo;
1275 YYUSE (yyoutput);
1276 if (!yyvaluep)
1277 return;
1278# ifdef YYPRINT
1279 if (yytype < YYNTOKENS)
1280 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1281# endif
1283 YYUSE (yytype);
1285}
1286
1287
1288/*---------------------------.
1289| Print this symbol on YYO. |
1290`---------------------------*/
1291
1292static void
1293yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1294{
1295 YYFPRINTF (yyo, "%s %s (",
1296 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1297
1298 yy_symbol_value_print (yyo, yytype, yyvaluep);
1299 YYFPRINTF (yyo, ")");
1300}
1301
1302/*------------------------------------------------------------------.
1303| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1304| TOP (included). |
1305`------------------------------------------------------------------*/
1306
1307static void
1308yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1309{
1310 YYFPRINTF (stderr, "Stack now");
1311 for (; yybottom <= yytop; yybottom++)
1312 {
1313 int yybot = *yybottom;
1314 YYFPRINTF (stderr, " %d", yybot);
1315 }
1316 YYFPRINTF (stderr, "\n");
1317}
1318
1319# define YY_STACK_PRINT(Bottom, Top) \
1320do { \
1321 if (yydebug) \
1322 yy_stack_print ((Bottom), (Top)); \
1323} while (0)
1324
1325
1326/*------------------------------------------------.
1327| Report that the YYRULE is going to be reduced. |
1328`------------------------------------------------*/
1329
1330static void
1331yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
1332{
1333 int yylno = yyrline[yyrule];
1334 int yynrhs = yyr2[yyrule];
1335 int yyi;
1336 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1337 yyrule - 1, yylno);
1338 /* The symbols being reduced. */
1339 for (yyi = 0; yyi < yynrhs; yyi++)
1340 {
1341 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1342 yy_symbol_print (stderr,
1343 yystos[+yyssp[yyi + 1 - yynrhs]],
1344 &yyvsp[(yyi + 1) - (yynrhs)]
1345 );
1346 YYFPRINTF (stderr, "\n");
1347 }
1348}
1349
1350# define YY_REDUCE_PRINT(Rule) \
1351do { \
1352 if (yydebug) \
1353 yy_reduce_print (yyssp, yyvsp, Rule); \
1354} while (0)
1355
1356/* Nonzero means print parse trace. It is left uninitialized so that
1357 multiple parsers can coexist. */
1358int yydebug;
1359#else /* !EX_DEBUG */
1360# define YYDPRINTF(Args)
1361# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1362# define YY_STACK_PRINT(Bottom, Top)
1363# define YY_REDUCE_PRINT(Rule)
1364#endif /* !EX_DEBUG */
1365
1366
1367/* YYINITDEPTH -- initial size of the parser's stacks. */
1368#ifndef YYINITDEPTH
1369# define YYINITDEPTH 200
1370#endif
1371
1372/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1373 if the built-in stack extension method is used).
1374
1375 Do not make this value too large; the results are undefined if
1376 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1377 evaluated with infinite-precision integer arithmetic. */
1378
1379#ifndef YYMAXDEPTH
1380# define YYMAXDEPTH 10000
1381#endif
1382
1383
1384#if YYERROR_VERBOSE
1385
1386# ifndef yystrlen
1387# if defined __GLIBC__ && defined _STRING_H
1388# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1389# else
1390/* Return the length of YYSTR. */
1391static YYPTRDIFF_T
1392yystrlen (const char *yystr)
1393{
1394 YYPTRDIFF_T yylen;
1395 for (yylen = 0; yystr[yylen]; yylen++)
1396 continue;
1397 return yylen;
1398}
1399# endif
1400# endif
1401
1402# ifndef yystpcpy
1403# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1404# define yystpcpy stpcpy
1405# else
1406/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1407 YYDEST. */
1408static char *
1409yystpcpy (char *yydest, const char *yysrc)
1410{
1411 char *yyd = yydest;
1412 const char *yys = yysrc;
1413
1414 while ((*yyd++ = *yys++) != '\0')
1415 continue;
1416
1417 return yyd - 1;
1418}
1419# endif
1420# endif
1421
1422# ifndef yytnamerr
1423/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1424 quotes and backslashes, so that it's suitable for yyerror. The
1425 heuristic is that double-quoting is unnecessary unless the string
1426 contains an apostrophe, a comma, or backslash (other than
1427 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1428 null, do not copy; instead, return the length of what the result
1429 would have been. */
1430static YYPTRDIFF_T
1431yytnamerr (char *yyres, const char *yystr)
1432{
1433 if (*yystr == '"')
1434 {
1435 YYPTRDIFF_T yyn = 0;
1436 char const *yyp = yystr;
1437
1438 for (;;)
1439 switch (*++yyp)
1440 {
1441 case '\'':
1442 case ',':
1443 goto do_not_strip_quotes;
1444
1445 case '\\':
1446 if (*++yyp != '\\')
1447 goto do_not_strip_quotes;
1448 else
1449 goto append;
1450
1451 append:
1452 default:
1453 if (yyres)
1454 yyres[yyn] = *yyp;
1455 yyn++;
1456 break;
1457
1458 case '"':
1459 if (yyres)
1460 yyres[yyn] = '\0';
1461 return yyn;
1462 }
1463 do_not_strip_quotes: ;
1464 }
1465
1466 if (yyres)
1467 return yystpcpy (yyres, yystr) - yyres;
1468 else
1469 return yystrlen (yystr);
1470}
1471# endif
1472
1473/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1474 about the unexpected token YYTOKEN for the state stack whose top is
1475 YYSSP.
1476
1477 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1478 not large enough to hold the message. In that case, also set
1479 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1480 required number of bytes is too large to store. */
1481static int
1482yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1483 yy_state_t *yyssp, int yytoken)
1484{
1485 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1486 /* Internationalized format string. */
1487 const char *yyformat = YY_NULLPTR;
1488 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1489 one per "expected"). */
1490 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1491 /* Actual size of YYARG. */
1492 int yycount = 0;
1493 /* Cumulated lengths of YYARG. */
1494 YYPTRDIFF_T yysize = 0;
1495
1496 /* There are many possibilities here to consider:
1497 - If this state is a consistent state with a default action, then
1498 the only way this function was invoked is if the default action
1499 is an error action. In that case, don't check for expected
1500 tokens because there are none.
1501 - The only way there can be no lookahead present (in yychar) is if
1502 this state is a consistent state with a default action. Thus,
1503 detecting the absence of a lookahead is sufficient to determine
1504 that there is no unexpected or expected token to report. In that
1505 case, just report a simple "syntax error".
1506 - Don't assume there isn't a lookahead just because this state is a
1507 consistent state with a default action. There might have been a
1508 previous inconsistent state, consistent state with a non-default
1509 action, or user semantic action that manipulated yychar.
1510 - Of course, the expected token list depends on states to have
1511 correct lookahead information, and it depends on the parser not
1512 to perform extra reductions after fetching a lookahead from the
1513 scanner and before detecting a syntax error. Thus, state merging
1514 (from LALR or IELR) and default reductions corrupt the expected
1515 token list. However, the list is correct for canonical LR with
1516 one exception: it will still contain any token that will not be
1517 accepted due to an error action in a later state.
1518 */
1519 if (yytoken != YYEMPTY)
1520 {
1521 int yyn = yypact[+*yyssp];
1522 YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1523 yysize = yysize0;
1524 yyarg[yycount++] = yytname[yytoken];
1525 if (!yypact_value_is_default (yyn))
1526 {
1527 /* Start YYX at -YYN if negative to avoid negative indexes in
1528 YYCHECK. In other words, skip the first -YYN actions for
1529 this state because they are default actions. */
1530 int yyxbegin = yyn < 0 ? -yyn : 0;
1531 /* Stay within bounds of both yycheck and yytname. */
1532 int yychecklim = YYLAST - yyn + 1;
1533 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1534 int yyx;
1535
1536 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1537 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1538 && !yytable_value_is_error (yytable[yyx + yyn]))
1539 {
1540 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1541 {
1542 yycount = 1;
1543 yysize = yysize0;
1544 break;
1545 }
1546 yyarg[yycount++] = yytname[yyx];
1547 {
1548 YYPTRDIFF_T yysize1
1549 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1550 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1551 yysize = yysize1;
1552 else
1553 return 2;
1554 }
1555 }
1556 }
1557 }
1558
1559 switch (yycount)
1560 {
1561# define YYCASE_(N, S) \
1562 case N: \
1563 yyformat = S; \
1564 break
1565 default: /* Avoid compiler warnings. */
1566 YYCASE_(0, YY_("syntax error"));
1567 YYCASE_(1, YY_("syntax error, unexpected %s"));
1568 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1569 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1570 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1571 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1572# undef YYCASE_
1573 }
1574
1575 {
1576 /* Don't count the "%s"s in the final size, but reserve room for
1577 the terminator. */
1578 YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1579 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1580 yysize = yysize1;
1581 else
1582 return 2;
1583 }
1584
1585 if (*yymsg_alloc < yysize)
1586 {
1587 *yymsg_alloc = 2 * yysize;
1588 if (! (yysize <= *yymsg_alloc
1589 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1590 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1591 return 1;
1592 }
1593
1594 /* Avoid sprintf, as that infringes on the user's name space.
1595 Don't have undefined behavior even if the translation
1596 produced a string with the wrong number of "%s"s. */
1597 {
1598 char *yyp = *yymsg;
1599 int yyi = 0;
1600 while ((*yyp = *yyformat) != '\0')
1601 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1602 {
1603 yyp += yytnamerr (yyp, yyarg[yyi++]);
1604 yyformat += 2;
1605 }
1606 else
1607 {
1608 ++yyp;
1609 ++yyformat;
1610 }
1611 }
1612 return 0;
1613}
1614#endif /* YYERROR_VERBOSE */
1615
1616/*-----------------------------------------------.
1617| Release the memory associated to this symbol. |
1618`-----------------------------------------------*/
1619
1620static void
1621yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1622{
1623 YYUSE (yyvaluep);
1624 if (!yymsg)
1625 yymsg = "Deleting";
1626 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1627
1629 YYUSE (yytype);
1631}
1632
1633
1634
1635
1636/* The lookahead symbol. */
1638
1639/* The semantic value of the lookahead symbol. */
1641/* Number of syntax errors so far. */
1643
1644
1645/*----------.
1646| yyparse. |
1647`----------*/
1648
1649int
1651{
1652 yy_state_fast_t yystate;
1653 /* Number of tokens to shift before error messages enabled. */
1654 int yyerrstatus;
1655
1656 /* The stacks and their tools:
1657 'yyss': related to states.
1658 'yyvs': related to semantic values.
1659
1660 Refer to the stacks through separate pointers, to allow yyoverflow
1661 to reallocate them elsewhere. */
1662
1663 /* The state stack. */
1664 yy_state_t yyssa[YYINITDEPTH];
1665 yy_state_t *yyss;
1666 yy_state_t *yyssp;
1667
1668 /* The semantic value stack. */
1669 YYSTYPE yyvsa[YYINITDEPTH];
1670 YYSTYPE *yyvs;
1671 YYSTYPE *yyvsp;
1672
1673 YYPTRDIFF_T yystacksize;
1674
1675 int yyn;
1676 int yyresult;
1677 /* Lookahead token as an internal (translated) token number. */
1678 int yytoken = 0;
1679 /* The variables used to return semantic value and location from the
1680 action routines. */
1681 YYSTYPE yyval;
1682
1683#if YYERROR_VERBOSE
1684 /* Buffer for error messages, and its allocated size. */
1685 char yymsgbuf[128];
1686 char *yymsg = yymsgbuf;
1687 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1688#endif
1689
1690#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1691
1692 /* The number of symbols on the RHS of the reduced rule.
1693 Keep to zero when no symbol should be popped. */
1694 int yylen = 0;
1695
1696 yyssp = yyss = yyssa;
1697 yyvsp = yyvs = yyvsa;
1698 yystacksize = YYINITDEPTH;
1699
1700 YYDPRINTF ((stderr, "Starting parse\n"));
1701
1702 yystate = 0;
1703 yyerrstatus = 0;
1704 yynerrs = 0;
1705 yychar = YYEMPTY; /* Cause a token to be read. */
1706 goto yysetstate;
1707
1708
1709/*------------------------------------------------------------.
1710| yynewstate -- push a new state, which is found in yystate. |
1711`------------------------------------------------------------*/
1712yynewstate:
1713 /* In all cases, when you get here, the value and location stacks
1714 have just been pushed. So pushing a state here evens the stacks. */
1715 yyssp++;
1716
1717
1718/*--------------------------------------------------------------------.
1719| yysetstate -- set current state (the top of the stack) to yystate. |
1720`--------------------------------------------------------------------*/
1721yysetstate:
1722 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1723 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1725 *yyssp = YY_CAST (yy_state_t, yystate);
1727
1728 if (yyss + yystacksize - 1 <= yyssp)
1729#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1730 goto yyexhaustedlab;
1731#else
1732 {
1733 /* Get the current used size of the three stacks, in elements. */
1734 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1735
1736# if defined yyoverflow
1737 {
1738 /* Give user a chance to reallocate the stack. Use copies of
1739 these so that the &'s don't force the real ones into
1740 memory. */
1741 yy_state_t *yyss1 = yyss;
1742 YYSTYPE *yyvs1 = yyvs;
1743
1744 /* Each stack pointer address is followed by the size of the
1745 data in use in that stack, in bytes. This used to be a
1746 conditional around just the two extra args, but that might
1747 be undefined if yyoverflow is a macro. */
1748 yyoverflow (YY_("memory exhausted"),
1749 &yyss1, yysize * YYSIZEOF (*yyssp),
1750 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1751 &yystacksize);
1752 yyss = yyss1;
1753 yyvs = yyvs1;
1754 }
1755# else /* defined YYSTACK_RELOCATE */
1756 /* Extend the stack our own way. */
1757 if (YYMAXDEPTH <= yystacksize)
1758 goto yyexhaustedlab;
1759 yystacksize *= 2;
1760 if (YYMAXDEPTH < yystacksize)
1761 yystacksize = YYMAXDEPTH;
1762
1763 {
1764 yy_state_t *yyss1 = yyss;
1765 union yyalloc *yyptr =
1766 YY_CAST (union yyalloc *,
1767 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1768 if (! yyptr)
1769 goto yyexhaustedlab;
1770 YYSTACK_RELOCATE (yyss_alloc, yyss);
1771 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1772# undef YYSTACK_RELOCATE
1773 if (yyss1 != yyssa)
1774 YYSTACK_FREE (yyss1);
1775 }
1776# endif
1777
1778 yyssp = yyss + yysize - 1;
1779 yyvsp = yyvs + yysize - 1;
1780
1782 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1783 YY_CAST (long, yystacksize)));
1785
1786 if (yyss + yystacksize - 1 <= yyssp)
1787 YYABORT;
1788 }
1789#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1790
1791 if (yystate == YYFINAL)
1792 YYACCEPT;
1793
1794 goto yybackup;
1795
1796
1797/*-----------.
1798| yybackup. |
1799`-----------*/
1800yybackup:
1801 /* Do appropriate processing given the current state. Read a
1802 lookahead token if we need one and don't already have one. */
1803
1804 /* First try to decide what to do without reference to lookahead token. */
1805 yyn = yypact[yystate];
1806 if (yypact_value_is_default (yyn))
1807 goto yydefault;
1808
1809 /* Not known => get a lookahead token if don't already have one. */
1810
1811 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1812 if (yychar == YYEMPTY)
1813 {
1814 YYDPRINTF ((stderr, "Reading a token: "));
1815 yychar = yylex ();
1816 }
1817
1818 if (yychar <= YYEOF)
1819 {
1820 yychar = yytoken = YYEOF;
1821 YYDPRINTF ((stderr, "Now at end of input.\n"));
1822 }
1823 else
1824 {
1825 yytoken = YYTRANSLATE (yychar);
1826 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1827 }
1828
1829 /* If the proper action on seeing token YYTOKEN is to reduce or to
1830 detect an error, take that action. */
1831 yyn += yytoken;
1832 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1833 goto yydefault;
1834 yyn = yytable[yyn];
1835 if (yyn <= 0)
1836 {
1837 if (yytable_value_is_error (yyn))
1838 goto yyerrlab;
1839 yyn = -yyn;
1840 goto yyreduce;
1841 }
1842
1843 /* Count tokens shifted since error; after three, turn off error
1844 status. */
1845 if (yyerrstatus)
1846 yyerrstatus--;
1847
1848 /* Shift the lookahead token. */
1849 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1850 yystate = yyn;
1852 *++yyvsp = yylval;
1854
1855 /* Discard the shifted token. */
1856 yychar = YYEMPTY;
1857 goto yynewstate;
1858
1859
1860/*-----------------------------------------------------------.
1861| yydefault -- do the default action for the current state. |
1862`-----------------------------------------------------------*/
1863yydefault:
1864 yyn = yydefact[yystate];
1865 if (yyn == 0)
1866 goto yyerrlab;
1867 goto yyreduce;
1868
1869
1870/*-----------------------------.
1871| yyreduce -- do a reduction. |
1872`-----------------------------*/
1873yyreduce:
1874 /* yyn is the number of a rule to reduce with. */
1875 yylen = yyr2[yyn];
1876
1877 /* If YYLEN is nonzero, implement the default value of the action:
1878 '$$ = $1'.
1879
1880 Otherwise, the following line sets YYVAL to garbage.
1881 This behavior is undocumented and Bison
1882 users should not rely upon it. Assigning to YYVAL
1883 unconditionally makes the parser a bit smaller, and it avoids a
1884 GCC warning that YYVAL may be used uninitialized. */
1885 yyval = yyvsp[1-yylen];
1886
1887
1888 YY_REDUCE_PRINT (yyn);
1889 switch (yyn)
1890 {
1891 case 2:
1892#line 181 "../../lib/expr/exparse.y"
1893 {
1894 if ((yyvsp[-1].expr)) {
1895 if (expr.program->main.value)
1896 exfreenode(expr.program, expr.program->main.value);
1897 if ((yyvsp[-1].expr)->op == S2B)
1898 {
1899 Exnode_t* x;
1900
1901 x = (yyvsp[-1].expr);
1902 (yyvsp[-1].expr) = x->data.operand.left;
1903 x->data.operand.left = 0;
1905 }
1906 expr.program->main.lex = PROCEDURE;
1907 expr.program->main.value = exnewnode(expr.program, PROCEDURE, 1, (yyvsp[-1].expr)->type, NULL, (yyvsp[-1].expr));
1908 }
1909 }
1910#line 1911 "exparse.c"
1911 break;
1912
1913 case 5:
1914#line 204 "../../lib/expr/exparse.y"
1915 {
1916 Dtdisc_t* disc;
1917
1918 if (expr.procedure)
1919 exerror("no nested function definitions");
1920 (yyvsp[-1].id)->lex = PROCEDURE;
1921 expr.procedure = (yyvsp[-1].id)->value = exnewnode(expr.program, PROCEDURE, 1, (yyvsp[-1].id)->type, NULL, NULL);
1923 if (!(disc = calloc(1, sizeof(Dtdisc_t))))
1924 exnospace();
1925 disc->key = offsetof(Exid_t, name);
1926 if (expr.assigned && !streq((yyvsp[-1].id)->name, "begin"))
1927 {
1928 if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
1929 exnospace();
1930 expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
1931 }
1932 }
1933#line 1934 "exparse.c"
1934 break;
1935
1936 case 6:
1937#line 222 "../../lib/expr/exparse.y"
1938 {
1939 expr.procedure = 0;
1940 if (expr.program->frame)
1941 {
1942 expr.program->symbols = expr.program->frame->view;
1943 dtview(expr.program->frame, NULL);
1944 expr.program->frame = 0;
1945 }
1946 if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == S2B)
1947 {
1948 Exnode_t* x;
1949
1950 x = (yyvsp[0].expr);
1951 (yyvsp[0].expr) = x->data.operand.left;
1952 x->data.operand.left = 0;
1954 }
1955 (yyvsp[-3].id)->value->data.operand.right = excast(expr.program, (yyvsp[0].expr), (yyvsp[-3].id)->type, NULL, 0);
1956 }
1957#line 1958 "exparse.c"
1958 break;
1959
1960 case 7:
1961#line 244 "../../lib/expr/exparse.y"
1962 {
1963 (yyval.expr) = 0;
1964 }
1965#line 1966 "exparse.c"
1966 break;
1967
1968 case 8:
1969#line 248 "../../lib/expr/exparse.y"
1970 {
1971 if (!(yyvsp[-1].expr))
1972 (yyval.expr) = (yyvsp[0].expr);
1973 else if (!(yyvsp[0].expr))
1974 (yyval.expr) = (yyvsp[-1].expr);
1975 else if ((yyvsp[-1].expr)->op == CONSTANT)
1976 {
1977 exfreenode(expr.program, (yyvsp[-1].expr));
1978 (yyval.expr) = (yyvsp[0].expr);
1979 }
1980 else (yyval.expr) = exnewnode(expr.program, ';', 1, (yyvsp[0].expr)->type, (yyvsp[-1].expr), (yyvsp[0].expr));
1981 }
1982#line 1983 "exparse.c"
1983 break;
1984
1985 case 9:
1986#line 263 "../../lib/expr/exparse.y"
1987 {
1988 (yyval.expr) = (yyvsp[-1].expr);
1989 }
1990#line 1991 "exparse.c"
1991 break;
1992
1993 case 10:
1994#line 267 "../../lib/expr/exparse.y"
1995 {
1996 (yyval.expr) = ((yyvsp[-1].expr) && (yyvsp[-1].expr)->type == STRING) ? exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-1].expr), NULL) : (yyvsp[-1].expr);
1997 }
1998#line 1999 "exparse.c"
1999 break;
2000
2001 case 11:
2002#line 270 "../../lib/expr/exparse.y"
2003 {expr.instatic=(yyvsp[0].integer);}
2004#line 2005 "exparse.c"
2005 break;
2006
2007 case 12:
2008#line 270 "../../lib/expr/exparse.y"
2009 {expr.declare=(yyvsp[0].id)->type;}
2010#line 2011 "exparse.c"
2011 break;
2012
2013 case 13:
2014#line 271 "../../lib/expr/exparse.y"
2015 {
2016 (yyval.expr) = (yyvsp[-1].expr);
2017 expr.declare = 0;
2018 }
2019#line 2020 "exparse.c"
2020 break;
2021
2022 case 14:
2023#line 276 "../../lib/expr/exparse.y"
2024 {
2025 if (exisAssign ((yyvsp[-3].expr)))
2026 exwarn ("assignment used as boolean in if statement");
2027 if ((yyvsp[-3].expr)->type == STRING)
2028 (yyvsp[-3].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-3].expr), NULL);
2029 else if (!INTEGRAL((yyvsp[-3].expr)->type))
2030 (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), INTEGER, NULL, 0);
2031 (yyval.expr) = exnewnode(expr.program, (yyvsp[-5].id)->index, 1, INTEGER, (yyvsp[-3].expr), exnewnode(expr.program, ':', 1, (yyvsp[-1].expr) ? (yyvsp[-1].expr)->type : 0, (yyvsp[-1].expr), (yyvsp[0].expr)));
2032 }
2033#line 2034 "exparse.c"
2034 break;
2035
2036 case 15:
2037#line 286 "../../lib/expr/exparse.y"
2038 {
2039 (yyval.expr) = exnewnode(expr.program, ITERATE, 0, INTEGER, NULL, NULL);
2040 (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
2041 if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
2042 exerror("simple index variable expected");
2043 (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
2044 if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
2045 exerror("integer index variable expected");
2046 exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
2047 (yyvsp[-2].expr)->data.variable.index = 0;
2048 (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
2049 }
2050#line 2051 "exparse.c"
2051 break;
2052
2053 case 16:
2054#line 299 "../../lib/expr/exparse.y"
2055 {
2056 if (!(yyvsp[-4].expr))
2057 {
2058 (yyvsp[-4].expr) = exnewnode(expr.program, CONSTANT, 0, INTEGER, NULL, NULL);
2059 (yyvsp[-4].expr)->data.constant.value.integer = 1;
2060 }
2061 else if ((yyvsp[-4].expr)->type == STRING)
2062 (yyvsp[-4].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-4].expr), NULL);
2063 else if (!INTEGRAL((yyvsp[-4].expr)->type))
2064 (yyvsp[-4].expr) = excast(expr.program, (yyvsp[-4].expr), INTEGER, NULL, 0);
2065 (yyval.expr) = exnewnode(expr.program, (yyvsp[-8].id)->index, 1, INTEGER, (yyvsp[-4].expr), exnewnode(expr.program, ';', 1, 0, (yyvsp[-2].expr), (yyvsp[0].expr)));
2066 if ((yyvsp[-6].expr))
2067 (yyval.expr) = exnewnode(expr.program, ';', 1, INTEGER, (yyvsp[-6].expr), (yyval.expr));
2068 }
2069#line 2070 "exparse.c"
2070 break;
2071
2072 case 17:
2073#line 314 "../../lib/expr/exparse.y"
2074 {
2075 (yyval.expr) = exnewnode(expr.program, ITERATER, 0, INTEGER, NULL, NULL);
2076 (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
2077 if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
2078 exerror("simple index variable expected");
2079 (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
2080 if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
2081 exerror("integer index variable expected");
2082 exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
2083 (yyvsp[-2].expr)->data.variable.index = 0;
2084 (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
2085 }
2086#line 2087 "exparse.c"
2087 break;
2088
2089 case 18:
2090#line 327 "../../lib/expr/exparse.y"
2091 {
2092 if ((yyvsp[-1].id)->local == NULL)
2093 exerror("cannot apply unset to non-array %s", (yyvsp[-1].id)->name);
2094 (yyval.expr) = exnewnode(expr.program, UNSET, 0, INTEGER, NULL, NULL);
2095 (yyval.expr)->data.variable.symbol = (yyvsp[-1].id);
2096 (yyval.expr)->data.variable.index = NULL;
2097 }
2098#line 2099 "exparse.c"
2099 break;
2100
2101 case 19:
2102#line 335 "../../lib/expr/exparse.y"
2103 {
2104 if ((yyvsp[-3].id)->local == NULL)
2105 exerror("cannot apply unset to non-array %s", (yyvsp[-3].id)->name);
2106 if (((yyvsp[-3].id)->index_type > 0) && ((yyvsp[-1].expr)->type != (yyvsp[-3].id)->index_type))
2107 exerror("%s indices must have type %s, not %s",
2108 (yyvsp[-3].id)->name, extypename(expr.program, (yyvsp[-3].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
2109 (yyval.expr) = exnewnode(expr.program, UNSET, 0, INTEGER, NULL, NULL);
2110 (yyval.expr)->data.variable.symbol = (yyvsp[-3].id);
2111 (yyval.expr)->data.variable.index = (yyvsp[-1].expr);
2112 }
2113#line 2114 "exparse.c"
2114 break;
2115
2116 case 20:
2117#line 346 "../../lib/expr/exparse.y"
2118 {
2119 if (exisAssign ((yyvsp[-2].expr)))
2120 exwarn ("assignment used as boolean in while statement");
2121 if ((yyvsp[-2].expr)->type == STRING)
2122 (yyvsp[-2].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-2].expr), NULL);
2123 else if (!INTEGRAL((yyvsp[-2].expr)->type))
2124 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
2125 (yyval.expr) = exnewnode(expr.program, (yyvsp[-4].id)->index, 1, INTEGER, (yyvsp[-2].expr), exnewnode(expr.program, ';', 1, 0, NULL, (yyvsp[0].expr)));
2126 }
2127#line 2128 "exparse.c"
2128 break;
2129
2130 case 21:
2131#line 355 "../../lib/expr/exparse.y"
2132 {expr.declare=(yyvsp[0].expr)->type;}
2133#line 2134 "exparse.c"
2134 break;
2135
2136 case 22:
2137#line 356 "../../lib/expr/exparse.y"
2138 {
2139 Switch_t* sw = expr.swstate;
2140
2141 (yyval.expr) = exnewnode(expr.program, (yyvsp[-7].id)->index, 1, INTEGER, (yyvsp[-5].expr), exnewnode(expr.program, DEFAULT, 1, 0, sw->defcase, sw->firstcase));
2143 free(sw->base);
2144 if (sw != &swstate)
2145 free(sw);
2146 expr.declare = 0;
2147 }
2148#line 2149 "exparse.c"
2149 break;
2150
2151 case 23:
2152#line 367 "../../lib/expr/exparse.y"
2153 {
2154 loopop:
2155 if (!(yyvsp[-1].expr))
2156 {
2157 (yyvsp[-1].expr) = exnewnode(expr.program, CONSTANT, 0, INTEGER, NULL, NULL);
2158 (yyvsp[-1].expr)->data.constant.value.integer = 1;
2159 }
2160 else if (!INTEGRAL((yyvsp[-1].expr)->type))
2161 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2162 (yyval.expr) = exnewnode(expr.program, (yyvsp[-2].id)->index, 1, INTEGER, (yyvsp[-1].expr), NULL);
2163 }
2164#line 2165 "exparse.c"
2165 break;
2166
2167 case 24:
2168#line 379 "../../lib/expr/exparse.y"
2169 {
2170 goto loopop;
2171 }
2172#line 2173 "exparse.c"
2173 break;
2174
2175 case 25:
2176#line 383 "../../lib/expr/exparse.y"
2177 {
2178 if ((yyvsp[-1].expr))
2179 {
2180 if (expr.procedure && !expr.procedure->type)
2181 exerror("return in void function");
2182 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.procedure ? expr.procedure->type : INTEGER, NULL, 0);
2183 }
2184 (yyval.expr) = exnewnode(expr.program, RETURN, 1, (yyvsp[-1].expr) ? (yyvsp[-1].expr)->type : 0, (yyvsp[-1].expr), NULL);
2185 }
2186#line 2187 "exparse.c"
2187 break;
2188
2189 case 26:
2190#line 395 "../../lib/expr/exparse.y"
2191 {
2192 Switch_t* sw;
2193
2194 if (expr.swstate)
2195 {
2196 if (!(sw = calloc(1, sizeof(Switch_t))))
2197 {
2198 exnospace();
2199 sw = &swstate;
2200 }
2201 sw->prev = expr.swstate;
2202 }
2203 else
2204 sw = &swstate;
2205 expr.swstate = sw;
2206 sw->type = expr.declare;
2207 sw->firstcase = 0;
2208 sw->lastcase = 0;
2209 sw->defcase = 0;
2210 sw->def = 0;
2211 size_t n = 8;
2212 if (!(sw->base = calloc(n, sizeof(Extype_t*))))
2213 {
2214 exnospace();
2215 n = 0;
2216 }
2217 sw->cur = sw->base;
2218 sw->last = sw->base + n;
2219 }
2220#line 2221 "exparse.c"
2221 break;
2222
2223 case 28:
2224#line 428 "../../lib/expr/exparse.y"
2225 {
2226 Switch_t* sw = expr.swstate;
2227
2228 (yyval.expr) = exnewnode(expr.program, CASE, 1, 0, (yyvsp[0].expr), NULL);
2229 if (sw->cur > sw->base)
2230 {
2231 if (sw->lastcase)
2232 sw->lastcase->data.select.next = (yyval.expr);
2233 else
2234 sw->firstcase = (yyval.expr);
2235 sw->lastcase = (yyval.expr);
2236 size_t n = (size_t)(sw->cur - sw->base);
2237 sw->cur = sw->base;
2238 (yyval.expr)->data.select.constant = exalloc(expr.program, (n + 1) * sizeof(Extype_t*));
2239 memcpy((yyval.expr)->data.select.constant, sw->base, n * sizeof(Extype_t*));
2240 (yyval.expr)->data.select.constant[n] = 0;
2241 }
2242 else
2243 (yyval.expr)->data.select.constant = 0;
2244 if (sw->def)
2245 {
2246 sw->def = 0;
2247 if (sw->defcase)
2248 exerror("duplicate default in switch");
2249 else
2250 sw->defcase = (yyvsp[0].expr);
2251 }
2252 }
2253#line 2254 "exparse.c"
2254 break;
2255
2256 case 31:
2257#line 463 "../../lib/expr/exparse.y"
2258 {
2259 if (expr.swstate->cur >= expr.swstate->last)
2260 {
2261 size_t n = (size_t)(expr.swstate->cur - expr.swstate->base);
2262 if (!(expr.swstate->base = realloc(expr.swstate->base, sizeof(Extype_t*) * 2 * n)))
2263 {
2264 exerror("too many case labels for switch");
2265 n = 0;
2266 }
2267 expr.swstate->cur = expr.swstate->base + n;
2268 expr.swstate->last = expr.swstate->base + 2 * n;
2269 }
2270 if (expr.swstate->cur)
2271 {
2272 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.swstate->type, NULL, 0);
2273 *expr.swstate->cur++ = &((yyvsp[-1].expr)->data.constant.value);
2274 }
2275 }
2276#line 2277 "exparse.c"
2277 break;
2278
2279 case 32:
2280#line 482 "../../lib/expr/exparse.y"
2281 {
2282 expr.swstate->def = 1;
2283 }
2284#line 2285 "exparse.c"
2285 break;
2286
2287 case 33:
2288#line 488 "../../lib/expr/exparse.y"
2289 {
2290 (yyval.integer) = 0;
2291 }
2292#line 2293 "exparse.c"
2293 break;
2294
2295 case 34:
2296#line 492 "../../lib/expr/exparse.y"
2297 {
2298 (yyval.integer) = 1;
2299 }
2300#line 2301 "exparse.c"
2301 break;
2302
2303 case 36:
2304#line 499 "../../lib/expr/exparse.y"
2305 {
2306 if ((yyvsp[0].expr))
2307 (yyval.expr) = (yyvsp[-2].expr) ? exnewnode(expr.program, ',', 1, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr)) : (yyvsp[0].expr);
2308 }
2309#line 2310 "exparse.c"
2310 break;
2311
2312 case 37:
2313#line 505 "../../lib/expr/exparse.y"
2314 {checkName ((yyvsp[0].id)); expr.id=(yyvsp[0].id);}
2315#line 2316 "exparse.c"
2316 break;
2317
2318 case 38:
2319#line 506 "../../lib/expr/exparse.y"
2320 {
2321 (yyval.expr) = 0;
2322 if (!(yyvsp[-3].id)->type || expr.declare)
2323 (yyvsp[-3].id)->type = expr.declare;
2324 if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == PROCEDURE)
2325 {
2326 (yyvsp[-3].id)->lex = PROCEDURE;
2327 (yyvsp[-3].id)->type = (yyvsp[0].expr)->type;
2328 (yyvsp[-3].id)->value = (yyvsp[0].expr);
2329 }
2330 else
2331 {
2332 (yyvsp[-3].id)->lex = DYNAMIC;
2333 (yyvsp[-3].id)->value = exnewnode(expr.program, 0, 0, 0, NULL, NULL);
2334 if ((yyvsp[-1].integer) && (yyvsp[-3].id)->local == NULL)
2335 {
2336 Dtdisc_t* disc;
2337
2338 if (!(disc = calloc(1, sizeof(Dtdisc_t))))
2339 exnospace();
2340 if ((yyvsp[-1].integer) == INTEGER) {
2341 disc->key = offsetof(Exassoc_t, key);
2342 disc->size = sizeof(Extype_t);
2343 disc->comparf = cmpKey;
2344 }
2345 else
2346 disc->key = offsetof(Exassoc_t, name);
2347 if (!((yyvsp[-3].id)->local = dtopen(disc, Dtoset)))
2348 exerror("%s: cannot initialize associative array", (yyvsp[-3].id)->name);
2349 (yyvsp[-3].id)->index_type = (yyvsp[-1].integer); /* -1 indicates no typechecking */
2350 }
2351 if ((yyvsp[0].expr))
2352 {
2353 if ((yyvsp[0].expr)->type != (yyvsp[-3].id)->type)
2354 {
2355 (yyvsp[0].expr)->type = (yyvsp[-3].id)->type;
2356 (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-3].id)->type, NULL, 0);
2357 }
2358 (yyvsp[0].expr)->data.operand.left = exnewnode(expr.program, DYNAMIC, 0, (yyvsp[-3].id)->type, NULL, NULL);
2359 (yyvsp[0].expr)->data.operand.left->data.variable.symbol = (yyvsp[-3].id);
2360 (yyval.expr) = (yyvsp[0].expr);
2361 }
2362 else if (!(yyvsp[-1].integer))
2363 (yyvsp[-3].id)->value->data.value = exzero((yyvsp[-3].id)->type);
2364 }
2365 }
2366#line 2367 "exparse.c"
2367 break;
2368
2369 case 45:
2370#line 565 "../../lib/expr/exparse.y"
2371 {
2372 (yyval.expr) = 0;
2373 }
2374#line 2375 "exparse.c"
2375 break;
2376
2377 case 46:
2378#line 569 "../../lib/expr/exparse.y"
2379 {
2380 (yyval.expr) = (yyvsp[0].expr);
2381 }
2382#line 2383 "exparse.c"
2383 break;
2384
2385 case 47:
2386#line 575 "../../lib/expr/exparse.y"
2387 {
2388 (yyval.expr) = 0;
2389 }
2390#line 2391 "exparse.c"
2391 break;
2392
2393 case 49:
2394#line 582 "../../lib/expr/exparse.y"
2395 {
2396 (yyval.expr) = (yyvsp[-1].expr);
2397 }
2398#line 2399 "exparse.c"
2399 break;
2400
2401 case 50:
2402#line 586 "../../lib/expr/exparse.y"
2403 {
2404 (yyval.expr) = ((yyvsp[0].expr)->type == (yyvsp[-2].id)->type) ? (yyvsp[0].expr) : excast(expr.program, (yyvsp[0].expr), (yyvsp[-2].id)->type, NULL, 0);
2405 }
2406#line 2407 "exparse.c"
2407 break;
2408
2409 case 51:
2410#line 590 "../../lib/expr/exparse.y"
2411 {
2412 long rel;
2413
2414 relational:
2415 rel = INTEGER;
2416 goto coerce;
2417 binary:
2418 rel = 0;
2419 coerce:
2420 if (!(yyvsp[-2].expr)->type)
2421 {
2422 if (!(yyvsp[0].expr)->type)
2423 (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type = rel ? STRING : INTEGER;
2424 else
2425 (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type;
2426 }
2427 else if (!(yyvsp[0].expr)->type)
2428 (yyvsp[0].expr)->type = (yyvsp[-2].expr)->type;
2429 if ((yyvsp[-2].expr)->type != (yyvsp[0].expr)->type)
2430 {
2431 if ((yyvsp[-2].expr)->type == STRING)
2432 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), (yyvsp[0].expr)->type, (yyvsp[0].expr), 0);
2433 else if ((yyvsp[0].expr)->type == STRING)
2434 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), (yyvsp[-2].expr)->type, (yyvsp[-2].expr), 0);
2435 else if ((yyvsp[-2].expr)->type == FLOATING)
2436 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, (yyvsp[-2].expr), 0);
2437 else if ((yyvsp[0].expr)->type == FLOATING)
2438 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), FLOATING, (yyvsp[0].expr), 0);
2439 }
2440 if (!rel)
2441 rel = ((yyvsp[-2].expr)->type == STRING) ? STRING : (((yyvsp[-2].expr)->type == UNSIGNED) ? UNSIGNED : (yyvsp[0].expr)->type);
2442 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), 1, rel, (yyvsp[-2].expr), (yyvsp[0].expr));
2443 if (!expr.program->errors && (yyvsp[-2].expr)->op == CONSTANT && (yyvsp[0].expr)->op == CONSTANT)
2444 {
2445 (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
2446 /* If a constant string, re-allocate from program heap. This is because the
2447 * value was constructed from string operators, which create a value in the
2448 * temporary heap, which is cleared when exeval is called again.
2449 */
2450 if ((yyval.expr)->type == STRING) {
2451 (yyval.expr)->data.constant.value.string =
2452 vmstrdup(expr.program->vm, (yyval.expr)->data.constant.value.string);
2453 }
2454 (yyval.expr)->binary = 0;
2455 (yyval.expr)->op = CONSTANT;
2456 exfreenode(expr.program, (yyvsp[-2].expr));
2457 exfreenode(expr.program, (yyvsp[0].expr));
2458 }
2459 else if (!BUILTIN((yyvsp[-2].expr)->type) || !BUILTIN((yyvsp[0].expr)->type)) {
2460 checkBinary(expr.program, (yyvsp[-2].expr), (yyval.expr), (yyvsp[0].expr));
2461 }
2462 }
2463#line 2464 "exparse.c"
2464 break;
2465
2466 case 52:
2467#line 643 "../../lib/expr/exparse.y"
2468 {
2469 goto binary;
2470 }
2471#line 2472 "exparse.c"
2472 break;
2473
2474 case 53:
2475#line 647 "../../lib/expr/exparse.y"
2476 {
2477 goto binary;
2478 }
2479#line 2480 "exparse.c"
2480 break;
2481
2482 case 54:
2483#line 651 "../../lib/expr/exparse.y"
2484 {
2485 goto binary;
2486 }
2487#line 2488 "exparse.c"
2488 break;
2489
2490 case 55:
2491#line 655 "../../lib/expr/exparse.y"
2492 {
2493 goto binary;
2494 }
2495#line 2496 "exparse.c"
2496 break;
2497
2498 case 56:
2499#line 659 "../../lib/expr/exparse.y"
2500 {
2501 goto binary;
2502 }
2503#line 2504 "exparse.c"
2504 break;
2505
2506 case 57:
2507#line 663 "../../lib/expr/exparse.y"
2508 {
2509 goto binary;
2510 }
2511#line 2512 "exparse.c"
2512 break;
2513
2514 case 58:
2515#line 667 "../../lib/expr/exparse.y"
2516 {
2517 goto relational;
2518 }
2519#line 2520 "exparse.c"
2520 break;
2521
2522 case 59:
2523#line 671 "../../lib/expr/exparse.y"
2524 {
2525 goto relational;
2526 }
2527#line 2528 "exparse.c"
2528 break;
2529
2530 case 60:
2531#line 675 "../../lib/expr/exparse.y"
2532 {
2533 goto relational;
2534 }
2535#line 2536 "exparse.c"
2536 break;
2537
2538 case 61:
2539#line 679 "../../lib/expr/exparse.y"
2540 {
2541 goto relational;
2542 }
2543#line 2544 "exparse.c"
2544 break;
2545
2546 case 62:
2547#line 683 "../../lib/expr/exparse.y"
2548 {
2549 goto relational;
2550 }
2551#line 2552 "exparse.c"
2552 break;
2553
2554 case 63:
2555#line 687 "../../lib/expr/exparse.y"
2556 {
2557 goto binary;
2558 }
2559#line 2560 "exparse.c"
2560 break;
2561
2562 case 64:
2563#line 691 "../../lib/expr/exparse.y"
2564 {
2565 goto binary;
2566 }
2567#line 2568 "exparse.c"
2568 break;
2569
2570 case 65:
2571#line 695 "../../lib/expr/exparse.y"
2572 {
2573 goto binary;
2574 }
2575#line 2576 "exparse.c"
2576 break;
2577
2578 case 66:
2579#line 699 "../../lib/expr/exparse.y"
2580 {
2581 goto binary;
2582 }
2583#line 2584 "exparse.c"
2584 break;
2585
2586 case 67:
2587#line 703 "../../lib/expr/exparse.y"
2588 {
2589 logical:
2590 if ((yyvsp[-2].expr)->type == STRING)
2591 (yyvsp[-2].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-2].expr), NULL);
2592 else if (!BUILTIN((yyvsp[-2].expr)->type))
2593 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
2594 if ((yyvsp[0].expr)->type == STRING)
2595 (yyvsp[0].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[0].expr), NULL);
2596 else if (!BUILTIN((yyvsp[0].expr)->type))
2597 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
2598 goto binary;
2599 }
2600#line 2601 "exparse.c"
2601 break;
2602
2603 case 68:
2604#line 716 "../../lib/expr/exparse.y"
2605 {
2606 goto logical;
2607 }
2608#line 2609 "exparse.c"
2609 break;
2610
2611 case 69:
2612#line 720 "../../lib/expr/exparse.y"
2613 {
2614 if ((yyvsp[-2].expr)->op == CONSTANT)
2615 {
2616 exfreenode(expr.program, (yyvsp[-2].expr));
2617 (yyval.expr) = (yyvsp[0].expr);
2618 }
2619 else
2620 (yyval.expr) = exnewnode(expr.program, ',', 1, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr));
2621 }
2622#line 2623 "exparse.c"
2623 break;
2624
2625 case 70:
2626#line 729 "../../lib/expr/exparse.y"
2627 {expr.nolabel=1;}
2628#line 2629 "exparse.c"
2629 break;
2630
2631 case 71:
2632#line 729 "../../lib/expr/exparse.y"
2633 {expr.nolabel=0;}
2634#line 2635 "exparse.c"
2635 break;
2636
2637 case 72:
2638#line 730 "../../lib/expr/exparse.y"
2639 {
2640 if (!(yyvsp[-3].expr)->type)
2641 {
2642 if (!(yyvsp[0].expr)->type)
2643 (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type = INTEGER;
2644 else
2645 (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type;
2646 }
2647 else if (!(yyvsp[0].expr)->type)
2648 (yyvsp[0].expr)->type = (yyvsp[-3].expr)->type;
2649 if ((yyvsp[-6].expr)->type == STRING)
2650 (yyvsp[-6].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[-6].expr), NULL);
2651 else if (!INTEGRAL((yyvsp[-6].expr)->type))
2652 (yyvsp[-6].expr) = excast(expr.program, (yyvsp[-6].expr), INTEGER, NULL, 0);
2653 if ((yyvsp[-3].expr)->type != (yyvsp[0].expr)->type)
2654 {
2655 if ((yyvsp[-3].expr)->type == STRING || (yyvsp[0].expr)->type == STRING)
2656 exerror("if statement string type mismatch");
2657 else if ((yyvsp[-3].expr)->type == FLOATING)
2658 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, NULL, 0);
2659 else if ((yyvsp[0].expr)->type == FLOATING)
2660 (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), FLOATING, NULL, 0);
2661 }
2662 if ((yyvsp[-6].expr)->op == CONSTANT)
2663 {
2664 if ((yyvsp[-6].expr)->data.constant.value.integer)
2665 {
2666 (yyval.expr) = (yyvsp[-3].expr);
2667 exfreenode(expr.program, (yyvsp[0].expr));
2668 }
2669 else
2670 {
2671 (yyval.expr) = (yyvsp[0].expr);
2672 exfreenode(expr.program, (yyvsp[-3].expr));
2673 }
2674 exfreenode(expr.program, (yyvsp[-6].expr));
2675 }
2676 else
2677 (yyval.expr) = exnewnode(expr.program, '?', 1, (yyvsp[-3].expr)->type, (yyvsp[-6].expr), exnewnode(expr.program, ':', 1, (yyvsp[-3].expr)->type, (yyvsp[-3].expr), (yyvsp[0].expr)));
2678 }
2679#line 2680 "exparse.c"
2680 break;
2681
2682 case 73:
2683#line 771 "../../lib/expr/exparse.y"
2684 {
2685 iunary:
2686 if ((yyvsp[0].expr)->type == STRING)
2687 (yyvsp[0].expr) = exnewnode(expr.program, S2B, 1, INTEGER, (yyvsp[0].expr), NULL);
2688 else if (!INTEGRAL((yyvsp[0].expr)->type))
2689 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
2690 unary:
2691 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), 1, (yyvsp[0].expr)->type == UNSIGNED ? INTEGER : (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
2692 if ((yyvsp[0].expr)->op == CONSTANT)
2693 {
2694 (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
2695 (yyval.expr)->binary = 0;
2696 (yyval.expr)->op = CONSTANT;
2697 exfreenode(expr.program, (yyvsp[0].expr));
2698 }
2699 else if (!BUILTIN((yyvsp[0].expr)->type)) {
2700 checkBinary(expr.program, (yyvsp[0].expr), (yyval.expr), 0);
2701 }
2702 }
2703#line 2704 "exparse.c"
2704 break;
2705
2706 case 74:
2707#line 791 "../../lib/expr/exparse.y"
2708 {
2709 if ((yyvsp[0].id)->local == NULL)
2710 exerror("cannot apply '#' operator to non-array %s", (yyvsp[0].id)->name);
2711 (yyval.expr) = exnewnode(expr.program, '#', 0, INTEGER, NULL, NULL);
2712 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
2713 }
2714#line 2715 "exparse.c"
2715 break;
2716
2717 case 75:
2718#line 798 "../../lib/expr/exparse.y"
2719 {
2720 goto iunary;
2721 }
2722#line 2723 "exparse.c"
2723 break;
2724
2725 case 76:
2726#line 802 "../../lib/expr/exparse.y"
2727 {
2728 goto unary;
2729 }
2730#line 2731 "exparse.c"
2731 break;
2732
2733 case 77:
2734#line 806 "../../lib/expr/exparse.y"
2735 {
2736 (yyval.expr) = (yyvsp[0].expr);
2737 }
2738#line 2739 "exparse.c"
2739 break;
2740
2741 case 78:
2742#line 810 "../../lib/expr/exparse.y"
2743 {
2744 (yyval.expr) = exnewnode(expr.program, ADDRESS, 0, T((yyvsp[0].expr)->type), (yyvsp[0].expr), NULL);
2745 }
2746#line 2747 "exparse.c"
2747 break;
2748
2749 case 79:
2750#line 814 "../../lib/expr/exparse.y"
2751 {
2752 (yyval.expr) = exnewnode(expr.program, ARRAY, 1, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
2753 }
2754#line 2755 "exparse.c"
2755 break;
2756
2757 case 80:
2758#line 818 "../../lib/expr/exparse.y"
2759 {
2760 (yyval.expr) = exnewnode(expr.program, FUNCTION, 1, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
2761 }
2762#line 2763 "exparse.c"
2763 break;
2764
2765 case 81:
2766#line 822 "../../lib/expr/exparse.y"
2767 {
2768 (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), GSUB);
2769 }
2770#line 2771 "exparse.c"
2771 break;
2772
2773 case 82:
2774#line 826 "../../lib/expr/exparse.y"
2775 {
2776 (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), SUB);
2777 }
2778#line 2779 "exparse.c"
2779 break;
2780
2781 case 83:
2782#line 830 "../../lib/expr/exparse.y"
2783 {
2784 (yyval.expr) = exnewsubstr (expr.program, (yyvsp[-1].expr));
2785 }
2786#line 2787 "exparse.c"
2787 break;
2788
2789 case 84:
2790#line 834 "../../lib/expr/exparse.y"
2791 {
2792 (yyval.expr) = exnewsplit (expr.program, (yyvsp[-5].id)->index, (yyvsp[-1].id), (yyvsp[-3].expr), NULL);
2793 }
2794#line 2795 "exparse.c"
2795 break;
2796
2797 case 85:
2798#line 838 "../../lib/expr/exparse.y"
2799 {
2800 (yyval.expr) = exnewsplit (expr.program, (yyvsp[-7].id)->index, (yyvsp[-3].id), (yyvsp[-5].expr), (yyvsp[-1].expr));
2801 }
2802#line 2803 "exparse.c"
2803 break;
2804
2805 case 86:
2806#line 842 "../../lib/expr/exparse.y"
2807 {
2808 if (!INTEGRAL((yyvsp[-1].expr)->type))
2809 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2810 (yyval.expr) = exnewnode(expr.program, EXIT, 1, INTEGER, (yyvsp[-1].expr), NULL);
2811 }
2812#line 2813 "exparse.c"
2813 break;
2814
2815 case 87:
2816#line 848 "../../lib/expr/exparse.y"
2817 {
2818 (yyval.expr) = exnewnode(expr.program, RAND, 0, FLOATING, NULL, NULL);
2819 }
2820#line 2821 "exparse.c"
2821 break;
2822
2823 case 88:
2824#line 852 "../../lib/expr/exparse.y"
2825 {
2826 (yyval.expr) = exnewnode(expr.program, SRAND, 0, INTEGER, NULL, NULL);
2827 }
2828#line 2829 "exparse.c"
2829 break;
2830
2831 case 89:
2832#line 856 "../../lib/expr/exparse.y"
2833 {
2834 if (!INTEGRAL((yyvsp[-1].expr)->type))
2835 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2836 (yyval.expr) = exnewnode(expr.program, SRAND, 1, INTEGER, (yyvsp[-1].expr), NULL);
2837 }
2838#line 2839 "exparse.c"
2839 break;
2840
2841 case 90:
2842#line 862 "../../lib/expr/exparse.y"
2843 {
2844 (yyval.expr) = exnewnode(expr.program, CALL, 1, (yyvsp[-3].id)->type, NULL, (yyvsp[-1].expr));
2845 (yyval.expr)->data.call.procedure = (yyvsp[-3].id);
2846 }
2847#line 2848 "exparse.c"
2848 break;
2849
2850 case 91:
2851#line 867 "../../lib/expr/exparse.y"
2852 {
2853 (yyval.expr) = exprint(expr.program, (yyvsp[-3].id), (yyvsp[-1].expr));
2854 }
2855#line 2856 "exparse.c"
2856 break;
2857
2858 case 92:
2859#line 871 "../../lib/expr/exparse.y"
2860 {
2861 (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, 0, (yyvsp[-3].id)->type, NULL, NULL);
2862 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
2863 {
2864 (yyval.expr)->data.print.descriptor = (yyvsp[-1].expr)->data.operand.left;
2865 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2866 }
2867 else
2868 switch ((yyvsp[-3].id)->index)
2869 {
2870 case QUERY:
2871 (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NULL, NULL);
2872 (yyval.expr)->data.print.descriptor->data.constant.value.integer = 2;
2873 break;
2874 case PRINTF:
2875 (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NULL, NULL);
2876 (yyval.expr)->data.print.descriptor->data.constant.value.integer = 1;
2877 break;
2878 case SPRINTF:
2879 (yyval.expr)->data.print.descriptor = 0;
2880 break;
2881 }
2882 (yyval.expr)->data.print.args = preprint((yyvsp[-1].expr));
2883 }
2884#line 2885 "exparse.c"
2885 break;
2886
2887 case 93:
2888#line 896 "../../lib/expr/exparse.y"
2889 {
2890 Exnode_t* x;
2891
2892 (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, 0, (yyvsp[-3].id)->type, NULL, NULL);
2893 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
2894 {
2895 (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
2896 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2897 }
2898 else
2899 switch ((yyvsp[-3].id)->index)
2900 {
2901 case SCANF:
2902 (yyval.expr)->data.scan.descriptor = 0;
2903 break;
2904 case SSCANF:
2905 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == STRING)
2906 {
2907 (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
2908 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2909 }
2910 else
2911 exerror("%s: string argument expected", (yyvsp[-3].id)->name);
2912 break;
2913 }
2914 if (!(yyvsp[-1].expr) || !(yyvsp[-1].expr)->data.operand.left || (yyvsp[-1].expr)->data.operand.left->type != STRING)
2915 exerror("%s: format argument expected", (yyvsp[-3].id)->name);
2916 (yyval.expr)->data.scan.format = (yyvsp[-1].expr)->data.operand.left;
2917 for (x = (yyval.expr)->data.scan.args = (yyvsp[-1].expr)->data.operand.right; x; x = x->data.operand.right)
2918 {
2919 if (x->data.operand.left->op != ADDRESS)
2920 exerror("%s: address argument expected", (yyvsp[-3].id)->name);
2922 }
2923 }
2924#line 2925 "exparse.c"
2925 break;
2926
2927 case 94:
2928#line 932 "../../lib/expr/exparse.y"
2929 {
2930 if ((yyvsp[0].expr))
2931 {
2932 if ((yyvsp[-1].expr)->op == ID && !expr.program->disc->setf)
2933 exerror("%s: variable assignment not supported", (yyvsp[-1].expr)->data.variable.symbol->name);
2934 else
2935 {
2936 if (!(yyvsp[-1].expr)->type)
2937 (yyvsp[-1].expr)->type = (yyvsp[0].expr)->type;
2938 else if ((yyvsp[0].expr)->type != (yyvsp[-1].expr)->type)
2939 {
2940 (yyvsp[0].expr)->type = (yyvsp[-1].expr)->type;
2941 (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-1].expr)->type, NULL, 0);
2942 }
2943 (yyvsp[0].expr)->data.operand.left = (yyvsp[-1].expr);
2944 (yyval.expr) = (yyvsp[0].expr);
2945 }
2946 }
2947 }
2948#line 2949 "exparse.c"
2949 break;
2950
2951 case 95:
2952#line 952 "../../lib/expr/exparse.y"
2953 {
2954 pre:
2955 if ((yyvsp[0].expr)->type == STRING)
2956 exerror("++ and -- invalid for string variables");
2957 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), 0, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
2958 (yyval.expr)->subop = PRE;
2959 }
2960#line 2961 "exparse.c"
2961 break;
2962
2963 case 96:
2964#line 960 "../../lib/expr/exparse.y"
2965 {
2966 pos:
2967 if ((yyvsp[-1].expr)->type == STRING)
2968 exerror("++ and -- invalid for string variables");
2969 (yyval.expr) = exnewnode(expr.program, (yyvsp[0].op), 0, (yyvsp[-1].expr)->type, (yyvsp[-1].expr), NULL);
2970 (yyval.expr)->subop = POS;
2971 }
2972#line 2973 "exparse.c"
2973 break;
2974
2975 case 97:
2976#line 968 "../../lib/expr/exparse.y"
2977 {
2978 if ((yyvsp[0].id)->local == NULL)
2979 exerror("cannot apply IN to non-array %s", (yyvsp[0].id)->name);
2980 if (((yyvsp[0].id)->index_type > 0) && ((yyvsp[-2].expr)->type != (yyvsp[0].id)->index_type))
2981 exerror("%s indices must have type %s, not %s",
2982 (yyvsp[0].id)->name, extypename(expr.program, (yyvsp[0].id)->index_type),extypename(expr.program, (yyvsp[-2].expr)->type));
2983 (yyval.expr) = exnewnode(expr.program, IN_OP, 0, INTEGER, NULL, NULL);
2984 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
2985 (yyval.expr)->data.variable.index = (yyvsp[-2].expr);
2986 }
2987#line 2988 "exparse.c"
2988 break;
2989
2990 case 98:
2991#line 979 "../../lib/expr/exparse.y"
2992 {
2993 goto pre;
2994 }
2995#line 2996 "exparse.c"
2996 break;
2997
2998 case 99:
2999#line 983 "../../lib/expr/exparse.y"
3000 {
3001 goto pos;
3002 }
3003#line 3004 "exparse.c"
3004 break;
3005
3006 case 103:
3007#line 993 "../../lib/expr/exparse.y"
3008 {
3009 (yyval.expr) = exnewnode(expr.program, CONSTANT, 0, (yyvsp[0].id)->type, NULL, NULL);
3010 if (!expr.program->disc->reff)
3011 exerror("%s: identifier references not supported", (yyvsp[0].id)->name);
3012 else
3013 (yyval.expr)->data.constant.value = expr.program->disc->reff(expr.program, (yyval.expr), (yyvsp[0].id), NULL);
3014 }
3015#line 3016 "exparse.c"
3016 break;
3017
3018 case 104:
3019#line 1001 "../../lib/expr/exparse.y"
3020 {
3021 (yyval.expr) = exnewnode(expr.program, CONSTANT, 0, FLOATING, NULL, NULL);
3022 (yyval.expr)->data.constant.value.floating = (yyvsp[0].floating);
3023 }
3024#line 3025 "exparse.c"
3025 break;
3026
3027 case 105:
3028#line 1006 "../../lib/expr/exparse.y"
3029 {
3030 (yyval.expr) = exnewnode(expr.program, CONSTANT, 0, INTEGER, NULL, NULL);
3031 (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
3032 }
3033#line 3034 "exparse.c"
3034 break;
3035
3036 case 106:
3037#line 1011 "../../lib/expr/exparse.y"
3038 {
3039 (yyval.expr) = exnewnode(expr.program, CONSTANT, 0, STRING, NULL, NULL);
3040 (yyval.expr)->data.constant.value.string = (yyvsp[0].string);
3041 }
3042#line 3043 "exparse.c"
3043 break;
3044
3045 case 107:
3046#line 1016 "../../lib/expr/exparse.y"
3047 {
3048 (yyval.expr) = exnewnode(expr.program, CONSTANT, 0, UNSIGNED, NULL, NULL);
3049 (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
3050 }
3051#line 3052 "exparse.c"
3052 break;
3053
3054 case 113:
3055#line 1032 "../../lib/expr/exparse.y"
3056 {
3057 (yyval.expr) = makeVar(expr.program, (yyvsp[-1].id), 0, 0, (yyvsp[0].reference));
3058 }
3059#line 3060 "exparse.c"
3060 break;
3061
3062 case 114:
3063#line 1036 "../../lib/expr/exparse.y"
3064 {
3065 Exnode_t* n;
3066
3067 n = exnewnode(expr.program, DYNAMIC, 0, (yyvsp[-2].id)->type, NULL, NULL);
3068 n->data.variable.symbol = (yyvsp[-2].id);
3069 n->data.variable.reference = 0;
3070 if (((n->data.variable.index = (yyvsp[-1].expr)) == 0) != ((yyvsp[-2].id)->local == NULL))
3071 exerror("%s: is%s an array", (yyvsp[-2].id)->name, (yyvsp[-2].id)->local != NULL ? "" : " not");
3072 if ((yyvsp[-2].id)->local != NULL && ((yyvsp[-2].id)->index_type > 0)) {
3073 if ((yyvsp[-1].expr)->type != (yyvsp[-2].id)->index_type)
3074 exerror("%s: indices must have type %s, not %s",
3075 (yyvsp[-2].id)->name, extypename(expr.program, (yyvsp[-2].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
3076 }
3077 if ((yyvsp[0].reference)) {
3078 n->data.variable.dyna =exnewnode(expr.program, 0, 0, 0, NULL, NULL);
3079 (yyval.expr) = makeVar(expr.program, (yyvsp[-2].id), (yyvsp[-1].expr), n, (yyvsp[0].reference));
3080 }
3081 else (yyval.expr) = n;
3082 }
3083#line 3084 "exparse.c"
3084 break;
3085
3086 case 115:
3087#line 1056 "../../lib/expr/exparse.y"
3088 {
3089 (yyval.expr) = exnewnode(expr.program, ID, 0, STRING, NULL, NULL);
3090 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
3091 (yyval.expr)->data.variable.reference = 0;
3092 (yyval.expr)->data.variable.index = 0;
3093 (yyval.expr)->data.variable.dyna = 0;
3094 if (!(expr.program->disc->flags & EX_UNDECLARED))
3095 exerror("unknown identifier");
3096 }
3097#line 3098 "exparse.c"
3098 break;
3099
3100 case 116:
3101#line 1068 "../../lib/expr/exparse.y"
3102 {
3103 (yyval.integer) = 0;
3104 }
3105#line 3106 "exparse.c"
3106 break;
3107
3108 case 117:
3109#line 1072 "../../lib/expr/exparse.y"
3110 {
3111 (yyval.integer) = -1;
3112 }
3113#line 3114 "exparse.c"
3114 break;
3115
3116 case 118:
3117#line 1076 "../../lib/expr/exparse.y"
3118 {
3119 /* If DECLARE is VOID, its type is 0, so this acts like
3120 * the empty case.
3121 */
3122 if (INTEGRAL((yyvsp[-1].id)->type))
3123 (yyval.integer) = INTEGER;
3124 else
3125 (yyval.integer) = (yyvsp[-1].id)->type;
3126
3127 }
3128#line 3129 "exparse.c"
3129 break;
3130
3131 case 119:
3132#line 1089 "../../lib/expr/exparse.y"
3133 {
3134 (yyval.expr) = 0;
3135 }
3136#line 3137 "exparse.c"
3137 break;
3138
3139 case 120:
3140#line 1093 "../../lib/expr/exparse.y"
3141 {
3142 (yyval.expr) = (yyvsp[-1].expr);
3143 }
3144#line 3145 "exparse.c"
3145 break;
3146
3147 case 121:
3148#line 1099 "../../lib/expr/exparse.y"
3149 {
3150 (yyval.expr) = 0;
3151 }
3152#line 3153 "exparse.c"
3153 break;
3154
3155 case 122:
3156#line 1103 "../../lib/expr/exparse.y"
3157 {
3158 (yyval.expr) = (yyvsp[0].expr)->data.operand.left;
3159 (yyvsp[0].expr)->data.operand.left = (yyvsp[0].expr)->data.operand.right = 0;
3160 exfreenode(expr.program, (yyvsp[0].expr));
3161 }
3162#line 3163 "exparse.c"
3163 break;
3164
3165 case 123:
3166#line 1111 "../../lib/expr/exparse.y"
3167 {
3168 (yyval.expr) = exnewnode(expr.program, ',', 1, 0, exnewnode(expr.program, ',', 1, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL), NULL);
3169 (yyval.expr)->data.operand.right = (yyval.expr)->data.operand.left;
3170 }
3171#line 3172 "exparse.c"
3172 break;
3173
3174 case 124:
3175#line 1116 "../../lib/expr/exparse.y"
3176 {
3177 (yyvsp[-2].expr)->data.operand.right = (yyvsp[-2].expr)->data.operand.right->data.operand.right = exnewnode(expr.program, ',', 1, (yyvsp[-2].expr)->type, (yyvsp[0].expr), NULL);
3178 }
3179#line 3180 "exparse.c"
3180 break;
3181
3182 case 125:
3183#line 1122 "../../lib/expr/exparse.y"
3184 {
3185 (yyval.expr) = 0;
3186 }
3187#line 3188 "exparse.c"
3188 break;
3189
3190 case 126:
3191#line 1126 "../../lib/expr/exparse.y"
3192 {
3193 (yyval.expr) = 0;
3194 if ((yyvsp[0].id)->type)
3195 exerror("(void) expected");
3196 }
3197#line 3198 "exparse.c"
3198 break;
3199
3200 case 128:
3201#line 1135 "../../lib/expr/exparse.y"
3202 {
3203 (yyval.expr) = exnewnode(expr.program, ',', 1, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
3204 }
3205#line 3206 "exparse.c"
3206 break;
3207
3208 case 129:
3209#line 1139 "../../lib/expr/exparse.y"
3210 {
3211 Exnode_t* x;
3212 Exnode_t* y;
3213
3214 (yyval.expr) = (yyvsp[-2].expr);
3215 for (x = (yyvsp[-2].expr); (y = x->data.operand.right); x = y);
3216 x->data.operand.right = exnewnode(expr.program, ',', 1, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
3217 }
3218#line 3219 "exparse.c"
3219 break;
3220
3221 case 130:
3222#line 1149 "../../lib/expr/exparse.y"
3223 {expr.declare=(yyvsp[0].id)->type;}
3224#line 3225 "exparse.c"
3225 break;
3226
3227 case 131:
3228#line 1150 "../../lib/expr/exparse.y"
3229 {
3230 (yyval.expr) = exnewnode(expr.program, ID, 0, (yyvsp[-2].id)->type, NULL, NULL);
3231 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
3232 (yyvsp[0].id)->lex = DYNAMIC;
3233 (yyvsp[0].id)->type = (yyvsp[-2].id)->type;
3234 (yyvsp[0].id)->value = exnewnode(expr.program, 0, 0, 0, NULL, NULL);
3235 expr.procedure->data.procedure.arity++;
3236 expr.declare = 0;
3237 }
3238#line 3239 "exparse.c"
3239 break;
3240
3241 case 132:
3242#line 1162 "../../lib/expr/exparse.y"
3243 {
3244 (yyval.reference) = expr.refs = 0;
3245 }
3246#line 3247 "exparse.c"
3247 break;
3248
3249 case 133:
3250#line 1166 "../../lib/expr/exparse.y"
3251 {
3252 Exref_t* r;
3253
3254 r = ALLOCATE(expr.program, Exref_t);
3255 *r = (Exref_t){0};
3256 r->symbol = (yyvsp[0].id);
3257 expr.refs = r;
3258 r->next = 0;
3259 r->index = 0;
3260 (yyval.reference) = expr.refs;
3261 }
3262#line 3263 "exparse.c"
3263 break;
3264
3265 case 134:
3266#line 1178 "../../lib/expr/exparse.y"
3267 {
3268 Exref_t* r;
3269 Exref_t* l;
3270
3271 r = ALLOCATE(expr.program, Exref_t);
3272 *r = (Exref_t){0};
3273 r->symbol = (yyvsp[0].id);
3274 r->index = 0;
3275 r->next = 0;
3276 l = ALLOCATE(expr.program, Exref_t);
3277 *l = (Exref_t){0};
3278 l->symbol = (yyvsp[-1].id);
3279 l->index = 0;
3280 l->next = r;
3281 expr.refs = l;
3282 (yyval.reference) = expr.refs;
3283 }
3284#line 3285 "exparse.c"
3285 break;
3286
3287 case 135:
3288#line 1198 "../../lib/expr/exparse.y"
3289 {
3290 (yyval.id) = (yyvsp[0].id);
3291 }
3292#line 3293 "exparse.c"
3293 break;
3294
3295 case 136:
3296#line 1202 "../../lib/expr/exparse.y"
3297 {
3298 (yyval.id) = (yyvsp[0].id);
3299 }
3300#line 3301 "exparse.c"
3301 break;
3302
3303 case 137:
3304#line 1207 "../../lib/expr/exparse.y"
3305 {
3306 (yyval.expr) = 0;
3307 }
3308#line 3309 "exparse.c"
3309 break;
3310
3311 case 138:
3312#line 1211 "../../lib/expr/exparse.y"
3313 {
3314 (yyval.expr) = exnewnode(expr.program, '=', 1, (yyvsp[0].expr)->type, NULL, (yyvsp[0].expr));
3315 (yyval.expr)->subop = (yyvsp[-1].op);
3316 }
3317#line 3318 "exparse.c"
3318 break;
3319
3320 case 140:
3321#line 1218 "../../lib/expr/exparse.y"
3322 {
3323 Dtdisc_t* disc;
3324
3325 if (expr.procedure)
3326 exerror("%s: nested function definitions not supported", expr.id->name);
3328 if (!(disc = calloc(1, sizeof(Dtdisc_t))))
3329 exnospace();
3330 disc->key = offsetof(Exid_t, name);
3331 if (!streq(expr.id->name, "begin"))
3332 {
3333 if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
3334 exnospace();
3335 expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
3336 expr.program->formals = 1;
3337 }
3338 expr.declare = 0;
3339 }
3340#line 3341 "exparse.c"
3341 break;
3342
3343 case 141:
3344#line 1235 "../../lib/expr/exparse.y"
3345 {
3346 expr.id->lex = PROCEDURE;
3348 expr.program->formals = 0;
3349 expr.declare = 0;
3350 }
3351#line 3352 "exparse.c"
3352 break;
3353
3354 case 142:
3355#line 1241 "../../lib/expr/exparse.y"
3356 {
3357 (yyval.expr) = expr.procedure;
3358 expr.procedure = 0;
3359 if (expr.program->frame)
3360 {
3361 expr.program->symbols = expr.program->frame->view;
3362 dtview(expr.program->frame, NULL);
3363 expr.program->frame = 0;
3364 }
3365 (yyval.expr)->data.operand.left = (yyvsp[-5].expr);
3366 (yyval.expr)->data.operand.right = excast(expr.program, (yyvsp[-1].expr), (yyval.expr)->type, NULL, 0);
3367
3368 /*
3369 * NOTE: procedure definition was slipped into the
3370 * declaration initializer statement production,
3371 * therefore requiring the statement terminator
3372 */
3373
3374 exunlex(expr.program, ';');
3375 }
3376#line 3377 "exparse.c"
3377 break;
3378
3379
3380#line 3381 "exparse.c"
3381
3382 default: break;
3383 }
3384 /* User semantic actions sometimes alter yychar, and that requires
3385 that yytoken be updated with the new translation. We take the
3386 approach of translating immediately before every use of yytoken.
3387 One alternative is translating here after every semantic action,
3388 but that translation would be missed if the semantic action invokes
3389 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3390 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3391 incorrect destructor might then be invoked immediately. In the
3392 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3393 to an incorrect destructor call or verbose syntax error message
3394 before the lookahead is translated. */
3395 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3396
3397 YYPOPSTACK (yylen);
3398 yylen = 0;
3399 YY_STACK_PRINT (yyss, yyssp);
3400
3401 *++yyvsp = yyval;
3402
3403 /* Now 'shift' the result of the reduction. Determine what state
3404 that goes to, based on the state we popped back to and the rule
3405 number reduced by. */
3406 {
3407 const int yylhs = yyr1[yyn] - YYNTOKENS;
3408 const int yyi = yypgoto[yylhs] + *yyssp;
3409 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
3410 ? yytable[yyi]
3411 : yydefgoto[yylhs]);
3412 }
3413
3414 goto yynewstate;
3415
3416
3417/*--------------------------------------.
3418| yyerrlab -- here on detecting error. |
3419`--------------------------------------*/
3420yyerrlab:
3421 /* Make sure we have latest lookahead translation. See comments at
3422 user semantic actions for why this is necessary. */
3423 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3424
3425 /* If not already recovering from an error, report this error. */
3426 if (!yyerrstatus)
3427 {
3428 ++yynerrs;
3429#if ! YYERROR_VERBOSE
3430 yyerror (YY_("syntax error"));
3431#else
3432# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3433 yyssp, yytoken)
3434 {
3435 char const *yymsgp = YY_("syntax error");
3436 int yysyntax_error_status;
3437 yysyntax_error_status = YYSYNTAX_ERROR;
3438 if (yysyntax_error_status == 0)
3439 yymsgp = yymsg;
3440 else if (yysyntax_error_status == 1)
3441 {
3442 if (yymsg != yymsgbuf)
3443 YYSTACK_FREE (yymsg);
3444 yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
3445 if (!yymsg)
3446 {
3447 yymsg = yymsgbuf;
3448 yymsg_alloc = sizeof yymsgbuf;
3449 yysyntax_error_status = 2;
3450 }
3451 else
3452 {
3453 yysyntax_error_status = YYSYNTAX_ERROR;
3454 yymsgp = yymsg;
3455 }
3456 }
3457 yyerror (yymsgp);
3458 if (yysyntax_error_status == 2)
3459 goto yyexhaustedlab;
3460 }
3461# undef YYSYNTAX_ERROR
3462#endif
3463 }
3464
3465
3466
3467 if (yyerrstatus == 3)
3468 {
3469 /* If just tried and failed to reuse lookahead token after an
3470 error, discard it. */
3471
3472 if (yychar <= YYEOF)
3473 {
3474 /* Return failure if at end of input. */
3475 if (yychar == YYEOF)
3476 YYABORT;
3477 }
3478 else
3479 {
3480 yydestruct ("Error: discarding",
3481 yytoken, &yylval);
3482 yychar = YYEMPTY;
3483 }
3484 }
3485
3486 /* Else will try to reuse lookahead token after shifting the error
3487 token. */
3488 goto yyerrlab1;
3489
3490
3491/*---------------------------------------------------.
3492| yyerrorlab -- error raised explicitly by YYERROR. |
3493`---------------------------------------------------*/
3494yyerrorlab:
3495 /* Pacify compilers when the user code never invokes YYERROR and the
3496 label yyerrorlab therefore never appears in user code. */
3497 if (0)
3498 YYERROR;
3499
3500 /* Do not reclaim the symbols of the rule whose action triggered
3501 this YYERROR. */
3502 YYPOPSTACK (yylen);
3503 yylen = 0;
3504 YY_STACK_PRINT (yyss, yyssp);
3505 yystate = *yyssp;
3506 goto yyerrlab1;
3507
3508
3509/*-------------------------------------------------------------.
3510| yyerrlab1 -- common code for both syntax error and YYERROR. |
3511`-------------------------------------------------------------*/
3512yyerrlab1:
3513 yyerrstatus = 3; /* Each real token shifted decrements this. */
3514
3515 for (;;)
3516 {
3517 yyn = yypact[yystate];
3518 if (!yypact_value_is_default (yyn))
3519 {
3520 yyn += YYTERROR;
3521 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3522 {
3523 yyn = yytable[yyn];
3524 if (0 < yyn)
3525 break;
3526 }
3527 }
3528
3529 /* Pop the current state because it cannot handle the error token. */
3530 if (yyssp == yyss)
3531 YYABORT;
3532
3533
3534 yydestruct ("Error: popping",
3535 yystos[yystate], yyvsp);
3536 YYPOPSTACK (1);
3537 yystate = *yyssp;
3538 YY_STACK_PRINT (yyss, yyssp);
3539 }
3540
3542 *++yyvsp = yylval;
3544
3545
3546 /* Shift the error token. */
3547 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3548
3549 yystate = yyn;
3550 goto yynewstate;
3551
3552
3553/*-------------------------------------.
3554| yyacceptlab -- YYACCEPT comes here. |
3555`-------------------------------------*/
3556yyacceptlab:
3557 yyresult = 0;
3558 goto yyreturn;
3559
3560
3561/*-----------------------------------.
3562| yyabortlab -- YYABORT comes here. |
3563`-----------------------------------*/
3564yyabortlab:
3565 yyresult = 1;
3566 goto yyreturn;
3567
3568
3569#if !defined yyoverflow || YYERROR_VERBOSE
3570/*-------------------------------------------------.
3571| yyexhaustedlab -- memory exhaustion comes here. |
3572`-------------------------------------------------*/
3573yyexhaustedlab:
3574 yyerror (YY_("memory exhausted"));
3575 yyresult = 2;
3576 /* Fall through. */
3577#endif
3578
3579
3580/*-----------------------------------------------------.
3581| yyreturn -- parsing is finished, return the result. |
3582`-----------------------------------------------------*/
3583yyreturn:
3584 if (yychar != YYEMPTY)
3585 {
3586 /* Make sure we have latest lookahead translation. See comments at
3587 user semantic actions for why this is necessary. */
3588 yytoken = YYTRANSLATE (yychar);
3589 yydestruct ("Cleanup: discarding lookahead",
3590 yytoken, &yylval);
3591 }
3592 /* Do not reclaim the symbols of the rule whose action triggered
3593 this YYABORT or YYACCEPT. */
3594 YYPOPSTACK (yylen);
3595 YY_STACK_PRINT (yyss, yyssp);
3596 while (yyssp != yyss)
3597 {
3598 yydestruct ("Cleanup: popping",
3599 yystos[+*yyssp], yyvsp);
3600 YYPOPSTACK (1);
3601 }
3602#ifndef yyoverflow
3603 if (yyss != yyssa)
3604 YYSTACK_FREE (yyss);
3605#endif
3606#if YYERROR_VERBOSE
3607 if (yymsg != yymsgbuf)
3608 YYSTACK_FREE (yymsg);
3609#endif
3610 return yyresult;
3611}
3612#line 1263 "../../lib/expr/exparse.y"
3613
3614
3615const char *exop(size_t index) {
3616
3617 /* yytname is generated by the %token-table directive */
3618
3619 /* find the index of MINTOKEN */
3620 size_t minid;
3621 for (minid = 0; yytname[minid] != NULL; ++minid) {
3622 if (strcmp(yytname[minid], "MINTOKEN") == 0) {
3623 break;
3624 }
3625 }
3626
3627 assert(yytname[minid] != NULL
3628 && "failed to find MINTOKEN; incorrect token list in exparse.y?");
3629
3630 /* find the requested token */
3631 {
3632 size_t i, j;
3633 for (i = j = minid; yytname[i] != NULL; ++i) {
3634
3635 /* if this token is not a word, skip it */
3636 {
3637 size_t k;
3638 for (k = 0; yytname[i][k] != '\0'; ++k) {
3639 if (yytname[i][k] != '_' && !gv_isalnum(yytname[i][k])) {
3640 break;
3641 }
3642 }
3643 if (yytname[i][k] != '\0') {
3644 continue;
3645 }
3646 }
3647
3648 if (j == index + minid) {
3649 return yytname[i];
3650 }
3651 ++j;
3652 }
3653 }
3654
3655 /* failed to find the requested token */
3656 return NULL;
3657}
3658
3659void ex_error(const char *message) {
3660 exerror("%s", message);
3661}
3662
3663#include <expr/exgram.h>
CDT_API Dtmethod_t * Dtset
set with unique elements
Definition dthash.c:277
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
Definition dtview.c:91
CDT_API Dtmethod_t * Dtoset
ordered set (self-adjusting tree)
Definition dttree.c:304
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Definition dtopen.c:9
static int binary(Exnode_t *l, Exnode_t *ex, Exnode_t *r, int arg)
Definition compile.c:1884
void exwarn(const char *format,...)
Definition exerror.c:79
void exerror(const char *format,...)
Definition exerror.c:62
Extype_t exeval(Expr_t *ex, Exnode_t *exnode, void *env)
Definition exeval.c:1965
Exstate_t expr
#define exunlex(p, c)
Definition exlib.h:126
char * exnospace(void)
Definition exnospace.c:25
#define UNSIGNED
Definition exparse.c:237
#define ELSE
Definition exparse.c:253
#define LABEL
Definition exparse.c:262
static const yytype_uint8 yyr1[]
Definition exparse.c:1160
#define STRING
Definition exparse.c:240
#define STATIC
Definition exparse.c:242
#define CHARACTER
Definition exparse.c:238
#define DYNAMIC
Definition exparse.c:252
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition exparse.c:505
const char * exop(size_t index)
Definition exparse.c:3615
#define YYMAXDEPTH
Definition exparse.c:1380
#define SCANF
Definition exparse.c:274
#define YYSTACK_FREE
Definition exparse.c:567
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition exparse.c:1361
static const yytype_int8 yytranslate[]
Definition exparse.c:680
#define F2S
Definition exparse.c:286
#define YY_ASSERT(E)
Definition exparse.c:525
#define YY_(Msgid)
Definition exparse.c:466
#define SSCANF
Definition exparse.c:278
#define RSH
Definition exparse.c:307
#define ADDRESS
Definition exparse.c:243
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition exparse.c:506
#define YYNSTATES
Definition exparse.c:667
#define YYSTYPE
Definition exparse.c:66
#define YY_IGNORE_USELESS_CAST_END
Definition exparse.c:521
short yytype_int16
Definition exparse.c:390
#define OR
Definition exparse.c:300
#define YYUSE(E)
Definition exparse.c:488
#define PRE
Definition exparse.c:267
#define yychar
Definition exparse.c:74
#define GE
Definition exparse.c:305
#define YYEOF
Definition exparse.c:1203
#define YYABORT
Definition exparse.c:1206
#define MINTOKEN
Definition exparse.c:235
#define DEFAULT
Definition exparse.c:251
#define YYSTACK_BYTES(N)
Definition exparse.c:611
#define ITERATER
Definition exparse.c:259
yytype_int16 yy_state_t
Definition exparse.c:453
#define NAME
Definition exparse.c:264
static const yytype_int16 yydefgoto[]
Definition exparse.c:880
#define YY_REDUCE_PRINT(Rule)
Definition exparse.c:1363
#define X2F
Definition exparse.c:295
#define YY_CAST(Type, Val)
Definition exparse.c:104
#define S2X
Definition exparse.c:294
#define WHILE
Definition exparse.c:284
static const yytype_int16 yypact[]
Definition exparse.c:800
#define yylex
Definition exparse.c:69
#define ITERATE
Definition exparse.c:258
#define MAXTOKEN
Definition exparse.c:313
#define YY_NULLPTR
Definition exparse.c:116
#define NE
Definition exparse.c:303
#define SRAND
Definition exparse.c:277
#define S2I
Definition exparse.c:291
#define SUB
Definition exparse.c:279
#define POS
Definition exparse.c:265
#define YYFINAL
Definition exparse.c:656
#define LSH
Definition exparse.c:306
#define FLOATING
Definition exparse.c:239
#define FOR
Definition exparse.c:255
#define RETURN
Definition exparse.c:273
#define I2X
Definition exparse.c:293
#define IN_OP
Definition exparse.c:308
static const yytype_int16 yypgoto[]
Definition exparse.c:870
#define SUBSTR
Definition exparse.c:280
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Definition exparse.c:1621
#define TOKENS
Definition exparse.c:282
#define yyparse
Definition exparse.c:1650
#define yylval
Definition exparse.c:73
#define VOIDTYPE
Definition exparse.c:241
#define YYNTOKENS
Definition exparse.c:661
#define ID
Definition exparse.c:260
unsigned char yytype_uint8
Definition exparse.c:399
#define YY_STACK_PRINT(Bottom, Top)
Definition exparse.c:1362
#define YYSIZE_T
Definition exparse.c:440
#define YYSTACK_ALLOC_MAXIMUM
Definition exparse.c:569
#define yydebug
Definition exparse.c:71
#define YY_IGNORE_USELESS_CAST_BEGIN
Definition exparse.c:520
#define RAND
Definition exparse.c:272
static const yytype_int8 yyr2[]
Definition exparse.c:1180
int ex_parse(void)
#define PRINT
Definition exparse.c:268
#define CAST
Definition exparse.c:312
void * malloc(YYSIZE_T)
#define I2F
Definition exparse.c:287
#define INTEGER
Definition exparse.c:236
#define YYPTRDIFF_T
Definition exparse.c:426
#define SPRINTF
Definition exparse.c:276
#define yynerrs
Definition exparse.c:72
#define I2S
Definition exparse.c:288
EX_STYPE ex_lval
ex_tokentype
Definition exparse.c:152
#define CONSTANT
Definition exparse.c:248
static const yytype_int16 yytable[]
Definition exparse.c:892
#define LE
Definition exparse.c:304
#define MEMBER
Definition exparse.c:263
#define YYACCEPT
Definition exparse.c:1205
#define yytable_value_is_error(Yyn)
Definition exparse.c:795
#define S2B
Definition exparse.c:289
#define CALL
Definition exparse.c:246
#define GSUB
Definition exparse.c:257
#define PRAGMA
Definition exparse.c:266
#define YYTRANSLATE(YYX)
Definition exparse.c:675
#define UNARY
Definition exparse.c:309
#define UNSET
Definition exparse.c:283
#define CONTINUE
Definition exparse.c:249
#define XPRINT
Definition exparse.c:299
static const char *const yytname[]
Definition exparse.c:743
#define F2I
Definition exparse.c:285
#define X2S
Definition exparse.c:297
#define SPLIT
Definition exparse.c:275
#define EQ
Definition exparse.c:302
static const yytype_uint8 yystos[]
Definition exparse.c:1126
#define BREAK
Definition exparse.c:245
#define S2F
Definition exparse.c:290
#define IF
Definition exparse.c:261
#define PROCEDURE
Definition exparse.c:270
#define SWITCH
Definition exparse.c:281
#define AND
Definition exparse.c:301
#define DECLARE
Definition exparse.c:250
#define X2X
Definition exparse.c:298
#define EXIT
Definition exparse.c:254
#define F2X
Definition exparse.c:292
#define YYTERROR
Definition exparse.c:1230
#define YYPOPSTACK(N)
int yy_state_fast_t
Definition exparse.c:456
#define X2I
Definition exparse.c:296
unsigned short yytype_uint16
Definition exparse.c:410
#define PRINTF
Definition exparse.c:269
#define YYEMPTY
Definition exparse.c:1202
#define QUERY
Definition exparse.c:271
#define YYLAST
Definition exparse.c:658
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition exparse.c:622
#define yypact_value_is_default(Yyn)
Definition exparse.c:790
#define YYINITDEPTH
Definition exparse.c:1369
void ex_error(const char *message)
Definition exparse.c:3659
signed char yytype_int8
Definition exparse.c:382
#define FUNCTION
Definition exparse.c:256
void free(void *)
#define YYERROR
Definition exparse.c:1207
#define CASE
Definition exparse.c:247
#define YYSIZEOF(X)
Definition exparse.c:450
static const yytype_int16 yycheck[]
Definition exparse.c:1008
#define YYSTACK_ALLOC
Definition exparse.c:566
#define ARRAY
Definition exparse.c:244
#define YYDPRINTF(Args)
Definition exparse.c:1360
#define INC
Definition exparse.c:310
static const yytype_uint8 yydefact[]
Definition exparse.c:836
#define yyerror
Definition exparse.c:70
#define DEC
Definition exparse.c:311
disc key
Definition exparse.y:214
$1 lex
Definition exparse.y:209
expr procedure type
Definition exparse.y:211
struct Exref_s Exref_t
Definition expr.h:87
int exisAssign(Exnode_t *)
#define exalloc(p, n)
Definition expr.h:79
EX_STYPE Extype_t
Definition expr.h:81
Exnode_t * excast(Expr_t *, Exnode_t *, long, Exnode_t *, int)
#define BUILTIN(t)
Definition expr.h:58
Exnode_t * exnewnode(Expr_t *, int, int, long, Exnode_t *, Exnode_t *)
void exfreenode(Expr_t *, Exnode_t *)
char * extypename(Expr_t *p, long)
#define EX_UNDECLARED
Definition expr.h:45
#define INTEGRAL(t)
Definition expr.h:57
Extype_t exzero(long int)
Definition exzero.c:24
#define YYSTYPE
Definition gmlparse.c:66
short yytype_int16
Definition gmlparse.c:483
unsigned char yytype_uint8
Definition gmlparse.c:492
int yy_state_fast_t
Definition gmlparse.c:549
signed char yytype_int8
Definition gmlparse.c:475
yytype_int8 yy_state_t
Definition gmlparse.c:546
node NULL
Definition grammar.y:149
replacements for ctype.h functions
static bool gv_isalnum(int c)
Definition gv_ctype.h:43
char * pre
Definition maze.c:29
#define __INT_LEAST8_TYPE__
#define __UINT_LEAST8_TYPE__
Definition moc_predefs.h:10
#define __UINT_LEAST16_TYPE__
#define __INT_LEAST16_TYPE__
static bool streq(const char *a, const char *b)
are a and b equal?
Definition streq.h:11
Definition expr.h:93
long type
Definition expr.h:97
long lex
Definition expr.h:95
char name[EX_NAMELEN]
Definition expr.h:103
int op
Definition expr.h:153
long type
value type
Definition expr.h:152
Exdata_t data
Definition expr.h:162
Dt_t * symbols
Definition expr.h:204
Vmalloc_t * vm
Definition expr.h:206
Exid_t * symbol
Definition expr.h:109
Exref_t * next
Definition expr.h:108
Exnode_t * index
Definition expr.h:110
int instatic
Definition exlib.h:161
int nolabel
Definition exlib.h:155
int assigned
Definition exlib.h:160
Exid_t * id
Definition exlib.h:153
Expr_t * program
Definition exlib.h:157
Exref_t * refs
Definition exlib.h:159
long declare
current declaration type
Definition exlib.h:154
Exnode_t * procedure
Definition exlib.h:158
Switch_t * swstate
Definition exlib.h:163
Extype_t ** last
Definition exlib.h:138
int def
Definition exlib.h:139
Exnode_t * defcase
Definition exlib.h:135
struct Switch_s * prev
Definition exlib.h:132
long type
switch test type
Definition exlib.h:140
Extype_t ** cur
Definition exlib.h:137
Exnode_t * lastcase
Definition exlib.h:134
Extype_t ** base
Definition exlib.h:136
Exnode_t * firstcase
Definition exlib.h:133
int size
Definition cdt.h:90
int key
Definition cdt.h:89
Dtcompar_f comparf
Definition cdt.h:94
Definition legal.c:50
static mytime_t T
Definition timing.c:41
struct Exref_s * reference
Definition exparse.c:323
struct Exid_s * id
Definition exparse.c:324
char * string
Definition exparse.c:327
long long integer
Definition exparse.c:325
double floating
Definition exparse.c:322
struct Exnode_s * expr
Definition exparse.c:321
int op
Definition exparse.c:326
Exnode_t * left
Definition expr.h:124
Exnode_t * right
Definition expr.h:125
Exid_t * reference
Definition expr.h:119
Exnode_t * next
Definition expr.h:132
struct Exdata_u::@88 operand
Exid_t * symbol
Definition expr.h:138
Exnode_t * dyna
Definition expr.h:141
struct Exdata_u::@89 select
Exnode_t * index
Definition expr.h:140
struct Exdata_u::@90 variable
char * vmstrdup(Vmalloc_t *, const char *)
Definition vmstrdup.c:19