* Makefile.in (symfile.o): Add gdb-stabs.h to dependencies list.
[deliverable/binutils-gdb.git] / gdb / p-exp.y
index fa2aef02a8f66f672a7591b03ee8087990d60342..edf34ca7a583f6d3cb9cffc8880acf284cfd054a 100644 (file)
@@ -58,6 +58,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 
+/* MSVC uses strnicmp instead of strncasecmp */
+#ifdef _MSC_VER
+#define strncasecmp strnicmp
+#endif
+
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
    yacc generated parsers in gdb.  Note that these are only the variables
@@ -942,30 +947,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 (strncasecmp (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 (strncasecmp (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 +1455,3 @@ yyerror (msg)
 {
   error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
 }
-
This page took 0.0245109999999999 seconds and 4 git commands to generate.