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