File indexing completed on 2024-05-12 04:39:27
0001 #include "cmStandardLexer.h" 0002 #line 2 "cmListFileLexer.c" 0003 0004 #line 4 "cmListFileLexer.c" 0005 0006 #define FLEXINT_H 1 0007 #define YY_INT_ALIGNED short int 0008 0009 /* A lexical scanner generated by flex */ 0010 0011 #define FLEX_SCANNER 0012 #define YY_FLEX_MAJOR_VERSION 2 0013 #define YY_FLEX_MINOR_VERSION 6 0014 #define YY_FLEX_SUBMINOR_VERSION 1 0015 #if YY_FLEX_SUBMINOR_VERSION > 0 0016 #define FLEX_BETA 0017 #endif 0018 0019 /* First, we deal with platform-specific or compiler-specific issues. */ 0020 0021 /* begin standard C headers. */ 0022 #include <stdio.h> 0023 #include <string.h> 0024 #include <errno.h> 0025 #include <stdlib.h> 0026 0027 /* end standard C headers. */ 0028 0029 /* flex integer type definitions */ 0030 0031 #ifndef FLEXINT_H 0032 #define FLEXINT_H 0033 0034 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 0035 0036 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 0037 0038 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 0039 * if you want the limit (max/min) macros for int types. 0040 */ 0041 #ifndef __STDC_LIMIT_MACROS 0042 #define __STDC_LIMIT_MACROS 1 0043 #endif 0044 0045 #include <inttypes.h> 0046 typedef int8_t flex_int8_t; 0047 typedef uint8_t flex_uint8_t; 0048 typedef int16_t flex_int16_t; 0049 typedef uint16_t flex_uint16_t; 0050 typedef int32_t flex_int32_t; 0051 typedef uint32_t flex_uint32_t; 0052 #else 0053 typedef signed char flex_int8_t; 0054 typedef short int flex_int16_t; 0055 typedef int flex_int32_t; 0056 typedef unsigned char flex_uint8_t; 0057 typedef unsigned short int flex_uint16_t; 0058 typedef unsigned int flex_uint32_t; 0059 0060 /* Limits of integral types. */ 0061 #ifndef INT8_MIN 0062 #define INT8_MIN (-128) 0063 #endif 0064 #ifndef INT16_MIN 0065 #define INT16_MIN (-32767-1) 0066 #endif 0067 #ifndef INT32_MIN 0068 #define INT32_MIN (-2147483647-1) 0069 #endif 0070 #ifndef INT8_MAX 0071 #define INT8_MAX (127) 0072 #endif 0073 #ifndef INT16_MAX 0074 #define INT16_MAX (32767) 0075 #endif 0076 #ifndef INT32_MAX 0077 #define INT32_MAX (2147483647) 0078 #endif 0079 #ifndef UINT8_MAX 0080 #define UINT8_MAX (255U) 0081 #endif 0082 #ifndef UINT16_MAX 0083 #define UINT16_MAX (65535U) 0084 #endif 0085 #ifndef UINT32_MAX 0086 #define UINT32_MAX (4294967295U) 0087 #endif 0088 0089 #endif /* ! C99 */ 0090 0091 #endif /* ! FLEXINT_H */ 0092 0093 /* TODO: this is always defined, so inline it */ 0094 #define yyconst const 0095 0096 #if defined(__GNUC__) && __GNUC__ >= 3 0097 #define yynoreturn __attribute__((__noreturn__)) 0098 #else 0099 #define yynoreturn 0100 #endif 0101 0102 /* Returned upon end-of-file. */ 0103 #define YY_NULL 0 0104 0105 /* Promotes a possibly negative, possibly signed char to an unsigned 0106 * integer for use as an array index. If the signed char is negative, 0107 * we want to instead treat it as an 8-bit unsigned char, hence the 0108 * double cast. 0109 */ 0110 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 0111 0112 /* An opaque pointer. */ 0113 #ifndef YY_TYPEDEF_YY_SCANNER_T 0114 #define YY_TYPEDEF_YY_SCANNER_T 0115 typedef void* yyscan_t; 0116 #endif 0117 0118 /* For convenience, these vars (plus the bison vars far below) 0119 are macros in the reentrant scanner. */ 0120 #define yyin yyg->yyin_r 0121 #define yyout yyg->yyout_r 0122 #define yyextra yyg->yyextra_r 0123 #define yyleng yyg->yyleng_r 0124 #define yytext yyg->yytext_r 0125 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 0126 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 0127 #define yy_flex_debug yyg->yy_flex_debug_r 0128 0129 /* Enter a start condition. This macro really ought to take a parameter, 0130 * but we do it the disgusting crufty way forced on us by the ()-less 0131 * definition of BEGIN. 0132 */ 0133 #define BEGIN yyg->yy_start = 1 + 2 * 0134 0135 /* Translate the current start state into a value that can be later handed 0136 * to BEGIN to return to the state. The YYSTATE alias is for lex 0137 * compatibility. 0138 */ 0139 #define YY_START ((yyg->yy_start - 1) / 2) 0140 #define YYSTATE YY_START 0141 0142 /* Action number for EOF rule of a given start state. */ 0143 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 0144 0145 /* Special action meaning "start processing a new file". */ 0146 #define YY_NEW_FILE cmListFileLexer_yyrestart(yyin ,yyscanner ) 0147 0148 #define YY_END_OF_BUFFER_CHAR 0 0149 0150 /* Size of default input buffer. */ 0151 #ifndef YY_BUF_SIZE 0152 #ifdef __ia64__ 0153 /* On IA-64, the buffer size is 16k, not 8k. 0154 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 0155 * Ditto for the __ia64__ case accordingly. 0156 */ 0157 #define YY_BUF_SIZE 32768 0158 #else 0159 #define YY_BUF_SIZE 16384 0160 #endif /* __ia64__ */ 0161 #endif 0162 0163 /* The state buf must be large enough to hold one state per character in the main buffer. 0164 */ 0165 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 0166 0167 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 0168 #define YY_TYPEDEF_YY_BUFFER_STATE 0169 typedef struct yy_buffer_state *YY_BUFFER_STATE; 0170 #endif 0171 0172 #ifndef YY_TYPEDEF_YY_SIZE_T 0173 #define YY_TYPEDEF_YY_SIZE_T 0174 typedef size_t yy_size_t; 0175 #endif 0176 0177 #define EOB_ACT_CONTINUE_SCAN 0 0178 #define EOB_ACT_END_OF_FILE 1 0179 #define EOB_ACT_LAST_MATCH 2 0180 0181 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 0182 * access to the local variable yy_act. Since yyless() is a macro, it would break 0183 * existing scanners that call yyless() from OUTSIDE cmListFileLexer_yylex. 0184 * One obvious solution it to make yy_act a global. I tried that, and saw 0185 * a 5% performance hit in a non-yylineno scanner, because yy_act is 0186 * normally declared as a register variable-- so it is not worth it. 0187 */ 0188 #define YY_LESS_LINENO(n) \ 0189 do { \ 0190 int yyl;\ 0191 for ( yyl = n; yyl < yyleng; ++yyl )\ 0192 if ( yytext[yyl] == '\n' )\ 0193 --yylineno;\ 0194 }while(0) 0195 #define YY_LINENO_REWIND_TO(dst) \ 0196 do {\ 0197 const char *p;\ 0198 for ( p = yy_cp-1; p >= (dst); --p)\ 0199 if ( *p == '\n' )\ 0200 --yylineno;\ 0201 }while(0) 0202 0203 /* Return all but the first "n" matched characters back to the input stream. */ 0204 #define yyless(n) \ 0205 do \ 0206 { \ 0207 /* Undo effects of setting up yytext. */ \ 0208 int yyless_macro_arg = (n); \ 0209 YY_LESS_LINENO(yyless_macro_arg);\ 0210 *yy_cp = yyg->yy_hold_char; \ 0211 YY_RESTORE_YY_MORE_OFFSET \ 0212 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 0213 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 0214 } \ 0215 while ( 0 ) 0216 0217 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 0218 0219 #ifndef YY_STRUCT_YY_BUFFER_STATE 0220 #define YY_STRUCT_YY_BUFFER_STATE 0221 struct yy_buffer_state 0222 { 0223 FILE *yy_input_file; 0224 0225 char *yy_ch_buf; /* input buffer */ 0226 char *yy_buf_pos; /* current position in input buffer */ 0227 0228 /* Size of input buffer in bytes, not including room for EOB 0229 * characters. 0230 */ 0231 int yy_buf_size; 0232 0233 /* Number of characters read into yy_ch_buf, not including EOB 0234 * characters. 0235 */ 0236 int yy_n_chars; 0237 0238 /* Whether we "own" the buffer - i.e., we know we created it, 0239 * and can realloc() it to grow it, and should free() it to 0240 * delete it. 0241 */ 0242 int yy_is_our_buffer; 0243 0244 /* Whether this is an "interactive" input source; if so, and 0245 * if we're using stdio for input, then we want to use getc() 0246 * instead of fread(), to make sure we stop fetching input after 0247 * each newline. 0248 */ 0249 int yy_is_interactive; 0250 0251 /* Whether we're considered to be at the beginning of a line. 0252 * If so, '^' rules will be active on the next match, otherwise 0253 * not. 0254 */ 0255 int yy_at_bol; 0256 0257 int yy_bs_lineno; /**< The line count. */ 0258 int yy_bs_column; /**< The column count. */ 0259 0260 /* Whether to try to fill the input buffer when we reach the 0261 * end of it. 0262 */ 0263 int yy_fill_buffer; 0264 0265 int yy_buffer_status; 0266 0267 #define YY_BUFFER_NEW 0 0268 #define YY_BUFFER_NORMAL 1 0269 /* When an EOF's been seen but there's still some text to process 0270 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 0271 * shouldn't try reading from the input source any more. We might 0272 * still have a bunch of tokens to match, though, because of 0273 * possible backing-up. 0274 * 0275 * When we actually see the EOF, we change the status to "new" 0276 * (via cmListFileLexer_yyrestart()), so that the user can continue scanning by 0277 * just pointing yyin at a new input file. 0278 */ 0279 #define YY_BUFFER_EOF_PENDING 2 0280 0281 }; 0282 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 0283 0284 /* We provide macros for accessing buffer states in case in the 0285 * future we want to put the buffer states in a more general 0286 * "scanner state". 0287 * 0288 * Returns the top of the stack, or NULL. 0289 */ 0290 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 0291 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 0292 : NULL) 0293 0294 /* Same as previous macro, but useful when we know that the buffer stack is not 0295 * NULL or when we need an lvalue. For internal use only. 0296 */ 0297 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 0298 0299 void cmListFileLexer_yyrestart (FILE *input_file ,yyscan_t yyscanner ); 0300 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 0301 YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 0302 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 0303 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 0304 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 0305 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner ); 0306 0307 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner ); 0308 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner ); 0309 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 0310 0311 #define YY_FLUSH_BUFFER cmListFileLexer_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 0312 0313 YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 0314 YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 0315 YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 0316 0317 void *cmListFileLexer_yyalloc (yy_size_t ,yyscan_t yyscanner ); 0318 void *cmListFileLexer_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); 0319 void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner ); 0320 0321 #define yy_new_buffer cmListFileLexer_yy_create_buffer 0322 0323 #define yy_set_interactive(is_interactive) \ 0324 { \ 0325 if ( ! YY_CURRENT_BUFFER ){ \ 0326 cmListFileLexer_yyensure_buffer_stack (yyscanner); \ 0327 YY_CURRENT_BUFFER_LVALUE = \ 0328 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 0329 } \ 0330 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 0331 } 0332 0333 #define yy_set_bol(at_bol) \ 0334 { \ 0335 if ( ! YY_CURRENT_BUFFER ){\ 0336 cmListFileLexer_yyensure_buffer_stack (yyscanner); \ 0337 YY_CURRENT_BUFFER_LVALUE = \ 0338 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 0339 } \ 0340 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 0341 } 0342 0343 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 0344 0345 /* Begin user sect3 */ 0346 0347 #define cmListFileLexer_yywrap(yyscanner) (/*CONSTCOND*/1) 0348 #define YY_SKIP_YYWRAP 0349 0350 typedef unsigned char YY_CHAR; 0351 0352 typedef int yy_state_type; 0353 0354 #define yytext_ptr yytext_r 0355 0356 static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 0357 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 0358 static int yy_get_next_buffer (yyscan_t yyscanner ); 0359 static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); 0360 0361 /* Done after the current pattern has been matched and before the 0362 * corresponding action - sets up yytext. 0363 */ 0364 #define YY_DO_BEFORE_ACTION \ 0365 yyg->yytext_ptr = yy_bp; \ 0366 yyleng = (int) (yy_cp - yy_bp); \ 0367 yyg->yy_hold_char = *yy_cp; \ 0368 *yy_cp = '\0'; \ 0369 yyg->yy_c_buf_p = yy_cp; 0370 0371 #define YY_NUM_RULES 24 0372 #define YY_END_OF_BUFFER 25 0373 /* This struct is not used in this scanner, 0374 but its presence is necessary. */ 0375 struct yy_trans_info 0376 { 0377 flex_int32_t yy_verify; 0378 flex_int32_t yy_nxt; 0379 }; 0380 static yyconst flex_int16_t yy_accept[77] = 0381 { 0, 0382 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0383 25, 13, 22, 1, 16, 3, 13, 5, 6, 7, 0384 15, 23, 17, 19, 20, 21, 10, 11, 8, 12, 0385 9, 4, 13, 0, 13, 0, 22, 0, 0, 7, 0386 13, 0, 13, 0, 2, 0, 13, 17, 0, 18, 0387 10, 8, 4, 0, 14, 0, 0, 0, 0, 14, 0388 0, 0, 14, 0, 0, 0, 2, 14, 0, 0, 0389 0, 0, 0, 0, 0, 0 0390 } ; 0391 0392 static yyconst YY_CHAR yy_ec[256] = 0393 { 0, 0394 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 0395 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 0396 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0397 1, 2, 1, 5, 6, 7, 1, 1, 1, 8, 0398 9, 1, 1, 1, 1, 1, 1, 10, 10, 10, 0399 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 0400 11, 1, 1, 1, 12, 12, 12, 12, 12, 12, 0401 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0402 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0403 13, 14, 15, 1, 12, 1, 12, 12, 12, 12, 0404 0405 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0406 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0407 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 0408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0415 0416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0421 1, 1, 1, 1, 1 0422 } ; 0423 0424 static yyconst YY_CHAR yy_meta[16] = 0425 { 0, 0426 1, 1, 2, 3, 4, 3, 1, 3, 5, 6, 0427 1, 6, 1, 1, 7 0428 } ; 0429 0430 static yyconst flex_uint16_t yy_base[95] = 0431 { 0, 0432 0, 0, 13, 25, 14, 16, 17, 18, 90, 88, 0433 88, 39, 20, 237, 237, 74, 78, 237, 237, 13, 0434 54, 0, 71, 237, 237, 31, 0, 237, 73, 237, 0435 237, 0, 0, 65, 75, 0, 33, 30, 72, 0, 0436 0, 75, 70, 0, 74, 0, 0, 62, 70, 237, 0437 0, 63, 0, 85, 99, 65, 111, 62, 34, 0, 0438 54, 116, 0, 54, 127, 51, 237, 50, 0, 48, 0439 47, 39, 33, 29, 17, 237, 136, 143, 150, 157, 0440 164, 171, 178, 184, 191, 198, 201, 207, 214, 217, 0441 219, 225, 228, 230 0442 0443 } ; 0444 0445 static yyconst flex_int16_t yy_def[95] = 0446 { 0, 0447 76, 1, 77, 77, 78, 78, 79, 79, 80, 80, 0448 76, 76, 76, 76, 76, 76, 12, 76, 76, 12, 0449 76, 81, 82, 76, 76, 82, 83, 76, 76, 76, 0450 76, 84, 12, 85, 12, 86, 76, 76, 87, 20, 0451 12, 88, 12, 21, 76, 89, 12, 82, 82, 76, 0452 83, 76, 84, 85, 76, 54, 85, 90, 76, 55, 0453 87, 88, 55, 62, 88, 91, 76, 55, 92, 93, 0454 90, 94, 91, 93, 94, 0, 76, 76, 76, 76, 0455 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 0456 76, 76, 76, 76 0457 0458 } ; 0459 0460 static yyconst flex_uint16_t yy_nxt[253] = 0461 { 0, 0462 12, 13, 14, 13, 15, 16, 17, 18, 19, 12, 0463 12, 20, 21, 22, 12, 24, 28, 25, 28, 28, 0464 28, 37, 40, 37, 40, 62, 26, 24, 29, 25, 0465 29, 31, 31, 50, 37, 48, 37, 54, 26, 33, 0466 59, 63, 45, 34, 59, 35, 45, 62, 33, 33, 0467 33, 33, 36, 33, 41, 55, 54, 58, 42, 63, 0468 43, 72, 60, 41, 44, 41, 45, 46, 41, 55, 0469 55, 56, 70, 52, 48, 49, 67, 66, 57, 63, 0470 60, 64, 58, 52, 49, 39, 38, 76, 65, 55, 0471 14, 56, 14, 76, 76, 76, 76, 76, 57, 55, 0472 0473 76, 76, 76, 34, 76, 68, 76, 76, 55, 55, 0474 55, 55, 69, 55, 54, 76, 54, 76, 54, 54, 0475 63, 76, 64, 76, 76, 76, 76, 76, 76, 65, 0476 62, 76, 62, 76, 62, 62, 23, 23, 23, 23, 0477 23, 23, 23, 27, 27, 27, 27, 27, 27, 27, 0478 30, 30, 30, 30, 30, 30, 30, 32, 32, 32, 0479 32, 32, 32, 32, 47, 76, 47, 47, 47, 47, 0480 47, 48, 76, 48, 76, 48, 48, 48, 51, 76, 0481 51, 51, 51, 51, 53, 76, 53, 53, 53, 53, 0482 53, 54, 76, 76, 54, 76, 54, 54, 33, 76, 0483 0484 33, 33, 33, 33, 33, 61, 61, 62, 76, 76, 0485 62, 76, 62, 62, 41, 76, 41, 41, 41, 41, 0486 41, 71, 71, 73, 73, 55, 76, 55, 55, 55, 0487 55, 55, 74, 74, 75, 75, 11, 76, 76, 76, 0488 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 0489 76, 76 0490 } ; 0491 0492 static yyconst flex_int16_t yy_chk[253] = 0493 { 0, 0494 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0495 1, 1, 1, 1, 1, 3, 5, 3, 6, 7, 0496 8, 13, 20, 13, 20, 75, 3, 4, 5, 4, 0497 6, 7, 8, 26, 37, 26, 37, 74, 4, 12, 0498 38, 73, 38, 12, 59, 12, 59, 72, 12, 12, 0499 12, 12, 12, 12, 21, 71, 70, 68, 21, 66, 0500 21, 64, 61, 21, 21, 21, 21, 21, 21, 34, 0501 58, 34, 56, 52, 49, 48, 45, 43, 34, 42, 0502 39, 42, 35, 29, 23, 17, 16, 11, 42, 54, 0503 10, 54, 9, 0, 0, 0, 0, 0, 54, 55, 0504 0505 0, 0, 0, 55, 0, 55, 0, 0, 55, 55, 0506 55, 55, 55, 55, 57, 0, 57, 0, 57, 57, 0507 62, 0, 62, 0, 0, 0, 0, 0, 0, 62, 0508 65, 0, 65, 0, 65, 65, 77, 77, 77, 77, 0509 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 0510 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 0511 80, 80, 80, 80, 81, 0, 81, 81, 81, 81, 0512 81, 82, 0, 82, 0, 82, 82, 82, 83, 0, 0513 83, 83, 83, 83, 84, 0, 84, 84, 84, 84, 0514 84, 85, 0, 0, 85, 0, 85, 85, 86, 0, 0515 0516 86, 86, 86, 86, 86, 87, 87, 88, 0, 0, 0517 88, 0, 88, 88, 89, 0, 89, 89, 89, 89, 0518 89, 90, 90, 91, 91, 92, 0, 92, 92, 92, 0519 92, 92, 93, 93, 94, 94, 76, 76, 76, 76, 0520 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 0521 76, 76 0522 } ; 0523 0524 /* Table of booleans, true if rule could match eol. */ 0525 static yyconst flex_int32_t yy_rule_can_match_eol[25] = 0526 { 0, 0527 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0528 0, 0, 0, 0, 0, }; 0529 0530 /* The intent behind this definition is that it'll catch 0531 * any uses of REJECT which flex missed. 0532 */ 0533 #define REJECT reject_used_but_not_detected 0534 #define yymore() yymore_used_but_not_detected 0535 #define YY_MORE_ADJ 0 0536 #define YY_RESTORE_YY_MORE_OFFSET 0537 #line 1 "cmListFileLexer.in.l" 0538 #line 2 "cmListFileLexer.in.l" 0539 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying 0540 file Copyright.txt or https://cmake.org/licensing for details. */ 0541 /* 0542 0543 This file must be translated to C and modified to build everywhere. 0544 0545 Run flex >= 2.6 like this: 0546 0547 flex --nounistd -DFLEXINT_H --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l 0548 0549 Modify cmListFileLexer.c: 0550 - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c 0551 - remove blank lines at end of file 0552 - #include "cmStandardLexer.h" at the top 0553 - add cast in cmListFileLexer_yy_scan_bytes for loop condition of _yybytes_len to size_t 0554 - change type of variable yyl under yy_find_action from yy_size_t to int 0555 0556 */ 0557 0558 /* IWYU pragma: no_forward_declare yyguts_t */ 0559 0560 #ifdef _WIN32 0561 #define KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP 0562 #include "EncodingC.c" 0563 #define cmsysEncoding_DupToWide kwsysEncoding_DupToWide 0564 #endif 0565 0566 /* Setup the proper cmListFileLexer_yylex declaration. */ 0567 #define YY_EXTRA_TYPE cmListFileLexer* 0568 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer) 0569 0570 #include "cmListFileLexer.h" 0571 0572 /*--------------------------------------------------------------------------*/ 0573 struct cmListFileLexer_s 0574 { 0575 cmListFileLexer_Token token; 0576 int bracket; 0577 int comment; 0578 int line; 0579 int column; 0580 int size; 0581 FILE* file; 0582 size_t cr; 0583 char* string_buffer; 0584 char* string_position; 0585 int string_left; 0586 yyscan_t scanner; 0587 }; 0588 0589 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text, 0590 int length); 0591 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text, 0592 int length); 0593 static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer, 0594 size_t bufferSize); 0595 static void cmListFileLexerInit(cmListFileLexer* lexer); 0596 static void cmListFileLexerDestroy(cmListFileLexer* lexer); 0597 0598 /* Replace the lexer input function. */ 0599 #undef YY_INPUT 0600 #define YY_INPUT(buf, result, max_size) \ 0601 { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } 0602 0603 /*--------------------------------------------------------------------------*/ 0604 0605 0606 0607 0608 #line 606 "cmListFileLexer.c" 0609 0610 #define INITIAL 0 0611 #define STRING 1 0612 #define BRACKET 2 0613 #define BRACKETEND 3 0614 #define COMMENT 4 0615 0616 #ifndef YY_EXTRA_TYPE 0617 #define YY_EXTRA_TYPE void * 0618 #endif 0619 0620 /* Holds the entire state of the reentrant scanner. */ 0621 struct yyguts_t 0622 { 0623 0624 /* User-defined. Not touched by flex. */ 0625 YY_EXTRA_TYPE yyextra_r; 0626 0627 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 0628 FILE *yyin_r, *yyout_r; 0629 size_t yy_buffer_stack_top; /**< index of top of stack. */ 0630 size_t yy_buffer_stack_max; /**< capacity of stack. */ 0631 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 0632 char yy_hold_char; 0633 int yy_n_chars; 0634 int yyleng_r; 0635 char *yy_c_buf_p; 0636 int yy_init; 0637 int yy_start; 0638 int yy_did_buffer_switch_on_eof; 0639 int yy_start_stack_ptr; 0640 int yy_start_stack_depth; 0641 int *yy_start_stack; 0642 yy_state_type yy_last_accepting_state; 0643 char* yy_last_accepting_cpos; 0644 0645 int yylineno_r; 0646 int yy_flex_debug_r; 0647 0648 char *yytext_r; 0649 int yy_more_flag; 0650 int yy_more_len; 0651 0652 }; /* end struct yyguts_t */ 0653 0654 static int yy_init_globals (yyscan_t yyscanner ); 0655 0656 int cmListFileLexer_yylex_init (yyscan_t* scanner); 0657 0658 int cmListFileLexer_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 0659 0660 /* Accessor methods to globals. 0661 These are made visible to non-reentrant scanners for convenience. */ 0662 0663 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner ); 0664 0665 int cmListFileLexer_yyget_debug (yyscan_t yyscanner ); 0666 0667 void cmListFileLexer_yyset_debug (int debug_flag ,yyscan_t yyscanner ); 0668 0669 YY_EXTRA_TYPE cmListFileLexer_yyget_extra (yyscan_t yyscanner ); 0670 0671 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 0672 0673 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner ); 0674 0675 void cmListFileLexer_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); 0676 0677 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner ); 0678 0679 void cmListFileLexer_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); 0680 0681 int cmListFileLexer_yyget_leng (yyscan_t yyscanner ); 0682 0683 char *cmListFileLexer_yyget_text (yyscan_t yyscanner ); 0684 0685 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner ); 0686 0687 void cmListFileLexer_yyset_lineno (int _line_number ,yyscan_t yyscanner ); 0688 0689 int cmListFileLexer_yyget_column (yyscan_t yyscanner ); 0690 0691 void cmListFileLexer_yyset_column (int _column_no ,yyscan_t yyscanner ); 0692 0693 /* Macros after this point can all be overridden by user definitions in 0694 * section 1. 0695 */ 0696 0697 #ifndef YY_SKIP_YYWRAP 0698 #ifdef __cplusplus 0699 extern "C" int cmListFileLexer_yywrap (yyscan_t yyscanner ); 0700 #else 0701 extern int cmListFileLexer_yywrap (yyscan_t yyscanner ); 0702 #endif 0703 #endif 0704 0705 #ifndef YY_NO_UNPUT 0706 0707 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); 0708 0709 #endif 0710 0711 #ifndef yytext_ptr 0712 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 0713 #endif 0714 0715 #ifdef YY_NEED_STRLEN 0716 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 0717 #endif 0718 0719 #ifndef YY_NO_INPUT 0720 0721 #ifdef __cplusplus 0722 static int yyinput (yyscan_t yyscanner ); 0723 #else 0724 static int input (yyscan_t yyscanner ); 0725 #endif 0726 0727 #endif 0728 0729 /* Amount of stuff to slurp up with each read. */ 0730 #ifndef YY_READ_BUF_SIZE 0731 #ifdef __ia64__ 0732 /* On IA-64, the buffer size is 16k, not 8k */ 0733 #define YY_READ_BUF_SIZE 16384 0734 #else 0735 #define YY_READ_BUF_SIZE 8192 0736 #endif /* __ia64__ */ 0737 #endif 0738 0739 /* Copy whatever the last rule matched to the standard output. */ 0740 #ifndef ECHO 0741 /* This used to be an fputs(), but since the string might contain NUL's, 0742 * we now use fwrite(). 0743 */ 0744 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) 0745 #endif 0746 0747 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 0748 * is returned in "result". 0749 */ 0750 #ifndef YY_INPUT 0751 #define YY_INPUT(buf,result,max_size) \ 0752 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 0753 { \ 0754 int c = '*'; \ 0755 size_t n; \ 0756 for ( n = 0; n < max_size && \ 0757 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 0758 buf[n] = (char) c; \ 0759 if ( c == '\n' ) \ 0760 buf[n++] = (char) c; \ 0761 if ( c == EOF && ferror( yyin ) ) \ 0762 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 0763 result = n; \ 0764 } \ 0765 else \ 0766 { \ 0767 errno=0; \ 0768 while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 0769 { \ 0770 if( errno != EINTR) \ 0771 { \ 0772 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 0773 break; \ 0774 } \ 0775 errno=0; \ 0776 clearerr(yyin); \ 0777 } \ 0778 }\ 0779 \ 0780 0781 #endif 0782 0783 /* No semi-colon after return; correct usage is to write "yyterminate();" - 0784 * we don't want an extra ';' after the "return" because that will cause 0785 * some compilers to complain about unreachable statements. 0786 */ 0787 #ifndef yyterminate 0788 #define yyterminate() return YY_NULL 0789 #endif 0790 0791 /* Number of entries by which start-condition stack grows. */ 0792 #ifndef YY_START_STACK_INCR 0793 #define YY_START_STACK_INCR 25 0794 #endif 0795 0796 /* Report a fatal error. */ 0797 #ifndef YY_FATAL_ERROR 0798 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 0799 #endif 0800 0801 /* end tables serialization structures and prototypes */ 0802 0803 /* Default declaration of generated scanner - a define so the user can 0804 * easily add parameters. 0805 */ 0806 #ifndef YY_DECL 0807 #define YY_DECL_IS_OURS 1 0808 0809 extern int cmListFileLexer_yylex (yyscan_t yyscanner); 0810 0811 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner) 0812 #endif /* !YY_DECL */ 0813 0814 /* Code executed at the beginning of each rule, after yytext and yyleng 0815 * have been set up. 0816 */ 0817 #ifndef YY_USER_ACTION 0818 #define YY_USER_ACTION 0819 #endif 0820 0821 /* Code executed at the end of each rule. */ 0822 #ifndef YY_BREAK 0823 #define YY_BREAK /*LINTED*/break; 0824 #endif 0825 0826 #define YY_RULE_SETUP \ 0827 YY_USER_ACTION 0828 0829 /** The main scanner function which does all the work. 0830 */ 0831 YY_DECL 0832 { 0833 yy_state_type yy_current_state; 0834 char *yy_cp, *yy_bp; 0835 int yy_act; 0836 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 0837 0838 if ( !yyg->yy_init ) 0839 { 0840 yyg->yy_init = 1; 0841 0842 #ifdef YY_USER_INIT 0843 YY_USER_INIT; 0844 #endif 0845 0846 if ( ! yyg->yy_start ) 0847 yyg->yy_start = 1; /* first start state */ 0848 0849 if ( ! yyin ) 0850 yyin = stdin; 0851 0852 if ( ! yyout ) 0853 yyout = stdout; 0854 0855 if ( ! YY_CURRENT_BUFFER ) { 0856 cmListFileLexer_yyensure_buffer_stack (yyscanner); 0857 YY_CURRENT_BUFFER_LVALUE = 0858 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 0859 } 0860 0861 cmListFileLexer_yy_load_buffer_state(yyscanner ); 0862 } 0863 0864 { 0865 #line 80 "cmListFileLexer.in.l" 0866 0867 0868 #line 866 "cmListFileLexer.c" 0869 0870 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ 0871 { 0872 yy_cp = yyg->yy_c_buf_p; 0873 0874 /* Support of yytext. */ 0875 *yy_cp = yyg->yy_hold_char; 0876 0877 /* yy_bp points to the position in yy_ch_buf of the start of 0878 * the current run. 0879 */ 0880 yy_bp = yy_cp; 0881 0882 yy_current_state = yyg->yy_start; 0883 yy_match: 0884 do 0885 { 0886 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; 0887 if ( yy_accept[yy_current_state] ) 0888 { 0889 yyg->yy_last_accepting_state = yy_current_state; 0890 yyg->yy_last_accepting_cpos = yy_cp; 0891 } 0892 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 0893 { 0894 yy_current_state = (int) yy_def[yy_current_state]; 0895 if ( yy_current_state >= 77 ) 0896 yy_c = yy_meta[(unsigned int) yy_c]; 0897 } 0898 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; 0899 ++yy_cp; 0900 } 0901 while ( yy_base[yy_current_state] != 237 ); 0902 0903 yy_find_action: 0904 yy_act = yy_accept[yy_current_state]; 0905 if ( yy_act == 0 ) 0906 { /* have to back up */ 0907 yy_cp = yyg->yy_last_accepting_cpos; 0908 yy_current_state = yyg->yy_last_accepting_state; 0909 yy_act = yy_accept[yy_current_state]; 0910 } 0911 0912 YY_DO_BEFORE_ACTION; 0913 0914 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 0915 { 0916 int yyl; 0917 for ( yyl = 0; yyl < yyleng; ++yyl ) 0918 if ( yytext[yyl] == '\n' ) 0919 0920 do{ yylineno++; 0921 yycolumn=0; 0922 }while(0) 0923 ; 0924 } 0925 0926 do_action: /* This label is used only to access EOF actions. */ 0927 0928 switch ( yy_act ) 0929 { /* beginning of action switch */ 0930 case 0: /* must back up */ 0931 /* undo the effects of YY_DO_BEFORE_ACTION */ 0932 *yy_cp = yyg->yy_hold_char; 0933 yy_cp = yyg->yy_last_accepting_cpos; 0934 yy_current_state = yyg->yy_last_accepting_state; 0935 goto yy_find_action; 0936 0937 case 1: 0938 /* rule 1 can match eol */ 0939 YY_RULE_SETUP 0940 #line 82 "cmListFileLexer.in.l" 0941 { 0942 lexer->token.type = cmListFileLexer_Token_Newline; 0943 cmListFileLexerSetToken(lexer, yytext, yyleng); 0944 ++lexer->line; 0945 lexer->column = 1; 0946 BEGIN(INITIAL); 0947 return 1; 0948 } 0949 YY_BREAK 0950 case 2: 0951 /* rule 2 can match eol */ 0952 YY_RULE_SETUP 0953 #line 91 "cmListFileLexer.in.l" 0954 { 0955 const char* bracket = yytext; 0956 lexer->comment = yytext[0] == '#'; 0957 if (lexer->comment) { 0958 lexer->token.type = cmListFileLexer_Token_CommentBracket; 0959 bracket += 1; 0960 } else { 0961 lexer->token.type = cmListFileLexer_Token_ArgumentBracket; 0962 } 0963 cmListFileLexerSetToken(lexer, "", 0); 0964 lexer->bracket = strchr(bracket+1, '[') - bracket; 0965 if (yytext[yyleng-1] == '\n') { 0966 ++lexer->line; 0967 lexer->column = 1; 0968 } else { 0969 lexer->column += yyleng; 0970 } 0971 BEGIN(BRACKET); 0972 } 0973 YY_BREAK 0974 case 3: 0975 YY_RULE_SETUP 0976 #line 111 "cmListFileLexer.in.l" 0977 { 0978 lexer->column += yyleng; 0979 BEGIN(COMMENT); 0980 } 0981 YY_BREAK 0982 case 4: 0983 YY_RULE_SETUP 0984 #line 116 "cmListFileLexer.in.l" 0985 { 0986 lexer->column += yyleng; 0987 } 0988 YY_BREAK 0989 case 5: 0990 YY_RULE_SETUP 0991 #line 120 "cmListFileLexer.in.l" 0992 { 0993 lexer->token.type = cmListFileLexer_Token_ParenLeft; 0994 cmListFileLexerSetToken(lexer, yytext, yyleng); 0995 lexer->column += yyleng; 0996 return 1; 0997 } 0998 YY_BREAK 0999 case 6: 1000 YY_RULE_SETUP 1001 #line 127 "cmListFileLexer.in.l" 1002 { 1003 lexer->token.type = cmListFileLexer_Token_ParenRight; 1004 cmListFileLexerSetToken(lexer, yytext, yyleng); 1005 lexer->column += yyleng; 1006 return 1; 1007 } 1008 YY_BREAK 1009 case 7: 1010 YY_RULE_SETUP 1011 #line 134 "cmListFileLexer.in.l" 1012 { 1013 lexer->token.type = cmListFileLexer_Token_Identifier; 1014 cmListFileLexerSetToken(lexer, yytext, yyleng); 1015 lexer->column += yyleng; 1016 return 1; 1017 } 1018 YY_BREAK 1019 case 8: 1020 YY_RULE_SETUP 1021 #line 141 "cmListFileLexer.in.l" 1022 { 1023 /* Handle ]]====]=======]*/ 1024 cmListFileLexerAppend(lexer, yytext, yyleng); 1025 lexer->column += yyleng; 1026 if (yyleng == lexer->bracket) { 1027 BEGIN(BRACKETEND); 1028 } 1029 } 1030 YY_BREAK 1031 case 9: 1032 YY_RULE_SETUP 1033 #line 150 "cmListFileLexer.in.l" 1034 { 1035 lexer->column += yyleng; 1036 /* Erase the partial bracket from the token. */ 1037 lexer->token.length -= lexer->bracket; 1038 lexer->token.text[lexer->token.length] = 0; 1039 BEGIN(INITIAL); 1040 return 1; 1041 } 1042 YY_BREAK 1043 case 10: 1044 YY_RULE_SETUP 1045 #line 159 "cmListFileLexer.in.l" 1046 { 1047 cmListFileLexerAppend(lexer, yytext, yyleng); 1048 lexer->column += yyleng; 1049 } 1050 YY_BREAK 1051 case 11: 1052 /* rule 11 can match eol */ 1053 YY_RULE_SETUP 1054 #line 164 "cmListFileLexer.in.l" 1055 { 1056 cmListFileLexerAppend(lexer, yytext, yyleng); 1057 ++lexer->line; 1058 lexer->column = 1; 1059 BEGIN(BRACKET); 1060 } 1061 YY_BREAK 1062 case 12: 1063 YY_RULE_SETUP 1064 #line 171 "cmListFileLexer.in.l" 1065 { 1066 cmListFileLexerAppend(lexer, yytext, yyleng); 1067 lexer->column += yyleng; 1068 BEGIN(BRACKET); 1069 } 1070 YY_BREAK 1071 case YY_STATE_EOF(BRACKET): 1072 case YY_STATE_EOF(BRACKETEND): 1073 #line 177 "cmListFileLexer.in.l" 1074 { 1075 lexer->token.type = cmListFileLexer_Token_BadBracket; 1076 BEGIN(INITIAL); 1077 return 1; 1078 } 1079 YY_BREAK 1080 case 13: 1081 YY_RULE_SETUP 1082 #line 183 "cmListFileLexer.in.l" 1083 { 1084 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted; 1085 cmListFileLexerSetToken(lexer, yytext, yyleng); 1086 lexer->column += yyleng; 1087 return 1; 1088 } 1089 YY_BREAK 1090 case 14: 1091 YY_RULE_SETUP 1092 #line 190 "cmListFileLexer.in.l" 1093 { 1094 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted; 1095 cmListFileLexerSetToken(lexer, yytext, yyleng); 1096 lexer->column += yyleng; 1097 return 1; 1098 } 1099 YY_BREAK 1100 case 15: 1101 YY_RULE_SETUP 1102 #line 197 "cmListFileLexer.in.l" 1103 { 1104 lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted; 1105 cmListFileLexerSetToken(lexer, yytext, yyleng); 1106 lexer->column += yyleng; 1107 return 1; 1108 } 1109 YY_BREAK 1110 case 16: 1111 YY_RULE_SETUP 1112 #line 204 "cmListFileLexer.in.l" 1113 { 1114 lexer->token.type = cmListFileLexer_Token_ArgumentQuoted; 1115 cmListFileLexerSetToken(lexer, "", 0); 1116 lexer->column += yyleng; 1117 BEGIN(STRING); 1118 } 1119 YY_BREAK 1120 case 17: 1121 YY_RULE_SETUP 1122 #line 211 "cmListFileLexer.in.l" 1123 { 1124 cmListFileLexerAppend(lexer, yytext, yyleng); 1125 lexer->column += yyleng; 1126 } 1127 YY_BREAK 1128 case 18: 1129 /* rule 18 can match eol */ 1130 YY_RULE_SETUP 1131 #line 216 "cmListFileLexer.in.l" 1132 { 1133 /* Continuation: text is not part of string */ 1134 ++lexer->line; 1135 lexer->column = 1; 1136 } 1137 YY_BREAK 1138 case 19: 1139 /* rule 19 can match eol */ 1140 YY_RULE_SETUP 1141 #line 222 "cmListFileLexer.in.l" 1142 { 1143 cmListFileLexerAppend(lexer, yytext, yyleng); 1144 ++lexer->line; 1145 lexer->column = 1; 1146 } 1147 YY_BREAK 1148 case 20: 1149 YY_RULE_SETUP 1150 #line 228 "cmListFileLexer.in.l" 1151 { 1152 lexer->column += yyleng; 1153 BEGIN(INITIAL); 1154 return 1; 1155 } 1156 YY_BREAK 1157 case 21: 1158 YY_RULE_SETUP 1159 #line 234 "cmListFileLexer.in.l" 1160 { 1161 cmListFileLexerAppend(lexer, yytext, yyleng); 1162 lexer->column += yyleng; 1163 } 1164 YY_BREAK 1165 case YY_STATE_EOF(STRING): 1166 #line 239 "cmListFileLexer.in.l" 1167 { 1168 lexer->token.type = cmListFileLexer_Token_BadString; 1169 BEGIN(INITIAL); 1170 return 1; 1171 } 1172 YY_BREAK 1173 case 22: 1174 YY_RULE_SETUP 1175 #line 245 "cmListFileLexer.in.l" 1176 { 1177 lexer->token.type = cmListFileLexer_Token_Space; 1178 cmListFileLexerSetToken(lexer, yytext, yyleng); 1179 lexer->column += yyleng; 1180 return 1; 1181 } 1182 YY_BREAK 1183 case 23: 1184 YY_RULE_SETUP 1185 #line 252 "cmListFileLexer.in.l" 1186 { 1187 lexer->token.type = cmListFileLexer_Token_BadCharacter; 1188 cmListFileLexerSetToken(lexer, yytext, yyleng); 1189 lexer->column += yyleng; 1190 return 1; 1191 } 1192 YY_BREAK 1193 case YY_STATE_EOF(INITIAL): 1194 case YY_STATE_EOF(COMMENT): 1195 #line 259 "cmListFileLexer.in.l" 1196 { 1197 lexer->token.type = cmListFileLexer_Token_None; 1198 cmListFileLexerSetToken(lexer, 0, 0); 1199 return 0; 1200 } 1201 YY_BREAK 1202 case 24: 1203 YY_RULE_SETUP 1204 #line 265 "cmListFileLexer.in.l" 1205 ECHO; 1206 YY_BREAK 1207 #line 1205 "cmListFileLexer.c" 1208 1209 case YY_END_OF_BUFFER: 1210 { 1211 /* Amount of text matched not including the EOB char. */ 1212 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1213 1214 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1215 *yy_cp = yyg->yy_hold_char; 1216 YY_RESTORE_YY_MORE_OFFSET 1217 1218 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1219 { 1220 /* We're scanning a new file or input source. It's 1221 * possible that this happened because the user 1222 * just pointed yyin at a new source and called 1223 * cmListFileLexer_yylex(). If so, then we have to assure 1224 * consistency between YY_CURRENT_BUFFER and our 1225 * globals. Here is the right place to do so, because 1226 * this is the first action (other than possibly a 1227 * back-up) that will match for the new input source. 1228 */ 1229 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1230 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1231 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1232 } 1233 1234 /* Note that here we test for yy_c_buf_p "<=" to the position 1235 * of the first EOB in the buffer, since yy_c_buf_p will 1236 * already have been incremented past the NUL character 1237 * (since all states make transitions on EOB to the 1238 * end-of-buffer state). Contrast this with the test 1239 * in input(). 1240 */ 1241 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1242 { /* This was really a NUL. */ 1243 yy_state_type yy_next_state; 1244 1245 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1246 1247 yy_current_state = yy_get_previous_state( yyscanner ); 1248 1249 /* Okay, we're now positioned to make the NUL 1250 * transition. We couldn't have 1251 * yy_get_previous_state() go ahead and do it 1252 * for us because it doesn't know how to deal 1253 * with the possibility of jamming (and we don't 1254 * want to build jamming into it because then it 1255 * will run more slowly). 1256 */ 1257 1258 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1259 1260 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1261 1262 if ( yy_next_state ) 1263 { 1264 /* Consume the NUL. */ 1265 yy_cp = ++yyg->yy_c_buf_p; 1266 yy_current_state = yy_next_state; 1267 goto yy_match; 1268 } 1269 1270 else 1271 { 1272 yy_cp = yyg->yy_c_buf_p; 1273 goto yy_find_action; 1274 } 1275 } 1276 1277 else switch ( yy_get_next_buffer( yyscanner ) ) 1278 { 1279 case EOB_ACT_END_OF_FILE: 1280 { 1281 yyg->yy_did_buffer_switch_on_eof = 0; 1282 1283 if ( cmListFileLexer_yywrap(yyscanner ) ) 1284 { 1285 /* Note: because we've taken care in 1286 * yy_get_next_buffer() to have set up 1287 * yytext, we can now set up 1288 * yy_c_buf_p so that if some total 1289 * hoser (like flex itself) wants to 1290 * call the scanner after we return the 1291 * YY_NULL, it'll still work - another 1292 * YY_NULL will get returned. 1293 */ 1294 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1295 1296 yy_act = YY_STATE_EOF(YY_START); 1297 goto do_action; 1298 } 1299 1300 else 1301 { 1302 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1303 YY_NEW_FILE; 1304 } 1305 break; 1306 } 1307 1308 case EOB_ACT_CONTINUE_SCAN: 1309 yyg->yy_c_buf_p = 1310 yyg->yytext_ptr + yy_amount_of_matched_text; 1311 1312 yy_current_state = yy_get_previous_state( yyscanner ); 1313 1314 yy_cp = yyg->yy_c_buf_p; 1315 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1316 goto yy_match; 1317 1318 case EOB_ACT_LAST_MATCH: 1319 yyg->yy_c_buf_p = 1320 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1321 1322 yy_current_state = yy_get_previous_state( yyscanner ); 1323 1324 yy_cp = yyg->yy_c_buf_p; 1325 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1326 goto yy_find_action; 1327 } 1328 break; 1329 } 1330 1331 default: 1332 YY_FATAL_ERROR( 1333 "fatal flex scanner internal error--no action found" ); 1334 } /* end of action switch */ 1335 } /* end of scanning one token */ 1336 } /* end of user's declarations */ 1337 } /* end of cmListFileLexer_yylex */ 1338 1339 /* yy_get_next_buffer - try to read in a new buffer 1340 * 1341 * Returns a code representing an action: 1342 * EOB_ACT_LAST_MATCH - 1343 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1344 * EOB_ACT_END_OF_FILE - end of file 1345 */ 1346 static int yy_get_next_buffer (yyscan_t yyscanner) 1347 { 1348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1349 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1350 char *source = yyg->yytext_ptr; 1351 yy_size_t number_to_move, i; 1352 int ret_val; 1353 1354 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1355 YY_FATAL_ERROR( 1356 "fatal flex scanner internal error--end of buffer missed" ); 1357 1358 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1359 { /* Don't try to fill the buffer, so this is an EOF. */ 1360 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1361 { 1362 /* We matched a single character, the EOB, so 1363 * treat this as a final EOF. 1364 */ 1365 return EOB_ACT_END_OF_FILE; 1366 } 1367 1368 else 1369 { 1370 /* We matched some text prior to the EOB, first 1371 * process it. 1372 */ 1373 return EOB_ACT_LAST_MATCH; 1374 } 1375 } 1376 1377 /* Try to read more data. */ 1378 1379 /* First move last chars to start of buffer. */ 1380 number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1381 1382 for ( i = 0; i < number_to_move; ++i ) 1383 *(dest++) = *(source++); 1384 1385 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1386 /* don't do the read, it's not guaranteed to return an EOF, 1387 * just force an EOF 1388 */ 1389 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1390 1391 else 1392 { 1393 int num_to_read = 1394 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1395 1396 while ( num_to_read <= 0 ) 1397 { /* Not enough room in the buffer - grow it. */ 1398 1399 /* just a shorter name for the current buffer */ 1400 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 1401 1402 int yy_c_buf_p_offset = 1403 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1404 1405 if ( b->yy_is_our_buffer ) 1406 { 1407 int new_size = b->yy_buf_size * 2; 1408 1409 if ( new_size <= 0 ) 1410 b->yy_buf_size += b->yy_buf_size / 8; 1411 else 1412 b->yy_buf_size *= 2; 1413 1414 b->yy_ch_buf = (char *) 1415 /* Include room in for 2 EOB chars. */ 1416 cmListFileLexer_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1417 } 1418 else 1419 /* Can't grow it, we don't own it. */ 1420 b->yy_ch_buf = NULL; 1421 1422 if ( ! b->yy_ch_buf ) 1423 YY_FATAL_ERROR( 1424 "fatal error - scanner input buffer overflow" ); 1425 1426 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1427 1428 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1429 number_to_move - 1; 1430 1431 } 1432 1433 if ( num_to_read > YY_READ_BUF_SIZE ) 1434 num_to_read = YY_READ_BUF_SIZE; 1435 1436 /* Read in more data. */ 1437 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1438 yyg->yy_n_chars, num_to_read ); 1439 1440 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1441 } 1442 1443 if ( yyg->yy_n_chars == 0 ) 1444 { 1445 if ( number_to_move == YY_MORE_ADJ ) 1446 { 1447 ret_val = EOB_ACT_END_OF_FILE; 1448 cmListFileLexer_yyrestart(yyin ,yyscanner); 1449 } 1450 1451 else 1452 { 1453 ret_val = EOB_ACT_LAST_MATCH; 1454 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1455 YY_BUFFER_EOF_PENDING; 1456 } 1457 } 1458 1459 else 1460 ret_val = EOB_ACT_CONTINUE_SCAN; 1461 1462 if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1463 /* Extend the array by 50%, plus the number we really need. */ 1464 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1465 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1466 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1467 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1468 } 1469 1470 yyg->yy_n_chars += number_to_move; 1471 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1472 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1473 1474 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1475 1476 return ret_val; 1477 } 1478 1479 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1480 1481 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1482 { 1483 yy_state_type yy_current_state; 1484 char *yy_cp; 1485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1486 1487 yy_current_state = yyg->yy_start; 1488 1489 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 1490 { 1491 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1492 if ( yy_accept[yy_current_state] ) 1493 { 1494 yyg->yy_last_accepting_state = yy_current_state; 1495 yyg->yy_last_accepting_cpos = yy_cp; 1496 } 1497 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1498 { 1499 yy_current_state = (int) yy_def[yy_current_state]; 1500 if ( yy_current_state >= 77 ) 1501 yy_c = yy_meta[(unsigned int) yy_c]; 1502 } 1503 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; 1504 } 1505 1506 return yy_current_state; 1507 } 1508 1509 /* yy_try_NUL_trans - try to make a transition on the NUL character 1510 * 1511 * synopsis 1512 * next_state = yy_try_NUL_trans( current_state ); 1513 */ 1514 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 1515 { 1516 int yy_is_jam; 1517 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 1518 char *yy_cp = yyg->yy_c_buf_p; 1519 1520 YY_CHAR yy_c = 1; 1521 if ( yy_accept[yy_current_state] ) 1522 { 1523 yyg->yy_last_accepting_state = yy_current_state; 1524 yyg->yy_last_accepting_cpos = yy_cp; 1525 } 1526 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1527 { 1528 yy_current_state = (int) yy_def[yy_current_state]; 1529 if ( yy_current_state >= 77 ) 1530 yy_c = yy_meta[(unsigned int) yy_c]; 1531 } 1532 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; 1533 yy_is_jam = (yy_current_state == 76); 1534 1535 (void)yyg; 1536 return yy_is_jam ? 0 : yy_current_state; 1537 } 1538 1539 #ifndef YY_NO_UNPUT 1540 1541 static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) 1542 { 1543 char *yy_cp; 1544 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1545 1546 yy_cp = yyg->yy_c_buf_p; 1547 1548 /* undo effects of setting up yytext */ 1549 *yy_cp = yyg->yy_hold_char; 1550 1551 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1552 { /* need to shift things up to make room */ 1553 /* +2 for EOB chars. */ 1554 int number_to_move = yyg->yy_n_chars + 2; 1555 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1556 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1557 char *source = 1558 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1559 1560 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1561 *--dest = *--source; 1562 1563 yy_cp += (int) (dest - source); 1564 yy_bp += (int) (dest - source); 1565 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1566 yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1567 1568 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1569 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1570 } 1571 1572 *--yy_cp = (char) c; 1573 1574 if ( c == '\n' ){ 1575 --yylineno; 1576 } 1577 1578 yyg->yytext_ptr = yy_bp; 1579 yyg->yy_hold_char = *yy_cp; 1580 yyg->yy_c_buf_p = yy_cp; 1581 } 1582 1583 #endif 1584 1585 #ifndef YY_NO_INPUT 1586 #ifdef __cplusplus 1587 static int yyinput (yyscan_t yyscanner) 1588 #else 1589 static int input (yyscan_t yyscanner) 1590 #endif 1591 1592 { 1593 int c; 1594 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1595 1596 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1597 1598 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 1599 { 1600 /* yy_c_buf_p now points to the character we want to return. 1601 * If this occurs *before* the EOB characters, then it's a 1602 * valid NUL; if not, then we've hit the end of the buffer. 1603 */ 1604 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1605 /* This was really a NUL. */ 1606 *yyg->yy_c_buf_p = '\0'; 1607 1608 else 1609 { /* need more input */ 1610 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1611 ++yyg->yy_c_buf_p; 1612 1613 switch ( yy_get_next_buffer( yyscanner ) ) 1614 { 1615 case EOB_ACT_LAST_MATCH: 1616 /* This happens because yy_g_n_b() 1617 * sees that we've accumulated a 1618 * token and flags that we need to 1619 * try matching the token before 1620 * proceeding. But for input(), 1621 * there's no matching to consider. 1622 * So convert the EOB_ACT_LAST_MATCH 1623 * to EOB_ACT_END_OF_FILE. 1624 */ 1625 1626 /* Reset buffer status. */ 1627 cmListFileLexer_yyrestart(yyin ,yyscanner); 1628 1629 /*FALLTHROUGH*/ 1630 1631 case EOB_ACT_END_OF_FILE: 1632 { 1633 if ( cmListFileLexer_yywrap(yyscanner ) ) 1634 return 0; 1635 1636 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1637 YY_NEW_FILE; 1638 #ifdef __cplusplus 1639 return yyinput(yyscanner); 1640 #else 1641 return input(yyscanner); 1642 #endif 1643 } 1644 1645 case EOB_ACT_CONTINUE_SCAN: 1646 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 1647 break; 1648 } 1649 } 1650 } 1651 1652 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 1653 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 1654 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 1655 1656 if ( c == '\n' ) 1657 1658 do{ yylineno++; 1659 yycolumn=0; 1660 }while(0) 1661 ; 1662 1663 return c; 1664 } 1665 #endif /* ifndef YY_NO_INPUT */ 1666 1667 /** Immediately switch to a different input stream. 1668 * @param input_file A readable stream. 1669 * @param yyscanner The scanner object. 1670 * @note This function does not reset the start condition to @c INITIAL . 1671 */ 1672 void cmListFileLexer_yyrestart (FILE * input_file , yyscan_t yyscanner) 1673 { 1674 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1675 1676 if ( ! YY_CURRENT_BUFFER ){ 1677 cmListFileLexer_yyensure_buffer_stack (yyscanner); 1678 YY_CURRENT_BUFFER_LVALUE = 1679 cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1680 } 1681 1682 cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 1683 cmListFileLexer_yy_load_buffer_state(yyscanner ); 1684 } 1685 1686 /** Switch to a different input buffer. 1687 * @param new_buffer The new input buffer. 1688 * @param yyscanner The scanner object. 1689 */ 1690 void cmListFileLexer_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1691 { 1692 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1693 1694 /* TODO. We should be able to replace this entire function body 1695 * with 1696 * cmListFileLexer_yypop_buffer_state(); 1697 * cmListFileLexer_yypush_buffer_state(new_buffer); 1698 */ 1699 cmListFileLexer_yyensure_buffer_stack (yyscanner); 1700 if ( YY_CURRENT_BUFFER == new_buffer ) 1701 return; 1702 1703 if ( YY_CURRENT_BUFFER ) 1704 { 1705 /* Flush out information for old buffer. */ 1706 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1707 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1708 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1709 } 1710 1711 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1712 cmListFileLexer_yy_load_buffer_state(yyscanner ); 1713 1714 /* We don't actually know whether we did this switch during 1715 * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag 1716 * is looked at is after cmListFileLexer_yywrap() is called, so it's safe 1717 * to go ahead and always set it. 1718 */ 1719 yyg->yy_did_buffer_switch_on_eof = 1; 1720 } 1721 1722 static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner) 1723 { 1724 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1725 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1726 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1727 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1728 yyg->yy_hold_char = *yyg->yy_c_buf_p; 1729 } 1730 1731 /** Allocate and initialize an input buffer state. 1732 * @param file A readable stream. 1733 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1734 * @param yyscanner The scanner object. 1735 * @return the allocated buffer state. 1736 */ 1737 YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) 1738 { 1739 YY_BUFFER_STATE b; 1740 1741 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 1742 if ( ! b ) 1743 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" ); 1744 1745 b->yy_buf_size = (yy_size_t)size; 1746 1747 /* yy_ch_buf has to be 2 characters longer than the size given because 1748 * we need to put in 2 end-of-buffer characters. 1749 */ 1750 b->yy_ch_buf = (char *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner ); 1751 if ( ! b->yy_ch_buf ) 1752 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" ); 1753 1754 b->yy_is_our_buffer = 1; 1755 1756 cmListFileLexer_yy_init_buffer(b,file ,yyscanner); 1757 1758 return b; 1759 } 1760 1761 /** Destroy the buffer. 1762 * @param b a buffer created with cmListFileLexer_yy_create_buffer() 1763 * @param yyscanner The scanner object. 1764 */ 1765 void cmListFileLexer_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1766 { 1767 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1768 1769 if ( ! b ) 1770 return; 1771 1772 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1773 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1774 1775 if ( b->yy_is_our_buffer ) 1776 cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner ); 1777 1778 cmListFileLexer_yyfree((void *) b ,yyscanner ); 1779 } 1780 1781 /* Initializes or reinitializes a buffer. 1782 * This function is sometimes called more than once on the same buffer, 1783 * such as during a cmListFileLexer_yyrestart() or at EOF. 1784 */ 1785 static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 1786 1787 { 1788 int oerrno = errno; 1789 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1790 1791 cmListFileLexer_yy_flush_buffer(b ,yyscanner); 1792 1793 b->yy_input_file = file; 1794 b->yy_fill_buffer = 1; 1795 1796 /* If b is the current buffer, then cmListFileLexer_yy_init_buffer was _probably_ 1797 * called from cmListFileLexer_yyrestart() or through yy_get_next_buffer. 1798 * In that case, we don't want to reset the lineno or column. 1799 */ 1800 if (b != YY_CURRENT_BUFFER){ 1801 b->yy_bs_lineno = 1; 1802 b->yy_bs_column = 0; 1803 } 1804 1805 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1806 1807 errno = oerrno; 1808 } 1809 1810 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1811 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1812 * @param yyscanner The scanner object. 1813 */ 1814 void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1815 { 1816 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1817 if ( ! b ) 1818 return; 1819 1820 b->yy_n_chars = 0; 1821 1822 /* We always need two end-of-buffer characters. The first causes 1823 * a transition to the end-of-buffer state. The second causes 1824 * a jam in that state. 1825 */ 1826 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1827 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1828 1829 b->yy_buf_pos = &b->yy_ch_buf[0]; 1830 1831 b->yy_at_bol = 1; 1832 b->yy_buffer_status = YY_BUFFER_NEW; 1833 1834 if ( b == YY_CURRENT_BUFFER ) 1835 cmListFileLexer_yy_load_buffer_state(yyscanner ); 1836 } 1837 1838 /** Pushes the new state onto the stack. The new state becomes 1839 * the current state. This function will allocate the stack 1840 * if necessary. 1841 * @param new_buffer The new state. 1842 * @param yyscanner The scanner object. 1843 */ 1844 void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1845 { 1846 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1847 if (new_buffer == NULL) 1848 return; 1849 1850 cmListFileLexer_yyensure_buffer_stack(yyscanner); 1851 1852 /* This block is copied from cmListFileLexer_yy_switch_to_buffer. */ 1853 if ( YY_CURRENT_BUFFER ) 1854 { 1855 /* Flush out information for old buffer. */ 1856 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1857 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1858 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1859 } 1860 1861 /* Only push if top exists. Otherwise, replace top. */ 1862 if (YY_CURRENT_BUFFER) 1863 yyg->yy_buffer_stack_top++; 1864 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1865 1866 /* copied from cmListFileLexer_yy_switch_to_buffer. */ 1867 cmListFileLexer_yy_load_buffer_state(yyscanner ); 1868 yyg->yy_did_buffer_switch_on_eof = 1; 1869 } 1870 1871 /** Removes and deletes the top of the stack, if present. 1872 * The next element becomes the new top. 1873 * @param yyscanner The scanner object. 1874 */ 1875 void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner) 1876 { 1877 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1878 if (!YY_CURRENT_BUFFER) 1879 return; 1880 1881 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 1882 YY_CURRENT_BUFFER_LVALUE = NULL; 1883 if (yyg->yy_buffer_stack_top > 0) 1884 --yyg->yy_buffer_stack_top; 1885 1886 if (YY_CURRENT_BUFFER) { 1887 cmListFileLexer_yy_load_buffer_state(yyscanner ); 1888 yyg->yy_did_buffer_switch_on_eof = 1; 1889 } 1890 } 1891 1892 /* Allocates the stack if it does not exist. 1893 * Guarantees space for at least one push. 1894 */ 1895 static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner) 1896 { 1897 int num_to_alloc; 1898 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1899 1900 if (!yyg->yy_buffer_stack) { 1901 1902 /* First allocation is just for 2 elements, since we don't know if this 1903 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1904 * immediate realloc on the next call. 1905 */ 1906 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ 1907 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc 1908 (num_to_alloc * sizeof(struct yy_buffer_state*) 1909 , yyscanner); 1910 if ( ! yyg->yy_buffer_stack ) 1911 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" ); 1912 1913 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1914 1915 yyg->yy_buffer_stack_max = num_to_alloc; 1916 yyg->yy_buffer_stack_top = 0; 1917 return; 1918 } 1919 1920 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 1921 1922 /* Increase the buffer to prepare for a possible push. */ 1923 yy_size_t grow_size = 8 /* arbitrary grow size */; 1924 1925 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 1926 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyrealloc 1927 (yyg->yy_buffer_stack, 1928 num_to_alloc * sizeof(struct yy_buffer_state*) 1929 , yyscanner); 1930 if ( ! yyg->yy_buffer_stack ) 1931 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" ); 1932 1933 /* zero only the new slots.*/ 1934 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 1935 yyg->yy_buffer_stack_max = num_to_alloc; 1936 } 1937 } 1938 1939 /** Setup the input buffer state to scan directly from a user-specified character buffer. 1940 * @param base the character buffer 1941 * @param size the size in bytes of the character buffer 1942 * @param yyscanner The scanner object. 1943 * @return the newly allocated buffer state object. 1944 */ 1945 YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 1946 { 1947 YY_BUFFER_STATE b; 1948 1949 if ( size < 2 || 1950 base[size-2] != YY_END_OF_BUFFER_CHAR || 1951 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1952 /* They forgot to leave room for the EOB's. */ 1953 return NULL; 1954 1955 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 1956 if ( ! b ) 1957 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" ); 1958 1959 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1960 b->yy_buf_pos = b->yy_ch_buf = base; 1961 b->yy_is_our_buffer = 0; 1962 b->yy_input_file = NULL; 1963 b->yy_n_chars = b->yy_buf_size; 1964 b->yy_is_interactive = 0; 1965 b->yy_at_bol = 1; 1966 b->yy_fill_buffer = 0; 1967 b->yy_buffer_status = YY_BUFFER_NEW; 1968 1969 cmListFileLexer_yy_switch_to_buffer(b ,yyscanner ); 1970 1971 return b; 1972 } 1973 1974 /** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will 1975 * scan from a @e copy of @a str. 1976 * @param yystr a NUL-terminated string to scan 1977 * @param yyscanner The scanner object. 1978 * @return the newly allocated buffer state object. 1979 * @note If you want to scan bytes that may contain NUL values, then use 1980 * cmListFileLexer_yy_scan_bytes() instead. 1981 */ 1982 YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) 1983 { 1984 1985 return cmListFileLexer_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); 1986 } 1987 1988 /** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will 1989 * scan from a @e copy of @a bytes. 1990 * @param yybytes the byte buffer to scan 1991 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 1992 * @param yyscanner The scanner object. 1993 * @return the newly allocated buffer state object. 1994 */ 1995 YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 1996 { 1997 YY_BUFFER_STATE b; 1998 char *buf; 1999 yy_size_t n; 2000 yy_size_t i; 2001 2002 /* Get memory for full buffer, including space for trailing EOB's. */ 2003 n = (yy_size_t) _yybytes_len + 2; 2004 buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner ); 2005 if ( ! buf ) 2006 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" ); 2007 2008 for ( i = 0; i < (size_t)_yybytes_len; ++i ) 2009 buf[i] = yybytes[i]; 2010 2011 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2012 2013 b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner); 2014 if ( ! b ) 2015 YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" ); 2016 2017 /* It's okay to grow etc. this buffer, and we should throw it 2018 * away when we're done. 2019 */ 2020 b->yy_is_our_buffer = 1; 2021 2022 return b; 2023 } 2024 2025 #ifndef YY_EXIT_FAILURE 2026 #define YY_EXIT_FAILURE 2 2027 #endif 2028 2029 static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2030 { 2031 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2032 (void)yyg; 2033 (void) fprintf( stderr, "%s\n", msg ); 2034 exit( YY_EXIT_FAILURE ); 2035 } 2036 2037 /* Redefine yyless() so it works in section 3 code. */ 2038 2039 #undef yyless 2040 #define yyless(n) \ 2041 do \ 2042 { \ 2043 /* Undo effects of setting up yytext. */ \ 2044 int yyless_macro_arg = (n); \ 2045 YY_LESS_LINENO(yyless_macro_arg);\ 2046 yytext[yyleng] = yyg->yy_hold_char; \ 2047 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2048 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2049 *yyg->yy_c_buf_p = '\0'; \ 2050 yyleng = yyless_macro_arg; \ 2051 } \ 2052 while ( 0 ) 2053 2054 /* Accessor methods (get/set functions) to struct members. */ 2055 2056 /** Get the user-defined data for this scanner. 2057 * @param yyscanner The scanner object. 2058 */ 2059 YY_EXTRA_TYPE cmListFileLexer_yyget_extra (yyscan_t yyscanner) 2060 { 2061 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2062 return yyextra; 2063 } 2064 2065 /** Get the current line number. 2066 * @param yyscanner The scanner object. 2067 */ 2068 int cmListFileLexer_yyget_lineno (yyscan_t yyscanner) 2069 { 2070 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2071 2072 if (! YY_CURRENT_BUFFER) 2073 return 0; 2074 2075 return yylineno; 2076 } 2077 2078 /** Get the current column number. 2079 * @param yyscanner The scanner object. 2080 */ 2081 int cmListFileLexer_yyget_column (yyscan_t yyscanner) 2082 { 2083 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2084 2085 if (! YY_CURRENT_BUFFER) 2086 return 0; 2087 2088 return yycolumn; 2089 } 2090 2091 /** Get the input stream. 2092 * @param yyscanner The scanner object. 2093 */ 2094 FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner) 2095 { 2096 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2097 return yyin; 2098 } 2099 2100 /** Get the output stream. 2101 * @param yyscanner The scanner object. 2102 */ 2103 FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner) 2104 { 2105 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2106 return yyout; 2107 } 2108 2109 /** Get the length of the current token. 2110 * @param yyscanner The scanner object. 2111 */ 2112 int cmListFileLexer_yyget_leng (yyscan_t yyscanner) 2113 { 2114 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2115 return yyleng; 2116 } 2117 2118 /** Get the current token. 2119 * @param yyscanner The scanner object. 2120 */ 2121 2122 char *cmListFileLexer_yyget_text (yyscan_t yyscanner) 2123 { 2124 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2125 return yytext; 2126 } 2127 2128 /** Set the user-defined data. This data is never touched by the scanner. 2129 * @param user_defined The data to be associated with this scanner. 2130 * @param yyscanner The scanner object. 2131 */ 2132 void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2133 { 2134 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2135 yyextra = user_defined ; 2136 } 2137 2138 /** Set the current line number. 2139 * @param _line_number line number 2140 * @param yyscanner The scanner object. 2141 */ 2142 void cmListFileLexer_yyset_lineno (int _line_number , yyscan_t yyscanner) 2143 { 2144 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2145 2146 /* lineno is only valid if an input buffer exists. */ 2147 if (! YY_CURRENT_BUFFER ) 2148 YY_FATAL_ERROR( "cmListFileLexer_yyset_lineno called with no buffer" ); 2149 2150 yylineno = _line_number; 2151 } 2152 2153 /** Set the current column. 2154 * @param _column_no column number 2155 * @param yyscanner The scanner object. 2156 */ 2157 void cmListFileLexer_yyset_column (int _column_no , yyscan_t yyscanner) 2158 { 2159 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2160 2161 /* column is only valid if an input buffer exists. */ 2162 if (! YY_CURRENT_BUFFER ) 2163 YY_FATAL_ERROR( "cmListFileLexer_yyset_column called with no buffer" ); 2164 2165 yycolumn = _column_no; 2166 } 2167 2168 /** Set the input stream. This does not discard the current 2169 * input buffer. 2170 * @param _in_str A readable stream. 2171 * @param yyscanner The scanner object. 2172 * @see cmListFileLexer_yy_switch_to_buffer 2173 */ 2174 void cmListFileLexer_yyset_in (FILE * _in_str , yyscan_t yyscanner) 2175 { 2176 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2177 yyin = _in_str ; 2178 } 2179 2180 void cmListFileLexer_yyset_out (FILE * _out_str , yyscan_t yyscanner) 2181 { 2182 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2183 yyout = _out_str ; 2184 } 2185 2186 int cmListFileLexer_yyget_debug (yyscan_t yyscanner) 2187 { 2188 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2189 return yy_flex_debug; 2190 } 2191 2192 void cmListFileLexer_yyset_debug (int _bdebug , yyscan_t yyscanner) 2193 { 2194 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2195 yy_flex_debug = _bdebug ; 2196 } 2197 2198 /* Accessor methods for yylval and yylloc */ 2199 2200 /* User-visible API */ 2201 2202 /* cmListFileLexer_yylex_init is special because it creates the scanner itself, so it is 2203 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2204 * That's why we explicitly handle the declaration, instead of using our macros. 2205 */ 2206 2207 int cmListFileLexer_yylex_init(yyscan_t* ptr_yy_globals) 2208 2209 { 2210 if (ptr_yy_globals == NULL){ 2211 errno = EINVAL; 2212 return 1; 2213 } 2214 2215 *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), NULL ); 2216 2217 if (*ptr_yy_globals == NULL){ 2218 errno = ENOMEM; 2219 return 1; 2220 } 2221 2222 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2223 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2224 2225 return yy_init_globals ( *ptr_yy_globals ); 2226 } 2227 2228 /* cmListFileLexer_yylex_init_extra has the same functionality as cmListFileLexer_yylex_init, but follows the 2229 * convention of taking the scanner as the last argument. Note however, that 2230 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2231 * is the reason, too, why this function also must handle its own declaration). 2232 * The user defined value in the first argument will be available to cmListFileLexer_yyalloc in 2233 * the yyextra field. 2234 */ 2235 2236 int cmListFileLexer_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2237 2238 { 2239 struct yyguts_t dummy_yyguts; 2240 2241 cmListFileLexer_yyset_extra (yy_user_defined, &dummy_yyguts); 2242 2243 if (ptr_yy_globals == NULL){ 2244 errno = EINVAL; 2245 return 1; 2246 } 2247 2248 *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2249 2250 if (*ptr_yy_globals == NULL){ 2251 errno = ENOMEM; 2252 return 1; 2253 } 2254 2255 /* By setting to 0xAA, we expose bugs in 2256 yy_init_globals. Leave at 0x00 for releases. */ 2257 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2258 2259 cmListFileLexer_yyset_extra (yy_user_defined, *ptr_yy_globals); 2260 2261 return yy_init_globals ( *ptr_yy_globals ); 2262 } 2263 2264 static int yy_init_globals (yyscan_t yyscanner) 2265 { 2266 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2267 /* Initialization is the same as for the non-reentrant scanner. 2268 * This function is called from cmListFileLexer_yylex_destroy(), so don't allocate here. 2269 */ 2270 2271 yyg->yy_buffer_stack = NULL; 2272 yyg->yy_buffer_stack_top = 0; 2273 yyg->yy_buffer_stack_max = 0; 2274 yyg->yy_c_buf_p = NULL; 2275 yyg->yy_init = 0; 2276 yyg->yy_start = 0; 2277 2278 yyg->yy_start_stack_ptr = 0; 2279 yyg->yy_start_stack_depth = 0; 2280 yyg->yy_start_stack = NULL; 2281 2282 /* Defined in main.c */ 2283 #ifdef YY_STDINIT 2284 yyin = stdin; 2285 yyout = stdout; 2286 #else 2287 yyin = NULL; 2288 yyout = NULL; 2289 #endif 2290 2291 /* For future reference: Set errno on error, since we are called by 2292 * cmListFileLexer_yylex_init() 2293 */ 2294 return 0; 2295 } 2296 2297 /* cmListFileLexer_yylex_destroy is for both reentrant and non-reentrant scanners. */ 2298 int cmListFileLexer_yylex_destroy (yyscan_t yyscanner) 2299 { 2300 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2301 2302 /* Pop the buffer stack, destroying each element. */ 2303 while(YY_CURRENT_BUFFER){ 2304 cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2305 YY_CURRENT_BUFFER_LVALUE = NULL; 2306 cmListFileLexer_yypop_buffer_state(yyscanner); 2307 } 2308 2309 /* Destroy the stack itself. */ 2310 cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner); 2311 yyg->yy_buffer_stack = NULL; 2312 2313 /* Destroy the start condition stack. */ 2314 cmListFileLexer_yyfree(yyg->yy_start_stack ,yyscanner ); 2315 yyg->yy_start_stack = NULL; 2316 2317 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2318 * cmListFileLexer_yylex() is called, initialization will occur. */ 2319 yy_init_globals( yyscanner); 2320 2321 /* Destroy the main struct (reentrant only). */ 2322 cmListFileLexer_yyfree ( yyscanner , yyscanner ); 2323 yyscanner = NULL; 2324 return 0; 2325 } 2326 2327 /* 2328 * Internal utility routines. 2329 */ 2330 2331 #ifndef yytext_ptr 2332 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2333 { 2334 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2335 (void)yyg; 2336 2337 int i; 2338 for ( i = 0; i < n; ++i ) 2339 s1[i] = s2[i]; 2340 } 2341 #endif 2342 2343 #ifdef YY_NEED_STRLEN 2344 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2345 { 2346 int n; 2347 for ( n = 0; s[n]; ++n ) 2348 ; 2349 2350 return n; 2351 } 2352 #endif 2353 2354 void *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner) 2355 { 2356 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2357 (void)yyg; 2358 return malloc(size); 2359 } 2360 2361 void *cmListFileLexer_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 2362 { 2363 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2364 (void)yyg; 2365 2366 /* The cast to (char *) in the following accommodates both 2367 * implementations that use char* generic pointers, and those 2368 * that use void* generic pointers. It works with the latter 2369 * because both ANSI C and C++ allow castless assignment from 2370 * any pointer type to void*, and deal with argument conversions 2371 * as though doing an assignment. 2372 */ 2373 return realloc(ptr, size); 2374 } 2375 2376 void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner) 2377 { 2378 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2379 (void)yyg; 2380 free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */ 2381 } 2382 2383 #define YYTABLES_NAME "yytables" 2384 2385 #line 265 "cmListFileLexer.in.l" 2386 2387 2388 2389 /*--------------------------------------------------------------------------*/ 2390 static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text, 2391 int length) 2392 { 2393 /* Set the token line and column number. */ 2394 lexer->token.line = lexer->line; 2395 lexer->token.column = lexer->column; 2396 2397 /* Use the same buffer if possible. */ 2398 if (lexer->token.text) { 2399 if (text && length < lexer->size) { 2400 strcpy(lexer->token.text, text); 2401 lexer->token.length = length; 2402 return; 2403 } 2404 free(lexer->token.text); 2405 lexer->token.text = 0; 2406 lexer->size = 0; 2407 } 2408 2409 /* Need to extend the buffer. */ 2410 if (text) { 2411 lexer->token.text = strdup(text); 2412 lexer->token.length = length; 2413 lexer->size = length + 1; 2414 } else { 2415 lexer->token.length = 0; 2416 } 2417 } 2418 2419 /*--------------------------------------------------------------------------*/ 2420 static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text, 2421 int length) 2422 { 2423 char* temp; 2424 int newSize; 2425 2426 /* If the appended text will fit in the buffer, do not reallocate. */ 2427 newSize = lexer->token.length + length + 1; 2428 if (lexer->token.text && newSize <= lexer->size) { 2429 strcpy(lexer->token.text + lexer->token.length, text); 2430 lexer->token.length += length; 2431 return; 2432 } 2433 2434 /* We need to extend the buffer. */ 2435 temp = malloc(newSize); 2436 if (lexer->token.text) { 2437 memcpy(temp, lexer->token.text, lexer->token.length); 2438 free(lexer->token.text); 2439 } 2440 memcpy(temp + lexer->token.length, text, length); 2441 temp[lexer->token.length + length] = 0; 2442 lexer->token.text = temp; 2443 lexer->token.length += length; 2444 lexer->size = newSize; 2445 } 2446 2447 /*--------------------------------------------------------------------------*/ 2448 static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer, 2449 size_t bufferSize) 2450 { 2451 if (lexer) { 2452 if (lexer->file) { 2453 /* Convert CRLF -> LF explicitly. The C FILE "t"ext mode 2454 does not convert newlines on all platforms. Move any 2455 trailing CR to the start of the buffer for the next read. */ 2456 size_t cr = lexer->cr; 2457 size_t n; 2458 buffer[0] = '\r'; 2459 n = fread(buffer + cr, 1, bufferSize - cr, lexer->file); 2460 if (n) { 2461 char* o = buffer; 2462 const char* i = buffer; 2463 const char* e; 2464 n += cr; 2465 cr = (buffer[n - 1] == '\r') ? 1 : 0; 2466 e = buffer + n - cr; 2467 while (i != e) { 2468 if (i[0] == '\r' && i[1] == '\n') { 2469 ++i; 2470 } 2471 *o++ = *i++; 2472 } 2473 n = o - buffer; 2474 } else { 2475 n = cr; 2476 cr = 0; 2477 } 2478 lexer->cr = cr; 2479 return n; 2480 } else if (lexer->string_left) { 2481 int length = lexer->string_left; 2482 if ((int)bufferSize < length) { 2483 length = (int)bufferSize; 2484 } 2485 memcpy(buffer, lexer->string_position, length); 2486 lexer->string_position += length; 2487 lexer->string_left -= length; 2488 return length; 2489 } 2490 } 2491 return 0; 2492 } 2493 2494 /*--------------------------------------------------------------------------*/ 2495 static void cmListFileLexerInit(cmListFileLexer* lexer) 2496 { 2497 if (lexer->file || lexer->string_buffer) { 2498 cmListFileLexer_yylex_init(&lexer->scanner); 2499 cmListFileLexer_yyset_extra(lexer, lexer->scanner); 2500 } 2501 } 2502 2503 /*--------------------------------------------------------------------------*/ 2504 static void cmListFileLexerDestroy(cmListFileLexer* lexer) 2505 { 2506 cmListFileLexerSetToken(lexer, 0, 0); 2507 if (lexer->file || lexer->string_buffer) { 2508 cmListFileLexer_yylex_destroy(lexer->scanner); 2509 if (lexer->file) { 2510 fclose(lexer->file); 2511 lexer->file = 0; 2512 } 2513 if (lexer->string_buffer) { 2514 free(lexer->string_buffer); 2515 lexer->string_buffer = 0; 2516 lexer->string_left = 0; 2517 lexer->string_position = 0; 2518 } 2519 } 2520 } 2521 2522 /*--------------------------------------------------------------------------*/ 2523 cmListFileLexer* cmListFileLexer_New(void) 2524 { 2525 cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer)); 2526 if (!lexer) { 2527 return 0; 2528 } 2529 memset(lexer, 0, sizeof(*lexer)); 2530 lexer->line = 1; 2531 lexer->column = 1; 2532 return lexer; 2533 } 2534 2535 /*--------------------------------------------------------------------------*/ 2536 void cmListFileLexer_Delete(cmListFileLexer* lexer) 2537 { 2538 cmListFileLexer_SetFileName(lexer, 0, 0); 2539 free(lexer); 2540 } 2541 2542 /*--------------------------------------------------------------------------*/ 2543 static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f) 2544 { 2545 unsigned char b[2]; 2546 if (fread(b, 1, 2, f) == 2) { 2547 if (b[0] == 0xEF && b[1] == 0xBB) { 2548 if (fread(b, 1, 1, f) == 1 && b[0] == 0xBF) { 2549 return cmListFileLexer_BOM_UTF8; 2550 } 2551 } else if (b[0] == 0xFE && b[1] == 0xFF) { 2552 /* UTF-16 BE */ 2553 return cmListFileLexer_BOM_UTF16BE; 2554 } else if (b[0] == 0 && b[1] == 0) { 2555 if (fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF) { 2556 return cmListFileLexer_BOM_UTF32BE; 2557 } 2558 } else if (b[0] == 0xFF && b[1] == 0xFE) { 2559 fpos_t p; 2560 fgetpos(f, &p); 2561 if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) { 2562 return cmListFileLexer_BOM_UTF32LE; 2563 } 2564 if (fsetpos(f, &p) != 0) { 2565 return cmListFileLexer_BOM_Broken; 2566 } 2567 return cmListFileLexer_BOM_UTF16LE; 2568 } 2569 } 2570 if (fseek(f, 0, SEEK_SET) != 0) { 2571 return cmListFileLexer_BOM_Broken; 2572 } 2573 return cmListFileLexer_BOM_None; 2574 } 2575 2576 /*--------------------------------------------------------------------------*/ 2577 int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name, 2578 cmListFileLexer_BOM* bom) 2579 { 2580 int result = 1; 2581 cmListFileLexerDestroy(lexer); 2582 if (name) { 2583 #ifdef _WIN32 2584 wchar_t* wname = cmsysEncoding_DupToWide(name); 2585 lexer->file = _wfopen(wname, L"rb"); 2586 free(wname); 2587 #else 2588 lexer->file = fopen(name, "rb"); 2589 #endif 2590 if (lexer->file) { 2591 if (bom) { 2592 *bom = cmListFileLexer_ReadBOM(lexer->file); 2593 } 2594 } else { 2595 result = 0; 2596 } 2597 } 2598 cmListFileLexerInit(lexer); 2599 return result; 2600 } 2601 2602 /*--------------------------------------------------------------------------*/ 2603 int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text) 2604 { 2605 int result = 1; 2606 cmListFileLexerDestroy(lexer); 2607 if (text) { 2608 int length = (int)strlen(text); 2609 lexer->string_buffer = (char*)malloc(length + 1); 2610 if (lexer->string_buffer) { 2611 strcpy(lexer->string_buffer, text); 2612 lexer->string_position = lexer->string_buffer; 2613 lexer->string_left = length; 2614 } else { 2615 result = 0; 2616 } 2617 } 2618 cmListFileLexerInit(lexer); 2619 return result; 2620 } 2621 2622 /*--------------------------------------------------------------------------*/ 2623 cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer) 2624 { 2625 if (!lexer->file) { 2626 return 0; 2627 } 2628 if (cmListFileLexer_yylex(lexer->scanner, lexer)) { 2629 return &lexer->token; 2630 } else { 2631 cmListFileLexer_SetFileName(lexer, 0, 0); 2632 return 0; 2633 } 2634 } 2635 2636 /*--------------------------------------------------------------------------*/ 2637 long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer) 2638 { 2639 if (lexer->file) { 2640 return lexer->line; 2641 } else { 2642 return 0; 2643 } 2644 } 2645 2646 /*--------------------------------------------------------------------------*/ 2647 long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer) 2648 { 2649 if (lexer->file) { 2650 return lexer->column; 2651 } else { 2652 return 0; 2653 } 2654 } 2655 2656 /*--------------------------------------------------------------------------*/ 2657 const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer, 2658 cmListFileLexer_Type type) 2659 { 2660 (void)lexer; 2661 switch (type) { 2662 case cmListFileLexer_Token_None: 2663 return "nothing"; 2664 case cmListFileLexer_Token_Space: 2665 return "space"; 2666 case cmListFileLexer_Token_Newline: 2667 return "newline"; 2668 case cmListFileLexer_Token_Identifier: 2669 return "identifier"; 2670 case cmListFileLexer_Token_ParenLeft: 2671 return "left paren"; 2672 case cmListFileLexer_Token_ParenRight: 2673 return "right paren"; 2674 case cmListFileLexer_Token_ArgumentUnquoted: 2675 return "unquoted argument"; 2676 case cmListFileLexer_Token_ArgumentQuoted: 2677 return "quoted argument"; 2678 case cmListFileLexer_Token_ArgumentBracket: 2679 return "bracket argument"; 2680 case cmListFileLexer_Token_CommentBracket: 2681 return "bracket comment"; 2682 case cmListFileLexer_Token_BadCharacter: 2683 return "bad character"; 2684 case cmListFileLexer_Token_BadBracket: 2685 return "unterminated bracket"; 2686 case cmListFileLexer_Token_BadString: 2687 return "unterminated string"; 2688 } 2689 return "unknown token"; 2690 }