Index: expression.h =================================================================== --- expression.h (revision 2) +++ expression.h (revision 3) @@ -387,6 +387,37 @@ struct expression /* From parse.c */ +/* Parsing an expression is dependent on a certain context such as + the language to use, or the input radix for numbers. This structure + contains that context information. */ + +struct parse_context + { + /* The language to use when parsing an expression. */ + const struct language_defn *language; + + /* The radix to use by default when parsing numbers. */ + int radix; + }; + +extern struct parse_context + build_parse_context (const struct language_defn *language, int radix); + +#define current_parse_context \ + (build_parse_context (current_language, input_radix)) + +/* FIXME: brobecker/2007-12-09: We are currently introducing the addition + of a struct parse_context parameter to all the parsing routines. + The addition of this parameter means that we need to update all + the callers, which often means that the caller should also be added + a struct parse_context parameter, which in turn often means that + the caller's caller should also be updated, etc etc etc. Rather than + updating the entire calling chains all at once, which would be a very + large change, we break the transition into smaller changes, with the use + of the following macro, which is a temporary use of current_parse_context. + This macro should be deleted once the transition is complete. */ +#define wrong_parse_context (current_parse_context) + extern struct expression *parse_expression (char *); extern struct expression *parse_expression_in_context (char *, int); Index: parse.c =================================================================== --- parse.c (revision 2) +++ parse.c (revision 3) @@ -911,6 +911,21 @@ prefixify_subexp (struct expression *ine outbeg += oplen; } } + +/* Return a parse_context structure using the given LANGUAGE + and RADIX. */ + +struct parse_context +build_parse_context (const struct language_defn *language, int radix) +{ + struct parse_context result; + + result.language = language; + result.radix = radix; + + return result; +} + /* This page contains the two entry points to this file. */