2 #line 3 "tokenparser.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
24 /* end standard C headers. */
26 /* flex integer type definitions */
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
57 /* Limits of integral types. */
59 #define INT8_MIN (-128)
62 #define INT16_MIN (-32767-1)
65 #define INT32_MIN (-2147483647-1)
68 #define INT8_MAX (127)
71 #define INT16_MAX (32767)
74 #define INT32_MAX (2147483647)
77 #define UINT8_MAX (255U)
80 #define UINT16_MAX (65535U)
83 #define UINT32_MAX (4294967295U)
87 #define SIZE_MAX (~(size_t)0)
92 #endif /* ! FLEXINT_H */
94 /* begin standard C++ headers. */
96 /* TODO: this is always defined, so inline it */
99 #if defined(__GNUC__) && __GNUC__ >= 3
100 #define yynoreturn __attribute__((__noreturn__))
105 /* Returned upon end-of-file. */
108 /* Promotes a possibly negative, possibly signed char to an
109 * integer in range [0..255] for use as an array index.
111 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
113 /* Enter a start condition. This macro really ought to take a parameter,
114 * but we do it the disgusting crufty way forced on us by the ()-less
115 * definition of BEGIN.
117 #define BEGIN (yy_start) = 1 + 2 *
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
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126 /* Special action meaning "start processing a new file". */
127 #define YY_NEW_FILE yyrestart( yyin )
128 #define YY_END_OF_BUFFER_CHAR 0
130 /* Size of default input buffer. */
133 /* On IA-64, the buffer size is 16k, not 8k.
134 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
135 * Ditto for the __ia64__ case accordingly.
137 #define YY_BUF_SIZE 32768
139 #define YY_BUF_SIZE 16384
140 #endif /* __ia64__ */
143 /* The state buf must be large enough to hold one state per character in the main buffer.
145 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
147 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
148 #define YY_TYPEDEF_YY_BUFFER_STATE
149 typedef struct yy_buffer_state *YY_BUFFER_STATE;
152 #ifndef YY_TYPEDEF_YY_SIZE_T
153 #define YY_TYPEDEF_YY_SIZE_T
154 typedef size_t yy_size_t;
159 extern FILE *yyin, *yyout;
161 #define EOB_ACT_CONTINUE_SCAN 0
162 #define EOB_ACT_END_OF_FILE 1
163 #define EOB_ACT_LAST_MATCH 2
165 #define YY_LESS_LINENO(n)
166 #define YY_LINENO_REWIND_TO(ptr)
168 /* Return all but the first "n" matched characters back to the input stream. */
172 /* Undo effects of setting up yytext. */ \
173 int yyless_macro_arg = (n); \
174 YY_LESS_LINENO(yyless_macro_arg);\
175 *yy_cp = (yy_hold_char); \
176 YY_RESTORE_YY_MORE_OFFSET \
177 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
178 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
181 #define unput(c) yyunput( c, (yytext_ptr) )
183 #ifndef YY_STRUCT_YY_BUFFER_STATE
184 #define YY_STRUCT_YY_BUFFER_STATE
185 struct yy_buffer_state
189 char *yy_ch_buf; /* input buffer */
190 char *yy_buf_pos; /* current position in input buffer */
192 /* Size of input buffer in bytes, not including room for EOB
197 /* Number of characters read into yy_ch_buf, not including EOB
202 /* Whether we "own" the buffer - i.e., we know we created it,
203 * and can realloc() it to grow it, and should free() it to
206 int yy_is_our_buffer;
208 /* Whether this is an "interactive" input source; if so, and
209 * if we're using stdio for input, then we want to use getc()
210 * instead of fread(), to make sure we stop fetching input after
213 int yy_is_interactive;
215 /* Whether we're considered to be at the beginning of a line.
216 * If so, '^' rules will be active on the next match, otherwise
221 int yy_bs_lineno; /**< The line count. */
222 int yy_bs_column; /**< The column count. */
224 /* Whether to try to fill the input buffer when we reach the
229 int yy_buffer_status;
231 #define YY_BUFFER_NEW 0
232 #define YY_BUFFER_NORMAL 1
233 /* When an EOF's been seen but there's still some text to process
234 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
235 * shouldn't try reading from the input source any more. We might
236 * still have a bunch of tokens to match, though, because of
237 * possible backing-up.
239 * When we actually see the EOF, we change the status to "new"
240 * (via yyrestart()), so that the user can continue scanning by
241 * just pointing yyin at a new input file.
243 #define YY_BUFFER_EOF_PENDING 2
246 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
248 /* Stack of input buffers. */
249 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
250 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
251 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
253 /* We provide macros for accessing buffer states in case in the
254 * future we want to put the buffer states in a more general
257 * Returns the top of the stack, or NULL.
259 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
260 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263 * NULL or when we need an lvalue. For internal use only.
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars; /* number of characters read into yy_ch_buf */
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0; /* whether we need to initialize */
275 static int yy_start = 0; /* start state number */
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278 * instead of setting up a fresh yyin. A bit of a hack ...
280 static int yy_did_buffer_switch_on_eof;
282 void yyrestart ( FILE *input_file );
283 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
284 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
285 void yy_delete_buffer ( YY_BUFFER_STATE b );
286 void yy_flush_buffer ( YY_BUFFER_STATE b );
287 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
288 void yypop_buffer_state ( void );
290 static void yyensure_buffer_stack ( void );
291 static void yy_load_buffer_state ( void );
292 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
293 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
295 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
296 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
297 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
299 void *yyalloc ( yy_size_t );
300 void *yyrealloc ( void *, yy_size_t );
301 void yyfree ( void * );
303 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
306 if ( ! YY_CURRENT_BUFFER ){ \
307 yyensure_buffer_stack (); \
308 YY_CURRENT_BUFFER_LVALUE = \
309 yy_create_buffer( yyin, YY_BUF_SIZE ); \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
313 #define yy_set_bol(at_bol) \
315 if ( ! YY_CURRENT_BUFFER ){\
316 yyensure_buffer_stack (); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 yy_create_buffer( yyin, YY_BUF_SIZE ); \
320 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324 /* Begin user sect3 */
326 #define yywrap() (/*CONSTCOND*/1)
327 #define YY_SKIP_YYWRAP
328 typedef flex_uint8_t YY_CHAR;
330 FILE *yyin = NULL, *yyout = NULL;
332 typedef int yy_state_type;
341 #define yytext_ptr yytext
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 yynoreturn yy_fatal_error ( const char* msg );
348 /* Done after the current pattern has been matched and before the
349 * corresponding action - sets up yytext.
351 #define YY_DO_BEFORE_ACTION \
352 (yytext_ptr) = yy_bp; \
353 yyleng = (int) (yy_cp - yy_bp); \
354 (yy_hold_char) = *yy_cp; \
356 (yy_c_buf_p) = yy_cp;
357 #define YY_NUM_RULES 7
358 #define YY_END_OF_BUFFER 8
359 /* This struct is not used in this scanner,
360 but its presence is necessary. */
363 flex_int32_t yy_verify;
366 static const flex_int16_t yy_accept[39] =
368 0, 0, 8, 6, 4, 2, 1, 6, 1, 0,
369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
370 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
371 0, 0, 0, 0, 0, 0, 5, 0
374 static const YY_CHAR yy_ec[256] =
376 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 2, 4, 4, 5, 4, 4, 4, 4, 4,
380 4, 4, 4, 4, 4, 4, 6, 7, 7, 7,
381 7, 7, 7, 7, 7, 7, 7, 4, 4, 8,
382 4, 9, 4, 4, 10, 10, 10, 10, 10, 10,
383 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
384 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
385 4, 1, 4, 4, 4, 1, 11, 11, 11, 11,
387 12, 11, 13, 11, 14, 11, 15, 11, 11, 16,
388 11, 11, 11, 17, 18, 19, 11, 11, 11, 11,
389 20, 11, 1, 1, 1, 4, 1, 1, 1, 1,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 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,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 static const YY_CHAR yy_meta[21] =
408 1, 2, 3, 4, 4, 4, 2, 1, 1, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
412 static const flex_int16_t yy_base[43] =
414 0, 7, 49, 50, 50, 50, 0, 1, 0, 36,
415 28, 26, 28, 35, 29, 0, 26, 33, 27, 33,
416 29, 22, 0, 24, 27, 14, 27, 23, 13, 50,
417 10, 9, 4, 1, 0, 2, 50, 50, 19, 23,
421 static const flex_int16_t yy_def[43] =
423 39, 39, 38, 38, 38, 38, 40, 38, 40, 38,
424 38, 38, 38, 38, 38, 41, 38, 41, 38, 38,
425 38, 38, 42, 38, 42, 38, 38, 38, 38, 38,
426 38, 38, 38, 38, 38, 38, 38, 0, 38, 38,
430 static const flex_int16_t yy_nxt[71] =
432 38, 5, 6, 18, 7, 38, 38, 8, 5, 6,
433 37, 7, 36, 38, 8, 10, 35, 34, 11, 4,
434 4, 4, 4, 9, 9, 33, 9, 25, 32, 25,
435 31, 30, 29, 28, 27, 26, 24, 23, 22, 21,
436 20, 19, 17, 16, 15, 14, 13, 12, 38, 3,
437 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
438 38, 38, 38, 38, 38, 38, 38, 38, 38, 38
441 static const flex_int16_t yy_chk[71] =
443 0, 1, 1, 41, 1, 0, 0, 1, 2, 2,
444 36, 2, 35, 0, 2, 8, 34, 33, 8, 39,
445 39, 39, 39, 40, 40, 32, 40, 42, 31, 42,
446 29, 28, 27, 26, 25, 24, 22, 21, 20, 19,
447 18, 17, 15, 14, 13, 12, 11, 10, 3, 38,
448 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
449 38, 38, 38, 38, 38, 38, 38, 38, 38, 38
452 static yy_state_type yy_last_accepting_state;
453 static char *yy_last_accepting_cpos;
455 extern int yy_flex_debug;
456 int yy_flex_debug = 0;
458 /* The intent behind this definition is that it'll catch
459 * any uses of REJECT which flex missed.
461 #define REJECT reject_used_but_not_detected
462 #define yymore() yymore_used_but_not_detected
463 #define YY_MORE_ADJ 0
464 #define YY_RESTORE_YY_MORE_OFFSET
466 #line 1 "tokenparser.l"
468 * Reads lexical config files and updates database.
470 * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
472 * Copyright (C) 2001-2003
473 * David Corcoran <corcoran@musclecard.com>
474 * Copyright (C) 2003-2010
475 * Ludovic Rousseau <ludovic.rousseau@free.fr>
477 Redistribution and use in source and binary forms, with or without
478 modification, are permitted provided that the following conditions
481 1. Redistributions of source code must retain the above copyright
482 notice, this list of conditions and the following disclaimer.
483 2. Redistributions in binary form must reproduce the above copyright
484 notice, this list of conditions and the following disclaimer in the
485 documentation and/or other materials provided with the distribution.
486 3. The name of the author may not be used to endorse or promote products
487 derived from this software without specific prior written permission.
489 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
490 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
491 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
492 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
493 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
494 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
495 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
496 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
497 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
498 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
502 * @brief provides parsing functions for Info.plist files
505 #line 42 "tokenparser.l"
514 #include "simclist.h"
515 #include "debuglog.h"
518 static void eval_key(char *pcToken, list_t *list_key);
519 static void eval_value(char *pcToken, list_t *list_values);
520 void tperrorCheck (char *pcToken_error);
522 static list_t *ListKeys;
523 static list_t *ListValues;
525 #line 526 "tokenparser.c"
526 #define YY_NO_INPUT 1
527 #line 528 "tokenparser.c"
531 #ifndef YY_NO_UNISTD_H
532 /* Special case for "unistd.h", since it is non-ANSI. We include it way
533 * down here because we want the user's section 1 to have been scanned first.
534 * The user has a chance to override it with an option.
539 #ifndef YY_EXTRA_TYPE
540 #define YY_EXTRA_TYPE void *
543 static int yy_init_globals ( void );
545 /* Accessor methods to globals.
546 These are made visible to non-reentrant scanners for convenience. */
548 int yylex_destroy ( void );
550 int yyget_debug ( void );
552 void yyset_debug ( int debug_flag );
554 YY_EXTRA_TYPE yyget_extra ( void );
556 void yyset_extra ( YY_EXTRA_TYPE user_defined );
558 FILE *yyget_in ( void );
560 void yyset_in ( FILE * _in_str );
562 FILE *yyget_out ( void );
564 void yyset_out ( FILE * _out_str );
566 int yyget_leng ( void );
568 char *yyget_text ( void );
570 int yyget_lineno ( void );
572 void yyset_lineno ( int _line_number );
574 /* Macros after this point can all be overridden by user definitions in
578 #ifndef YY_SKIP_YYWRAP
580 extern "C" int yywrap ( void );
582 extern int yywrap ( void );
591 static void yy_flex_strncpy ( char *, const char *, int );
594 #ifdef YY_NEED_STRLEN
595 static int yy_flex_strlen ( const char * );
600 static int yyinput ( void );
602 static int input ( void );
607 /* Amount of stuff to slurp up with each read. */
608 #ifndef YY_READ_BUF_SIZE
610 /* On IA-64, the buffer size is 16k, not 8k */
611 #define YY_READ_BUF_SIZE 16384
613 #define YY_READ_BUF_SIZE 8192
614 #endif /* __ia64__ */
617 /* Copy whatever the last rule matched to the standard output. */
619 /* This used to be an fputs(), but since the string might contain NUL's,
620 * we now use fwrite().
622 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
625 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
626 * is returned in "result".
629 #define YY_INPUT(buf,result,max_size) \
630 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
634 for ( n = 0; n < max_size && \
635 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
638 buf[n++] = (char) c; \
639 if ( c == EOF && ferror( yyin ) ) \
640 YY_FATAL_ERROR( "input in flex scanner failed" ); \
646 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
648 if( errno != EINTR) \
650 YY_FATAL_ERROR( "input in flex scanner failed" ); \
661 /* No semi-colon after return; correct usage is to write "yyterminate();" -
662 * we don't want an extra ';' after the "return" because that will cause
663 * some compilers to complain about unreachable statements.
666 #define yyterminate() return YY_NULL
669 /* Number of entries by which start-condition stack grows. */
670 #ifndef YY_START_STACK_INCR
671 #define YY_START_STACK_INCR 25
674 /* Report a fatal error. */
675 #ifndef YY_FATAL_ERROR
676 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
679 /* end tables serialization structures and prototypes */
681 /* Default declaration of generated scanner - a define so the user can
682 * easily add parameters.
685 #define YY_DECL_IS_OURS 1
687 extern int yylex (void);
689 #define YY_DECL int yylex (void)
690 #endif /* !YY_DECL */
692 /* Code executed at the beginning of each rule, after yytext and yyleng
695 #ifndef YY_USER_ACTION
696 #define YY_USER_ACTION
699 /* Code executed at the end of each rule. */
701 #define YY_BREAK /*LINTED*/break;
704 #define YY_RULE_SETUP \
707 /** The main scanner function which does all the work.
711 yy_state_type yy_current_state;
724 (yy_start) = 1; /* first start state */
732 if ( ! YY_CURRENT_BUFFER ) {
733 yyensure_buffer_stack ();
734 YY_CURRENT_BUFFER_LVALUE =
735 yy_create_buffer( yyin, YY_BUF_SIZE );
738 yy_load_buffer_state( );
742 #line 67 "tokenparser.l"
745 #line 746 "tokenparser.c"
747 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
749 yy_cp = (yy_c_buf_p);
751 /* Support of yytext. */
752 *yy_cp = (yy_hold_char);
754 /* yy_bp points to the position in yy_ch_buf of the start of
759 yy_current_state = (yy_start);
763 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
764 if ( yy_accept[yy_current_state] )
766 (yy_last_accepting_state) = yy_current_state;
767 (yy_last_accepting_cpos) = yy_cp;
769 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
771 yy_current_state = (int) yy_def[yy_current_state];
772 if ( yy_current_state >= 39 )
773 yy_c = yy_meta[yy_c];
775 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
778 while ( yy_base[yy_current_state] != 50 );
781 yy_act = yy_accept[yy_current_state];
783 { /* have to back up */
784 yy_cp = (yy_last_accepting_cpos);
785 yy_current_state = (yy_last_accepting_state);
786 yy_act = yy_accept[yy_current_state];
791 do_action: /* This label is used only to access EOF actions. */
794 { /* beginning of action switch */
795 case 0: /* must back up */
796 /* undo the effects of YY_DO_BEFORE_ACTION */
797 *yy_cp = (yy_hold_char);
798 yy_cp = (yy_last_accepting_cpos);
799 yy_current_state = (yy_last_accepting_state);
804 #line 69 "tokenparser.l"
808 /* rule 2 can match eol */
810 #line 70 "tokenparser.l"
815 #line 71 "tokenparser.l"
816 { eval_key(yytext, ListKeys); }
820 #line 72 "tokenparser.l"
825 #line 73 "tokenparser.l"
826 { eval_value(yytext, ListValues); }
830 #line 74 "tokenparser.l"
831 { tperrorCheck(yytext); }
835 #line 75 "tokenparser.l"
838 #line 839 "tokenparser.c"
839 case YY_STATE_EOF(INITIAL):
842 case YY_END_OF_BUFFER:
844 /* Amount of text matched not including the EOB char. */
845 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
847 /* Undo the effects of YY_DO_BEFORE_ACTION. */
848 *yy_cp = (yy_hold_char);
849 YY_RESTORE_YY_MORE_OFFSET
851 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
853 /* We're scanning a new file or input source. It's
854 * possible that this happened because the user
855 * just pointed yyin at a new source and called
856 * yylex(). If so, then we have to assure
857 * consistency between YY_CURRENT_BUFFER and our
858 * globals. Here is the right place to do so, because
859 * this is the first action (other than possibly a
860 * back-up) that will match for the new input source.
862 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
863 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
864 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
867 /* Note that here we test for yy_c_buf_p "<=" to the position
868 * of the first EOB in the buffer, since yy_c_buf_p will
869 * already have been incremented past the NUL character
870 * (since all states make transitions on EOB to the
871 * end-of-buffer state). Contrast this with the test
874 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
875 { /* This was really a NUL. */
876 yy_state_type yy_next_state;
878 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
880 yy_current_state = yy_get_previous_state( );
882 /* Okay, we're now positioned to make the NUL
883 * transition. We couldn't have
884 * yy_get_previous_state() go ahead and do it
885 * for us because it doesn't know how to deal
886 * with the possibility of jamming (and we don't
887 * want to build jamming into it because then it
888 * will run more slowly).
891 yy_next_state = yy_try_NUL_trans( yy_current_state );
893 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
897 /* Consume the NUL. */
898 yy_cp = ++(yy_c_buf_p);
899 yy_current_state = yy_next_state;
905 yy_cp = (yy_c_buf_p);
910 else switch ( yy_get_next_buffer( ) )
912 case EOB_ACT_END_OF_FILE:
914 (yy_did_buffer_switch_on_eof) = 0;
918 /* Note: because we've taken care in
919 * yy_get_next_buffer() to have set up
920 * yytext, we can now set up
921 * yy_c_buf_p so that if some total
922 * hoser (like flex itself) wants to
923 * call the scanner after we return the
924 * YY_NULL, it'll still work - another
925 * YY_NULL will get returned.
927 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
929 yy_act = YY_STATE_EOF(YY_START);
935 if ( ! (yy_did_buffer_switch_on_eof) )
941 case EOB_ACT_CONTINUE_SCAN:
943 (yytext_ptr) + yy_amount_of_matched_text;
945 yy_current_state = yy_get_previous_state( );
947 yy_cp = (yy_c_buf_p);
948 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
951 case EOB_ACT_LAST_MATCH:
953 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
955 yy_current_state = yy_get_previous_state( );
957 yy_cp = (yy_c_buf_p);
958 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
966 "fatal flex scanner internal error--no action found" );
967 } /* end of action switch */
968 } /* end of scanning one token */
969 } /* end of user's declarations */
972 /* yy_get_next_buffer - try to read in a new buffer
974 * Returns a code representing an action:
975 * EOB_ACT_LAST_MATCH -
976 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
977 * EOB_ACT_END_OF_FILE - end of file
979 static int yy_get_next_buffer (void)
981 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
982 char *source = (yytext_ptr);
983 int number_to_move, i;
986 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
988 "fatal flex scanner internal error--end of buffer missed" );
990 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
991 { /* Don't try to fill the buffer, so this is an EOF. */
992 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
994 /* We matched a single character, the EOB, so
995 * treat this as a final EOF.
997 return EOB_ACT_END_OF_FILE;
1002 /* We matched some text prior to the EOB, first
1005 return EOB_ACT_LAST_MATCH;
1009 /* Try to read more data. */
1011 /* First move last chars to start of buffer. */
1012 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1014 for ( i = 0; i < number_to_move; ++i )
1015 *(dest++) = *(source++);
1017 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1018 /* don't do the read, it's not guaranteed to return an EOF,
1021 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1026 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1028 while ( num_to_read <= 0 )
1029 { /* Not enough room in the buffer - grow it. */
1031 /* just a shorter name for the current buffer */
1032 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1034 int yy_c_buf_p_offset =
1035 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1037 if ( b->yy_is_our_buffer )
1039 int new_size = b->yy_buf_size * 2;
1041 if ( new_size <= 0 )
1042 b->yy_buf_size += b->yy_buf_size / 8;
1044 b->yy_buf_size *= 2;
1046 b->yy_ch_buf = (char *)
1047 /* Include room in for 2 EOB chars. */
1048 yyrealloc( (void *) b->yy_ch_buf,
1049 (yy_size_t) (b->yy_buf_size + 2) );
1052 /* Can't grow it, we don't own it. */
1053 b->yy_ch_buf = NULL;
1055 if ( ! b->yy_ch_buf )
1057 "fatal error - scanner input buffer overflow" );
1059 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1061 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1066 if ( num_to_read > YY_READ_BUF_SIZE )
1067 num_to_read = YY_READ_BUF_SIZE;
1069 /* Read in more data. */
1070 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1071 (yy_n_chars), num_to_read );
1073 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1076 if ( (yy_n_chars) == 0 )
1078 if ( number_to_move == YY_MORE_ADJ )
1080 ret_val = EOB_ACT_END_OF_FILE;
1086 ret_val = EOB_ACT_LAST_MATCH;
1087 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1088 YY_BUFFER_EOF_PENDING;
1093 ret_val = EOB_ACT_CONTINUE_SCAN;
1095 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1096 /* Extend the array by 50%, plus the number we really need. */
1097 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1098 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1099 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1100 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1101 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1102 /* "- 2" to take care of EOB's */
1103 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1106 (yy_n_chars) += number_to_move;
1107 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1108 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1110 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1115 /* yy_get_previous_state - get the state just before the EOB char was reached */
1117 static yy_state_type yy_get_previous_state (void)
1119 yy_state_type yy_current_state;
1122 yy_current_state = (yy_start);
1124 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1126 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1127 if ( yy_accept[yy_current_state] )
1129 (yy_last_accepting_state) = yy_current_state;
1130 (yy_last_accepting_cpos) = yy_cp;
1132 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1134 yy_current_state = (int) yy_def[yy_current_state];
1135 if ( yy_current_state >= 39 )
1136 yy_c = yy_meta[yy_c];
1138 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1141 return yy_current_state;
1144 /* yy_try_NUL_trans - try to make a transition on the NUL character
1147 * next_state = yy_try_NUL_trans( current_state );
1149 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1152 char *yy_cp = (yy_c_buf_p);
1155 if ( yy_accept[yy_current_state] )
1157 (yy_last_accepting_state) = yy_current_state;
1158 (yy_last_accepting_cpos) = yy_cp;
1160 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1162 yy_current_state = (int) yy_def[yy_current_state];
1163 if ( yy_current_state >= 39 )
1164 yy_c = yy_meta[yy_c];
1166 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1167 yy_is_jam = (yy_current_state == 38);
1169 return yy_is_jam ? 0 : yy_current_state;
1178 static int yyinput (void)
1180 static int input (void)
1186 *(yy_c_buf_p) = (yy_hold_char);
1188 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1190 /* yy_c_buf_p now points to the character we want to return.
1191 * If this occurs *before* the EOB characters, then it's a
1192 * valid NUL; if not, then we've hit the end of the buffer.
1194 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1195 /* This was really a NUL. */
1196 *(yy_c_buf_p) = '\0';
1199 { /* need more input */
1200 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1203 switch ( yy_get_next_buffer( ) )
1205 case EOB_ACT_LAST_MATCH:
1206 /* This happens because yy_g_n_b()
1207 * sees that we've accumulated a
1208 * token and flags that we need to
1209 * try matching the token before
1210 * proceeding. But for input(),
1211 * there's no matching to consider.
1212 * So convert the EOB_ACT_LAST_MATCH
1213 * to EOB_ACT_END_OF_FILE.
1216 /* Reset buffer status. */
1221 case EOB_ACT_END_OF_FILE:
1226 if ( ! (yy_did_buffer_switch_on_eof) )
1235 case EOB_ACT_CONTINUE_SCAN:
1236 (yy_c_buf_p) = (yytext_ptr) + offset;
1242 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1243 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1244 (yy_hold_char) = *++(yy_c_buf_p);
1248 #endif /* ifndef YY_NO_INPUT */
1250 /** Immediately switch to a different input stream.
1251 * @param input_file A readable stream.
1253 * @note This function does not reset the start condition to @c INITIAL .
1255 void yyrestart (FILE * input_file )
1258 if ( ! YY_CURRENT_BUFFER ){
1259 yyensure_buffer_stack ();
1260 YY_CURRENT_BUFFER_LVALUE =
1261 yy_create_buffer( yyin, YY_BUF_SIZE );
1264 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1265 yy_load_buffer_state( );
1268 /** Switch to a different input buffer.
1269 * @param new_buffer The new input buffer.
1272 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1275 /* TODO. We should be able to replace this entire function body
1277 * yypop_buffer_state();
1278 * yypush_buffer_state(new_buffer);
1280 yyensure_buffer_stack ();
1281 if ( YY_CURRENT_BUFFER == new_buffer )
1284 if ( YY_CURRENT_BUFFER )
1286 /* Flush out information for old buffer. */
1287 *(yy_c_buf_p) = (yy_hold_char);
1288 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1289 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1292 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1293 yy_load_buffer_state( );
1295 /* We don't actually know whether we did this switch during
1296 * EOF (yywrap()) processing, but the only time this flag
1297 * is looked at is after yywrap() is called, so it's safe
1298 * to go ahead and always set it.
1300 (yy_did_buffer_switch_on_eof) = 1;
1303 static void yy_load_buffer_state (void)
1305 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1306 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1307 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1308 (yy_hold_char) = *(yy_c_buf_p);
1311 /** Allocate and initialize an input buffer state.
1312 * @param file A readable stream.
1313 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1315 * @return the allocated buffer state.
1317 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1321 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1323 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1325 b->yy_buf_size = size;
1327 /* yy_ch_buf has to be 2 characters longer than the size given because
1328 * we need to put in 2 end-of-buffer characters.
1330 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1331 if ( ! b->yy_ch_buf )
1332 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1334 b->yy_is_our_buffer = 1;
1336 yy_init_buffer( b, file );
1341 /** Destroy the buffer.
1342 * @param b a buffer created with yy_create_buffer()
1345 void yy_delete_buffer (YY_BUFFER_STATE b )
1351 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1352 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1354 if ( b->yy_is_our_buffer )
1355 yyfree( (void *) b->yy_ch_buf );
1357 yyfree( (void *) b );
1360 /* Initializes or reinitializes a buffer.
1361 * This function is sometimes called more than once on the same buffer,
1362 * such as during a yyrestart() or at EOF.
1364 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1369 yy_flush_buffer( b );
1371 b->yy_input_file = file;
1372 b->yy_fill_buffer = 1;
1374 /* If b is the current buffer, then yy_init_buffer was _probably_
1375 * called from yyrestart() or through yy_get_next_buffer.
1376 * In that case, we don't want to reset the lineno or column.
1378 if (b != YY_CURRENT_BUFFER){
1379 b->yy_bs_lineno = 1;
1380 b->yy_bs_column = 0;
1383 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1388 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1389 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1392 void yy_flush_buffer (YY_BUFFER_STATE b )
1399 /* We always need two end-of-buffer characters. The first causes
1400 * a transition to the end-of-buffer state. The second causes
1401 * a jam in that state.
1403 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1404 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1406 b->yy_buf_pos = &b->yy_ch_buf[0];
1409 b->yy_buffer_status = YY_BUFFER_NEW;
1411 if ( b == YY_CURRENT_BUFFER )
1412 yy_load_buffer_state( );
1415 /** Pushes the new state onto the stack. The new state becomes
1416 * the current state. This function will allocate the stack
1418 * @param new_buffer The new state.
1421 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1423 if (new_buffer == NULL)
1426 yyensure_buffer_stack();
1428 /* This block is copied from yy_switch_to_buffer. */
1429 if ( YY_CURRENT_BUFFER )
1431 /* Flush out information for old buffer. */
1432 *(yy_c_buf_p) = (yy_hold_char);
1433 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1434 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1437 /* Only push if top exists. Otherwise, replace top. */
1438 if (YY_CURRENT_BUFFER)
1439 (yy_buffer_stack_top)++;
1440 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1442 /* copied from yy_switch_to_buffer. */
1443 yy_load_buffer_state( );
1444 (yy_did_buffer_switch_on_eof) = 1;
1447 /** Removes and deletes the top of the stack, if present.
1448 * The next element becomes the new top.
1451 void yypop_buffer_state (void)
1453 if (!YY_CURRENT_BUFFER)
1456 yy_delete_buffer(YY_CURRENT_BUFFER );
1457 YY_CURRENT_BUFFER_LVALUE = NULL;
1458 if ((yy_buffer_stack_top) > 0)
1459 --(yy_buffer_stack_top);
1461 if (YY_CURRENT_BUFFER) {
1462 yy_load_buffer_state( );
1463 (yy_did_buffer_switch_on_eof) = 1;
1467 /* Allocates the stack if it does not exist.
1468 * Guarantees space for at least one push.
1470 static void yyensure_buffer_stack (void)
1472 yy_size_t num_to_alloc;
1474 if (!(yy_buffer_stack)) {
1476 /* First allocation is just for 2 elements, since we don't know if this
1477 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1478 * immediate realloc on the next call.
1480 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1481 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1482 (num_to_alloc * sizeof(struct yy_buffer_state*)
1484 if ( ! (yy_buffer_stack) )
1485 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1487 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1489 (yy_buffer_stack_max) = num_to_alloc;
1490 (yy_buffer_stack_top) = 0;
1494 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1496 /* Increase the buffer to prepare for a possible push. */
1497 yy_size_t grow_size = 8 /* arbitrary grow size */;
1499 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1500 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1502 num_to_alloc * sizeof(struct yy_buffer_state*)
1504 if ( ! (yy_buffer_stack) )
1505 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1507 /* zero only the new slots.*/
1508 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1509 (yy_buffer_stack_max) = num_to_alloc;
1513 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1514 * @param base the character buffer
1515 * @param size the size in bytes of the character buffer
1517 * @return the newly allocated buffer state object.
1519 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1524 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1525 base[size-1] != YY_END_OF_BUFFER_CHAR )
1526 /* They forgot to leave room for the EOB's. */
1529 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1531 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1533 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1534 b->yy_buf_pos = b->yy_ch_buf = base;
1535 b->yy_is_our_buffer = 0;
1536 b->yy_input_file = NULL;
1537 b->yy_n_chars = b->yy_buf_size;
1538 b->yy_is_interactive = 0;
1540 b->yy_fill_buffer = 0;
1541 b->yy_buffer_status = YY_BUFFER_NEW;
1543 yy_switch_to_buffer( b );
1548 /** Setup the input buffer state to scan a string. The next call to yylex() will
1549 * scan from a @e copy of @a str.
1550 * @param yystr a NUL-terminated string to scan
1552 * @return the newly allocated buffer state object.
1553 * @note If you want to scan bytes that may contain NUL values, then use
1554 * yy_scan_bytes() instead.
1556 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1559 return yy_scan_bytes( yystr, (int) strlen(yystr) );
1562 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1563 * scan from a @e copy of @a bytes.
1564 * @param yybytes the byte buffer to scan
1565 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1567 * @return the newly allocated buffer state object.
1569 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1576 /* Get memory for full buffer, including space for trailing EOB's. */
1577 n = (yy_size_t) (_yybytes_len + 2);
1578 buf = (char *) yyalloc( n );
1580 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1582 for ( i = 0; i < _yybytes_len; ++i )
1583 buf[i] = yybytes[i];
1585 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1587 b = yy_scan_buffer( buf, n );
1589 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1591 /* It's okay to grow etc. this buffer, and we should throw it
1592 * away when we're done.
1594 b->yy_is_our_buffer = 1;
1599 #ifndef YY_EXIT_FAILURE
1600 #define YY_EXIT_FAILURE 2
1603 static void yynoreturn yy_fatal_error (const char* msg )
1605 fprintf( stderr, "%s\n", msg );
1606 exit( YY_EXIT_FAILURE );
1609 /* Redefine yyless() so it works in section 3 code. */
1615 /* Undo effects of setting up yytext. */ \
1616 int yyless_macro_arg = (n); \
1617 YY_LESS_LINENO(yyless_macro_arg);\
1618 yytext[yyleng] = (yy_hold_char); \
1619 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1620 (yy_hold_char) = *(yy_c_buf_p); \
1621 *(yy_c_buf_p) = '\0'; \
1622 yyleng = yyless_macro_arg; \
1626 /* Accessor methods (get/set functions) to struct members. */
1628 /** Get the current line number.
1631 int yyget_lineno (void)
1637 /** Get the input stream.
1640 FILE *yyget_in (void)
1645 /** Get the output stream.
1648 FILE *yyget_out (void)
1653 /** Get the length of the current token.
1656 int yyget_leng (void)
1661 /** Get the current token.
1665 char *yyget_text (void)
1670 /** Set the current line number.
1671 * @param _line_number line number
1674 void yyset_lineno (int _line_number )
1677 yylineno = _line_number;
1680 /** Set the input stream. This does not discard the current
1682 * @param _in_str A readable stream.
1684 * @see yy_switch_to_buffer
1686 void yyset_in (FILE * _in_str )
1691 void yyset_out (FILE * _out_str )
1696 int yyget_debug (void)
1698 return yy_flex_debug;
1701 void yyset_debug (int _bdebug )
1703 yy_flex_debug = _bdebug ;
1706 static int yy_init_globals (void)
1708 /* Initialization is the same as for the non-reentrant scanner.
1709 * This function is called from yylex_destroy(), so don't allocate here.
1712 (yy_buffer_stack) = NULL;
1713 (yy_buffer_stack_top) = 0;
1714 (yy_buffer_stack_max) = 0;
1715 (yy_c_buf_p) = NULL;
1719 /* Defined in main.c */
1728 /* For future reference: Set errno on error, since we are called by
1734 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1735 int yylex_destroy (void)
1738 /* Pop the buffer stack, destroying each element. */
1739 while(YY_CURRENT_BUFFER){
1740 yy_delete_buffer( YY_CURRENT_BUFFER );
1741 YY_CURRENT_BUFFER_LVALUE = NULL;
1742 yypop_buffer_state();
1745 /* Destroy the stack itself. */
1746 yyfree((yy_buffer_stack) );
1747 (yy_buffer_stack) = NULL;
1749 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1750 * yylex() is called, initialization will occur. */
1757 * Internal utility routines.
1761 static void yy_flex_strncpy (char* s1, const char * s2, int n )
1765 for ( i = 0; i < n; ++i )
1770 #ifdef YY_NEED_STRLEN
1771 static int yy_flex_strlen (const char * s )
1774 for ( n = 0; s[n]; ++n )
1781 void *yyalloc (yy_size_t size )
1783 return malloc(size);
1786 void *yyrealloc (void * ptr, yy_size_t size )
1789 /* The cast to (char *) in the following accommodates both
1790 * implementations that use char* generic pointers, and those
1791 * that use void* generic pointers. It works with the latter
1792 * because both ANSI C and C++ allow castless assignment from
1793 * any pointer type to void*, and deal with argument conversions
1794 * as though doing an assignment.
1796 return realloc(ptr, size);
1799 void yyfree (void * ptr )
1801 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1804 #define YYTABLES_NAME "yytables"
1806 #line 75 "tokenparser.l"
1810 static void eval_key(char *pcToken, list_t *list_key)
1812 struct bundleElt *elt;
1816 /* create a new list element */
1817 elt = malloc(sizeof(*elt));
1820 /* <key>foobar</key>
1821 * 012345 : 5 is the first key character index */
1823 /* calculate the argument length */
1824 for (len=0; pcToken[len+5] != '<'; len++)
1826 len++; /* final NULL byte */
1828 elt->key = malloc(len);
1829 memcpy(elt->key, &pcToken[5], len-1);
1830 elt->key[len-1] = '\0';
1832 r = list_init(&elt->values);
1836 /* add the key/values */
1837 list_append(list_key, elt);
1839 /* set the list to store the values */
1840 ListValues = &elt->values;
1843 static void eval_value(char *pcToken, list_t *list_values)
1850 /* <string>foobar</string>
1851 * 012345678 : 8 is the first string character index */
1853 /* calculate the argument length */
1854 for (len=0; pcToken[len+8] != '<'; len++)
1856 len++; /* final NULL byte */
1858 value = malloc(len);
1861 memcpy(value, &pcToken[8], len-1);
1862 value[len-1] = '\0';
1864 /* for all & in the string */
1866 while ((amp = strstr(amp, "&")) != NULL)
1870 /* just skip "amp;" substring (4 letters) */
1871 for (p = amp+1; *(p+4); p++)
1875 /* terminate the now shorter string */
1878 /* skip the & and continue */
1882 r = list_append(list_values, value);
1887 void tperrorCheck (char *token_error)
1893 * Find an optional key in a configuration file
1894 * No error is logged if the key is not found
1896 * @param l list generated by bundleParse()
1897 * @param key searched key
1898 * @param[out] values list of token value (if key found)
1900 * @retval 1 key not found
1902 int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values)
1907 for (i=0; i < list_size(l); i++)
1909 struct bundleElt *elt;
1911 elt = list_get_at(l, i);
1914 if (0 == strcmp(elt->key, key))
1916 *values = &elt->values;
1926 * Parse a Info.plist file and file a list
1928 * @param fileName file name
1929 * @param l list containing the results
1930 * @retval -1 configuration file not found
1933 int bundleParse(const char *fileName, list_t *l)
1941 file = fopen(fileName, "r");
1944 Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
1945 fileName, strerror(errno));
1959 } while (!feof(file));
1965 printf("size: %d\n", list_size(l));
1966 for (i=0; i < list_size(l); i++)
1968 struct bundleElt *elt;
1971 elt = list_get_at(l, i);
1973 printf("Key: %s\n", elt->key);
1975 for (j=0; j<list_size(&elt->values); j++)
1977 char *v = list_get_at(&elt->values, j);
1978 printf(" value: %s\n", v);
1987 * Free the list created by bundleParse()
1989 * @param l list containing the results
1991 void bundleRelease(list_t *l)
1995 for (i=0; i < list_size(l); i++)
1997 struct bundleElt *elt;
2000 elt = list_get_at(l, i);
2003 /* free all the values */
2004 for (j=0; j<list_size(&elt->values); j++)
2005 free(list_get_at(&elt->values, j));
2006 list_destroy(&elt->values);