[PATCH]Use prev_lexptr in p-exp.y

Pierre Muller
2002-04-25T15:06:09Z

This basically just adds the same functionality
than in the c language parser.
See
http://sources.redhat.com/ml/gdb-patches/2002-04/msg00467.html

ChangeLog entry:

2002-04-25 Pierre Muller <muller@ics.u-strasbg.fr>

* p-exp.y: Also use new prev_lexptr variable
to improve error reporting. Based on Michael Snyder
2002-04-24 dated patch to c-exp.y.

Index: p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.9
diff -u -p -r1.9 p-exp.y
--- p-exp.y 18 Apr 2002 15:22:18 -0000 1.9
+++ p-exp.y 25 Apr 2002 08:38:29 -0000
@@ -947,6 +947,8 @@ yylex ()

retry:

+ prev_lexptr = lexptr;
+
tokstart = lexptr;
explen = strlen (lexptr);
/* See if it is a special token of length 3. */
@@ -1481,5 +1483,8 @@ void
yyerror (msg)
char *msg;
{
+ if (prev_lexptr)
+ lexptr = prev_lexptr;
+
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
}

Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99