133965Sjdp%{ 2218822Sdim/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc. 378828Sobrien 4218822SdimThis file is part of GNU Binutils. 578828Sobrien 6218822SdimThis program is free software; you can redistribute it and/or modify 778828Sobrienit under the terms of the GNU General Public License as published by 878828Sobrienthe Free Software Foundation; either version 2, or (at your option) 978828Sobrienany later version. 1078828Sobrien 11218822SdimThis program is distributed in the hope that it will be useful, 1278828Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1378828SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1478828SobrienGNU General Public License for more details. 1578828Sobrien 1678828SobrienYou should have received a copy of the GNU General Public License 1778828Sobrienalong with GLD; see the file COPYING. If not, write to the Free 18218822SdimSoftware Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19218822Sdim02110-1301, USA. */ 2078828Sobrien 21218822Sdim#include "config.h" 22218822Sdim#ifdef HAVE_STRING_H 23218822Sdim#include <string.h> 24218822Sdim#else 25218822Sdim#ifdef HAVE_STRINGS_H 26218822Sdim#include <strings.h> 27218822Sdim#endif 28218822Sdim#endif 2933965Sjdp#include "sysinfo.h" 3033965Sjdp 31218822Sdim#define YY_NO_UNPUT 32218822Sdim 3333965Sjdp#ifndef yywrap 34218822Sdimstatic int yywrap (void) { return 1; } 3533965Sjdp#endif 36218822Sdim 37218822Sdimextern int yylex (void); 3833965Sjdp%} 3933965Sjdp%% 4033965Sjdp"(" { return '(';} 4133965Sjdp")" { return ')';} 4233965Sjdp"[" { return '[';} 4333965Sjdp"]" { return ']';} 4433965Sjdp" " { ; } 4533965Sjdp";".* { ; } 4633965Sjdp"\t" { ; } 4733965Sjdp"\n" { ; } 4833965Sjdp"\""[^\"]*"\"" { 49218822Sdim yylval.s = malloc (yyleng - 1); 50218822Sdim memcpy (yylval.s, yytext + 1, yyleng - 2); 51218822Sdim yylval.s[yyleng - 2] = '\0'; 5233965Sjdp return NAME; 5333965Sjdp } 5433965Sjdp 5533965Sjdp0x[0-9a-f]+ { 5633965Sjdp yylval.i = strtol(yytext,0,16); 5733965Sjdp return NUMBER; 5833965Sjdp } 5933965Sjdp 6033965Sjdp[0-9]+ { 6133965Sjdp yylval.i = atoi(yytext); 6233965Sjdp return NUMBER; 6333965Sjdp } 6433965Sjdp 6533965Sjdp 6633965Sjdp"bits" { yylval.i =1 ;return UNIT;} 6733965Sjdp"bit" { yylval.i = 1; return UNIT;} 6833965Sjdp"bytes" { yylval.i= 8; return UNIT;} 6933965Sjdp"byte" { yylval.i = 8; return UNIT;} 7033965Sjdp 7133965Sjdp"int" { yylval.s = "INT"; return TYPE;} 7233965Sjdp"barray" { yylval.s = "BARRAY"; return TYPE;} 7333965Sjdp"chars" { yylval.s = "CHARS"; return TYPE;} 7433965Sjdp"variable" { yylval.i = 0; return NUMBER;} 7533965Sjdp"counted" { yylval.i = -4; return NUMBER;} 7633965Sjdp"addrsize" { yylval.i = -2; return NUMBER; } 7733965Sjdp"segsize" { yylval.i = -1; return NUMBER; } 7833965Sjdp"cond" { return COND;} 7933965Sjdp"repeat" { return REPEAT;} 80