* Added the "c_gen.pl" perl script into this directory, so the current
[binutils-gdb.git] / binutils / syslex.l
blobe1fd85c04a68a5a93bc40d4fd1a05f346b5222cd
1 %{
2 #include "y.tab.h"
3 char *word;
4 int number;
5 int unit;
7 #ifndef yywrap
8 static int yywrap () { return 1; }
9 #endif
12 "(" { return '(';}
13 ")" { return ')';}
14 "[" { return '[';}
15 "]" { return ']';}
16 " " { ; }
17 ";".* { ; } 
18 "\t" { ; }
19 "\n" { ; }
20 "\""[^\"]*"\"" {
21 yylval.s = malloc(strlen (yytext));
22 strcpy(yylval.s, yytext+1);
23 yylval.s[strlen(yylval.s)-1] = 0;
24         return NAME;
25         }
27 0x[0-9a-f]+ {
28         yylval.i = strtol(yytext,0,16);
29         return  NUMBER;
30         }
32 [0-9]+ {
33         yylval.i = atoi(yytext);
34         return  NUMBER;
35         }
38 "bits" { yylval.i =1 ;return UNIT;}
39 "bit" { yylval.i = 1; return UNIT;}
40 "bytes" { yylval.i= 8; return UNIT;}
41 "byte" { yylval.i = 8; return UNIT;}
43 "int" { yylval.s = "INT"; return TYPE;}
44 "barray" { yylval.s = "BARRAY"; return TYPE;}
45 "chars" { yylval.s = "CHARS"; return TYPE;}
46 "variable" { yylval.i = 0; return NUMBER;}
47 "counted" { yylval.i = -4; return NUMBER;}
48 "addrsize" { yylval.i = -2; return NUMBER; }
49 "segsize" { yylval.i = -1; return NUMBER; }
50 "cond" { return COND;}
51 "repeat" { return REPEAT;}