From 0b4e13251c935cb507296127d8af1c78fc627bd5 Mon Sep 17 00:00:00 2001 From: Wu Zhou Date: Tue, 20 Sep 2005 06:25:34 +0000 Subject: * 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. --- gdb/parse.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'gdb/parse.c') diff --git a/gdb/parse.c b/gdb/parse.c index 4ec96c6..f6b0c4f 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1,7 +1,7 @@ /* Parse expressions for GDB. Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc. + 1997, 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc. Modified from expread.y by the Department of Computer Science at the State University of New York at Buffalo, 1991. @@ -43,6 +43,7 @@ #include "value.h" #include "command.h" #include "language.h" +#include "f-lang.h" #include "parser-defs.h" #include "gdbcmd.h" #include "symfile.h" /* for overlay functions */ @@ -837,6 +838,7 @@ operator_length_standard (struct expression *expr, int endpos, { int oplen = 1; int args = 0; + enum f90_range_type range_type; int i; if (endpos < 1) @@ -957,6 +959,26 @@ operator_length_standard (struct expression *expr, int endpos, oplen = 2; break; + case OP_F90_RANGE: + oplen = 3; + + range_type = longest_to_int (expr->elts[endpos - 2].longconst); + switch (range_type) + { + case LOW_BOUND_DEFAULT: + case HIGH_BOUND_DEFAULT: + args = 1; + break; + case BOTH_BOUND_DEFAULT: + args = 0; + break; + case NONE_BOUND_DEFAULT: + args = 2; + break; + } + + break; + default: args = 1 + (i < (int) BINOP_END); } -- cgit v1.1