1 /* A lexical scanner for NetHack generated by flex */
3 /* Scanner skeleton version:
4 * flexhack.skl 3.3.0 (from .../flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47)
6 #define FLEXHACK_SCANNER
7 #define YY_FLEX_MAJOR_VERSION 2
8 #define YY_FLEX_MINOR_VERSION 5
11 #define yyconst const /* some code inserted by flex will refer to yyconst */
13 /* Returned upon end-of-file. */
16 /* Promotes a possibly negative, possibly signed char to an unsigned
17 * integer for use as an array index. If the signed char is negative,
18 * we want to instead treat it as an 8-bit unsigned char, hence the
21 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
23 /* Enter a start condition. This macro really ought to take a parameter,
24 * but we do it the disgusting crufty way forced on us by the ()-less
25 * definition of BEGIN.
27 #define BEGIN yy_start = 1 + 2 *
29 /* Translate the current start state into a value that can be later handed
30 * to BEGIN to return to the state. The YYSTATE alias is for lex
33 #define YY_START ((yy_start - 1) / 2)
34 #define YYSTATE YY_START
36 /* Action number for EOF rule of a given start state. */
37 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
39 /* Special action meaning "start processing a new file". */
40 #define YY_NEW_FILE yyrestart( yyin )
42 #define YY_END_OF_BUFFER_CHAR 0
44 /* Size of default input buffer. */
45 #define YY_BUF_SIZE 16384
47 typedef struct yy_buffer_state *YY_BUFFER_STATE;
50 extern FILE *yyin, *yyout;
52 #define EOB_ACT_CONTINUE_SCAN 0
53 #define EOB_ACT_END_OF_FILE 1
54 #define EOB_ACT_LAST_MATCH 2
56 /* Return all but the first 'n' matched characters back to the input stream. */
60 /* Undo effects of setting up yytext. */ \
61 *yy_cp = yy_hold_char; \
62 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
63 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
67 #define unput(c) yyunput( c, yytext_ptr )
69 /* The following is because we cannot portably get our hands on size_t
70 * (without autoconf's help, which isn't available because we want
71 * flex-generated scanners to compile on their own).
73 typedef unsigned int yy_size_t;
76 struct yy_buffer_state
80 char *yy_ch_buf; /* input buffer */
81 char *yy_buf_pos; /* current position in input buffer */
83 /* Size of input buffer in bytes, not including room for EOB
86 yy_size_t yy_buf_size;
88 /* Number of characters read into yy_ch_buf, not including EOB
93 /* Whether we "own" the buffer - i.e., we know we created it,
94 * and can realloc() it to grow it, and should free() it to
99 /* Whether this is an "interactive" input source; if so, and
100 * if we're using stdio for input, then we want to use getc()
101 * instead of fread(), to make sure we stop fetching input after
104 int yy_is_interactive;
106 /* Whether we're considered to be at the beginning of a line.
107 * If so, '^' rules will be active on the next match, otherwise
112 /* Whether to try to fill the input buffer when we reach the
117 int yy_buffer_status;
118 #define YY_BUFFER_NEW 0
119 #define YY_BUFFER_NORMAL 1
120 /* When an EOF's been seen but there's still some text to process
121 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
122 * shouldn't try reading from the input source any more. We might
123 * still have a bunch of tokens to match, though, because of
124 * possible backing-up.
126 * When we actually see the EOF, we change the status to "new"
127 * (via yyrestart()), so that the user can continue scanning by
128 * just pointing yyin at a new input file.
130 #define YY_BUFFER_EOF_PENDING 2
133 static YY_BUFFER_STATE yy_current_buffer = 0;
135 /* We provide macros for accessing buffer states in case in the
136 * future we want to put the buffer states in a more general
139 #define YY_CURRENT_BUFFER yy_current_buffer
141 /* yy_hold_char holds the character lost when yytext is formed. */
142 static char yy_hold_char;
144 static int yy_n_chars; /* number of characters read into yy_ch_buf */
148 /* Points to current character in buffer. */
149 static char *yy_c_buf_p = (char *) 0;
150 static int yy_init = 1; /* whether we need to initialize */
151 static int yy_start = 0; /* start state number */
153 /* Flag which is used to allow yywrap()'s to do buffer switches
154 * instead of setting up a fresh yyin. A bit of a hack ...
156 static int yy_did_buffer_switch_on_eof;
158 void FDECL(yyrestart, (FILE *));
160 void FDECL(yy_switch_to_buffer, (YY_BUFFER_STATE));
161 void NDECL(yy_load_buffer_state);
162 YY_BUFFER_STATE FDECL(yy_create_buffer, (FILE *,int));
163 void FDECL(yy_delete_buffer, (YY_BUFFER_STATE));
164 void FDECL(yy_init_buffer, (YY_BUFFER_STATE,FILE *));
165 void FDECL(yy_flush_buffer, (YY_BUFFER_STATE));
166 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
168 static genericptr_t FDECL(yy_flex_alloc, (yy_size_t));
169 static genericptr_t FDECL(yy_flex_realloc2, (genericptr_t,yy_size_t,int));
170 static void FDECL(yy_flex_free, (genericptr_t));
172 #define yy_new_buffer yy_create_buffer
174 #define yy_set_interactive(is_interactive) \
176 if ( ! yy_current_buffer ) \
177 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
178 yy_current_buffer->yy_is_interactive = is_interactive; \
181 #define yy_set_bol(at_bol) \
183 if ( ! yy_current_buffer ) \
184 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
185 yy_current_buffer->yy_at_bol = at_bol; \
188 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
190 typedef unsigned char YY_CHAR;
191 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
192 typedef int yy_state_type;
194 #define yytext_ptr yytext
196 static yy_state_type NDECL(yy_get_previous_state);
197 static yy_state_type FDECL(yy_try_NUL_trans, (yy_state_type));
198 static int NDECL(yy_get_next_buffer);
199 static void FDECL(yy_fatal_error, (const char *));
201 /* Done after the current pattern has been matched and before the
202 * corresponding action - sets up yytext.
204 #define YY_DO_BEFORE_ACTION \
205 yytext_ptr = yy_bp; \
206 yyleng = (int) (yy_cp - yy_bp); \
207 yy_hold_char = *yy_cp; \
211 #define YY_NUM_RULES 35
212 #define YY_END_OF_BUFFER 36
213 static yyconst short int yy_accept[196] =
215 0, 0, 36, 34, 33, 32, 34, 34, 29, 34,
216 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
217 34, 34, 34, 34, 34, 34, 34, 34, 34, 33,
218 32, 0, 30, 29, 0, 0, 0, 0, 0, 0,
219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
220 0, 0, 0, 0, 0, 2, 0, 31, 0, 0,
221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
224 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
226 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
227 4, 0, 25, 0, 0, 0, 0, 0, 0, 0,
228 0, 0, 6, 0, 0, 0, 5, 0, 0, 23,
229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
230 0, 20, 0, 0, 0, 0, 8, 0, 0, 0,
231 0, 0, 0, 1, 0, 0, 0, 0, 0, 22,
232 15, 0, 21, 7, 19, 0, 0, 0, 0, 0,
233 0, 13, 0, 0, 0, 26, 16, 0, 0, 12,
234 0, 0, 0, 11, 9, 0, 17, 18, 0, 27,
239 static yyconst int yy_ec[256] =
241 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
242 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
243 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
244 1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
245 1, 1, 1, 1, 7, 1, 1, 7, 7, 7,
246 7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
247 1, 1, 1, 1, 8, 9, 10, 11, 12, 13,
248 14, 15, 16, 1, 1, 17, 18, 19, 20, 21,
249 1, 22, 23, 24, 25, 26, 1, 1, 27, 1,
250 1, 1, 1, 1, 28, 1, 29, 1, 30, 31,
252 32, 33, 34, 35, 36, 1, 37, 38, 39, 40,
253 41, 42, 1, 43, 44, 45, 46, 1, 47, 1,
254 1, 48, 1, 1, 1, 1, 1, 1, 1, 1,
255 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
256 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
257 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
258 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
259 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
260 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
261 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
263 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
264 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
265 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
266 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
267 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
271 static yyconst int yy_meta[49] =
273 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
274 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
275 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
276 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
277 1, 1, 1, 1, 1, 1, 1, 1
280 static yyconst short int yy_base[198] =
282 0, 213, 218, 220, 215, 220, 213, 210, 207, 196,
283 190, 196, 37, 191, 197, 186, 188, 171, 164, 172,
284 174, 173, 18, 160, 159, 154, 157, 11, 194, 194,
285 220, 190, 220, 187, 177, 184, 183, 167, 170, 164,
286 161, 166, 174, 155, 136, 144, 134, 132, 133, 26,
287 135, 143, 147, 128, 145, 220, 170, 220, 158, 152,
288 154, 159, 154, 145, 44, 142, 47, 124, 124, 125,
289 129, 129, 115, 27, 121, 113, 111, 120, 115, 116,
290 134, 142, 132, 128, 137, 121, 130, 129, 125, 129,
291 131, 97, 220, 105, 94, 101, 95, 96, 94, 99,
293 105, 101, 89, 220, 95, 112, 114, 51, 112, 107,
294 220, 110, 114, 111, 106, 96, 85, 76, 81, 82,
295 88, 69, 220, 81, 76, 75, 220, 78, 99, 220,
296 88, 97, 87, 88, 92, 93, 88, 91, 90, 71,
297 65, 220, 62, 60, 57, 56, 220, 59, 54, 74,
298 84, 65, 66, 220, 70, 65, 70, 60, 68, 220,
299 220, 52, 220, 220, 220, 46, 50, 57, 61, 67,
300 62, 220, 67, 64, 63, 220, 220, 42, 41, 220,
301 61, 53, 49, 220, 220, 50, 220, 220, 51, 220,
302 46, 220, 220, 220, 220, 62, 60
306 static yyconst short int yy_def[198] =
308 195, 1, 195, 195, 195, 195, 195, 196, 195, 195,
309 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
310 195, 195, 195, 195, 195, 195, 195, 195, 197, 195,
311 195, 196, 195, 195, 195, 195, 195, 195, 195, 195,
312 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
313 195, 195, 195, 195, 195, 195, 197, 195, 195, 195,
314 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
315 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
316 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
317 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
319 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
320 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
321 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
322 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
323 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
324 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
325 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
326 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
327 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
328 195, 195, 195, 195, 0, 195, 195
332 static yyconst short int yy_nxt[269] =
334 4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
335 13, 14, 4, 4, 4, 4, 15, 4, 4, 4,
336 16, 17, 4, 4, 4, 4, 4, 4, 4, 18,
337 19, 4, 4, 4, 20, 4, 4, 21, 22, 23,
338 4, 24, 25, 26, 27, 28, 4, 4, 38, 49,
339 55, 87, 56, 74, 75, 88, 90, 98, 50, 131,
340 57, 39, 32, 91, 194, 193, 192, 132, 191, 190,
341 189, 188, 99, 187, 186, 185, 184, 183, 182, 181,
342 180, 179, 178, 177, 176, 175, 174, 173, 172, 171,
343 170, 169, 168, 167, 166, 165, 164, 163, 162, 161,
345 160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
346 150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
347 140, 139, 138, 137, 136, 135, 134, 133, 130, 129,
348 128, 127, 126, 125, 124, 123, 122, 121, 120, 119,
349 118, 117, 116, 115, 114, 113, 112, 111, 110, 109,
350 108, 107, 106, 105, 104, 103, 102, 101, 100, 97,
351 96, 95, 94, 93, 92, 89, 86, 85, 84, 83,
352 82, 81, 58, 80, 79, 78, 77, 76, 73, 72,
353 71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
354 61, 60, 59, 34, 33, 30, 58, 54, 53, 52,
356 51, 48, 47, 46, 45, 44, 43, 42, 41, 40,
357 37, 36, 35, 34, 33, 31, 30, 195, 29, 3,
358 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
359 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
360 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
361 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
362 195, 195, 195, 195, 195, 195, 195, 195
365 static yyconst short int yy_chk[269] =
367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
369 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
371 1, 1, 1, 1, 1, 1, 1, 1, 13, 23,
372 28, 65, 28, 50, 50, 65, 67, 74, 23, 108,
373 197, 13, 196, 67, 191, 189, 186, 108, 183, 182,
374 181, 179, 74, 178, 175, 174, 173, 171, 170, 169,
375 168, 167, 166, 162, 159, 158, 157, 156, 155, 153,
376 152, 151, 150, 149, 148, 146, 145, 144, 143, 141,
378 140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
379 129, 128, 126, 125, 124, 122, 121, 120, 119, 118,
380 117, 116, 115, 114, 113, 112, 110, 109, 107, 106,
381 105, 103, 102, 101, 100, 99, 98, 97, 96, 95,
382 94, 92, 91, 90, 89, 88, 87, 86, 85, 84,
383 83, 82, 81, 80, 79, 78, 77, 76, 75, 73,
384 72, 71, 70, 69, 68, 66, 64, 63, 62, 61,
385 60, 59, 57, 55, 54, 53, 52, 51, 49, 48,
386 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
387 37, 36, 35, 34, 32, 30, 29, 27, 26, 25,
389 24, 22, 21, 20, 19, 18, 17, 16, 15, 14,
390 12, 11, 10, 9, 8, 7, 5, 3, 2, 195,
391 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
392 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
393 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
394 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
395 195, 195, 195, 195, 195, 195, 195, 195
398 static yy_state_type yy_last_accepting_state;
399 static char *yy_last_accepting_cpos;
401 /* The intent behind this definition is that it'll catch
402 * any uses of REJECT which flex missed.
404 #define REJECT reject_used_but_not_detected
405 #define yymore() yymore_used_but_not_detected
406 #define YY_MORE_ADJ 0
409 /* SCCS Id: @(#)dgn_lex.c 3.4 2002/03/27 */
410 /* Copyright (c) 1989 by Jean-Christophe Collet */
411 /* Copyright (c) 1990 by M. Stephenson */
412 /* NetHack may be freely redistributed. See license for details. */
417 #include "dgn_comp.h"
418 #include "dgn_file.h"
421 * Most of these don't exist in flex, yywrap is macro and
422 * yyunput is properly declared in flex.skel.
424 #if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
425 int FDECL(yyback, (int *,int));
430 /* Traditional lexes let yyunput() and yyoutput() default to int;
431 * newer ones may declare them as void since they don't return
432 * values. For even more fun, the lex supplied as part of the
433 * newer unbundled compiler for SunOS 4.x adds the void declarations
434 * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain
435 * int) while the bundled lex and the one with the older unbundled
436 * compiler do not. To detect this, we need help from outside --
437 * sys/unix/Makefile.utl.
439 * Digital UNIX is difficult and still has int in spite of all
442 # if defined(NeXT) || defined(SVR4) || defined(_AIX32)
445 # if !defined(VOIDYYPUT) && defined(POSIX_TYPES)
446 # if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS)
450 # if !defined(VOIDYYPUT) && defined(WEIRD_LEX)
451 # if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1)
455 # if defined(VOIDYYPUT) && defined(__osf__)
459 void FDECL(yyunput, (int));
460 void FDECL(yyoutput, (int));
462 int FDECL(yyunput, (int));
463 int FDECL(yyoutput, (int));
465 #endif /* !FLEX_SCANNER && !FLEXHACK_SCANNER */
468 #define YY_MALLOC_DECL \
469 genericptr_t FDECL(malloc, (size_t)); \
470 genericptr_t FDECL(realloc, (genericptr_t,size_t));
474 void FDECL(init_yyin, (FILE *));
475 void FDECL(init_yyout, (FILE *));
477 /* this doesn't always get put in dgn_comp.h
478 * (esp. when using older versions of bison)
481 extern YYSTYPE yylval;
486 /* Macros after this point can all be overridden by user definitions in
490 #ifndef YY_SKIP_YYWRAP
491 extern int NDECL(yywrap);
495 static void FDECL(yyunput, (int,char *));
499 static void FDECL(yy_flex_strncpy, (char *,const char *,int));
503 static int NDECL(input);
506 /* Amount of stuff to slurp up with each read. */
507 #ifndef YY_READ_BUF_SIZE
508 #define YY_READ_BUF_SIZE 8192
511 /* Copy whatever the last rule matched to the standard output. */
514 /* This used to be an fputs(), but since the string might contain NUL's,
515 * we now use fwrite().
517 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
520 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
521 * is returned in "result".
524 #define YY_INPUT(buf,result,max_size) \
525 if ( yy_current_buffer->yy_is_interactive ) \
528 for ( n = 0; n < max_size && \
529 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
532 buf[n++] = (char) c; \
533 if ( c == EOF && ferror( yyin ) ) \
534 YY_FATAL_ERROR( "input in flex scanner failed" ); \
537 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
538 && ferror( yyin ) ) \
539 YY_FATAL_ERROR( "input in flex scanner failed" );
542 /* No semi-colon after return; correct usage is to write "yyterminate();" -
543 * we don't want an extra ';' after the "return" because that will cause
544 * some compilers to complain about unreachable statements.
547 #define yyterminate() return YY_NULL
550 /* Number of entries by which start-condition stack grows. */
551 #ifndef YY_START_STACK_INCR
552 #define YY_START_STACK_INCR 25
555 /* Report a fatal error. */
556 #ifndef YY_FATAL_ERROR
557 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
560 /* Code executed at the beginning of each rule, after yytext and yyleng
563 #ifndef YY_USER_ACTION
564 #define YY_USER_ACTION
567 /* Code executed at the end of each rule. */
569 #define YY_BREAK break;
572 #define YY_RULE_SETUP \
574 yy_current_buffer->yy_at_bol = \
575 (yytext[yyleng - 1] == '\n'); \
581 register yy_state_type yy_current_state;
582 register char *yy_cp, *yy_bp;
596 yy_start = 1; /* first start state */
604 if ( ! yy_current_buffer )
606 yy_create_buffer( yyin, YY_BUF_SIZE );
608 yy_load_buffer_state();
611 while ( 1 ) /* loops until end-of-file is reached */
615 /* Support of yytext. */
616 *yy_cp = yy_hold_char;
618 /* yy_bp points to the position in yy_ch_buf of the start of
623 yy_current_state = yy_start;
624 yy_current_state += YY_AT_BOL();
628 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
629 if ( yy_accept[yy_current_state] )
631 yy_last_accepting_state = yy_current_state;
632 yy_last_accepting_cpos = yy_cp;
634 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
636 yy_current_state = (int) yy_def[yy_current_state];
637 if ( yy_current_state >= 196 )
638 yy_c = yy_meta[(unsigned int) yy_c];
640 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
643 while ( yy_base[yy_current_state] != 220 );
646 yy_act = yy_accept[yy_current_state];
648 { /* have to back up */
649 yy_cp = yy_last_accepting_cpos;
650 yy_current_state = yy_last_accepting_state;
651 yy_act = yy_accept[yy_current_state];
657 do_action: /* This label is used only to access EOF actions. */
661 { /* beginning of action switch */
662 case 0: /* must back up */
663 /* undo the effects of YY_DO_BEFORE_ACTION */
664 *yy_cp = yy_hold_char;
665 yy_cp = yy_last_accepting_cpos;
666 yy_current_state = yy_last_accepting_state;
675 { yylval.i=1; return(UP_OR_DOWN); }
679 { yylval.i=0; return(UP_OR_DOWN); }
723 { yylval.i=TOWN ; return(DESCRIPTOR); }
727 { yylval.i=HELLISH ; return(DESCRIPTOR); }
731 { yylval.i=MAZELIKE ; return(DESCRIPTOR); }
735 { yylval.i=ROGUELIKE ; return(DESCRIPTOR); }
739 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
743 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
747 { yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); }
751 { yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); }
755 { yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); }
783 { yylval.i=atoi(yytext); return(INTEGER); }
787 { yytext[yyleng-1] = 0; /* Discard the trailing \" */
788 yylval.str = (char *) alloc(strlen(yytext+1)+1);
789 Strcpy(yylval.str, yytext+1); /* Discard the first \" */
802 ; /* skip trailing tabs & spaces */
806 { return yytext[0]; }
812 case YY_STATE_EOF(INITIAL):
815 case YY_END_OF_BUFFER:
817 /* Amount of text matched not including the EOB char. */
818 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
820 /* Undo the effects of YY_DO_BEFORE_ACTION. */
821 *yy_cp = yy_hold_char;
823 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
825 /* We're scanning a new file or input source. It's
826 * possible that this happened because the user
827 * just pointed yyin at a new source and called
828 * yylex(). If so, then we have to assure
829 * consistency between yy_current_buffer and our
830 * globals. Here is the right place to do so, because
831 * this is the first action (other than possibly a
832 * back-up) that will match for the new input source.
834 yy_n_chars = yy_current_buffer->yy_n_chars;
835 yy_current_buffer->yy_input_file = yyin;
836 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
839 /* Note that here we test for yy_c_buf_p "<=" to the position
840 * of the first EOB in the buffer, since yy_c_buf_p will
841 * already have been incremented past the NUL character
842 * (since all states make transitions on EOB to the
843 * end-of-buffer state). Contrast this with the test
846 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
847 { /* This was really a NUL. */
848 yy_state_type yy_next_state;
850 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
852 yy_current_state = yy_get_previous_state();
854 /* Okay, we're now positioned to make the NUL
855 * transition. We couldn't have
856 * yy_get_previous_state() go ahead and do it
857 * for us because it doesn't know how to deal
858 * with the possibility of jamming (and we don't
859 * want to build jamming into it because then it
860 * will run more slowly).
863 yy_next_state = yy_try_NUL_trans( yy_current_state );
865 yy_bp = yytext_ptr + YY_MORE_ADJ;
869 /* Consume the NUL. */
870 yy_cp = ++yy_c_buf_p;
871 yy_current_state = yy_next_state;
882 else switch ( yy_get_next_buffer() )
884 case EOB_ACT_END_OF_FILE:
886 yy_did_buffer_switch_on_eof = 0;
890 /* Note: because we've taken care in
891 * yy_get_next_buffer() to have set up
892 * yytext, we can now set up
893 * yy_c_buf_p so that if some total
894 * hoser (like flex itself) wants to
895 * call the scanner after we return the
896 * YY_NULL, it'll still work - another
897 * YY_NULL will get returned.
899 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
901 yy_act = YY_STATE_EOF(YY_START);
907 if ( ! yy_did_buffer_switch_on_eof )
913 case EOB_ACT_CONTINUE_SCAN:
915 yytext_ptr + yy_amount_of_matched_text;
917 yy_current_state = yy_get_previous_state();
920 yy_bp = yytext_ptr + YY_MORE_ADJ;
923 case EOB_ACT_LAST_MATCH:
925 &yy_current_buffer->yy_ch_buf[yy_n_chars];
927 yy_current_state = yy_get_previous_state();
930 yy_bp = yytext_ptr + YY_MORE_ADJ;
938 "fatal flex scanner internal error--no action found" );
939 } /* end of action switch */
940 } /* end of scanning one token */
944 /* yy_get_next_buffer - try to read in a new buffer
946 * Returns a code representing an action:
947 * EOB_ACT_LAST_MATCH -
948 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
949 * EOB_ACT_END_OF_FILE - end of file
952 static int yy_get_next_buffer()
954 register char *dest = yy_current_buffer->yy_ch_buf;
955 register char *source = yytext_ptr;
956 register int number_to_move, i;
959 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
961 "fatal flex scanner internal error--end of buffer missed" );
963 if ( yy_current_buffer->yy_fill_buffer == 0 )
964 { /* Don't try to fill the buffer, so this is an EOF. */
965 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
967 /* We matched a singled characater, the EOB, so
968 * treat this as a final EOF.
970 return EOB_ACT_END_OF_FILE;
975 /* We matched some text prior to the EOB, first
978 return EOB_ACT_LAST_MATCH;
982 /* Try to read more data. */
984 /* First move last chars to start of buffer. */
985 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
987 for ( i = 0; i < number_to_move; ++i )
988 *(dest++) = *(source++);
990 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
991 /* don't do the read, it's not guaranteed to return an EOF,
999 yy_current_buffer->yy_buf_size - number_to_move - 1;
1001 while ( num_to_read <= 0 )
1002 { /* Not enough room in the buffer - grow it. */
1003 #ifdef YY_USES_REJECT
1005 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1008 /* just a shorter name for the current buffer */
1009 YY_BUFFER_STATE b = yy_current_buffer;
1011 int yy_c_buf_p_offset =
1012 (int) (yy_c_buf_p - b->yy_ch_buf);
1014 if ( b->yy_is_our_buffer )
1016 int old_size = b->yy_buf_size + 2;
1017 int new_size = b->yy_buf_size * 2;
1019 if ( new_size <= 0 )
1020 b->yy_buf_size += b->yy_buf_size / 8;
1022 b->yy_buf_size *= 2;
1024 b->yy_ch_buf = (char *)
1025 /* Include room in for 2 EOB chars. */
1026 yy_flex_realloc2( (genericptr_t) b->yy_ch_buf,
1027 b->yy_buf_size + 2, old_size );
1030 /* Can't grow it, we don't own it. */
1033 if ( ! b->yy_ch_buf )
1035 "fatal error - scanner input buffer overflow" );
1037 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1039 num_to_read = yy_current_buffer->yy_buf_size -
1044 if ( num_to_read > YY_READ_BUF_SIZE )
1045 num_to_read = YY_READ_BUF_SIZE;
1047 /* Read in more data. */
1048 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1049 yy_n_chars, num_to_read );
1052 if ( yy_n_chars == 0 )
1054 if ( number_to_move == YY_MORE_ADJ )
1056 ret_val = EOB_ACT_END_OF_FILE;
1062 ret_val = EOB_ACT_LAST_MATCH;
1063 yy_current_buffer->yy_buffer_status =
1064 YY_BUFFER_EOF_PENDING;
1069 ret_val = EOB_ACT_CONTINUE_SCAN;
1071 yy_n_chars += number_to_move;
1072 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1073 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1075 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1081 /* yy_get_previous_state - get the state just before the EOB char was reached */
1083 static yy_state_type yy_get_previous_state()
1085 register yy_state_type yy_current_state;
1086 register char *yy_cp;
1088 yy_current_state = yy_start;
1089 yy_current_state += YY_AT_BOL();
1091 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1093 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1094 if ( yy_accept[yy_current_state] )
1096 yy_last_accepting_state = yy_current_state;
1097 yy_last_accepting_cpos = yy_cp;
1099 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1101 yy_current_state = (int) yy_def[yy_current_state];
1102 if ( yy_current_state >= 196 )
1103 yy_c = yy_meta[(unsigned int) yy_c];
1105 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1108 return yy_current_state;
1112 /* yy_try_NUL_trans - try to make a transition on the NUL character
1115 * next_state = yy_try_NUL_trans( current_state );
1118 static yy_state_type yy_try_NUL_trans( yy_current_state )
1119 yy_state_type yy_current_state;
1121 register int yy_is_jam;
1122 register char *yy_cp = yy_c_buf_p;
1124 register YY_CHAR yy_c = 1;
1125 if ( yy_accept[yy_current_state] )
1127 yy_last_accepting_state = yy_current_state;
1128 yy_last_accepting_cpos = yy_cp;
1130 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1132 yy_current_state = (int) yy_def[yy_current_state];
1133 if ( yy_current_state >= 196 )
1134 yy_c = yy_meta[(unsigned int) yy_c];
1136 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1137 yy_is_jam = (yy_current_state == 195);
1139 return yy_is_jam ? 0 : yy_current_state;
1144 static void yyunput( c, yy_bp )
1146 register char *yy_bp;
1148 register char *yy_cp = yy_c_buf_p;
1150 /* undo effects of setting up yytext */
1151 *yy_cp = yy_hold_char;
1153 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1154 { /* need to shift things up to make room */
1155 /* +2 for EOB chars. */
1156 register int number_to_move = yy_n_chars + 2;
1157 register char *dest = &yy_current_buffer->yy_ch_buf[
1158 yy_current_buffer->yy_buf_size + 2];
1159 register char *source =
1160 &yy_current_buffer->yy_ch_buf[number_to_move];
1162 while ( source > yy_current_buffer->yy_ch_buf )
1163 *--dest = *--source;
1165 yy_cp += (int) (dest - source);
1166 yy_bp += (int) (dest - source);
1167 yy_n_chars = yy_current_buffer->yy_buf_size;
1169 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1170 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1173 *--yy_cp = (char) c;
1177 yy_hold_char = *yy_cp;
1180 #endif /* ifndef YY_NO_UNPUT */
1187 *yy_c_buf_p = yy_hold_char;
1189 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1191 /* yy_c_buf_p now points to the character we want to return.
1192 * If this occurs *before* the EOB characters, then it's a
1193 * valid NUL; if not, then we've hit the end of the buffer.
1195 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1196 /* This was really a NUL. */
1200 { /* need more input */
1201 yytext_ptr = yy_c_buf_p;
1204 switch ( yy_get_next_buffer() )
1206 case EOB_ACT_END_OF_FILE:
1211 yytext_ptr + YY_MORE_ADJ;
1215 if ( ! yy_did_buffer_switch_on_eof )
1220 case EOB_ACT_CONTINUE_SCAN:
1221 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1224 case EOB_ACT_LAST_MATCH:
1226 "unexpected last match in input()" );
1231 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1232 *yy_c_buf_p = '\0'; /* preserve yytext */
1233 yy_hold_char = *++yy_c_buf_p;
1235 yy_current_buffer->yy_at_bol = (c == '\n');
1241 void yyrestart( input_file )
1244 if ( ! yy_current_buffer )
1245 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1247 yy_init_buffer( yy_current_buffer, input_file );
1248 yy_load_buffer_state();
1252 void yy_switch_to_buffer( new_buffer )
1253 YY_BUFFER_STATE new_buffer;
1255 if ( yy_current_buffer == new_buffer )
1258 if ( yy_current_buffer )
1260 /* Flush out information for old buffer. */
1261 *yy_c_buf_p = yy_hold_char;
1262 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1263 yy_current_buffer->yy_n_chars = yy_n_chars;
1266 yy_current_buffer = new_buffer;
1267 yy_load_buffer_state();
1269 /* We don't actually know whether we did this switch during
1270 * EOF (yywrap()) processing, but the only time this flag
1271 * is looked at is after yywrap() is called, so it's safe
1272 * to go ahead and always set it.
1274 yy_did_buffer_switch_on_eof = 1;
1278 void yy_load_buffer_state()
1280 yy_n_chars = yy_current_buffer->yy_n_chars;
1281 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1282 yyin = yy_current_buffer->yy_input_file;
1283 yy_hold_char = *yy_c_buf_p;
1287 YY_BUFFER_STATE yy_create_buffer( file, size )
1293 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1295 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1297 b->yy_buf_size = size;
1299 /* yy_ch_buf has to be 2 characters longer than the size given because
1300 * we need to put in 2 end-of-buffer characters.
1302 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1303 if ( ! b->yy_ch_buf )
1304 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1306 b->yy_is_our_buffer = 1;
1308 yy_init_buffer( b, file );
1314 void yy_delete_buffer( b )
1320 if ( b == yy_current_buffer )
1321 yy_current_buffer = (YY_BUFFER_STATE) 0;
1323 if ( b->yy_is_our_buffer )
1324 yy_flex_free( (genericptr_t) b->yy_ch_buf );
1326 yy_flex_free( (genericptr_t) b );
1330 #ifndef YY_ALWAYS_INTERACTIVE
1331 #ifndef YY_NEVER_INTERACTIVE
1332 extern int FDECL(isatty, (int));
1336 void yy_init_buffer( b, file )
1340 yy_flush_buffer( b );
1342 b->yy_input_file = file;
1343 b->yy_fill_buffer = 1;
1345 #ifdef YY_ALWAYS_INTERACTIVE
1346 b->yy_is_interactive = 1;
1348 #ifdef YY_NEVER_INTERACTIVE
1349 b->yy_is_interactive = 0;
1351 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1357 void yy_flush_buffer( b )
1362 /* We always need two end-of-buffer characters. The first causes
1363 * a transition to the end-of-buffer state. The second causes
1364 * a jam in that state.
1366 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1367 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1369 b->yy_buf_pos = &b->yy_ch_buf[0];
1372 b->yy_buffer_status = YY_BUFFER_NEW;
1374 if ( b == yy_current_buffer )
1375 yy_load_buffer_state();
1380 #ifndef YY_EXIT_FAILURE
1381 #define YY_EXIT_FAILURE 2
1384 static void yy_fatal_error( msg )
1387 (void) fprintf( stderr, "%s\n", msg );
1388 exit( YY_EXIT_FAILURE );
1393 /* Redefine yyless() so it works in section 3 code. */
1399 /* Undo effects of setting up yytext. */ \
1400 yytext[yyleng] = yy_hold_char; \
1401 yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
1402 yy_hold_char = *yy_c_buf_p; \
1403 *yy_c_buf_p = '\0'; \
1409 /* Internal utility routines. */
1412 static void yy_flex_strncpy( s1, s2, n )
1418 for ( i = 0; i < n; ++i )
1424 static genericptr_t yy_flex_alloc( size )
1427 return (genericptr_t) alloc((unsigned)size);
1430 /* we want to avoid use of realloc(), so we require that caller supply the
1431 size of the old block of memory */
1432 static genericptr_t yy_flex_realloc2( ptr, size, old_size )
1437 genericptr_t outptr = yy_flex_alloc(size);
1440 char *p = (char *) outptr, *q = (char *) ptr;
1442 while (--old_size >= 0) *p++ = *q++;
1448 static void yy_flex_free( ptr )
1457 /* routine to switch to another input file; needed for flex */
1458 void init_yyin( input_f )
1461 #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
1468 /* analogous routine (for completeness) */
1469 void init_yyout( output_f )