Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | %{/* deflex.l - Lexer for .def files */ |
2 | ||
7aa52b1f NC |
3 | /* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004 |
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 | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 | ||
30 | int linenumber; | |
31 | ||
32 | %} | |
33 | %% | |
34 | "NAME" { return NAME;} | |
35 | "LIBRARY" { return LIBRARY;} | |
36 | "DESCRIPTION" { return DESCRIPTION;} | |
37 | "STACKSIZE" { return STACKSIZE;} | |
38 | "HEAPSIZE" { return HEAPSIZE;} | |
39 | "CODE" { return CODE;} | |
40 | "DATA" { return DATA;} | |
41 | "SECTIONS" { return SECTIONS;} | |
42 | "EXPORTS" { return EXPORTS;} | |
43 | "IMPORTS" { return IMPORTS;} | |
44 | "VERSION" { return VERSIONK;} | |
45 | "BASE" { return BASE;} | |
46 | "CONSTANT" { return CONSTANT; } | |
47 | "NONAME" { return NONAME; } | |
7aa52b1f | 48 | "PRIVATE" { return PRIVATE; } |
252b5132 RH |
49 | "READ" { return READ;} |
50 | "WRITE" { return WRITE;} | |
51 | "EXECUTE" { return EXECUTE;} | |
52 | "SHARED" { return SHARED;} | |
d7ec8102 ILT |
53 | "NONSHARED" { return NONSHARED;} |
54 | "SINGLE" { return SINGLE;} | |
55 | "MULTIPLE" { return MULTIPLE;} | |
56 | "INITINSTANCE" { return INITINSTANCE;} | |
57 | "INITGLOBAL" { return INITGLOBAL;} | |
58 | "TERMINSTANCE" { return TERMINSTANCE;} | |
59 | "TERMGLOBAL" { return TERMGLOBAL;} | |
252b5132 RH |
60 | |
61 | [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); | |
62 | return NUMBER; } | |
63 | ||
c9e38879 | 64 | (@)?[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* { |
252b5132 RH |
65 | yylval.id = xstrdup (yytext); |
66 | return ID; | |
67 | } | |
68 | ||
69 | "\""[^\"]*"\"" { | |
70 | yylval.id = xstrdup (yytext+1); | |
71 | yylval.id[yyleng-2] = 0; | |
72 | return ID; | |
73 | } | |
74 | ||
75 | "\'"[^\']*"\'" { | |
76 | yylval.id = xstrdup (yytext+1); | |
77 | yylval.id[yyleng-2] = 0; | |
78 | return ID; | |
79 | } | |
80 | "*".* { } | |
81 | ";".* { } | |
82 | " " { } | |
83 | "\t" { } | |
84 | "\n" { linenumber ++ ;} | |
85 | "=" { return '=';} | |
86 | "." { return '.';} | |
87 | "@" { return '@';} | |
88 | "," { return ',';} | |
89 | %% | |
90 | #ifndef yywrap | |
91 | /* Needed for lex, though not flex. */ | |
2da42df6 | 92 | int yywrap(void) { return 1; } |
252b5132 | 93 | #endif |