1 /* A Bison parser, made from inform.y
4 #define YYBISON 1 /* Identify Bison output. */
18 # define INFOSOURCE 269
19 # define INFOSOURCES 270
41 # define BREAKPOINTS 292
46 # define RECORDOFF 297
48 # define REPLAYOFF 299
49 # define SYMBOL_FILE 300
51 # define SELECT_FRAME 302
52 # define BACKTRACE 303
54 # define DOWN_FRAME 305
55 # define UP_SILENTLY 306
56 # define DOWN_SILENTLY 307
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
65 # define LIST_GLOBALS 316
78 # define BYTEARRAY 329
79 # define WORDARRAY 330
87 # define INCREMENT 338
88 # define DECREMENT 339
90 # define PROPLENGTH 341
91 # define SUPERCLASS 342
95 /* Nitfol - z-machine interpreter using Glk for output.
96 Copyright (C) 1999 Evin Robertson
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.
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.
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.
112 The author can be reached at ecr+@andrew.cmu.edu
118 /* bison uses str* functions; make it use n_str* instead... */
120 #define strcat(d, s) n_strcat(d, s)
123 #define strlen(s) n_strlen(s)
126 #define strcpy(d, s) n_strcpy(d, s)
132 typedef struct zword_list zword_list;
138 typedef struct cond_list cond_list;
142 BOOL (*condfunc)(zword a, zword b);
148 static z_typed z_t(z_typed a, z_typed b, zword v);
150 static const char *lex_expression;
151 static int lex_offset;
153 static const char *lex_tail(void) {
154 const char *t = lex_expression + lex_offset;
157 lex_offset = n_strlen(lex_expression);
161 static z_typed inform_result;
163 static int yylex(void);
164 static void yyerror(const char *s);
165 static void inform_help(void);
169 #define YYERROR_VERBOSE
186 BOOL (*condfunc)(zword a, zword b);
192 # define YYSTYPE yystype
193 # define YYSTYPE_IS_TRIVIAL 1
202 #define YYFLAG -32768
205 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
206 #define YYTRANSLATE(x) ((unsigned)(x) <= 342 ? yytranslate[x] : 114)
208 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
209 static const char yytranslate[] =
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,
249 static const short yyprhs[] =
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,
266 static const short yyrhs[] =
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
311 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
312 static const short yyrline[] =
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,
332 #if (YYDEBUG) || defined YYERROR_VERBOSE
334 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
335 static const char *const yytname[] =
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",
358 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
359 static const short yyr1[] =
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,
377 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
378 static const short yyr2[] =
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,
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
399 static const short yydefact[] =
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
424 static const short yydefgoto[] =
426 206, 90, 197, 186, 78, 79, 171, 80, 173, 174
429 static const short yypact[] =
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
454 static const short yypgoto[] =
456 -32768, 181,-32768, 24, -15, 82,-32768, -62,-32768,-32768
463 static const short yytable[] =
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,
503 static const short yycheck[] =
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,
542 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
543 #line 3 "/usr/share/bison/bison.simple"
545 /* Skeleton output parser for bison,
547 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
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)
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.
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. */
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. */
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. */
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. */
582 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
584 /* The parser invokes alloca or malloc; define the necessary symbols. */
586 # if YYSTACK_USE_ALLOCA
587 # define YYSTACK_ALLOC alloca
589 # ifndef YYSTACK_USE_ALLOCA
590 # if defined (alloca) || defined (_ALLOCA_H)
591 # define YYSTACK_ALLOC alloca
594 # define YYSTACK_ALLOC __builtin_alloca
600 # ifdef YYSTACK_ALLOC
601 /* Pacify GCC's `empty if-body' warning. */
602 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
604 # if defined (__STDC__) || defined (__cplusplus)
605 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
606 # define YYSIZE_T size_t
608 # define YYSTACK_ALLOC malloc
609 # define YYSTACK_FREE free
611 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
614 #if (! defined (yyoverflow) \
615 && (! defined (__cplusplus) \
616 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
618 /* A type that is properly aligned for any stack member. */
628 /* The size of the maximum gap between one aligned stack and the next. */
629 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
631 /* The size of an array large to enough to hold all stacks, each with
634 # define YYSTACK_BYTES(N) \
635 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
636 + 2 * YYSTACK_GAP_MAX)
638 # define YYSTACK_BYTES(N) \
639 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
643 /* Copy COUNT objects from FROM to TO. The source and destination do
647 # define YYCOPY(To, From, Count) \
648 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
650 # define YYCOPY(To, From, Count) \
653 register YYSIZE_T yyi; \
654 for (yyi = 0; yyi < (Count); yyi++) \
655 (To)[yyi] = (From)[yyi]; \
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
666 # define YYSTACK_RELOCATE(Stack) \
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); \
680 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
681 # define YYSIZE_T __SIZE_TYPE__
683 #if ! defined (YYSIZE_T) && defined (size_t)
684 # define YYSIZE_T size_t
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
692 #if ! defined (YYSIZE_T)
693 # define YYSIZE_T unsigned int
696 #define yyerrok (yyerrstatus = 0)
697 #define yyclearin (yychar = YYEMPTY)
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) \
710 if (yychar == YYEMPTY && yylen == 1) \
714 yychar1 = YYTRANSLATE (yychar); \
720 yyerror ("syntax error: cannot back up"); \
726 #define YYERRCODE 256
729 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
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. */
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;
743 /* YYLEX -- calling `yylex' with the right arguments. */
748 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
750 # define YYLEX yylex (&yylval, &yylloc)
752 # else /* !YYLSP_NEEDED */
754 # define YYLEX yylex (&yylval, YYLEX_PARAM)
756 # define YYLEX yylex (&yylval)
758 # endif /* !YYLSP_NEEDED */
760 # define YYLEX yylex ()
764 /* Enable debugging if requested. */
768 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
769 # define YYFPRINTF fprintf
772 # define YYDPRINTF(Args) \
777 /* Nonzero means print parse trace. It is left uninitialized so that
778 multiple parsers can coexist. */
781 # define YYDPRINTF(Args)
782 #endif /* !YYDEBUG */
784 /* YYINITDEPTH -- initial size of the parser's stacks. */
786 # define YYINITDEPTH 200
789 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
790 if the built-in stack extension method is used).
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. */
801 # define YYMAXDEPTH 10000
804 #ifdef YYERROR_VERBOSE
807 # if defined (__GLIBC__) && defined (_STRING_H)
808 # define yystrlen strlen
810 /* Return the length of YYSTR. */
812 # if defined (__STDC__) || defined (__cplusplus)
813 yystrlen (const char *yystr)
819 register const char *yys = yystr;
821 while (*yys++ != '\0')
824 return yys - yystr - 1;
830 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
831 # define yystpcpy stpcpy
833 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
836 # if defined (__STDC__) || defined (__cplusplus)
837 yystpcpy (char *yydest, const char *yysrc)
839 yystpcpy (yydest, yysrc)
844 register char *yyd = yydest;
845 register const char *yys = yysrc;
847 while ((*yyd++ = *yys++) != '\0')
856 #line 315 "/usr/share/bison/bison.simple"
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. */
866 # if defined (__STDC__) || defined (__cplusplus)
867 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
868 # define YYPARSE_PARAM_DECL
870 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
871 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
873 #else /* !YYPARSE_PARAM */
874 # define YYPARSE_PARAM_ARG
875 # define YYPARSE_PARAM_DECL
876 #endif /* !YYPARSE_PARAM */
878 /* Prevent warning if -Wstrict-prototypes. */
880 # ifdef YYPARSE_PARAM
881 int yyparse (void *);
887 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
888 variables are global, or local to YYPARSE. */
890 #define YY_DECL_NON_LSP_VARIABLES \
891 /* The lookahead symbol. */ \
894 /* The semantic value of the lookahead symbol. */ \
897 /* Number of parse errors so far. */ \
901 # define YY_DECL_VARIABLES \
902 YY_DECL_NON_LSP_VARIABLES \
904 /* Location data for the lookahead symbol. */ \
907 # define YY_DECL_VARIABLES \
908 YY_DECL_NON_LSP_VARIABLES
912 /* If nonreentrant, generate the variables here. */
919 yyparse (YYPARSE_PARAM_ARG)
922 /* If reentrant, generate the variables here. */
927 register int yystate;
930 /* Number of tokens to shift before error messages enabled. */
932 /* Lookahead token as an internal (translated) token number. */
935 /* Three stacks and their tools:
936 `yyss': related to states,
937 `yyvs': related to semantic values,
938 `yyls': related to locations.
940 Refer to the stacks thru separate pointers, to allow yyoverflow
941 to reallocate them elsewhere. */
943 /* The state stack. */
944 short yyssa[YYINITDEPTH];
946 register short *yyssp;
948 /* The semantic value stack. */
949 YYSTYPE yyvsa[YYINITDEPTH];
950 YYSTYPE *yyvs = yyvsa;
951 register YYSTYPE *yyvsp;
954 /* The location stack. */
955 YYLTYPE yylsa[YYINITDEPTH];
956 YYLTYPE *yyls = yylsa;
961 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
963 # define YYPOPSTACK (yyvsp--, yyssp--)
966 YYSIZE_T yystacksize = YYINITDEPTH;
969 /* The variables used to return semantic value and location from the
976 /* When reducing, the number of symbols on the RHS of the reduced
980 YYDPRINTF ((stderr, "Starting parse\n"));
985 yychar = YYEMPTY; /* Cause a token to be read. */
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. */
999 /*------------------------------------------------------------.
1000 | yynewstate -- Push a new state, which is found in yystate. |
1001 `------------------------------------------------------------*/
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.
1011 if (yyssp >= yyss + yystacksize - 1)
1013 /* Get the current used size of the three stacks, in elements. */
1014 YYSIZE_T yysize = yyssp - yyss + 1;
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
1021 YYSTYPE *yyvs1 = yyvs;
1022 short *yyss1 = yyss;
1024 /* Each stack pointer address is followed by the size of the
1025 data in use in that stack, in bytes. */
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),
1037 yyoverflow ("parser stack overflow",
1038 &yyss1, yysize * sizeof (*yyssp),
1039 &yyvs1, yysize * sizeof (*yyvsp),
1045 #else /* no yyoverflow */
1046 # ifndef YYSTACK_RELOCATE
1049 /* Extend the stack our own way. */
1050 if (yystacksize >= YYMAXDEPTH)
1053 if (yystacksize > YYMAXDEPTH)
1054 yystacksize = YYMAXDEPTH;
1057 short *yyss1 = yyss;
1058 union yyalloc *yyptr =
1059 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1062 YYSTACK_RELOCATE (yyss);
1063 YYSTACK_RELOCATE (yyvs);
1065 YYSTACK_RELOCATE (yyls);
1067 # undef YYSTACK_RELOCATE
1069 YYSTACK_FREE (yyss1);
1072 #endif /* no yyoverflow */
1074 yyssp = yyss + yysize - 1;
1075 yyvsp = yyvs + yysize - 1;
1077 yylsp = yyls + yysize - 1;
1080 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1081 (unsigned long int) yystacksize));
1083 if (yyssp >= yyss + yystacksize - 1)
1087 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1097 /* Do appropriate processing given the current state. */
1098 /* Read a lookahead token if we need one and don't already have one. */
1101 /* First try to decide what to do without reference to lookahead token. */
1103 yyn = yypact[yystate];
1107 /* Not known => get a lookahead token if don't already have one. */
1109 /* yychar is either YYEMPTY or YYEOF
1110 or a valid token in external form. */
1112 if (yychar == YYEMPTY)
1114 YYDPRINTF ((stderr, "Reading a token: "));
1118 /* Convert token to internal form (in yychar1) for indexing tables with */
1120 if (yychar <= 0) /* This means end of input. */
1123 yychar = YYEOF; /* Don't call YYLEX any more */
1125 YYDPRINTF ((stderr, "Now at end of input.\n"));
1129 yychar1 = YYTRANSLATE (yychar);
1132 /* We have to keep this `#if YYDEBUG', since we use variables
1133 which are defined only if `YYDEBUG' is set. */
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. */
1141 YYPRINT (stderr, yychar, yylval);
1143 YYFPRINTF (stderr, ")\n");
1149 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
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. */
1174 /* Shift the lookahead token. */
1175 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1176 yychar, yytname[yychar1]));
1178 /* Discard the token being shifted unless it is eof. */
1179 if (yychar != YYEOF)
1187 /* Count tokens shifted since error; after three, turn off error
1196 /*-----------------------------------------------------------.
1197 | yydefault -- do the default action for the current state. |
1198 `-----------------------------------------------------------*/
1200 yyn = yydefact[yystate];
1206 /*-----------------------------.
1207 | yyreduce -- Do a reduction. |
1208 `-----------------------------*/
1210 /* yyn is the number of a rule to reduce with. */
1213 /* If YYLEN is nonzero, implement the default value of the action:
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];
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);
1231 /* We have to keep this `#if YYDEBUG', since we use variables which
1232 are defined only if `YYDEBUG' is set. */
1237 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
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]]);
1250 #line 132 "inform.y"
1251 { lex_offset = n_strlen(lex_expression); }
1254 #line 134 "inform.y"
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);
1264 #line 142 "inform.y"
1265 { parse_new_alias(lex_tail(), FALSE); }
1268 #line 144 "inform.y"
1269 { parse_new_alias(lex_tail(), TRUE); }
1272 #line 146 "inform.y"
1273 { remove_alias(lex_tail()); }
1276 #line 148 "inform.y"
1277 { automap_init(object_count, lex_tail()); }
1280 #line 150 "inform.y"
1284 #line 152 "inform.y"
1285 { op_restart(); exit_debugger = TRUE; read_abort = TRUE; }
1288 #line 154 "inform.y"
1291 exit_debugger = TRUE; read_abort = TRUE;
1295 mop_store_result(2);
1297 infix_print_string("Restore failed.\n");
1301 #line 165 "inform.y"
1302 { zword oldop0 = operand[0]; operand[0] = 4; op_output_stream(); operand[0] = oldop0; }
1305 #line 167 "inform.y"
1306 { zword oldop0 = operand[0]; operand[0] = neg(4); op_output_stream(); operand[0] = oldop0; }
1309 #line 169 "inform.y"
1310 { zword oldop0 = operand[0]; operand[0] = 1; op_input_stream(); operand[0] = oldop0; exit_debugger = TRUE; }
1313 #line 171 "inform.y"
1314 { zword oldop0 = operand[0]; operand[0] = 0; op_input_stream(); operand[0] = oldop0; }
1317 #line 173 "inform.y"
1318 { z_close(); glk_exit(); }
1321 #line 175 "inform.y"
1324 read_abort = TRUE; exit_debugger = TRUE;
1326 infix_print_string("No undo slots.\n");
1330 #line 182 "inform.y"
1333 read_abort = TRUE; exit_debugger = TRUE;
1335 infix_print_string("No redo slots.\n");
1339 #line 189 "inform.y"
1342 f = n_file_name_or_prompt(fileusage_Data|fileusage_BinaryMode,
1343 filemode_Read, lex_tail());
1350 #line 198 "inform.y"
1351 { infix_display(yyvsp[0].val); }
1354 #line 200 "inform.y"
1355 { inform_result = yyvsp[0].val; }
1358 #line 202 "inform.y"
1359 { infix_auto_display(lex_tail()); }
1362 #line 204 "inform.y"
1363 { infix_auto_undisplay(yyvsp[0].val.v); }
1366 #line 206 "inform.y"
1367 { infix_set_display_enabled(yyvsp[0].val.v, FALSE); }
1370 #line 208 "inform.y"
1371 { infix_set_display_enabled(yyvsp[0].val.v, TRUE); }
1374 #line 210 "inform.y"
1375 { infix_move(yyvsp[0].val.v, yyvsp[-2].val.v); }
1378 #line 212 "inform.y"
1379 { infix_object_tree(0); }
1382 #line 214 "inform.y"
1383 { infix_object_tree(yyvsp[0].val.v); }
1386 #line 216 "inform.y"
1388 if(lex_expression[lex_offset])
1389 infix_object_find(lex_tail());
1393 #line 221 "inform.y"
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("; ");
1400 infix_print_string(name);
1402 infix_print_char('G');
1403 infix_print_number(v.o);
1405 infix_print_char('=');
1407 infix_print_number(v.v);
1409 infix_print_char(10);
1413 #line 239 "inform.y"
1415 z_typed v; v.t = Z_GLOBAL;
1416 for(v.o = 0; v.o <= 245; v.o++) {
1418 if(v.v == yyvsp[0].val.v) {
1419 const char *name = infix_get_name(v);
1421 infix_print_string(name);
1423 infix_print_char('G');
1424 infix_print_number(v.o);
1426 infix_print_char(10);
1431 #line 255 "inform.y"
1432 { infix_set_attrib(yyvsp[-1].val.v, yyvsp[0].val.v); }
1435 #line 257 "inform.y"
1436 { infix_clear_attrib(yyvsp[-2].val.v, yyvsp[0].val.v); }
1439 #line 259 "inform.y"
1440 { infix_remove(yyvsp[0].val.v); }
1443 #line 261 "inform.y"
1444 { PC=yyvsp[0].pcoffset; exit_debugger = TRUE; }
1447 #line 263 "inform.y"
1448 { set_step(CONT_GO, 1); }
1451 #line 265 "inform.y"
1452 { set_step(CONT_GO, 1); infix_set_ignore(cur_break, yyvsp[0].val.v); }
1455 #line 267 "inform.y"
1456 { set_step(CONT_STEP, 1); }
1459 #line 269 "inform.y"
1460 { set_step(CONT_STEP, yyvsp[0].val.v); }
1463 #line 271 "inform.y"
1464 { set_step(CONT_NEXT, 1); }
1467 #line 273 "inform.y"
1468 { set_step(CONT_NEXT, yyvsp[0].val.v); }
1471 #line 275 "inform.y"
1472 { set_step(CONT_UNTIL, 1); }
1475 #line 277 "inform.y"
1476 { set_step(CONT_STEPI, 1); }
1479 #line 279 "inform.y"
1480 { set_step(CONT_STEPI, yyvsp[0].val.v); }
1483 #line 281 "inform.y"
1484 { set_step(CONT_NEXTI, 1); }
1487 #line 283 "inform.y"
1488 { set_step(CONT_NEXTI, yyvsp[0].val.v); }
1491 #line 285 "inform.y"
1492 { set_step(CONT_FINISH, 1); }
1495 #line 287 "inform.y"
1496 { infix_set_break(yyvsp[0].pcoffset); }
1499 #line 289 "inform.y"
1500 { int n = infix_set_break(yyvsp[-1].pcoffset); infix_set_cond(n, lex_tail()); }
1503 #line 291 "inform.y"
1504 { infix_set_cond(yyvsp[0].val.v, lex_tail()); }
1507 #line 293 "inform.y"
1508 { infix_set_ignore(yyvsp[-1].val.v, yyvsp[0].val.v); }
1511 #line 295 "inform.y"
1512 { infix_delete_breakpoint(yyvsp[0].val.v); }
1515 #line 297 "inform.y"
1516 { infix_show_all_breakpoints(); }
1519 #line 299 "inform.y"
1520 { infix_show_breakpoint(yyvsp[0].val.v); }
1523 #line 301 "inform.y"
1524 { infix_set_break_enabled(yyvsp[0].val.v, FALSE); }
1527 #line 303 "inform.y"
1528 { infix_set_break_enabled(yyvsp[0].val.v, TRUE); }
1531 #line 305 "inform.y"
1532 { infix_print_string("The current source language is \"inform\".\n"); }
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"); }
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'); }
1543 #line 311 "inform.y"
1547 #line 313 "inform.y"
1548 { show_warranty(); }
1551 #line 315 "inform.y"
1552 { infix_show_frame(infix_selected_frame); }
1555 #line 317 "inform.y"
1556 { infix_select_frame(yyvsp[0].val.v); infix_show_frame(yyvsp[0].val.v); }
1559 #line 319 "inform.y"
1560 { infix_select_frame(yyvsp[0].val.v); }
1563 #line 321 "inform.y"
1564 { infix_select_frame(infix_selected_frame - 1); infix_show_frame(infix_selected_frame); }
1567 #line 323 "inform.y"
1568 { infix_select_frame(infix_selected_frame - yyvsp[0].val.v); infix_show_frame(infix_selected_frame); }
1571 #line 325 "inform.y"
1572 { infix_select_frame(infix_selected_frame - 1); }
1575 #line 327 "inform.y"
1576 { infix_select_frame(infix_selected_frame - yyvsp[0].val.v); }
1579 #line 329 "inform.y"
1580 { infix_select_frame(infix_selected_frame + 1); infix_show_frame(infix_selected_frame); }
1583 #line 331 "inform.y"
1584 { infix_select_frame(infix_selected_frame + yyvsp[0].val.v); infix_show_frame(infix_selected_frame); }
1587 #line 333 "inform.y"
1588 { infix_select_frame(infix_selected_frame + 1); }
1591 #line 335 "inform.y"
1592 { infix_select_frame(infix_selected_frame + yyvsp[0].val.v); }
1595 #line 337 "inform.y"
1596 { infix_backtrace(0, stack_get_depth()); }
1599 #line 339 "inform.y"
1600 { infix_backtrace(stack_get_depth() - yyvsp[0].val.v, yyvsp[0].val.v); }
1603 #line 341 "inform.y"
1604 { infix_backtrace(0, yyvsp[0].val.v); }
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; } }
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; }
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; }
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; } }
1623 #line 353 "inform.y"
1624 { yyval.pcoffset = yyvsp[0].val.v; }
1627 #line 357 "inform.y"
1629 if(condlist->condfunc(condlist->val, yyvsp[0].val.v) ^ condlist->opposite) {
1637 #line 364 "inform.y"
1642 if(condlist->condfunc(condlist->val, yyvsp[0].val.v) ^ condlist->opposite) {
1646 else yyval.flag = FALSE;
1650 #line 377 "inform.y"
1651 { yyval.zlist = NULL; }
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); }
1658 #line 384 "inform.y"
1659 { yyval.val = yyvsp[0].val; }
1662 #line 385 "inform.y"
1663 { yyval.val = yyvsp[0].val; }
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); }
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); }
1674 #line 395 "inform.y"
1675 { yyval.val = yyvsp[0].val; }
1678 #line 397 "inform.y"
1679 { yyval.val.v = 0; yyval.val.t = Z_BOOLEAN; }
1682 #line 399 "inform.y"
1683 { yyval.val.v = 1; yyval.val.t = Z_BOOLEAN; }
1686 #line 401 "inform.y"
1687 { yyval.val.v = 0; yyval.val.t = Z_OBJECT; }
1690 #line 404 "inform.y"
1691 { yyval.val = yyvsp[0].val; infix_assign(&yyvsp[-2].val, yyvsp[0].val.v); }
1694 #line 407 "inform.y"
1695 { yyval.val.v = infix_parent(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
1698 #line 409 "inform.y"
1699 { yyval.val.v = infix_child(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
1702 #line 411 "inform.y"
1703 { yyval.val.v = infix_sibling(yyvsp[-1].val.v); yyval.val.t = Z_OBJECT; }
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; }
1710 #line 416 "inform.y"
1712 if(!ignoreeffects) {
1713 yyval.val.v = z_random(yyvsp[-1].val.v);
1714 yyval.val.t = Z_NUMBER;
1717 yyval.val.t = Z_UNKNOWN;
1722 #line 426 "inform.y"
1727 if(!ignoreeffects) {
1728 for(p = yyvsp[-1].zlist; p && i < 16; p=p->next) {
1729 locals[i++] = p->item;
1731 mop_call(yyvsp[-3].val.v, i, locals, -2);
1733 exit_decoder = FALSE;
1734 yyval.val.v = time_ret; yyval.val.t = Z_UNKNOWN;
1736 yyval.val.v = 0; yyval.val.t = Z_UNKNOWN;
1741 #line 443 "inform.y"
1742 { if(yyvsp[-1].val.v == 0) ignoreeffects++; }
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); }
1749 #line 445 "inform.y"
1750 { if(yyvsp[-1].val.v != 0) ignoreeffects++; }
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); }
1757 #line 448 "inform.y"
1758 { yyval.val.v = !(yyvsp[0].val.v); yyval.val.t = Z_NUMBER; }
1761 #line 451 "inform.y"
1762 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v + yyvsp[0].val.v); }
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)); }
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)); }
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)); }
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)); }
1781 #line 461 "inform.y"
1782 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v & yyvsp[0].val.v); }
1785 #line 463 "inform.y"
1786 { yyval.val = z_t(yyvsp[-2].val, yyvsp[0].val, yyvsp[-2].val.v | yyvsp[0].val.v); }
1789 #line 465 "inform.y"
1790 { yyval.val = z_t(yyvsp[0].val, yyvsp[0].val, ~yyvsp[0].val.v); }
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); }
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); }
1801 #line 473 "inform.y"
1802 { yyval.val = z_t(yyvsp[0].val, yyvsp[0].val, neg(yyvsp[0].val.v)); }
1805 #line 476 "inform.y"
1806 { if(!ignoreeffects) infix_assign(&yyvsp[0].val, ARITHMASK(yyvsp[0].val.v + 1)); yyval.val = yyvsp[0].val; }
1809 #line 478 "inform.y"
1810 { yyval.val = yyvsp[-1].val; if(!ignoreeffects) infix_assign(&yyvsp[-1].val, ARITHMASK(yyvsp[-1].val.v + 1)); }
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; }
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))); }
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; }
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; }
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); }
1833 #line 498 "inform.y"
1834 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_NUMBER; }
1837 #line 500 "inform.y"
1838 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_OBJECT; }
1841 #line 502 "inform.y"
1842 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_ROUTINE; }
1845 #line 504 "inform.y"
1846 { yyval.val.v = yyvsp[0].val.v; yyval.val.t = Z_STRING; }
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); }
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); }
1857 #line 510 "inform.y"
1858 { yyval.val = yyvsp[-1].val; }
1862 #line 705 "/usr/share/bison/bison.simple"
1874 short *yyssp1 = yyss - 1;
1875 YYFPRINTF (stderr, "state stack now");
1876 while (yyssp1 != yyssp)
1877 YYFPRINTF (stderr, " %d", *++yyssp1);
1878 YYFPRINTF (stderr, "\n");
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. */
1893 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1894 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1895 yystate = yytable[yystate];
1897 yystate = yydefgoto[yyn - YYNTBASE];
1902 /*------------------------------------.
1903 | yyerrlab -- here on detecting error |
1904 `------------------------------------*/
1906 /* If not already recovering from an error, report this error. */
1911 #ifdef YYERROR_VERBOSE
1912 yyn = yypact[yystate];
1914 if (yyn > YYFLAG && yyn < YYLAST)
1916 YYSIZE_T yysize = 0;
1921 /* Start YYX at -YYN if negative to avoid negative indexes in
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);
1932 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1933 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1938 for (yyx = yyn < 0 ? -yyn : 0;
1939 yyx < (int) (sizeof (yytname) / sizeof (char *));
1941 if (yycheck[yyx + yyn] == yyx)
1943 const char *yyq = ! yycount ? ", expecting " : " or ";
1944 yyp = yystpcpy (yyp, yyq);
1945 yyp = yystpcpy (yyp, yytname[yyx]);
1950 YYSTACK_FREE (yymsg);
1953 yyerror ("parse error; also virtual memory exhausted");
1956 #endif /* defined (YYERROR_VERBOSE) */
1957 yyerror ("parse error");
1962 /*--------------------------------------------------.
1963 | yyerrlab1 -- error raised explicitly by an action |
1964 `--------------------------------------------------*/
1966 if (yyerrstatus == 3)
1968 /* If just tried and failed to reuse lookahead token after an
1969 error, discard it. */
1971 /* return failure if at end of input */
1972 if (yychar == YYEOF)
1974 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1975 yychar, yytname[yychar1]));
1979 /* Else will try to reuse lookahead token after shifting the error
1982 yyerrstatus = 3; /* Each real token shifted decrements this */
1987 /*-------------------------------------------------------------------.
1988 | yyerrdefault -- current state does not do anything special for the |
1990 `-------------------------------------------------------------------*/
1993 /* This is wrong; only states that explicitly want error tokens
1994 should shift them. */
1996 /* If its default is to accept any token, ok. Otherwise pop it. */
1997 yyn = yydefact[yystate];
2003 /*---------------------------------------------------------------.
2004 | yyerrpop -- pop the current state because it cannot handle the |
2006 `---------------------------------------------------------------*/
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");
2031 yyn = yypact[yystate];
2036 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2053 YYDPRINTF ((stderr, "Shifting error token, "));
2064 /*-------------------------------------.
2065 | yyacceptlab -- YYACCEPT comes here. |
2066 `-------------------------------------*/
2071 /*-----------------------------------.
2072 | yyabortlab -- YYABORT comes here. |
2073 `-----------------------------------*/
2078 /*---------------------------------------------.
2079 | yyoverflowab -- parser overflow comes here. |
2080 `---------------------------------------------*/
2082 yyerror ("parser stack overflow");
2089 YYSTACK_FREE (yyss);
2093 #line 514 "inform.y"
2097 { /* fanagling to get emacs indentation sane */
2101 static z_typed z_t(z_typed a, z_typed b, zword v)
2105 if(a.t == Z_NUMBER && b.t == Z_NUMBER)
2119 static name_token infix_operators[] = {
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, "::" }
2137 static name_token infix_keywords[] = {
2142 { BFALSE, "false" },
2143 { NOTHING, "nothing" },
2144 { PARENT, "parent" },
2146 { SIBLING, "sibling" },
2147 { RANDOM, "random" },
2148 { CHILDREN, "children" }
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[] = {
2158 { RALIAS, "ralias" },
2159 { UNALIAS, "unalias" },
2160 { DUMPMEM, "dumpmem" },
2161 { AUTOMAP, "automap" },
2165 { RESTORE, "restore" },
2166 { RESTART, "restart" },
2168 { RECORDON, "recording on" },
2169 { RECORDOFF, "recording off" },
2170 { REPLAY, "replay" },
2171 { REPLAYOFF, "replay off" },
2172 { SYMBOL_FILE, "symbol-file" },
2175 { PRINT, "call" }, /* No void functions in inform */
2178 { OBJECT_TREE, "object-tree" },
2179 { OBJECT_TREE, "tree" },
2181 { REMOVE, "remove" },
2183 { LIST_GLOBALS, "globals" },
2185 { CONT, "continue" },
2198 { FINISH, "finish" },
2200 { DELETE, "delete" },
2202 { DELETE, "delete breakpoints" },
2203 { COND, "condition" },
2204 { IGNORE, "ignore" },
2207 { SELECT_FRAME, "select-frame" },
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" }
2240 #include "dbg_help.h"
2242 static BOOL z_isequal(zword a, zword b)
2247 static BOOL z_isgreat(zword a, zword b)
2249 return is_greaterthan(a, b);
2252 static BOOL z_isless(zword a, zword b)
2254 return is_lessthan(a, b);
2257 static BOOL infix_provides(zword o, zword p)
2260 return (infix_get_proptable(o, p, &len) != 0);
2263 static BOOL infix_in(zword a, zword b)
2265 return infix_parent(a) == b;
2270 BOOL (*condfunc)(zword a, zword b);
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 }
2290 static BOOL is_command_identifier(char c)
2292 return isalpha(c) || (c == '-');
2295 static BOOL is_identifier(char c)
2297 return isalpha(c) || isdigit(c) || (c == '_');
2300 static BOOL is_longer_identifier(char c)
2302 return isalpha(c) || isdigit(c) || (c == '_') || (c == '.') || (c == ':');
2305 static int grab_number(z_typed *val)
2309 char c = lex_expression[lex_offset + len];
2313 /* Don't handle negativity here */
2314 if(c == '-' || c == '+')
2320 c = lex_expression[lex_offset + len];
2324 c = lex_expression[lex_offset + len];
2328 num = n_strtol(lex_expression + lex_offset + len, &endptr, base);
2330 if(endptr != lex_expression + lex_offset) {
2331 len += endptr - lex_expression - lex_offset;
2340 typedef enum { match_None, match_Partial, match_Complete } match_type;
2342 static match_type command_matches(const char *command, const char *expression,
2343 unsigned *matchedlen)
2348 for(c = 0; command[c]; c++) {
2349 if(command[c] != expression[e]) {
2350 if(!is_command_identifier(expression[e])) {
2352 return match_Partial;
2359 if(command[c] == ' ') {
2360 while(expression[e] == ' ')
2365 if(!is_command_identifier(expression[e])) {
2367 return match_Complete;
2374 static int grab_command(void)
2380 match_type best_match = match_None;
2381 unsigned best_len = 0;
2385 while(isspace(lex_expression[lex_offset]))
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) {
2393 best_match = match_Complete;
2400 if(best_match != match_Complete) {
2404 best_match = match_Partial;
2414 if(ambig && best_match != match_Complete) {
2415 infix_print_string("Ambiguous command.\n");
2420 lex_offset += best_len;
2421 return infix_commands[best].token;
2424 infix_print_string("Undefined command.\n");
2429 static void inform_help(void)
2433 BOOL is_command = FALSE;
2435 for(i = lex_offset; lex_expression[i]; i++)
2436 if(!isspace(lex_expression[i]))
2440 infix_print_string("Help is available on the following commands:\n");
2441 for(i = 0; i < sizeof(command_help) / sizeof(*command_help); i++) {
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('\'');
2450 infix_print_char(' ');
2452 infix_print_string("\n");
2456 command = grab_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);
2465 infix_print_string("No help available for that command.\n");
2470 void process_debug_command(const char *buffer)
2475 lex_expression = buffer;
2482 BOOL exp_has_locals(const char *exp)
2487 z_typed evaluate_expression(const char *exp, unsigned frame)
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);
2494 infix_selected_frame = frame;
2495 process_debug_command(new_exp);
2496 infix_selected_frame = old_frame;
2500 return inform_result;
2503 static void yyerror(const char *s)
2505 infix_print_string(s);
2506 infix_print_char(10);
2509 static int yylex(void)
2511 unsigned i, len, longer;
2512 BOOL check_command = FALSE;
2515 check_command = TRUE;
2517 while(isspace(lex_expression[lex_offset]))
2521 return grab_command();
2524 if((len = grab_number(&yylval.val)) != 0) {
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;
2537 for(i = 0; i < sizeof(conditionlist) / sizeof(*conditionlist); i++) {
2538 len = n_strlen(conditionlist[i].name);
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]))) {
2546 yylval.cond.condfunc = conditionlist[i].condfunc;
2547 yylval.cond.opposite = conditionlist[i].opposite;
2552 if((len = infix_find_file(&yylval.filenum, lex_expression + lex_offset)) != 0) {
2558 for(len = 0; is_identifier(lex_expression[lex_offset + len]); len++)
2562 return lex_expression[lex_offset++];
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)) {
2567 return infix_keywords[i].token;
2571 for(longer = len; is_longer_identifier(lex_expression[lex_offset + longer]); longer++)
2574 if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, longer)) {
2575 lex_offset += longer;
2579 if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, len)) {
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");
2592 #endif /* DEBUGGING */