gdbarch: add instruction predicate methods
[deliverable/binutils-gdb.git] / gdb / f-exp.y
index 8e941749f675b1d1788e41dce4c20679b76ac24c..7a94b15b5a334b1ac5dd5570bec9c322cbabb3d1 100644 (file)
@@ -1,6 +1,5 @@
 /* YACC parser for Fortran expressions, for GDB.
-   Copyright (C) 1986, 1989-1991, 1993-1996, 2000-2012 Free Software
-   Foundation, Inc.
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
 
    Contributed by Motorola.  Adapted from the C parser by Farooq Butt
    (fmbutt@engage.sps.mot.com).
@@ -43,7 +42,7 @@
 %{
 
 #include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
 #include "expression.h"
 #include "value.h"
 #include "parser-defs.h"
@@ -158,7 +157,7 @@ static int match_string_literal (void);
 
 %{
 /* YYSTYPE gets defined by %union */
-static int parse_number (char *, int, int, YYSTYPE *);
+static int parse_number (const char *, int, int, YYSTYPE *);
 %}
 
 %type <voidval> exp  type_exp start variable 
@@ -514,12 +513,12 @@ variable: name_not_typename
                            }
                          else
                            {
-                             struct minimal_symbol *msymbol;
+                             struct bound_minimal_symbol msymbol;
                              char *arg = copy_name ($1.stoken);
 
                              msymbol =
-                               lookup_minimal_symbol (arg, NULL, NULL);
-                             if (msymbol != NULL)
+                               lookup_bound_minimal_symbol (arg);
+                             if (msymbol.minsym != NULL)
                                write_exp_msymbol (msymbol);
                              else if (!have_full_symbols () && !have_partial_symbols ())
                                error (_("No symbol table is loaded.  Use the \"file\" command."));
@@ -670,7 +669,7 @@ name_not_typename : NAME
 /*** Needs some error checking for the float case ***/
 
 static int
-parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
+parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
 {
   LONGEST n = 0;
   LONGEST prevn = 0;
@@ -921,7 +920,7 @@ growbuf_by_size (int count)
 static int
 match_string_literal (void)
 {
-  char *tokptr = lexptr;
+  const char *tokptr = lexptr;
 
   for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
     {
@@ -956,7 +955,7 @@ yylex (void)
   int c;
   int namelen;
   unsigned int i,token;
-  char *tokstart;
+  const char *tokstart;
   
  retry:
  
@@ -1055,7 +1054,7 @@ yylex (void)
       {
         /* It's a number.  */
        int got_dot = 0, got_e = 0, got_d = 0, toktype;
-       char *p = tokstart;
+       const char *p = tokstart;
        int hex = input_radix > 10;
        
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
@@ -1176,21 +1175,35 @@ yylex (void)
     char *tmp = copy_name (yylval.sval);
     struct symbol *sym;
     struct field_of_this_result is_a_field_of_this;
+    enum domain_enum_tag lookup_domains[] =
+    {
+      STRUCT_DOMAIN,
+      VAR_DOMAIN,
+      MODULE_DOMAIN
+    };
+    int i;
     int hextype;
-    
-    /* Initialize this in case we *don't* use it in this call; that
-       way we can refer to it unconditionally below.  */
-    memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
-
-    sym = lookup_symbol (tmp, expression_context_block,
-                        VAR_DOMAIN,
-                        parse_language->la_language == language_cplus
-                        ? &is_a_field_of_this : NULL);
-    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+
+    for (i = 0; i < ARRAY_SIZE (lookup_domains); ++i)
       {
-       yylval.tsym.type = SYMBOL_TYPE (sym);
-       return TYPENAME;
+       /* Initialize this in case we *don't* use it in this call; that
+          way we can refer to it unconditionally below.  */
+       memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
+
+       sym = lookup_symbol (tmp, expression_context_block,
+                            lookup_domains[i],
+                            parse_language->la_language == language_cplus
+                            ? &is_a_field_of_this : NULL);
+       if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+         {
+           yylval.tsym.type = SYMBOL_TYPE (sym);
+           return TYPENAME;
+         }
+
+       if (sym)
+         break;
       }
+
     yylval.tsym.type
       = language_lookup_primitive_type_by_name (parse_language,
                                                parse_gdbarch, tmp);
This page took 0.025268 seconds and 4 git commands to generate.