* 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.
This commit is contained in:
Wu Zhou 2005-09-20 06:25:34 +00:00
parent 096f7d00c1
commit 0b4e13251c
6 changed files with 116 additions and 29 deletions

View file

@ -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);
}