"Fossies" - the Fresh Open Source Software Archive

Member "gawk-5.1.0/command.c" (14 Apr 2020, 103054 Bytes) of package /linux/misc/gawk-5.1.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "command.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.0.1_vs_5.1.0.

    1 /* A Bison parser, made by GNU Bison 3.5.4.  */
    2 
    3 /* Bison implementation for Yacc-like parsers in C
    4 
    5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
    6    Inc.
    7 
    8    This program is free software: you can redistribute it and/or modify
    9    it under the terms of the GNU General Public License as published by
   10    the Free Software Foundation, either version 3 of the License, or
   11    (at your option) any later version.
   12 
   13    This program is distributed in the hope that it will be useful,
   14    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16    GNU General Public License for more details.
   17 
   18    You should have received a copy of the GNU General Public License
   19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   20 
   21 /* As a special exception, you may create a larger work that contains
   22    part or all of the Bison parser skeleton and distribute that work
   23    under terms of your choice, so long as that work isn't itself a
   24    parser generator using the skeleton or a modified version thereof
   25    as a parser skeleton.  Alternatively, if you modify or redistribute
   26    the parser skeleton itself, you may (at your option) remove this
   27    special exception, which will cause the skeleton and the resulting
   28    Bison output files to be licensed under the GNU General Public
   29    License without this special exception.
   30 
   31    This special exception was added by the Free Software Foundation in
   32    version 2.2 of Bison.  */
   33 
   34 /* C LALR(1) parser skeleton written by Richard Stallman, by
   35    simplifying the original so-called "semantic" parser.  */
   36 
   37 /* All symbols defined below should begin with yy or YY, to avoid
   38    infringing on user name space.  This should be done even for local
   39    variables, as they might otherwise be expanded by user macros.
   40    There are some unavoidable exceptions within include files to
   41    define necessary library symbols; they are noted "INFRINGES ON
   42    USER NAME SPACE" below.  */
   43 
   44 /* Undocumented macros, especially those whose name start with YY_,
   45    are private implementation details.  Do not rely on them.  */
   46 
   47 /* Identify Bison output.  */
   48 #define YYBISON 1
   49 
   50 /* Bison version.  */
   51 #define YYBISON_VERSION "3.5.4"
   52 
   53 /* Skeleton name.  */
   54 #define YYSKELETON_NAME "yacc.c"
   55 
   56 /* Pure parsers.  */
   57 #define YYPURE 0
   58 
   59 /* Push parsers.  */
   60 #define YYPUSH 0
   61 
   62 /* Pull parsers.  */
   63 #define YYPULL 1
   64 
   65 
   66 /* Substitute the variable and function names.  */
   67 #define yyparse         zzparse
   68 #define yylex           zzlex
   69 #define yyerror         zzerror
   70 #define yydebug         zzdebug
   71 #define yynerrs         zznerrs
   72 #define yylval          zzlval
   73 #define yychar          zzchar
   74 
   75 /* First part of user prologue.  */
   76 #line 28 "command.y"
   77 
   78 #include "awk.h"
   79 #include "cmd.h"
   80 
   81 #if 0
   82 #define YYDEBUG 12
   83 int yydebug = 2;
   84 #endif
   85 
   86 static int yylex(void);
   87 static void yyerror(const char *mesg, ...);
   88 
   89 static int find_command(const char *token, size_t toklen);
   90 
   91 static bool want_nodeval = false;
   92 
   93 static int cmd_idx = -1;        /* index of current command in cmd table */
   94 static int repeat_idx = -1;     /* index of last repeatable command in command table */
   95 static CMDARG *arg_list = NULL;     /* list of arguments */
   96 static long dbg_errcount = 0;
   97 static char *lexptr_begin = NULL;
   98 static bool in_commands = false;
   99 static int num_dim;
  100 
  101 static bool in_eval = false;
  102 static const char start_EVAL[] = "function @eval(){";
  103 static const char end_EVAL[] = "}";
  104 static CMDARG *append_statement(CMDARG *stmt_list, char *stmt);
  105 static NODE *concat_args(CMDARG *a, int count);
  106 
  107 #ifdef HAVE_LIBREADLINE
  108 static char *next_word(char *p, int len, char **endp);
  109 static void history_expand_line(char **line);
  110 static char *command_generator(const char *text, int state);
  111 static char *srcfile_generator(const char *text, int state);
  112 static char *argument_generator(const char *text, int state);
  113 static char *variable_generator(const char *text, int state);
  114 extern char *option_generator(const char *text, int state);
  115 static int this_cmd = D_illegal;
  116 #else
  117 #define history_expand_line(p)  /* nothing */
  118 static int rl_inhibit_completion;   /* dummy variable */
  119 #endif
  120 
  121 struct argtoken {
  122     const char *name;
  123     enum argtype cmd;
  124     enum nametypeval value;
  125 };
  126 
  127 /*
  128  * These two should be static, but there are some compilers that
  129  * don't like the static keyword with an empty size. Therefore give
  130  * them names that are less likely to conflict with the rest of gawk.
  131  */
  132 #define argtab zz_debug_argtab
  133 #define cmdtab zz_debug_cmdtab
  134 
  135 extern struct argtoken argtab[];
  136 extern struct cmdtoken cmdtab[];
  137 
  138 static CMDARG *mk_cmdarg(enum argtype type);
  139 static void append_cmdarg(CMDARG *arg);
  140 static int find_argument(CMDARG *arg);
  141 #define YYSTYPE CMDARG *
  142 
  143 #line 144 "command.c"
  144 
  145 # ifndef YY_CAST
  146 #  ifdef __cplusplus
  147 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
  148 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  149 #  else
  150 #   define YY_CAST(Type, Val) ((Type) (Val))
  151 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  152 #  endif
  153 # endif
  154 # ifndef YY_NULLPTR
  155 #  if defined __cplusplus
  156 #   if 201103L <= __cplusplus
  157 #    define YY_NULLPTR nullptr
  158 #   else
  159 #    define YY_NULLPTR 0
  160 #   endif
  161 #  else
  162 #   define YY_NULLPTR ((void*)0)
  163 #  endif
  164 # endif
  165 
  166 /* Enabling verbose error messages.  */
  167 #ifdef YYERROR_VERBOSE
  168 # undef YYERROR_VERBOSE
  169 # define YYERROR_VERBOSE 1
  170 #else
  171 # define YYERROR_VERBOSE 0
  172 #endif
  173 
  174 
  175 /* Debug traces.  */
  176 #ifndef YYDEBUG
  177 # define YYDEBUG 0
  178 #endif
  179 #if YYDEBUG
  180 extern int zzdebug;
  181 #endif
  182 
  183 /* Token type.  */
  184 #ifndef YYTOKENTYPE
  185 # define YYTOKENTYPE
  186   enum yytokentype
  187   {
  188     D_BACKTRACE = 258,
  189     D_BREAK = 259,
  190     D_CLEAR = 260,
  191     D_CONTINUE = 261,
  192     D_DELETE = 262,
  193     D_DISABLE = 263,
  194     D_DOWN = 264,
  195     D_ENABLE = 265,
  196     D_FINISH = 266,
  197     D_FRAME = 267,
  198     D_HELP = 268,
  199     D_IGNORE = 269,
  200     D_INFO = 270,
  201     D_LIST = 271,
  202     D_NEXT = 272,
  203     D_NEXTI = 273,
  204     D_PRINT = 274,
  205     D_PRINTF = 275,
  206     D_QUIT = 276,
  207     D_RETURN = 277,
  208     D_RUN = 278,
  209     D_SET = 279,
  210     D_STEP = 280,
  211     D_STEPI = 281,
  212     D_TBREAK = 282,
  213     D_UP = 283,
  214     D_UNTIL = 284,
  215     D_DISPLAY = 285,
  216     D_UNDISPLAY = 286,
  217     D_WATCH = 287,
  218     D_UNWATCH = 288,
  219     D_DUMP = 289,
  220     D_TRACE = 290,
  221     D_INT = 291,
  222     D_STRING = 292,
  223     D_NODE = 293,
  224     D_VARIABLE = 294,
  225     D_OPTION = 295,
  226     D_COMMANDS = 296,
  227     D_END = 297,
  228     D_SILENT = 298,
  229     D_SOURCE = 299,
  230     D_SAVE = 300,
  231     D_EVAL = 301,
  232     D_CONDITION = 302,
  233     D_STATEMENT = 303
  234   };
  235 #endif
  236 /* Tokens.  */
  237 #define D_BACKTRACE 258
  238 #define D_BREAK 259
  239 #define D_CLEAR 260
  240 #define D_CONTINUE 261
  241 #define D_DELETE 262
  242 #define D_DISABLE 263
  243 #define D_DOWN 264
  244 #define D_ENABLE 265
  245 #define D_FINISH 266
  246 #define D_FRAME 267
  247 #define D_HELP 268
  248 #define D_IGNORE 269
  249 #define D_INFO 270
  250 #define D_LIST 271
  251 #define D_NEXT 272
  252 #define D_NEXTI 273
  253 #define D_PRINT 274
  254 #define D_PRINTF 275
  255 #define D_QUIT 276
  256 #define D_RETURN 277
  257 #define D_RUN 278
  258 #define D_SET 279
  259 #define D_STEP 280
  260 #define D_STEPI 281
  261 #define D_TBREAK 282
  262 #define D_UP 283
  263 #define D_UNTIL 284
  264 #define D_DISPLAY 285
  265 #define D_UNDISPLAY 286
  266 #define D_WATCH 287
  267 #define D_UNWATCH 288
  268 #define D_DUMP 289
  269 #define D_TRACE 290
  270 #define D_INT 291
  271 #define D_STRING 292
  272 #define D_NODE 293
  273 #define D_VARIABLE 294
  274 #define D_OPTION 295
  275 #define D_COMMANDS 296
  276 #define D_END 297
  277 #define D_SILENT 298
  278 #define D_SOURCE 299
  279 #define D_SAVE 300
  280 #define D_EVAL 301
  281 #define D_CONDITION 302
  282 #define D_STATEMENT 303
  283 
  284 /* Value type.  */
  285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  286 typedef int YYSTYPE;
  287 # define YYSTYPE_IS_TRIVIAL 1
  288 # define YYSTYPE_IS_DECLARED 1
  289 #endif
  290 
  291 
  292 extern YYSTYPE zzlval;
  293 
  294 int zzparse (void);
  295 
  296 
  297 
  298 
  299 
  300 #ifdef short
  301 # undef short
  302 #endif
  303 
  304 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  305    <limits.h> and (if available) <stdint.h> are included
  306    so that the code can choose integer types of a good width.  */
  307 
  308 #ifndef __PTRDIFF_MAX__
  309 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
  310 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  311 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  312 #  define YY_STDINT_H
  313 # endif
  314 #endif
  315 
  316 /* Narrow types that promote to a signed type and that can represent a
  317    signed or unsigned integer of at least N bits.  In tables they can
  318    save space and decrease cache pressure.  Promoting to a signed type
  319    helps avoid bugs in integer arithmetic.  */
  320 
  321 #ifdef __INT_LEAST8_MAX__
  322 typedef __INT_LEAST8_TYPE__ yytype_int8;
  323 #elif defined YY_STDINT_H
  324 typedef int_least8_t yytype_int8;
  325 #else
  326 typedef signed char yytype_int8;
  327 #endif
  328 
  329 #ifdef __INT_LEAST16_MAX__
  330 typedef __INT_LEAST16_TYPE__ yytype_int16;
  331 #elif defined YY_STDINT_H
  332 typedef int_least16_t yytype_int16;
  333 #else
  334 typedef short yytype_int16;
  335 #endif
  336 
  337 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  338 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  339 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  340        && UINT_LEAST8_MAX <= INT_MAX)
  341 typedef uint_least8_t yytype_uint8;
  342 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  343 typedef unsigned char yytype_uint8;
  344 #else
  345 typedef short yytype_uint8;
  346 #endif
  347 
  348 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  349 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  350 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  351        && UINT_LEAST16_MAX <= INT_MAX)
  352 typedef uint_least16_t yytype_uint16;
  353 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  354 typedef unsigned short yytype_uint16;
  355 #else
  356 typedef int yytype_uint16;
  357 #endif
  358 
  359 #ifndef YYPTRDIFF_T
  360 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  361 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
  362 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  363 # elif defined PTRDIFF_MAX
  364 #  ifndef ptrdiff_t
  365 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  366 #  endif
  367 #  define YYPTRDIFF_T ptrdiff_t
  368 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  369 # else
  370 #  define YYPTRDIFF_T long
  371 #  define YYPTRDIFF_MAXIMUM LONG_MAX
  372 # endif
  373 #endif
  374 
  375 #ifndef YYSIZE_T
  376 # ifdef __SIZE_TYPE__
  377 #  define YYSIZE_T __SIZE_TYPE__
  378 # elif defined size_t
  379 #  define YYSIZE_T size_t
  380 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  381 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  382 #  define YYSIZE_T size_t
  383 # else
  384 #  define YYSIZE_T unsigned
  385 # endif
  386 #endif
  387 
  388 #define YYSIZE_MAXIMUM                                  \
  389   YY_CAST (YYPTRDIFF_T,                                 \
  390            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
  391             ? YYPTRDIFF_MAXIMUM                         \
  392             : YY_CAST (YYSIZE_T, -1)))
  393 
  394 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  395 
  396 /* Stored state numbers (used for stacks). */
  397 typedef yytype_uint8 yy_state_t;
  398 
  399 /* State numbers in computations.  */
  400 typedef int yy_state_fast_t;
  401 
  402 #ifndef YY_
  403 # if defined YYENABLE_NLS && YYENABLE_NLS
  404 #  if ENABLE_NLS
  405 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  406 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  407 #  endif
  408 # endif
  409 # ifndef YY_
  410 #  define YY_(Msgid) Msgid
  411 # endif
  412 #endif
  413 
  414 #ifndef YY_ATTRIBUTE_PURE
  415 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  416 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  417 # else
  418 #  define YY_ATTRIBUTE_PURE
  419 # endif
  420 #endif
  421 
  422 #ifndef YY_ATTRIBUTE_UNUSED
  423 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  424 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  425 # else
  426 #  define YY_ATTRIBUTE_UNUSED
  427 # endif
  428 #endif
  429 
  430 /* Suppress unused-variable warnings by "using" E.  */
  431 #if ! defined lint || defined __GNUC__
  432 # define YYUSE(E) ((void) (E))
  433 #else
  434 # define YYUSE(E) /* empty */
  435 #endif
  436 
  437 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  438 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
  439 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
  440     _Pragma ("GCC diagnostic push")                                     \
  441     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
  442     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  443 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
  444     _Pragma ("GCC diagnostic pop")
  445 #else
  446 # define YY_INITIAL_VALUE(Value) Value
  447 #endif
  448 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  449 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  450 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  451 #endif
  452 #ifndef YY_INITIAL_VALUE
  453 # define YY_INITIAL_VALUE(Value) /* Nothing. */
  454 #endif
  455 
  456 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  457 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
  458     _Pragma ("GCC diagnostic push")                            \
  459     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  460 # define YY_IGNORE_USELESS_CAST_END            \
  461     _Pragma ("GCC diagnostic pop")
  462 #endif
  463 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  464 # define YY_IGNORE_USELESS_CAST_BEGIN
  465 # define YY_IGNORE_USELESS_CAST_END
  466 #endif
  467 
  468 
  469 #define YY_ASSERT(E) ((void) (0 && (E)))
  470 
  471 #if ! defined yyoverflow || YYERROR_VERBOSE
  472 
  473 /* The parser invokes alloca or malloc; define the necessary symbols.  */
  474 
  475 # ifdef YYSTACK_USE_ALLOCA
  476 #  if YYSTACK_USE_ALLOCA
  477 #   ifdef __GNUC__
  478 #    define YYSTACK_ALLOC __builtin_alloca
  479 #   elif defined __BUILTIN_VA_ARG_INCR
  480 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  481 #   elif defined _AIX
  482 #    define YYSTACK_ALLOC __alloca
  483 #   elif defined _MSC_VER
  484 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  485 #    define alloca _alloca
  486 #   else
  487 #    define YYSTACK_ALLOC alloca
  488 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  489 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  490       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
  491 #     ifndef EXIT_SUCCESS
  492 #      define EXIT_SUCCESS 0
  493 #     endif
  494 #    endif
  495 #   endif
  496 #  endif
  497 # endif
  498 
  499 # ifdef YYSTACK_ALLOC
  500    /* Pacify GCC's 'empty if-body' warning.  */
  501 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  502 #  ifndef YYSTACK_ALLOC_MAXIMUM
  503     /* The OS might guarantee only one guard page at the bottom of the stack,
  504        and a page size can be as small as 4096 bytes.  So we cannot safely
  505        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
  506        to allow for a few compiler-allocated temporary stack slots.  */
  507 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  508 #  endif
  509 # else
  510 #  define YYSTACK_ALLOC YYMALLOC
  511 #  define YYSTACK_FREE YYFREE
  512 #  ifndef YYSTACK_ALLOC_MAXIMUM
  513 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  514 #  endif
  515 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
  516        && ! ((defined YYMALLOC || defined malloc) \
  517              && (defined YYFREE || defined free)))
  518 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  519 #   ifndef EXIT_SUCCESS
  520 #    define EXIT_SUCCESS 0
  521 #   endif
  522 #  endif
  523 #  ifndef YYMALLOC
  524 #   define YYMALLOC malloc
  525 #   if ! defined malloc && ! defined EXIT_SUCCESS
  526 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  527 #   endif
  528 #  endif
  529 #  ifndef YYFREE
  530 #   define YYFREE free
  531 #   if ! defined free && ! defined EXIT_SUCCESS
  532 void free (void *); /* INFRINGES ON USER NAME SPACE */
  533 #   endif
  534 #  endif
  535 # endif
  536 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  537 
  538 
  539 #if (! defined yyoverflow \
  540      && (! defined __cplusplus \
  541          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  542 
  543 /* A type that is properly aligned for any stack member.  */
  544 union yyalloc
  545 {
  546   yy_state_t yyss_alloc;
  547   YYSTYPE yyvs_alloc;
  548 };
  549 
  550 /* The size of the maximum gap between one aligned stack and the next.  */
  551 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
  552 
  553 /* The size of an array large to enough to hold all stacks, each with
  554    N elements.  */
  555 # define YYSTACK_BYTES(N) \
  556      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
  557       + YYSTACK_GAP_MAXIMUM)
  558 
  559 # define YYCOPY_NEEDED 1
  560 
  561 /* Relocate STACK from its old location to the new one.  The
  562    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  563    elements in the stack, and YYPTR gives the new location of the
  564    stack.  Advance YYPTR to a properly aligned location for the next
  565    stack.  */
  566 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
  567     do                                                                  \
  568       {                                                                 \
  569         YYPTRDIFF_T yynewbytes;                                         \
  570         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
  571         Stack = &yyptr->Stack_alloc;                                    \
  572         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
  573         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
  574       }                                                                 \
  575     while (0)
  576 
  577 #endif
  578 
  579 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  580 /* Copy COUNT objects from SRC to DST.  The source and destination do
  581    not overlap.  */
  582 # ifndef YYCOPY
  583 #  if defined __GNUC__ && 1 < __GNUC__
  584 #   define YYCOPY(Dst, Src, Count) \
  585       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
  586 #  else
  587 #   define YYCOPY(Dst, Src, Count)              \
  588       do                                        \
  589         {                                       \
  590           YYPTRDIFF_T yyi;                      \
  591           for (yyi = 0; yyi < (Count); yyi++)   \
  592             (Dst)[yyi] = (Src)[yyi];            \
  593         }                                       \
  594       while (0)
  595 #  endif
  596 # endif
  597 #endif /* !YYCOPY_NEEDED */
  598 
  599 /* YYFINAL -- State number of the termination state.  */
  600 #define YYFINAL  2
  601 /* YYLAST -- Last index in YYTABLE.  */
  602 #define YYLAST   203
  603 
  604 /* YYNTOKENS -- Number of terminals.  */
  605 #define YYNTOKENS  59
  606 /* YYNNTS -- Number of nonterminals.  */
  607 #define YYNNTS  55
  608 /* YYNRULES -- Number of rules.  */
  609 #define YYNRULES  156
  610 /* YYNSTATES -- Number of states.  */
  611 #define YYNSTATES  203
  612 
  613 #define YYUNDEFTOK  2
  614 #define YYMAXUTOK   303
  615 
  616 
  617 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  618    as returned by yylex, with out-of-bounds checking.  */
  619 #define YYTRANSLATE(YYX)                                                \
  620   (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  621 
  622 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  623    as returned by yylex.  */
  624 static const yytype_int8 yytranslate[] =
  625 {
  626        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  627       58,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  628        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  629        2,     2,     2,     2,     2,     2,    57,     2,     2,     2,
  630        2,     2,     2,    53,    50,    54,     2,     2,     2,     2,
  631        2,     2,     2,     2,     2,     2,     2,     2,    51,     2,
  632        2,    49,     2,     2,    52,     2,     2,     2,     2,     2,
  633        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  634        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  635        2,    55,     2,    56,     2,     2,     2,     2,     2,     2,
  636        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  637        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  638        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  639        2,     2,     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,     2,     2,     2,     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,     1,     2,     3,     4,
  652        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  653       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
  654       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  655       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
  656       45,    46,    47,    48
  657 };
  658 
  659 #if YYDEBUG
  660   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  661 static const yytype_int16 yyrline[] =
  662 {
  663        0,   109,   109,   110,   128,   129,   179,   186,   187,   188,
  664      189,   190,   194,   195,   196,   197,   201,   202,   203,   204,
  665      208,   209,   214,   218,   238,   245,   245,   252,   268,   282,
  666      283,   284,   285,   286,   287,   293,   305,   306,   307,   307,
  667      308,   308,   309,   310,   311,   312,   313,   313,   314,   315,
  668      315,   316,   316,   317,   317,   318,   319,   320,   325,   330,
  669      356,   366,   371,   383,   383,   391,   405,   418,   419,   425,
  670      426,   430,   431,   432,   433,   439,   440,   441,   446,   457,
  671      458,   463,   471,   488,   489,   490,   491,   492,   497,   498,
  672      498,   499,   500,   500,   501,   506,   507,   512,   513,   518,
  673      519,   523,   524,   528,   529,   544,   545,   550,   558,   559,
  674      560,   561,   565,   566,   570,   571,   572,   577,   578,   580,
  675      587,   588,   589,   590,   591,   592,   596,   609,   610,   611,
  676      615,   616,   617,   618,   622,   624,   626,   630,   645,   649,
  677      651,   656,   657,   666,   676,   678,   685,   698,   699,   705,
  678      706,   711,   717,   726,   728,   730,   738
  679 };
  680 #endif
  681 
  682 #if YYDEBUG || YYERROR_VERBOSE || 0
  683 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  684    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  685 static const char *const yytname[] =
  686 {
  687   "$end", "error", "$undefined", "D_BACKTRACE", "D_BREAK", "D_CLEAR",
  688   "D_CONTINUE", "D_DELETE", "D_DISABLE", "D_DOWN", "D_ENABLE", "D_FINISH",
  689   "D_FRAME", "D_HELP", "D_IGNORE", "D_INFO", "D_LIST", "D_NEXT", "D_NEXTI",
  690   "D_PRINT", "D_PRINTF", "D_QUIT", "D_RETURN", "D_RUN", "D_SET", "D_STEP",
  691   "D_STEPI", "D_TBREAK", "D_UP", "D_UNTIL", "D_DISPLAY", "D_UNDISPLAY",
  692   "D_WATCH", "D_UNWATCH", "D_DUMP", "D_TRACE", "D_INT", "D_STRING",
  693   "D_NODE", "D_VARIABLE", "D_OPTION", "D_COMMANDS", "D_END", "D_SILENT",
  694   "D_SOURCE", "D_SAVE", "D_EVAL", "D_CONDITION", "D_STATEMENT", "'='",
  695   "','", "':'", "'@'", "'+'", "'-'", "'['", "']'", "'$'", "'\\n'",
  696   "$accept", "input", "line", "control_cmd", "d_cmd", "frame_cmd",
  697   "break_cmd", "set_want_nodeval", "eval_prologue", "statement_list", "@1",
  698   "eval_cmd", "command", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8",
  699   "condition_exp", "commands_arg", "opt_param_list", "param_list",
  700   "opt_string_node", "string_node", "option_args", "func_name", "location",
  701   "break_args", "$@9", "$@10", "opt_variable", "opt_string", "opt_node",
  702   "help_args", "enable_args", "print_exp", "print_args", "printf_exp",
  703   "printf_args", "list_args", "integer_range", "opt_integer_list",
  704   "integer_list", "exp_list", "subscript", "subscript_list", "variable",
  705   "node", "opt_plus_integer", "opt_integer", "plus_integer", "integer",
  706   "nls", YY_NULLPTR
  707 };
  708 #endif
  709 
  710 # ifdef YYPRINT
  711 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  712    (internal) symbol number NUM (which must be that of a token).  */
  713 static const yytype_int16 yytoknum[] =
  714 {
  715        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
  716      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
  717      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
  718      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
  719      295,   296,   297,   298,   299,   300,   301,   302,   303,    61,
  720       44,    58,    64,    43,    45,    91,    93,    36,    10
  721 };
  722 # endif
  723 
  724 #define YYPACT_NINF (-151)
  725 
  726 #define yypact_value_is_default(Yyn) \
  727   ((Yyn) == YYPACT_NINF)
  728 
  729 #define YYTABLE_NINF (-148)
  730 
  731 #define yytable_value_is_error(Yyn) \
  732   0
  733 
  734   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  735      STATE-NUM.  */
  736 static const yytype_int16 yypact[] =
  737 {
  738     -151,   145,  -151,   -34,  -151,  -151,    50,  -151,  -151,  -151,
  739     -151,    10,  -151,  -151,   -10,    59,    -9,    43,  -151,  -151,
  740     -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,
  741       50,  -151,  -151,  -151,  -151,    -8,    -6,    14,    12,  -151,
  742     -151,    22,    23,  -151,    59,  -151,  -151,    59,    13,    36,
  743       64,  -151,  -151,   -34,  -151,  -151,  -151,    24,    47,  -151,
  744     -151,  -151,  -151,    13,  -151,  -151,  -151,    59,    48,  -151,
  745     -151,    80,  -151,    67,    47,  -151,  -151,  -151,  -151,    48,
  746        4,    19,    69,   -20,  -151,   -20,   -20,  -151,  -151,  -151,
  747       70,  -151,  -151,  -151,  -151,  -151,  -151,  -151,    16,  -151,
  748     -151,  -151,  -151,    84,    85,  -151,  -151,    73,  -151,  -151,
  749     -151,    40,  -151,    74,  -151,  -151,  -151,    48,    59,  -151,
  750       74,  -151,    71,    89,    91,  -151,    42,  -151,  -151,  -151,
  751     -151,    81,  -151,  -151,    92,    94,  -151,  -151,    86,  -151,
  752     -151,     6,    96,  -151,  -151,  -151,   -34,    75,  -151,     6,
  753     -151,  -151,    74,     6,  -151,  -151,  -151,  -151,  -151,  -151,
  754     -151,  -151,    48,    31,  -151,    71,    71,  -151,    52,  -151,
  755      -17,  -151,  -151,    69,  -151,  -151,  -151,  -151,  -151,  -151,
  756     -151,    95,  -151,  -151,  -151,  -151,   -34,  -151,    17,  -151,
  757     -151,    71,  -151,  -151,  -151,  -151,     6,  -151,  -151,    69,
  758     -151,  -151,  -151
  759 };
  760 
  761   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  762      Performed when YYTABLE does not specify something else to do.  Zero
  763      means the default is an error.  */
  764 static const yytype_uint8 yydefact[] =
  765 {
  766        2,     0,     1,     0,    18,    20,    83,     7,    15,    14,
  767       17,     0,    32,    19,   101,     0,     0,   117,     8,     9,
  768       38,    40,    30,    49,    31,    46,    10,    11,    21,    16,
  769       83,    51,    12,    53,    13,    97,     0,    79,     0,    60,
  770       61,     0,     0,    22,     0,   156,     3,   147,     0,   149,
  771       88,    24,    65,     0,     4,     6,   151,    82,     0,    85,
  772       44,    84,   129,     0,    37,   131,   103,   128,   130,   102,
  773       29,     0,    35,    82,   118,   119,   121,    42,   122,   120,
  774        0,     0,    99,     0,    43,    95,     0,    98,    56,    62,
  775       80,    48,    68,    59,    67,   148,    57,    58,     0,    63,
  776       33,    55,   153,     0,     0,    34,   150,    82,    91,    45,
  777       89,     0,     5,     0,   152,   104,   133,   132,     0,    36,
  778        0,   111,   141,     0,     0,   108,    39,   105,   116,   112,
  779      114,    41,   113,   144,     0,     0,    50,   100,     0,    52,
  780       96,     0,     0,    74,    78,    71,     0,    70,    28,     0,
  781      154,   155,     0,     0,    27,    25,    82,    87,    86,   126,
  782      124,   125,   123,     0,   139,   143,   106,   142,     0,   109,
  783        0,   145,   146,     0,    77,    54,    66,    76,    81,    23,
  784       72,     0,    64,    94,    92,    90,     0,   136,     0,   134,
  785      140,   107,   110,   115,    47,    73,     0,    26,   138,     0,
  786      137,    93,   135
  787 };
  788 
  789   /* YYPGOTO[NTERM-NUM].  */
  790 static const yytype_int16 yypgoto[] =
  791 {
  792     -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,
  793     -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,  -151,
  794     -119,  -151,  -151,  -151,  -151,    38,  -151,   -15,   108,  -151,
  795     -151,  -151,  -151,  -151,  -151,  -151,  -151,   -90,  -151,   -31,
  796     -151,  -151,   -14,   -25,  -151,  -151,  -150,   -26,   -77,  -147,
  797       97,  -151,    -5,  -151,    -3
  798 };
  799 
  800   /* YYDEFGOTO[NTERM-NUM].  */
  801 static const yytype_int16 yydefgoto[] =
  802 {
  803       -1,     1,    46,    47,    48,    49,    50,    98,    51,   111,
  804      186,    52,    53,    80,    81,    83,    82,    85,    86,   149,
  805      175,    93,   146,   147,   176,   177,    91,    59,    60,   109,
  806      153,   196,   139,    88,   136,    70,    64,   125,   126,   130,
  807      131,    77,    65,    66,    67,   188,   164,   165,   127,   137,
  808       94,   105,    68,   106,    54
  809 };
  810 
  811   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
  812      positive, shift that token.  If negative, reduce the rule whose
  813      number is the opposite.  If YYTABLE_NINF, syntax error.  */
  814 static const yytype_int16 yytable[] =
  815 {
  816       55,    61,    76,    78,   132,   121,   138,   174,   140,   141,
  817       71,    62,    79,    92,    62,   190,   189,   143,   198,   122,
  818      128,   129,   122,   101,    45,    61,   194,    69,    72,    87,
  819      182,    89,   187,    95,   185,   108,   169,   124,   115,    99,
  820      124,   190,    95,   122,   144,   110,    56,    63,    56,    56,
  821      112,    90,   202,   116,   144,   145,   123,   129,   122,    96,
  822       97,   124,   117,    58,   -75,    58,    58,   199,  -127,   133,
  823     -147,  -127,   102,   200,   -69,   113,   124,   201,   192,    56,
  824       73,   122,   154,   114,   134,   135,    56,    57,   155,   103,
  825      104,   122,   168,   132,   123,    56,    74,    75,   157,   124,
  826       56,   107,   118,    58,   123,   160,   161,   133,   158,   124,
  827       56,   156,    58,   159,   180,   162,   119,    58,   120,   142,
  828      150,   151,   134,   135,   152,   181,   163,    58,   166,   167,
  829      171,   170,   172,   178,   195,   173,   148,   183,    84,   193,
  830      191,     0,     0,   179,   100,     2,     3,   184,     4,     5,
  831        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  832       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  833       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  834       36,     0,     0,   197,     0,    37,    38,    39,    40,    41,
  835       42,    43,    44,     0,     0,     0,     0,     0,     0,     0,
  836        0,     0,     0,    45
  837 };
  838 
  839 static const yytype_int16 yycheck[] =
  840 {
  841        3,     6,    17,    17,    81,     1,    83,     1,    85,    86,
  842       15,     1,    17,     1,     1,   165,   163,     1,     1,    39,
  843        1,    38,    39,    48,    58,    30,   173,    37,    37,    37,
  844      149,    37,     1,    38,   153,    50,   126,    57,    63,    44,
  845       57,   191,    47,    39,    38,    50,    36,    37,    36,    36,
  846       53,    37,   199,    67,    38,    39,    52,    38,    39,    37,
  847       37,    57,    67,    53,    58,    53,    53,    50,    58,    38,
  848       58,    58,    36,    56,    58,    51,    57,   196,   168,    36,
  849       37,    39,    42,    36,    53,    54,    36,    37,    48,    53,
  850       54,    39,    50,   170,    52,    36,    53,    54,   113,    57,
  851       36,    37,    54,    53,    52,   120,   120,    38,   113,    57,
  852       36,    37,    53,   118,    39,   120,    36,    53,    51,    49,
  853       36,    36,    53,    54,    51,    50,    55,    53,    39,    38,
  854       38,    50,    38,    37,    39,    49,    98,   152,    30,   170,
  855      166,    -1,    -1,   146,    47,     0,     1,   152,     3,     4,
  856        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  857       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
  858       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  859       35,    -1,    -1,   186,    -1,    40,    41,    42,    43,    44,
  860       45,    46,    47,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  861       -1,    -1,    -1,    58
  862 };
  863 
  864   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  865      symbol of state STATE-NUM.  */
  866 static const yytype_int8 yystos[] =
  867 {
  868        0,    60,     0,     1,     3,     4,     5,     6,     7,     8,
  869        9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
  870       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
  871       29,    30,    31,    32,    33,    34,    35,    40,    41,    42,
  872       43,    44,    45,    46,    47,    58,    61,    62,    63,    64,
  873       65,    67,    70,    71,   113,   113,    36,    37,    53,    86,
  874       87,   111,     1,    37,    95,   101,   102,   103,   111,    37,
  875       94,   111,    37,    37,    53,    54,    86,   100,   101,   111,
  876       72,    73,    75,    74,    87,    76,    77,    37,    92,    37,
  877       37,    85,     1,    80,   109,   111,    37,    37,    66,   111,
  878      109,   102,    36,    53,    54,   110,   112,    37,    86,    88,
  879      111,    68,   113,    51,    36,   102,   101,   111,    54,    36,
  880       51,     1,    39,    52,    57,    96,    97,   107,     1,    38,
  881       98,    99,   107,    38,    53,    54,    93,   108,   107,    91,
  882      107,   107,    49,     1,    38,    39,    81,    82,    84,    78,
  883       36,    36,    51,    89,    42,    48,    37,    86,   111,   111,
  884       86,   101,   111,    55,   105,   106,    39,    38,    50,    96,
  885       50,    38,    38,    49,     1,    79,    83,    84,    37,   113,
  886       39,    50,    79,    86,   111,    79,    69,     1,   104,   108,
  887      105,   106,    96,    98,   108,    39,    90,   113,     1,    50,
  888       56,    79,   108
  889 };
  890 
  891   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  892 static const yytype_int8 yyr1[] =
  893 {
  894        0,    59,    60,    60,    61,    61,    61,    62,    62,    62,
  895       62,    62,    63,    63,    63,    63,    64,    64,    64,    64,
  896       65,    65,    66,    67,    68,    69,    68,    70,    70,    71,
  897       71,    71,    71,    71,    71,    71,    71,    71,    72,    71,
  898       73,    71,    71,    71,    71,    71,    74,    71,    71,    75,
  899       71,    76,    71,    77,    71,    71,    71,    71,    71,    71,
  900       71,    71,    71,    78,    71,    71,    79,    80,    80,    81,
  901       81,    82,    82,    82,    82,    83,    83,    83,    84,    85,
  902       85,    85,    86,    87,    87,    87,    87,    87,    88,    89,
  903       88,    88,    90,    88,    88,    91,    91,    92,    92,    93,
  904       93,    94,    94,    95,    95,    96,    96,    96,    97,    97,
  905       97,    97,    98,    98,    99,    99,    99,   100,   100,   100,
  906      100,   100,   100,   100,   100,   100,   101,   102,   102,   102,
  907      103,   103,   103,   103,   104,   104,   104,   105,   105,   106,
  908      106,   107,   107,   107,   108,   108,   108,   109,   109,   110,
  909      110,   111,   111,   112,   112,   112,   113
  910 };
  911 
  912   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
  913 static const yytype_int8 yyr2[] =
  914 {
  915        0,     2,     0,     2,     1,     2,     2,     1,     1,     1,
  916        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  917        1,     1,     0,     4,     0,     0,     4,     3,     3,     2,
  918        1,     1,     1,     2,     2,     2,     3,     2,     0,     3,
  919        0,     3,     2,     2,     2,     2,     0,     5,     2,     0,
  920        3,     0,     3,     0,     4,     2,     2,     2,     2,     2,
  921        1,     1,     2,     0,     4,     1,     1,     1,     1,     0,
  922        1,     1,     2,     3,     1,     0,     1,     1,     1,     0,
  923        1,     3,     1,     0,     1,     1,     3,     3,     0,     0,
  924        3,     1,     0,     5,     3,     0,     1,     0,     1,     0,
  925        1,     0,     1,     1,     2,     1,     2,     3,     1,     2,
  926        3,     1,     1,     1,     1,     3,     1,     0,     1,     1,
  927        1,     1,     1,     3,     3,     3,     3,     0,     1,     1,
  928        1,     1,     2,     2,     1,     3,     1,     3,     3,     1,
  929        2,     1,     2,     2,     1,     2,     2,     0,     1,     0,
  930        1,     1,     2,     1,     2,     2,     1
  931 };
  932 
  933 
  934 #define yyerrok         (yyerrstatus = 0)
  935 #define yyclearin       (yychar = YYEMPTY)
  936 #define YYEMPTY         (-2)
  937 #define YYEOF           0
  938 
  939 #define YYACCEPT        goto yyacceptlab
  940 #define YYABORT         goto yyabortlab
  941 #define YYERROR         goto yyerrorlab
  942 
  943 
  944 #define YYRECOVERING()  (!!yyerrstatus)
  945 
  946 #define YYBACKUP(Token, Value)                                    \
  947   do                                                              \
  948     if (yychar == YYEMPTY)                                        \
  949       {                                                           \
  950         yychar = (Token);                                         \
  951         yylval = (Value);                                         \
  952         YYPOPSTACK (yylen);                                       \
  953         yystate = *yyssp;                                         \
  954         goto yybackup;                                            \
  955       }                                                           \
  956     else                                                          \
  957       {                                                           \
  958         yyerror (YY_("syntax error: cannot back up")); \
  959         YYERROR;                                                  \
  960       }                                                           \
  961   while (0)
  962 
  963 /* Error token number */
  964 #define YYTERROR        1
  965 #define YYERRCODE       256
  966 
  967 
  968 
  969 /* Enable debugging if requested.  */
  970 #if YYDEBUG
  971 
  972 # ifndef YYFPRINTF
  973 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  974 #  define YYFPRINTF fprintf
  975 # endif
  976 
  977 # define YYDPRINTF(Args)                        \
  978 do {                                            \
  979   if (yydebug)                                  \
  980     YYFPRINTF Args;                             \
  981 } while (0)
  982 
  983 /* This macro is provided for backward compatibility. */
  984 #ifndef YY_LOCATION_PRINT
  985 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  986 #endif
  987 
  988 
  989 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
  990 do {                                                                      \
  991   if (yydebug)                                                            \
  992     {                                                                     \
  993       YYFPRINTF (stderr, "%s ", Title);                                   \
  994       yy_symbol_print (stderr,                                            \
  995                   Type, Value); \
  996       YYFPRINTF (stderr, "\n");                                           \
  997     }                                                                     \
  998 } while (0)
  999 
 1000 
 1001 /*-----------------------------------.
 1002 | Print this symbol's value on YYO.  |
 1003 `-----------------------------------*/
 1004 
 1005 static void
 1006 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
 1007 {
 1008   FILE *yyoutput = yyo;
 1009   YYUSE (yyoutput);
 1010   if (!yyvaluep)
 1011     return;
 1012 # ifdef YYPRINT
 1013   if (yytype < YYNTOKENS)
 1014     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
 1015 # endif
 1016   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1017   YYUSE (yytype);
 1018   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1019 }
 1020 
 1021 
 1022 /*---------------------------.
 1023 | Print this symbol on YYO.  |
 1024 `---------------------------*/
 1025 
 1026 static void
 1027 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
 1028 {
 1029   YYFPRINTF (yyo, "%s %s (",
 1030              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 1031 
 1032   yy_symbol_value_print (yyo, yytype, yyvaluep);
 1033   YYFPRINTF (yyo, ")");
 1034 }
 1035 
 1036 /*------------------------------------------------------------------.
 1037 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
 1038 | TOP (included).                                                   |
 1039 `------------------------------------------------------------------*/
 1040 
 1041 static void
 1042 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 1043 {
 1044   YYFPRINTF (stderr, "Stack now");
 1045   for (; yybottom <= yytop; yybottom++)
 1046     {
 1047       int yybot = *yybottom;
 1048       YYFPRINTF (stderr, " %d", yybot);
 1049     }
 1050   YYFPRINTF (stderr, "\n");
 1051 }
 1052 
 1053 # define YY_STACK_PRINT(Bottom, Top)                            \
 1054 do {                                                            \
 1055   if (yydebug)                                                  \
 1056     yy_stack_print ((Bottom), (Top));                           \
 1057 } while (0)
 1058 
 1059 
 1060 /*------------------------------------------------.
 1061 | Report that the YYRULE is going to be reduced.  |
 1062 `------------------------------------------------*/
 1063 
 1064 static void
 1065 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
 1066 {
 1067   int yylno = yyrline[yyrule];
 1068   int yynrhs = yyr2[yyrule];
 1069   int yyi;
 1070   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
 1071              yyrule - 1, yylno);
 1072   /* The symbols being reduced.  */
 1073   for (yyi = 0; yyi < yynrhs; yyi++)
 1074     {
 1075       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
 1076       yy_symbol_print (stderr,
 1077                        yystos[+yyssp[yyi + 1 - yynrhs]],
 1078                        &yyvsp[(yyi + 1) - (yynrhs)]
 1079                                               );
 1080       YYFPRINTF (stderr, "\n");
 1081     }
 1082 }
 1083 
 1084 # define YY_REDUCE_PRINT(Rule)          \
 1085 do {                                    \
 1086   if (yydebug)                          \
 1087     yy_reduce_print (yyssp, yyvsp, Rule); \
 1088 } while (0)
 1089 
 1090 /* Nonzero means print parse trace.  It is left uninitialized so that
 1091    multiple parsers can coexist.  */
 1092 int yydebug;
 1093 #else /* !YYDEBUG */
 1094 # define YYDPRINTF(Args)
 1095 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
 1096 # define YY_STACK_PRINT(Bottom, Top)
 1097 # define YY_REDUCE_PRINT(Rule)
 1098 #endif /* !YYDEBUG */
 1099 
 1100 
 1101 /* YYINITDEPTH -- initial size of the parser's stacks.  */
 1102 #ifndef YYINITDEPTH
 1103 # define YYINITDEPTH 200
 1104 #endif
 1105 
 1106 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 1107    if the built-in stack extension method is used).
 1108 
 1109    Do not make this value too large; the results are undefined if
 1110    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
 1111    evaluated with infinite-precision integer arithmetic.  */
 1112 
 1113 #ifndef YYMAXDEPTH
 1114 # define YYMAXDEPTH 10000
 1115 #endif
 1116 
 1117 
 1118 #if YYERROR_VERBOSE
 1119 
 1120 # ifndef yystrlen
 1121 #  if defined __GLIBC__ && defined _STRING_H
 1122 #   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
 1123 #  else
 1124 /* Return the length of YYSTR.  */
 1125 static YYPTRDIFF_T
 1126 yystrlen (const char *yystr)
 1127 {
 1128   YYPTRDIFF_T yylen;
 1129   for (yylen = 0; yystr[yylen]; yylen++)
 1130     continue;
 1131   return yylen;
 1132 }
 1133 #  endif
 1134 # endif
 1135 
 1136 # ifndef yystpcpy
 1137 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
 1138 #   define yystpcpy stpcpy
 1139 #  else
 1140 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 1141    YYDEST.  */
 1142 static char *
 1143 yystpcpy (char *yydest, const char *yysrc)
 1144 {
 1145   char *yyd = yydest;
 1146   const char *yys = yysrc;
 1147 
 1148   while ((*yyd++ = *yys++) != '\0')
 1149     continue;
 1150 
 1151   return yyd - 1;
 1152 }
 1153 #  endif
 1154 # endif
 1155 
 1156 # ifndef yytnamerr
 1157 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
 1158    quotes and backslashes, so that it's suitable for yyerror.  The
 1159    heuristic is that double-quoting is unnecessary unless the string
 1160    contains an apostrophe, a comma, or backslash (other than
 1161    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
 1162    null, do not copy; instead, return the length of what the result
 1163    would have been.  */
 1164 static YYPTRDIFF_T
 1165 yytnamerr (char *yyres, const char *yystr)
 1166 {
 1167   if (*yystr == '"')
 1168     {
 1169       YYPTRDIFF_T yyn = 0;
 1170       char const *yyp = yystr;
 1171 
 1172       for (;;)
 1173         switch (*++yyp)
 1174           {
 1175           case '\'':
 1176           case ',':
 1177             goto do_not_strip_quotes;
 1178 
 1179           case '\\':
 1180             if (*++yyp != '\\')
 1181               goto do_not_strip_quotes;
 1182             else
 1183               goto append;
 1184 
 1185           append:
 1186           default:
 1187             if (yyres)
 1188               yyres[yyn] = *yyp;
 1189             yyn++;
 1190             break;
 1191 
 1192           case '"':
 1193             if (yyres)
 1194               yyres[yyn] = '\0';
 1195             return yyn;
 1196           }
 1197     do_not_strip_quotes: ;
 1198     }
 1199 
 1200   if (yyres)
 1201     return yystpcpy (yyres, yystr) - yyres;
 1202   else
 1203     return yystrlen (yystr);
 1204 }
 1205 # endif
 1206 
 1207 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
 1208    about the unexpected token YYTOKEN for the state stack whose top is
 1209    YYSSP.
 1210 
 1211    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
 1212    not large enough to hold the message.  In that case, also set
 1213    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
 1214    required number of bytes is too large to store.  */
 1215 static int
 1216 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
 1217                 yy_state_t *yyssp, int yytoken)
 1218 {
 1219   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
 1220   /* Internationalized format string. */
 1221   const char *yyformat = YY_NULLPTR;
 1222   /* Arguments of yyformat: reported tokens (one for the "unexpected",
 1223      one per "expected"). */
 1224   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
 1225   /* Actual size of YYARG. */
 1226   int yycount = 0;
 1227   /* Cumulated lengths of YYARG.  */
 1228   YYPTRDIFF_T yysize = 0;
 1229 
 1230   /* There are many possibilities here to consider:
 1231      - If this state is a consistent state with a default action, then
 1232        the only way this function was invoked is if the default action
 1233        is an error action.  In that case, don't check for expected
 1234        tokens because there are none.
 1235      - The only way there can be no lookahead present (in yychar) is if
 1236        this state is a consistent state with a default action.  Thus,
 1237        detecting the absence of a lookahead is sufficient to determine
 1238        that there is no unexpected or expected token to report.  In that
 1239        case, just report a simple "syntax error".
 1240      - Don't assume there isn't a lookahead just because this state is a
 1241        consistent state with a default action.  There might have been a
 1242        previous inconsistent state, consistent state with a non-default
 1243        action, or user semantic action that manipulated yychar.
 1244      - Of course, the expected token list depends on states to have
 1245        correct lookahead information, and it depends on the parser not
 1246        to perform extra reductions after fetching a lookahead from the
 1247        scanner and before detecting a syntax error.  Thus, state merging
 1248        (from LALR or IELR) and default reductions corrupt the expected
 1249        token list.  However, the list is correct for canonical LR with
 1250        one exception: it will still contain any token that will not be
 1251        accepted due to an error action in a later state.
 1252   */
 1253   if (yytoken != YYEMPTY)
 1254     {
 1255       int yyn = yypact[+*yyssp];
 1256       YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
 1257       yysize = yysize0;
 1258       yyarg[yycount++] = yytname[yytoken];
 1259       if (!yypact_value_is_default (yyn))
 1260         {
 1261           /* Start YYX at -YYN if negative to avoid negative indexes in
 1262              YYCHECK.  In other words, skip the first -YYN actions for
 1263              this state because they are default actions.  */
 1264           int yyxbegin = yyn < 0 ? -yyn : 0;
 1265           /* Stay within bounds of both yycheck and yytname.  */
 1266           int yychecklim = YYLAST - yyn + 1;
 1267           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 1268           int yyx;
 1269 
 1270           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 1271             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
 1272                 && !yytable_value_is_error (yytable[yyx + yyn]))
 1273               {
 1274                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
 1275                   {
 1276                     yycount = 1;
 1277                     yysize = yysize0;
 1278                     break;
 1279                   }
 1280                 yyarg[yycount++] = yytname[yyx];
 1281                 {
 1282                   YYPTRDIFF_T yysize1
 1283                     = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
 1284                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
 1285                     yysize = yysize1;
 1286                   else
 1287                     return 2;
 1288                 }
 1289               }
 1290         }
 1291     }
 1292 
 1293   switch (yycount)
 1294     {
 1295 # define YYCASE_(N, S)                      \
 1296       case N:                               \
 1297         yyformat = S;                       \
 1298       break
 1299     default: /* Avoid compiler warnings. */
 1300       YYCASE_(0, YY_("syntax error"));
 1301       YYCASE_(1, YY_("syntax error, unexpected %s"));
 1302       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
 1303       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
 1304       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
 1305       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
 1306 # undef YYCASE_
 1307     }
 1308 
 1309   {
 1310     /* Don't count the "%s"s in the final size, but reserve room for
 1311        the terminator.  */
 1312     YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
 1313     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
 1314       yysize = yysize1;
 1315     else
 1316       return 2;
 1317   }
 1318 
 1319   if (*yymsg_alloc < yysize)
 1320     {
 1321       *yymsg_alloc = 2 * yysize;
 1322       if (! (yysize <= *yymsg_alloc
 1323              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
 1324         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
 1325       return 1;
 1326     }
 1327 
 1328   /* Avoid sprintf, as that infringes on the user's name space.
 1329      Don't have undefined behavior even if the translation
 1330      produced a string with the wrong number of "%s"s.  */
 1331   {
 1332     char *yyp = *yymsg;
 1333     int yyi = 0;
 1334     while ((*yyp = *yyformat) != '\0')
 1335       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
 1336         {
 1337           yyp += yytnamerr (yyp, yyarg[yyi++]);
 1338           yyformat += 2;
 1339         }
 1340       else
 1341         {
 1342           ++yyp;
 1343           ++yyformat;
 1344         }
 1345   }
 1346   return 0;
 1347 }
 1348 #endif /* YYERROR_VERBOSE */
 1349 
 1350 /*-----------------------------------------------.
 1351 | Release the memory associated to this symbol.  |
 1352 `-----------------------------------------------*/
 1353 
 1354 static void
 1355 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
 1356 {
 1357   YYUSE (yyvaluep);
 1358   if (!yymsg)
 1359     yymsg = "Deleting";
 1360   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 1361 
 1362   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1363   YYUSE (yytype);
 1364   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1365 }
 1366 
 1367 
 1368 
 1369 
 1370 /* The lookahead symbol.  */
 1371 int yychar;
 1372 
 1373 /* The semantic value of the lookahead symbol.  */
 1374 YYSTYPE yylval;
 1375 /* Number of syntax errors so far.  */
 1376 int yynerrs;
 1377 
 1378 
 1379 /*----------.
 1380 | yyparse.  |
 1381 `----------*/
 1382 
 1383 int
 1384 yyparse (void)
 1385 {
 1386     yy_state_fast_t yystate;
 1387     /* Number of tokens to shift before error messages enabled.  */
 1388     int yyerrstatus;
 1389 
 1390     /* The stacks and their tools:
 1391        'yyss': related to states.
 1392        'yyvs': related to semantic values.
 1393 
 1394        Refer to the stacks through separate pointers, to allow yyoverflow
 1395        to reallocate them elsewhere.  */
 1396 
 1397     /* The state stack.  */
 1398     yy_state_t yyssa[YYINITDEPTH];
 1399     yy_state_t *yyss;
 1400     yy_state_t *yyssp;
 1401 
 1402     /* The semantic value stack.  */
 1403     YYSTYPE yyvsa[YYINITDEPTH];
 1404     YYSTYPE *yyvs;
 1405     YYSTYPE *yyvsp;
 1406 
 1407     YYPTRDIFF_T yystacksize;
 1408 
 1409   int yyn;
 1410   int yyresult;
 1411   /* Lookahead token as an internal (translated) token number.  */
 1412   int yytoken = 0;
 1413   /* The variables used to return semantic value and location from the
 1414      action routines.  */
 1415   YYSTYPE yyval;
 1416 
 1417 #if YYERROR_VERBOSE
 1418   /* Buffer for error messages, and its allocated size.  */
 1419   char yymsgbuf[128];
 1420   char *yymsg = yymsgbuf;
 1421   YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
 1422 #endif
 1423 
 1424 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 1425 
 1426   /* The number of symbols on the RHS of the reduced rule.
 1427      Keep to zero when no symbol should be popped.  */
 1428   int yylen = 0;
 1429 
 1430   yyssp = yyss = yyssa;
 1431   yyvsp = yyvs = yyvsa;
 1432   yystacksize = YYINITDEPTH;
 1433 
 1434   YYDPRINTF ((stderr, "Starting parse\n"));
 1435 
 1436   yystate = 0;
 1437   yyerrstatus = 0;
 1438   yynerrs = 0;
 1439   yychar = YYEMPTY; /* Cause a token to be read.  */
 1440   goto yysetstate;
 1441 
 1442 
 1443 /*------------------------------------------------------------.
 1444 | yynewstate -- push a new state, which is found in yystate.  |
 1445 `------------------------------------------------------------*/
 1446 yynewstate:
 1447   /* In all cases, when you get here, the value and location stacks
 1448      have just been pushed.  So pushing a state here evens the stacks.  */
 1449   yyssp++;
 1450 
 1451 
 1452 /*--------------------------------------------------------------------.
 1453 | yysetstate -- set current state (the top of the stack) to yystate.  |
 1454 `--------------------------------------------------------------------*/
 1455 yysetstate:
 1456   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 1457   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
 1458   YY_IGNORE_USELESS_CAST_BEGIN
 1459   *yyssp = YY_CAST (yy_state_t, yystate);
 1460   YY_IGNORE_USELESS_CAST_END
 1461 
 1462   if (yyss + yystacksize - 1 <= yyssp)
 1463 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
 1464     goto yyexhaustedlab;
 1465 #else
 1466     {
 1467       /* Get the current used size of the three stacks, in elements.  */
 1468       YYPTRDIFF_T yysize = yyssp - yyss + 1;
 1469 
 1470 # if defined yyoverflow
 1471       {
 1472         /* Give user a chance to reallocate the stack.  Use copies of
 1473            these so that the &'s don't force the real ones into
 1474            memory.  */
 1475         yy_state_t *yyss1 = yyss;
 1476         YYSTYPE *yyvs1 = yyvs;
 1477 
 1478         /* Each stack pointer address is followed by the size of the
 1479            data in use in that stack, in bytes.  This used to be a
 1480            conditional around just the two extra args, but that might
 1481            be undefined if yyoverflow is a macro.  */
 1482         yyoverflow (YY_("memory exhausted"),
 1483                     &yyss1, yysize * YYSIZEOF (*yyssp),
 1484                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
 1485                     &yystacksize);
 1486         yyss = yyss1;
 1487         yyvs = yyvs1;
 1488       }
 1489 # else /* defined YYSTACK_RELOCATE */
 1490       /* Extend the stack our own way.  */
 1491       if (YYMAXDEPTH <= yystacksize)
 1492         goto yyexhaustedlab;
 1493       yystacksize *= 2;
 1494       if (YYMAXDEPTH < yystacksize)
 1495         yystacksize = YYMAXDEPTH;
 1496 
 1497       {
 1498         yy_state_t *yyss1 = yyss;
 1499         union yyalloc *yyptr =
 1500           YY_CAST (union yyalloc *,
 1501                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
 1502         if (! yyptr)
 1503           goto yyexhaustedlab;
 1504         YYSTACK_RELOCATE (yyss_alloc, yyss);
 1505         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 1506 # undef YYSTACK_RELOCATE
 1507         if (yyss1 != yyssa)
 1508           YYSTACK_FREE (yyss1);
 1509       }
 1510 # endif
 1511 
 1512       yyssp = yyss + yysize - 1;
 1513       yyvsp = yyvs + yysize - 1;
 1514 
 1515       YY_IGNORE_USELESS_CAST_BEGIN
 1516       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
 1517                   YY_CAST (long, yystacksize)));
 1518       YY_IGNORE_USELESS_CAST_END
 1519 
 1520       if (yyss + yystacksize - 1 <= yyssp)
 1521         YYABORT;
 1522     }
 1523 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 1524 
 1525   if (yystate == YYFINAL)
 1526     YYACCEPT;
 1527 
 1528   goto yybackup;
 1529 
 1530 
 1531 /*-----------.
 1532 | yybackup.  |
 1533 `-----------*/
 1534 yybackup:
 1535   /* Do appropriate processing given the current state.  Read a
 1536      lookahead token if we need one and don't already have one.  */
 1537 
 1538   /* First try to decide what to do without reference to lookahead token.  */
 1539   yyn = yypact[yystate];
 1540   if (yypact_value_is_default (yyn))
 1541     goto yydefault;
 1542 
 1543   /* Not known => get a lookahead token if don't already have one.  */
 1544 
 1545   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 1546   if (yychar == YYEMPTY)
 1547     {
 1548       YYDPRINTF ((stderr, "Reading a token: "));
 1549       yychar = yylex ();
 1550     }
 1551 
 1552   if (yychar <= YYEOF)
 1553     {
 1554       yychar = yytoken = YYEOF;
 1555       YYDPRINTF ((stderr, "Now at end of input.\n"));
 1556     }
 1557   else
 1558     {
 1559       yytoken = YYTRANSLATE (yychar);
 1560       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
 1561     }
 1562 
 1563   /* If the proper action on seeing token YYTOKEN is to reduce or to
 1564      detect an error, take that action.  */
 1565   yyn += yytoken;
 1566   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 1567     goto yydefault;
 1568   yyn = yytable[yyn];
 1569   if (yyn <= 0)
 1570     {
 1571       if (yytable_value_is_error (yyn))
 1572         goto yyerrlab;
 1573       yyn = -yyn;
 1574       goto yyreduce;
 1575     }
 1576 
 1577   /* Count tokens shifted since error; after three, turn off error
 1578      status.  */
 1579   if (yyerrstatus)
 1580     yyerrstatus--;
 1581 
 1582   /* Shift the lookahead token.  */
 1583   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 1584   yystate = yyn;
 1585   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1586   *++yyvsp = yylval;
 1587   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1588 
 1589   /* Discard the shifted token.  */
 1590   yychar = YYEMPTY;
 1591   goto yynewstate;
 1592 
 1593 
 1594 /*-----------------------------------------------------------.
 1595 | yydefault -- do the default action for the current state.  |
 1596 `-----------------------------------------------------------*/
 1597 yydefault:
 1598   yyn = yydefact[yystate];
 1599   if (yyn == 0)
 1600     goto yyerrlab;
 1601   goto yyreduce;
 1602 
 1603 
 1604 /*-----------------------------.
 1605 | yyreduce -- do a reduction.  |
 1606 `-----------------------------*/
 1607 yyreduce:
 1608   /* yyn is the number of a rule to reduce with.  */
 1609   yylen = yyr2[yyn];
 1610 
 1611   /* If YYLEN is nonzero, implement the default value of the action:
 1612      '$$ = $1'.
 1613 
 1614      Otherwise, the following line sets YYVAL to garbage.
 1615      This behavior is undocumented and Bison
 1616      users should not rely upon it.  Assigning to YYVAL
 1617      unconditionally makes the parser a bit smaller, and it avoids a
 1618      GCC warning that YYVAL may be used uninitialized.  */
 1619   yyval = yyvsp[1-yylen];
 1620 
 1621 
 1622   YY_REDUCE_PRINT (yyn);
 1623   switch (yyn)
 1624     {
 1625   case 3:
 1626 #line 111 "command.y"
 1627           {
 1628         cmd_idx = -1;
 1629         want_nodeval = false;
 1630         if (lexptr_begin != NULL) {
 1631             if (input_from_tty && lexptr_begin[0] != '\0')
 1632                 add_history(lexptr_begin);
 1633             efree(lexptr_begin);
 1634             lexptr_begin = NULL;
 1635         }
 1636         if (arg_list != NULL) {
 1637             free_cmdarg(arg_list);
 1638             arg_list = NULL;
 1639         }
 1640       }
 1641 #line 1642 "command.c"
 1642     break;
 1643 
 1644   case 5:
 1645 #line 130 "command.y"
 1646           {
 1647         if (dbg_errcount == 0 && cmd_idx >= 0) {
 1648             Func_cmd cmdfunc;
 1649             bool terminate = false;
 1650             CMDARG *args;
 1651             int ctype = 0;
 1652 
 1653             ctype = cmdtab[cmd_idx].type;
 1654 
 1655             /* a blank line repeats previous command
 1656              * (list, next, nexti, step, stepi and continue without arguments).
 1657              * save the index in the command table; used in yylex
 1658              */
 1659             if ((ctype == D_list
 1660                     || ctype == D_next
 1661                     || ctype == D_step
 1662                     || ctype == D_nexti
 1663                     || ctype == D_stepi
 1664                     || ctype == D_continue)
 1665                 && arg_list == NULL
 1666                 && ! in_commands
 1667                 && input_from_tty
 1668             )
 1669                 repeat_idx = cmd_idx;
 1670             else
 1671                 repeat_idx = -1;
 1672 
 1673             /* call the command handler; reset the globals arg_list, cmd_idx,
 1674              * since this handler could invoke yyparse again.
 1675              * call do_commands for the list of commands in `commands';
 1676              * arg_list isn't freed on return.
 1677              */
 1678 
 1679             cmdfunc = cmdtab[cmd_idx].cf_ptr;
 1680             if (in_commands)
 1681                 cmdfunc = do_commands;
 1682             cmd_idx = -1;
 1683             want_nodeval = false;
 1684 
 1685             args = arg_list;
 1686             arg_list = NULL;
 1687 
 1688             terminate = (*cmdfunc)(args, ctype);
 1689             if (! in_commands || ctype == D_commands)
 1690                 free_cmdarg(args);
 1691             if (terminate)
 1692                 YYACCEPT;
 1693         }
 1694       }
 1695 #line 1696 "command.c"
 1696     break;
 1697 
 1698   case 6:
 1699 #line 180 "command.y"
 1700           {
 1701         yyerrok;
 1702       }
 1703 #line 1704 "command.c"
 1704     break;
 1705 
 1706   case 22:
 1707 #line 214 "command.y"
 1708           { want_nodeval = true; }
 1709 #line 1710 "command.c"
 1710     break;
 1711 
 1712   case 23:
 1713 #line 219 "command.y"
 1714           {
 1715         if (dbg_errcount == 0) {
 1716             /* don't free arg_list; passed on to statement_list
 1717              * non-terminal (empty rule action). See below.
 1718              */
 1719             if (input_from_tty) {
 1720                 dbg_prompt = eval_prompt;
 1721                 fprintf(out_fp,
 1722         _("Type (g)awk statement(s). End with the command `end'\n"));
 1723                 rl_inhibit_completion = 1;
 1724             }
 1725             cmd_idx = -1;
 1726             in_eval = true;
 1727         }
 1728       }
 1729 #line 1730 "command.c"
 1730     break;
 1731 
 1732   case 24:
 1733 #line 238 "command.y"
 1734           {
 1735         yyval = append_statement(arg_list, (char *) start_EVAL);
 1736         if (read_a_line == read_commands_string)    /* unserializing 'eval' in 'commands' */
 1737             yyval->a_string[0] = '\0';
 1738         free_cmdarg(arg_list);
 1739         arg_list = NULL;
 1740       }
 1741 #line 1742 "command.c"
 1742     break;
 1743 
 1744   case 25:
 1745 #line 245 "command.y"
 1746                                      { yyval = append_statement(yyvsp[-1], lexptr_begin); }
 1747 #line 1748 "command.c"
 1748     break;
 1749 
 1750   case 26:
 1751 #line 246 "command.y"
 1752           {
 1753         yyval = yyvsp[-1];
 1754       }
 1755 #line 1756 "command.c"
 1756     break;
 1757 
 1758   case 27:
 1759 #line 253 "command.y"
 1760           {
 1761         arg_list = append_statement(yyvsp[-1], (char *) end_EVAL);
 1762         if (read_a_line == read_commands_string) {  /* unserializing 'eval' in 'commands' */
 1763             char *str = arg_list->a_string;
 1764             size_t len = strlen(str);
 1765             assert(len > 2 && str[len - 2] == '}');
 1766             str[len - 2] = '\0';
 1767         }
 1768         if (input_from_tty) {
 1769             dbg_prompt = in_commands ? commands_prompt : dgawk_prompt;
 1770             rl_inhibit_completion = 0;
 1771         }
 1772         cmd_idx = find_command("eval", 4);
 1773         in_eval = false;
 1774       }
 1775 #line 1776 "command.c"
 1776     break;
 1777 
 1778   case 28:
 1779 #line 269 "command.y"
 1780           {
 1781         NODE *n;
 1782         CMDARG *arg;
 1783         n = yyvsp[0]->a_node;
 1784         arg = append_statement(NULL, (char *) start_EVAL);
 1785         (void) append_statement(arg, n->stptr);
 1786         (void) append_statement(arg, (char *) end_EVAL);
 1787         free_cmdarg(arg_list);
 1788         arg_list = arg;
 1789       }
 1790 #line 1791 "command.c"
 1791     break;
 1792 
 1793   case 34:
 1794 #line 288 "command.y"
 1795           {
 1796         if (cmdtab[cmd_idx].class == D_FRAME
 1797                 && yyvsp[0] != NULL && yyvsp[0]->a_int < 0)
 1798             yyerror(_("invalid frame number: %d"), yyvsp[0]->a_int);
 1799       }
 1800 #line 1801 "command.c"
 1801     break;
 1802 
 1803   case 35:
 1804 #line 294 "command.y"
 1805           {
 1806         int idx = find_argument(yyvsp[0]);
 1807         if (idx < 0)
 1808             yyerror(_("info: invalid option - `%s'"), yyvsp[0]->a_string);
 1809         else {
 1810             efree(yyvsp[0]->a_string);
 1811             yyvsp[0]->a_string = NULL;
 1812             yyvsp[0]->type = D_argument;
 1813             yyvsp[0]->a_argument = argtab[idx].value;
 1814         }
 1815       }
 1816 #line 1817 "command.c"
 1817     break;
 1818 
 1819   case 38:
 1820 #line 307 "command.y"
 1821                   { want_nodeval = true; }
 1822 #line 1823 "command.c"
 1823     break;
 1824 
 1825   case 40:
 1826 #line 308 "command.y"
 1827                    { want_nodeval = true; }
 1828 #line 1829 "command.c"
 1829     break;
 1830 
 1831   case 46:
 1832 #line 313 "command.y"
 1833                 { want_nodeval = true; }
 1834 #line 1835 "command.c"
 1835     break;
 1836 
 1837   case 49:
 1838 #line 315 "command.y"
 1839                    { want_nodeval = true; }
 1840 #line 1841 "command.c"
 1841     break;
 1842 
 1843   case 51:
 1844 #line 316 "command.y"
 1845                     { want_nodeval = true; }
 1846 #line 1847 "command.c"
 1847     break;
 1848 
 1849   case 53:
 1850 #line 317 "command.y"
 1851                   { want_nodeval = true; }
 1852 #line 1853 "command.c"
 1853     break;
 1854 
 1855   case 57:
 1856 #line 321 "command.y"
 1857           {
 1858         if (in_cmd_src(yyvsp[0]->a_string))
 1859             yyerror(_("source: `%s': already sourced."), yyvsp[0]->a_string);
 1860       }
 1861 #line 1862 "command.c"
 1862     break;
 1863 
 1864   case 58:
 1865 #line 326 "command.y"
 1866           {
 1867         if (! input_from_tty)
 1868             yyerror(_("save: `%s': command not permitted."), yyvsp[0]->a_string);
 1869       }
 1870 #line 1871 "command.c"
 1871     break;
 1872 
 1873   case 59:
 1874 #line 331 "command.y"
 1875           {
 1876         int type = 0;
 1877         int num;
 1878 
 1879         if (yyvsp[0] != NULL)
 1880             num = yyvsp[0]->a_int;
 1881 
 1882         if (dbg_errcount != 0)
 1883             ;
 1884         else if (in_commands)
 1885             yyerror(_("cannot use command `commands' for breakpoint/watchpoint commands"));
 1886         else if (yyvsp[0] == NULL &&  ! (type = has_break_or_watch_point(&num, true)))
 1887             yyerror(_("no breakpoint/watchpoint has been set yet"));
 1888         else if (yyvsp[0] != NULL && ! (type = has_break_or_watch_point(&num, false)))
 1889             yyerror(_("invalid breakpoint/watchpoint number"));
 1890         if (type) {
 1891             in_commands = true;
 1892             if (input_from_tty) {
 1893                 dbg_prompt = commands_prompt;
 1894                 fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"),
 1895                                 (type == D_break) ? "breakpoint" : "watchpoint", num);
 1896                 fprintf(out_fp, _("End with the command `end'\n"));
 1897             }
 1898         }
 1899       }
 1900 #line 1901 "command.c"
 1901     break;
 1902 
 1903   case 60:
 1904 #line 357 "command.y"
 1905           {
 1906         if (! in_commands)
 1907             yyerror(_("`end' valid only in command `commands' or `eval'"));
 1908         else {
 1909             if (input_from_tty)
 1910                 dbg_prompt = dgawk_prompt;
 1911             in_commands = false;
 1912         }
 1913       }
 1914 #line 1915 "command.c"
 1915     break;
 1916 
 1917   case 61:
 1918 #line 367 "command.y"
 1919           {
 1920         if (! in_commands)
 1921             yyerror(_("`silent' valid only in command `commands'"));
 1922       }
 1923 #line 1924 "command.c"
 1924     break;
 1925 
 1926   case 62:
 1927 #line 372 "command.y"
 1928           {
 1929         int idx = find_argument(yyvsp[0]);
 1930         if (idx < 0)
 1931             yyerror(_("trace: invalid option - `%s'"), yyvsp[0]->a_string);
 1932         else {
 1933             efree(yyvsp[0]->a_string);
 1934             yyvsp[0]->a_string = NULL;
 1935             yyvsp[0]->type = D_argument;
 1936             yyvsp[0]->a_argument = argtab[idx].value;
 1937         }
 1938       }
 1939 #line 1940 "command.c"
 1940     break;
 1941 
 1942   case 63:
 1943 #line 383 "command.y"
 1944                                    { want_nodeval = true; }
 1945 #line 1946 "command.c"
 1946     break;
 1947 
 1948   case 64:
 1949 #line 384 "command.y"
 1950           {
 1951         int type;
 1952         int num = yyvsp[-2]->a_int;
 1953         type = has_break_or_watch_point(&num, false);
 1954         if (! type)
 1955             yyerror(_("condition: invalid breakpoint/watchpoint number"));
 1956       }
 1957 #line 1958 "command.c"
 1958     break;
 1959 
 1960   case 65:
 1961 #line 392 "command.y"
 1962           {
 1963         if (in_commands) {
 1964             /* Prepend command 'eval' to argument list */
 1965             CMDARG *arg;
 1966             arg = mk_cmdarg(D_string);
 1967             arg->a_string = estrdup("eval", 4);
 1968             arg->next = arg_list;
 1969             arg_list = arg;
 1970         }
 1971       }
 1972 #line 1973 "command.c"
 1973     break;
 1974 
 1975   case 66:
 1976 #line 406 "command.y"
 1977           {
 1978         if (yyvsp[0] != NULL) {
 1979             NODE *n = yyvsp[0]->a_node;
 1980             yyvsp[0]->type = D_string;
 1981             yyvsp[0]->a_string = n->stptr;
 1982             freenode(n);
 1983         }
 1984         yyval = yyvsp[0];
 1985       }
 1986 #line 1987 "command.c"
 1987     break;
 1988 
 1989   case 68:
 1990 #line 420 "command.y"
 1991           { yyval = NULL; }
 1992 #line 1993 "command.c"
 1993     break;
 1994 
 1995   case 69:
 1996 #line 425 "command.y"
 1997           { yyval = NULL; }
 1998 #line 1999 "command.c"
 1999     break;
 2000 
 2001   case 74:
 2002 #line 434 "command.y"
 2003           { yyval = NULL; }
 2004 #line 2005 "command.c"
 2005     break;
 2006 
 2007   case 75:
 2008 #line 439 "command.y"
 2009           { yyval = NULL; }
 2010 #line 2011 "command.c"
 2011     break;
 2012 
 2013   case 77:
 2014 #line 442 "command.y"
 2015           { yyval = NULL; }
 2016 #line 2017 "command.c"
 2017     break;
 2018 
 2019   case 78:
 2020 #line 447 "command.y"
 2021           {
 2022         NODE *n;
 2023         n = yyvsp[0]->a_node;
 2024         if ((n->flags & STRING) == 0)
 2025             yyerror(_("argument not a string"));
 2026       }
 2027 #line 2028 "command.c"
 2028     break;
 2029 
 2030   case 79:
 2031 #line 457 "command.y"
 2032           { yyval = NULL; }
 2033 #line 2034 "command.c"
 2034     break;
 2035 
 2036   case 80:
 2037 #line 459 "command.y"
 2038           {
 2039         if (find_option(yyvsp[0]->a_string) < 0)
 2040             yyerror(_("option: invalid parameter - `%s'"), yyvsp[0]->a_string);
 2041       }
 2042 #line 2043 "command.c"
 2043     break;
 2044 
 2045   case 81:
 2046 #line 464 "command.y"
 2047           {
 2048         if (find_option(yyvsp[-2]->a_string) < 0)
 2049             yyerror(_("option: invalid parameter - `%s'"), yyvsp[-2]->a_string);
 2050       }
 2051 #line 2052 "command.c"
 2052     break;
 2053 
 2054   case 82:
 2055 #line 472 "command.y"
 2056           {
 2057         NODE *n;
 2058         n = lookup(yyvsp[0]->a_string);
 2059         if (n == NULL || n->type != Node_func)
 2060             yyerror(_("no such function - `%s'"), yyvsp[0]->a_string);
 2061         else {
 2062             yyvsp[0]->type = D_func;
 2063             efree(yyvsp[0]->a_string);
 2064             yyvsp[0]->a_string = NULL;
 2065             yyvsp[0]->a_node = n;
 2066         }
 2067       }
 2068 #line 2069 "command.c"
 2069     break;
 2070 
 2071   case 83:
 2072 #line 488 "command.y"
 2073           { yyval = NULL; }
 2074 #line 2075 "command.c"
 2075     break;
 2076 
 2077   case 88:
 2078 #line 497 "command.y"
 2079           { yyval = NULL; }
 2080 #line 2081 "command.c"
 2081     break;
 2082 
 2083   case 89:
 2084 #line 498 "command.y"
 2085                        { want_nodeval = true; }
 2086 #line 2087 "command.c"
 2087     break;
 2088 
 2089   case 92:
 2090 #line 500 "command.y"
 2091                                     { want_nodeval = true; }
 2092 #line 2093 "command.c"
 2093     break;
 2094 
 2095   case 95:
 2096 #line 506 "command.y"
 2097           { yyval = NULL; }
 2098 #line 2099 "command.c"
 2099     break;
 2100 
 2101   case 97:
 2102 #line 512 "command.y"
 2103           { yyval = NULL; }
 2104 #line 2105 "command.c"
 2105     break;
 2106 
 2107   case 99:
 2108 #line 518 "command.y"
 2109           { yyval = NULL; }
 2110 #line 2111 "command.c"
 2111     break;
 2112 
 2113   case 104:
 2114 #line 530 "command.y"
 2115           {
 2116         int idx = find_argument(yyvsp[-1]);
 2117         if (idx < 0)
 2118             yyerror(_("enable: invalid option - `%s'"), yyvsp[-1]->a_string);
 2119         else {
 2120             efree(yyvsp[-1]->a_string);
 2121             yyvsp[-1]->a_string = NULL;
 2122             yyvsp[-1]->type = D_argument;
 2123             yyvsp[-1]->a_argument = argtab[idx].value;
 2124         }
 2125       }
 2126 #line 2127 "command.c"
 2127     break;
 2128 
 2129   case 106:
 2130 #line 546 "command.y"
 2131           {
 2132         yyvsp[0]->type = D_array;   /* dump all items */
 2133         yyvsp[0]->a_count = 0;
 2134       }
 2135 #line 2136 "command.c"
 2136     break;
 2137 
 2138   case 107:
 2139 #line 551 "command.y"
 2140           {
 2141         yyvsp[-1]->type = D_array;
 2142         yyvsp[-1]->a_count = num_dim;
 2143       }
 2144 #line 2145 "command.c"
 2145     break;
 2146 
 2147   case 117:
 2148 #line 577 "command.y"
 2149           { yyval = NULL; }
 2150 #line 2151 "command.c"
 2151     break;
 2152 
 2153   case 118:
 2154 #line 579 "command.y"
 2155           { yyval = NULL; }
 2156 #line 2157 "command.c"
 2157     break;
 2158 
 2159   case 119:
 2160 #line 581 "command.y"
 2161           {
 2162         CMDARG *a;
 2163         a = mk_cmdarg(D_int);
 2164         a->a_int = -1;
 2165         append_cmdarg(a);
 2166       }
 2167 #line 2168 "command.c"
 2168     break;
 2169 
 2170   case 126:
 2171 #line 597 "command.y"
 2172           {
 2173         if (yyvsp[-2]->a_int > yyvsp[0]->a_int)
 2174             yyerror(_("invalid range specification: %d - %d"),
 2175                 yyvsp[-2]->a_int, yyvsp[0]->a_int);
 2176         else
 2177             yyvsp[-2]->type = D_range;
 2178         yyval = yyvsp[-2];
 2179       }
 2180 #line 2181 "command.c"
 2181     break;
 2182 
 2183   case 127:
 2184 #line 609 "command.y"
 2185           { yyval = NULL; }
 2186 #line 2187 "command.c"
 2187     break;
 2188 
 2189   case 134:
 2190 #line 623 "command.y"
 2191           { yyval = yyvsp[0]; }
 2192 #line 2193 "command.c"
 2193     break;
 2194 
 2195   case 135:
 2196 #line 625 "command.y"
 2197           { yyval = yyvsp[-2]; }
 2198 #line 2199 "command.c"
 2199     break;
 2200 
 2201   case 137:
 2202 #line 631 "command.y"
 2203           {
 2204         CMDARG *a;
 2205         NODE *subs;
 2206         int count = 0;
 2207 
 2208         for (a = yyvsp[-1]; a != NULL; a = a->next)
 2209             count++;
 2210         subs = concat_args(yyvsp[-1], count);
 2211         free_cmdarg(yyvsp[-1]->next);
 2212         yyvsp[-1]->next = NULL;
 2213         yyvsp[-1]->type = D_node;
 2214         yyvsp[-1]->a_node = subs;
 2215         yyval = yyvsp[-1];
 2216       }
 2217 #line 2218 "command.c"
 2218     break;
 2219 
 2220   case 139:
 2221 #line 650 "command.y"
 2222           { yyval = yyvsp[0]; num_dim = 1; }
 2223 #line 2224 "command.c"
 2224     break;
 2225 
 2226   case 140:
 2227 #line 652 "command.y"
 2228           { yyval = yyvsp[-1]; num_dim++; }
 2229 #line 2230 "command.c"
 2230     break;
 2231 
 2232   case 142:
 2233 #line 658 "command.y"
 2234           {
 2235         NODE *n = yyvsp[0]->a_node;
 2236         if ((n->flags & NUMBER) == 0)
 2237             yyerror(_("non-numeric value for field number"));
 2238         else
 2239             yyvsp[0]->type = D_field;
 2240         yyval = yyvsp[0];
 2241       }
 2242 #line 2243 "command.c"
 2243     break;
 2244 
 2245   case 143:
 2246 #line 667 "command.y"
 2247           {
 2248         /* a_string is array name, a_count is dimension count */
 2249         yyvsp[-1]->type = D_subscript;
 2250         yyvsp[-1]->a_count = num_dim;
 2251         yyval = yyvsp[-1];
 2252       }
 2253 #line 2254 "command.c"
 2254     break;
 2255 
 2256   case 144:
 2257 #line 677 "command.y"
 2258           { yyval = yyvsp[0]; }
 2259 #line 2260 "command.c"
 2260     break;
 2261 
 2262   case 145:
 2263 #line 679 "command.y"
 2264           {
 2265         NODE *n = yyvsp[0]->a_node;
 2266         if ((n->flags & NUMBER) == 0)
 2267             yyerror(_("non-numeric value found, numeric expected"));
 2268         yyval = yyvsp[0];
 2269       }
 2270 #line 2271 "command.c"
 2271     break;
 2272 
 2273   case 146:
 2274 #line 686 "command.y"
 2275           {
 2276         NODE *n = yyvsp[0]->a_node;
 2277         if ((n->flags & NUMBER) == 0)
 2278             yyerror(_("non-numeric value found, numeric expected"));
 2279         else
 2280             negate_num(n);
 2281         yyval = yyvsp[0];
 2282       }
 2283 #line 2284 "command.c"
 2284     break;
 2285 
 2286   case 147:
 2287 #line 698 "command.y"
 2288           { yyval = NULL; }
 2289 #line 2290 "command.c"
 2290     break;
 2291 
 2292   case 148:
 2293 #line 700 "command.y"
 2294           { yyval = yyvsp[0]; }
 2295 #line 2296 "command.c"
 2296     break;
 2297 
 2298   case 149:
 2299 #line 705 "command.y"
 2300           { yyval = NULL; }
 2301 #line 2302 "command.c"
 2302     break;
 2303 
 2304   case 150:
 2305 #line 707 "command.y"
 2306           { yyval = yyvsp[0]; }
 2307 #line 2308 "command.c"
 2308     break;
 2309 
 2310   case 151:
 2311 #line 712 "command.y"
 2312           {
 2313         if (yyvsp[0]->a_int == 0)
 2314             yyerror(_("non-zero integer value"));
 2315         yyval = yyvsp[0];
 2316       }
 2317 #line 2318 "command.c"
 2318     break;
 2319 
 2320   case 152:
 2321 #line 718 "command.y"
 2322           {
 2323         if (yyvsp[0]->a_int == 0)
 2324             yyerror(_("non-zero integer value"));
 2325         yyval = yyvsp[0];
 2326       }
 2327 #line 2328 "command.c"
 2328     break;
 2329 
 2330   case 153:
 2331 #line 727 "command.y"
 2332           { yyval = yyvsp[0]; }
 2333 #line 2334 "command.c"
 2334     break;
 2335 
 2336   case 154:
 2337 #line 729 "command.y"
 2338           { yyval = yyvsp[0]; }
 2339 #line 2340 "command.c"
 2340     break;
 2341 
 2342   case 155:
 2343 #line 731 "command.y"
 2344           {
 2345         yyvsp[0]->a_int = - yyvsp[0]->a_int;
 2346         yyval = yyvsp[0];
 2347       }
 2348 #line 2349 "command.c"
 2349     break;
 2350 
 2351   case 156:
 2352 #line 739 "command.y"
 2353           {
 2354         if (lexptr_begin != NULL) {
 2355             if (input_from_tty && lexptr_begin[0] != '\0')
 2356                 add_history(lexptr_begin);
 2357             efree(lexptr_begin);
 2358             lexptr_begin = NULL;
 2359         }
 2360       }
 2361 #line 2362 "command.c"
 2362     break;
 2363 
 2364 
 2365 #line 2366 "command.c"
 2366 
 2367       default: break;
 2368     }
 2369   /* User semantic actions sometimes alter yychar, and that requires
 2370      that yytoken be updated with the new translation.  We take the
 2371      approach of translating immediately before every use of yytoken.
 2372      One alternative is translating here after every semantic action,
 2373      but that translation would be missed if the semantic action invokes
 2374      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
 2375      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
 2376      incorrect destructor might then be invoked immediately.  In the
 2377      case of YYERROR or YYBACKUP, subsequent parser actions might lead
 2378      to an incorrect destructor call or verbose syntax error message
 2379      before the lookahead is translated.  */
 2380   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 2381 
 2382   YYPOPSTACK (yylen);
 2383   yylen = 0;
 2384   YY_STACK_PRINT (yyss, yyssp);
 2385 
 2386   *++yyvsp = yyval;
 2387 
 2388   /* Now 'shift' the result of the reduction.  Determine what state
 2389      that goes to, based on the state we popped back to and the rule
 2390      number reduced by.  */
 2391   {
 2392     const int yylhs = yyr1[yyn] - YYNTOKENS;
 2393     const int yyi = yypgoto[yylhs] + *yyssp;
 2394     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
 2395                ? yytable[yyi]
 2396                : yydefgoto[yylhs]);
 2397   }
 2398 
 2399   goto yynewstate;
 2400 
 2401 
 2402 /*--------------------------------------.
 2403 | yyerrlab -- here on detecting error.  |
 2404 `--------------------------------------*/
 2405 yyerrlab:
 2406   /* Make sure we have latest lookahead translation.  See comments at
 2407      user semantic actions for why this is necessary.  */
 2408   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
 2409 
 2410   /* If not already recovering from an error, report this error.  */
 2411   if (!yyerrstatus)
 2412     {
 2413       ++yynerrs;
 2414 #if ! YYERROR_VERBOSE
 2415       yyerror (YY_("syntax error"));
 2416 #else
 2417 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
 2418                                         yyssp, yytoken)
 2419       {
 2420         char const *yymsgp = YY_("syntax error");
 2421         int yysyntax_error_status;
 2422         yysyntax_error_status = YYSYNTAX_ERROR;
 2423         if (yysyntax_error_status == 0)
 2424           yymsgp = yymsg;
 2425         else if (yysyntax_error_status == 1)
 2426           {
 2427             if (yymsg != yymsgbuf)
 2428               YYSTACK_FREE (yymsg);
 2429             yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
 2430             if (!yymsg)
 2431               {
 2432                 yymsg = yymsgbuf;
 2433                 yymsg_alloc = sizeof yymsgbuf;
 2434                 yysyntax_error_status = 2;
 2435               }
 2436             else
 2437               {
 2438                 yysyntax_error_status = YYSYNTAX_ERROR;
 2439                 yymsgp = yymsg;
 2440               }
 2441           }
 2442         yyerror (yymsgp);
 2443         if (yysyntax_error_status == 2)
 2444           goto yyexhaustedlab;
 2445       }
 2446 # undef YYSYNTAX_ERROR
 2447 #endif
 2448     }
 2449 
 2450 
 2451 
 2452   if (yyerrstatus == 3)
 2453     {
 2454       /* If just tried and failed to reuse lookahead token after an
 2455          error, discard it.  */
 2456 
 2457       if (yychar <= YYEOF)
 2458         {
 2459           /* Return failure if at end of input.  */
 2460           if (yychar == YYEOF)
 2461             YYABORT;
 2462         }
 2463       else
 2464         {
 2465           yydestruct ("Error: discarding",
 2466                       yytoken, &yylval);
 2467           yychar = YYEMPTY;
 2468         }
 2469     }
 2470 
 2471   /* Else will try to reuse lookahead token after shifting the error
 2472      token.  */
 2473   goto yyerrlab1;
 2474 
 2475 
 2476 /*---------------------------------------------------.
 2477 | yyerrorlab -- error raised explicitly by YYERROR.  |
 2478 `---------------------------------------------------*/
 2479 yyerrorlab:
 2480   /* Pacify compilers when the user code never invokes YYERROR and the
 2481      label yyerrorlab therefore never appears in user code.  */
 2482   if (0)
 2483     YYERROR;
 2484 
 2485   /* Do not reclaim the symbols of the rule whose action triggered
 2486      this YYERROR.  */
 2487   YYPOPSTACK (yylen);
 2488   yylen = 0;
 2489   YY_STACK_PRINT (yyss, yyssp);
 2490   yystate = *yyssp;
 2491   goto yyerrlab1;
 2492 
 2493 
 2494 /*-------------------------------------------------------------.
 2495 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 2496 `-------------------------------------------------------------*/
 2497 yyerrlab1:
 2498   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 2499 
 2500   for (;;)
 2501     {
 2502       yyn = yypact[yystate];
 2503       if (!yypact_value_is_default (yyn))
 2504         {
 2505           yyn += YYTERROR;
 2506           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 2507             {
 2508               yyn = yytable[yyn];
 2509               if (0 < yyn)
 2510                 break;
 2511             }
 2512         }
 2513 
 2514       /* Pop the current state because it cannot handle the error token.  */
 2515       if (yyssp == yyss)
 2516         YYABORT;
 2517 
 2518 
 2519       yydestruct ("Error: popping",
 2520                   yystos[yystate], yyvsp);
 2521       YYPOPSTACK (1);
 2522       yystate = *yyssp;
 2523       YY_STACK_PRINT (yyss, yyssp);
 2524     }
 2525 
 2526   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 2527   *++yyvsp = yylval;
 2528   YY_IGNORE_MAYBE_UNINITIALIZED_END
 2529 
 2530 
 2531   /* Shift the error token.  */
 2532   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
 2533 
 2534   yystate = yyn;
 2535   goto yynewstate;
 2536 
 2537 
 2538 /*-------------------------------------.
 2539 | yyacceptlab -- YYACCEPT comes here.  |
 2540 `-------------------------------------*/
 2541 yyacceptlab:
 2542   yyresult = 0;
 2543   goto yyreturn;
 2544 
 2545 
 2546 /*-----------------------------------.
 2547 | yyabortlab -- YYABORT comes here.  |
 2548 `-----------------------------------*/
 2549 yyabortlab:
 2550   yyresult = 1;
 2551   goto yyreturn;
 2552 
 2553 
 2554 #if !defined yyoverflow || YYERROR_VERBOSE
 2555 /*-------------------------------------------------.
 2556 | yyexhaustedlab -- memory exhaustion comes here.  |
 2557 `-------------------------------------------------*/
 2558 yyexhaustedlab:
 2559   yyerror (YY_("memory exhausted"));
 2560   yyresult = 2;
 2561   /* Fall through.  */
 2562 #endif
 2563 
 2564 
 2565 /*-----------------------------------------------------.
 2566 | yyreturn -- parsing is finished, return the result.  |
 2567 `-----------------------------------------------------*/
 2568 yyreturn:
 2569   if (yychar != YYEMPTY)
 2570     {
 2571       /* Make sure we have latest lookahead translation.  See comments at
 2572          user semantic actions for why this is necessary.  */
 2573       yytoken = YYTRANSLATE (yychar);
 2574       yydestruct ("Cleanup: discarding lookahead",
 2575                   yytoken, &yylval);
 2576     }
 2577   /* Do not reclaim the symbols of the rule whose action triggered
 2578      this YYABORT or YYACCEPT.  */
 2579   YYPOPSTACK (yylen);
 2580   YY_STACK_PRINT (yyss, yyssp);
 2581   while (yyssp != yyss)
 2582     {
 2583       yydestruct ("Cleanup: popping",
 2584                   yystos[+*yyssp], yyvsp);
 2585       YYPOPSTACK (1);
 2586     }
 2587 #ifndef yyoverflow
 2588   if (yyss != yyssa)
 2589     YYSTACK_FREE (yyss);
 2590 #endif
 2591 #if YYERROR_VERBOSE
 2592   if (yymsg != yymsgbuf)
 2593     YYSTACK_FREE (yymsg);
 2594 #endif
 2595   return yyresult;
 2596 }
 2597 #line 749 "command.y"
 2598 
 2599 
 2600 
 2601 /* append_statement --- append 'stmt' to the list of eval awk statements */
 2602 
 2603 static CMDARG *
 2604 append_statement(CMDARG *stmt_list, char *stmt)
 2605 {
 2606     CMDARG *a, *arg;
 2607     char *s;
 2608     int len, slen, ssize;
 2609 
 2610 #define EVALSIZE    512
 2611 
 2612     if (stmt == start_EVAL) {
 2613         len = sizeof(start_EVAL);
 2614         for (a = stmt_list; a != NULL; a = a->next)
 2615             len += strlen(a->a_string) + 1; /* 1 for ',' */
 2616         len += EVALSIZE;
 2617 
 2618         emalloc(s, char *, (len + 1) * sizeof(char), "append_statement");
 2619         arg = mk_cmdarg(D_string);
 2620         arg->a_string = s;
 2621         arg->a_count = len; /* kludge */
 2622 
 2623         slen = sizeof("function @eval(") - 1;
 2624         memcpy(s, start_EVAL, slen);
 2625 
 2626         for (a = stmt_list; a != NULL; a = a->next) {
 2627             len = strlen(a->a_string);
 2628             memcpy(s + slen, a->a_string, len);
 2629             slen += len;
 2630             if (a->next != NULL)
 2631                 s[slen++] = ',';
 2632         }
 2633         s[slen++] = ')';
 2634         s[slen++] = '{';
 2635         s[slen] = '\0';
 2636         return arg;
 2637     }
 2638 
 2639     len = strlen(stmt) + 1; /* 1 for newline */
 2640     s = stmt_list->a_string;
 2641     slen = strlen(s);
 2642     ssize = stmt_list->a_count;
 2643     if (len > ssize - slen) {
 2644         ssize = slen + len + EVALSIZE;
 2645         erealloc(s, char *, (ssize + 1) * sizeof(char), "append_statement");
 2646         stmt_list->a_string = s;
 2647         stmt_list->a_count = ssize;
 2648     }
 2649     memcpy(s + slen, stmt, len);
 2650     slen += len;
 2651     if (slen >= 2 && s[slen - 2] != '\n') {
 2652         s[slen - 1] = '\n';
 2653         s[slen] = '\0';
 2654     }
 2655 
 2656     if (stmt == end_EVAL)
 2657         erealloc(stmt_list->a_string, char *, slen + 1, "append_statement");
 2658     return stmt_list;
 2659 
 2660 #undef EVALSIZE
 2661 }
 2662 
 2663 
 2664 /* command names sorted in ascending order */
 2665 
 2666 struct cmdtoken cmdtab[] = {
 2667 { "backtrace", "bt", D_backtrace, D_BACKTRACE, do_backtrace,
 2668     gettext_noop("backtrace [N] - print trace of all or N innermost (outermost if N < 0) frames.") },
 2669 { "break", "b", D_break, D_BREAK, do_breakpoint,
 2670     gettext_noop("break [[filename:]N|function] - set breakpoint at the specified location.") },
 2671 { "clear", "", D_clear, D_CLEAR, do_clear,
 2672     gettext_noop("clear [[filename:]N|function] - delete breakpoints previously set.") },
 2673 { "commands", "", D_commands, D_COMMANDS, do_commands,
 2674     gettext_noop("commands [num] - starts a list of commands to be executed at a breakpoint(watchpoint) hit.") },
 2675 { "condition", "", D_condition, D_CONDITION, do_condition,
 2676     gettext_noop("condition num [expr] - set or clear breakpoint or watchpoint condition.") },
 2677 { "continue", "c", D_continue, D_CONTINUE, do_continue,
 2678     gettext_noop("continue [COUNT] - continue program being debugged.") },
 2679 { "delete", "d", D_delete, D_DELETE, do_delete_breakpoint,
 2680     gettext_noop("delete [breakpoints] [range] - delete specified breakpoints.") },
 2681 { "disable", "", D_disable, D_DISABLE, do_disable_breakpoint,
 2682     gettext_noop("disable [breakpoints] [range] - disable specified breakpoints.") },
 2683 { "display", "", D_display, D_DISPLAY, do_display,
 2684     gettext_noop("display [var] - print value of variable each time the program stops.") },
 2685 { "down", "", D_down, D_DOWN, do_down,
 2686     gettext_noop("down [N] - move N frames down the stack.") },
 2687 { "dump", "", D_dump, D_DUMP, do_dump_instructions,
 2688     gettext_noop("dump [filename] - dump instructions to file or stdout.") },
 2689 { "enable", "e", D_enable, D_ENABLE, do_enable_breakpoint,
 2690     gettext_noop("enable [once|del] [breakpoints] [range] - enable specified breakpoints.") },
 2691 { "end", "", D_end, D_END, do_commands,
 2692     gettext_noop("end - end a list of commands or awk statements.") },
 2693 { "eval", "", D_eval, D_EVAL, do_eval,
 2694     gettext_noop("eval stmt|[p1, p2, ...] - evaluate awk statement(s).") },
 2695 { "exit", "", D_quit, D_QUIT, do_quit,
 2696     gettext_noop("exit - (same as quit) exit debugger.") },
 2697 { "finish", "", D_finish, D_FINISH, do_finish,
 2698     gettext_noop("finish - execute until selected stack frame returns.") },
 2699 { "frame", "f", D_frame, D_FRAME, do_frame,
 2700     gettext_noop("frame [N] - select and print stack frame number N.") },
 2701 { "help", "h", D_help, D_HELP, do_help,
 2702     gettext_noop("help [command] - print list of commands or explanation of command.") },
 2703 { "ignore", "", D_ignore, D_IGNORE, do_ignore_breakpoint,
 2704     gettext_noop("ignore N COUNT - set ignore-count of breakpoint number N to COUNT.") },
 2705 { "info", "i", D_info, D_INFO, do_info,
 2706     gettext_noop("info topic - source|sources|variables|functions|break|frame|args|locals|display|watch.") },
 2707 { "list", "l", D_list, D_LIST, do_list,
 2708     gettext_noop("list [-|+|[filename:]lineno|function|range] - list specified line(s).") },
 2709 { "next", "n", D_next, D_NEXT, do_next,
 2710     gettext_noop("next [COUNT] - step program, proceeding through subroutine calls.") },
 2711 { "nexti", "ni", D_nexti, D_NEXTI, do_nexti,
 2712     gettext_noop("nexti [COUNT] - step one instruction, but proceed through subroutine calls.") },
 2713 { "option", "o", D_option, D_OPTION, do_option,
 2714     gettext_noop("option [name[=value]] - set or display debugger option(s).") },
 2715 { "print", "p", D_print, D_PRINT, do_print_var,
 2716     gettext_noop("print var [var] - print value of a variable or array.") },
 2717 { "printf", "", D_printf, D_PRINTF, do_print_f,
 2718     gettext_noop("printf format, [arg], ... - formatted output.") },
 2719 { "quit", "q", D_quit, D_QUIT, do_quit,
 2720     gettext_noop("quit - exit debugger.") },
 2721 { "return", "", D_return, D_RETURN, do_return,
 2722     gettext_noop("return [value] - make selected stack frame return to its caller.") },
 2723 { "run", "r", D_run, D_RUN, do_run,
 2724     gettext_noop("run - start or restart executing program.") },
 2725 #ifdef HAVE_LIBREADLINE
 2726 { "save", "", D_save, D_SAVE, do_save,
 2727     gettext_noop("save filename - save commands from the session to file.") },
 2728 #endif
 2729 { "set", "", D_set, D_SET, do_set_var,
 2730     gettext_noop("set var = value - assign value to a scalar variable.") },
 2731 { "silent", "", D_silent, D_SILENT, do_commands,
 2732     gettext_noop("silent - suspends usual message when stopped at a breakpoint/watchpoint.") },
 2733 { "source", "", D_source, D_SOURCE, do_source,
 2734     gettext_noop("source file - execute commands from file.") },
 2735 { "step", "s", D_step, D_STEP, do_step,
 2736     gettext_noop("step [COUNT] - step program until it reaches a different source line.") },
 2737 { "stepi", "si", D_stepi, D_STEPI, do_stepi,
 2738     gettext_noop("stepi [COUNT] - step one instruction exactly.") },
 2739 { "tbreak", "t", D_tbreak, D_TBREAK, do_tmp_breakpoint,
 2740     gettext_noop("tbreak [[filename:]N|function] - set a temporary breakpoint.") },
 2741 { "trace", "", D_trace, D_TRACE, do_trace_instruction,
 2742     gettext_noop("trace on|off - print instruction before executing.") },
 2743 { "undisplay",  "", D_undisplay, D_UNDISPLAY, do_undisplay,
 2744     gettext_noop("undisplay [N] - remove variable(s) from automatic display list.") },
 2745 { "until", "u", D_until, D_UNTIL, do_until,
 2746     gettext_noop("until [[filename:]N|function] - execute until program reaches a different line or line N within current frame.") },
 2747 { "unwatch", "", D_unwatch, D_UNWATCH, do_unwatch,
 2748     gettext_noop("unwatch [N] - remove variable(s) from watch list.") },
 2749 { "up", "", D_up, D_UP, do_up,
 2750     gettext_noop("up [N] - move N frames up the stack.") },
 2751 { "watch", "w", D_watch, D_WATCH, do_watch,
 2752     gettext_noop("watch var - set a watchpoint for a variable.") },
 2753 { "where", "", D_backtrace, D_BACKTRACE, do_backtrace,
 2754     gettext_noop("where [N] - (same as backtrace) print trace of all or N innermost (outermost if N < 0) frames.") },
 2755 { NULL, NULL, D_illegal, 0, (Func_cmd) 0,
 2756      NULL },
 2757 };
 2758 
 2759 struct argtoken argtab[] = {
 2760     { "args", D_info, A_ARGS },
 2761     { "break", D_info, A_BREAK },
 2762     { "del", D_enable, A_DEL },
 2763     { "display", D_info, A_DISPLAY },
 2764     { "frame", D_info, A_FRAME },
 2765     { "functions", D_info, A_FUNCTIONS },
 2766     { "locals", D_info, A_LOCALS },
 2767     { "off", D_trace, A_TRACE_OFF },
 2768     { "on", D_trace, A_TRACE_ON },
 2769     { "once", D_enable, A_ONCE },
 2770     { "source", D_info, A_SOURCE },
 2771     { "sources", D_info, A_SOURCES },
 2772     { "variables", D_info, A_VARIABLES },
 2773     { "watch", D_info, A_WATCH },
 2774     { NULL, D_illegal, A_NONE },
 2775 };
 2776 
 2777 
 2778 /* get_command --- return command handler function */
 2779 
 2780 Func_cmd
 2781 get_command(int ctype)
 2782 {
 2783     int i;
 2784     for (i = 0; cmdtab[i].name != NULL; i++) {
 2785         if (cmdtab[i].type == ctype)
 2786             return cmdtab[i].cf_ptr;
 2787     }
 2788     return (Func_cmd) 0;
 2789 }
 2790 
 2791 /* get_command_name --- return command name given it's type */
 2792 
 2793 const char *
 2794 get_command_name(int ctype)
 2795 {
 2796     int i;
 2797     for (i = 0; cmdtab[i].name != NULL; i++) {
 2798         if (cmdtab[i].type == ctype)
 2799             return cmdtab[i].name;
 2800     }
 2801     return NULL;
 2802 }
 2803 
 2804 /* mk_cmdarg --- make an argument for command */
 2805 
 2806 static CMDARG *
 2807 mk_cmdarg(enum argtype type)
 2808 {
 2809     CMDARG *arg;
 2810     ezalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg");
 2811     arg->type = type;
 2812     return arg;
 2813 }
 2814 
 2815 /* append_cmdarg --- append ARG to the list of arguments for the current command */
 2816 
 2817 static void
 2818 append_cmdarg(CMDARG *arg)
 2819 {
 2820     static CMDARG *savetail;
 2821 
 2822     if (arg_list == NULL)
 2823         arg_list = arg;
 2824     else
 2825         savetail->next = arg;
 2826     savetail = arg;
 2827 }
 2828 
 2829 /* free_cmdarg --- free all arguments in LIST */
 2830 
 2831 void
 2832 free_cmdarg(CMDARG *list)
 2833 {
 2834     CMDARG *arg, *nexta;
 2835 
 2836     for (arg = list; arg != NULL; arg = nexta) {
 2837         nexta = arg->next;
 2838 
 2839         switch (arg->type) {
 2840         case D_variable:
 2841         case D_subscript:
 2842         case D_array:
 2843         case D_string:
 2844             if (arg->a_string != NULL)
 2845                 efree(arg->a_string);
 2846             break;
 2847         case D_node:
 2848         case D_field:
 2849             unref(arg->a_node);
 2850             break;
 2851         default:
 2852             break;
 2853         }
 2854         efree(arg);
 2855     }
 2856 }
 2857 
 2858 /* yyerror --- print a syntax error message */
 2859 
 2860 static void
 2861 yyerror(const char *mesg, ...)
 2862 {
 2863     va_list args;
 2864     va_start(args, mesg);
 2865     fprintf(out_fp, _("error: "));
 2866     vfprintf(out_fp, mesg, args);
 2867     fprintf(out_fp, "\n");
 2868     va_end(args);
 2869     dbg_errcount++;
 2870     repeat_idx = -1;
 2871 }
 2872 
 2873 
 2874 /* yylex --- read a command and turn it into tokens */
 2875 
 2876 static int
 2877 #ifdef USE_EBCDIC
 2878 yylex_ebcdic(void)
 2879 #else
 2880 yylex(void)
 2881 #endif
 2882 {
 2883     static char *lexptr = NULL;
 2884     static char *lexend;
 2885     int c;
 2886     char *tokstart;
 2887     size_t toklen;
 2888 
 2889     yylval = (CMDARG *) NULL;
 2890 
 2891     if (dbg_errcount > 0 && lexptr_begin == NULL) {
 2892         /* fake a new line */
 2893         dbg_errcount = 0;
 2894         return '\n';
 2895     }
 2896 
 2897     if (lexptr_begin == NULL) {
 2898 again:
 2899         lexptr_begin = read_a_line(dbg_prompt);
 2900         if (lexptr_begin == NULL) { /* EOF or error */
 2901             if (get_eof_status() == EXIT_FATAL)
 2902                 exit(EXIT_FATAL);
 2903             if (get_eof_status() == EXIT_FAILURE) {
 2904                 static int seen_eof = 0;
 2905 
 2906                 /* force a quit, and let do_quit (in debug.c) exit */
 2907                 if (! seen_eof) {
 2908                     if (errno != 0) {
 2909                         fprintf(stderr, _("cannot read command: %s\n"), strerror(errno));
 2910                         exit_val = EXIT_FAILURE;
 2911                     } /* else
 2912                         exit_val = EXIT_SUCCESS; */
 2913 
 2914                     seen_eof = 1;
 2915                     return '\n';    /* end current command if any */
 2916                 } else if (seen_eof++ == 1) {
 2917                     cmd_idx = find_command("quit", 4);
 2918                     return D_QUIT;  /* 'quit' token */
 2919                 } else
 2920                     return '\n';    /* end command 'quit' */
 2921             }
 2922             if (errno != 0)
 2923                 d_error(_("cannot read command: %s"), strerror(errno));
 2924             if (pop_cmd_src() == 0)
 2925                 goto again;
 2926             exit(EXIT_FATAL);   /* shouldn't happen */
 2927         }
 2928 
 2929         if (! in_commands && ! in_eval  /* history expansion off in 'commands' and 'eval' */
 2930                 && input_from_tty
 2931         )
 2932             history_expand_line(&lexptr_begin);
 2933 
 2934         lexptr = lexptr_begin;
 2935         lexend = lexptr + strlen(lexptr);
 2936         if (*lexptr == '\0'     /* blank line */
 2937                 && repeat_idx >= 0
 2938                 && input_from_tty
 2939                 && ! in_eval
 2940         ) {
 2941 #ifdef HAVE_LIBREADLINE
 2942             HIST_ENTRY *h;
 2943             h = previous_history();
 2944             if (h != NULL)
 2945                 add_history(h->line);
 2946 #endif
 2947             cmd_idx = repeat_idx;
 2948             return cmdtab[cmd_idx].class;   /* repeat last command */
 2949         }
 2950         repeat_idx = -1;
 2951     }
 2952 
 2953     c = *lexptr;
 2954 
 2955     while (c == ' ' || c == '\t')
 2956         c = *++lexptr;
 2957 
 2958     if (! input_from_tty && c == '#')
 2959         return '\n';
 2960 
 2961     tokstart = lexptr;
 2962     if (lexptr >= lexend)
 2963         return '\n';
 2964 
 2965     if (cmd_idx < 0) {  /* need a command */
 2966         if (c == '?' && tokstart[1] == '\0' && ! in_eval) {
 2967             lexptr++;
 2968             cmd_idx = find_command("help", 4);
 2969             return D_HELP;
 2970         }
 2971 
 2972         while (c != '\0' && c != ' ' && c != '\t') {
 2973             if (! is_alpha(c) && ! in_eval) {
 2974                 yyerror(_("invalid character in command"));
 2975                 return '\n';
 2976             }
 2977             c = *++lexptr;
 2978         }
 2979 
 2980         toklen = lexptr - tokstart;
 2981 
 2982         if (in_eval) {
 2983             if (toklen == 3
 2984                     && tokstart[3] == '\0'
 2985                     && tokstart[0] == 'e'
 2986                     && tokstart[1] == 'n'
 2987                     && tokstart[2] == 'd'
 2988             ) {
 2989                 cmd_idx = find_command(tokstart, toklen);
 2990                 return D_END;
 2991             }
 2992             lexptr = lexend;
 2993             return D_STATEMENT;
 2994         }
 2995 
 2996         cmd_idx = find_command(tokstart, toklen);
 2997         if (cmd_idx >= 0) {
 2998             if (in_commands && cmdtab[cmd_idx].type != D_eval) {
 2999                 /* add the actual command string (lexptr_begin) to
 3000                  * arg_list; command string for 'eval' prepended to the arg_list
 3001                  * in the grammer above (see eval_cmd non-terminal).
 3002                  */
 3003                 CMDARG *arg;
 3004                 arg = mk_cmdarg(D_string);
 3005                 arg->a_string = estrdup(lexptr_begin, lexend - lexptr_begin);
 3006                 append_cmdarg(arg);
 3007             }
 3008             return cmdtab[cmd_idx].class;
 3009         } else {
 3010             yyerror(_("unknown command - `%.*s', try help"), toklen, tokstart);
 3011             return '\n';
 3012         }
 3013     }
 3014 
 3015     c = *lexptr;
 3016 
 3017     if (cmdtab[cmd_idx].type == D_option) {
 3018         if (c == '=')
 3019             return *lexptr++;
 3020     } else if (c == '-' || c == '+' || c == ':' || c == '|')
 3021         return *lexptr++;
 3022 
 3023     if (c == '"') {
 3024         char *str, *p;
 3025         int flags = ALREADY_MALLOCED;
 3026         bool esc_seen = false;
 3027 
 3028         toklen = lexend - lexptr;
 3029         emalloc(str, char *, toklen + 1, "yylex");
 3030         p = str;
 3031 
 3032         while ((c = *++lexptr) != '"') {
 3033             if (lexptr == lexend) {
 3034 err:
 3035                 efree(str);
 3036                 yyerror(_("unterminated string"));
 3037                 return '\n';
 3038             }
 3039             if (c == '\\') {
 3040                 c = *++lexptr;
 3041                 esc_seen = true;
 3042                 if (want_nodeval || c != '"')
 3043                     *p++ = '\\';
 3044             }
 3045             if (lexptr == lexend)
 3046                 goto err;
 3047             *p++ = c;
 3048         }
 3049         lexptr++;
 3050         *p = '\0';
 3051 
 3052         if (! want_nodeval) {
 3053             yylval = mk_cmdarg(D_string);
 3054             yylval->a_string = str;
 3055             append_cmdarg(yylval);
 3056             return D_STRING;
 3057         } else {    /* awk string */
 3058             if (esc_seen)
 3059                 flags |= SCAN;
 3060             yylval = mk_cmdarg(D_node);
 3061             yylval->a_node = make_str_node(str, p - str, flags);
 3062             append_cmdarg(yylval);
 3063             return D_NODE;
 3064         }
 3065     }
 3066 
 3067     if (! want_nodeval) {
 3068         while ((c = *++lexptr) != '\0' && c != ':' && c != '-'
 3069                     && c != ' ' && c != '\t' && c != '=')
 3070             ;
 3071 
 3072         /* Is it an integer? */
 3073         if (isdigit((unsigned char) tokstart[0]) && cmdtab[cmd_idx].type != D_option) {
 3074             char *end;
 3075             long l;
 3076 
 3077             errno = 0;
 3078             l = strtol(tokstart, &end, 0);
 3079             if (errno != 0) {
 3080                 yyerror(_("%s"), strerror(errno));
 3081                 errno = 0;
 3082                 return '\n';
 3083             }
 3084 
 3085             if (lexptr == end) {
 3086                 yylval = mk_cmdarg(D_int);
 3087                 yylval->a_int = l;
 3088                 append_cmdarg(yylval);
 3089                 return D_INT;
 3090             }
 3091         }
 3092 
 3093         /* Must be string */
 3094         yylval = mk_cmdarg(D_string);
 3095         yylval->a_string = estrdup(tokstart, lexptr - tokstart);
 3096         append_cmdarg(yylval);
 3097         return D_STRING;
 3098     }
 3099 
 3100     /* look for awk number */
 3101 
 3102     if (isdigit((unsigned char) tokstart[0])) {
 3103         NODE *r = NULL;
 3104 
 3105         errno = 0;
 3106 #ifdef HAVE_MPFR
 3107         if (do_mpfr) {
 3108             int tval;
 3109             r = mpg_float();
 3110             tval = mpfr_strtofr(r->mpg_numbr, tokstart, & lexptr, 0, ROUND_MODE);
 3111             IEEE_FMT(r->mpg_numbr, tval);
 3112             if (mpfr_integer_p(r->mpg_numbr)) {
 3113                 /* integral value, convert to a GMP type. */
 3114                 NODE *tmp = r;
 3115                 r = mpg_integer();
 3116                 mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ);
 3117                 unref(tmp);
 3118             }
 3119         } else
 3120 #endif
 3121             r = make_number(strtod(tokstart, & lexptr));
 3122 
 3123         if (errno != 0) {
 3124             yyerror(strerror(errno));
 3125             unref(r);
 3126             errno = 0;
 3127             return '\n';
 3128         }
 3129         yylval = mk_cmdarg(D_node);
 3130         yylval->a_node = r;
 3131         append_cmdarg(yylval);
 3132         return D_NODE;
 3133     }
 3134 
 3135     c = *lexptr;
 3136     if (c == '$' || c == '@'
 3137             || c == '[' || c == ']'
 3138             || c == ',' || c == '=')
 3139         return *lexptr++;
 3140 
 3141     if (! is_letter(c)) {
 3142         yyerror(_("invalid character"));
 3143         return '\n';
 3144     }
 3145 
 3146     while (is_identchar(c))
 3147         c = *++lexptr;
 3148     toklen = lexptr - tokstart;
 3149 
 3150     /* awk variable */
 3151     yylval = mk_cmdarg(D_variable);
 3152     yylval->a_string = estrdup(tokstart, toklen);
 3153     append_cmdarg(yylval);
 3154     return D_VARIABLE;
 3155 }
 3156 
 3157 /* Convert single-character tokens coming out of yylex() from EBCDIC to
 3158    ASCII values on-the-fly so that the parse tables need not be regenerated
 3159    for EBCDIC systems.  */
 3160 #ifdef USE_EBCDIC
 3161 static int
 3162 yylex(void)
 3163 {
 3164     static char etoa_xlate[256];
 3165     static int do_etoa_init = 1;
 3166     int tok;
 3167 
 3168     if (do_etoa_init)
 3169     {
 3170         for (tok = 0; tok < 256; tok++)
 3171             etoa_xlate[tok] = (char) tok;
 3172 #ifdef HAVE___ETOA_L
 3173         /* IBM helpfully provides this function.  */
 3174         __etoa_l(etoa_xlate, sizeof(etoa_xlate));
 3175 #else
 3176 # error "An EBCDIC-to-ASCII translation function is needed for this system"
 3177 #endif
 3178         do_etoa_init = 0;
 3179     }
 3180 
 3181     tok = yylex_ebcdic();
 3182 
 3183     if (tok >= 0 && tok <= 0xFF)
 3184         tok = etoa_xlate[tok];
 3185 
 3186     return tok;
 3187 }
 3188 #endif /* USE_EBCDIC */
 3189 
 3190 /* find_argument --- find index in 'argtab' for a command option */
 3191 
 3192 static int
 3193 find_argument(CMDARG *arg)
 3194 {
 3195     /* non-number argument */
 3196     int idx;
 3197     char *name, *p;
 3198     size_t len;
 3199     assert(cmd_idx >= 0);
 3200     name = arg->a_string;
 3201     len = strlen(name);
 3202     for (idx = 0; (p = (char *) argtab[idx].name) != NULL; idx++) {
 3203         if (cmdtab[cmd_idx].type == argtab[idx].cmd
 3204                 && *p == *name
 3205                 && strlen(p) == len
 3206                 && strncmp(p, name, len) == 0
 3207         )
 3208             return idx;
 3209     }
 3210     return -1;  /* invalid option */
 3211 }
 3212 
 3213 /* concat_args --- concatenate argument strings into a single string NODE */
 3214 
 3215 static NODE *
 3216 concat_args(CMDARG *arg, int count)
 3217 {
 3218     NODE *n;
 3219     NODE **tmp;
 3220     char *str, *subsep, *p;
 3221     long len, subseplen;
 3222     int i;
 3223 
 3224     if (count == 1) {
 3225         n = force_string(arg->a_node);
 3226         return dupnode(n);
 3227     }
 3228 
 3229     emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args");
 3230     subseplen = SUBSEP_node->var_value->stlen;
 3231     subsep = SUBSEP_node->var_value->stptr;
 3232     len = -subseplen;
 3233 
 3234     for (i = 0; i < count; i++) {
 3235         n = force_string(arg->a_node);
 3236         len += n->stlen + subseplen;
 3237         tmp[i] = n;
 3238         arg = arg->next;
 3239     }
 3240 
 3241     emalloc(str, char *, len + 1, "concat_args");
 3242     n = tmp[0];
 3243     memcpy(str, n->stptr, n->stlen);
 3244     p = str + n->stlen;
 3245     for (i = 1; i < count; i++) {
 3246         if (subseplen == 1)
 3247             *p++ = *subsep;
 3248         else if (subseplen > 0) {
 3249             memcpy(p, subsep, subseplen);
 3250             p += subseplen;
 3251         }
 3252 
 3253         n = tmp[i];
 3254         memcpy(p, n->stptr, n->stlen);
 3255         p += n->stlen;
 3256     }
 3257     str[len] = '\0';
 3258     efree(tmp);
 3259     return make_str_node(str, len, ALREADY_MALLOCED);
 3260 }
 3261 
 3262 /* find_command --- find the index in 'cmdtab' using exact,
 3263  *                  abbreviation or unique partial match
 3264  */
 3265 
 3266 static int
 3267 find_command(const char *token, size_t toklen)
 3268 {
 3269     char *name, *abrv;
 3270     int i, k;
 3271     bool try_exact = true;
 3272     int abrv_match = -1;
 3273     int partial_match = -1;
 3274 
 3275 #ifdef USE_EBCDIC
 3276     /* make sure all lower case characters in token (sorting
 3277      * isn't the solution in this case)
 3278      */
 3279     for (i = 0; i < toklen; i++) {
 3280         if (token[i] != tolower(token[i]))
 3281             return -1;
 3282     }
 3283 #endif
 3284 
 3285     k = sizeof(cmdtab)/sizeof(cmdtab[0]) - 1;
 3286     for (i = 0; i < k; i++) {
 3287         name = (char *) cmdtab[i].name;
 3288         if (try_exact && *token == *name
 3289                 && toklen == strlen(name)
 3290                 && strncmp(name, token, toklen) == 0
 3291         )
 3292             return i;
 3293 
 3294         if (*name > *token || i == (k - 1))
 3295             try_exact = false;
 3296 
 3297         if (abrv_match < 0) {
 3298             abrv = cmdtab[i].abbrvn;
 3299             if (abrv[0] == token[0]) {
 3300                 if (toklen == 1 && ! abrv[1])
 3301                     abrv_match = i;
 3302                 else if (toklen == 2 && abrv[1] == token[1])
 3303                     abrv_match = i;
 3304             }
 3305         }
 3306         if (! try_exact && abrv_match >= 0)
 3307             return abrv_match;
 3308         if (partial_match < 0) {
 3309             if (*token == *name
 3310                     && toklen < strlen(name)
 3311                     && strncmp(name, token, toklen) == 0
 3312             ) {
 3313                 if ((i == k - 1 || strncmp(cmdtab[i + 1].name, token, toklen) != 0)
 3314                     && (i == 0 || strncmp(cmdtab[i - 1].name, token, toklen) != 0)
 3315                 )
 3316                     partial_match = i;
 3317             }
 3318         }
 3319     }
 3320     return partial_match;
 3321 }
 3322 
 3323 /* do_help -- help command */
 3324 
 3325 int
 3326 do_help(CMDARG *arg, int cmd)
 3327 {
 3328     int i;
 3329     if (arg == NULL) {
 3330         initialize_pager(out_fp);
 3331         if (setjmp(pager_quit_tag) == 0) {
 3332             for (i = 0; cmdtab[i].name != NULL; i++) {
 3333                 gprintf(out_fp, "%s:\n", cmdtab[i].name);
 3334                 gprintf(out_fp, "\t%s\n", _(cmdtab[i].help_txt));
 3335             }
 3336         }
 3337     } else if (arg->type == D_string) {
 3338         char *name;
 3339         name = arg->a_string;
 3340         i = find_command(name, strlen(name));
 3341         if (i >= 0) {
 3342             fprintf(out_fp, "%s\n", cmdtab[i].help_txt);
 3343             if (strcmp(cmdtab[i].name, "option") == 0)
 3344                 option_help();
 3345         } else
 3346             fprintf(out_fp, _("undefined command: %s\n"), name);
 3347     }
 3348 
 3349     return false;
 3350 }
 3351 
 3352 
 3353 #ifdef HAVE_LIBREADLINE
 3354 
 3355 /* next_word --- find the next word in a line to complete
 3356  *               (word seperation characters are space and tab).
 3357  */
 3358 
 3359 static char *
 3360 next_word(char *p, int len, char **endp)
 3361 {
 3362     char *q;
 3363     int i;
 3364 
 3365     if (p == NULL || len <= 0)
 3366         return NULL;
 3367     for (i = 0; i < len; i++, p++)
 3368         if (*p != ' ' && *p != '\t')
 3369             break;
 3370     if (i == len)
 3371         return NULL;
 3372     if (endp != NULL) {
 3373         for (i++, q = p + 1; i < len; i++, q++)
 3374             if (*q == ' ' || *q == '\t')
 3375                 break;
 3376         *endp = q;
 3377     }
 3378     return p;
 3379 }
 3380 
 3381 /* command_completion --- attempt to complete based on the word number in line;
 3382  *    try to complete on command names if this is the first word; for the next
 3383  *    word(s), the type of completion depends on the command name (first word).
 3384  */
 3385 
 3386 #ifndef RL_READLINE_VERSION     /* < 4.2a */
 3387 #define rl_completion_matches(x, y) completion_matches((char *) (x), (y))
 3388 #endif
 3389 
 3390 
 3391 char **
 3392 command_completion(const char *text, int start, int end)
 3393 {
 3394     char *cmdtok, *e;
 3395     int idx;
 3396     int len;
 3397 
 3398     rl_attempted_completion_over = true;    /* no default filename completion please */
 3399 
 3400     this_cmd = D_illegal;
 3401     len = start;
 3402     if ((cmdtok = next_word(rl_line_buffer, len, &e)) == NULL)  /* no first word yet */
 3403         return  rl_completion_matches(text, command_generator);
 3404     len -= (e - rl_line_buffer);
 3405 
 3406     idx = find_command(cmdtok, e - cmdtok);
 3407     if (idx < 0)
 3408         return NULL;
 3409     this_cmd = cmdtab[idx].type;
 3410 
 3411     if (! next_word(e, len, NULL)) {
 3412         switch (this_cmd) {
 3413         case D_break:
 3414         case D_list:
 3415         case D_until:
 3416         case D_tbreak:
 3417         case D_clear:
 3418             return rl_completion_matches(text, srcfile_generator);
 3419         case D_info:
 3420         case D_enable:
 3421         case D_trace:
 3422         case D_help:
 3423             return rl_completion_matches(text, argument_generator);
 3424         case D_option:
 3425             return rl_completion_matches(text, option_generator);
 3426         case D_print:
 3427         case D_printf:
 3428         case D_set:
 3429         case D_display:
 3430         case D_watch:
 3431             return rl_completion_matches(text, variable_generator);
 3432         default:
 3433             return NULL;
 3434         }
 3435     }
 3436 
 3437     if (this_cmd == D_print || this_cmd == D_printf)
 3438         return rl_completion_matches(text, variable_generator);
 3439     return NULL;
 3440 }
 3441 
 3442 /* command_generator --- generator function for command completion */
 3443 
 3444 static char *
 3445 command_generator(const char *text, int state)
 3446 {
 3447     static size_t textlen;
 3448     static int idx = 0;
 3449     char *name;
 3450 
 3451     if (! state) {  /* first time */
 3452         textlen = strlen(text);
 3453         idx = 0;
 3454     }
 3455     while ((name = (char *) cmdtab[idx].name) != NULL) {
 3456         idx++;
 3457         if (strncmp(name, text, textlen) == 0)
 3458             return estrdup(name, strlen(name));
 3459     }
 3460     return NULL;
 3461 }
 3462 
 3463 /* srcfile_generator --- generator function for source file completion */
 3464 
 3465 static char *
 3466 srcfile_generator(const char *text, int state)
 3467 {
 3468     static size_t textlen;
 3469     static SRCFILE *s;
 3470     char *name;
 3471     extern SRCFILE *srcfiles;
 3472 
 3473     if (! state) {  /* first time */
 3474         textlen = strlen(text);
 3475         s = srcfiles->next;
 3476     }
 3477     while (s != srcfiles) {
 3478         if (s->stype != SRC_FILE && s->stype != SRC_INC) {
 3479             s = s->next;
 3480             continue;
 3481         }
 3482         name = s->src;
 3483         s = s->next;
 3484         if (strncmp(name, text, textlen) == 0)
 3485             return estrdup(name, strlen(name));
 3486     }
 3487     return NULL;
 3488 }
 3489 
 3490 /* argument_generator --- generator function for non-number argument completion */
 3491 
 3492 static char *
 3493 argument_generator(const char *text, int state)
 3494 {
 3495     static size_t textlen;
 3496     static int idx;
 3497     const char *name;
 3498 
 3499     if (! state) {  /* first time */
 3500         textlen = strlen(text);
 3501         idx = 0;
 3502     }
 3503 
 3504     if (this_cmd == D_help) {
 3505         while ((name = cmdtab[idx++].name) != NULL) {
 3506             if (strncmp(name, text, textlen) == 0)
 3507                 return estrdup(name, strlen(name));
 3508         }
 3509     } else {
 3510         while ((name = argtab[idx].name) != NULL) {
 3511             if (this_cmd != argtab[idx++].cmd)
 3512                 continue;
 3513             if (strncmp(name, text, textlen) == 0)
 3514                 return estrdup(name, strlen(name));
 3515         }
 3516     }
 3517     return NULL;
 3518 }
 3519 
 3520 /* variable_generator --- generator function for variable name completion */
 3521 
 3522 static char *
 3523 variable_generator(const char *text, int state)
 3524 {
 3525     static size_t textlen;
 3526     static int idx = 0;
 3527     static NODE *func = NULL;
 3528     static NODE **vars = NULL;
 3529     const char *name;
 3530     NODE *r;
 3531 
 3532     if (! state) {  /* first time */
 3533         textlen = strlen(text);
 3534         if (vars != NULL)
 3535             efree(vars);
 3536         vars = variable_list();
 3537         idx = 0;
 3538         func = get_function();  /* function in current context */
 3539     }
 3540 
 3541     /* function params */
 3542     while (func != NULL) {
 3543         if (idx >= func->param_cnt) {
 3544             func = NULL;    /* don't try to match params again */
 3545             idx = 0;
 3546             break;
 3547         }
 3548         name = func->fparms[idx++].param;
 3549         if (strncmp(name, text, textlen) == 0)
 3550             return estrdup(name, strlen(name));
 3551     }
 3552 
 3553     /* globals */
 3554     while ((r = vars[idx++]) != NULL) {
 3555         name = r->vname;
 3556         if (strncmp(name, text, textlen) == 0)
 3557             return estrdup(name, strlen(name));
 3558     }
 3559 
 3560     return NULL;
 3561 }
 3562 
 3563 /* history_expand_line ---  history expand the LINE */
 3564 
 3565 static void
 3566 history_expand_line(char **line)
 3567 {
 3568     int ret;
 3569     char *expansion;
 3570 
 3571     if (! *line || input_fd != 0 || ! input_from_tty)
 3572         return;
 3573     using_history();
 3574     ret = history_expand(*line, &expansion);
 3575     if (ret < 0 || ret == 2)
 3576         efree(expansion);
 3577     else {
 3578         efree(*line);
 3579         *line = expansion;
 3580     }
 3581 }
 3582 
 3583 #endif