4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex via 'flex -S flexhack.skl'
7 * where flexhack.skl is a nethack-specific alternate skeleton derived
8 * from flex 2.6.0's skel.c (which in turn was generated from flex.skl).
10 * Support for C++, re-entrancy, and table serialization stripped out.
11 * NetHack's usage doesn't need them and we want to reduce the size and
12 * complexity of this skeleton as well as of the generated scanner code.
14 #define FLEXHACK_SCANNER
15 #define YY_FLEX_MAJOR_VERSION 2
16 #define YY_FLEX_MINOR_VERSION 6
17 #define YY_FLEX_SUBMINOR_VERSION 0
23 /* we don't care if actual types happen to have more bits than their names;
24 the tables will just take up more space, possibly slowing the parse;
25 still, allow config.h to override these via typedef+#define if desired */
27 typedef int flex_int32_t
;
30 typedef short int flex_int16_t
;
33 typedef unsigned short int flex_uint16_t
;
38 #define FDECL_dummy /*empty*/
40 /* Returned upon end-of-file. */
43 /* Promotes a possibly negative, possibly signed char to an unsigned
44 * integer for use as an array index. If the signed char is negative,
45 * we want to instead treat it as an 8-bit unsigned char, hence the
48 #define YY_SC_TO_UI(c) ((unsigned int) (uchar) c)
50 /* Enter a start condition. This macro really ought to take a parameter,
51 * but we do it the disgusting crufty way forced on us by the ()-less
52 * definition of BEGIN.
54 #define BEGIN (yy_start) = 1 + 2 *
56 /* Translate the current start state into a value that can be later handed
57 * to BEGIN to return to the state. The YYSTATE alias is for lex
60 #define YY_START (((yy_start) - 1) / 2)
61 #define YYSTATE YY_START
63 /* Action number for EOF rule of a given start state. */
64 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
66 /* Special action meaning "start processing a new file". */
67 #define YY_NEW_FILE yyrestart(yyin )
69 #define YY_END_OF_BUFFER_CHAR 0
71 /* Size of default input buffer. */
74 /* On IA-64, the buffer size is 16k, not 8k.
75 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
76 * Ditto for the __ia64__ case accordingly.
78 #define YY_BUF_SIZE 32768
80 #define YY_BUF_SIZE 16384
84 /* The state buf must be large enough to hold one state per character
87 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
89 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
90 #define YY_TYPEDEF_YY_BUFFER_STATE
91 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
94 #ifndef YY_TYPEDEF_YY_SIZE_T
95 #define YY_TYPEDEF_YY_SIZE_T
96 typedef size_t yy_size_t
;
99 extern yy_size_t yyleng
;
100 extern FILE *yyin
, *yyout
;
102 #define EOB_ACT_CONTINUE_SCAN 0
103 #define EOB_ACT_END_OF_FILE 1
104 #define EOB_ACT_LAST_MATCH 2
106 #define YY_LESS_LINENO(n)
107 #define YY_LINENO_REWIND_TO(ptr)
109 /* Return all but the first "n" matched characters back to the input stream. */
112 /* Undo effects of setting up yytext. */ \
113 int yyless_macro_arg = (n); \
114 YY_LESS_LINENO(yyless_macro_arg); \
115 *yy_cp = (yy_hold_char); \
116 YY_RESTORE_YY_MORE_OFFSET \
117 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
118 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
121 #define unput(c) yyunput( c, (yytext_ptr) )
123 #ifndef YY_STRUCT_YY_BUFFER_STATE
124 #define YY_STRUCT_YY_BUFFER_STATE
125 struct yy_buffer_state
{
128 char *yy_ch_buf
; /* input buffer */
129 char *yy_buf_pos
; /* current position in input buffer */
131 /* Size of input buffer in bytes, not including room for EOB
134 yy_size_t yy_buf_size
;
136 /* Number of characters read into yy_ch_buf, not including EOB
139 yy_size_t yy_n_chars
;
141 /* Whether we "own" the buffer - i.e., we know we created it,
142 * and can realloc() it to grow it, and should free() it to
145 int yy_is_our_buffer
;
147 /* Whether this is an "interactive" input source; if so, and
148 * if we're using stdio for input, then we want to use getc()
149 * instead of fread(), to make sure we stop fetching input after
152 int yy_is_interactive
;
154 /* Whether we're considered to be at the beginning of a line.
155 * If so, '^' rules will be active on the next match, otherwise
160 int yy_bs_lineno
; /**< The line count. */
161 int yy_bs_column
; /**< The column count. */
163 /* Whether to try to fill the input buffer when we reach the
168 int yy_buffer_status
;
170 #define YY_BUFFER_NEW 0
171 #define YY_BUFFER_NORMAL 1
172 /* When an EOF's been seen but there's still some text to process
173 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
174 * shouldn't try reading from the input source any more. We might
175 * still have a bunch of tokens to match, though, because of
176 * possible backing-up.
178 * When we actually see the EOF, we change the status to "new"
179 * (via yyrestart()), so that the user can continue scanning by
180 * just pointing yyin at a new input file.
182 #define YY_BUFFER_EOF_PENDING 2
185 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
187 /* Stack of input buffers. */
188 static size_t yy_buffer_stack_top
= 0; /**< index of top of stack. */
189 static size_t yy_buffer_stack_max
= 0; /**< capacity of stack. */
190 static YY_BUFFER_STATE
* yy_buffer_stack
= 0; /**< Stack as an array. */
192 /* We provide macros for accessing buffer states in case in the
193 * future we want to put the buffer states in a more general
196 * Returns the top of the stack, or NULL.
198 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
199 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
202 /* Same as previous macro, but useful when we know that the buffer stack is not
203 * NULL or when we need an lvalue. For internal use only.
205 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
207 /* yy_hold_char holds the character lost when yytext is formed. */
208 static char yy_hold_char
;
209 static yy_size_t yy_n_chars
; /* number of characters read into yy_ch_buf */
212 /* Points to current character in buffer. */
213 static char *yy_c_buf_p
= (char *) 0;
214 static int yy_init
= 0; /* whether we need to initialize */
215 static int yy_start
= 0; /* start state number */
217 /* Flag which is used to allow yywrap()'s to do buffer switches
218 * instead of setting up a fresh yyin. A bit of a hack ...
220 static int yy_did_buffer_switch_on_eof
;
222 void yyrestart
FDECL(FDECL_dummy
, (FILE *input_file
));
223 void yy_switch_to_buffer
FDECL(FDECL_dummy
, (YY_BUFFER_STATE new_buffer
));
224 YY_BUFFER_STATE yy_create_buffer
FDECL(FDECL_dummy
, (FILE *file
,int size
));
225 void yy_delete_buffer
FDECL(FDECL_dummy
, (YY_BUFFER_STATE b
));
226 void yy_flush_buffer
FDECL(FDECL_dummy
, (YY_BUFFER_STATE b
));
227 void yypush_buffer_state
FDECL(FDECL_dummy
, (YY_BUFFER_STATE new_buffer
));
228 void yypop_buffer_state
FDECL(FDECL_dummy
, (void ));
230 static void yyensure_buffer_stack
FDECL(FDECL_dummy
, (void ));
231 static void yy_load_buffer_state
FDECL(FDECL_dummy
, (void ));
232 static void yy_init_buffer
FDECL(FDECL_dummy
, (YY_BUFFER_STATE b
,FILE *file
));
234 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
236 YY_BUFFER_STATE yy_scan_buffer
FDECL(FDECL_dummy
, (char *base
,yy_size_t size
));
237 YY_BUFFER_STATE yy_scan_string
FDECL(FDECL_dummy
, (yyconst
char *yy_str
));
238 YY_BUFFER_STATE yy_scan_bytes
FDECL(FDECL_dummy
, (yyconst
char *bytes
,yy_size_t len
));
240 void *yyalloc
FDECL(FDECL_dummy
, (yy_size_t
));
241 void *yyrealloc
FDECL(FDECL_dummy
, (void *,yy_size_t
));
242 void yyfree
FDECL(FDECL_dummy
, (void * ));
244 #define yy_new_buffer yy_create_buffer
245 #define yy_set_interactive(is_interactive) \
247 if ( ! YY_CURRENT_BUFFER ) { \
248 yyensure_buffer_stack (); \
249 YY_CURRENT_BUFFER_LVALUE = \
250 yy_create_buffer(yyin,YY_BUF_SIZE ); \
252 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
254 #define yy_set_bol(at_bol) \
256 if ( ! YY_CURRENT_BUFFER ) { \
257 yyensure_buffer_stack (); \
258 YY_CURRENT_BUFFER_LVALUE = \
259 yy_create_buffer(yyin,YY_BUF_SIZE ); \
261 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
263 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
265 /* Begin user sect3 */
267 typedef unsigned char YY_CHAR
;
269 FILE *yyin
= (FILE *) 0, *yyout
= (FILE *) 0;
271 typedef int yy_state_type
;
281 #define yytext_ptr yytext
283 static yy_state_type yy_get_previous_state
FDECL(FDECL_dummy
, (void ));
284 static yy_state_type yy_try_NUL_trans
FDECL(FDECL_dummy
, (yy_state_type current_state
));
285 static int yy_get_next_buffer
FDECL(FDECL_dummy
, (void ));
286 static void yy_fatal_error
FDECL(FDECL_dummy
, (yyconst
char msg
[] )) NORETURN
;
288 /* Done after the current pattern has been matched and before the
289 * corresponding action - sets up yytext.
291 #define YY_DO_BEFORE_ACTION \
292 (yytext_ptr) = yy_bp; \
293 yyleng = (size_t) (yy_cp - yy_bp); \
294 (yy_hold_char) = *yy_cp; \
296 (yy_c_buf_p) = yy_cp;
298 #define YY_NUM_RULES 35
299 #define YY_END_OF_BUFFER 36
300 /* This struct is not used in this scanner,
301 but its presence is necessary. */
304 flex_int32_t yy_verify
;
307 static yyconst flex_int16_t yy_accept
[196] =
309 0, 0, 36, 34, 33, 32, 34, 34, 29, 34,
310 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
311 34, 34, 34, 34, 34, 34, 34, 34, 34, 33,
312 32, 0, 30, 29, 0, 0, 0, 0, 0, 0,
313 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
314 0, 0, 0, 0, 0, 2, 0, 31, 0, 0,
315 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
318 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
320 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
321 4, 0, 25, 0, 0, 0, 0, 0, 0, 0,
322 0, 0, 6, 0, 0, 0, 5, 0, 0, 23,
323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
324 0, 20, 0, 0, 0, 0, 8, 0, 0, 0,
325 0, 0, 0, 1, 0, 0, 0, 0, 0, 22,
326 15, 0, 21, 7, 19, 0, 0, 0, 0, 0,
327 0, 13, 0, 0, 0, 26, 16, 0, 0, 12,
328 0, 0, 0, 11, 9, 0, 17, 18, 0, 27,
333 static yyconst YY_CHAR yy_ec
[256] =
335 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
336 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
338 1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 7, 1, 1, 7, 7, 7,
340 7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
341 1, 1, 1, 1, 8, 9, 10, 11, 12, 13,
342 14, 15, 16, 1, 1, 17, 18, 19, 20, 21,
343 1, 22, 23, 24, 25, 26, 1, 1, 27, 1,
344 1, 1, 1, 1, 28, 1, 29, 1, 30, 31,
346 32, 33, 34, 35, 36, 1, 37, 38, 39, 40,
347 41, 42, 1, 43, 44, 45, 46, 1, 47, 1,
348 1, 48, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
359 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
365 static yyconst YY_CHAR yy_meta
[49] =
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
374 static yyconst flex_uint16_t yy_base
[198] =
376 0, 213, 218, 220, 215, 220, 213, 210, 207, 196,
377 190, 196, 37, 191, 197, 186, 188, 171, 164, 172,
378 174, 173, 18, 160, 159, 154, 157, 11, 194, 194,
379 220, 190, 220, 187, 177, 184, 183, 167, 170, 164,
380 161, 166, 174, 155, 136, 144, 134, 132, 133, 26,
381 135, 143, 147, 128, 145, 220, 170, 220, 158, 152,
382 154, 159, 154, 145, 44, 142, 47, 124, 124, 125,
383 129, 129, 115, 27, 121, 113, 111, 120, 115, 116,
384 134, 142, 132, 128, 137, 121, 130, 129, 125, 129,
385 131, 97, 220, 105, 94, 101, 95, 96, 94, 99,
387 105, 101, 89, 220, 95, 112, 114, 51, 112, 107,
388 220, 110, 114, 111, 106, 96, 85, 76, 81, 82,
389 88, 69, 220, 81, 76, 75, 220, 78, 99, 220,
390 88, 97, 87, 88, 92, 93, 88, 91, 90, 71,
391 65, 220, 62, 60, 57, 56, 220, 59, 54, 74,
392 84, 65, 66, 220, 70, 65, 70, 60, 68, 220,
393 220, 52, 220, 220, 220, 46, 50, 57, 61, 67,
394 62, 220, 67, 64, 63, 220, 220, 42, 41, 220,
395 61, 53, 49, 220, 220, 50, 220, 220, 51, 220,
396 46, 220, 220, 220, 220, 62, 60
400 static yyconst flex_int16_t yy_def
[198] =
402 195, 1, 195, 195, 195, 195, 195, 196, 195, 195,
403 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
404 195, 195, 195, 195, 195, 195, 195, 195, 197, 195,
405 195, 196, 195, 195, 195, 195, 195, 195, 195, 195,
406 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
407 195, 195, 195, 195, 195, 195, 197, 195, 195, 195,
408 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
409 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
410 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
411 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
413 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
414 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
415 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
416 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
417 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
418 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
419 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
420 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
421 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
422 195, 195, 195, 195, 0, 195, 195
426 static yyconst flex_uint16_t yy_nxt
[269] =
428 4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
429 13, 14, 4, 4, 4, 4, 15, 4, 4, 4,
430 16, 17, 4, 4, 4, 4, 4, 4, 4, 18,
431 19, 4, 4, 4, 20, 4, 4, 21, 22, 23,
432 4, 24, 25, 26, 27, 28, 4, 4, 38, 49,
433 55, 87, 56, 74, 75, 88, 90, 98, 50, 131,
434 57, 39, 32, 91, 194, 193, 192, 132, 191, 190,
435 189, 188, 99, 187, 186, 185, 184, 183, 182, 181,
436 180, 179, 178, 177, 176, 175, 174, 173, 172, 171,
437 170, 169, 168, 167, 166, 165, 164, 163, 162, 161,
439 160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
440 150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
441 140, 139, 138, 137, 136, 135, 134, 133, 130, 129,
442 128, 127, 126, 125, 124, 123, 122, 121, 120, 119,
443 118, 117, 116, 115, 114, 113, 112, 111, 110, 109,
444 108, 107, 106, 105, 104, 103, 102, 101, 100, 97,
445 96, 95, 94, 93, 92, 89, 86, 85, 84, 83,
446 82, 81, 58, 80, 79, 78, 77, 76, 73, 72,
447 71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
448 61, 60, 59, 34, 33, 30, 58, 54, 53, 52,
450 51, 48, 47, 46, 45, 44, 43, 42, 41, 40,
451 37, 36, 35, 34, 33, 31, 30, 195, 29, 3,
452 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
453 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
454 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
455 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
456 195, 195, 195, 195, 195, 195, 195, 195
459 static yyconst flex_int16_t yy_chk
[269] =
461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
462 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
464 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465 1, 1, 1, 1, 1, 1, 1, 1, 13, 23,
466 28, 65, 28, 50, 50, 65, 67, 74, 23, 108,
467 197, 13, 196, 67, 191, 189, 186, 108, 183, 182,
468 181, 179, 74, 178, 175, 174, 173, 171, 170, 169,
469 168, 167, 166, 162, 159, 158, 157, 156, 155, 153,
470 152, 151, 150, 149, 148, 146, 145, 144, 143, 141,
472 140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
473 129, 128, 126, 125, 124, 122, 121, 120, 119, 118,
474 117, 116, 115, 114, 113, 112, 110, 109, 107, 106,
475 105, 103, 102, 101, 100, 99, 98, 97, 96, 95,
476 94, 92, 91, 90, 89, 88, 87, 86, 85, 84,
477 83, 82, 81, 80, 79, 78, 77, 76, 75, 73,
478 72, 71, 70, 69, 68, 66, 64, 63, 62, 61,
479 60, 59, 57, 55, 54, 53, 52, 51, 49, 48,
480 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
481 37, 36, 35, 34, 32, 30, 29, 27, 26, 25,
483 24, 22, 21, 20, 19, 18, 17, 16, 15, 14,
484 12, 11, 10, 9, 8, 7, 5, 3, 2, 195,
485 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
486 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
487 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
488 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
489 195, 195, 195, 195, 195, 195, 195, 195
492 static yy_state_type yy_last_accepting_state
;
493 static char *yy_last_accepting_cpos
;
495 extern int yy_flex_debug
;
496 int yy_flex_debug
= 0;
498 /* The intent behind this definition is that it'll catch
499 * any uses of REJECT which flex missed.
501 #define REJECT reject_used_but_not_detected
502 #define yymore() yymore_used_but_not_detected
503 #define YY_MORE_ADJ 0
504 #define YY_RESTORE_YY_MORE_OFFSET
506 /* NetHack 3.6 dgn_comp.l $NHDT-Date: 1455415233 2016/02/14 02:00:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.19 $ */
507 /* Copyright (c) 1989 by Jean-Christophe Collet */
508 /* Copyright (c) 1990 by M. Stephenson */
509 /* NetHack may be freely redistributed. See license for details. */
514 #include "dgn_comp.h"
515 #include "dgn_file.h"
518 * Most of these don't exist in flex, yywrap is macro and
519 * yyunput is properly declared in flex.skel.
521 #if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
522 int FDECL(yyback
, (int *,int));
527 /* Traditional lexes let yyunput() and yyoutput() default to int;
528 * newer ones may declare them as void since they don't return
529 * values. For even more fun, the lex supplied as part of the
530 * newer unbundled compiler for SunOS 4.x adds the void declarations
531 * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain
532 * int) while the bundled lex and the one with the older unbundled
533 * compiler do not. To detect this, we need help from outside --
534 * sys/unix/Makefile.utl.
536 * Digital UNIX is difficult and still has int in spite of all
539 # if defined(NeXT) || defined(SVR4) || defined(_AIX32)
542 # if !defined(VOIDYYPUT) && defined(POSIX_TYPES)
543 # if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS)
547 # if !defined(VOIDYYPUT) && defined(WEIRD_LEX)
548 # if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1)
552 # if defined(VOIDYYPUT) && defined(__osf__)
556 void FDECL(yyunput
, (int));
557 void FDECL(yyoutput
, (int));
559 int FDECL(yyunput
, (int));
560 int FDECL(yyoutput
, (int));
563 #else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */
564 /* most recent flex allows suppressing yyunput() altogether when not needed */
569 #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
570 /* older flex wants this */
571 #define YY_MALLOC_DECL genericptr_t FDECL(malloc, (size_t)); \
572 genericptr_t FDECL(realloc, (genericptr_t, size_t));
573 /* newer flex assumes <stdlib.h> so needs this in case it's been suppressed */
577 void FDECL(init_yyin
, (FILE *));
578 void FDECL(init_yyout
, (FILE *));
580 /* this doesn't always get put in dgn_comp.h
581 * (esp. when using older versions of bison)
583 extern YYSTYPE yylval
;
585 int nh_line_number
= 1;
589 #ifndef YY_EXTRA_TYPE
590 #define YY_EXTRA_TYPE void *
593 /* Accessor methods to globals.
594 These are made visible to non-reentrant scanners for convenience. */
596 int yylex_destroy
FDECL(FDECL_dummy
, (void ));
597 int yyget_debug
FDECL(FDECL_dummy
, (void ));
598 void yyset_debug
FDECL(FDECL_dummy
, (int debug_flag
));
599 YY_EXTRA_TYPE yyget_extra
FDECL(FDECL_dummy
, (void ));
600 void yyset_extra
FDECL(FDECL_dummy
, (YY_EXTRA_TYPE user_defined
));
601 FILE *yyget_in
FDECL(FDECL_dummy
, (void ));
602 void yyset_in
FDECL(FDECL_dummy
, (FILE * _in_str
));
603 FILE *yyget_out
FDECL(FDECL_dummy
, (void ));
604 void yyset_out
FDECL(FDECL_dummy
, (FILE * _out_str
));
605 yy_size_t yyget_leng
FDECL(FDECL_dummy
, (void ));
606 char *yyget_text
FDECL(FDECL_dummy
, (void ));
607 int yyget_lineno
FDECL(FDECL_dummy
, (void ));
608 void yyset_lineno
FDECL(FDECL_dummy
, (int _line_number
));
610 /* Macros after this point can all be overridden by user definitions in
614 #ifndef YY_SKIP_YYWRAP
615 extern int yywrap
FDECL(FDECL_dummy
, (void ));
620 static void yyunput
FDECL(FDECL_dummy
, (int c
,char *buf_ptr
));
624 static void yy_flex_strncpy
FDECL(FDECL_dummy
, (char *,yyconst
char *,int ));
627 #ifdef YY_NEED_STRLEN
628 static int yy_flex_strlen
FDECL(FDECL_dummy
, (yyconst
char * ));
633 static int input
FDECL(FDECL_dummy
, (void ));
637 /* Amount of stuff to slurp up with each read. */
638 #ifndef YY_READ_BUF_SIZE
640 /* On IA-64, the buffer size is 16k, not 8k */
641 #define YY_READ_BUF_SIZE 16384
643 #define YY_READ_BUF_SIZE 8192
644 #endif /* __ia64__ */
647 /* Copy whatever the last rule matched to the standard output. */
649 /* This used to be an fputs(), but since the string might contain NUL's,
650 * we now use fwrite().
652 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
655 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
656 * is returned in "result".
659 #define YY_INPUT(buf,result,max_size) \
660 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
664 for ( n = 0; n < max_size && \
665 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
668 buf[n++] = (char) c; \
669 if ( c == EOF && ferror( yyin ) ) \
670 YY_FATAL_ERROR( "input in flex scanner failed" ); \
676 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
678 if( errno != EINTR) \
680 YY_FATAL_ERROR( "input in flex scanner failed" ); \
690 /* No semi-colon after return; correct usage is to write "yyterminate();" -
691 * we don't want an extra ';' after the "return" because that will cause
692 * some compilers to complain about unreachable statements.
695 #define yyterminate() return YY_NULL
698 /* Number of entries by which start-condition stack grows. */
699 #ifndef YY_START_STACK_INCR
700 #define YY_START_STACK_INCR 25
703 /* Report a fatal error. */
704 #ifndef YY_FATAL_ERROR
705 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
708 /* Default declaration of generated scanner - a define so the user can
709 * easily add parameters.
712 #define YY_DECL_IS_OURS 1
714 extern int yylex
FDECL(FDECL_dummy
, (void));
716 #define YY_DECL int yylex ()
717 #endif /* !YY_DECL */
719 /* Code executed at the beginning of each rule, after yytext and yyleng
722 #ifndef YY_USER_ACTION
723 #define YY_USER_ACTION
726 /* Code executed at the end of each rule. */
728 #define YY_BREAK /*LINTED*/break;
731 #define YY_RULE_SETUP \
733 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
734 (yytext[yyleng - 1] == '\n'); \
737 /** The main scanner function which does all the work.
741 yy_state_type yy_current_state
;
754 (yy_start
) = 1; /* first start state */
762 if ( ! YY_CURRENT_BUFFER
) {
763 yyensure_buffer_stack ();
764 YY_CURRENT_BUFFER_LVALUE
=
765 yy_create_buffer(yyin
,YY_BUF_SIZE
);
768 yy_load_buffer_state( );
773 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
775 yy_cp
= (yy_c_buf_p
);
777 /* Support of yytext. */
778 *yy_cp
= (yy_hold_char
);
780 /* yy_bp points to the position in yy_ch_buf of the start of
785 yy_current_state
= (yy_start
);
786 yy_current_state
+= YY_AT_BOL();
790 YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)] ;
791 if ( yy_accept
[yy_current_state
] )
793 (yy_last_accepting_state
) = yy_current_state
;
794 (yy_last_accepting_cpos
) = yy_cp
;
796 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
798 yy_current_state
= (int) yy_def
[yy_current_state
];
799 if ( yy_current_state
>= 196 )
800 yy_c
= yy_meta
[(unsigned int) yy_c
];
802 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
805 while ( yy_base
[yy_current_state
] != 220 );
808 yy_act
= yy_accept
[yy_current_state
];
810 { /* have to back up */
811 yy_cp
= (yy_last_accepting_cpos
);
812 yy_current_state
= (yy_last_accepting_state
);
813 yy_act
= yy_accept
[yy_current_state
];
818 do_action
: /* This label is used only to access EOF actions. */
821 { /* beginning of action switch */
822 case 0: /* must back up */
823 /* undo the effects of YY_DO_BEFORE_ACTION */
824 *yy_cp
= (yy_hold_char
);
825 yy_cp
= (yy_last_accepting_cpos
);
826 yy_current_state
= (yy_last_accepting_state
);
835 { yylval
.i
=1; return(UP_OR_DOWN
); }
839 { yylval
.i
=0; return(UP_OR_DOWN
); }
883 { yylval
.i
=TOWN
; return(DESCRIPTOR
); }
887 { yylval
.i
=HELLISH
; return(DESCRIPTOR
); }
891 { yylval
.i
=MAZELIKE
; return(DESCRIPTOR
); }
895 { yylval
.i
=ROGUELIKE
; return(DESCRIPTOR
); }
899 { yylval
.i
=D_ALIGN_NONE
; return(DESCRIPTOR
); }
903 { yylval
.i
=D_ALIGN_NONE
; return(DESCRIPTOR
); }
907 { yylval
.i
=D_ALIGN_LAWFUL
; return(DESCRIPTOR
); }
911 { yylval
.i
=D_ALIGN_NEUTRAL
; return(DESCRIPTOR
); }
915 { yylval
.i
=D_ALIGN_CHAOTIC
; return(DESCRIPTOR
); }
943 { yylval
.i
=atoi(yytext
); return(INTEGER
); }
946 /* rule 30 can match eol */
948 { yytext
[yyleng
- 1] = '\0'; /* discard the trailing \" */
949 yylval
.str
= dupstr(yytext
+ 1); /* skip the first \" */
953 /* rule 31 can match eol */
955 { nh_line_number
++; }
958 /* rule 32 can match eol */
960 { nh_line_number
++; }
964 ; /* skip trailing tabs & spaces */
968 { return yytext
[0]; }
974 case YY_STATE_EOF(INITIAL
):
977 case YY_END_OF_BUFFER
:
979 /* Amount of text matched not including the EOB char. */
980 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
982 /* Undo the effects of YY_DO_BEFORE_ACTION. */
983 *yy_cp
= (yy_hold_char
);
984 YY_RESTORE_YY_MORE_OFFSET
986 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
988 /* We're scanning a new file or input source. It's
989 * possible that this happened because the user
990 * just pointed yyin at a new source and called
991 * yylex(). If so, then we have to assure
992 * consistency between YY_CURRENT_BUFFER and our
993 * globals. Here is the right place to do so, because
994 * this is the first action (other than possibly a
995 * back-up) that will match for the new input source.
997 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
998 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
999 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1002 /* Note that here we test for yy_c_buf_p "<=" to the position
1003 * of the first EOB in the buffer, since yy_c_buf_p will
1004 * already have been incremented past the NUL character
1005 * (since all states make transitions on EOB to the
1006 * end-of-buffer state). Contrast this with the test
1009 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1010 { /* This was really a NUL. */
1011 yy_state_type yy_next_state
;
1013 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
1015 yy_current_state
= yy_get_previous_state( );
1017 /* Okay, we're now positioned to make the NUL
1018 * transition. We couldn't have
1019 * yy_get_previous_state() go ahead and do it
1020 * for us because it doesn't know how to deal
1021 * with the possibility of jamming (and we don't
1022 * want to build jamming into it because then it
1023 * will run more slowly).
1026 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1028 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1030 if ( yy_next_state
)
1032 /* Consume the NUL. */
1033 yy_cp
= ++(yy_c_buf_p
);
1034 yy_current_state
= yy_next_state
;
1040 yy_cp
= (yy_c_buf_p
);
1041 goto yy_find_action
;
1045 else switch ( yy_get_next_buffer( ) )
1047 case EOB_ACT_END_OF_FILE
:
1049 (yy_did_buffer_switch_on_eof
) = 0;
1053 /* Note: because we've taken care in
1054 * yy_get_next_buffer() to have set up
1055 * yytext, we can now set up
1056 * yy_c_buf_p so that if some total
1057 * hoser (like flex itself) wants to
1058 * call the scanner after we return the
1059 * YY_NULL, it'll still work - another
1060 * YY_NULL will get returned.
1062 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
1064 yy_act
= YY_STATE_EOF(YY_START
);
1070 if ( ! (yy_did_buffer_switch_on_eof
) )
1076 case EOB_ACT_CONTINUE_SCAN
:
1078 (yytext_ptr
) + yy_amount_of_matched_text
;
1080 yy_current_state
= yy_get_previous_state( );
1082 yy_cp
= (yy_c_buf_p
);
1083 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1086 case EOB_ACT_LAST_MATCH
:
1088 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1090 yy_current_state
= yy_get_previous_state( );
1092 yy_cp
= (yy_c_buf_p
);
1093 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1094 goto yy_find_action
;
1101 "fatal flex scanner internal error--no action found" );
1102 } /* end of action switch */
1103 } /* end of scanning one token */
1104 } /* end of user's declarations */
1105 } /* end of yylex */
1107 /* yy_get_next_buffer - try to read in a new buffer
1109 * Returns a code representing an action:
1110 * EOB_ACT_LAST_MATCH -
1111 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1112 * EOB_ACT_END_OF_FILE - end of file
1114 static int yy_get_next_buffer ()
1116 char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1117 char *source
= (yytext_ptr
);
1118 yy_size_t number_to_move
, i
;
1121 if ((yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1])
1122 YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
1124 if (YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0) {
1125 /* Don't try to fill the buffer, so this is an EOF. */
1126 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 ) {
1127 /* We matched a single character, the EOB, so
1128 * treat this as a final EOF.
1130 return EOB_ACT_END_OF_FILE
;
1132 /* We matched some text prior to the EOB, first
1135 return EOB_ACT_LAST_MATCH
;
1139 /* Try to read more data. */
1141 /* First move last chars to start of buffer. */
1142 number_to_move
= (yy_size_t
) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1144 for (i
= 0; i
< number_to_move
; ++i
)
1145 *(dest
++) = *(source
++);
1147 if (YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
) {
1148 /* don't do the read, it's not guaranteed to return an EOF,
1151 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1153 yy_size_t num_to_read
;
1154 /* just a shorter name for the current buffer */
1155 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER_LVALUE
;
1157 /* [pr] This could probably be (b->yy_buf_size < number_to_move)
1158 * since the allocated size is actually b->yy_buf_size + 2.
1159 * The old code calculated num_to_read above (with same formula
1160 * as is used below), then used (num_to_read <= 0) here, which
1161 * got broken when num_to_read was changed to an unsigned type. */
1162 while (b
->yy_buf_size
<= number_to_move
+ 1) {
1163 /* Not enough room in the buffer - grow it. */
1165 int yy_c_buf_p_offset
= (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1167 if ( b
->yy_is_our_buffer
) {
1168 b
->yy_buf_size
+= b
->yy_buf_size
/ 4;
1169 b
->yy_ch_buf
= (char *)
1170 /* Include room in for 2 EOB chars. */
1171 yyrealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
1173 /* Can't grow it, we don't own it. */
1177 YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
1179 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1183 num_to_read
= b
->yy_buf_size
- number_to_move
- 1;
1184 if ( num_to_read
> YY_READ_BUF_SIZE
)
1185 num_to_read
= YY_READ_BUF_SIZE
;
1187 /* Read in more data. */
1188 YY_INPUT((&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1189 (yy_n_chars
), num_to_read
);
1190 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1193 if ((yy_n_chars
) == 0) {
1194 if (number_to_move
== YY_MORE_ADJ
) {
1195 ret_val
= EOB_ACT_END_OF_FILE
;
1198 ret_val
= EOB_ACT_LAST_MATCH
;
1199 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_EOF_PENDING
;
1202 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1204 if ((yy_size_t
) ((yy_n_chars
) + number_to_move
)
1205 > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1206 /* Extend the array by 50%, plus the number we really need. */
1207 yy_size_t new_size
= (yy_n_chars
) + number_to_move
+ ((yy_n_chars
) >> 1);
1208 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *)
1209 yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
);
1210 if (! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1211 YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
1214 (yy_n_chars
) += number_to_move
;
1215 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
1216 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
1218 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1223 /* yy_get_previous_state - get the state just before EOB char was reached */
1225 static yy_state_type
yy_get_previous_state ()
1227 yy_state_type yy_current_state
;
1230 yy_current_state
= (yy_start
);
1231 yy_current_state
+= YY_AT_BOL();
1233 for (yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
) {
1235 YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1236 if ( yy_accept
[yy_current_state
] )
1238 (yy_last_accepting_state
) = yy_current_state
;
1239 (yy_last_accepting_cpos
) = yy_cp
;
1241 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1243 yy_current_state
= (int) yy_def
[yy_current_state
];
1244 if ( yy_current_state
>= 196 )
1245 yy_c
= yy_meta
[(unsigned int) yy_c
];
1247 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1250 return yy_current_state
;
1253 /* yy_try_NUL_trans - try to make a transition on the NUL character
1256 * next_state = yy_try_NUL_trans( current_state );
1259 static yy_state_type
yy_try_NUL_trans (yy_current_state
)
1260 yy_state_type yy_current_state
;
1263 char *yy_cp
= (yy_c_buf_p
);
1266 if ( yy_accept
[yy_current_state
] )
1268 (yy_last_accepting_state
) = yy_current_state
;
1269 (yy_last_accepting_cpos
) = yy_cp
;
1271 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1273 yy_current_state
= (int) yy_def
[yy_current_state
];
1274 if ( yy_current_state
>= 196 )
1275 yy_c
= yy_meta
[(unsigned int) yy_c
];
1277 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1278 yy_is_jam
= (yy_current_state
== 195);
1280 return yy_is_jam
? 0 : yy_current_state
;
1285 static void yyunput (c
,yy_bp
)
1291 yy_cp
= (yy_c_buf_p
);
1293 /* undo effects of setting up yytext */
1294 *yy_cp
= (yy_hold_char
);
1296 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1297 { /* need to shift things up to make room */
1298 /* +2 for EOB chars. */
1299 yy_size_t number_to_move
= (yy_n_chars
) + 2;
1300 char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1301 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1303 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1305 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1306 *--dest
= *--source
;
1308 yy_cp
+= (int) (dest
- source
);
1309 yy_bp
+= (int) (dest
- source
);
1310 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1311 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1313 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1314 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1317 *--yy_cp
= (char) c
;
1319 (yytext_ptr
) = yy_bp
;
1320 (yy_hold_char
) = *yy_cp
;
1321 (yy_c_buf_p
) = yy_cp
;
1331 *(yy_c_buf_p
) = (yy_hold_char
);
1333 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
1335 /* yy_c_buf_p now points to the character we want to return.
1336 * If this occurs *before* the EOB characters, then it's a
1337 * valid NUL; if not, then we've hit the end of the buffer.
1339 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1340 /* This was really a NUL. */
1341 *(yy_c_buf_p
) = '\0';
1344 { /* need more input */
1345 yy_size_t offset
= (yy_c_buf_p
) - (yytext_ptr
);
1348 switch ( yy_get_next_buffer( ) )
1350 case EOB_ACT_LAST_MATCH
:
1351 /* This happens because yy_g_n_b()
1352 * sees that we've accumulated a
1353 * token and flags that we need to
1354 * try matching the token before
1355 * proceeding. But for input(),
1356 * there's no matching to consider.
1357 * So convert the EOB_ACT_LAST_MATCH
1358 * to EOB_ACT_END_OF_FILE.
1361 /* Reset buffer status. */
1366 case EOB_ACT_END_OF_FILE
:
1371 if ( ! (yy_did_buffer_switch_on_eof
) )
1376 case EOB_ACT_CONTINUE_SCAN
:
1377 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
1383 c
= *(uchar
*) (yy_c_buf_p
); /* cast for 8-bit char's */
1384 *(yy_c_buf_p
) = '\0'; /* preserve yytext */
1385 (yy_hold_char
) = *++(yy_c_buf_p
);
1387 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
1391 #endif /* ifndef YY_NO_INPUT */
1393 /** Immediately switch to a different input stream.
1394 * @param input_file A readable stream.
1396 * @note This function does not reset the start condition to @c INITIAL .
1399 void yyrestart (input_file
)
1403 if ( ! YY_CURRENT_BUFFER
){
1404 yyensure_buffer_stack ();
1405 YY_CURRENT_BUFFER_LVALUE
=
1406 yy_create_buffer(yyin
,YY_BUF_SIZE
);
1409 yy_init_buffer(YY_CURRENT_BUFFER
,input_file
);
1410 yy_load_buffer_state( );
1413 /** Switch to a different input buffer.
1414 * @param new_buffer The new input buffer.
1417 void yy_switch_to_buffer (new_buffer
)
1418 YY_BUFFER_STATE new_buffer
;
1421 /* TODO. We should be able to replace this entire function body
1423 * yypop_buffer_state();
1424 * yypush_buffer_state(new_buffer);
1426 yyensure_buffer_stack ();
1427 if ( YY_CURRENT_BUFFER
== new_buffer
)
1430 if ( YY_CURRENT_BUFFER
)
1432 /* Flush out information for old buffer. */
1433 *(yy_c_buf_p
) = (yy_hold_char
);
1434 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1435 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1438 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1439 yy_load_buffer_state( );
1441 /* We don't actually know whether we did this switch during
1442 * EOF (yywrap()) processing, but the only time this flag
1443 * is looked at is after yywrap() is called, so it's safe
1444 * to go ahead and always set it.
1446 (yy_did_buffer_switch_on_eof
) = 1;
1449 static void yy_load_buffer_state ()
1451 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1452 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1453 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1454 (yy_hold_char
) = *(yy_c_buf_p
);
1457 /** Allocate and initialize an input buffer state.
1458 * @param file A readable stream.
1459 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1461 * @return the allocated buffer state.
1463 YY_BUFFER_STATE
yy_create_buffer (file
,size
)
1469 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1471 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1475 b
->yy_buf_size
= (yy_size_t
)size
;
1477 /* yy_ch_buf has to be 2 characters longer than the size given because
1478 * we need to put in 2 end-of-buffer characters.
1480 b
->yy_ch_buf
= (char *) yyalloc(b
->yy_buf_size
+ 2 );
1481 if ( ! b
->yy_ch_buf
)
1482 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1484 b
->yy_is_our_buffer
= 1;
1486 yy_init_buffer(b
,file
);
1491 /** Destroy the buffer.
1492 * @param b a buffer created with yy_create_buffer()
1495 void yy_delete_buffer (b
)
1502 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1503 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1505 if ( b
->yy_is_our_buffer
)
1506 yyfree((void *) b
->yy_ch_buf
);
1508 yyfree((void *) b
);
1511 /* Initializes or reinitializes a buffer.
1512 * This function is sometimes called more than once on the same buffer,
1513 * such as during a yyrestart() or at EOF.
1515 static void yy_init_buffer (b
,file
)
1521 yy_flush_buffer(b
);
1523 b
->yy_input_file
= file
;
1524 b
->yy_fill_buffer
= 1;
1526 /* If b is the current buffer, then yy_init_buffer was _probably_
1527 * called from yyrestart() or through yy_get_next_buffer.
1528 * In that case, we don't want to reset the lineno or column.
1530 if (b
!= YY_CURRENT_BUFFER
){
1531 b
->yy_bs_lineno
= 1;
1532 b
->yy_bs_column
= 0;
1535 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1540 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1541 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1544 void yy_flush_buffer (b
)
1552 /* We always need two end-of-buffer characters. The first causes
1553 * a transition to the end-of-buffer state. The second causes
1554 * a jam in that state.
1556 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1557 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1559 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1562 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1564 if ( b
== YY_CURRENT_BUFFER
)
1565 yy_load_buffer_state( );
1568 /** Pushes the new state onto the stack. The new state becomes
1569 * the current state. This function will allocate the stack
1571 * @param new_buffer The new state.
1574 void yypush_buffer_state (new_buffer
)
1575 YY_BUFFER_STATE new_buffer
;
1577 if (new_buffer
== NULL
)
1580 yyensure_buffer_stack();
1582 /* This block is copied from yy_switch_to_buffer. */
1583 if ( YY_CURRENT_BUFFER
)
1585 /* Flush out information for old buffer. */
1586 *(yy_c_buf_p
) = (yy_hold_char
);
1587 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1588 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1591 /* Only push if top exists. Otherwise, replace top. */
1592 if (YY_CURRENT_BUFFER
)
1593 (yy_buffer_stack_top
)++;
1594 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1596 /* copied from yy_switch_to_buffer. */
1597 yy_load_buffer_state( );
1598 (yy_did_buffer_switch_on_eof
) = 1;
1601 /** Removes and deletes the top of the stack, if present.
1602 * The next element becomes the new top.
1605 void yypop_buffer_state ()
1607 if (!YY_CURRENT_BUFFER
)
1610 yy_delete_buffer(YY_CURRENT_BUFFER
);
1611 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1612 if ((yy_buffer_stack_top
) > 0)
1613 --(yy_buffer_stack_top
);
1615 if (YY_CURRENT_BUFFER
) {
1616 yy_load_buffer_state( );
1617 (yy_did_buffer_switch_on_eof
) = 1;
1621 /* Allocates the stack if it does not exist.
1622 * Guarantees space for at least one push.
1624 static void yyensure_buffer_stack ()
1626 yy_size_t num_to_alloc
;
1628 if (!(yy_buffer_stack
)) {
1629 /* First allocation is just for 2 elements, since we don't know if this
1630 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1631 * immediate realloc on the next call.
1633 #if 1 /* [PR] avoid C++-style comment; older C compilers choke on it */
1634 num_to_alloc
= 2; /* also changed to match the comment... */
1636 num_to_alloc
= 1; // After all that talk, this was set to 1 anyways...
1638 (yy_buffer_stack
) = (struct yy_buffer_state
**)
1639 yyalloc(num_to_alloc
* sizeof(struct yy_buffer_state
*) );
1640 if (!(yy_buffer_stack
))
1641 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1643 (void) memset((yy_buffer_stack
), 0,
1644 num_to_alloc
* sizeof(struct yy_buffer_state
*));
1646 (yy_buffer_stack_max
) = num_to_alloc
;
1647 (yy_buffer_stack_top
) = 0;
1651 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1) {
1652 /* Increase the buffer to prepare for a possible push. */
1653 yy_size_t grow_size
= 8 /* arbitrary grow size */;
1655 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
1656 (yy_buffer_stack
) = (struct yy_buffer_state
**)
1657 yyrealloc((yy_buffer_stack
),num_to_alloc
* sizeof(struct yy_buffer_state
*) );
1658 if (!(yy_buffer_stack
))
1659 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1661 /* zero only the new slots.*/
1662 (void) memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0,
1663 grow_size
* sizeof(struct yy_buffer_state
*));
1664 (yy_buffer_stack_max
) = num_to_alloc
;
1668 /** Setup the input buffer state to scan directly from a user-specified
1670 * @param base the character buffer
1671 * @param size the size in bytes of the character buffer
1673 * @return the newly allocated buffer state object.
1675 YY_BUFFER_STATE
yy_scan_buffer (base
,size
)
1682 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1683 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1684 /* They forgot to leave room for the EOB's. */
1687 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1689 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1691 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1692 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1693 b
->yy_is_our_buffer
= 0;
1694 b
->yy_input_file
= 0;
1695 b
->yy_n_chars
= b
->yy_buf_size
;
1696 b
->yy_is_interactive
= 0;
1698 b
->yy_fill_buffer
= 0;
1699 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1701 yy_switch_to_buffer(b
);
1706 /** Setup the input buffer state to scan a string. The next call to yylex()
1707 * will scan from a @e copy of @a str.
1708 * @param yystr a NUL-terminated string to scan
1710 * @return the newly allocated buffer state object.
1711 * @note If you want to scan bytes that may contain NUL values, then use
1712 * yy_scan_bytes() instead.
1714 YY_BUFFER_STATE
yy_scan_string (yystr
)
1715 yyconst
char * yystr
;
1718 return yy_scan_bytes(yystr
,strlen(yystr
) );
1721 /** Setup the input buffer state to scan the given bytes. The next call to
1722 * yylex() will scan from a @e copy of @a bytes.
1723 * @param yybytes the byte buffer to scan
1724 * @param _yybytes_len the number of bytes in the buffer pointed to by @a
1727 * @return the newly allocated buffer state object.
1729 YY_BUFFER_STATE
yy_scan_bytes (yybytes
,_yybytes_len
)
1730 yyconst
char * yybytes
;
1731 yy_size_t _yybytes_len
;
1738 /* Get memory for full buffer, including space for trailing EOB's. */
1739 n
= _yybytes_len
+ 2;
1740 buf
= (char *) yyalloc(n
);
1742 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1744 for ( i
= 0; i
< _yybytes_len
; ++i
)
1745 buf
[i
] = yybytes
[i
];
1747 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
1749 b
= yy_scan_buffer(buf
,n
);
1751 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1753 /* It's okay to grow etc. this buffer, and we should throw it
1754 * away when we're done.
1756 b
->yy_is_our_buffer
= 1;
1761 #ifndef YY_EXIT_FAILURE
1762 #define YY_EXIT_FAILURE 2
1765 static void yy_fatal_error (msg
)
1768 (void) fprintf( stderr
, "%s\n", msg
);
1769 exit( YY_EXIT_FAILURE
);
1772 /* Redefine yyless() so it works in section 3 code. */
1777 /* Undo effects of setting up yytext. */ \
1778 int yyless_macro_arg = (n); \
1779 YY_LESS_LINENO(yyless_macro_arg); \
1780 yytext[yyleng] = (yy_hold_char); \
1781 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1782 (yy_hold_char) = *(yy_c_buf_p); \
1783 *(yy_c_buf_p) = '\0'; \
1784 yyleng = yyless_macro_arg; \
1787 /* Accessor methods (get/set functions) to struct members. */
1789 /** Get the current line number.
1798 /** Get the input stream.
1806 /** Get the output stream.
1814 /** Get the length of the current token.
1817 yy_size_t
yyget_leng ()
1822 /** Get the current token.
1831 /** Set the current line number.
1832 * @param _line_number line number
1835 void yyset_lineno (_line_number
)
1839 yylineno
= _line_number
;
1842 /** Set the input stream. This does not discard the current
1844 * @param _in_str A readable stream.
1846 * @see yy_switch_to_buffer
1848 void yyset_in (_in_str
)
1854 void yyset_out (_out_str
)
1862 return yy_flex_debug
;
1865 void yyset_debug (_bdebug
)
1868 yy_flex_debug
= _bdebug
;
1871 static int yy_init_globals ()
1873 /* Initialization is the same as for the non-reentrant scanner.
1874 * This function is called from yylex_destroy(), so don't allocate here.
1877 (yy_buffer_stack
) = 0;
1878 (yy_buffer_stack_top
) = 0;
1879 (yy_buffer_stack_max
) = 0;
1880 (yy_c_buf_p
) = (char *) 0;
1884 /* Defined in main.c */
1893 /* For future reference: Set errno on error, since we are called by
1899 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1900 int yylex_destroy ()
1903 /* Pop the buffer stack, destroying each element. */
1904 while (YY_CURRENT_BUFFER
) {
1905 yy_delete_buffer(YY_CURRENT_BUFFER
);
1906 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1907 yypop_buffer_state();
1909 /* Destroy the stack itself. */
1910 yyfree((yy_buffer_stack
) );
1911 (yy_buffer_stack
) = NULL
;
1913 /* Reset the globals. This is important in a non-reentrant scanner
1914 * so the next time yylex() is called, initialization will occur. */
1921 * Internal utility routines.
1925 static void yy_flex_strncpy (s1
,s2
,n
)
1932 for ( i
= 0; i
< n
; ++i
)
1937 #ifdef YY_NEED_STRLEN
1938 static int yy_flex_strlen (s
)
1942 for ( n
= 0; s
[n
]; ++n
)
1949 void *yyalloc (size
)
1953 return (void *) malloc( size
);
1956 void *yyrealloc (ptr
,size
)
1961 /* The cast to (char *) in the following accommodates both
1962 * implementations that use char* generic pointers, and those
1963 * that use void* generic pointers. It works with the latter
1964 * because both ANSI C and C++ allow castless assignment from
1965 * any pointer type to void*, and deal with argument conversions
1966 * as though doing an assignment.
1968 return (void *) realloc( (char *) ptr
, size
);
1975 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
1978 /* routine to switch to another input file; needed for flex */
1980 init_yyin( input_f
)
1983 #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
1991 /* analogous routine (for completeness) */
1993 init_yyout( output_f
)