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.
This commit is contained in:
Michael Snyder 2002-04-24 22:26:32 +00:00
parent 6ff9af88cb
commit 665132f945
4 changed files with 18 additions and 0 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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;

View File

@ -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.