Played around with nitfol build process, adding rules to generate the
[projects/chimara/chimara.git] / interpreters / nitfol / inform.c
1
2 /* A Bison parser, made by GNU Bison 2.4.1.  */
3
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5    
6       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7    Free Software Foundation, Inc.
8    
9    This program is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 /* As a special exception, you may create a larger work that contains
23    part or all of the Bison parser skeleton and distribute that work
24    under terms of your choice, so long as that work isn't itself a
25    parser generator using the skeleton or a modified version thereof
26    as a parser skeleton.  Alternatively, if you modify or redistribute
27    the parser skeleton itself, you may (at your option) remove this
28    special exception, which will cause the skeleton and the resulting
29    Bison output files to be licensed under the GNU General Public
30    License without this special exception.
31    
32    This special exception was added by the Free Software Foundation in
33    version 2.2 of Bison.  */
34
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36    simplifying the original so-called "semantic" parser.  */
37
38 /* All symbols defined below should begin with yy or YY, to avoid
39    infringing on user name space.  This should be done even for local
40    variables, as they might otherwise be expanded by user macros.
41    There are some unavoidable exceptions within include files to
42    define necessary library symbols; they are noted "INFRINGES ON
43    USER NAME SPACE" below.  */
44
45 /* Identify Bison output.  */
46 #define YYBISON 1
47
48 /* Bison version.  */
49 #define YYBISON_VERSION "2.4.1"
50
51 /* Skeleton name.  */
52 #define YYSKELETON_NAME "yacc.c"
53
54 /* Pure parsers.  */
55 #define YYPURE 0
56
57 /* Push parsers.  */
58 #define YYPUSH 0
59
60 /* Pull parsers.  */
61 #define YYPULL 1
62
63 /* Using locations.  */
64 #define YYLSP_NEEDED 0
65
66
67
68 /* Copy the first part of user declarations.  */
69
70 /* Line 189 of yacc.c  */
71 #line 1 "inform.y"
72
73 /*  Nitfol - z-machine interpreter using Glk for output.
74     Copyright (C) 1999  Evin Robertson
75
76     This program is free software; you can redistribute it and/or modify
77     it under the terms of the GNU General Public License as published by
78     the Free Software Foundation; either version 2 of the License, or
79     (at your option) any later version.
80
81     This program is distributed in the hope that it will be useful,
82     but WITHOUT ANY WARRANTY; without even the implied warranty of
83     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
84     GNU General Public License for more details.
85
86     You should have received a copy of the GNU General Public License
87     along with this program; if not, write to the Free Software
88     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
89
90     The author can be reached at ecr+@andrew.cmu.edu
91 */
92
93 #include "nitfol.h"
94 #include <ctype.h>
95
96 /* bison uses str* functions; make it use n_str* instead... */
97 #ifndef n_strcat
98 #define strcat(d, s) n_strcat(d, s)
99 #endif
100 #ifndef n_strlen
101 #define strlen(s) n_strlen(s)
102 #endif
103 #ifndef n_strcpy
104 #define strcpy(d, s) n_strcpy(d, s)
105 #endif
106   
107   
108 #ifdef DEBUGGING
109   
110   typedef struct zword_list zword_list;
111   struct zword_list {
112     zword_list *next;
113     zword item;
114   };
115
116   typedef struct cond_list cond_list;
117   struct cond_list {
118     cond_list *next;
119     zword val;
120     BOOL (*condfunc)(zword a, zword b);
121     BOOL opposite;
122   };
123
124   cond_list *condlist;
125   
126   static z_typed z_t(z_typed a, z_typed b, zword v);
127   
128   static const char *lex_expression;
129   static int lex_offset;
130
131   static const char *lex_tail(void) {
132     const char *t = lex_expression + lex_offset;
133     while(*t == ' ')
134       t++;
135     lex_offset = n_strlen(lex_expression);
136     return t;
137   }
138   
139   static z_typed inform_result;
140   
141   static int yylex(void);
142   static void yyerror(const char *s);
143   static void inform_help(void);
144   
145   int ignoreeffects;
146
147 #define YYERROR_VERBOSE
148   
149 /*
150 #define YYDEBUG 1
151 */
152
153
154
155 /* Line 189 of yacc.c  */
156 #line 157 "inform.c"
157
158 /* Enabling traces.  */
159 #ifndef YYDEBUG
160 # define YYDEBUG 0
161 #endif
162
163 /* Enabling verbose error messages.  */
164 #ifdef YYERROR_VERBOSE
165 # undef YYERROR_VERBOSE
166 # define YYERROR_VERBOSE 1
167 #else
168 # define YYERROR_VERBOSE 0
169 #endif
170
171 /* Enabling the token table.  */
172 #ifndef YYTOKEN_TABLE
173 # define YYTOKEN_TABLE 0
174 #endif
175
176
177 /* Tokens.  */
178 #ifndef YYTOKENTYPE
179 # define YYTOKENTYPE
180    /* Put the tokens into the symbol table, so that GDB and other debuggers
181       know about them.  */
182    enum yytokentype {
183      NUM = 258,
184      DFILE = 259,
185      CONDITION = 260,
186      ALIAS = 261,
187      RALIAS = 262,
188      UNALIAS = 263,
189      DUMPMEM = 264,
190      AUTOMAP = 265,
191      HELP = 266,
192      UNDO = 267,
193      REDO = 268,
194      LANGUAGE = 269,
195      INFOSOURCE = 270,
196      INFOSOURCES = 271,
197      COPYING = 272,
198      WARRANTY = 273,
199      PRINT = 274,
200      SET = 275,
201      MOVE = 276,
202      TO = 277,
203      GIVE = 278,
204      REMOVE = 279,
205      JUMP = 280,
206      CONT = 281,
207      STEP = 282,
208      NEXT = 283,
209      UNTIL = 284,
210      STEPI = 285,
211      NEXTI = 286,
212      FINISH = 287,
213      BREAK = 288,
214      DELETE = 289,
215      IF = 290,
216      COND = 291,
217      IGNORE = 292,
218      BREAKPOINTS = 293,
219      RESTORE = 294,
220      RESTART = 295,
221      QUIT = 296,
222      RECORDON = 297,
223      RECORDOFF = 298,
224      REPLAY = 299,
225      REPLAYOFF = 300,
226      SYMBOL_FILE = 301,
227      FRAME = 302,
228      SELECT_FRAME = 303,
229      BACKTRACE = 304,
230      UP_FRAME = 305,
231      DOWN_FRAME = 306,
232      UP_SILENTLY = 307,
233      DOWN_SILENTLY = 308,
234      DISPLAY = 309,
235      UNDISPLAY = 310,
236      DISABLE_DISPLAY = 311,
237      ENABLE_DISPLAY = 312,
238      DISABLE_BREAK = 313,
239      ENABLE_BREAK = 314,
240      OBJECT_TREE = 315,
241      FIND = 316,
242      LIST_GLOBALS = 317,
243      BTRUE = 318,
244      BFALSE = 319,
245      NOTHING = 320,
246      PARENT = 321,
247      CHILD = 322,
248      SIBLING = 323,
249      CHILDREN = 324,
250      RANDOM = 325,
251      NOTNOT = 326,
252      OROR = 327,
253      ANDAND = 328,
254      OR = 329,
255      WORDARRAY = 330,
256      BYTEARRAY = 331,
257      precNEG = 332,
258      LOCAL = 333,
259      GLOBAL = 334,
260      STRING = 335,
261      ROUTINE = 336,
262      OBJECT = 337,
263      NUMBER = 338,
264      DECREMENT = 339,
265      INCREMENT = 340,
266      PROPLENGTH = 341,
267      PROPADDR = 342,
268      SUPERCLASS = 343
269    };
270 #endif
271 /* Tokens.  */
272 #define NUM 258
273 #define DFILE 259
274 #define CONDITION 260
275 #define ALIAS 261
276 #define RALIAS 262
277 #define UNALIAS 263
278 #define DUMPMEM 264
279 #define AUTOMAP 265
280 #define HELP 266
281 #define UNDO 267
282 #define REDO 268
283 #define LANGUAGE 269
284 #define INFOSOURCE 270
285 #define INFOSOURCES 271
286 #define COPYING 272
287 #define WARRANTY 273
288 #define PRINT 274
289 #define SET 275
290 #define MOVE 276
291 #define TO 277
292 #define GIVE 278
293 #define REMOVE 279
294 #define JUMP 280
295 #define CONT 281
296 #define STEP 282
297 #define NEXT 283
298 #define UNTIL 284
299 #define STEPI 285
300 #define NEXTI 286
301 #define FINISH 287
302 #define BREAK 288
303 #define DELETE 289
304 #define IF 290
305 #define COND 291
306 #define IGNORE 292
307 #define BREAKPOINTS 293
308 #define RESTORE 294
309 #define RESTART 295
310 #define QUIT 296
311 #define RECORDON 297
312 #define RECORDOFF 298
313 #define REPLAY 299
314 #define REPLAYOFF 300
315 #define SYMBOL_FILE 301
316 #define FRAME 302
317 #define SELECT_FRAME 303
318 #define BACKTRACE 304
319 #define UP_FRAME 305
320 #define DOWN_FRAME 306
321 #define UP_SILENTLY 307
322 #define DOWN_SILENTLY 308
323 #define DISPLAY 309
324 #define UNDISPLAY 310
325 #define DISABLE_DISPLAY 311
326 #define ENABLE_DISPLAY 312
327 #define DISABLE_BREAK 313
328 #define ENABLE_BREAK 314
329 #define OBJECT_TREE 315
330 #define FIND 316
331 #define LIST_GLOBALS 317
332 #define BTRUE 318
333 #define BFALSE 319
334 #define NOTHING 320
335 #define PARENT 321
336 #define CHILD 322
337 #define SIBLING 323
338 #define CHILDREN 324
339 #define RANDOM 325
340 #define NOTNOT 326
341 #define OROR 327
342 #define ANDAND 328
343 #define OR 329
344 #define WORDARRAY 330
345 #define BYTEARRAY 331
346 #define precNEG 332
347 #define LOCAL 333
348 #define GLOBAL 334
349 #define STRING 335
350 #define ROUTINE 336
351 #define OBJECT 337
352 #define NUMBER 338
353 #define DECREMENT 339
354 #define INCREMENT 340
355 #define PROPLENGTH 341
356 #define PROPADDR 342
357 #define SUPERCLASS 343
358
359
360
361
362 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
363 typedef union YYSTYPE
364 {
365
366 /* Line 214 of yacc.c  */
367 #line 84 "inform.y"
368
369   glui32 pcoffset;
370   infix_file *filenum;
371   z_typed val;
372   
373   zword_list *zlist;
374
375   struct {
376     BOOL (*condfunc)(zword a, zword b);
377     BOOL opposite;
378   } cond;
379
380   BOOL flag;
381
382
383
384 /* Line 214 of yacc.c  */
385 #line 386 "inform.c"
386 } YYSTYPE;
387 # define YYSTYPE_IS_TRIVIAL 1
388 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
389 # define YYSTYPE_IS_DECLARED 1
390 #endif
391
392
393 /* Copy the second part of user declarations.  */
394
395
396 /* Line 264 of yacc.c  */
397 #line 398 "inform.c"
398
399 #ifdef short
400 # undef short
401 #endif
402
403 #ifdef YYTYPE_UINT8
404 typedef YYTYPE_UINT8 yytype_uint8;
405 #else
406 typedef unsigned char yytype_uint8;
407 #endif
408
409 #ifdef YYTYPE_INT8
410 typedef YYTYPE_INT8 yytype_int8;
411 #elif (defined __STDC__ || defined __C99__FUNC__ \
412      || defined __cplusplus || defined _MSC_VER)
413 typedef signed char yytype_int8;
414 #else
415 typedef short int yytype_int8;
416 #endif
417
418 #ifdef YYTYPE_UINT16
419 typedef YYTYPE_UINT16 yytype_uint16;
420 #else
421 typedef unsigned short int yytype_uint16;
422 #endif
423
424 #ifdef YYTYPE_INT16
425 typedef YYTYPE_INT16 yytype_int16;
426 #else
427 typedef short int yytype_int16;
428 #endif
429
430 #ifndef YYSIZE_T
431 # ifdef __SIZE_TYPE__
432 #  define YYSIZE_T __SIZE_TYPE__
433 # elif defined size_t
434 #  define YYSIZE_T size_t
435 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
436      || defined __cplusplus || defined _MSC_VER)
437 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
438 #  define YYSIZE_T size_t
439 # else
440 #  define YYSIZE_T unsigned int
441 # endif
442 #endif
443
444 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
445
446 #ifndef YY_
447 # if YYENABLE_NLS
448 #  if ENABLE_NLS
449 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
450 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
451 #  endif
452 # endif
453 # ifndef YY_
454 #  define YY_(msgid) msgid
455 # endif
456 #endif
457
458 /* Suppress unused-variable warnings by "using" E.  */
459 #if ! defined lint || defined __GNUC__
460 # define YYUSE(e) ((void) (e))
461 #else
462 # define YYUSE(e) /* empty */
463 #endif
464
465 /* Identity function, used to suppress warnings about constant conditions.  */
466 #ifndef lint
467 # define YYID(n) (n)
468 #else
469 #if (defined __STDC__ || defined __C99__FUNC__ \
470      || defined __cplusplus || defined _MSC_VER)
471 static int
472 YYID (int yyi)
473 #else
474 static int
475 YYID (yyi)
476     int yyi;
477 #endif
478 {
479   return yyi;
480 }
481 #endif
482
483 #if ! defined yyoverflow || YYERROR_VERBOSE
484
485 /* The parser invokes alloca or malloc; define the necessary symbols.  */
486
487 # ifdef YYSTACK_USE_ALLOCA
488 #  if YYSTACK_USE_ALLOCA
489 #   ifdef __GNUC__
490 #    define YYSTACK_ALLOC __builtin_alloca
491 #   elif defined __BUILTIN_VA_ARG_INCR
492 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
493 #   elif defined _AIX
494 #    define YYSTACK_ALLOC __alloca
495 #   elif defined _MSC_VER
496 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
497 #    define alloca _alloca
498 #   else
499 #    define YYSTACK_ALLOC alloca
500 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
501      || defined __cplusplus || defined _MSC_VER)
502 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
503 #     ifndef _STDLIB_H
504 #      define _STDLIB_H 1
505 #     endif
506 #    endif
507 #   endif
508 #  endif
509 # endif
510
511 # ifdef YYSTACK_ALLOC
512    /* Pacify GCC's `empty if-body' warning.  */
513 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
514 #  ifndef YYSTACK_ALLOC_MAXIMUM
515     /* The OS might guarantee only one guard page at the bottom of the stack,
516        and a page size can be as small as 4096 bytes.  So we cannot safely
517        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
518        to allow for a few compiler-allocated temporary stack slots.  */
519 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
520 #  endif
521 # else
522 #  define YYSTACK_ALLOC YYMALLOC
523 #  define YYSTACK_FREE YYFREE
524 #  ifndef YYSTACK_ALLOC_MAXIMUM
525 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
526 #  endif
527 #  if (defined __cplusplus && ! defined _STDLIB_H \
528        && ! ((defined YYMALLOC || defined malloc) \
529              && (defined YYFREE || defined free)))
530 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
531 #   ifndef _STDLIB_H
532 #    define _STDLIB_H 1
533 #   endif
534 #  endif
535 #  ifndef YYMALLOC
536 #   define YYMALLOC malloc
537 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
538      || defined __cplusplus || defined _MSC_VER)
539 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
540 #   endif
541 #  endif
542 #  ifndef YYFREE
543 #   define YYFREE free
544 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
545      || defined __cplusplus || defined _MSC_VER)
546 void free (void *); /* INFRINGES ON USER NAME SPACE */
547 #   endif
548 #  endif
549 # endif
550 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
551
552
553 #if (! defined yyoverflow \
554      && (! defined __cplusplus \
555          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
556
557 /* A type that is properly aligned for any stack member.  */
558 union yyalloc
559 {
560   yytype_int16 yyss_alloc;
561   YYSTYPE yyvs_alloc;
562 };
563
564 /* The size of the maximum gap between one aligned stack and the next.  */
565 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
566
567 /* The size of an array large to enough to hold all stacks, each with
568    N elements.  */
569 # define YYSTACK_BYTES(N) \
570      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
571       + YYSTACK_GAP_MAXIMUM)
572
573 /* Copy COUNT objects from FROM to TO.  The source and destination do
574    not overlap.  */
575 # ifndef YYCOPY
576 #  if defined __GNUC__ && 1 < __GNUC__
577 #   define YYCOPY(To, From, Count) \
578       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
579 #  else
580 #   define YYCOPY(To, From, Count)              \
581       do                                        \
582         {                                       \
583           YYSIZE_T yyi;                         \
584           for (yyi = 0; yyi < (Count); yyi++)   \
585             (To)[yyi] = (From)[yyi];            \
586         }                                       \
587       while (YYID (0))
588 #  endif
589 # endif
590
591 /* Relocate STACK from its old location to the new one.  The
592    local variables YYSIZE and YYSTACKSIZE give the old and new number of
593    elements in the stack, and YYPTR gives the new location of the
594    stack.  Advance YYPTR to a properly aligned location for the next
595    stack.  */
596 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
597     do                                                                  \
598       {                                                                 \
599         YYSIZE_T yynewbytes;                                            \
600         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
601         Stack = &yyptr->Stack_alloc;                                    \
602         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
603         yyptr += yynewbytes / sizeof (*yyptr);                          \
604       }                                                                 \
605     while (YYID (0))
606
607 #endif
608
609 /* YYFINAL -- State number of the termination state.  */
610 #define YYFINAL  117
611 /* YYLAST -- Last index in YYTABLE.  */
612 #define YYLAST   351
613
614 /* YYNTOKENS -- Number of terminals.  */
615 #define YYNTOKENS  104
616 /* YYNNTS -- Number of nonterminals.  */
617 #define YYNNTS  11
618 /* YYNRULES -- Number of rules.  */
619 #define YYNRULES  131
620 /* YYNRULES -- Number of states.  */
621 #define YYNSTATES  208
622
623 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
624 #define YYUNDEFTOK  2
625 #define YYMAXUTOK   343
626
627 #define YYTRANSLATE(YYX)                                                \
628   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
629
630 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
631 static const yytype_uint8 yytranslate[] =
632 {
633        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
634        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
635        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
636        2,     2,     2,     2,     2,   101,     2,    81,    82,     2,
637       98,   103,    79,    77,    71,    78,    99,    80,     2,     2,
638        2,     2,     2,     2,     2,     2,     2,     2,   102,     2,
639        2,    72,     2,     2,     2,     2,     2,     2,     2,     2,
640        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
641        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
642        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
643        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
644        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
645        2,     2,     2,     2,    83,     2,    84,     2,     2,     2,
646        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
647        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
648        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
649        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
650        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
651        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
652        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
653        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
654        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
655        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
656        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
657        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
658        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
659        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
660       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
661       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
662       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
663       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
664       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
665       65,    66,    67,    68,    69,    70,    73,    74,    75,    76,
666       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
667       95,    96,    97,   100
668 };
669
670 #if YYDEBUG
671 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
672    YYRHS.  */
673 static const yytype_uint16 yyprhs[] =
674 {
675        0,     0,     3,     4,     6,     8,    10,    12,    14,    16,
676       18,    20,    22,    24,    26,    28,    30,    32,    34,    36,
677       38,    41,    44,    46,    49,    52,    55,    60,    62,    65,
678       67,    69,    72,    76,    81,    84,    87,    89,    92,    94,
679       97,    99,   102,   104,   106,   109,   111,   114,   116,   119,
680      123,   126,   130,   133,   135,   138,   141,   144,   146,   148,
681      150,   152,   154,   156,   159,   162,   164,   167,   169,   172,
682      174,   177,   179,   182,   184,   187,   191,   193,   196,   199,
683      203,   206,   208,   212,   213,   217,   219,   221,   225,   229,
684      230,   235,   237,   239,   241,   243,   247,   252,   257,   262,
685      267,   272,   277,   278,   283,   284,   289,   292,   296,   300,
686      304,   308,   312,   316,   320,   323,   327,   331,   334,   337,
687      340,   343,   346,   350,   354,   358,   361,   364,   367,   370,
688      373,   376
689 };
690
691 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
692 static const yytype_int8 yyrhs[] =
693 {
694      105,     0,    -1,    -1,   101,    -1,     9,    -1,     6,    -1,
695        7,    -1,     8,    -1,    10,    -1,    11,    -1,    40,    -1,
696       39,    -1,    42,    -1,    43,    -1,    44,    -1,    45,    -1,
697       41,    -1,    12,    -1,    13,    -1,    46,    -1,    19,   109,
698       -1,    20,   109,    -1,    54,    -1,    55,     3,    -1,    56,
699        3,    -1,    57,     3,    -1,    21,   109,    22,   109,    -1,
700       60,    -1,    60,   109,    -1,    61,    -1,    62,    -1,    62,
701      109,    -1,    23,   109,     3,    -1,    23,   109,    84,     3,
702       -1,    24,   109,    -1,    25,   106,    -1,    26,    -1,    26,
703        3,    -1,    27,    -1,    27,     3,    -1,    28,    -1,    28,
704        3,    -1,    29,    -1,    30,    -1,    30,     3,    -1,    31,
705       -1,    31,     3,    -1,    32,    -1,    33,   106,    -1,    33,
706      106,    35,    -1,    36,     3,    -1,    37,     3,     3,    -1,
707       34,     3,    -1,    38,    -1,    38,     3,    -1,    58,     3,
708       -1,    59,     3,    -1,    14,    -1,    15,    -1,    16,    -1,
709       17,    -1,    18,    -1,    47,    -1,    47,     3,    -1,    48,
710        3,    -1,    50,    -1,    50,     3,    -1,    52,    -1,    52,
711        3,    -1,    51,    -1,    51,     3,    -1,    53,    -1,    53,
712        3,    -1,    49,    -1,    49,     3,    -1,    49,    78,     3,
713       -1,     3,    -1,    77,     3,    -1,    78,     3,    -1,     4,
714      102,     3,    -1,    79,     3,    -1,   112,    -1,   107,    76,
715      112,    -1,    -1,   112,    71,   108,    -1,   112,    -1,   110,
716       -1,   109,    71,   112,    -1,   109,    71,   110,    -1,    -1,
717      112,     5,   111,   107,    -1,     3,    -1,    64,    -1,    63,
718       -1,    65,    -1,   112,    72,   112,    -1,    66,    98,   109,
719      103,    -1,    67,    98,   109,   103,    -1,    68,    98,   109,
720      103,    -1,    69,    98,   109,   103,    -1,    70,    98,   109,
721      103,    -1,   112,    98,   108,   103,    -1,    -1,   112,    75,
722      113,   112,    -1,    -1,   112,    74,   114,   112,    -1,    73,
723      112,    -1,   112,    77,   112,    -1,   112,    78,   112,    -1,
724      112,    79,   112,    -1,   112,    80,   112,    -1,   112,    81,
725      112,    -1,   112,    82,   112,    -1,   112,    83,   112,    -1,
726       84,   112,    -1,   112,    86,   112,    -1,   112,    85,   112,
727       -1,    78,   112,    -1,    95,   112,    -1,   112,    95,    -1,
728       94,   112,    -1,   112,    94,    -1,   112,    97,   112,    -1,
729      112,    96,   112,    -1,   112,    99,   112,    -1,    93,   112,
730       -1,    92,   112,    -1,    91,   112,    -1,    90,   112,    -1,
731       89,   112,    -1,    88,   112,    -1,    98,   109,   103,    -1
732 };
733
734 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
735 static const yytype_uint16 yyrline[] =
736 {
737        0,   130,   130,   132,   134,   142,   144,   146,   148,   150,
738      152,   154,   165,   167,   169,   171,   173,   175,   182,   189,
739      198,   200,   202,   204,   206,   208,   210,   212,   214,   216,
740      221,   239,   255,   257,   259,   261,   263,   265,   267,   269,
741      271,   273,   275,   277,   279,   281,   283,   285,   287,   289,
742      291,   293,   295,   297,   299,   301,   303,   305,   307,   309,
743      311,   313,   315,   317,   319,   321,   323,   325,   327,   329,
744      331,   333,   335,   337,   339,   341,   349,   350,   351,   352,
745      353,   357,   364,   377,   378,   382,   383,   384,   385,   390,
746      390,   394,   396,   398,   400,   403,   406,   408,   410,   412,
747      415,   425,   443,   443,   445,   445,   447,   450,   452,   454,
748      456,   458,   460,   462,   464,   467,   469,   472,   475,   477,
749      479,   481,   484,   486,   489,   497,   499,   501,   503,   505,
750      507,   509
751 };
752 #endif
753
754 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
755 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
756    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
757 static const char *const yytname[] =
758 {
759   "$end", "error", "$undefined", "NUM", "DFILE", "CONDITION", "ALIAS",
760   "RALIAS", "UNALIAS", "DUMPMEM", "AUTOMAP", "HELP", "UNDO", "REDO",
761   "LANGUAGE", "INFOSOURCE", "INFOSOURCES", "COPYING", "WARRANTY", "PRINT",
762   "SET", "MOVE", "TO", "GIVE", "REMOVE", "JUMP", "CONT", "STEP", "NEXT",
763   "UNTIL", "STEPI", "NEXTI", "FINISH", "BREAK", "DELETE", "IF", "COND",
764   "IGNORE", "BREAKPOINTS", "RESTORE", "RESTART", "QUIT", "RECORDON",
765   "RECORDOFF", "REPLAY", "REPLAYOFF", "SYMBOL_FILE", "FRAME",
766   "SELECT_FRAME", "BACKTRACE", "UP_FRAME", "DOWN_FRAME", "UP_SILENTLY",
767   "DOWN_SILENTLY", "DISPLAY", "UNDISPLAY", "DISABLE_DISPLAY",
768   "ENABLE_DISPLAY", "DISABLE_BREAK", "ENABLE_BREAK", "OBJECT_TREE", "FIND",
769   "LIST_GLOBALS", "BTRUE", "BFALSE", "NOTHING", "PARENT", "CHILD",
770   "SIBLING", "CHILDREN", "RANDOM", "','", "'='", "NOTNOT", "OROR",
771   "ANDAND", "OR", "'+'", "'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'~'",
772   "WORDARRAY", "BYTEARRAY", "precNEG", "LOCAL", "GLOBAL", "STRING",
773   "ROUTINE", "OBJECT", "NUMBER", "DECREMENT", "INCREMENT", "PROPLENGTH",
774   "PROPADDR", "'('", "'.'", "SUPERCLASS", "'#'", "':'", "')'", "$accept",
775   "input", "linespec", "orlist", "arglist", "commaexp", "condexp", "$@1",
776   "exp", "$@2", "$@3", 0
777 };
778 #endif
779
780 # ifdef YYPRINT
781 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
782    token YYLEX-NUM.  */
783 static const yytype_uint16 yytoknum[] =
784 {
785        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
786      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
787      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
788      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
789      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
790      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
791      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
792      325,    44,    61,   326,   327,   328,   329,    43,    45,    42,
793       47,    37,    38,   124,   126,   330,   331,   332,   333,   334,
794      335,   336,   337,   338,   339,   340,   341,   342,    40,    46,
795      343,    35,    58,    41
796 };
797 # endif
798
799 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
800 static const yytype_uint8 yyr1[] =
801 {
802        0,   104,   105,   105,   105,   105,   105,   105,   105,   105,
803      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
804      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
805      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
806      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
807      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
808      105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
809      105,   105,   105,   105,   105,   105,   106,   106,   106,   106,
810      106,   107,   107,   108,   108,   109,   109,   109,   109,   111,
811      110,   112,   112,   112,   112,   112,   112,   112,   112,   112,
812      112,   112,   113,   112,   114,   112,   112,   112,   112,   112,
813      112,   112,   112,   112,   112,   112,   112,   112,   112,   112,
814      112,   112,   112,   112,   112,   112,   112,   112,   112,   112,
815      112,   112
816 };
817
818 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
819 static const yytype_uint8 yyr2[] =
820 {
821        0,     2,     0,     1,     1,     1,     1,     1,     1,     1,
822        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
823        2,     2,     1,     2,     2,     2,     4,     1,     2,     1,
824        1,     2,     3,     4,     2,     2,     1,     2,     1,     2,
825        1,     2,     1,     1,     2,     1,     2,     1,     2,     3,
826        2,     3,     2,     1,     2,     2,     2,     1,     1,     1,
827        1,     1,     1,     2,     2,     1,     2,     1,     2,     1,
828        2,     1,     2,     1,     2,     3,     1,     2,     2,     3,
829        2,     1,     3,     0,     3,     1,     1,     3,     3,     0,
830        4,     1,     1,     1,     1,     3,     4,     4,     4,     4,
831        4,     4,     0,     4,     0,     4,     2,     3,     3,     3,
832        3,     3,     3,     3,     2,     3,     3,     2,     2,     2,
833        2,     2,     3,     3,     3,     2,     2,     2,     2,     2,
834        2,     3
835 };
836
837 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
838    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
839    means the default is an error.  */
840 static const yytype_uint8 yydefact[] =
841 {
842        2,     5,     6,     7,     4,     8,     9,    17,    18,    57,
843       58,    59,    60,    61,     0,     0,     0,     0,     0,     0,
844       36,    38,    40,    42,    43,    45,    47,     0,     0,     0,
845        0,    53,    11,    10,    16,    12,    13,    14,    15,    19,
846       62,     0,    73,    65,    69,    67,    71,    22,     0,     0,
847        0,     0,     0,    27,    29,    30,     3,     0,    91,    93,
848       92,    94,     0,     0,     0,     0,     0,     0,     0,     0,
849        0,     0,     0,     0,     0,     0,     0,     0,     0,    20,
850       86,    85,    21,     0,     0,    34,    76,     0,     0,     0,
851        0,    35,    37,    39,    41,    44,    46,    48,    52,    50,
852        0,    54,    63,    64,    74,     0,    66,    70,    68,    72,
853       23,    24,    25,    55,    56,    28,    31,     1,     0,     0,
854        0,     0,     0,   106,   117,   114,   130,   129,   128,   127,
855      126,   125,   120,   118,     0,     0,    89,     0,   104,   102,
856        0,     0,     0,     0,     0,     0,     0,     0,     0,   121,
857      119,     0,     0,    83,     0,     0,    32,     0,     0,    77,
858       78,    80,    49,    51,    75,     0,     0,     0,     0,     0,
859      131,    88,    87,     0,    95,     0,     0,   107,   108,   109,
860      110,   111,   112,   113,   116,   115,   123,   122,     0,     0,
861      124,    26,    33,    79,    96,    97,    98,    99,   100,    90,
862       81,   105,   103,   101,    83,     0,    84,    82
863 };
864
865 /* YYDEFGOTO[NTERM-NUM].  */
866 static const yytype_int16 yydefgoto[] =
867 {
868       -1,    57,    91,   199,   188,    79,    80,   173,    81,   176,
869      175
870 };
871
872 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
873    STATE-NUM.  */
874 #define YYPACT_NINF -65
875 static const yytype_int16 yypact[] =
876 {
877      137,   -65,   -65,   -65,   -65,   -65,   -65,   -65,   -65,   -65,
878      -65,   -65,   -65,   -65,   156,   156,   156,   156,   156,    16,
879       28,    33,    34,   -65,    36,    44,   -65,    16,    46,    47,
880       48,    49,   -65,   -65,   -65,   -65,   -65,   -65,   -65,   -65,
881       55,    56,    14,    57,    58,    59,    68,   -65,    70,    72,
882       73,    84,    93,   156,   -65,   156,   -65,    97,   -65,   -65,
883      -65,   -65,     0,     2,     3,     4,    10,   156,   156,   156,
884      156,   156,   156,   156,   156,   156,   156,   156,   156,    38,
885      -65,   195,    38,    -7,    15,    38,   -65,     9,   118,   127,
886      134,   -65,   -65,   -65,   -65,   -65,   -65,   103,   -65,   -65,
887      136,   -65,   -65,   -65,   -65,   169,   -65,   -65,   -65,   -65,
888      -65,   -65,   -65,   -65,   -65,    38,    38,   -65,   156,   156,
889      156,   156,   156,    37,   -29,   116,   -29,   -29,   -29,   -29,
890      -29,   -29,    30,    30,   -55,   156,   -65,   156,   -65,   -65,
891      156,   156,   156,   156,   156,   156,   156,   156,   156,   -65,
892      -65,   156,   156,   156,   156,   156,   -65,   200,   201,   -65,
893      -65,   -65,   -65,   -65,   -65,   -50,   -49,   -48,   -47,   -46,
894      -65,   -65,   195,   156,   252,   156,   156,   -53,   -53,   116,
895      116,   116,   116,   116,   -29,   -29,   -64,   -64,   102,   224,
896      -65,    38,   -65,   -65,   -65,   -65,   -65,   -65,   -65,   130,
897      252,    37,    37,   -65,   156,   156,   -65,   252
898 };
899
900 /* YYPGOTO[NTERM-NUM].  */
901 static const yytype_int16 yypgoto[] =
902 {
903      -65,   -65,   180,   -65,     5,   -15,    81,   -65,   -63,   -65,
904      -65
905 };
906
907 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
908    positive, shift that token.  If negative, reduce the rule which
909    number is the opposite.  If zero, do what YYDEFACT says.
910    If YYTABLE_NINF, syntax error.  */
911 #define YYTABLE_NINF -1
912 static const yytype_int16 yytable[] =
913 {
914       82,    83,    84,    85,   123,   124,   125,   126,   127,   128,
915      129,   130,   131,   132,   133,   155,   135,   104,   156,    86,
916       87,   135,   135,   135,   135,   135,   142,   143,   144,   145,
917      146,    92,   147,   148,   153,   154,    93,    94,   115,    95,
918      116,   149,   150,   151,   152,   153,   154,    96,   170,    98,
919       99,   100,   101,   194,   195,   196,   197,   198,   102,   103,
920      106,   107,   108,   134,   135,   149,   150,   151,   152,   153,
921      154,   109,   172,   110,   174,   111,   112,   177,   178,   179,
922      180,   181,   182,   183,   184,   185,   135,   113,   186,   187,
923      189,   190,   105,    88,    89,    90,   114,   117,   118,   157,
924      119,   120,   121,   165,   166,   167,   168,   169,   122,   135,
925      200,   158,   201,   202,   140,   141,   142,   143,   144,   145,
926      146,   159,   147,   148,    -1,    -1,   151,   152,   153,   154,
927      160,   149,   150,   151,   152,   153,   154,   161,   162,   163,
928      191,   189,   207,     1,     2,     3,     4,     5,     6,     7,
929        8,     9,    10,    11,    12,    13,    14,    15,    16,    58,
930       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
931       27,    28,   164,    29,    30,    31,    32,    33,    34,    35,
932       36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
933       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
934      136,   147,   148,   192,   193,   203,   205,    97,     0,   206,
935      149,   150,   151,   152,   153,   154,   171,     0,     0,    59,
936       60,    61,    62,    63,    64,    65,    66,     0,     0,    67,
937        0,     0,     0,     0,    68,     0,     0,     0,    56,     0,
938       69,     0,     0,     0,    70,    71,    72,    73,    74,    75,
939       76,    77,     0,     0,    78,     0,     0,     0,     0,     0,
940        0,     0,     0,     0,     0,     0,     0,   137,     0,   138,
941      139,     0,   140,   141,   142,   143,   144,   145,   146,     0,
942      147,   148,     0,     0,     0,     0,     0,     0,     0,   149,
943      150,   151,   152,   153,   154,   204,   137,     0,   138,   139,
944        0,   140,   141,   142,   143,   144,   145,   146,     0,   147,
945      148,     0,     0,     0,     0,     0,     0,     0,   149,   150,
946      151,   152,   153,   154,   137,     0,   138,   139,     0,   140,
947      141,   142,   143,   144,   145,   146,     0,   147,   148,     0,
948        0,     0,     0,     0,     0,     0,   149,   150,   151,   152,
949      153,   154
950 };
951
952 static const yytype_int16 yycheck[] =
953 {
954       15,    16,    17,    18,    67,    68,    69,    70,    71,    72,
955       73,    74,    75,    76,    77,    22,    71,     3,     3,     3,
956        4,    71,    71,    71,    71,    71,    79,    80,    81,    82,
957       83,     3,    85,    86,    98,    99,     3,     3,    53,     3,
958       55,    94,    95,    96,    97,    98,    99,     3,   103,     3,
959        3,     3,     3,   103,   103,   103,   103,   103,     3,     3,
960        3,     3,     3,    78,    71,    94,    95,    96,    97,    98,
961       99,     3,   135,     3,   137,     3,     3,   140,   141,   142,
962      143,   144,   145,   146,   147,   148,    71,     3,   151,   152,
963      153,   154,    78,    77,    78,    79,     3,     0,    98,    84,
964       98,    98,    98,   118,   119,   120,   121,   122,    98,    71,
965      173,   102,   175,   176,    77,    78,    79,    80,    81,    82,
966       83,     3,    85,    86,    94,    95,    96,    97,    98,    99,
967        3,    94,    95,    96,    97,    98,    99,     3,    35,     3,
968      155,   204,   205,     6,     7,     8,     9,    10,    11,    12,
969       13,    14,    15,    16,    17,    18,    19,    20,    21,     3,
970       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
971       33,    34,     3,    36,    37,    38,    39,    40,    41,    42,
972       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
973       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
974        5,    85,    86,     3,     3,   103,    76,    27,    -1,   204,
975       94,    95,    96,    97,    98,    99,   135,    -1,    -1,    63,
976       64,    65,    66,    67,    68,    69,    70,    -1,    -1,    73,
977       -1,    -1,    -1,    -1,    78,    -1,    -1,    -1,   101,    -1,
978       84,    -1,    -1,    -1,    88,    89,    90,    91,    92,    93,
979       94,    95,    -1,    -1,    98,    -1,    -1,    -1,    -1,    -1,
980       -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    74,
981       75,    -1,    77,    78,    79,    80,    81,    82,    83,    -1,
982       85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    94,
983       95,    96,    97,    98,    99,    71,    72,    -1,    74,    75,
984       -1,    77,    78,    79,    80,    81,    82,    83,    -1,    85,
985       86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    94,    95,
986       96,    97,    98,    99,    72,    -1,    74,    75,    -1,    77,
987       78,    79,    80,    81,    82,    83,    -1,    85,    86,    -1,
988       -1,    -1,    -1,    -1,    -1,    -1,    94,    95,    96,    97,
989       98,    99
990 };
991
992 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
993    symbol of state STATE-NUM.  */
994 static const yytype_uint8 yystos[] =
995 {
996        0,     6,     7,     8,     9,    10,    11,    12,    13,    14,
997       15,    16,    17,    18,    19,    20,    21,    23,    24,    25,
998       26,    27,    28,    29,    30,    31,    32,    33,    34,    36,
999       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1000       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1001       57,    58,    59,    60,    61,    62,   101,   105,     3,    63,
1002       64,    65,    66,    67,    68,    69,    70,    73,    78,    84,
1003       88,    89,    90,    91,    92,    93,    94,    95,    98,   109,
1004      110,   112,   109,   109,   109,   109,     3,     4,    77,    78,
1005       79,   106,     3,     3,     3,     3,     3,   106,     3,     3,
1006        3,     3,     3,     3,     3,    78,     3,     3,     3,     3,
1007        3,     3,     3,     3,     3,   109,   109,     0,    98,    98,
1008       98,    98,    98,   112,   112,   112,   112,   112,   112,   112,
1009      112,   112,   112,   112,   109,    71,     5,    72,    74,    75,
1010       77,    78,    79,    80,    81,    82,    83,    85,    86,    94,
1011       95,    96,    97,    98,    99,    22,     3,    84,   102,     3,
1012        3,     3,    35,     3,     3,   109,   109,   109,   109,   109,
1013      103,   110,   112,   111,   112,   114,   113,   112,   112,   112,
1014      112,   112,   112,   112,   112,   112,   112,   112,   108,   112,
1015      112,   109,     3,     3,   103,   103,   103,   103,   103,   107,
1016      112,   112,   112,   103,    71,    76,   108,   112
1017 };
1018
1019 #define yyerrok         (yyerrstatus = 0)
1020 #define yyclearin       (yychar = YYEMPTY)
1021 #define YYEMPTY         (-2)
1022 #define YYEOF           0
1023
1024 #define YYACCEPT        goto yyacceptlab
1025 #define YYABORT         goto yyabortlab
1026 #define YYERROR         goto yyerrorlab
1027
1028
1029 /* Like YYERROR except do call yyerror.  This remains here temporarily
1030    to ease the transition to the new meaning of YYERROR, for GCC.
1031    Once GCC version 2 has supplanted version 1, this can go.  */
1032
1033 #define YYFAIL          goto yyerrlab
1034
1035 #define YYRECOVERING()  (!!yyerrstatus)
1036
1037 #define YYBACKUP(Token, Value)                                  \
1038 do                                                              \
1039   if (yychar == YYEMPTY && yylen == 1)                          \
1040     {                                                           \
1041       yychar = (Token);                                         \
1042       yylval = (Value);                                         \
1043       yytoken = YYTRANSLATE (yychar);                           \
1044       YYPOPSTACK (1);                                           \
1045       goto yybackup;                                            \
1046     }                                                           \
1047   else                                                          \
1048     {                                                           \
1049       yyerror (YY_("syntax error: cannot back up")); \
1050       YYERROR;                                                  \
1051     }                                                           \
1052 while (YYID (0))
1053
1054
1055 #define YYTERROR        1
1056 #define YYERRCODE       256
1057
1058
1059 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1060    If N is 0, then set CURRENT to the empty location which ends
1061    the previous symbol: RHS[0] (always defined).  */
1062
1063 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1064 #ifndef YYLLOC_DEFAULT
1065 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1066     do                                                                  \
1067       if (YYID (N))                                                    \
1068         {                                                               \
1069           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1070           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1071           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1072           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1073         }                                                               \
1074       else                                                              \
1075         {                                                               \
1076           (Current).first_line   = (Current).last_line   =              \
1077             YYRHSLOC (Rhs, 0).last_line;                                \
1078           (Current).first_column = (Current).last_column =              \
1079             YYRHSLOC (Rhs, 0).last_column;                              \
1080         }                                                               \
1081     while (YYID (0))
1082 #endif
1083
1084
1085 /* YY_LOCATION_PRINT -- Print the location on the stream.
1086    This macro was not mandated originally: define only if we know
1087    we won't break user code: when these are the locations we know.  */
1088
1089 #ifndef YY_LOCATION_PRINT
1090 # if YYLTYPE_IS_TRIVIAL
1091 #  define YY_LOCATION_PRINT(File, Loc)                  \
1092      fprintf (File, "%d.%d-%d.%d",                      \
1093               (Loc).first_line, (Loc).first_column,     \
1094               (Loc).last_line,  (Loc).last_column)
1095 # else
1096 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1097 # endif
1098 #endif
1099
1100
1101 /* YYLEX -- calling `yylex' with the right arguments.  */
1102
1103 #ifdef YYLEX_PARAM
1104 # define YYLEX yylex (YYLEX_PARAM)
1105 #else
1106 # define YYLEX yylex ()
1107 #endif
1108
1109 /* Enable debugging if requested.  */
1110 #if YYDEBUG
1111
1112 # ifndef YYFPRINTF
1113 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1114 #  define YYFPRINTF fprintf
1115 # endif
1116
1117 # define YYDPRINTF(Args)                        \
1118 do {                                            \
1119   if (yydebug)                                  \
1120     YYFPRINTF Args;                             \
1121 } while (YYID (0))
1122
1123 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
1124 do {                                                                      \
1125   if (yydebug)                                                            \
1126     {                                                                     \
1127       YYFPRINTF (stderr, "%s ", Title);                                   \
1128       yy_symbol_print (stderr,                                            \
1129                   Type, Value); \
1130       YYFPRINTF (stderr, "\n");                                           \
1131     }                                                                     \
1132 } while (YYID (0))
1133
1134
1135 /*--------------------------------.
1136 | Print this symbol on YYOUTPUT.  |
1137 `--------------------------------*/
1138
1139 /*ARGSUSED*/
1140 #if (defined __STDC__ || defined __C99__FUNC__ \
1141      || defined __cplusplus || defined _MSC_VER)
1142 static void
1143 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1144 #else
1145 static void
1146 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1147     FILE *yyoutput;
1148     int yytype;
1149     YYSTYPE const * const yyvaluep;
1150 #endif
1151 {
1152   if (!yyvaluep)
1153     return;
1154 # ifdef YYPRINT
1155   if (yytype < YYNTOKENS)
1156     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1157 # else
1158   YYUSE (yyoutput);
1159 # endif
1160   switch (yytype)
1161     {
1162       default:
1163         break;
1164     }
1165 }
1166
1167
1168 /*--------------------------------.
1169 | Print this symbol on YYOUTPUT.  |
1170 `--------------------------------*/
1171
1172 #if (defined __STDC__ || defined __C99__FUNC__ \
1173      || defined __cplusplus || defined _MSC_VER)
1174 static void
1175 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1176 #else
1177 static void
1178 yy_symbol_print (yyoutput, yytype, yyvaluep)
1179     FILE *yyoutput;
1180     int yytype;
1181     YYSTYPE const * const yyvaluep;
1182 #endif
1183 {
1184   if (yytype < YYNTOKENS)
1185     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1186   else
1187     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1188
1189   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1190   YYFPRINTF (yyoutput, ")");
1191 }
1192
1193 /*------------------------------------------------------------------.
1194 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1195 | TOP (included).                                                   |
1196 `------------------------------------------------------------------*/
1197
1198 #if (defined __STDC__ || defined __C99__FUNC__ \
1199      || defined __cplusplus || defined _MSC_VER)
1200 static void
1201 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1202 #else
1203 static void
1204 yy_stack_print (yybottom, yytop)
1205     yytype_int16 *yybottom;
1206     yytype_int16 *yytop;
1207 #endif
1208 {
1209   YYFPRINTF (stderr, "Stack now");
1210   for (; yybottom <= yytop; yybottom++)
1211     {
1212       int yybot = *yybottom;
1213       YYFPRINTF (stderr, " %d", yybot);
1214     }
1215   YYFPRINTF (stderr, "\n");
1216 }
1217
1218 # define YY_STACK_PRINT(Bottom, Top)                            \
1219 do {                                                            \
1220   if (yydebug)                                                  \
1221     yy_stack_print ((Bottom), (Top));                           \
1222 } while (YYID (0))
1223
1224
1225 /*------------------------------------------------.
1226 | Report that the YYRULE is going to be reduced.  |
1227 `------------------------------------------------*/
1228
1229 #if (defined __STDC__ || defined __C99__FUNC__ \
1230      || defined __cplusplus || defined _MSC_VER)
1231 static void
1232 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1233 #else
1234 static void
1235 yy_reduce_print (yyvsp, yyrule)
1236     YYSTYPE *yyvsp;
1237     int yyrule;
1238 #endif
1239 {
1240   int yynrhs = yyr2[yyrule];
1241   int yyi;
1242   unsigned long int yylno = yyrline[yyrule];
1243   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1244              yyrule - 1, yylno);
1245   /* The symbols being reduced.  */
1246   for (yyi = 0; yyi < yynrhs; yyi++)
1247     {
1248       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1249       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1250                        &(yyvsp[(yyi + 1) - (yynrhs)])
1251                                        );
1252       YYFPRINTF (stderr, "\n");
1253     }
1254 }
1255
1256 # define YY_REDUCE_PRINT(Rule)          \
1257 do {                                    \
1258   if (yydebug)                          \
1259     yy_reduce_print (yyvsp, Rule); \
1260 } while (YYID (0))
1261
1262 /* Nonzero means print parse trace.  It is left uninitialized so that
1263    multiple parsers can coexist.  */
1264 int yydebug;
1265 #else /* !YYDEBUG */
1266 # define YYDPRINTF(Args)
1267 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1268 # define YY_STACK_PRINT(Bottom, Top)
1269 # define YY_REDUCE_PRINT(Rule)
1270 #endif /* !YYDEBUG */
1271
1272
1273 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1274 #ifndef YYINITDEPTH
1275 # define YYINITDEPTH 200
1276 #endif
1277
1278 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1279    if the built-in stack extension method is used).
1280
1281    Do not make this value too large; the results are undefined if
1282    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1283    evaluated with infinite-precision integer arithmetic.  */
1284
1285 #ifndef YYMAXDEPTH
1286 # define YYMAXDEPTH 10000
1287 #endif
1288
1289 \f
1290
1291 #if YYERROR_VERBOSE
1292
1293 # ifndef yystrlen
1294 #  if defined __GLIBC__ && defined _STRING_H
1295 #   define yystrlen strlen
1296 #  else
1297 /* Return the length of YYSTR.  */
1298 #if (defined __STDC__ || defined __C99__FUNC__ \
1299      || defined __cplusplus || defined _MSC_VER)
1300 static YYSIZE_T
1301 yystrlen (const char *yystr)
1302 #else
1303 static YYSIZE_T
1304 yystrlen (yystr)
1305     const char *yystr;
1306 #endif
1307 {
1308   YYSIZE_T yylen;
1309   for (yylen = 0; yystr[yylen]; yylen++)
1310     continue;
1311   return yylen;
1312 }
1313 #  endif
1314 # endif
1315
1316 # ifndef yystpcpy
1317 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1318 #   define yystpcpy stpcpy
1319 #  else
1320 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1321    YYDEST.  */
1322 #if (defined __STDC__ || defined __C99__FUNC__ \
1323      || defined __cplusplus || defined _MSC_VER)
1324 static char *
1325 yystpcpy (char *yydest, const char *yysrc)
1326 #else
1327 static char *
1328 yystpcpy (yydest, yysrc)
1329     char *yydest;
1330     const char *yysrc;
1331 #endif
1332 {
1333   char *yyd = yydest;
1334   const char *yys = yysrc;
1335
1336   while ((*yyd++ = *yys++) != '\0')
1337     continue;
1338
1339   return yyd - 1;
1340 }
1341 #  endif
1342 # endif
1343
1344 # ifndef yytnamerr
1345 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1346    quotes and backslashes, so that it's suitable for yyerror.  The
1347    heuristic is that double-quoting is unnecessary unless the string
1348    contains an apostrophe, a comma, or backslash (other than
1349    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1350    null, do not copy; instead, return the length of what the result
1351    would have been.  */
1352 static YYSIZE_T
1353 yytnamerr (char *yyres, const char *yystr)
1354 {
1355   if (*yystr == '"')
1356     {
1357       YYSIZE_T yyn = 0;
1358       char const *yyp = yystr;
1359
1360       for (;;)
1361         switch (*++yyp)
1362           {
1363           case '\'':
1364           case ',':
1365             goto do_not_strip_quotes;
1366
1367           case '\\':
1368             if (*++yyp != '\\')
1369               goto do_not_strip_quotes;
1370             /* Fall through.  */
1371           default:
1372             if (yyres)
1373               yyres[yyn] = *yyp;
1374             yyn++;
1375             break;
1376
1377           case '"':
1378             if (yyres)
1379               yyres[yyn] = '\0';
1380             return yyn;
1381           }
1382     do_not_strip_quotes: ;
1383     }
1384
1385   if (! yyres)
1386     return yystrlen (yystr);
1387
1388   return yystpcpy (yyres, yystr) - yyres;
1389 }
1390 # endif
1391
1392 /* Copy into YYRESULT an error message about the unexpected token
1393    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1394    including the terminating null byte.  If YYRESULT is null, do not
1395    copy anything; just return the number of bytes that would be
1396    copied.  As a special case, return 0 if an ordinary "syntax error"
1397    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1398    size calculation.  */
1399 static YYSIZE_T
1400 yysyntax_error (char *yyresult, int yystate, int yychar)
1401 {
1402   int yyn = yypact[yystate];
1403
1404   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1405     return 0;
1406   else
1407     {
1408       int yytype = YYTRANSLATE (yychar);
1409       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1410       YYSIZE_T yysize = yysize0;
1411       YYSIZE_T yysize1;
1412       int yysize_overflow = 0;
1413       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1414       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1415       int yyx;
1416
1417 # if 0
1418       /* This is so xgettext sees the translatable formats that are
1419          constructed on the fly.  */
1420       YY_("syntax error, unexpected %s");
1421       YY_("syntax error, unexpected %s, expecting %s");
1422       YY_("syntax error, unexpected %s, expecting %s or %s");
1423       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1424       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1425 # endif
1426       char *yyfmt;
1427       char const *yyf;
1428       static char const yyunexpected[] = "syntax error, unexpected %s";
1429       static char const yyexpecting[] = ", expecting %s";
1430       static char const yyor[] = " or %s";
1431       char yyformat[sizeof yyunexpected
1432                     + sizeof yyexpecting - 1
1433                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1434                        * (sizeof yyor - 1))];
1435       char const *yyprefix = yyexpecting;
1436
1437       /* Start YYX at -YYN if negative to avoid negative indexes in
1438          YYCHECK.  */
1439       int yyxbegin = yyn < 0 ? -yyn : 0;
1440
1441       /* Stay within bounds of both yycheck and yytname.  */
1442       int yychecklim = YYLAST - yyn + 1;
1443       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1444       int yycount = 1;
1445
1446       yyarg[0] = yytname[yytype];
1447       yyfmt = yystpcpy (yyformat, yyunexpected);
1448
1449       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1450         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1451           {
1452             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1453               {
1454                 yycount = 1;
1455                 yysize = yysize0;
1456                 yyformat[sizeof yyunexpected - 1] = '\0';
1457                 break;
1458               }
1459             yyarg[yycount++] = yytname[yyx];
1460             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1461             yysize_overflow |= (yysize1 < yysize);
1462             yysize = yysize1;
1463             yyfmt = yystpcpy (yyfmt, yyprefix);
1464             yyprefix = yyor;
1465           }
1466
1467       yyf = YY_(yyformat);
1468       yysize1 = yysize + yystrlen (yyf);
1469       yysize_overflow |= (yysize1 < yysize);
1470       yysize = yysize1;
1471
1472       if (yysize_overflow)
1473         return YYSIZE_MAXIMUM;
1474
1475       if (yyresult)
1476         {
1477           /* Avoid sprintf, as that infringes on the user's name space.
1478              Don't have undefined behavior even if the translation
1479              produced a string with the wrong number of "%s"s.  */
1480           char *yyp = yyresult;
1481           int yyi = 0;
1482           while ((*yyp = *yyf) != '\0')
1483             {
1484               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1485                 {
1486                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1487                   yyf += 2;
1488                 }
1489               else
1490                 {
1491                   yyp++;
1492                   yyf++;
1493                 }
1494             }
1495         }
1496       return yysize;
1497     }
1498 }
1499 #endif /* YYERROR_VERBOSE */
1500 \f
1501
1502 /*-----------------------------------------------.
1503 | Release the memory associated to this symbol.  |
1504 `-----------------------------------------------*/
1505
1506 /*ARGSUSED*/
1507 #if (defined __STDC__ || defined __C99__FUNC__ \
1508      || defined __cplusplus || defined _MSC_VER)
1509 static void
1510 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1511 #else
1512 static void
1513 yydestruct (yymsg, yytype, yyvaluep)
1514     const char *yymsg;
1515     int yytype;
1516     YYSTYPE *yyvaluep;
1517 #endif
1518 {
1519   YYUSE (yyvaluep);
1520
1521   if (!yymsg)
1522     yymsg = "Deleting";
1523   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1524
1525   switch (yytype)
1526     {
1527
1528       default:
1529         break;
1530     }
1531 }
1532
1533 /* Prevent warnings from -Wmissing-prototypes.  */
1534 #ifdef YYPARSE_PARAM
1535 #if defined __STDC__ || defined __cplusplus
1536 int yyparse (void *YYPARSE_PARAM);
1537 #else
1538 int yyparse ();
1539 #endif
1540 #else /* ! YYPARSE_PARAM */
1541 #if defined __STDC__ || defined __cplusplus
1542 int yyparse (void);
1543 #else
1544 int yyparse ();
1545 #endif
1546 #endif /* ! YYPARSE_PARAM */
1547
1548
1549 /* The lookahead symbol.  */
1550 int yychar;
1551
1552 /* The semantic value of the lookahead symbol.  */
1553 YYSTYPE yylval;
1554
1555 /* Number of syntax errors so far.  */
1556 int yynerrs;
1557
1558
1559
1560 /*-------------------------.
1561 | yyparse or yypush_parse.  |
1562 `-------------------------*/
1563
1564 #ifdef YYPARSE_PARAM
1565 #if (defined __STDC__ || defined __C99__FUNC__ \
1566      || defined __cplusplus || defined _MSC_VER)
1567 int
1568 yyparse (void *YYPARSE_PARAM)
1569 #else
1570 int
1571 yyparse (YYPARSE_PARAM)
1572     void *YYPARSE_PARAM;
1573 #endif
1574 #else /* ! YYPARSE_PARAM */
1575 #if (defined __STDC__ || defined __C99__FUNC__ \
1576      || defined __cplusplus || defined _MSC_VER)
1577 int
1578 yyparse (void)
1579 #else
1580 int
1581 yyparse ()
1582
1583 #endif
1584 #endif
1585 {
1586
1587
1588     int yystate;
1589     /* Number of tokens to shift before error messages enabled.  */
1590     int yyerrstatus;
1591
1592     /* The stacks and their tools:
1593        `yyss': related to states.
1594        `yyvs': related to semantic values.
1595
1596        Refer to the stacks thru separate pointers, to allow yyoverflow
1597        to reallocate them elsewhere.  */
1598
1599     /* The state stack.  */
1600     yytype_int16 yyssa[YYINITDEPTH];
1601     yytype_int16 *yyss;
1602     yytype_int16 *yyssp;
1603
1604     /* The semantic value stack.  */
1605     YYSTYPE yyvsa[YYINITDEPTH];
1606     YYSTYPE *yyvs;
1607     YYSTYPE *yyvsp;
1608
1609     YYSIZE_T yystacksize;
1610
1611   int yyn;
1612   int yyresult;
1613   /* Lookahead token as an internal (translated) token number.  */
1614   int yytoken;
1615   /* The variables used to return semantic value and location from the
1616      action routines.  */
1617   YYSTYPE yyval;
1618
1619 #if YYERROR_VERBOSE
1620   /* Buffer for error messages, and its allocated size.  */
1621   char yymsgbuf[128];
1622   char *yymsg = yymsgbuf;
1623   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1624 #endif
1625
1626 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1627
1628   /* The number of symbols on the RHS of the reduced rule.
1629      Keep to zero when no symbol should be popped.  */
1630   int yylen = 0;
1631
1632   yytoken = 0;
1633   yyss = yyssa;
1634   yyvs = yyvsa;
1635   yystacksize = YYINITDEPTH;
1636
1637   YYDPRINTF ((stderr, "Starting parse\n"));
1638
1639   yystate = 0;
1640   yyerrstatus = 0;
1641   yynerrs = 0;
1642   yychar = YYEMPTY; /* Cause a token to be read.  */
1643
1644   /* Initialize stack pointers.
1645      Waste one element of value and location stack
1646      so that they stay on the same level as the state stack.
1647      The wasted elements are never initialized.  */
1648   yyssp = yyss;
1649   yyvsp = yyvs;
1650
1651   goto yysetstate;
1652
1653 /*------------------------------------------------------------.
1654 | yynewstate -- Push a new state, which is found in yystate.  |
1655 `------------------------------------------------------------*/
1656  yynewstate:
1657   /* In all cases, when you get here, the value and location stacks
1658      have just been pushed.  So pushing a state here evens the stacks.  */
1659   yyssp++;
1660
1661  yysetstate:
1662   *yyssp = yystate;
1663
1664   if (yyss + yystacksize - 1 <= yyssp)
1665     {
1666       /* Get the current used size of the three stacks, in elements.  */
1667       YYSIZE_T yysize = yyssp - yyss + 1;
1668
1669 #ifdef yyoverflow
1670       {
1671         /* Give user a chance to reallocate the stack.  Use copies of
1672            these so that the &'s don't force the real ones into
1673            memory.  */
1674         YYSTYPE *yyvs1 = yyvs;
1675         yytype_int16 *yyss1 = yyss;
1676
1677         /* Each stack pointer address is followed by the size of the
1678            data in use in that stack, in bytes.  This used to be a
1679            conditional around just the two extra args, but that might
1680            be undefined if yyoverflow is a macro.  */
1681         yyoverflow (YY_("memory exhausted"),
1682                     &yyss1, yysize * sizeof (*yyssp),
1683                     &yyvs1, yysize * sizeof (*yyvsp),
1684                     &yystacksize);
1685
1686         yyss = yyss1;
1687         yyvs = yyvs1;
1688       }
1689 #else /* no yyoverflow */
1690 # ifndef YYSTACK_RELOCATE
1691       goto yyexhaustedlab;
1692 # else
1693       /* Extend the stack our own way.  */
1694       if (YYMAXDEPTH <= yystacksize)
1695         goto yyexhaustedlab;
1696       yystacksize *= 2;
1697       if (YYMAXDEPTH < yystacksize)
1698         yystacksize = YYMAXDEPTH;
1699
1700       {
1701         yytype_int16 *yyss1 = yyss;
1702         union yyalloc *yyptr =
1703           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1704         if (! yyptr)
1705           goto yyexhaustedlab;
1706         YYSTACK_RELOCATE (yyss_alloc, yyss);
1707         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1708 #  undef YYSTACK_RELOCATE
1709         if (yyss1 != yyssa)
1710           YYSTACK_FREE (yyss1);
1711       }
1712 # endif
1713 #endif /* no yyoverflow */
1714
1715       yyssp = yyss + yysize - 1;
1716       yyvsp = yyvs + yysize - 1;
1717
1718       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1719                   (unsigned long int) yystacksize));
1720
1721       if (yyss + yystacksize - 1 <= yyssp)
1722         YYABORT;
1723     }
1724
1725   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1726
1727   if (yystate == YYFINAL)
1728     YYACCEPT;
1729
1730   goto yybackup;
1731
1732 /*-----------.
1733 | yybackup.  |
1734 `-----------*/
1735 yybackup:
1736
1737   /* Do appropriate processing given the current state.  Read a
1738      lookahead token if we need one and don't already have one.  */
1739
1740   /* First try to decide what to do without reference to lookahead token.  */
1741   yyn = yypact[yystate];
1742   if (yyn == YYPACT_NINF)
1743     goto yydefault;
1744
1745   /* Not known => get a lookahead token if don't already have one.  */
1746
1747   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1748   if (yychar == YYEMPTY)
1749     {
1750       YYDPRINTF ((stderr, "Reading a token: "));
1751       yychar = YYLEX;
1752     }
1753
1754   if (yychar <= YYEOF)
1755     {
1756       yychar = yytoken = YYEOF;
1757       YYDPRINTF ((stderr, "Now at end of input.\n"));
1758     }
1759   else
1760     {
1761       yytoken = YYTRANSLATE (yychar);
1762       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1763     }
1764
1765   /* If the proper action on seeing token YYTOKEN is to reduce or to
1766      detect an error, take that action.  */
1767   yyn += yytoken;
1768   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1769     goto yydefault;
1770   yyn = yytable[yyn];
1771   if (yyn <= 0)
1772     {
1773       if (yyn == 0 || yyn == YYTABLE_NINF)
1774         goto yyerrlab;
1775       yyn = -yyn;
1776       goto yyreduce;
1777     }
1778
1779   /* Count tokens shifted since error; after three, turn off error
1780      status.  */
1781   if (yyerrstatus)
1782     yyerrstatus--;
1783
1784   /* Shift the lookahead token.  */
1785   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1786
1787   /* Discard the shifted token.  */
1788   yychar = YYEMPTY;
1789
1790   yystate = yyn;
1791   *++yyvsp = yylval;
1792
1793   goto yynewstate;
1794
1795
1796 /*-----------------------------------------------------------.
1797 | yydefault -- do the default action for the current state.  |
1798 `-----------------------------------------------------------*/
1799 yydefault:
1800   yyn = yydefact[yystate];
1801   if (yyn == 0)
1802     goto yyerrlab;
1803   goto yyreduce;
1804
1805
1806 /*-----------------------------.
1807 | yyreduce -- Do a reduction.  |
1808 `-----------------------------*/
1809 yyreduce:
1810   /* yyn is the number of a rule to reduce with.  */
1811   yylen = yyr2[yyn];
1812
1813   /* If YYLEN is nonzero, implement the default value of the action:
1814      `$$ = $1'.
1815
1816      Otherwise, the following line sets YYVAL to garbage.
1817      This behavior is undocumented and Bison
1818      users should not rely upon it.  Assigning to YYVAL
1819      unconditionally makes the parser a bit smaller, and it avoids a
1820      GCC warning that YYVAL may be used uninitialized.  */
1821   yyval = yyvsp[1-yylen];
1822
1823
1824   YY_REDUCE_PRINT (yyn);
1825   switch (yyn)
1826     {
1827         case 3:
1828
1829 /* Line 1455 of yacc.c  */
1830 #line 132 "inform.y"
1831     { lex_offset = n_strlen(lex_expression); }
1832     break;
1833
1834   case 4:
1835
1836 /* Line 1455 of yacc.c  */
1837 #line 134 "inform.y"
1838     {
1839                 strid_t f;
1840                 f = n_file_name_or_prompt(fileusage_Data|fileusage_BinaryMode,
1841                                           filemode_Write, lex_tail());
1842                 w_glk_put_buffer_stream(f, (char *) z_memory, total_size);
1843                 glk_stream_close(f, NULL);
1844         }
1845     break;
1846
1847   case 5:
1848
1849 /* Line 1455 of yacc.c  */
1850 #line 142 "inform.y"
1851     { parse_new_alias(lex_tail(), FALSE); }
1852     break;
1853
1854   case 6:
1855
1856 /* Line 1455 of yacc.c  */
1857 #line 144 "inform.y"
1858     { parse_new_alias(lex_tail(), TRUE); }
1859     break;
1860
1861   case 7:
1862
1863 /* Line 1455 of yacc.c  */
1864 #line 146 "inform.y"
1865     { remove_alias(lex_tail()); }
1866     break;
1867
1868   case 8:
1869
1870 /* Line 1455 of yacc.c  */
1871 #line 148 "inform.y"
1872     { automap_init(object_count, lex_tail()); }
1873     break;
1874
1875   case 9:
1876
1877 /* Line 1455 of yacc.c  */
1878 #line 150 "inform.y"
1879     { inform_help(); }
1880     break;
1881
1882   case 10:
1883
1884 /* Line 1455 of yacc.c  */
1885 #line 152 "inform.y"
1886     { op_restart(); exit_debugger = TRUE; read_abort = TRUE;  }
1887     break;
1888
1889   case 11:
1890
1891 /* Line 1455 of yacc.c  */
1892 #line 154 "inform.y"
1893     {
1894                 if(restoregame()) {
1895                   exit_debugger = TRUE; read_abort = TRUE;
1896                   if(zversion <= 3)
1897                     mop_take_branch();
1898                   else
1899                     mop_store_result(2);
1900                 } else {
1901                   infix_print_string("Restore failed.\n");
1902                 } }
1903     break;
1904
1905   case 12:
1906
1907 /* Line 1455 of yacc.c  */
1908 #line 165 "inform.y"
1909     { zword oldop0 = operand[0]; operand[0] = 4; op_output_stream(); operand[0] = oldop0; }
1910     break;
1911
1912   case 13:
1913
1914 /* Line 1455 of yacc.c  */
1915 #line 167 "inform.y"
1916     { zword oldop0 = operand[0]; operand[0] = neg(4); op_output_stream(); operand[0] = oldop0; }
1917     break;
1918
1919   case 14:
1920
1921 /* Line 1455 of yacc.c  */
1922 #line 169 "inform.y"
1923     { zword oldop0 = operand[0]; operand[0] = 1; op_input_stream(); operand[0] = oldop0; exit_debugger = TRUE; }
1924     break;
1925
1926   case 15:
1927
1928 /* Line 1455 of yacc.c  */
1929 #line 171 "inform.y"
1930     { zword oldop0 = operand[0]; operand[0] = 0; op_input_stream(); operand[0] = oldop0; }
1931     break;
1932
1933   case 16:
1934
1935 /* Line 1455 of yacc.c  */
1936 #line 173 "inform.y"
1937     { z_close(); glk_exit();    }
1938     break;
1939
1940   case 17:
1941
1942 /* Line 1455 of yacc.c  */
1943 #line 175 "inform.y"
1944     {
1945                 if(restoreundo()) {
1946                   read_abort = TRUE; exit_debugger = TRUE;
1947                 } else {
1948                   infix_print_string("No undo slots.\n");
1949                 } }
1950     break;
1951
1952   case 18:
1953
1954 /* Line 1455 of yacc.c  */
1955 #line 182 "inform.y"
1956     {
1957                 if(restoreredo()) {
1958                   read_abort = TRUE; exit_debugger = TRUE;
1959                 } else {
1960                   infix_print_string("No redo slots.\n");
1961                 } }
1962     break;
1963
1964   case 19:
1965
1966 /* Line 1455 of yacc.c  */
1967 #line 189 "inform.y"
1968     {
1969                 strid_t f;
1970                 f = n_file_name_or_prompt(fileusage_Data|fileusage_BinaryMode,
1971                                           filemode_Read, lex_tail());
1972                 if(f) {
1973                   kill_infix();
1974                   init_infix(f);
1975                 } }
1976     break;
1977
1978   case 20:
1979
1980 /* Line 1455 of yacc.c  */
1981 #line 198 "inform.y"
1982     { infix_display((yyvsp[(2) - (2)].val));            }
1983     break;
1984
1985   case 21:
1986
1987 /* Line 1455 of yacc.c  */
1988 #line 200 "inform.y"
1989     { inform_result = (yyvsp[(2) - (2)].val);           }
1990     break;
1991
1992   case 22:
1993
1994 /* Line 1455 of yacc.c  */
1995 #line 202 "inform.y"
1996     { infix_auto_display(lex_tail()); }
1997     break;
1998
1999   case 23:
2000
2001 /* Line 1455 of yacc.c  */
2002 #line 204 "inform.y"
2003     { infix_auto_undisplay((yyvsp[(2) - (2)].val).v);   }
2004     break;
2005
2006   case 24:
2007
2008 /* Line 1455 of yacc.c  */
2009 #line 206 "inform.y"
2010     { infix_set_display_enabled((yyvsp[(2) - (2)].val).v, FALSE); }
2011     break;
2012
2013   case 25:
2014
2015 /* Line 1455 of yacc.c  */
2016 #line 208 "inform.y"
2017     { infix_set_display_enabled((yyvsp[(2) - (2)].val).v, TRUE); }
2018     break;
2019
2020   case 26:
2021
2022 /* Line 1455 of yacc.c  */
2023 #line 210 "inform.y"
2024     { infix_move((yyvsp[(4) - (4)].val).v, (yyvsp[(2) - (4)].val).v);   }
2025     break;
2026
2027   case 27:
2028
2029 /* Line 1455 of yacc.c  */
2030 #line 212 "inform.y"
2031     { infix_object_tree(0);             }
2032     break;
2033
2034   case 28:
2035
2036 /* Line 1455 of yacc.c  */
2037 #line 214 "inform.y"
2038     { infix_object_tree((yyvsp[(2) - (2)].val).v);      }
2039     break;
2040
2041   case 29:
2042
2043 /* Line 1455 of yacc.c  */
2044 #line 216 "inform.y"
2045     {
2046                 if(lex_expression[lex_offset])
2047                   infix_object_find(lex_tail());
2048         }
2049     break;
2050
2051   case 30:
2052
2053 /* Line 1455 of yacc.c  */
2054 #line 221 "inform.y"
2055     {
2056                 z_typed v; v.t = Z_GLOBAL;
2057                 for(v.o = 0; v.o <= 245; v.o++) {
2058                   const char *name = infix_get_name(v);
2059                   if(v.o) infix_print_string("; ");
2060                   if(name) {
2061                     infix_print_string(name);
2062                   } else {
2063                     infix_print_char('G');
2064                     infix_print_number(v.o);
2065                   }
2066                   infix_print_char('=');
2067                   infix_get_val(&v);
2068                   infix_print_number(v.v);
2069                 }
2070                 infix_print_char(10);
2071         }
2072     break;
2073
2074   case 31:
2075
2076 /* Line 1455 of yacc.c  */
2077 #line 239 "inform.y"
2078     {
2079                 z_typed v; v.t = Z_GLOBAL;
2080                 for(v.o = 0; v.o <= 245; v.o++) {
2081                   infix_get_val(&v);
2082                   if(v.v == (yyvsp[(2) - (2)].val).v) {
2083                     const char *name = infix_get_name(v);
2084                     if(name) {
2085                       infix_print_string(name);
2086                     } else {
2087                       infix_print_char('G');
2088                       infix_print_number(v.o);
2089                     }
2090                     infix_print_char(10);
2091                   }
2092                 } }
2093     break;
2094
2095   case 32:
2096
2097 /* Line 1455 of yacc.c  */
2098 #line 255 "inform.y"
2099     { infix_set_attrib((yyvsp[(2) - (3)].val).v, (yyvsp[(3) - (3)].val).v);     }
2100     break;
2101
2102   case 33:
2103
2104 /* Line 1455 of yacc.c  */
2105 #line 257 "inform.y"
2106     { infix_clear_attrib((yyvsp[(2) - (4)].val).v, (yyvsp[(4) - (4)].val).v); }
2107     break;
2108
2109   case 34:
2110
2111 /* Line 1455 of yacc.c  */
2112 #line 259 "inform.y"
2113     { infix_remove((yyvsp[(2) - (2)].val).v);           }
2114     break;
2115
2116   case 35:
2117
2118 /* Line 1455 of yacc.c  */
2119 #line 261 "inform.y"
2120     { PC=(yyvsp[(2) - (2)].pcoffset); exit_debugger = TRUE;     }
2121     break;
2122
2123   case 36:
2124
2125 /* Line 1455 of yacc.c  */
2126 #line 263 "inform.y"
2127     { set_step(CONT_GO, 1); }
2128     break;
2129
2130   case 37:
2131
2132 /* Line 1455 of yacc.c  */
2133 #line 265 "inform.y"
2134     { set_step(CONT_GO, 1); infix_set_ignore(cur_break, (yyvsp[(2) - (2)].val).v); }
2135     break;
2136
2137   case 38:
2138
2139 /* Line 1455 of yacc.c  */
2140 #line 267 "inform.y"
2141     { set_step(CONT_STEP, 1); }
2142     break;
2143
2144   case 39:
2145
2146 /* Line 1455 of yacc.c  */
2147 #line 269 "inform.y"
2148     { set_step(CONT_STEP, (yyvsp[(2) - (2)].val).v); }
2149     break;
2150
2151   case 40:
2152
2153 /* Line 1455 of yacc.c  */
2154 #line 271 "inform.y"
2155     { set_step(CONT_NEXT, 1); }
2156     break;
2157
2158   case 41:
2159
2160 /* Line 1455 of yacc.c  */
2161 #line 273 "inform.y"
2162     { set_step(CONT_NEXT, (yyvsp[(2) - (2)].val).v); }
2163     break;
2164
2165   case 42:
2166
2167 /* Line 1455 of yacc.c  */
2168 #line 275 "inform.y"
2169     { set_step(CONT_UNTIL, 1); }
2170     break;
2171
2172   case 43:
2173
2174 /* Line 1455 of yacc.c  */
2175 #line 277 "inform.y"
2176     { set_step(CONT_STEPI, 1); }
2177     break;
2178
2179   case 44:
2180
2181 /* Line 1455 of yacc.c  */
2182 #line 279 "inform.y"
2183     { set_step(CONT_STEPI, (yyvsp[(2) - (2)].val).v); }
2184     break;
2185
2186   case 45:
2187
2188 /* Line 1455 of yacc.c  */
2189 #line 281 "inform.y"
2190     { set_step(CONT_NEXTI, 1); }
2191     break;
2192
2193   case 46:
2194
2195 /* Line 1455 of yacc.c  */
2196 #line 283 "inform.y"
2197     { set_step(CONT_NEXTI, (yyvsp[(2) - (2)].val).v); }
2198     break;
2199
2200   case 47:
2201
2202 /* Line 1455 of yacc.c  */
2203 #line 285 "inform.y"
2204     { set_step(CONT_FINISH, 1); }
2205     break;
2206
2207   case 48:
2208
2209 /* Line 1455 of yacc.c  */
2210 #line 287 "inform.y"
2211     { infix_set_break((yyvsp[(2) - (2)].pcoffset));     }
2212     break;
2213
2214   case 49:
2215
2216 /* Line 1455 of yacc.c  */
2217 #line 289 "inform.y"
2218     { int n = infix_set_break((yyvsp[(2) - (3)].pcoffset)); infix_set_cond(n, lex_tail()); }
2219     break;
2220
2221   case 50:
2222
2223 /* Line 1455 of yacc.c  */
2224 #line 291 "inform.y"
2225     { infix_set_cond((yyvsp[(2) - (2)].val).v, lex_tail()); }
2226     break;
2227
2228   case 51:
2229
2230 /* Line 1455 of yacc.c  */
2231 #line 293 "inform.y"
2232     { infix_set_ignore((yyvsp[(2) - (3)].val).v, (yyvsp[(3) - (3)].val).v);     }
2233     break;
2234
2235   case 52:
2236
2237 /* Line 1455 of yacc.c  */
2238 #line 295 "inform.y"
2239     { infix_delete_breakpoint((yyvsp[(2) - (2)].val).v); }
2240     break;
2241
2242   case 53:
2243
2244 /* Line 1455 of yacc.c  */
2245 #line 297 "inform.y"
2246     { infix_show_all_breakpoints(); }
2247     break;
2248
2249   case 54:
2250
2251 /* Line 1455 of yacc.c  */
2252 #line 299 "inform.y"
2253     { infix_show_breakpoint((yyvsp[(2) - (2)].val).v);  }
2254     break;
2255
2256   case 55:
2257
2258 /* Line 1455 of yacc.c  */
2259 #line 301 "inform.y"
2260     { infix_set_break_enabled((yyvsp[(2) - (2)].val).v, FALSE); }
2261     break;
2262
2263   case 56:
2264
2265 /* Line 1455 of yacc.c  */
2266 #line 303 "inform.y"
2267     { infix_set_break_enabled((yyvsp[(2) - (2)].val).v, TRUE); }
2268     break;
2269
2270   case 57:
2271
2272 /* Line 1455 of yacc.c  */
2273 #line 305 "inform.y"
2274     { infix_print_string("The current source language is \"inform\".\n"); }
2275     break;
2276
2277   case 58:
2278
2279 /* Line 1455 of yacc.c  */
2280 #line 307 "inform.y"
2281     { 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"); }
2282     break;
2283
2284   case 59:
2285
2286 /* Line 1455 of yacc.c  */
2287 #line 309 "inform.y"
2288     { infix_print_string("Source files for which symbols have been read in:\n\n"); infix_list_files(); infix_print_char('\n'); }
2289     break;
2290
2291   case 60:
2292
2293 /* Line 1455 of yacc.c  */
2294 #line 311 "inform.y"
2295     { show_copying(); }
2296     break;
2297
2298   case 61:
2299
2300 /* Line 1455 of yacc.c  */
2301 #line 313 "inform.y"
2302     { show_warranty(); }
2303     break;
2304
2305   case 62:
2306
2307 /* Line 1455 of yacc.c  */
2308 #line 315 "inform.y"
2309     { infix_show_frame(infix_selected_frame); }
2310     break;
2311
2312   case 63:
2313
2314 /* Line 1455 of yacc.c  */
2315 #line 317 "inform.y"
2316     { infix_select_frame((yyvsp[(2) - (2)].val).v); infix_show_frame((yyvsp[(2) - (2)].val).v); }
2317     break;
2318
2319   case 64:
2320
2321 /* Line 1455 of yacc.c  */
2322 #line 319 "inform.y"
2323     { infix_select_frame((yyvsp[(2) - (2)].val).v); }
2324     break;
2325
2326   case 65:
2327
2328 /* Line 1455 of yacc.c  */
2329 #line 321 "inform.y"
2330     { infix_select_frame(infix_selected_frame - 1); infix_show_frame(infix_selected_frame); }
2331     break;
2332
2333   case 66:
2334
2335 /* Line 1455 of yacc.c  */
2336 #line 323 "inform.y"
2337     { infix_select_frame(infix_selected_frame - (yyvsp[(2) - (2)].val).v); infix_show_frame(infix_selected_frame); }
2338     break;
2339
2340   case 67:
2341
2342 /* Line 1455 of yacc.c  */
2343 #line 325 "inform.y"
2344     { infix_select_frame(infix_selected_frame - 1); }
2345     break;
2346
2347   case 68:
2348
2349 /* Line 1455 of yacc.c  */
2350 #line 327 "inform.y"
2351     { infix_select_frame(infix_selected_frame - (yyvsp[(2) - (2)].val).v); }
2352     break;
2353
2354   case 69:
2355
2356 /* Line 1455 of yacc.c  */
2357 #line 329 "inform.y"
2358     { infix_select_frame(infix_selected_frame + 1); infix_show_frame(infix_selected_frame); }
2359     break;
2360
2361   case 70:
2362
2363 /* Line 1455 of yacc.c  */
2364 #line 331 "inform.y"
2365     { infix_select_frame(infix_selected_frame + (yyvsp[(2) - (2)].val).v); infix_show_frame(infix_selected_frame); }
2366     break;
2367
2368   case 71:
2369
2370 /* Line 1455 of yacc.c  */
2371 #line 333 "inform.y"
2372     { infix_select_frame(infix_selected_frame + 1); }
2373     break;
2374
2375   case 72:
2376
2377 /* Line 1455 of yacc.c  */
2378 #line 335 "inform.y"
2379     { infix_select_frame(infix_selected_frame + (yyvsp[(2) - (2)].val).v); }
2380     break;
2381
2382   case 73:
2383
2384 /* Line 1455 of yacc.c  */
2385 #line 337 "inform.y"
2386     { infix_backtrace(0, stack_get_depth()); }
2387     break;
2388
2389   case 74:
2390
2391 /* Line 1455 of yacc.c  */
2392 #line 339 "inform.y"
2393     { infix_backtrace(stack_get_depth() - (yyvsp[(2) - (2)].val).v, (yyvsp[(2) - (2)].val).v); }
2394     break;
2395
2396   case 75:
2397
2398 /* Line 1455 of yacc.c  */
2399 #line 341 "inform.y"
2400     { infix_backtrace(0, (yyvsp[(3) - (3)].val).v); }
2401     break;
2402
2403   case 76:
2404
2405 /* Line 1455 of yacc.c  */
2406 #line 349 "inform.y"
2407     { if((yyvsp[(1) - (1)].val).t == Z_ROUTINE) (yyval.pcoffset) = infix_get_routine_PC((yyvsp[(1) - (1)].val).v); else { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", (yyvsp[(1) - (1)].val).v); (yyval.pcoffset) = l.thisPC; } }
2408     break;
2409
2410   case 77:
2411
2412 /* Line 1455 of yacc.c  */
2413 #line 350 "inform.y"
2414     { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line + (yyvsp[(2) - (2)].val).v); (yyval.pcoffset) = l.thisPC; }
2415     break;
2416
2417   case 78:
2418
2419 /* Line 1455 of yacc.c  */
2420 #line 351 "inform.y"
2421     { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line - (yyvsp[(2) - (2)].val).v); (yyval.pcoffset) = l.thisPC; }
2422     break;
2423
2424   case 79:
2425
2426 /* Line 1455 of yacc.c  */
2427 #line 352 "inform.y"
2428     { if((yyvsp[(3) - (3)].val).t == Z_ROUTINE) (yyval.pcoffset) = UNPACKR((yyvsp[(3) - (3)].val).v); else { infix_location l; infix_decode_fileloc(&l, (yyvsp[(1) - (3)].filenum)->filename, (yyvsp[(3) - (3)].val).v); (yyval.pcoffset) = l.thisPC; } }
2429     break;
2430
2431   case 80:
2432
2433 /* Line 1455 of yacc.c  */
2434 #line 353 "inform.y"
2435     { (yyval.pcoffset) = (yyvsp[(2) - (2)].val).v;                      }
2436     break;
2437
2438   case 81:
2439
2440 /* Line 1455 of yacc.c  */
2441 #line 357 "inform.y"
2442     {
2443                 if(condlist->condfunc(condlist->val, (yyvsp[(1) - (1)].val).v) ^ condlist->opposite) {
2444                    (yyval.flag) = TRUE;
2445                    ignoreeffects++;
2446                 } else
2447                    (yyval.flag) = FALSE;
2448             }
2449     break;
2450
2451   case 82:
2452
2453 /* Line 1455 of yacc.c  */
2454 #line 364 "inform.y"
2455     {
2456                 if((yyvsp[(1) - (3)].flag))
2457                   (yyval.flag) = TRUE;
2458                 else {
2459                   if(condlist->condfunc(condlist->val, (yyvsp[(3) - (3)].val).v) ^ condlist->opposite) {
2460                     (yyval.flag) = TRUE;
2461                     ignoreeffects++;
2462                   }
2463                   else (yyval.flag) = FALSE;
2464                 } }
2465     break;
2466
2467   case 83:
2468
2469 /* Line 1455 of yacc.c  */
2470 #line 377 "inform.y"
2471     { (yyval.zlist) = NULL; }
2472     break;
2473
2474   case 84:
2475
2476 /* Line 1455 of yacc.c  */
2477 #line 378 "inform.y"
2478     { zword_list g; (yyval.zlist) = (yyvsp[(3) - (3)].zlist); g.item = (yyvsp[(1) - (3)].val).v; LEaddm((yyval.zlist), g, n_rmmalloc); }
2479     break;
2480
2481   case 87:
2482
2483 /* Line 1455 of yacc.c  */
2484 #line 384 "inform.y"
2485     { (yyval.val) = (yyvsp[(3) - (3)].val);                     }
2486     break;
2487
2488   case 88:
2489
2490 /* Line 1455 of yacc.c  */
2491 #line 385 "inform.y"
2492     { (yyval.val) = (yyvsp[(3) - (3)].val);                     }
2493     break;
2494
2495   case 89:
2496
2497 /* Line 1455 of yacc.c  */
2498 #line 390 "inform.y"
2499     { cond_list newcond; newcond.val = (yyvsp[(1) - (2)].val).v; newcond.condfunc = (yyvsp[(2) - (2)].cond).condfunc; newcond.opposite = (yyvsp[(2) - (2)].cond).opposite; LEaddm(condlist, newcond, n_rmmalloc); }
2500     break;
2501
2502   case 90:
2503
2504 /* Line 1455 of yacc.c  */
2505 #line 390 "inform.y"
2506     { if((yyvsp[(4) - (4)].flag)) ignoreeffects--; (yyval.val).v = (yyvsp[(4) - (4)].flag); (yyval.val).t = Z_BOOLEAN; LEremovem(condlist, n_rmfreeone); }
2507     break;
2508
2509   case 91:
2510
2511 /* Line 1455 of yacc.c  */
2512 #line 395 "inform.y"
2513     { (yyval.val) = (yyvsp[(1) - (1)].val);                             }
2514     break;
2515
2516   case 92:
2517
2518 /* Line 1455 of yacc.c  */
2519 #line 397 "inform.y"
2520     { (yyval.val).v = 0; (yyval.val).t = Z_BOOLEAN;             }
2521     break;
2522
2523   case 93:
2524
2525 /* Line 1455 of yacc.c  */
2526 #line 399 "inform.y"
2527     { (yyval.val).v = 1; (yyval.val).t = Z_BOOLEAN;             }
2528     break;
2529
2530   case 94:
2531
2532 /* Line 1455 of yacc.c  */
2533 #line 401 "inform.y"
2534     { (yyval.val).v = 0; (yyval.val).t = Z_OBJECT;              }
2535     break;
2536
2537   case 95:
2538
2539 /* Line 1455 of yacc.c  */
2540 #line 404 "inform.y"
2541     { (yyval.val) = (yyvsp[(3) - (3)].val); infix_assign(&(yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val).v);    }
2542     break;
2543
2544   case 96:
2545
2546 /* Line 1455 of yacc.c  */
2547 #line 407 "inform.y"
2548     { (yyval.val).v = infix_parent((yyvsp[(3) - (4)].val).v); (yyval.val).t = Z_OBJECT; }
2549     break;
2550
2551   case 97:
2552
2553 /* Line 1455 of yacc.c  */
2554 #line 409 "inform.y"
2555     { (yyval.val).v = infix_child((yyvsp[(3) - (4)].val).v); (yyval.val).t = Z_OBJECT; }
2556     break;
2557
2558   case 98:
2559
2560 /* Line 1455 of yacc.c  */
2561 #line 411 "inform.y"
2562     { (yyval.val).v = infix_sibling((yyvsp[(3) - (4)].val).v); (yyval.val).t = Z_OBJECT; }
2563     break;
2564
2565   case 99:
2566
2567 /* Line 1455 of yacc.c  */
2568 #line 413 "inform.y"
2569     { int n = 0; zword o = infix_child((yyvsp[(3) - (4)].val).v); while(o) { n++; o = infix_sibling(o); } (yyval.val).v = n; (yyval.val).t = Z_NUMBER; }
2570     break;
2571
2572   case 100:
2573
2574 /* Line 1455 of yacc.c  */
2575 #line 416 "inform.y"
2576     {
2577                   if(!ignoreeffects) {
2578                     (yyval.val).v = z_random((yyvsp[(3) - (4)].val).v);
2579                     (yyval.val).t = Z_NUMBER;
2580                   } else {
2581                     (yyval.val).v = 0;
2582                     (yyval.val).t = Z_UNKNOWN;
2583                   }
2584                 }
2585     break;
2586
2587   case 101:
2588
2589 /* Line 1455 of yacc.c  */
2590 #line 426 "inform.y"
2591     {
2592                 zword locals[16];
2593                 int i = 0;
2594                 zword_list *p;
2595                 if(!ignoreeffects) {
2596                   for(p = (yyvsp[(3) - (4)].zlist); p && i < 16; p=p->next) {
2597                     locals[i++] = p->item;
2598                   }
2599                   mop_call((yyvsp[(1) - (4)].val).v, i, locals, -2);
2600                   decode();
2601                   exit_decoder = FALSE;
2602                   (yyval.val).v = time_ret; (yyval.val).t = Z_UNKNOWN;
2603                 } else {
2604                   (yyval.val).v = 0; (yyval.val).t = Z_UNKNOWN;
2605                 }
2606               }
2607     break;
2608
2609   case 102:
2610
2611 /* Line 1455 of yacc.c  */
2612 #line 443 "inform.y"
2613     { if((yyvsp[(1) - (2)].val).v == 0) ignoreeffects++; }
2614     break;
2615
2616   case 103:
2617
2618 /* Line 1455 of yacc.c  */
2619 #line 444 "inform.y"
2620     { if((yyvsp[(1) - (4)].val).v == 0) ignoreeffects--; (yyval.val) = z_t((yyvsp[(1) - (4)].val), (yyvsp[(4) - (4)].val), (yyvsp[(1) - (4)].val).v && (yyvsp[(4) - (4)].val).v);       }
2621     break;
2622
2623   case 104:
2624
2625 /* Line 1455 of yacc.c  */
2626 #line 445 "inform.y"
2627     { if((yyvsp[(1) - (2)].val).v != 0) ignoreeffects++; }
2628     break;
2629
2630   case 105:
2631
2632 /* Line 1455 of yacc.c  */
2633 #line 446 "inform.y"
2634     { if((yyvsp[(1) - (4)].val).v != 0) ignoreeffects--; (yyval.val) = z_t((yyvsp[(1) - (4)].val), (yyvsp[(4) - (4)].val), (yyvsp[(1) - (4)].val).v || (yyvsp[(4) - (4)].val).v);       }
2635     break;
2636
2637   case 106:
2638
2639 /* Line 1455 of yacc.c  */
2640 #line 448 "inform.y"
2641     { (yyval.val).v = !((yyvsp[(2) - (2)].val).v); (yyval.val).t = Z_NUMBER;    }
2642     break;
2643
2644   case 107:
2645
2646 /* Line 1455 of yacc.c  */
2647 #line 451 "inform.y"
2648     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val).v + (yyvsp[(3) - (3)].val).v);   }
2649     break;
2650
2651   case 108:
2652
2653 /* Line 1455 of yacc.c  */
2654 #line 453 "inform.y"
2655     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val).v + neg((yyvsp[(3) - (3)].val).v));      }
2656     break;
2657
2658   case 109:
2659
2660 /* Line 1455 of yacc.c  */
2661 #line 455 "inform.y"
2662     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), z_mult((yyvsp[(1) - (3)].val).v, (yyvsp[(3) - (3)].val).v));    }
2663     break;
2664
2665   case 110:
2666
2667 /* Line 1455 of yacc.c  */
2668 #line 457 "inform.y"
2669     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), z_div((yyvsp[(1) - (3)].val).v, (yyvsp[(3) - (3)].val).v));     }
2670     break;
2671
2672   case 111:
2673
2674 /* Line 1455 of yacc.c  */
2675 #line 459 "inform.y"
2676     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), z_mod((yyvsp[(1) - (3)].val).v, (yyvsp[(3) - (3)].val).v));     }
2677     break;
2678
2679   case 112:
2680
2681 /* Line 1455 of yacc.c  */
2682 #line 461 "inform.y"
2683     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val).v & (yyvsp[(3) - (3)].val).v);   }
2684     break;
2685
2686   case 113:
2687
2688 /* Line 1455 of yacc.c  */
2689 #line 463 "inform.y"
2690     { (yyval.val) = z_t((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val).v | (yyvsp[(3) - (3)].val).v);   }
2691     break;
2692
2693   case 114:
2694
2695 /* Line 1455 of yacc.c  */
2696 #line 465 "inform.y"
2697     { (yyval.val) = z_t((yyvsp[(2) - (2)].val), (yyvsp[(2) - (2)].val), ~(yyvsp[(2) - (2)].val).v);             }
2698     break;
2699
2700   case 115:
2701
2702 /* Line 1455 of yacc.c  */
2703 #line 468 "inform.y"
2704     { (yyval.val).t = Z_BYTEARRAY; (yyval.val).o = (yyvsp[(1) - (3)].val).v; (yyval.val).p = (yyvsp[(3) - (3)].val).v; infix_get_val(&(yyval.val)); }
2705     break;
2706
2707   case 116:
2708
2709 /* Line 1455 of yacc.c  */
2710 #line 470 "inform.y"
2711     { (yyval.val).t = Z_WORDARRAY; (yyval.val).o = (yyvsp[(1) - (3)].val).v; (yyval.val).p = (yyvsp[(3) - (3)].val).v; infix_get_val(&(yyval.val));     }
2712     break;
2713
2714   case 117:
2715
2716 /* Line 1455 of yacc.c  */
2717 #line 473 "inform.y"
2718     { (yyval.val) = z_t((yyvsp[(2) - (2)].val), (yyvsp[(2) - (2)].val), neg((yyvsp[(2) - (2)].val).v));         }
2719     break;
2720
2721   case 118:
2722
2723 /* Line 1455 of yacc.c  */
2724 #line 476 "inform.y"
2725     { if(!ignoreeffects) infix_assign(&(yyvsp[(2) - (2)].val), ARITHMASK((yyvsp[(2) - (2)].val).v + 1)); (yyval.val) = (yyvsp[(2) - (2)].val); }
2726     break;
2727
2728   case 119:
2729
2730 /* Line 1455 of yacc.c  */
2731 #line 478 "inform.y"
2732     { (yyval.val) = (yyvsp[(1) - (2)].val); if(!ignoreeffects) infix_assign(&(yyvsp[(1) - (2)].val), ARITHMASK((yyvsp[(1) - (2)].val).v + 1)); }
2733     break;
2734
2735   case 120:
2736
2737 /* Line 1455 of yacc.c  */
2738 #line 480 "inform.y"
2739     { if(!ignoreeffects) infix_assign(&(yyvsp[(2) - (2)].val), ARITHMASK((yyvsp[(2) - (2)].val).v + neg(1))); (yyval.val) = (yyvsp[(2) - (2)].val); }
2740     break;
2741
2742   case 121:
2743
2744 /* Line 1455 of yacc.c  */
2745 #line 482 "inform.y"
2746     { (yyval.val) = (yyvsp[(1) - (2)].val); if(!ignoreeffects) infix_assign(&(yyvsp[(1) - (2)].val), ARITHMASK((yyvsp[(1) - (2)].val).v + neg(1))); }
2747     break;
2748
2749   case 122:
2750
2751 /* Line 1455 of yacc.c  */
2752 #line 485 "inform.y"
2753     { zword len; (yyval.val).v = infix_get_proptable((yyvsp[(1) - (3)].val).v, (yyvsp[(3) - (3)].val).v, &len); (yyval.val).t = Z_NUMBER; }
2754     break;
2755
2756   case 123:
2757
2758 /* Line 1455 of yacc.c  */
2759 #line 487 "inform.y"
2760     { infix_get_proptable((yyvsp[(1) - (3)].val).v, (yyvsp[(3) - (3)].val).v, &(yyval.val).v); (yyval.val).t = Z_NUMBER; }
2761     break;
2762
2763   case 124:
2764
2765 /* Line 1455 of yacc.c  */
2766 #line 490 "inform.y"
2767     { (yyval.val).t = Z_OBJPROP; (yyval.val).o = (yyvsp[(1) - (3)].val).v; (yyval.val).p = (yyvsp[(3) - (3)].val).v; infix_get_val(&(yyval.val)); }
2768     break;
2769
2770   case 125:
2771
2772 /* Line 1455 of yacc.c  */
2773 #line 498 "inform.y"
2774     { (yyval.val).v = (yyvsp[(2) - (2)].val).v; (yyval.val).t = Z_NUMBER;               }
2775     break;
2776
2777   case 126:
2778
2779 /* Line 1455 of yacc.c  */
2780 #line 500 "inform.y"
2781     { (yyval.val).v = (yyvsp[(2) - (2)].val).v; (yyval.val).t = Z_OBJECT;               }
2782     break;
2783
2784   case 127:
2785
2786 /* Line 1455 of yacc.c  */
2787 #line 502 "inform.y"
2788     { (yyval.val).v = (yyvsp[(2) - (2)].val).v; (yyval.val).t = Z_ROUTINE;      }
2789     break;
2790
2791   case 128:
2792
2793 /* Line 1455 of yacc.c  */
2794 #line 504 "inform.y"
2795     { (yyval.val).v = (yyvsp[(2) - (2)].val).v; (yyval.val).t = Z_STRING;               }
2796     break;
2797
2798   case 129:
2799
2800 /* Line 1455 of yacc.c  */
2801 #line 506 "inform.y"
2802     { (yyval.val).t = Z_WORDARRAY; (yyval.val).o = z_globaltable; (yyval.val).p = (yyvsp[(2) - (2)].val).v; infix_get_val(&(yyval.val)); }
2803     break;
2804
2805   case 130:
2806
2807 /* Line 1455 of yacc.c  */
2808 #line 508 "inform.y"
2809     { (yyval.val).t = Z_LOCAL; (yyval.val).o = infix_selected_frame; (yyval.val).p = (yyvsp[(2) - (2)].val).v; infix_get_val(&(yyval.val)); }
2810     break;
2811
2812   case 131:
2813
2814 /* Line 1455 of yacc.c  */
2815 #line 510 "inform.y"
2816     { (yyval.val) = (yyvsp[(2) - (3)].val);                             }
2817     break;
2818
2819
2820
2821 /* Line 1455 of yacc.c  */
2822 #line 2823 "inform.c"
2823       default: break;
2824     }
2825   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2826
2827   YYPOPSTACK (yylen);
2828   yylen = 0;
2829   YY_STACK_PRINT (yyss, yyssp);
2830
2831   *++yyvsp = yyval;
2832
2833   /* Now `shift' the result of the reduction.  Determine what state
2834      that goes to, based on the state we popped back to and the rule
2835      number reduced by.  */
2836
2837   yyn = yyr1[yyn];
2838
2839   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2840   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2841     yystate = yytable[yystate];
2842   else
2843     yystate = yydefgoto[yyn - YYNTOKENS];
2844
2845   goto yynewstate;
2846
2847
2848 /*------------------------------------.
2849 | yyerrlab -- here on detecting error |
2850 `------------------------------------*/
2851 yyerrlab:
2852   /* If not already recovering from an error, report this error.  */
2853   if (!yyerrstatus)
2854     {
2855       ++yynerrs;
2856 #if ! YYERROR_VERBOSE
2857       yyerror (YY_("syntax error"));
2858 #else
2859       {
2860         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2861         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2862           {
2863             YYSIZE_T yyalloc = 2 * yysize;
2864             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2865               yyalloc = YYSTACK_ALLOC_MAXIMUM;
2866             if (yymsg != yymsgbuf)
2867               YYSTACK_FREE (yymsg);
2868             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2869             if (yymsg)
2870               yymsg_alloc = yyalloc;
2871             else
2872               {
2873                 yymsg = yymsgbuf;
2874                 yymsg_alloc = sizeof yymsgbuf;
2875               }
2876           }
2877
2878         if (0 < yysize && yysize <= yymsg_alloc)
2879           {
2880             (void) yysyntax_error (yymsg, yystate, yychar);
2881             yyerror (yymsg);
2882           }
2883         else
2884           {
2885             yyerror (YY_("syntax error"));
2886             if (yysize != 0)
2887               goto yyexhaustedlab;
2888           }
2889       }
2890 #endif
2891     }
2892
2893
2894
2895   if (yyerrstatus == 3)
2896     {
2897       /* If just tried and failed to reuse lookahead token after an
2898          error, discard it.  */
2899
2900       if (yychar <= YYEOF)
2901         {
2902           /* Return failure if at end of input.  */
2903           if (yychar == YYEOF)
2904             YYABORT;
2905         }
2906       else
2907         {
2908           yydestruct ("Error: discarding",
2909                       yytoken, &yylval);
2910           yychar = YYEMPTY;
2911         }
2912     }
2913
2914   /* Else will try to reuse lookahead token after shifting the error
2915      token.  */
2916   goto yyerrlab1;
2917
2918
2919 /*---------------------------------------------------.
2920 | yyerrorlab -- error raised explicitly by YYERROR.  |
2921 `---------------------------------------------------*/
2922 yyerrorlab:
2923
2924   /* Pacify compilers like GCC when the user code never invokes
2925      YYERROR and the label yyerrorlab therefore never appears in user
2926      code.  */
2927   if (/*CONSTCOND*/ 0)
2928      goto yyerrorlab;
2929
2930   /* Do not reclaim the symbols of the rule which action triggered
2931      this YYERROR.  */
2932   YYPOPSTACK (yylen);
2933   yylen = 0;
2934   YY_STACK_PRINT (yyss, yyssp);
2935   yystate = *yyssp;
2936   goto yyerrlab1;
2937
2938
2939 /*-------------------------------------------------------------.
2940 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2941 `-------------------------------------------------------------*/
2942 yyerrlab1:
2943   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2944
2945   for (;;)
2946     {
2947       yyn = yypact[yystate];
2948       if (yyn != YYPACT_NINF)
2949         {
2950           yyn += YYTERROR;
2951           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2952             {
2953               yyn = yytable[yyn];
2954               if (0 < yyn)
2955                 break;
2956             }
2957         }
2958
2959       /* Pop the current state because it cannot handle the error token.  */
2960       if (yyssp == yyss)
2961         YYABORT;
2962
2963
2964       yydestruct ("Error: popping",
2965                   yystos[yystate], yyvsp);
2966       YYPOPSTACK (1);
2967       yystate = *yyssp;
2968       YY_STACK_PRINT (yyss, yyssp);
2969     }
2970
2971   *++yyvsp = yylval;
2972
2973
2974   /* Shift the error token.  */
2975   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2976
2977   yystate = yyn;
2978   goto yynewstate;
2979
2980
2981 /*-------------------------------------.
2982 | yyacceptlab -- YYACCEPT comes here.  |
2983 `-------------------------------------*/
2984 yyacceptlab:
2985   yyresult = 0;
2986   goto yyreturn;
2987
2988 /*-----------------------------------.
2989 | yyabortlab -- YYABORT comes here.  |
2990 `-----------------------------------*/
2991 yyabortlab:
2992   yyresult = 1;
2993   goto yyreturn;
2994
2995 #if !defined(yyoverflow) || YYERROR_VERBOSE
2996 /*-------------------------------------------------.
2997 | yyexhaustedlab -- memory exhaustion comes here.  |
2998 `-------------------------------------------------*/
2999 yyexhaustedlab:
3000   yyerror (YY_("memory exhausted"));
3001   yyresult = 2;
3002   /* Fall through.  */
3003 #endif
3004
3005 yyreturn:
3006   if (yychar != YYEMPTY)
3007      yydestruct ("Cleanup: discarding lookahead",
3008                  yytoken, &yylval);
3009   /* Do not reclaim the symbols of the rule which action triggered
3010      this YYABORT or YYACCEPT.  */
3011   YYPOPSTACK (yylen);
3012   YY_STACK_PRINT (yyss, yyssp);
3013   while (yyssp != yyss)
3014     {
3015       yydestruct ("Cleanup: popping",
3016                   yystos[*yyssp], yyvsp);
3017       YYPOPSTACK (1);
3018     }
3019 #ifndef yyoverflow
3020   if (yyss != yyssa)
3021     YYSTACK_FREE (yyss);
3022 #endif
3023 #if YYERROR_VERBOSE
3024   if (yymsg != yymsgbuf)
3025     YYSTACK_FREE (yymsg);
3026 #endif
3027   /* Make sure YYID is used.  */
3028   return YYID (yyresult);
3029 }
3030
3031
3032
3033 /* Line 1675 of yacc.c  */
3034 #line 514 "inform.y"
3035
3036
3037 #if 0
3038 { /* fanagling to get emacs indentation sane */
3039 int foo;
3040 #endif
3041
3042 static z_typed z_t(z_typed a, z_typed b, zword v)
3043 {
3044   z_typed r;
3045   r.v = ARITHMASK(v);
3046   if(a.t == Z_NUMBER && b.t == Z_NUMBER)
3047     r.t = Z_NUMBER;
3048   else
3049     r.t = Z_UNKNOWN;
3050   return r;
3051 }
3052
3053
3054
3055 typedef struct {
3056   int token;
3057   const char *name;
3058 } name_token;
3059
3060 static name_token infix_operators[] = {
3061   { ANDAND,     "&&" },
3062   { OROR,       "||" },
3063   { NOTNOT,     "~~" },
3064   { BYTEARRAY,  "->" },
3065   { WORDARRAY,  "-->" },
3066   { NUMBER,     "(number)" },
3067   { OBJECT,     "(object)" },
3068   { ROUTINE,    "(routine)" },
3069   { STRING,     "(string)" },
3070   { GLOBAL,     "(global)" },
3071   { LOCAL,      "(local)" },
3072   { INCREMENT,  "++" },
3073   { DECREMENT,  "--" },
3074   { SUPERCLASS, "::" }
3075 };
3076
3077
3078 static name_token infix_keywords[] = {
3079   { TO,         "to" },
3080   { IF,         "if" },
3081   { OR,         "or" },
3082   { BTRUE,      "true" },
3083   { BFALSE,     "false" },
3084   { NOTHING,    "nothing" },
3085   { PARENT,     "parent" },
3086   { CHILD,      "child" },
3087   { SIBLING,    "sibling" },
3088   { RANDOM,     "random" },
3089   { CHILDREN,   "children" }
3090 };
3091
3092
3093 /* These are only valid as the first token in an expression.  A single space
3094    matches at least one typed whitespace character */
3095 static name_token infix_commands[] = {
3096   { '#',          "#" },
3097   { HELP,         "help" },
3098   { ALIAS,        "alias" },
3099   { RALIAS,       "ralias" },
3100   { UNALIAS,      "unalias" },
3101   { DUMPMEM,      "dumpmem" },
3102   { AUTOMAP,      "automap" },
3103   { UNDO,         "undo" },
3104   { REDO,         "redo" },
3105   { QUIT,         "quit" },
3106   { RESTORE,      "restore" },
3107   { RESTART,      "restart" },
3108   { RESTART,      "run" },
3109   { RECORDON,     "recording on" },
3110   { RECORDOFF,    "recording off" },
3111   { REPLAY,       "replay" },
3112   { REPLAYOFF,    "replay off" },
3113   { SYMBOL_FILE,  "symbol-file" },
3114   { PRINT,        "print" },
3115   { PRINT,        "p" },
3116   { PRINT,        "call" },  /* No void functions in inform */
3117   { SET,          "set" },
3118   { MOVE,         "move" },
3119   { OBJECT_TREE,  "object-tree" },
3120   { OBJECT_TREE,  "tree" },
3121   { FIND,         "find" },
3122   { REMOVE,       "remove" },
3123   { GIVE,         "give" },
3124   { LIST_GLOBALS, "globals" },
3125   { JUMP,         "jump" },
3126   { CONT,         "continue" },
3127   { CONT,         "c" },
3128   { CONT,         "fg" },
3129   { STEP,         "step" },
3130   { STEP,         "s" },
3131   { NEXT,         "next" },
3132   { NEXT,         "n" },
3133   { STEPI,        "stepi" },
3134   { STEPI,        "si" },
3135   { NEXTI,        "nexti" },
3136   { NEXTI,        "ni" },
3137   { UNTIL,        "until" },
3138   { UNTIL,        "u" },
3139   { FINISH,       "finish" },
3140   { BREAK,        "break" },
3141   { DELETE,       "delete" },
3142   { DELETE,       "d" },
3143   { DELETE,       "delete breakpoints" },
3144   { COND,         "condition" },
3145   { IGNORE,       "ignore" },
3146   { FRAME,        "frame" },
3147   { FRAME,        "f" },
3148   { SELECT_FRAME, "select-frame" },
3149   { UP_FRAME,     "up" },
3150   { DOWN_FRAME,   "down" },
3151   { DOWN_FRAME,   "do" },
3152   { UP_SILENTLY,  "up-silently" },
3153   { DOWN_SILENTLY,"down-silently" },
3154   { BREAKPOINTS,  "info breakpoints" },
3155   { BREAKPOINTS,  "info watchpoints" },
3156   { BREAKPOINTS,  "info break" },
3157   { DISABLE_BREAK,"disable" },
3158   { DISABLE_BREAK,"disable breakpoints" },
3159   { DISABLE_BREAK,"dis" },
3160   { DISABLE_BREAK,"dis breakpoints" },
3161   { ENABLE_BREAK, "enable" },
3162   { ENABLE_BREAK, "enable breakpoints" },
3163   { LANGUAGE,     "show language" },
3164   { INFOSOURCE,   "info source" },
3165   { INFOSOURCES,  "info sources" },
3166   { COPYING,      "show copying" },
3167   { WARRANTY,     "show warranty" },
3168   { BACKTRACE,    "backtrace" },
3169   { BACKTRACE,    "bt" },
3170   { BACKTRACE,    "where" },
3171   { BACKTRACE,    "info stack" },
3172   { BACKTRACE,    "info s" },
3173   { DISPLAY,      "display" },
3174   { UNDISPLAY,    "undisplay" },
3175   { UNDISPLAY,    "delete display" },
3176   { DISABLE_DISPLAY,"disable display" },
3177   { DISABLE_DISPLAY,"dis display" },
3178   { ENABLE_DISPLAY,"enable display" }
3179 };
3180
3181 #include "dbg_help.h"
3182
3183 static BOOL z_isequal(zword a, zword b)
3184 {
3185   return (a == b);
3186 }
3187
3188 static BOOL z_isgreat(zword a, zword b)
3189 {
3190   return is_greaterthan(a, b);
3191 }
3192
3193 static BOOL z_isless(zword a, zword b)
3194 {
3195   return is_lessthan(a, b);
3196 }
3197
3198 static BOOL infix_provides(zword o, zword p)
3199 {
3200   zword len;
3201   return (infix_get_proptable(o, p, &len) != 0);
3202 }
3203
3204 static BOOL infix_in(zword a, zword b)
3205 {
3206   return infix_parent(a) == b;
3207 }
3208
3209 typedef struct {
3210   const char *name;
3211   BOOL (*condfunc)(zword a, zword b);
3212   BOOL opposite;
3213 } condition;
3214
3215 condition conditionlist[] = {
3216   { "==",      z_isequal,         FALSE },
3217   { "~=",      z_isequal,         TRUE },
3218   { ">",       z_isgreat,         FALSE },
3219   { "<",       z_isless,          FALSE },
3220   { "<=",      z_isgreat,         TRUE },
3221   { ">=",      z_isless,          TRUE },
3222   { "has",     infix_test_attrib, FALSE },
3223   { "hasnt",   infix_test_attrib, TRUE },
3224   { "in",      infix_in,          FALSE },
3225   { "notin",   infix_in,          TRUE },
3226 /*{ "ofclass", infix_ofclass,     FALSE },*/
3227   { "provides",infix_provides,    FALSE }
3228 };
3229
3230
3231 static BOOL is_command_identifier(char c)
3232 {
3233   return isalpha(c) || (c == '-');
3234 }
3235
3236 static BOOL is_identifier(char c)
3237 {
3238   return isalpha(c) || isdigit(c) || (c == '_');
3239 }
3240
3241 static BOOL is_longer_identifier(char c)
3242 {
3243   return isalpha(c) || isdigit(c) || (c == '_') || (c == '.') || (c == ':');
3244 }
3245
3246 static int grab_number(z_typed *val)
3247 {
3248   int len = 0;
3249   char *endptr;
3250   char c = lex_expression[lex_offset + len];
3251   int base = 10;
3252   long int num;
3253
3254   /* Don't handle negativity here */
3255   if(c == '-' || c == '+')
3256     return 0;
3257   
3258   if(c == '$') {
3259     len++;
3260     base = 16;
3261     c = lex_expression[lex_offset + len];
3262     if(c == '$') {
3263       len++;
3264       base = 2;
3265       c = lex_expression[lex_offset + len];
3266     }
3267   }
3268   
3269   num = n_strtol(lex_expression + lex_offset + len, &endptr, base);
3270
3271   if(endptr != lex_expression + lex_offset) {
3272     len += endptr - lex_expression - lex_offset;
3273     val->v = num;
3274     val->t = Z_NUMBER;
3275     return len;
3276   }
3277   return 0;
3278 }
3279
3280
3281 typedef enum { match_None, match_Partial, match_Complete } match_type;
3282
3283 static match_type command_matches(const char *command, const char *expression,
3284                                   unsigned *matchedlen)
3285 {
3286   unsigned c, e;
3287   e = 0;
3288
3289   for(c = 0; command[c]; c++) {
3290     if(command[c] != expression[e]) {
3291       if(!is_command_identifier(expression[e])) {
3292         *matchedlen = e;
3293         return match_Partial;
3294       }
3295       return match_None;
3296     }
3297
3298     e++;
3299     
3300     if(command[c] == ' ') {
3301       while(expression[e] == ' ')
3302         e++;
3303     }
3304   }
3305
3306   if(!is_command_identifier(expression[e])) {
3307     *matchedlen = e;
3308     return match_Complete; 
3309   }
3310
3311   return match_None;
3312 }
3313
3314
3315 static int grab_command(void)
3316 {
3317   unsigned i;
3318   unsigned len;
3319
3320   unsigned best;
3321   match_type best_match = match_None;
3322   unsigned best_len = 0;
3323   BOOL found = FALSE;
3324   BOOL ambig = FALSE;
3325
3326   while(isspace(lex_expression[lex_offset]))
3327     lex_offset++;
3328
3329   for(i = 0; i < sizeof(infix_commands) / sizeof(*infix_commands); i++) {
3330     switch(command_matches(infix_commands[i].name, lex_expression + lex_offset, &len)) {
3331     case match_Complete:
3332       if(len > best_len || best_match != match_Complete) {
3333         best = i;
3334         best_match = match_Complete;
3335         best_len = len;
3336         found = TRUE;
3337       }
3338       break;
3339
3340     case match_Partial:
3341       if(best_match != match_Complete) {
3342         if(found)
3343           ambig = TRUE;
3344         best = i;
3345         best_match = match_Partial;
3346         best_len = len;
3347         found = TRUE;
3348       }
3349
3350     case match_None:
3351       ;
3352     }
3353   }
3354
3355   if(ambig && best_match != match_Complete) {
3356     infix_print_string("Ambiguous command.\n");
3357     return 0;
3358   }
3359
3360   if(found) {
3361     lex_offset += best_len;
3362     return infix_commands[best].token;
3363   }
3364
3365   infix_print_string("Undefined command.\n");
3366   return 0;
3367 }
3368
3369
3370 static void inform_help(void)
3371 {
3372   int command;
3373   unsigned i;
3374   BOOL is_command = FALSE;
3375   
3376   for(i = lex_offset; lex_expression[i]; i++)
3377     if(!isspace(lex_expression[i]))
3378       is_command = TRUE;
3379
3380   if(!is_command) {
3381     infix_print_string("Help is available on the following commands:\n");
3382     for(i = 0; i < sizeof(command_help) / sizeof(*command_help); i++) {
3383       unsigned j;
3384       for(j = 0; j < sizeof(infix_commands) / sizeof(*infix_commands); j++)
3385         if(command_help[i].token == infix_commands[j].token) {
3386           infix_print_char('\'');
3387           infix_print_string(infix_commands[j].name);
3388           infix_print_char('\'');
3389           break;
3390         }
3391       infix_print_char(' ');
3392     }
3393     infix_print_string("\n");
3394     return;
3395   }
3396   
3397   command = grab_command();
3398   if(command) {
3399     for(i = 0; i < sizeof(command_help) / sizeof(*command_help); i++) {
3400       if(command_help[i].token == command) {
3401         infix_print_string(command_help[i].name);
3402         infix_print_char(10);
3403         return;
3404       }
3405     }
3406     infix_print_string("No help available for that command.\n");
3407   }
3408 }
3409
3410
3411 void process_debug_command(const char *buffer)
3412 {
3413 #ifdef YYDEBUG
3414   yydebug = 1;
3415 #endif
3416   lex_expression = buffer;
3417   lex_offset = 0;
3418   ignoreeffects = 0;
3419   yyparse();
3420   n_rmfree();
3421 }
3422
3423 BOOL exp_has_locals(const char *exp)
3424 {
3425   return FALSE;
3426 }
3427
3428 z_typed evaluate_expression(const char *exp, unsigned frame)
3429 {
3430   unsigned old_frame = infix_selected_frame;
3431   char *new_exp = (char *) n_malloc(n_strlen(exp) + 5);
3432   n_strcpy(new_exp, "set ");
3433   n_strcat(new_exp, exp);
3434
3435   infix_selected_frame = frame;
3436   process_debug_command(new_exp);
3437   infix_selected_frame = old_frame;
3438
3439   n_free(new_exp);
3440
3441   return inform_result;
3442 }
3443
3444 static void yyerror(const char *s)
3445 {
3446   infix_print_string(s);
3447   infix_print_char(10);
3448 }
3449
3450 static int yylex(void)
3451 {
3452   unsigned i, len, longer;
3453   BOOL check_command = FALSE;
3454
3455   if(lex_offset == 0)
3456     check_command = TRUE;
3457
3458   while(isspace(lex_expression[lex_offset]))
3459     lex_offset++;
3460
3461   if(check_command) {
3462     return grab_command();
3463   }
3464
3465   if((len = grab_number(&yylval.val)) != 0) {
3466     lex_offset += len;
3467     return NUM;
3468   }
3469
3470   for(i = 0; i < sizeof(infix_operators) / sizeof(*infix_operators); i++) {
3471     if(n_strncmp(infix_operators[i].name, lex_expression + lex_offset,
3472                n_strlen(infix_operators[i].name)) == 0) {
3473       lex_offset += n_strlen(infix_operators[i].name);
3474       return infix_operators[i].token;
3475     }
3476   }
3477
3478   for(i = 0; i < sizeof(conditionlist) / sizeof(*conditionlist); i++) {
3479     len = n_strlen(conditionlist[i].name);
3480     if(len
3481        && n_strncmp(conditionlist[i].name,
3482                    lex_expression + lex_offset, len) == 0
3483        && !(is_identifier(conditionlist[i].name[len-1])
3484             && is_identifier(lex_expression[lex_offset + len]))) {
3485
3486       lex_offset += len;
3487       yylval.cond.condfunc = conditionlist[i].condfunc;
3488       yylval.cond.opposite = conditionlist[i].opposite;
3489       return CONDITION;
3490     }
3491   }
3492
3493   if((len = infix_find_file(&yylval.filenum, lex_expression + lex_offset)) != 0) {
3494     lex_offset += len;
3495     return DFILE;
3496   }
3497
3498
3499   for(len = 0; is_identifier(lex_expression[lex_offset + len]); len++)
3500     ;
3501
3502   if(!len)
3503     return lex_expression[lex_offset++];
3504
3505   for(i = 0; i < sizeof(infix_keywords) / sizeof(*infix_keywords); i++) {
3506     if(n_strmatch(infix_keywords[i].name, lex_expression + lex_offset, len)) {
3507       lex_offset += len;
3508       return infix_keywords[i].token;
3509     }
3510   }
3511
3512   for(longer = len; is_longer_identifier(lex_expression[lex_offset + longer]); longer++)
3513     ;
3514
3515   if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, longer)) {
3516     lex_offset += longer;
3517     return NUM;
3518   }
3519
3520   if(infix_find_symbol(&yylval.val, lex_expression + lex_offset, len)) {
3521     lex_offset += len;
3522     return NUM;
3523   }
3524
3525   infix_print_string("Unknown identifier \"");
3526   for(i = 0; i < len; i++)
3527     infix_print_char(lex_expression[lex_offset + i]);
3528   infix_print_string("\"\n");
3529
3530   return 0;
3531 }
3532
3533 #endif /* DEBUGGING */
3534