* symtab.h (lookup_symbol_in_language): Remove SYMTAB parameter.
[deliverable/binutils-gdb.git] / gdb / f-exp.y
index 4e1f6359e2ec84e2e580c21e0e349d3925c10c48..121b2472833a6eb7bcd592a48c1c65018d00c9e8 100644 (file)
@@ -1,6 +1,6 @@
 /* YACC parser for Fortran expressions, for GDB.
-   Copyright 1986, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 2000, 2001,
-   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 2000, 2001,
+   2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    Contributed by Motorola.  Adapted from the C parser by Farooq Butt
    (fmbutt@engage.sps.mot.com).
@@ -19,7 +19,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* This was blantantly ripped off the C expression parser, please 
    be aware of that as you look at its basic structure -FMB */ 
@@ -177,6 +178,7 @@ static int parse_number (char *, int, int, YYSTYPE *);
 %token <lval> BOOLEAN_LITERAL
 %token <ssym> NAME 
 %token <tsym> TYPENAME
+%type <sval> name
 %type <ssym> name_not_typename
 
 /* A NAME_OR_INT is a symbol which is not known in the symbol table,
@@ -216,8 +218,9 @@ static int parse_number (char *, int, int, YYSTYPE *);
 %left LSH RSH
 %left '@'
 %left '+' '-'
-%left '*' '/' '%'
+%left '*' '/'
 %right STARSTAR
+%right '%'
 %right UNARY 
 %right '('
 
@@ -331,6 +334,12 @@ exp        :       '(' type ')' exp  %prec UNARY
                          write_exp_elt_opcode (UNOP_CAST); }
        ;
 
+exp     :       exp '%' name
+                        { write_exp_elt_opcode (STRUCTOP_STRUCT);
+                          write_exp_string ($3);
+                          write_exp_elt_opcode (STRUCTOP_STRUCT); }
+        ;
+
 /* Binary operators in order of decreasing precedence.  */
 
 exp    :       exp '@' exp
@@ -349,10 +358,6 @@ exp        :       exp '/' exp
                        { write_exp_elt_opcode (BINOP_DIV); }
        ;
 
-exp    :       exp '%' exp
-                       { write_exp_elt_opcode (BINOP_REM); }
-       ;
-
 exp    :       exp '+' exp
                        { write_exp_elt_opcode (BINOP_ADD); }
        ;
@@ -634,6 +639,10 @@ nonempty_typelist
                }
        ;
 
+name   :       NAME
+               {  $$ = $1.stoken; }
+       ;
+
 name_not_typename :    NAME
 /* These would be useful if name_not_typename was useful, but it is just
    a fake for "variable", so these cause reduce/reduce conflicts because
@@ -757,23 +766,24 @@ parse_number (p, len, parsed_float, putithere)
      target int size is different to the target long size.
      
      In the expression below, we could have tested
-     (n >> TARGET_INT_BIT)
+     (n >> gdbarch_int_bit (current_gdbarch))
      to see if it was zero,
      but too many compilers warn about that, when ints and longs
      are the same size.  So we shift it twice, with fewer bits
      each time, for the same result.  */
   
-  if ((TARGET_INT_BIT != TARGET_LONG_BIT 
-       && ((n >> 2) >> (TARGET_INT_BIT-2)))   /* Avoid shift warning */
+  if ((gdbarch_int_bit (current_gdbarch) != gdbarch_long_bit (current_gdbarch)
+       && ((n >> 2)
+          >> (gdbarch_int_bit (current_gdbarch)-2))) /* Avoid shift warning */
       || long_p)
     {
-      high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
+      high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch)-1);
       unsigned_type = builtin_type_unsigned_long;
       signed_type = builtin_type_long;
     }
   else 
     {
-      high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
+      high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch)-1);
       unsigned_type = builtin_type_unsigned_int;
       signed_type = builtin_type_int;
     }    
@@ -1165,8 +1175,7 @@ yylex ()
     sym = lookup_symbol (tmp, expression_context_block,
                         VAR_DOMAIN,
                         current_language->la_language == language_cplus
-                        ? &is_a_field_of_this : NULL,
-                        NULL);
+                        ? &is_a_field_of_this : NULL);
     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
       {
        yylval.tsym.type = SYMBOL_TYPE (sym);
This page took 0.048243 seconds and 4 git commands to generate.