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