Graphviz 13.0.0~dev.20250210.0415
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, 197, 198, 201, 201, 236, 239, 254,
722 258, 262, 262, 267, 277, 290, 305, 318, 326, 337,
723 347, 347, 357, 369, 373, 386, 402, 405, 436, 437,
724 440, 458, 464, 465, 472, 472, 520, 521, 522, 523,
725 526, 527, 531, 534, 541, 544, 547, 551, 555, 608,
726 612, 616, 620, 624, 628, 632, 636, 640, 644, 648,
727 652, 656, 660, 664, 668, 681, 685, 695, 695, 695,
728 736, 756, 763, 767, 771, 775, 779, 783, 787, 791,
729 795, 799, 803, 807, 813, 817, 821, 827, 832, 836,
730 861, 897, 917, 925, 933, 944, 948, 952, 955, 956,
731 958, 966, 971, 976, 981, 988, 989, 990, 993, 994,
732 997, 1001, 1019, 1032, 1035, 1039, 1053, 1056, 1063, 1066,
733 1074, 1079, 1086, 1089, 1095, 1098, 1102, 1113, 1113, 1129,
734 1132, 1144, 1164, 1168, 1174, 1177, 1184, 1185, 1197, 1185
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 = (yyvsp[-1].expr);
1895 (yyvsp[-1].expr) = x->data.operand.left;
1896 x->data.operand.left = 0;
1898 }
1899 expr.program->main.lex = PROCEDURE;
1900 expr.program->main.value = exnewnode(expr.program, PROCEDURE, true, (yyvsp[-1].expr)->type, NULL, (yyvsp[-1].expr));
1901 }
1902 }
1903#line 1904 "exparse.c"
1904 break;
1905
1906 case 5:
1907#line 201 "../../lib/expr/exparse.y"
1908 {
1909 if (expr.procedure)
1910 exerror("no nested function definitions");
1911 (yyvsp[-1].id)->lex = PROCEDURE;
1912 expr.procedure = (yyvsp[-1].id)->value = exnewnode(expr.program, PROCEDURE, true, (yyvsp[-1].id)->type, NULL, NULL);
1914 static Dtdisc_t disc = {.key = offsetof(Exid_t, name)};
1915 if (expr.assigned && !streq((yyvsp[-1].id)->name, "begin"))
1916 {
1917 if (!(expr.procedure->data.procedure.frame = dtopen(&disc, Dtset)) ||
1918 !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
1919 exnospace();
1920 expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
1921 }
1922 }
1923#line 1924 "exparse.c"
1924 break;
1925
1926 case 6:
1927#line 216 "../../lib/expr/exparse.y"
1928 {
1930 if (expr.program->frame)
1931 {
1932 expr.program->symbols = expr.program->frame->view;
1933 dtview(expr.program->frame, NULL);
1934 expr.program->frame = NULL;
1935 }
1936 if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == S2B)
1937 {
1938 Exnode_t *x = (yyvsp[0].expr);
1939 (yyvsp[0].expr) = x->data.operand.left;
1940 x->data.operand.left = 0;
1942 }
1943 (yyvsp[-3].id)->value->data.procedure.body = excast(expr.program, (yyvsp[0].expr), (yyvsp[-3].id)->type, NULL, 0);
1944 }
1945#line 1946 "exparse.c"
1946 break;
1947
1948 case 7:
1949#line 236 "../../lib/expr/exparse.y"
1950 {
1951 (yyval.expr) = 0;
1952 }
1953#line 1954 "exparse.c"
1954 break;
1955
1956 case 8:
1957#line 240 "../../lib/expr/exparse.y"
1958 {
1959 if (!(yyvsp[-1].expr))
1960 (yyval.expr) = (yyvsp[0].expr);
1961 else if (!(yyvsp[0].expr))
1962 (yyval.expr) = (yyvsp[-1].expr);
1963 else if ((yyvsp[-1].expr)->op == CONSTANT)
1964 {
1965 exfreenode(expr.program, (yyvsp[-1].expr));
1966 (yyval.expr) = (yyvsp[0].expr);
1967 }
1968 else (yyval.expr) = exnewnode(expr.program, ';', true, (yyvsp[0].expr)->type, (yyvsp[-1].expr), (yyvsp[0].expr));
1969 }
1970#line 1971 "exparse.c"
1971 break;
1972
1973 case 9:
1974#line 255 "../../lib/expr/exparse.y"
1975 {
1976 (yyval.expr) = (yyvsp[-1].expr);
1977 }
1978#line 1979 "exparse.c"
1979 break;
1980
1981 case 10:
1982#line 259 "../../lib/expr/exparse.y"
1983 {
1984 (yyval.expr) = ((yyvsp[-1].expr) && (yyvsp[-1].expr)->type == STRING) ? exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-1].expr), NULL) : (yyvsp[-1].expr);
1985 }
1986#line 1987 "exparse.c"
1987 break;
1988
1989 case 11:
1990#line 262 "../../lib/expr/exparse.y"
1991 {expr.declare = (yyvsp[0].id)->type;}
1992#line 1993 "exparse.c"
1993 break;
1994
1995 case 12:
1996#line 263 "../../lib/expr/exparse.y"
1997 {
1998 (yyval.expr) = (yyvsp[-1].expr);
1999 expr.declare = 0;
2000 }
2001#line 2002 "exparse.c"
2002 break;
2003
2004 case 13:
2005#line 268 "../../lib/expr/exparse.y"
2006 {
2007 if (exisAssign ((yyvsp[-3].expr)))
2008 exwarn ("assignment used as boolean in if statement");
2009 if ((yyvsp[-3].expr)->type == STRING)
2010 (yyvsp[-3].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-3].expr), NULL);
2011 else if (!INTEGRAL((yyvsp[-3].expr)->type))
2012 (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), INTEGER, NULL, 0);
2013 (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)));
2014 }
2015#line 2016 "exparse.c"
2016 break;
2017
2018 case 14:
2019#line 278 "../../lib/expr/exparse.y"
2020 {
2021 (yyval.expr) = exnewnode(expr.program, ITERATE, false, INTEGER, NULL, NULL);
2022 (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
2023 if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
2024 exerror("simple index variable expected");
2025 (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
2026 if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
2027 exerror("integer index variable expected");
2028 exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
2029 (yyvsp[-2].expr)->data.variable.index = 0;
2030 (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
2031 }
2032#line 2033 "exparse.c"
2033 break;
2034
2035 case 15:
2036#line 291 "../../lib/expr/exparse.y"
2037 {
2038 if (!(yyvsp[-4].expr))
2039 {
2040 (yyvsp[-4].expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
2041 (yyvsp[-4].expr)->data.constant.value.integer = 1;
2042 }
2043 else if ((yyvsp[-4].expr)->type == STRING)
2044 (yyvsp[-4].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-4].expr), NULL);
2045 else if (!INTEGRAL((yyvsp[-4].expr)->type))
2046 (yyvsp[-4].expr) = excast(expr.program, (yyvsp[-4].expr), INTEGER, NULL, 0);
2047 (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)));
2048 if ((yyvsp[-6].expr))
2049 (yyval.expr) = exnewnode(expr.program, ';', true, INTEGER, (yyvsp[-6].expr), (yyval.expr));
2050 }
2051#line 2052 "exparse.c"
2052 break;
2053
2054 case 16:
2055#line 306 "../../lib/expr/exparse.y"
2056 {
2057 (yyval.expr) = exnewnode(expr.program, ITERATOR, false, INTEGER, NULL, NULL);
2058 (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
2059 if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
2060 exerror("simple index variable expected");
2061 (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
2062 if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
2063 exerror("integer index variable expected");
2064 exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
2065 (yyvsp[-2].expr)->data.variable.index = 0;
2066 (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
2067 }
2068#line 2069 "exparse.c"
2069 break;
2070
2071 case 17:
2072#line 319 "../../lib/expr/exparse.y"
2073 {
2074 if ((yyvsp[-1].id)->local == NULL)
2075 exerror("cannot apply unset to non-array %s", (yyvsp[-1].id)->name);
2076 (yyval.expr) = exnewnode(expr.program, UNSET, false, INTEGER, NULL, NULL);
2077 (yyval.expr)->data.variable.symbol = (yyvsp[-1].id);
2078 (yyval.expr)->data.variable.index = NULL;
2079 }
2080#line 2081 "exparse.c"
2081 break;
2082
2083 case 18:
2084#line 327 "../../lib/expr/exparse.y"
2085 {
2086 if ((yyvsp[-3].id)->local == NULL)
2087 exerror("cannot apply unset to non-array %s", (yyvsp[-3].id)->name);
2088 if (((yyvsp[-3].id)->index_type > 0) && ((yyvsp[-1].expr)->type != (yyvsp[-3].id)->index_type))
2089 exerror("%s indices must have type %s, not %s",
2090 (yyvsp[-3].id)->name, extypename(expr.program, (yyvsp[-3].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
2091 (yyval.expr) = exnewnode(expr.program, UNSET, false, INTEGER, NULL, NULL);
2092 (yyval.expr)->data.variable.symbol = (yyvsp[-3].id);
2093 (yyval.expr)->data.variable.index = (yyvsp[-1].expr);
2094 }
2095#line 2096 "exparse.c"
2096 break;
2097
2098 case 19:
2099#line 338 "../../lib/expr/exparse.y"
2100 {
2101 if (exisAssign ((yyvsp[-2].expr)))
2102 exwarn ("assignment used as boolean in while statement");
2103 if ((yyvsp[-2].expr)->type == STRING)
2104 (yyvsp[-2].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-2].expr), NULL);
2105 else if (!INTEGRAL((yyvsp[-2].expr)->type))
2106 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
2107 (yyval.expr) = exnewnode(expr.program, (yyvsp[-4].id)->index, true, INTEGER, (yyvsp[-2].expr), exnewnode(expr.program, ';', true, 0, NULL, (yyvsp[0].expr)));
2108 }
2109#line 2110 "exparse.c"
2110 break;
2111
2112 case 20:
2113#line 347 "../../lib/expr/exparse.y"
2114 {expr.declare=(yyvsp[0].expr)->type;}
2115#line 2116 "exparse.c"
2116 break;
2117
2118 case 21:
2119#line 348 "../../lib/expr/exparse.y"
2120 {
2121 Switch_t* sw = expr.swstate;
2122
2123 (yyval.expr) = exnewnode(expr.program, (yyvsp[-7].id)->index, true, INTEGER, (yyvsp[-5].expr), exnewnode(expr.program, DEFAULT, true, 0, sw->defcase, sw->firstcase));
2125 free(sw->base);
2126 free(sw);
2127 expr.declare = 0;
2128 }
2129#line 2130 "exparse.c"
2130 break;
2131
2132 case 22:
2133#line 358 "../../lib/expr/exparse.y"
2134 {
2135 loopop:
2136 if (!(yyvsp[-1].expr))
2137 {
2138 (yyvsp[-1].expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
2139 (yyvsp[-1].expr)->data.constant.value.integer = 1;
2140 }
2141 else if (!INTEGRAL((yyvsp[-1].expr)->type))
2142 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2143 (yyval.expr) = exnewnode(expr.program, (yyvsp[-2].id)->index, true, INTEGER, (yyvsp[-1].expr), NULL);
2144 }
2145#line 2146 "exparse.c"
2146 break;
2147
2148 case 23:
2149#line 370 "../../lib/expr/exparse.y"
2150 {
2151 goto loopop;
2152 }
2153#line 2154 "exparse.c"
2154 break;
2155
2156 case 24:
2157#line 374 "../../lib/expr/exparse.y"
2158 {
2159 if ((yyvsp[-1].expr))
2160 {
2161 if (expr.procedure && !expr.procedure->type)
2162 exerror("return in void function");
2163 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.procedure ? expr.procedure->type : INTEGER, NULL, 0);
2164 }
2165 (yyval.expr) = exnewnode(expr.program, RETURN, true, (yyvsp[-1].expr) ? (yyvsp[-1].expr)->type : 0, (yyvsp[-1].expr), NULL);
2166 }
2167#line 2168 "exparse.c"
2168 break;
2169
2170 case 25:
2171#line 386 "../../lib/expr/exparse.y"
2172 {
2173 Switch_t* sw;
2174
2175 if (!(sw = calloc(1, sizeof(Switch_t)))) {
2176 exnospace();
2177 } else {
2178 expr.swstate = sw;
2179 sw->type = expr.declare;
2180 size_t n = 8;
2181 if (!(sw->base = calloc(n, sizeof(Extype_t*)))) {
2182 exnospace();
2183 n = 0;
2184 }
2185 sw->cap = n;
2186 }
2187 }
2188#line 2189 "exparse.c"
2189 break;
2190
2191 case 27:
2192#line 406 "../../lib/expr/exparse.y"
2193 {
2194 Switch_t* sw = expr.swstate;
2195
2196 (yyval.expr) = exnewnode(expr.program, CASE, true, 0, (yyvsp[0].expr), NULL);
2197 if (sw->cur > 0)
2198 {
2199 if (sw->lastcase)
2200 sw->lastcase->data.select.next = (yyval.expr);
2201 else
2202 sw->firstcase = (yyval.expr);
2203 sw->lastcase = (yyval.expr);
2204 const size_t n = sw->cap;
2205 sw->cur = 0;
2206 (yyval.expr)->data.select.constant = exalloc(expr.program, (n + 1) * sizeof(Extype_t*));
2207 memcpy((yyval.expr)->data.select.constant, sw->base, n * sizeof(Extype_t*));
2208 (yyval.expr)->data.select.constant[n] = 0;
2209 }
2210 else
2211 (yyval.expr)->data.select.constant = 0;
2212 if (sw->def)
2213 {
2214 sw->def = 0;
2215 if (sw->defcase)
2216 exerror("duplicate default in switch");
2217 else
2218 sw->defcase = (yyvsp[0].expr);
2219 }
2220 }
2221#line 2222 "exparse.c"
2222 break;
2223
2224 case 30:
2225#line 441 "../../lib/expr/exparse.y"
2226 {
2227 if (expr.swstate->cur >= expr.swstate->cap)
2228 {
2229 size_t n = expr.swstate->cap;
2230 if (!(expr.swstate->base = realloc(expr.swstate->base, sizeof(Extype_t*) * 2 * n)))
2231 {
2232 exerror("too many case labels for switch");
2233 n = 0;
2234 }
2235 expr.swstate->cap = 2 * n;
2236 }
2237 if (expr.swstate->base != NULL)
2238 {
2239 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.swstate->type, NULL, 0);
2240 expr.swstate->base[expr.swstate->cur++] = &(yyvsp[-1].expr)->data.constant.value;
2241 }
2242 }
2243#line 2244 "exparse.c"
2244 break;
2245
2246 case 31:
2247#line 459 "../../lib/expr/exparse.y"
2248 {
2249 expr.swstate->def = 1;
2250 }
2251#line 2252 "exparse.c"
2252 break;
2253
2254 case 33:
2255#line 466 "../../lib/expr/exparse.y"
2256 {
2257 if ((yyvsp[0].expr))
2258 (yyval.expr) = (yyvsp[-2].expr) ? exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr)) : (yyvsp[0].expr);
2259 }
2260#line 2261 "exparse.c"
2261 break;
2262
2263 case 34:
2264#line 472 "../../lib/expr/exparse.y"
2265 {checkName ((yyvsp[0].id)); expr.id=(yyvsp[0].id);}
2266#line 2267 "exparse.c"
2267 break;
2268
2269 case 35:
2270#line 473 "../../lib/expr/exparse.y"
2271 {
2272 (yyval.expr) = 0;
2273 if (!(yyvsp[-3].id)->type || expr.declare)
2274 (yyvsp[-3].id)->type = expr.declare;
2275 if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == PROCEDURE)
2276 {
2277 (yyvsp[-3].id)->lex = PROCEDURE;
2278 (yyvsp[-3].id)->type = (yyvsp[0].expr)->type;
2279 (yyvsp[-3].id)->value = (yyvsp[0].expr);
2280 }
2281 else
2282 {
2283 if ((yyvsp[-3].id)->type == 0) {
2284 exerror("%s: a variable cannot be void typed", (yyvsp[-3].id)->name);
2285 }
2286 (yyvsp[-3].id)->lex = DYNAMIC;
2287 (yyvsp[-3].id)->value = exnewnode(expr.program, 0, false, 0, NULL, NULL);
2288 if ((yyvsp[-1].integer) && (yyvsp[-3].id)->local == NULL)
2289 {
2290 static Dtdisc_t disc_key = {
2291 .key = offsetof(Exassoc_t, key),
2292 .size = sizeof(Extype_t),
2293 .comparf = cmpKey,
2294 };
2295 static Dtdisc_t disc_name = {.key = offsetof(Exassoc_t, name)};
2296 Dtdisc_t *const disc = (yyvsp[-1].integer) == INTEGER ? &disc_key : &disc_name;
2297 if (!((yyvsp[-3].id)->local = dtopen(disc, Dtoset)))
2298 exerror("%s: cannot initialize associative array", (yyvsp[-3].id)->name);
2299 (yyvsp[-3].id)->index_type = (yyvsp[-1].integer); /* -1 indicates no typechecking */
2300 }
2301 if ((yyvsp[0].expr))
2302 {
2303 if ((yyvsp[0].expr)->type != (yyvsp[-3].id)->type)
2304 {
2305 (yyvsp[0].expr)->type = (yyvsp[-3].id)->type;
2306 (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-3].id)->type, NULL, 0);
2307 }
2308 (yyvsp[0].expr)->data.operand.left = exnewnode(expr.program, DYNAMIC, false, (yyvsp[-3].id)->type, NULL, NULL);
2309 (yyvsp[0].expr)->data.operand.left->data.variable.symbol = (yyvsp[-3].id);
2310 (yyval.expr) = (yyvsp[0].expr);
2311 }
2312 else if (!(yyvsp[-1].integer))
2313 (yyvsp[-3].id)->value->data.value = exzero((yyvsp[-3].id)->type);
2314 }
2315 }
2316#line 2317 "exparse.c"
2317 break;
2318
2319 case 42:
2320#line 531 "../../lib/expr/exparse.y"
2321 {
2322 (yyval.expr) = 0;
2323 }
2324#line 2325 "exparse.c"
2325 break;
2326
2327 case 43:
2328#line 535 "../../lib/expr/exparse.y"
2329 {
2330 (yyval.expr) = (yyvsp[0].expr);
2331 }
2332#line 2333 "exparse.c"
2333 break;
2334
2335 case 44:
2336#line 541 "../../lib/expr/exparse.y"
2337 {
2338 (yyval.expr) = 0;
2339 }
2340#line 2341 "exparse.c"
2341 break;
2342
2343 case 46:
2344#line 548 "../../lib/expr/exparse.y"
2345 {
2346 (yyval.expr) = (yyvsp[-1].expr);
2347 }
2348#line 2349 "exparse.c"
2349 break;
2350
2351 case 47:
2352#line 552 "../../lib/expr/exparse.y"
2353 {
2354 (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);
2355 }
2356#line 2357 "exparse.c"
2357 break;
2358
2359 case 48:
2360#line 556 "../../lib/expr/exparse.y"
2361 {
2362 long rel;
2363
2364 relational:
2365 rel = INTEGER;
2366 goto coerce;
2367 binary:
2368 rel = 0;
2369 coerce:
2370 if (!(yyvsp[-2].expr)->type)
2371 {
2372 if (!(yyvsp[0].expr)->type)
2373 (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type = rel ? STRING : INTEGER;
2374 else
2375 (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type;
2376 }
2377 else if (!(yyvsp[0].expr)->type)
2378 (yyvsp[0].expr)->type = (yyvsp[-2].expr)->type;
2379 if ((yyvsp[-2].expr)->type != (yyvsp[0].expr)->type)
2380 {
2381 if ((yyvsp[-2].expr)->type == STRING)
2382 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), (yyvsp[0].expr)->type, (yyvsp[0].expr), 0);
2383 else if ((yyvsp[0].expr)->type == STRING)
2384 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), (yyvsp[-2].expr)->type, (yyvsp[-2].expr), 0);
2385 else if ((yyvsp[-2].expr)->type == FLOATING)
2386 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, (yyvsp[-2].expr), 0);
2387 else if ((yyvsp[0].expr)->type == FLOATING)
2388 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), FLOATING, (yyvsp[0].expr), 0);
2389 }
2390 if (!rel)
2391 rel = ((yyvsp[-2].expr)->type == STRING) ? STRING : (((yyvsp[-2].expr)->type == UNSIGNED) ? UNSIGNED : (yyvsp[0].expr)->type);
2392 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), true, rel, (yyvsp[-2].expr), (yyvsp[0].expr));
2393 if (!expr.program->errors && (yyvsp[-2].expr)->op == CONSTANT && (yyvsp[0].expr)->op == CONSTANT)
2394 {
2395 (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
2396 /* If a constant string, re-allocate from program heap. This is because the
2397 * value was constructed from string operators, which create a value in the
2398 * temporary heap, which is cleared when exeval is called again.
2399 */
2400 if ((yyval.expr)->type == STRING) {
2401 (yyval.expr)->data.constant.value.string =
2402 vmstrdup(expr.program->vm, (yyval.expr)->data.constant.value.string);
2403 }
2404 (yyval.expr)->binary = false;
2405 (yyval.expr)->op = CONSTANT;
2406 exfreenode(expr.program, (yyvsp[-2].expr));
2407 exfreenode(expr.program, (yyvsp[0].expr));
2408 }
2409 else if (!BUILTIN((yyvsp[-2].expr)->type) || !BUILTIN((yyvsp[0].expr)->type)) {
2410 checkBinary(expr.program, (yyvsp[-2].expr), (yyval.expr), (yyvsp[0].expr));
2411 }
2412 }
2413#line 2414 "exparse.c"
2414 break;
2415
2416 case 49:
2417#line 609 "../../lib/expr/exparse.y"
2418 {
2419 goto binary;
2420 }
2421#line 2422 "exparse.c"
2422 break;
2423
2424 case 50:
2425#line 613 "../../lib/expr/exparse.y"
2426 {
2427 goto binary;
2428 }
2429#line 2430 "exparse.c"
2430 break;
2431
2432 case 51:
2433#line 617 "../../lib/expr/exparse.y"
2434 {
2435 goto binary;
2436 }
2437#line 2438 "exparse.c"
2438 break;
2439
2440 case 52:
2441#line 621 "../../lib/expr/exparse.y"
2442 {
2443 goto binary;
2444 }
2445#line 2446 "exparse.c"
2446 break;
2447
2448 case 53:
2449#line 625 "../../lib/expr/exparse.y"
2450 {
2451 goto binary;
2452 }
2453#line 2454 "exparse.c"
2454 break;
2455
2456 case 54:
2457#line 629 "../../lib/expr/exparse.y"
2458 {
2459 goto binary;
2460 }
2461#line 2462 "exparse.c"
2462 break;
2463
2464 case 55:
2465#line 633 "../../lib/expr/exparse.y"
2466 {
2467 goto relational;
2468 }
2469#line 2470 "exparse.c"
2470 break;
2471
2472 case 56:
2473#line 637 "../../lib/expr/exparse.y"
2474 {
2475 goto relational;
2476 }
2477#line 2478 "exparse.c"
2478 break;
2479
2480 case 57:
2481#line 641 "../../lib/expr/exparse.y"
2482 {
2483 goto relational;
2484 }
2485#line 2486 "exparse.c"
2486 break;
2487
2488 case 58:
2489#line 645 "../../lib/expr/exparse.y"
2490 {
2491 goto relational;
2492 }
2493#line 2494 "exparse.c"
2494 break;
2495
2496 case 59:
2497#line 649 "../../lib/expr/exparse.y"
2498 {
2499 goto relational;
2500 }
2501#line 2502 "exparse.c"
2502 break;
2503
2504 case 60:
2505#line 653 "../../lib/expr/exparse.y"
2506 {
2507 goto binary;
2508 }
2509#line 2510 "exparse.c"
2510 break;
2511
2512 case 61:
2513#line 657 "../../lib/expr/exparse.y"
2514 {
2515 goto binary;
2516 }
2517#line 2518 "exparse.c"
2518 break;
2519
2520 case 62:
2521#line 661 "../../lib/expr/exparse.y"
2522 {
2523 goto binary;
2524 }
2525#line 2526 "exparse.c"
2526 break;
2527
2528 case 63:
2529#line 665 "../../lib/expr/exparse.y"
2530 {
2531 goto binary;
2532 }
2533#line 2534 "exparse.c"
2534 break;
2535
2536 case 64:
2537#line 669 "../../lib/expr/exparse.y"
2538 {
2539 logical:
2540 if ((yyvsp[-2].expr)->type == STRING)
2541 (yyvsp[-2].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-2].expr), NULL);
2542 else if (!BUILTIN((yyvsp[-2].expr)->type))
2543 (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
2544 if ((yyvsp[0].expr)->type == STRING)
2545 (yyvsp[0].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[0].expr), NULL);
2546 else if (!BUILTIN((yyvsp[0].expr)->type))
2547 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
2548 goto binary;
2549 }
2550#line 2551 "exparse.c"
2551 break;
2552
2553 case 65:
2554#line 682 "../../lib/expr/exparse.y"
2555 {
2556 goto logical;
2557 }
2558#line 2559 "exparse.c"
2559 break;
2560
2561 case 66:
2562#line 686 "../../lib/expr/exparse.y"
2563 {
2564 if ((yyvsp[-2].expr)->op == CONSTANT)
2565 {
2566 exfreenode(expr.program, (yyvsp[-2].expr));
2567 (yyval.expr) = (yyvsp[0].expr);
2568 }
2569 else
2570 (yyval.expr) = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr));
2571 }
2572#line 2573 "exparse.c"
2573 break;
2574
2575 case 67:
2576#line 695 "../../lib/expr/exparse.y"
2577 {expr.nolabel=1;}
2578#line 2579 "exparse.c"
2579 break;
2580
2581 case 68:
2582#line 695 "../../lib/expr/exparse.y"
2583 {expr.nolabel=0;}
2584#line 2585 "exparse.c"
2585 break;
2586
2587 case 69:
2588#line 696 "../../lib/expr/exparse.y"
2589 {
2590 if (!(yyvsp[-3].expr)->type)
2591 {
2592 if (!(yyvsp[0].expr)->type)
2593 (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type = INTEGER;
2594 else
2595 (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type;
2596 }
2597 else if (!(yyvsp[0].expr)->type)
2598 (yyvsp[0].expr)->type = (yyvsp[-3].expr)->type;
2599 if ((yyvsp[-6].expr)->type == STRING)
2600 (yyvsp[-6].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-6].expr), NULL);
2601 else if (!INTEGRAL((yyvsp[-6].expr)->type))
2602 (yyvsp[-6].expr) = excast(expr.program, (yyvsp[-6].expr), INTEGER, NULL, 0);
2603 if ((yyvsp[-3].expr)->type != (yyvsp[0].expr)->type)
2604 {
2605 if ((yyvsp[-3].expr)->type == STRING || (yyvsp[0].expr)->type == STRING)
2606 exerror("if statement string type mismatch");
2607 else if ((yyvsp[-3].expr)->type == FLOATING)
2608 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, NULL, 0);
2609 else if ((yyvsp[0].expr)->type == FLOATING)
2610 (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), FLOATING, NULL, 0);
2611 }
2612 if ((yyvsp[-6].expr)->op == CONSTANT)
2613 {
2614 if ((yyvsp[-6].expr)->data.constant.value.integer)
2615 {
2616 (yyval.expr) = (yyvsp[-3].expr);
2617 exfreenode(expr.program, (yyvsp[0].expr));
2618 }
2619 else
2620 {
2621 (yyval.expr) = (yyvsp[0].expr);
2622 exfreenode(expr.program, (yyvsp[-3].expr));
2623 }
2624 exfreenode(expr.program, (yyvsp[-6].expr));
2625 }
2626 else
2627 (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)));
2628 }
2629#line 2630 "exparse.c"
2630 break;
2631
2632 case 70:
2633#line 737 "../../lib/expr/exparse.y"
2634 {
2635 iunary:
2636 if ((yyvsp[0].expr)->type == STRING)
2637 (yyvsp[0].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[0].expr), NULL);
2638 else if (!INTEGRAL((yyvsp[0].expr)->type))
2639 (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
2640 unary:
2641 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), true, (yyvsp[0].expr)->type == UNSIGNED ? INTEGER : (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
2642 if ((yyvsp[0].expr)->op == CONSTANT)
2643 {
2644 (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
2645 (yyval.expr)->binary = false;
2646 (yyval.expr)->op = CONSTANT;
2647 exfreenode(expr.program, (yyvsp[0].expr));
2648 }
2649 else if (!BUILTIN((yyvsp[0].expr)->type)) {
2650 checkBinary(expr.program, (yyvsp[0].expr), (yyval.expr), 0);
2651 }
2652 }
2653#line 2654 "exparse.c"
2654 break;
2655
2656 case 71:
2657#line 757 "../../lib/expr/exparse.y"
2658 {
2659 if ((yyvsp[0].id)->local == NULL)
2660 exerror("cannot apply '#' operator to non-array %s", (yyvsp[0].id)->name);
2661 (yyval.expr) = exnewnode(expr.program, '#', false, INTEGER, NULL, NULL);
2662 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
2663 }
2664#line 2665 "exparse.c"
2665 break;
2666
2667 case 72:
2668#line 764 "../../lib/expr/exparse.y"
2669 {
2670 goto iunary;
2671 }
2672#line 2673 "exparse.c"
2673 break;
2674
2675 case 73:
2676#line 768 "../../lib/expr/exparse.y"
2677 {
2678 goto unary;
2679 }
2680#line 2681 "exparse.c"
2681 break;
2682
2683 case 74:
2684#line 772 "../../lib/expr/exparse.y"
2685 {
2686 (yyval.expr) = (yyvsp[0].expr);
2687 }
2688#line 2689 "exparse.c"
2689 break;
2690
2691 case 75:
2692#line 776 "../../lib/expr/exparse.y"
2693 {
2694 (yyval.expr) = exnewnode(expr.program, ADDRESS, false, T((yyvsp[0].expr)->type), (yyvsp[0].expr), NULL);
2695 }
2696#line 2697 "exparse.c"
2697 break;
2698
2699 case 76:
2700#line 780 "../../lib/expr/exparse.y"
2701 {
2702 (yyval.expr) = exnewnode(expr.program, ARRAY, true, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
2703 }
2704#line 2705 "exparse.c"
2705 break;
2706
2707 case 77:
2708#line 784 "../../lib/expr/exparse.y"
2709 {
2710 (yyval.expr) = exnewnode(expr.program, FUNCTION, true, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
2711 }
2712#line 2713 "exparse.c"
2713 break;
2714
2715 case 78:
2716#line 788 "../../lib/expr/exparse.y"
2717 {
2718 (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), GSUB);
2719 }
2720#line 2721 "exparse.c"
2721 break;
2722
2723 case 79:
2724#line 792 "../../lib/expr/exparse.y"
2725 {
2726 (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), SUB);
2727 }
2728#line 2729 "exparse.c"
2729 break;
2730
2731 case 80:
2732#line 796 "../../lib/expr/exparse.y"
2733 {
2734 (yyval.expr) = exnewsubstr (expr.program, (yyvsp[-1].expr));
2735 }
2736#line 2737 "exparse.c"
2737 break;
2738
2739 case 81:
2740#line 800 "../../lib/expr/exparse.y"
2741 {
2742 (yyval.expr) = exnewsplit (expr.program, (yyvsp[-5].id)->index, (yyvsp[-1].id), (yyvsp[-3].expr), NULL);
2743 }
2744#line 2745 "exparse.c"
2745 break;
2746
2747 case 82:
2748#line 804 "../../lib/expr/exparse.y"
2749 {
2750 (yyval.expr) = exnewsplit (expr.program, (yyvsp[-7].id)->index, (yyvsp[-3].id), (yyvsp[-5].expr), (yyvsp[-1].expr));
2751 }
2752#line 2753 "exparse.c"
2753 break;
2754
2755 case 83:
2756#line 808 "../../lib/expr/exparse.y"
2757 {
2758 if (!INTEGRAL((yyvsp[-1].expr)->type))
2759 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2760 (yyval.expr) = exnewnode(expr.program, EXIT, true, INTEGER, (yyvsp[-1].expr), NULL);
2761 }
2762#line 2763 "exparse.c"
2763 break;
2764
2765 case 84:
2766#line 814 "../../lib/expr/exparse.y"
2767 {
2768 (yyval.expr) = exnewnode(expr.program, RAND, false, FLOATING, NULL, NULL);
2769 }
2770#line 2771 "exparse.c"
2771 break;
2772
2773 case 85:
2774#line 818 "../../lib/expr/exparse.y"
2775 {
2776 (yyval.expr) = exnewnode(expr.program, SRAND, false, INTEGER, NULL, NULL);
2777 }
2778#line 2779 "exparse.c"
2779 break;
2780
2781 case 86:
2782#line 822 "../../lib/expr/exparse.y"
2783 {
2784 if (!INTEGRAL((yyvsp[-1].expr)->type))
2785 (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
2786 (yyval.expr) = exnewnode(expr.program, SRAND, true, INTEGER, (yyvsp[-1].expr), NULL);
2787 }
2788#line 2789 "exparse.c"
2789 break;
2790
2791 case 87:
2792#line 828 "../../lib/expr/exparse.y"
2793 {
2794 (yyval.expr) = exnewnode(expr.program, CALL, true, (yyvsp[-3].id)->type, NULL, (yyvsp[-1].expr));
2795 (yyval.expr)->data.call.procedure = (yyvsp[-3].id);
2796 }
2797#line 2798 "exparse.c"
2798 break;
2799
2800 case 88:
2801#line 833 "../../lib/expr/exparse.y"
2802 {
2803 (yyval.expr) = exprint(expr.program, (yyvsp[-3].id), (yyvsp[-1].expr));
2804 }
2805#line 2806 "exparse.c"
2806 break;
2807
2808 case 89:
2809#line 837 "../../lib/expr/exparse.y"
2810 {
2811 (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, false, (yyvsp[-3].id)->type, NULL, NULL);
2812 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
2813 {
2814 (yyval.expr)->data.print.descriptor = (yyvsp[-1].expr)->data.operand.left;
2815 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2816 }
2817 else
2818 switch ((yyvsp[-3].id)->index)
2819 {
2820 case QUERY:
2821 (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
2822 (yyval.expr)->data.print.descriptor->data.constant.value.integer = 2;
2823 break;
2824 case PRINTF:
2825 (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
2826 (yyval.expr)->data.print.descriptor->data.constant.value.integer = 1;
2827 break;
2828 case SPRINTF:
2829 (yyval.expr)->data.print.descriptor = 0;
2830 break;
2831 }
2832 (yyval.expr)->data.print.args = preprint((yyvsp[-1].expr));
2833 }
2834#line 2835 "exparse.c"
2835 break;
2836
2837 case 90:
2838#line 862 "../../lib/expr/exparse.y"
2839 {
2840 Exnode_t* x;
2841
2842 (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, false, (yyvsp[-3].id)->type, NULL, NULL);
2843 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
2844 {
2845 (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
2846 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2847 }
2848 else
2849 switch ((yyvsp[-3].id)->index)
2850 {
2851 case SCANF:
2852 (yyval.expr)->data.scan.descriptor = 0;
2853 break;
2854 case SSCANF:
2855 if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == STRING)
2856 {
2857 (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
2858 (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
2859 }
2860 else
2861 exerror("%s: string argument expected", (yyvsp[-3].id)->name);
2862 break;
2863 }
2864 if (!(yyvsp[-1].expr) || !(yyvsp[-1].expr)->data.operand.left || (yyvsp[-1].expr)->data.operand.left->type != STRING)
2865 exerror("%s: format argument expected", (yyvsp[-3].id)->name);
2866 (yyval.expr)->data.scan.format = (yyvsp[-1].expr)->data.operand.left;
2867 for (x = (yyval.expr)->data.scan.args = (yyvsp[-1].expr)->data.operand.right; x; x = x->data.operand.right)
2868 {
2869 if (x->data.operand.left->op != ADDRESS)
2870 exerror("%s: address argument expected", (yyvsp[-3].id)->name);
2872 }
2873 }
2874#line 2875 "exparse.c"
2875 break;
2876
2877 case 91:
2878#line 898 "../../lib/expr/exparse.y"
2879 {
2880 if ((yyvsp[0].expr))
2881 {
2882 if ((yyvsp[-1].expr)->op == ID && !expr.program->disc->setf)
2883 exerror("%s: variable assignment not supported", (yyvsp[-1].expr)->data.variable.symbol->name);
2884 else
2885 {
2886 if (!(yyvsp[-1].expr)->type)
2887 (yyvsp[-1].expr)->type = (yyvsp[0].expr)->type;
2888 else if ((yyvsp[0].expr)->type != (yyvsp[-1].expr)->type)
2889 {
2890 (yyvsp[0].expr)->type = (yyvsp[-1].expr)->type;
2891 (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-1].expr)->type, NULL, 0);
2892 }
2893 (yyvsp[0].expr)->data.operand.left = (yyvsp[-1].expr);
2894 (yyval.expr) = (yyvsp[0].expr);
2895 }
2896 }
2897 }
2898#line 2899 "exparse.c"
2899 break;
2900
2901 case 92:
2902#line 918 "../../lib/expr/exparse.y"
2903 {
2904 pre:
2905 if ((yyvsp[0].expr)->type == STRING)
2906 exerror("++ and -- invalid for string variables");
2907 (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), false, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
2908 (yyval.expr)->subop = PRE;
2909 }
2910#line 2911 "exparse.c"
2911 break;
2912
2913 case 93:
2914#line 926 "../../lib/expr/exparse.y"
2915 {
2916 pos:
2917 if ((yyvsp[-1].expr)->type == STRING)
2918 exerror("++ and -- invalid for string variables");
2919 (yyval.expr) = exnewnode(expr.program, (yyvsp[0].op), false, (yyvsp[-1].expr)->type, (yyvsp[-1].expr), NULL);
2920 (yyval.expr)->subop = POS;
2921 }
2922#line 2923 "exparse.c"
2923 break;
2924
2925 case 94:
2926#line 934 "../../lib/expr/exparse.y"
2927 {
2928 if ((yyvsp[0].id)->local == NULL)
2929 exerror("cannot apply IN to non-array %s", (yyvsp[0].id)->name);
2930 if ((yyvsp[0].id)->index_type > 0 && (yyvsp[-2].expr)->type != (yyvsp[0].id)->index_type)
2931 exerror("%s indices must have type %s, not %s",
2932 (yyvsp[0].id)->name, extypename(expr.program, (yyvsp[0].id)->index_type),extypename(expr.program, (yyvsp[-2].expr)->type));
2933 (yyval.expr) = exnewnode(expr.program, IN_OP, false, INTEGER, NULL, NULL);
2934 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
2935 (yyval.expr)->data.variable.index = (yyvsp[-2].expr);
2936 }
2937#line 2938 "exparse.c"
2938 break;
2939
2940 case 95:
2941#line 945 "../../lib/expr/exparse.y"
2942 {
2943 goto pre;
2944 }
2945#line 2946 "exparse.c"
2946 break;
2947
2948 case 96:
2949#line 949 "../../lib/expr/exparse.y"
2950 {
2951 goto pos;
2952 }
2953#line 2954 "exparse.c"
2954 break;
2955
2956 case 100:
2957#line 959 "../../lib/expr/exparse.y"
2958 {
2959 (yyval.expr) = exnewnode(expr.program, CONSTANT, false, (yyvsp[0].id)->type, NULL, NULL);
2960 if (!expr.program->disc->reff)
2961 exerror("%s: identifier references not supported", (yyvsp[0].id)->name);
2962 else
2963 (yyval.expr)->data.constant.value = expr.program->disc->reff(expr.program, (yyval.expr), (yyvsp[0].id), NULL);
2964 }
2965#line 2966 "exparse.c"
2966 break;
2967
2968 case 101:
2969#line 967 "../../lib/expr/exparse.y"
2970 {
2971 (yyval.expr) = exnewnode(expr.program, CONSTANT, false, FLOATING, NULL, NULL);
2972 (yyval.expr)->data.constant.value.floating = (yyvsp[0].floating);
2973 }
2974#line 2975 "exparse.c"
2975 break;
2976
2977 case 102:
2978#line 972 "../../lib/expr/exparse.y"
2979 {
2980 (yyval.expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
2981 (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
2982 }
2983#line 2984 "exparse.c"
2984 break;
2985
2986 case 103:
2987#line 977 "../../lib/expr/exparse.y"
2988 {
2989 (yyval.expr) = exnewnode(expr.program, CONSTANT, false, STRING, NULL, NULL);
2990 (yyval.expr)->data.constant.value.string = (yyvsp[0].string);
2991 }
2992#line 2993 "exparse.c"
2993 break;
2994
2995 case 104:
2996#line 982 "../../lib/expr/exparse.y"
2997 {
2998 (yyval.expr) = exnewnode(expr.program, CONSTANT, false, UNSIGNED, NULL, NULL);
2999 (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
3000 }
3001#line 3002 "exparse.c"
3002 break;
3003
3004 case 110:
3005#line 998 "../../lib/expr/exparse.y"
3006 {
3007 (yyval.expr) = makeVar(expr.program, (yyvsp[-1].id), 0, 0, (yyvsp[0].reference));
3008 }
3009#line 3010 "exparse.c"
3010 break;
3011
3012 case 111:
3013#line 1002 "../../lib/expr/exparse.y"
3014 {
3015 Exnode_t *n = exnewnode(expr.program, DYNAMIC, false, (yyvsp[-2].id)->type, NULL, NULL);
3016 n->data.variable.symbol = (yyvsp[-2].id);
3017 n->data.variable.reference = 0;
3018 if (((n->data.variable.index = (yyvsp[-1].expr)) == 0) != ((yyvsp[-2].id)->local == NULL))
3019 exerror("%s: is%s an array", (yyvsp[-2].id)->name, (yyvsp[-2].id)->local != NULL ? "" : " not");
3020 if ((yyvsp[-2].id)->local != NULL && (yyvsp[-2].id)->index_type > 0) {
3021 if ((yyvsp[-1].expr)->type != (yyvsp[-2].id)->index_type)
3022 exerror("%s: indices must have type %s, not %s",
3023 (yyvsp[-2].id)->name, extypename(expr.program, (yyvsp[-2].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
3024 }
3025 if ((yyvsp[0].reference)) {
3026 n->data.variable.dyna = exnewnode(expr.program, 0, false, 0, NULL, NULL);
3027 (yyval.expr) = makeVar(expr.program, (yyvsp[-2].id), (yyvsp[-1].expr), n, (yyvsp[0].reference));
3028 }
3029 else (yyval.expr) = n;
3030 }
3031#line 3032 "exparse.c"
3032 break;
3033
3034 case 112:
3035#line 1020 "../../lib/expr/exparse.y"
3036 {
3037 (yyval.expr) = exnewnode(expr.program, ID, false, STRING, NULL, NULL);
3038 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
3039 (yyval.expr)->data.variable.reference = 0;
3040 (yyval.expr)->data.variable.index = 0;
3041 (yyval.expr)->data.variable.dyna = 0;
3042 if (!(expr.program->disc->flags & EX_UNDECLARED))
3043 exerror("unknown identifier");
3044 }
3045#line 3046 "exparse.c"
3046 break;
3047
3048 case 113:
3049#line 1032 "../../lib/expr/exparse.y"
3050 {
3051 (yyval.integer) = 0;
3052 }
3053#line 3054 "exparse.c"
3054 break;
3055
3056 case 114:
3057#line 1036 "../../lib/expr/exparse.y"
3058 {
3059 (yyval.integer) = -1;
3060 }
3061#line 3062 "exparse.c"
3062 break;
3063
3064 case 115:
3065#line 1040 "../../lib/expr/exparse.y"
3066 {
3067 /* If DECLARE is VOID, its type is 0, so this acts like
3068 * the empty case.
3069 */
3070 if (INTEGRAL((yyvsp[-1].id)->type))
3071 (yyval.integer) = INTEGER;
3072 else
3073 (yyval.integer) = (yyvsp[-1].id)->type;
3074
3075 }
3076#line 3077 "exparse.c"
3077 break;
3078
3079 case 116:
3080#line 1053 "../../lib/expr/exparse.y"
3081 {
3082 (yyval.expr) = 0;
3083 }
3084#line 3085 "exparse.c"
3085 break;
3086
3087 case 117:
3088#line 1057 "../../lib/expr/exparse.y"
3089 {
3090 (yyval.expr) = (yyvsp[-1].expr);
3091 }
3092#line 3093 "exparse.c"
3093 break;
3094
3095 case 118:
3096#line 1063 "../../lib/expr/exparse.y"
3097 {
3098 (yyval.expr) = 0;
3099 }
3100#line 3101 "exparse.c"
3101 break;
3102
3103 case 119:
3104#line 1067 "../../lib/expr/exparse.y"
3105 {
3106 (yyval.expr) = (yyvsp[0].expr)->data.operand.left;
3107 (yyvsp[0].expr)->data.operand.left = (yyvsp[0].expr)->data.operand.right = 0;
3108 exfreenode(expr.program, (yyvsp[0].expr));
3109 }
3110#line 3111 "exparse.c"
3111 break;
3112
3113 case 120:
3114#line 1075 "../../lib/expr/exparse.y"
3115 {
3116 (yyval.expr) = exnewnode(expr.program, ',', true, 0, exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL), NULL);
3117 (yyval.expr)->data.operand.right = (yyval.expr)->data.operand.left;
3118 }
3119#line 3120 "exparse.c"
3120 break;
3121
3122 case 121:
3123#line 1080 "../../lib/expr/exparse.y"
3124 {
3125 (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);
3126 }
3127#line 3128 "exparse.c"
3128 break;
3129
3130 case 122:
3131#line 1086 "../../lib/expr/exparse.y"
3132 {
3133 (yyval.expr) = 0;
3134 }
3135#line 3136 "exparse.c"
3136 break;
3137
3138 case 123:
3139#line 1090 "../../lib/expr/exparse.y"
3140 {
3141 (yyval.expr) = 0;
3142 if ((yyvsp[0].id)->type)
3143 exerror("(void) expected");
3144 }
3145#line 3146 "exparse.c"
3146 break;
3147
3148 case 125:
3149#line 1099 "../../lib/expr/exparse.y"
3150 {
3151 (yyval.expr) = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
3152 }
3153#line 3154 "exparse.c"
3154 break;
3155
3156 case 126:
3157#line 1103 "../../lib/expr/exparse.y"
3158 {
3159 Exnode_t* x;
3160 Exnode_t* y;
3161
3162 (yyval.expr) = (yyvsp[-2].expr);
3163 for (x = (yyvsp[-2].expr); (y = x->data.operand.right); x = y);
3164 x->data.operand.right = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
3165 }
3166#line 3167 "exparse.c"
3167 break;
3168
3169 case 127:
3170#line 1113 "../../lib/expr/exparse.y"
3171 {expr.declare=(yyvsp[0].id)->type;}
3172#line 3173 "exparse.c"
3173 break;
3174
3175 case 128:
3176#line 1114 "../../lib/expr/exparse.y"
3177 {
3178 if ((yyvsp[-2].id)->type == 0) {
3179 exerror("%s: parameters to functions cannot be void typed", (yyvsp[0].id)->name);
3180 }
3181 (yyval.expr) = exnewnode(expr.program, ID, false, (yyvsp[-2].id)->type, NULL, NULL);
3182 (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
3183 (yyvsp[0].id)->lex = DYNAMIC;
3184 (yyvsp[0].id)->type = (yyvsp[-2].id)->type;
3185 (yyvsp[0].id)->value = exnewnode(expr.program, 0, false, 0, NULL, NULL);
3186 expr.procedure->data.procedure.arity++;
3187 expr.declare = 0;
3188 }
3189#line 3190 "exparse.c"
3190 break;
3191
3192 case 129:
3193#line 1129 "../../lib/expr/exparse.y"
3194 {
3195 (yyval.reference) = expr.refs = 0;
3196 }
3197#line 3198 "exparse.c"
3198 break;
3199
3200 case 130:
3201#line 1133 "../../lib/expr/exparse.y"
3202 {
3203 Exref_t* r;
3204
3205 r = ALLOCATE(expr.program, Exref_t);
3206 *r = (Exref_t){0};
3207 r->symbol = (yyvsp[0].id);
3208 expr.refs = r;
3209 r->next = 0;
3210 r->index = 0;
3211 (yyval.reference) = expr.refs;
3212 }
3213#line 3214 "exparse.c"
3214 break;
3215
3216 case 131:
3217#line 1145 "../../lib/expr/exparse.y"
3218 {
3219 Exref_t* r;
3220 Exref_t* l;
3221
3222 r = ALLOCATE(expr.program, Exref_t);
3223 *r = (Exref_t){0};
3224 r->symbol = (yyvsp[0].id);
3225 r->index = 0;
3226 r->next = 0;
3227 l = ALLOCATE(expr.program, Exref_t);
3228 *l = (Exref_t){0};
3229 l->symbol = (yyvsp[-1].id);
3230 l->index = 0;
3231 l->next = r;
3232 expr.refs = l;
3233 (yyval.reference) = expr.refs;
3234 }
3235#line 3236 "exparse.c"
3236 break;
3237
3238 case 132:
3239#line 1165 "../../lib/expr/exparse.y"
3240 {
3241 (yyval.id) = (yyvsp[0].id);
3242 }
3243#line 3244 "exparse.c"
3244 break;
3245
3246 case 133:
3247#line 1169 "../../lib/expr/exparse.y"
3248 {
3249 (yyval.id) = (yyvsp[0].id);
3250 }
3251#line 3252 "exparse.c"
3252 break;
3253
3254 case 134:
3255#line 1174 "../../lib/expr/exparse.y"
3256 {
3257 (yyval.expr) = 0;
3258 }
3259#line 3260 "exparse.c"
3260 break;
3261
3262 case 135:
3263#line 1178 "../../lib/expr/exparse.y"
3264 {
3265 (yyval.expr) = exnewnode(expr.program, '=', true, (yyvsp[0].expr)->type, NULL, (yyvsp[0].expr));
3266 (yyval.expr)->subop = (yyvsp[-1].op);
3267 }
3268#line 3269 "exparse.c"
3269 break;
3270
3271 case 137:
3272#line 1185 "../../lib/expr/exparse.y"
3273 {
3274 if (expr.procedure)
3275 exerror("%s: nested function definitions not supported", expr.id->name);
3277 if (!streq(expr.id->name, "begin"))
3278 {
3279 static Dtdisc_t disc = {.key = offsetof(Exid_t, name)};
3280 if (!(expr.procedure->data.procedure.frame = dtopen(&disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
3281 exnospace();
3282 expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
3283 }
3284 expr.declare = 0;
3285 }
3286#line 3287 "exparse.c"
3287 break;
3288
3289 case 138:
3290#line 1197 "../../lib/expr/exparse.y"
3291 {
3292 expr.id->lex = PROCEDURE;
3294 expr.declare = 0;
3295 }
3296#line 3297 "exparse.c"
3297 break;
3298
3299 case 139:
3300#line 1202 "../../lib/expr/exparse.y"
3301 {
3302 (yyval.expr) = expr.procedure;
3304 if (expr.program->frame)
3305 {
3306 expr.program->symbols = expr.program->frame->view;
3307 dtview(expr.program->frame, NULL);
3308 expr.program->frame = NULL;
3309 }
3310 // dictionary of locals no longer required, now that we have parsed the body
3311 (void)dtclose((yyval.expr)->data.procedure.frame);
3312 (yyval.expr)->data.procedure.frame = NULL;
3313 (yyval.expr)->data.procedure.args = (yyvsp[-5].expr);
3314 (yyval.expr)->data.procedure.body = excast(expr.program, (yyvsp[-1].expr), (yyval.expr)->type, NULL, 0);
3315
3316 /*
3317 * NOTE: procedure definition was slipped into the
3318 * declaration initializer statement production,
3319 * therefore requiring the statement terminator
3320 */
3321
3322 exunlex(expr.program, ';');
3323 }
3324#line 3325 "exparse.c"
3325 break;
3326
3327
3328#line 3329 "exparse.c"
3329
3330 default: break;
3331 }
3332 /* User semantic actions sometimes alter yychar, and that requires
3333 that yytoken be updated with the new translation. We take the
3334 approach of translating immediately before every use of yytoken.
3335 One alternative is translating here after every semantic action,
3336 but that translation would be missed if the semantic action invokes
3337 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3338 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3339 incorrect destructor might then be invoked immediately. In the
3340 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3341 to an incorrect destructor call or verbose syntax error message
3342 before the lookahead is translated. */
3343 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3344
3345 YYPOPSTACK (yylen);
3346 yylen = 0;
3347 YY_STACK_PRINT (yyss, yyssp);
3348
3349 *++yyvsp = yyval;
3350
3351 /* Now 'shift' the result of the reduction. Determine what state
3352 that goes to, based on the state we popped back to and the rule
3353 number reduced by. */
3354 {
3355 const int yylhs = yyr1[yyn] - YYNTOKENS;
3356 const int yyi = yypgoto[yylhs] + *yyssp;
3357 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
3358 ? yytable[yyi]
3359 : yydefgoto[yylhs]);
3360 }
3361
3362 goto yynewstate;
3363
3364
3365/*--------------------------------------.
3366| yyerrlab -- here on detecting error. |
3367`--------------------------------------*/
3368yyerrlab:
3369 /* Make sure we have latest lookahead translation. See comments at
3370 user semantic actions for why this is necessary. */
3371 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3372
3373 /* If not already recovering from an error, report this error. */
3374 if (!yyerrstatus)
3375 {
3376 ++yynerrs;
3377#if ! YYERROR_VERBOSE
3378 yyerror (YY_("syntax error"));
3379#else
3380# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3381 yyssp, yytoken)
3382 {
3383 char const *yymsgp = YY_("syntax error");
3384 int yysyntax_error_status;
3385 yysyntax_error_status = YYSYNTAX_ERROR;
3386 if (yysyntax_error_status == 0)
3387 yymsgp = yymsg;
3388 else if (yysyntax_error_status == 1)
3389 {
3390 if (yymsg != yymsgbuf)
3391 YYSTACK_FREE (yymsg);
3392 yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
3393 if (!yymsg)
3394 {
3395 yymsg = yymsgbuf;
3396 yymsg_alloc = sizeof yymsgbuf;
3397 yysyntax_error_status = 2;
3398 }
3399 else
3400 {
3401 yysyntax_error_status = YYSYNTAX_ERROR;
3402 yymsgp = yymsg;
3403 }
3404 }
3405 yyerror (yymsgp);
3406 if (yysyntax_error_status == 2)
3407 goto yyexhaustedlab;
3408 }
3409# undef YYSYNTAX_ERROR
3410#endif
3411 }
3412
3413
3414
3415 if (yyerrstatus == 3)
3416 {
3417 /* If just tried and failed to reuse lookahead token after an
3418 error, discard it. */
3419
3420 if (yychar <= YYEOF)
3421 {
3422 /* Return failure if at end of input. */
3423 if (yychar == YYEOF)
3424 YYABORT;
3425 }
3426 else
3427 {
3428 yydestruct ("Error: discarding",
3429 yytoken, &yylval);
3430 yychar = YYEMPTY;
3431 }
3432 }
3433
3434 /* Else will try to reuse lookahead token after shifting the error
3435 token. */
3436 goto yyerrlab1;
3437
3438
3439/*---------------------------------------------------.
3440| yyerrorlab -- error raised explicitly by YYERROR. |
3441`---------------------------------------------------*/
3442yyerrorlab:
3443 /* Pacify compilers when the user code never invokes YYERROR and the
3444 label yyerrorlab therefore never appears in user code. */
3445 if (0)
3446 YYERROR;
3447
3448 /* Do not reclaim the symbols of the rule whose action triggered
3449 this YYERROR. */
3450 YYPOPSTACK (yylen);
3451 yylen = 0;
3452 YY_STACK_PRINT (yyss, yyssp);
3453 yystate = *yyssp;
3454 goto yyerrlab1;
3455
3456
3457/*-------------------------------------------------------------.
3458| yyerrlab1 -- common code for both syntax error and YYERROR. |
3459`-------------------------------------------------------------*/
3460yyerrlab1:
3461 yyerrstatus = 3; /* Each real token shifted decrements this. */
3462
3463 for (;;)
3464 {
3465 yyn = yypact[yystate];
3466 if (!yypact_value_is_default (yyn))
3467 {
3468 yyn += YYTERROR;
3469 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3470 {
3471 yyn = yytable[yyn];
3472 if (0 < yyn)
3473 break;
3474 }
3475 }
3476
3477 /* Pop the current state because it cannot handle the error token. */
3478 if (yyssp == yyss)
3479 YYABORT;
3480
3481
3482 yydestruct ("Error: popping",
3483 yystos[yystate], yyvsp);
3484 YYPOPSTACK (1);
3485 yystate = *yyssp;
3486 YY_STACK_PRINT (yyss, yyssp);
3487 }
3488
3490 *++yyvsp = yylval;
3492
3493
3494 /* Shift the error token. */
3495 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3496
3497 yystate = yyn;
3498 goto yynewstate;
3499
3500
3501/*-------------------------------------.
3502| yyacceptlab -- YYACCEPT comes here. |
3503`-------------------------------------*/
3504yyacceptlab:
3505 yyresult = 0;
3506 goto yyreturn;
3507
3508
3509/*-----------------------------------.
3510| yyabortlab -- YYABORT comes here. |
3511`-----------------------------------*/
3512yyabortlab:
3513 yyresult = 1;
3514 goto yyreturn;
3515
3516
3517#if !defined yyoverflow || YYERROR_VERBOSE
3518/*-------------------------------------------------.
3519| yyexhaustedlab -- memory exhaustion comes here. |
3520`-------------------------------------------------*/
3521yyexhaustedlab:
3522 yyerror (YY_("memory exhausted"));
3523 yyresult = 2;
3524 /* Fall through. */
3525#endif
3526
3527
3528/*-----------------------------------------------------.
3529| yyreturn -- parsing is finished, return the result. |
3530`-----------------------------------------------------*/
3531yyreturn:
3532 if (yychar != YYEMPTY)
3533 {
3534 /* Make sure we have latest lookahead translation. See comments at
3535 user semantic actions for why this is necessary. */
3536 yytoken = YYTRANSLATE (yychar);
3537 yydestruct ("Cleanup: discarding lookahead",
3538 yytoken, &yylval);
3539 }
3540 /* Do not reclaim the symbols of the rule whose action triggered
3541 this YYABORT or YYACCEPT. */
3542 YYPOPSTACK (yylen);
3543 YY_STACK_PRINT (yyss, yyssp);
3544 while (yyssp != yyss)
3545 {
3546 yydestruct ("Cleanup: popping",
3547 yystos[+*yyssp], yyvsp);
3548 YYPOPSTACK (1);
3549 }
3550#ifndef yyoverflow
3551 if (yyss != yyssa)
3552 YYSTACK_FREE (yyss);
3553#endif
3554#if YYERROR_VERBOSE
3555 if (yymsg != yymsgbuf)
3556 YYSTACK_FREE (yymsg);
3557#endif
3558 return yyresult;
3559}
3560#line 1227 "../../lib/expr/exparse.y"
3561
3562
3563const char *exop(size_t index) {
3564
3565 /* yytname is generated by the %token-table directive */
3566
3567 /* find the index of MINTOKEN */
3568 size_t minid;
3569 for (minid = 0; yytname[minid] != NULL; ++minid) {
3570 if (strcmp(yytname[minid], "MINTOKEN") == 0) {
3571 break;
3572 }
3573 }
3574
3575 assert(yytname[minid] != NULL
3576 && "failed to find MINTOKEN; incorrect token list in exparse.y?");
3577
3578 /* find the requested token */
3579 {
3580 size_t i, j;
3581 for (i = j = minid; yytname[i] != NULL; ++i) {
3582
3583 /* if this token is not a word, skip it */
3584 {
3585 size_t k;
3586 for (k = 0; yytname[i][k] != '\0'; ++k) {
3587 if (yytname[i][k] != '_' && !gv_isalnum(yytname[i][k])) {
3588 break;
3589 }
3590 }
3591 if (yytname[i][k] != '\0') {
3592 continue;
3593 }
3594 }
3595
3596 if (j == index + minid) {
3597 return yytname[i];
3598 }
3599 ++j;
3600 }
3601 }
3602
3603 /* failed to find the requested token */
3604 return NULL;
3605}
3606
3607void ex_error(const char *message) {
3608 exerror("%s", message);
3609}
3610
3611#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 int dtclose(Dt_t *)
Definition dtclose.c:8
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:1830
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:125
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:3563
#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:3607
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:204
static Dtdisc_t disc
Definition exparse.y:207
expr procedure type
Definition exparse.y:206
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:101
long op
operator
Definition expr.h:150
long type
value type
Definition expr.h:149
Exdata_t data
Definition expr.h:158
Dt_t * symbols
Definition expr.h:200
Vmalloc_t * vm
Definition expr.h:202
Exid_t * symbol
Definition expr.h:107
Exref_t * next
Definition expr.h:106
Exnode_t * index
Definition expr.h:108
int assigned
Definition exlib.h:159
Expr_t * program
Definition exlib.h:156
Switch_t * swstate
Definition exlib.h:160
Exid_t * id
Definition exlib.h:152
Exref_t * refs
Definition exlib.h:158
long declare
current declaration type
Definition exlib.h:153
int nolabel
Definition exlib.h:154
Exnode_t * procedure
Definition exlib.h:157
size_t cap
Definition exlib.h:137
int def
Definition exlib.h:138
Exnode_t * defcase
Definition exlib.h:134
struct Switch_s * prev
Definition exlib.h:131
long type
switch test type
Definition exlib.h:139
Exnode_t * lastcase
Definition exlib.h:133
size_t cur
Definition exlib.h:136
Extype_t ** base
Definition exlib.h:135
Exnode_t * firstcase
Definition exlib.h:132
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:122
Exnode_t * right
Definition expr.h:123
Exid_t * reference
Definition expr.h:117
Exnode_t * next
Definition expr.h:129
Exid_t * symbol
Definition expr.h:135
struct Exdata_u::@85 operand
struct Exdata_u::@86 select
Exnode_t * dyna
Definition expr.h:138
Exnode_t * index
Definition expr.h:137
char * vmstrdup(Vmalloc_t *, const char *)
Definition vmstrdup.c:19