diff options
author | Per Bothner <per@bothner.com> | 1995-01-04 01:07:15 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1995-01-04 01:07:15 +0000 |
commit | 2d67c7e986e0502739a211e899573dee17f21346 (patch) | |
tree | a44dbf8e3d6dcf21286bffa18280be0cd309bbb7 /gdb/ch-exp.y | |
parent | 3bcf418186358df5756e645b6e6034198b3ce2b6 (diff) | |
download | gdb-2d67c7e986e0502739a211e899573dee17f21346.zip gdb-2d67c7e986e0502739a211e899573dee17f21346.tar.gz gdb-2d67c7e986e0502739a211e899573dee17f21346.tar.bz2 |
* ch-exp.y (literal): Recognize NULL.
(tuple): Parse simple unlabelled tuples.
* eval.c (evaluate_subexp case OP_ARRAY): Use expect_type to
evaluate brace-initializer-expressions depending on context.
(evaluate_subexp case UNOP_CAST): Pass the target type as
expected type when evaluating the expression.
Diffstat (limited to 'gdb/ch-exp.y')
-rw-r--r-- | gdb/ch-exp.y | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index 191abe6..a68c684 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -510,7 +510,12 @@ literal : INTEGER_LITERAL } | EMPTINESS_LITERAL { - $$ = 0; /* FIXME */ + struct type *void_ptr_type + = lookup_pointer_type (builtin_type_void); + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (void_ptr_type); + write_exp_elt_longcst (0); + write_exp_elt_opcode (OP_LONG); } | CHARACTER_STRING_LITERAL { @@ -528,9 +533,28 @@ literal : INTEGER_LITERAL /* Z.200, 5.2.5 */ -tuple : FIXME_04 +tuple : '[' + { start_arglist (); } + expression_list ']' { - $$ = 0; /* FIXME */ + write_exp_elt_opcode (OP_ARRAY); + write_exp_elt_longcst ((LONGEST) 0); + write_exp_elt_longcst ((LONGEST) end_arglist () - 1); + write_exp_elt_opcode (OP_ARRAY); + } + | + mode_name '[' + { start_arglist (); } + expression_list ']' + { + write_exp_elt_opcode (OP_ARRAY); + write_exp_elt_longcst ((LONGEST) 0); + write_exp_elt_longcst ((LONGEST) end_arglist () - 1); + write_exp_elt_opcode (OP_ARRAY); + + write_exp_elt_opcode (UNOP_CAST); + write_exp_elt_type ($1.type); + write_exp_elt_opcode (UNOP_CAST); } ; @@ -637,7 +661,7 @@ conditional_expression : IF boolean_expression then_alternative else_alternative { $$ = 0; /* FIXME */ } - | CASE case_selector_list OF value_case_alternative '[' ELSE sub_expression ']' ESAC + | CASE case_selector_list OF value_case_alternative ELSE sub_expression ESAC { $$ = 0; /* FIXME */ } @@ -1706,7 +1730,8 @@ static const struct token idtokentab[] = { "xor", LOGXOR }, { "and", LOGAND }, { "in", IN }, - { "or", LOGIOR } + { "or", LOGIOR }, + { "null", EMPTINESS_LITERAL } }; static const struct token tokentab2[] = |