[BACK]Return to syslex.l CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / gpl3 / binutils.old / dist / binutils

Annotation of src/external/gpl3/binutils.old/dist/binutils/syslex.l, Revision 1.1.1.1

1.1       christos    1: %option noinput nounput
                      2:
                      3: %{
                      4: /* Copyright 2001, 2003, 2005, 2007, 2011, 2012 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, or (at your option)
                     11:    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 GLD; see the file COPYING.  If not, write to the Free
                     20:    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
                     21:    02110-1301, USA.  */
                     22:
                     23: /* Note: config.h is #included via syslex_wrap.c.  */
                     24:
                     25: #ifdef HAVE_STRING_H
                     26: #include <string.h>
                     27: #else
                     28: #ifdef HAVE_STRINGS_H
                     29: #include <strings.h>
                     30: #endif
                     31: #endif
                     32:
                     33: #include "sysinfo.h"
                     34:
                     35: #ifndef YY_NO_UNPUT
                     36: #define YY_NO_UNPUT
                     37: #endif
                     38:
                     39: #ifndef yywrap
                     40: static int yywrap (void) { return 1; }
                     41: #endif
                     42:
                     43: extern int yylex (void);
                     44: %}
                     45: %%
                     46: "(" { return '(';}
                     47: ")" { return ')';}
                     48: "[" { return '[';}
                     49: "]" { return ']';}
                     50: " " { ; }
                     51: ";".* { ; }
                     52: "\t" { ; }
                     53: "\n" { ; }
                     54: "\""[^\"]*"\"" {
                     55:        yylval.s = malloc (yyleng - 1);
                     56:        memcpy (yylval.s, yytext + 1, yyleng - 2);
                     57:        yylval.s[yyleng - 2] = '\0';
                     58:         return NAME;
                     59:        }
                     60:
                     61: 0x[0-9a-f]+ {
                     62:         yylval.i = strtol(yytext,0,16);
                     63:        return  NUMBER;
                     64:        }
                     65:
                     66: [0-9]+ {
                     67:         yylval.i = atoi(yytext);
                     68:        return  NUMBER;
                     69:        }
                     70:
                     71:
                     72: "bits" { yylval.i =1 ;return UNIT;}
                     73: "bit" { yylval.i = 1; return UNIT;}
                     74: "bytes" { yylval.i= 8; return UNIT;}
                     75: "byte" { yylval.i = 8; return UNIT;}
                     76:
                     77: "int" { yylval.s = "INT"; return TYPE;}
                     78: "barray" { yylval.s = "BARRAY"; return TYPE;}
                     79: "chars" { yylval.s = "CHARS"; return TYPE;}
                     80: "variable" { yylval.i = 0; return NUMBER;}
                     81: "counted" { yylval.i = -4; return NUMBER;}
                     82: "addrsize" { yylval.i = -2; return NUMBER; }
                     83: "segsize" { yylval.i = -1; return NUMBER; }
                     84: "cond" { return COND;}
                     85: "repeat" { return REPEAT;}

CVSweb <webmaster@jp.NetBSD.org>