ECLIPSE + PyDev Project
[Samba/kamenim.git] / source4 / heimdal / lib / com_err / lex.c
blob94d5934699be0bb2fdf5c35b47d2432c74703573
1 #include "config.h"
3 #line 3 "heimdal/lib/com_err/lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
25 /* end standard C headers. */
27 /* flex integer type definitions */
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
87 #endif /* ! C99 */
89 #endif /* ! FLEXINT_H */
91 #ifdef __cplusplus
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
101 #define YY_USE_CONST
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
118 * double cast.
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 * compatibility.
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
144 #ifndef YY_BUF_SIZE
145 #ifdef __ia64__
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
150 #define YY_BUF_SIZE 32768
151 #else
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
154 #endif
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
163 #endif
165 extern int yyleng;
167 extern FILE *yyin, *yyout;
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
173 #define YY_LESS_LINENO(n)
175 /* Return all but the first "n" matched characters back to the input stream. */
176 #define yyless(n) \
177 do \
179 /* Undo effects of setting up yytext. */ \
180 int yyless_macro_arg = (n); \
181 YY_LESS_LINENO(yyless_macro_arg);\
182 *yy_cp = (yy_hold_char); \
183 YY_RESTORE_YY_MORE_OFFSET \
184 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
187 while ( 0 )
189 #define unput(c) yyunput( c, (yytext_ptr) )
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
194 #endif
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
200 FILE *yy_input_file;
202 char *yy_ch_buf; /* input buffer */
203 char *yy_buf_pos; /* current position in input buffer */
205 /* Size of input buffer in bytes, not including room for EOB
206 * characters.
208 yy_size_t yy_buf_size;
210 /* Number of characters read into yy_ch_buf, not including EOB
211 * characters.
213 int yy_n_chars;
215 /* Whether we "own" the buffer - i.e., we know we created it,
216 * and can realloc() it to grow it, and should free() it to
217 * delete it.
219 int yy_is_our_buffer;
221 /* Whether this is an "interactive" input source; if so, and
222 * if we're using stdio for input, then we want to use getc()
223 * instead of fread(), to make sure we stop fetching input after
224 * each newline.
226 int yy_is_interactive;
228 /* Whether we're considered to be at the beginning of a line.
229 * If so, '^' rules will be active on the next match, otherwise
230 * not.
232 int yy_at_bol;
234 int yy_bs_lineno; /**< The line count. */
235 int yy_bs_column; /**< The column count. */
237 /* Whether to try to fill the input buffer when we reach the
238 * end of it.
240 int yy_fill_buffer;
242 int yy_buffer_status;
244 #define YY_BUFFER_NEW 0
245 #define YY_BUFFER_NORMAL 1
246 /* When an EOF's been seen but there's still some text to process
247 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
248 * shouldn't try reading from the input source any more. We might
249 * still have a bunch of tokens to match, though, because of
250 * possible backing-up.
252 * When we actually see the EOF, we change the status to "new"
253 * (via yyrestart()), so that the user can continue scanning by
254 * just pointing yyin at a new input file.
256 #define YY_BUFFER_EOF_PENDING 2
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
261 /* Stack of input buffers. */
262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
266 /* We provide macros for accessing buffer states in case in the
267 * future we want to put the buffer states in a more general
268 * "scanner state".
270 * Returns the top of the stack, or NULL.
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
274 : NULL)
276 /* Same as previous macro, but useful when we know that the buffer stack is not
277 * NULL or when we need an lvalue. For internal use only.
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
281 /* yy_hold_char holds the character lost when yytext is formed. */
282 static char yy_hold_char;
283 static int yy_n_chars; /* number of characters read into yy_ch_buf */
284 int yyleng;
286 /* Points to current character in buffer. */
287 static char *yy_c_buf_p = (char *) 0;
288 static int yy_init = 0; /* whether we need to initialize */
289 static int yy_start = 0; /* start state number */
291 /* Flag which is used to allow yywrap()'s to do buffer switches
292 * instead of setting up a fresh yyin. A bit of a hack ...
294 static int yy_did_buffer_switch_on_eof;
296 void yyrestart (FILE *input_file );
297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
299 void yy_delete_buffer (YY_BUFFER_STATE b );
300 void yy_flush_buffer (YY_BUFFER_STATE b );
301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
302 void yypop_buffer_state (void );
304 static void yyensure_buffer_stack (void );
305 static void yy_load_buffer_state (void );
306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
314 void *yyalloc (yy_size_t );
315 void *yyrealloc (void *,yy_size_t );
316 void yyfree (void * );
318 #define yy_new_buffer yy_create_buffer
320 #define yy_set_interactive(is_interactive) \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330 #define yy_set_bol(at_bol) \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 /* Begin user sect3 */
344 typedef unsigned char YY_CHAR;
346 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
348 typedef int yy_state_type;
350 extern int yylineno;
352 int yylineno = 1;
354 extern char *yytext;
355 #define yytext_ptr yytext
357 static yy_state_type yy_get_previous_state (void );
358 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
359 static int yy_get_next_buffer (void );
360 static void yy_fatal_error (yyconst char msg[] );
362 /* Done after the current pattern has been matched and before the
363 * corresponding action - sets up yytext.
365 #define YY_DO_BEFORE_ACTION \
366 (yytext_ptr) = yy_bp; \
367 yyleng = (size_t) (yy_cp - yy_bp); \
368 (yy_hold_char) = *yy_cp; \
369 *yy_cp = '\0'; \
370 (yy_c_buf_p) = yy_cp;
372 #define YY_NUM_RULES 16
373 #define YY_END_OF_BUFFER 17
374 /* This struct is not used in this scanner,
375 but its presence is necessary. */
376 struct yy_trans_info
378 flex_int32_t yy_verify;
379 flex_int32_t yy_nxt;
381 static yyconst flex_int16_t yy_accept[46] =
382 { 0,
383 0, 0, 17, 15, 11, 12, 13, 10, 9, 14,
384 14, 14, 14, 10, 9, 14, 3, 14, 14, 1,
385 7, 14, 14, 8, 14, 14, 14, 14, 14, 14,
386 14, 6, 14, 14, 5, 14, 14, 14, 14, 14,
387 14, 4, 14, 2, 0
390 static yyconst flex_int32_t yy_ec[256] =
391 { 0,
392 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 1, 6, 6, 6,
397 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
398 1, 1, 1, 1, 7, 7, 7, 7, 7, 7,
399 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
400 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
401 1, 1, 1, 1, 8, 1, 9, 10, 11, 12,
403 13, 14, 7, 7, 15, 7, 7, 16, 7, 17,
404 18, 19, 7, 20, 7, 21, 7, 7, 7, 22,
405 7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1
422 static yyconst flex_int32_t yy_meta[23] =
423 { 0,
424 1, 1, 2, 1, 1, 3, 3, 3, 3, 3,
425 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
426 3, 3
429 static yyconst flex_int16_t yy_base[48] =
430 { 0,
431 0, 0, 56, 57, 57, 57, 57, 0, 49, 0,
432 12, 13, 34, 0, 47, 0, 0, 40, 31, 0,
433 0, 38, 36, 0, 30, 34, 32, 25, 22, 28,
434 34, 0, 19, 13, 0, 22, 30, 26, 26, 18,
435 12, 0, 14, 0, 57, 34, 23
438 static yyconst flex_int16_t yy_def[48] =
439 { 0,
440 45, 1, 45, 45, 45, 45, 45, 46, 47, 47,
441 47, 47, 47, 46, 47, 47, 47, 47, 47, 47,
442 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
443 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
444 47, 47, 47, 47, 0, 45, 45
447 static yyconst flex_int16_t yy_nxt[80] =
448 { 0,
449 4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
450 10, 10, 11, 10, 12, 10, 10, 10, 13, 10,
451 10, 10, 17, 36, 21, 16, 44, 43, 18, 22,
452 42, 19, 20, 37, 14, 41, 14, 40, 39, 38,
453 35, 34, 33, 32, 31, 30, 29, 28, 27, 26,
454 25, 24, 15, 23, 15, 45, 3, 45, 45, 45,
455 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
456 45, 45, 45, 45, 45, 45, 45, 45, 45
459 static yyconst flex_int16_t yy_chk[80] =
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, 11, 34, 12, 47, 43, 41, 11, 12,
464 40, 11, 11, 34, 46, 39, 46, 38, 37, 36,
465 33, 31, 30, 29, 28, 27, 26, 25, 23, 22,
466 19, 18, 15, 13, 9, 3, 45, 45, 45, 45,
467 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
468 45, 45, 45, 45, 45, 45, 45, 45, 45
471 static yy_state_type yy_last_accepting_state;
472 static char *yy_last_accepting_cpos;
474 extern int yy_flex_debug;
475 int yy_flex_debug = 0;
477 /* The intent behind this definition is that it'll catch
478 * any uses of REJECT which flex missed.
480 #define REJECT reject_used_but_not_detected
481 #define yymore() yymore_used_but_not_detected
482 #define YY_MORE_ADJ 0
483 #define YY_RESTORE_YY_MORE_OFFSET
484 char *yytext;
485 #line 1 "lex.l"
486 #line 2 "lex.l"
488 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
489 * (Royal Institute of Technology, Stockholm, Sweden).
490 * All rights reserved.
492 * Redistribution and use in source and binary forms, with or without
493 * modification, are permitted provided that the following conditions
494 * are met:
496 * 1. Redistributions of source code must retain the above copyright
497 * notice, this list of conditions and the following disclaimer.
499 * 2. Redistributions in binary form must reproduce the above copyright
500 * notice, this list of conditions and the following disclaimer in the
501 * documentation and/or other materials provided with the distribution.
503 * 3. Neither the name of the Institute nor the names of its contributors
504 * may be used to endorse or promote products derived from this software
505 * without specific prior written permission.
507 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
508 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
509 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
510 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
511 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
512 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
513 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
514 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
515 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
516 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
517 * SUCH DAMAGE.
521 * This is to handle the definition of this symbol in some AIX
522 * headers, which will conflict with the definition that lex will
523 * generate for it. It's only a problem for AIX lex.
526 #undef ECHO
528 #include "compile_et.h"
529 #include "parse.h"
530 #include "lex.h"
532 static unsigned lineno = 1;
533 static int getstring(void);
535 #define YY_NO_UNPUT
537 #undef ECHO
539 #line 539 "heimdal/lib/com_err/lex.c"
541 #define INITIAL 0
543 #ifndef YY_NO_UNISTD_H
544 /* Special case for "unistd.h", since it is non-ANSI. We include it way
545 * down here because we want the user's section 1 to have been scanned first.
546 * The user has a chance to override it with an option.
548 #include <unistd.h>
549 #endif
551 #ifndef YY_EXTRA_TYPE
552 #define YY_EXTRA_TYPE void *
553 #endif
555 static int yy_init_globals (void );
557 /* Accessor methods to globals.
558 These are made visible to non-reentrant scanners for convenience. */
560 int yylex_destroy (void );
562 int yyget_debug (void );
564 void yyset_debug (int debug_flag );
566 YY_EXTRA_TYPE yyget_extra (void );
568 void yyset_extra (YY_EXTRA_TYPE user_defined );
570 FILE *yyget_in (void );
572 void yyset_in (FILE * in_str );
574 FILE *yyget_out (void );
576 void yyset_out (FILE * out_str );
578 int yyget_leng (void );
580 char *yyget_text (void );
582 int yyget_lineno (void );
584 void yyset_lineno (int line_number );
586 /* Macros after this point can all be overridden by user definitions in
587 * section 1.
590 #ifndef YY_SKIP_YYWRAP
591 #ifdef __cplusplus
592 extern "C" int yywrap (void );
593 #else
594 extern int yywrap (void );
595 #endif
596 #endif
598 static void yyunput (int c,char *buf_ptr );
600 #ifndef yytext_ptr
601 static void yy_flex_strncpy (char *,yyconst char *,int );
602 #endif
604 #ifdef YY_NEED_STRLEN
605 static int yy_flex_strlen (yyconst char * );
606 #endif
608 #ifndef YY_NO_INPUT
610 #ifdef __cplusplus
611 static int yyinput (void );
612 #else
613 static int input (void );
614 #endif
616 #endif
618 /* Amount of stuff to slurp up with each read. */
619 #ifndef YY_READ_BUF_SIZE
620 #ifdef __ia64__
621 /* On IA-64, the buffer size is 16k, not 8k */
622 #define YY_READ_BUF_SIZE 16384
623 #else
624 #define YY_READ_BUF_SIZE 8192
625 #endif /* __ia64__ */
626 #endif
628 /* Copy whatever the last rule matched to the standard output. */
629 #ifndef ECHO
630 /* This used to be an fputs(), but since the string might contain NUL's,
631 * we now use fwrite().
633 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
634 #endif
636 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
637 * is returned in "result".
639 #ifndef YY_INPUT
640 #define YY_INPUT(buf,result,max_size) \
641 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
643 int c = '*'; \
644 size_t n; \
645 for ( n = 0; n < max_size && \
646 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
647 buf[n] = (char) c; \
648 if ( c == '\n' ) \
649 buf[n++] = (char) c; \
650 if ( c == EOF && ferror( yyin ) ) \
651 YY_FATAL_ERROR( "input in flex scanner failed" ); \
652 result = n; \
654 else \
656 errno=0; \
657 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
659 if( errno != EINTR) \
661 YY_FATAL_ERROR( "input in flex scanner failed" ); \
662 break; \
664 errno=0; \
665 clearerr(yyin); \
670 #endif
672 /* No semi-colon after return; correct usage is to write "yyterminate();" -
673 * we don't want an extra ';' after the "return" because that will cause
674 * some compilers to complain about unreachable statements.
676 #ifndef yyterminate
677 #define yyterminate() return YY_NULL
678 #endif
680 /* Number of entries by which start-condition stack grows. */
681 #ifndef YY_START_STACK_INCR
682 #define YY_START_STACK_INCR 25
683 #endif
685 /* Report a fatal error. */
686 #ifndef YY_FATAL_ERROR
687 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
688 #endif
690 /* end tables serialization structures and prototypes */
692 /* Default declaration of generated scanner - a define so the user can
693 * easily add parameters.
695 #ifndef YY_DECL
696 #define YY_DECL_IS_OURS 1
698 extern int yylex (void);
700 #define YY_DECL int yylex (void)
701 #endif /* !YY_DECL */
703 /* Code executed at the beginning of each rule, after yytext and yyleng
704 * have been set up.
706 #ifndef YY_USER_ACTION
707 #define YY_USER_ACTION
708 #endif
710 /* Code executed at the end of each rule. */
711 #ifndef YY_BREAK
712 #define YY_BREAK break;
713 #endif
715 #define YY_RULE_SETUP \
716 YY_USER_ACTION
718 /** The main scanner function which does all the work.
720 YY_DECL
722 register yy_state_type yy_current_state;
723 register char *yy_cp, *yy_bp;
724 register int yy_act;
726 #line 57 "lex.l"
728 #line 728 "heimdal/lib/com_err/lex.c"
730 if ( !(yy_init) )
732 (yy_init) = 1;
734 #ifdef YY_USER_INIT
735 YY_USER_INIT;
736 #endif
738 if ( ! (yy_start) )
739 (yy_start) = 1; /* first start state */
741 if ( ! yyin )
742 yyin = stdin;
744 if ( ! yyout )
745 yyout = stdout;
747 if ( ! YY_CURRENT_BUFFER ) {
748 yyensure_buffer_stack ();
749 YY_CURRENT_BUFFER_LVALUE =
750 yy_create_buffer(yyin,YY_BUF_SIZE );
753 yy_load_buffer_state( );
756 while ( 1 ) /* loops until end-of-file is reached */
758 yy_cp = (yy_c_buf_p);
760 /* Support of yytext. */
761 *yy_cp = (yy_hold_char);
763 /* yy_bp points to the position in yy_ch_buf of the start of
764 * the current run.
766 yy_bp = yy_cp;
768 yy_current_state = (yy_start);
769 yy_match:
772 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
773 if ( yy_accept[yy_current_state] )
775 (yy_last_accepting_state) = yy_current_state;
776 (yy_last_accepting_cpos) = yy_cp;
778 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
780 yy_current_state = (int) yy_def[yy_current_state];
781 if ( yy_current_state >= 46 )
782 yy_c = yy_meta[(unsigned int) yy_c];
784 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
785 ++yy_cp;
787 while ( yy_base[yy_current_state] != 57 );
789 yy_find_action:
790 yy_act = yy_accept[yy_current_state];
791 if ( yy_act == 0 )
792 { /* have to back up */
793 yy_cp = (yy_last_accepting_cpos);
794 yy_current_state = (yy_last_accepting_state);
795 yy_act = yy_accept[yy_current_state];
798 YY_DO_BEFORE_ACTION;
800 do_action: /* This label is used only to access EOF actions. */
802 switch ( yy_act )
803 { /* beginning of action switch */
804 case 0: /* must back up */
805 /* undo the effects of YY_DO_BEFORE_ACTION */
806 *yy_cp = (yy_hold_char);
807 yy_cp = (yy_last_accepting_cpos);
808 yy_current_state = (yy_last_accepting_state);
809 goto yy_find_action;
811 case 1:
812 YY_RULE_SETUP
813 #line 58 "lex.l"
814 { return ET; }
815 YY_BREAK
816 case 2:
817 YY_RULE_SETUP
818 #line 59 "lex.l"
819 { return ET; }
820 YY_BREAK
821 case 3:
822 YY_RULE_SETUP
823 #line 60 "lex.l"
824 { return EC; }
825 YY_BREAK
826 case 4:
827 YY_RULE_SETUP
828 #line 61 "lex.l"
829 { return EC; }
830 YY_BREAK
831 case 5:
832 YY_RULE_SETUP
833 #line 62 "lex.l"
834 { return PREFIX; }
835 YY_BREAK
836 case 6:
837 YY_RULE_SETUP
838 #line 63 "lex.l"
839 { return INDEX; }
840 YY_BREAK
841 case 7:
842 YY_RULE_SETUP
843 #line 64 "lex.l"
844 { return ID; }
845 YY_BREAK
846 case 8:
847 YY_RULE_SETUP
848 #line 65 "lex.l"
849 { return END; }
850 YY_BREAK
851 case 9:
852 YY_RULE_SETUP
853 #line 66 "lex.l"
854 { yylval.number = atoi(yytext); return NUMBER; }
855 YY_BREAK
856 case 10:
857 YY_RULE_SETUP
858 #line 67 "lex.l"
860 YY_BREAK
861 case 11:
862 YY_RULE_SETUP
863 #line 68 "lex.l"
865 YY_BREAK
866 case 12:
867 /* rule 12 can match eol */
868 YY_RULE_SETUP
869 #line 69 "lex.l"
870 { lineno++; }
871 YY_BREAK
872 case 13:
873 YY_RULE_SETUP
874 #line 70 "lex.l"
875 { return getstring(); }
876 YY_BREAK
877 case 14:
878 YY_RULE_SETUP
879 #line 71 "lex.l"
880 { yylval.string = strdup(yytext); return STRING; }
881 YY_BREAK
882 case 15:
883 YY_RULE_SETUP
884 #line 72 "lex.l"
885 { return *yytext; }
886 YY_BREAK
887 case 16:
888 YY_RULE_SETUP
889 #line 73 "lex.l"
890 ECHO;
891 YY_BREAK
892 #line 892 "heimdal/lib/com_err/lex.c"
893 case YY_STATE_EOF(INITIAL):
894 yyterminate();
896 case YY_END_OF_BUFFER:
898 /* Amount of text matched not including the EOB char. */
899 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
901 /* Undo the effects of YY_DO_BEFORE_ACTION. */
902 *yy_cp = (yy_hold_char);
903 YY_RESTORE_YY_MORE_OFFSET
905 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
907 /* We're scanning a new file or input source. It's
908 * possible that this happened because the user
909 * just pointed yyin at a new source and called
910 * yylex(). If so, then we have to assure
911 * consistency between YY_CURRENT_BUFFER and our
912 * globals. Here is the right place to do so, because
913 * this is the first action (other than possibly a
914 * back-up) that will match for the new input source.
916 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
917 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
918 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
921 /* Note that here we test for yy_c_buf_p "<=" to the position
922 * of the first EOB in the buffer, since yy_c_buf_p will
923 * already have been incremented past the NUL character
924 * (since all states make transitions on EOB to the
925 * end-of-buffer state). Contrast this with the test
926 * in input().
928 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
929 { /* This was really a NUL. */
930 yy_state_type yy_next_state;
932 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
934 yy_current_state = yy_get_previous_state( );
936 /* Okay, we're now positioned to make the NUL
937 * transition. We couldn't have
938 * yy_get_previous_state() go ahead and do it
939 * for us because it doesn't know how to deal
940 * with the possibility of jamming (and we don't
941 * want to build jamming into it because then it
942 * will run more slowly).
945 yy_next_state = yy_try_NUL_trans( yy_current_state );
947 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
949 if ( yy_next_state )
951 /* Consume the NUL. */
952 yy_cp = ++(yy_c_buf_p);
953 yy_current_state = yy_next_state;
954 goto yy_match;
957 else
959 yy_cp = (yy_c_buf_p);
960 goto yy_find_action;
964 else switch ( yy_get_next_buffer( ) )
966 case EOB_ACT_END_OF_FILE:
968 (yy_did_buffer_switch_on_eof) = 0;
970 if ( yywrap( ) )
972 /* Note: because we've taken care in
973 * yy_get_next_buffer() to have set up
974 * yytext, we can now set up
975 * yy_c_buf_p so that if some total
976 * hoser (like flex itself) wants to
977 * call the scanner after we return the
978 * YY_NULL, it'll still work - another
979 * YY_NULL will get returned.
981 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
983 yy_act = YY_STATE_EOF(YY_START);
984 goto do_action;
987 else
989 if ( ! (yy_did_buffer_switch_on_eof) )
990 YY_NEW_FILE;
992 break;
995 case EOB_ACT_CONTINUE_SCAN:
996 (yy_c_buf_p) =
997 (yytext_ptr) + yy_amount_of_matched_text;
999 yy_current_state = yy_get_previous_state( );
1001 yy_cp = (yy_c_buf_p);
1002 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1003 goto yy_match;
1005 case EOB_ACT_LAST_MATCH:
1006 (yy_c_buf_p) =
1007 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1009 yy_current_state = yy_get_previous_state( );
1011 yy_cp = (yy_c_buf_p);
1012 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1013 goto yy_find_action;
1015 break;
1018 default:
1019 YY_FATAL_ERROR(
1020 "fatal flex scanner internal error--no action found" );
1021 } /* end of action switch */
1022 } /* end of scanning one token */
1023 } /* end of yylex */
1025 /* yy_get_next_buffer - try to read in a new buffer
1027 * Returns a code representing an action:
1028 * EOB_ACT_LAST_MATCH -
1029 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1030 * EOB_ACT_END_OF_FILE - end of file
1032 static int yy_get_next_buffer (void)
1034 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1035 register char *source = (yytext_ptr);
1036 register int number_to_move, i;
1037 int ret_val;
1039 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1040 YY_FATAL_ERROR(
1041 "fatal flex scanner internal error--end of buffer missed" );
1043 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1044 { /* Don't try to fill the buffer, so this is an EOF. */
1045 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1047 /* We matched a single character, the EOB, so
1048 * treat this as a final EOF.
1050 return EOB_ACT_END_OF_FILE;
1053 else
1055 /* We matched some text prior to the EOB, first
1056 * process it.
1058 return EOB_ACT_LAST_MATCH;
1062 /* Try to read more data. */
1064 /* First move last chars to start of buffer. */
1065 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1067 for ( i = 0; i < number_to_move; ++i )
1068 *(dest++) = *(source++);
1070 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1071 /* don't do the read, it's not guaranteed to return an EOF,
1072 * just force an EOF
1074 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1076 else
1078 int num_to_read =
1079 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1081 while ( num_to_read <= 0 )
1082 { /* Not enough room in the buffer - grow it. */
1084 /* just a shorter name for the current buffer */
1085 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1087 int yy_c_buf_p_offset =
1088 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1090 if ( b->yy_is_our_buffer )
1092 int new_size = b->yy_buf_size * 2;
1094 if ( new_size <= 0 )
1095 b->yy_buf_size += b->yy_buf_size / 8;
1096 else
1097 b->yy_buf_size *= 2;
1099 b->yy_ch_buf = (char *)
1100 /* Include room in for 2 EOB chars. */
1101 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1103 else
1104 /* Can't grow it, we don't own it. */
1105 b->yy_ch_buf = 0;
1107 if ( ! b->yy_ch_buf )
1108 YY_FATAL_ERROR(
1109 "fatal error - scanner input buffer overflow" );
1111 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1113 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1114 number_to_move - 1;
1118 if ( num_to_read > YY_READ_BUF_SIZE )
1119 num_to_read = YY_READ_BUF_SIZE;
1121 /* Read in more data. */
1122 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1123 (yy_n_chars), (size_t) num_to_read );
1125 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1128 if ( (yy_n_chars) == 0 )
1130 if ( number_to_move == YY_MORE_ADJ )
1132 ret_val = EOB_ACT_END_OF_FILE;
1133 yyrestart(yyin );
1136 else
1138 ret_val = EOB_ACT_LAST_MATCH;
1139 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1140 YY_BUFFER_EOF_PENDING;
1144 else
1145 ret_val = EOB_ACT_CONTINUE_SCAN;
1147 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1148 /* Extend the array by 50%, plus the number we really need. */
1149 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1150 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1151 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1152 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1155 (yy_n_chars) += number_to_move;
1156 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1157 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1159 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1161 return ret_val;
1164 /* yy_get_previous_state - get the state just before the EOB char was reached */
1166 static yy_state_type yy_get_previous_state (void)
1168 register yy_state_type yy_current_state;
1169 register char *yy_cp;
1171 yy_current_state = (yy_start);
1173 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1175 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1176 if ( yy_accept[yy_current_state] )
1178 (yy_last_accepting_state) = yy_current_state;
1179 (yy_last_accepting_cpos) = yy_cp;
1181 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1183 yy_current_state = (int) yy_def[yy_current_state];
1184 if ( yy_current_state >= 46 )
1185 yy_c = yy_meta[(unsigned int) yy_c];
1187 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1190 return yy_current_state;
1193 /* yy_try_NUL_trans - try to make a transition on the NUL character
1195 * synopsis
1196 * next_state = yy_try_NUL_trans( current_state );
1198 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1200 register int yy_is_jam;
1201 register char *yy_cp = (yy_c_buf_p);
1203 register YY_CHAR yy_c = 1;
1204 if ( yy_accept[yy_current_state] )
1206 (yy_last_accepting_state) = yy_current_state;
1207 (yy_last_accepting_cpos) = yy_cp;
1209 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1211 yy_current_state = (int) yy_def[yy_current_state];
1212 if ( yy_current_state >= 46 )
1213 yy_c = yy_meta[(unsigned int) yy_c];
1215 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1216 yy_is_jam = (yy_current_state == 45);
1218 return yy_is_jam ? 0 : yy_current_state;
1221 static void yyunput (int c, register char * yy_bp )
1223 register char *yy_cp;
1225 yy_cp = (yy_c_buf_p);
1227 /* undo effects of setting up yytext */
1228 *yy_cp = (yy_hold_char);
1230 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1231 { /* need to shift things up to make room */
1232 /* +2 for EOB chars. */
1233 register int number_to_move = (yy_n_chars) + 2;
1234 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1235 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1236 register char *source =
1237 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1239 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1240 *--dest = *--source;
1242 yy_cp += (int) (dest - source);
1243 yy_bp += (int) (dest - source);
1244 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1245 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1247 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1248 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1251 *--yy_cp = (char) c;
1253 (yytext_ptr) = yy_bp;
1254 (yy_hold_char) = *yy_cp;
1255 (yy_c_buf_p) = yy_cp;
1258 #ifndef YY_NO_INPUT
1259 #ifdef __cplusplus
1260 static int yyinput (void)
1261 #else
1262 static int input (void)
1263 #endif
1266 int c;
1268 *(yy_c_buf_p) = (yy_hold_char);
1270 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1272 /* yy_c_buf_p now points to the character we want to return.
1273 * If this occurs *before* the EOB characters, then it's a
1274 * valid NUL; if not, then we've hit the end of the buffer.
1276 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1277 /* This was really a NUL. */
1278 *(yy_c_buf_p) = '\0';
1280 else
1281 { /* need more input */
1282 int offset = (yy_c_buf_p) - (yytext_ptr);
1283 ++(yy_c_buf_p);
1285 switch ( yy_get_next_buffer( ) )
1287 case EOB_ACT_LAST_MATCH:
1288 /* This happens because yy_g_n_b()
1289 * sees that we've accumulated a
1290 * token and flags that we need to
1291 * try matching the token before
1292 * proceeding. But for input(),
1293 * there's no matching to consider.
1294 * So convert the EOB_ACT_LAST_MATCH
1295 * to EOB_ACT_END_OF_FILE.
1298 /* Reset buffer status. */
1299 yyrestart(yyin );
1301 /*FALLTHROUGH*/
1303 case EOB_ACT_END_OF_FILE:
1305 if ( yywrap( ) )
1306 return EOF;
1308 if ( ! (yy_did_buffer_switch_on_eof) )
1309 YY_NEW_FILE;
1310 #ifdef __cplusplus
1311 return yyinput();
1312 #else
1313 return input();
1314 #endif
1317 case EOB_ACT_CONTINUE_SCAN:
1318 (yy_c_buf_p) = (yytext_ptr) + offset;
1319 break;
1324 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1325 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1326 (yy_hold_char) = *++(yy_c_buf_p);
1328 return c;
1330 #endif /* ifndef YY_NO_INPUT */
1332 /** Immediately switch to a different input stream.
1333 * @param input_file A readable stream.
1335 * @note This function does not reset the start condition to @c INITIAL .
1337 void yyrestart (FILE * input_file )
1340 if ( ! YY_CURRENT_BUFFER ){
1341 yyensure_buffer_stack ();
1342 YY_CURRENT_BUFFER_LVALUE =
1343 yy_create_buffer(yyin,YY_BUF_SIZE );
1346 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1347 yy_load_buffer_state( );
1350 /** Switch to a different input buffer.
1351 * @param new_buffer The new input buffer.
1354 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1357 /* TODO. We should be able to replace this entire function body
1358 * with
1359 * yypop_buffer_state();
1360 * yypush_buffer_state(new_buffer);
1362 yyensure_buffer_stack ();
1363 if ( YY_CURRENT_BUFFER == new_buffer )
1364 return;
1366 if ( YY_CURRENT_BUFFER )
1368 /* Flush out information for old buffer. */
1369 *(yy_c_buf_p) = (yy_hold_char);
1370 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1371 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1374 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1375 yy_load_buffer_state( );
1377 /* We don't actually know whether we did this switch during
1378 * EOF (yywrap()) processing, but the only time this flag
1379 * is looked at is after yywrap() is called, so it's safe
1380 * to go ahead and always set it.
1382 (yy_did_buffer_switch_on_eof) = 1;
1385 static void yy_load_buffer_state (void)
1387 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1388 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1389 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1390 (yy_hold_char) = *(yy_c_buf_p);
1393 /** Allocate and initialize an input buffer state.
1394 * @param file A readable stream.
1395 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1397 * @return the allocated buffer state.
1399 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1401 YY_BUFFER_STATE b;
1403 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1404 if ( ! b )
1405 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1407 b->yy_buf_size = size;
1409 /* yy_ch_buf has to be 2 characters longer than the size given because
1410 * we need to put in 2 end-of-buffer characters.
1412 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1413 if ( ! b->yy_ch_buf )
1414 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1416 b->yy_is_our_buffer = 1;
1418 yy_init_buffer(b,file );
1420 return b;
1423 /** Destroy the buffer.
1424 * @param b a buffer created with yy_create_buffer()
1427 void yy_delete_buffer (YY_BUFFER_STATE b )
1430 if ( ! b )
1431 return;
1433 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1434 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1436 if ( b->yy_is_our_buffer )
1437 yyfree((void *) b->yy_ch_buf );
1439 yyfree((void *) b );
1442 #ifndef __cplusplus
1443 extern int isatty (int );
1444 #endif /* __cplusplus */
1446 /* Initializes or reinitializes a buffer.
1447 * This function is sometimes called more than once on the same buffer,
1448 * such as during a yyrestart() or at EOF.
1450 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1453 int oerrno = errno;
1455 yy_flush_buffer(b );
1457 b->yy_input_file = file;
1458 b->yy_fill_buffer = 1;
1460 /* If b is the current buffer, then yy_init_buffer was _probably_
1461 * called from yyrestart() or through yy_get_next_buffer.
1462 * In that case, we don't want to reset the lineno or column.
1464 if (b != YY_CURRENT_BUFFER){
1465 b->yy_bs_lineno = 1;
1466 b->yy_bs_column = 0;
1469 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1471 errno = oerrno;
1474 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1475 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1478 void yy_flush_buffer (YY_BUFFER_STATE b )
1480 if ( ! b )
1481 return;
1483 b->yy_n_chars = 0;
1485 /* We always need two end-of-buffer characters. The first causes
1486 * a transition to the end-of-buffer state. The second causes
1487 * a jam in that state.
1489 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1490 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1492 b->yy_buf_pos = &b->yy_ch_buf[0];
1494 b->yy_at_bol = 1;
1495 b->yy_buffer_status = YY_BUFFER_NEW;
1497 if ( b == YY_CURRENT_BUFFER )
1498 yy_load_buffer_state( );
1501 /** Pushes the new state onto the stack. The new state becomes
1502 * the current state. This function will allocate the stack
1503 * if necessary.
1504 * @param new_buffer The new state.
1507 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1509 if (new_buffer == NULL)
1510 return;
1512 yyensure_buffer_stack();
1514 /* This block is copied from yy_switch_to_buffer. */
1515 if ( YY_CURRENT_BUFFER )
1517 /* Flush out information for old buffer. */
1518 *(yy_c_buf_p) = (yy_hold_char);
1519 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1520 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1523 /* Only push if top exists. Otherwise, replace top. */
1524 if (YY_CURRENT_BUFFER)
1525 (yy_buffer_stack_top)++;
1526 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1528 /* copied from yy_switch_to_buffer. */
1529 yy_load_buffer_state( );
1530 (yy_did_buffer_switch_on_eof) = 1;
1533 /** Removes and deletes the top of the stack, if present.
1534 * The next element becomes the new top.
1537 void yypop_buffer_state (void)
1539 if (!YY_CURRENT_BUFFER)
1540 return;
1542 yy_delete_buffer(YY_CURRENT_BUFFER );
1543 YY_CURRENT_BUFFER_LVALUE = NULL;
1544 if ((yy_buffer_stack_top) > 0)
1545 --(yy_buffer_stack_top);
1547 if (YY_CURRENT_BUFFER) {
1548 yy_load_buffer_state( );
1549 (yy_did_buffer_switch_on_eof) = 1;
1553 /* Allocates the stack if it does not exist.
1554 * Guarantees space for at least one push.
1556 static void yyensure_buffer_stack (void)
1558 int num_to_alloc;
1560 if (!(yy_buffer_stack)) {
1562 /* First allocation is just for 2 elements, since we don't know if this
1563 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1564 * immediate realloc on the next call.
1566 num_to_alloc = 1;
1567 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1568 (num_to_alloc * sizeof(struct yy_buffer_state*)
1570 if ( ! (yy_buffer_stack) )
1571 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1573 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1575 (yy_buffer_stack_max) = num_to_alloc;
1576 (yy_buffer_stack_top) = 0;
1577 return;
1580 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1582 /* Increase the buffer to prepare for a possible push. */
1583 int grow_size = 8 /* arbitrary grow size */;
1585 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1586 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1587 ((yy_buffer_stack),
1588 num_to_alloc * sizeof(struct yy_buffer_state*)
1590 if ( ! (yy_buffer_stack) )
1591 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1593 /* zero only the new slots.*/
1594 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1595 (yy_buffer_stack_max) = num_to_alloc;
1599 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1600 * @param base the character buffer
1601 * @param size the size in bytes of the character buffer
1603 * @return the newly allocated buffer state object.
1605 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1607 YY_BUFFER_STATE b;
1609 if ( size < 2 ||
1610 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1611 base[size-1] != YY_END_OF_BUFFER_CHAR )
1612 /* They forgot to leave room for the EOB's. */
1613 return 0;
1615 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1616 if ( ! b )
1617 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1619 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1620 b->yy_buf_pos = b->yy_ch_buf = base;
1621 b->yy_is_our_buffer = 0;
1622 b->yy_input_file = 0;
1623 b->yy_n_chars = b->yy_buf_size;
1624 b->yy_is_interactive = 0;
1625 b->yy_at_bol = 1;
1626 b->yy_fill_buffer = 0;
1627 b->yy_buffer_status = YY_BUFFER_NEW;
1629 yy_switch_to_buffer(b );
1631 return b;
1634 /** Setup the input buffer state to scan a string. The next call to yylex() will
1635 * scan from a @e copy of @a str.
1636 * @param yystr a NUL-terminated string to scan
1638 * @return the newly allocated buffer state object.
1639 * @note If you want to scan bytes that may contain NUL values, then use
1640 * yy_scan_bytes() instead.
1642 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1645 return yy_scan_bytes(yystr,strlen(yystr) );
1648 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1649 * scan from a @e copy of @a bytes.
1650 * @param yybytes the byte buffer to scan
1651 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1653 * @return the newly allocated buffer state object.
1655 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1657 YY_BUFFER_STATE b;
1658 char *buf;
1659 yy_size_t n;
1660 int i;
1662 /* Get memory for full buffer, including space for trailing EOB's. */
1663 n = _yybytes_len + 2;
1664 buf = (char *) yyalloc(n );
1665 if ( ! buf )
1666 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1668 for ( i = 0; i < _yybytes_len; ++i )
1669 buf[i] = yybytes[i];
1671 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1673 b = yy_scan_buffer(buf,n );
1674 if ( ! b )
1675 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1677 /* It's okay to grow etc. this buffer, and we should throw it
1678 * away when we're done.
1680 b->yy_is_our_buffer = 1;
1682 return b;
1685 #ifndef YY_EXIT_FAILURE
1686 #define YY_EXIT_FAILURE 2
1687 #endif
1689 static void yy_fatal_error (yyconst char* msg )
1691 (void) fprintf( stderr, "%s\n", msg );
1692 exit( YY_EXIT_FAILURE );
1695 /* Redefine yyless() so it works in section 3 code. */
1697 #undef yyless
1698 #define yyless(n) \
1699 do \
1701 /* Undo effects of setting up yytext. */ \
1702 int yyless_macro_arg = (n); \
1703 YY_LESS_LINENO(yyless_macro_arg);\
1704 yytext[yyleng] = (yy_hold_char); \
1705 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1706 (yy_hold_char) = *(yy_c_buf_p); \
1707 *(yy_c_buf_p) = '\0'; \
1708 yyleng = yyless_macro_arg; \
1710 while ( 0 )
1712 /* Accessor methods (get/set functions) to struct members. */
1714 /** Get the current line number.
1717 int yyget_lineno (void)
1720 return yylineno;
1723 /** Get the input stream.
1726 FILE *yyget_in (void)
1728 return yyin;
1731 /** Get the output stream.
1734 FILE *yyget_out (void)
1736 return yyout;
1739 /** Get the length of the current token.
1742 int yyget_leng (void)
1744 return yyleng;
1747 /** Get the current token.
1751 char *yyget_text (void)
1753 return yytext;
1756 /** Set the current line number.
1757 * @param line_number
1760 void yyset_lineno (int line_number )
1763 yylineno = line_number;
1766 /** Set the input stream. This does not discard the current
1767 * input buffer.
1768 * @param in_str A readable stream.
1770 * @see yy_switch_to_buffer
1772 void yyset_in (FILE * in_str )
1774 yyin = in_str ;
1777 void yyset_out (FILE * out_str )
1779 yyout = out_str ;
1782 int yyget_debug (void)
1784 return yy_flex_debug;
1787 void yyset_debug (int bdebug )
1789 yy_flex_debug = bdebug ;
1792 static int yy_init_globals (void)
1794 /* Initialization is the same as for the non-reentrant scanner.
1795 * This function is called from yylex_destroy(), so don't allocate here.
1798 (yy_buffer_stack) = 0;
1799 (yy_buffer_stack_top) = 0;
1800 (yy_buffer_stack_max) = 0;
1801 (yy_c_buf_p) = (char *) 0;
1802 (yy_init) = 0;
1803 (yy_start) = 0;
1805 /* Defined in main.c */
1806 #ifdef YY_STDINIT
1807 yyin = stdin;
1808 yyout = stdout;
1809 #else
1810 yyin = (FILE *) 0;
1811 yyout = (FILE *) 0;
1812 #endif
1814 /* For future reference: Set errno on error, since we are called by
1815 * yylex_init()
1817 return 0;
1820 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1821 int yylex_destroy (void)
1824 /* Pop the buffer stack, destroying each element. */
1825 while(YY_CURRENT_BUFFER){
1826 yy_delete_buffer(YY_CURRENT_BUFFER );
1827 YY_CURRENT_BUFFER_LVALUE = NULL;
1828 yypop_buffer_state();
1831 /* Destroy the stack itself. */
1832 yyfree((yy_buffer_stack) );
1833 (yy_buffer_stack) = NULL;
1835 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1836 * yylex() is called, initialization will occur. */
1837 yy_init_globals( );
1839 return 0;
1843 * Internal utility routines.
1846 #ifndef yytext_ptr
1847 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1849 register int i;
1850 for ( i = 0; i < n; ++i )
1851 s1[i] = s2[i];
1853 #endif
1855 #ifdef YY_NEED_STRLEN
1856 static int yy_flex_strlen (yyconst char * s )
1858 register int n;
1859 for ( n = 0; s[n]; ++n )
1862 return n;
1864 #endif
1866 void *yyalloc (yy_size_t size )
1868 return (void *) malloc( size );
1871 void *yyrealloc (void * ptr, yy_size_t size )
1873 /* The cast to (char *) in the following accommodates both
1874 * implementations that use char* generic pointers, and those
1875 * that use void* generic pointers. It works with the latter
1876 * because both ANSI C and C++ allow castless assignment from
1877 * any pointer type to void*, and deal with argument conversions
1878 * as though doing an assignment.
1880 return (void *) realloc( (char *) ptr, size );
1883 void yyfree (void * ptr )
1885 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1888 #define YYTABLES_NAME "yytables"
1890 #line 73 "lex.l"
1894 #ifndef yywrap /* XXX */
1896 yywrap ()
1898 return 1;
1900 #endif
1902 static int
1903 getstring(void)
1905 char x[128];
1906 int i = 0;
1907 int c;
1908 int quote = 0;
1909 while(i < sizeof(x) - 1 && (c = input()) != EOF){
1910 if(quote) {
1911 x[i++] = c;
1912 quote = 0;
1913 continue;
1915 if(c == '\n'){
1916 error_message("unterminated string");
1917 lineno++;
1918 break;
1920 if(c == '\\'){
1921 quote++;
1922 continue;
1924 if(c == '\"')
1925 break;
1926 x[i++] = c;
1928 x[i] = '\0';
1929 yylval.string = strdup(x);
1930 if (yylval.string == NULL)
1931 err(1, "malloc");
1932 return STRING;
1935 void
1936 error_message (const char *format, ...)
1938 va_list args;
1940 va_start (args, format);
1941 fprintf (stderr, "%s:%d:", filename, lineno);
1942 vfprintf (stderr, format, args);
1943 va_end (args);
1944 numerror++;