aboutsummaryrefslogtreecommitdiff
path: root/gdb/ch-exp.y
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-01 21:02:51 +0000
committerPer Bothner <per@bothner.com>1995-02-01 21:02:51 +0000
commitf91a9e05e0183d596f1f307ddeb462175ca84ce8 (patch)
tree0d4a44205089ea893799272b7a78b7f8bd3acdea /gdb/ch-exp.y
parente1affd5840505e64d51482bfc3de7ea74edc5352 (diff)
downloadfsf-binutils-gdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.zip
fsf-binutils-gdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.tar.gz
fsf-binutils-gdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.tar.bz2
* ch-exp.y (value_string_element, string_primitive_value,
start_element, left_element, right_element, slice_size, lower_element, upper_element, first_element): Removed. (value_string_slice, value_array_slice): Replaced by ... (slice): New non-terminal, with working slice support. (primitive_value_lparen, rparen): New non-terminals. (maybe_tuple_elements): New non-terminal, to allow empty tuples. (idtokentab): Added "up". * value.h (COERCE_VARYING_ARRAY): New macro. * valarith.c (value_subscript): Use it. * valops.c (value_cast): Likewise. Also, do nothing if already correct type, and allow converting from/to range to/from scalar. * valops.c, value.h (varying_to_slice, value_slice): New functions. * eval.c (OP_ARRAY): Add cast for array element. * expression.h (TERNOP_SLICE, TERNOP_SLICE_COUNT): New exp_opcodes. * valops.c (chill_varying_type): Moved function frp, here ... * gdbtypes.c (chill_varying_type), gdbtypes.h: ... to here. * parse.c (length_of_subexp, prefixify_subexp): Add support for TERNOP_SLICE, TERNOP_SLICE_COUNT. * expprint.c (print_subexp, dump_expression): Likewise. * eval.c (evaluate_subexp): Likewise. * eval.c (evaluate_subexp case MULTI_SUBSCRIPT): Don't call value_x_binop on a Chill varying string.
Diffstat (limited to 'gdb/ch-exp.y')
-rw-r--r--gdb/ch-exp.y83
1 files changed, 25 insertions, 58 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index 46f48da..8b76979 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -252,9 +252,7 @@ yyerror PARAMS ((char *));
%type <voidval> value_name
%type <voidval> literal
%type <voidval> tuple
-%type <voidval> value_string_element
-%type <voidval> value_string_slice
-%type <voidval> value_array_slice
+%type <voidval> slice
%type <voidval> expression_conversion
%type <voidval> value_procedure_call
%type <voidval> value_built_in_routine_call
@@ -281,15 +279,7 @@ yyerror PARAMS ((char *));
%type <voidval> value_enumeration_name
%type <voidval> value_do_with_name
%type <voidval> value_receive_name
-%type <voidval> string_primitive_value
-%type <voidval> start_element
-%type <voidval> left_element
-%type <voidval> right_element
-%type <voidval> slice_size
%type <voidval> expression_list
-%type <voidval> lower_element
-%type <voidval> upper_element
-%type <voidval> first_element
%type <tval> mode_argument
%type <voidval> upper_lower_argument
%type <voidval> length_argument
@@ -303,6 +293,7 @@ yyerror PARAMS ((char *));
%type <voidval> buffer_location
%type <voidval> single_assignment_action
%type <tsym> mode_name
+%type <lval> rparen
%%
@@ -379,16 +370,22 @@ expression_list : expression
/* Z.200, 5.2.1 */
-primitive_value :
- access_name
- | primitive_value '('
+primitive_value_lparen: primitive_value '('
/* This is to save the value of arglist_len
being accumulated for each dimension. */
{ start_arglist (); }
- expression_list ')'
+ ;
+
+rparen : ')'
+ { $$ = end_arglist (); }
+ ;
+
+primitive_value :
+ access_name
+ | primitive_value_lparen expression_list rparen
{
write_exp_elt_opcode (MULTI_SUBSCRIPT);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_longcst ($3);
write_exp_elt_opcode (MULTI_SUBSCRIPT);
}
| primitive_value FIELD_NAME
@@ -412,15 +409,7 @@ primitive_value :
{
$$ = 0; /* FIXME */
}
- | value_string_element
- {
- $$ = 0; /* FIXME */
- }
- | value_string_slice
- {
- $$ = 0; /* FIXME */
- }
- | value_array_slice
+ | slice
{
$$ = 0; /* FIXME */
}
@@ -561,9 +550,13 @@ tuple_elements : tuple_element
}
;
+maybe_tuple_elements : tuple_elements
+ | /* EMPTY */
+ ;
+
tuple : '['
{ start_arglist (); }
- tuple_elements ']'
+ maybe_tuple_elements ']'
{
write_exp_elt_opcode (OP_ARRAY);
write_exp_elt_longcst ((LONGEST) 0);
@@ -573,7 +566,7 @@ tuple : '['
|
mode_name '['
{ start_arglist (); }
- tuple_elements ']'
+ maybe_tuple_elements ']'
{
write_exp_elt_opcode (OP_ARRAY);
write_exp_elt_longcst ((LONGEST) 0);
@@ -589,33 +582,14 @@ tuple : '['
/* Z.200, 5.2.6 */
-value_string_element: string_primitive_value '(' start_element ')'
- {
- $$ = 0; /* FIXME */
- }
- ;
-
-/* Z.200, 5.2.7 */
-
-value_string_slice: string_primitive_value '(' left_element ':' right_element ')'
- {
- $$ = 0; /* FIXME */
- }
- | string_primitive_value '(' start_element UP slice_size ')'
- {
- $$ = 0; /* FIXME */
- }
- ;
-
-/* Z.200, 5.2.9 */
-value_array_slice: primitive_value '(' lower_element ':' upper_element ')'
+slice: primitive_value_lparen expression ':' expression rparen
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (TERNOP_SLICE);
}
- | primitive_value '(' first_element UP slice_size ')'
+ | primitive_value_lparen expression UP expression rparen
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (TERNOP_SLICE_COUNT);
}
;
@@ -986,14 +960,6 @@ synonym_name : FIXME_11 { $$ = 0; }
value_enumeration_name : FIXME_12 { $$ = 0; }
value_do_with_name : FIXME_13 { $$ = 0; }
value_receive_name : FIXME_14 { $$ = 0; }
-string_primitive_value : FIXME_15 { $$ = 0; }
-start_element : FIXME_16 { $$ = 0; }
-left_element : FIXME_17 { $$ = 0; }
-right_element : FIXME_18 { $$ = 0; }
-slice_size : FIXME_19 { $$ = 0; }
-lower_element : FIXME_20 { $$ = 0; }
-upper_element : FIXME_21 { $$ = 0; }
-first_element : FIXME_22 { $$ = 0; }
boolean_expression : FIXME_26 { $$ = 0; }
case_selector_list : FIXME_27 { $$ = 0; }
subexpression : FIXME_28 { $$ = 0; }
@@ -1764,6 +1730,7 @@ static const struct token idtokentab[] =
{ "and", LOGAND },
{ "in", IN },
{ "or", LOGIOR },
+ { "up", UP },
{ "null", EMPTINESS_LITERAL }
};