diff options
Diffstat (limited to 'command.y')
-rw-r--r-- | command.y | 80 |
1 files changed, 40 insertions, 40 deletions
@@ -2,23 +2,23 @@ * command.y - yacc/bison parser for debugger commands. */ -/* +/* * Copyright (C) 2004, 2010, 2011, 2014, 2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -42,7 +42,7 @@ static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ -static CMDARG *arg_list = NULL; /* list of arguments */ +static CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; @@ -50,7 +50,7 @@ static int num_dim; static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; -static const char end_EVAL[] = "}"; +static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); static NODE *concat_args(CMDARG *a, int count); @@ -132,7 +132,7 @@ line bool terminate = false; CMDARG *args; int ctype = 0; - + ctype = cmdtab[cmd_idx].type; /* a blank line repeats previous command @@ -308,7 +308,7 @@ command | D_LIST list_args | D_UNTIL location | D_CLEAR location - | break_cmd break_args + | break_cmd break_args | D_SET { want_nodeval = true; } variable '=' node | D_OPTION option_args | D_RETURN { want_nodeval = true; } opt_node @@ -345,7 +345,7 @@ command if (type) { in_commands = true; if (input_from_tty) { - dbg_prompt = commands_prompt; + dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), (type == D_break) ? "breakpoint" : "watchpoint", num); fprintf(out_fp, _("End with the command \"end\"\n")); @@ -358,7 +358,7 @@ command yyerror(_("`end' valid only in command `commands' or `eval'")); else { if (input_from_tty) - dbg_prompt = dgawk_prompt; + dbg_prompt = dgawk_prompt; in_commands = false; } } @@ -493,9 +493,9 @@ location break_args : /* empty */ - { $$ = NULL; } + { $$ = NULL; } | plus_integer { want_nodeval = true; } condition_exp - | func_name + | func_name | D_STRING ':' plus_integer { want_nodeval = true; } condition_exp | D_STRING ':' func_name ; @@ -631,7 +631,7 @@ subscript CMDARG *a; NODE *subs; int count = 0; - + for (a = $2; a != NULL; a = a->next) count++; subs = concat_args($2, count); @@ -641,7 +641,7 @@ subscript $2->a_node = subs; $$ = $2; } - | '[' exp_list error + | '[' exp_list error ; subscript_list @@ -675,14 +675,14 @@ node : D_NODE { $$ = $1; } | '+' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); $$ = $2; } | '-' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -705,7 +705,7 @@ opt_integer | integer { $$ = $1; } ; - + plus_integer : D_INT { @@ -720,7 +720,7 @@ plus_integer $$ = $2; } ; - + integer : D_INT { $$ = $1; } @@ -748,12 +748,12 @@ nls %% -/* append_statement --- append 'stmt' to the list of eval awk statements */ +/* append_statement --- append 'stmt' to the list of eval awk statements */ static CMDARG * -append_statement(CMDARG *stmt_list, char *stmt) +append_statement(CMDARG *stmt_list, char *stmt) { - CMDARG *a, *arg; + CMDARG *a, *arg; char *s; int len, slen, ssize; @@ -785,7 +785,7 @@ append_statement(CMDARG *stmt_list, char *stmt) s[slen] = '\0'; return arg; } - + len = strlen(stmt) + 1; /* 1 for newline */ s = stmt_list->a_string; slen = strlen(s); @@ -949,7 +949,7 @@ get_command_name(int ctype) return cmdtab[i].name; } return NULL; -} +} /* mk_cmdarg --- make an argument for command */ @@ -964,7 +964,7 @@ mk_cmdarg(enum argtype type) } /* append_cmdarg --- append ARG to the list of arguments for the current command */ - + static void append_cmdarg(CMDARG *arg) { @@ -1035,7 +1035,7 @@ yylex(void) static char *lexend; int c; char *tokstart; - size_t toklen; + size_t toklen; yylval = (CMDARG *) NULL; @@ -1049,7 +1049,7 @@ yylex(void) again: lexptr_begin = read_a_line(dbg_prompt); if (lexptr_begin == NULL) { /* EOF or error */ - if (get_eof_status() == EXIT_FATAL) + if (get_eof_status() == EXIT_FATAL) exit(EXIT_FATAL); if (get_eof_status() == EXIT_FAILURE) { static int seen_eof = 0; @@ -1081,7 +1081,7 @@ again: && input_from_tty ) history_expand_line(&lexptr_begin); - + lexptr = lexptr_begin; lexend = lexptr + strlen(lexptr); if (*lexptr == '\0' /* blank line */ @@ -1100,14 +1100,14 @@ again: } repeat_idx = -1; } - + c = *lexptr; while (c == ' ' || c == '\t') c = *++lexptr; if (! input_from_tty && c == '#') - return '\n'; + return '\n'; tokstart = lexptr; if (lexptr >= lexend) @@ -1164,7 +1164,7 @@ again: } c = *lexptr; - + if (cmdtab[cmd_idx].type == D_option) { if (c == '=') return *lexptr++; @@ -1266,8 +1266,8 @@ err: r = mpg_integer(); mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ); unref(tmp); - } - } else + } + } else #endif r = make_number(strtod(tokstart, & lexptr)); @@ -1376,7 +1376,7 @@ concat_args(CMDARG *arg, int count) n = force_string(arg->a_node); return dupnode(n); } - + emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args"); subseplen = SUBSEP_node->var_value->stlen; subsep = SUBSEP_node->var_value->stptr; @@ -1411,7 +1411,7 @@ concat_args(CMDARG *arg, int count) } /* find_command --- find the index in 'cmdtab' using exact, - * abbreviation or unique partial match + * abbreviation or unique partial match */ static int @@ -1503,10 +1503,10 @@ do_help(CMDARG *arg, int cmd) #ifdef HAVE_LIBREADLINE -/* next_word --- find the next word in a line to complete +/* next_word --- find the next word in a line to complete * (word seperation characters are space and tab). */ - + static char * next_word(char *p, int len, char **endp) { @@ -1588,10 +1588,10 @@ command_completion(const char *text, int start, int end) if (this_cmd == D_print || this_cmd == D_printf) return rl_completion_matches(text, variable_generator); return NULL; -} +} /* command_generator --- generator function for command completion */ - + static char * command_generator(const char *text, int state) { @@ -1664,7 +1664,7 @@ argument_generator(const char *text, int state) if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } - } + } return NULL; } |