Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | %{/* deflex.l - Lexer for .def files */ |
2 | ||
aef6203b | 3 | /* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004, 2005 |
7aa52b1f | 4 | Free Software Foundation, Inc. |
252b5132 | 5 | |
7aa52b1f | 6 | This file is part of GNU Binutils. |
252b5132 | 7 | |
7aa52b1f NC |
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 2 of the License, or | |
11 | (at your option) any later version. | |
252b5132 | 12 | |
7aa52b1f NC |
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. | |
252b5132 | 17 | |
7aa52b1f NC |
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 | |
b43b5d5f | 20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
252b5132 RH |
21 | |
22 | ||
7aa52b1f | 23 | /* Contributed by Steve Chamberlain: sac@cygnus.com */ |
252b5132 | 24 | |
252b5132 RH |
25 | #define DONTDECLARE_MALLOC |
26 | #include "libiberty.h" | |
27 | #include "defparse.h" | |
28 | #include "dlltool.h" | |
29 | ||
0af6db78 AM |
30 | #define YY_NO_UNPUT |
31 | ||
252b5132 RH |
32 | int linenumber; |
33 | ||
34 | %} | |
35 | %% | |
36 | "NAME" { return NAME;} | |
37 | "LIBRARY" { return LIBRARY;} | |
38 | "DESCRIPTION" { return DESCRIPTION;} | |
39 | "STACKSIZE" { return STACKSIZE;} | |
40 | "HEAPSIZE" { return HEAPSIZE;} | |
41 | "CODE" { return CODE;} | |
42 | "DATA" { return DATA;} | |
43 | "SECTIONS" { return SECTIONS;} | |
44 | "EXPORTS" { return EXPORTS;} | |
45 | "IMPORTS" { return IMPORTS;} | |
46 | "VERSION" { return VERSIONK;} | |
47 | "BASE" { return BASE;} | |
48 | "CONSTANT" { return CONSTANT; } | |
49 | "NONAME" { return NONAME; } | |
7aa52b1f | 50 | "PRIVATE" { return PRIVATE; } |
252b5132 RH |
51 | "READ" { return READ;} |
52 | "WRITE" { return WRITE;} | |
53 | "EXECUTE" { return EXECUTE;} | |
54 | "SHARED" { return SHARED;} | |
d7ec8102 ILT |
55 | "NONSHARED" { return NONSHARED;} |
56 | "SINGLE" { return SINGLE;} | |
57 | "MULTIPLE" { return MULTIPLE;} | |
58 | "INITINSTANCE" { return INITINSTANCE;} | |
59 | "INITGLOBAL" { return INITGLOBAL;} | |
60 | "TERMINSTANCE" { return TERMINSTANCE;} | |
61 | "TERMGLOBAL" { return TERMGLOBAL;} | |
252b5132 RH |
62 | |
63 | [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); | |
64 | return NUMBER; } | |
65 | ||
c9e38879 | 66 | (@)?[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* { |
252b5132 RH |
67 | yylval.id = xstrdup (yytext); |
68 | return ID; | |
69 | } | |
70 | ||
71 | "\""[^\"]*"\"" { | |
72 | yylval.id = xstrdup (yytext+1); | |
73 | yylval.id[yyleng-2] = 0; | |
74 | return ID; | |
75 | } | |
76 | ||
77 | "\'"[^\']*"\'" { | |
78 | yylval.id = xstrdup (yytext+1); | |
79 | yylval.id[yyleng-2] = 0; | |
80 | return ID; | |
81 | } | |
82 | "*".* { } | |
83 | ";".* { } | |
84 | " " { } | |
85 | "\t" { } | |
39ddb54e | 86 | "\r" { } |
252b5132 RH |
87 | "\n" { linenumber ++ ;} |
88 | "=" { return '=';} | |
89 | "." { return '.';} | |
90 | "@" { return '@';} | |
91 | "," { return ',';} | |
92 | %% | |
93 | #ifndef yywrap | |
94 | /* Needed for lex, though not flex. */ | |
2da42df6 | 95 | int yywrap(void) { return 1; } |
252b5132 | 96 | #endif |