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