aboutsummaryrefslogtreecommitdiff
path: root/gdb/ch-exp.y
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-22 07:43:01 +0000
committerPer Bothner <per@bothner.com>1995-02-22 07:43:01 +0000
commit835c25596515ca0a2376d43ce96c04674e683c2b (patch)
treebb279f526ce949adc60b072d4f4ca518f94bf553 /gdb/ch-exp.y
parentd439f0eca605216e5fca7314bf827248273d33a9 (diff)
downloadgdb-835c25596515ca0a2376d43ce96c04674e683c2b.zip
gdb-835c25596515ca0a2376d43ce96c04674e683c2b.tar.gz
gdb-835c25596515ca0a2376d43ce96c04674e683c2b.tar.bz2
* ch-exp.y (expression_conversion): Recognize 'ARRAY () TYPE (EXPR)'
(same as C's '(TYPE[])EXPR')
Diffstat (limited to 'gdb/ch-exp.y')
-rw-r--r--gdb/ch-exp.y18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index c87157c..98e890d 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -237,6 +237,7 @@ yyerror PARAMS ((char *));
%token <voidval> UPPER
%token <voidval> LOWER
%token <voidval> LENGTH
+%token <voidval> ARRAY
/* Tokens which are not Chill tokens used in expressions, but rather GDB
specific things that we recognize in the same context as Chill tokens
@@ -608,6 +609,22 @@ expression_conversion: mode_name parenthesised_expression
write_exp_elt_type ($1.type);
write_exp_elt_opcode (UNOP_CAST);
}
+ | ARRAY '(' ')' mode_name parenthesised_expression
+ /* This is pseudo-Chill, similar to C's '(TYPE[])EXPR'
+ which casts to an artificial array. */
+ {
+ struct type *range_type
+ = create_range_type ((struct type *) NULL,
+ builtin_type_int, 0, 0);
+ struct type *array_type
+ = create_array_type ((struct type *) NULL,
+ $4.type, range_type);
+ TYPE_ARRAY_UPPER_BOUND_TYPE(array_type)
+ = BOUND_CANNOT_BE_DETERMINED;
+ write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_type (array_type);
+ write_exp_elt_opcode (UNOP_CAST);
+ }
;
/* Z.200, 5.2.12 */
@@ -1717,6 +1734,7 @@ struct token
static const struct token idtokentab[] =
{
+ { "array", ARRAY },
{ "length", LENGTH },
{ "lower", LOWER },
{ "upper", UPPER },