From e89496f42ac7b2d6fbba15f98f3caf496de050f4 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 2 Jan 2024 14:02:44 +0000 Subject: 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 --- gdb/f-exp.y | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gdb/f-exp.y') diff --git a/gdb/f-exp.y b/gdb/f-exp.y index e4e2171..88a95bc 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1736,8 +1736,5 @@ f_language::parser (struct parser_state *par_state) const static void yyerror (const char *msg) { - if (pstate->prev_lexptr) - pstate->lexptr = pstate->prev_lexptr; - - error (_("A %s in expression, near `%s'."), msg, pstate->lexptr); + pstate->parse_error (msg); } -- cgit v1.1