1%{
2/* arlex.l - Strange script language lexer */
3
4/* Copyright 1992, 1997, 2000, 2001, 2002, 2003, 2004
5   Free Software Foundation, Inc.
6
7This file is part of GNU Binutils.
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
22
23
24/* Contributed by Steve Chamberlain <sac@cygnus.com>.  */
25
26#define DONTDECLARE_MALLOC
27#include "ansidecl.h"
28#include "libiberty.h"
29#include "arparse.h"
30
31extern int yylex (void);
32
33int linenumber;
34%}
35
36%option nounput
37
38%a 10000
39%o 25000
40
41%%
42
43"ADDLIB"   	{ return ADDLIB; }
44"ADDMOD"   	{ return ADDMOD; }
45"CLEAR"   	{ return CLEAR; }
46"CREATE"   	{ return CREATE; }
47"DELETE"   	{ return DELETE; }
48"DIRECTORY"   	{ return DIRECTORY; }
49"END"   	{ return END; }
50"EXTRACT"   	{ return EXTRACT; }
51"FULLDIR"   	{ return FULLDIR; }
52"HELP"   	{ return HELP; }
53"LIST"		{ return LIST; }
54"OPEN"   	{ return OPEN; }
55"REPLACE"   	{ return REPLACE; }
56"VERBOSE"   	{ return VERBOSE; }
57"SAVE"   	{ return SAVE; }
58"addlib"   	{ return ADDLIB; }
59"addmod"   	{ return ADDMOD; }
60"clear"   	{ return CLEAR; }
61"create"   	{ return CREATE; }
62"delete"   	{ return DELETE; }
63"directory"   	{ return DIRECTORY; }
64"end"   	{ return END; }
65"extract"   	{ return EXTRACT; }
66"fulldir"   	{ return FULLDIR; }
67"help"   	{ return HELP; }
68"list"		{ return LIST; }
69"open"   	{ return OPEN; }
70"replace"   	{ return REPLACE; }
71"verbose"   	{ return VERBOSE; }
72"save"   	{ return SAVE; }
73"+\n"           { linenumber ++; }
74"("             { return '('; }
75")"             { return ')'; }
76","             { return ','; }
77[A-Za-z0-9/\\$:.\-\_]+  {
78		yylval.name =  xstrdup (yytext);
79		return FILENAME;
80		}
81"*".* 		{ }
82";".* 		{ }
83" "		{ }
84"\n"	 	 { linenumber ++; return NEWLINE; }
85
86%%
87#ifndef yywrap
88/* Needed for lex, though not flex. */
89int yywrap(void) { return 1; }
90#endif
91