BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmListFileLexer.c
blob6f1091ec84ec25090d9439a85a253d6a56de4af5
1 #line 2 "cmListFileLexer.c"
3 #line 4 "cmListFileLexer.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 31
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
25 /* end standard C headers. */
27 /* flex integer type definitions */
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
35 #include <inttypes.h>
36 typedef int8_t flex_int8_t;
37 typedef uint8_t flex_uint8_t;
38 typedef int16_t flex_int16_t;
39 typedef uint16_t flex_uint16_t;
40 typedef int32_t flex_int32_t;
41 typedef uint32_t flex_uint32_t;
42 #else
43 typedef signed char flex_int8_t;
44 typedef short int flex_int16_t;
45 typedef int flex_int32_t;
46 typedef unsigned char flex_uint8_t;
47 typedef unsigned short int flex_uint16_t;
48 typedef unsigned int flex_uint32_t;
49 #endif /* ! C99 */
51 /* Limits of integral types. */
52 #ifndef INT8_MIN
53 #define INT8_MIN (-128)
54 #endif
55 #ifndef INT16_MIN
56 #define INT16_MIN (-32767-1)
57 #endif
58 #ifndef INT32_MIN
59 #define INT32_MIN (-2147483647-1)
60 #endif
61 #ifndef INT8_MAX
62 #define INT8_MAX (127)
63 #endif
64 #ifndef INT16_MAX
65 #define INT16_MAX (32767)
66 #endif
67 #ifndef INT32_MAX
68 #define INT32_MAX (2147483647)
69 #endif
70 #ifndef UINT8_MAX
71 #define UINT8_MAX (255U)
72 #endif
73 #ifndef UINT16_MAX
74 #define UINT16_MAX (65535U)
75 #endif
76 #ifndef UINT32_MAX
77 #define UINT32_MAX (4294967295U)
78 #endif
80 #endif /* ! FLEXINT_H */
82 #ifdef __cplusplus
84 /* The "const" storage-class-modifier is valid. */
85 #define YY_USE_CONST
87 #else /* ! __cplusplus */
89 #if __STDC__
91 #define YY_USE_CONST
93 #endif /* __STDC__ */
94 #endif /* ! __cplusplus */
96 #ifdef YY_USE_CONST
97 #define yyconst const
98 #else
99 #define yyconst
100 #endif
102 /* Returned upon end-of-file. */
103 #define YY_NULL 0
105 /* Promotes a possibly negative, possibly signed char to an unsigned
106 * integer for use as an array index. If the signed char is negative,
107 * we want to instead treat it as an 8-bit unsigned char, hence the
108 * double cast.
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;
116 #endif
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
139 * compatibility.
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. */
153 #ifndef YY_BUF_SIZE
154 #define YY_BUF_SIZE 16384
155 #endif
157 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
158 #define YY_TYPEDEF_YY_BUFFER_STATE
159 typedef struct yy_buffer_state *YY_BUFFER_STATE;
160 #endif
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) \
174 do { \
175 int yyl;\
176 for ( yyl = n; yyl < yyleng; ++yyl )\
177 if ( yytext[yyl] == '\n' )\
178 --yylineno;\
179 }while(0)
181 /* Return all but the first "n" matched characters back to the input stream. */
182 #define yyless(n) \
183 do \
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 */ \
193 while ( 0 )
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;
203 #endif
205 #ifndef YY_STRUCT_YY_BUFFER_STATE
206 #define YY_STRUCT_YY_BUFFER_STATE
207 struct yy_buffer_state
209 FILE *yy_input_file;
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
215 * characters.
217 yy_size_t yy_buf_size;
219 /* Number of characters read into yy_ch_buf, not including EOB
220 * characters.
222 int yy_n_chars;
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
226 * delete it.
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
233 * each newline.
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
239 * not.
241 int yy_at_bol;
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
247 * end of it.
249 int yy_fill_buffer;
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
272 * "scanner state".
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] \
278 : NULL)
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; \
354 *yy_cp = '\0'; \
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. */
361 struct yy_trans_info
363 flex_int32_t yy_verify;
364 flex_int32_t yy_nxt;
366 static yyconst flex_int16_t yy_accept[39] =
367 { 0,
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] =
375 { 0,
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,
403 1, 1, 1, 1, 1
406 static yyconst flex_int32_t yy_meta[13] =
407 { 0,
408 1, 1, 2, 1, 3, 1, 1, 1, 4, 4,
409 4, 1
412 static yyconst flex_int16_t yy_base[48] =
413 { 0,
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] =
422 { 0,
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] =
431 { 0,
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] =
447 { 0,
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] =
464 { 0,
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 $
480 Language: C++
481 Date: $Date: 2006-08-09 13:45:04 $
482 Version: $Revision: 1.15 $
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.
496 Run flex like this:
498 flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
500 Modify cmListFileLexer.c:
501 - remove TABs
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;
522 int line;
523 int column;
524 int size;
525 FILE* file;
526 char* string_buffer;
527 char* string_position;
528 int string_left;
529 yyscan_t scanner;
532 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
533 int length);
534 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
535 int length);
536 static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
537 size_t bufferSize);
538 static void cmListFileLexerInit(cmListFileLexer* lexer);
539 static void cmListFileLexerDestroy(cmListFileLexer* lexer);
541 /* Replace the lexer input function. */
542 #undef YY_INPUT
543 #define YY_INPUT(buf, result, max_size) \
544 { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); }
546 /*--------------------------------------------------------------------------*/
548 #line 568 "cmListFileLexer.c"
550 #define INITIAL 0
551 #define STRING 1
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.
558 #include <unistd.h>
559 #endif
561 #ifndef YY_EXTRA_TYPE
562 #define YY_EXTRA_TYPE void *
563 #endif
565 /* Holds the entire state of the reentrant scanner. */
566 struct yyguts_t
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. */
577 char yy_hold_char;
578 int yy_n_chars;
579 int yyleng_r;
580 char *yy_c_buf_p;
581 int yy_init;
582 int yy_start;
583 int yy_did_buffer_switch_on_eof;
584 int yy_start_stack_ptr;
585 int yy_start_stack_depth;
586 int *yy_start_stack;
587 yy_state_type yy_last_accepting_state;
588 char* yy_last_accepting_cpos;
590 int yylineno_r;
591 int yy_flex_debug_r;
593 char *yytext_r;
594 int yy_more_flag;
595 int yy_more_len;
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
629 * section 1.
632 #ifndef YY_SKIP_YYWRAP
633 #ifdef __cplusplus
634 extern "C" int cmListFileLexer_yywrap (yyscan_t yyscanner );
635 #else
636 extern int cmListFileLexer_yywrap (yyscan_t yyscanner );
637 #endif
638 #endif
640 #ifndef yytext_ptr
641 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
642 #endif
644 #ifdef YY_NEED_STRLEN
645 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
646 #endif
648 #ifndef YY_NO_INPUT
650 #ifdef __cplusplus
651 static int yyinput (yyscan_t yyscanner );
652 #else
653 static int input (yyscan_t yyscanner );
654 #endif
656 #endif
658 /* Amount of stuff to slurp up with each read. */
659 #ifndef YY_READ_BUF_SIZE
660 #define YY_READ_BUF_SIZE 8192
661 #endif
663 /* Copy whatever the last rule matched to the standard output. */
664 #ifndef ECHO
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 )
669 #endif
671 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
672 * is returned in "result".
674 #ifndef YY_INPUT
675 #define YY_INPUT(buf,result,max_size) \
676 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
678 int c = '*'; \
679 size_t n; \
680 for ( n = 0; n < max_size && \
681 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
682 buf[n] = (char) c; \
683 if ( c == '\n' ) \
684 buf[n++] = (char) c; \
685 if ( c == EOF && ferror( yyin ) ) \
686 YY_FATAL_ERROR( "input in flex scanner failed" ); \
687 result = n; \
689 else \
691 errno=0; \
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" ); \
697 break; \
699 errno=0; \
700 clearerr(yyin); \
705 #endif
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.
711 #ifndef yyterminate
712 #define yyterminate() return YY_NULL
713 #endif
715 /* Number of entries by which start-condition stack grows. */
716 #ifndef YY_START_STACK_INCR
717 #define YY_START_STACK_INCR 25
718 #endif
720 /* Report a fatal error. */
721 #ifndef YY_FATAL_ERROR
722 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
723 #endif
725 /* end tables serialization structures and prototypes */
727 /* Default declaration of generated scanner - a define so the user can
728 * easily add parameters.
730 #ifndef YY_DECL
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
739 * have been set up.
741 #ifndef YY_USER_ACTION
742 #define YY_USER_ACTION
743 #endif
745 /* Code executed at the end of each rule. */
746 #ifndef YY_BREAK
747 #define YY_BREAK break;
748 #endif
750 #define YY_RULE_SETUP \
751 YY_USER_ACTION
753 /** The main scanner function which does all the work.
755 YY_DECL
757 register yy_state_type yy_current_state;
758 register char *yy_cp, *yy_bp;
759 register int yy_act;
760 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
762 #line 100 "cmListFileLexer.in.l"
765 #line 787 "cmListFileLexer.c"
767 if ( yyg->yy_init )
769 yyg->yy_init = 0;
771 #ifdef YY_USER_INIT
772 YY_USER_INIT;
773 #endif
775 if ( ! yyg->yy_start )
776 yyg->yy_start = 1; /* first start state */
778 if ( ! yyin )
779 yyin = stdin;
781 if ( ! yyout )
782 yyout = stdout;
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
801 * the current run.
803 yy_bp = yy_cp;
805 yy_current_state = yyg->yy_start;
806 yy_match:
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];
822 ++yy_cp;
824 while ( yy_base[yy_current_state] != 89 );
826 yy_find_action:
827 yy_act = yy_accept[yy_current_state];
828 if ( yy_act == 0 )
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];
835 YY_DO_BEFORE_ACTION;
837 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
839 int yyl;
840 for ( yyl = 0; yyl < yyleng; ++yyl )
841 if ( yytext[yyl] == '\n' )
843 do{ yylineno++;
844 yycolumn=0;
845 }while(0)
849 do_action: /* This label is used only to access EOF actions. */
851 switch ( yy_act )
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;
858 goto yy_find_action;
860 case 1:
861 /* rule 1 can match eol */
862 YY_RULE_SETUP
863 #line 102 "cmListFileLexer.in.l"
865 lexer->token.type = cmListFileLexer_Token_Newline;
866 cmListFileLexerSetToken(lexer, yytext, yyleng);
867 ++lexer->line;
868 lexer->column = 1;
869 return 1;
871 case 2:
872 YY_RULE_SETUP
873 #line 110 "cmListFileLexer.in.l"
875 lexer->column += yyleng;
877 YY_BREAK
878 case 3:
879 YY_RULE_SETUP
880 #line 114 "cmListFileLexer.in.l"
882 lexer->token.type = cmListFileLexer_Token_ParenLeft;
883 cmListFileLexerSetToken(lexer, yytext, yyleng);
884 lexer->column += yyleng;
885 return 1;
887 case 4:
888 YY_RULE_SETUP
889 #line 121 "cmListFileLexer.in.l"
891 lexer->token.type = cmListFileLexer_Token_ParenRight;
892 cmListFileLexerSetToken(lexer, yytext, yyleng);
893 lexer->column += yyleng;
894 return 1;
896 case 5:
897 YY_RULE_SETUP
898 #line 128 "cmListFileLexer.in.l"
900 lexer->token.type = cmListFileLexer_Token_Identifier;
901 cmListFileLexerSetToken(lexer, yytext, yyleng);
902 lexer->column += yyleng;
903 return 1;
905 case 6:
906 YY_RULE_SETUP
907 #line 135 "cmListFileLexer.in.l"
909 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
910 cmListFileLexerSetToken(lexer, yytext, yyleng);
911 lexer->column += yyleng;
912 return 1;
914 case 7:
915 YY_RULE_SETUP
916 #line 142 "cmListFileLexer.in.l"
918 lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
919 cmListFileLexerSetToken(lexer, "", 0);
920 lexer->column += yyleng;
921 BEGIN(STRING);
923 YY_BREAK
924 case 8:
925 /* rule 8 can match eol */
926 YY_RULE_SETUP
927 #line 149 "cmListFileLexer.in.l"
929 cmListFileLexerAppend(lexer, yytext, yyleng);
930 lexer->column += yyleng;
932 YY_BREAK
933 case 9:
934 /* rule 9 can match eol */
935 YY_RULE_SETUP
936 #line 154 "cmListFileLexer.in.l"
938 cmListFileLexerAppend(lexer, yytext, yyleng);
939 ++lexer->line;
940 lexer->column = 1;
942 YY_BREAK
943 case 10:
944 YY_RULE_SETUP
945 #line 160 "cmListFileLexer.in.l"
947 lexer->column += yyleng;
948 BEGIN(INITIAL);
949 return 1;
951 case 11:
952 YY_RULE_SETUP
953 #line 166 "cmListFileLexer.in.l"
955 cmListFileLexerAppend(lexer, yytext, yyleng);
956 lexer->column += yyleng;
958 YY_BREAK
959 case YY_STATE_EOF(STRING):
960 #line 171 "cmListFileLexer.in.l"
962 lexer->token.type = cmListFileLexer_Token_BadString;
963 BEGIN(INITIAL);
964 return 1;
966 case 12:
967 YY_RULE_SETUP
968 #line 177 "cmListFileLexer.in.l"
970 lexer->column += yyleng;
972 YY_BREAK
973 case 13:
974 YY_RULE_SETUP
975 #line 181 "cmListFileLexer.in.l"
977 lexer->token.type = cmListFileLexer_Token_BadCharacter;
978 cmListFileLexerSetToken(lexer, yytext, yyleng);
979 lexer->column += yyleng;
980 return 1;
982 case YY_STATE_EOF(INITIAL):
983 #line 188 "cmListFileLexer.in.l"
985 lexer->token.type = cmListFileLexer_Token_None;
986 cmListFileLexerSetToken(lexer, 0, 0);
987 return 0;
989 case 14:
990 YY_RULE_SETUP
991 #line 194 "cmListFileLexer.in.l"
992 ECHO;
993 YY_BREAK
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
1026 * in input().
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;
1054 goto yy_match;
1057 else
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);
1084 goto do_action;
1087 else
1089 if ( ! yyg->yy_did_buffer_switch_on_eof )
1090 YY_NEW_FILE;
1092 break;
1095 case EOB_ACT_CONTINUE_SCAN:
1096 yyg->yy_c_buf_p =
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;
1103 goto yy_match;
1105 case EOB_ACT_LAST_MATCH:
1106 yyg->yy_c_buf_p =
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;
1115 break;
1118 default:
1119 YY_FATAL_ERROR(
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;
1138 int ret_val;
1140 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1141 YY_FATAL_ERROR(
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;
1154 else
1156 /* We matched some text prior to the EOB, first
1157 * process it.
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,
1173 * just force an EOF
1175 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1177 else
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;
1197 else
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 );
1204 else
1205 /* Can't grow it, we don't own it. */
1206 b->yy_ch_buf = 0;
1208 if ( ! b->yy_ch_buf )
1209 YY_FATAL_ERROR(
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 -
1215 number_to_move - 1;
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);
1237 else
1239 ret_val = EOB_ACT_LAST_MATCH;
1240 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1241 YY_BUFFER_EOF_PENDING;
1245 else
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];
1254 return ret_val;
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
1289 * synopsis
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;
1316 #ifndef YY_NO_INPUT
1317 #ifdef __cplusplus
1318 static int yyinput (yyscan_t yyscanner)
1319 #else
1320 static int input (yyscan_t yyscanner)
1321 #endif
1324 int c;
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';
1339 else
1340 { /* need more input */
1341 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1342 ++yyg->yy_c_buf_p;
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);
1360 /*FALLTHROUGH*/
1362 case EOB_ACT_END_OF_FILE:
1364 if ( cmListFileLexer_yywrap(yyscanner ) )
1365 return EOF;
1367 if ( ! yyg->yy_did_buffer_switch_on_eof )
1368 YY_NEW_FILE;
1369 #ifdef __cplusplus
1370 return yyinput(yyscanner);
1371 #else
1372 return input(yyscanner);
1373 #endif
1376 case EOB_ACT_CONTINUE_SCAN:
1377 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1378 break;
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;
1387 if ( c == '\n' )
1389 do{ yylineno++;
1390 yycolumn=0;
1391 }while(0)
1394 return c;
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
1426 * with
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 )
1432 return;
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)
1470 YY_BUFFER_STATE b;
1472 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1473 if ( ! b )
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);
1489 return b;
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;
1500 if ( ! b )
1501 return;
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)
1519 int oerrno = errno;
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;
1538 errno = oerrno;
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;
1548 if ( ! b )
1549 return;
1551 b->yy_n_chars = 0;
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];
1562 b->yy_at_bol = 1;
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
1571 * if necessary.
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)
1579 return;
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)
1610 return;
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)
1628 int num_to_alloc;
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.
1637 num_to_alloc = 1;
1638 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
1639 (num_to_alloc * sizeof(struct yy_buffer_state*)
1640 , yyscanner);
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;
1646 return;
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*)
1658 , yyscanner);
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)
1674 YY_BUFFER_STATE b;
1676 if ( size < 2 ||
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. */
1680 return 0;
1682 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1683 if ( ! b )
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;
1692 b->yy_at_bol = 1;
1693 b->yy_fill_buffer = 0;
1694 b->yy_buffer_status = YY_BUFFER_NEW;
1696 cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
1698 return b;
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)
1724 YY_BUFFER_STATE b;
1725 char *buf;
1726 yy_size_t n;
1727 int i;
1729 /* Get memory for full buffer, including space for trailing EOB's. */
1730 n = len + 2;
1731 buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
1732 if ( ! buf )
1733 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
1735 for ( i = 0; i < len; ++i )
1736 buf[i] = bytes[i];
1738 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1740 b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
1741 if ( ! b )
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;
1749 return b;
1752 #ifndef YY_EXIT_FAILURE
1753 #define YY_EXIT_FAILURE 2
1754 #endif
1756 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1758 (void)yyscanner;
1759 (void) fprintf( stderr, "%s\n", msg );
1760 exit( YY_EXIT_FAILURE );
1763 /* Redefine yyless() so it works in section 3 code. */
1765 #undef yyless
1766 #define yyless(n) \
1767 do \
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; \
1778 while ( 0 )
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;
1788 return yyextra;
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)
1799 return 0;
1801 return yylineno;
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)
1812 return 0;
1814 return yycolumn;
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;
1823 return yyin;
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;
1832 return yyout;
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;
1841 return yyleng;
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;
1851 return yytext;
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
1895 * input buffer.
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;
1903 yyin = in_str ;
1906 void cmListFileLexer_yyset_out (FILE * out_str , yyscan_t yyscanner)
1908 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1909 yyout = out_str ;
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;
1936 yyg->yy_init = 1;
1937 yyg->yy_start = 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 */
1943 #ifdef YY_STDINIT
1944 yyin = stdin;
1945 yyout = stdout;
1946 #else
1947 yyin = (FILE *) 0;
1948 yyout = (FILE *) 0;
1949 #endif
1951 /* For future reference: Set errno on error, since we are called by
1952 * cmListFileLexer_yylex_init()
1954 return 0;
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){
1968 errno = EINVAL;
1969 return 1;
1972 *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), NULL );
1974 if (*ptr_yy_globals == NULL){
1975 errno = ENOMEM;
1976 return 1;
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 );
2006 return 0;
2010 * Internal utility routines.
2013 #ifndef yytext_ptr
2014 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2016 register int i;
2017 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2018 for ( i = 0; i < n; ++i )
2019 s1[i] = s2[i];
2021 #endif
2023 #ifdef YY_NEED_STRLEN
2024 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2026 register int n;
2027 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2028 for ( n = 0; s[n]; ++n )
2031 return n;
2033 #endif
2035 void *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner)
2037 (void)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.
2050 (void)yyscanner;
2051 return (void *) realloc( (char *) ptr, size );
2054 void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
2056 (void)yyscanner;
2057 free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
2060 #define YYTABLES_NAME "yytables"
2062 #undef YY_NEW_FILE
2063 #undef YY_FLUSH_BUFFER
2064 #undef yy_set_bol
2065 #undef yy_new_buffer
2066 #undef yy_set_interactive
2067 #undef yytext_ptr
2068 #undef YY_DO_BEFORE_ACTION
2070 #ifdef YY_DECL_IS_OURS
2071 #undef YY_DECL_IS_OURS
2072 #undef YY_DECL
2073 #endif
2074 #line 194 "cmListFileLexer.in.l"
2078 /*--------------------------------------------------------------------------*/
2079 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
2080 int length)
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;
2093 return;
2095 free(lexer->token.text);
2096 lexer->token.text = 0;
2097 lexer->size = 0;
2100 /* Need to extend the buffer. */
2101 if(text)
2103 lexer->token.text = strdup(text);
2104 lexer->token.length = length;
2105 lexer->size = length+1;
2107 else
2109 lexer->token.length = 0;
2113 /*--------------------------------------------------------------------------*/
2114 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
2115 int length)
2117 char* temp;
2118 int newSize;
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;
2126 return;
2129 /* We need to extend the buffer. */
2130 temp = 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,
2145 size_t bufferSize)
2147 if(lexer)
2149 if(lexer->file)
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;
2160 return length;
2163 return 0;
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);
2182 if(lexer->file)
2184 fclose(lexer->file);
2185 lexer->file = 0;
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));
2201 if(!lexer)
2203 return 0;
2205 memset(lexer, 0, sizeof(*lexer));
2206 lexer->line = 1;
2207 lexer->column = 1;
2208 return lexer;
2211 /*--------------------------------------------------------------------------*/
2212 void cmListFileLexer_Delete(cmListFileLexer* lexer)
2214 cmListFileLexer_SetFileName(lexer, 0);
2215 free(lexer);
2218 /*--------------------------------------------------------------------------*/
2219 int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name)
2221 int result = 1;
2222 cmListFileLexerDestroy(lexer);
2223 if(name)
2225 lexer->file = fopen(name, "r");
2226 if(!lexer->file)
2228 result = 0;
2231 cmListFileLexerInit(lexer);
2232 return result;
2235 /*--------------------------------------------------------------------------*/
2236 int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
2238 int result = 1;
2239 cmListFileLexerDestroy(lexer);
2240 if(text)
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;
2250 else
2252 result = 0;
2255 cmListFileLexerInit(lexer);
2256 return result;
2259 /*--------------------------------------------------------------------------*/
2260 cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
2262 if(!lexer->file)
2264 return 0;
2266 if(cmListFileLexer_yylex(lexer->scanner, lexer))
2268 return &lexer->token;
2270 else
2272 cmListFileLexer_SetFileName(lexer, 0);
2273 return 0;
2277 /*--------------------------------------------------------------------------*/
2278 long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
2280 if(lexer->file)
2282 return lexer->line;
2284 else
2286 return 0;
2290 /*--------------------------------------------------------------------------*/
2291 long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
2293 if(lexer->file)
2295 return lexer->column;
2297 else
2299 return 0;
2303 /*--------------------------------------------------------------------------*/
2304 const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
2305 cmListFileLexer_Type type)
2307 (void)lexer;
2308 switch(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";