Re: [RFA]Use prev_lexptr in *-exp.y

Michael Snyder
2002-04-25T18:51:04Z

Pierre Muller wrote:
>
> At 17:30 25/04/2002 , Andrew Cagney a Ã©crit:
> >>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.
> >
> >Nice. Can I suggest creating bug report so we know that the others should be done.
>
> This is more work than fixing them directly!

ROTFL! You rock, Pierre! <g>

>
> So what about that:
>
> ChangeLog entry:
>
> 2002-04-25 Pierre Muller <muller@ics.u-strasbg.fr>
> * f-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.
> * jv-exp.y: Likewise.
> * m2-exp.y: Likewise.
>
> Index: f-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/f-exp.y,v
> retrieving revision 1.5
> diff -u -p -r1.5 f-exp.y
> --- f-exp.y 6 Mar 2001 08:21:07 -0000 1.5
> +++ f-exp.y 25 Apr 2002 16:45:29 -0000
> @@ -924,7 +924,9 @@ yylex ()
> char *tokstart;
>
> retry:
> -
> +
> + prev_lexptr = lexptr;
> +
> tokstart = lexptr;
>
> /* First of all, let us make sure we are not dealing with the
> @@ -1171,5 +1173,8 @@ void
> yyerror (msg)
> char *msg;
> {
> + if (prev_lexptr)
> + lexptr = prev_lexptr;
> +
> error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
> }
> Index: jv-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/jv-exp.y,v
> retrieving revision 1.5
> diff -u -p -r1.5 jv-exp.y
> --- jv-exp.y 21 Feb 2002 02:54:46 -0000 1.5
> +++ jv-exp.y 25 Apr 2002 16:45:29 -0000
> @@ -862,6 +862,8 @@ yylex ()
>
> retry:
>
> + prev_lexptr = lexptr;
> +
> tokstart = lexptr;
> /* See if it is a special token of length 3. */
> for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
> @@ -1207,6 +1209,9 @@ void
> yyerror (msg)
> char *msg;
> {
> + if (prev_lexptr)
> + lexptr = prev_lexptr;
> +
> error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
> }
>
> Index: m2-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/m2-exp.y,v
> retrieving revision 1.3
> diff -u -p -r1.3 m2-exp.y
> --- m2-exp.y 6 Mar 2001 08:21:09 -0000 1.3
> +++ m2-exp.y 25 Apr 2002 16:45:29 -0000
> @@ -821,6 +821,8 @@ yylex ()
>
> retry:
>
> + prev_lexptr = lexptr;
> +
> tokstart = lexptr;
>
>
> @@ -1090,5 +1092,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