* 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.
This commit is contained in:
Paul N. Hilfinger 2004-04-10 22:10:01 +00:00
parent fa34704a30
commit e85c3284f3
13 changed files with 91 additions and 0 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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,

View File

@ -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,

View File

@ -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 */

View File

@ -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,

View File

@ -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 */

View File

@ -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
@ -1020,6 +1023,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;
@ -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". */

View File

@ -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. */

View File

@ -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 */