029c7f803398e5ed9b16052f6a53c6a042db353e
[advent21.git] / 2.c
1
2 #line 3 "<stdout>"
3
4 #define YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
15
16 /* First, we deal with platform-specific or compiler-specific issues. */
17
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
23
24 /* end standard C headers. */
25
26 /* flex integer type definitions */
27
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
30
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
37 */
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
41
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
56
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX (4294967295U)
84 #endif
85
86 #ifndef SIZE_MAX
87 #define SIZE_MAX (~(size_t)0)
88 #endif
89
90 #endif /* ! C99 */
91
92 #endif /* ! FLEXINT_H */
93
94 /* begin standard C++ headers. */
95
96 /* TODO: this is always defined, so inline it */
97 #define yyconst const
98
99 #if defined(__GNUC__) && __GNUC__ >= 3
100 #define yynoreturn __attribute__((__noreturn__))
101 #else
102 #define yynoreturn
103 #endif
104
105 /* Returned upon end-of-file. */
106 #define YY_NULL 0
107
108 /* Promotes a possibly negative, possibly signed char to an
109 * integer in range [0..255] for use as an array index.
110 */
111 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
112
113 /* Enter a start condition. This macro really ought to take a parameter,
114 * but we do it the disgusting crufty way forced on us by the ()-less
115 * definition of BEGIN.
116 */
117 #define BEGIN (yy_start) = 1 + 2 *
118 /* Translate the current start state into a value that can be later handed
119 * to BEGIN to return to the state. The YYSTATE alias is for lex
120 * compatibility.
121 */
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126 /* Special action meaning "start processing a new file". */
127 #define YY_NEW_FILE yyrestart( yyin )
128 #define YY_END_OF_BUFFER_CHAR 0
129
130 /* Size of default input buffer. */
131 #ifndef YY_BUF_SIZE
132 #ifdef __ia64__
133 /* On IA-64, the buffer size is 16k, not 8k.
134 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
135 * Ditto for the __ia64__ case accordingly.
136 */
137 #define YY_BUF_SIZE 32768
138 #else
139 #define YY_BUF_SIZE 16384
140 #endif /* __ia64__ */
141 #endif
142
143 /* The state buf must be large enough to hold one state per character in the main buffer.
144 */
145 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
146
147 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
148 #define YY_TYPEDEF_YY_BUFFER_STATE
149 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #endif
151
152 #ifndef YY_TYPEDEF_YY_SIZE_T
153 #define YY_TYPEDEF_YY_SIZE_T
154 typedef size_t yy_size_t;
155 #endif
156
157 extern int yyleng;
158
159 extern FILE *yyin, *yyout;
160
161 #define EOB_ACT_CONTINUE_SCAN 0
162 #define EOB_ACT_END_OF_FILE 1
163 #define EOB_ACT_LAST_MATCH 2
164
165 #define YY_LESS_LINENO(n)
166 #define YY_LINENO_REWIND_TO(ptr)
167
168 /* Return all but the first "n" matched characters back to the input stream. */
169 #define yyless(n) \
170 do \
171 { \
172 /* Undo effects of setting up yytext. */ \
173 int yyless_macro_arg = (n); \
174 YY_LESS_LINENO(yyless_macro_arg);\
175 *yy_cp = (yy_hold_char); \
176 YY_RESTORE_YY_MORE_OFFSET \
177 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
178 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
179 } \
180 while ( 0 )
181 #define unput(c) yyunput( c, (yytext_ptr) )
182
183 #ifndef YY_STRUCT_YY_BUFFER_STATE
184 #define YY_STRUCT_YY_BUFFER_STATE
185 struct yy_buffer_state
186 {
187 FILE *yy_input_file;
188
189 char *yy_ch_buf; /* input buffer */
190 char *yy_buf_pos; /* current position in input buffer */
191
192 /* Size of input buffer in bytes, not including room for EOB
193 * characters.
194 */
195 int yy_buf_size;
196
197 /* Number of characters read into yy_ch_buf, not including EOB
198 * characters.
199 */
200 int yy_n_chars;
201
202 /* Whether we "own" the buffer - i.e., we know we created it,
203 * and can realloc() it to grow it, and should free() it to
204 * delete it.
205 */
206 int yy_is_our_buffer;
207
208 /* Whether this is an "interactive" input source; if so, and
209 * if we're using stdio for input, then we want to use getc()
210 * instead of fread(), to make sure we stop fetching input after
211 * each newline.
212 */
213 int yy_is_interactive;
214
215 /* Whether we're considered to be at the beginning of a line.
216 * If so, '^' rules will be active on the next match, otherwise
217 * not.
218 */
219 int yy_at_bol;
220
221 int yy_bs_lineno; /**< The line count. */
222 int yy_bs_column; /**< The column count. */
223
224 /* Whether to try to fill the input buffer when we reach the
225 * end of it.
226 */
227 int yy_fill_buffer;
228
229 int yy_buffer_status;
230
231 #define YY_BUFFER_NEW 0
232 #define YY_BUFFER_NORMAL 1
233 /* When an EOF's been seen but there's still some text to process
234 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
235 * shouldn't try reading from the input source any more. We might
236 * still have a bunch of tokens to match, though, because of
237 * possible backing-up.
238 *
239 * When we actually see the EOF, we change the status to "new"
240 * (via yyrestart()), so that the user can continue scanning by
241 * just pointing yyin at a new input file.
242 */
243 #define YY_BUFFER_EOF_PENDING 2
244
245 };
246 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
247
248 /* Stack of input buffers. */
249 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
250 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
251 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
252
253 /* We provide macros for accessing buffer states in case in the
254 * future we want to put the buffer states in a more general
255 * "scanner state".
256 *
257 * Returns the top of the stack, or NULL.
258 */
259 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
260 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
261 : NULL)
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263 * NULL or when we need an lvalue. For internal use only.
264 */
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
266
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars; /* number of characters read into yy_ch_buf */
270 int yyleng;
271
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0; /* whether we need to initialize */
275 static int yy_start = 0; /* start state number */
276
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278 * instead of setting up a fresh yyin. A bit of a hack ...
279 */
280 static int yy_did_buffer_switch_on_eof;
281
282 void yyrestart ( FILE *input_file );
283 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
284 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
285 void yy_delete_buffer ( YY_BUFFER_STATE b );
286 void yy_flush_buffer ( YY_BUFFER_STATE b );
287 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
288 void yypop_buffer_state ( void );
289
290 static void yyensure_buffer_stack ( void );
291 static void yy_load_buffer_state ( void );
292 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
293 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
294
295 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
296 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
297 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
298
299 void *yyalloc ( yy_size_t );
300 void *yyrealloc ( void *, yy_size_t );
301 void yyfree ( void * );
302
303 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
305 { \
306 if ( ! YY_CURRENT_BUFFER ){ \
307 yyensure_buffer_stack (); \
308 YY_CURRENT_BUFFER_LVALUE = \
309 yy_create_buffer( yyin, YY_BUF_SIZE ); \
310 } \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 }
313 #define yy_set_bol(at_bol) \
314 { \
315 if ( ! YY_CURRENT_BUFFER ){\
316 yyensure_buffer_stack (); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 yy_create_buffer( yyin, YY_BUF_SIZE ); \
319 } \
320 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
321 }
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323
324 /* Begin user sect3 */
325
326 #define yywrap() (/*CONSTCOND*/1)
327 #define YY_SKIP_YYWRAP
328 typedef flex_uint8_t YY_CHAR;
329
330 FILE *yyin = NULL, *yyout = NULL;
331
332 typedef int yy_state_type;
333
334 extern int yylineno;
335 int yylineno = 1;
336
337 extern char *yytext;
338 #ifdef yytext_ptr
339 #undef yytext_ptr
340 #endif
341 #define yytext_ptr yytext
342
343 static yy_state_type yy_get_previous_state ( void );
344 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
345 static int yy_get_next_buffer ( void );
346 static void yynoreturn yy_fatal_error ( const char* msg );
347
348 /* Done after the current pattern has been matched and before the
349 * corresponding action - sets up yytext.
350 */
351 #define YY_DO_BEFORE_ACTION \
352 (yytext_ptr) = yy_bp; \
353 yyleng = (int) (yy_cp - yy_bp); \
354 (yy_hold_char) = *yy_cp; \
355 *yy_cp = '\0'; \
356 (yy_c_buf_p) = yy_cp;
357 #define YY_NUM_RULES 5
358 #define YY_END_OF_BUFFER 6
359 /* This struct is not used in this scanner,
360 but its presence is necessary. */
361 struct yy_trans_info
362 {
363 flex_int32_t yy_verify;
364 flex_int32_t yy_nxt;
365 };
366 static const flex_int16_t yy_accept[26] =
367 { 0,
368 0, 0, 6, 5, 4, 5, 5, 5, 0, 0,
369 0, 0, 0, 0, 0, 0, 2, 0, 0, 3,
370 0, 0, 0, 1, 0
371 } ;
372
373 static const YY_CHAR yy_ec[256] =
374 { 0,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 1, 1, 1, 1, 1, 1, 4, 4, 4,
380 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384 1, 1, 1, 1, 1, 1, 5, 1, 1, 6,
385
386 1, 7, 1, 1, 1, 1, 1, 1, 1, 8,
387 9, 10, 1, 11, 1, 1, 12, 1, 13, 1,
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1
403 } ;
404
405 static const YY_CHAR yy_meta[14] =
406 { 0,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1
409 } ;
410
411 static const flex_int16_t yy_base[27] =
412 { 0,
413 0, 11, 29, 30, 30, 19, 18, 16, 12, 13,
414 19, 13, 7, 15, 13, 10, 30, 10, 0, 30,
415 2, 2, 0, 30, 30, 0
416 } ;
417
418 static const flex_int16_t yy_def[27] =
419 { 0,
420 26, 26, 25, 25, 25, 25, 25, 25, 25, 25,
421 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
422 25, 25, 25, 25, 0, 25
423 } ;
424
425 static const flex_int16_t yy_nxt[44] =
426 { 0,
427 4, 5, 25, 24, 23, 6, 7, 22, 25, 25,
428 21, 8, 5, 20, 19, 18, 6, 7, 17, 16,
429 15, 14, 8, 13, 12, 11, 10, 9, 25, 3,
430 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
431 25, 25, 25
432 } ;
433
434 static const flex_int16_t yy_chk[44] =
435 { 0,
436 26, 1, 0, 23, 22, 1, 1, 21, 0, 0,
437 19, 1, 2, 18, 16, 15, 2, 2, 14, 13,
438 12, 11, 2, 10, 9, 8, 7, 6, 3, 25,
439 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
440 25, 25, 25
441 } ;
442
443 static yy_state_type yy_last_accepting_state;
444 static char *yy_last_accepting_cpos;
445
446 extern int yy_flex_debug;
447 int yy_flex_debug = 0;
448
449 /* The intent behind this definition is that it'll catch
450 * any uses of REJECT which flex missed.
451 */
452 #define REJECT reject_used_but_not_detected
453 #define yymore() yymore_used_but_not_detected
454 #define YY_MORE_ADJ 0
455 #define YY_RESTORE_YY_MORE_OFFSET
456 char *yytext;
457 #line 1 "2.l"
458 #define YY_NO_INPUT 1
459 #line 5 "2.l"
460 #include <stdio.h>
461 int x = 0, z = 0;
462 #line 463 "<stdout>"
463 #line 464 "<stdout>"
464
465 #define INITIAL 0
466
467 #ifndef YY_NO_UNISTD_H
468 /* Special case for "unistd.h", since it is non-ANSI. We include it way
469 * down here because we want the user's section 1 to have been scanned first.
470 * The user has a chance to override it with an option.
471 */
472 #include <unistd.h>
473 #endif
474
475 #ifndef YY_EXTRA_TYPE
476 #define YY_EXTRA_TYPE void *
477 #endif
478
479 static int yy_init_globals ( void );
480
481 /* Accessor methods to globals.
482 These are made visible to non-reentrant scanners for convenience. */
483
484 int yylex_destroy ( void );
485
486 int yyget_debug ( void );
487
488 void yyset_debug ( int debug_flag );
489
490 YY_EXTRA_TYPE yyget_extra ( void );
491
492 void yyset_extra ( YY_EXTRA_TYPE user_defined );
493
494 FILE *yyget_in ( void );
495
496 void yyset_in ( FILE * _in_str );
497
498 FILE *yyget_out ( void );
499
500 void yyset_out ( FILE * _out_str );
501
502 int yyget_leng ( void );
503
504 char *yyget_text ( void );
505
506 int yyget_lineno ( void );
507
508 void yyset_lineno ( int _line_number );
509
510 /* Macros after this point can all be overridden by user definitions in
511 * section 1.
512 */
513
514 #ifndef YY_SKIP_YYWRAP
515 #ifdef __cplusplus
516 extern "C" int yywrap ( void );
517 #else
518 extern int yywrap ( void );
519 #endif
520 #endif
521
522 #ifndef YY_NO_UNPUT
523
524 #endif
525
526 #ifndef yytext_ptr
527 static void yy_flex_strncpy ( char *, const char *, int );
528 #endif
529
530 #ifdef YY_NEED_STRLEN
531 static int yy_flex_strlen ( const char * );
532 #endif
533
534 #ifndef YY_NO_INPUT
535 #ifdef __cplusplus
536 static int yyinput ( void );
537 #else
538 static int input ( void );
539 #endif
540
541 #endif
542
543 /* Amount of stuff to slurp up with each read. */
544 #ifndef YY_READ_BUF_SIZE
545 #ifdef __ia64__
546 /* On IA-64, the buffer size is 16k, not 8k */
547 #define YY_READ_BUF_SIZE 16384
548 #else
549 #define YY_READ_BUF_SIZE 8192
550 #endif /* __ia64__ */
551 #endif
552
553 /* Copy whatever the last rule matched to the standard output. */
554 #ifndef ECHO
555 /* This used to be an fputs(), but since the string might contain NUL's,
556 * we now use fwrite().
557 */
558 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
559 #endif
560
561 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
562 * is returned in "result".
563 */
564 #ifndef YY_INPUT
565 #define YY_INPUT(buf,result,max_size) \
566 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
567 { \
568 int c = '*'; \
569 int n; \
570 for ( n = 0; n < max_size && \
571 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
572 buf[n] = (char) c; \
573 if ( c == '\n' ) \
574 buf[n++] = (char) c; \
575 if ( c == EOF && ferror( yyin ) ) \
576 YY_FATAL_ERROR( "input in flex scanner failed" ); \
577 result = n; \
578 } \
579 else \
580 { \
581 errno=0; \
582 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
583 { \
584 if( errno != EINTR) \
585 { \
586 YY_FATAL_ERROR( "input in flex scanner failed" ); \
587 break; \
588 } \
589 errno=0; \
590 clearerr(yyin); \
591 } \
592 }\
593 \
594
595 #endif
596
597 /* No semi-colon after return; correct usage is to write "yyterminate();" -
598 * we don't want an extra ';' after the "return" because that will cause
599 * some compilers to complain about unreachable statements.
600 */
601 #ifndef yyterminate
602 #define yyterminate() return YY_NULL
603 #endif
604
605 /* Number of entries by which start-condition stack grows. */
606 #ifndef YY_START_STACK_INCR
607 #define YY_START_STACK_INCR 25
608 #endif
609
610 /* Report a fatal error. */
611 #ifndef YY_FATAL_ERROR
612 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
613 #endif
614
615 /* end tables serialization structures and prototypes */
616
617 /* Default declaration of generated scanner - a define so the user can
618 * easily add parameters.
619 */
620 #ifndef YY_DECL
621 #define YY_DECL_IS_OURS 1
622
623 extern int yylex (void);
624
625 #define YY_DECL int yylex (void)
626 #endif /* !YY_DECL */
627
628 /* Code executed at the beginning of each rule, after yytext and yyleng
629 * have been set up.
630 */
631 #ifndef YY_USER_ACTION
632 #define YY_USER_ACTION
633 #endif
634
635 /* Code executed at the end of each rule. */
636 #ifndef YY_BREAK
637 #define YY_BREAK /*LINTED*/break;
638 #endif
639
640 #define YY_RULE_SETUP \
641 YY_USER_ACTION
642
643 /** The main scanner function which does all the work.
644 */
645 YY_DECL
646 {
647 yy_state_type yy_current_state;
648 char *yy_cp, *yy_bp;
649 int yy_act;
650
651 if ( !(yy_init) )
652 {
653 (yy_init) = 1;
654
655 #ifdef YY_USER_INIT
656 YY_USER_INIT;
657 #endif
658
659 if ( ! (yy_start) )
660 (yy_start) = 1; /* first start state */
661
662 if ( ! yyin )
663 yyin = stdin;
664
665 if ( ! yyout )
666 yyout = stdout;
667
668 if ( ! YY_CURRENT_BUFFER ) {
669 yyensure_buffer_stack ();
670 YY_CURRENT_BUFFER_LVALUE =
671 yy_create_buffer( yyin, YY_BUF_SIZE );
672 }
673
674 yy_load_buffer_state( );
675 }
676
677 {
678 #line 9 "2.l"
679
680
681 #line 682 "<stdout>"
682
683 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
684 {
685 yy_cp = (yy_c_buf_p);
686
687 /* Support of yytext. */
688 *yy_cp = (yy_hold_char);
689
690 /* yy_bp points to the position in yy_ch_buf of the start of
691 * the current run.
692 */
693 yy_bp = yy_cp;
694
695 yy_current_state = (yy_start);
696 yy_match:
697 do
698 {
699 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
700 if ( yy_accept[yy_current_state] )
701 {
702 (yy_last_accepting_state) = yy_current_state;
703 (yy_last_accepting_cpos) = yy_cp;
704 }
705 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
706 {
707 yy_current_state = (int) yy_def[yy_current_state];
708 if ( yy_current_state >= 26 )
709 yy_c = yy_meta[yy_c];
710 }
711 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
712 ++yy_cp;
713 }
714 while ( yy_base[yy_current_state] != 30 );
715
716 yy_find_action:
717 yy_act = yy_accept[yy_current_state];
718 if ( yy_act == 0 )
719 { /* have to back up */
720 yy_cp = (yy_last_accepting_cpos);
721 yy_current_state = (yy_last_accepting_state);
722 yy_act = yy_accept[yy_current_state];
723 }
724
725 YY_DO_BEFORE_ACTION;
726
727 do_action: /* This label is used only to access EOF actions. */
728
729 switch ( yy_act )
730 { /* beginning of action switch */
731 case 0: /* must back up */
732 /* undo the effects of YY_DO_BEFORE_ACTION */
733 *yy_cp = (yy_hold_char);
734 yy_cp = (yy_last_accepting_cpos);
735 yy_current_state = (yy_last_accepting_state);
736 goto yy_find_action;
737
738 case 1:
739 YY_RULE_SETUP
740 #line 11 "2.l"
741 {
742 x += yytext[strlen(yytext)-1]-'0';
743 }
744 YY_BREAK
745 case 2:
746 YY_RULE_SETUP
747 #line 14 "2.l"
748 {
749 z -= yytext[strlen(yytext)-1]-'0';
750 }
751 YY_BREAK
752 case 3:
753 YY_RULE_SETUP
754 #line 17 "2.l"
755 {
756 z += yytext[strlen(yytext)-1]-'0';
757 }
758 YY_BREAK
759 case 4:
760 /* rule 4 can match eol */
761 YY_RULE_SETUP
762 #line 20 "2.l"
763 ;
764 YY_BREAK
765 case 5:
766 YY_RULE_SETUP
767 #line 21 "2.l"
768 ECHO;
769 YY_BREAK
770 #line 771 "<stdout>"
771 case YY_STATE_EOF(INITIAL):
772 yyterminate();
773
774 case YY_END_OF_BUFFER:
775 {
776 /* Amount of text matched not including the EOB char. */
777 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
778
779 /* Undo the effects of YY_DO_BEFORE_ACTION. */
780 *yy_cp = (yy_hold_char);
781 YY_RESTORE_YY_MORE_OFFSET
782
783 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
784 {
785 /* We're scanning a new file or input source. It's
786 * possible that this happened because the user
787 * just pointed yyin at a new source and called
788 * yylex(). If so, then we have to assure
789 * consistency between YY_CURRENT_BUFFER and our
790 * globals. Here is the right place to do so, because
791 * this is the first action (other than possibly a
792 * back-up) that will match for the new input source.
793 */
794 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
795 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
796 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
797 }
798
799 /* Note that here we test for yy_c_buf_p "<=" to the position
800 * of the first EOB in the buffer, since yy_c_buf_p will
801 * already have been incremented past the NUL character
802 * (since all states make transitions on EOB to the
803 * end-of-buffer state). Contrast this with the test
804 * in input().
805 */
806 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
807 { /* This was really a NUL. */
808 yy_state_type yy_next_state;
809
810 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
811
812 yy_current_state = yy_get_previous_state( );
813
814 /* Okay, we're now positioned to make the NUL
815 * transition. We couldn't have
816 * yy_get_previous_state() go ahead and do it
817 * for us because it doesn't know how to deal
818 * with the possibility of jamming (and we don't
819 * want to build jamming into it because then it
820 * will run more slowly).
821 */
822
823 yy_next_state = yy_try_NUL_trans( yy_current_state );
824
825 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
826
827 if ( yy_next_state )
828 {
829 /* Consume the NUL. */
830 yy_cp = ++(yy_c_buf_p);
831 yy_current_state = yy_next_state;
832 goto yy_match;
833 }
834
835 else
836 {
837 yy_cp = (yy_c_buf_p);
838 goto yy_find_action;
839 }
840 }
841
842 else switch ( yy_get_next_buffer( ) )
843 {
844 case EOB_ACT_END_OF_FILE:
845 {
846 (yy_did_buffer_switch_on_eof) = 0;
847
848 if ( yywrap( ) )
849 {
850 /* Note: because we've taken care in
851 * yy_get_next_buffer() to have set up
852 * yytext, we can now set up
853 * yy_c_buf_p so that if some total
854 * hoser (like flex itself) wants to
855 * call the scanner after we return the
856 * YY_NULL, it'll still work - another
857 * YY_NULL will get returned.
858 */
859 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
860
861 yy_act = YY_STATE_EOF(YY_START);
862 goto do_action;
863 }
864
865 else
866 {
867 if ( ! (yy_did_buffer_switch_on_eof) )
868 YY_NEW_FILE;
869 }
870 break;
871 }
872
873 case EOB_ACT_CONTINUE_SCAN:
874 (yy_c_buf_p) =
875 (yytext_ptr) + yy_amount_of_matched_text;
876
877 yy_current_state = yy_get_previous_state( );
878
879 yy_cp = (yy_c_buf_p);
880 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
881 goto yy_match;
882
883 case EOB_ACT_LAST_MATCH:
884 (yy_c_buf_p) =
885 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
886
887 yy_current_state = yy_get_previous_state( );
888
889 yy_cp = (yy_c_buf_p);
890 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
891 goto yy_find_action;
892 }
893 break;
894 }
895
896 default:
897 YY_FATAL_ERROR(
898 "fatal flex scanner internal error--no action found" );
899 } /* end of action switch */
900 } /* end of scanning one token */
901 } /* end of user's declarations */
902 } /* end of yylex */
903
904 /* yy_get_next_buffer - try to read in a new buffer
905 *
906 * Returns a code representing an action:
907 * EOB_ACT_LAST_MATCH -
908 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
909 * EOB_ACT_END_OF_FILE - end of file
910 */
911 static int yy_get_next_buffer (void)
912 {
913 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
914 char *source = (yytext_ptr);
915 int number_to_move, i;
916 int ret_val;
917
918 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
919 YY_FATAL_ERROR(
920 "fatal flex scanner internal error--end of buffer missed" );
921
922 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
923 { /* Don't try to fill the buffer, so this is an EOF. */
924 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
925 {
926 /* We matched a single character, the EOB, so
927 * treat this as a final EOF.
928 */
929 return EOB_ACT_END_OF_FILE;
930 }
931
932 else
933 {
934 /* We matched some text prior to the EOB, first
935 * process it.
936 */
937 return EOB_ACT_LAST_MATCH;
938 }
939 }
940
941 /* Try to read more data. */
942
943 /* First move last chars to start of buffer. */
944 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
945
946 for ( i = 0; i < number_to_move; ++i )
947 *(dest++) = *(source++);
948
949 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
950 /* don't do the read, it's not guaranteed to return an EOF,
951 * just force an EOF
952 */
953 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
954
955 else
956 {
957 int num_to_read =
958 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
959
960 while ( num_to_read <= 0 )
961 { /* Not enough room in the buffer - grow it. */
962
963 /* just a shorter name for the current buffer */
964 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
965
966 int yy_c_buf_p_offset =
967 (int) ((yy_c_buf_p) - b->yy_ch_buf);
968
969 if ( b->yy_is_our_buffer )
970 {
971 int new_size = b->yy_buf_size * 2;
972
973 if ( new_size <= 0 )
974 b->yy_buf_size += b->yy_buf_size / 8;
975 else
976 b->yy_buf_size *= 2;
977
978 b->yy_ch_buf = (char *)
979 /* Include room in for 2 EOB chars. */
980 yyrealloc( (void *) b->yy_ch_buf,
981 (yy_size_t) (b->yy_buf_size + 2) );
982 }
983 else
984 /* Can't grow it, we don't own it. */
985 b->yy_ch_buf = NULL;
986
987 if ( ! b->yy_ch_buf )
988 YY_FATAL_ERROR(
989 "fatal error - scanner input buffer overflow" );
990
991 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
992
993 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
994 number_to_move - 1;
995
996 }
997
998 if ( num_to_read > YY_READ_BUF_SIZE )
999 num_to_read = YY_READ_BUF_SIZE;
1000
1001 /* Read in more data. */
1002 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1003 (yy_n_chars), num_to_read );
1004
1005 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1006 }
1007
1008 if ( (yy_n_chars) == 0 )
1009 {
1010 if ( number_to_move == YY_MORE_ADJ )
1011 {
1012 ret_val = EOB_ACT_END_OF_FILE;
1013 yyrestart( yyin );
1014 }
1015
1016 else
1017 {
1018 ret_val = EOB_ACT_LAST_MATCH;
1019 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1020 YY_BUFFER_EOF_PENDING;
1021 }
1022 }
1023
1024 else
1025 ret_val = EOB_ACT_CONTINUE_SCAN;
1026
1027 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1028 /* Extend the array by 50%, plus the number we really need. */
1029 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1030 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1031 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1032 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1033 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1034 /* "- 2" to take care of EOB's */
1035 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1036 }
1037
1038 (yy_n_chars) += number_to_move;
1039 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1040 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1041
1042 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1043
1044 return ret_val;
1045 }
1046
1047 /* yy_get_previous_state - get the state just before the EOB char was reached */
1048
1049 static yy_state_type yy_get_previous_state (void)
1050 {
1051 yy_state_type yy_current_state;
1052 char *yy_cp;
1053
1054 yy_current_state = (yy_start);
1055
1056 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1057 {
1058 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1059 if ( yy_accept[yy_current_state] )
1060 {
1061 (yy_last_accepting_state) = yy_current_state;
1062 (yy_last_accepting_cpos) = yy_cp;
1063 }
1064 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1065 {
1066 yy_current_state = (int) yy_def[yy_current_state];
1067 if ( yy_current_state >= 26 )
1068 yy_c = yy_meta[yy_c];
1069 }
1070 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1071 }
1072
1073 return yy_current_state;
1074 }
1075
1076 /* yy_try_NUL_trans - try to make a transition on the NUL character
1077 *
1078 * synopsis
1079 * next_state = yy_try_NUL_trans( current_state );
1080 */
1081 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1082 {
1083 int yy_is_jam;
1084 char *yy_cp = (yy_c_buf_p);
1085
1086 YY_CHAR yy_c = 1;
1087 if ( yy_accept[yy_current_state] )
1088 {
1089 (yy_last_accepting_state) = yy_current_state;
1090 (yy_last_accepting_cpos) = yy_cp;
1091 }
1092 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1093 {
1094 yy_current_state = (int) yy_def[yy_current_state];
1095 if ( yy_current_state >= 26 )
1096 yy_c = yy_meta[yy_c];
1097 }
1098 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1099 yy_is_jam = (yy_current_state == 25);
1100
1101 return yy_is_jam ? 0 : yy_current_state;
1102 }
1103
1104 #ifndef YY_NO_UNPUT
1105
1106 #endif
1107
1108 #ifndef YY_NO_INPUT
1109 #ifdef __cplusplus
1110 static int yyinput (void)
1111 #else
1112 static int input (void)
1113 #endif
1114
1115 {
1116 int c;
1117
1118 *(yy_c_buf_p) = (yy_hold_char);
1119
1120 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1121 {
1122 /* yy_c_buf_p now points to the character we want to return.
1123 * If this occurs *before* the EOB characters, then it's a
1124 * valid NUL; if not, then we've hit the end of the buffer.
1125 */
1126 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1127 /* This was really a NUL. */
1128 *(yy_c_buf_p) = '\0';
1129
1130 else
1131 { /* need more input */
1132 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1133 ++(yy_c_buf_p);
1134
1135 switch ( yy_get_next_buffer( ) )
1136 {
1137 case EOB_ACT_LAST_MATCH:
1138 /* This happens because yy_g_n_b()
1139 * sees that we've accumulated a
1140 * token and flags that we need to
1141 * try matching the token before
1142 * proceeding. But for input(),
1143 * there's no matching to consider.
1144 * So convert the EOB_ACT_LAST_MATCH
1145 * to EOB_ACT_END_OF_FILE.
1146 */
1147
1148 /* Reset buffer status. */
1149 yyrestart( yyin );
1150
1151 /*FALLTHROUGH*/
1152
1153 case EOB_ACT_END_OF_FILE:
1154 {
1155 if ( yywrap( ) )
1156 return 0;
1157
1158 if ( ! (yy_did_buffer_switch_on_eof) )
1159 YY_NEW_FILE;
1160 #ifdef __cplusplus
1161 return yyinput();
1162 #else
1163 return input();
1164 #endif
1165 }
1166
1167 case EOB_ACT_CONTINUE_SCAN:
1168 (yy_c_buf_p) = (yytext_ptr) + offset;
1169 break;
1170 }
1171 }
1172 }
1173
1174 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1175 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1176 (yy_hold_char) = *++(yy_c_buf_p);
1177
1178 return c;
1179 }
1180 #endif /* ifndef YY_NO_INPUT */
1181
1182 /** Immediately switch to a different input stream.
1183 * @param input_file A readable stream.
1184 *
1185 * @note This function does not reset the start condition to @c INITIAL .
1186 */
1187 void yyrestart (FILE * input_file )
1188 {
1189
1190 if ( ! YY_CURRENT_BUFFER ){
1191 yyensure_buffer_stack ();
1192 YY_CURRENT_BUFFER_LVALUE =
1193 yy_create_buffer( yyin, YY_BUF_SIZE );
1194 }
1195
1196 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1197 yy_load_buffer_state( );
1198 }
1199
1200 /** Switch to a different input buffer.
1201 * @param new_buffer The new input buffer.
1202 *
1203 */
1204 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1205 {
1206
1207 /* TODO. We should be able to replace this entire function body
1208 * with
1209 * yypop_buffer_state();
1210 * yypush_buffer_state(new_buffer);
1211 */
1212 yyensure_buffer_stack ();
1213 if ( YY_CURRENT_BUFFER == new_buffer )
1214 return;
1215
1216 if ( YY_CURRENT_BUFFER )
1217 {
1218 /* Flush out information for old buffer. */
1219 *(yy_c_buf_p) = (yy_hold_char);
1220 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1221 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1222 }
1223
1224 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1225 yy_load_buffer_state( );
1226
1227 /* We don't actually know whether we did this switch during
1228 * EOF (yywrap()) processing, but the only time this flag
1229 * is looked at is after yywrap() is called, so it's safe
1230 * to go ahead and always set it.
1231 */
1232 (yy_did_buffer_switch_on_eof) = 1;
1233 }
1234
1235 static void yy_load_buffer_state (void)
1236 {
1237 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1238 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1239 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1240 (yy_hold_char) = *(yy_c_buf_p);
1241 }
1242
1243 /** Allocate and initialize an input buffer state.
1244 * @param file A readable stream.
1245 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1246 *
1247 * @return the allocated buffer state.
1248 */
1249 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1250 {
1251 YY_BUFFER_STATE b;
1252
1253 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1254 if ( ! b )
1255 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1256
1257 b->yy_buf_size = size;
1258
1259 /* yy_ch_buf has to be 2 characters longer than the size given because
1260 * we need to put in 2 end-of-buffer characters.
1261 */
1262 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1263 if ( ! b->yy_ch_buf )
1264 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1265
1266 b->yy_is_our_buffer = 1;
1267
1268 yy_init_buffer( b, file );
1269
1270 return b;
1271 }
1272
1273 /** Destroy the buffer.
1274 * @param b a buffer created with yy_create_buffer()
1275 *
1276 */
1277 void yy_delete_buffer (YY_BUFFER_STATE b )
1278 {
1279
1280 if ( ! b )
1281 return;
1282
1283 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1284 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1285
1286 if ( b->yy_is_our_buffer )
1287 yyfree( (void *) b->yy_ch_buf );
1288
1289 yyfree( (void *) b );
1290 }
1291
1292 /* Initializes or reinitializes a buffer.
1293 * This function is sometimes called more than once on the same buffer,
1294 * such as during a yyrestart() or at EOF.
1295 */
1296 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1297
1298 {
1299 int oerrno = errno;
1300
1301 yy_flush_buffer( b );
1302
1303 b->yy_input_file = file;
1304 b->yy_fill_buffer = 1;
1305
1306 /* If b is the current buffer, then yy_init_buffer was _probably_
1307 * called from yyrestart() or through yy_get_next_buffer.
1308 * In that case, we don't want to reset the lineno or column.
1309 */
1310 if (b != YY_CURRENT_BUFFER){
1311 b->yy_bs_lineno = 1;
1312 b->yy_bs_column = 0;
1313 }
1314
1315 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1316
1317 errno = oerrno;
1318 }
1319
1320 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1321 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1322 *
1323 */
1324 void yy_flush_buffer (YY_BUFFER_STATE b )
1325 {
1326 if ( ! b )
1327 return;
1328
1329 b->yy_n_chars = 0;
1330
1331 /* We always need two end-of-buffer characters. The first causes
1332 * a transition to the end-of-buffer state. The second causes
1333 * a jam in that state.
1334 */
1335 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1336 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1337
1338 b->yy_buf_pos = &b->yy_ch_buf[0];
1339
1340 b->yy_at_bol = 1;
1341 b->yy_buffer_status = YY_BUFFER_NEW;
1342
1343 if ( b == YY_CURRENT_BUFFER )
1344 yy_load_buffer_state( );
1345 }
1346
1347 /** Pushes the new state onto the stack. The new state becomes
1348 * the current state. This function will allocate the stack
1349 * if necessary.
1350 * @param new_buffer The new state.
1351 *
1352 */
1353 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1354 {
1355 if (new_buffer == NULL)
1356 return;
1357
1358 yyensure_buffer_stack();
1359
1360 /* This block is copied from yy_switch_to_buffer. */
1361 if ( YY_CURRENT_BUFFER )
1362 {
1363 /* Flush out information for old buffer. */
1364 *(yy_c_buf_p) = (yy_hold_char);
1365 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1366 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1367 }
1368
1369 /* Only push if top exists. Otherwise, replace top. */
1370 if (YY_CURRENT_BUFFER)
1371 (yy_buffer_stack_top)++;
1372 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1373
1374 /* copied from yy_switch_to_buffer. */
1375 yy_load_buffer_state( );
1376 (yy_did_buffer_switch_on_eof) = 1;
1377 }
1378
1379 /** Removes and deletes the top of the stack, if present.
1380 * The next element becomes the new top.
1381 *
1382 */
1383 void yypop_buffer_state (void)
1384 {
1385 if (!YY_CURRENT_BUFFER)
1386 return;
1387
1388 yy_delete_buffer(YY_CURRENT_BUFFER );
1389 YY_CURRENT_BUFFER_LVALUE = NULL;
1390 if ((yy_buffer_stack_top) > 0)
1391 --(yy_buffer_stack_top);
1392
1393 if (YY_CURRENT_BUFFER) {
1394 yy_load_buffer_state( );
1395 (yy_did_buffer_switch_on_eof) = 1;
1396 }
1397 }
1398
1399 /* Allocates the stack if it does not exist.
1400 * Guarantees space for at least one push.
1401 */
1402 static void yyensure_buffer_stack (void)
1403 {
1404 yy_size_t num_to_alloc;
1405
1406 if (!(yy_buffer_stack)) {
1407
1408 /* First allocation is just for 2 elements, since we don't know if this
1409 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1410 * immediate realloc on the next call.
1411 */
1412 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1413 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1414 (num_to_alloc * sizeof(struct yy_buffer_state*)
1415 );
1416 if ( ! (yy_buffer_stack) )
1417 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1418
1419 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1420
1421 (yy_buffer_stack_max) = num_to_alloc;
1422 (yy_buffer_stack_top) = 0;
1423 return;
1424 }
1425
1426 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1427
1428 /* Increase the buffer to prepare for a possible push. */
1429 yy_size_t grow_size = 8 /* arbitrary grow size */;
1430
1431 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1432 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1433 ((yy_buffer_stack),
1434 num_to_alloc * sizeof(struct yy_buffer_state*)
1435 );
1436 if ( ! (yy_buffer_stack) )
1437 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1438
1439 /* zero only the new slots.*/
1440 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1441 (yy_buffer_stack_max) = num_to_alloc;
1442 }
1443 }
1444
1445 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1446 * @param base the character buffer
1447 * @param size the size in bytes of the character buffer
1448 *
1449 * @return the newly allocated buffer state object.
1450 */
1451 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1452 {
1453 YY_BUFFER_STATE b;
1454
1455 if ( size < 2 ||
1456 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1457 base[size-1] != YY_END_OF_BUFFER_CHAR )
1458 /* They forgot to leave room for the EOB's. */
1459 return NULL;
1460
1461 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1462 if ( ! b )
1463 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1464
1465 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1466 b->yy_buf_pos = b->yy_ch_buf = base;
1467 b->yy_is_our_buffer = 0;
1468 b->yy_input_file = NULL;
1469 b->yy_n_chars = b->yy_buf_size;
1470 b->yy_is_interactive = 0;
1471 b->yy_at_bol = 1;
1472 b->yy_fill_buffer = 0;
1473 b->yy_buffer_status = YY_BUFFER_NEW;
1474
1475 yy_switch_to_buffer( b );
1476
1477 return b;
1478 }
1479
1480 /** Setup the input buffer state to scan a string. The next call to yylex() will
1481 * scan from a @e copy of @a str.
1482 * @param yystr a NUL-terminated string to scan
1483 *
1484 * @return the newly allocated buffer state object.
1485 * @note If you want to scan bytes that may contain NUL values, then use
1486 * yy_scan_bytes() instead.
1487 */
1488 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1489 {
1490
1491 return yy_scan_bytes( yystr, (int) strlen(yystr) );
1492 }
1493
1494 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1495 * scan from a @e copy of @a bytes.
1496 * @param yybytes the byte buffer to scan
1497 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1498 *
1499 * @return the newly allocated buffer state object.
1500 */
1501 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1502 {
1503 YY_BUFFER_STATE b;
1504 char *buf;
1505 yy_size_t n;
1506 int i;
1507
1508 /* Get memory for full buffer, including space for trailing EOB's. */
1509 n = (yy_size_t) (_yybytes_len + 2);
1510 buf = (char *) yyalloc( n );
1511 if ( ! buf )
1512 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1513
1514 for ( i = 0; i < _yybytes_len; ++i )
1515 buf[i] = yybytes[i];
1516
1517 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1518
1519 b = yy_scan_buffer( buf, n );
1520 if ( ! b )
1521 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1522
1523 /* It's okay to grow etc. this buffer, and we should throw it
1524 * away when we're done.
1525 */
1526 b->yy_is_our_buffer = 1;
1527
1528 return b;
1529 }
1530
1531 #ifndef YY_EXIT_FAILURE
1532 #define YY_EXIT_FAILURE 2
1533 #endif
1534
1535 static void yynoreturn yy_fatal_error (const char* msg )
1536 {
1537 fprintf( stderr, "%s\n", msg );
1538 exit( YY_EXIT_FAILURE );
1539 }
1540
1541 /* Redefine yyless() so it works in section 3 code. */
1542
1543 #undef yyless
1544 #define yyless(n) \
1545 do \
1546 { \
1547 /* Undo effects of setting up yytext. */ \
1548 int yyless_macro_arg = (n); \
1549 YY_LESS_LINENO(yyless_macro_arg);\
1550 yytext[yyleng] = (yy_hold_char); \
1551 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1552 (yy_hold_char) = *(yy_c_buf_p); \
1553 *(yy_c_buf_p) = '\0'; \
1554 yyleng = yyless_macro_arg; \
1555 } \
1556 while ( 0 )
1557
1558 /* Accessor methods (get/set functions) to struct members. */
1559
1560 /** Get the current line number.
1561 *
1562 */
1563 int yyget_lineno (void)
1564 {
1565
1566 return yylineno;
1567 }
1568
1569 /** Get the input stream.
1570 *
1571 */
1572 FILE *yyget_in (void)
1573 {
1574 return yyin;
1575 }
1576
1577 /** Get the output stream.
1578 *
1579 */
1580 FILE *yyget_out (void)
1581 {
1582 return yyout;
1583 }
1584
1585 /** Get the length of the current token.
1586 *
1587 */
1588 int yyget_leng (void)
1589 {
1590 return yyleng;
1591 }
1592
1593 /** Get the current token.
1594 *
1595 */
1596
1597 char *yyget_text (void)
1598 {
1599 return yytext;
1600 }
1601
1602 /** Set the current line number.
1603 * @param _line_number line number
1604 *
1605 */
1606 void yyset_lineno (int _line_number )
1607 {
1608
1609 yylineno = _line_number;
1610 }
1611
1612 /** Set the input stream. This does not discard the current
1613 * input buffer.
1614 * @param _in_str A readable stream.
1615 *
1616 * @see yy_switch_to_buffer
1617 */
1618 void yyset_in (FILE * _in_str )
1619 {
1620 yyin = _in_str ;
1621 }
1622
1623 void yyset_out (FILE * _out_str )
1624 {
1625 yyout = _out_str ;
1626 }
1627
1628 int yyget_debug (void)
1629 {
1630 return yy_flex_debug;
1631 }
1632
1633 void yyset_debug (int _bdebug )
1634 {
1635 yy_flex_debug = _bdebug ;
1636 }
1637
1638 static int yy_init_globals (void)
1639 {
1640 /* Initialization is the same as for the non-reentrant scanner.
1641 * This function is called from yylex_destroy(), so don't allocate here.
1642 */
1643
1644 (yy_buffer_stack) = NULL;
1645 (yy_buffer_stack_top) = 0;
1646 (yy_buffer_stack_max) = 0;
1647 (yy_c_buf_p) = NULL;
1648 (yy_init) = 0;
1649 (yy_start) = 0;
1650
1651 /* Defined in main.c */
1652 #ifdef YY_STDINIT
1653 yyin = stdin;
1654 yyout = stdout;
1655 #else
1656 yyin = NULL;
1657 yyout = NULL;
1658 #endif
1659
1660 /* For future reference: Set errno on error, since we are called by
1661 * yylex_init()
1662 */
1663 return 0;
1664 }
1665
1666 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1667 int yylex_destroy (void)
1668 {
1669
1670 /* Pop the buffer stack, destroying each element. */
1671 while(YY_CURRENT_BUFFER){
1672 yy_delete_buffer( YY_CURRENT_BUFFER );
1673 YY_CURRENT_BUFFER_LVALUE = NULL;
1674 yypop_buffer_state();
1675 }
1676
1677 /* Destroy the stack itself. */
1678 yyfree((yy_buffer_stack) );
1679 (yy_buffer_stack) = NULL;
1680
1681 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1682 * yylex() is called, initialization will occur. */
1683 yy_init_globals( );
1684
1685 return 0;
1686 }
1687
1688 /*
1689 * Internal utility routines.
1690 */
1691
1692 #ifndef yytext_ptr
1693 static void yy_flex_strncpy (char* s1, const char * s2, int n )
1694 {
1695
1696 int i;
1697 for ( i = 0; i < n; ++i )
1698 s1[i] = s2[i];
1699 }
1700 #endif
1701
1702 #ifdef YY_NEED_STRLEN
1703 static int yy_flex_strlen (const char * s )
1704 {
1705 int n;
1706 for ( n = 0; s[n]; ++n )
1707 ;
1708
1709 return n;
1710 }
1711 #endif
1712
1713 void *yyalloc (yy_size_t size )
1714 {
1715 return malloc(size);
1716 }
1717
1718 void *yyrealloc (void * ptr, yy_size_t size )
1719 {
1720
1721 /* The cast to (char *) in the following accommodates both
1722 * implementations that use char* generic pointers, and those
1723 * that use void* generic pointers. It works with the latter
1724 * because both ANSI C and C++ allow castless assignment from
1725 * any pointer type to void*, and deal with argument conversions
1726 * as though doing an assignment.
1727 */
1728 return realloc(ptr, size);
1729 }
1730
1731 void yyfree (void * ptr )
1732 {
1733 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1734 }
1735
1736 #define YYTABLES_NAME "yytables"
1737
1738 #line 21 "2.l"
1739
1740
1741 int main (void)
1742 {
1743 yylex();
1744 printf("x: %d, z: %d, x*z: %d\n", x, z, x*z);
1745 return 0;
1746 }
1747