projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Target FP: Use target format throughout expression parsing
[deliverable/binutils-gdb.git]
/
gdb
/
m2-exp.y
diff --git
a/gdb/m2-exp.y
b/gdb/m2-exp.y
index a8b431e366d8cfe66bbec0a8c54a1e775331e0d9..3998d2b9f99b0d6b4c521e0673bbd1ed75a1477d 100644
(file)
--- a/
gdb/m2-exp.y
+++ b/
gdb/m2-exp.y
@@
-1,5
+1,5
@@
/* YACC grammar for Modula-2 expressions, for GDB.
/* YACC grammar for Modula-2 expressions, for GDB.
- Copyright (C) 1986-201
6
Free Software Foundation, Inc.
+ Copyright (C) 1986-201
7
Free Software Foundation, Inc.
Generated from expread.y (now c-exp.y) and contributed by the Department
of Computer Science at the State University of New York at Buffalo, 1991.
Generated from expread.y (now c-exp.y) and contributed by the Department
of Computer Science at the State University of New York at Buffalo, 1991.
@@
-65,7
+65,7
@@
int yyparse (void);
static int yylex (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (c
onst c
har *);
static int parse_number (int);
static int parse_number (int);
@@
-82,7
+82,7
@@
static int number_sign = 1;
{
LONGEST lval;
ULONGEST ulval;
{
LONGEST lval;
ULONGEST ulval;
-
DOUBLEST dval
;
+
gdb_byte val[16]
;
struct symbol *sym;
struct type *tval;
struct stoken sval;
struct symbol *sym;
struct type *tval;
struct stoken sval;
@@
-103,7
+103,7
@@
static int number_sign = 1;
%token <lval> INT HEX ERROR
%token <ulval> UINT M2_TRUE M2_FALSE CHAR
%token <lval> INT HEX ERROR
%token <ulval> UINT M2_TRUE M2_FALSE CHAR
-%token <
d
val> FLOAT
+%token <val> FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@
-474,12
+474,12
@@
exp : CHAR
exp : FLOAT
exp : FLOAT
- { write_exp_elt_opcode (pstate, OP_
DOUBLE
);
+ { write_exp_elt_opcode (pstate, OP_
FLOAT
);
write_exp_elt_type (pstate,
parse_m2_type (pstate)
->builtin_real);
write_exp_elt_type (pstate,
parse_m2_type (pstate)
->builtin_real);
- write_exp_elt_
dbl
cst (pstate, $1);
- write_exp_elt_opcode (pstate, OP_
DOUBLE
); }
+ write_exp_elt_
float
cst (pstate, $1);
+ write_exp_elt_opcode (pstate, OP_
FLOAT
); }
;
exp : variable
;
exp : variable
@@
-650,7
+650,11
@@
parse_number (int olen)
if (p[c] == '.' && base == 10)
{
/* It's a float since it contains a point. */
if (p[c] == '.' && base == 10)
{
/* It's a float since it contains a point. */
- yylval.dval = atof (p);
+ if (!parse_float (p, len,
+ parse_m2_type (pstate)->builtin_real,
+ yylval.val))
+ return ERROR;
+
lexptr += len;
return FLOAT;
}
lexptr += len;
return FLOAT;
}
@@
-1036,21
+1040,16
@@
yylex (void)
int
m2_parse (struct parser_state *par_state)
{
int
m2_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
-
- return result;
+ return yyparse ();
}
void
}
void
-yyerror (char *msg)
+yyerror (c
onst c
har *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
{
if (prev_lexptr)
lexptr = prev_lexptr;
This page took
0.025992 seconds
and
4
git commands to generate.