summaryrefslogtreecommitdiff
path: root/gdb/parse.c
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
commit0b4e13251c935cb507296127d8af1c78fc627bd5 (patch)
tree2d9566d8763fb091f28846503023d46c7a5a899d /gdb/parse.c
parent096f7d00c1d4f1f28990b9546813d3be40589c13 (diff)
downloadbinutils-gdb-0b4e13251c935cb507296127d8af1c78fc627bd5.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/parse.c')
-rw-r--r--gdb/parse.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 4ec96c6a1e3..f6b0c4f8edd 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);
}