db615a72b8d30ca7b47e3adc44a569b1cd04b2a6
[projects/chimara/chimara.git] / interpreters / nitfol / inform.c
1 /* A Bison parser, made from inform.y
2    by GNU bison 1.35.  */
3
4 #define YYBISON 1  /* Identify Bison output.  */
5
6 # define        NUM     257
7 # define        DFILE   258
8 # define        CONDITION       259
9 # define        ALIAS   260
10 # define        RALIAS  261
11 # define        UNALIAS 262
12 # define        DUMPMEM 263
13 # define        AUTOMAP 264
14 # define        HELP    265
15 # define        UNDO    266
16 # define        REDO    267
17 # define        LANGUAGE        268
18 # define        INFOSOURCE      269
19 # define        INFOSOURCES     270
20 # define        COPYING 271
21 # define        WARRANTY        272
22 # define        PRINT   273
23 # define        SET     274
24 # define        MOVE    275
25 # define        TO      276
26 # define        GIVE    277
27 # define        REMOVE  278
28 # define        JUMP    279
29 # define        CONT    280
30 # define        STEP    281
31 # define        NEXT    282
32 # define        UNTIL   283
33 # define        STEPI   284
34 # define        NEXTI   285
35 # define        FINISH  286
36 # define        BREAK   287
37 # define        DELETE  288
38 # define        IF      289
39 # define        COND    290
40 # define        IGNORE  291
41 # define        BREAKPOINTS     292
42 # define        RESTORE 293
43 # define        RESTART 294
44 # define        QUIT    295
45 # define        RECORDON        296
46 # define        RECORDOFF       297
47 # define        REPLAY  298
48 # define        REPLAYOFF       299
49 # define        SYMBOL_FILE     300
50 # define        FRAME   301
51 # define        SELECT_FRAME    302
52 # define        BACKTRACE       303
53 # define        UP_FRAME        304
54 # define        DOWN_FRAME      305
55 # define        UP_SILENTLY     306
56 # define        DOWN_SILENTLY   307
57 # define        DISPLAY 308
58 # define        UNDISPLAY       309
59 # define        DISABLE_DISPLAY 310
60 # define        ENABLE_DISPLAY  311
61 # define        DISABLE_BREAK   312
62 # define        ENABLE_BREAK    313
63 # define        OBJECT_TREE     314
64 # define        FIND    315
65 # define        LIST_GLOBALS    316
66 # define        BTRUE   317
67 # define        BFALSE  318
68 # define        NOTHING 319
69 # define        PARENT  320
70 # define        CHILD   321
71 # define        SIBLING 322
72 # define        CHILDREN        323
73 # define        RANDOM  324
74 # define        ANDAND  325
75 # define        OROR    326
76 # define        NOTNOT  327
77 # define        OR      328
78 # define        BYTEARRAY       329
79 # define        WORDARRAY       330
80 # define        precNEG 331
81 # define        NUMBER  332
82 # define        OBJECT  333
83 # define        ROUTINE 334
84 # define        STRING  335
85 # define        GLOBAL  336
86 # define        LOCAL   337
87 # define        INCREMENT       338
88 # define        DECREMENT       339
89 # define        PROPADDR        340
90 # define        PROPLENGTH      341
91 # define        SUPERCLASS      342
92
93 #line 1 "inform.y"
94
95 /*  Nitfol - z-machine interpreter using Glk for output.
96     Copyright (C) 1999  Evin Robertson
97
98     This program is free software; you can redistribute it and/or modify
99     it under the terms of the GNU General Public License as published by
100     the Free Software Foundation; either version 2 of the License, or
101     (at your option) any later version.
102
103     This program is distributed in the hope that it will be useful,
104     but WITHOUT ANY WARRANTY; without even the implied warranty of
105     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
106     GNU General Public License for more details.
107
108     You should have received a copy of the GNU General Public License
109     along with this program; if not, write to the Free Software
110     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
111
112     The author can be reached at ecr+@andrew.cmu.edu
113 */
114
115 #include "nitfol.h"
116 #include <ctype.h>
117
118 /* bison uses str* functions; make it use n_str* instead... */
119 #ifndef n_strcat
120 #define strcat(d, s) n_strcat(d, s)
121 #endif
122 #ifndef n_strlen
123 #define strlen(s) n_strlen(s)
124 #endif
125 #ifndef n_strcpy
126 #define strcpy(d, s) n_strcpy(d, s)
127 #endif
128   
129   
130 #ifdef DEBUGGING
131   
132   typedef struct zword_list zword_list;
133   struct zword_list {
134     zword_list *next;
135     zword item;
136   };
137
138   typedef struct cond_list cond_list;
139   struct cond_list {
140     cond_list *next;
141     zword val;
142     BOOL (*condfunc)(zword a, zword b);
143     BOOL opposite;
144   };
145
146   cond_list *condlist;
147   
148   static z_typed z_t(z_typed a, z_typed b, zword v);
149   
150   static const char *lex_expression;
151   static int lex_offset;
152
153   static const char *lex_tail(void) {
154     const char *t = lex_expression + lex_offset;
155     while(*t == ' ')
156       t++;
157     lex_offset = n_strlen(lex_expression);
158     return t;
159   }
160   
161   static z_typed inform_result;
162   
163   static int yylex(void);
164   static void yyerror(const char *s);
165   static void inform_help(void);
166   
167   int ignoreeffects;
168
169 #define YYERROR_VERBOSE
170   
171 /*
172 #define YYDEBUG 1
173 */
174
175
176 #line 84 "inform.y"
177 #ifndef YYSTYPE
178 typedef union {
179   glui32 pcoffset;
180   infix_file *filenum;
181   z_typed val;
182   
183   zword_list *zlist;
184
185   struct {
186     BOOL (*condfunc)(zword a, zword b);
187     BOOL opposite;
188   } cond;
189
190   BOOL flag;
191 } yystype;
192 # define YYSTYPE yystype
193 # define YYSTYPE_IS_TRIVIAL 1
194 #endif
195 #ifndef YYDEBUG
196 # define YYDEBUG 0
197 #endif
198
199
200
201 #define YYFINAL         208
202 #define YYFLAG          -32768
203 #define YYNTBASE        104
204
205 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
206 #define YYTRANSLATE(x) ((unsigned)(x) <= 342 ? yytranslate[x] : 114)
207
208 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
209 static const char yytranslate[] =
210 {
211        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
212        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
213        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
214        2,     2,     2,     2,     2,   101,     2,    81,    82,     2,
215       98,   103,    79,    77,    71,    78,    99,    80,     2,     2,
216        2,     2,     2,     2,     2,     2,     2,     2,   102,     2,
217        2,    72,     2,     2,     2,     2,     2,     2,     2,     2,
218        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
219        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
220        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
221        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
222        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
223        2,     2,     2,     2,    83,     2,    84,     2,     2,     2,
224        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
225        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
226        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
227        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
228        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
229        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
230        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
231        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
232        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
233        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
234        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
235        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
236        2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
237        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
238       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
239       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
240       36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
241       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
242       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
243       66,    67,    68,    69,    70,    73,    74,    75,    76,    85,
244       86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
245       96,    97,   100
246 };
247
248 #if YYDEBUG
249 static const short yyprhs[] =
250 {
251        0,     0,     1,     3,     5,     7,     9,    11,    13,    15,
252       17,    19,    21,    23,    25,    27,    29,    31,    33,    35,
253       38,    41,    43,    46,    49,    52,    57,    59,    62,    64,
254       66,    69,    73,    78,    81,    84,    86,    89,    91,    94,
255       96,    99,   101,   103,   106,   108,   111,   113,   116,   120,
256      123,   127,   130,   132,   135,   138,   141,   143,   145,   147,
257      149,   151,   153,   156,   159,   161,   164,   166,   169,   171,
258      174,   176,   179,   181,   184,   188,   190,   193,   196,   200,
259      203,   205,   209,   210,   214,   216,   218,   222,   226,   227,
260      232,   234,   236,   238,   240,   244,   249,   254,   259,   264,
261      269,   274,   275,   280,   281,   286,   289,   293,   297,   301,
262      305,   309,   313,   317,   320,   324,   328,   331,   334,   337,
263      340,   343,   347,   351,   355,   358,   361,   364,   367,   370,
264      373
265 };
266 static const short yyrhs[] =
267 {
268       -1,   101,     0,     9,     0,     6,     0,     7,     0,     8,
269        0,    10,     0,    11,     0,    40,     0,    39,     0,    42,
270        0,    43,     0,    44,     0,    45,     0,    41,     0,    12,
271        0,    13,     0,    46,     0,    19,   108,     0,    20,   108,
272        0,    54,     0,    55,     3,     0,    56,     3,     0,    57,
273        3,     0,    21,   108,    22,   108,     0,    60,     0,    60,
274      108,     0,    61,     0,    62,     0,    62,   108,     0,    23,
275      108,     3,     0,    23,   108,    84,     3,     0,    24,   108,
276        0,    25,   105,     0,    26,     0,    26,     3,     0,    27,
277        0,    27,     3,     0,    28,     0,    28,     3,     0,    29,
278        0,    30,     0,    30,     3,     0,    31,     0,    31,     3,
279        0,    32,     0,    33,   105,     0,    33,   105,    35,     0,
280       36,     3,     0,    37,     3,     3,     0,    34,     3,     0,
281       38,     0,    38,     3,     0,    58,     3,     0,    59,     3,
282        0,    14,     0,    15,     0,    16,     0,    17,     0,    18,
283        0,    47,     0,    47,     3,     0,    48,     3,     0,    50,
284        0,    50,     3,     0,    52,     0,    52,     3,     0,    51,
285        0,    51,     3,     0,    53,     0,    53,     3,     0,    49,
286        0,    49,     3,     0,    49,    78,     3,     0,     3,     0,
287       77,     3,     0,    78,     3,     0,     4,   102,     3,     0,
288       79,     3,     0,   111,     0,   106,    76,   111,     0,     0,
289      111,    71,   107,     0,   111,     0,   109,     0,   108,    71,
290      111,     0,   108,    71,   109,     0,     0,   111,     5,   110,
291      106,     0,     3,     0,    64,     0,    63,     0,    65,     0,
292      111,    72,   111,     0,    66,    98,   108,   103,     0,    67,
293       98,   108,   103,     0,    68,    98,   108,   103,     0,    69,
294       98,   108,   103,     0,    70,    98,   108,   103,     0,   111,
295       98,   107,   103,     0,     0,   111,    73,   112,   111,     0,
296        0,   111,    74,   113,   111,     0,    75,   111,     0,   111,
297       77,   111,     0,   111,    78,   111,     0,   111,    79,   111,
298        0,   111,    80,   111,     0,   111,    81,   111,     0,   111,
299       82,   111,     0,   111,    83,   111,     0,    84,   111,     0,
300      111,    85,   111,     0,   111,    86,   111,     0,    78,   111,
301        0,    94,   111,     0,   111,    94,     0,    95,   111,     0,
302      111,    95,     0,   111,    96,   111,     0,   111,    97,   111,
303        0,   111,    99,   111,     0,    88,   111,     0,    89,   111,
304        0,    90,   111,     0,    91,   111,     0,    92,   111,     0,
305       93,   111,     0,    98,   108,   103,     0
306 };
307
308 #endif
309
310 #if YYDEBUG
311 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
312 static const short yyrline[] =
313 {
314        0,   130,   132,   134,   142,   144,   146,   148,   150,   152,
315      154,   165,   167,   169,   171,   173,   175,   182,   189,   198,
316      200,   202,   204,   206,   208,   210,   212,   214,   216,   221,
317      239,   255,   257,   259,   261,   263,   265,   267,   269,   271,
318      273,   275,   277,   279,   281,   283,   285,   287,   289,   291,
319      293,   295,   297,   299,   301,   303,   305,   307,   309,   311,
320      313,   315,   317,   319,   321,   323,   325,   327,   329,   331,
321      333,   335,   337,   339,   341,   349,   350,   351,   352,   353,
322      357,   364,   377,   378,   382,   383,   384,   385,   389,   389,
323      394,   396,   398,   400,   403,   406,   408,   410,   412,   415,
324      425,   443,   443,   445,   445,   447,   450,   452,   454,   456,
325      458,   460,   462,   464,   467,   469,   472,   475,   477,   479,
326      481,   484,   486,   489,   497,   499,   501,   503,   505,   507,
327      509
328 };
329 #endif
330
331
332 #if (YYDEBUG) || defined YYERROR_VERBOSE
333
334 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
335 static const char *const yytname[] =
336 {
337   "$", "error", "$undefined.", "NUM", "DFILE", "CONDITION", "ALIAS", 
338   "RALIAS", "UNALIAS", "DUMPMEM", "AUTOMAP", "HELP", "UNDO", "REDO", 
339   "LANGUAGE", "INFOSOURCE", "INFOSOURCES", "COPYING", "WARRANTY", "PRINT", 
340   "SET", "MOVE", "TO", "GIVE", "REMOVE", "JUMP", "CONT", "STEP", "NEXT", 
341   "UNTIL", "STEPI", "NEXTI", "FINISH", "BREAK", "DELETE", "IF", "COND", 
342   "IGNORE", "BREAKPOINTS", "RESTORE", "RESTART", "QUIT", "RECORDON", 
343   "RECORDOFF", "REPLAY", "REPLAYOFF", "SYMBOL_FILE", "FRAME", 
344   "SELECT_FRAME", "BACKTRACE", "UP_FRAME", "DOWN_FRAME", "UP_SILENTLY", 
345   "DOWN_SILENTLY", "DISPLAY", "UNDISPLAY", "DISABLE_DISPLAY", 
346   "ENABLE_DISPLAY", "DISABLE_BREAK", "ENABLE_BREAK", "OBJECT_TREE", 
347   "FIND", "LIST_GLOBALS", "BTRUE", "BFALSE", "NOTHING", "PARENT", "CHILD", 
348   "SIBLING", "CHILDREN", "RANDOM", "','", "'='", "ANDAND", "OROR", 
349   "NOTNOT", "OR", "'+'", "'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'~'", 
350   "BYTEARRAY", "WORDARRAY", "precNEG", "NUMBER", "OBJECT", "ROUTINE", 
351   "STRING", "GLOBAL", "LOCAL", "INCREMENT", "DECREMENT", "PROPADDR", 
352   "PROPLENGTH", "'('", "'.'", "SUPERCLASS", "'#'", "':'", "')'", "input", 
353   "linespec", "orlist", "arglist", "commaexp", "condexp", "@1", "exp", 
354   "@2", "@3", 0
355 };
356 #endif
357
358 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
359 static const short yyr1[] =
360 {
361        0,   104,   104,   104,   104,   104,   104,   104,   104,   104,
362      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
363      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
364      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
365      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
366      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
367      104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
368      104,   104,   104,   104,   104,   105,   105,   105,   105,   105,
369      106,   106,   107,   107,   108,   108,   108,   108,   110,   109,
370      111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
371      111,   112,   111,   113,   111,   111,   111,   111,   111,   111,
372      111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
373      111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
374      111
375 };
376
377 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
378 static const short yyr2[] =
379 {
380        0,     0,     1,     1,     1,     1,     1,     1,     1,     1,
381        1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
382        2,     1,     2,     2,     2,     4,     1,     2,     1,     1,
383        2,     3,     4,     2,     2,     1,     2,     1,     2,     1,
384        2,     1,     1,     2,     1,     2,     1,     2,     3,     2,
385        3,     2,     1,     2,     2,     2,     1,     1,     1,     1,
386        1,     1,     2,     2,     1,     2,     1,     2,     1,     2,
387        1,     2,     1,     2,     3,     1,     2,     2,     3,     2,
388        1,     3,     0,     3,     1,     1,     3,     3,     0,     4,
389        1,     1,     1,     1,     3,     4,     4,     4,     4,     4,
390        4,     0,     4,     0,     4,     2,     3,     3,     3,     3,
391        3,     3,     3,     2,     3,     3,     2,     2,     2,     2,
392        2,     3,     3,     3,     2,     2,     2,     2,     2,     2,
393        3
394 };
395
396 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
397    doesn't specify something else to do.  Zero means the default is an
398    error. */
399 static const short yydefact[] =
400 {
401        1,     4,     5,     6,     3,     7,     8,    16,    17,    56,
402       57,    58,    59,    60,     0,     0,     0,     0,     0,     0,
403       35,    37,    39,    41,    42,    44,    46,     0,     0,     0,
404        0,    52,    10,     9,    15,    11,    12,    13,    14,    18,
405       61,     0,    72,    64,    68,    66,    70,    21,     0,     0,
406        0,     0,     0,    26,    28,    29,     2,    90,    92,    91,
407       93,     0,     0,     0,     0,     0,     0,     0,     0,     0,
408        0,     0,     0,     0,     0,     0,     0,     0,    19,    85,
409       84,    20,     0,     0,    33,    75,     0,     0,     0,     0,
410       34,    36,    38,    40,    43,    45,    47,    51,    49,     0,
411       53,    62,    63,    73,     0,    65,    69,    67,    71,    22,
412       23,    24,    54,    55,    27,    30,     0,     0,     0,     0,
413        0,   105,   116,   113,   124,   125,   126,   127,   128,   129,
414      117,   119,     0,     0,    88,     0,   101,   103,     0,     0,
415        0,     0,     0,     0,     0,     0,     0,   118,   120,     0,
416        0,    82,     0,     0,    31,     0,     0,    76,    77,    79,
417       48,    50,    74,     0,     0,     0,     0,     0,   130,    87,
418       86,     0,    94,     0,     0,   106,   107,   108,   109,   110,
419      111,   112,   114,   115,   121,   122,     0,     0,   123,    25,
420       32,    78,    95,    96,    97,    98,    99,    89,    80,   102,
421      104,   100,    82,     0,    83,    81,     0,     0,     0
422 };
423
424 static const short yydefgoto[] =
425 {
426      206,    90,   197,   186,    78,    79,   171,    80,   173,   174
427 };
428
429 static const short yypact[] =
430 {
431      136,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
432   -32768,-32768,-32768,-32768,   155,   155,   155,   155,   155,    15,
433       28,    33,    34,-32768,    44,    45,-32768,    15,    46,    47,
434       48,    55,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
435       56,    57,    13,    58,    60,    69,    71,-32768,    72,    83,
436       92,    93,    94,   155,-32768,   155,-32768,-32768,-32768,-32768,
437   -32768,   -59,     1,     2,     8,     9,   155,   155,   155,   155,
438      155,   155,   155,   155,   155,   155,   155,   155,    37,-32768,
439      194,    37,    -7,    14,    37,-32768,    18,   107,   126,   133,
440   -32768,-32768,-32768,-32768,-32768,-32768,   102,-32768,-32768,   168,
441   -32768,-32768,-32768,-32768,   199,-32768,-32768,-32768,-32768,-32768,
442   -32768,-32768,-32768,-32768,    37,    37,   155,   155,   155,   155,
443      155,    36,   -29,   115,   -29,   -29,   -29,   -29,   -29,   -29,
444       29,    29,   -51,   155,-32768,   155,-32768,-32768,   155,   155,
445      155,   155,   155,   155,   155,   155,   155,-32768,-32768,   155,
446      155,   155,   155,   155,-32768,   200,   201,-32768,-32768,-32768,
447   -32768,-32768,-32768,   -50,   -49,   -48,   -47,   -46,-32768,-32768,
448      194,   155,   251,   155,   155,   -53,   -53,   115,   115,   115,
449      115,   115,   -29,   -29,   -64,   -64,   103,   223,-32768,    37,
450   -32768,-32768,-32768,-32768,-32768,-32768,-32768,    63,   251,    36,
451       36,-32768,   155,   155,-32768,   251,   205,   207,-32768
452 };
453
454 static const short yypgoto[] =
455 {
456   -32768,   181,-32768,    24,   -15,    82,-32768,   -62,-32768,-32768
457 };
458
459
460 #define YYLAST          350
461
462
463 static const short yytable[] =
464 {
465       81,    82,    83,    84,   121,   122,   123,   124,   125,   126,
466      127,   128,   129,   130,   131,   153,   103,   154,    85,    86,
467      133,   133,   133,   133,   133,   133,   140,   141,   142,   143,
468      144,    91,   145,   146,   151,   152,    92,    93,   114,   116,
469      115,   147,   148,   149,   150,   151,   152,    94,    95,    97,
470       98,    99,   168,   192,   193,   194,   195,   196,   100,   101,
471      102,   105,   132,   106,   133,   147,   148,   149,   150,   151,
472      152,   170,   107,   172,   108,   109,   175,   176,   177,   178,
473      179,   180,   181,   182,   183,   133,   110,   184,   185,   187,
474      188,   104,    87,    88,    89,   111,   112,   113,   155,   117,
475      118,   163,   164,   165,   166,   167,   119,   120,   133,   198,
476      157,   199,   200,   138,   139,   140,   141,   142,   143,   144,
477      156,   145,   146,-32768,-32768,   149,   150,   151,   152,   158,
478      147,   148,   149,   150,   151,   152,   159,   160,   189,   203,
479      187,   205,     1,     2,     3,     4,     5,     6,     7,     8,
480        9,    10,    11,    12,    13,    14,    15,    16,    57,    17,
481       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
482       28,   161,    29,    30,    31,    32,    33,    34,    35,    36,
483       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
484       47,    48,    49,    50,    51,    52,    53,    54,    55,   134,
485      145,   146,   162,   190,   191,   207,   201,   208,    96,   147,
486      148,   149,   150,   151,   152,   169,     0,     0,    58,    59,
487       60,    61,    62,    63,    64,    65,   204,     0,     0,     0,
488       66,     0,     0,    67,     0,     0,     0,    56,     0,    68,
489        0,     0,     0,    69,    70,    71,    72,    73,    74,    75,
490       76,     0,     0,    77,     0,     0,     0,     0,     0,     0,
491        0,     0,     0,     0,     0,     0,   135,   136,   137,     0,
492        0,   138,   139,   140,   141,   142,   143,   144,     0,   145,
493      146,     0,     0,     0,     0,     0,     0,     0,   147,   148,
494      149,   150,   151,   152,   202,   135,   136,   137,     0,     0,
495      138,   139,   140,   141,   142,   143,   144,     0,   145,   146,
496        0,     0,     0,     0,     0,     0,     0,   147,   148,   149,
497      150,   151,   152,   135,   136,   137,     0,     0,   138,   139,
498      140,   141,   142,   143,   144,     0,   145,   146,     0,     0,
499        0,     0,     0,     0,     0,   147,   148,   149,   150,   151,
500      152
501 };
502
503 static const short yycheck[] =
504 {
505       15,    16,    17,    18,    66,    67,    68,    69,    70,    71,
506       72,    73,    74,    75,    76,    22,     3,     3,     3,     4,
507       71,    71,    71,    71,    71,    71,    79,    80,    81,    82,
508       83,     3,    85,    86,    98,    99,     3,     3,    53,    98,
509       55,    94,    95,    96,    97,    98,    99,     3,     3,     3,
510        3,     3,   103,   103,   103,   103,   103,   103,     3,     3,
511        3,     3,    77,     3,    71,    94,    95,    96,    97,    98,
512       99,   133,     3,   135,     3,     3,   138,   139,   140,   141,
513      142,   143,   144,   145,   146,    71,     3,   149,   150,   151,
514      152,    78,    77,    78,    79,     3,     3,     3,    84,    98,
515       98,   116,   117,   118,   119,   120,    98,    98,    71,   171,
516        3,   173,   174,    77,    78,    79,    80,    81,    82,    83,
517      102,    85,    86,    94,    95,    96,    97,    98,    99,     3,
518       94,    95,    96,    97,    98,    99,     3,    35,   153,    76,
519      202,   203,     6,     7,     8,     9,    10,    11,    12,    13,
520       14,    15,    16,    17,    18,    19,    20,    21,     3,    23,
521       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
522       34,     3,    36,    37,    38,    39,    40,    41,    42,    43,
523       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
524       54,    55,    56,    57,    58,    59,    60,    61,    62,     5,
525       85,    86,     3,     3,     3,     0,   103,     0,    27,    94,
526       95,    96,    97,    98,    99,   133,    -1,    -1,    63,    64,
527       65,    66,    67,    68,    69,    70,   202,    -1,    -1,    -1,
528       75,    -1,    -1,    78,    -1,    -1,    -1,   101,    -1,    84,
529       -1,    -1,    -1,    88,    89,    90,    91,    92,    93,    94,
530       95,    -1,    -1,    98,    -1,    -1,    -1,    -1,    -1,    -1,
531       -1,    -1,    -1,    -1,    -1,    -1,    72,    73,    74,    -1,
532       -1,    77,    78,    79,    80,    81,    82,    83,    -1,    85,
533       86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    94,    95,
534       96,    97,    98,    99,    71,    72,    73,    74,    -1,    -1,
535       77,    78,    79,    80,    81,    82,    83,    -1,    85,    86,
536       -1,    -1,    -1,    -1,    -1,    -1,    -1,    94,    95,    96,
537       97,    98,    99,    72,    73,    74,    -1,    -1,    77,    78,
538       79,    80,    81,    82,    83,    -1,    85,    86,    -1,    -1,
539       -1,    -1,    -1,    -1,    -1,    94,    95,    96,    97,    98,
540       99
541 };
542 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
543 #line 3 "/usr/share/bison/bison.simple"
544
545 /* Skeleton output parser for bison,
546
547    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
548    Foundation, Inc.
549
550    This program is free software; you can redistribute it and/or modify
551    it under the terms of the GNU General Public License as published by
552    the Free Software Foundation; either version 2, or (at your option)
553    any later version.
554
555    This program is distributed in the hope that it will be useful,
556    but WITHOUT ANY WARRANTY; without even the implied warranty of
557    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
558    GNU General Public License for more details.
559
560    You should have received a copy of the GNU General Public License
561    along with this program; if not, write to the Free Software
562    Foundation, Inc., 59 Temple Place - Suite 330,
563    Boston, MA 02111-1307, USA.  */
564
565 /* As a special exception, when this file is copied by Bison into a
566    Bison output file, you may use that output file without restriction.
567    This special exception was added by the Free Software Foundation
568    in version 1.24 of Bison.  */
569
570 /* This is the parser code that is written into each bison parser when
571    the %semantic_parser declaration is not specified in the grammar.
572    It was written by Richard Stallman by simplifying the hairy parser
573    used when %semantic_parser is specified.  */
574
575 /* All symbols defined below should begin with yy or YY, to avoid
576    infringing on user name space.  This should be done even for local
577    variables, as they might otherwise be expanded by user macros.
578    There are some unavoidable exceptions within include files to
579    define necessary library symbols; they are noted "INFRINGES ON
580    USER NAME SPACE" below.  */
581
582 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
583
584 /* The parser invokes alloca or malloc; define the necessary symbols.  */
585
586 # if YYSTACK_USE_ALLOCA
587 #  define YYSTACK_ALLOC alloca
588 # else
589 #  ifndef YYSTACK_USE_ALLOCA
590 #   if defined (alloca) || defined (_ALLOCA_H)
591 #    define YYSTACK_ALLOC alloca
592 #   else
593 #    ifdef __GNUC__
594 #     define YYSTACK_ALLOC __builtin_alloca
595 #    endif
596 #   endif
597 #  endif
598 # endif
599
600 # ifdef YYSTACK_ALLOC
601    /* Pacify GCC's `empty if-body' warning. */
602 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
603 # else
604 #  if defined (__STDC__) || defined (__cplusplus)
605 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
606 #   define YYSIZE_T size_t
607 #  endif
608 #  define YYSTACK_ALLOC malloc
609 #  define YYSTACK_FREE free
610 # endif
611 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
612
613
614 #if (! defined (yyoverflow) \
615      && (! defined (__cplusplus) \
616          || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
617
618 /* A type that is properly aligned for any stack member.  */
619 union yyalloc
620 {
621   short yyss;
622   YYSTYPE yyvs;
623 # if YYLSP_NEEDED
624   YYLTYPE yyls;
625 # endif
626 };
627
628 /* The size of the maximum gap between one aligned stack and the next.  */
629 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
630
631 /* The size of an array large to enough to hold all stacks, each with
632    N elements.  */
633 # if YYLSP_NEEDED
634 #  define YYSTACK_BYTES(N) \
635      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))      \
636       + 2 * YYSTACK_GAP_MAX)
637 # else
638 #  define YYSTACK_BYTES(N) \
639      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
640       + YYSTACK_GAP_MAX)
641 # endif
642
643 /* Copy COUNT objects from FROM to TO.  The source and destination do
644    not overlap.  */
645 # ifndef YYCOPY
646 #  if 1 < __GNUC__
647 #   define YYCOPY(To, From, Count) \
648       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
649 #  else
650 #   define YYCOPY(To, From, Count)              \
651       do                                        \
652         {                                       \
653           register YYSIZE_T yyi;                \
654           for (yyi = 0; yyi < (Count); yyi++)   \
655             (To)[yyi] = (From)[yyi];            \
656         }                                       \
657       while (0)
658 #  endif
659 # endif
660
661 /* Relocate STACK from its old location to the new one.  The
662    local variables YYSIZE and YYSTACKSIZE give the old and new number of
663    elements in the stack, and YYPTR gives the new location of the
664    stack.  Advance YYPTR to a properly aligned location for the next
665    stack.  */
666 # define YYSTACK_RELOCATE(Stack)                                        \
667     do                                                                  \
668       {                                                                 \
669         YYSIZE_T yynewbytes;                                            \
670         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
671         Stack = &yyptr->Stack;                                          \
672         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \
673         yyptr += yynewbytes / sizeof (*yyptr);                          \
674       }                                                                 \
675     while (0)
676
677 #endif
678
679
680 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
681 # define YYSIZE_T __SIZE_TYPE__
682 #endif
683 #if ! defined (YYSIZE_T) && defined (size_t)
684 # define YYSIZE_T size_t
685 #endif
686 #if ! defined (YYSIZE_T)
687 # if defined (__STDC__) || defined (__cplusplus)
688 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
689 #  define YYSIZE_T size_t
690 # endif
691 #endif
692 #if ! defined (YYSIZE_T)
693 # define YYSIZE_T unsigned int
694 #endif
695
696 #define yyerrok         (yyerrstatus = 0)
697 #define yyclearin       (yychar = YYEMPTY)
698 #define YYEMPTY         -2
699 #define YYEOF           0
700 #define YYACCEPT        goto yyacceptlab
701 #define YYABORT         goto yyabortlab
702 #define YYERROR         goto yyerrlab1
703 /* Like YYERROR except do call yyerror.  This remains here temporarily
704    to ease the transition to the new meaning of YYERROR, for GCC.
705    Once GCC version 2 has supplanted version 1, this can go.  */
706 #define YYFAIL          goto yyerrlab
707 #define YYRECOVERING()  (!!yyerrstatus)
708 #define YYBACKUP(Token, Value)                                  \
709 do                                                              \
710   if (yychar == YYEMPTY && yylen == 1)                          \
711     {                                                           \
712       yychar = (Token);                                         \
713       yylval = (Value);                                         \
714       yychar1 = YYTRANSLATE (yychar);                           \
715       YYPOPSTACK;                                               \
716       goto yybackup;                                            \
717     }                                                           \
718   else                                                          \
719     {                                                           \
720       yyerror ("syntax error: cannot back up");                 \
721       YYERROR;                                                  \
722     }                                                           \
723 while (0)
724
725 #define YYTERROR        1
726 #define YYERRCODE       256
727
728
729 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
730    are run).
731
732    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
733    first token.  By default, to implement support for ranges, extend
734    its range to the last symbol.  */
735
736 #ifndef YYLLOC_DEFAULT
737 # define YYLLOC_DEFAULT(Current, Rhs, N)        \
738    Current.last_line   = Rhs[N].last_line;      \
739    Current.last_column = Rhs[N].last_column;
740 #endif
741
742
743 /* YYLEX -- calling `yylex' with the right arguments.  */
744
745 #if YYPURE
746 # if YYLSP_NEEDED
747 #  ifdef YYLEX_PARAM
748 #   define YYLEX                yylex (&yylval, &yylloc, YYLEX_PARAM)
749 #  else
750 #   define YYLEX                yylex (&yylval, &yylloc)
751 #  endif
752 # else /* !YYLSP_NEEDED */
753 #  ifdef YYLEX_PARAM
754 #   define YYLEX                yylex (&yylval, YYLEX_PARAM)
755 #  else
756 #   define YYLEX                yylex (&yylval)
757 #  endif
758 # endif /* !YYLSP_NEEDED */
759 #else /* !YYPURE */
760 # define YYLEX                  yylex ()
761 #endif /* !YYPURE */
762
763
764 /* Enable debugging if requested.  */
765 #if YYDEBUG
766
767 # ifndef YYFPRINTF
768 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
769 #  define YYFPRINTF fprintf
770 # endif
771
772 # define YYDPRINTF(Args)                        \
773 do {                                            \
774   if (yydebug)                                  \
775     YYFPRINTF Args;                             \
776 } while (0)
777 /* Nonzero means print parse trace.  It is left uninitialized so that
778    multiple parsers can coexist.  */
779 int yydebug;
780 #else /* !YYDEBUG */
781 # define YYDPRINTF(Args)
782 #endif /* !YYDEBUG */
783
784 /* YYINITDEPTH -- initial size of the parser's stacks.  */
785 #ifndef YYINITDEPTH
786 # define YYINITDEPTH 200
787 #endif
788
789 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
790    if the built-in stack extension method is used).
791
792    Do not make this value too large; the results are undefined if
793    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
794    evaluated with infinite-precision integer arithmetic.  */
795
796 #if YYMAXDEPTH == 0
797 # undef YYMAXDEPTH
798 #endif
799
800 #ifndef YYMAXDEPTH
801 # define YYMAXDEPTH 10000
802 #endif
803 \f
804 #ifdef YYERROR_VERBOSE
805
806 # ifndef yystrlen
807 #  if defined (__GLIBC__) && defined (_STRING_H)
808 #   define yystrlen strlen
809 #  else
810 /* Return the length of YYSTR.  */
811 static YYSIZE_T
812 #   if defined (__STDC__) || defined (__cplusplus)
813 yystrlen (const char *yystr)
814 #   else
815 yystrlen (yystr)
816      const char *yystr;
817 #   endif
818 {
819   register const char *yys = yystr;
820
821   while (*yys++ != '\0')
822     continue;
823
824   return yys - yystr - 1;
825 }
826 #  endif
827 # endif
828
829 # ifndef yystpcpy
830 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
831 #   define yystpcpy stpcpy
832 #  else
833 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
834    YYDEST.  */
835 static char *
836 #   if defined (__STDC__) || defined (__cplusplus)
837 yystpcpy (char *yydest, const char *yysrc)
838 #   else
839 yystpcpy (yydest, yysrc)
840      char *yydest;
841      const char *yysrc;
842 #   endif
843 {
844   register char *yyd = yydest;
845   register const char *yys = yysrc;
846
847   while ((*yyd++ = *yys++) != '\0')
848     continue;
849
850   return yyd - 1;
851 }
852 #  endif
853 # endif
854 #endif
855 \f
856 #line 315 "/usr/share/bison/bison.simple"
857
858
859 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
860    into yyparse.  The argument should have type void *.
861    It should actually point to an object.
862    Grammar actions can access the variable by casting it
863    to the proper pointer type.  */
864
865 #ifdef YYPARSE_PARAM
866 # if defined (__STDC__) || defined (__cplusplus)
867 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
868 #  define YYPARSE_PARAM_DECL
869 # else
870 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
871 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
872 # endif
873 #else /* !YYPARSE_PARAM */
874 # define YYPARSE_PARAM_ARG
875 # define YYPARSE_PARAM_DECL
876 #endif /* !YYPARSE_PARAM */
877
878 /* Prevent warning if -Wstrict-prototypes.  */
879 #ifdef __GNUC__
880 # ifdef YYPARSE_PARAM
881 int yyparse (void *);
882 # else
883 int yyparse (void);
884 # endif
885 #endif
886
887 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
888    variables are global, or local to YYPARSE.  */
889
890 #define YY_DECL_NON_LSP_VARIABLES                       \
891 /* The lookahead symbol.  */                            \
892 int yychar;                                             \
893                                                         \
894 /* The semantic value of the lookahead symbol. */       \
895 YYSTYPE yylval;                                         \
896                                                         \
897 /* Number of parse errors so far.  */                   \
898 int yynerrs;
899
900 #if YYLSP_NEEDED
901 # define YY_DECL_VARIABLES                      \
902 YY_DECL_NON_LSP_VARIABLES                       \
903                                                 \
904 /* Location data for the lookahead symbol.  */  \
905 YYLTYPE yylloc;
906 #else
907 # define YY_DECL_VARIABLES                      \
908 YY_DECL_NON_LSP_VARIABLES
909 #endif
910
911
912 /* If nonreentrant, generate the variables here. */
913
914 #if !YYPURE
915 YY_DECL_VARIABLES
916 #endif  /* !YYPURE */
917
918 int
919 yyparse (YYPARSE_PARAM_ARG)
920      YYPARSE_PARAM_DECL
921 {
922   /* If reentrant, generate the variables here. */
923 #if YYPURE
924   YY_DECL_VARIABLES
925 #endif  /* !YYPURE */
926
927   register int yystate;
928   register int yyn;
929   int yyresult;
930   /* Number of tokens to shift before error messages enabled.  */
931   int yyerrstatus;
932   /* Lookahead token as an internal (translated) token number.  */
933   int yychar1 = 0;
934
935   /* Three stacks and their tools:
936      `yyss': related to states,
937      `yyvs': related to semantic values,
938      `yyls': related to locations.
939
940      Refer to the stacks thru separate pointers, to allow yyoverflow
941      to reallocate them elsewhere.  */
942
943   /* The state stack. */
944   short yyssa[YYINITDEPTH];
945   short *yyss = yyssa;
946   register short *yyssp;
947
948   /* The semantic value stack.  */
949   YYSTYPE yyvsa[YYINITDEPTH];
950   YYSTYPE *yyvs = yyvsa;
951   register YYSTYPE *yyvsp;
952
953 #if YYLSP_NEEDED
954   /* The location stack.  */
955   YYLTYPE yylsa[YYINITDEPTH];
956   YYLTYPE *yyls = yylsa;
957   YYLTYPE *yylsp;
958 #endif
959
960 #if YYLSP_NEEDED
961 # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
962 #else
963 # define YYPOPSTACK   (yyvsp--, yyssp--)
964 #endif
965
966   YYSIZE_T yystacksize = YYINITDEPTH;
967
968
969   /* The variables used to return semantic value and location from the
970      action routines.  */
971   YYSTYPE yyval;
972 #if YYLSP_NEEDED
973   YYLTYPE yyloc;
974 #endif
975
976   /* When reducing, the number of symbols on the RHS of the reduced
977      rule. */
978   int yylen;
979
980   YYDPRINTF ((stderr, "Starting parse\n"));
981
982   yystate = 0;
983   yyerrstatus = 0;
984   yynerrs = 0;
985   yychar = YYEMPTY;             /* Cause a token to be read.  */
986
987   /* Initialize stack pointers.
988      Waste one element of value and location stack
989      so that they stay on the same level as the state stack.
990      The wasted elements are never initialized.  */
991
992   yyssp = yyss;
993   yyvsp = yyvs;
994 #if YYLSP_NEEDED
995   yylsp = yyls;
996 #endif
997   goto yysetstate;
998
999 /*------------------------------------------------------------.
1000 | yynewstate -- Push a new state, which is found in yystate.  |
1001 `------------------------------------------------------------*/
1002  yynewstate:
1003   /* In all cases, when you get here, the value and location stacks
1004      have just been pushed. so pushing a state here evens the stacks.
1005      */
1006   yyssp++;
1007
1008  yysetstate:
1009   *yyssp = yystate;
1010
1011   if (yyssp >= yyss + yystacksize - 1)
1012     {
1013       /* Get the current used size of the three stacks, in elements.  */
1014       YYSIZE_T yysize = yyssp - yyss + 1;
1015
1016 #ifdef yyoverflow
1017       {
1018         /* Give user a chance to reallocate the stack. Use copies of
1019            these so that the &'s don't force the real ones into
1020            memory.  */
1021         YYSTYPE *yyvs1 = yyvs;
1022         short *yyss1 = yyss;
1023
1024         /* Each stack pointer address is followed by the size of the
1025            data in use in that stack, in bytes.  */
1026 # if YYLSP_NEEDED
1027         YYLTYPE *yyls1 = yyls;
1028         /* This used to be a conditional around just the two extra args,
1029            but that might be undefined if yyoverflow is a macro.  */
1030         yyoverflow ("parser stack overflow",
1031                     &yyss1, yysize * sizeof (*yyssp),
1032                     &yyvs1, yysize * sizeof (*yyvsp),
1033                     &yyls1, yysize * sizeof (*yylsp),
1034                     &yystacksize);
1035         yyls = yyls1;
1036 # else
1037         yyoverflow ("parser stack overflow",
1038                     &yyss1, yysize * sizeof (*yyssp),
1039                     &yyvs1, yysize * sizeof (*yyvsp),
1040                     &yystacksize);
1041 # endif
1042         yyss = yyss1;
1043         yyvs = yyvs1;
1044       }
1045 #else /* no yyoverflow */
1046 # ifndef YYSTACK_RELOCATE
1047       goto yyoverflowlab;
1048 # else
1049       /* Extend the stack our own way.  */
1050       if (yystacksize >= YYMAXDEPTH)
1051         goto yyoverflowlab;
1052       yystacksize *= 2;
1053       if (yystacksize > YYMAXDEPTH)
1054         yystacksize = YYMAXDEPTH;
1055
1056       {
1057         short *yyss1 = yyss;
1058         union yyalloc *yyptr =
1059           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1060         if (! yyptr)
1061           goto yyoverflowlab;
1062         YYSTACK_RELOCATE (yyss);
1063         YYSTACK_RELOCATE (yyvs);
1064 # if YYLSP_NEEDED
1065         YYSTACK_RELOCATE (yyls);
1066 # endif
1067 # undef YYSTACK_RELOCATE
1068         if (yyss1 != yyssa)
1069           YYSTACK_FREE (yyss1);
1070       }
1071 # endif
1072 #endif /* no yyoverflow */
1073
1074       yyssp = yyss + yysize - 1;
1075       yyvsp = yyvs + yysize - 1;
1076 #if YYLSP_NEEDED
1077       yylsp = yyls + yysize - 1;
1078 #endif
1079
1080       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1081                   (unsigned long int) yystacksize));
1082
1083       if (yyssp >= yyss + yystacksize - 1)
1084         YYABORT;
1085     }
1086
1087   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1088
1089   goto yybackup;
1090
1091
1092 /*-----------.
1093 | yybackup.  |
1094 `-----------*/
1095 yybackup:
1096
1097 /* Do appropriate processing given the current state.  */
1098 /* Read a lookahead token if we need one and don't already have one.  */
1099 /* yyresume: */
1100
1101   /* First try to decide what to do without reference to lookahead token.  */
1102
1103   yyn = yypact[yystate];
1104   if (yyn == YYFLAG)
1105     goto yydefault;
1106
1107   /* Not known => get a lookahead token if don't already have one.  */
1108
1109   /* yychar is either YYEMPTY or YYEOF
1110      or a valid token in external form.  */
1111
1112   if (yychar == YYEMPTY)
1113     {
1114       YYDPRINTF ((stderr, "Reading a token: "));
1115       yychar = YYLEX;
1116     }
1117
1118   /* Convert token to internal form (in yychar1) for indexing tables with */
1119
1120   if (yychar <= 0)              /* This means end of input. */
1121     {
1122       yychar1 = 0;
1123       yychar = YYEOF;           /* Don't call YYLEX any more */
1124
1125       YYDPRINTF ((stderr, "Now at end of input.\n"));
1126     }
1127   else
1128     {
1129       yychar1 = YYTRANSLATE (yychar);
1130
1131 #if YYDEBUG
1132      /* We have to keep this `#if YYDEBUG', since we use variables
1133         which are defined only if `YYDEBUG' is set.  */
1134       if (yydebug)
1135         {
1136           YYFPRINTF (stderr, "Next token is %d (%s",
1137                      yychar, yytname[yychar1]);
1138           /* Give the individual parser a way to print the precise
1139              meaning of a token, for further debugging info.  */
1140 # ifdef YYPRINT
1141           YYPRINT (stderr, yychar, yylval);
1142 # endif
1143           YYFPRINTF (stderr, ")\n");
1144         }
1145 #endif
1146     }
1147
1148   yyn += yychar1;
1149   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1150     goto yydefault;
1151
1152   yyn = yytable[yyn];
1153
1154   /* yyn is what to do for this token type in this state.
1155      Negative => reduce, -yyn is rule number.
1156      Positive => shift, yyn is new state.
1157        New state is final state => don't bother to shift,
1158        just return success.
1159      0, or most negative number => error.  */
1160
1161   if (yyn < 0)
1162     {
1163       if (yyn == YYFLAG)
1164         goto yyerrlab;
1165       yyn = -yyn;
1166       goto yyreduce;
1167     }
1168   else if (yyn == 0)
1169     goto yyerrlab;
1170
1171   if (yyn == YYFINAL)
1172     YYACCEPT;
1173
1174   /* Shift the lookahead token.  */
1175   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1176               yychar, yytname[yychar1]));
1177
1178   /* Discard the token being shifted unless it is eof.  */
1179   if (yychar != YYEOF)
1180     yychar = YYEMPTY;
1181
1182   *++yyvsp = yylval;
1183 #if YYLSP_NEEDED
1184   *++yylsp = yylloc;
1185 #endif
1186
1187   /* Count tokens shifted since error; after three, turn off error
1188      status.  */
1189   if (yyerrstatus)
1190     yyerrstatus--;
1191
1192   yystate = yyn;
1193   goto yynewstate;
1194
1195
1196 /*-----------------------------------------------------------.
1197 | yydefault -- do the default action for the current state.  |
1198 `-----------------------------------------------------------*/
1199 yydefault:
1200   yyn = yydefact[yystate];
1201   if (yyn == 0)
1202     goto yyerrlab;
1203   goto yyreduce;
1204
1205
1206 /*-----------------------------.
1207 | yyreduce -- Do a reduction.  |
1208 `-----------------------------*/
1209 yyreduce:
1210   /* yyn is the number of a rule to reduce with.  */
1211   yylen = yyr2[yyn];
1212
1213   /* If YYLEN is nonzero, implement the default value of the action:
1214      `$$ = $1'.
1215
1216      Otherwise, the following line sets YYVAL to the semantic value of
1217      the lookahead token.  This behavior is undocumented and Bison
1218      users should not rely upon it.  Assigning to YYVAL
1219      unconditionally makes the parser a bit smaller, and it avoids a
1220      GCC warning that YYVAL may be used uninitialized.  */
1221   yyval = yyvsp[1-yylen];
1222
1223 #if YYLSP_NEEDED
1224   /* Similarly for the default location.  Let the user run additional
1225      commands if for instance locations are ranges.  */
1226   yyloc = yylsp[1-yylen];
1227   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1228 #endif
1229
1230 #if YYDEBUG
1231   /* We have to keep this `#if YYDEBUG', since we use variables which
1232      are defined only if `YYDEBUG' is set.  */
1233   if (yydebug)
1234     {
1235       int yyi;
1236
1237       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1238                  yyn, yyrline[yyn]);
1239
1240       /* Print the symbols being reduced, and their result.  */
1241       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1242         YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1243       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1244     }
1245 #endif
1246
1247   switch (yyn) {
1248
1249 case 2:
1250 #line 132 "inform.y"
1251 { lex_offset = n_strlen(lex_expression); }
1252     break;
1253 case 3:
1254 #line 134 "inform.y"
1255 {
1256                 strid_t f;
1257                 f = n_file_name_or_prompt(fileusage_Data|fileusage_BinaryMode,
1258                                           filemode_Write, lex_tail());
1259                 w_glk_put_buffer_stream(f, (char *) z_memory, total_size);
1260                 glk_stream_close(f, NULL);
1261         }
1262     break;
1263 case 4:
1264 #line 142 "inform.y"
1265 { parse_new_alias(lex_tail(), FALSE); }
1266     break;
1267 case 5:
1268 #line 144 "inform.y"
1269 { parse_new_alias(lex_tail(), TRUE); }
1270     break;
1271 case 6:
1272 #line 146 "inform.y"
1273 { remove_alias(lex_tail()); }
1274     break;
1275 case 7:
1276 #line 148 "inform.y"
1277 { automap_init(object_count, lex_tail()); }
1278     break;
1279 case 8:
1280 #line 150 "inform.y"
1281 { inform_help(); }
1282     break;
1283 case 9:
1284 #line 152 "inform.y"
1285 { op_restart(); exit_debugger = TRUE; read_abort = TRUE;  }
1286     break;
1287 case 10:
1288 #line 154 "inform.y"
1289 {
1290                 if(restoregame()) {
1291                   exit_debugger = TRUE; read_abort = TRUE;
1292                   if(zversion <= 3)
1293                     mop_take_branch();
1294                   else
1295                     mop_store_result(2);
1296                 } else {
1297                   infix_print_string("Restore failed.\n");
1298                 } }
1299     break;
1300 case 11:
1301 #line 165 "inform.y"
1302 { zword oldop0 = operand[0]; operand[0] = 4; op_output_stream(); operand[0] = oldop0; }
1303     break;
1304 case 12:
1305 #line 167 "inform.y"
1306 { zword oldop0 = operand[0]; operand[0] = neg(4); op_output_stream(); operand[0] = oldop0; }
1307     break;
1308 case 13:
1309 #line 169 "inform.y"
1310 { zword oldop0 = operand[0]; operand[0] = 1; op_input_stream(); operand[0] = oldop0; exit_debugger = TRUE; }
1311     break;
1312 case 14:
1313 #line 171 "inform.y"
1314 { zword oldop0 = operand[0]; operand[0] = 0; op_input_stream(); operand[0] = oldop0; }
1315     break;
1316 case 15:
1317 #line 173 "inform.y"
1318 { z_close(); glk_exit();        }
1319     break;
1320 case 16:
1321 #line 175 "inform.y"
1322 {
1323                 if(restoreundo()) {
1324                   read_abort = TRUE; exit_debugger = TRUE;
1325                 } else {
1326                   infix_print_string("No undo slots.\n");
1327                 } }
1328     break;
1329 case 17:
1330 #line 182 "inform.y"
1331 {
1332                 if(restoreredo()) {
1333                   read_abort = TRUE; exit_debugger = TRUE;
1334                 } else {
1335                   infix_print_string("No redo slots.\n");
1336                 } }
1337     break;
1338 case 18:
1339 #line 189 "inform.y"
1340 {
1341                 strid_t f;
1342                 f = n_file_name_or_prompt(fileusage_Data|fileusage_BinaryMode,
1343                                           filemode_Read, lex_tail());
1344                 if(f) {
1345                   kill_infix();
1346                   init_infix(f);
1347                 } }
1348     break;
1349 case 19:
1350 #line 198 "inform.y"
1351 { infix_display(yyvsp[0].val);          }
1352     break;
1353 case 20:
1354 #line 200 "inform.y"
1355 { inform_result = yyvsp[0].val;         }
1356     break;
1357 case 21:
1358 #line 202 "inform.y"
1359 { infix_auto_display(lex_tail()); }
1360     break;
1361 case 22:
1362 #line 204 "inform.y"
1363 { infix_auto_undisplay(yyvsp[0].val.v); }
1364     break;
1365 case 23:
1366 #line 206 "inform.y"
1367 { infix_set_display_enabled(yyvsp[0].val.v, FALSE); }
1368     break;
1369 case 24:
1370 #line 208 "inform.y"
1371 { infix_set_display_enabled(yyvsp[0].val.v, TRUE); }
1372     break;
1373 case 25:
1374 #line 210 "inform.y"
1375 { infix_move(yyvsp[0].val.v, yyvsp[-2].val.v);  }
1376     break;
1377 case 26:
1378 #line 212 "inform.y"
1379 { infix_object_tree(0);         }
1380     break;
1381 case 27:
1382 #line 214 "inform.y"
1383 { infix_object_tree(yyvsp[0].val.v);    }
1384     break;
1385 case 28:
1386 #line 216 "inform.y"
1387 {
1388                 if(lex_expression[lex_offset])
1389                   infix_object_find(lex_tail());
1390         }
1391     break;
1392 case 29:
1393 #line 221 "inform.y"
1394 {
1395                 z_typed v; v.t = Z_GLOBAL;
1396                 for(v.o = 0; v.o <= 245; v.o++) {
1397                   const char *name = infix_get_name(v);
1398                   if(v.o) infix_print_string("; ");
1399                   if(name) {
1400                     infix_print_string(name);
1401                   } else {
1402                     infix_print_char('G');
1403                     infix_print_number(v.o);
1404                   }
1405                   infix_print_char('=');
1406                   infix_get_val(&v);
1407                   infix_print_number(v.v);
1408                 }
1409                 infix_print_char(10);
1410         }
1411     break;
1412 case 30:
1413 #line 239 "inform.y"
1414 {
1415                 z_typed v; v.t = Z_GLOBAL;
1416                 for(v.o = 0; v.o <= 245; v.o++) {
1417                   infix_get_val(&v);
1418                   if(v.v == yyvsp[0].val.v) {
1419                     const char *name = infix_get_name(v);
1420                     if(name) {
1421                       infix_print_string(name);
1422                     } else {
1423                       infix_print_char('G');
1424                       infix_print_number(v.o);
1425                     }
1426                     infix_print_char(10);
1427                   }
1428                 } }
1429     break;
1430 case 31:
1431 #line 255 "inform.y"
1432 { infix_set_attrib(yyvsp[-1].val.v, yyvsp[0].val.v);    }
1433     break;
1434 case 32:
1435 #line 257 "inform.y"
1436 { infix_clear_attrib(yyvsp[-2].val.v, yyvsp[0].val.v); }
1437     break;
1438 case 33:
1439 #line 259 "inform.y"
1440 { infix_remove(yyvsp[0].val.v);         }
1441     break;
1442 case 34:
1443 #line 261 "inform.y"
1444 { PC=yyvsp[0].pcoffset; exit_debugger = TRUE;   }
1445     break;
1446 case 35:
1447 #line 263 "inform.y"
1448 { set_step(CONT_GO, 1); }
1449     break;
1450 case 36:
1451 #line 265 "inform.y"
1452 { set_step(CONT_GO, 1); infix_set_ignore(cur_break, yyvsp[0].val.v); }
1453     break;
1454 case 37:
1455 #line 267 "inform.y"
1456 { set_step(CONT_STEP, 1); }
1457     break;
1458 case 38:
1459 #line 269 "inform.y"
1460 { set_step(CONT_STEP, yyvsp[0].val.v); }
1461     break;
1462 case 39:
1463 #line 271 "inform.y"
1464 { set_step(CONT_NEXT, 1); }
1465     break;
1466 case 40:
1467 #line 273 "inform.y"
1468 { set_step(CONT_NEXT, yyvsp[0].val.v); }
1469     break;
1470 case 41:
1471 #line 275 "inform.y"
1472 { set_step(CONT_UNTIL, 1); }
1473     break;
1474 case 42:
1475 #line 277 "inform.y"
1476 { set_step(CONT_STEPI, 1); }
1477     break;
1478 case 43:
1479 #line 279 "inform.y"
1480 { set_step(CONT_STEPI, yyvsp[0].val.v); }
1481     break;
1482 case 44:
1483 #line 281 "inform.y"
1484 { set_step(CONT_NEXTI, 1); }
1485     break;
1486 case 45:
1487 #line 283 "inform.y"
1488 { set_step(CONT_NEXTI, yyvsp[0].val.v); }
1489     break;
1490 case 46:
1491 #line 285 "inform.y"
1492 { set_step(CONT_FINISH, 1); }
1493     break;
1494 case 47:
1495 #line 287 "inform.y"
1496 { infix_set_break(yyvsp[0].pcoffset);   }
1497     break;
1498 case 48:
1499 #line 289 "inform.y"
1500 { int n = infix_set_break(yyvsp[-1].pcoffset); infix_set_cond(n, lex_tail()); }
1501     break;
1502 case 49:
1503 #line 291 "inform.y"
1504 { infix_set_cond(yyvsp[0].val.v, lex_tail()); }
1505     break;
1506 case 50:
1507 #line 293 "inform.y"
1508 { infix_set_ignore(yyvsp[-1].val.v, yyvsp[0].val.v);    }
1509     break;
1510 case 51:
1511 #line 295 "inform.y"
1512 { infix_delete_breakpoint(yyvsp[0].val.v); }
1513     break;
1514 case 52:
1515 #line 297 "inform.y"
1516 { infix_show_all_breakpoints(); }
1517     break;
1518 case 53:
1519 #line 299 "inform.y"
1520 { infix_show_breakpoint(yyvsp[0].val.v);        }
1521     break;
1522 case 54:
1523 #line 301 "inform.y"
1524 { infix_set_break_enabled(yyvsp[0].val.v, FALSE); }
1525     break;
1526 case 55:
1527 #line 303 "inform.y"
1528 { infix_set_break_enabled(yyvsp[0].val.v, TRUE); }
1529     break;
1530 case 56:
1531 #line 305 "inform.y"
1532 { infix_print_string("The current source language is \"inform\".\n"); }
1533     break;
1534 case 57:
1535 #line 307 "inform.y"
1536 { infix_print_string("Current source file is "); infix_print_string(cur_file?cur_file->filename:"unknown"); infix_print_string("\nContains "); infix_print_number(cur_file?cur_file->num_lines:0); infix_print_string(" lines.\nSource language is inform.\n"); }
1537     break;
1538 case 58:
1539 #line 309 "inform.y"
1540 { infix_print_string("Source files for which symbols have been read in:\n\n"); infix_list_files(); infix_print_char('\n'); }
1541     break;
1542 case 59:
1543 #line 311 "inform.y"
1544 { show_copying(); }
1545     break;
1546 case 60:
1547 #line 313 "inform.y"
1548 { show_warranty(); }
1549     break;
1550 case 61:
1551 #line 315 "inform.y"
1552 { infix_show_frame(infix_selected_frame); }
1553     break;
1554 case 62:
1555 #line 317 "inform.y"
1556 { infix_select_frame(yyvsp[0].val.v); infix_show_frame(yyvsp[0].val.v); }
1557     break;
1558 case 63:
1559 #line 319 "inform.y"
1560 { infix_select_frame(yyvsp[0].val.v); }
1561     break;
1562 case 64:
1563 #line 321 "inform.y"
1564 { infix_select_frame(infix_selected_frame - 1); infix_show_frame(infix_selected_frame); }
1565     break;
1566 case 65:
1567 #line 323 "inform.y"
1568 { infix_select_frame(infix_selected_frame - yyvsp[0].val.v); infix_show_frame(infix_selected_frame); }
1569     break;
1570 case 66:
1571 #line 325 "inform.y"
1572 { infix_select_frame(infix_selected_frame - 1); }
1573     break;
1574 case 67:
1575 #line 327 "inform.y"
1576 { infix_select_frame(infix_selected_frame - yyvsp[0].val.v); }
1577     break;
1578 case 68:
1579 #line 329 "inform.y"
1580 { infix_select_frame(infix_selected_frame + 1); infix_show_frame(infix_selected_frame); }
1581     break;
1582 case 69:
1583 #line 331 "inform.y"
1584 { infix_select_frame(infix_selected_frame + yyvsp[0].val.v); infix_show_frame(infix_selected_frame); }
1585     break;
1586 case 70:
1587 #line 333 "inform.y"
1588 { infix_select_frame(infix_selected_frame + 1); }
1589     break;
1590 case 71:
1591 #line 335 "inform.y"
1592 { infix_select_frame(infix_selected_frame + yyvsp[0].val.v); }
1593     break;
1594 case 72:
1595 #line 337 "inform.y"
1596 { infix_backtrace(0, stack_get_depth()); }
1597     break;
1598 case 73:
1599 #line 339 "inform.y"
1600 { infix_backtrace(stack_get_depth() - yyvsp[0].val.v, yyvsp[0].val.v); }
1601     break;
1602 case 74:
1603 #line 341 "inform.y"
1604 { infix_backtrace(0, yyvsp[0].val.v); }
1605     break;
1606 case 75:
1607 #line 349 "inform.y"
1608 { if(yyvsp[0].val.t == Z_ROUTINE) yyval.pcoffset = infix_get_routine_PC(yyvsp[0].val.v); else { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", yyvsp[0].val.v); yyval.pcoffset = l.thisPC; } }
1609     break;
1610 case 76:
1611 #line 350 "inform.y"
1612 { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line + yyvsp[0].val.v); yyval.pcoffset = l.thisPC; }
1613     break;
1614 case 77:
1615 #line 351 "inform.y"
1616 { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line - yyvsp[0].val.v); yyval.pcoffset = l.thisPC; }
1617     break;
1618 case 78:
1619 #line 352 "inform.y"
1620 { if(yyvsp[0].val.t == Z_ROUTINE) yyval.pcoffset = UNPACKR(yyvsp[0].val.v); else { infix_location l; infix_decode_fileloc(&l, yyvsp[-2].filenum->filename, yyvsp[0].val.v); yyval.pcoffset = l.thisPC; } }
1621     break;
1622 case 79:
1623 #line 353 "inform.y"
1624 { yyval.pcoffset = yyvsp[0].val.v;                      }
1625     break;
1626 case 80:
1627 #line 357 "inform.y"
1628 {
1629                 if(condlist->condfunc(condlist->val, yyvsp[0].val.v) ^ condlist->opposite) {
1630                    yyval.flag = TRUE;
1631                    ignoreeffects++;
1632                 } else
1633                    yyval.flag = FALSE;
1634             }
1635     break;
1636 case 81:
1637 #line 364 "inform.y"
1638 {
1639                 if(yyvsp[-2].flag)
1640                   yyval.flag = TRUE;
1641                 else {
1642                   if(condlist->condfunc(condlist->val, yyvsp[0].val.v) ^ condlist->opposite) {
1643                     yyval.flag = TRUE;
1644                     ignoreeffects++;
1645                   }
1646                   else yyval.flag = FALSE;
1647                 } }
1648     break;
1649 case 82:
1650 #line 377 "inform.y"
1651 { yyval.zlist = NULL; }
1652     break;
1653 case 83:
1654 #line 378 "inform.y"
1655 { zword_list g; yyval.zlist = yyvsp[0].zlist; g.item = yyvsp[-2].val.v; LEaddm(yyval.zlist, g, n_rmmalloc); }
1656     break;
1657 case 86:
1658 #line 384 "inform.y"
1659 { yyval.val = yyvsp[0].val;                     }
1660     break;
1661 case 87:
1662 #line 385 "inform.y"
1663 { yyval.val = yyvsp[0].val;                     }
1664     break;
1665 case 88:
1666 #line 390 "inform.y"
1667 { cond_list newcond; newcond.val = yyvsp[-1].val.v; newcond.condfunc = yyvsp[0].cond.condfunc; newcond.opposite = yyvsp[0].cond.opposite; LEaddm(condlist, newcond, n_rmmalloc); }
1668     break;
1669 case 89:
1670 #line 390 "inform.y"
1671 { if(yyvsp[0].flag) ignoreeffects--; yyval.val.v = yyvsp[0].flag; yyval.val.t = Z_BOOLEAN; LEremovem(condlist, n_rmfreeone); }
1672     break;
1673 case 90:
1674 #line 395 "inform.y"
1675 { yyval.val = yyvsp[0].val;                             }
1676     break;
1677 case 91:
1678 #line 397 "inform.y"
1679 { yyval.val.v = 0; yyval.val.t = Z_BOOLEAN;             }
1680     break;
1681 case 92:
1682 #line 399 "inform.y"
1683 { yyval.val.v = 1; yyval.val.t = Z_BOOLEAN;             }
1684     break;
1685 case 93:
1686 #line 401 "inform.y"
1687 { yyval.val.v = 0; yyval.val.t = Z_OBJECT;              }
1688     break;
1689 case 94:
1690 #line 404 "inform.y"
1691 { yyval.val = yyvsp[0].val; infix_assign(&yyvsp[-2].val, yyvsp[0].val.v);       }
1692     break;
1693 case 95:
1694 #line 407 "inform.y"
1695 { yyval.val.v = infix_parent(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
1696     break;
1697 case 96:
1698 #line 409 "inform.y"
1699 { yyval.val.v = infix_child(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
1700     break;
1701 case 97:
1702 #line 411 "inform.y"
1703 { yyval.val.v = infix_sibling(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
1704     break;
1705 case 98:
1706 #line 413 "inform.y"
1707 { int n = 0; zword o = infix_child(yyvsp[-1].val.v); while(o) { n++; o = infix_sibling(o); } yyval.val.v = n; yyval.val.t = Z_NUMBER; }
1708     break;
1709 case 99:
1710 #line 416 "inform.y"
1711 {
1712                   if(!ignoreeffects) {
1713                     yyval.val.v = z_random(yyvsp[-1].val.v);
1714                     yyval.val.t = Z_NUMBER;
1715                   } else {
1716                     yyval.val.v = 0;
1717                     yyval.val.t = Z_UNKNOWN;
1718                   }
1719                 }
1720     break;
1721 case 100:
1722 #line 426 "inform.y"
1723 {
1724                 zword locals[16];
1725                 int i = 0;
1726                 zword_list *p;
1727                 if(!ignoreeffects) {
1728                   for(p = yyvsp[-1].zlist; p && i < 16; p=p->next) {
1729                     locals[i++] = p->item;
1730                   }
1731                   mop_call(yyvsp[-3].val.v, i, locals, -2);
1732                   decode();
1733                   exit_decoder = FALSE;
1734                   yyval.val.v = time_ret; yyval.val.t = Z_UNKNOWN;
1735                 } else {
1736                   yyval.val.v = 0; yyval.val.t = Z_UNKNOWN;
1737                 }
1738               }
1739     break;
1740 case 101:
1741 #line 443 "inform.y"
1742 { if(yyvsp[-1].val.v == 0) ignoreeffects++; }
1743     break;
1744 case 102:
1745 #line 444 "inform.y"
1746 { if(yyvsp[-3].val.v == 0) ignoreeffects--; yyval.val = z_t(yyvsp[-3].val, yyvsp[0].val, yyvsp[-3].val.v && yyvsp[0].val.v);    }
1747     break;
1748 case 103:
1749 #line 445 "inform.y"
1750 { if(yyvsp[-1].val.v != 0) ignoreeffects++; }
1751     break;
1752 case 104:
1753 #line 446 "inform.y"
1754 { if(yyvsp[-3].val.v != 0) ignoreeffects--; yyval.val = z_t(yyvsp[-3].val, yyvsp[0].val, yyvsp[-3].val.v || yyvsp[0].val.v);    }
1755     break;
1756 case 105:
1757 #line 448 "inform.y"
1758 { yyval.val.v = !(yyvsp[0].val.v); yyval.val.t = Z_NUMBER;      }
1759     break;
1760 case 106:
1761 #line 451 "inform.y"
1762 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v + yyvsp[0].val.v);       }
1763     break;
1764 case 107:
1765 #line 453 "inform.y"
1766 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v + neg(yyvsp[0].val.v));  }
1767     break;
1768 case 108:
1769 #line 455 "inform.y"
1770 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, z_mult(yyvsp[-2].val.v, yyvsp[0].val.v));        }
1771     break;
1772 case 109:
1773 #line 457 "inform.y"
1774 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, z_div(yyvsp[-2].val.v, yyvsp[0].val.v)); }
1775     break;
1776 case 110:
1777 #line 459 "inform.y"
1778 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, z_mod(yyvsp[-2].val.v, yyvsp[0].val.v)); }
1779     break;
1780 case 111:
1781 #line 461 "inform.y"
1782 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v & yyvsp[0].val.v);       }
1783     break;
1784 case 112:
1785 #line 463 "inform.y"
1786 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v | yyvsp[0].val.v);       }
1787     break;
1788 case 113:
1789 #line 465 "inform.y"
1790 { yyval.val = z_t(yyvsp[0].val, yyvsp[0].val, ~yyvsp[0].val.v);         }
1791     break;
1792 case 114:
1793 #line 468 "inform.y"
1794 { yyval.val.t = Z_BYTEARRAY; yyval.val.o = yyvsp[-2].val.v; yyval.val.p = yyvsp[0].val.v; infix_get_val(&yyval.val); }
1795     break;
1796 case 115:
1797 #line 470 "inform.y"
1798 { yyval.val.t = Z_WORDARRAY; yyval.val.o = yyvsp[-2].val.v; yyval.val.p = yyvsp[0].val.v; infix_get_val(&yyval.val);    }
1799     break;
1800 case 116:
1801 #line 473 "inform.y"
1802 { yyval.val = z_t(yyvsp[0].val, yyvsp[0].val, neg(yyvsp[0].val.v));             }
1803     break;
1804 case 117:
1805 #line 476 "inform.y"
1806 { if(!ignoreeffects) infix_assign(&yyvsp[0].val, ARITHMASK(yyvsp[0].val.v + 1)); yyval.val = yyvsp[0].val; }
1807     break;
1808 case 118:
1809 #line 478 "inform.y"
1810 { yyval.val = yyvsp[-1].val; if(!ignoreeffects) infix_assign(&yyvsp[-1].val, ARITHMASK(yyvsp[-1].val.v + 1)); }
1811     break;
1812 case 119:
1813 #line 480 "inform.y"
1814 { if(!ignoreeffects) infix_assign(&yyvsp[0].val, ARITHMASK(yyvsp[0].val.v + neg(1))); yyval.val = yyvsp[0].val; }
1815     break;
1816 case 120:
1817 #line 482 "inform.y"
1818 { yyval.val = yyvsp[-1].val; if(!ignoreeffects) infix_assign(&yyvsp[-1].val, ARITHMASK(yyvsp[-1].val.v + neg(1))); }
1819     break;
1820 case 121:
1821 #line 485 "inform.y"
1822 { zword len; yyval.val.v = infix_get_proptable(yyvsp[-2].val.v, yyvsp[0].val.v, &len); yyval.val.t = Z_NUMBER; }
1823     break;
1824 case 122:
1825 #line 487 "inform.y"
1826 { infix_get_proptable(yyvsp[-2].val.v, yyvsp[0].val.v, &yyval.val.v); yyval.val.t = Z_NUMBER; }
1827     break;
1828 case 123:
1829 #line 490 "inform.y"
1830 { yyval.val.t = Z_OBJPROP; yyval.val.o = yyvsp[-2].val.v; yyval.val.p = yyvsp[0].val.v; infix_get_val(&yyval.val); }
1831     break;
1832 case 124:
1833 #line 498 "inform.y"
1834 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_NUMBER;         }
1835     break;
1836 case 125:
1837 #line 500 "inform.y"
1838 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_OBJECT;         }
1839     break;
1840 case 126:
1841 #line 502 "inform.y"
1842 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_ROUTINE;        }
1843     break;
1844 case 127:
1845 #line 504 "inform.y"
1846 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_STRING;         }
1847     break;
1848 case 128:
1849 #line 506 "inform.y"
1850 { yyval.val.t = Z_WORDARRAY; yyval.val.o = z_globaltable; yyval.val.p = yyvsp[0].val.v; infix_get_val(&yyval.val); }
1851     break;
1852 case 129:
1853 #line 508 "inform.y"
1854 { yyval.val.t = Z_LOCAL; yyval.val.o = infix_selected_frame; yyval.val.p = yyvsp[0].val.v; infix_get_val(&yyval.val); }
1855     break;
1856 case 130:
1857 #line 510 "inform.y"
1858 { yyval.val = yyvsp[-1].val;                            }
1859     break;
1860 }
1861
1862 #line 705 "/usr/share/bison/bison.simple"
1863
1864 \f
1865   yyvsp -= yylen;
1866   yyssp -= yylen;
1867 #if YYLSP_NEEDED
1868   yylsp -= yylen;
1869 #endif
1870
1871 #if YYDEBUG
1872   if (yydebug)
1873     {
1874       short *yyssp1 = yyss - 1;
1875       YYFPRINTF (stderr, "state stack now");
1876       while (yyssp1 != yyssp)
1877         YYFPRINTF (stderr, " %d", *++yyssp1);
1878       YYFPRINTF (stderr, "\n");
1879     }
1880 #endif
1881
1882   *++yyvsp = yyval;
1883 #if YYLSP_NEEDED
1884   *++yylsp = yyloc;
1885 #endif
1886
1887   /* Now `shift' the result of the reduction.  Determine what state
1888      that goes to, based on the state we popped back to and the rule
1889      number reduced by.  */
1890
1891   yyn = yyr1[yyn];
1892
1893   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1894   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1895     yystate = yytable[yystate];
1896   else
1897     yystate = yydefgoto[yyn - YYNTBASE];
1898
1899   goto yynewstate;
1900
1901
1902 /*------------------------------------.
1903 | yyerrlab -- here on detecting error |
1904 `------------------------------------*/
1905 yyerrlab:
1906   /* If not already recovering from an error, report this error.  */
1907   if (!yyerrstatus)
1908     {
1909       ++yynerrs;
1910
1911 #ifdef YYERROR_VERBOSE
1912       yyn = yypact[yystate];
1913
1914       if (yyn > YYFLAG && yyn < YYLAST)
1915         {
1916           YYSIZE_T yysize = 0;
1917           char *yymsg;
1918           int yyx, yycount;
1919
1920           yycount = 0;
1921           /* Start YYX at -YYN if negative to avoid negative indexes in
1922              YYCHECK.  */
1923           for (yyx = yyn < 0 ? -yyn : 0;
1924                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1925             if (yycheck[yyx + yyn] == yyx)
1926               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1927           yysize += yystrlen ("parse error, unexpected ") + 1;
1928           yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1929           yymsg = (char *) YYSTACK_ALLOC (yysize);
1930           if (yymsg != 0)
1931             {
1932               char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1933               yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1934
1935               if (yycount < 5)
1936                 {
1937                   yycount = 0;
1938                   for (yyx = yyn < 0 ? -yyn : 0;
1939                        yyx < (int) (sizeof (yytname) / sizeof (char *));
1940                        yyx++)
1941                     if (yycheck[yyx + yyn] == yyx)
1942                       {
1943                         const char *yyq = ! yycount ? ", expecting " : " or ";
1944                         yyp = yystpcpy (yyp, yyq);
1945                         yyp = yystpcpy (yyp, yytname[yyx]);
1946                         yycount++;
1947                       }
1948                 }
1949               yyerror (yymsg);
1950               YYSTACK_FREE (yymsg);
1951             }
1952           else
1953             yyerror ("parse error; also virtual memory exhausted");
1954         }
1955       else
1956 #endif /* defined (YYERROR_VERBOSE) */
1957         yyerror ("parse error");
1958     }
1959   goto yyerrlab1;
1960
1961
1962 /*--------------------------------------------------.
1963 | yyerrlab1 -- error raised explicitly by an action |
1964 `--------------------------------------------------*/
1965 yyerrlab1:
1966   if (yyerrstatus == 3)
1967     {
1968       /* If just tried and failed to reuse lookahead token after an
1969          error, discard it.  */
1970
1971       /* return failure if at end of input */
1972       if (yychar == YYEOF)
1973         YYABORT;
1974       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1975                   yychar, yytname[yychar1]));
1976       yychar = YYEMPTY;
1977     }
1978
1979   /* Else will try to reuse lookahead token after shifting the error
1980      token.  */
1981
1982   yyerrstatus = 3;              /* Each real token shifted decrements this */
1983
1984   goto yyerrhandle;
1985
1986
1987 /*-------------------------------------------------------------------.
1988 | yyerrdefault -- current state does not do anything special for the |
1989 | error token.                                                       |
1990 `-------------------------------------------------------------------*/
1991 yyerrdefault:
1992 #if 0
1993   /* This is wrong; only states that explicitly want error tokens
1994      should shift them.  */
1995
1996   /* If its default is to accept any token, ok.  Otherwise pop it.  */
1997   yyn = yydefact[yystate];
1998   if (yyn)
1999     goto yydefault;
2000 #endif
2001
2002
2003 /*---------------------------------------------------------------.
2004 | yyerrpop -- pop the current state because it cannot handle the |
2005 | error token                                                    |
2006 `---------------------------------------------------------------*/
2007 yyerrpop:
2008   if (yyssp == yyss)
2009     YYABORT;
2010   yyvsp--;
2011   yystate = *--yyssp;
2012 #if YYLSP_NEEDED
2013   yylsp--;
2014 #endif
2015
2016 #if YYDEBUG
2017   if (yydebug)
2018     {
2019       short *yyssp1 = yyss - 1;
2020       YYFPRINTF (stderr, "Error: state stack now");
2021       while (yyssp1 != yyssp)
2022         YYFPRINTF (stderr, " %d", *++yyssp1);
2023       YYFPRINTF (stderr, "\n");
2024     }
2025 #endif
2026
2027 /*--------------.
2028 | yyerrhandle.  |
2029 `--------------*/
2030 yyerrhandle:
2031   yyn = yypact[yystate];
2032   if (yyn == YYFLAG)
2033     goto yyerrdefault;
2034
2035   yyn += YYTERROR;
2036   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2037     goto yyerrdefault;
2038
2039   yyn = yytable[yyn];
2040   if (yyn < 0)
2041     {
2042       if (yyn == YYFLAG)
2043         goto yyerrpop;
2044       yyn = -yyn;
2045       goto yyreduce;
2046     }
2047   else if (yyn == 0)
2048     goto yyerrpop;
2049
2050   if (yyn == YYFINAL)
2051     YYACCEPT;
2052
2053   YYDPRINTF ((stderr, "Shifting error token, "));
2054
2055   *++yyvsp = yylval;
2056 #if YYLSP_NEEDED
2057   *++yylsp = yylloc;
2058 #endif
2059
2060   yystate = yyn;
2061   goto yynewstate;
2062
2063
2064 /*-------------------------------------.
2065 | yyacceptlab -- YYACCEPT comes here.  |
2066 `-------------------------------------*/
2067 yyacceptlab:
2068   yyresult = 0;
2069   goto yyreturn;
2070
2071 /*-----------------------------------.
2072 | yyabortlab -- YYABORT comes here.  |
2073 `-----------------------------------*/
2074 yyabortlab:
2075   yyresult = 1;
2076   goto yyreturn;
2077
2078 /*---------------------------------------------.
2079 | yyoverflowab -- parser overflow comes here.  |
2080 `---------------------------------------------*/
2081 yyoverflowlab:
2082   yyerror ("parser stack overflow");
2083   yyresult = 2;
2084   /* Fall through.  */
2085
2086 yyreturn:
2087 #ifndef yyoverflow
2088   if (yyss != yyssa)
2089     YYSTACK_FREE (yyss);
2090 #endif
2091   return yyresult;
2092 }
2093 #line 514 "inform.y"
2094
2095
2096 #if 0
2097 { /* fanagling to get emacs indentation sane */
2098 int foo;
2099 #endif
2100
2101 static z_typed z_t(z_typed a, z_typed b, zword v)
2102 {
2103   z_typed r;
2104   r.v = ARITHMASK(v);
2105   if(a.t == Z_NUMBER && b.t == Z_NUMBER)
2106     r.t = Z_NUMBER;
2107   else
2108     r.t = Z_UNKNOWN;
2109   return r;
2110 }
2111
2112
2113
2114 typedef struct {
2115   int token;
2116   const char *name;
2117 } name_token;
2118
2119 static name_token infix_operators[] = {
2120   { ANDAND,     "&&" },
2121   { OROR,       "||" },
2122   { NOTNOT,     "~~" },
2123   { BYTEARRAY,  "->" },
2124   { WORDARRAY,  "-->" },
2125   { NUMBER,     "(number)" },
2126   { OBJECT,     "(object)" },
2127   { ROUTINE,    "(routine)" },
2128   { STRING,     "(string)" },
2129   { GLOBAL,     "(global)" },
2130   { LOCAL,      "(local)" },
2131   { INCREMENT,  "++" },
2132   { DECREMENT,  "--" },
2133   { SUPERCLASS, "::" }
2134 };
2135
2136
2137 static name_token infix_keywords[] = {
2138   { TO,         "to" },
2139   { IF,         "if" },
2140   { OR,         "or" },
2141   { BTRUE,      "true" },
2142   { BFALSE,     "false" },
2143   { NOTHING,    "nothing" },
2144   { PARENT,     "parent" },
2145   { CHILD,      "child" },
2146   { SIBLING,    "sibling" },
2147   { RANDOM,     "random" },
2148   { CHILDREN,   "children" }
2149 };
2150
2151
2152 /* These are only valid as the first token in an expression.  A single space
2153    matches at least one typed whitespace character */
2154 static name_token infix_commands[] = {
2155   { '#',          "#" },
2156   { HELP,         "help" },
2157   { ALIAS,        "alias" },
2158   { RALIAS,       "ralias" },
2159   { UNALIAS,      "unalias" },
2160   { DUMPMEM,      "dumpmem" },
2161   { AUTOMAP,      "automap" },
2162   { UNDO,         "undo" },
2163   { REDO,         "redo" },
2164   { QUIT,         "quit" },
2165   { RESTORE,      "restore" },
2166   { RESTART,      "restart" },
2167   { RESTART,      "run" },
2168   { RECORDON,     "recording on" },
2169   { RECORDOFF,    "recording off" },
2170   { REPLAY,       "replay" },
2171   { REPLAYOFF,    "replay off" },
2172   { SYMBOL_FILE,  "symbol-file" },
2173   { PRINT,        "print" },
2174   { PRINT,        "p" },
2175   { PRINT,        "call" },  /* No void functions in inform */
2176   { SET,          "set" },
2177   { MOVE,         "move" },
2178   { OBJECT_TREE,  "object-tree" },
2179   { OBJECT_TREE,  "tree" },
2180   { FIND,         "find" },
2181   { REMOVE,       "remove" },
2182   { GIVE,         "give" },
2183   { LIST_GLOBALS, "globals" },
2184   { JUMP,         "jump" },
2185   { CONT,         "continue" },
2186   { CONT,         "c" },
2187   { CONT,         "fg" },
2188   { STEP,         "step" },
2189   { STEP,         "s" },
2190   { NEXT,         "next" },
2191   { NEXT,         "n" },
2192   { STEPI,        "stepi" },
2193   { STEPI,        "si" },
2194   { NEXTI,        "nexti" },
2195   { NEXTI,        "ni" },
2196   { UNTIL,        "until" },
2197   { UNTIL,        "u" },
2198   { FINISH,       "finish" },
2199   { BREAK,        "break" },
2200   { DELETE,       "delete" },
2201   { DELETE,       "d" },
2202   { DELETE,       "delete breakpoints" },
2203   { COND,         "condition" },
2204   { IGNORE,       "ignore" },
2205   { FRAME,        "frame" },
2206   { FRAME,        "f" },
2207   { SELECT_FRAME, "select-frame" },
2208   { UP_FRAME,     "up" },
2209   { DOWN_FRAME,   "down" },
2210   { DOWN_FRAME,   "do" },
2211   { UP_SILENTLY,  "up-silently" },
2212   { DOWN_SILENTLY,"down-silently" },
2213   { BREAKPOINTS,  "info breakpoints" },
2214   { BREAKPOINTS,  "info watchpoints" },
2215   { BREAKPOINTS,  "info break" },
2216   { DISABLE_BREAK,"disable" },
2217   { DISABLE_BREAK,"disable breakpoints" },
2218   { DISABLE_BREAK,"dis" },
2219   { DISABLE_BREAK,"dis breakpoints" },
2220   { ENABLE_BREAK, "enable" },
2221   { ENABLE_BREAK, "enable breakpoints" },
2222   { LANGUAGE,     "show language" },
2223   { INFOSOURCE,   "info source" },
2224   { INFOSOURCES,  "info sources" },
2225   { COPYING,      "show copying" },
2226   { WARRANTY,     "show warranty" },
2227   { BACKTRACE,    "backtrace" },
2228   { BACKTRACE,    "bt" },
2229   { BACKTRACE,    "where" },
2230   { BACKTRACE,    "info stack" },
2231   { BACKTRACE,    "info s" },
2232   { DISPLAY,      "display" },
2233   { UNDISPLAY,    "undisplay" },
2234   { UNDISPLAY,    "delete display" },
2235   { DISABLE_DISPLAY,"disable display" },
2236   { DISABLE_DISPLAY,"dis display" },
2237   { ENABLE_DISPLAY,"enable display" }
2238 };
2239
2240 #include "dbg_help.h"
2241
2242 static BOOL z_isequal(zword a, zword b)
2243 {
2244   return (a == b);
2245 }
2246
2247 static BOOL z_isgreat(zword a, zword b)
2248 {
2249   return is_greaterthan(a, b);
2250 }
2251
2252 static BOOL z_isless(zword a, zword b)
2253 {
2254   return is_lessthan(a, b);
2255 }
2256
2257 static BOOL infix_provides(zword o, zword p)
2258 {
2259   zword len;
2260   return (infix_get_proptable(o, p, &len) != 0);
2261 }
2262
2263 static BOOL infix_in(zword a, zword b)
2264 {
2265   return infix_parent(a) == b;
2266 }
2267
2268 typedef struct {
2269   const char *name;
2270   BOOL (*condfunc)(zword a, zword b);
2271   BOOL opposite;
2272 } condition;
2273
2274 condition conditionlist[] = {
2275   { "==",      z_isequal,         FALSE },
2276   { "~=",      z_isequal,         TRUE },
2277   { ">",       z_isgreat,         FALSE },
2278   { "<",       z_isless,          FALSE },
2279   { "<=",      z_isgreat,         TRUE },
2280   { ">=",      z_isless,          TRUE },
2281   { "has",     infix_test_attrib, FALSE },
2282   { "hasnt",   infix_test_attrib, TRUE },
2283   { "in",      infix_in,          FALSE },
2284   { "notin",   infix_in,          TRUE },
2285 /*{ "ofclass", infix_ofclass,     FALSE },*/
2286   { "provides",infix_provides,    FALSE }
2287 };
2288
2289
2290 static BOOL is_command_identifier(char c)
2291 {
2292   return isalpha(c) || (c == '-');
2293 }
2294
2295 static BOOL is_identifier(char c)
2296 {
2297   return isalpha(c) || isdigit(c) || (c == '_');
2298 }
2299
2300 static BOOL is_longer_identifier(char c)
2301 {
2302   return isalpha(c) || isdigit(c) || (c == '_') || (c == '.') || (c == ':');
2303 }
2304
2305 static int grab_number(z_typed *val)
2306 {
2307   int len = 0;
2308   char *endptr;
2309   char c = lex_expression[lex_offset + len];
2310   int base = 10;
2311   long int num;
2312
2313   /* Don't handle negativity here */
2314   if(c == '-' || c == '+')
2315     return 0;
2316   
2317   if(c == '$') {
2318     len++;
2319     base = 16;
2320     c = lex_expression[lex_offset + len];
2321     if(c == '$') {
2322       len++;
2323       base = 2;
2324       c = lex_expression[lex_offset + len];
2325     }
2326   }
2327   
2328   num = n_strtol(lex_expression + lex_offset + len, &endptr, base);
2329
2330   if(endptr != lex_expression + lex_offset) {
2331     len += endptr - lex_expression - lex_offset;
2332     val->v = num;
2333     val->t = Z_NUMBER;
2334     return len;
2335   }
2336   return 0;
2337 }
2338
2339
2340 typedef enum { match_None, match_Partial, match_Complete } match_type;
2341
2342 static match_type command_matches(const char *command, const char *expression,
2343                                   unsigned *matchedlen)
2344 {
2345   unsigned c, e;
2346   e = 0;
2347
2348   for(c = 0; command[c]; c++) {
2349     if(command[c] != expression[e]) {
2350       if(!is_command_identifier(expression[e])) {
2351         *matchedlen = e;
2352         return match_Partial;
2353       }
2354       return match_None;
2355     }
2356
2357     e++;
2358     
2359     if(command[c] == ' ') {
2360       while(expression[e] == ' ')
2361         e++;
2362     }
2363   }
2364
2365   if(!is_command_identifier(expression[e])) {
2366     *matchedlen = e;
2367     return match_Complete; 
2368   }
2369
2370   return match_None;
2371 }
2372
2373
2374 static int grab_command(void)
2375 {
2376   unsigned i;
2377   unsigned len;
2378
2379   unsigned best;
2380   match_type best_match = match_None;
2381   unsigned best_len = 0;
2382   BOOL found = FALSE;
2383   BOOL ambig = FALSE;
2384
2385   while(isspace(lex_expression[lex_offset]))
2386     lex_offset++;
2387
2388   for(i = 0; i < sizeof(infix_commands) / sizeof(*infix_commands); i++) {
2389     switch(command_matches(infix_commands[i].name, lex_expression + lex_offset, &len)) {
2390     case match_Complete:
2391       if(len > best_len || best_match != match_Complete) {
2392         best = i;
2393         best_match = match_Complete;
2394         best_len = len;
2395         found = TRUE;
2396       }
2397       break;
2398
2399     case match_Partial:
2400       if(best_match != match_Complete) {
2401         if(found)
2402           ambig = TRUE;
2403         best = i;
2404         best_match = match_Partial;
2405         best_len = len;
2406         found = TRUE;
2407       }
2408
2409     case match_None:
2410       ;
2411     }
2412   }
2413
2414   if(ambig && best_match != match_Complete) {
2415     infix_print_string("Ambiguous command.\n");
2416     return 0;
2417   }
2418
2419   if(found) {
2420     lex_offset += best_len;
2421     return infix_commands[best].token;
2422   }
2423
2424   infix_print_string("Undefined command.\n");
2425   return 0;
2426 }
2427
2428
2429 static void inform_help(void)
2430 {
2431   int command;
2432   unsigned i;
2433   BOOL is_command = FALSE;
2434   
2435   for(i = lex_offset; lex_expression[i]; i++)
2436     if(!isspace(lex_expression[i]))
2437       is_command = TRUE;
2438
2439   if(!is_command) {
2440     infix_print_string("Help is available on the following commands:\n");
2441     for(i = 0; i < sizeof(command_help) / sizeof(*command_help); i++) {
2442       unsigned j;
2443       for(j = 0; j < sizeof(infix_commands) / sizeof(*infix_commands); j++)
2444         if(command_help[i].token == infix_commands[j].token) {
2445           infix_print_char('\'');
2446           infix_print_string(infix_commands[j].name);
2447           infix_print_char('\'');
2448           break;
2449         }
2450       infix_print_char(' ');
2451     }
2452     infix_print_string("\n");
2453     return;
2454   }
2455   
2456   command = grab_command();
2457   if(command) {
2458     for(i = 0; i < sizeof(command_help) / sizeof(*command_help); i++) {
2459       if(command_help[i].token == command) {
2460         infix_print_string(command_help[i].name);
2461         infix_print_char(10);
2462         return;
2463       }
2464     }
2465     infix_print_string("No help available for that command.\n");
2466   }
2467 }
2468
2469
2470 void process_debug_command(const char *buffer)
2471 {
2472 #if YYDEBUG
2473   yydebug = 1;
2474 #endif
2475   lex_expression = buffer;
2476   lex_offset = 0;
2477   ignoreeffects = 0;
2478   yyparse();
2479   n_rmfree();
2480 }
2481
2482 BOOL exp_has_locals(const char *exp)
2483 {
2484   return FALSE;
2485 }
2486
2487 z_typed evaluate_expression(const char *exp, unsigned frame)
2488 {
2489   unsigned old_frame = infix_selected_frame;
2490   char *new_exp = (char *) n_malloc(n_strlen(exp) + 5);
2491   n_strcpy(new_exp, "set ");
2492   n_strcat(new_exp, exp);
2493
2494   infix_selected_frame = frame;
2495   process_debug_command(new_exp);
2496   infix_selected_frame = old_frame;
2497
2498   n_free(new_exp);
2499
2500   return inform_result;
2501 }
2502
2503 static void yyerror(const char *s)
2504 {
2505   infix_print_string(s);
2506   infix_print_char(10);
2507 }
2508
2509 static int yylex(void)
2510 {
2511   unsigned i, len, longer;
2512   BOOL check_command = FALSE;
2513
2514   if(lex_offset == 0)
2515     check_command = TRUE;
2516
2517   while(isspace(lex_expression[lex_offset]))
2518     lex_offset++;
2519
2520   if(check_command) {
2521     return grab_command();
2522   }
2523
2524   if((len = grab_number(&yylval.val)) != 0) {
2525     lex_offset += len;
2526     return NUM;
2527   }
2528
2529   for(i = 0; i < sizeof(infix_operators) / sizeof(*infix_operators); i++) {
2530     if(n_strncmp(infix_operators[i].name, lex_expression + lex_offset,
2531                n_strlen(infix_operators[i].name)) == 0) {
2532       lex_offset += n_strlen(infix_operators[i].name);
2533       return infix_operators[i].token;
2534     }
2535   }
2536
2537   for(i = 0; i < sizeof(conditionlist) / sizeof(*conditionlist); i++) {
2538     len = n_strlen(conditionlist[i].name);
2539     if(len
2540        && n_strncmp(conditionlist[i].name,
2541                    lex_expression + lex_offset, len) == 0
2542        && !(is_identifier(conditionlist[i].name[len-1])
2543             && is_identifier(lex_expression[lex_offset + len]))) {
2544
2545       lex_offset += len;
2546       yylval.cond.condfunc = conditionlist[i].condfunc;
2547       yylval.cond.opposite = conditionlist[i].opposite;
2548       return CONDITION;
2549     }
2550   }
2551
2552   if((len = infix_find_file(&yylval.filenum, lex_expression + lex_offset)) != 0) {
2553     lex_offset += len;
2554     return DFILE;
2555   }
2556
2557
2558   for(len = 0; is_identifier(lex_expression[lex_offset + len]); len++)
2559     ;
2560
2561   if(!len)
2562     return lex_expression[lex_offset++];
2563
2564   for(i = 0; i < sizeof(infix_keywords) / sizeof(*infix_keywords); i++) {
2565     if(n_strmatch(infix_keywords[i].name, lex_expression + lex_offset, len)) {
2566       lex_offset += len;
2567       return infix_keywords[i].token;
2568     }
2569   }
2570
2571   for(longer = len; is_longer_identifier(lex_expression[lex_offset + longer]); longer++)
2572     ;
2573
2574   if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, longer)) {
2575     lex_offset += longer;
2576     return NUM;
2577   }
2578
2579   if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, len)) {
2580     lex_offset += len;
2581     return NUM;
2582   }
2583
2584   infix_print_string("Unknown identifier \"");
2585   for(i = 0; i < len; i++)
2586     infix_print_char(lex_expression[lex_offset + i]);
2587   infix_print_string("\"\n");
2588
2589   return 0;
2590 }
2591
2592 #endif /* DEBUGGING */