]>
Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | %{/* deflex.l - Lexer for .def files */ |
2 | ||
32866df7 NC |
3 | /* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2007 |
4 | Free Software Foundation, Inc. | |
5 | ||
6 | This file is part of GNU Binutils. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | MA 02110-1301, USA. */ | |
252b5132 RH |
22 | |
23 | ||
7aa52b1f | 24 | /* Contributed by Steve Chamberlain: [email protected] */ |
252b5132 | 25 | |
252b5132 RH |
26 | #define DONTDECLARE_MALLOC |
27 | #include "libiberty.h" | |
28 | #include "defparse.h" | |
29 | #include "dlltool.h" | |
30 | ||
0af6db78 AM |
31 | #define YY_NO_UNPUT |
32 | ||
252b5132 RH |
33 | int linenumber; |
34 | ||
35 | %} | |
36 | %% | |
37 | "NAME" { return NAME;} | |
38 | "LIBRARY" { return LIBRARY;} | |
39 | "DESCRIPTION" { return DESCRIPTION;} | |
40 | "STACKSIZE" { return STACKSIZE;} | |
41 | "HEAPSIZE" { return HEAPSIZE;} | |
42 | "CODE" { return CODE;} | |
43 | "DATA" { return DATA;} | |
44 | "SECTIONS" { return SECTIONS;} | |
45 | "EXPORTS" { return EXPORTS;} | |
46 | "IMPORTS" { return IMPORTS;} | |
47 | "VERSION" { return VERSIONK;} | |
48 | "BASE" { return BASE;} | |
49 | "CONSTANT" { return CONSTANT; } | |
50 | "NONAME" { return NONAME; } | |
7aa52b1f | 51 | "PRIVATE" { return PRIVATE; } |
252b5132 RH |
52 | "READ" { return READ;} |
53 | "WRITE" { return WRITE;} | |
54 | "EXECUTE" { return EXECUTE;} | |
55 | "SHARED" { return SHARED;} | |
d7ec8102 ILT |
56 | "NONSHARED" { return NONSHARED;} |
57 | "SINGLE" { return SINGLE;} | |
58 | "MULTIPLE" { return MULTIPLE;} | |
59 | "INITINSTANCE" { return INITINSTANCE;} | |
60 | "INITGLOBAL" { return INITGLOBAL;} | |
61 | "TERMINSTANCE" { return TERMINSTANCE;} | |
62 | "TERMGLOBAL" { return TERMGLOBAL;} | |
252b5132 RH |
63 | |
64 | [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); | |
65 | return NUMBER; } | |
66 | ||
c9e38879 | 67 | (@)?[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* { |
252b5132 RH |
68 | yylval.id = xstrdup (yytext); |
69 | return ID; | |
70 | } | |
71 | ||
72 | "\""[^\"]*"\"" { | |
73 | yylval.id = xstrdup (yytext+1); | |
74 | yylval.id[yyleng-2] = 0; | |
75 | return ID; | |
76 | } | |
77 | ||
78 | "\'"[^\']*"\'" { | |
79 | yylval.id = xstrdup (yytext+1); | |
80 | yylval.id[yyleng-2] = 0; | |
81 | return ID; | |
82 | } | |
83 | "*".* { } | |
84 | ";".* { } | |
85 | " " { } | |
86 | "\t" { } | |
39ddb54e | 87 | "\r" { } |
252b5132 RH |
88 | "\n" { linenumber ++ ;} |
89 | "=" { return '=';} | |
90 | "." { return '.';} | |
91 | "@" { return '@';} | |
92 | "," { return ',';} | |
93 | %% | |
94 | #ifndef yywrap | |
95 | /* Needed for lex, though not flex. */ | |
2da42df6 | 96 | int yywrap(void) { return 1; } |
252b5132 | 97 | #endif |