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