Commit | Line | Data |
---|---|---|
c63043aa DG |
1 | %option noinput nounput |
2 | ||
252b5132 RH |
3 | %{/* deflex.l - Lexer for .def files */ |
4 | ||
b90efa5b | 5 | /* Copyright (C) 1995-2015 Free Software Foundation, Inc. |
3aade688 | 6 | |
32866df7 | 7 | This file is part of GNU Binutils. |
3aade688 | 8 | |
32866df7 NC |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3 of the License, or | |
12 | (at your option) any later version. | |
3aade688 | 13 | |
32866df7 NC |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
3aade688 | 18 | |
32866df7 NC |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software | |
21 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
22 | MA 02110-1301, USA. */ | |
252b5132 RH |
23 | |
24 | ||
7aa52b1f | 25 | /* Contributed by Steve Chamberlain: sac@cygnus.com */ |
252b5132 | 26 | |
252b5132 RH |
27 | #define DONTDECLARE_MALLOC |
28 | #include "libiberty.h" | |
29 | #include "defparse.h" | |
30 | #include "dlltool.h" | |
31 | ||
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 | 62 | |
3aade688 | 63 | [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); |
252b5132 RH |
64 | return NUMBER; } |
65 | ||
3aade688 | 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 | 87 | "\n" { linenumber ++ ;} |
bf201fdd | 88 | "==" { return EQUAL;} |
252b5132 RH |
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 |