Commit | Line | Data |
---|---|---|
252b5132 | 1 | %{ |
2da42df6 | 2 | /* Copyright 2001, 2003 Free Software Foundation, Inc. |
8c2bc687 NC |
3 | |
4 | This file is part of GLD, the Gnu Linker. | |
5 | ||
6 | GLD is free software; you can redistribute it and/or modify | |
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 | ||
11 | GLD is distributed in the hope that it will be useful, | |
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 | |
18 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
252b5132 RH |
21 | #include "sysinfo.h" |
22 | char *word; | |
23 | int number; | |
24 | int unit; | |
25 | ||
26 | #ifndef yywrap | |
2da42df6 | 27 | static int yywrap (void) { return 1; } |
252b5132 RH |
28 | #endif |
29 | %} | |
30 | %% | |
31 | "(" { return '(';} | |
32 | ")" { return ')';} | |
33 | "[" { return '[';} | |
34 | "]" { return ']';} | |
35 | " " { ; } | |
36 | ";".* { ; } | |
37 | "\t" { ; } | |
38 | "\n" { ; } | |
39 | "\""[^\"]*"\"" { | |
40 | yylval.s = malloc(strlen (yytext)); | |
41 | strcpy(yylval.s, yytext+1); | |
42 | yylval.s[strlen(yylval.s)-1] = 0; | |
43 | return NAME; | |
44 | } | |
45 | ||
46 | 0x[0-9a-f]+ { | |
47 | yylval.i = strtol(yytext,0,16); | |
48 | return NUMBER; | |
49 | } | |
50 | ||
51 | [0-9]+ { | |
52 | yylval.i = atoi(yytext); | |
53 | return NUMBER; | |
54 | } | |
55 | ||
56 | ||
57 | "bits" { yylval.i =1 ;return UNIT;} | |
58 | "bit" { yylval.i = 1; return UNIT;} | |
59 | "bytes" { yylval.i= 8; return UNIT;} | |
60 | "byte" { yylval.i = 8; return UNIT;} | |
61 | ||
62 | "int" { yylval.s = "INT"; return TYPE;} | |
63 | "barray" { yylval.s = "BARRAY"; return TYPE;} | |
64 | "chars" { yylval.s = "CHARS"; return TYPE;} | |
65 | "variable" { yylval.i = 0; return NUMBER;} | |
66 | "counted" { yylval.i = -4; return NUMBER;} | |
67 | "addrsize" { yylval.i = -2; return NUMBER; } | |
68 | "segsize" { yylval.i = -1; return NUMBER; } | |
69 | "cond" { return COND;} | |
70 | "repeat" { return REPEAT;} |