/* YACC parser for Fortran expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 2000, 2001,
- 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
%token <lval> BOOLEAN_LITERAL
%token <ssym> NAME
%token <tsym> TYPENAME
+%type <sval> name
%type <ssym> name_not_typename
/* A NAME_OR_INT is a symbol which is not known in the symbol table,
%left LSH RSH
%left '@'
%left '+' '-'
-%left '*' '/' '%'
+%left '*' '/'
%right STARSTAR
+%right '%'
%right UNARY
%right '('
write_exp_elt_opcode (UNOP_CAST); }
;
+exp : exp '%' name
+ { write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string ($3);
+ write_exp_elt_opcode (STRUCTOP_STRUCT); }
+ ;
+
/* Binary operators in order of decreasing precedence. */
exp : exp '@' exp
{ write_exp_elt_opcode (BINOP_DIV); }
;
-exp : exp '%' exp
- { write_exp_elt_opcode (BINOP_REM); }
- ;
-
exp : exp '+' exp
{ write_exp_elt_opcode (BINOP_ADD); }
;
}
;
+name : NAME
+ { $$ = $1.stoken; }
+ ;
+
name_not_typename : NAME
/* These would be useful if name_not_typename was useful, but it is just
a fake for "variable", so these cause reduce/reduce conflicts because