1
2 #line 3 "dgn_lex.c"
3
4 #define YY_INT_ALIGNED short int
5
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).
9 *
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.
13 */
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
18
19 #include "config.h"
20
21 #include <errno.h>
22
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 */
26 #ifndef FLEX_INT32_T
27 typedef int flex_int32_t;
28 #endif
29 #ifndef FLEX_INT16_T
30 typedef short int flex_int16_t;
31 #endif
32 #ifndef FLEX_UINT16_T
33 typedef unsigned short int flex_uint16_t;
34 #endif
35
36 #define yyconst const
37
38 #define FDECL_dummy /*empty*/
39
40 /* Returned upon end-of-file. */
41 #define YY_NULL 0
42
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
46 * double cast.
47 */
48 #define YY_SC_TO_UI(c) ((unsigned int) (uchar) c)
49
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.
53 */
54 #define BEGIN (yy_start) = 1 + 2 *
55
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
58 * compatibility.
59 */
60 #define YY_START (((yy_start) - 1) / 2)
61 #define YYSTATE YY_START
62
63 /* Action number for EOF rule of a given start state. */
64 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
65
66 /* Special action meaning "start processing a new file". */
67 #define YY_NEW_FILE yyrestart(yyin )
68
69 #define YY_END_OF_BUFFER_CHAR 0
70
71 /* Size of default input buffer. */
72 #ifndef YY_BUF_SIZE
73 #ifdef __ia64__
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.
77 */
78 #define YY_BUF_SIZE 32768
79 #else
80 #define YY_BUF_SIZE 16384
81 #endif /* __ia64__ */
82 #endif
83
84 /* The state buf must be large enough to hold one state per character
85 * in the main buffer.
86 */
87 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
88
89 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
90 #define YY_TYPEDEF_YY_BUFFER_STATE
91 typedef struct yy_buffer_state *YY_BUFFER_STATE;
92 #endif
93
94 #ifndef YY_TYPEDEF_YY_SIZE_T
95 #define YY_TYPEDEF_YY_SIZE_T
96 typedef size_t yy_size_t;
97 #endif
98
99 extern yy_size_t yyleng;
100 extern FILE *yyin, *yyout;
101
102 #define EOB_ACT_CONTINUE_SCAN 0
103 #define EOB_ACT_END_OF_FILE 1
104 #define EOB_ACT_LAST_MATCH 2
105
106 #define YY_LESS_LINENO(n)
107 #define YY_LINENO_REWIND_TO(ptr)
108
109 /* Return all but the first "n" matched characters back to the input stream. */
110 #define yyless(n) \
111 do { \
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 */ \
119 } while ( 0 )
120
121 #define unput(c) yyunput( c, (yytext_ptr) )
122
123 #ifndef YY_STRUCT_YY_BUFFER_STATE
124 #define YY_STRUCT_YY_BUFFER_STATE
125 struct yy_buffer_state {
126 FILE *yy_input_file;
127
128 char *yy_ch_buf; /* input buffer */
129 char *yy_buf_pos; /* current position in input buffer */
130
131 /* Size of input buffer in bytes, not including room for EOB
132 * characters.
133 */
134 yy_size_t yy_buf_size;
135
136 /* Number of characters read into yy_ch_buf, not including EOB
137 * characters.
138 */
139 yy_size_t yy_n_chars;
140
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
143 * delete it.
144 */
145 int yy_is_our_buffer;
146
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
150 * each newline.
151 */
152 int yy_is_interactive;
153
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
156 * not.
157 */
158 int yy_at_bol;
159
160 int yy_bs_lineno; /**< The line count. */
161 int yy_bs_column; /**< The column count. */
162
163 /* Whether to try to fill the input buffer when we reach the
164 * end of it.
165 */
166 int yy_fill_buffer;
167
168 int yy_buffer_status;
169
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.
177 *
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.
181 */
182 #define YY_BUFFER_EOF_PENDING 2
183
184 };
185 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
186
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. */
191
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
194 * "scanner state".
195 *
196 * Returns the top of the stack, or NULL.
197 */
198 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
199 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
200 : NULL)
201
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.
204 */
205 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
206
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 */
210 yy_size_t yyleng;
211
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 */
216
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 ...
219 */
220 static int yy_did_buffer_switch_on_eof;
221
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 ));
229
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 ));
233
234 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
235
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 ));
239
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 * ));
243
244 #define yy_new_buffer yy_create_buffer
245 #define yy_set_interactive(is_interactive) \
246 { \
247 if ( ! YY_CURRENT_BUFFER ) { \
248 yyensure_buffer_stack (); \
249 YY_CURRENT_BUFFER_LVALUE = \
250 yy_create_buffer(yyin,YY_BUF_SIZE ); \
251 } \
252 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
253 }
254 #define yy_set_bol(at_bol) \
255 { \
256 if ( ! YY_CURRENT_BUFFER ) { \
257 yyensure_buffer_stack (); \
258 YY_CURRENT_BUFFER_LVALUE = \
259 yy_create_buffer(yyin,YY_BUF_SIZE ); \
260 } \
261 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
262 }
263 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
264
265 /* Begin user sect3 */
266
267 typedef unsigned char YY_CHAR;
268
269 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
270
271 typedef int yy_state_type;
272
273 extern int yylineno;
274
275 int yylineno = 1;
276
277 extern char *yytext;
278 #ifdef yytext_ptr
279 #undef yytext_ptr
280 #endif
281 #define yytext_ptr yytext
282
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;
287
288 /* Done after the current pattern has been matched and before the
289 * corresponding action - sets up yytext.
290 */
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; \
295 *yy_cp = '\0'; \
296 (yy_c_buf_p) = yy_cp;
297
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. */
302 struct yy_trans_info
303 {
304 flex_int32_t yy_verify;
305 flex_int32_t yy_nxt;
306 };
307 static yyconst flex_int16_t yy_accept[196] =
308 { 0,
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,
319
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,
329 0, 28, 24, 10, 0
330
331 } ;
332
333 static yyconst YY_CHAR yy_ec[256] =
334 { 0,
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,
345
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,
356
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,
362 1, 1, 1, 1, 1
363 } ;
364
365 static yyconst YY_CHAR yy_meta[49] =
366 { 0,
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
372 } ;
373
374 static yyconst flex_uint16_t yy_base[198] =
375 { 0,
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,
386
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
397
398 } ;
399
400 static yyconst flex_int16_t yy_def[198] =
401 { 0,
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,
412
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
423
424 } ;
425
426 static yyconst flex_uint16_t yy_nxt[269] =
427 { 0,
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,
438
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,
449
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
457 } ;
458
459 static yyconst flex_int16_t yy_chk[269] =
460 { 0,
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,
471
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,
482
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
490 } ;
491
492 static yy_state_type yy_last_accepting_state;
493 static char *yy_last_accepting_cpos;
494
495 extern int yy_flex_debug;
496 int yy_flex_debug = 0;
497
498 /* The intent behind this definition is that it'll catch
499 * any uses of REJECT which flex missed.
500 */
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
505 char *yytext;
506 /* NetHack 3.6 dgn_comp.l $NHDT-Date: 1522193682 2018/03/27 23:34:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.20 $ */
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. */
510
511 #define DGN_COMP
512
513 #include "config.h"
514 #include "dgn_comp.h"
515 #include "dgn_file.h"
516
517 /*
518 * Most of these don't exist in flex, yywrap is macro and
519 * yyunput is properly declared in flex.skel.
520 */
521 #if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
522 int FDECL(yyback, (int *,int));
523 int NDECL(yylook);
524 int NDECL(yyinput);
525 int NDECL(yywrap);
526 int NDECL(yylex);
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.
535 *
536 * Digital UNIX is difficult and still has int in spite of all
537 * other signs.
538 */
539 # if defined(NeXT) || defined(SVR4) || defined(_AIX32)
540 # define VOIDYYPUT
541 # endif
542 # if !defined(VOIDYYPUT) && defined(POSIX_TYPES)
543 # if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS)
544 # define VOIDYYPUT
545 # endif
546 # endif
547 # if !defined(VOIDYYPUT) && defined(WEIRD_LEX)
548 # if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1)
549 # define VOIDYYPUT
550 # endif
551 # endif
552 # if defined(VOIDYYPUT) && defined(__osf__)
553 # undef VOIDYYPUT
554 # endif
555 # ifdef VOIDYYPUT
556 void FDECL(yyunput, (int));
557 void FDECL(yyoutput, (int));
558 # else
559 int FDECL(yyunput, (int));
560 int FDECL(yyoutput, (int));
561 # endif
562
563 #else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */
564 /* most recent flex allows suppressing yyunput() altogether when not needed */
565 #define YY_NO_UNPUT
566 #define YY_NO_INPUT
567 #endif
568
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 */
574 YY_MALLOC_DECL
575 #endif
576
577 void FDECL(init_yyin, (FILE *));
578 void FDECL(init_yyout, (FILE *));
579
580 /* this doesn't always get put in dgn_comp.h
581 * (esp. when using older versions of bison)
582 */
583 extern YYSTYPE yylval;
584
585 int nh_line_number = 1;
586
587 #define INITIAL 0
588
589 #ifndef YY_EXTRA_TYPE
590 #define YY_EXTRA_TYPE void *
591 #endif
592
593 /* Accessor methods to globals.
594 These are made visible to non-reentrant scanners for convenience. */
595
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 ));
609
610 /* Macros after this point can all be overridden by user definitions in
611 * section 1.
612 */
613
614 #ifndef YY_SKIP_YYWRAP
615 extern int yywrap FDECL(FDECL_dummy, (void ));
616 #endif
617
618 #ifndef YY_NO_UNPUT
619
620 void yyunput FDECL(FDECL_dummy, (int c,char *buf_ptr ));
621 #endif
622
623 #ifndef yytext_ptr
624 static void yy_flex_strncpy FDECL(FDECL_dummy, (char *,yyconst char *,int ));
625 #endif
626
627 #ifdef YY_NEED_STRLEN
628 static int yy_flex_strlen FDECL(FDECL_dummy, (yyconst char * ));
629 #endif
630
631 #ifndef YY_NO_INPUT
632
633 static int input FDECL(FDECL_dummy, (void ));
634
635 #endif
636
637 /* Amount of stuff to slurp up with each read. */
638 #ifndef YY_READ_BUF_SIZE
639 #ifdef __ia64__
640 /* On IA-64, the buffer size is 16k, not 8k */
641 #define YY_READ_BUF_SIZE 16384
642 #else
643 #define YY_READ_BUF_SIZE 8192
644 #endif /* __ia64__ */
645 #endif
646
647 /* Copy whatever the last rule matched to the standard output. */
648 #ifndef ECHO
649 /* This used to be an fputs(), but since the string might contain NUL's,
650 * we now use fwrite().
651 */
652 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
653 #endif
654
655 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
656 * is returned in "result".
657 */
658 #ifndef YY_INPUT
659 #define YY_INPUT(buf,result,max_size) \
660 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
661 { \
662 int c = '*'; \
663 size_t n; \
664 for ( n = 0; n < max_size && \
665 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
666 buf[n] = (char) c; \
667 if ( c == '\n' ) \
668 buf[n++] = (char) c; \
669 if ( c == EOF && ferror( yyin ) ) \
670 YY_FATAL_ERROR( "input in flex scanner failed" ); \
671 result = n; \
672 } \
673 else \
674 { \
675 errno=0; \
676 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
677 { \
678 if( errno != EINTR) \
679 { \
680 YY_FATAL_ERROR( "input in flex scanner failed" ); \
681 break; \
682 } \
683 errno=0; \
684 clearerr(yyin); \
685 } \
686 }\
687
688 #endif
689
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.
693 */
694 #ifndef yyterminate
695 #define yyterminate() return YY_NULL
696 #endif
697
698 /* Number of entries by which start-condition stack grows. */
699 #ifndef YY_START_STACK_INCR
700 #define YY_START_STACK_INCR 25
701 #endif
702
703 /* Report a fatal error. */
704 #ifndef YY_FATAL_ERROR
705 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
706 #endif
707
708 /* Default declaration of generated scanner - a define so the user can
709 * easily add parameters.
710 */
711 #ifndef YY_DECL
712 #define YY_DECL_IS_OURS 1
713
714 extern int yylex FDECL(FDECL_dummy, (void));
715
716 #define YY_DECL int yylex ()
717 #endif /* !YY_DECL */
718
719 /* Code executed at the beginning of each rule, after yytext and yyleng
720 * have been set up.
721 */
722 #ifndef YY_USER_ACTION
723 #define YY_USER_ACTION
724 #endif
725
726 /* Code executed at the end of each rule. */
727 #ifndef YY_BREAK
728 #define YY_BREAK /*LINTED*/break;
729 #endif
730
731 #define YY_RULE_SETUP \
732 if ( yyleng > 0 ) \
733 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
734 (yytext[yyleng - 1] == '\n'); \
735 YY_USER_ACTION
736
737 /** The main scanner function which does all the work.
738 */
739 YY_DECL
740 {
741 yy_state_type yy_current_state;
742 char *yy_cp, *yy_bp;
743 int yy_act;
744
745 if ( !(yy_init) )
746 {
747 (yy_init) = 1;
748
749 #ifdef YY_USER_INIT
750 YY_USER_INIT;
751 #endif
752
753 if ( ! (yy_start) )
754 (yy_start) = 1; /* first start state */
755
756 if ( ! yyin )
757 yyin = stdin;
758
759 if ( ! yyout )
760 yyout = stdout;
761
762 if ( ! YY_CURRENT_BUFFER ) {
763 yyensure_buffer_stack ();
764 YY_CURRENT_BUFFER_LVALUE =
765 yy_create_buffer(yyin,YY_BUF_SIZE );
766 }
767
768 yy_load_buffer_state( );
769 }
770
771 {
772
773 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
774 {
775 yy_cp = (yy_c_buf_p);
776
777 /* Support of yytext. */
778 *yy_cp = (yy_hold_char);
779
780 /* yy_bp points to the position in yy_ch_buf of the start of
781 * the current run.
782 */
783 yy_bp = yy_cp;
784
785 yy_current_state = (yy_start);
786 yy_current_state += YY_AT_BOL();
787 yy_match:
788 do
789 {
790 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
791 if ( yy_accept[yy_current_state] )
792 {
793 (yy_last_accepting_state) = yy_current_state;
794 (yy_last_accepting_cpos) = yy_cp;
795 }
796 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
797 {
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];
801 }
802 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
803 ++yy_cp;
804 }
805 while ( yy_base[yy_current_state] != 220 );
806
807 yy_find_action:
808 yy_act = yy_accept[yy_current_state];
809 if ( yy_act == 0 )
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];
814 }
815
816 YY_DO_BEFORE_ACTION;
817
818 do_action: /* This label is used only to access EOF actions. */
819
820 switch ( yy_act )
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);
827 goto yy_find_action;
828
829 case 1:
830 YY_RULE_SETUP
831 return(A_DUNGEON);
832 YY_BREAK
833 case 2:
834 YY_RULE_SETUP
835 { yylval.i=1; return(UP_OR_DOWN); }
836 YY_BREAK
837 case 3:
838 YY_RULE_SETUP
839 { yylval.i=0; return(UP_OR_DOWN); }
840 YY_BREAK
841 case 4:
842 YY_RULE_SETUP
843 return(ENTRY);
844 YY_BREAK
845 case 5:
846 YY_RULE_SETUP
847 return(STAIR);
848 YY_BREAK
849 case 6:
850 YY_RULE_SETUP
851 return(NO_UP);
852 YY_BREAK
853 case 7:
854 YY_RULE_SETUP
855 return(NO_DOWN);
856 YY_BREAK
857 case 8:
858 YY_RULE_SETUP
859 return(PORTAL);
860 YY_BREAK
861 case 9:
862 YY_RULE_SETUP
863 return(PROTOFILE);
864 YY_BREAK
865 case 10:
866 YY_RULE_SETUP
867 return(DESCRIPTION);
868 YY_BREAK
869 case 11:
870 YY_RULE_SETUP
871 return(LEVELDESC);
872 YY_BREAK
873 case 12:
874 YY_RULE_SETUP
875 return(ALIGNMENT);
876 YY_BREAK
877 case 13:
878 YY_RULE_SETUP
879 return(LEVALIGN);
880 YY_BREAK
881 case 14:
882 YY_RULE_SETUP
883 { yylval.i=TOWN ; return(DESCRIPTOR); }
884 YY_BREAK
885 case 15:
886 YY_RULE_SETUP
887 { yylval.i=HELLISH ; return(DESCRIPTOR); }
888 YY_BREAK
889 case 16:
890 YY_RULE_SETUP
891 { yylval.i=MAZELIKE ; return(DESCRIPTOR); }
892 YY_BREAK
893 case 17:
894 YY_RULE_SETUP
895 { yylval.i=ROGUELIKE ; return(DESCRIPTOR); }
896 YY_BREAK
897 case 18:
898 YY_RULE_SETUP
899 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
900 YY_BREAK
901 case 19:
902 YY_RULE_SETUP
903 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
904 YY_BREAK
905 case 20:
906 YY_RULE_SETUP
907 { yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); }
908 YY_BREAK
909 case 21:
910 YY_RULE_SETUP
911 { yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); }
912 YY_BREAK
913 case 22:
914 YY_RULE_SETUP
915 { yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); }
916 YY_BREAK
917 case 23:
918 YY_RULE_SETUP
919 return(BRANCH);
920 YY_BREAK
921 case 24:
922 YY_RULE_SETUP
923 return(CHBRANCH);
924 YY_BREAK
925 case 25:
926 YY_RULE_SETUP
927 return(LEVEL);
928 YY_BREAK
929 case 26:
930 YY_RULE_SETUP
931 return(RNDLEVEL);
932 YY_BREAK
933 case 27:
934 YY_RULE_SETUP
935 return(CHLEVEL);
936 YY_BREAK
937 case 28:
938 YY_RULE_SETUP
939 return(RNDCHLEVEL);
940 YY_BREAK
941 case 29:
942 YY_RULE_SETUP
943 { yylval.i=atoi(yytext); return(INTEGER); }
944 YY_BREAK
945 case 30:
946 /* rule 30 can match eol */
947 YY_RULE_SETUP
948 { yytext[yyleng - 1] = '\0'; /* discard the trailing \" */
949 yylval.str = dupstr(yytext + 1); /* skip the first \" */
950 return STRING; }
951 YY_BREAK
952 case 31:
953 /* rule 31 can match eol */
954 YY_RULE_SETUP
955 { nh_line_number++; }
956 YY_BREAK
957 case 32:
958 /* rule 32 can match eol */
959 YY_RULE_SETUP
960 { nh_line_number++; }
961 YY_BREAK
962 case 33:
963 YY_RULE_SETUP
964 ; /* skip trailing tabs & spaces */
965 YY_BREAK
966 case 34:
967 YY_RULE_SETUP
968 { return yytext[0]; }
969 YY_BREAK
970 case 35:
971 YY_RULE_SETUP
972 ECHO;
973 YY_BREAK
974 case YY_STATE_EOF(INITIAL):
975 yyterminate();
976
977 case YY_END_OF_BUFFER:
978 {
979 /* Amount of text matched not including the EOB char. */
980 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
981
982 /* Undo the effects of YY_DO_BEFORE_ACTION. */
983 *yy_cp = (yy_hold_char);
984 YY_RESTORE_YY_MORE_OFFSET
985
986 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
987 {
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.
996 */
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;
1000 }
1001
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
1007 * in input().
1008 */
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;
1012
1013 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1014
1015 yy_current_state = yy_get_previous_state( );
1016
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).
1024 */
1025
1026 yy_next_state = yy_try_NUL_trans( yy_current_state );
1027
1028 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1029
1030 if ( yy_next_state )
1031 {
1032 /* Consume the NUL. */
1033 yy_cp = ++(yy_c_buf_p);
1034 yy_current_state = yy_next_state;
1035 goto yy_match;
1036 }
1037
1038 else
1039 {
1040 yy_cp = (yy_c_buf_p);
1041 goto yy_find_action;
1042 }
1043 }
1044
1045 else switch ( yy_get_next_buffer( ) )
1046 {
1047 case EOB_ACT_END_OF_FILE:
1048 {
1049 (yy_did_buffer_switch_on_eof) = 0;
1050
1051 if ( yywrap( ) )
1052 {
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.
1061 */
1062 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1063
1064 yy_act = YY_STATE_EOF(YY_START);
1065 goto do_action;
1066 }
1067
1068 else
1069 {
1070 if ( ! (yy_did_buffer_switch_on_eof) )
1071 YY_NEW_FILE;
1072 }
1073 break;
1074 }
1075
1076 case EOB_ACT_CONTINUE_SCAN:
1077 (yy_c_buf_p) =
1078 (yytext_ptr) + yy_amount_of_matched_text;
1079
1080 yy_current_state = yy_get_previous_state( );
1081
1082 yy_cp = (yy_c_buf_p);
1083 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1084 goto yy_match;
1085
1086 case EOB_ACT_LAST_MATCH:
1087 (yy_c_buf_p) =
1088 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1089
1090 yy_current_state = yy_get_previous_state( );
1091
1092 yy_cp = (yy_c_buf_p);
1093 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1094 goto yy_find_action;
1095 }
1096 break;
1097 }
1098
1099 default:
1100 YY_FATAL_ERROR(
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 */
1106
1107 /* yy_get_next_buffer - try to read in a new buffer
1108 *
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
1113 */
yy_get_next_buffer()1114 static int yy_get_next_buffer ()
1115 {
1116 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1117 char *source = (yytext_ptr);
1118 yy_size_t number_to_move, i;
1119 int ret_val;
1120
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");
1123
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.
1129 */
1130 return EOB_ACT_END_OF_FILE;
1131 } else {
1132 /* We matched some text prior to the EOB, first
1133 * process it.
1134 */
1135 return EOB_ACT_LAST_MATCH;
1136 }
1137 }
1138
1139 /* Try to read more data. */
1140
1141 /* First move last chars to start of buffer. */
1142 number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1143
1144 for (i = 0; i < number_to_move; ++i)
1145 *(dest++) = *(source++);
1146
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,
1149 * just force an EOF
1150 */
1151 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1152 } else {
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;
1156
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. */
1164
1165 int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf);
1166
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 );
1172 } else
1173 /* Can't grow it, we don't own it. */
1174 b->yy_ch_buf = 0;
1175
1176 if (! b->yy_ch_buf)
1177 YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
1178
1179 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1180
1181 }
1182
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;
1186
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);
1191 }
1192
1193 if ((yy_n_chars) == 0) {
1194 if (number_to_move == YY_MORE_ADJ) {
1195 ret_val = EOB_ACT_END_OF_FILE;
1196 yyrestart(yyin );
1197 } else {
1198 ret_val = EOB_ACT_LAST_MATCH;
1199 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
1200 }
1201 } else
1202 ret_val = EOB_ACT_CONTINUE_SCAN;
1203
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()");
1212 }
1213
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;
1217
1218 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1219
1220 return ret_val;
1221 }
1222
1223 /* yy_get_previous_state - get the state just before EOB char was reached */
1224
yy_get_previous_state()1225 static yy_state_type yy_get_previous_state ()
1226 {
1227 yy_state_type yy_current_state;
1228 char *yy_cp;
1229
1230 yy_current_state = (yy_start);
1231 yy_current_state += YY_AT_BOL();
1232
1233 for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
1234
1235 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1236 if ( yy_accept[yy_current_state] )
1237 {
1238 (yy_last_accepting_state) = yy_current_state;
1239 (yy_last_accepting_cpos) = yy_cp;
1240 }
1241 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1242 {
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];
1246 }
1247 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1248 }
1249
1250 return yy_current_state;
1251 }
1252
1253 /* yy_try_NUL_trans - try to make a transition on the NUL character
1254 *
1255 * synopsis
1256 * next_state = yy_try_NUL_trans( current_state );
1257 */
1258
yy_try_NUL_trans(yy_current_state)1259 static yy_state_type yy_try_NUL_trans (yy_current_state )
1260 yy_state_type yy_current_state;
1261 {
1262 int yy_is_jam;
1263 char *yy_cp = (yy_c_buf_p);
1264
1265 YY_CHAR yy_c = 1;
1266 if ( yy_accept[yy_current_state] )
1267 {
1268 (yy_last_accepting_state) = yy_current_state;
1269 (yy_last_accepting_cpos) = yy_cp;
1270 }
1271 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1272 {
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];
1276 }
1277 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1278 yy_is_jam = (yy_current_state == 195);
1279
1280 return yy_is_jam ? 0 : yy_current_state;
1281 }
1282
1283 #ifndef YY_NO_UNPUT
1284
yyunput(c,yy_bp)1285 void yyunput (c,yy_bp )
1286 int c;
1287 char * yy_bp;
1288 {
1289 char *yy_cp;
1290
1291 yy_cp = (yy_c_buf_p);
1292
1293 /* undo effects of setting up yytext */
1294 *yy_cp = (yy_hold_char);
1295
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];
1302 char *source =
1303 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1304
1305 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1306 *--dest = *--source;
1307
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;
1312
1313 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1314 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1315 }
1316
1317 *--yy_cp = (char) c;
1318
1319 (yytext_ptr) = yy_bp;
1320 (yy_hold_char) = *yy_cp;
1321 (yy_c_buf_p) = yy_cp;
1322 }
1323
1324 #endif
1325
1326 #ifndef YY_NO_INPUT
input()1327 static int input ()
1328 {
1329 int c;
1330
1331 *(yy_c_buf_p) = (yy_hold_char);
1332
1333 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1334 {
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.
1338 */
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';
1342
1343 else
1344 { /* need more input */
1345 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1346 ++(yy_c_buf_p);
1347
1348 switch ( yy_get_next_buffer( ) )
1349 {
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.
1359 */
1360
1361 /* Reset buffer status. */
1362 yyrestart(yyin );
1363
1364 /*FALLTHROUGH*/
1365
1366 case EOB_ACT_END_OF_FILE:
1367 {
1368 if ( yywrap( ) )
1369 return EOF;
1370
1371 if ( ! (yy_did_buffer_switch_on_eof) )
1372 YY_NEW_FILE;
1373 return input();
1374 }
1375
1376 case EOB_ACT_CONTINUE_SCAN:
1377 (yy_c_buf_p) = (yytext_ptr) + offset;
1378 break;
1379 }
1380 }
1381 }
1382
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);
1386
1387 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1388
1389 return c;
1390 }
1391 #endif /* ifndef YY_NO_INPUT */
1392
1393 /** Immediately switch to a different input stream.
1394 * @param input_file A readable stream.
1395 *
1396 * @note This function does not reset the start condition to @c INITIAL .
1397 */
1398
yyrestart(input_file)1399 void yyrestart (input_file )
1400 FILE * input_file;
1401 {
1402
1403 if ( ! YY_CURRENT_BUFFER ){
1404 yyensure_buffer_stack ();
1405 YY_CURRENT_BUFFER_LVALUE =
1406 yy_create_buffer(yyin,YY_BUF_SIZE );
1407 }
1408
1409 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1410 yy_load_buffer_state( );
1411 }
1412
1413 /** Switch to a different input buffer.
1414 * @param new_buffer The new input buffer.
1415 *
1416 */
yy_switch_to_buffer(new_buffer)1417 void yy_switch_to_buffer (new_buffer )
1418 YY_BUFFER_STATE new_buffer;
1419 {
1420
1421 /* TODO. We should be able to replace this entire function body
1422 * with
1423 * yypop_buffer_state();
1424 * yypush_buffer_state(new_buffer);
1425 */
1426 yyensure_buffer_stack ();
1427 if ( YY_CURRENT_BUFFER == new_buffer )
1428 return;
1429
1430 if ( YY_CURRENT_BUFFER )
1431 {
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);
1436 }
1437
1438 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1439 yy_load_buffer_state( );
1440
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.
1445 */
1446 (yy_did_buffer_switch_on_eof) = 1;
1447 }
1448
yy_load_buffer_state()1449 static void yy_load_buffer_state ()
1450 {
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);
1455 }
1456
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.
1460 *
1461 * @return the allocated buffer state.
1462 */
yy_create_buffer(file,size)1463 YY_BUFFER_STATE yy_create_buffer (file,size )
1464 FILE * file;
1465 int size;
1466 {
1467 YY_BUFFER_STATE b;
1468
1469 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1470 if ( ! b )
1471 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1472 if (!size)
1473 size = YY_BUF_SIZE;
1474
1475 b->yy_buf_size = (yy_size_t)size;
1476
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.
1479 */
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()" );
1483
1484 b->yy_is_our_buffer = 1;
1485
1486 yy_init_buffer(b,file );
1487
1488 return b;
1489 }
1490
1491 /** Destroy the buffer.
1492 * @param b a buffer created with yy_create_buffer()
1493 *
1494 */
yy_delete_buffer(b)1495 void yy_delete_buffer (b )
1496 YY_BUFFER_STATE b;
1497 {
1498
1499 if ( ! b )
1500 return;
1501
1502 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1503 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1504
1505 if ( b->yy_is_our_buffer )
1506 yyfree((void *) b->yy_ch_buf );
1507
1508 yyfree((void *) b );
1509 }
1510
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.
1514 */
yy_init_buffer(b,file)1515 static void yy_init_buffer (b,file )
1516 YY_BUFFER_STATE b;
1517 FILE * file;
1518 {
1519 int oerrno = errno;
1520
1521 yy_flush_buffer(b );
1522
1523 b->yy_input_file = file;
1524 b->yy_fill_buffer = 1;
1525
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.
1529 */
1530 if (b != YY_CURRENT_BUFFER){
1531 b->yy_bs_lineno = 1;
1532 b->yy_bs_column = 0;
1533 }
1534
1535 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1536
1537 errno = oerrno;
1538 }
1539
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.
1542 *
1543 */
yy_flush_buffer(b)1544 void yy_flush_buffer (b )
1545 YY_BUFFER_STATE b;
1546 {
1547 if ( ! b )
1548 return;
1549
1550 b->yy_n_chars = 0;
1551
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.
1555 */
1556 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1557 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1558
1559 b->yy_buf_pos = &b->yy_ch_buf[0];
1560
1561 b->yy_at_bol = 1;
1562 b->yy_buffer_status = YY_BUFFER_NEW;
1563
1564 if ( b == YY_CURRENT_BUFFER )
1565 yy_load_buffer_state( );
1566 }
1567
1568 /** Pushes the new state onto the stack. The new state becomes
1569 * the current state. This function will allocate the stack
1570 * if necessary.
1571 * @param new_buffer The new state.
1572 *
1573 */
yypush_buffer_state(new_buffer)1574 void yypush_buffer_state (new_buffer )
1575 YY_BUFFER_STATE new_buffer;
1576 {
1577 if (new_buffer == NULL)
1578 return;
1579
1580 yyensure_buffer_stack();
1581
1582 /* This block is copied from yy_switch_to_buffer. */
1583 if ( YY_CURRENT_BUFFER )
1584 {
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);
1589 }
1590
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;
1595
1596 /* copied from yy_switch_to_buffer. */
1597 yy_load_buffer_state( );
1598 (yy_did_buffer_switch_on_eof) = 1;
1599 }
1600
1601 /** Removes and deletes the top of the stack, if present.
1602 * The next element becomes the new top.
1603 *
1604 */
yypop_buffer_state()1605 void yypop_buffer_state ()
1606 {
1607 if (!YY_CURRENT_BUFFER)
1608 return;
1609
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);
1614
1615 if (YY_CURRENT_BUFFER) {
1616 yy_load_buffer_state( );
1617 (yy_did_buffer_switch_on_eof) = 1;
1618 }
1619 }
1620
1621 /* Allocates the stack if it does not exist.
1622 * Guarantees space for at least one push.
1623 */
yyensure_buffer_stack()1624 static void yyensure_buffer_stack ()
1625 {
1626 yy_size_t num_to_alloc;
1627
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.
1632 */
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... */
1635 #else
1636 num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
1637 #endif
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()");
1642
1643 (void) memset((yy_buffer_stack), 0,
1644 num_to_alloc * sizeof(struct yy_buffer_state*));
1645
1646 (yy_buffer_stack_max) = num_to_alloc;
1647 (yy_buffer_stack_top) = 0;
1648 return;
1649 }
1650
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 */;
1654
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()");
1660
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;
1665 }
1666 }
1667
1668 /** Setup the input buffer state to scan directly from a user-specified
1669 * character buffer.
1670 * @param base the character buffer
1671 * @param size the size in bytes of the character buffer
1672 *
1673 * @return the newly allocated buffer state object.
1674 */
yy_scan_buffer(base,size)1675 YY_BUFFER_STATE yy_scan_buffer (base,size )
1676 char * base;
1677 yy_size_t size;
1678 {
1679 YY_BUFFER_STATE b;
1680
1681 if ( size < 2 ||
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. */
1685 return 0;
1686
1687 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1688 if ( ! b )
1689 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1690
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;
1697 b->yy_at_bol = 1;
1698 b->yy_fill_buffer = 0;
1699 b->yy_buffer_status = YY_BUFFER_NEW;
1700
1701 yy_switch_to_buffer(b );
1702
1703 return b;
1704 }
1705
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
1709 *
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.
1713 */
yy_scan_string(yystr)1714 YY_BUFFER_STATE yy_scan_string (yystr )
1715 yyconst char * yystr;
1716 {
1717
1718 return yy_scan_bytes(yystr,strlen(yystr) );
1719 }
1720
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
1725 * bytes.
1726 *
1727 * @return the newly allocated buffer state object.
1728 */
yy_scan_bytes(yybytes,_yybytes_len)1729 YY_BUFFER_STATE yy_scan_bytes (yybytes,_yybytes_len )
1730 yyconst char * yybytes;
1731 yy_size_t _yybytes_len;
1732 {
1733 YY_BUFFER_STATE b;
1734 char *buf;
1735 yy_size_t n;
1736 yy_size_t i;
1737
1738 /* Get memory for full buffer, including space for trailing EOB's. */
1739 n = _yybytes_len + 2;
1740 buf = (char *) yyalloc(n );
1741 if ( ! buf )
1742 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1743
1744 for ( i = 0; i < _yybytes_len; ++i )
1745 buf[i] = yybytes[i];
1746
1747 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1748
1749 b = yy_scan_buffer(buf,n );
1750 if ( ! b )
1751 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1752
1753 /* It's okay to grow etc. this buffer, and we should throw it
1754 * away when we're done.
1755 */
1756 b->yy_is_our_buffer = 1;
1757
1758 return b;
1759 }
1760
1761 #ifndef YY_EXIT_FAILURE
1762 #define YY_EXIT_FAILURE 2
1763 #endif
1764
yy_fatal_error(msg)1765 static void yy_fatal_error (msg )
1766 yyconst char* msg;
1767 {
1768 (void) fprintf( stderr, "%s\n", msg );
1769 exit( YY_EXIT_FAILURE );
1770 }
1771
1772 /* Redefine yyless() so it works in section 3 code. */
1773
1774 #undef yyless
1775 #define yyless(n) \
1776 do { \
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; \
1785 } while ( 0 )
1786
1787 /* Accessor methods (get/set functions) to struct members. */
1788
1789 /** Get the current line number.
1790 *
1791 */
yyget_lineno()1792 int yyget_lineno ()
1793 {
1794
1795 return yylineno;
1796 }
1797
1798 /** Get the input stream.
1799 *
1800 */
yyget_in()1801 FILE *yyget_in ()
1802 {
1803 return yyin;
1804 }
1805
1806 /** Get the output stream.
1807 *
1808 */
yyget_out()1809 FILE *yyget_out ()
1810 {
1811 return yyout;
1812 }
1813
1814 /** Get the length of the current token.
1815 *
1816 */
yyget_leng()1817 yy_size_t yyget_leng ()
1818 {
1819 return yyleng;
1820 }
1821
1822 /** Get the current token.
1823 *
1824 */
1825
yyget_text()1826 char *yyget_text ()
1827 {
1828 return yytext;
1829 }
1830
1831 /** Set the current line number.
1832 * @param _line_number line number
1833 *
1834 */
yyset_lineno(_line_number)1835 void yyset_lineno (_line_number )
1836 int _line_number;
1837 {
1838
1839 yylineno = _line_number;
1840 }
1841
1842 /** Set the input stream. This does not discard the current
1843 * input buffer.
1844 * @param _in_str A readable stream.
1845 *
1846 * @see yy_switch_to_buffer
1847 */
yyset_in(_in_str)1848 void yyset_in (_in_str )
1849 FILE * _in_str;
1850 {
1851 yyin = _in_str ;
1852 }
1853
yyset_out(_out_str)1854 void yyset_out (_out_str )
1855 FILE * _out_str;
1856 {
1857 yyout = _out_str ;
1858 }
1859
yyget_debug()1860 int yyget_debug ()
1861 {
1862 return yy_flex_debug;
1863 }
1864
yyset_debug(_bdebug)1865 void yyset_debug (_bdebug )
1866 int _bdebug;
1867 {
1868 yy_flex_debug = _bdebug ;
1869 }
1870
yy_init_globals()1871 static int yy_init_globals ()
1872 {
1873 /* Initialization is the same as for the non-reentrant scanner.
1874 * This function is called from yylex_destroy(), so don't allocate here.
1875 */
1876
1877 (yy_buffer_stack) = 0;
1878 (yy_buffer_stack_top) = 0;
1879 (yy_buffer_stack_max) = 0;
1880 (yy_c_buf_p) = (char *) 0;
1881 (yy_init) = 0;
1882 (yy_start) = 0;
1883
1884 /* Defined in main.c */
1885 #ifdef YY_STDINIT
1886 yyin = stdin;
1887 yyout = stdout;
1888 #else
1889 yyin = (FILE *) 0;
1890 yyout = (FILE *) 0;
1891 #endif
1892
1893 /* For future reference: Set errno on error, since we are called by
1894 * yylex_init()
1895 */
1896 return 0;
1897 }
1898
1899 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy()1900 int yylex_destroy ()
1901 {
1902
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();
1908 }
1909 /* Destroy the stack itself. */
1910 yyfree((yy_buffer_stack) );
1911 (yy_buffer_stack) = NULL;
1912
1913 /* Reset the globals. This is important in a non-reentrant scanner
1914 * so the next time yylex() is called, initialization will occur. */
1915 yy_init_globals( );
1916
1917 return 0;
1918 }
1919
1920 /*
1921 * Internal utility routines.
1922 */
1923
1924 #ifndef yytext_ptr
yy_flex_strncpy(s1,s2,n)1925 static void yy_flex_strncpy (s1,s2,n )
1926 char* s1;
1927 yyconst char * s2;
1928 int n;
1929 {
1930
1931 int i;
1932 for ( i = 0; i < n; ++i )
1933 s1[i] = s2[i];
1934 }
1935 #endif
1936
1937 #ifdef YY_NEED_STRLEN
yy_flex_strlen(s)1938 static int yy_flex_strlen (s )
1939 yyconst char * s;
1940 {
1941 int n;
1942 for ( n = 0; s[n]; ++n )
1943 ;
1944
1945 return n;
1946 }
1947 #endif
1948
yyalloc(size)1949 void *yyalloc (size )
1950 yy_size_t size;
1951 {
1952
1953 return (void *) malloc( size );
1954 }
1955
yyrealloc(ptr,size)1956 void *yyrealloc (ptr,size )
1957 void * ptr;
1958 yy_size_t size;
1959 {
1960
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.
1967 */
1968 return (void *) realloc( (char *) ptr, size );
1969 }
1970
yyfree(ptr)1971 void yyfree (ptr )
1972 void * ptr;
1973 {
1974
1975 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1976 }
1977
1978 /* routine to switch to another input file; needed for flex */
1979 void
init_yyin(input_f)1980 init_yyin( input_f )
1981 FILE *input_f;
1982 {
1983 #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
1984 if (yyin)
1985 yyrestart(input_f);
1986 else
1987 #endif
1988 yyin = input_f;
1989 }
1990
1991 /* analogous routine (for completeness) */
1992 void
init_yyout(output_f)1993 init_yyout( output_f )
1994 FILE *output_f;
1995 {
1996 yyout = output_f;
1997 }
1998
1999 /*dgn_comp.l*/
2000
2001