aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-01-02 14:02:44 +0000
committerAndrew Burgess <aburgess@redhat.com>2024-01-04 09:24:18 +0000
commite89496f42ac7b2d6fbba15f98f3caf496de050f4 (patch)
tree0e411dc7a998c3a56e25bba1adde8ad2642d4122 /gdb/f-exp.y
parentc9f1e0dfc8f02a7772aa383cc305d9049075d1d8 (diff)
downloadgdb-e89496f42ac7b2d6fbba15f98f3caf496de050f4.zip
gdb-e89496f42ac7b2d6fbba15f98f3caf496de050f4.tar.gz
gdb-e89496f42ac7b2d6fbba15f98f3caf496de050f4.tar.bz2
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>
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y5
1 files changed, 1 insertions, 4 deletions
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);
}