+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.
&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 */
&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 */
&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 */
&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 */
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
&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 */
&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 */
&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,
&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,
&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,
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,
&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 */
&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,
&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 */
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
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;
prefixify_expression (expout);
+ current_language->la_post_parser (&expout, void_context_p);
+
if (expressiondebug)
dump_prefix_expression (expout, gdb_stdlog);
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)
+{
+}
\f
/* Stuff for maintaining a stack of types. Currently just used by C, but
probably useful for any language which declares its types "backwards". */
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. */
&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 */