summaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c58
1 files changed, 47 insertions, 11 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 374e88ed85d..61d28f70663 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -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;
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;
@@ -1023,6 +1026,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;
lexptr = *stringptr;
@@ -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)
+{
+}
/* Stuff for maintaining a stack of types. Currently just used by C, but
probably useful for any language which declares its types "backwards". */
@@ -1298,11 +1334,11 @@ _initialize_parse (void)
DEPRECATED_REGISTER_GDBARCH_SWAP (msym_unknown_symbol_type);
deprecated_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_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);
}