2009-09-02 Tristan Gingold <gingold@adacore.com>
[binutils.git] / binutils / deflex.l
blobbd8fbdc8f290361ee3cae73d17b1e5c68b3eaa72
1 %{/* deflex.l - Lexer for .def files */
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.  */
24 /* Contributed by Steve Chamberlain: sac@cygnus.com  */
26 #define DONTDECLARE_MALLOC
27 #include "libiberty.h"
28 #include "defparse.h"
29 #include "dlltool.h"
31 #define YY_NO_UNPUT
33 int linenumber;
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; }
51 "PRIVATE"       { return PRIVATE; }
52 "READ"          { return READ;}
53 "WRITE"         { return WRITE;}
54 "EXECUTE"       { return EXECUTE;}
55 "SHARED"        { return SHARED;}
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;}
64 [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); 
65                 return NUMBER; }
67 (@)?[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* {      
68                 yylval.id =  xstrdup (yytext);
69                 return ID;
70                 }
72 "\""[^\"]*"\"" {
73                 yylval.id = xstrdup (yytext+1);
74                 yylval.id[yyleng-2] = 0;
75                 return ID;
76                 }
78 "\'"[^\']*"\'" {
79                 yylval.id = xstrdup (yytext+1);
80                 yylval.id[yyleng-2] = 0;
81                 return ID;
82                 }
83 "*".*           { }
84 ";".*           { }
85 " "             { }
86 "\t"            { }
87 "\r"            { }
88 "\n"            { linenumber ++ ;}
89 "="             { return '=';}
90 "."             { return '.';}
91 "@"             { return '@';}
92 ","             { return ',';}
94 #ifndef yywrap
95 /* Needed for lex, though not flex. */
96 int yywrap(void) { return 1; }
97 #endif