]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | %{ |
dc3c06c2 | 2 | /* Copyright 2001, 2003, 2005 Free Software Foundation, Inc. |
8c2bc687 | 3 | |
943ea8a2 | 4 | This file is part of GNU Binutils. |
8c2bc687 | 5 | |
943ea8a2 | 6 | This program is free software; you can redistribute it and/or modify |
8c2bc687 NC |
7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
943ea8a2 | 11 | This program is distributed in the hope that it will be useful, |
8c2bc687 NC |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GLD; see the file COPYING. If not, write to the Free | |
b43b5d5f NC |
18 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
19 | 02110-1301, USA. */ | |
8c2bc687 | 20 | |
dc3c06c2 AM |
21 | #include "config.h" |
22 | #ifdef HAVE_STRING_H | |
23 | #include <string.h> | |
24 | #else | |
25 | #ifdef HAVE_STRINGS_H | |
26 | #include <strings.h> | |
27 | #endif | |
28 | #endif | |
252b5132 | 29 | #include "sysinfo.h" |
252b5132 | 30 | |
dc3c06c2 AM |
31 | #define YY_NO_UNPUT |
32 | ||
252b5132 | 33 | #ifndef yywrap |
2da42df6 | 34 | static int yywrap (void) { return 1; } |
252b5132 | 35 | #endif |
dc3c06c2 AM |
36 | |
37 | extern int yylex (void); | |
252b5132 RH |
38 | %} |
39 | %% | |
40 | "(" { return '(';} | |
41 | ")" { return ')';} | |
42 | "[" { return '[';} | |
43 | "]" { return ']';} | |
44 | " " { ; } | |
45 | ";".* { ; } | |
46 | "\t" { ; } | |
47 | "\n" { ; } | |
48 | "\""[^\"]*"\"" { | |
dc3c06c2 AM |
49 | yylval.s = malloc (yyleng - 1); |
50 | memcpy (yylval.s, yytext + 1, yyleng - 2); | |
51 | yylval.s[yyleng - 2] = '\0'; | |
252b5132 RH |
52 | return NAME; |
53 | } | |
54 | ||
55 | 0x[0-9a-f]+ { | |
56 | yylval.i = strtol(yytext,0,16); | |
57 | return NUMBER; | |
58 | } | |
59 | ||
60 | [0-9]+ { | |
61 | yylval.i = atoi(yytext); | |
62 | return NUMBER; | |
63 | } | |
64 | ||
65 | ||
66 | "bits" { yylval.i =1 ;return UNIT;} | |
67 | "bit" { yylval.i = 1; return UNIT;} | |
68 | "bytes" { yylval.i= 8; return UNIT;} | |
69 | "byte" { yylval.i = 8; return UNIT;} | |
70 | ||
71 | "int" { yylval.s = "INT"; return TYPE;} | |
72 | "barray" { yylval.s = "BARRAY"; return TYPE;} | |
73 | "chars" { yylval.s = "CHARS"; return TYPE;} | |
74 | "variable" { yylval.i = 0; return NUMBER;} | |
75 | "counted" { yylval.i = -4; return NUMBER;} | |
76 | "addrsize" { yylval.i = -2; return NUMBER; } | |
77 | "segsize" { yylval.i = -1; return NUMBER; } | |
78 | "cond" { return COND;} | |
79 | "repeat" { return REPEAT;} |