Convert ada-exp.y to use operations
This converts the Ada parser to generate operations rather than exp_elements. This was the most difficult of the parser conversions, partly due to the decision to integrate Ada expression resolution into the parse, and partly due to Ada aggregregate assignment. A couple of new per-parse globals are introduced, along with a number of helper functions. Resolution is done in 'ada_pop', yielding the unfortunate rule that ada-exp.y should generally not use parser_state::pop (exceptions are marked). gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-exp.y: Create operations. (empty_stoken): Remove. (ada_pop, ada_wrap, ada_addrof, ada_un_wrap2, ada_wrap2) (ada_wrap_op, ada_wrap3, ada_funcall): New functions. (components): New global. (push_component, choice_component, pop_component, pop_components): New functions. (associations): New global (push_association, pop_association, pop_associations): New functions. (ada_parse): Update. (write_var_from_sym, write_int): Create operations. (write_exp_op_with_string): Remove. (write_object_renaming, write_selectors, write_ambiguous_var) (write_var_or_type, write_name_assoc): Create operations. * ada-lang.h (ada_index_type): Declare. * ada-lang.c (ada_index_type): No longer static.
This commit is contained in:
parent
d308ba78cf
commit
08a057e64b
@ -1,3 +1,23 @@
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* ada-exp.y: Create operations.
|
||||
(empty_stoken): Remove.
|
||||
(ada_pop, ada_wrap, ada_addrof, ada_un_wrap2, ada_wrap2)
|
||||
(ada_wrap_op, ada_wrap3, ada_funcall): New functions.
|
||||
(components): New global.
|
||||
(push_component, choice_component, pop_component, pop_components):
|
||||
New functions.
|
||||
(associations): New global
|
||||
(push_association, pop_association, pop_associations): New
|
||||
functions.
|
||||
(ada_parse): Update.
|
||||
(write_var_from_sym, write_int): Create operations.
|
||||
(write_exp_op_with_string): Remove.
|
||||
(write_object_renaming, write_selectors, write_ambiguous_var)
|
||||
(write_var_or_type, write_name_assoc): Create operations.
|
||||
* ada-lang.h (ada_index_type): Declare.
|
||||
* ada-lang.c (ada_index_type): No longer static.
|
||||
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* f-exp.y: Create operations.
|
||||
|
658
gdb/ada-exp.y
658
gdb/ada-exp.y
File diff suppressed because it is too large
Load Diff
@ -2898,13 +2898,9 @@ ada_array_element_type (struct type *type, int nindices)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The type of nth index in arrays of given type (n numbering from 1).
|
||||
Does not examine memory. Throws an error if N is invalid or TYPE
|
||||
is not an array type. NAME is the name of the Ada attribute being
|
||||
evaluated ('range, 'first, 'last, or 'length); it is used in building
|
||||
the error message. */
|
||||
/* See ada-lang.h. */
|
||||
|
||||
static struct type *
|
||||
struct type *
|
||||
ada_index_type (struct type *type, int n, const char *name)
|
||||
{
|
||||
struct type *result_type;
|
||||
|
@ -417,4 +417,12 @@ extern block_symbol ada_resolve_variable (struct symbol *sym,
|
||||
int deprocedure_p,
|
||||
innermost_block_tracker *tracker);
|
||||
|
||||
/* The type of nth index in arrays of given type (n numbering from 1).
|
||||
Does not examine memory. Throws an error if N is invalid or TYPE
|
||||
is not an array type. NAME is the name of the Ada attribute being
|
||||
evaluated ('range, 'first, 'last, or 'length); it is used in building
|
||||
the error message. */
|
||||
extern struct type *ada_index_type (struct type *type, int n,
|
||||
const char *name);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user