1 
2 #line 3 "tokenparser.c"
3 
4 #define  YY_INT_ALIGNED short int
5 
6 /* A lexical scanner generated by flex */
7 
8 #define yy_create_buffer tp_create_buffer
9 #define yy_delete_buffer tp_delete_buffer
10 #define yy_scan_buffer tp_scan_buffer
11 #define yy_scan_string tp_scan_string
12 #define yy_scan_bytes tp_scan_bytes
13 #define yy_init_buffer tp_init_buffer
14 #define yy_flush_buffer tp_flush_buffer
15 #define yy_load_buffer_state tp_load_buffer_state
16 #define yy_switch_to_buffer tp_switch_to_buffer
17 #define yypush_buffer_state tppush_buffer_state
18 #define yypop_buffer_state tppop_buffer_state
19 #define yyensure_buffer_stack tpensure_buffer_stack
20 #define yy_flex_debug tp_flex_debug
21 #define yyin tpin
22 #define yyleng tpleng
23 #define yylex tplex
24 #define yylineno tplineno
25 #define yyout tpout
26 #define yyrestart tprestart
27 #define yytext tptext
28 #define yywrap tpwrap
29 #define yyalloc tpalloc
30 #define yyrealloc tprealloc
31 #define yyfree tpfree
32 
33 #define FLEX_SCANNER
34 #define YY_FLEX_MAJOR_VERSION 2
35 #define YY_FLEX_MINOR_VERSION 6
36 #define YY_FLEX_SUBMINOR_VERSION 4
37 #if YY_FLEX_SUBMINOR_VERSION > 0
38 #define FLEX_BETA
39 #endif
40 
41 #ifdef yy_create_buffer
42 #define tp_create_buffer_ALREADY_DEFINED
43 #else
44 #define yy_create_buffer tp_create_buffer
45 #endif
46 
47 #ifdef yy_delete_buffer
48 #define tp_delete_buffer_ALREADY_DEFINED
49 #else
50 #define yy_delete_buffer tp_delete_buffer
51 #endif
52 
53 #ifdef yy_scan_buffer
54 #define tp_scan_buffer_ALREADY_DEFINED
55 #else
56 #define yy_scan_buffer tp_scan_buffer
57 #endif
58 
test_rv(LONG rv,SCARDCONTEXT hContext,int dont_panic)59 #ifdef yy_scan_string
60 #define tp_scan_string_ALREADY_DEFINED
61 #else
62 #define yy_scan_string tp_scan_string
63 #endif
64 
65 #ifdef yy_scan_bytes
66 #define tp_scan_bytes_ALREADY_DEFINED
67 #else
68 #define yy_scan_bytes tp_scan_bytes
69 #endif
70 
71 #ifdef yy_init_buffer
72 #define tp_init_buffer_ALREADY_DEFINED
73 #else
74 #define yy_init_buffer tp_init_buffer
75 #endif
76 
77 #ifdef yy_flush_buffer
78 #define tp_flush_buffer_ALREADY_DEFINED
79 #else
80 #define yy_flush_buffer tp_flush_buffer
81 #endif
82 
83 #ifdef yy_load_buffer_state
84 #define tp_load_buffer_state_ALREADY_DEFINED
85 #else
86 #define yy_load_buffer_state tp_load_buffer_state
87 #endif
88 
89 #ifdef yy_switch_to_buffer
90 #define tp_switch_to_buffer_ALREADY_DEFINED
91 #else
92 #define yy_switch_to_buffer tp_switch_to_buffer
93 #endif
94 
95 #ifdef yypush_buffer_state
96 #define tppush_buffer_state_ALREADY_DEFINED
97 #else
98 #define yypush_buffer_state tppush_buffer_state
99 #endif
100 
101 #ifdef yypop_buffer_state
102 #define tppop_buffer_state_ALREADY_DEFINED
103 #else
104 #define yypop_buffer_state tppop_buffer_state
105 #endif
106 
107 #ifdef yyensure_buffer_stack
108 #define tpensure_buffer_stack_ALREADY_DEFINED
109 #else
110 #define yyensure_buffer_stack tpensure_buffer_stack
111 #endif
112 
113 #ifdef yylex
114 #define tplex_ALREADY_DEFINED
115 #else
116 #define yylex tplex
117 #endif
118 
119 #ifdef yyrestart
120 #define tprestart_ALREADY_DEFINED
121 #else
122 #define yyrestart tprestart
123 #endif
124 
125 #ifdef yylex_init
126 #define tplex_init_ALREADY_DEFINED
127 #else
128 #define yylex_init tplex_init
129 #endif
130 
131 #ifdef yylex_init_extra
132 #define tplex_init_extra_ALREADY_DEFINED
133 #else
134 #define yylex_init_extra tplex_init_extra
135 #endif
136 
137 #ifdef yylex_destroy
138 #define tplex_destroy_ALREADY_DEFINED
139 #else
140 #define yylex_destroy tplex_destroy
141 #endif
142 
143 #ifdef yyget_debug
144 #define tpget_debug_ALREADY_DEFINED
145 #else
146 #define yyget_debug tpget_debug
147 #endif
148 
149 #ifdef yyset_debug
150 #define tpset_debug_ALREADY_DEFINED
151 #else
152 #define yyset_debug tpset_debug
153 #endif
154 
155 #ifdef yyget_extra
156 #define tpget_extra_ALREADY_DEFINED
157 #else
158 #define yyget_extra tpget_extra
159 #endif
160 
161 #ifdef yyset_extra
162 #define tpset_extra_ALREADY_DEFINED
163 #else
164 #define yyset_extra tpset_extra
165 #endif
166 
167 #ifdef yyget_in
168 #define tpget_in_ALREADY_DEFINED
169 #else
170 #define yyget_in tpget_in
171 #endif
172 
173 #ifdef yyset_in
174 #define tpset_in_ALREADY_DEFINED
175 #else
176 #define yyset_in tpset_in
177 #endif
178 
179 #ifdef yyget_out
180 #define tpget_out_ALREADY_DEFINED
181 #else
182 #define yyget_out tpget_out
183 #endif
184 
185 #ifdef yyset_out
186 #define tpset_out_ALREADY_DEFINED
187 #else
188 #define yyset_out tpset_out
189 #endif
190 
191 #ifdef yyget_leng
192 #define tpget_leng_ALREADY_DEFINED
193 #else
194 #define yyget_leng tpget_leng
195 #endif
196 
197 #ifdef yyget_text
198 #define tpget_text_ALREADY_DEFINED
199 #else
200 #define yyget_text tpget_text
201 #endif
202 
203 #ifdef yyget_lineno
204 #define tpget_lineno_ALREADY_DEFINED
205 #else
206 #define yyget_lineno tpget_lineno
207 #endif
208 
209 #ifdef yyset_lineno
210 #define tpset_lineno_ALREADY_DEFINED
211 #else
212 #define yyset_lineno tpset_lineno
213 #endif
214 
215 #ifdef yywrap
216 #define tpwrap_ALREADY_DEFINED
217 #else
218 #define yywrap tpwrap
219 #endif
220 
221 #ifdef yyalloc
222 #define tpalloc_ALREADY_DEFINED
223 #else
224 #define yyalloc tpalloc
225 #endif
226 
227 #ifdef yyrealloc
228 #define tprealloc_ALREADY_DEFINED
229 #else
230 #define yyrealloc tprealloc
231 #endif
232 
233 #ifdef yyfree
234 #define tpfree_ALREADY_DEFINED
235 #else
236 #define yyfree tpfree
237 #endif
238 
239 #ifdef yytext
240 #define tptext_ALREADY_DEFINED
241 #else
242 #define yytext tptext
243 #endif
244 
245 #ifdef yyleng
246 #define tpleng_ALREADY_DEFINED
247 #else
248 #define yyleng tpleng
249 #endif
250 
251 #ifdef yyin
252 #define tpin_ALREADY_DEFINED
253 #else
254 #define yyin tpin
255 #endif
256 
257 #ifdef yyout
258 #define tpout_ALREADY_DEFINED
259 #else
260 #define yyout tpout
261 #endif
262 
263 #ifdef yy_flex_debug
264 #define tp_flex_debug_ALREADY_DEFINED
265 #else
266 #define yy_flex_debug tp_flex_debug
267 #endif
268 
269 #ifdef yylineno
270 #define tplineno_ALREADY_DEFINED
271 #else
272 #define yylineno tplineno
273 #endif
274 
275 /* First, we deal with  platform-specific or compiler-specific issues. */
276 
277 /* begin standard C headers. */
278 #include <stdio.h>
279 #include <string.h>
280 #include <errno.h>
281 #include <stdlib.h>
282 
283 /* end standard C headers. */
284 
285 /* flex integer type definitions */
286 
287 #ifndef FLEXINT_H
288 #define FLEXINT_H
289 
290 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
291 
292 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
293 
294 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
295  * if you want the limit (max/min) macros for int types.
296  */
297 #ifndef __STDC_LIMIT_MACROS
298 #define __STDC_LIMIT_MACROS 1
299 #endif
300 
301 #include <inttypes.h>
302 typedef int8_t flex_int8_t;
303 typedef uint8_t flex_uint8_t;
304 typedef int16_t flex_int16_t;
305 typedef uint16_t flex_uint16_t;
306 typedef int32_t flex_int32_t;
307 typedef uint32_t flex_uint32_t;
308 #else
309 typedef signed char flex_int8_t;
310 typedef short int flex_int16_t;
311 typedef int flex_int32_t;
312 typedef unsigned char flex_uint8_t;
313 typedef unsigned short int flex_uint16_t;
314 typedef unsigned int flex_uint32_t;
315 
316 /* Limits of integral types. */
317 #ifndef INT8_MIN
318 #define INT8_MIN               (-128)
319 #endif
320 #ifndef INT16_MIN
321 #define INT16_MIN              (-32767-1)
322 #endif
323 #ifndef INT32_MIN
324 #define INT32_MIN              (-2147483647-1)
325 #endif
326 #ifndef INT8_MAX
327 #define INT8_MAX               (127)
328 #endif
329 #ifndef INT16_MAX
330 #define INT16_MAX              (32767)
331 #endif
332 #ifndef INT32_MAX
333 #define INT32_MAX              (2147483647)
334 #endif
335 #ifndef UINT8_MAX
336 #define UINT8_MAX              (255U)
337 #endif
338 #ifndef UINT16_MAX
339 #define UINT16_MAX             (65535U)
340 #endif
341 #ifndef UINT32_MAX
342 #define UINT32_MAX             (4294967295U)
343 #endif
344 
345 #ifndef SIZE_MAX
346 #define SIZE_MAX               (~(size_t)0)
347 #endif
348 
349 #endif /* ! C99 */
350 
351 #endif /* ! FLEXINT_H */
352 
353 /* begin standard C++ headers. */
354 
355 /* TODO: this is always defined, so inline it */
356 #define yyconst const
357 
358 #if defined(__GNUC__) && __GNUC__ >= 3
359 #define yynoreturn __attribute__((__noreturn__))
360 #else
361 #define yynoreturn
362 #endif
363 
364 /* Returned upon end-of-file. */
365 #define YY_NULL 0
366 
367 /* Promotes a possibly negative, possibly signed char to an
368  *   integer in range [0..255] for use as an array index.
369  */
370 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
371 
372 /* Enter a start condition.  This macro really ought to take a parameter,
373  * but we do it the disgusting crufty way forced on us by the ()-less
374  * definition of BEGIN.
375  */
376 #define BEGIN (yy_start) = 1 + 2 *
377 /* Translate the current start state into a value that can be later handed
378  * to BEGIN to return to the state.  The YYSTATE alias is for lex
379  * compatibility.
380  */
381 #define YY_START (((yy_start) - 1) / 2)
382 #define YYSTATE YY_START
383 /* Action number for EOF rule of a given start state. */
384 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
385 /* Special action meaning "start processing a new file". */
386 #define YY_NEW_FILE yyrestart( yyin  )
387 #define YY_END_OF_BUFFER_CHAR 0
388 
389 /* Size of default input buffer. */
390 #ifndef YY_BUF_SIZE
391 #ifdef __ia64__
392 /* On IA-64, the buffer size is 16k, not 8k.
393  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
394  * Ditto for the __ia64__ case accordingly.
395  */
396 #define YY_BUF_SIZE 32768
397 #else
398 #define YY_BUF_SIZE 16384
399 #endif /* __ia64__ */
400 #endif
401 
402 /* The state buf must be large enough to hold one state per character in the main buffer.
403  */
404 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
405 
406 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
407 #define YY_TYPEDEF_YY_BUFFER_STATE
408 typedef struct yy_buffer_state *YY_BUFFER_STATE;
409 #endif
410 
411 #ifndef YY_TYPEDEF_YY_SIZE_T
412 #define YY_TYPEDEF_YY_SIZE_T
413 typedef size_t yy_size_t;
414 #endif
415 
416 extern int yyleng;
417 
418 extern FILE *yyin, *yyout;
419 
420 #define EOB_ACT_CONTINUE_SCAN 0
421 #define EOB_ACT_END_OF_FILE 1
422 #define EOB_ACT_LAST_MATCH 2
423 
424     #define YY_LESS_LINENO(n)
425     #define YY_LINENO_REWIND_TO(ptr)
426 
427 /* Return all but the first "n" matched characters back to the input stream. */
428 #define yyless(n) \
429 	do \
430 		{ \
431 		/* Undo effects of setting up yytext. */ \
432         int yyless_macro_arg = (n); \
433         YY_LESS_LINENO(yyless_macro_arg);\
434 		*yy_cp = (yy_hold_char); \
435 		YY_RESTORE_YY_MORE_OFFSET \
436 		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
437 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
438 		} \
439 	while ( 0 )
440 #define unput(c) yyunput( c, (yytext_ptr)  )
441 
442 #ifndef YY_STRUCT_YY_BUFFER_STATE
443 #define YY_STRUCT_YY_BUFFER_STATE
444 struct yy_buffer_state
445 	{
446 	FILE *yy_input_file;
447 
448 	char *yy_ch_buf;		/* input buffer */
449 	char *yy_buf_pos;		/* current position in input buffer */
450 
451 	/* Size of input buffer in bytes, not including room for EOB
452 	 * characters.
453 	 */
454 	int yy_buf_size;
455 
456 	/* Number of characters read into yy_ch_buf, not including EOB
457 	 * characters.
458 	 */
459 	int yy_n_chars;
460 
461 	/* Whether we "own" the buffer - i.e., we know we created it,
462 	 * and can realloc() it to grow it, and should free() it to
463 	 * delete it.
464 	 */
465 	int yy_is_our_buffer;
466 
467 	/* Whether this is an "interactive" input source; if so, and
468 	 * if we're using stdio for input, then we want to use getc()
469 	 * instead of fread(), to make sure we stop fetching input after
470 	 * each newline.
471 	 */
472 	int yy_is_interactive;
473 
474 	/* Whether we're considered to be at the beginning of a line.
475 	 * If so, '^' rules will be active on the next match, otherwise
476 	 * not.
477 	 */
478 	int yy_at_bol;
479 
480     int yy_bs_lineno; /**< The line count. */
481     int yy_bs_column; /**< The column count. */
482 
483 	/* Whether to try to fill the input buffer when we reach the
484 	 * end of it.
485 	 */
486 	int yy_fill_buffer;
487 
488 	int yy_buffer_status;
489 
490 #define YY_BUFFER_NEW 0
491 #define YY_BUFFER_NORMAL 1
492 	/* When an EOF's been seen but there's still some text to process
493 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
494 	 * shouldn't try reading from the input source any more.  We might
495 	 * still have a bunch of tokens to match, though, because of
496 	 * possible backing-up.
497 	 *
498 	 * When we actually see the EOF, we change the status to "new"
499 	 * (via yyrestart()), so that the user can continue scanning by
500 	 * just pointing yyin at a new input file.
501 	 */
502 #define YY_BUFFER_EOF_PENDING 2
503 
504 	};
505 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
506 
507 /* Stack of input buffers. */
508 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
509 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
510 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
511 
512 /* We provide macros for accessing buffer states in case in the
513  * future we want to put the buffer states in a more general
514  * "scanner state".
515  *
516  * Returns the top of the stack, or NULL.
517  */
518 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
519                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
520                           : NULL)
521 /* Same as previous macro, but useful when we know that the buffer stack is not
522  * NULL or when we need an lvalue. For internal use only.
523  */
524 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
525 
526 /* yy_hold_char holds the character lost when yytext is formed. */
527 static char yy_hold_char;
528 static int yy_n_chars;		/* number of characters read into yy_ch_buf */
529 int yyleng;
530 
531 /* Points to current character in buffer. */
532 static char *yy_c_buf_p = NULL;
533 static int yy_init = 0;		/* whether we need to initialize */
534 static int yy_start = 0;	/* start state number */
535 
536 /* Flag which is used to allow yywrap()'s to do buffer switches
537  * instead of setting up a fresh yyin.  A bit of a hack ...
538  */
539 static int yy_did_buffer_switch_on_eof;
540 
541 void yyrestart ( FILE *input_file  );
542 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
543 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
544 void yy_delete_buffer ( YY_BUFFER_STATE b  );
545 void yy_flush_buffer ( YY_BUFFER_STATE b  );
546 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
547 void yypop_buffer_state ( void );
548 
549 static void yyensure_buffer_stack ( void );
550 static void yy_load_buffer_state ( void );
551 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
552 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
553 
554 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
555 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
556 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
557 
558 void *yyalloc ( yy_size_t  );
559 void *yyrealloc ( void *, yy_size_t  );
560 void yyfree ( void *  );
561 
562 #define yy_new_buffer yy_create_buffer
563 #define yy_set_interactive(is_interactive) \
564 	{ \
565 	if ( ! YY_CURRENT_BUFFER ){ \
566         yyensure_buffer_stack (); \
567 		YY_CURRENT_BUFFER_LVALUE =    \
568             yy_create_buffer( yyin, YY_BUF_SIZE ); \
569 	} \
570 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
571 	}
572 #define yy_set_bol(at_bol) \
573 	{ \
574 	if ( ! YY_CURRENT_BUFFER ){\
575         yyensure_buffer_stack (); \
576 		YY_CURRENT_BUFFER_LVALUE =    \
577             yy_create_buffer( yyin, YY_BUF_SIZE ); \
578 	} \
579 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
580 	}
581 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
582 
583 /* Begin user sect3 */
584 
585 #define tpwrap() (/*CONSTCOND*/1)
586 #define YY_SKIP_YYWRAP
587 typedef flex_uint8_t YY_CHAR;
588 
589 FILE *yyin = NULL, *yyout = NULL;
590 
591 typedef int yy_state_type;
592 
593 extern int yylineno;
594 int yylineno = 1;
595 
596 extern char *yytext;
597 #ifdef yytext_ptr
598 #undef yytext_ptr
599 #endif
600 #define yytext_ptr yytext
601 
602 static yy_state_type yy_get_previous_state ( void );
603 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
604 static int yy_get_next_buffer ( void );
605 static void yynoreturn yy_fatal_error ( const char* msg  );
606 
607 /* Done after the current pattern has been matched and before the
608  * corresponding action - sets up yytext.
609  */
610 #define YY_DO_BEFORE_ACTION \
611 	(yytext_ptr) = yy_bp; \
612 	yyleng = (int) (yy_cp - yy_bp); \
613 	(yy_hold_char) = *yy_cp; \
614 	*yy_cp = '\0'; \
615 	(yy_c_buf_p) = yy_cp;
616 #define YY_NUM_RULES 7
617 #define YY_END_OF_BUFFER 8
618 /* This struct is not used in this scanner,
619    but its presence is necessary. */
620 struct yy_trans_info
621 	{
622 	flex_int32_t yy_verify;
623 	flex_int32_t yy_nxt;
624 	};
625 static const flex_int16_t yy_accept[39] =
626     {   0,
627         0,    0,    8,    6,    4,    2,    1,    6,    1,    0,
628         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
629         0,    0,    0,    0,    0,    0,    0,    0,    0,    3,
630         0,    0,    0,    0,    0,    0,    5,    0
631     } ;
632 
633 static const YY_CHAR yy_ec[256] =
634     {   0,
635         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
636         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
637         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
638         1,    2,    1,    1,    4,    1,    1,    1,    1,    1,
639         1,    1,    1,    1,    1,    1,    5,    6,    6,    6,
640         6,    6,    6,    6,    6,    6,    6,    1,    1,    7,
641         1,    8,    1,    1,    9,    9,    9,    9,    9,    9,
642         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
643         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
644         1,    1,    1,    1,    1,    1,   10,   10,   10,   10,
645 
646        11,   10,   12,   10,   13,   10,   14,   10,   10,   15,
647        10,   10,   10,   16,   17,   18,   10,   10,   10,   10,
648        19,   10,    1,    1,    1,    1,    1,    1,    1,    1,
649         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
650         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
651         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
652         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
653         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
654         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
655         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
656 
657         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
658         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
659         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
660         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
661         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
662         1,    1,    1,    1,    1
663     } ;
664 
665 static const YY_CHAR yy_meta[20] =
666     {   0,
667         1,    2,    3,    1,    1,    2,    1,    1,    2,    2,
668         2,    2,    2,    2,    2,    2,    2,    2,    2
669     } ;
670 
671 static const flex_int16_t yy_base[43] =
672     {   0,
673         0,    6,   54,   55,   55,   55,    0,    0,    0,   42,
674        34,   32,   34,   41,   35,    0,   32,   39,   33,   39,
675        35,   28,    0,   30,   33,   20,   11,   30,    4,   55,
676         5,    8,   12,   13,   15,   22,   19,   55,   30,   33,
677         3,   35
678     } ;
679 
680 static const flex_int16_t yy_def[43] =
681     {   0,
682        39,   39,   38,   38,   38,   38,   40,   38,   40,   38,
683        38,   38,   38,   38,   38,   41,   38,   41,   38,   38,
684        38,   38,   42,   38,   42,   38,   42,   38,   42,   38,
685        42,   42,   42,   42,   42,   42,   42,    0,   38,   38,
686        38,   38
687     } ;
688 
689 static const flex_int16_t yy_nxt[75] =
690     {   0,
691        38,    5,    6,    7,   18,   38,    8,    5,    6,    7,
692        27,   27,    8,   10,   27,   29,   11,   27,   27,   27,
693        31,   27,   32,   33,   34,   27,   36,   35,   27,   37,
694         4,    4,    4,    9,    9,   25,   25,   30,   28,   27,
695        26,   24,   23,   22,   21,   20,   19,   17,   16,   15,
696        14,   13,   12,   38,    3,   38,   38,   38,   38,   38,
697        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
698        38,   38,   38,   38
699     } ;
700 
701 static const flex_int16_t yy_chk[75] =
702     {   0,
703         0,    1,    1,    1,   41,    0,    1,    2,    2,    2,
704        29,   31,    2,    8,   32,   27,    8,   27,   33,   34,
705        29,   35,   31,   32,   33,   37,   35,   34,   36,   36,
706        39,   39,   39,   40,   40,   42,   42,   28,   26,   25,
707        24,   22,   21,   20,   19,   18,   17,   15,   14,   13,
708        12,   11,   10,    3,   38,   38,   38,   38,   38,   38,
709        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
710        38,   38,   38,   38
711     } ;
712 
713 static yy_state_type yy_last_accepting_state;
714 static char *yy_last_accepting_cpos;
715 
716 extern int yy_flex_debug;
717 int yy_flex_debug = 0;
718 
719 /* The intent behind this definition is that it'll catch
720  * any uses of REJECT which flex missed.
721  */
722 #define REJECT reject_used_but_not_detected
723 #define yymore() yymore_used_but_not_detected
724 #define YY_MORE_ADJ 0
725 #define YY_RESTORE_YY_MORE_OFFSET
726 char *yytext;
727 #line 1 "tokenparser.l"
728 /*
729  * Reads lexical config files and updates database.
730  *
731  * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
732  *
733  * Copyright (C) 2001-2003
734  *  David Corcoran <corcoran@musclecard.com>
735  * Copyright (C) 2003-2010
736  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
737  *
738 Redistribution and use in source and binary forms, with or without
739 modification, are permitted provided that the following conditions
740 are met:
741 
742 1. Redistributions of source code must retain the above copyright
743    notice, this list of conditions and the following disclaimer.
744 2. Redistributions in binary form must reproduce the above copyright
745    notice, this list of conditions and the following disclaimer in the
746    documentation and/or other materials provided with the distribution.
747 3. The name of the author may not be used to endorse or promote products
748    derived from this software without specific prior written permission.
749 
750 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
751 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
752 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
753 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
754 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
755 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
756 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
757 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
758 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
759 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
760  */
761 /**
762  * @file
763  * @brief provides parsing functions for Info.plist files
764  * platforms
765  */
766 #line 42 "tokenparser.l"
767 
768 #include "config.h"
769 #include <stdio.h>
770 #include <string.h>
771 #include <errno.h>
772 #ifndef NDEBUG
773 #define NDEBUG
774 #endif
775 #include <assert.h>
776 
777 #include "simclist.h"
778 #include "debuglog.h"
779 #include "parser.h"
780 
781 static void eval_key(char *pcToken, list_t *list_key);
782 static void eval_value(char *pcToken, list_t *list_values);
783 void tperrorCheck (char *pcToken_error);
784 
785 static list_t *ListKeys;
786 static list_t *ListValues;
787 
788 #line 789 "tokenparser.c"
789 #define YY_NO_INPUT 1
790 #line 791 "tokenparser.c"
791 
792 #define INITIAL 0
793 
794 #ifndef YY_NO_UNISTD_H
795 /* Special case for "unistd.h", since it is non-ANSI. We include it way
796  * down here because we want the user's section 1 to have been scanned first.
797  * The user has a chance to override it with an option.
798  */
799 #include <unistd.h>
800 #endif
801 
802 #ifndef YY_EXTRA_TYPE
803 #define YY_EXTRA_TYPE void *
804 #endif
805 
806 static int yy_init_globals ( void );
807 
808 /* Accessor methods to globals.
809    These are made visible to non-reentrant scanners for convenience. */
810 
811 int yylex_destroy ( void );
812 
813 int yyget_debug ( void );
814 
815 void yyset_debug ( int debug_flag  );
816 
817 YY_EXTRA_TYPE yyget_extra ( void );
818 
819 void yyset_extra ( YY_EXTRA_TYPE user_defined  );
820 
821 FILE *yyget_in ( void );
822 
823 void yyset_in  ( FILE * _in_str  );
824 
825 FILE *yyget_out ( void );
826 
827 void yyset_out  ( FILE * _out_str  );
828 
829 			int yyget_leng ( void );
830 
831 char *yyget_text ( void );
832 
833 int yyget_lineno ( void );
834 
835 void yyset_lineno ( int _line_number  );
836 
837 /* Macros after this point can all be overridden by user definitions in
838  * section 1.
839  */
840 
841 #ifndef YY_SKIP_YYWRAP
842 #ifdef __cplusplus
843 extern "C" int yywrap ( void );
844 #else
845 extern int yywrap ( void );
846 #endif
847 #endif
848 
849 #ifndef YY_NO_UNPUT
850 
851 #endif
852 
853 #ifndef yytext_ptr
854 static void yy_flex_strncpy ( char *, const char *, int );
855 #endif
856 
857 #ifdef YY_NEED_STRLEN
858 static int yy_flex_strlen ( const char * );
859 #endif
860 
861 #ifndef YY_NO_INPUT
862 #ifdef __cplusplus
863 static int yyinput ( void );
864 #else
865 static int input ( void );
866 #endif
867 
868 #endif
869 
870 /* Amount of stuff to slurp up with each read. */
871 #ifndef YY_READ_BUF_SIZE
872 #ifdef __ia64__
873 /* On IA-64, the buffer size is 16k, not 8k */
874 #define YY_READ_BUF_SIZE 16384
875 #else
876 #define YY_READ_BUF_SIZE 8192
877 #endif /* __ia64__ */
878 #endif
879 
880 /* Copy whatever the last rule matched to the standard output. */
881 #ifndef ECHO
882 /* This used to be an fputs(), but since the string might contain NUL's,
883  * we now use fwrite().
884  */
885 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
886 #endif
887 
888 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
889  * is returned in "result".
890  */
891 #ifndef YY_INPUT
892 #define YY_INPUT(buf,result,max_size) \
893 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
894 		{ \
895 		int c = '*'; \
896 		int n; \
897 		for ( n = 0; n < max_size && \
898 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
899 			buf[n] = (char) c; \
900 		if ( c == '\n' ) \
901 			buf[n++] = (char) c; \
902 		if ( c == EOF && ferror( yyin ) ) \
903 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
904 		result = n; \
905 		} \
906 	else \
907 		{ \
908 		errno=0; \
909 		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
910 			{ \
911 			if( errno != EINTR) \
912 				{ \
913 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
914 				break; \
915 				} \
916 			errno=0; \
917 			clearerr(yyin); \
918 			} \
919 		}\
920 \
921 
922 #endif
923 
924 /* No semi-colon after return; correct usage is to write "yyterminate();" -
925  * we don't want an extra ';' after the "return" because that will cause
926  * some compilers to complain about unreachable statements.
927  */
928 #ifndef yyterminate
929 #define yyterminate() return YY_NULL
930 #endif
931 
932 /* Number of entries by which start-condition stack grows. */
933 #ifndef YY_START_STACK_INCR
934 #define YY_START_STACK_INCR 25
935 #endif
936 
937 /* Report a fatal error. */
938 #ifndef YY_FATAL_ERROR
939 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
940 #endif
941 
942 /* end tables serialization structures and prototypes */
943 
944 /* Default declaration of generated scanner - a define so the user can
945  * easily add parameters.
946  */
947 #ifndef YY_DECL
948 #define YY_DECL_IS_OURS 1
949 
950 extern int yylex (void);
951 
952 #define YY_DECL int yylex (void)
953 #endif /* !YY_DECL */
954 
955 /* Code executed at the beginning of each rule, after yytext and yyleng
956  * have been set up.
957  */
958 #ifndef YY_USER_ACTION
959 #define YY_USER_ACTION
960 #endif
961 
962 /* Code executed at the end of each rule. */
963 #ifndef YY_BREAK
964 #define YY_BREAK /*LINTED*/break;
965 #endif
966 
967 #define YY_RULE_SETUP \
968 	YY_USER_ACTION
969 
970 /** The main scanner function which does all the work.
971  */
972 YY_DECL
973 {
974 	yy_state_type yy_current_state;
975 	char *yy_cp, *yy_bp;
976 	int yy_act;
977 
978 	if ( !(yy_init) )
979 		{
980 		(yy_init) = 1;
981 
982 #ifdef YY_USER_INIT
983 		YY_USER_INIT;
984 #endif
985 
986 		if ( ! (yy_start) )
987 			(yy_start) = 1;	/* first start state */
988 
989 		if ( ! yyin )
990 			yyin = stdin;
991 
992 		if ( ! yyout )
993 			yyout = stdout;
994 
995 		if ( ! YY_CURRENT_BUFFER ) {
996 			yyensure_buffer_stack ();
997 			YY_CURRENT_BUFFER_LVALUE =
998 				yy_create_buffer( yyin, YY_BUF_SIZE );
999 		}
1000 
1001 		yy_load_buffer_state(  );
1002 		}
1003 
1004 	{
1005 #line 69 "tokenparser.l"
1006 
1007 
1008 #line 1009 "tokenparser.c"
1009 
1010 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
1011 		{
1012 		yy_cp = (yy_c_buf_p);
1013 
1014 		/* Support of yytext. */
1015 		*yy_cp = (yy_hold_char);
1016 
1017 		/* yy_bp points to the position in yy_ch_buf of the start of
1018 		 * the current run.
1019 		 */
1020 		yy_bp = yy_cp;
1021 
1022 		yy_current_state = (yy_start);
1023 yy_match:
1024 		do
1025 			{
1026 			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1027 			if ( yy_accept[yy_current_state] )
1028 				{
1029 				(yy_last_accepting_state) = yy_current_state;
1030 				(yy_last_accepting_cpos) = yy_cp;
1031 				}
1032 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1033 				{
1034 				yy_current_state = (int) yy_def[yy_current_state];
1035 				if ( yy_current_state >= 39 )
1036 					yy_c = yy_meta[yy_c];
1037 				}
1038 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1039 			++yy_cp;
1040 			}
1041 		while ( yy_base[yy_current_state] != 55 );
1042 
1043 yy_find_action:
1044 		yy_act = yy_accept[yy_current_state];
1045 		if ( yy_act == 0 )
1046 			{ /* have to back up */
1047 			yy_cp = (yy_last_accepting_cpos);
1048 			yy_current_state = (yy_last_accepting_state);
1049 			yy_act = yy_accept[yy_current_state];
1050 			}
1051 
1052 		YY_DO_BEFORE_ACTION;
1053 
1054 do_action:	/* This label is used only to access EOF actions. */
1055 
1056 		switch ( yy_act )
1057 	{ /* beginning of action switch */
1058 			case 0: /* must back up */
1059 			/* undo the effects of YY_DO_BEFORE_ACTION */
1060 			*yy_cp = (yy_hold_char);
1061 			yy_cp = (yy_last_accepting_cpos);
1062 			yy_current_state = (yy_last_accepting_state);
1063 			goto yy_find_action;
1064 
1065 case 1:
1066 YY_RULE_SETUP
1067 #line 71 "tokenparser.l"
1068 {}
1069 	YY_BREAK
1070 case 2:
1071 /* rule 2 can match eol */
1072 YY_RULE_SETUP
1073 #line 72 "tokenparser.l"
1074 {}
1075 	YY_BREAK
1076 case 3:
1077 YY_RULE_SETUP
1078 #line 73 "tokenparser.l"
1079 { eval_key(yytext, ListKeys); }
1080 	YY_BREAK
1081 case 4:
1082 YY_RULE_SETUP
1083 #line 74 "tokenparser.l"
1084 {}
1085 	YY_BREAK
1086 case 5:
1087 YY_RULE_SETUP
1088 #line 75 "tokenparser.l"
1089 { eval_value(yytext, ListValues); }
1090 	YY_BREAK
1091 case 6:
1092 YY_RULE_SETUP
1093 #line 76 "tokenparser.l"
1094 { tperrorCheck(yytext); }
1095 	YY_BREAK
1096 case 7:
1097 YY_RULE_SETUP
1098 #line 77 "tokenparser.l"
1099 ECHO;
1100 	YY_BREAK
1101 #line 1102 "tokenparser.c"
1102 case YY_STATE_EOF(INITIAL):
1103 	yyterminate();
1104 
1105 	case YY_END_OF_BUFFER:
1106 		{
1107 		/* Amount of text matched not including the EOB char. */
1108 		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1109 
1110 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1111 		*yy_cp = (yy_hold_char);
1112 		YY_RESTORE_YY_MORE_OFFSET
1113 
1114 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1115 			{
1116 			/* We're scanning a new file or input source.  It's
1117 			 * possible that this happened because the user
1118 			 * just pointed yyin at a new source and called
1119 			 * yylex().  If so, then we have to assure
1120 			 * consistency between YY_CURRENT_BUFFER and our
1121 			 * globals.  Here is the right place to do so, because
1122 			 * this is the first action (other than possibly a
1123 			 * back-up) that will match for the new input source.
1124 			 */
1125 			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1126 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1127 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1128 			}
1129 
1130 		/* Note that here we test for yy_c_buf_p "<=" to the position
1131 		 * of the first EOB in the buffer, since yy_c_buf_p will
1132 		 * already have been incremented past the NUL character
1133 		 * (since all states make transitions on EOB to the
1134 		 * end-of-buffer state).  Contrast this with the test
1135 		 * in input().
1136 		 */
1137 		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1138 			{ /* This was really a NUL. */
1139 			yy_state_type yy_next_state;
1140 
1141 			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1142 
1143 			yy_current_state = yy_get_previous_state(  );
1144 
1145 			/* Okay, we're now positioned to make the NUL
1146 			 * transition.  We couldn't have
1147 			 * yy_get_previous_state() go ahead and do it
1148 			 * for us because it doesn't know how to deal
1149 			 * with the possibility of jamming (and we don't
1150 			 * want to build jamming into it because then it
1151 			 * will run more slowly).
1152 			 */
1153 
1154 			yy_next_state = yy_try_NUL_trans( yy_current_state );
1155 
1156 			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1157 
1158 			if ( yy_next_state )
1159 				{
1160 				/* Consume the NUL. */
1161 				yy_cp = ++(yy_c_buf_p);
1162 				yy_current_state = yy_next_state;
1163 				goto yy_match;
1164 				}
1165 
1166 			else
1167 				{
1168 				yy_cp = (yy_c_buf_p);
1169 				goto yy_find_action;
1170 				}
1171 			}
1172 
1173 		else switch ( yy_get_next_buffer(  ) )
1174 			{
1175 			case EOB_ACT_END_OF_FILE:
1176 				{
1177 				(yy_did_buffer_switch_on_eof) = 0;
1178 
1179 				if ( yywrap(  ) )
1180 					{
1181 					/* Note: because we've taken care in
1182 					 * yy_get_next_buffer() to have set up
1183 					 * yytext, we can now set up
1184 					 * yy_c_buf_p so that if some total
1185 					 * hoser (like flex itself) wants to
1186 					 * call the scanner after we return the
1187 					 * YY_NULL, it'll still work - another
1188 					 * YY_NULL will get returned.
1189 					 */
1190 					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1191 
1192 					yy_act = YY_STATE_EOF(YY_START);
1193 					goto do_action;
1194 					}
1195 
1196 				else
1197 					{
1198 					if ( ! (yy_did_buffer_switch_on_eof) )
1199 						YY_NEW_FILE;
1200 					}
1201 				break;
1202 				}
1203 
1204 			case EOB_ACT_CONTINUE_SCAN:
1205 				(yy_c_buf_p) =
1206 					(yytext_ptr) + yy_amount_of_matched_text;
1207 
1208 				yy_current_state = yy_get_previous_state(  );
1209 
1210 				yy_cp = (yy_c_buf_p);
1211 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1212 				goto yy_match;
1213 
1214 			case EOB_ACT_LAST_MATCH:
1215 				(yy_c_buf_p) =
1216 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1217 
1218 				yy_current_state = yy_get_previous_state(  );
1219 
1220 				yy_cp = (yy_c_buf_p);
1221 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1222 				goto yy_find_action;
1223 			}
1224 		break;
1225 		}
1226 
1227 	default:
1228 		YY_FATAL_ERROR(
1229 			"fatal flex scanner internal error--no action found" );
1230 	} /* end of action switch */
1231 		} /* end of scanning one token */
1232 	} /* end of user's declarations */
1233 } /* end of yylex */
1234 
1235 /* yy_get_next_buffer - try to read in a new buffer
1236  *
1237  * Returns a code representing an action:
1238  *	EOB_ACT_LAST_MATCH -
1239  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1240  *	EOB_ACT_END_OF_FILE - end of file
1241  */
1242 static int yy_get_next_buffer (void)
1243 {
1244     	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1245 	char *source = (yytext_ptr);
1246 	int number_to_move, i;
1247 	int ret_val;
1248 
1249 	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1250 		YY_FATAL_ERROR(
1251 		"fatal flex scanner internal error--end of buffer missed" );
1252 
1253 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1254 		{ /* Don't try to fill the buffer, so this is an EOF. */
1255 		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1256 			{
1257 			/* We matched a single character, the EOB, so
1258 			 * treat this as a final EOF.
1259 			 */
1260 			return EOB_ACT_END_OF_FILE;
1261 			}
1262 
1263 		else
1264 			{
1265 			/* We matched some text prior to the EOB, first
1266 			 * process it.
1267 			 */
1268 			return EOB_ACT_LAST_MATCH;
1269 			}
1270 		}
1271 
1272 	/* Try to read more data. */
1273 
1274 	/* First move last chars to start of buffer. */
1275 	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1276 
1277 	for ( i = 0; i < number_to_move; ++i )
1278 		*(dest++) = *(source++);
1279 
1280 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1281 		/* don't do the read, it's not guaranteed to return an EOF,
1282 		 * just force an EOF
1283 		 */
1284 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1285 
1286 	else
1287 		{
1288 			int num_to_read =
1289 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1290 
1291 		while ( num_to_read <= 0 )
1292 			{ /* Not enough room in the buffer - grow it. */
1293 
1294 			/* just a shorter name for the current buffer */
1295 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1296 
1297 			int yy_c_buf_p_offset =
1298 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
1299 
1300 			if ( b->yy_is_our_buffer )
1301 				{
1302 				int new_size = b->yy_buf_size * 2;
1303 
1304 				if ( new_size <= 0 )
1305 					b->yy_buf_size += b->yy_buf_size / 8;
1306 				else
1307 					b->yy_buf_size *= 2;
1308 
1309 				b->yy_ch_buf = (char *)
1310 					/* Include room in for 2 EOB chars. */
1311 					yyrealloc( (void *) b->yy_ch_buf,
1312 							 (yy_size_t) (b->yy_buf_size + 2)  );
1313 				}
1314 			else
1315 				/* Can't grow it, we don't own it. */
1316 				b->yy_ch_buf = NULL;
1317 
1318 			if ( ! b->yy_ch_buf )
1319 				YY_FATAL_ERROR(
1320 				"fatal error - scanner input buffer overflow" );
1321 
1322 			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1323 
1324 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1325 						number_to_move - 1;
1326 
1327 			}
1328 
1329 		if ( num_to_read > YY_READ_BUF_SIZE )
1330 			num_to_read = YY_READ_BUF_SIZE;
1331 
1332 		/* Read in more data. */
1333 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1334 			(yy_n_chars), num_to_read );
1335 
1336 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1337 		}
1338 
1339 	if ( (yy_n_chars) == 0 )
1340 		{
1341 		if ( number_to_move == YY_MORE_ADJ )
1342 			{
1343 			ret_val = EOB_ACT_END_OF_FILE;
1344 			yyrestart( yyin  );
1345 			}
1346 
1347 		else
1348 			{
1349 			ret_val = EOB_ACT_LAST_MATCH;
1350 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1351 				YY_BUFFER_EOF_PENDING;
1352 			}
1353 		}
1354 
1355 	else
1356 		ret_val = EOB_ACT_CONTINUE_SCAN;
1357 
1358 	if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1359 		/* Extend the array by 50%, plus the number we really need. */
1360 		int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1361 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1362 			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
1363 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1364 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1365 		/* "- 2" to take care of EOB's */
1366 		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1367 	}
1368 
1369 	(yy_n_chars) += number_to_move;
1370 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1371 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1372 
1373 	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1374 
1375 	return ret_val;
1376 }
1377 
1378 /* yy_get_previous_state - get the state just before the EOB char was reached */
1379 
1380     static yy_state_type yy_get_previous_state (void)
1381 {
1382 	yy_state_type yy_current_state;
1383 	char *yy_cp;
1384 
1385 	yy_current_state = (yy_start);
1386 
1387 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1388 		{
1389 		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1390 		if ( yy_accept[yy_current_state] )
1391 			{
1392 			(yy_last_accepting_state) = yy_current_state;
1393 			(yy_last_accepting_cpos) = yy_cp;
1394 			}
1395 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1396 			{
1397 			yy_current_state = (int) yy_def[yy_current_state];
1398 			if ( yy_current_state >= 39 )
1399 				yy_c = yy_meta[yy_c];
1400 			}
1401 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1402 		}
1403 
1404 	return yy_current_state;
1405 }
1406 
1407 /* yy_try_NUL_trans - try to make a transition on the NUL character
1408  *
1409  * synopsis
1410  *	next_state = yy_try_NUL_trans( current_state );
1411  */
1412     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1413 {
1414 	int yy_is_jam;
1415     	char *yy_cp = (yy_c_buf_p);
1416 
1417 	YY_CHAR yy_c = 1;
1418 	if ( yy_accept[yy_current_state] )
1419 		{
1420 		(yy_last_accepting_state) = yy_current_state;
1421 		(yy_last_accepting_cpos) = yy_cp;
1422 		}
1423 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1424 		{
1425 		yy_current_state = (int) yy_def[yy_current_state];
1426 		if ( yy_current_state >= 39 )
1427 			yy_c = yy_meta[yy_c];
1428 		}
1429 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1430 	yy_is_jam = (yy_current_state == 38);
1431 
1432 		return yy_is_jam ? 0 : yy_current_state;
1433 }
1434 
1435 #ifndef YY_NO_UNPUT
1436 
1437 #endif
1438 
1439 #ifndef YY_NO_INPUT
1440 #ifdef __cplusplus
1441     static int yyinput (void)
1442 #else
1443     static int input  (void)
1444 #endif
1445 
1446 {
1447 	int c;
1448 
1449 	*(yy_c_buf_p) = (yy_hold_char);
1450 
1451 	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1452 		{
1453 		/* yy_c_buf_p now points to the character we want to return.
1454 		 * If this occurs *before* the EOB characters, then it's a
1455 		 * valid NUL; if not, then we've hit the end of the buffer.
1456 		 */
1457 		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1458 			/* This was really a NUL. */
1459 			*(yy_c_buf_p) = '\0';
1460 
1461 		else
1462 			{ /* need more input */
1463 			int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1464 			++(yy_c_buf_p);
1465 
1466 			switch ( yy_get_next_buffer(  ) )
1467 				{
1468 				case EOB_ACT_LAST_MATCH:
1469 					/* This happens because yy_g_n_b()
1470 					 * sees that we've accumulated a
1471 					 * token and flags that we need to
1472 					 * try matching the token before
1473 					 * proceeding.  But for input(),
1474 					 * there's no matching to consider.
1475 					 * So convert the EOB_ACT_LAST_MATCH
1476 					 * to EOB_ACT_END_OF_FILE.
1477 					 */
1478 
1479 					/* Reset buffer status. */
1480 					yyrestart( yyin );
1481 
1482 					/*FALLTHROUGH*/
1483 
1484 				case EOB_ACT_END_OF_FILE:
1485 					{
1486 					if ( yywrap(  ) )
1487 						return 0;
1488 
1489 					if ( ! (yy_did_buffer_switch_on_eof) )
1490 						YY_NEW_FILE;
1491 #ifdef __cplusplus
1492 					return yyinput();
1493 #else
1494 					return input();
1495 #endif
1496 					}
1497 
1498 				case EOB_ACT_CONTINUE_SCAN:
1499 					(yy_c_buf_p) = (yytext_ptr) + offset;
1500 					break;
1501 				}
1502 			}
1503 		}
1504 
1505 	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
1506 	*(yy_c_buf_p) = '\0';	/* preserve yytext */
1507 	(yy_hold_char) = *++(yy_c_buf_p);
1508 
1509 	return c;
1510 }
1511 #endif	/* ifndef YY_NO_INPUT */
1512 
1513 /** Immediately switch to a different input stream.
1514  * @param input_file A readable stream.
1515  *
1516  * @note This function does not reset the start condition to @c INITIAL .
1517  */
1518     void yyrestart  (FILE * input_file )
1519 {
1520 
1521 	if ( ! YY_CURRENT_BUFFER ){
1522         yyensure_buffer_stack ();
1523 		YY_CURRENT_BUFFER_LVALUE =
1524             yy_create_buffer( yyin, YY_BUF_SIZE );
1525 	}
1526 
1527 	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1528 	yy_load_buffer_state(  );
1529 }
1530 
1531 /** Switch to a different input buffer.
1532  * @param new_buffer The new input buffer.
1533  *
1534  */
1535     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1536 {
1537 
1538 	/* TODO. We should be able to replace this entire function body
1539 	 * with
1540 	 *		yypop_buffer_state();
1541 	 *		yypush_buffer_state(new_buffer);
1542      */
1543 	yyensure_buffer_stack ();
1544 	if ( YY_CURRENT_BUFFER == new_buffer )
1545 		return;
1546 
1547 	if ( YY_CURRENT_BUFFER )
1548 		{
1549 		/* Flush out information for old buffer. */
1550 		*(yy_c_buf_p) = (yy_hold_char);
1551 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1552 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1553 		}
1554 
1555 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1556 	yy_load_buffer_state(  );
1557 
1558 	/* We don't actually know whether we did this switch during
1559 	 * EOF (yywrap()) processing, but the only time this flag
1560 	 * is looked at is after yywrap() is called, so it's safe
1561 	 * to go ahead and always set it.
1562 	 */
1563 	(yy_did_buffer_switch_on_eof) = 1;
1564 }
1565 
1566 static void yy_load_buffer_state  (void)
1567 {
1568     	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1569 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1570 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1571 	(yy_hold_char) = *(yy_c_buf_p);
1572 }
1573 
1574 /** Allocate and initialize an input buffer state.
1575  * @param file A readable stream.
1576  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1577  *
1578  * @return the allocated buffer state.
1579  */
1580     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1581 {
1582 	YY_BUFFER_STATE b;
1583 
1584 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
1585 	if ( ! b )
1586 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1587 
1588 	b->yy_buf_size = size;
1589 
1590 	/* yy_ch_buf has to be 2 characters longer than the size given because
1591 	 * we need to put in 2 end-of-buffer characters.
1592 	 */
1593 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
1594 	if ( ! b->yy_ch_buf )
1595 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1596 
1597 	b->yy_is_our_buffer = 1;
1598 
1599 	yy_init_buffer( b, file );
1600 
1601 	return b;
1602 }
1603 
1604 /** Destroy the buffer.
1605  * @param b a buffer created with yy_create_buffer()
1606  *
1607  */
1608     void yy_delete_buffer (YY_BUFFER_STATE  b )
1609 {
1610 
1611 	if ( ! b )
1612 		return;
1613 
1614 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1615 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1616 
1617 	if ( b->yy_is_our_buffer )
1618 		yyfree( (void *) b->yy_ch_buf  );
1619 
1620 	yyfree( (void *) b  );
1621 }
1622 
1623 /* Initializes or reinitializes a buffer.
1624  * This function is sometimes called more than once on the same buffer,
1625  * such as during a yyrestart() or at EOF.
1626  */
1627     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1628 
1629 {
1630 	int oerrno = errno;
1631 
1632 	yy_flush_buffer( b );
1633 
1634 	b->yy_input_file = file;
1635 	b->yy_fill_buffer = 1;
1636 
1637     /* If b is the current buffer, then yy_init_buffer was _probably_
1638      * called from yyrestart() or through yy_get_next_buffer.
1639      * In that case, we don't want to reset the lineno or column.
1640      */
1641     if (b != YY_CURRENT_BUFFER){
1642         b->yy_bs_lineno = 1;
1643         b->yy_bs_column = 0;
1644     }
1645 
1646         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1647 
1648 	errno = oerrno;
1649 }
1650 
1651 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1652  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1653  *
1654  */
1655     void yy_flush_buffer (YY_BUFFER_STATE  b )
1656 {
1657     	if ( ! b )
1658 		return;
1659 
1660 	b->yy_n_chars = 0;
1661 
1662 	/* We always need two end-of-buffer characters.  The first causes
1663 	 * a transition to the end-of-buffer state.  The second causes
1664 	 * a jam in that state.
1665 	 */
1666 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1667 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1668 
1669 	b->yy_buf_pos = &b->yy_ch_buf[0];
1670 
1671 	b->yy_at_bol = 1;
1672 	b->yy_buffer_status = YY_BUFFER_NEW;
1673 
1674 	if ( b == YY_CURRENT_BUFFER )
1675 		yy_load_buffer_state(  );
1676 }
1677 
1678 /** Pushes the new state onto the stack. The new state becomes
1679  *  the current state. This function will allocate the stack
1680  *  if necessary.
1681  *  @param new_buffer The new state.
1682  *
1683  */
1684 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1685 {
1686     	if (new_buffer == NULL)
1687 		return;
1688 
1689 	yyensure_buffer_stack();
1690 
1691 	/* This block is copied from yy_switch_to_buffer. */
1692 	if ( YY_CURRENT_BUFFER )
1693 		{
1694 		/* Flush out information for old buffer. */
1695 		*(yy_c_buf_p) = (yy_hold_char);
1696 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1697 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1698 		}
1699 
1700 	/* Only push if top exists. Otherwise, replace top. */
1701 	if (YY_CURRENT_BUFFER)
1702 		(yy_buffer_stack_top)++;
1703 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1704 
1705 	/* copied from yy_switch_to_buffer. */
1706 	yy_load_buffer_state(  );
1707 	(yy_did_buffer_switch_on_eof) = 1;
1708 }
1709 
1710 /** Removes and deletes the top of the stack, if present.
1711  *  The next element becomes the new top.
1712  *
1713  */
1714 void yypop_buffer_state (void)
1715 {
1716     	if (!YY_CURRENT_BUFFER)
1717 		return;
1718 
1719 	yy_delete_buffer(YY_CURRENT_BUFFER );
1720 	YY_CURRENT_BUFFER_LVALUE = NULL;
1721 	if ((yy_buffer_stack_top) > 0)
1722 		--(yy_buffer_stack_top);
1723 
1724 	if (YY_CURRENT_BUFFER) {
1725 		yy_load_buffer_state(  );
1726 		(yy_did_buffer_switch_on_eof) = 1;
1727 	}
1728 }
1729 
1730 /* Allocates the stack if it does not exist.
1731  *  Guarantees space for at least one push.
1732  */
1733 static void yyensure_buffer_stack (void)
1734 {
1735 	yy_size_t num_to_alloc;
1736 
1737 	if (!(yy_buffer_stack)) {
1738 
1739 		/* First allocation is just for 2 elements, since we don't know if this
1740 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1741 		 * immediate realloc on the next call.
1742          */
1743       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1744 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1745 								(num_to_alloc * sizeof(struct yy_buffer_state*)
1746 								);
1747 		if ( ! (yy_buffer_stack) )
1748 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1749 
1750 		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1751 
1752 		(yy_buffer_stack_max) = num_to_alloc;
1753 		(yy_buffer_stack_top) = 0;
1754 		return;
1755 	}
1756 
1757 	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1758 
1759 		/* Increase the buffer to prepare for a possible push. */
1760 		yy_size_t grow_size = 8 /* arbitrary grow size */;
1761 
1762 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
1763 		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1764 								((yy_buffer_stack),
1765 								num_to_alloc * sizeof(struct yy_buffer_state*)
1766 								);
1767 		if ( ! (yy_buffer_stack) )
1768 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1769 
1770 		/* zero only the new slots.*/
1771 		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1772 		(yy_buffer_stack_max) = num_to_alloc;
1773 	}
1774 }
1775 
1776 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1777  * @param base the character buffer
1778  * @param size the size in bytes of the character buffer
1779  *
1780  * @return the newly allocated buffer state object.
1781  */
1782 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1783 {
1784 	YY_BUFFER_STATE b;
1785 
1786 	if ( size < 2 ||
1787 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
1788 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
1789 		/* They forgot to leave room for the EOB's. */
1790 		return NULL;
1791 
1792 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
1793 	if ( ! b )
1794 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1795 
1796 	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
1797 	b->yy_buf_pos = b->yy_ch_buf = base;
1798 	b->yy_is_our_buffer = 0;
1799 	b->yy_input_file = NULL;
1800 	b->yy_n_chars = b->yy_buf_size;
1801 	b->yy_is_interactive = 0;
1802 	b->yy_at_bol = 1;
1803 	b->yy_fill_buffer = 0;
1804 	b->yy_buffer_status = YY_BUFFER_NEW;
1805 
1806 	yy_switch_to_buffer( b  );
1807 
1808 	return b;
1809 }
1810 
1811 /** Setup the input buffer state to scan a string. The next call to yylex() will
1812  * scan from a @e copy of @a str.
1813  * @param yystr a NUL-terminated string to scan
1814  *
1815  * @return the newly allocated buffer state object.
1816  * @note If you want to scan bytes that may contain NUL values, then use
1817  *       yy_scan_bytes() instead.
1818  */
1819 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1820 {
1821 
1822 	return yy_scan_bytes( yystr, (int) strlen(yystr) );
1823 }
1824 
1825 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1826  * scan from a @e copy of @a bytes.
1827  * @param yybytes the byte buffer to scan
1828  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1829  *
1830  * @return the newly allocated buffer state object.
1831  */
1832 YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
1833 {
1834 	YY_BUFFER_STATE b;
1835 	char *buf;
1836 	yy_size_t n;
1837 	int i;
1838 
1839 	/* Get memory for full buffer, including space for trailing EOB's. */
1840 	n = (yy_size_t) (_yybytes_len + 2);
1841 	buf = (char *) yyalloc( n  );
1842 	if ( ! buf )
1843 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1844 
1845 	for ( i = 0; i < _yybytes_len; ++i )
1846 		buf[i] = yybytes[i];
1847 
1848 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1849 
1850 	b = yy_scan_buffer( buf, n );
1851 	if ( ! b )
1852 		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1853 
1854 	/* It's okay to grow etc. this buffer, and we should throw it
1855 	 * away when we're done.
1856 	 */
1857 	b->yy_is_our_buffer = 1;
1858 
1859 	return b;
1860 }
1861 
1862 #ifndef YY_EXIT_FAILURE
1863 #define YY_EXIT_FAILURE 2
1864 #endif
1865 
1866 static void yynoreturn yy_fatal_error (const char* msg )
1867 {
1868 			fprintf( stderr, "%s\n", msg );
1869 	exit( YY_EXIT_FAILURE );
1870 }
1871 
1872 /* Redefine yyless() so it works in section 3 code. */
1873 
1874 #undef yyless
1875 #define yyless(n) \
1876 	do \
1877 		{ \
1878 		/* Undo effects of setting up yytext. */ \
1879         int yyless_macro_arg = (n); \
1880         YY_LESS_LINENO(yyless_macro_arg);\
1881 		yytext[yyleng] = (yy_hold_char); \
1882 		(yy_c_buf_p) = yytext + yyless_macro_arg; \
1883 		(yy_hold_char) = *(yy_c_buf_p); \
1884 		*(yy_c_buf_p) = '\0'; \
1885 		yyleng = yyless_macro_arg; \
1886 		} \
1887 	while ( 0 )
1888 
1889 /* Accessor  methods (get/set functions) to struct members. */
1890 
1891 /** Get the current line number.
1892  *
1893  */
1894 int yyget_lineno  (void)
1895 {
1896 
1897     return yylineno;
1898 }
1899 
1900 /** Get the input stream.
1901  *
1902  */
1903 FILE *yyget_in  (void)
1904 {
1905         return yyin;
1906 }
1907 
1908 /** Get the output stream.
1909  *
1910  */
1911 FILE *yyget_out  (void)
1912 {
1913         return yyout;
1914 }
1915 
1916 /** Get the length of the current token.
1917  *
1918  */
1919 int yyget_leng  (void)
1920 {
1921         return yyleng;
1922 }
1923 
1924 /** Get the current token.
1925  *
1926  */
1927 
1928 char *yyget_text  (void)
1929 {
1930         return yytext;
1931 }
1932 
1933 /** Set the current line number.
1934  * @param _line_number line number
1935  *
1936  */
1937 void yyset_lineno (int  _line_number )
1938 {
1939 
1940     yylineno = _line_number;
1941 }
1942 
1943 /** Set the input stream. This does not discard the current
1944  * input buffer.
1945  * @param _in_str A readable stream.
1946  *
1947  * @see yy_switch_to_buffer
1948  */
1949 void yyset_in (FILE *  _in_str )
1950 {
1951         yyin = _in_str ;
1952 }
1953 
1954 void yyset_out (FILE *  _out_str )
1955 {
1956         yyout = _out_str ;
1957 }
1958 
1959 int yyget_debug  (void)
1960 {
1961         return yy_flex_debug;
1962 }
1963 
1964 void yyset_debug (int  _bdebug )
1965 {
1966         yy_flex_debug = _bdebug ;
1967 }
1968 
1969 static int yy_init_globals (void)
1970 {
1971         /* Initialization is the same as for the non-reentrant scanner.
1972      * This function is called from yylex_destroy(), so don't allocate here.
1973      */
1974 
1975     (yy_buffer_stack) = NULL;
1976     (yy_buffer_stack_top) = 0;
1977     (yy_buffer_stack_max) = 0;
1978     (yy_c_buf_p) = NULL;
1979     (yy_init) = 0;
1980     (yy_start) = 0;
1981 
1982 /* Defined in main.c */
1983 #ifdef YY_STDINIT
1984     yyin = stdin;
1985     yyout = stdout;
1986 #else
1987     yyin = NULL;
1988     yyout = NULL;
1989 #endif
1990 
1991     /* For future reference: Set errno on error, since we are called by
1992      * yylex_init()
1993      */
1994     return 0;
1995 }
1996 
1997 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1998 int yylex_destroy  (void)
1999 {
2000 
2001     /* Pop the buffer stack, destroying each element. */
2002 	while(YY_CURRENT_BUFFER){
2003 		yy_delete_buffer( YY_CURRENT_BUFFER  );
2004 		YY_CURRENT_BUFFER_LVALUE = NULL;
2005 		yypop_buffer_state();
2006 	}
2007 
2008 	/* Destroy the stack itself. */
2009 	yyfree((yy_buffer_stack) );
2010 	(yy_buffer_stack) = NULL;
2011 
2012     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2013      * yylex() is called, initialization will occur. */
2014     yy_init_globals( );
2015 
2016     return 0;
2017 }
2018 
2019 /*
2020  * Internal utility routines.
2021  */
2022 
2023 #ifndef yytext_ptr
2024 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2025 {
2026 
2027 	int i;
2028 	for ( i = 0; i < n; ++i )
2029 		s1[i] = s2[i];
2030 }
2031 #endif
2032 
2033 #ifdef YY_NEED_STRLEN
2034 static int yy_flex_strlen (const char * s )
2035 {
2036 	int n;
2037 	for ( n = 0; s[n]; ++n )
2038 		;
2039 
2040 	return n;
2041 }
2042 #endif
2043 
2044 void *yyalloc (yy_size_t  size )
2045 {
2046 			return malloc(size);
2047 }
2048 
2049 void *yyrealloc  (void * ptr, yy_size_t  size )
2050 {
2051 
2052 	/* The cast to (char *) in the following accommodates both
2053 	 * implementations that use char* generic pointers, and those
2054 	 * that use void* generic pointers.  It works with the latter
2055 	 * because both ANSI C and C++ allow castless assignment from
2056 	 * any pointer type to void*, and deal with argument conversions
2057 	 * as though doing an assignment.
2058 	 */
2059 	return realloc(ptr, size);
2060 }
2061 
2062 void yyfree (void * ptr )
2063 {
2064 			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
2065 }
2066 
2067 #define YYTABLES_NAME "yytables"
2068 
2069 #line 77 "tokenparser.l"
2070 
2071 
2072 
2073 static void eval_key(char *pcToken, list_t *list_key)
2074 {
2075 	struct bundleElt *elt;
2076 	int r;
2077 	size_t len;
2078 
2079 	/* create a new list element */
2080 	elt = malloc(sizeof(*elt));
2081 	assert(elt);
2082 
2083 	/* <key>foobar</key>
2084 	 * 012345 : 5 is the first key character index */
2085 
2086 	/* calculate the argument length */
2087 	for (len=0; pcToken[len+5] != '<'; len++)
2088 		;
2089 	len++;	/* final NULL byte */
2090 
2091 	elt->key = malloc(len);
2092 	memcpy(elt->key, &pcToken[5], len-1);
2093 	elt->key[len-1] = '\0';
2094 
2095 	r = list_init(&elt->values);
2096 	assert(r >= 0);
2097 	(void)r;
2098 
2099 	/* add the key/values */
2100 	list_append(list_key, elt);
2101 
2102 	/* set the list to store the values */
2103 	ListValues = &elt->values;
2104 }
2105 
2106 static void eval_value(char *pcToken, list_t *list_values)
2107 {
2108 	int r;
2109 	size_t len;
2110 	char *value;
2111 	char *amp;
2112 
2113 	/* <string>foobar</string>
2114 	 * 012345678 : 8 is the first string character index */
2115 
2116 	/* calculate the argument length */
2117 	for (len=0; pcToken[len+8] != '<'; len++)
2118 		;
2119 	len++;	/* final NULL byte */
2120 
2121 	value = malloc(len);
2122 	assert(value);
2123 
2124 	memcpy(value, &pcToken[8], len-1);
2125 	value[len-1] = '\0';
2126 
2127 	/* for all &amp; in the string */
2128 	amp = value;
2129 	while ((amp = strstr(amp, "&amp;")) != NULL)
2130 	{
2131 		char *p;
2132 
2133 		/* just skip "amp;" substring (4 letters) */
2134 		for (p = amp+1; *(p+4); p++)
2135 		{
2136 			*p = *(p+4);
2137 		}
2138 		/* terminate the now shorter string */
2139 		*p = '\0';
2140 
2141 		/* skip the & and continue */
2142 		amp++;
2143 	}
2144 
2145 	r = list_append(list_values, value);
2146 	assert(r >= 0);
2147 	(void)r;
2148 }
2149 
2150 void tperrorCheck (char *token_error)
2151 {
2152     (void)token_error;
2153 }
2154 
2155 /**
2156  * Find an optional key in a configuration file
2157  * No error is logged if the key is not found
2158  *
2159  * @param l list generated by bundleParse()
2160  * @param key searched key
2161  * @param[out] values list of token value (if key found)
2162  * @retval 0 OK
2163  * @retval 1 key not found
2164  */
2165 int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values)
2166 {
2167 	unsigned int i;
2168 	int ret = 1;
2169 
2170 	for (i=0; i < list_size(l); i++)
2171 	{
2172 		struct bundleElt *elt;
2173 
2174 		elt = list_get_at(l, i);
2175 		assert(elt);
2176 
2177 		if (0 == strcmp(elt->key, key))
2178 		{
2179 			*values = &elt->values;
2180 			ret = 0;
2181 		}
2182 	}
2183 
2184 	return ret;
2185 }
2186 
2187 
2188 /**
2189  * Parse a Info.plist file and file a list
2190  *
2191  * @param fileName file name
2192  * @param l list containing the results
2193  * @retval -1 configuration file not found
2194  * @retval 0 OK
2195  */
2196 int bundleParse(const char *fileName, list_t *l)
2197 {
2198 	FILE *file = NULL;
2199 	int r;
2200 #ifndef NDEBUG
2201 	int i;
2202 #endif
2203 
2204 	file = fopen(fileName, "r");
2205 	if (!file)
2206 	{
2207 		Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
2208 			fileName, strerror(errno));
2209 		return 1;
2210 	}
2211 
2212 	r = list_init(l);
2213 	assert(r >= 0);
2214 	(void)r;
2215 
2216 	ListKeys = l;
2217 	yyin = file;
2218 
2219 	do
2220 	{
2221 		(void)yylex();
2222 	} while (!feof(file));
2223 	yylex_destroy();
2224 
2225 	(void)fclose(file);
2226 
2227 #ifndef NDEBUG
2228 	printf("size: %d\n", list_size(l));
2229 	for (i=0; i < list_size(l); i++)
2230 	{
2231 		struct bundleElt *elt;
2232 		unsigned int j;
2233 
2234 		elt = list_get_at(l, i);
2235 		assert(elt);
2236 		printf("Key: %s\n", elt->key);
2237 
2238 		for (j=0; j<list_size(&elt->values); j++)
2239 		{
2240 			char *v = list_get_at(&elt->values, j);
2241 			printf(" value: %s\n", v);
2242 		}
2243 	}
2244 #endif
2245 
2246 	return 0;
2247 }
2248 
2249 /**
2250  * Free the list created by bundleParse()
2251  *
2252  * @param l list containing the results
2253  */
2254 void bundleRelease(list_t *l)
2255 {
2256 	unsigned int i;
2257 
2258 	for (i=0; i < list_size(l); i++)
2259 	{
2260 		struct bundleElt *elt;
2261 		unsigned int j;
2262 
2263 		elt = list_get_at(l, i);
2264 		assert(elt);
2265 
2266 		/* free all the values */
2267 		for (j=0; j<list_size(&elt->values); j++)
2268 			free(list_get_at(&elt->values, j));
2269 		list_destroy(&elt->values);
2270 
2271 		/* free the key */
2272 		free(elt->key);
2273 		free(elt);
2274 	}
2275 
2276 	list_destroy(l);
2277 }
2278 
2279