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