aboutsummaryrefslogtreecommitdiff
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
parentfa34704a3086195fd51896b69100c19ceccb549c (diff)
downloadfsf-binutils-gdb-e85c3284f3920865d80242a740dc7c4803f59840.zip
fsf-binutils-gdb-e85c3284f3920865d80242a740dc7c4803f59840.tar.gz
fsf-binutils-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.
-rw-r--r--gdb/ChangeLog29
-rw-r--r--gdb/c-lang.c4
-rw-r--r--gdb/expression.h2
-rw-r--r--gdb/f-lang.c1
-rw-r--r--gdb/jv-lang.c1
-rw-r--r--gdb/language.c3
-rw-r--r--gdb/language.h8
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/objc-lang.c1
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/parse.c37
-rw-r--r--gdb/parser-defs.h2
-rw-r--r--gdb/scm-lang.c1
13 files changed, 91 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 02f04a6..d783729 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,32 @@
+2004-03-10 Paul N. Hilfinger <Hilfinger@gnat.com>
+
+ * 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.
+
2004-04-10 Mark Kettenis <kettenis@gnu.org>
* amd64nbsd-tdep.c (amd64nbsd_sigcontext_addr): Remove function.
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index ba34540..3b52890 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -546,6 +546,7 @@ const struct language_defn c_language_defn =
&exp_descriptor_standard,
c_preprocess_and_parse,
c_error,
+ null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
@@ -604,6 +605,7 @@ const struct language_defn cplus_language_defn =
&exp_descriptor_standard,
c_preprocess_and_parse,
c_error,
+ null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
@@ -639,6 +641,7 @@ const struct language_defn asm_language_defn =
&exp_descriptor_standard,
c_preprocess_and_parse,
c_error,
+ null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
@@ -679,6 +682,7 @@ const struct language_defn minimal_language_defn =
&exp_descriptor_standard,
c_preprocess_and_parse,
c_error,
+ null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
diff --git a/gdb/expression.h b/gdb/expression.h
index 03b45c2..2b09716 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -378,6 +378,8 @@ struct expression
extern struct expression *parse_expression (char *);
+extern struct expression *parse_expression_in_context (char *, int);
+
extern struct expression *parse_exp_1 (char **, struct block *, int);
/* The innermost context required by the stack and register variables
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 1e7cd45..0e30c70 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -465,6 +465,7 @@ const struct language_defn f_language_defn =
&exp_descriptor_standard,
f_parse, /* parser */
f_error, /* parser error function */
+ null_post_parser,
f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
f_emit_char, /* Function to print a single character */
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 6db6e88..e840191 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -1036,6 +1036,7 @@ const struct language_defn java_language_defn =
&exp_descriptor_java,
java_parse,
java_error,
+ null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
java_emit_char, /* Function to print a single character */
diff --git a/gdb/language.c b/gdb/language.c
index bc00b47..b4d38ea 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1279,6 +1279,7 @@ const struct language_defn unknown_language_defn =
&exp_descriptor_standard,
unk_lang_parser,
unk_lang_error,
+ null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
unk_lang_emit_char,
@@ -1315,6 +1316,7 @@ const struct language_defn auto_language_defn =
&exp_descriptor_standard,
unk_lang_parser,
unk_lang_error,
+ null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
unk_lang_emit_char,
@@ -1350,6 +1352,7 @@ const struct language_defn local_language_defn =
&exp_descriptor_standard,
unk_lang_parser,
unk_lang_error,
+ null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
unk_lang_emit_char,
diff --git a/gdb/language.h b/gdb/language.h
index 8ed9fb0..27c1491 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -180,6 +180,14 @@ struct language_defn
void (*la_error) (char *);
+ /* Given an expression *EXPP created by prefixifying the result of
+ la_parser, perform any remaining processing necessary to complete
+ its translation. *EXPP may change; la_post_parser is responsible
+ for releasing its previous contents, if necessary. If
+ VOID_CONTEXT_P, then no value is expected from the expression. */
+
+ void (*la_post_parser) (struct expression ** expp, int void_context_p);
+
void (*la_printchar) (int ch, struct ui_file * stream);
void (*la_printstr) (struct ui_file * stream, char *string,
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index e5b6b50..c66b703 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -418,6 +418,7 @@ const struct language_defn m2_language_defn =
&exp_descriptor_standard,
m2_parse, /* parser */
m2_error, /* parser error function */
+ null_post_parser,
m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
m2_emit_char, /* Function to print a single character */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 5c184f3..ecbce77 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -662,6 +662,7 @@ const struct language_defn objc_language_defn = {
&exp_descriptor_standard,
objc_parse,
objc_error,
+ null_post_parser,
objc_printchar, /* Print a character constant */
objc_printstr, /* Function to print string constant */
objc_emit_char,
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index a402532..9ab5573 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -454,6 +454,7 @@ const struct language_defn pascal_language_defn =
&exp_descriptor_standard,
pascal_parse,
pascal_error,
+ null_post_parser,
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_emit_char, /* Print a single char */
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". */
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index c84fcad..43a07c37 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -172,6 +172,8 @@ extern char *op_name_standard (enum exp_opcode);
extern struct type *follow_types (struct type *);
+extern void null_post_parser (struct expression **, int);
+
/* During parsing of a C expression, the pointer to the next character
is in this variable. */
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 872dcaf..1c41076 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -253,6 +253,7 @@ const struct language_defn scm_language_defn =
&exp_descriptor_scm,
scm_parse,
c_error,
+ null_post_parser,
scm_printchar, /* Print a character constant */
scm_printstr, /* Function to print string constant */
NULL, /* Function to print a single character */