aboutsummaryrefslogtreecommitdiff
path: root/gdb/ch-exp.y
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-01-20 23:45:21 +0000
committerPer Bothner <per@bothner.com>1995-01-20 23:45:21 +0000
commitdcda44a07a5fae20fc6ab26e07229984f87b7172 (patch)
tree1fc99b3348a3486686f52eafb5d4fe11a18ef5d4 /gdb/ch-exp.y
parentf34c87666e4020cfd61a4d8d1084f03c9f3038d2 (diff)
downloadgdb-dcda44a07a5fae20fc6ab26e07229984f87b7172.zip
gdb-dcda44a07a5fae20fc6ab26e07229984f87b7172.tar.gz
gdb-dcda44a07a5fae20fc6ab26e07229984f87b7172.tar.bz2
* expression.h (OP_LABELED): New operator, for Chill
labeled structre tuples. * ch-exp.y (tuple_element, named_record_element, tuple_elements): New non-terminals, to handle labeled structure tuples. (tuple): Re-define using tuple_elements. * eval.c (evaluate_labeled_field_init): New function, to handle initialization of structure fields, possibly using OP_LABELED. (evaluate_subexp): Use it. * expprint.c (print_subexp case): For OP_ARRAY, use Chill syntax for Chill. Handled OP_LABELED. * parse.c (length_of_subexp, prefixify_subexp): Handle OP_LABELED. * eval.c (evaluate_subexp): Handle Chill Powerset tuples. * valarith.c (value_bit_index): Just treat bitstring as represented by an array of bytes. Alignment is handled by compiler.
Diffstat (limited to 'gdb/ch-exp.y')
-rw-r--r--gdb/ch-exp.y32
1 files changed, 30 insertions, 2 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index a68c684..9bb7526 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -374,6 +374,8 @@ expression_list : expression
{
arglist_len++;
}
+ ;
+
/* Z.200, 5.2.1 */
@@ -533,9 +535,35 @@ literal : INTEGER_LITERAL
/* Z.200, 5.2.5 */
+tuple_element : expression
+ | named_record_element
+ ;
+
+named_record_element: FIELD_NAME ',' named_record_element
+ { write_exp_elt_opcode (OP_LABELED);
+ write_exp_string ($1);
+ write_exp_elt_opcode (OP_LABELED);
+ }
+ | FIELD_NAME ':' expression
+ { write_exp_elt_opcode (OP_LABELED);
+ write_exp_string ($1);
+ write_exp_elt_opcode (OP_LABELED);
+ }
+ ;
+
+tuple_elements : tuple_element
+ {
+ arglist_len = 1;
+ }
+ | tuple_elements ',' tuple_element
+ {
+ arglist_len++;
+ }
+ ;
+
tuple : '['
{ start_arglist (); }
- expression_list ']'
+ tuple_elements ']'
{
write_exp_elt_opcode (OP_ARRAY);
write_exp_elt_longcst ((LONGEST) 0);
@@ -545,7 +573,7 @@ tuple : '['
|
mode_name '['
{ start_arglist (); }
- expression_list ']'
+ tuple_elements ']'
{
write_exp_elt_opcode (OP_ARRAY);
write_exp_elt_longcst ((LONGEST) 0);