2 /* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc.
3 Written by Ulrich Drepper <drepper@redhat.com>, 2004.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
8 * the GNU Lesser General Public License as published by the Free
9 Software Foundation; either version 3 of the License, or (at
10 your option) any later version
14 * the GNU General Public License as published by the Free
15 Software Foundation; either version 2 of the License, or (at
16 your option) any later version
18 or both in parallel, as here.
20 elfutils is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received copies of the GNU General Public License and
26 the GNU Lesser General Public License along with this program. If
27 not, see <http://www.gnu.org/licenses/>. */
38 #include "i386_parse.h"
41 static void eat_to_eol (void);
42 static void invalid_char (int ch);
45 ID [a-zA-Z_][a-zA-Z0-9_/]*
51 %option never-interactive
59 "%mask" { return kMASK; }
61 "%prefix" { return kPREFIX; }
62 "%suffix" { return kSUFFIX; }
64 "%synonym" { return kSYNONYM; }
66 {NUMBER} { i386_lval.num = strtoul (yytext, NULL, 10);
69 "%%" { BEGIN (MAIN); return kPERCPERC; }
72 <MAIN>"0" { return '0'; }
73 <MAIN>"1" { return '1'; }
75 <INITIAL,MAIN>"{"{ID2}"}" { i386_lval.str = xstrndup (yytext + 1,
79 <MAIN>"INVALID" { i386_lval.str = (void *) -1l;
82 <MAIN>{ID} { i386_lval.str = xstrndup (yytext, yyleng);
85 <MAIN>"," { return ','; }
87 <MAIN>":" { return ':'; }
89 <INITIAL,MAIN>^"\n" { /* IGNORE */ }
91 <INITIAL,MAIN>"\n" { return '\n'; }
93 <INITIAL,MAIN>^"#" { eat_to_eol (); }
95 {WHITE} { /* IGNORE */ }
97 <MAIN>{WHITE} { return kSPACE; }
99 <MAIN>. { i386_lval.ch = *yytext; return kCHAR; }
101 . { invalid_char (*yytext); }
113 if (c == EOF || c == '\n')
119 invalid_char (int ch)
121 error (0, 0, (isascii (ch)
122 ? gettext ("invalid character '%c' at line %d; ignored")
123 : gettext ("invalid character '\\%o' at line %d; ignored")),