Fix type of not saved registers.
[deliverable/binutils-gdb.git] / gdb / ada-lex.l
index f198ea790c5e41323027edc2b13fe1059dddc879..3c30043323c6f9afa1a891e97dd4c3dc63411294 100644 (file)
@@ -1,6 +1,5 @@
 /* FLEX lexer for Ada expressions, for GDB.
-   Copyright (C) 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2007, 2008, 2009,
-   2010 Free Software Foundation, Inc.
+   Copyright (C) 1994-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -54,6 +53,7 @@ static int processReal (const char *);
 static struct stoken processId (const char *, int);
 static int processAttribute (const char *);
 static int find_dot_all (const char *);
+static void rewind_to_char (int);
 
 #undef YY_DECL
 #define YY_DECL static int yylex ( void )
@@ -158,18 +158,19 @@ static int find_dot_all (const char *);
 
 
 if             {
-                 while (*lexptr != 'i' && *lexptr != 'I')
-                   lexptr -= 1;
-                 yyrestart(NULL);
+                  rewind_to_char ('i');
                  return 0;
                }
 
-(task|thread)  {
+task            {
+                  rewind_to_char ('t');
+                 return 0;
+               }
+
+thread{WHITE}+{DIG} {
                   /* This keyword signals the end of the expression and
                      will be processed separately.  */
-                 while (*lexptr != 't' && *lexptr != 'T')
-                   lexptr--;
-                 yyrestart(NULL);
+                  rewind_to_char ('t');
                  return 0;
                }
 
@@ -219,8 +220,7 @@ false               { return FALSEKEYWORD; }
 
 ","            { if (paren_depth == 0 && comma_terminates)
                    {
-                     lexptr -= 1;
-                     yyrestart(NULL);
+                     rewind_to_char (',');
                      return 0;
                    }
                  else
@@ -230,8 +230,7 @@ false               { return FALSEKEYWORD; }
 "("            { paren_depth += 1; return '('; }
 ")"            { if (paren_depth == 0)
                    {
-                     lexptr -= 1;
-                     yyrestart(NULL);
+                     rewind_to_char (')');
                      return 0;
                    }
                  else
@@ -289,11 +288,11 @@ false             { return FALSEKEYWORD; }
 %%
 
 #include <ctype.h>
-#include "gdb_string.h"
+#include <string.h>
 
 /* Initialize the lexer for processing new expression. */
 
-void
+static void
 lexer_init (FILE *inp)
 {
   BEGIN INITIAL;
@@ -330,8 +329,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
   ULONGEST result;
   long exp;
   int base;
-
-  char *trailer;
+  const char *trailer;
 
   if (base0 == NULL)
     base = 10;
@@ -348,7 +346,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
     exp = strtol(exp0, (char **) NULL, 10);
 
   errno = 0;
-  result = strtoulst (num0, (const char **) &trailer, base);
+  result = strtoulst (num0, &trailer, base);
   if (errno == ERANGE)
     error (_("Integer literal out of range"));
   if (isxdigit(*trailer))
@@ -410,7 +408,9 @@ processReal (const char *num0)
 
 
 /* Store a canonicalized version of NAME0[0..LEN-1] in yylval.ssym.  The
-   resulting string is valid until the next call to ada_parse.  It differs
+   resulting string is valid until the next call to ada_parse.  If
+   NAME0 contains the substring "___", it is assumed to be already
+   encoded and the resulting name is equal to it.  Otherwise, it differs
    from NAME0 in that:
     + Characters between '...' or <...> are transfered verbatim to 
       yylval.ssym.
@@ -430,8 +430,18 @@ processId (const char *name0, int len)
   int i0, i;
   struct stoken result;
 
+  result.ptr = name;
   while (len > 0 && isspace (name0[len-1]))
     len -= 1;
+
+  if (strstr (name0, "___") != NULL)
+    {
+      strncpy (name, name0, len);
+      name[len] = '\000';
+      result.length = len;
+      return result;
+    }
+
   i = i0 = 0;
   while (i0 < len)
     {
@@ -471,7 +481,6 @@ processId (const char *name0, int len)
     }
   name[i] = '\000';
 
-  result.ptr = name;
   result.length = i;
   return result;
 }
@@ -488,7 +497,8 @@ processString (const char *text, int len)
   const char *lim = text + len;
   struct stoken result;
 
-  q = result.ptr = obstack_alloc (&temp_parse_space, len);
+  q = obstack_alloc (&temp_parse_space, len);
+  result.ptr = q;
   p = text;
   while (p < lim)
     {
@@ -606,6 +616,23 @@ processAttribute (const char *str)
   return attributes[k].code;
 }
 
+/* Back up lexptr by yyleng and then to the rightmost occurrence of
+   character CH, case-folded (there must be one).  WARNING: since
+   lexptr points to the next input character that Flex has not yet
+   transferred to its internal buffer, the use of this function
+   depends on the assumption that Flex calls YY_INPUT only when it is
+   logically necessary to do so (thus, there is no reading ahead
+   farther than needed to identify the next token.)  */
+
+static void
+rewind_to_char (int ch)
+{
+  lexptr -= yyleng;
+  while (toupper (*lexptr) != toupper (ch))
+    lexptr -= 1;
+  yyrestart (NULL);
+}
+
 int
 yywrap(void)
 {
This page took 0.029619 seconds and 4 git commands to generate.