"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "command.y" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

command.y  (gawk-5.0.1.tar.xz):command.y  (gawk-5.1.0.tar.xz)
/* /*
* command.y - yacc/bison parser for debugger commands. * command.y - yacc/bison parser for debugger commands.
*/ */
/* /*
* Copyright (C) 2004, 2010, 2011, 2014, 2016, 2017 * Copyright (C) 2004, 2010, 2011, 2014, 2016, 2017, 2019, 2020,
* the Free Software Foundation, Inc. * the Free Software Foundation, Inc.
* *
* This file is part of GAWK, the GNU implementation of the * This file is part of GAWK, the GNU implementation of the
* AWK Programming Language. * AWK Programming Language.
* *
* GAWK is free software; you can redistribute it and/or modify * GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
skipping to change at line 227 skipping to change at line 227
eval_prologue eval_prologue
: D_EVAL set_want_nodeval opt_param_list nls : D_EVAL set_want_nodeval opt_param_list nls
{ {
if (dbg_errcount == 0) { if (dbg_errcount == 0) {
/* don't free arg_list; passed on to statement_list /* don't free arg_list; passed on to statement_list
* non-terminal (empty rule action). See below. * non-terminal (empty rule action). See below.
*/ */
if (input_from_tty) { if (input_from_tty) {
dbg_prompt = eval_prompt; dbg_prompt = eval_prompt;
fprintf(out_fp, fprintf(out_fp,
_("Type (g)awk statement(s). End with the command \"end\"\n")); _("Type (g)awk statement(s). End with the command `end'\n"));
rl_inhibit_completion = 1; rl_inhibit_completion = 1;
} }
cmd_idx = -1; cmd_idx = -1;
in_eval = true; in_eval = true;
} }
} }
; ;
statement_list statement_list
: /* empty */ : /* empty */
skipping to change at line 297 skipping to change at line 297
| frame_cmd opt_integer | frame_cmd opt_integer
{ {
if (cmdtab[cmd_idx].class == D_FRAME if (cmdtab[cmd_idx].class == D_FRAME
&& $2 != NULL && $2->a_int < 0) && $2 != NULL && $2->a_int < 0)
yyerror(_("invalid frame number: %d"), $2->a_int); yyerror(_("invalid frame number: %d"), $2->a_int);
} }
| D_INFO D_STRING | D_INFO D_STRING
{ {
int idx = find_argument($2); int idx = find_argument($2);
if (idx < 0) if (idx < 0)
yyerror(_("info: invalid option - \"%s\""), $2->a_string) ; yyerror(_("info: invalid option - `%s'"), $2->a_string);
else { else {
efree($2->a_string); efree($2->a_string);
$2->a_string = NULL; $2->a_string = NULL;
$2->type = D_argument; $2->type = D_argument;
$2->a_argument = argtab[idx].value; $2->a_argument = argtab[idx].value;
} }
} }
| D_IGNORE plus_integer D_INT | D_IGNORE plus_integer D_INT
| D_ENABLE enable_args | D_ENABLE enable_args
| D_PRINT { want_nodeval = true; } print_args | D_PRINT { want_nodeval = true; } print_args
skipping to change at line 323 skipping to change at line 323
| D_SET { want_nodeval = true; } variable '=' node | D_SET { want_nodeval = true; } variable '=' node
| D_OPTION option_args | D_OPTION option_args
| D_RETURN { want_nodeval = true; } opt_node | D_RETURN { want_nodeval = true; } opt_node
| D_DISPLAY { want_nodeval = true; } opt_variable | D_DISPLAY { want_nodeval = true; } opt_variable
| D_WATCH { want_nodeval = true; } variable condition_exp | D_WATCH { want_nodeval = true; } variable condition_exp
| d_cmd opt_integer_list | d_cmd opt_integer_list
| D_DUMP opt_string | D_DUMP opt_string
| D_SOURCE D_STRING | D_SOURCE D_STRING
{ {
if (in_cmd_src($2->a_string)) if (in_cmd_src($2->a_string))
yyerror(_("source \"%s\": already sourced."), $2->a_strin g); yyerror(_("source: `%s': already sourced."), $2->a_string );
} }
| D_SAVE D_STRING | D_SAVE D_STRING
{ {
if (! input_from_tty) if (! input_from_tty)
yyerror(_("save \"%s\": command not permitted."), $2->a_s tring); yyerror(_("save: `%s': command not permitted."), $2->a_st ring);
} }
| D_COMMANDS commands_arg | D_COMMANDS commands_arg
{ {
int type = 0; int type = 0;
int num; int num;
if ($2 != NULL) if ($2 != NULL)
num = $2->a_int; num = $2->a_int;
if (dbg_errcount != 0) if (dbg_errcount != 0)
; ;
else if (in_commands) else if (in_commands)
yyerror(_("Can't use command `commands' for breakpoint/wa tchpoint commands")); yyerror(_("cannot use command `commands' for breakpoint/w atchpoint commands"));
else if ($2 == NULL && ! (type = has_break_or_watch_point(&num, true))) else if ($2 == NULL && ! (type = has_break_or_watch_point(&num, true)))
yyerror(_("no breakpoint/watchpoint has been set yet")); yyerror(_("no breakpoint/watchpoint has been set yet"));
else if ($2 != NULL && ! (type = has_break_or_watch_point(&num, f alse))) else if ($2 != NULL && ! (type = has_break_or_watch_point(&num, f alse)))
yyerror(_("invalid breakpoint/watchpoint number")); yyerror(_("invalid breakpoint/watchpoint number"));
if (type) { if (type) {
in_commands = true; in_commands = true;
if (input_from_tty) { if (input_from_tty) {
dbg_prompt = commands_prompt; dbg_prompt = commands_prompt;
fprintf(out_fp, _("Type commands for when %s %d i s hit, one per line.\n"), fprintf(out_fp, _("Type commands for when %s %d i s hit, one per line.\n"),
(type == D_break) ? "breakpoint" : "watchpoint", num); (type == D_break) ? "breakpoint" : "watchpoint", num);
fprintf(out_fp, _("End with the command \"end\"\n ")); fprintf(out_fp, _("End with the command `end'\n") );
} }
} }
} }
| D_END | D_END
{ {
if (! in_commands) if (! in_commands)
yyerror(_("`end' valid only in command `commands' or `eva l'")); yyerror(_("`end' valid only in command `commands' or `eva l'"));
else { else {
if (input_from_tty) if (input_from_tty)
dbg_prompt = dgawk_prompt; dbg_prompt = dgawk_prompt;
skipping to change at line 375 skipping to change at line 375
} }
| D_SILENT | D_SILENT
{ {
if (! in_commands) if (! in_commands)
yyerror(_("`silent' valid only in command `commands'")); yyerror(_("`silent' valid only in command `commands'"));
} }
| D_TRACE D_STRING | D_TRACE D_STRING
{ {
int idx = find_argument($2); int idx = find_argument($2);
if (idx < 0) if (idx < 0)
yyerror(_("trace: invalid option - \"%s\""), $2->a_string ); yyerror(_("trace: invalid option - `%s'"), $2->a_string);
else { else {
efree($2->a_string); efree($2->a_string);
$2->a_string = NULL; $2->a_string = NULL;
$2->type = D_argument; $2->type = D_argument;
$2->a_argument = argtab[idx].value; $2->a_argument = argtab[idx].value;
} }
} }
| D_CONDITION plus_integer { want_nodeval = true; } condition_exp | D_CONDITION plus_integer { want_nodeval = true; } condition_exp
{ {
int type; int type;
skipping to change at line 461 skipping to change at line 461
yyerror(_("argument not a string")); yyerror(_("argument not a string"));
} }
; ;
option_args option_args
: /* empty */ : /* empty */
{ $$ = NULL; } { $$ = NULL; }
| D_STRING | D_STRING
{ {
if (find_option($1->a_string) < 0) if (find_option($1->a_string) < 0)
yyerror(_("option: invalid parameter - \"%s\""), $1->a_st ring); yyerror(_("option: invalid parameter - `%s'"), $1->a_stri ng);
} }
| D_STRING '=' D_STRING | D_STRING '=' D_STRING
{ {
if (find_option($1->a_string) < 0) if (find_option($1->a_string) < 0)
yyerror(_("option: invalid parameter - \"%s\""), $1->a_st ring); yyerror(_("option: invalid parameter - `%s'"), $1->a_stri ng);
} }
; ;
func_name func_name
: D_STRING : D_STRING
{ {
NODE *n; NODE *n;
n = lookup($1->a_string); n = lookup($1->a_string);
if (n == NULL || n->type != Node_func) if (n == NULL || n->type != Node_func)
yyerror(_("no such function - \"%s\""), $1->a_string); yyerror(_("no such function - `%s'"), $1->a_string);
else { else {
$1->type = D_func; $1->type = D_func;
efree($1->a_string); efree($1->a_string);
$1->a_string = NULL; $1->a_string = NULL;
$1->a_node = n; $1->a_node = n;
} }
} }
; ;
location location
skipping to change at line 533 skipping to change at line 533
: /* empty */ : /* empty */
| D_STRING | D_STRING
; ;
enable_args enable_args
: opt_integer_list : opt_integer_list
| D_STRING opt_integer_list | D_STRING opt_integer_list
{ {
int idx = find_argument($1); int idx = find_argument($1);
if (idx < 0) if (idx < 0)
yyerror(_("enable: invalid option - \"%s\""), $1->a_strin g); yyerror(_("enable: invalid option - `%s'"), $1->a_string) ;
else { else {
efree($1->a_string); efree($1->a_string);
$1->a_string = NULL; $1->a_string = NULL;
$1->type = D_argument; $1->type = D_argument;
$1->a_argument = argtab[idx].value; $1->a_argument = argtab[idx].value;
} }
} }
; ;
print_exp print_exp
skipping to change at line 1056 skipping to change at line 1056
lexptr_begin = read_a_line(dbg_prompt); lexptr_begin = read_a_line(dbg_prompt);
if (lexptr_begin == NULL) { /* EOF or error */ if (lexptr_begin == NULL) { /* EOF or error */
if (get_eof_status() == EXIT_FATAL) if (get_eof_status() == EXIT_FATAL)
exit(EXIT_FATAL); exit(EXIT_FATAL);
if (get_eof_status() == EXIT_FAILURE) { if (get_eof_status() == EXIT_FAILURE) {
static int seen_eof = 0; static int seen_eof = 0;
/* force a quit, and let do_quit (in debug.c) exi t */ /* force a quit, and let do_quit (in debug.c) exi t */
if (! seen_eof) { if (! seen_eof) {
if (errno != 0) { if (errno != 0) {
fprintf(stderr, _("can't read com mand (%s)\n"), strerror(errno)); fprintf(stderr, _("cannot read co mmand: %s\n"), strerror(errno));
exit_val = EXIT_FAILURE; exit_val = EXIT_FAILURE;
} /* else } /* else
exit_val = EXIT_SUCCESS; */ exit_val = EXIT_SUCCESS; */
seen_eof = 1; seen_eof = 1;
return '\n'; /* end current command if any */ return '\n'; /* end current command if any */
} else if (seen_eof++ == 1) { } else if (seen_eof++ == 1) {
cmd_idx = find_command("quit", 4); cmd_idx = find_command("quit", 4);
return D_QUIT; /* 'quit' token */ return D_QUIT; /* 'quit' token */
} else } else
return '\n'; /* end command 'quit' */ return '\n'; /* end command 'quit' */
} }
if (errno != 0) if (errno != 0)
d_error(_("can't read command (%s)"), strerror(er rno)); d_error(_("cannot read command: %s"), strerror(er rno));
if (pop_cmd_src() == 0) if (pop_cmd_src() == 0)
goto again; goto again;
exit(EXIT_FATAL); /* shouldn't happen */ exit(EXIT_FATAL); /* shouldn't happen */
} }
if (! in_commands && ! in_eval /* history expansion off in 'comm ands' and 'eval' */ if (! in_commands && ! in_eval /* history expansion off in 'comm ands' and 'eval' */
&& input_from_tty && input_from_tty
) )
history_expand_line(&lexptr_begin); history_expand_line(&lexptr_begin);
skipping to change at line 1157 skipping to change at line 1157
* arg_list; command string for 'eval' prepended to the arg_list * arg_list; command string for 'eval' prepended to the arg_list
* in the grammer above (see eval_cmd non-termina l). * in the grammer above (see eval_cmd non-termina l).
*/ */
CMDARG *arg; CMDARG *arg;
arg = mk_cmdarg(D_string); arg = mk_cmdarg(D_string);
arg->a_string = estrdup(lexptr_begin, lexend - le xptr_begin); arg->a_string = estrdup(lexptr_begin, lexend - le xptr_begin);
append_cmdarg(arg); append_cmdarg(arg);
} }
return cmdtab[cmd_idx].class; return cmdtab[cmd_idx].class;
} else { } else {
yyerror(_("unknown command - \"%.*s\", try help"), toklen , tokstart); yyerror(_("unknown command - `%.*s', try help"), toklen, tokstart);
return '\n'; return '\n';
} }
} }
c = *lexptr; c = *lexptr;
if (cmdtab[cmd_idx].type == D_option) { if (cmdtab[cmd_idx].type == D_option) {
if (c == '=') if (c == '=')
return *lexptr++; return *lexptr++;
} else if (c == '-' || c == '+' || c == ':' || c == '|') } else if (c == '-' || c == '+' || c == ':' || c == '|')
 End of changes. 15 change blocks. 
15 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)