projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003-02-19 David Carlton <carlton@math.stanford.edu>
[deliverable/binutils-gdb.git]
/
gdb
/
f-exp.y
diff --git
a/gdb/f-exp.y
b/gdb/f-exp.y
index 9e67561d34f53bb78b12f9f300e8133b0c3e77b5..a9504c18418a799244408421e5bec8a3c9ab3cdb 100644
(file)
--- a/
gdb/f-exp.y
+++ b/
gdb/f-exp.y
@@
-1,6
+1,7
@@
/* YACC parser for Fortran expressions, for GDB.
/* YACC parser for Fortran expressions, for GDB.
- Copyright 1986, 1989, 1990, 1991, 1993, 1994
- Free Software Foundation, Inc.
+ Copyright 1986, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 2000, 2001
+ Free Software Foundation, Inc.
+
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@
-52,6
+53,8
@@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
+#include <ctype.h>
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
@@
-89,6
+92,8
@@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yylloc f_lloc
#define yyreds f_reds /* With YYDEBUG defined */
#define yytoks f_toks /* With YYDEBUG defined */
#define yylloc f_lloc
#define yyreds f_reds /* With YYDEBUG defined */
#define yytoks f_toks /* With YYDEBUG defined */
+#define yyname f_name /* With YYDEBUG defined */
+#define yyrule f_rule /* With YYDEBUG defined */
#define yylhs f_yylhs
#define yylen f_yylen
#define yydefred f_yydefred
#define yylhs f_yylhs
#define yylen f_yylen
#define yydefred f_yydefred
@@
-100,9
+105,11
@@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yycheck f_yycheck
#ifndef YYDEBUG
#define yycheck f_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 1 /* Default to
no
yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
int yyparse (void);
static int yylex (void);
@@
-235,9
+242,11
@@
exp : '(' exp ')'
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@
-277,6
+286,7
@@
arglist : exp
arglist : substring
{ arglist_len = 2;}
arglist : substring
{ arglist_len = 2;}
+ ;
arglist : arglist ',' exp %prec ABOVE_COMMA
{ arglist_len++; }
arglist : arglist ',' exp %prec ABOVE_COMMA
{ arglist_len++; }
@@
-555,7
+565,7
@@
direct_abs_decl: '(' abs_decl ')'
func_mod: '(' ')'
{ $$ = 0; }
| '(' nonempty_typelist ')'
func_mod: '(' ')'
{ $$ = 0; }
| '(' nonempty_typelist ')'
- { free (
(PTR)
$2); $$ = 0; }
+ { free ($2); $$ = 0; }
;
typebase /* Implements (approximately): (type-qualifier)* type-specifier */
;
typebase /* Implements (approximately): (type-qualifier)* type-specifier */
@@
-638,7
+648,6
@@
parse_number (p, len, parsed_float, putithere)
{
register LONGEST n = 0;
register LONGEST prevn = 0;
{
register LONGEST n = 0;
register LONGEST prevn = 0;
- register int i;
register int c;
register int base = input_radix;
int unsigned_p = 0;
register int c;
register int base = input_radix;
int unsigned_p = 0;
@@
-653,7
+662,7
@@
parse_number (p, len, parsed_float, putithere)
/* [dD] is not understood as an exponent by atof, change it to 'e'. */
char *tmp, *tmp2;
/* [dD] is not understood as an exponent by atof, change it to 'e'. */
char *tmp, *tmp2;
- tmp =
strsave
(p);
+ tmp =
xstrdup
(p);
for (tmp2 = tmp; *tmp2; ++tmp2)
if (*tmp2 == 'd' || *tmp2 == 'D')
*tmp2 = 'e';
for (tmp2 = tmp; *tmp2; ++tmp2)
if (*tmp2 == 'd' || *tmp2 == 'D')
*tmp2 = 'e';
@@
-696,26
+705,26
@@
parse_number (p, len, parsed_float, putithere)
while (len-- > 0)
{
c = *p++;
while (len-- > 0)
{
c = *p++;
- if (
c >= 'A' && c <= 'Z'
)
- c
+= 'a' - 'A'
;
- if (
c != 'l' && c != 'u
')
-
n *= base
;
-
if (c >= '0' && c <= '9
')
-
n += i = c - '0'
;
+ if (
isupper (c)
)
+ c
= tolower (c)
;
+ if (
len == 0 && c == 'l
')
+
long_p = 1
;
+
else if (len == 0 && c == 'u
')
+
unsigned_p = 1
;
else
{
else
{
- if (base > 10 && c >= 'a' && c <= 'f')
- n += i = c - 'a' + 10;
- else if (len == 0 && c == 'l')
- long_p = 1;
- else if (len == 0 && c == 'u')
- unsigned_p = 1;
+ int i;
+ if (c >= '0' && c <= '9')
+ i = c - '0';
+ else if (c >= 'a' && c <= 'f')
+ i = c - 'a' + 10;
else
return ERROR; /* Char not a digit */
else
return ERROR; /* Char not a digit */
+ if (i >= base)
+ return ERROR; /* Invalid digit in this base */
+ n *= base;
+ n += i;
}
}
- if (i >= base)
- return ERROR; /* Invalid digit in this base */
-
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). */
if ((prevn >= n) && n != 0)
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). */
if ((prevn >= n) && n != 0)
@@
-923,7
+932,9
@@
yylex ()
char *tokstart;
retry:
char *tokstart;
retry:
-
+
+ prev_lexptr = lexptr;
+
tokstart = lexptr;
/* First of all, let us make sure we are not dealing with the
tokstart = lexptr;
/* First of all, let us make sure we are not dealing with the
@@
-1170,5
+1181,8
@@
void
yyerror (msg)
char *msg;
{
yyerror (msg)
char *msg;
{
+ if (prev_lexptr)
+ lexptr = prev_lexptr;
+
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
}
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
}
This page took
0.028619 seconds
and
4
git commands to generate.