aboutsummaryrefslogtreecommitdiff
path: root/gdb/m2-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/m2-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/m2-exp.y')
-rw-r--r--gdb/m2-exp.y5
1 files changed, 1 insertions, 4 deletions
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 092a8be..9a8767f 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -1006,8 +1006,5 @@ m2_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);
}