diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/c-exp.y | 4 | ||||
-rw-r--r-- | gdb/parse.c | 2 | ||||
-rw-r--r-- | gdb/parser-defs.h | 4 |
4 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 534418e..ce31b8e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-04-24 Michael Snyder <msnyder@redhat.com> + + * parser-defs.h (prev_lexptr): New external variable. + * parse.c (parse_exp_1): Set prev_lexptr to null before + calling the language-specific parser. + * c-exp.y (yylex): Set prev_lexptr to start of current token. + (yyerror): Use prev_lexptr in error reporting. + 2002-04-24 Daniel Jacobowitz <drow@mvista.com> * config/i386/tm-linux.h: Define FILL_FPXREGSET. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 0ccac03..a15a445 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1246,6 +1246,7 @@ yylex () retry: + prev_lexptr = lexptr; unquoted_expr = 1; tokstart = lexptr; @@ -1766,5 +1767,8 @@ void yyerror (msg) char *msg; { + if (prev_lexptr) + lexptr = prev_lexptr; + error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); } diff --git a/gdb/parse.c b/gdb/parse.c index 1a1003b..9c1f3e1 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -76,6 +76,7 @@ int arglist_len; union type_stack_elt *type_stack; int type_stack_depth, type_stack_size; char *lexptr; +char *prev_lexptr; char *namecopy; int paren_depth; int comma_terminates; @@ -1126,6 +1127,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma) struct cleanup *old_chain; lexptr = *stringptr; + prev_lexptr = NULL; paren_depth = 0; type_stack_depth = 0; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 5b2e47b..ece2849 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -150,6 +150,10 @@ extern struct type *follow_types (struct type *); extern char *lexptr; +/* After a token has been recognized, this variable points to it. + Currently used only for error reporting. */ +extern char *prev_lexptr; + /* Tokens that refer to names do so with explicit pointer and length, so they can share the storage that lexptr is parsing. |