s4-heimdal: fixed the use of error_message() in heimdal
[Samba.git] / source4 / heimdal / lib / com_err / lex.c
blob3b17cd7035829cd5c5cee3ef7767cafb375933a1
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;
57 #endif /* ! C99 */
59 /* Limits of integral types. */
60 #ifndef INT8_MIN
61 #define INT8_MIN (-128)
62 #endif
63 #ifndef INT16_MIN
64 #define INT16_MIN (-32767-1)
65 #endif
66 #ifndef INT32_MIN
67 #define INT32_MIN (-2147483647-1)
68 #endif
69 #ifndef INT8_MAX
70 #define INT8_MAX (127)
71 #endif
72 #ifndef INT16_MAX
73 #define INT16_MAX (32767)
74 #endif
75 #ifndef INT32_MAX
76 #define INT32_MAX (2147483647)
77 #endif
78 #ifndef UINT8_MAX
79 #define UINT8_MAX (255U)
80 #endif
81 #ifndef UINT16_MAX
82 #define UINT16_MAX (65535U)
83 #endif
84 #ifndef UINT32_MAX
85 #define UINT32_MAX (4294967295U)
86 #endif
88 #endif /* ! FLEXINT_H */
90 #ifdef __cplusplus
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
100 #define YY_USE_CONST
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
105 #ifdef YY_USE_CONST
106 #define yyconst const
107 #else
108 #define yyconst
109 #endif
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
117 * double cast.
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* Enter a start condition. This macro really ought to take a parameter,
122 * but we do it the disgusting crufty way forced on us by the ()-less
123 * definition of BEGIN.
125 #define BEGIN (yy_start) = 1 + 2 *
127 /* Translate the current start state into a value that can be later handed
128 * to BEGIN to return to the state. The YYSTATE alias is for lex
129 * compatibility.
131 #define YY_START (((yy_start) - 1) / 2)
132 #define YYSTATE YY_START
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE yyrestart(yyin )
140 #define YY_END_OF_BUFFER_CHAR 0
142 /* Size of default input buffer. */
143 #ifndef YY_BUF_SIZE
144 #define YY_BUF_SIZE 16384
145 #endif
147 /* The state buf must be large enough to hold one state per character in the main buffer.
149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
152 #define YY_TYPEDEF_YY_BUFFER_STATE
153 typedef struct yy_buffer_state *YY_BUFFER_STATE;
154 #endif
156 extern int yyleng;
158 extern FILE *yyin, *yyout;
160 #define EOB_ACT_CONTINUE_SCAN 0
161 #define EOB_ACT_END_OF_FILE 1
162 #define EOB_ACT_LAST_MATCH 2
164 #define YY_LESS_LINENO(n)
166 /* Return all but the first "n" matched characters back to the input stream. */
167 #define yyless(n) \
168 do \
170 /* Undo effects of setting up yytext. */ \
171 int yyless_macro_arg = (n); \
172 YY_LESS_LINENO(yyless_macro_arg);\
173 *yy_cp = (yy_hold_char); \
174 YY_RESTORE_YY_MORE_OFFSET \
175 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
176 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
178 while ( 0 )
180 #define unput(c) yyunput( c, (yytext_ptr) )
182 #ifndef YY_TYPEDEF_YY_SIZE_T
183 #define YY_TYPEDEF_YY_SIZE_T
184 typedef size_t yy_size_t;
185 #endif
187 #ifndef YY_STRUCT_YY_BUFFER_STATE
188 #define YY_STRUCT_YY_BUFFER_STATE
189 struct yy_buffer_state
191 FILE *yy_input_file;
193 char *yy_ch_buf; /* input buffer */
194 char *yy_buf_pos; /* current position in input buffer */
196 /* Size of input buffer in bytes, not including room for EOB
197 * characters.
199 yy_size_t yy_buf_size;
201 /* Number of characters read into yy_ch_buf, not including EOB
202 * characters.
204 int yy_n_chars;
206 /* Whether we "own" the buffer - i.e., we know we created it,
207 * and can realloc() it to grow it, and should free() it to
208 * delete it.
210 int yy_is_our_buffer;
212 /* Whether this is an "interactive" input source; if so, and
213 * if we're using stdio for input, then we want to use getc()
214 * instead of fread(), to make sure we stop fetching input after
215 * each newline.
217 int yy_is_interactive;
219 /* Whether we're considered to be at the beginning of a line.
220 * If so, '^' rules will be active on the next match, otherwise
221 * not.
223 int yy_at_bol;
225 int yy_bs_lineno; /**< The line count. */
226 int yy_bs_column; /**< The column count. */
228 /* Whether to try to fill the input buffer when we reach the
229 * end of it.
231 int yy_fill_buffer;
233 int yy_buffer_status;
235 #define YY_BUFFER_NEW 0
236 #define YY_BUFFER_NORMAL 1
237 /* When an EOF's been seen but there's still some text to process
238 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
239 * shouldn't try reading from the input source any more. We might
240 * still have a bunch of tokens to match, though, because of
241 * possible backing-up.
243 * When we actually see the EOF, we change the status to "new"
244 * (via yyrestart()), so that the user can continue scanning by
245 * just pointing yyin at a new input file.
247 #define YY_BUFFER_EOF_PENDING 2
250 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
252 /* Stack of input buffers. */
253 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
254 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
255 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
257 /* We provide macros for accessing buffer states in case in the
258 * future we want to put the buffer states in a more general
259 * "scanner state".
261 * Returns the top of the stack, or NULL.
263 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
264 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
265 : NULL)
267 /* Same as previous macro, but useful when we know that the buffer stack is not
268 * NULL or when we need an lvalue. For internal use only.
270 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
272 /* yy_hold_char holds the character lost when yytext is formed. */
273 static char yy_hold_char;
274 static int yy_n_chars; /* number of characters read into yy_ch_buf */
275 int yyleng;
277 /* Points to current character in buffer. */
278 static char *yy_c_buf_p = (char *) 0;
279 static int yy_init = 0; /* whether we need to initialize */
280 static int yy_start = 0; /* start state number */
282 /* Flag which is used to allow yywrap()'s to do buffer switches
283 * instead of setting up a fresh yyin. A bit of a hack ...
285 static int yy_did_buffer_switch_on_eof;
287 void yyrestart (FILE *input_file );
288 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
289 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
290 void yy_delete_buffer (YY_BUFFER_STATE b );
291 void yy_flush_buffer (YY_BUFFER_STATE b );
292 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
293 void yypop_buffer_state (void );
295 static void yyensure_buffer_stack (void );
296 static void yy_load_buffer_state (void );
297 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
299 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
301 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
302 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
303 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
305 void *yyalloc (yy_size_t );
306 void *yyrealloc (void *,yy_size_t );
307 void yyfree (void * );
309 #define yy_new_buffer yy_create_buffer
311 #define yy_set_interactive(is_interactive) \
313 if ( ! YY_CURRENT_BUFFER ){ \
314 yyensure_buffer_stack (); \
315 YY_CURRENT_BUFFER_LVALUE = \
316 yy_create_buffer(yyin,YY_BUF_SIZE ); \
318 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
321 #define yy_set_bol(at_bol) \
323 if ( ! YY_CURRENT_BUFFER ){\
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
331 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
333 /* Begin user sect3 */
335 typedef unsigned char YY_CHAR;
337 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
339 typedef int yy_state_type;
341 extern int yylineno;
343 int yylineno = 1;
345 extern char *yytext;
346 #define yytext_ptr yytext
348 static yy_state_type yy_get_previous_state (void );
349 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
350 static int yy_get_next_buffer (void );
351 static void yy_fatal_error (yyconst char msg[] );
353 /* Done after the current pattern has been matched and before the
354 * corresponding action - sets up yytext.
356 #define YY_DO_BEFORE_ACTION \
357 (yytext_ptr) = yy_bp; \
358 yyleng = (size_t) (yy_cp - yy_bp); \
359 (yy_hold_char) = *yy_cp; \
360 *yy_cp = '\0'; \
361 (yy_c_buf_p) = yy_cp;
363 #define YY_NUM_RULES 16
364 #define YY_END_OF_BUFFER 17
365 /* This struct is not used in this scanner,
366 but its presence is necessary. */
367 struct yy_trans_info
369 flex_int32_t yy_verify;
370 flex_int32_t yy_nxt;
372 static yyconst flex_int16_t yy_accept[46] =
373 { 0,
374 0, 0, 17, 15, 11, 12, 13, 10, 9, 14,
375 14, 14, 14, 10, 9, 14, 3, 14, 14, 1,
376 7, 14, 14, 8, 14, 14, 14, 14, 14, 14,
377 14, 6, 14, 14, 5, 14, 14, 14, 14, 14,
378 14, 4, 14, 2, 0
381 static yyconst flex_int32_t yy_ec[256] =
382 { 0,
383 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 6, 6, 6,
388 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
389 1, 1, 1, 1, 7, 7, 7, 7, 7, 7,
390 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
391 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
392 1, 1, 1, 1, 8, 1, 9, 10, 11, 12,
394 13, 14, 7, 7, 15, 7, 7, 16, 7, 17,
395 18, 19, 7, 20, 7, 21, 7, 7, 7, 22,
396 7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
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, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 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
413 static yyconst flex_int32_t yy_meta[23] =
414 { 0,
415 1, 1, 2, 1, 1, 3, 3, 3, 3, 3,
416 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
417 3, 3
420 static yyconst flex_int16_t yy_base[48] =
421 { 0,
422 0, 0, 56, 57, 57, 57, 57, 0, 49, 0,
423 12, 13, 34, 0, 47, 0, 0, 40, 31, 0,
424 0, 38, 36, 0, 30, 34, 32, 25, 22, 28,
425 34, 0, 19, 13, 0, 22, 30, 26, 26, 18,
426 12, 0, 14, 0, 57, 34, 23
429 static yyconst flex_int16_t yy_def[48] =
430 { 0,
431 45, 1, 45, 45, 45, 45, 45, 46, 47, 47,
432 47, 47, 47, 46, 47, 47, 47, 47, 47, 47,
433 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
434 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
435 47, 47, 47, 47, 0, 45, 45
438 static yyconst flex_int16_t yy_nxt[80] =
439 { 0,
440 4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
441 10, 10, 11, 10, 12, 10, 10, 10, 13, 10,
442 10, 10, 17, 36, 21, 16, 44, 43, 18, 22,
443 42, 19, 20, 37, 14, 41, 14, 40, 39, 38,
444 35, 34, 33, 32, 31, 30, 29, 28, 27, 26,
445 25, 24, 15, 23, 15, 45, 3, 45, 45, 45,
446 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
447 45, 45, 45, 45, 45, 45, 45, 45, 45
450 static yyconst flex_int16_t yy_chk[80] =
451 { 0,
452 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 11, 34, 12, 47, 43, 41, 11, 12,
455 40, 11, 11, 34, 46, 39, 46, 38, 37, 36,
456 33, 31, 30, 29, 28, 27, 26, 25, 23, 22,
457 19, 18, 15, 13, 9, 3, 45, 45, 45, 45,
458 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
459 45, 45, 45, 45, 45, 45, 45, 45, 45
462 static yy_state_type yy_last_accepting_state;
463 static char *yy_last_accepting_cpos;
465 extern int yy_flex_debug;
466 int yy_flex_debug = 0;
468 /* The intent behind this definition is that it'll catch
469 * any uses of REJECT which flex missed.
471 #define REJECT reject_used_but_not_detected
472 #define yymore() yymore_used_but_not_detected
473 #define YY_MORE_ADJ 0
474 #define YY_RESTORE_YY_MORE_OFFSET
475 char *yytext;
476 #line 1 "lex.l"
477 #line 2 "lex.l"
479 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
480 * (Royal Institute of Technology, Stockholm, Sweden).
481 * All rights reserved.
483 * Redistribution and use in source and binary forms, with or without
484 * modification, are permitted provided that the following conditions
485 * are met:
487 * 1. Redistributions of source code must retain the above copyright
488 * notice, this list of conditions and the following disclaimer.
490 * 2. Redistributions in binary form must reproduce the above copyright
491 * notice, this list of conditions and the following disclaimer in the
492 * documentation and/or other materials provided with the distribution.
494 * 3. Neither the name of the Institute nor the names of its contributors
495 * may be used to endorse or promote products derived from this software
496 * without specific prior written permission.
498 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
499 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
500 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
501 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
502 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
503 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
504 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
505 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
506 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
507 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
508 * SUCH DAMAGE.
512 * This is to handle the definition of this symbol in some AIX
513 * headers, which will conflict with the definition that lex will
514 * generate for it. It's only a problem for AIX lex.
517 #undef ECHO
519 #include "compile_et.h"
520 #include "parse.h"
521 #include "lex.h"
523 static unsigned lineno = 1;
524 static int getstring(void);
526 #define YY_NO_UNPUT
528 #undef ECHO
530 #line 530 "heimdal/lib/com_err/lex.c"
532 #define INITIAL 0
534 #ifndef YY_NO_UNISTD_H
535 /* Special case for "unistd.h", since it is non-ANSI. We include it way
536 * down here because we want the user's section 1 to have been scanned first.
537 * The user has a chance to override it with an option.
539 #include <unistd.h>
540 #endif
542 #ifndef YY_EXTRA_TYPE
543 #define YY_EXTRA_TYPE void *
544 #endif
546 static int yy_init_globals (void );
548 /* Accessor methods to globals.
549 These are made visible to non-reentrant scanners for convenience. */
551 int yylex_destroy (void );
553 int yyget_debug (void );
555 void yyset_debug (int debug_flag );
557 YY_EXTRA_TYPE yyget_extra (void );
559 void yyset_extra (YY_EXTRA_TYPE user_defined );
561 FILE *yyget_in (void );
563 void yyset_in (FILE * in_str );
565 FILE *yyget_out (void );
567 void yyset_out (FILE * out_str );
569 int yyget_leng (void );
571 char *yyget_text (void );
573 int yyget_lineno (void );
575 void yyset_lineno (int line_number );
577 /* Macros after this point can all be overridden by user definitions in
578 * section 1.
581 #ifndef YY_SKIP_YYWRAP
582 #ifdef __cplusplus
583 extern "C" int yywrap (void );
584 #else
585 extern int yywrap (void );
586 #endif
587 #endif
589 static void yyunput (int c,char *buf_ptr );
591 #ifndef yytext_ptr
592 static void yy_flex_strncpy (char *,yyconst char *,int );
593 #endif
595 #ifdef YY_NEED_STRLEN
596 static int yy_flex_strlen (yyconst char * );
597 #endif
599 #ifndef YY_NO_INPUT
601 #ifdef __cplusplus
602 static int yyinput (void );
603 #else
604 static int input (void );
605 #endif
607 #endif
609 /* Amount of stuff to slurp up with each read. */
610 #ifndef YY_READ_BUF_SIZE
611 #define YY_READ_BUF_SIZE 8192
612 #endif
614 /* Copy whatever the last rule matched to the standard output. */
615 #ifndef ECHO
616 /* This used to be an fputs(), but since the string might contain NUL's,
617 * we now use fwrite().
619 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
620 #endif
622 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
623 * is returned in "result".
625 #ifndef YY_INPUT
626 #define YY_INPUT(buf,result,max_size) \
627 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
629 int c = '*'; \
630 unsigned n; \
631 for ( n = 0; n < max_size && \
632 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
633 buf[n] = (char) c; \
634 if ( c == '\n' ) \
635 buf[n++] = (char) c; \
636 if ( c == EOF && ferror( yyin ) ) \
637 YY_FATAL_ERROR( "input in flex scanner failed" ); \
638 result = n; \
640 else \
642 errno=0; \
643 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
645 if( errno != EINTR) \
647 YY_FATAL_ERROR( "input in flex scanner failed" ); \
648 break; \
650 errno=0; \
651 clearerr(yyin); \
656 #endif
658 /* No semi-colon after return; correct usage is to write "yyterminate();" -
659 * we don't want an extra ';' after the "return" because that will cause
660 * some compilers to complain about unreachable statements.
662 #ifndef yyterminate
663 #define yyterminate() return YY_NULL
664 #endif
666 /* Number of entries by which start-condition stack grows. */
667 #ifndef YY_START_STACK_INCR
668 #define YY_START_STACK_INCR 25
669 #endif
671 /* Report a fatal error. */
672 #ifndef YY_FATAL_ERROR
673 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
674 #endif
676 /* end tables serialization structures and prototypes */
678 /* Default declaration of generated scanner - a define so the user can
679 * easily add parameters.
681 #ifndef YY_DECL
682 #define YY_DECL_IS_OURS 1
684 extern int yylex (void);
686 #define YY_DECL int yylex (void)
687 #endif /* !YY_DECL */
689 /* Code executed at the beginning of each rule, after yytext and yyleng
690 * have been set up.
692 #ifndef YY_USER_ACTION
693 #define YY_USER_ACTION
694 #endif
696 /* Code executed at the end of each rule. */
697 #ifndef YY_BREAK
698 #define YY_BREAK break;
699 #endif
701 #define YY_RULE_SETUP \
702 YY_USER_ACTION
704 /** The main scanner function which does all the work.
706 YY_DECL
708 register yy_state_type yy_current_state;
709 register char *yy_cp, *yy_bp;
710 register int yy_act;
712 #line 57 "lex.l"
714 #line 714 "heimdal/lib/com_err/lex.c"
716 if ( !(yy_init) )
718 (yy_init) = 1;
720 #ifdef YY_USER_INIT
721 YY_USER_INIT;
722 #endif
724 if ( ! (yy_start) )
725 (yy_start) = 1; /* first start state */
727 if ( ! yyin )
728 yyin = stdin;
730 if ( ! yyout )
731 yyout = stdout;
733 if ( ! YY_CURRENT_BUFFER ) {
734 yyensure_buffer_stack ();
735 YY_CURRENT_BUFFER_LVALUE =
736 yy_create_buffer(yyin,YY_BUF_SIZE );
739 yy_load_buffer_state( );
742 while ( 1 ) /* loops until end-of-file is reached */
744 yy_cp = (yy_c_buf_p);
746 /* Support of yytext. */
747 *yy_cp = (yy_hold_char);
749 /* yy_bp points to the position in yy_ch_buf of the start of
750 * the current run.
752 yy_bp = yy_cp;
754 yy_current_state = (yy_start);
755 yy_match:
758 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
759 if ( yy_accept[yy_current_state] )
761 (yy_last_accepting_state) = yy_current_state;
762 (yy_last_accepting_cpos) = yy_cp;
764 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
766 yy_current_state = (int) yy_def[yy_current_state];
767 if ( yy_current_state >= 46 )
768 yy_c = yy_meta[(unsigned int) yy_c];
770 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
771 ++yy_cp;
773 while ( yy_base[yy_current_state] != 57 );
775 yy_find_action:
776 yy_act = yy_accept[yy_current_state];
777 if ( yy_act == 0 )
778 { /* have to back up */
779 yy_cp = (yy_last_accepting_cpos);
780 yy_current_state = (yy_last_accepting_state);
781 yy_act = yy_accept[yy_current_state];
784 YY_DO_BEFORE_ACTION;
786 do_action: /* This label is used only to access EOF actions. */
788 switch ( yy_act )
789 { /* beginning of action switch */
790 case 0: /* must back up */
791 /* undo the effects of YY_DO_BEFORE_ACTION */
792 *yy_cp = (yy_hold_char);
793 yy_cp = (yy_last_accepting_cpos);
794 yy_current_state = (yy_last_accepting_state);
795 goto yy_find_action;
797 case 1:
798 YY_RULE_SETUP
799 #line 58 "lex.l"
800 { return ET; }
801 YY_BREAK
802 case 2:
803 YY_RULE_SETUP
804 #line 59 "lex.l"
805 { return ET; }
806 YY_BREAK
807 case 3:
808 YY_RULE_SETUP
809 #line 60 "lex.l"
810 { return EC; }
811 YY_BREAK
812 case 4:
813 YY_RULE_SETUP
814 #line 61 "lex.l"
815 { return EC; }
816 YY_BREAK
817 case 5:
818 YY_RULE_SETUP
819 #line 62 "lex.l"
820 { return PREFIX; }
821 YY_BREAK
822 case 6:
823 YY_RULE_SETUP
824 #line 63 "lex.l"
825 { return INDEX; }
826 YY_BREAK
827 case 7:
828 YY_RULE_SETUP
829 #line 64 "lex.l"
830 { return ID; }
831 YY_BREAK
832 case 8:
833 YY_RULE_SETUP
834 #line 65 "lex.l"
835 { return END; }
836 YY_BREAK
837 case 9:
838 YY_RULE_SETUP
839 #line 66 "lex.l"
840 { yylval.number = atoi(yytext); return NUMBER; }
841 YY_BREAK
842 case 10:
843 YY_RULE_SETUP
844 #line 67 "lex.l"
846 YY_BREAK
847 case 11:
848 YY_RULE_SETUP
849 #line 68 "lex.l"
851 YY_BREAK
852 case 12:
853 /* rule 12 can match eol */
854 YY_RULE_SETUP
855 #line 69 "lex.l"
856 { lineno++; }
857 YY_BREAK
858 case 13:
859 YY_RULE_SETUP
860 #line 70 "lex.l"
861 { return getstring(); }
862 YY_BREAK
863 case 14:
864 YY_RULE_SETUP
865 #line 71 "lex.l"
866 { yylval.string = strdup(yytext); return STRING; }
867 YY_BREAK
868 case 15:
869 YY_RULE_SETUP
870 #line 72 "lex.l"
871 { return *yytext; }
872 YY_BREAK
873 case 16:
874 YY_RULE_SETUP
875 #line 73 "lex.l"
876 ECHO;
877 YY_BREAK
878 #line 878 "heimdal/lib/com_err/lex.c"
879 case YY_STATE_EOF(INITIAL):
880 yyterminate();
882 case YY_END_OF_BUFFER:
884 /* Amount of text matched not including the EOB char. */
885 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
887 /* Undo the effects of YY_DO_BEFORE_ACTION. */
888 *yy_cp = (yy_hold_char);
889 YY_RESTORE_YY_MORE_OFFSET
891 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
893 /* We're scanning a new file or input source. It's
894 * possible that this happened because the user
895 * just pointed yyin at a new source and called
896 * yylex(). If so, then we have to assure
897 * consistency between YY_CURRENT_BUFFER and our
898 * globals. Here is the right place to do so, because
899 * this is the first action (other than possibly a
900 * back-up) that will match for the new input source.
902 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
903 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
904 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
907 /* Note that here we test for yy_c_buf_p "<=" to the position
908 * of the first EOB in the buffer, since yy_c_buf_p will
909 * already have been incremented past the NUL character
910 * (since all states make transitions on EOB to the
911 * end-of-buffer state). Contrast this with the test
912 * in input().
914 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
915 { /* This was really a NUL. */
916 yy_state_type yy_next_state;
918 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
920 yy_current_state = yy_get_previous_state( );
922 /* Okay, we're now positioned to make the NUL
923 * transition. We couldn't have
924 * yy_get_previous_state() go ahead and do it
925 * for us because it doesn't know how to deal
926 * with the possibility of jamming (and we don't
927 * want to build jamming into it because then it
928 * will run more slowly).
931 yy_next_state = yy_try_NUL_trans( yy_current_state );
933 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
935 if ( yy_next_state )
937 /* Consume the NUL. */
938 yy_cp = ++(yy_c_buf_p);
939 yy_current_state = yy_next_state;
940 goto yy_match;
943 else
945 yy_cp = (yy_c_buf_p);
946 goto yy_find_action;
950 else switch ( yy_get_next_buffer( ) )
952 case EOB_ACT_END_OF_FILE:
954 (yy_did_buffer_switch_on_eof) = 0;
956 if ( yywrap( ) )
958 /* Note: because we've taken care in
959 * yy_get_next_buffer() to have set up
960 * yytext, we can now set up
961 * yy_c_buf_p so that if some total
962 * hoser (like flex itself) wants to
963 * call the scanner after we return the
964 * YY_NULL, it'll still work - another
965 * YY_NULL will get returned.
967 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
969 yy_act = YY_STATE_EOF(YY_START);
970 goto do_action;
973 else
975 if ( ! (yy_did_buffer_switch_on_eof) )
976 YY_NEW_FILE;
978 break;
981 case EOB_ACT_CONTINUE_SCAN:
982 (yy_c_buf_p) =
983 (yytext_ptr) + yy_amount_of_matched_text;
985 yy_current_state = yy_get_previous_state( );
987 yy_cp = (yy_c_buf_p);
988 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
989 goto yy_match;
991 case EOB_ACT_LAST_MATCH:
992 (yy_c_buf_p) =
993 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
995 yy_current_state = yy_get_previous_state( );
997 yy_cp = (yy_c_buf_p);
998 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
999 goto yy_find_action;
1001 break;
1004 default:
1005 YY_FATAL_ERROR(
1006 "fatal flex scanner internal error--no action found" );
1007 } /* end of action switch */
1008 } /* end of scanning one token */
1009 } /* end of yylex */
1011 /* yy_get_next_buffer - try to read in a new buffer
1013 * Returns a code representing an action:
1014 * EOB_ACT_LAST_MATCH -
1015 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1016 * EOB_ACT_END_OF_FILE - end of file
1018 static int yy_get_next_buffer (void)
1020 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1021 register char *source = (yytext_ptr);
1022 register int number_to_move, i;
1023 int ret_val;
1025 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1026 YY_FATAL_ERROR(
1027 "fatal flex scanner internal error--end of buffer missed" );
1029 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1030 { /* Don't try to fill the buffer, so this is an EOF. */
1031 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1033 /* We matched a single character, the EOB, so
1034 * treat this as a final EOF.
1036 return EOB_ACT_END_OF_FILE;
1039 else
1041 /* We matched some text prior to the EOB, first
1042 * process it.
1044 return EOB_ACT_LAST_MATCH;
1048 /* Try to read more data. */
1050 /* First move last chars to start of buffer. */
1051 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1053 for ( i = 0; i < number_to_move; ++i )
1054 *(dest++) = *(source++);
1056 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1057 /* don't do the read, it's not guaranteed to return an EOF,
1058 * just force an EOF
1060 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1062 else
1064 int num_to_read =
1065 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1067 while ( num_to_read <= 0 )
1068 { /* Not enough room in the buffer - grow it. */
1070 /* just a shorter name for the current buffer */
1071 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1073 int yy_c_buf_p_offset =
1074 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1076 if ( b->yy_is_our_buffer )
1078 int new_size = b->yy_buf_size * 2;
1080 if ( new_size <= 0 )
1081 b->yy_buf_size += b->yy_buf_size / 8;
1082 else
1083 b->yy_buf_size *= 2;
1085 b->yy_ch_buf = (char *)
1086 /* Include room in for 2 EOB chars. */
1087 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1089 else
1090 /* Can't grow it, we don't own it. */
1091 b->yy_ch_buf = 0;
1093 if ( ! b->yy_ch_buf )
1094 YY_FATAL_ERROR(
1095 "fatal error - scanner input buffer overflow" );
1097 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1099 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1100 number_to_move - 1;
1104 if ( num_to_read > YY_READ_BUF_SIZE )
1105 num_to_read = YY_READ_BUF_SIZE;
1107 /* Read in more data. */
1108 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1109 (yy_n_chars), (size_t) num_to_read );
1111 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1114 if ( (yy_n_chars) == 0 )
1116 if ( number_to_move == YY_MORE_ADJ )
1118 ret_val = EOB_ACT_END_OF_FILE;
1119 yyrestart(yyin );
1122 else
1124 ret_val = EOB_ACT_LAST_MATCH;
1125 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1126 YY_BUFFER_EOF_PENDING;
1130 else
1131 ret_val = EOB_ACT_CONTINUE_SCAN;
1133 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1134 /* Extend the array by 50%, plus the number we really need. */
1135 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1136 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1137 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1138 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1141 (yy_n_chars) += number_to_move;
1142 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1143 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1145 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1147 return ret_val;
1150 /* yy_get_previous_state - get the state just before the EOB char was reached */
1152 static yy_state_type yy_get_previous_state (void)
1154 register yy_state_type yy_current_state;
1155 register char *yy_cp;
1157 yy_current_state = (yy_start);
1159 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1161 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1162 if ( yy_accept[yy_current_state] )
1164 (yy_last_accepting_state) = yy_current_state;
1165 (yy_last_accepting_cpos) = yy_cp;
1167 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1169 yy_current_state = (int) yy_def[yy_current_state];
1170 if ( yy_current_state >= 46 )
1171 yy_c = yy_meta[(unsigned int) yy_c];
1173 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1176 return yy_current_state;
1179 /* yy_try_NUL_trans - try to make a transition on the NUL character
1181 * synopsis
1182 * next_state = yy_try_NUL_trans( current_state );
1184 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1186 register int yy_is_jam;
1187 register char *yy_cp = (yy_c_buf_p);
1189 register YY_CHAR yy_c = 1;
1190 if ( yy_accept[yy_current_state] )
1192 (yy_last_accepting_state) = yy_current_state;
1193 (yy_last_accepting_cpos) = yy_cp;
1195 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1197 yy_current_state = (int) yy_def[yy_current_state];
1198 if ( yy_current_state >= 46 )
1199 yy_c = yy_meta[(unsigned int) yy_c];
1201 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1202 yy_is_jam = (yy_current_state == 45);
1204 return yy_is_jam ? 0 : yy_current_state;
1207 static void yyunput (int c, register char * yy_bp )
1209 register char *yy_cp;
1211 yy_cp = (yy_c_buf_p);
1213 /* undo effects of setting up yytext */
1214 *yy_cp = (yy_hold_char);
1216 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1217 { /* need to shift things up to make room */
1218 /* +2 for EOB chars. */
1219 register int number_to_move = (yy_n_chars) + 2;
1220 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1221 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1222 register char *source =
1223 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1225 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1226 *--dest = *--source;
1228 yy_cp += (int) (dest - source);
1229 yy_bp += (int) (dest - source);
1230 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1231 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1233 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1234 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1237 *--yy_cp = (char) c;
1239 (yytext_ptr) = yy_bp;
1240 (yy_hold_char) = *yy_cp;
1241 (yy_c_buf_p) = yy_cp;
1244 #ifndef YY_NO_INPUT
1245 #ifdef __cplusplus
1246 static int yyinput (void)
1247 #else
1248 static int input (void)
1249 #endif
1252 int c;
1254 *(yy_c_buf_p) = (yy_hold_char);
1256 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1258 /* yy_c_buf_p now points to the character we want to return.
1259 * If this occurs *before* the EOB characters, then it's a
1260 * valid NUL; if not, then we've hit the end of the buffer.
1262 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1263 /* This was really a NUL. */
1264 *(yy_c_buf_p) = '\0';
1266 else
1267 { /* need more input */
1268 int offset = (yy_c_buf_p) - (yytext_ptr);
1269 ++(yy_c_buf_p);
1271 switch ( yy_get_next_buffer( ) )
1273 case EOB_ACT_LAST_MATCH:
1274 /* This happens because yy_g_n_b()
1275 * sees that we've accumulated a
1276 * token and flags that we need to
1277 * try matching the token before
1278 * proceeding. But for input(),
1279 * there's no matching to consider.
1280 * So convert the EOB_ACT_LAST_MATCH
1281 * to EOB_ACT_END_OF_FILE.
1284 /* Reset buffer status. */
1285 yyrestart(yyin );
1287 /*FALLTHROUGH*/
1289 case EOB_ACT_END_OF_FILE:
1291 if ( yywrap( ) )
1292 return EOF;
1294 if ( ! (yy_did_buffer_switch_on_eof) )
1295 YY_NEW_FILE;
1296 #ifdef __cplusplus
1297 return yyinput();
1298 #else
1299 return input();
1300 #endif
1303 case EOB_ACT_CONTINUE_SCAN:
1304 (yy_c_buf_p) = (yytext_ptr) + offset;
1305 break;
1310 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1311 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1312 (yy_hold_char) = *++(yy_c_buf_p);
1314 return c;
1316 #endif /* ifndef YY_NO_INPUT */
1318 /** Immediately switch to a different input stream.
1319 * @param input_file A readable stream.
1321 * @note This function does not reset the start condition to @c INITIAL .
1323 void yyrestart (FILE * input_file )
1326 if ( ! YY_CURRENT_BUFFER ){
1327 yyensure_buffer_stack ();
1328 YY_CURRENT_BUFFER_LVALUE =
1329 yy_create_buffer(yyin,YY_BUF_SIZE );
1332 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1333 yy_load_buffer_state( );
1336 /** Switch to a different input buffer.
1337 * @param new_buffer The new input buffer.
1340 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1343 /* TODO. We should be able to replace this entire function body
1344 * with
1345 * yypop_buffer_state();
1346 * yypush_buffer_state(new_buffer);
1348 yyensure_buffer_stack ();
1349 if ( YY_CURRENT_BUFFER == new_buffer )
1350 return;
1352 if ( YY_CURRENT_BUFFER )
1354 /* Flush out information for old buffer. */
1355 *(yy_c_buf_p) = (yy_hold_char);
1356 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1357 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1360 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1361 yy_load_buffer_state( );
1363 /* We don't actually know whether we did this switch during
1364 * EOF (yywrap()) processing, but the only time this flag
1365 * is looked at is after yywrap() is called, so it's safe
1366 * to go ahead and always set it.
1368 (yy_did_buffer_switch_on_eof) = 1;
1371 static void yy_load_buffer_state (void)
1373 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1374 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1375 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1376 (yy_hold_char) = *(yy_c_buf_p);
1379 /** Allocate and initialize an input buffer state.
1380 * @param file A readable stream.
1381 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1383 * @return the allocated buffer state.
1385 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1387 YY_BUFFER_STATE b;
1389 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1390 if ( ! b )
1391 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1393 b->yy_buf_size = size;
1395 /* yy_ch_buf has to be 2 characters longer than the size given because
1396 * we need to put in 2 end-of-buffer characters.
1398 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1399 if ( ! b->yy_ch_buf )
1400 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1402 b->yy_is_our_buffer = 1;
1404 yy_init_buffer(b,file );
1406 return b;
1409 /** Destroy the buffer.
1410 * @param b a buffer created with yy_create_buffer()
1413 void yy_delete_buffer (YY_BUFFER_STATE b )
1416 if ( ! b )
1417 return;
1419 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1420 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1422 if ( b->yy_is_our_buffer )
1423 yyfree((void *) b->yy_ch_buf );
1425 yyfree((void *) b );
1428 #ifndef __cplusplus
1429 extern int isatty (int );
1430 #endif /* __cplusplus */
1432 /* Initializes or reinitializes a buffer.
1433 * This function is sometimes called more than once on the same buffer,
1434 * such as during a yyrestart() or at EOF.
1436 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1439 int oerrno = errno;
1441 yy_flush_buffer(b );
1443 b->yy_input_file = file;
1444 b->yy_fill_buffer = 1;
1446 /* If b is the current buffer, then yy_init_buffer was _probably_
1447 * called from yyrestart() or through yy_get_next_buffer.
1448 * In that case, we don't want to reset the lineno or column.
1450 if (b != YY_CURRENT_BUFFER){
1451 b->yy_bs_lineno = 1;
1452 b->yy_bs_column = 0;
1455 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1457 errno = oerrno;
1460 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1461 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1464 void yy_flush_buffer (YY_BUFFER_STATE b )
1466 if ( ! b )
1467 return;
1469 b->yy_n_chars = 0;
1471 /* We always need two end-of-buffer characters. The first causes
1472 * a transition to the end-of-buffer state. The second causes
1473 * a jam in that state.
1475 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1476 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1478 b->yy_buf_pos = &b->yy_ch_buf[0];
1480 b->yy_at_bol = 1;
1481 b->yy_buffer_status = YY_BUFFER_NEW;
1483 if ( b == YY_CURRENT_BUFFER )
1484 yy_load_buffer_state( );
1487 /** Pushes the new state onto the stack. The new state becomes
1488 * the current state. This function will allocate the stack
1489 * if necessary.
1490 * @param new_buffer The new state.
1493 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1495 if (new_buffer == NULL)
1496 return;
1498 yyensure_buffer_stack();
1500 /* This block is copied from yy_switch_to_buffer. */
1501 if ( YY_CURRENT_BUFFER )
1503 /* Flush out information for old buffer. */
1504 *(yy_c_buf_p) = (yy_hold_char);
1505 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1506 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1509 /* Only push if top exists. Otherwise, replace top. */
1510 if (YY_CURRENT_BUFFER)
1511 (yy_buffer_stack_top)++;
1512 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1514 /* copied from yy_switch_to_buffer. */
1515 yy_load_buffer_state( );
1516 (yy_did_buffer_switch_on_eof) = 1;
1519 /** Removes and deletes the top of the stack, if present.
1520 * The next element becomes the new top.
1523 void yypop_buffer_state (void)
1525 if (!YY_CURRENT_BUFFER)
1526 return;
1528 yy_delete_buffer(YY_CURRENT_BUFFER );
1529 YY_CURRENT_BUFFER_LVALUE = NULL;
1530 if ((yy_buffer_stack_top) > 0)
1531 --(yy_buffer_stack_top);
1533 if (YY_CURRENT_BUFFER) {
1534 yy_load_buffer_state( );
1535 (yy_did_buffer_switch_on_eof) = 1;
1539 /* Allocates the stack if it does not exist.
1540 * Guarantees space for at least one push.
1542 static void yyensure_buffer_stack (void)
1544 int num_to_alloc;
1546 if (!(yy_buffer_stack)) {
1548 /* First allocation is just for 2 elements, since we don't know if this
1549 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1550 * immediate realloc on the next call.
1552 num_to_alloc = 1;
1553 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1554 (num_to_alloc * sizeof(struct yy_buffer_state*)
1556 if ( ! (yy_buffer_stack) )
1557 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1559 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1561 (yy_buffer_stack_max) = num_to_alloc;
1562 (yy_buffer_stack_top) = 0;
1563 return;
1566 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1568 /* Increase the buffer to prepare for a possible push. */
1569 int grow_size = 8 /* arbitrary grow size */;
1571 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1572 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1573 ((yy_buffer_stack),
1574 num_to_alloc * sizeof(struct yy_buffer_state*)
1576 if ( ! (yy_buffer_stack) )
1577 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1579 /* zero only the new slots.*/
1580 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1581 (yy_buffer_stack_max) = num_to_alloc;
1585 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1586 * @param base the character buffer
1587 * @param size the size in bytes of the character buffer
1589 * @return the newly allocated buffer state object.
1591 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1593 YY_BUFFER_STATE b;
1595 if ( size < 2 ||
1596 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1597 base[size-1] != YY_END_OF_BUFFER_CHAR )
1598 /* They forgot to leave room for the EOB's. */
1599 return 0;
1601 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1602 if ( ! b )
1603 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1605 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1606 b->yy_buf_pos = b->yy_ch_buf = base;
1607 b->yy_is_our_buffer = 0;
1608 b->yy_input_file = 0;
1609 b->yy_n_chars = b->yy_buf_size;
1610 b->yy_is_interactive = 0;
1611 b->yy_at_bol = 1;
1612 b->yy_fill_buffer = 0;
1613 b->yy_buffer_status = YY_BUFFER_NEW;
1615 yy_switch_to_buffer(b );
1617 return b;
1620 /** Setup the input buffer state to scan a string. The next call to yylex() will
1621 * scan from a @e copy of @a str.
1622 * @param yystr a NUL-terminated string to scan
1624 * @return the newly allocated buffer state object.
1625 * @note If you want to scan bytes that may contain NUL values, then use
1626 * yy_scan_bytes() instead.
1628 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1631 return yy_scan_bytes(yystr,strlen(yystr) );
1634 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1635 * scan from a @e copy of @a bytes.
1636 * @param bytes the byte buffer to scan
1637 * @param len the number of bytes in the buffer pointed to by @a bytes.
1639 * @return the newly allocated buffer state object.
1641 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1643 YY_BUFFER_STATE b;
1644 char *buf;
1645 yy_size_t n;
1646 int i;
1648 /* Get memory for full buffer, including space for trailing EOB's. */
1649 n = _yybytes_len + 2;
1650 buf = (char *) yyalloc(n );
1651 if ( ! buf )
1652 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1654 for ( i = 0; i < _yybytes_len; ++i )
1655 buf[i] = yybytes[i];
1657 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1659 b = yy_scan_buffer(buf,n );
1660 if ( ! b )
1661 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1663 /* It's okay to grow etc. this buffer, and we should throw it
1664 * away when we're done.
1666 b->yy_is_our_buffer = 1;
1668 return b;
1671 #ifndef YY_EXIT_FAILURE
1672 #define YY_EXIT_FAILURE 2
1673 #endif
1675 static void yy_fatal_error (yyconst char* msg )
1677 (void) fprintf( stderr, "%s\n", msg );
1678 exit( YY_EXIT_FAILURE );
1681 /* Redefine yyless() so it works in section 3 code. */
1683 #undef yyless
1684 #define yyless(n) \
1685 do \
1687 /* Undo effects of setting up yytext. */ \
1688 int yyless_macro_arg = (n); \
1689 YY_LESS_LINENO(yyless_macro_arg);\
1690 yytext[yyleng] = (yy_hold_char); \
1691 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1692 (yy_hold_char) = *(yy_c_buf_p); \
1693 *(yy_c_buf_p) = '\0'; \
1694 yyleng = yyless_macro_arg; \
1696 while ( 0 )
1698 /* Accessor methods (get/set functions) to struct members. */
1700 /** Get the current line number.
1703 int yyget_lineno (void)
1706 return yylineno;
1709 /** Get the input stream.
1712 FILE *yyget_in (void)
1714 return yyin;
1717 /** Get the output stream.
1720 FILE *yyget_out (void)
1722 return yyout;
1725 /** Get the length of the current token.
1728 int yyget_leng (void)
1730 return yyleng;
1733 /** Get the current token.
1737 char *yyget_text (void)
1739 return yytext;
1742 /** Set the current line number.
1743 * @param line_number
1746 void yyset_lineno (int line_number )
1749 yylineno = line_number;
1752 /** Set the input stream. This does not discard the current
1753 * input buffer.
1754 * @param in_str A readable stream.
1756 * @see yy_switch_to_buffer
1758 void yyset_in (FILE * in_str )
1760 yyin = in_str ;
1763 void yyset_out (FILE * out_str )
1765 yyout = out_str ;
1768 int yyget_debug (void)
1770 return yy_flex_debug;
1773 void yyset_debug (int bdebug )
1775 yy_flex_debug = bdebug ;
1778 static int yy_init_globals (void)
1780 /* Initialization is the same as for the non-reentrant scanner.
1781 * This function is called from yylex_destroy(), so don't allocate here.
1784 (yy_buffer_stack) = 0;
1785 (yy_buffer_stack_top) = 0;
1786 (yy_buffer_stack_max) = 0;
1787 (yy_c_buf_p) = (char *) 0;
1788 (yy_init) = 0;
1789 (yy_start) = 0;
1791 /* Defined in main.c */
1792 #ifdef YY_STDINIT
1793 yyin = stdin;
1794 yyout = stdout;
1795 #else
1796 yyin = (FILE *) 0;
1797 yyout = (FILE *) 0;
1798 #endif
1800 /* For future reference: Set errno on error, since we are called by
1801 * yylex_init()
1803 return 0;
1806 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1807 int yylex_destroy (void)
1810 /* Pop the buffer stack, destroying each element. */
1811 while(YY_CURRENT_BUFFER){
1812 yy_delete_buffer(YY_CURRENT_BUFFER );
1813 YY_CURRENT_BUFFER_LVALUE = NULL;
1814 yypop_buffer_state();
1817 /* Destroy the stack itself. */
1818 yyfree((yy_buffer_stack) );
1819 (yy_buffer_stack) = NULL;
1821 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1822 * yylex() is called, initialization will occur. */
1823 yy_init_globals( );
1825 return 0;
1829 * Internal utility routines.
1832 #ifndef yytext_ptr
1833 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1835 register int i;
1836 for ( i = 0; i < n; ++i )
1837 s1[i] = s2[i];
1839 #endif
1841 #ifdef YY_NEED_STRLEN
1842 static int yy_flex_strlen (yyconst char * s )
1844 register int n;
1845 for ( n = 0; s[n]; ++n )
1848 return n;
1850 #endif
1852 void *yyalloc (yy_size_t size )
1854 return (void *) malloc( size );
1857 void *yyrealloc (void * ptr, yy_size_t size )
1859 /* The cast to (char *) in the following accommodates both
1860 * implementations that use char* generic pointers, and those
1861 * that use void* generic pointers. It works with the latter
1862 * because both ANSI C and C++ allow castless assignment from
1863 * any pointer type to void*, and deal with argument conversions
1864 * as though doing an assignment.
1866 return (void *) realloc( (char *) ptr, size );
1869 void yyfree (void * ptr )
1871 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1874 #define YYTABLES_NAME "yytables"
1876 #line 73 "lex.l"
1880 #ifndef yywrap /* XXX */
1882 yywrap ()
1884 return 1;
1886 #endif
1888 static int
1889 getstring(void)
1891 char x[128];
1892 int i = 0;
1893 int c;
1894 int quote = 0;
1895 while(i < sizeof(x) - 1 && (c = input()) != EOF){
1896 if(quote) {
1897 x[i++] = c;
1898 quote = 0;
1899 continue;
1901 if(c == '\n'){
1902 lex_err_message("unterminated string");
1903 lineno++;
1904 break;
1906 if(c == '\\'){
1907 quote++;
1908 continue;
1910 if(c == '\"')
1911 break;
1912 x[i++] = c;
1914 x[i] = '\0';
1915 yylval.string = strdup(x);
1916 if (yylval.string == NULL)
1917 err(1, "malloc");
1918 return STRING;
1921 void
1922 lex_err_message (const char *format, ...)
1924 va_list args;
1926 va_start (args, format);
1927 fprintf (stderr, "%s:%d:", filename, lineno);
1928 vfprintf (stderr, format, args);
1929 va_end (args);
1930 numerror++;