2011-03-01 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / objc-exp.y
index 888bd201e4f4867df7ba21c5c8cfe36e26c56f89..3322874f221fd99a46b6fe43de2f1cf87929a9dc 100644 (file)
@@ -1,7 +1,7 @@
 /* YACC parser for C expressions, for GDB.
 
    Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 2002, 2006, 2007, 2008,
-   2009, 2010 Free Software Foundation, Inc.
+   2009, 2010, 2011 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -178,7 +178,7 @@ parse_number (char *, int, int, YYSTYPE *);
 %token <sval> STRING
 %token <sval> NSSTRING         /* ObjC Foundation "NSString" literal */
 %token <sval> SELECTOR         /* ObjC "@selector" pseudo-operator   */
-%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence.  */
 %token <tsym> TYPENAME
 %token <class> CLASSNAME       /* ObjC Class name */
 %type <sval> name
@@ -544,10 +544,12 @@ exp       :       INT
 
 exp    :       NAME_OR_INT
                        { YYSTYPE val;
-                         parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
+                         parse_number ($1.stoken.ptr,
+                                       $1.stoken.length, 0, &val);
                          write_exp_elt_opcode (OP_LONG);
                          write_exp_elt_type (val.typed_val_int.type);
-                         write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
+                         write_exp_elt_longcst ((LONGEST) 
+                                                val.typed_val_int.val);
                          write_exp_elt_opcode (OP_LONG);
                        }
        ;
@@ -624,7 +626,8 @@ block       :       BLOCKNAME
                              struct symtab *tem =
                                  lookup_symtab (copy_name ($1.stoken));
                              if (tem)
-                               $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
+                               $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem),
+                                                       STATIC_BLOCK);
                              else
                                error ("No file or function \"%s\".",
                                       copy_name ($1.stoken));
@@ -717,10 +720,13 @@ variable: qualified_name
                          msymbol = lookup_minimal_symbol (name, NULL, NULL);
                          if (msymbol != NULL)
                            write_exp_msymbol (msymbol);
-                         else if (!have_full_symbols () && !have_partial_symbols ())
-                           error ("No symbol table is loaded.  Use the \"file\" command.");
+                         else if (!have_full_symbols ()
+                                  && !have_partial_symbols ())
+                           error ("No symbol table is loaded.  "
+                                  "Use the \"file\" command.");
                          else
-                           error ("No symbol \"%s\" in current context.", name);
+                           error ("No symbol \"%s\" in current context.",
+                                  name);
                        }
        ;
 
@@ -770,7 +776,8 @@ variable:   name_not_typename
                                write_exp_msymbol (msymbol);
                              else if (!have_full_symbols () && 
                                       !have_partial_symbols ())
-                               error ("No symbol table is loaded.  Use the \"file\" command.");
+                               error ("No symbol table is loaded.  "
+                                      "Use the \"file\" command.");
                              else
                                error ("No symbol \"%s\" in current context.",
                                       copy_name ($1.stoken));
@@ -1012,26 +1019,10 @@ parse_number (p, len, parsed_float, putithere)
 
   if (parsed_float)
     {
-      char c;
-
-      /* It's a float since it contains a point or an exponent.  */
-
-      sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
-             &putithere->typed_val_float.dval, &c);
-
-      /* See if it has `f' or `l' suffix (float or long double).  */
-
-      c = tolower (p[len - 1]);
-
-      if (c == 'f')
-       putithere->typed_val_float.type = parse_type->builtin_float;
-      else if (c == 'l')
-       putithere->typed_val_float.type = parse_type->builtin_long_double;
-      else if (isdigit (c) || c == '.')
-       putithere->typed_val_float.type = parse_type->builtin_double;
-      else
+      if (! parse_c_float (parse_gdbarch, p, len,
+                          &putithere->typed_val_float.dval,
+                          &putithere->typed_val_float.type))
        return ERROR;
-
       return FLOAT;
     }
 
@@ -1136,7 +1127,8 @@ parse_number (p, len, parsed_float, putithere)
   if (long_p == 0
       && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
     {
-      high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
+      high_bit
+       = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
 
       /* A large decimal (not hex or octal) constant (between INT_MAX
         and UINT_MAX) is a long or unsigned long, according to ANSI,
@@ -1150,7 +1142,8 @@ parse_number (p, len, parsed_float, putithere)
   else if (long_p <= 1
           && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
     {
-      high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+      high_bit
+       = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
       unsigned_type = parse_type->builtin_unsigned_long;
       signed_type = parse_type->builtin_long;
     }
@@ -1347,7 +1340,8 @@ yylex ()
            hex = 1;
            local_radix = 16;
          }
-       else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
+       else if (tokchr == '0' && (p[1]=='t' || p[1]=='T'
+                                  || p[1]=='d' || p[1]=='D'))
          {
            p += 2;
            hex = 0;
This page took 0.025061 seconds and 4 git commands to generate.