1 %
{ /* defparse.y - parser for .def files */
3 /* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
5 This file is part of GNU Binutils.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
31 %token NAME
, LIBRARY
, DESCRIPTION
, STACKSIZE
, HEAPSIZE
, CODE
, DATA
32 %token SECTIONS
, EXPORTS
, IMPORTS
, VERSIONK
, BASE
, CONSTANT
33 %token READ WRITE EXECUTE SHARED NONAME
35 %token
<number
> NUMBER
36 %type
<number
> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
37 %type
<number
> attr attr_list opt_number
38 %type
<id
> opt_name opt_equal_name
47 NAME opt_name opt_base
{ def_name
($2, $3); }
48 | LIBRARY opt_name opt_base
{ def_library
($2, $3); }
50 | DESCRIPTION ID
{ def_description
($2);}
51 | STACKSIZE NUMBER opt_number
{ def_stacksize
($2, $3);}
52 | HEAPSIZE NUMBER opt_number
{ def_heapsize
($2, $3);}
53 | CODE attr_list
{ def_code
($2);}
54 | DATA attr_list
{ def_data
($2);}
57 | VERSIONK NUMBER
{ def_version
($2,0);}
58 | VERSIONK NUMBER
'.' NUMBER
{ def_version
($2,$4);}
69 ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
70 { def_exports
($1, $2, $3, $4, $5, $6);}
78 ID
'=' ID
'.' ID
'.' ID
{ def_import
($1,$3,$5,$7, 0); }
79 | ID
'=' ID
'.' ID
'.' NUMBER
{ def_import
($1,$3,$5, 0,$7); }
80 | ID
'=' ID
'.' ID
{ def_import
($1,$3, 0,$5, 0); }
81 | ID
'=' ID
'.' NUMBER
{ def_import
($1,$3, 0, 0,$5); }
82 | ID
'.' ID
'.' ID
{ def_import
( 0,$1,$3,$5, 0); }
83 | ID
'.' ID
'.' NUMBER
{ def_import
( 0,$1,$3, 0,$5); }
84 | ID
'.' ID
{ def_import
( 0,$1, 0,$3, 0); }
85 | ID
'.' NUMBER
{ def_import
( 0,$1, 0, 0,$3); }
94 ID attr_list
{ def_section
($1,$2);}
98 attr_list opt_comma attr
106 opt_number: ',' NUMBER
{ $$
=$2;}
132 opt_name: ID
{ $$
=$1; }
135 char *name
= xmalloc
(strlen
($1) + 1 + strlen
($3) + 1);
136 sprintf
(name
, "%s.%s", $1, $3);
152 opt_base: BASE
'=' NUMBER
{ $$
= $3;}