Remove `expout*' globals from parser-defs.h
[deliverable/binutils-gdb.git] / gdb / ada-lex.l
index 0787a0f30a8db8f5bdfc0c79a9828359c0bc9d2c..963207384424e57bdd4f27b057599d0b746573d5 100644 (file)
@@ -48,8 +48,9 @@ POSEXP  (e"+"?{NUM10})
 static char numbuf[NUMERAL_WIDTH];
  static void canonicalizeNumeral (char *s1, const char *);
 static struct stoken processString (const char*, int);
-static int processInt (const char *, const char *, const char *);
-static int processReal (const char *);
+static int processInt (struct parser_state *, const char *, const char *,
+                      const char *);
+static int processReal (struct parser_state *, const char *);
 static struct stoken processId (const char *, int);
 static int processAttribute (const char *);
 static int find_dot_all (const char *);
@@ -89,40 +90,42 @@ static int find_dot_all (const char *);
 
 {NUM10}{POSEXP}  {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
+                  return processInt (pstate, NULL, numbuf,
+                                     strrchr (numbuf, 'e') + 1);
                 }
 
 {NUM10}          {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processInt (NULL, numbuf, NULL);
+                  return processInt (pstate, NULL, numbuf, NULL);
                 }
 
 {NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processInt (numbuf,
+                  return processInt (pstate, numbuf,
                                      strchr (numbuf, '#') + 1,
                                      strrchr(numbuf, '#') + 1);
                 }
 
 {NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#" {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
+                  return processInt (pstate, numbuf, strchr (numbuf, '#') + 1,
+                                     NULL);
                 }
 
 "0x"{HEXDIG}+  {
                  canonicalizeNumeral (numbuf, yytext+2);
-                 return processInt ("16#", numbuf, NULL);
+                 return processInt (pstate, "16#", numbuf, NULL);
                }
 
 
 {NUM10}"."{NUM10}{EXP} {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processReal (numbuf);
+                  return processReal (pstate, numbuf);
                }
 
 {NUM10}"."{NUM10} {
                   canonicalizeNumeral (numbuf, yytext);
-                  return processReal (numbuf);
+                  return processReal (pstate, numbuf);
                }
 
 {NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
@@ -134,14 +137,14 @@ static int find_dot_all (const char *);
                }
 
 <INITIAL>"'"({GRAPHIC}|\")"'" {
-                  yylval.typed_val.type = type_char ();
+                  yylval.typed_val.type = type_char (pstate);
                   yylval.typed_val.val = yytext[1];
                   return CHARLIT;
                }
 
 <INITIAL>"'[\""{HEXDIG}{2}"\"]'"   {
                    int v;
-                   yylval.typed_val.type = type_char ();
+                   yylval.typed_val.type = type_char (pstate);
                   sscanf (yytext+3, "%2x", &v);
                   yylval.typed_val.val = v;
                   return CHARLIT;
@@ -324,7 +327,8 @@ canonicalizeNumeral (char *s1, const char *s2)
  */
 
 static int
-processInt (const char *base0, const char *num0, const char *exp0)
+processInt (struct parser_state *par_state, const char *base0,
+           const char *num0, const char *exp0)
 {
   ULONGEST result;
   long exp;
@@ -360,11 +364,11 @@ processInt (const char *base0, const char *num0, const char *exp0)
       exp -= 1;
     }
 
-  if ((result >> (gdbarch_int_bit (parse_gdbarch)-1)) == 0)
-    yylval.typed_val.type = type_int ();
-  else if ((result >> (gdbarch_long_bit (parse_gdbarch)-1)) == 0)
-    yylval.typed_val.type = type_long ();
-  else if (((result >> (gdbarch_long_bit (parse_gdbarch)-1)) >> 1) == 0)
+  if ((result >> (gdbarch_int_bit (parse_gdbarch (par_state))-1)) == 0)
+    yylval.typed_val.type = type_int (par_state);
+  else if ((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) == 0)
+    yylval.typed_val.type = type_long (par_state);
+  else if (((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) >> 1) == 0)
     {
       /* We have a number representable as an unsigned integer quantity.
          For consistency with the C treatment, we will treat it as an
@@ -374,7 +378,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
          assignment does the trick (no, it doesn't; read the reference manual).
        */
       yylval.typed_val.type
-       = builtin_type (parse_gdbarch)->builtin_unsigned_long;
+       = builtin_type (parse_gdbarch (par_state))->builtin_unsigned_long;
       if (result & LONGEST_SIGN)
        yylval.typed_val.val =
          (LONGEST) (result & ~LONGEST_SIGN)
@@ -384,24 +388,24 @@ processInt (const char *base0, const char *num0, const char *exp0)
       return INT;
     }
   else
-    yylval.typed_val.type = type_long_long ();
+    yylval.typed_val.type = type_long_long (par_state);
 
   yylval.typed_val.val = (LONGEST) result;
   return INT;
 }
 
 static int
-processReal (const char *num0)
+processReal (struct parser_state *par_state, const char *num0)
 {
   sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
 
-  yylval.typed_val_float.type = type_float ();
-  if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch)
+  yylval.typed_val_float.type = type_float (par_state);
+  if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch (par_state))
                            / TARGET_CHAR_BIT)
-    yylval.typed_val_float.type = type_double ();
-  if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch)
+    yylval.typed_val_float.type = type_double (par_state);
+  if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch (par_state))
                            / TARGET_CHAR_BIT)
-    yylval.typed_val_float.type = type_long_double ();
+    yylval.typed_val_float.type = type_long_double (par_state);
 
   return FLOAT;
 }
This page took 0.03922 seconds and 4 git commands to generate.