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