Beginnings of template debugging tests.
[deliverable/binutils-gdb.git] / gdb / m2-exp.y
index cc4001fa984cd432d1fb21cd6ff913e4a7156be9..bbbdda48f7786253fd05ea7a0dd129cc4daaab9e 100644 (file)
@@ -1,5 +1,6 @@
 /* YACC grammar for Modula-2 expressions, for GDB.
-   Copyright (C) 1986, 1989, 1990, 1991 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994
+   Free Software Foundation, Inc.
    Generated from expread.y (now c-exp.y) and contributed by the Department
    of Computer Science at the State University of New York at Buffalo, 1991.
 
@@ -39,11 +40,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 %{
 
 #include "defs.h"
+#include <string.h>
 #include "expression.h"
 #include "language.h"
 #include "value.h"
 #include "parser-defs.h"
 #include "m2-lang.h"
+#include "bfd.h" /* Required by objfiles.h.  */
+#include "symfile.h" /* Required by objfiles.h.  */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
@@ -620,23 +625,13 @@ variable: NAME
                              struct minimal_symbol *msymbol;
                              register char *arg = copy_name ($1);
 
-                             msymbol = lookup_minimal_symbol (arg,
-                                         (struct objfile *) NULL);
+                             msymbol = lookup_minimal_symbol (arg, NULL);
                              if (msymbol != NULL)
                                {
-                                 write_exp_elt_opcode (OP_LONG);
-                                 write_exp_elt_type (builtin_type_long);
-                                 write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
-                                 write_exp_elt_opcode (OP_LONG);
-                                 write_exp_elt_opcode (UNOP_MEMVAL);
-                                 if (msymbol -> type == mst_data ||
-                                     msymbol -> type == mst_bss)
-                                   write_exp_elt_type (builtin_type_int);
-                                 else if (msymbol -> type == mst_text)
-                                   write_exp_elt_type (lookup_function_type (builtin_type_int));
-                                 else
-                                   write_exp_elt_type (builtin_type_char);
-                                 write_exp_elt_opcode (UNOP_MEMVAL);
+                                 write_exp_msymbol
+                                   (msymbol,
+                                    lookup_function_type (builtin_type_int),
+                                    builtin_type_int);
                                }
                              else if (!have_full_symbols () && !have_partial_symbols ())
                                error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
@@ -1157,13 +1152,8 @@ make_qualname(mod,ident)
 #endif  /* 0 */
 
 void
-yyerror(msg)
-     char *msg;        /* unused */
+yyerror (msg)
+     char *msg;
 {
-   printf("Parsing:  %s\n",lexptr);
-   if (yychar < 256)
-     error("Invalid syntax in expression near character '%c'.",yychar);
-   else
-     error("Invalid syntax in expression");
+  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
 }
-
This page took 0.024401 seconds and 4 git commands to generate.