aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2004-04-10 22:10:01 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2004-04-10 22:10:01 +0000
commite85c3284f3920865d80242a740dc7c4803f59840 (patch)
tree6cb88f9ce7d0dd87c820e56f5fda8556e71ff510 /gdb/parse.c
parentfa34704a3086195fd51896b69100c19ceccb549c (diff)
downloadgdb-e85c3284f3920865d80242a740dc7c4803f59840.zip
gdb-e85c3284f3920865d80242a740dc7c4803f59840.tar.gz
gdb-e85c3284f3920865d80242a740dc7c4803f59840.tar.bz2
* language.h (language_defn): Add new la_post_parser field.
* parser-defs.h (null_post_parser): New declaration (default for la_post_parser). * parse.c (parse_exp_1): Move code to parse_exp_in_context and insert call to that function. (parse_exp_in_context): New function, including code formerly in parse_exp_1. Calls language-dependent post-parser after prefixification. (parse_expression_in_context): New exported function. (null_post_parser): New definition. * expression.h (parse_expression_in_context): Add declaration. * p-lang.c (pascal_language_defn): Add trivial post-parser. * c-lang.c (c_language_defn): Ditto. (cplus_language_defn): Ditto. (asm_language_defn): Ditto. (minimal_language_defn): Ditto. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * language.c (unknown_language_defn): Ditto. (auto_language_defn): Ditto. (local_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * scm-lang.c (scm_language_defn): Ditto. * obj-lang.c (objc_language_defn): Ditto.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 3bf06b9..4af6d7c 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -102,6 +102,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
@@ -1021,6 +1024,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;
@@ -1076,6 +1089,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);
@@ -1095,6 +1110,28 @@ 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 */
+
+/* ARGSUSED */
+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". */