1 #line 2 "cmListFileLexer.c"
3 #line 4 "cmListFileLexer.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* An opaque pointer. */
123 #ifndef YY_TYPEDEF_YY_SCANNER_T
124 #define YY_TYPEDEF_YY_SCANNER_T
125 typedef void* yyscan_t;
128 /* For convenience, these vars (plus the bison vars far below)
129 are macros in the reentrant scanner. */
130 #define yyin yyg->yyin_r
131 #define yyout yyg->yyout_r
132 #define yyextra yyg->yyextra_r
133 #define yyleng yyg->yyleng_r
134 #define yytext yyg->yytext_r
135 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
136 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
137 #define yy_flex_debug yyg->yy_flex_debug_r
139 /* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
143 #define BEGIN yyg->yy_start = 1 + 2 *
145 /* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
149 #define YY_START ((yyg->yy_start - 1) / 2)
150 #define YYSTATE YY_START
152 /* Action number for EOF rule of a given start state. */
153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155 /* Special action meaning "start processing a new file". */
156 #define YY_NEW_FILE cmListFileLexer_yyrestart(yyin ,yyscanner )
158 #define YY_END_OF_BUFFER_CHAR 0
160 /* Size of default input buffer. */
163 /* On IA-64, the buffer size is 16k, not 8k.
164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165 * Ditto for the __ia64__ case accordingly.
167 #define YY_BUF_SIZE 32768
169 #define YY_BUF_SIZE 16384
170 #endif /* __ia64__ */
173 /* The state buf must be large enough to hold one state per character in the main buffer.
175 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
178 #define YY_TYPEDEF_YY_BUFFER_STATE
179 typedef struct yy_buffer_state *YY_BUFFER_STATE;
182 #define EOB_ACT_CONTINUE_SCAN 0
183 #define EOB_ACT_END_OF_FILE 1
184 #define EOB_ACT_LAST_MATCH 2
186 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
187 * access to the local variable yy_act. Since yyless() is a macro, it would break
188 * existing scanners that call yyless() from OUTSIDE cmListFileLexer_yylex.
189 * One obvious solution it to make yy_act a global. I tried that, and saw
190 * a 5% performance hit in a non-yylineno scanner, because yy_act is
191 * normally declared as a register variable-- so it is not worth it.
193 #define YY_LESS_LINENO(n) \
196 for ( yyl = n; yyl < yyleng; ++yyl )\
197 if ( yytext[yyl] == '\n' )\
201 /* Return all but the first "n" matched characters back to the input stream. */
205 /* Undo effects of setting up yytext. */ \
206 int yyless_macro_arg = (n); \
207 YY_LESS_LINENO(yyless_macro_arg);\
208 *yy_cp = yyg->yy_hold_char; \
209 YY_RESTORE_YY_MORE_OFFSET \
210 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
211 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
215 #ifndef YY_TYPEDEF_YY_SIZE_T
216 #define YY_TYPEDEF_YY_SIZE_T
217 typedef size_t yy_size_t;
220 #ifndef YY_STRUCT_YY_BUFFER_STATE
221 #define YY_STRUCT_YY_BUFFER_STATE
222 struct yy_buffer_state
226 char *yy_ch_buf; /* input buffer */
227 char *yy_buf_pos; /* current position in input buffer */
229 /* Size of input buffer in bytes, not including room for EOB
232 yy_size_t yy_buf_size;
234 /* Number of characters read into yy_ch_buf, not including EOB
239 /* Whether we "own" the buffer - i.e., we know we created it,
240 * and can realloc() it to grow it, and should free() it to
243 int yy_is_our_buffer;
245 /* Whether this is an "interactive" input source; if so, and
246 * if we're using stdio for input, then we want to use getc()
247 * instead of fread(), to make sure we stop fetching input after
250 int yy_is_interactive;
252 /* Whether we're considered to be at the beginning of a line.
253 * If so, '^' rules will be active on the next match, otherwise
258 int yy_bs_lineno; /**< The line count. */
259 int yy_bs_column; /**< The column count. */
261 /* Whether to try to fill the input buffer when we reach the
266 int yy_buffer_status;
268 #define YY_BUFFER_NEW 0
269 #define YY_BUFFER_NORMAL 1
270 /* When an EOF's been seen but there's still some text to process
271 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
272 * shouldn't try reading from the input source any more. We might
273 * still have a bunch of tokens to match, though, because of
274 * possible backing-up.
276 * When we actually see the EOF, we change the status to "new"
277 * (via cmListFileLexer_yyrestart()), so that the user can continue scanning by
278 * just pointing yyin at a new input file.
280 #define YY_BUFFER_EOF_PENDING 2
283 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
285 /* We provide macros for accessing buffer states in case in the
286 * future we want to put the buffer states in a more general
289 * Returns the top of the stack, or NULL.
291 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
292 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
295 /* Same as previous macro, but useful when we know that the buffer stack is not
296 * NULL or when we need an lvalue. For internal use only.
298 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
300 void cmListFileLexer_yyrestart (FILE *input_file ,yyscan_t yyscanner );
301 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
302 YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
303 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
304 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
305 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
306 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner );
308 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner );
309 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner );
310 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
312 #define YY_FLUSH_BUFFER cmListFileLexer_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
314 YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
315 YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
316 YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
318 void *cmListFileLexer_yyalloc (yy_size_t ,yyscan_t yyscanner );
319 void *cmListFileLexer_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
320 void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner );
322 #define yy_new_buffer cmListFileLexer_yy_create_buffer
324 #define yy_set_interactive(is_interactive) \
326 if ( ! YY_CURRENT_BUFFER ){ \
327 cmListFileLexer_yyensure_buffer_stack (yyscanner); \
328 YY_CURRENT_BUFFER_LVALUE = \
329 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
331 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
334 #define yy_set_bol(at_bol) \
336 if ( ! YY_CURRENT_BUFFER ){\
337 cmListFileLexer_yyensure_buffer_stack (yyscanner); \
338 YY_CURRENT_BUFFER_LVALUE = \
339 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
341 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
344 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
346 /* Begin user sect3 */
348 #define cmListFileLexer_yywrap(n) 1
349 #define YY_SKIP_YYWRAP
351 typedef unsigned char YY_CHAR;
353 typedef int yy_state_type;
355 #define yytext_ptr yytext_r
357 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
358 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
359 static int yy_get_next_buffer (yyscan_t yyscanner );
360 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
362 /* Done after the current pattern has been matched and before the
363 * corresponding action - sets up yytext.
365 #define YY_DO_BEFORE_ACTION \
366 yyg->yytext_ptr = yy_bp; \
367 yyleng = (size_t) (yy_cp - yy_bp); \
368 yyg->yy_hold_char = *yy_cp; \
370 yyg->yy_c_buf_p = yy_cp;
372 #define YY_NUM_RULES 16
373 #define YY_END_OF_BUFFER 17
374 /* This struct is not used in this scanner,
375 but its presence is necessary. */
378 flex_int32_t yy_verify;
381 static yyconst flex_int16_t yy_accept[45] =
383 0, 0, 0, 0, 17, 6, 14, 1, 8, 2,
384 6, 3, 4, 6, 15, 9, 11, 12, 13, 6,
385 0, 6, 0, 14, 2, 0, 5, 6, 9, 0,
386 10, 0, 7, 0, 0, 0, 7, 0, 7, 0,
390 static yyconst flex_int32_t yy_ec[256] =
392 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
393 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 2, 1, 5, 6, 7, 1, 1, 1, 8,
396 9, 1, 1, 1, 1, 1, 1, 10, 10, 10,
397 10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
398 1, 1, 1, 1, 11, 11, 11, 11, 11, 11,
399 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
400 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
401 1, 12, 1, 1, 11, 1, 11, 11, 11, 11,
403 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
404 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
405 11, 11, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 static yyconst flex_int32_t yy_meta[13] =
424 1, 2, 3, 2, 4, 1, 1, 1, 5, 5,
428 static yyconst flex_int16_t yy_base[56] =
430 0, 0, 10, 20, 38, 32, 0, 109, 109, 0,
431 28, 109, 109, 35, 0, 23, 109, 109, 44, 0,
432 49, 26, 0, 0, 0, 22, 0, 0, 18, 24,
433 109, 0, 61, 20, 0, 18, 0, 17, 16, 0,
434 12, 11, 10, 109, 73, 16, 78, 83, 88, 93,
438 static yyconst flex_int16_t yy_def[56] =
440 44, 1, 45, 45, 44, 44, 46, 44, 44, 47,
441 6, 44, 44, 6, 48, 49, 44, 44, 49, 6,
442 44, 6, 50, 46, 47, 51, 14, 6, 49, 49,
443 44, 21, 44, 21, 52, 53, 33, 51, 33, 54,
444 55, 53, 55, 0, 44, 44, 44, 44, 44, 44,
448 static yyconst flex_int16_t yy_nxt[122] =
450 6, 7, 8, 7, 9, 10, 11, 12, 13, 6,
451 14, 15, 17, 43, 18, 42, 38, 24, 32, 33,
452 32, 19, 17, 36, 18, 37, 33, 41, 29, 30,
453 37, 19, 20, 36, 30, 26, 21, 44, 22, 44,
454 44, 20, 20, 23, 27, 27, 31, 44, 29, 32,
455 32, 44, 44, 33, 44, 34, 44, 44, 32, 32,
456 35, 33, 44, 44, 44, 21, 44, 39, 44, 44,
457 33, 33, 40, 16, 16, 16, 16, 16, 25, 25,
458 44, 25, 25, 28, 28, 44, 28, 28, 29, 29,
459 44, 44, 29, 20, 20, 44, 20, 20, 32, 32,
461 44, 32, 32, 33, 33, 44, 33, 33, 5, 44,
462 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
466 static yyconst flex_int16_t yy_chk[122] =
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 1, 3, 55, 3, 53, 51, 46, 43, 42,
470 41, 3, 4, 39, 4, 38, 36, 34, 30, 29,
471 26, 4, 6, 22, 16, 11, 6, 5, 6, 0,
472 0, 6, 6, 6, 14, 14, 19, 0, 19, 21,
473 21, 0, 0, 21, 0, 21, 0, 0, 21, 21,
474 21, 33, 0, 0, 0, 33, 0, 33, 0, 0,
475 33, 33, 33, 45, 45, 45, 45, 45, 47, 47,
476 0, 47, 47, 48, 48, 0, 48, 48, 49, 49,
477 0, 0, 49, 50, 50, 0, 50, 50, 52, 52,
479 0, 52, 52, 54, 54, 0, 54, 54, 44, 44,
480 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
484 /* Table of booleans, true if rule could match eol. */
485 static yyconst flex_int32_t yy_rule_can_match_eol[17] =
487 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, };
489 /* The intent behind this definition is that it'll catch
490 * any uses of REJECT which flex missed.
492 #define REJECT reject_used_but_not_detected
493 #define yymore() yymore_used_but_not_detected
494 #define YY_MORE_ADJ 0
495 #define YY_RESTORE_YY_MORE_OFFSET
496 #line 1 "cmListFileLexer.in.l"
497 #line 2 "cmListFileLexer.in.l"
498 /*============================================================================
499 CMake - Cross Platform Makefile Generator
500 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
502 Distributed under the OSI-approved BSD License (the "License");
503 see accompanying file Copyright.txt for details.
505 This software is distributed WITHOUT ANY WARRANTY; without even the
506 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
507 See the License for more information.
508 ============================================================================*/
511 This file must be translated to C and modified to build everywhere.
515 flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
517 Modify cmListFileLexer.c:
519 - remove use of the 'register' storage class specifier
520 - remove the yyunput function
521 - add a statement "(void)yyscanner;" to the top of these methods:
522 yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
523 - remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
524 - remove all YY_BREAK lines occurring right after return statements
525 - remove the isatty forward declaration
529 #include "cmStandardLexer.h"
531 /* Setup the proper cmListFileLexer_yylex declaration. */
532 #define YY_EXTRA_TYPE cmListFileLexer*
533 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
535 #include "cmListFileLexer.h"
537 /*--------------------------------------------------------------------------*/
538 struct cmListFileLexer_s
540 cmListFileLexer_Token token;
546 char* string_position;
551 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
553 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
555 static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
557 static void cmListFileLexerInit(cmListFileLexer* lexer);
558 static void cmListFileLexerDestroy(cmListFileLexer* lexer);
560 /* Replace the lexer input function. */
562 #define YY_INPUT(buf, result, max_size) \
563 { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); }
565 /*--------------------------------------------------------------------------*/
567 #line 570 "cmListFileLexer.c"
572 #ifndef YY_NO_UNISTD_H
573 /* Special case for "unistd.h", since it is non-ANSI. We include it way
574 * down here because we want the user's section 1 to have been scanned first.
575 * The user has a chance to override it with an option.
580 #ifndef YY_EXTRA_TYPE
581 #define YY_EXTRA_TYPE void *
584 /* Holds the entire state of the reentrant scanner. */
588 /* User-defined. Not touched by flex. */
589 YY_EXTRA_TYPE yyextra_r;
591 /* The rest are the same as the globals declared in the non-reentrant scanner. */
592 FILE *yyin_r, *yyout_r;
593 size_t yy_buffer_stack_top; /**< index of top of stack. */
594 size_t yy_buffer_stack_max; /**< capacity of stack. */
595 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
602 int yy_did_buffer_switch_on_eof;
603 int yy_start_stack_ptr;
604 int yy_start_stack_depth;
606 yy_state_type yy_last_accepting_state;
607 char* yy_last_accepting_cpos;
616 }; /* end struct yyguts_t */
618 static int yy_init_globals (yyscan_t yyscanner );
620 int cmListFileLexer_yylex_init (yyscan_t* scanner);
622 int cmListFileLexer_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
624 /* Accessor methods to globals.
625 These are made visible to non-reentrant scanners for convenience. */
627 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner );
629 int cmListFileLexer_yyget_debug (yyscan_t yyscanner );
631 void cmListFileLexer_yyset_debug (int debug_flag ,yyscan_t yyscanner );
633 YY_EXTRA_TYPE cmListFileLexer_yyget_extra (yyscan_t yyscanner );
635 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
637 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner );
639 void cmListFileLexer_yyset_in (FILE * in_str ,yyscan_t yyscanner );
641 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner );
643 void cmListFileLexer_yyset_out (FILE * out_str ,yyscan_t yyscanner );
645 int cmListFileLexer_yyget_leng (yyscan_t yyscanner );
647 char *cmListFileLexer_yyget_text (yyscan_t yyscanner );
649 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner );
651 void cmListFileLexer_yyset_lineno (int line_number ,yyscan_t yyscanner );
653 int cmListFileLexer_yyget_column (yyscan_t yyscanner );
655 void cmListFileLexer_yyset_column (int column_no ,yyscan_t yyscanner );
657 /* Macros after this point can all be overridden by user definitions in
661 #ifndef YY_SKIP_YYWRAP
663 extern "C" int cmListFileLexer_yywrap (yyscan_t yyscanner );
665 extern int cmListFileLexer_yywrap (yyscan_t yyscanner );
670 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
673 #ifdef YY_NEED_STRLEN
674 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
680 static int yyinput (yyscan_t yyscanner );
682 static int input (yyscan_t yyscanner );
687 /* Amount of stuff to slurp up with each read. */
688 #ifndef YY_READ_BUF_SIZE
690 /* On IA-64, the buffer size is 16k, not 8k */
691 #define YY_READ_BUF_SIZE 16384
693 #define YY_READ_BUF_SIZE 8192
694 #endif /* __ia64__ */
697 /* Copy whatever the last rule matched to the standard output. */
699 /* This used to be an fputs(), but since the string might contain NUL's,
700 * we now use fwrite().
702 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
705 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
706 * is returned in "result".
709 #define YY_INPUT(buf,result,max_size) \
710 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
714 for ( n = 0; n < max_size && \
715 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
718 buf[n++] = (char) c; \
719 if ( c == EOF && ferror( yyin ) ) \
720 YY_FATAL_ERROR( "input in flex scanner failed" ); \
726 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
728 if( errno != EINTR) \
730 YY_FATAL_ERROR( "input in flex scanner failed" ); \
741 /* No semi-colon after return; correct usage is to write "yyterminate();" -
742 * we don't want an extra ';' after the "return" because that will cause
743 * some compilers to complain about unreachable statements.
746 #define yyterminate() return YY_NULL
749 /* Number of entries by which start-condition stack grows. */
750 #ifndef YY_START_STACK_INCR
751 #define YY_START_STACK_INCR 25
754 /* Report a fatal error. */
755 #ifndef YY_FATAL_ERROR
756 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
759 /* end tables serialization structures and prototypes */
761 /* Default declaration of generated scanner - a define so the user can
762 * easily add parameters.
765 #define YY_DECL_IS_OURS 1
767 extern int cmListFileLexer_yylex (yyscan_t yyscanner);
769 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner)
770 #endif /* !YY_DECL */
772 /* Code executed at the beginning of each rule, after yytext and yyleng
775 #ifndef YY_USER_ACTION
776 #define YY_USER_ACTION
779 /* Code executed at the end of each rule. */
781 #define YY_BREAK break;
784 #define YY_RULE_SETUP \
787 /** The main scanner function which does all the work.
791 yy_state_type yy_current_state;
794 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
796 #line 82 "cmListFileLexer.in.l"
799 #line 804 "cmListFileLexer.c"
809 if ( ! yyg->yy_start )
810 yyg->yy_start = 1; /* first start state */
818 if ( ! YY_CURRENT_BUFFER ) {
819 cmListFileLexer_yyensure_buffer_stack (yyscanner);
820 YY_CURRENT_BUFFER_LVALUE =
821 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
824 cmListFileLexer_yy_load_buffer_state(yyscanner );
827 while ( 1 ) /* loops until end-of-file is reached */
829 yy_cp = yyg->yy_c_buf_p;
831 /* Support of yytext. */
832 *yy_cp = yyg->yy_hold_char;
834 /* yy_bp points to the position in yy_ch_buf of the start of
839 yy_current_state = yyg->yy_start;
843 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
844 if ( yy_accept[yy_current_state] )
846 yyg->yy_last_accepting_state = yy_current_state;
847 yyg->yy_last_accepting_cpos = yy_cp;
849 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
851 yy_current_state = (int) yy_def[yy_current_state];
852 if ( yy_current_state >= 45 )
853 yy_c = yy_meta[(unsigned int) yy_c];
855 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
858 while ( yy_base[yy_current_state] != 109 );
861 yy_act = yy_accept[yy_current_state];
863 { /* have to back up */
864 yy_cp = yyg->yy_last_accepting_cpos;
865 yy_current_state = yyg->yy_last_accepting_state;
866 yy_act = yy_accept[yy_current_state];
871 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
874 for ( yyl = 0; yyl < yyleng; ++yyl )
875 if ( yytext[yyl] == '\n' )
883 do_action: /* This label is used only to access EOF actions. */
886 { /* beginning of action switch */
887 case 0: /* must back up */
888 /* undo the effects of YY_DO_BEFORE_ACTION */
889 *yy_cp = yyg->yy_hold_char;
890 yy_cp = yyg->yy_last_accepting_cpos;
891 yy_current_state = yyg->yy_last_accepting_state;
895 /* rule 1 can match eol */
897 #line 84 "cmListFileLexer.in.l"
899 lexer->token.type = cmListFileLexer_Token_Newline;
900 cmListFileLexerSetToken(lexer, yytext, yyleng);
907 #line 92 "cmListFileLexer.in.l"
909 lexer->column += yyleng;
914 #line 96 "cmListFileLexer.in.l"
916 lexer->token.type = cmListFileLexer_Token_ParenLeft;
917 cmListFileLexerSetToken(lexer, yytext, yyleng);
918 lexer->column += yyleng;
923 #line 103 "cmListFileLexer.in.l"
925 lexer->token.type = cmListFileLexer_Token_ParenRight;
926 cmListFileLexerSetToken(lexer, yytext, yyleng);
927 lexer->column += yyleng;
932 #line 110 "cmListFileLexer.in.l"
934 lexer->token.type = cmListFileLexer_Token_Identifier;
935 cmListFileLexerSetToken(lexer, yytext, yyleng);
936 lexer->column += yyleng;
941 #line 117 "cmListFileLexer.in.l"
943 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
944 cmListFileLexerSetToken(lexer, yytext, yyleng);
945 lexer->column += yyleng;
950 #line 124 "cmListFileLexer.in.l"
952 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
953 cmListFileLexerSetToken(lexer, yytext, yyleng);
954 lexer->column += yyleng;
959 #line 131 "cmListFileLexer.in.l"
961 lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
962 cmListFileLexerSetToken(lexer, "", 0);
963 lexer->column += yyleng;
969 #line 138 "cmListFileLexer.in.l"
971 cmListFileLexerAppend(lexer, yytext, yyleng);
972 lexer->column += yyleng;
976 /* rule 10 can match eol */
978 #line 143 "cmListFileLexer.in.l"
980 cmListFileLexerAppend(lexer, yytext, yyleng);
986 /* rule 11 can match eol */
988 #line 149 "cmListFileLexer.in.l"
990 cmListFileLexerAppend(lexer, yytext, yyleng);
997 #line 155 "cmListFileLexer.in.l"
999 lexer->column += yyleng;
1005 #line 161 "cmListFileLexer.in.l"
1007 cmListFileLexerAppend(lexer, yytext, yyleng);
1008 lexer->column += yyleng;
1011 case YY_STATE_EOF(STRING):
1012 #line 166 "cmListFileLexer.in.l"
1014 lexer->token.type = cmListFileLexer_Token_BadString;
1020 #line 172 "cmListFileLexer.in.l"
1022 lexer->token.type = cmListFileLexer_Token_Space;
1023 cmListFileLexerSetToken(lexer, yytext, yyleng);
1024 lexer->column += yyleng;
1029 #line 179 "cmListFileLexer.in.l"
1031 lexer->token.type = cmListFileLexer_Token_BadCharacter;
1032 cmListFileLexerSetToken(lexer, yytext, yyleng);
1033 lexer->column += yyleng;
1036 case YY_STATE_EOF(INITIAL):
1037 #line 186 "cmListFileLexer.in.l"
1039 lexer->token.type = cmListFileLexer_Token_None;
1040 cmListFileLexerSetToken(lexer, 0, 0);
1045 #line 192 "cmListFileLexer.in.l"
1048 #line 1064 "cmListFileLexer.c"
1050 case YY_END_OF_BUFFER:
1052 /* Amount of text matched not including the EOB char. */
1053 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1055 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1056 *yy_cp = yyg->yy_hold_char;
1057 YY_RESTORE_YY_MORE_OFFSET
1059 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1061 /* We're scanning a new file or input source. It's
1062 * possible that this happened because the user
1063 * just pointed yyin at a new source and called
1064 * cmListFileLexer_yylex(). If so, then we have to assure
1065 * consistency between YY_CURRENT_BUFFER and our
1066 * globals. Here is the right place to do so, because
1067 * this is the first action (other than possibly a
1068 * back-up) that will match for the new input source.
1070 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1071 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1072 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1075 /* Note that here we test for yy_c_buf_p "<=" to the position
1076 * of the first EOB in the buffer, since yy_c_buf_p will
1077 * already have been incremented past the NUL character
1078 * (since all states make transitions on EOB to the
1079 * end-of-buffer state). Contrast this with the test
1082 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1083 { /* This was really a NUL. */
1084 yy_state_type yy_next_state;
1086 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1088 yy_current_state = yy_get_previous_state( yyscanner );
1090 /* Okay, we're now positioned to make the NUL
1091 * transition. We couldn't have
1092 * yy_get_previous_state() go ahead and do it
1093 * for us because it doesn't know how to deal
1094 * with the possibility of jamming (and we don't
1095 * want to build jamming into it because then it
1096 * will run more slowly).
1099 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1101 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1103 if ( yy_next_state )
1105 /* Consume the NUL. */
1106 yy_cp = ++yyg->yy_c_buf_p;
1107 yy_current_state = yy_next_state;
1113 yy_cp = yyg->yy_c_buf_p;
1114 goto yy_find_action;
1118 else switch ( yy_get_next_buffer( yyscanner ) )
1120 case EOB_ACT_END_OF_FILE:
1122 yyg->yy_did_buffer_switch_on_eof = 0;
1124 if ( cmListFileLexer_yywrap(yyscanner ) )
1126 /* Note: because we've taken care in
1127 * yy_get_next_buffer() to have set up
1128 * yytext, we can now set up
1129 * yy_c_buf_p so that if some total
1130 * hoser (like flex itself) wants to
1131 * call the scanner after we return the
1132 * YY_NULL, it'll still work - another
1133 * YY_NULL will get returned.
1135 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1137 yy_act = YY_STATE_EOF(YY_START);
1143 if ( ! yyg->yy_did_buffer_switch_on_eof )
1149 case EOB_ACT_CONTINUE_SCAN:
1151 yyg->yytext_ptr + yy_amount_of_matched_text;
1153 yy_current_state = yy_get_previous_state( yyscanner );
1155 yy_cp = yyg->yy_c_buf_p;
1156 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1159 case EOB_ACT_LAST_MATCH:
1161 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1163 yy_current_state = yy_get_previous_state( yyscanner );
1165 yy_cp = yyg->yy_c_buf_p;
1166 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1167 goto yy_find_action;
1174 "fatal flex scanner internal error--no action found" );
1175 } /* end of action switch */
1176 } /* end of scanning one token */
1177 } /* end of cmListFileLexer_yylex */
1179 /* yy_get_next_buffer - try to read in a new buffer
1181 * Returns a code representing an action:
1182 * EOB_ACT_LAST_MATCH -
1183 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1184 * EOB_ACT_END_OF_FILE - end of file
1186 static int yy_get_next_buffer (yyscan_t yyscanner)
1188 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1189 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1190 char *source = yyg->yytext_ptr;
1191 int number_to_move, i;
1194 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1196 "fatal flex scanner internal error--end of buffer missed" );
1198 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1199 { /* Don't try to fill the buffer, so this is an EOF. */
1200 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1202 /* We matched a single character, the EOB, so
1203 * treat this as a final EOF.
1205 return EOB_ACT_END_OF_FILE;
1210 /* We matched some text prior to the EOB, first
1213 return EOB_ACT_LAST_MATCH;
1217 /* Try to read more data. */
1219 /* First move last chars to start of buffer. */
1220 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1222 for ( i = 0; i < number_to_move; ++i )
1223 *(dest++) = *(source++);
1225 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1226 /* don't do the read, it's not guaranteed to return an EOF,
1229 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1234 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1236 while ( num_to_read <= 0 )
1237 { /* Not enough room in the buffer - grow it. */
1239 /* just a shorter name for the current buffer */
1240 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1242 int yy_c_buf_p_offset =
1243 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1245 if ( b->yy_is_our_buffer )
1247 int new_size = b->yy_buf_size * 2;
1249 if ( new_size <= 0 )
1250 b->yy_buf_size += b->yy_buf_size / 8;
1252 b->yy_buf_size *= 2;
1254 b->yy_ch_buf = (char *)
1255 /* Include room in for 2 EOB chars. */
1256 cmListFileLexer_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1259 /* Can't grow it, we don't own it. */
1262 if ( ! b->yy_ch_buf )
1264 "fatal error - scanner input buffer overflow" );
1266 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1268 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1273 if ( num_to_read > YY_READ_BUF_SIZE )
1274 num_to_read = YY_READ_BUF_SIZE;
1276 /* Read in more data. */
1277 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1278 yyg->yy_n_chars, (size_t) num_to_read );
1280 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1283 if ( yyg->yy_n_chars == 0 )
1285 if ( number_to_move == YY_MORE_ADJ )
1287 ret_val = EOB_ACT_END_OF_FILE;
1288 cmListFileLexer_yyrestart(yyin ,yyscanner);
1293 ret_val = EOB_ACT_LAST_MATCH;
1294 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1295 YY_BUFFER_EOF_PENDING;
1300 ret_val = EOB_ACT_CONTINUE_SCAN;
1302 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1303 /* Extend the array by 50%, plus the number we really need. */
1304 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1305 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1306 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1307 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1310 yyg->yy_n_chars += number_to_move;
1311 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1312 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1314 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1319 /* yy_get_previous_state - get the state just before the EOB char was reached */
1321 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1323 yy_state_type yy_current_state;
1325 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1327 yy_current_state = yyg->yy_start;
1329 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1331 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1332 if ( yy_accept[yy_current_state] )
1334 yyg->yy_last_accepting_state = yy_current_state;
1335 yyg->yy_last_accepting_cpos = yy_cp;
1337 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1339 yy_current_state = (int) yy_def[yy_current_state];
1340 if ( yy_current_state >= 45 )
1341 yy_c = yy_meta[(unsigned int) yy_c];
1343 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1346 return yy_current_state;
1349 /* yy_try_NUL_trans - try to make a transition on the NUL character
1352 * next_state = yy_try_NUL_trans( current_state );
1354 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1357 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1358 char *yy_cp = yyg->yy_c_buf_p;
1361 if ( yy_accept[yy_current_state] )
1363 yyg->yy_last_accepting_state = yy_current_state;
1364 yyg->yy_last_accepting_cpos = yy_cp;
1366 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1368 yy_current_state = (int) yy_def[yy_current_state];
1369 if ( yy_current_state >= 45 )
1370 yy_c = yy_meta[(unsigned int) yy_c];
1372 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1373 yy_is_jam = (yy_current_state == 44);
1375 return yy_is_jam ? 0 : yy_current_state;
1380 static int yyinput (yyscan_t yyscanner)
1382 static int input (yyscan_t yyscanner)
1387 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1389 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1391 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1393 /* yy_c_buf_p now points to the character we want to return.
1394 * If this occurs *before* the EOB characters, then it's a
1395 * valid NUL; if not, then we've hit the end of the buffer.
1397 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1398 /* This was really a NUL. */
1399 *yyg->yy_c_buf_p = '\0';
1402 { /* need more input */
1403 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1406 switch ( yy_get_next_buffer( yyscanner ) )
1408 case EOB_ACT_LAST_MATCH:
1409 /* This happens because yy_g_n_b()
1410 * sees that we've accumulated a
1411 * token and flags that we need to
1412 * try matching the token before
1413 * proceeding. But for input(),
1414 * there's no matching to consider.
1415 * So convert the EOB_ACT_LAST_MATCH
1416 * to EOB_ACT_END_OF_FILE.
1419 /* Reset buffer status. */
1420 cmListFileLexer_yyrestart(yyin ,yyscanner);
1424 case EOB_ACT_END_OF_FILE:
1426 if ( cmListFileLexer_yywrap(yyscanner ) )
1429 if ( ! yyg->yy_did_buffer_switch_on_eof )
1432 return yyinput(yyscanner);
1434 return input(yyscanner);
1438 case EOB_ACT_CONTINUE_SCAN:
1439 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1445 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1446 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1447 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1458 #endif /* ifndef YY_NO_INPUT */
1460 /** Immediately switch to a different input stream.
1461 * @param input_file A readable stream.
1462 * @param yyscanner The scanner object.
1463 * @note This function does not reset the start condition to @c INITIAL .
1465 void cmListFileLexer_yyrestart (FILE * input_file , yyscan_t yyscanner)
1467 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1469 if ( ! YY_CURRENT_BUFFER ){
1470 cmListFileLexer_yyensure_buffer_stack (yyscanner);
1471 YY_CURRENT_BUFFER_LVALUE =
1472 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1475 cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1476 cmListFileLexer_yy_load_buffer_state(yyscanner );
1479 /** Switch to a different input buffer.
1480 * @param new_buffer The new input buffer.
1481 * @param yyscanner The scanner object.
1483 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1487 /* TODO. We should be able to replace this entire function body
1489 * cmListFileLexer_yypop_buffer_state();
1490 * cmListFileLexer_yypush_buffer_state(new_buffer);
1492 cmListFileLexer_yyensure_buffer_stack (yyscanner);
1493 if ( YY_CURRENT_BUFFER == new_buffer )
1496 if ( YY_CURRENT_BUFFER )
1498 /* Flush out information for old buffer. */
1499 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1500 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1501 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1504 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1505 cmListFileLexer_yy_load_buffer_state(yyscanner );
1507 /* We don't actually know whether we did this switch during
1508 * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
1509 * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
1510 * to go ahead and always set it.
1512 yyg->yy_did_buffer_switch_on_eof = 1;
1515 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
1517 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1518 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1519 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1520 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1521 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1524 /** Allocate and initialize an input buffer state.
1525 * @param file A readable stream.
1526 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1527 * @param yyscanner The scanner object.
1528 * @return the allocated buffer state.
1530 YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1534 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1536 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
1538 b->yy_buf_size = size;
1540 /* yy_ch_buf has to be 2 characters longer than the size given because
1541 * we need to put in 2 end-of-buffer characters.
1543 b->yy_ch_buf = (char *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner );
1544 if ( ! b->yy_ch_buf )
1545 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
1547 b->yy_is_our_buffer = 1;
1549 cmListFileLexer_yy_init_buffer(b,file ,yyscanner);
1554 /** Destroy the buffer.
1555 * @param b a buffer created with cmListFileLexer_yy_create_buffer()
1556 * @param yyscanner The scanner object.
1558 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1560 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1565 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1566 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1568 if ( b->yy_is_our_buffer )
1569 cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner );
1571 cmListFileLexer_yyfree((void *) b ,yyscanner );
1574 /* Initializes or reinitializes a buffer.
1575 * This function is sometimes called more than once on the same buffer,
1576 * such as during a cmListFileLexer_yyrestart() or at EOF.
1578 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1582 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1584 cmListFileLexer_yy_flush_buffer(b ,yyscanner);
1586 b->yy_input_file = file;
1587 b->yy_fill_buffer = 1;
1589 /* If b is the current buffer, then cmListFileLexer_yy_init_buffer was _probably_
1590 * called from cmListFileLexer_yyrestart() or through yy_get_next_buffer.
1591 * In that case, we don't want to reset the lineno or column.
1593 if (b != YY_CURRENT_BUFFER){
1594 b->yy_bs_lineno = 1;
1595 b->yy_bs_column = 0;
1598 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1603 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1604 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1605 * @param yyscanner The scanner object.
1607 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1609 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1615 /* We always need two end-of-buffer characters. The first causes
1616 * a transition to the end-of-buffer state. The second causes
1617 * a jam in that state.
1619 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1620 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1622 b->yy_buf_pos = &b->yy_ch_buf[0];
1625 b->yy_buffer_status = YY_BUFFER_NEW;
1627 if ( b == YY_CURRENT_BUFFER )
1628 cmListFileLexer_yy_load_buffer_state(yyscanner );
1631 /** Pushes the new state onto the stack. The new state becomes
1632 * the current state. This function will allocate the stack
1634 * @param new_buffer The new state.
1635 * @param yyscanner The scanner object.
1637 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1639 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1640 if (new_buffer == NULL)
1643 cmListFileLexer_yyensure_buffer_stack(yyscanner);
1645 /* This block is copied from cmListFileLexer_yy_switch_to_buffer. */
1646 if ( YY_CURRENT_BUFFER )
1648 /* Flush out information for old buffer. */
1649 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1650 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1651 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1654 /* Only push if top exists. Otherwise, replace top. */
1655 if (YY_CURRENT_BUFFER)
1656 yyg->yy_buffer_stack_top++;
1657 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1659 /* copied from cmListFileLexer_yy_switch_to_buffer. */
1660 cmListFileLexer_yy_load_buffer_state(yyscanner );
1661 yyg->yy_did_buffer_switch_on_eof = 1;
1664 /** Removes and deletes the top of the stack, if present.
1665 * The next element becomes the new top.
1666 * @param yyscanner The scanner object.
1668 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
1670 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1671 if (!YY_CURRENT_BUFFER)
1674 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1675 YY_CURRENT_BUFFER_LVALUE = NULL;
1676 if (yyg->yy_buffer_stack_top > 0)
1677 --yyg->yy_buffer_stack_top;
1679 if (YY_CURRENT_BUFFER) {
1680 cmListFileLexer_yy_load_buffer_state(yyscanner );
1681 yyg->yy_did_buffer_switch_on_eof = 1;
1685 /* Allocates the stack if it does not exist.
1686 * Guarantees space for at least one push.
1688 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
1691 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1693 if (!yyg->yy_buffer_stack) {
1695 /* First allocation is just for 2 elements, since we don't know if this
1696 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1697 * immediate realloc on the next call.
1700 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
1701 (num_to_alloc * sizeof(struct yy_buffer_state*)
1703 if ( ! yyg->yy_buffer_stack )
1704 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
1706 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1708 yyg->yy_buffer_stack_max = num_to_alloc;
1709 yyg->yy_buffer_stack_top = 0;
1713 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1715 /* Increase the buffer to prepare for a possible push. */
1716 int grow_size = 8 /* arbitrary grow size */;
1718 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1719 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyrealloc
1720 (yyg->yy_buffer_stack,
1721 num_to_alloc * sizeof(struct yy_buffer_state*)
1723 if ( ! yyg->yy_buffer_stack )
1724 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
1726 /* zero only the new slots.*/
1727 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1728 yyg->yy_buffer_stack_max = num_to_alloc;
1732 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1733 * @param base the character buffer
1734 * @param size the size in bytes of the character buffer
1735 * @param yyscanner The scanner object.
1736 * @return the newly allocated buffer state object.
1738 YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1743 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1744 base[size-1] != YY_END_OF_BUFFER_CHAR )
1745 /* They forgot to leave room for the EOB's. */
1748 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1750 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
1752 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1753 b->yy_buf_pos = b->yy_ch_buf = base;
1754 b->yy_is_our_buffer = 0;
1755 b->yy_input_file = 0;
1756 b->yy_n_chars = b->yy_buf_size;
1757 b->yy_is_interactive = 0;
1759 b->yy_fill_buffer = 0;
1760 b->yy_buffer_status = YY_BUFFER_NEW;
1762 cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
1767 /** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
1768 * scan from a @e copy of @a str.
1769 * @param yystr a NUL-terminated string to scan
1770 * @param yyscanner The scanner object.
1771 * @return the newly allocated buffer state object.
1772 * @note If you want to scan bytes that may contain NUL values, then use
1773 * cmListFileLexer_yy_scan_bytes() instead.
1775 YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
1778 return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1781 /** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will
1782 * scan from a @e copy of @a bytes.
1783 * @param yybytes the byte buffer to scan
1784 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1785 * @param yyscanner The scanner object.
1786 * @return the newly allocated buffer state object.
1788 YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
1795 /* Get memory for full buffer, including space for trailing EOB's. */
1796 n = _yybytes_len + 2;
1797 buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
1799 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
1801 for ( i = 0; i < _yybytes_len; ++i )
1802 buf[i] = yybytes[i];
1804 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1806 b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
1808 YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" );
1810 /* It's okay to grow etc. this buffer, and we should throw it
1811 * away when we're done.
1813 b->yy_is_our_buffer = 1;
1818 #ifndef YY_EXIT_FAILURE
1819 #define YY_EXIT_FAILURE 2
1822 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1825 (void) fprintf( stderr, "%s\n", msg );
1826 exit( YY_EXIT_FAILURE );
1829 /* Redefine yyless() so it works in section 3 code. */
1835 /* Undo effects of setting up yytext. */ \
1836 int yyless_macro_arg = (n); \
1837 YY_LESS_LINENO(yyless_macro_arg);\
1838 yytext[yyleng] = yyg->yy_hold_char; \
1839 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1840 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1841 *yyg->yy_c_buf_p = '\0'; \
1842 yyleng = yyless_macro_arg; \
1846 /* Accessor methods (get/set functions) to struct members. */
1848 /** Get the user-defined data for this scanner.
1849 * @param yyscanner The scanner object.
1851 YY_EXTRA_TYPE cmListFileLexer_yyget_extra (yyscan_t yyscanner)
1853 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1857 /** Get the current line number.
1858 * @param yyscanner The scanner object.
1860 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner)
1862 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1864 if (! YY_CURRENT_BUFFER)
1870 /** Get the current column number.
1871 * @param yyscanner The scanner object.
1873 int cmListFileLexer_yyget_column (yyscan_t yyscanner)
1875 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1877 if (! YY_CURRENT_BUFFER)
1883 /** Get the input stream.
1884 * @param yyscanner The scanner object.
1886 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner)
1888 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1892 /** Get the output stream.
1893 * @param yyscanner The scanner object.
1895 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner)
1897 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1901 /** Get the length of the current token.
1902 * @param yyscanner The scanner object.
1904 int cmListFileLexer_yyget_leng (yyscan_t yyscanner)
1906 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1910 /** Get the current token.
1911 * @param yyscanner The scanner object.
1914 char *cmListFileLexer_yyget_text (yyscan_t yyscanner)
1916 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1920 /** Set the user-defined data. This data is never touched by the scanner.
1921 * @param user_defined The data to be associated with this scanner.
1922 * @param yyscanner The scanner object.
1924 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
1926 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1927 yyextra = user_defined ;
1930 /** Set the current line number.
1931 * @param line_number
1932 * @param yyscanner The scanner object.
1934 void cmListFileLexer_yyset_lineno (int line_number , yyscan_t yyscanner)
1936 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1938 /* lineno is only valid if an input buffer exists. */
1939 if (! YY_CURRENT_BUFFER )
1940 yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner);
1942 yylineno = line_number;
1945 /** Set the current column.
1946 * @param line_number
1947 * @param yyscanner The scanner object.
1949 void cmListFileLexer_yyset_column (int column_no , yyscan_t yyscanner)
1951 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1953 /* column is only valid if an input buffer exists. */
1954 if (! YY_CURRENT_BUFFER )
1955 yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner);
1957 yycolumn = column_no;
1960 /** Set the input stream. This does not discard the current
1962 * @param in_str A readable stream.
1963 * @param yyscanner The scanner object.
1964 * @see cmListFileLexer_yy_switch_to_buffer
1966 void cmListFileLexer_yyset_in (FILE * in_str , yyscan_t yyscanner)
1968 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1972 void cmListFileLexer_yyset_out (FILE * out_str , yyscan_t yyscanner)
1974 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1978 int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
1980 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1981 return yy_flex_debug;
1984 void cmListFileLexer_yyset_debug (int bdebug , yyscan_t yyscanner)
1986 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1987 yy_flex_debug = bdebug ;
1990 /* Accessor methods for yylval and yylloc */
1992 /* User-visible API */
1994 /* cmListFileLexer_yylex_init is special because it creates the scanner itself, so it is
1995 * the ONLY reentrant function that doesn't take the scanner as the last argument.
1996 * That's why we explicitly handle the declaration, instead of using our macros.
1999 int cmListFileLexer_yylex_init(yyscan_t* ptr_yy_globals)
2002 if (ptr_yy_globals == NULL){
2007 *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), NULL );
2009 if (*ptr_yy_globals == NULL){
2014 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2015 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2017 return yy_init_globals ( *ptr_yy_globals );
2020 /* cmListFileLexer_yylex_init_extra has the same functionality as cmListFileLexer_yylex_init, but follows the
2021 * convention of taking the scanner as the last argument. Note however, that
2022 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2023 * is the reason, too, why this function also must handle its own declaration).
2024 * The user defined value in the first argument will be available to cmListFileLexer_yyalloc in
2025 * the yyextra field.
2028 int cmListFileLexer_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2031 struct yyguts_t dummy_yyguts;
2033 cmListFileLexer_yyset_extra (yy_user_defined, &dummy_yyguts);
2035 if (ptr_yy_globals == NULL){
2040 *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2042 if (*ptr_yy_globals == NULL){
2047 /* By setting to 0xAA, we expose bugs in
2048 yy_init_globals. Leave at 0x00 for releases. */
2049 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2051 cmListFileLexer_yyset_extra (yy_user_defined, *ptr_yy_globals);
2053 return yy_init_globals ( *ptr_yy_globals );
2056 static int yy_init_globals (yyscan_t yyscanner)
2058 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2059 /* Initialization is the same as for the non-reentrant scanner.
2060 * This function is called from cmListFileLexer_yylex_destroy(), so don't allocate here.
2063 yyg->yy_buffer_stack = 0;
2064 yyg->yy_buffer_stack_top = 0;
2065 yyg->yy_buffer_stack_max = 0;
2066 yyg->yy_c_buf_p = (char *) 0;
2070 yyg->yy_start_stack_ptr = 0;
2071 yyg->yy_start_stack_depth = 0;
2072 yyg->yy_start_stack = NULL;
2074 /* Defined in main.c */
2083 /* For future reference: Set errno on error, since we are called by
2084 * cmListFileLexer_yylex_init()
2089 /* cmListFileLexer_yylex_destroy is for both reentrant and non-reentrant scanners. */
2090 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner)
2092 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2094 /* Pop the buffer stack, destroying each element. */
2095 while(YY_CURRENT_BUFFER){
2096 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2097 YY_CURRENT_BUFFER_LVALUE = NULL;
2098 cmListFileLexer_yypop_buffer_state(yyscanner);
2101 /* Destroy the stack itself. */
2102 cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner);
2103 yyg->yy_buffer_stack = NULL;
2105 /* Destroy the start condition stack. */
2106 cmListFileLexer_yyfree(yyg->yy_start_stack ,yyscanner );
2107 yyg->yy_start_stack = NULL;
2109 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2110 * cmListFileLexer_yylex() is called, initialization will occur. */
2111 yy_init_globals( yyscanner);
2113 /* Destroy the main struct (reentrant only). */
2114 cmListFileLexer_yyfree ( yyscanner , yyscanner );
2119 * Internal utility routines.
2123 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2126 for ( i = 0; i < n; ++i )
2131 #ifdef YY_NEED_STRLEN
2132 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2135 for ( n = 0; s[n]; ++n )
2142 void *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner)
2145 return (void *) malloc( size );
2148 void *cmListFileLexer_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2150 /* The cast to (char *) in the following accommodates both
2151 * implementations that use char* generic pointers, and those
2152 * that use void* generic pointers. It works with the latter
2153 * because both ANSI C and C++ allow castless assignment from
2154 * any pointer type to void*, and deal with argument conversions
2155 * as though doing an assignment.
2158 return (void *) realloc( (char *) ptr, size );
2161 void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
2164 free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
2167 #define YYTABLES_NAME "yytables"
2169 #line 192 "cmListFileLexer.in.l"
2173 /*--------------------------------------------------------------------------*/
2174 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
2177 /* Set the token line and column number. */
2178 lexer->token.line = lexer->line;
2179 lexer->token.column = lexer->column;
2181 /* Use the same buffer if possible. */
2182 if(lexer->token.text)
2184 if(text && length < lexer->size)
2186 strcpy(lexer->token.text, text);
2187 lexer->token.length = length;
2190 free(lexer->token.text);
2191 lexer->token.text = 0;
2195 /* Need to extend the buffer. */
2198 lexer->token.text = strdup(text);
2199 lexer->token.length = length;
2200 lexer->size = length+1;
2204 lexer->token.length = 0;
2208 /*--------------------------------------------------------------------------*/
2209 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
2215 /* If the appended text will fit in the buffer, do not reallocate. */
2216 newSize = lexer->token.length + length + 1;
2217 if(lexer->token.text && newSize <= lexer->size)
2219 strcpy(lexer->token.text+lexer->token.length, text);
2220 lexer->token.length += length;
2224 /* We need to extend the buffer. */
2225 temp = malloc(newSize);
2226 if(lexer->token.text)
2228 memcpy(temp, lexer->token.text, lexer->token.length);
2229 free(lexer->token.text);
2231 memcpy(temp+lexer->token.length, text, length);
2232 temp[lexer->token.length+length] = 0;
2233 lexer->token.text = temp;
2234 lexer->token.length += length;
2235 lexer->size = newSize;
2238 /*--------------------------------------------------------------------------*/
2239 static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
2246 return (int)fread(buffer, 1, bufferSize, lexer->file);
2248 else if(lexer->string_left)
2250 int length = lexer->string_left;
2251 if((int)bufferSize < length) { length = (int)bufferSize; }
2252 memcpy(buffer, lexer->string_position, length);
2253 lexer->string_position += length;
2254 lexer->string_left -= length;
2261 /*--------------------------------------------------------------------------*/
2262 static void cmListFileLexerInit(cmListFileLexer* lexer)
2264 if(lexer->file || lexer->string_buffer)
2266 cmListFileLexer_yylex_init(&lexer->scanner);
2267 cmListFileLexer_yyset_extra(lexer, lexer->scanner);
2271 /*--------------------------------------------------------------------------*/
2272 static void cmListFileLexerDestroy(cmListFileLexer* lexer)
2274 if(lexer->file || lexer->string_buffer)
2276 cmListFileLexer_yylex_destroy(lexer->scanner);
2279 fclose(lexer->file);
2282 if(lexer->string_buffer)
2284 free(lexer->string_buffer);
2285 lexer->string_buffer = 0;
2286 lexer->string_left = 0;
2287 lexer->string_position = 0;
2292 /*--------------------------------------------------------------------------*/
2293 cmListFileLexer* cmListFileLexer_New()
2295 cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
2300 memset(lexer, 0, sizeof(*lexer));
2306 /*--------------------------------------------------------------------------*/
2307 void cmListFileLexer_Delete(cmListFileLexer* lexer)
2309 cmListFileLexer_SetFileName(lexer, 0);
2313 /*--------------------------------------------------------------------------*/
2314 int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name)
2317 cmListFileLexerDestroy(lexer);
2320 lexer->file = fopen(name, "r");
2326 cmListFileLexerInit(lexer);
2330 /*--------------------------------------------------------------------------*/
2331 int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
2334 cmListFileLexerDestroy(lexer);
2337 int length = (int)strlen(text);
2338 lexer->string_buffer = (char*)malloc(length+1);
2339 if(lexer->string_buffer)
2341 strcpy(lexer->string_buffer, text);
2342 lexer->string_position = lexer->string_buffer;
2343 lexer->string_left = length;
2350 cmListFileLexerInit(lexer);
2354 /*--------------------------------------------------------------------------*/
2355 cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
2361 if(cmListFileLexer_yylex(lexer->scanner, lexer))
2363 return &lexer->token;
2367 cmListFileLexer_SetFileName(lexer, 0);
2372 /*--------------------------------------------------------------------------*/
2373 long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
2385 /*--------------------------------------------------------------------------*/
2386 long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
2390 return lexer->column;
2398 /*--------------------------------------------------------------------------*/
2399 const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
2400 cmListFileLexer_Type type)
2405 case cmListFileLexer_Token_None: return "nothing";
2406 case cmListFileLexer_Token_Space: return "space";
2407 case cmListFileLexer_Token_Newline: return "newline";
2408 case cmListFileLexer_Token_Identifier: return "identifier";
2409 case cmListFileLexer_Token_ParenLeft: return "left paren";
2410 case cmListFileLexer_Token_ParenRight: return "right paren";
2411 case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
2412 case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
2413 case cmListFileLexer_Token_BadCharacter: return "bad character";
2414 case cmListFileLexer_Token_BadString: return "unterminated string";
2416 return "unknown token";