summaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorWu Zhou <woodzltc@cn.ibm.com>2005-09-20 06:25:34 +0000
committerWu Zhou <woodzltc@cn.ibm.com>2005-09-20 06:25:34 +0000
commit41f582ab9f50df99cc733860f89e52ef73a87a85 (patch)
tree9a259d2d7a4f87d1b270ecaf74c9b70c2a84a976 /gdb/f-exp.y
parentb8160d54e5c17501d04f0bedf077b83fa7765fb3 (diff)
downloadgdb-41f582ab9f50df99cc733860f89e52ef73a87a85.tar.gz
* expression.h (enum exp_opcode): Add a new operator for F90
subrange. * f-lang.h (enum f90_range_type): New enumeration type to identify F90 subrange type. * f-exp.y (yyparse): Add support for parsing F90 subrange and change substring parsing to subrange parsing. * parse.c (operator_length_standard): Set the operator length and args number for OP_F90_RANGE. * eval.c (evaluate_subexp_standard): Add code to evaluate F90 array section and substring. (value_f90_subarray): New function to evaluate F90 array section. (evaluate_subexp_standard): Delete label op_f77_substr and its code because the logic is implemented by function value_f90_subarray now.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y29
1 files changed, 25 insertions, 4 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 0deb81682c2..4e1f6359e2e 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -283,18 +283,39 @@ arglist : exp
{ arglist_len = 1; }
;
-arglist : substring
- { arglist_len = 2;}
+arglist : subrange
+ { arglist_len = 1; }
;
arglist : arglist ',' exp %prec ABOVE_COMMA
{ arglist_len++; }
;
-substring: exp ':' exp %prec ABOVE_COMMA
- { }
+/* There are four sorts of subrange types in F90. */
+
+subrange: exp ':' exp %prec ABOVE_COMMA
+ { write_exp_elt_opcode (OP_F90_RANGE);
+ write_exp_elt_longcst (NONE_BOUND_DEFAULT);
+ write_exp_elt_opcode (OP_F90_RANGE); }
+ ;
+
+subrange: exp ':' %prec ABOVE_COMMA
+ { write_exp_elt_opcode (OP_F90_RANGE);
+ write_exp_elt_longcst (HIGH_BOUND_DEFAULT);
+ write_exp_elt_opcode (OP_F90_RANGE); }
;
+subrange: ':' exp %prec ABOVE_COMMA
+ { write_exp_elt_opcode (OP_F90_RANGE);
+ write_exp_elt_longcst (LOW_BOUND_DEFAULT);
+ write_exp_elt_opcode (OP_F90_RANGE); }
+ ;
+
+subrange: ':' %prec ABOVE_COMMA
+ { write_exp_elt_opcode (OP_F90_RANGE);
+ write_exp_elt_longcst (BOTH_BOUND_DEFAULT);
+ write_exp_elt_opcode (OP_F90_RANGE); }
+ ;
complexnum: exp ',' exp
{ }