2000-10-27 Pierre Muller <muller@ics.u-strasbg.fr>

* p-exp.y (yylex): avoid problem with symbol name
	starting as a operator name.
This commit is contained in:
Pierre Muller 2000-12-01 10:40:10 +00:00
parent 76a0ddacc0
commit d3d6d17346
2 changed files with 27 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2000-10-27 Pierre Muller <muller@ics.u-strasbg.fr>
* p-exp.y (yylex): avoid problem with symbol name
starting as a operator name.
2000-11-30 Fernando Nasser <fnasser@redhat.com> 2000-11-30 Fernando Nasser <fnasser@redhat.com>
* linespec.h: New file. Declarations for linespec.c. * linespec.h: New file. Declarations for linespec.c.

View File

@ -942,30 +942,37 @@ yylex ()
char *uptokstart; char *uptokstart;
char *tokptr; char *tokptr;
char *p; char *p;
int tempbufindex; int explen, tempbufindex;
static char *tempbuf; static char *tempbuf;
static int tempbufsize; static int tempbufsize;
retry: retry:
tokstart = lexptr; tokstart = lexptr;
explen = strlen (lexptr);
/* See if it is a special token of length 3. */ /* See if it is a special token of length 3. */
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) if (explen > 2)
if (STREQN (tokstart, tokentab3[i].operator, 3)) for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
{ if (strnicmp (tokstart, tokentab3[i].operator, 3) == 0
lexptr += 3; && (!isalpha (tokentab3[i].operator[0]) || explen == 3
yylval.opcode = tokentab3[i].opcode; || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
return tokentab3[i].token; {
} lexptr += 3;
yylval.opcode = tokentab3[i].opcode;
return tokentab3[i].token;
}
/* See if it is a special token of length 2. */ /* See if it is a special token of length 2. */
for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) if (explen > 1)
if (STREQN (tokstart, tokentab2[i].operator, 2)) for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
{ if (strnicmp (tokstart, tokentab2[i].operator, 2) == 0
lexptr += 2; && (!isalpha (tokentab2[i].operator[0]) || explen == 2
yylval.opcode = tokentab2[i].opcode; || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
return tokentab2[i].token; {
} lexptr += 2;
yylval.opcode = tokentab2[i].opcode;
return tokentab2[i].token;
}
switch (c = *tokstart) switch (c = *tokstart)
{ {
@ -1443,4 +1450,3 @@ yyerror (msg)
{ {
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
} }