aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2000-12-01 10:40:10 +0000
committerPierre Muller <muller@sourceware.org>2000-12-01 10:40:10 +0000
commitd3d6d17346f2f8667b8d8539bdb8a21bb5d03b72 (patch)
tree791f427f15e08d124866600f209b2b4f4e6510ed
parent76a0ddacc00c5345b7eb4bcb88fa8fdb63ea7248 (diff)
downloadfsf-binutils-gdb-d3d6d17346f2f8667b8d8539bdb8a21bb5d03b72.zip
fsf-binutils-gdb-d3d6d17346f2f8667b8d8539bdb8a21bb5d03b72.tar.gz
fsf-binutils-gdb-d3d6d17346f2f8667b8d8539bdb8a21bb5d03b72.tar.bz2
2000-10-27 Pierre Muller <muller@ics.u-strasbg.fr>
* p-exp.y (yylex): avoid problem with symbol name starting as a operator name.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/p-exp.y38
2 files changed, 27 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d52df9c..bd27d38 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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>
* linespec.h: New file. Declarations for linespec.c.
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index fa2aef0..8cde6d5 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -942,30 +942,37 @@ yylex ()
char *uptokstart;
char *tokptr;
char *p;
- int tempbufindex;
+ int explen, tempbufindex;
static char *tempbuf;
static int tempbufsize;
retry:
tokstart = lexptr;
+ explen = strlen (lexptr);
/* See if it is a special token of length 3. */
- for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (STREQN (tokstart, tokentab3[i].operator, 3))
- {
- lexptr += 3;
- yylval.opcode = tokentab3[i].opcode;
- return tokentab3[i].token;
- }
+ if (explen > 2)
+ for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
+ if (strnicmp (tokstart, tokentab3[i].operator, 3) == 0
+ && (!isalpha (tokentab3[i].operator[0]) || explen == 3
+ || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
+ {
+ lexptr += 3;
+ yylval.opcode = tokentab3[i].opcode;
+ return tokentab3[i].token;
+ }
/* See if it is a special token of length 2. */
- for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (STREQN (tokstart, tokentab2[i].operator, 2))
- {
- lexptr += 2;
- yylval.opcode = tokentab2[i].opcode;
- return tokentab2[i].token;
- }
+ if (explen > 1)
+ for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
+ if (strnicmp (tokstart, tokentab2[i].operator, 2) == 0
+ && (!isalpha (tokentab2[i].operator[0]) || explen == 2
+ || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
+ {
+ lexptr += 2;
+ yylval.opcode = tokentab2[i].opcode;
+ return tokentab2[i].token;
+ }
switch (c = *tokstart)
{
@@ -1443,4 +1450,3 @@ yyerror (msg)
{
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
}
-