mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
gdb: merge error handling from different expression parsers
Many (all?) of the expression parsers implement yyerror to handle parser errors, and all of these functions are basically identical. This commit adds a new parser_state::parse_error() function, which implements the common error handling code, this function can then be called from all the different yyerror functions. The benefit of this is that (in a future commit) I can improve the error output, and all the expression parsers will benefit. This commit is pure refactoring though, and so, there should be no user visible changes after this commit. Approved-By: John Baldwin <jhb@FreeBSD.org>
This commit is contained in:
11
gdb/parse.c
11
gdb/parse.c
@@ -244,6 +244,17 @@ parser_state::push_dollar (struct stoken str)
|
||||
(create_internalvar (copy.c_str () + 1));
|
||||
}
|
||||
|
||||
/* See parser-defs.h. */
|
||||
|
||||
void
|
||||
parser_state::parse_error (const char *msg)
|
||||
{
|
||||
if (this->prev_lexptr)
|
||||
this->lexptr = this->prev_lexptr;
|
||||
|
||||
error (_("A %s in expression, near `%s'."), msg, this->lexptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
|
||||
Reference in New Issue
Block a user