]>
Commit | Line | Data |
---|---|---|
a33f7359 | 1 | %{/* deflex.l - Lexer for .def files */ |
6f2d3212 | 2 | |
a33f7359 | 3 | /* Copyright (C) 1995, 1997 Free Software Foundation, Inc. |
6f2d3212 SC |
4 | |
5 | This file is part of GNU Binutils. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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 | |
a33f7359 | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
6f2d3212 SC |
20 | |
21 | ||
22 | /* Contributed by Steve Chamberlain | |
23 | [email protected] | |
24 | ||
25 | */ | |
26 | #define DONTDECLARE_MALLOC | |
a33f7359 | 27 | #include "libiberty.h" |
6f2d3212 | 28 | #include "defparse.h" |
a33f7359 ILT |
29 | #include "dlltool.h" |
30 | ||
6f2d3212 SC |
31 | int linenumber; |
32 | ||
33 | %} | |
34 | %% | |
a33f7359 ILT |
35 | "NAME" { return NAME;} |
36 | "LIBRARY" { return LIBRARY;} | |
37 | "DESCRIPTION" { return DESCRIPTION;} | |
38 | "STACKSIZE" { return STACKSIZE;} | |
39 | "HEAPSIZE" { return HEAPSIZE;} | |
40 | "CODE" { return CODE;} | |
41 | "DATA" { return DATA;} | |
42 | "SECTIONS" { return SECTIONS;} | |
43 | "EXPORTS" { return EXPORTS;} | |
44 | "IMPORTS" { return IMPORTS;} | |
9a455e6b | 45 | "VERSION" { return VERSIONK;} |
a33f7359 | 46 | "BASE" { return BASE;} |
6f2d3212 SC |
47 | "CONSTANT" { return CONSTANT; } |
48 | "NONAME" { return NONAME; } | |
a33f7359 ILT |
49 | "READ" { return READ;} |
50 | "WRITE" { return WRITE;} | |
6f2d3212 SC |
51 | "EXECUTE" { return EXECUTE;} |
52 | "SHARED" { return SHARED;} | |
53 | ||
54 | [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); | |
55 | return NUMBER; } | |
56 | ||
9a455e6b | 57 | [A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]+ { |
a33f7359 | 58 | yylval.id = xstrdup (yytext); |
6f2d3212 SC |
59 | return ID; |
60 | } | |
a33f7359 | 61 | |
6f2d3212 | 62 | "\""[^\"]*"\"" { |
a33f7359 ILT |
63 | yylval.id = xstrdup (yytext+1); |
64 | yylval.id[yyleng-2] = 0; | |
65 | return ID; | |
6f2d3212 SC |
66 | } |
67 | ||
68 | "\'"[^\']*"\'" { | |
a33f7359 ILT |
69 | yylval.id = xstrdup (yytext+1); |
70 | yylval.id[yyleng-2] = 0; | |
71 | return ID; | |
6f2d3212 SC |
72 | } |
73 | "*".* { } | |
74 | ";".* { } | |
75 | " " { } | |
76 | "\t" { } | |
a33f7359 ILT |
77 | "\n" { linenumber ++ ;} |
78 | "=" { return '=';} | |
79 | "." { return '.';} | |
80 | "@" { return '@';} | |
81 | "," { return ',';} | |
6f2d3212 SC |
82 | %% |
83 | #ifndef yywrap | |
84 | /* Needed for lex, though not flex. */ | |
85 | int yywrap() { return 1; } | |
86 | #endif |