2004-11-08 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / parse.c
index da39866f759ea3f85379f948699906f77a7affdd..61d28f706635fd8b65e0378c4ba44145f35c4c13 100644 (file)
@@ -1,6 +1,8 @@
 /* Parse expressions for GDB.
-   Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+   Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
 
@@ -95,8 +97,6 @@ int comma_terminates;
 \f
 static int expressiondebug = 0;
 
-extern int hp_som_som_object_present;
-
 static void free_funcalls (void *ignore);
 
 static void prefixify_expression (struct expression *);
@@ -104,6 +104,9 @@ static void prefixify_expression (struct expression *);
 static void prefixify_subexp (struct expression *, struct expression *, int,
                              int);
 
+static struct expression *parse_exp_in_context (char **, struct block *, int, 
+                                               int);
+
 void _initialize_parse (void);
 
 /* Data structure for saving values of arglist_len for function calls whose
@@ -590,7 +593,7 @@ parse_nested_classes_for_hpacc (char *name, int len, char **token,
      return NULL, and caller must default to standard GDB
      behaviour. */
 
-  if (!hp_som_som_object_present)
+  if (!deprecated_hp_som_som_object_present)
     return (struct symbol *) NULL;
 
   p = name;
@@ -1022,6 +1025,16 @@ prefixify_subexp (struct expression *inexpr,
 
 struct expression *
 parse_exp_1 (char **stringptr, struct block *block, int comma)
+{
+  return parse_exp_in_context (stringptr, block, comma, 0);
+}
+
+/* As for parse_exp_1, except that if VOID_CONTEXT_P, then
+   no value is expected from the expression.  */
+
+static struct expression *
+parse_exp_in_context (char **stringptr, struct block *block, int comma, 
+                     int void_context_p)
 {
   struct cleanup *old_chain;
 
@@ -1078,6 +1091,8 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
 
   prefixify_expression (expout);
 
+  current_language->la_post_parser (&expout, void_context_p);
+
   if (expressiondebug)
     dump_prefix_expression (expout, gdb_stdlog);
 
@@ -1097,6 +1112,27 @@ parse_expression (char *string)
     error ("Junk after end of expression.");
   return exp;
 }
+
+
+/* As for parse_expression, except that if VOID_CONTEXT_P, then
+   no value is expected from the expression.  */
+
+struct expression *
+parse_expression_in_context (char *string, int void_context_p)
+{
+  struct expression *exp;
+  exp = parse_exp_in_context (&string, 0, 0, void_context_p);
+  if (*string != '\000')
+    error ("Junk after end of expression.");
+  return exp;
+}
+
+/* A post-parser that does nothing */
+
+void
+null_post_parser (struct expression **exp, int void_context_p)
+{
+}
 \f
 /* Stuff for maintaining a stack of types.  Currently just used by C, but
    probably useful for any language which declares its types "backwards".  */
@@ -1293,17 +1329,16 @@ _initialize_parse (void)
   /* FIXME - For the moment, handle types by swapping them in and out.
      Should be using the per-architecture data-pointer and a large
      struct. */
-  register_gdbarch_swap (&msym_text_symbol_type, sizeof (msym_text_symbol_type), NULL);
-  register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL);
-  register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL);
-
-  register_gdbarch_swap (NULL, 0, build_parse);
-
-  add_show_from_set (
-           add_set_cmd ("expression", class_maintenance, var_zinteger,
-                        (char *) &expressiondebug,
-                        "Set expression debugging.\n\
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_text_symbol_type);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_data_symbol_type);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_unknown_symbol_type);
+  deprecated_register_gdbarch_swap (NULL, 0, build_parse);
+
+  deprecated_add_show_from_set
+    (add_set_cmd ("expression", class_maintenance, var_zinteger,
+                 (char *) &expressiondebug,
+                 "Set expression debugging.\n\
 When non-zero, the internal representation of expressions will be printed.",
-                        &setdebuglist),
-                     &showdebuglist);
+                 &setdebuglist),
+     &showdebuglist);
 }
This page took 0.045656 seconds and 4 git commands to generate.