1 /* A Bison parser, made from ifgram.y, by GNU bison 1.75. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
45 /* If NAME_PREFIX is specified substitute the variables and functions
47 #define yyparse ifparse
49 #define yyerror iferror
52 #define yydebug ifdebug
53 #define yynerrs ifnerrs
59 /* Put the tokens into the symbol table, so that GDB and other debuggers
64 ICT_BITCOMPLEMENT = 260,
94 #define ICT_BITAND 259
95 #define ICT_BITCOMPLEMENT 260
97 #define ICT_BITXOR 262
99 #define ICT_DIVIDE 264
101 #define ICT_ERROR 266
103 #define ICT_FALSE 268
106 #define ICT_LPAREN 271
109 #define ICT_MINUS 274
116 #define ICT_QUESTION 281
117 #define ICT_RPAREN 282
118 #define ICT_SHLEFT 283
119 #define ICT_SHRIGHT 284
121 #define ICT_VALUE 286
126 /* Copy the first part of user declarations. */
129 /* Copyright 2005 by Arkkra Enterprises */
130 /* All rights reserved. */
132 /* This is a "mini-parser" that handles "if" clauses.
133 * It uses a buffer containing a compressed form of the user's input.
134 * The compressed format is described in lex.c above add_ifclause().
135 * This tries to follow the ANSI C preprocessor rules as much as is reasonable.
136 * It uses C operator precedences and associativity.
137 * We do use 32-bit ints rather than longs to try to avoid any
138 * incompatibilities if someone creates a Mup file on a 32-bit machine
139 * and then tries to run it on 64-bit or vice-versa.
149 /* Enabling traces. */
154 /* Enabling verbose error messages. */
155 #ifdef YYERROR_VERBOSE
156 # undef YYERROR_VERBOSE
157 # define YYERROR_VERBOSE 1
159 # define YYERROR_VERBOSE 0
164 # define YYSTYPE yystype
165 # define YYSTYPE_IS_TRIVIAL 1
169 typedef struct yyltype
176 # define YYLTYPE yyltype
177 # define YYLTYPE_IS_TRIVIAL 1
180 /* Copy the second part of user declarations. */
183 /* Line 213 of /usr/share/bison/yacc.c. */
184 #line 185 "ifgram.tab.c"
186 #if ! defined (yyoverflow) || YYERROR_VERBOSE
188 /* The parser invokes alloca or malloc; define the necessary symbols. */
190 # if YYSTACK_USE_ALLOCA
191 # define YYSTACK_ALLOC alloca
193 # ifndef YYSTACK_USE_ALLOCA
194 # if defined (alloca) || defined (_ALLOCA_H)
195 # define YYSTACK_ALLOC alloca
198 # define YYSTACK_ALLOC __builtin_alloca
204 # ifdef YYSTACK_ALLOC
205 /* Pacify GCC's `empty if-body' warning. */
206 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
208 # if defined (__STDC__) || defined (__cplusplus)
209 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
210 # define YYSIZE_T size_t
212 # define YYSTACK_ALLOC malloc
213 # define YYSTACK_FREE free
215 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
218 #if (! defined (yyoverflow) \
219 && (! defined (__cplusplus) \
220 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
222 /* A type that is properly aligned for any stack member. */
229 /* The size of the maximum gap between one aligned stack and the next. */
230 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
232 /* The size of an array large to enough to hold all stacks, each with
234 # define YYSTACK_BYTES(N) \
235 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
238 /* Copy COUNT objects from FROM to TO. The source and destination do
242 # define YYCOPY(To, From, Count) \
243 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
245 # define YYCOPY(To, From, Count) \
248 register YYSIZE_T yyi; \
249 for (yyi = 0; yyi < (Count); yyi++) \
250 (To)[yyi] = (From)[yyi]; \
256 /* Relocate STACK from its old location to the new one. The
257 local variables YYSIZE and YYSTACKSIZE give the old and new number of
258 elements in the stack, and YYPTR gives the new location of the
259 stack. Advance YYPTR to a properly aligned location for the next
261 # define YYSTACK_RELOCATE(Stack) \
264 YYSIZE_T yynewbytes; \
265 YYCOPY (&yyptr->Stack, Stack, yysize); \
266 Stack = &yyptr->Stack; \
267 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
268 yyptr += yynewbytes / sizeof (*yyptr); \
274 #if defined (__STDC__) || defined (__cplusplus)
275 typedef signed char yysigned_char;
277 typedef short yysigned_char;
280 /* YYFINAL -- State number of the termination state. */
284 /* YYNTOKENS -- Number of terminals. */
286 /* YYNNTS -- Number of nonterminals. */
288 /* YYNRULES -- Number of rules. */
290 /* YYNRULES -- Number of states. */
293 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
295 #define YYMAXUTOK 286
297 #define YYTRANSLATE(X) \
298 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
300 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
301 static const unsigned char yytranslate[] =
303 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
304 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
305 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
306 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
307 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
308 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
309 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
310 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
311 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
312 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
313 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
314 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
315 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
316 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
317 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
318 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
319 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
320 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
321 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
322 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
323 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
324 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
325 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
329 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
330 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
331 25, 26, 27, 28, 29, 30, 31
335 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
337 static const unsigned char yyprhs[] =
339 0, 0, 3, 6, 8, 10, 14, 17, 20, 23,
340 26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
341 66, 70, 74, 78, 82, 86, 90, 94, 98, 104,
345 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
346 static const yysigned_char yyrhs[] =
348 33, 0, -1, 34, 10, -1, 11, -1, 1, -1,
349 16, 34, 27, -1, 23, 34, -1, 5, 34, -1,
350 19, 34, -1, 25, 34, -1, 34, 21, 34, -1,
351 34, 9, 34, -1, 34, 20, 34, -1, 34, 25,
352 34, -1, 34, 19, 34, -1, 34, 28, 34, -1,
353 34, 29, 34, -1, 34, 18, 34, -1, 34, 17,
354 34, -1, 34, 14, 34, -1, 34, 15, 34, -1,
355 34, 12, 34, -1, 34, 22, 34, -1, 34, 4,
356 34, -1, 34, 7, 34, -1, 34, 6, 34, -1,
357 34, 24, 34, -1, 34, 3, 34, -1, 34, 26,
358 34, 8, 34, -1, 31, -1, 35, -1, 30, -1,
362 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
363 static const unsigned short yyrline[] =
365 0, 68, 68, 73, 79, 87, 92, 98, 104, 111,
366 118, 124, 138, 150, 156, 162, 168, 174, 180, 186,
367 192, 198, 204, 210, 216, 222, 228, 234, 240, 246,
372 #if YYDEBUG || YYERROR_VERBOSE
373 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
374 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
375 static const char *const yytname[] =
377 "$end", "error", "$undefined", "ICT_AND", "ICT_BITAND",
378 "ICT_BITCOMPLEMENT", "ICT_BITOR", "ICT_BITXOR", "ICT_COLON",
379 "ICT_DIVIDE", "ICT_END", "ICT_ERROR", "ICT_EQ", "ICT_FALSE", "ICT_GT",
380 "ICT_GE", "ICT_LPAREN", "ICT_LE", "ICT_LT", "ICT_MINUS", "ICT_MOD",
381 "ICT_MULT", "ICT_NE", "ICT_NOT", "ICT_OR", "ICT_PLUS", "ICT_QUESTION",
382 "ICT_RPAREN", "ICT_SHLEFT", "ICT_SHRIGHT", "ICT_TRUE", "ICT_VALUE",
383 "$accept", "ifclause", "expr", "boolval", 0
388 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
390 static const unsigned short yytoknum[] =
392 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
393 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
394 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
399 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
400 static const unsigned char yyr1[] =
402 0, 32, 33, 33, 33, 34, 34, 34, 34, 34,
403 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
404 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
408 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
409 static const unsigned char yyr2[] =
411 0, 2, 2, 1, 1, 3, 2, 2, 2, 2,
412 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
413 3, 3, 3, 3, 3, 3, 3, 3, 5, 1,
417 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
418 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
419 means the default is an error. */
420 static const unsigned char yydefact[] =
422 0, 4, 0, 3, 32, 0, 0, 0, 0, 31,
423 29, 0, 0, 30, 7, 0, 8, 6, 9, 1,
424 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
426 5, 27, 23, 25, 24, 11, 21, 19, 20, 18,
427 17, 14, 12, 10, 22, 26, 13, 0, 15, 16,
431 /* YYDEFGOTO[NTERM-NUM]. */
432 static const yysigned_char yydefgoto[] =
437 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
439 #define YYPACT_NINF -9
440 static const short yypact[] =
442 37, -9, 185, -9, -9, 185, 185, 185, 185, -9,
443 -9, 2, 66, -9, -9, 93, -9, -9, -9, -9,
444 185, 185, 185, 185, 185, -9, 185, 185, 185, 185,
445 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
446 -9, 205, 268, 228, 250, -9, 285, 298, 298, 298,
447 298, 31, -9, -9, 285, 174, 31, 120, -8, -8,
451 /* YYPGOTO[NTERM-NUM]. */
452 static const yysigned_char yypgoto[] =
457 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
458 positive, shift that token. If negative, reduce the rule which
459 number is the opposite. If zero, do what YYDEFACT says.
460 If YYTABLE_NINF, parse error. */
461 #define YYTABLE_NINF -1
462 static const unsigned char yytable[] =
464 14, 24, 19, 15, 16, 17, 18, 0, 0, 0,
465 0, 31, 32, 33, 0, 0, 0, 36, 41, 42,
466 43, 44, 45, 0, 46, 47, 48, 49, 50, 51,
467 52, 53, 54, 55, 56, 57, 58, 59, 1, 0,
468 24, 0, 2, 0, 0, 0, 0, 0, 3, 0,
469 4, 32, 33, 5, 0, 0, 6, 0, 61, 0,
470 7, 0, 8, 0, 0, 0, 0, 9, 10, 20,
471 21, 0, 22, 23, 0, 24, 25, 0, 26, 0,
472 27, 28, 0, 29, 30, 31, 32, 33, 34, 0,
473 35, 36, 37, 0, 38, 39, 20, 21, 0, 22,
474 23, 0, 24, 0, 0, 26, 0, 27, 28, 0,
475 29, 30, 31, 32, 33, 34, 0, 35, 36, 37,
476 40, 38, 39, 20, 21, 0, 22, 23, 60, 24,
477 0, 0, 26, 0, 27, 28, 0, 29, 30, 31,
478 32, 33, 34, 0, 35, 36, 37, 0, 38, 39,
479 20, 21, 0, 22, 23, 0, 24, 0, 0, 26,
480 0, 27, 28, 0, 29, 30, 31, 32, 33, 34,
481 0, 35, 36, 37, 0, 38, 39, 20, 21, 0,
482 22, 23, 0, 24, 0, 0, 26, 0, 27, 28,
483 2, 29, 30, 31, 32, 33, 34, 0, 4, 36,
484 0, 5, 38, 39, 6, 0, 0, 0, 7, 21,
485 8, 22, 23, 0, 24, 9, 10, 26, 0, 27,
486 28, 0, 29, 30, 31, 32, 33, 34, 0, 0,
487 36, 0, 21, 38, 39, 23, 0, 24, 0, 0,
488 26, 0, 27, 28, 0, 29, 30, 31, 32, 33,
489 34, 0, 0, 36, 21, 0, 38, 39, 0, 24,
490 0, 0, 26, 0, 27, 28, 0, 29, 30, 31,
491 32, 33, 34, 0, 0, 36, 0, 24, 38, 39,
492 26, 0, 27, 28, 0, 29, 30, 31, 32, 33,
493 34, 0, 0, 36, 24, 0, 38, 39, 0, 27,
494 28, 0, 29, 30, 31, 32, 33, 24, 0, 0,
495 36, 0, 0, 38, 39, 0, 0, 31, 32, 33,
496 0, 0, 0, 36, 0, 0, 38, 39
499 static const yysigned_char yycheck[] =
501 2, 9, 0, 5, 6, 7, 8, -1, -1, -1,
502 -1, 19, 20, 21, -1, -1, -1, 25, 20, 21,
503 22, 23, 24, -1, 26, 27, 28, 29, 30, 31,
504 32, 33, 34, 35, 36, 37, 38, 39, 1, -1,
505 9, -1, 5, -1, -1, -1, -1, -1, 11, -1,
506 13, 20, 21, 16, -1, -1, 19, -1, 60, -1,
507 23, -1, 25, -1, -1, -1, -1, 30, 31, 3,
508 4, -1, 6, 7, -1, 9, 10, -1, 12, -1,
509 14, 15, -1, 17, 18, 19, 20, 21, 22, -1,
510 24, 25, 26, -1, 28, 29, 3, 4, -1, 6,
511 7, -1, 9, -1, -1, 12, -1, 14, 15, -1,
512 17, 18, 19, 20, 21, 22, -1, 24, 25, 26,
513 27, 28, 29, 3, 4, -1, 6, 7, 8, 9,
514 -1, -1, 12, -1, 14, 15, -1, 17, 18, 19,
515 20, 21, 22, -1, 24, 25, 26, -1, 28, 29,
516 3, 4, -1, 6, 7, -1, 9, -1, -1, 12,
517 -1, 14, 15, -1, 17, 18, 19, 20, 21, 22,
518 -1, 24, 25, 26, -1, 28, 29, 3, 4, -1,
519 6, 7, -1, 9, -1, -1, 12, -1, 14, 15,
520 5, 17, 18, 19, 20, 21, 22, -1, 13, 25,
521 -1, 16, 28, 29, 19, -1, -1, -1, 23, 4,
522 25, 6, 7, -1, 9, 30, 31, 12, -1, 14,
523 15, -1, 17, 18, 19, 20, 21, 22, -1, -1,
524 25, -1, 4, 28, 29, 7, -1, 9, -1, -1,
525 12, -1, 14, 15, -1, 17, 18, 19, 20, 21,
526 22, -1, -1, 25, 4, -1, 28, 29, -1, 9,
527 -1, -1, 12, -1, 14, 15, -1, 17, 18, 19,
528 20, 21, 22, -1, -1, 25, -1, 9, 28, 29,
529 12, -1, 14, 15, -1, 17, 18, 19, 20, 21,
530 22, -1, -1, 25, 9, -1, 28, 29, -1, 14,
531 15, -1, 17, 18, 19, 20, 21, 9, -1, -1,
532 25, -1, -1, 28, 29, -1, -1, 19, 20, 21,
533 -1, -1, -1, 25, -1, -1, 28, 29
536 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
537 symbol of state STATE-NUM. */
538 static const unsigned char yystos[] =
540 0, 1, 5, 11, 13, 16, 19, 23, 25, 30,
541 31, 33, 34, 35, 34, 34, 34, 34, 34, 0,
542 3, 4, 6, 7, 9, 10, 12, 14, 15, 17,
543 18, 19, 20, 21, 22, 24, 25, 26, 28, 29,
544 27, 34, 34, 34, 34, 34, 34, 34, 34, 34,
545 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
549 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
550 # define YYSIZE_T __SIZE_TYPE__
552 #if ! defined (YYSIZE_T) && defined (size_t)
553 # define YYSIZE_T size_t
555 #if ! defined (YYSIZE_T)
556 # if defined (__STDC__) || defined (__cplusplus)
557 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
558 # define YYSIZE_T size_t
561 #if ! defined (YYSIZE_T)
562 # define YYSIZE_T unsigned int
565 #define yyerrok (yyerrstatus = 0)
566 #define yyclearin (yychar = YYEMPTY)
570 #define YYACCEPT goto yyacceptlab
571 #define YYABORT goto yyabortlab
572 #define YYERROR goto yyerrlab1
574 /* Like YYERROR except do call yyerror. This remains here temporarily
575 to ease the transition to the new meaning of YYERROR, for GCC.
576 Once GCC version 2 has supplanted version 1, this can go. */
578 #define YYFAIL goto yyerrlab
580 #define YYRECOVERING() (!!yyerrstatus)
582 #define YYBACKUP(Token, Value) \
584 if (yychar == YYEMPTY && yylen == 1) \
588 yychar1 = YYTRANSLATE (yychar); \
594 yyerror ("syntax error: cannot back up"); \
600 #define YYERRCODE 256
602 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
605 #ifndef YYLLOC_DEFAULT
606 # define YYLLOC_DEFAULT(Current, Rhs, N) \
607 Current.first_line = Rhs[1].first_line; \
608 Current.first_column = Rhs[1].first_column; \
609 Current.last_line = Rhs[N].last_line; \
610 Current.last_column = Rhs[N].last_column;
613 /* YYLEX -- calling `yylex' with the right arguments. */
615 #define YYLEX yylex ()
617 /* Enable debugging if requested. */
621 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
622 # define YYFPRINTF fprintf
625 # define YYDPRINTF(Args) \
630 # define YYDSYMPRINT(Args) \
635 /* Nonzero means print parse trace. It is left uninitialized so that
636 multiple parsers can coexist. */
639 # define YYDPRINTF(Args)
640 # define YYDSYMPRINT(Args)
641 #endif /* !YYDEBUG */
643 /* YYINITDEPTH -- initial size of the parser's stacks. */
645 # define YYINITDEPTH 200
648 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
649 if the built-in stack extension method is used).
651 Do not make this value too large; the results are undefined if
652 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
653 evaluated with infinite-precision integer arithmetic. */
660 # define YYMAXDEPTH 10000
668 # if defined (__GLIBC__) && defined (_STRING_H)
669 # define yystrlen strlen
671 /* Return the length of YYSTR. */
673 # if defined (__STDC__) || defined (__cplusplus)
674 yystrlen (const char *yystr)
680 register const char *yys = yystr;
682 while (*yys++ != '\0')
685 return yys - yystr - 1;
691 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
692 # define yystpcpy stpcpy
694 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
697 # if defined (__STDC__) || defined (__cplusplus)
698 yystpcpy (char *yydest, const char *yysrc)
700 yystpcpy (yydest, yysrc)
705 register char *yyd = yydest;
706 register const char *yys = yysrc;
708 while ((*yyd++ = *yys++) != '\0')
716 #endif /* !YYERROR_VERBOSE */
721 /*-----------------------------.
722 | Print this symbol on YYOUT. |
723 `-----------------------------*/
726 #if defined (__STDC__) || defined (__cplusplus)
727 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
729 yysymprint (yyout, yytype, yyvalue)
735 /* Pacify ``unused variable'' warnings. */
738 if (yytype < YYNTOKENS)
740 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
742 YYPRINT (yyout, yytoknum[yytype], yyvalue);
746 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
753 YYFPRINTF (yyout, ")");
755 #endif /* YYDEBUG. */
758 /*-----------------------------------------------.
759 | Release the memory associated to this symbol. |
760 `-----------------------------------------------*/
763 #if defined (__STDC__) || defined (__cplusplus)
764 yydestruct (int yytype, YYSTYPE yyvalue)
766 yydestruct (yytype, yyvalue)
771 /* Pacify ``unused variable'' warnings. */
783 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
784 into yyparse. The argument should have type void *.
785 It should actually point to an object.
786 Grammar actions can access the variable by casting it
787 to the proper pointer type. */
790 # if defined (__STDC__) || defined (__cplusplus)
791 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
792 # define YYPARSE_PARAM_DECL
794 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
795 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
797 #else /* !YYPARSE_PARAM */
798 # define YYPARSE_PARAM_ARG
799 # define YYPARSE_PARAM_DECL
800 #endif /* !YYPARSE_PARAM */
802 /* Prevent warning if -Wstrict-prototypes. */
804 # ifdef YYPARSE_PARAM
805 int yyparse (void *);
812 /* The lookahead symbol. */
815 /* The semantic value of the lookahead symbol. */
818 /* Number of parse errors so far. */
823 yyparse (YYPARSE_PARAM_ARG)
827 register int yystate;
830 /* Number of tokens to shift before error messages enabled. */
832 /* Lookahead token as an internal (translated) token number. */
835 /* Three stacks and their tools:
836 `yyss': related to states,
837 `yyvs': related to semantic values,
838 `yyls': related to locations.
840 Refer to the stacks thru separate pointers, to allow yyoverflow
841 to reallocate them elsewhere. */
843 /* The state stack. */
844 short yyssa[YYINITDEPTH];
846 register short *yyssp;
848 /* The semantic value stack. */
849 YYSTYPE yyvsa[YYINITDEPTH];
850 YYSTYPE *yyvs = yyvsa;
851 register YYSTYPE *yyvsp;
855 #define YYPOPSTACK (yyvsp--, yyssp--)
857 YYSIZE_T yystacksize = YYINITDEPTH;
859 /* The variables used to return semantic value and location from the
864 /* When reducing, the number of symbols on the RHS of the reduced
868 YYDPRINTF ((stderr, "Starting parse\n"));
873 yychar = YYEMPTY; /* Cause a token to be read. */
875 /* Initialize stack pointers.
876 Waste one element of value and location stack
877 so that they stay on the same level as the state stack.
878 The wasted elements are never initialized. */
885 /*------------------------------------------------------------.
886 | yynewstate -- Push a new state, which is found in yystate. |
887 `------------------------------------------------------------*/
889 /* In all cases, when you get here, the value and location stacks
890 have just been pushed. so pushing a state here evens the stacks.
897 if (yyssp >= yyss + yystacksize - 1)
899 /* Get the current used size of the three stacks, in elements. */
900 YYSIZE_T yysize = yyssp - yyss + 1;
904 /* Give user a chance to reallocate the stack. Use copies of
905 these so that the &'s don't force the real ones into
907 YYSTYPE *yyvs1 = yyvs;
911 /* Each stack pointer address is followed by the size of the
912 data in use in that stack, in bytes. This used to be a
913 conditional around just the two extra args, but that might
914 be undefined if yyoverflow is a macro. */
915 yyoverflow ("parser stack overflow",
916 &yyss1, yysize * sizeof (*yyssp),
917 &yyvs1, yysize * sizeof (*yyvsp),
924 #else /* no yyoverflow */
925 # ifndef YYSTACK_RELOCATE
928 /* Extend the stack our own way. */
929 if (yystacksize >= YYMAXDEPTH)
932 if (yystacksize > YYMAXDEPTH)
933 yystacksize = YYMAXDEPTH;
937 union yyalloc *yyptr =
938 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
941 YYSTACK_RELOCATE (yyss);
942 YYSTACK_RELOCATE (yyvs);
944 # undef YYSTACK_RELOCATE
946 YYSTACK_FREE (yyss1);
949 #endif /* no yyoverflow */
951 yyssp = yyss + yysize - 1;
952 yyvsp = yyvs + yysize - 1;
955 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
956 (unsigned long int) yystacksize));
958 if (yyssp >= yyss + yystacksize - 1)
962 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
971 /* Do appropriate processing given the current state. */
972 /* Read a lookahead token if we need one and don't already have one. */
975 /* First try to decide what to do without reference to lookahead token. */
977 yyn = yypact[yystate];
978 if (yyn == YYPACT_NINF)
981 /* Not known => get a lookahead token if don't already have one. */
983 /* yychar is either YYEMPTY or YYEOF
984 or a valid token in external form. */
986 if (yychar == YYEMPTY)
988 YYDPRINTF ((stderr, "Reading a token: "));
992 /* Convert token to internal form (in yychar1) for indexing tables with. */
994 if (yychar <= 0) /* This means end of input. */
997 yychar = YYEOF; /* Don't call YYLEX any more. */
999 YYDPRINTF ((stderr, "Now at end of input.\n"));
1003 yychar1 = YYTRANSLATE (yychar);
1005 /* We have to keep this `#if YYDEBUG', since we use variables
1006 which are defined only if `YYDEBUG' is set. */
1007 YYDPRINTF ((stderr, "Next token is "));
1008 YYDSYMPRINT ((stderr, yychar1, yylval));
1009 YYDPRINTF ((stderr, "\n"));
1012 /* If the proper action on seeing token YYCHAR1 is to reduce or to
1013 detect an error, take that action. */
1015 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
1020 if (yyn == 0 || yyn == YYTABLE_NINF)
1029 /* Shift the lookahead token. */
1030 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1031 yychar, yytname[yychar1]));
1033 /* Discard the token being shifted unless it is eof. */
1034 if (yychar != YYEOF)
1040 /* Count tokens shifted since error; after three, turn off error
1049 /*-----------------------------------------------------------.
1050 | yydefault -- do the default action for the current state. |
1051 `-----------------------------------------------------------*/
1053 yyn = yydefact[yystate];
1059 /*-----------------------------.
1060 | yyreduce -- Do a reduction. |
1061 `-----------------------------*/
1063 /* yyn is the number of a rule to reduce with. */
1066 /* If YYLEN is nonzero, implement the default value of the action:
1069 Otherwise, the following line sets YYVAL to garbage.
1070 This behavior is undocumented and Bison
1071 users should not rely upon it. Assigning to YYVAL
1072 unconditionally makes the parser a bit smaller, and it avoids a
1073 GCC warning that YYVAL may be used uninitialized. */
1074 yyval = yyvsp[1-yylen];
1079 /* We have to keep this `#if YYDEBUG', since we use variables which
1080 are defined only if `YYDEBUG' is set. */
1085 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1086 yyn - 1, yyrline[yyn]);
1088 /* Print the symbols being reduced, and their result. */
1089 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
1090 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1091 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1099 return(yyvsp[-1] ? YES : NO);
1106 pfatal("if clause parser received unknown token type");
1113 l_yyerror(Curr_filename, yylineno, "syntax error in 'if' condition");
1128 yyval = !(yyvsp[0]);
1133 #line 100 "ifgram.y"
1135 yyval = ~(yyvsp[0]);
1140 #line 106 "ifgram.y"
1143 yyval = -(yyvsp[0]);
1148 #line 113 "ifgram.y"
1150 /* unary plus. Not very useful, but ANSI C supports it... */
1156 #line 120 "ifgram.y"
1158 yyval = yyvsp[-2] * yyvsp[0];
1163 #line 126 "ifgram.y"
1165 if (yyvsp[0] == 0) {
1166 yyerror("attempt to divide by 0");
1167 /* gcc appears to return the numerator in this case,
1168 * so we do the same */
1172 yyval = yyvsp[-2] / yyvsp[0];
1178 #line 140 "ifgram.y"
1180 if (yyvsp[0] == 0) {
1181 yyerror("attempt to modulo by 0");
1185 yyval = yyvsp[-2] % yyvsp[0];
1191 #line 152 "ifgram.y"
1193 yyval = yyvsp[-2] + yyvsp[0];
1198 #line 158 "ifgram.y"
1200 yyval = yyvsp[-2] - yyvsp[0];
1205 #line 164 "ifgram.y"
1207 yyval = yyvsp[-2] << yyvsp[0];
1212 #line 170 "ifgram.y"
1214 yyval = yyvsp[-2] >> yyvsp[0];
1219 #line 176 "ifgram.y"
1221 yyval = (yyvsp[-2] < yyvsp[0]);
1226 #line 182 "ifgram.y"
1228 yyval = (yyvsp[-2] <= yyvsp[0]);
1233 #line 188 "ifgram.y"
1235 yyval = (yyvsp[-2] > yyvsp[0]);
1240 #line 194 "ifgram.y"
1242 yyval = (yyvsp[-2] >= yyvsp[0]);
1247 #line 200 "ifgram.y"
1249 yyval = (yyvsp[-2] == yyvsp[0]);
1254 #line 206 "ifgram.y"
1256 yyval = (yyvsp[-2] != yyvsp[0]);
1261 #line 212 "ifgram.y"
1263 yyval = yyvsp[-2] & yyvsp[0];
1268 #line 218 "ifgram.y"
1270 yyval = yyvsp[-2] ^ yyvsp[0];
1275 #line 224 "ifgram.y"
1277 yyval = yyvsp[-2] | yyvsp[0];
1282 #line 230 "ifgram.y"
1284 yyval = yyvsp[-2] || yyvsp[0];
1289 #line 236 "ifgram.y"
1291 yyval = yyvsp[-2] && yyvsp[0];
1296 #line 242 "ifgram.y"
1298 yyval = ( yyvsp[-4] ? yyvsp[-2] : yyvsp[0] );
1303 #line 248 "ifgram.y"
1310 #line 254 "ifgram.y"
1317 #line 260 "ifgram.y"
1324 #line 266 "ifgram.y"
1333 /* Line 1016 of /usr/share/bison/yacc.c. */
1334 #line 1335 "ifgram.tab.c"
1343 short *yyssp1 = yyss - 1;
1344 YYFPRINTF (stderr, "state stack now");
1345 while (yyssp1 != yyssp)
1346 YYFPRINTF (stderr, " %d", *++yyssp1);
1347 YYFPRINTF (stderr, "\n");
1354 /* Now `shift' the result of the reduction. Determine what state
1355 that goes to, based on the state we popped back to and the rule
1356 number reduced by. */
1360 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1361 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1362 yystate = yytable[yystate];
1364 yystate = yydefgoto[yyn - YYNTOKENS];
1369 /*------------------------------------.
1370 | yyerrlab -- here on detecting error |
1371 `------------------------------------*/
1373 /* If not already recovering from an error, report this error. */
1378 yyn = yypact[yystate];
1380 if (YYPACT_NINF < yyn && yyn < YYLAST)
1382 YYSIZE_T yysize = 0;
1383 int yytype = YYTRANSLATE (yychar);
1388 /* Start YYX at -YYN if negative to avoid negative indexes in
1390 for (yyx = yyn < 0 ? -yyn : 0;
1391 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1392 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1393 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1394 yysize += yystrlen ("parse error, unexpected ") + 1;
1395 yysize += yystrlen (yytname[yytype]);
1396 yymsg = (char *) YYSTACK_ALLOC (yysize);
1399 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1400 yyp = yystpcpy (yyp, yytname[yytype]);
1405 for (yyx = yyn < 0 ? -yyn : 0;
1406 yyx < (int) (sizeof (yytname) / sizeof (char *));
1408 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1410 const char *yyq = ! yycount ? ", expecting " : " or ";
1411 yyp = yystpcpy (yyp, yyq);
1412 yyp = yystpcpy (yyp, yytname[yyx]);
1417 YYSTACK_FREE (yymsg);
1420 yyerror ("parse error; also virtual memory exhausted");
1423 #endif /* YYERROR_VERBOSE */
1424 yyerror ("parse error");
1429 /*----------------------------------------------------.
1430 | yyerrlab1 -- error raised explicitly by an action. |
1431 `----------------------------------------------------*/
1433 if (yyerrstatus == 3)
1435 /* If just tried and failed to reuse lookahead token after an
1436 error, discard it. */
1438 /* Return failure if at end of input. */
1439 if (yychar == YYEOF)
1441 /* Pop the error token. */
1443 /* Pop the rest of the stack. */
1444 while (yyssp > yyss)
1446 YYDPRINTF ((stderr, "Error: popping "));
1447 YYDSYMPRINT ((stderr,
1450 YYDPRINTF ((stderr, "\n"));
1451 yydestruct (yystos[*yyssp], *yyvsp);
1457 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1458 yychar, yytname[yychar1]));
1459 yydestruct (yychar1, yylval);
1463 /* Else will try to reuse lookahead token after shifting the error
1466 yyerrstatus = 3; /* Each real token shifted decrements this. */
1470 yyn = yypact[yystate];
1471 if (yyn != YYPACT_NINF)
1474 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1482 /* Pop the current state because it cannot handle the error token. */
1486 YYDPRINTF ((stderr, "Error: popping "));
1487 YYDSYMPRINT ((stderr,
1488 yystos[*yyssp], *yyvsp));
1489 YYDPRINTF ((stderr, "\n"));
1491 yydestruct (yystos[yystate], *yyvsp);
1499 short *yyssp1 = yyss - 1;
1500 YYFPRINTF (stderr, "Error: state stack now");
1501 while (yyssp1 != yyssp)
1502 YYFPRINTF (stderr, " %d", *++yyssp1);
1503 YYFPRINTF (stderr, "\n");
1511 YYDPRINTF ((stderr, "Shifting error token, "));
1520 /*-------------------------------------.
1521 | yyacceptlab -- YYACCEPT comes here. |
1522 `-------------------------------------*/
1527 /*-----------------------------------.
1528 | yyabortlab -- YYABORT comes here. |
1529 `-----------------------------------*/
1535 /*----------------------------------------------.
1536 | yyoverflowlab -- parser overflow comes here. |
1537 `----------------------------------------------*/
1539 yyerror ("parser stack overflow");
1547 YYSTACK_FREE (yyss);
1553 #line 272 "ifgram.y"
1556 /* This is a pointer to the buffer containing the clause in compressed form.
1557 * A call to set_ifclause_buffer() sets this to point to an actual array */
1558 static unsigned char * Buffer;
1560 /* Our current position in Buffer */
1563 /* length of Buffer */
1568 /* To use this mini-parser, put the clause in compressed internal form
1569 * in an array, and pass that array and its length to this function,
1570 * then call ifparse().
1574 set_ifclause_buffer(buff, len)
1576 unsigned char * buff;
1586 /* The compressed if-clause format is described in lex.c above add_ifclause().
1587 * Since it's very simple (everything except numbers
1588 * are single character tokens), we have a hand-coded lexer.
1589 * It maps the compressed format tokens to bison tokens.
1595 if (Offset == Length) {
1599 switch(Buffer[Offset++]) {
1609 return(ICT_BITCOMPLEMENT);
1626 return(ICT_SHRIGHT);
1658 return(ICT_QUESTION);
1667 iflval = ((Buffer[Offset] << 24) & 0xff000000)
1668 | ((Buffer[Offset+1] << 16) & 0xff0000)
1669 | ((Buffer[Offset+2] << 8) & 0xff00)
1670 | (Buffer[Offset+3] & 0xff);
1681 /* Error message printer for syntax/semantic errors in 'if' clauses.
1682 * WARNING: bison appears to somehow use yyerror even when using a prefix
1683 * other than yy. So if this function calls yyerror, it gets into an
1684 * infinite loop! So don't do that...
1693 l_yyerror(Curr_filename, yylineno, msg);