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 31
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 typedef int8_t flex_int8_t
;
37 typedef uint8_t flex_uint8_t
;
38 typedef int16_t flex_int16_t
;
39 typedef uint16_t flex_uint16_t
;
40 typedef int32_t flex_int32_t
;
41 typedef uint32_t flex_uint32_t
;
43 typedef signed char flex_int8_t
;
44 typedef short int flex_int16_t
;
45 typedef int flex_int32_t
;
46 typedef unsigned char flex_uint8_t
;
47 typedef unsigned short int flex_uint16_t
;
48 typedef unsigned int flex_uint32_t
;
51 /* Limits of integral types. */
53 #define INT8_MIN (-128)
56 #define INT16_MIN (-32767-1)
59 #define INT32_MIN (-2147483647-1)
62 #define INT8_MAX (127)
65 #define INT16_MAX (32767)
68 #define INT32_MAX (2147483647)
71 #define UINT8_MAX (255U)
74 #define UINT16_MAX (65535U)
77 #define UINT32_MAX (4294967295U)
80 #endif /* ! FLEXINT_H */
84 /* The "const" storage-class-modifier is valid. */
87 #else /* ! __cplusplus */
94 #endif /* ! __cplusplus */
102 /* Returned upon end-of-file. */
105 /* Promotes a possibly negative, possibly signed char to an unsigned
106 * integer for use as an array index. If the signed char is negative,
107 * we want to instead treat it as an 8-bit unsigned char, hence the
110 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
112 /* An opaque pointer. */
113 #ifndef YY_TYPEDEF_YY_SCANNER_T
114 #define YY_TYPEDEF_YY_SCANNER_T
115 typedef void* yyscan_t
;
118 /* For convenience, these vars (plus the bison vars far below)
119 are macros in the reentrant scanner. */
120 #define yyin yyg->yyin_r
121 #define yyout yyg->yyout_r
122 #define yyextra yyg->yyextra_r
123 #define yyleng yyg->yyleng_r
124 #define yytext yyg->yytext_r
125 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
126 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
127 #define yy_flex_debug yyg->yy_flex_debug_r
129 int cmListFileLexer_yylex_init (yyscan_t
* scanner
);
131 /* Enter a start condition. This macro really ought to take a parameter,
132 * but we do it the disgusting crufty way forced on us by the ()-less
133 * definition of BEGIN.
135 #define BEGIN yyg->yy_start = 1 + 2 *
137 /* Translate the current start state into a value that can be later handed
138 * to BEGIN to return to the state. The YYSTATE alias is for lex
141 #define YY_START ((yyg->yy_start - 1) / 2)
142 #define YYSTATE YY_START
144 /* Action number for EOF rule of a given start state. */
145 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
147 /* Special action meaning "start processing a new file". */
148 #define YY_NEW_FILE cmListFileLexer_yyrestart(yyin ,yyscanner )
150 #define YY_END_OF_BUFFER_CHAR 0
152 /* Size of default input buffer. */
154 #define YY_BUF_SIZE 16384
157 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
158 #define YY_TYPEDEF_YY_BUFFER_STATE
159 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
162 #define EOB_ACT_CONTINUE_SCAN 0
163 #define EOB_ACT_END_OF_FILE 1
164 #define EOB_ACT_LAST_MATCH 2
166 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
167 * access to the local variable yy_act. Since yyless() is a macro, it would break
168 * existing scanners that call yyless() from OUTSIDE cmListFileLexer_yylex.
169 * One obvious solution it to make yy_act a global. I tried that, and saw
170 * a 5% performance hit in a non-yylineno scanner, because yy_act is
171 * normally declared as a register variable-- so it is not worth it.
173 #define YY_LESS_LINENO(n) \
176 for ( yyl = n; yyl < yyleng; ++yyl )\
177 if ( yytext[yyl] == '\n' )\
181 /* Return all but the first "n" matched characters back to the input stream. */
185 /* Undo effects of setting up yytext. */ \
186 int yyless_macro_arg = (n); \
187 YY_LESS_LINENO(yyless_macro_arg);\
188 *yy_cp = yyg->yy_hold_char; \
189 YY_RESTORE_YY_MORE_OFFSET \
190 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
191 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
195 /* The following is because we cannot portably get our hands on size_t
196 * (without autoconf's help, which isn't available because we want
197 * flex-generated scanners to compile on their own).
200 #ifndef YY_TYPEDEF_YY_SIZE_T
201 #define YY_TYPEDEF_YY_SIZE_T
202 typedef unsigned int yy_size_t
;
205 #ifndef YY_STRUCT_YY_BUFFER_STATE
206 #define YY_STRUCT_YY_BUFFER_STATE
207 struct yy_buffer_state
211 char *yy_ch_buf
; /* input buffer */
212 char *yy_buf_pos
; /* current position in input buffer */
214 /* Size of input buffer in bytes, not including room for EOB
217 yy_size_t yy_buf_size
;
219 /* Number of characters read into yy_ch_buf, not including EOB
224 /* Whether we "own" the buffer - i.e., we know we created it,
225 * and can realloc() it to grow it, and should free() it to
228 int yy_is_our_buffer
;
230 /* Whether this is an "interactive" input source; if so, and
231 * if we're using stdio for input, then we want to use getc()
232 * instead of fread(), to make sure we stop fetching input after
235 int yy_is_interactive
;
237 /* Whether we're considered to be at the beginning of a line.
238 * If so, '^' rules will be active on the next match, otherwise
243 int yy_bs_lineno
; /**< The line count. */
244 int yy_bs_column
; /**< The column count. */
246 /* Whether to try to fill the input buffer when we reach the
251 int yy_buffer_status
;
253 #define YY_BUFFER_NEW 0
254 #define YY_BUFFER_NORMAL 1
255 /* When an EOF's been seen but there's still some text to process
256 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
257 * shouldn't try reading from the input source any more. We might
258 * still have a bunch of tokens to match, though, because of
259 * possible backing-up.
261 * When we actually see the EOF, we change the status to "new"
262 * (via cmListFileLexer_yyrestart()), so that the user can continue scanning by
263 * just pointing yyin at a new input file.
265 #define YY_BUFFER_EOF_PENDING 2
268 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
270 /* We provide macros for accessing buffer states in case in the
271 * future we want to put the buffer states in a more general
274 * Returns the top of the stack, or NULL.
276 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
277 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
280 /* Same as previous macro, but useful when we know that the buffer stack is not
281 * NULL or when we need an lvalue. For internal use only.
283 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
285 void cmListFileLexer_yyrestart (FILE *input_file
,yyscan_t yyscanner
);
286 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
287 YY_BUFFER_STATE
cmListFileLexer_yy_create_buffer (FILE *file
,int size
,yyscan_t yyscanner
);
288 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
289 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
290 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
291 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner
);
293 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner
);
294 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner
);
295 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b
,FILE *file
,yyscan_t yyscanner
);
297 #define YY_FLUSH_BUFFER cmListFileLexer_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
299 YY_BUFFER_STATE
cmListFileLexer_yy_scan_buffer (char *base
,yy_size_t size
,yyscan_t yyscanner
);
300 YY_BUFFER_STATE
cmListFileLexer_yy_scan_string (yyconst
char *yy_str
,yyscan_t yyscanner
);
301 YY_BUFFER_STATE
cmListFileLexer_yy_scan_bytes (yyconst
char *bytes
,int len
,yyscan_t yyscanner
);
303 void *cmListFileLexer_yyalloc (yy_size_t
,yyscan_t yyscanner
);
304 void *cmListFileLexer_yyrealloc (void *,yy_size_t
,yyscan_t yyscanner
);
305 void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner
);
307 #define yy_new_buffer cmListFileLexer_yy_create_buffer
309 #define yy_set_interactive(is_interactive) \
311 if ( ! YY_CURRENT_BUFFER ){ \
312 cmListFileLexer_yyensure_buffer_stack (yyscanner); \
313 YY_CURRENT_BUFFER_LVALUE = \
314 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
316 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
319 #define yy_set_bol(at_bol) \
321 if ( ! YY_CURRENT_BUFFER ){\
322 cmListFileLexer_yyensure_buffer_stack (yyscanner); \
323 YY_CURRENT_BUFFER_LVALUE = \
324 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
326 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
329 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
331 /* Begin user sect3 */
333 #define cmListFileLexer_yywrap(n) 1
334 #define YY_SKIP_YYWRAP
336 typedef unsigned char YY_CHAR
;
338 typedef int yy_state_type
;
340 #define yytext_ptr yytext_r
342 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
);
343 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
,yyscan_t yyscanner
);
344 static int yy_get_next_buffer (yyscan_t yyscanner
);
345 static void yy_fatal_error (yyconst
char msg
[] ,yyscan_t yyscanner
);
347 /* Done after the current pattern has been matched and before the
348 * corresponding action - sets up yytext.
350 #define YY_DO_BEFORE_ACTION \
351 yyg->yytext_ptr = yy_bp; \
352 yyleng = (size_t) (yy_cp - yy_bp); \
353 yyg->yy_hold_char = *yy_cp; \
355 yyg->yy_c_buf_p = yy_cp;
357 #define YY_NUM_RULES 14
358 #define YY_END_OF_BUFFER 15
359 /* This struct is not used in this scanner,
360 but its presence is necessary. */
363 flex_int32_t yy_verify
;
366 static yyconst flex_int16_t yy_accept
[39] =
368 0, 0, 0, 0, 15, 6, 12, 1, 7, 2,
369 6, 3, 4, 6, 13, 8, 9, 10, 11, 6,
370 0, 6, 0, 2, 0, 5, 6, 8, 0, 0,
371 0, 0, 0, 0, 0, 0, 0, 0
374 static yyconst flex_int32_t yy_ec
[256] =
376 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
377 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 2, 1, 5, 6, 7, 1, 1, 1, 8,
380 9, 1, 1, 1, 1, 1, 1, 10, 10, 10,
381 10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
382 1, 1, 1, 1, 11, 11, 11, 11, 11, 11,
383 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
384 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
385 1, 12, 1, 1, 11, 1, 11, 11, 11, 11,
387 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
388 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
389 11, 11, 1, 1, 1, 1, 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 yyconst flex_int32_t yy_meta
[13] =
408 1, 1, 2, 1, 3, 1, 1, 1, 4, 4,
412 static yyconst flex_int16_t yy_base
[48] =
414 0, 0, 10, 20, 34, 32, 89, 89, 89, 0,
415 23, 89, 89, 35, 0, 18, 89, 89, 44, 0,
416 49, 21, 0, 0, 19, 0, 0, 15, 59, 0,
417 18, 0, 15, 12, 11, 10, 9, 89, 64, 68,
418 72, 76, 80, 13, 84, 12, 10
421 static yyconst flex_int16_t yy_def
[48] =
423 38, 1, 39, 39, 38, 38, 38, 38, 38, 40,
424 6, 38, 38, 6, 41, 42, 38, 38, 42, 6,
425 38, 6, 43, 40, 44, 14, 6, 42, 42, 21,
426 21, 45, 46, 44, 47, 46, 47, 0, 38, 38,
427 38, 38, 38, 38, 38, 38, 38
430 static yyconst flex_int16_t yy_nxt
[102] =
432 6, 7, 8, 7, 9, 10, 11, 12, 13, 6,
433 14, 15, 17, 37, 18, 36, 34, 30, 20, 30,
434 27, 19, 17, 20, 18, 35, 29, 27, 33, 29,
435 25, 19, 20, 38, 38, 38, 21, 38, 22, 38,
436 38, 20, 20, 23, 26, 26, 28, 38, 28, 30,
437 30, 38, 38, 20, 38, 31, 38, 38, 30, 30,
438 32, 28, 38, 28, 16, 16, 16, 16, 24, 38,
439 24, 24, 27, 38, 27, 27, 28, 38, 38, 28,
440 20, 38, 20, 20, 30, 38, 30, 30, 5, 38,
441 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
446 static yyconst flex_int16_t yy_chk
[102] =
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 3, 47, 3, 46, 44, 37, 36, 35,
450 34, 3, 4, 33, 4, 31, 28, 25, 22, 16,
451 11, 4, 6, 5, 0, 0, 6, 0, 6, 0,
452 0, 6, 6, 6, 14, 14, 19, 0, 19, 21,
453 21, 0, 0, 21, 0, 21, 0, 0, 21, 21,
454 21, 29, 0, 29, 39, 39, 39, 39, 40, 0,
455 40, 40, 41, 0, 41, 41, 42, 0, 0, 42,
456 43, 0, 43, 43, 45, 0, 45, 45, 38, 38,
457 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
462 /* Table of booleans, true if rule could match eol. */
463 static yyconst flex_int32_t yy_rule_can_match_eol
[15] =
465 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, };
467 /* The intent behind this definition is that it'll catch
468 * any uses of REJECT which flex missed.
470 #define REJECT reject_used_but_not_detected
471 #define yymore() yymore_used_but_not_detected
472 #define YY_MORE_ADJ 0
473 #define YY_RESTORE_YY_MORE_OFFSET
474 #line 1 "cmListFileLexer.in.l"
475 #line 2 "cmListFileLexer.in.l"
476 /*=========================================================================
478 Program: CMake - Cross-Platform Makefile Generator
479 Module: $RCSfile: cmListFileLexer.c,v $
481 Date: $Date: 2009-06-25 20:41:55 $
482 Version: $Revision: 1.16 $
484 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
485 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
487 This software is distributed WITHOUT ANY WARRANTY; without even
488 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
489 PURPOSE. See the above copyright notices for more information.
491 =========================================================================*/
494 This file must be translated to C and modified to build everywhere.
498 flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
500 Modify cmListFileLexer.c:
502 - remove the yyunput function
503 - add a statement "(void)yyscanner;" to the top of these methods:
504 yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
505 - remove all YY_BREAK lines occurring right after return statements
506 - remove the isatty forward declaration
510 #include "cmStandardLexer.h"
512 /* Setup the proper cmListFileLexer_yylex declaration. */
513 #define YY_EXTRA_TYPE cmListFileLexer*
514 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
516 #include "cmListFileLexer.h"
518 /*--------------------------------------------------------------------------*/
519 struct cmListFileLexer_s
521 cmListFileLexer_Token token
;
527 char* string_position
;
532 static void cmListFileLexerSetToken(cmListFileLexer
* lexer
, const char* text
,
534 static void cmListFileLexerAppend(cmListFileLexer
* lexer
, const char* text
,
536 static int cmListFileLexerInput(cmListFileLexer
* lexer
, char* buffer
,
538 static void cmListFileLexerInit(cmListFileLexer
* lexer
);
539 static void cmListFileLexerDestroy(cmListFileLexer
* lexer
);
541 /* Replace the lexer input function. */
543 #define YY_INPUT(buf, result, max_size) \
544 { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); }
546 /*--------------------------------------------------------------------------*/
548 #line 568 "cmListFileLexer.c"
553 #ifndef YY_NO_UNISTD_H
554 /* Special case for "unistd.h", since it is non-ANSI. We include it way
555 * down here because we want the user's section 1 to have been scanned first.
556 * The user has a chance to override it with an option.
561 #ifndef YY_EXTRA_TYPE
562 #define YY_EXTRA_TYPE void *
565 /* Holds the entire state of the reentrant scanner. */
569 /* User-defined. Not touched by flex. */
570 YY_EXTRA_TYPE yyextra_r
;
572 /* The rest are the same as the globals declared in the non-reentrant scanner. */
573 FILE *yyin_r
, *yyout_r
;
574 size_t yy_buffer_stack_top
; /**< index of top of stack. */
575 size_t yy_buffer_stack_max
; /**< capacity of stack. */
576 YY_BUFFER_STATE
* yy_buffer_stack
; /**< Stack as an array. */
583 int yy_did_buffer_switch_on_eof
;
584 int yy_start_stack_ptr
;
585 int yy_start_stack_depth
;
587 yy_state_type yy_last_accepting_state
;
588 char* yy_last_accepting_cpos
;
597 }; /* end struct yyguts_t */
599 /* Accessor methods to globals.
600 These are made visible to non-reentrant scanners for convenience. */
602 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner
);
604 int cmListFileLexer_yyget_debug (yyscan_t yyscanner
);
606 void cmListFileLexer_yyset_debug (int debug_flag
,yyscan_t yyscanner
);
608 YY_EXTRA_TYPE
cmListFileLexer_yyget_extra (yyscan_t yyscanner
);
610 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined
,yyscan_t yyscanner
);
612 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner
);
614 void cmListFileLexer_yyset_in (FILE * in_str
,yyscan_t yyscanner
);
616 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner
);
618 void cmListFileLexer_yyset_out (FILE * out_str
,yyscan_t yyscanner
);
620 int cmListFileLexer_yyget_leng (yyscan_t yyscanner
);
622 char *cmListFileLexer_yyget_text (yyscan_t yyscanner
);
624 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner
);
626 void cmListFileLexer_yyset_lineno (int line_number
,yyscan_t yyscanner
);
628 /* Macros after this point can all be overridden by user definitions in
632 #ifndef YY_SKIP_YYWRAP
634 extern "C" int cmListFileLexer_yywrap (yyscan_t yyscanner
);
636 extern int cmListFileLexer_yywrap (yyscan_t yyscanner
);
641 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
644 #ifdef YY_NEED_STRLEN
645 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
651 static int yyinput (yyscan_t yyscanner
);
653 static int input (yyscan_t yyscanner
);
658 /* Amount of stuff to slurp up with each read. */
659 #ifndef YY_READ_BUF_SIZE
660 #define YY_READ_BUF_SIZE 8192
663 /* Copy whatever the last rule matched to the standard output. */
665 /* This used to be an fputs(), but since the string might contain NUL's,
666 * we now use fwrite().
668 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
671 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
672 * is returned in "result".
675 #define YY_INPUT(buf,result,max_size) \
676 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
680 for ( n = 0; n < max_size && \
681 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
684 buf[n++] = (char) c; \
685 if ( c == EOF && ferror( yyin ) ) \
686 YY_FATAL_ERROR( "input in flex scanner failed" ); \
692 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
694 if( errno != EINTR) \
696 YY_FATAL_ERROR( "input in flex scanner failed" ); \
707 /* No semi-colon after return; correct usage is to write "yyterminate();" -
708 * we don't want an extra ';' after the "return" because that will cause
709 * some compilers to complain about unreachable statements.
712 #define yyterminate() return YY_NULL
715 /* Number of entries by which start-condition stack grows. */
716 #ifndef YY_START_STACK_INCR
717 #define YY_START_STACK_INCR 25
720 /* Report a fatal error. */
721 #ifndef YY_FATAL_ERROR
722 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
725 /* end tables serialization structures and prototypes */
727 /* Default declaration of generated scanner - a define so the user can
728 * easily add parameters.
731 #define YY_DECL_IS_OURS 1
733 extern int cmListFileLexer_yylex (yyscan_t yyscanner
);
735 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner)
736 #endif /* !YY_DECL */
738 /* Code executed at the beginning of each rule, after yytext and yyleng
741 #ifndef YY_USER_ACTION
742 #define YY_USER_ACTION
745 /* Code executed at the end of each rule. */
747 #define YY_BREAK break;
750 #define YY_RULE_SETUP \
753 /** The main scanner function which does all the work.
757 register yy_state_type yy_current_state
;
758 register char *yy_cp
, *yy_bp
;
760 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
762 #line 100 "cmListFileLexer.in.l"
765 #line 787 "cmListFileLexer.c"
775 if ( ! yyg
->yy_start
)
776 yyg
->yy_start
= 1; /* first start state */
784 if ( ! YY_CURRENT_BUFFER
) {
785 cmListFileLexer_yyensure_buffer_stack (yyscanner
);
786 YY_CURRENT_BUFFER_LVALUE
=
787 cmListFileLexer_yy_create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
790 cmListFileLexer_yy_load_buffer_state(yyscanner
);
793 while ( 1 ) /* loops until end-of-file is reached */
795 yy_cp
= yyg
->yy_c_buf_p
;
797 /* Support of yytext. */
798 *yy_cp
= yyg
->yy_hold_char
;
800 /* yy_bp points to the position in yy_ch_buf of the start of
805 yy_current_state
= yyg
->yy_start
;
809 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
810 if ( yy_accept
[yy_current_state
] )
812 yyg
->yy_last_accepting_state
= yy_current_state
;
813 yyg
->yy_last_accepting_cpos
= yy_cp
;
815 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
817 yy_current_state
= (int) yy_def
[yy_current_state
];
818 if ( yy_current_state
>= 39 )
819 yy_c
= yy_meta
[(unsigned int) yy_c
];
821 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
824 while ( yy_base
[yy_current_state
] != 89 );
827 yy_act
= yy_accept
[yy_current_state
];
829 { /* have to back up */
830 yy_cp
= yyg
->yy_last_accepting_cpos
;
831 yy_current_state
= yyg
->yy_last_accepting_state
;
832 yy_act
= yy_accept
[yy_current_state
];
837 if ( yy_act
!= YY_END_OF_BUFFER
&& yy_rule_can_match_eol
[yy_act
] )
840 for ( yyl
= 0; yyl
< yyleng
; ++yyl
)
841 if ( yytext
[yyl
] == '\n' )
849 do_action
: /* This label is used only to access EOF actions. */
852 { /* beginning of action switch */
853 case 0: /* must back up */
854 /* undo the effects of YY_DO_BEFORE_ACTION */
855 *yy_cp
= yyg
->yy_hold_char
;
856 yy_cp
= yyg
->yy_last_accepting_cpos
;
857 yy_current_state
= yyg
->yy_last_accepting_state
;
861 /* rule 1 can match eol */
863 #line 102 "cmListFileLexer.in.l"
865 lexer
->token
.type
= cmListFileLexer_Token_Newline
;
866 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
873 #line 110 "cmListFileLexer.in.l"
875 lexer
->column
+= yyleng
;
880 #line 114 "cmListFileLexer.in.l"
882 lexer
->token
.type
= cmListFileLexer_Token_ParenLeft
;
883 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
884 lexer
->column
+= yyleng
;
889 #line 121 "cmListFileLexer.in.l"
891 lexer
->token
.type
= cmListFileLexer_Token_ParenRight
;
892 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
893 lexer
->column
+= yyleng
;
898 #line 128 "cmListFileLexer.in.l"
900 lexer
->token
.type
= cmListFileLexer_Token_Identifier
;
901 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
902 lexer
->column
+= yyleng
;
907 #line 135 "cmListFileLexer.in.l"
909 lexer
->token
.type
= cmListFileLexer_Token_ArgumentUnquoted
;
910 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
911 lexer
->column
+= yyleng
;
916 #line 142 "cmListFileLexer.in.l"
918 lexer
->token
.type
= cmListFileLexer_Token_ArgumentQuoted
;
919 cmListFileLexerSetToken(lexer
, "", 0);
920 lexer
->column
+= yyleng
;
925 /* rule 8 can match eol */
927 #line 149 "cmListFileLexer.in.l"
929 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
930 lexer
->column
+= yyleng
;
934 /* rule 9 can match eol */
936 #line 154 "cmListFileLexer.in.l"
938 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
945 #line 160 "cmListFileLexer.in.l"
947 lexer
->column
+= yyleng
;
953 #line 166 "cmListFileLexer.in.l"
955 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
956 lexer
->column
+= yyleng
;
959 case YY_STATE_EOF(STRING
):
960 #line 171 "cmListFileLexer.in.l"
962 lexer
->token
.type
= cmListFileLexer_Token_BadString
;
968 #line 177 "cmListFileLexer.in.l"
970 lexer
->column
+= yyleng
;
975 #line 181 "cmListFileLexer.in.l"
977 lexer
->token
.type
= cmListFileLexer_Token_BadCharacter
;
978 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
979 lexer
->column
+= yyleng
;
982 case YY_STATE_EOF(INITIAL
):
983 #line 188 "cmListFileLexer.in.l"
985 lexer
->token
.type
= cmListFileLexer_Token_None
;
986 cmListFileLexerSetToken(lexer
, 0, 0);
991 #line 194 "cmListFileLexer.in.l"
994 #line 1025 "cmListFileLexer.c"
996 case YY_END_OF_BUFFER
:
998 /* Amount of text matched not including the EOB char. */
999 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
1001 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1002 *yy_cp
= yyg
->yy_hold_char
;
1003 YY_RESTORE_YY_MORE_OFFSET
1005 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1007 /* We're scanning a new file or input source. It's
1008 * possible that this happened because the user
1009 * just pointed yyin at a new source and called
1010 * cmListFileLexer_yylex(). If so, then we have to assure
1011 * consistency between YY_CURRENT_BUFFER and our
1012 * globals. Here is the right place to do so, because
1013 * this is the first action (other than possibly a
1014 * back-up) that will match for the new input source.
1016 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1017 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
1018 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1021 /* Note that here we test for yy_c_buf_p "<=" to the position
1022 * of the first EOB in the buffer, since yy_c_buf_p will
1023 * already have been incremented past the NUL character
1024 * (since all states make transitions on EOB to the
1025 * end-of-buffer state). Contrast this with the test
1028 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1029 { /* This was really a NUL. */
1030 yy_state_type yy_next_state
;
1032 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1034 yy_current_state
= yy_get_previous_state( yyscanner
);
1036 /* Okay, we're now positioned to make the NUL
1037 * transition. We couldn't have
1038 * yy_get_previous_state() go ahead and do it
1039 * for us because it doesn't know how to deal
1040 * with the possibility of jamming (and we don't
1041 * want to build jamming into it because then it
1042 * will run more slowly).
1045 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
1047 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1049 if ( yy_next_state
)
1051 /* Consume the NUL. */
1052 yy_cp
= ++yyg
->yy_c_buf_p
;
1053 yy_current_state
= yy_next_state
;
1059 yy_cp
= yyg
->yy_c_buf_p
;
1060 goto yy_find_action
;
1064 else switch ( yy_get_next_buffer( yyscanner
) )
1066 case EOB_ACT_END_OF_FILE
:
1068 yyg
->yy_did_buffer_switch_on_eof
= 0;
1070 if ( cmListFileLexer_yywrap(yyscanner
) )
1072 /* Note: because we've taken care in
1073 * yy_get_next_buffer() to have set up
1074 * yytext, we can now set up
1075 * yy_c_buf_p so that if some total
1076 * hoser (like flex itself) wants to
1077 * call the scanner after we return the
1078 * YY_NULL, it'll still work - another
1079 * YY_NULL will get returned.
1081 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1083 yy_act
= YY_STATE_EOF(YY_START
);
1089 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1095 case EOB_ACT_CONTINUE_SCAN
:
1097 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1099 yy_current_state
= yy_get_previous_state( yyscanner
);
1101 yy_cp
= yyg
->yy_c_buf_p
;
1102 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1105 case EOB_ACT_LAST_MATCH
:
1107 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
1109 yy_current_state
= yy_get_previous_state( yyscanner
);
1111 yy_cp
= yyg
->yy_c_buf_p
;
1112 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1113 goto yy_find_action
;
1120 "fatal flex scanner internal error--no action found" );
1121 } /* end of action switch */
1122 } /* end of scanning one token */
1123 } /* end of cmListFileLexer_yylex */
1125 /* yy_get_next_buffer - try to read in a new buffer
1127 * Returns a code representing an action:
1128 * EOB_ACT_LAST_MATCH -
1129 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1130 * EOB_ACT_END_OF_FILE - end of file
1132 static int yy_get_next_buffer (yyscan_t yyscanner
)
1134 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1135 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1136 register char *source
= yyg
->yytext_ptr
;
1137 register int number_to_move
, i
;
1140 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
1142 "fatal flex scanner internal error--end of buffer missed" );
1144 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1145 { /* Don't try to fill the buffer, so this is an EOF. */
1146 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
1148 /* We matched a single character, the EOB, so
1149 * treat this as a final EOF.
1151 return EOB_ACT_END_OF_FILE
;
1156 /* We matched some text prior to the EOB, first
1159 return EOB_ACT_LAST_MATCH
;
1163 /* Try to read more data. */
1165 /* First move last chars to start of buffer. */
1166 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
) - 1;
1168 for ( i
= 0; i
< number_to_move
; ++i
)
1169 *(dest
++) = *(source
++);
1171 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1172 /* don't do the read, it's not guaranteed to return an EOF,
1175 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
1179 size_t num_to_read
=
1180 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1182 while ( num_to_read
<= 0 )
1183 { /* Not enough room in the buffer - grow it. */
1185 /* just a shorter name for the current buffer */
1186 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1188 int yy_c_buf_p_offset
=
1189 (int) (yyg
->yy_c_buf_p
- b
->yy_ch_buf
);
1191 if ( b
->yy_is_our_buffer
)
1193 int new_size
= b
->yy_buf_size
* 2;
1195 if ( new_size
<= 0 )
1196 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1198 b
->yy_buf_size
*= 2;
1200 b
->yy_ch_buf
= (char *)
1201 /* Include room in for 2 EOB chars. */
1202 cmListFileLexer_yyrealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 ,yyscanner
);
1205 /* Can't grow it, we don't own it. */
1208 if ( ! b
->yy_ch_buf
)
1210 "fatal error - scanner input buffer overflow" );
1212 yyg
->yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1214 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1219 if ( num_to_read
> YY_READ_BUF_SIZE
)
1220 num_to_read
= YY_READ_BUF_SIZE
;
1222 /* Read in more data. */
1223 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1224 yyg
->yy_n_chars
, num_to_read
);
1226 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1229 if ( yyg
->yy_n_chars
== 0 )
1231 if ( number_to_move
== YY_MORE_ADJ
)
1233 ret_val
= EOB_ACT_END_OF_FILE
;
1234 cmListFileLexer_yyrestart(yyin
,yyscanner
);
1239 ret_val
= EOB_ACT_LAST_MATCH
;
1240 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1241 YY_BUFFER_EOF_PENDING
;
1246 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1248 yyg
->yy_n_chars
+= number_to_move
;
1249 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1250 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1252 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1257 /* yy_get_previous_state - get the state just before the EOB char was reached */
1259 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
1261 register yy_state_type yy_current_state
;
1262 register char *yy_cp
;
1263 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1265 yy_current_state
= yyg
->yy_start
;
1267 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
1269 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1270 if ( yy_accept
[yy_current_state
] )
1272 yyg
->yy_last_accepting_state
= yy_current_state
;
1273 yyg
->yy_last_accepting_cpos
= yy_cp
;
1275 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1277 yy_current_state
= (int) yy_def
[yy_current_state
];
1278 if ( yy_current_state
>= 39 )
1279 yy_c
= yy_meta
[(unsigned int) yy_c
];
1281 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1284 return yy_current_state
;
1287 /* yy_try_NUL_trans - try to make a transition on the NUL character
1290 * next_state = yy_try_NUL_trans( current_state );
1292 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
1294 register int yy_is_jam
;
1295 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1296 register char *yy_cp
= yyg
->yy_c_buf_p
;
1298 register YY_CHAR yy_c
= 1;
1299 if ( yy_accept
[yy_current_state
] )
1301 yyg
->yy_last_accepting_state
= yy_current_state
;
1302 yyg
->yy_last_accepting_cpos
= yy_cp
;
1304 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1306 yy_current_state
= (int) yy_def
[yy_current_state
];
1307 if ( yy_current_state
>= 39 )
1308 yy_c
= yy_meta
[(unsigned int) yy_c
];
1310 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1311 yy_is_jam
= (yy_current_state
== 38);
1313 return yy_is_jam
? 0 : yy_current_state
;
1318 static int yyinput (yyscan_t yyscanner
)
1320 static int input (yyscan_t yyscanner
)
1325 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1327 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1329 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1331 /* yy_c_buf_p now points to the character we want to return.
1332 * If this occurs *before* the EOB characters, then it's a
1333 * valid NUL; if not, then we've hit the end of the buffer.
1335 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1336 /* This was really a NUL. */
1337 *yyg
->yy_c_buf_p
= '\0';
1340 { /* need more input */
1341 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
1344 switch ( yy_get_next_buffer( yyscanner
) )
1346 case EOB_ACT_LAST_MATCH
:
1347 /* This happens because yy_g_n_b()
1348 * sees that we've accumulated a
1349 * token and flags that we need to
1350 * try matching the token before
1351 * proceeding. But for input(),
1352 * there's no matching to consider.
1353 * So convert the EOB_ACT_LAST_MATCH
1354 * to EOB_ACT_END_OF_FILE.
1357 /* Reset buffer status. */
1358 cmListFileLexer_yyrestart(yyin
,yyscanner
);
1362 case EOB_ACT_END_OF_FILE
:
1364 if ( cmListFileLexer_yywrap(yyscanner
) )
1367 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1370 return yyinput(yyscanner
);
1372 return input(yyscanner
);
1376 case EOB_ACT_CONTINUE_SCAN
:
1377 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
1383 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
1384 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
1385 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
1396 #endif /* ifndef YY_NO_INPUT */
1398 /** Immediately switch to a different input stream.
1399 * @param input_file A readable stream.
1400 * @param yyscanner The scanner object.
1401 * @note This function does not reset the start condition to @c INITIAL .
1403 void cmListFileLexer_yyrestart (FILE * input_file
, yyscan_t yyscanner
)
1405 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1407 if ( ! YY_CURRENT_BUFFER
){
1408 cmListFileLexer_yyensure_buffer_stack (yyscanner
);
1409 YY_CURRENT_BUFFER_LVALUE
=
1410 cmListFileLexer_yy_create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
1413 cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER
,input_file
,yyscanner
);
1414 cmListFileLexer_yy_load_buffer_state(yyscanner
);
1417 /** Switch to a different input buffer.
1418 * @param new_buffer The new input buffer.
1419 * @param yyscanner The scanner object.
1421 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1423 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1425 /* TODO. We should be able to replace this entire function body
1427 * cmListFileLexer_yypop_buffer_state();
1428 * cmListFileLexer_yypush_buffer_state(new_buffer);
1430 cmListFileLexer_yyensure_buffer_stack (yyscanner
);
1431 if ( YY_CURRENT_BUFFER
== new_buffer
)
1434 if ( YY_CURRENT_BUFFER
)
1436 /* Flush out information for old buffer. */
1437 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1438 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
1439 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1442 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1443 cmListFileLexer_yy_load_buffer_state(yyscanner
);
1445 /* We don't actually know whether we did this switch during
1446 * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
1447 * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
1448 * to go ahead and always set it.
1450 yyg
->yy_did_buffer_switch_on_eof
= 1;
1453 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner
)
1455 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1456 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1457 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1458 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1459 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
1462 /** Allocate and initialize an input buffer state.
1463 * @param file A readable stream.
1464 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1465 * @param yyscanner The scanner object.
1466 * @return the allocated buffer state.
1468 YY_BUFFER_STATE
cmListFileLexer_yy_create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
1472 b
= (YY_BUFFER_STATE
) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
1474 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
1476 b
->yy_buf_size
= size
;
1478 /* yy_ch_buf has to be 2 characters longer than the size given because
1479 * we need to put in 2 end-of-buffer characters.
1481 b
->yy_ch_buf
= (char *) cmListFileLexer_yyalloc(b
->yy_buf_size
+ 2 ,yyscanner
);
1482 if ( ! b
->yy_ch_buf
)
1483 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
1485 b
->yy_is_our_buffer
= 1;
1487 cmListFileLexer_yy_init_buffer(b
,file
,yyscanner
);
1492 /** Destroy the buffer.
1493 * @param b a buffer created with cmListFileLexer_yy_create_buffer()
1494 * @param yyscanner The scanner object.
1496 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1498 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1503 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1504 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1506 if ( b
->yy_is_our_buffer
)
1507 cmListFileLexer_yyfree((void *) b
->yy_ch_buf
,yyscanner
);
1509 cmListFileLexer_yyfree((void *) b
,yyscanner
);
1512 /* Initializes or reinitializes a buffer.
1513 * This function is sometimes called more than once on the same buffer,
1514 * such as during a cmListFileLexer_yyrestart() or at EOF.
1516 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
1520 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1522 cmListFileLexer_yy_flush_buffer(b
,yyscanner
);
1524 b
->yy_input_file
= file
;
1525 b
->yy_fill_buffer
= 1;
1527 /* If b is the current buffer, then cmListFileLexer_yy_init_buffer was _probably_
1528 * called from cmListFileLexer_yyrestart() or through yy_get_next_buffer.
1529 * In that case, we don't want to reset the lineno or column.
1531 if (b
!= YY_CURRENT_BUFFER
){
1532 b
->yy_bs_lineno
= 1;
1533 b
->yy_bs_column
= 0;
1536 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1541 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1542 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1543 * @param yyscanner The scanner object.
1545 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1547 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1553 /* We always need two end-of-buffer characters. The first causes
1554 * a transition to the end-of-buffer state. The second causes
1555 * a jam in that state.
1557 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1558 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1560 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1563 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1565 if ( b
== YY_CURRENT_BUFFER
)
1566 cmListFileLexer_yy_load_buffer_state(yyscanner
);
1569 /** Pushes the new state onto the stack. The new state becomes
1570 * the current state. This function will allocate the stack
1572 * @param new_buffer The new state.
1573 * @param yyscanner The scanner object.
1575 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1577 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1578 if (new_buffer
== NULL
)
1581 cmListFileLexer_yyensure_buffer_stack(yyscanner
);
1583 /* This block is copied from cmListFileLexer_yy_switch_to_buffer. */
1584 if ( YY_CURRENT_BUFFER
)
1586 /* Flush out information for old buffer. */
1587 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1588 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
1589 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1592 /* Only push if top exists. Otherwise, replace top. */
1593 if (YY_CURRENT_BUFFER
)
1594 yyg
->yy_buffer_stack_top
++;
1595 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1597 /* copied from cmListFileLexer_yy_switch_to_buffer. */
1598 cmListFileLexer_yy_load_buffer_state(yyscanner
);
1599 yyg
->yy_did_buffer_switch_on_eof
= 1;
1602 /** Removes and deletes the top of the stack, if present.
1603 * The next element becomes the new top.
1604 * @param yyscanner The scanner object.
1606 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner
)
1608 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1609 if (!YY_CURRENT_BUFFER
)
1612 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
1613 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1614 if (yyg
->yy_buffer_stack_top
> 0)
1615 --yyg
->yy_buffer_stack_top
;
1617 if (YY_CURRENT_BUFFER
) {
1618 cmListFileLexer_yy_load_buffer_state(yyscanner
);
1619 yyg
->yy_did_buffer_switch_on_eof
= 1;
1623 /* Allocates the stack if it does not exist.
1624 * Guarantees space for at least one push.
1626 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner
)
1629 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1631 if (!yyg
->yy_buffer_stack
) {
1633 /* First allocation is just for 2 elements, since we don't know if this
1634 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1635 * immediate realloc on the next call.
1638 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)cmListFileLexer_yyalloc
1639 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
1642 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
1644 yyg
->yy_buffer_stack_max
= num_to_alloc
;
1645 yyg
->yy_buffer_stack_top
= 0;
1649 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
1651 /* Increase the buffer to prepare for a possible push. */
1652 int grow_size
= 8 /* arbitrary grow size */;
1654 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
1655 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)cmListFileLexer_yyrealloc
1656 (yyg
->yy_buffer_stack
,
1657 num_to_alloc
* sizeof(struct yy_buffer_state
*)
1660 /* zero only the new slots.*/
1661 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
1662 yyg
->yy_buffer_stack_max
= num_to_alloc
;
1666 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1667 * @param base the character buffer
1668 * @param size the size in bytes of the character buffer
1669 * @param yyscanner The scanner object.
1670 * @return the newly allocated buffer state object.
1672 YY_BUFFER_STATE
cmListFileLexer_yy_scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
1677 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1678 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1679 /* They forgot to leave room for the EOB's. */
1682 b
= (YY_BUFFER_STATE
) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
1684 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
1686 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1687 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1688 b
->yy_is_our_buffer
= 0;
1689 b
->yy_input_file
= 0;
1690 b
->yy_n_chars
= b
->yy_buf_size
;
1691 b
->yy_is_interactive
= 0;
1693 b
->yy_fill_buffer
= 0;
1694 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1696 cmListFileLexer_yy_switch_to_buffer(b
,yyscanner
);
1701 /** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
1702 * scan from a @e copy of @a str.
1703 * @param str a NUL-terminated string to scan
1704 * @param yyscanner The scanner object.
1705 * @return the newly allocated buffer state object.
1706 * @note If you want to scan bytes that may contain NUL values, then use
1707 * cmListFileLexer_yy_scan_bytes() instead.
1709 YY_BUFFER_STATE
cmListFileLexer_yy_scan_string (yyconst
char * yy_str
, yyscan_t yyscanner
)
1712 return cmListFileLexer_yy_scan_bytes(yy_str
,strlen(yy_str
) ,yyscanner
);
1715 /** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will
1716 * scan from a @e copy of @a bytes.
1717 * @param bytes the byte buffer to scan
1718 * @param len the number of bytes in the buffer pointed to by @a bytes.
1719 * @param yyscanner The scanner object.
1720 * @return the newly allocated buffer state object.
1722 YY_BUFFER_STATE
cmListFileLexer_yy_scan_bytes (yyconst
char * bytes
, int len
, yyscan_t yyscanner
)
1729 /* Get memory for full buffer, including space for trailing EOB's. */
1731 buf
= (char *) cmListFileLexer_yyalloc(n
,yyscanner
);
1733 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
1735 for ( i
= 0; i
< len
; ++i
)
1738 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1740 b
= cmListFileLexer_yy_scan_buffer(buf
,n
,yyscanner
);
1742 YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" );
1744 /* It's okay to grow etc. this buffer, and we should throw it
1745 * away when we're done.
1747 b
->yy_is_our_buffer
= 1;
1752 #ifndef YY_EXIT_FAILURE
1753 #define YY_EXIT_FAILURE 2
1756 static void yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
1759 (void) fprintf( stderr
, "%s\n", msg
);
1760 exit( YY_EXIT_FAILURE
);
1763 /* Redefine yyless() so it works in section 3 code. */
1769 /* Undo effects of setting up yytext. */ \
1770 int yyless_macro_arg = (n); \
1771 YY_LESS_LINENO(yyless_macro_arg);\
1772 yytext[yyleng] = yyg->yy_hold_char; \
1773 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1774 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1775 *yyg->yy_c_buf_p = '\0'; \
1776 yyleng = yyless_macro_arg; \
1780 /* Accessor methods (get/set functions) to struct members. */
1782 /** Get the user-defined data for this scanner.
1783 * @param yyscanner The scanner object.
1785 YY_EXTRA_TYPE
cmListFileLexer_yyget_extra (yyscan_t yyscanner
)
1787 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1791 /** Get the current line number.
1792 * @param yyscanner The scanner object.
1794 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner
)
1796 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1798 if (! YY_CURRENT_BUFFER
)
1804 /** Get the current column number.
1805 * @param yyscanner The scanner object.
1807 int cmListFileLexer_yyget_column (yyscan_t yyscanner
)
1809 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1811 if (! YY_CURRENT_BUFFER
)
1817 /** Get the input stream.
1818 * @param yyscanner The scanner object.
1820 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner
)
1822 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1826 /** Get the output stream.
1827 * @param yyscanner The scanner object.
1829 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner
)
1831 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1835 /** Get the length of the current token.
1836 * @param yyscanner The scanner object.
1838 int cmListFileLexer_yyget_leng (yyscan_t yyscanner
)
1840 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1844 /** Get the current token.
1845 * @param yyscanner The scanner object.
1848 char *cmListFileLexer_yyget_text (yyscan_t yyscanner
)
1850 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1854 /** Set the user-defined data. This data is never touched by the scanner.
1855 * @param user_defined The data to be associated with this scanner.
1856 * @param yyscanner The scanner object.
1858 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
1860 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1861 yyextra
= user_defined
;
1864 /** Set the current line number.
1865 * @param line_number
1866 * @param yyscanner The scanner object.
1868 void cmListFileLexer_yyset_lineno (int line_number
, yyscan_t yyscanner
)
1870 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1872 /* lineno is only valid if an input buffer exists. */
1873 if (! YY_CURRENT_BUFFER
)
1874 yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner
);
1876 yylineno
= line_number
;
1879 /** Set the current column.
1880 * @param line_number
1881 * @param yyscanner The scanner object.
1883 void cmListFileLexer_yyset_column (int column_no
, yyscan_t yyscanner
)
1885 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1887 /* column is only valid if an input buffer exists. */
1888 if (! YY_CURRENT_BUFFER
)
1889 yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner
);
1891 yycolumn
= column_no
;
1894 /** Set the input stream. This does not discard the current
1896 * @param in_str A readable stream.
1897 * @param yyscanner The scanner object.
1898 * @see cmListFileLexer_yy_switch_to_buffer
1900 void cmListFileLexer_yyset_in (FILE * in_str
, yyscan_t yyscanner
)
1902 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1906 void cmListFileLexer_yyset_out (FILE * out_str
, yyscan_t yyscanner
)
1908 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1912 int cmListFileLexer_yyget_debug (yyscan_t yyscanner
)
1914 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1915 return yy_flex_debug
;
1918 void cmListFileLexer_yyset_debug (int bdebug
, yyscan_t yyscanner
)
1920 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1921 yy_flex_debug
= bdebug
;
1924 /* Accessor methods for yylval and yylloc */
1926 static int yy_init_globals (yyscan_t yyscanner
)
1928 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1929 /* Initialization is the same as for the non-reentrant scanner.
1930 This function is called once per scanner lifetime. */
1932 yyg
->yy_buffer_stack
= 0;
1933 yyg
->yy_buffer_stack_top
= 0;
1934 yyg
->yy_buffer_stack_max
= 0;
1935 yyg
->yy_c_buf_p
= (char *) 0;
1938 yyg
->yy_start_stack_ptr
= 0;
1939 yyg
->yy_start_stack_depth
= 0;
1940 yyg
->yy_start_stack
= (int *) 0;
1942 /* Defined in main.c */
1951 /* For future reference: Set errno on error, since we are called by
1952 * cmListFileLexer_yylex_init()
1957 /* User-visible API */
1959 /* cmListFileLexer_yylex_init is special because it creates the scanner itself, so it is
1960 * the ONLY reentrant function that doesn't take the scanner as the last argument.
1961 * That's why we explicitly handle the declaration, instead of using our macros.
1964 int cmListFileLexer_yylex_init(yyscan_t
* ptr_yy_globals
)
1967 if (ptr_yy_globals
== NULL
){
1972 *ptr_yy_globals
= (yyscan_t
) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t
), NULL
);
1974 if (*ptr_yy_globals
== NULL
){
1979 memset(*ptr_yy_globals
,0,sizeof(struct yyguts_t
));
1981 return yy_init_globals ( *ptr_yy_globals
);
1984 /* cmListFileLexer_yylex_destroy is for both reentrant and non-reentrant scanners. */
1985 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner
)
1987 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1989 /* Pop the buffer stack, destroying each element. */
1990 while(YY_CURRENT_BUFFER
){
1991 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
1992 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1993 cmListFileLexer_yypop_buffer_state(yyscanner
);
1996 /* Destroy the stack itself. */
1997 cmListFileLexer_yyfree(yyg
->yy_buffer_stack
,yyscanner
);
1998 yyg
->yy_buffer_stack
= NULL
;
2000 /* Destroy the start condition stack. */
2001 cmListFileLexer_yyfree(yyg
->yy_start_stack
,yyscanner
);
2002 yyg
->yy_start_stack
= NULL
;
2004 /* Destroy the main struct (reentrant only). */
2005 cmListFileLexer_yyfree ( yyscanner
, yyscanner
);
2010 * Internal utility routines.
2014 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
, yyscan_t yyscanner
)
2017 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2018 for ( i
= 0; i
< n
; ++i
)
2023 #ifdef YY_NEED_STRLEN
2024 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
2027 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2028 for ( n
= 0; s
[n
]; ++n
)
2035 void *cmListFileLexer_yyalloc (yy_size_t size
, yyscan_t yyscanner
)
2038 return (void *) malloc( size
);
2041 void *cmListFileLexer_yyrealloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
2043 /* The cast to (char *) in the following accommodates both
2044 * implementations that use char* generic pointers, and those
2045 * that use void* generic pointers. It works with the latter
2046 * because both ANSI C and C++ allow castless assignment from
2047 * any pointer type to void*, and deal with argument conversions
2048 * as though doing an assignment.
2051 return (void *) realloc( (char *) ptr
, size
);
2054 void cmListFileLexer_yyfree (void * ptr
, yyscan_t yyscanner
)
2057 free( (char *) ptr
); /* see cmListFileLexer_yyrealloc() for (char *) cast */
2060 #define YYTABLES_NAME "yytables"
2063 #undef YY_FLUSH_BUFFER
2065 #undef yy_new_buffer
2066 #undef yy_set_interactive
2068 #undef YY_DO_BEFORE_ACTION
2070 #ifdef YY_DECL_IS_OURS
2071 #undef YY_DECL_IS_OURS
2074 #line 194 "cmListFileLexer.in.l"
2078 /*--------------------------------------------------------------------------*/
2079 static void cmListFileLexerSetToken(cmListFileLexer
* lexer
, const char* text
,
2082 /* Set the token line and column number. */
2083 lexer
->token
.line
= lexer
->line
;
2084 lexer
->token
.column
= lexer
->column
;
2086 /* Use the same buffer if possible. */
2087 if(lexer
->token
.text
)
2089 if(text
&& length
< lexer
->size
)
2091 strcpy(lexer
->token
.text
, text
);
2092 lexer
->token
.length
= length
;
2095 free(lexer
->token
.text
);
2096 lexer
->token
.text
= 0;
2100 /* Need to extend the buffer. */
2103 lexer
->token
.text
= strdup(text
);
2104 lexer
->token
.length
= length
;
2105 lexer
->size
= length
+1;
2109 lexer
->token
.length
= 0;
2113 /*--------------------------------------------------------------------------*/
2114 static void cmListFileLexerAppend(cmListFileLexer
* lexer
, const char* text
,
2120 /* If the appended text will fit in the buffer, do not reallocate. */
2121 newSize
= lexer
->token
.length
+ length
+ 1;
2122 if(lexer
->token
.text
&& newSize
<= lexer
->size
)
2124 strcpy(lexer
->token
.text
+lexer
->token
.length
, text
);
2125 lexer
->token
.length
+= length
;
2129 /* We need to extend the buffer. */
2130 temp
= (char*)malloc(newSize
);
2131 if(lexer
->token
.text
)
2133 memcpy(temp
, lexer
->token
.text
, lexer
->token
.length
);
2134 free(lexer
->token
.text
);
2136 memcpy(temp
+lexer
->token
.length
, text
, length
);
2137 temp
[lexer
->token
.length
+length
] = 0;
2138 lexer
->token
.text
= temp
;
2139 lexer
->token
.length
+= length
;
2140 lexer
->size
= newSize
;
2143 /*--------------------------------------------------------------------------*/
2144 static int cmListFileLexerInput(cmListFileLexer
* lexer
, char* buffer
,
2151 return (int)fread(buffer
, 1, bufferSize
, lexer
->file
);
2153 else if(lexer
->string_left
)
2155 int length
= lexer
->string_left
;
2156 if((int)bufferSize
< length
) { length
= (int)bufferSize
; }
2157 memcpy(buffer
, lexer
->string_position
, length
);
2158 lexer
->string_position
+= length
;
2159 lexer
->string_left
-= length
;
2166 /*--------------------------------------------------------------------------*/
2167 static void cmListFileLexerInit(cmListFileLexer
* lexer
)
2169 if(lexer
->file
|| lexer
->string_buffer
)
2171 cmListFileLexer_yylex_init(&lexer
->scanner
);
2172 cmListFileLexer_yyset_extra(lexer
, lexer
->scanner
);
2176 /*--------------------------------------------------------------------------*/
2177 static void cmListFileLexerDestroy(cmListFileLexer
* lexer
)
2179 if(lexer
->file
|| lexer
->string_buffer
)
2181 cmListFileLexer_yylex_destroy(lexer
->scanner
);
2184 fclose(lexer
->file
);
2187 if(lexer
->string_buffer
)
2189 free(lexer
->string_buffer
);
2190 lexer
->string_buffer
= 0;
2191 lexer
->string_left
= 0;
2192 lexer
->string_position
= 0;
2197 /*--------------------------------------------------------------------------*/
2198 cmListFileLexer
* cmListFileLexer_New()
2200 cmListFileLexer
* lexer
= (cmListFileLexer
*)malloc(sizeof(cmListFileLexer
));
2205 memset(lexer
, 0, sizeof(*lexer
));
2211 /*--------------------------------------------------------------------------*/
2212 void cmListFileLexer_Delete(cmListFileLexer
* lexer
)
2214 cmListFileLexer_SetFileName(lexer
, 0);
2218 /*--------------------------------------------------------------------------*/
2219 int cmListFileLexer_SetFileName(cmListFileLexer
* lexer
, const char* name
)
2222 cmListFileLexerDestroy(lexer
);
2225 lexer
->file
= fopen(name
, "r");
2231 cmListFileLexerInit(lexer
);
2235 /*--------------------------------------------------------------------------*/
2236 int cmListFileLexer_SetString(cmListFileLexer
* lexer
, const char* text
)
2239 cmListFileLexerDestroy(lexer
);
2242 int length
= (int)strlen(text
);
2243 lexer
->string_buffer
= (char*)malloc(length
+1);
2244 if(lexer
->string_buffer
)
2246 strcpy(lexer
->string_buffer
, text
);
2247 lexer
->string_position
= lexer
->string_buffer
;
2248 lexer
->string_left
= length
;
2255 cmListFileLexerInit(lexer
);
2259 /*--------------------------------------------------------------------------*/
2260 cmListFileLexer_Token
* cmListFileLexer_Scan(cmListFileLexer
* lexer
)
2266 if(cmListFileLexer_yylex(lexer
->scanner
, lexer
))
2268 return &lexer
->token
;
2272 cmListFileLexer_SetFileName(lexer
, 0);
2277 /*--------------------------------------------------------------------------*/
2278 long cmListFileLexer_GetCurrentLine(cmListFileLexer
* lexer
)
2290 /*--------------------------------------------------------------------------*/
2291 long cmListFileLexer_GetCurrentColumn(cmListFileLexer
* lexer
)
2295 return lexer
->column
;
2303 /*--------------------------------------------------------------------------*/
2304 const char* cmListFileLexer_GetTypeAsString(cmListFileLexer
* lexer
,
2305 cmListFileLexer_Type type
)
2310 case cmListFileLexer_Token_None
: return "nothing";
2311 case cmListFileLexer_Token_Newline
: return "newline";
2312 case cmListFileLexer_Token_Identifier
: return "identifier";
2313 case cmListFileLexer_Token_ParenLeft
: return "left paren";
2314 case cmListFileLexer_Token_ParenRight
: return "right paren";
2315 case cmListFileLexer_Token_ArgumentUnquoted
: return "unquoted argument";
2316 case cmListFileLexer_Token_ArgumentQuoted
: return "quoted argument";
2317 case cmListFileLexer_Token_BadCharacter
: return "bad character";
2318 case cmListFileLexer_Token_BadString
: return "unterminated string";
2320 return "unknown token";