chiark / gitweb /
Import upstream version 5.3.
[mup] / mup / mup / ifgram.c
1 /* A Bison parser, made from ifgram.y, by GNU bison 1.75.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
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)
9    any later version.
10
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.
15
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.  */
20
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.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
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.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Pure parsers.  */
40 #define YYPURE  0
41
42 /* Using locations.  */
43 #define YYLSP_NEEDED 0
44
45 /* If NAME_PREFIX is specified substitute the variables and functions
46    names.  */
47 #define yyparse ifparse
48 #define yylex   iflex
49 #define yyerror iferror
50 #define yylval  iflval
51 #define yychar  ifchar
52 #define yydebug ifdebug
53 #define yynerrs ifnerrs
54
55
56 /* Tokens.  */
57 #ifndef YYTOKENTYPE
58 # define YYTOKENTYPE
59    /* Put the tokens into the symbol table, so that GDB and other debuggers
60       know about them.  */
61    enum yytokentype {
62      ICT_AND = 258,
63      ICT_BITAND = 259,
64      ICT_BITCOMPLEMENT = 260,
65      ICT_BITOR = 261,
66      ICT_BITXOR = 262,
67      ICT_COLON = 263,
68      ICT_DIVIDE = 264,
69      ICT_END = 265,
70      ICT_ERROR = 266,
71      ICT_EQ = 267,
72      ICT_FALSE = 268,
73      ICT_GT = 269,
74      ICT_GE = 270,
75      ICT_LPAREN = 271,
76      ICT_LE = 272,
77      ICT_LT = 273,
78      ICT_MINUS = 274,
79      ICT_MOD = 275,
80      ICT_MULT = 276,
81      ICT_NE = 277,
82      ICT_NOT = 278,
83      ICT_OR = 279,
84      ICT_PLUS = 280,
85      ICT_QUESTION = 281,
86      ICT_RPAREN = 282,
87      ICT_SHLEFT = 283,
88      ICT_SHRIGHT = 284,
89      ICT_TRUE = 285,
90      ICT_VALUE = 286
91    };
92 #endif
93 #define ICT_AND 258
94 #define ICT_BITAND 259
95 #define ICT_BITCOMPLEMENT 260
96 #define ICT_BITOR 261
97 #define ICT_BITXOR 262
98 #define ICT_COLON 263
99 #define ICT_DIVIDE 264
100 #define ICT_END 265
101 #define ICT_ERROR 266
102 #define ICT_EQ 267
103 #define ICT_FALSE 268
104 #define ICT_GT 269
105 #define ICT_GE 270
106 #define ICT_LPAREN 271
107 #define ICT_LE 272
108 #define ICT_LT 273
109 #define ICT_MINUS 274
110 #define ICT_MOD 275
111 #define ICT_MULT 276
112 #define ICT_NE 277
113 #define ICT_NOT 278
114 #define ICT_OR 279
115 #define ICT_PLUS 280
116 #define ICT_QUESTION 281
117 #define ICT_RPAREN 282
118 #define ICT_SHLEFT 283
119 #define ICT_SHRIGHT 284
120 #define ICT_TRUE 285
121 #define ICT_VALUE 286
122
123
124
125
126 /* Copy the first part of user declarations.  */
127 #line 2 "ifgram.y"
128
129 /* Copyright 2005 by Arkkra Enterprises */
130 /* All rights reserved. */
131
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.
140  */
141
142 #include "defines.h"
143 #include "globals.h"
144
145 #define YYDEBUG 1
146
147
148
149 /* Enabling traces.  */
150 #ifndef YYDEBUG
151 # define YYDEBUG 0
152 #endif
153
154 /* Enabling verbose error messages.  */
155 #ifdef YYERROR_VERBOSE
156 # undef YYERROR_VERBOSE
157 # define YYERROR_VERBOSE 1
158 #else
159 # define YYERROR_VERBOSE 0
160 #endif
161
162 #ifndef YYSTYPE
163 typedef int yystype;
164 # define YYSTYPE yystype
165 # define YYSTYPE_IS_TRIVIAL 1
166 #endif
167
168 #ifndef YYLTYPE
169 typedef struct yyltype
170 {
171   int first_line;
172   int first_column;
173   int last_line;
174   int last_column;
175 } yyltype;
176 # define YYLTYPE yyltype
177 # define YYLTYPE_IS_TRIVIAL 1
178 #endif
179
180 /* Copy the second part of user declarations.  */
181
182
183 /* Line 213 of /usr/share/bison/yacc.c.  */
184 #line 185 "ifgram.tab.c"
185
186 #if ! defined (yyoverflow) || YYERROR_VERBOSE
187
188 /* The parser invokes alloca or malloc; define the necessary symbols.  */
189
190 # if YYSTACK_USE_ALLOCA
191 #  define YYSTACK_ALLOC alloca
192 # else
193 #  ifndef YYSTACK_USE_ALLOCA
194 #   if defined (alloca) || defined (_ALLOCA_H)
195 #    define YYSTACK_ALLOC alloca
196 #   else
197 #    ifdef __GNUC__
198 #     define YYSTACK_ALLOC __builtin_alloca
199 #    endif
200 #   endif
201 #  endif
202 # endif
203
204 # ifdef YYSTACK_ALLOC
205    /* Pacify GCC's `empty if-body' warning. */
206 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
207 # else
208 #  if defined (__STDC__) || defined (__cplusplus)
209 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
210 #   define YYSIZE_T size_t
211 #  endif
212 #  define YYSTACK_ALLOC malloc
213 #  define YYSTACK_FREE free
214 # endif
215 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
216
217
218 #if (! defined (yyoverflow) \
219      && (! defined (__cplusplus) \
220          || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
221
222 /* A type that is properly aligned for any stack member.  */
223 union yyalloc
224 {
225   short yyss;
226   YYSTYPE yyvs;
227   };
228
229 /* The size of the maximum gap between one aligned stack and the next.  */
230 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
231
232 /* The size of an array large to enough to hold all stacks, each with
233    N elements.  */
234 # define YYSTACK_BYTES(N) \
235      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
236       + YYSTACK_GAP_MAX)
237
238 /* Copy COUNT objects from FROM to TO.  The source and destination do
239    not overlap.  */
240 # ifndef YYCOPY
241 #  if 1 < __GNUC__
242 #   define YYCOPY(To, From, Count) \
243       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
244 #  else
245 #   define YYCOPY(To, From, Count)              \
246       do                                        \
247         {                                       \
248           register YYSIZE_T yyi;                \
249           for (yyi = 0; yyi < (Count); yyi++)   \
250             (To)[yyi] = (From)[yyi];    \
251         }                                       \
252       while (0)
253 #  endif
254 # endif
255
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
260    stack.  */
261 # define YYSTACK_RELOCATE(Stack)                                        \
262     do                                                                  \
263       {                                                                 \
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);                          \
269       }                                                                 \
270     while (0)
271
272 #endif
273
274 #if defined (__STDC__) || defined (__cplusplus)
275    typedef signed char yysigned_char;
276 #else
277    typedef short yysigned_char;
278 #endif
279
280 /* YYFINAL -- State number of the termination state. */
281 #define YYFINAL  19
282 #define YYLAST   327
283
284 /* YYNTOKENS -- Number of terminals. */
285 #define YYNTOKENS  32
286 /* YYNNTS -- Number of nonterminals. */
287 #define YYNNTS  4
288 /* YYNRULES -- Number of rules. */
289 #define YYNRULES  32
290 /* YYNRULES -- Number of states. */
291 #define YYNSTATES  62
292
293 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
294 #define YYUNDEFTOK  2
295 #define YYMAXUTOK   286
296
297 #define YYTRANSLATE(X) \
298   ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
299
300 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
301 static const unsigned char yytranslate[] =
302 {
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
332 };
333
334 #if YYDEBUG
335 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
336    YYRHS.  */
337 static const unsigned char yyprhs[] =
338 {
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,
342      106,   108,   110
343 };
344
345 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
346 static const yysigned_char yyrhs[] =
347 {
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,
359       13,    -1
360 };
361
362 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
363 static const unsigned short yyrline[] =
364 {
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,
368      252,   259,   264
369 };
370 #endif
371
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[] =
376 {
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
384 };
385 #endif
386
387 # ifdef YYPRINT
388 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
389    token YYLEX-NUM.  */
390 static const unsigned short yytoknum[] =
391 {
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,
395      285,   286
396 };
397 # endif
398
399 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
400 static const unsigned char yyr1[] =
401 {
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,
405       34,    35,    35
406 };
407
408 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
409 static const unsigned char yyr2[] =
410 {
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,
414        1,     1,     1
415 };
416
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[] =
421 {
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,
428        0,    28
429 };
430
431 /* YYDEFGOTO[NTERM-NUM]. */
432 static const yysigned_char yydefgoto[] =
433 {
434       -1,    11,    12,    13
435 };
436
437 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
438    STATE-NUM.  */
439 #define YYPACT_NINF -9
440 static const short yypact[] =
441 {
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,
448      185,   147
449 };
450
451 /* YYPGOTO[NTERM-NUM].  */
452 static const yysigned_char yypgoto[] =
453 {
454       -9,    -9,    -2,    -9
455 };
456
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[] =
463 {
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
497 };
498
499 static const yysigned_char yycheck[] =
500 {
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
534 };
535
536 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
537    symbol of state STATE-NUM.  */
538 static const unsigned char yystos[] =
539 {
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,
546        8,    34
547 };
548
549 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
550 # define YYSIZE_T __SIZE_TYPE__
551 #endif
552 #if ! defined (YYSIZE_T) && defined (size_t)
553 # define YYSIZE_T size_t
554 #endif
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
559 # endif
560 #endif
561 #if ! defined (YYSIZE_T)
562 # define YYSIZE_T unsigned int
563 #endif
564
565 #define yyerrok         (yyerrstatus = 0)
566 #define yyclearin       (yychar = YYEMPTY)
567 #define YYEMPTY         -2
568 #define YYEOF           0
569
570 #define YYACCEPT        goto yyacceptlab
571 #define YYABORT         goto yyabortlab
572 #define YYERROR         goto yyerrlab1
573
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.  */
577
578 #define YYFAIL          goto yyerrlab
579
580 #define YYRECOVERING()  (!!yyerrstatus)
581
582 #define YYBACKUP(Token, Value)                                  \
583 do                                                              \
584   if (yychar == YYEMPTY && yylen == 1)                          \
585     {                                                           \
586       yychar = (Token);                                         \
587       yylval = (Value);                                         \
588       yychar1 = YYTRANSLATE (yychar);                           \
589       YYPOPSTACK;                                               \
590       goto yybackup;                                            \
591     }                                                           \
592   else                                                          \
593     {                                                           \
594       yyerror ("syntax error: cannot back up");                 \
595       YYERROR;                                                  \
596     }                                                           \
597 while (0)
598
599 #define YYTERROR        1
600 #define YYERRCODE       256
601
602 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
603    are run).  */
604
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;
611 #endif
612
613 /* YYLEX -- calling `yylex' with the right arguments.  */
614
615 #define YYLEX   yylex ()
616
617 /* Enable debugging if requested.  */
618 #if YYDEBUG
619
620 # ifndef YYFPRINTF
621 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
622 #  define YYFPRINTF fprintf
623 # endif
624
625 # define YYDPRINTF(Args)                        \
626 do {                                            \
627   if (yydebug)                                  \
628     YYFPRINTF Args;                             \
629 } while (0)
630 # define YYDSYMPRINT(Args)                      \
631 do {                                            \
632   if (yydebug)                                  \
633     yysymprint Args;                            \
634 } while (0)
635 /* Nonzero means print parse trace.  It is left uninitialized so that
636    multiple parsers can coexist.  */
637 int yydebug;
638 #else /* !YYDEBUG */
639 # define YYDPRINTF(Args)
640 # define YYDSYMPRINT(Args)
641 #endif /* !YYDEBUG */
642
643 /* YYINITDEPTH -- initial size of the parser's stacks.  */
644 #ifndef YYINITDEPTH
645 # define YYINITDEPTH 200
646 #endif
647
648 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
649    if the built-in stack extension method is used).
650
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.  */
654
655 #if YYMAXDEPTH == 0
656 # undef YYMAXDEPTH
657 #endif
658
659 #ifndef YYMAXDEPTH
660 # define YYMAXDEPTH 10000
661 #endif
662
663 \f
664
665 #if YYERROR_VERBOSE
666
667 # ifndef yystrlen
668 #  if defined (__GLIBC__) && defined (_STRING_H)
669 #   define yystrlen strlen
670 #  else
671 /* Return the length of YYSTR.  */
672 static YYSIZE_T
673 #   if defined (__STDC__) || defined (__cplusplus)
674 yystrlen (const char *yystr)
675 #   else
676 yystrlen (yystr)
677      const char *yystr;
678 #   endif
679 {
680   register const char *yys = yystr;
681
682   while (*yys++ != '\0')
683     continue;
684
685   return yys - yystr - 1;
686 }
687 #  endif
688 # endif
689
690 # ifndef yystpcpy
691 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
692 #   define yystpcpy stpcpy
693 #  else
694 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
695    YYDEST.  */
696 static char *
697 #   if defined (__STDC__) || defined (__cplusplus)
698 yystpcpy (char *yydest, const char *yysrc)
699 #   else
700 yystpcpy (yydest, yysrc)
701      char *yydest;
702      const char *yysrc;
703 #   endif
704 {
705   register char *yyd = yydest;
706   register const char *yys = yysrc;
707
708   while ((*yyd++ = *yys++) != '\0')
709     continue;
710
711   return yyd - 1;
712 }
713 #  endif
714 # endif
715
716 #endif /* !YYERROR_VERBOSE */
717
718 \f
719
720 #if YYDEBUG
721 /*-----------------------------.
722 | Print this symbol on YYOUT.  |
723 `-----------------------------*/
724
725 static void
726 #if defined (__STDC__) || defined (__cplusplus)
727 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
728 #else
729 yysymprint (yyout, yytype, yyvalue)
730     FILE* yyout;
731     int yytype;
732     YYSTYPE yyvalue;
733 #endif
734 {
735   /* Pacify ``unused variable'' warnings.  */
736   (void) yyvalue;
737
738   if (yytype < YYNTOKENS)
739     {
740       YYFPRINTF (yyout, "token %s (", yytname[yytype]);
741 # ifdef YYPRINT
742       YYPRINT (yyout, yytoknum[yytype], yyvalue);
743 # endif
744     }
745   else
746     YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
747
748   switch (yytype)
749     {
750       default:
751         break;
752     }
753   YYFPRINTF (yyout, ")");
754 }
755 #endif /* YYDEBUG. */
756
757
758 /*-----------------------------------------------.
759 | Release the memory associated to this symbol.  |
760 `-----------------------------------------------*/
761
762 static void
763 #if defined (__STDC__) || defined (__cplusplus)
764 yydestruct (int yytype, YYSTYPE yyvalue)
765 #else
766 yydestruct (yytype, yyvalue)
767     int yytype;
768     YYSTYPE yyvalue;
769 #endif
770 {
771   /* Pacify ``unused variable'' warnings.  */
772   (void) yyvalue;
773
774   switch (yytype)
775     {
776       default:
777         break;
778     }
779 }
780
781 \f
782
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.  */
788
789 #ifdef YYPARSE_PARAM
790 # if defined (__STDC__) || defined (__cplusplus)
791 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
792 #  define YYPARSE_PARAM_DECL
793 # else
794 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
795 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
796 # endif
797 #else /* !YYPARSE_PARAM */
798 # define YYPARSE_PARAM_ARG
799 # define YYPARSE_PARAM_DECL
800 #endif /* !YYPARSE_PARAM */
801
802 /* Prevent warning if -Wstrict-prototypes.  */
803 #ifdef __GNUC__
804 # ifdef YYPARSE_PARAM
805 int yyparse (void *);
806 # else
807 int yyparse (void);
808 # endif
809 #endif
810
811
812 /* The lookahead symbol.  */
813 int yychar;
814
815 /* The semantic value of the lookahead symbol.  */
816 YYSTYPE yylval;
817
818 /* Number of parse errors so far.  */
819 int yynerrs;
820
821
822 int
823 yyparse (YYPARSE_PARAM_ARG)
824      YYPARSE_PARAM_DECL
825 {
826   
827   register int yystate;
828   register int yyn;
829   int yyresult;
830   /* Number of tokens to shift before error messages enabled.  */
831   int yyerrstatus;
832   /* Lookahead token as an internal (translated) token number.  */
833   int yychar1 = 0;
834
835   /* Three stacks and their tools:
836      `yyss': related to states,
837      `yyvs': related to semantic values,
838      `yyls': related to locations.
839
840      Refer to the stacks thru separate pointers, to allow yyoverflow
841      to reallocate them elsewhere.  */
842
843   /* The state stack.  */
844   short yyssa[YYINITDEPTH];
845   short *yyss = yyssa;
846   register short *yyssp;
847
848   /* The semantic value stack.  */
849   YYSTYPE yyvsa[YYINITDEPTH];
850   YYSTYPE *yyvs = yyvsa;
851   register YYSTYPE *yyvsp;
852
853
854
855 #define YYPOPSTACK   (yyvsp--, yyssp--)
856
857   YYSIZE_T yystacksize = YYINITDEPTH;
858
859   /* The variables used to return semantic value and location from the
860      action routines.  */
861   YYSTYPE yyval;
862
863
864   /* When reducing, the number of symbols on the RHS of the reduced
865      rule.  */
866   int yylen;
867
868   YYDPRINTF ((stderr, "Starting parse\n"));
869
870   yystate = 0;
871   yyerrstatus = 0;
872   yynerrs = 0;
873   yychar = YYEMPTY;             /* Cause a token to be read.  */
874
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.  */
879
880   yyssp = yyss;
881   yyvsp = yyvs;
882
883   goto yysetstate;
884
885 /*------------------------------------------------------------.
886 | yynewstate -- Push a new state, which is found in yystate.  |
887 `------------------------------------------------------------*/
888  yynewstate:
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.
891      */
892   yyssp++;
893
894  yysetstate:
895   *yyssp = yystate;
896
897   if (yyssp >= yyss + yystacksize - 1)
898     {
899       /* Get the current used size of the three stacks, in elements.  */
900       YYSIZE_T yysize = yyssp - yyss + 1;
901
902 #ifdef yyoverflow
903       {
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
906            memory.  */
907         YYSTYPE *yyvs1 = yyvs;
908         short *yyss1 = yyss;
909
910
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),
918
919                     &yystacksize);
920
921         yyss = yyss1;
922         yyvs = yyvs1;
923       }
924 #else /* no yyoverflow */
925 # ifndef YYSTACK_RELOCATE
926       goto yyoverflowlab;
927 # else
928       /* Extend the stack our own way.  */
929       if (yystacksize >= YYMAXDEPTH)
930         goto yyoverflowlab;
931       yystacksize *= 2;
932       if (yystacksize > YYMAXDEPTH)
933         yystacksize = YYMAXDEPTH;
934
935       {
936         short *yyss1 = yyss;
937         union yyalloc *yyptr =
938           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
939         if (! yyptr)
940           goto yyoverflowlab;
941         YYSTACK_RELOCATE (yyss);
942         YYSTACK_RELOCATE (yyvs);
943
944 #  undef YYSTACK_RELOCATE
945         if (yyss1 != yyssa)
946           YYSTACK_FREE (yyss1);
947       }
948 # endif
949 #endif /* no yyoverflow */
950
951       yyssp = yyss + yysize - 1;
952       yyvsp = yyvs + yysize - 1;
953
954
955       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
956                   (unsigned long int) yystacksize));
957
958       if (yyssp >= yyss + yystacksize - 1)
959         YYABORT;
960     }
961
962   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
963
964   goto yybackup;
965
966 /*-----------.
967 | yybackup.  |
968 `-----------*/
969 yybackup:
970
971 /* Do appropriate processing given the current state.  */
972 /* Read a lookahead token if we need one and don't already have one.  */
973 /* yyresume: */
974
975   /* First try to decide what to do without reference to lookahead token.  */
976
977   yyn = yypact[yystate];
978   if (yyn == YYPACT_NINF)
979     goto yydefault;
980
981   /* Not known => get a lookahead token if don't already have one.  */
982
983   /* yychar is either YYEMPTY or YYEOF
984      or a valid token in external form.  */
985
986   if (yychar == YYEMPTY)
987     {
988       YYDPRINTF ((stderr, "Reading a token: "));
989       yychar = YYLEX;
990     }
991
992   /* Convert token to internal form (in yychar1) for indexing tables with.  */
993
994   if (yychar <= 0)              /* This means end of input.  */
995     {
996       yychar1 = 0;
997       yychar = YYEOF;           /* Don't call YYLEX any more.  */
998
999       YYDPRINTF ((stderr, "Now at end of input.\n"));
1000     }
1001   else
1002     {
1003       yychar1 = YYTRANSLATE (yychar);
1004
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"));
1010     }
1011
1012   /* If the proper action on seeing token YYCHAR1 is to reduce or to
1013      detect an error, take that action.  */
1014   yyn += yychar1;
1015   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
1016     goto yydefault;
1017   yyn = yytable[yyn];
1018   if (yyn <= 0)
1019     {
1020       if (yyn == 0 || yyn == YYTABLE_NINF)
1021         goto yyerrlab;
1022       yyn = -yyn;
1023       goto yyreduce;
1024     }
1025
1026   if (yyn == YYFINAL)
1027     YYACCEPT;
1028
1029   /* Shift the lookahead token.  */
1030   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1031               yychar, yytname[yychar1]));
1032
1033   /* Discard the token being shifted unless it is eof.  */
1034   if (yychar != YYEOF)
1035     yychar = YYEMPTY;
1036
1037   *++yyvsp = yylval;
1038
1039
1040   /* Count tokens shifted since error; after three, turn off error
1041      status.  */
1042   if (yyerrstatus)
1043     yyerrstatus--;
1044
1045   yystate = yyn;
1046   goto yynewstate;
1047
1048
1049 /*-----------------------------------------------------------.
1050 | yydefault -- do the default action for the current state.  |
1051 `-----------------------------------------------------------*/
1052 yydefault:
1053   yyn = yydefact[yystate];
1054   if (yyn == 0)
1055     goto yyerrlab;
1056   goto yyreduce;
1057
1058
1059 /*-----------------------------.
1060 | yyreduce -- Do a reduction.  |
1061 `-----------------------------*/
1062 yyreduce:
1063   /* yyn is the number of a rule to reduce with.  */
1064   yylen = yyr2[yyn];
1065
1066   /* If YYLEN is nonzero, implement the default value of the action:
1067      `$$ = $1'.
1068
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];
1075
1076
1077
1078 #if YYDEBUG
1079   /* We have to keep this `#if YYDEBUG', since we use variables which
1080      are defined only if `YYDEBUG' is set.  */
1081   if (yydebug)
1082     {
1083       int yyi;
1084
1085       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1086                  yyn - 1, yyrline[yyn]);
1087
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]]);
1092     }
1093 #endif
1094   switch (yyn)
1095     {
1096         case 2:
1097 #line 69 "ifgram.y"
1098     {
1099                 return(yyvsp[-1] ? YES : NO);
1100         }
1101     break;
1102
1103   case 3:
1104 #line 75 "ifgram.y"
1105     {
1106                 pfatal("if clause parser received unknown token type");
1107         }
1108     break;
1109
1110   case 4:
1111 #line 81 "ifgram.y"
1112     {
1113                 l_yyerror(Curr_filename, yylineno, "syntax error in 'if' condition");
1114                 return(NO);
1115         }
1116     break;
1117
1118   case 5:
1119 #line 88 "ifgram.y"
1120     {
1121                 yyval = yyvsp[-1];
1122         }
1123     break;
1124
1125   case 6:
1126 #line 94 "ifgram.y"
1127     {
1128                 yyval = !(yyvsp[0]);
1129         }
1130     break;
1131
1132   case 7:
1133 #line 100 "ifgram.y"
1134     {
1135                 yyval = ~(yyvsp[0]);
1136         }
1137     break;
1138
1139   case 8:
1140 #line 106 "ifgram.y"
1141     {
1142                 /* unary minus */
1143                 yyval = -(yyvsp[0]);
1144         }
1145     break;
1146
1147   case 9:
1148 #line 113 "ifgram.y"
1149     {
1150                 /* unary plus. Not very useful, but ANSI C supports it... */
1151                 yyval = (yyvsp[0]);
1152         }
1153     break;
1154
1155   case 10:
1156 #line 120 "ifgram.y"
1157     {
1158                 yyval = yyvsp[-2] * yyvsp[0];
1159         }
1160     break;
1161
1162   case 11:
1163 #line 126 "ifgram.y"
1164     {
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 */
1169                         yyval = yyvsp[-2];
1170                 }
1171                 else {
1172                         yyval = yyvsp[-2] / yyvsp[0];
1173                 }
1174         }
1175     break;
1176
1177   case 12:
1178 #line 140 "ifgram.y"
1179     {
1180                 if (yyvsp[0] == 0) {
1181                         yyerror("attempt to modulo by 0");
1182                         yyval = yyvsp[-2];
1183                 }
1184                 else {
1185                         yyval = yyvsp[-2] % yyvsp[0];
1186                 }
1187         }
1188     break;
1189
1190   case 13:
1191 #line 152 "ifgram.y"
1192     {
1193                 yyval = yyvsp[-2] + yyvsp[0];
1194         }
1195     break;
1196
1197   case 14:
1198 #line 158 "ifgram.y"
1199     {
1200                 yyval = yyvsp[-2] - yyvsp[0];
1201         }
1202     break;
1203
1204   case 15:
1205 #line 164 "ifgram.y"
1206     {
1207                 yyval = yyvsp[-2] << yyvsp[0];
1208         }
1209     break;
1210
1211   case 16:
1212 #line 170 "ifgram.y"
1213     {
1214                 yyval = yyvsp[-2] >> yyvsp[0];
1215         }
1216     break;
1217
1218   case 17:
1219 #line 176 "ifgram.y"
1220     {
1221                 yyval = (yyvsp[-2] < yyvsp[0]);
1222         }
1223     break;
1224
1225   case 18:
1226 #line 182 "ifgram.y"
1227     {
1228                 yyval = (yyvsp[-2] <= yyvsp[0]);
1229         }
1230     break;
1231
1232   case 19:
1233 #line 188 "ifgram.y"
1234     {
1235                 yyval = (yyvsp[-2] > yyvsp[0]);
1236         }
1237     break;
1238
1239   case 20:
1240 #line 194 "ifgram.y"
1241     {
1242                 yyval = (yyvsp[-2] >= yyvsp[0]);
1243         }
1244     break;
1245
1246   case 21:
1247 #line 200 "ifgram.y"
1248     {
1249                 yyval = (yyvsp[-2] == yyvsp[0]);
1250         }
1251     break;
1252
1253   case 22:
1254 #line 206 "ifgram.y"
1255     {
1256                 yyval = (yyvsp[-2] != yyvsp[0]);
1257         }
1258     break;
1259
1260   case 23:
1261 #line 212 "ifgram.y"
1262     {
1263                 yyval = yyvsp[-2] & yyvsp[0];
1264         }
1265     break;
1266
1267   case 24:
1268 #line 218 "ifgram.y"
1269     {
1270                 yyval = yyvsp[-2] ^ yyvsp[0];
1271         }
1272     break;
1273
1274   case 25:
1275 #line 224 "ifgram.y"
1276     {
1277                 yyval = yyvsp[-2] | yyvsp[0];
1278         }
1279     break;
1280
1281   case 26:
1282 #line 230 "ifgram.y"
1283     {
1284                 yyval = yyvsp[-2] || yyvsp[0];
1285         }
1286     break;
1287
1288   case 27:
1289 #line 236 "ifgram.y"
1290     {
1291                 yyval = yyvsp[-2] && yyvsp[0];
1292         }
1293     break;
1294
1295   case 28:
1296 #line 242 "ifgram.y"
1297     {
1298                 yyval = ( yyvsp[-4] ? yyvsp[-2] : yyvsp[0] );
1299         }
1300     break;
1301
1302   case 29:
1303 #line 248 "ifgram.y"
1304     {
1305                 yyval = yyvsp[0];
1306         }
1307     break;
1308
1309   case 30:
1310 #line 254 "ifgram.y"
1311     {
1312                 yyval = yyvsp[0];
1313         }
1314     break;
1315
1316   case 31:
1317 #line 260 "ifgram.y"
1318     {
1319                 yyval = 1;
1320         }
1321     break;
1322
1323   case 32:
1324 #line 266 "ifgram.y"
1325     {
1326                 yyval = 0;
1327         }
1328     break;
1329
1330
1331     }
1332
1333 /* Line 1016 of /usr/share/bison/yacc.c.  */
1334 #line 1335 "ifgram.tab.c"
1335 \f
1336   yyvsp -= yylen;
1337   yyssp -= yylen;
1338
1339
1340 #if YYDEBUG
1341   if (yydebug)
1342     {
1343       short *yyssp1 = yyss - 1;
1344       YYFPRINTF (stderr, "state stack now");
1345       while (yyssp1 != yyssp)
1346         YYFPRINTF (stderr, " %d", *++yyssp1);
1347       YYFPRINTF (stderr, "\n");
1348     }
1349 #endif
1350
1351   *++yyvsp = yyval;
1352
1353
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.  */
1357
1358   yyn = yyr1[yyn];
1359
1360   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1361   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1362     yystate = yytable[yystate];
1363   else
1364     yystate = yydefgoto[yyn - YYNTOKENS];
1365
1366   goto yynewstate;
1367
1368
1369 /*------------------------------------.
1370 | yyerrlab -- here on detecting error |
1371 `------------------------------------*/
1372 yyerrlab:
1373   /* If not already recovering from an error, report this error.  */
1374   if (!yyerrstatus)
1375     {
1376       ++yynerrs;
1377 #if YYERROR_VERBOSE
1378       yyn = yypact[yystate];
1379
1380       if (YYPACT_NINF < yyn && yyn < YYLAST)
1381         {
1382           YYSIZE_T yysize = 0;
1383           int yytype = YYTRANSLATE (yychar);
1384           char *yymsg;
1385           int yyx, yycount;
1386
1387           yycount = 0;
1388           /* Start YYX at -YYN if negative to avoid negative indexes in
1389              YYCHECK.  */
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);
1397           if (yymsg != 0)
1398             {
1399               char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1400               yyp = yystpcpy (yyp, yytname[yytype]);
1401
1402               if (yycount < 5)
1403                 {
1404                   yycount = 0;
1405                   for (yyx = yyn < 0 ? -yyn : 0;
1406                        yyx < (int) (sizeof (yytname) / sizeof (char *));
1407                        yyx++)
1408                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1409                       {
1410                         const char *yyq = ! yycount ? ", expecting " : " or ";
1411                         yyp = yystpcpy (yyp, yyq);
1412                         yyp = yystpcpy (yyp, yytname[yyx]);
1413                         yycount++;
1414                       }
1415                 }
1416               yyerror (yymsg);
1417               YYSTACK_FREE (yymsg);
1418             }
1419           else
1420             yyerror ("parse error; also virtual memory exhausted");
1421         }
1422       else
1423 #endif /* YYERROR_VERBOSE */
1424         yyerror ("parse error");
1425     }
1426   goto yyerrlab1;
1427
1428
1429 /*----------------------------------------------------.
1430 | yyerrlab1 -- error raised explicitly by an action.  |
1431 `----------------------------------------------------*/
1432 yyerrlab1:
1433   if (yyerrstatus == 3)
1434     {
1435       /* If just tried and failed to reuse lookahead token after an
1436          error, discard it.  */
1437
1438       /* Return failure if at end of input.  */
1439       if (yychar == YYEOF)
1440         {
1441           /* Pop the error token.  */
1442           YYPOPSTACK;
1443           /* Pop the rest of the stack.  */
1444           while (yyssp > yyss)
1445             {
1446               YYDPRINTF ((stderr, "Error: popping "));
1447               YYDSYMPRINT ((stderr,
1448                             yystos[*yyssp],
1449                             *yyvsp));
1450               YYDPRINTF ((stderr, "\n"));
1451               yydestruct (yystos[*yyssp], *yyvsp);
1452               YYPOPSTACK;
1453             }
1454           YYABORT;
1455         }
1456
1457       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1458                   yychar, yytname[yychar1]));
1459       yydestruct (yychar1, yylval);
1460       yychar = YYEMPTY;
1461     }
1462
1463   /* Else will try to reuse lookahead token after shifting the error
1464      token.  */
1465
1466   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1467
1468   for (;;)
1469     {
1470       yyn = yypact[yystate];
1471       if (yyn != YYPACT_NINF)
1472         {
1473           yyn += YYTERROR;
1474           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1475             {
1476               yyn = yytable[yyn];
1477               if (0 < yyn)
1478                 break;
1479             }
1480         }
1481
1482       /* Pop the current state because it cannot handle the error token.  */
1483       if (yyssp == yyss)
1484         YYABORT;
1485
1486       YYDPRINTF ((stderr, "Error: popping "));
1487       YYDSYMPRINT ((stderr,
1488                     yystos[*yyssp], *yyvsp));
1489       YYDPRINTF ((stderr, "\n"));
1490
1491       yydestruct (yystos[yystate], *yyvsp);
1492       yyvsp--;
1493       yystate = *--yyssp;
1494
1495
1496 #if YYDEBUG
1497       if (yydebug)
1498         {
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");
1504         }
1505 #endif
1506     }
1507
1508   if (yyn == YYFINAL)
1509     YYACCEPT;
1510
1511   YYDPRINTF ((stderr, "Shifting error token, "));
1512
1513   *++yyvsp = yylval;
1514
1515
1516   yystate = yyn;
1517   goto yynewstate;
1518
1519
1520 /*-------------------------------------.
1521 | yyacceptlab -- YYACCEPT comes here.  |
1522 `-------------------------------------*/
1523 yyacceptlab:
1524   yyresult = 0;
1525   goto yyreturn;
1526
1527 /*-----------------------------------.
1528 | yyabortlab -- YYABORT comes here.  |
1529 `-----------------------------------*/
1530 yyabortlab:
1531   yyresult = 1;
1532   goto yyreturn;
1533
1534 #ifndef yyoverflow
1535 /*----------------------------------------------.
1536 | yyoverflowlab -- parser overflow comes here.  |
1537 `----------------------------------------------*/
1538 yyoverflowlab:
1539   yyerror ("parser stack overflow");
1540   yyresult = 2;
1541   /* Fall through.  */
1542 #endif
1543
1544 yyreturn:
1545 #ifndef yyoverflow
1546   if (yyss != yyssa)
1547     YYSTACK_FREE (yyss);
1548 #endif
1549   return yyresult;
1550 }
1551
1552
1553 #line 272 "ifgram.y"
1554
1555
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;
1559
1560 /* Our current position in Buffer */
1561 static int Offset;
1562
1563 /* length of Buffer */
1564 static int Length;
1565
1566
1567
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().
1571  */
1572
1573 void
1574 set_ifclause_buffer(buff, len)
1575
1576 unsigned char * buff;
1577 int len;
1578
1579 {
1580         Buffer = buff;
1581         Length = len;
1582         Offset = 0;
1583 }
1584
1585
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.
1590  */
1591
1592 int
1593 iflex()
1594 {
1595         if (Offset == Length) {
1596                 return(ICT_END);
1597         }
1598
1599         switch(Buffer[Offset++]) {
1600
1601         case '(':
1602                 return(ICT_LPAREN);
1603         case ')':
1604                 return(ICT_RPAREN);
1605
1606         case '!':
1607                 return(ICT_NOT);
1608         case '~':
1609                 return(ICT_BITCOMPLEMENT);
1610
1611         case '*':
1612                 return(ICT_MULT);
1613         case '/':
1614                 return(ICT_DIVIDE);
1615         case '%':
1616                 return(ICT_MOD);
1617
1618         case '+':
1619                 return(ICT_PLUS);
1620         case '-':
1621                 return(ICT_MINUS);
1622
1623         case 'l':
1624                 return(ICT_SHLEFT);
1625         case 'r':
1626                 return(ICT_SHRIGHT);
1627
1628         case '<':
1629                 return(ICT_LT);
1630         case '>':
1631                 return(ICT_GT);
1632         case 'L':
1633                 return(ICT_LE);
1634         case 'G':
1635                 return(ICT_GE);
1636
1637         case 'E':
1638                 return(ICT_EQ);
1639         case 'N':
1640                 return(ICT_NE);
1641
1642         case '&':
1643                 return(ICT_BITAND);
1644
1645         case '^':
1646                 return(ICT_BITXOR);
1647
1648         case '|':
1649                 return(ICT_BITOR);
1650
1651         case 'a':
1652                 return(ICT_AND);
1653
1654         case 'o':
1655                 return(ICT_OR);
1656
1657         case '?':
1658                 return(ICT_QUESTION);
1659         case ':':
1660                 return(ICT_COLON);
1661
1662         case 'T':
1663                 return(ICT_TRUE);
1664         case 'F':
1665                 return(ICT_FALSE);
1666         case '#':
1667                 iflval = ((Buffer[Offset] << 24) & 0xff000000)
1668                         | ((Buffer[Offset+1] << 16) & 0xff0000)
1669                         | ((Buffer[Offset+2] << 8) & 0xff00)
1670                         | (Buffer[Offset+3] & 0xff);
1671                 Offset += 4;
1672                 return(ICT_VALUE);
1673
1674         default:
1675                 return(ICT_ERROR);
1676         }
1677 }       
1678
1679
1680
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...
1685  */
1686
1687 int
1688 iferror(msg)
1689
1690 char * msg;
1691
1692 {
1693         l_yyerror(Curr_filename, yylineno, msg);
1694         return(0);
1695 }
1696
1697