diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2006-01-02 09:46:34 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2006-01-02 09:46:34 +0000 |
commit | 52ce64369c7d39c1e901f946c6128c8439f7392c (patch) | |
tree | 437feb1b53fcad99ceded7d91107bd842facb04d /gdb/ada-lang.h | |
parent | 529cad9c5b74f4a079b07107e736fe9857a5dc84 (diff) | |
download | gdb-52ce64369c7d39c1e901f946c6128c8439f7392c.zip gdb-52ce64369c7d39c1e901f946c6128c8439f7392c.tar.gz gdb-52ce64369c7d39c1e901f946c6128c8439f7392c.tar.bz2 |
* ada-exp.y: Considerable reorganization to move functionality
from ada-lex.l to here, where it is logically more appropriate.
The original reason, however, was to prevent premature name
lookups for selector names in record aggregates.
(BLOCKNAME, TYPENAME, OBJECT_RENAMING): Remove; lexer now returns
NAME for all of these.
(VAR): New artificial token to clarify precedence rules.
(OTHERS): New lexeme.
(empty_stoken): New symbol.
(%union): Remove ssym, voidval.
(%type): Remove <voidval> type declarations.
(syntax definitions): Add aggregates.
Remove distinction between NAME, TYPENAME, BLOCKNAME, OBJECT_RENAMING.
Rename some non-terminals to be closer to reference manual usage.
Tighten up expression syntax to disallow certain non-Ada
constructions such as X and then Y or else Z.
(ada_parse): Remove initialization of left_block_context.
(write_var_from_name): Remove.
(write_var_or_type): New function, containing previous code from
defunct write_var_from_name and name_lookup.
(block_lookup): New function, moved from ada-lex.l
(select_possible_type_sym): New function, factored out of
name_lookup, which used to be in ada-lex.l.
(find_primitive_type): Ditto.
(chop_selector): Ditto.
(write_ambiguous_var): New function, factored out of defunct
write_var_from_name.
(write_selectors): New function.
(write_name_assoc): New function.
(write_exp_op_with_string): New function.
* ada-lex.l (processId): Change interface to return stoken.
(tempbuf, resize_tempbuf, tempbuf_size, tempbuf_len): Remove.
(block_lookup, name_lookup): Remove. Functionality moved to
ada-exp.y.
(state IN_STRING): Remove.
(rules): Handle string escapes in processString.
Add 'others' token.
Return all NAMEs, BLOCKNAMEs, OBJECT_RENAMINGs, TYPENAMEs in
yylval.sval (as simple strings).
All name look-ups now handled in ada-exp.y.
Introduce "::" (COLONCOLON) token and return as separate token.
(processId): Change return convention. Comment.
Leave leading "'" in place.
(processString): New function.
(find_dot_all): Add note to comment.
Fix problem that allowed match only at the end.
* ada-lang.c: Introduce aggregates.
(find_struct_field): Add new parameter to count fields skipped, and
allow other output parameters to be NULL.
(value_tag_from_contents_and_address, ada_value_struct_elt): Use
new find_struct_field.
(ada_index_struct_field, assign_aggregate, ada_is_array_type)
(num_visible_fields, ada_index_struct_field_1, ada_index_struct_field)
(num_component_specs, assign_component, assign_aggregate):
(aggregate_assign_from_choices,aggregate_assign_positional)
(aggregate_assign_others,add_component_interval):
New functions.
(ada_evaluate_subexp): Declare.
Add aggregate-related operators.
(ada_forward_operator_length): Declare.
(resolve_subexp): Add cases for new aggregate operators and OP_NAME.
Consolidate Ada operators, using ada_forward_operator_length.
(ada_search_struct_field): Search in forward order.
(ADA_OPERATORS): Add new aggregate operators.
(ada_operator_length, ada_op_name, ada_forward_operator_length)
(ada_dump_subexp_body, ada_print_subexp): Handle new aggregate
operators and OP_NAME.
(ada_type_of_array): Use longest_to_int.
(value_assign_to_component): New function.
(ada_forward_operator_length, ada_op_name, ada_dump_subexp_body):
Add OP_NAME case.
(ada_forward_operator_length, ada_dump_subexp_body):
Add OP_STRING case.
* ada-lang.h (enum ada_operator): Add OP_AGGREGATE, OP_OTHERS,
OP_CHOICES, OP_DISCRETE_RANGE, OP_POSITIONAL.
Diffstat (limited to 'gdb/ada-lang.h')
-rw-r--r-- | gdb/ada-lang.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index 65c2e93..a2114a8 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -115,6 +115,54 @@ enum ada_operator type TYPE (typically a subrange). */ UNOP_IN_RANGE, + /* An aggregate. A single immediate operand, N>0, gives + the number of component specifications that follow. The + immediate operand is followed by a second OP_AGGREGATE. + Next come N component specifications. A component + specification is either an OP_OTHERS (others=>...), an + OP_CHOICES (for named associations), or other expression (for + positional aggregates only). Aggregates currently + occur only as the right sides of assignments. */ + OP_AGGREGATE, + + /* An others clause. Followed by a single expression. */ + OP_OTHERS, + + /* An aggregate component association. A single immediate operand, N, + gives the number of choices that follow. This is followed by a second + OP_CHOICES operator. Next come N operands, each of which is an + expression, an OP_DISCRETE_RANGE, or an OP_NAME---the latter + for a simple name that must be a record component name and does + not correspond to a single existing symbol. After the N choice + indicators comes an expression giving the value. + + In an aggregate such as (X => E1, ...), where X is a simple + name, X could syntactically be either a component_selector_name + or an expression used as a discrete_choice, depending on the + aggregate's type context. Since this is not known at parsing + time, we don't attempt to disambiguate X if it has multiple + definitions, but instead supply an OP_NAME. If X has a single + definition, we represent it with an OP_VAR_VALUE, even though + it may turn out to be within a record aggregate. Aggregate + evaluation can use either OP_NAMEs or OP_VAR_VALUEs to get a + record field name, and can evaluate OP_VAR_VALUE normally to + get its value as an expression. Unfortunately, we lose out in + cases where X has multiple meanings and is part of an array + aggregate. I hope these are not common enough to annoy users, + who can work around the problem in any case by putting + parentheses around X. */ + OP_CHOICES, + + /* A positional aggregate component association. The operator is + followed by a single integer indicating the position in the + aggregate (0-based), followed by a second OP_POSITIONAL. Next + follows a single expression giving the component value. */ + OP_POSITIONAL, + + /* A range of values. Followed by two expressions giving the + upper and lower bounds of the range. */ + OP_DISCRETE_RANGE, + /* End marker */ OP_ADA_LAST }; |