+2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (parse): Rename to ada_language::parser.
+ (ada_language_data): Delete la_parser initializer.
+ (ada_language::parser): New member function, implementation from
+ parse.
+ * c-lang.c (c_language_data): Delete la_parser initializer.
+ (cplus_language_data): Likewise.
+ (asm_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ (d_language::parser): New member function.
+ * f-lang.c (f_language_data): Delete la_parser initializer.
+ (f_language::parser): New member function.
+ * go-lang.c (go_language_data): Delete la_parser initializer.
+ (go_language::parser): New member function.
+ * language.c (unk_lang_parser): Delete.
+ (language_defn::parser): Define new member function.
+ (unknown_language_data): Delete la_parser initializer.
+ (unknown_language::parser): New member function.
+ (auto_language_data): Delete la_parser initializer.
+ (auto_language::parser): New member function.
+ * language.h (language_data): Delete la_parser field.
+ (language_defn::parser): Declare new member function.
+ * m2-lang.c (m2_language_data): Delete la_parser initializer.
+ (m2_language::parser): New member function.
+ * objc-lang.c (objc_language_data): Delete la_parser initializer.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Likewise.
+ (pascal_language::parser): New member function.
+ * parse.c (parse_exp_in_context): Update call to parser.
+ * rust-lang.c (rust_language_data): Delete la_parser initializer.
+ (rust_language::parser): New member function.
+
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
* top.c (print_gdb_configuration): Print --with-python-libdir
ada_emit_char (c, type, stream, quoter, 1);
}
-static int
-parse (struct parser_state *ps)
-{
- warnings_issued = 0;
- return ada_parse (ps);
-}
-
static const struct exp_descriptor ada_exp_descriptor = {
ada_print_subexp,
ada_operator_length,
macro_expansion_no,
ada_extensions,
&ada_exp_descriptor,
- parse,
resolve,
ada_printchar, /* Print a character constant */
ada_printstr, /* Function to print string constant */
return {};
}
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ warnings_issued = 0;
+ return ada_parse (ps);
+ }
+
protected:
/* See language.h. */
macro_expansion_c,
c_extensions,
&exp_descriptor_c,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_c,
asm_extensions,
&exp_descriptor_c,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_c,
NULL,
&exp_descriptor_c,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
- d_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
{
return d_lookup_symbol_nonlocal (this, name, block, domain);
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return d_parse (ps);
+ }
};
/* Single instance of the D language class. */
macro_expansion_no,
f_extensions,
&exp_descriptor_f,
- f_parse, /* parser */
null_post_parser,
f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
return cp_lookup_symbol_nonlocal (this, name, block, domain);
}
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return f_parse (ps);
+ }
+
protected:
/* See language.h. */
macro_expansion_no,
NULL,
&exp_descriptor_c,
- go_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
{
return go_value_print_inner (val, stream, recurse, options);
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return go_parse (ps);
+ }
};
/* Single instance of the Go language class. */
#include <algorithm>
#include "gdbarch.h"
-static int unk_lang_parser (struct parser_state *);
-
static void set_range_case (void);
static void unk_lang_emit_char (int c, struct type *type,
/* See language.h. */
+int
+language_defn::parser (struct parser_state *ps) const
+{
+ return c_parse (ps);
+}
+
+/* See language.h. */
+
void
language_defn::value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
/* Define the language that is no language. */
-static int
-unk_lang_parser (struct parser_state *ps)
-{
- return 1;
-}
-
static void
unk_lang_emit_char (int c, struct type *type, struct ui_file *stream,
int quoter)
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- unk_lang_parser,
null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
{
error (_("unimplemented unknown_language::value_print_inner called"));
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ /* No parsing is done, just claim success. */
+ return 1;
+ }
};
/* Single instance of the unknown language class. */
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- unk_lang_parser,
null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
{
error (_("unimplemented auto_language::value_print_inner called"));
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ /* No parsing is done, just claim success. */
+ return 1;
+ }
};
/* Single instance of the fake "auto" language. */
const struct exp_descriptor *la_exp_desc;
- /* Parser function. */
-
- int (*la_parser) (struct parser_state *);
-
/* 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
(struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const;
+ /* Parser function. */
+
+ virtual int parser (struct parser_state *ps) const;
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
macro_expansion_no,
NULL,
&exp_descriptor_modula2,
- m2_parse, /* parser */
null_post_parser,
m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
{
return m2_value_print_inner (val, stream, recurse, options);
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return m2_parse (ps);
+ }
};
/* Single instance of the M2 language. */
macro_expansion_c,
objc_extensions,
&exp_descriptor_standard,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_c,
NULL,
&exp_descriptor_opencl,
- c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
- pascal_parse,
null_post_parser,
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
{
return pascal_value_print_inner (val, stream, recurse, options);
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return pascal_parse (ps);
+ }
};
/* Single instance of the Pascal language class. */
try
{
- lang->la_parser (&ps);
+ lang->parser (&ps);
}
catch (const gdb_exception &except)
{
macro_expansion_no,
rust_extensions,
&exp_descriptor_rust,
- rust_parse,
null_post_parser,
rust_printchar, /* Print a character constant */
rust_printstr, /* Function to print string constant */
}
return result;
}
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override
+ {
+ return rust_parse (ps);
+ }
};
/* Single instance of the Rust language class. */