1 #include "cmStandardLexer.h"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 #ifdef yy_create_buffer
17 #define cmListFileLexer_yy_create_buffer_ALREADY_DEFINED
19 #define yy_create_buffer cmListFileLexer_yy_create_buffer
22 #ifdef yy_delete_buffer
23 #define cmListFileLexer_yy_delete_buffer_ALREADY_DEFINED
25 #define yy_delete_buffer cmListFileLexer_yy_delete_buffer
29 #define cmListFileLexer_yy_scan_buffer_ALREADY_DEFINED
31 #define yy_scan_buffer cmListFileLexer_yy_scan_buffer
35 #define cmListFileLexer_yy_scan_string_ALREADY_DEFINED
37 #define yy_scan_string cmListFileLexer_yy_scan_string
41 #define cmListFileLexer_yy_scan_bytes_ALREADY_DEFINED
43 #define yy_scan_bytes cmListFileLexer_yy_scan_bytes
47 #define cmListFileLexer_yy_init_buffer_ALREADY_DEFINED
49 #define yy_init_buffer cmListFileLexer_yy_init_buffer
52 #ifdef yy_flush_buffer
53 #define cmListFileLexer_yy_flush_buffer_ALREADY_DEFINED
55 #define yy_flush_buffer cmListFileLexer_yy_flush_buffer
58 #ifdef yy_load_buffer_state
59 #define cmListFileLexer_yy_load_buffer_state_ALREADY_DEFINED
61 #define yy_load_buffer_state cmListFileLexer_yy_load_buffer_state
64 #ifdef yy_switch_to_buffer
65 #define cmListFileLexer_yy_switch_to_buffer_ALREADY_DEFINED
67 #define yy_switch_to_buffer cmListFileLexer_yy_switch_to_buffer
70 #ifdef yypush_buffer_state
71 #define cmListFileLexer_yypush_buffer_state_ALREADY_DEFINED
73 #define yypush_buffer_state cmListFileLexer_yypush_buffer_state
76 #ifdef yypop_buffer_state
77 #define cmListFileLexer_yypop_buffer_state_ALREADY_DEFINED
79 #define yypop_buffer_state cmListFileLexer_yypop_buffer_state
82 #ifdef yyensure_buffer_stack
83 #define cmListFileLexer_yyensure_buffer_stack_ALREADY_DEFINED
85 #define yyensure_buffer_stack cmListFileLexer_yyensure_buffer_stack
89 #define cmListFileLexer_yylex_ALREADY_DEFINED
91 #define yylex cmListFileLexer_yylex
95 #define cmListFileLexer_yyrestart_ALREADY_DEFINED
97 #define yyrestart cmListFileLexer_yyrestart
101 #define cmListFileLexer_yylex_init_ALREADY_DEFINED
103 #define yylex_init cmListFileLexer_yylex_init
106 #ifdef yylex_init_extra
107 #define cmListFileLexer_yylex_init_extra_ALREADY_DEFINED
109 #define yylex_init_extra cmListFileLexer_yylex_init_extra
113 #define cmListFileLexer_yylex_destroy_ALREADY_DEFINED
115 #define yylex_destroy cmListFileLexer_yylex_destroy
119 #define cmListFileLexer_yyget_debug_ALREADY_DEFINED
121 #define yyget_debug cmListFileLexer_yyget_debug
125 #define cmListFileLexer_yyset_debug_ALREADY_DEFINED
127 #define yyset_debug cmListFileLexer_yyset_debug
131 #define cmListFileLexer_yyget_extra_ALREADY_DEFINED
133 #define yyget_extra cmListFileLexer_yyget_extra
137 #define cmListFileLexer_yyset_extra_ALREADY_DEFINED
139 #define yyset_extra cmListFileLexer_yyset_extra
143 #define cmListFileLexer_yyget_in_ALREADY_DEFINED
145 #define yyget_in cmListFileLexer_yyget_in
149 #define cmListFileLexer_yyset_in_ALREADY_DEFINED
151 #define yyset_in cmListFileLexer_yyset_in
155 #define cmListFileLexer_yyget_out_ALREADY_DEFINED
157 #define yyget_out cmListFileLexer_yyget_out
161 #define cmListFileLexer_yyset_out_ALREADY_DEFINED
163 #define yyset_out cmListFileLexer_yyset_out
167 #define cmListFileLexer_yyget_leng_ALREADY_DEFINED
169 #define yyget_leng cmListFileLexer_yyget_leng
173 #define cmListFileLexer_yyget_text_ALREADY_DEFINED
175 #define yyget_text cmListFileLexer_yyget_text
179 #define cmListFileLexer_yyget_lineno_ALREADY_DEFINED
181 #define yyget_lineno cmListFileLexer_yyget_lineno
185 #define cmListFileLexer_yyset_lineno_ALREADY_DEFINED
187 #define yyset_lineno cmListFileLexer_yyset_lineno
191 #define cmListFileLexer_yyget_column_ALREADY_DEFINED
193 #define yyget_column cmListFileLexer_yyget_column
197 #define cmListFileLexer_yyset_column_ALREADY_DEFINED
199 #define yyset_column cmListFileLexer_yyset_column
203 #define cmListFileLexer_yywrap_ALREADY_DEFINED
205 #define yywrap cmListFileLexer_yywrap
209 #define cmListFileLexer_yyalloc_ALREADY_DEFINED
211 #define yyalloc cmListFileLexer_yyalloc
215 #define cmListFileLexer_yyrealloc_ALREADY_DEFINED
217 #define yyrealloc cmListFileLexer_yyrealloc
221 #define cmListFileLexer_yyfree_ALREADY_DEFINED
223 #define yyfree cmListFileLexer_yyfree
226 /* First, we deal with platform-specific or compiler-specific issues. */
228 /* begin standard C headers. */
234 /* end standard C headers. */
236 /* flex integer type definitions */
241 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
243 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
245 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
246 * if you want the limit (max/min) macros for int types.
248 #ifndef __STDC_LIMIT_MACROS
249 #define __STDC_LIMIT_MACROS 1
252 #include <inttypes.h>
253 typedef int8_t flex_int8_t
;
254 typedef uint8_t flex_uint8_t
;
255 typedef int16_t flex_int16_t
;
256 typedef uint16_t flex_uint16_t
;
257 typedef int32_t flex_int32_t
;
258 typedef uint32_t flex_uint32_t
;
260 typedef signed char flex_int8_t
;
261 typedef short int flex_int16_t
;
262 typedef int flex_int32_t
;
263 typedef unsigned char flex_uint8_t
;
264 typedef unsigned short int flex_uint16_t
;
265 typedef unsigned int flex_uint32_t
;
267 /* Limits of integral types. */
269 #define INT8_MIN (-128)
272 #define INT16_MIN (-32767-1)
275 #define INT32_MIN (-2147483647-1)
278 #define INT8_MAX (127)
281 #define INT16_MAX (32767)
284 #define INT32_MAX (2147483647)
287 #define UINT8_MAX (255U)
290 #define UINT16_MAX (65535U)
293 #define UINT32_MAX (4294967295U)
297 #define SIZE_MAX (~(size_t)0)
302 #endif /* ! FLEXINT_H */
304 /* begin standard C++ headers. */
306 /* TODO: this is always defined, so inline it */
307 #define yyconst const
309 #if defined(__GNUC__) && __GNUC__ >= 3
310 #define yynoreturn __attribute__((__noreturn__))
315 /* Returned upon end-of-file. */
318 /* Promotes a possibly negative, possibly signed char to an
319 * integer in range [0..255] for use as an array index.
321 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
323 /* An opaque pointer. */
324 #ifndef YY_TYPEDEF_YY_SCANNER_T
325 #define YY_TYPEDEF_YY_SCANNER_T
326 typedef void* yyscan_t
;
329 /* For convenience, these vars (plus the bison vars far below)
330 are macros in the reentrant scanner. */
331 #define yyin yyg->yyin_r
332 #define yyout yyg->yyout_r
333 #define yyextra yyg->yyextra_r
334 #define yyleng yyg->yyleng_r
335 #define yytext yyg->yytext_r
336 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
337 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
338 #define yy_flex_debug yyg->yy_flex_debug_r
340 /* Enter a start condition. This macro really ought to take a parameter,
341 * but we do it the disgusting crufty way forced on us by the ()-less
342 * definition of BEGIN.
344 #define BEGIN yyg->yy_start = 1 + 2 *
345 /* Translate the current start state into a value that can be later handed
346 * to BEGIN to return to the state. The YYSTATE alias is for lex
349 #define YY_START ((yyg->yy_start - 1) / 2)
350 #define YYSTATE YY_START
351 /* Action number for EOF rule of a given start state. */
352 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
353 /* Special action meaning "start processing a new file". */
354 #define YY_NEW_FILE yyrestart( yyin , yyscanner )
355 #define YY_END_OF_BUFFER_CHAR 0
357 /* Size of default input buffer. */
360 /* On IA-64, the buffer size is 16k, not 8k.
361 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
362 * Ditto for the __ia64__ case accordingly.
364 #define YY_BUF_SIZE 32768
366 #define YY_BUF_SIZE 16384
367 #endif /* __ia64__ */
370 /* The state buf must be large enough to hold one state per character in the main buffer.
372 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
374 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
375 #define YY_TYPEDEF_YY_BUFFER_STATE
376 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
379 #ifndef YY_TYPEDEF_YY_SIZE_T
380 #define YY_TYPEDEF_YY_SIZE_T
381 typedef size_t yy_size_t
;
384 #define EOB_ACT_CONTINUE_SCAN 0
385 #define EOB_ACT_END_OF_FILE 1
386 #define EOB_ACT_LAST_MATCH 2
388 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
389 * access to the local variable yy_act. Since yyless() is a macro, it would break
390 * existing scanners that call yyless() from OUTSIDE yylex.
391 * One obvious solution it to make yy_act a global. I tried that, and saw
392 * a 5% performance hit in a non-yylineno scanner, because yy_act is
393 * normally declared as a register variable-- so it is not worth it.
395 #define YY_LESS_LINENO(n) \
398 for ( yyl = n; yyl < yyleng; ++yyl )\
399 if ( yytext[yyl] == '\n' )\
402 #define YY_LINENO_REWIND_TO(dst) \
405 for ( p = yy_cp-1; p >= (dst); --p)\
410 /* Return all but the first "n" matched characters back to the input stream. */
414 /* Undo effects of setting up yytext. */ \
415 int yyless_macro_arg = (n); \
416 YY_LESS_LINENO(yyless_macro_arg);\
417 *yy_cp = yyg->yy_hold_char; \
418 YY_RESTORE_YY_MORE_OFFSET \
419 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
420 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
423 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
425 #ifndef YY_STRUCT_YY_BUFFER_STATE
426 #define YY_STRUCT_YY_BUFFER_STATE
427 struct yy_buffer_state
431 char *yy_ch_buf
; /* input buffer */
432 char *yy_buf_pos
; /* current position in input buffer */
434 /* Size of input buffer in bytes, not including room for EOB
439 /* Number of characters read into yy_ch_buf, not including EOB
444 /* Whether we "own" the buffer - i.e., we know we created it,
445 * and can realloc() it to grow it, and should free() it to
448 int yy_is_our_buffer
;
450 /* Whether this is an "interactive" input source; if so, and
451 * if we're using stdio for input, then we want to use getc()
452 * instead of fread(), to make sure we stop fetching input after
455 int yy_is_interactive
;
457 /* Whether we're considered to be at the beginning of a line.
458 * If so, '^' rules will be active on the next match, otherwise
463 int yy_bs_lineno
; /**< The line count. */
464 int yy_bs_column
; /**< The column count. */
466 /* Whether to try to fill the input buffer when we reach the
471 int yy_buffer_status
;
473 #define YY_BUFFER_NEW 0
474 #define YY_BUFFER_NORMAL 1
475 /* When an EOF's been seen but there's still some text to process
476 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
477 * shouldn't try reading from the input source any more. We might
478 * still have a bunch of tokens to match, though, because of
479 * possible backing-up.
481 * When we actually see the EOF, we change the status to "new"
482 * (via yyrestart()), so that the user can continue scanning by
483 * just pointing yyin at a new input file.
485 #define YY_BUFFER_EOF_PENDING 2
488 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
490 /* We provide macros for accessing buffer states in case in the
491 * future we want to put the buffer states in a more general
494 * Returns the top of the stack, or NULL.
496 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
497 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
499 /* Same as previous macro, but useful when we know that the buffer stack is not
500 * NULL or when we need an lvalue. For internal use only.
502 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
504 void yyrestart ( FILE *input_file
, yyscan_t yyscanner
);
505 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
);
506 YY_BUFFER_STATE
yy_create_buffer ( FILE *file
, int size
, yyscan_t yyscanner
);
507 void yy_delete_buffer ( YY_BUFFER_STATE b
, yyscan_t yyscanner
);
508 void yy_flush_buffer ( YY_BUFFER_STATE b
, yyscan_t yyscanner
);
509 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
);
510 void yypop_buffer_state ( yyscan_t yyscanner
);
512 static void yyensure_buffer_stack ( yyscan_t yyscanner
);
513 static void yy_load_buffer_state ( yyscan_t yyscanner
);
514 static void yy_init_buffer ( YY_BUFFER_STATE b
, FILE *file
, yyscan_t yyscanner
);
515 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
517 YY_BUFFER_STATE
yy_scan_buffer ( char *base
, yy_size_t size
, yyscan_t yyscanner
);
518 YY_BUFFER_STATE
yy_scan_string ( const char *yy_str
, yyscan_t yyscanner
);
519 YY_BUFFER_STATE
yy_scan_bytes ( const char *bytes
, int len
, yyscan_t yyscanner
);
521 void *yyalloc ( yy_size_t
, yyscan_t yyscanner
);
522 void *yyrealloc ( void *, yy_size_t
, yyscan_t yyscanner
);
523 void yyfree ( void * , yyscan_t yyscanner
);
525 #define yy_new_buffer yy_create_buffer
526 #define yy_set_interactive(is_interactive) \
528 if ( ! YY_CURRENT_BUFFER ){ \
529 yyensure_buffer_stack (yyscanner); \
530 YY_CURRENT_BUFFER_LVALUE = \
531 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
533 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
535 #define yy_set_bol(at_bol) \
537 if ( ! YY_CURRENT_BUFFER ){\
538 yyensure_buffer_stack (yyscanner); \
539 YY_CURRENT_BUFFER_LVALUE = \
540 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
542 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
544 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
546 /* Begin user sect3 */
548 #define cmListFileLexer_yywrap(yyscanner) (/*CONSTCOND*/1)
549 #define YY_SKIP_YYWRAP
550 typedef flex_uint8_t YY_CHAR
;
552 typedef int yy_state_type
;
554 #define yytext_ptr yytext_r
556 static yy_state_type
yy_get_previous_state ( yyscan_t yyscanner
);
557 static yy_state_type
yy_try_NUL_trans ( yy_state_type current_state
, yyscan_t yyscanner
);
558 static int yy_get_next_buffer ( yyscan_t yyscanner
);
559 static void yynoreturn
yy_fatal_error ( const char* msg
, yyscan_t yyscanner
);
561 /* Done after the current pattern has been matched and before the
562 * corresponding action - sets up yytext.
564 #define YY_DO_BEFORE_ACTION \
565 yyg->yytext_ptr = yy_bp; \
566 yyleng = (int) (yy_cp - yy_bp); \
567 yyg->yy_hold_char = *yy_cp; \
569 yyg->yy_c_buf_p = yy_cp;
570 #define YY_NUM_RULES 24
571 #define YY_END_OF_BUFFER 25
572 /* This struct is not used in this scanner,
573 but its presence is necessary. */
576 flex_int32_t yy_verify
;
579 static const flex_int16_t yy_accept
[79] =
581 0, 0, 0, 0, 0, 0, 0, 0, 4, 4,
582 25, 13, 22, 1, 16, 3, 13, 5, 6, 7,
583 15, 23, 23, 17, 19, 20, 21, 24, 10, 11,
584 8, 12, 9, 4, 13, 0, 13, 0, 22, 0,
585 0, 7, 13, 0, 13, 0, 2, 0, 13, 17,
586 0, 18, 10, 8, 4, 0, 14, 0, 0, 0,
587 0, 14, 0, 0, 14, 0, 0, 0, 2, 14,
588 0, 0, 0, 0, 0, 0, 0, 0
591 static const YY_CHAR yy_ec
[256] =
593 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
594 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
595 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
596 1, 2, 1, 5, 6, 7, 1, 1, 1, 8,
597 9, 1, 1, 1, 1, 1, 1, 10, 10, 10,
598 10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
599 11, 1, 1, 1, 12, 12, 12, 12, 12, 12,
600 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
601 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
602 13, 14, 15, 1, 12, 1, 12, 12, 12, 12,
604 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
605 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
606 12, 12, 1, 1, 1, 1, 1, 1, 1, 1,
607 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
608 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
609 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
610 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
611 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
612 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
613 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
615 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
616 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
617 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
618 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
619 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
623 static const YY_CHAR yy_meta
[17] =
625 1, 1, 2, 3, 4, 3, 1, 3, 5, 6,
629 static const flex_int16_t yy_base
[97] =
631 0, 0, 14, 28, 42, 56, 70, 84, 18, 19,
632 68, 100, 16, 298, 298, 54, 58, 298, 298, 13,
633 115, 0, 298, 51, 298, 298, 21, 298, 0, 298,
634 53, 298, 298, 0, 0, 126, 55, 0, 25, 25,
635 53, 0, 0, 136, 53, 0, 57, 0, 0, 42,
636 50, 298, 0, 43, 0, 146, 160, 45, 172, 43,
637 26, 0, 42, 177, 0, 42, 188, 40, 298, 40,
638 0, 38, 37, 34, 32, 31, 23, 298, 197, 204,
639 211, 218, 225, 232, 239, 245, 252, 259, 262, 268,
640 275, 278, 280, 286, 289, 291
644 static const flex_int16_t yy_def
[97] =
646 78, 1, 79, 79, 80, 80, 81, 81, 82, 82,
647 78, 78, 78, 78, 78, 78, 12, 78, 78, 12,
648 78, 83, 78, 84, 78, 78, 84, 78, 85, 78,
649 78, 78, 78, 86, 12, 87, 12, 88, 78, 78,
650 89, 20, 12, 90, 12, 21, 78, 91, 12, 84,
651 84, 78, 85, 78, 86, 87, 78, 56, 87, 92,
652 78, 57, 89, 90, 57, 64, 90, 93, 78, 57,
653 94, 95, 92, 96, 93, 95, 96, 0, 78, 78,
654 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
655 78, 78, 78, 78, 78, 78
659 static const flex_int16_t yy_nxt
[315] =
661 12, 13, 14, 13, 15, 16, 17, 18, 19, 12,
662 12, 20, 21, 22, 12, 23, 25, 39, 26, 39,
663 14, 14, 42, 52, 42, 50, 39, 27, 39, 28,
664 25, 64, 26, 28, 28, 61, 61, 47, 47, 56,
665 65, 27, 64, 28, 30, 57, 56, 60, 65, 74,
666 62, 57, 72, 54, 50, 51, 31, 28, 30, 69,
667 68, 62, 60, 54, 51, 41, 40, 78, 78, 78,
668 31, 28, 30, 78, 78, 78, 78, 78, 78, 78,
669 78, 78, 78, 78, 33, 28, 30, 78, 78, 78,
670 78, 78, 78, 78, 78, 78, 78, 78, 33, 28,
672 35, 78, 78, 78, 36, 78, 37, 78, 78, 35,
673 35, 35, 35, 38, 35, 43, 78, 78, 78, 44,
674 78, 45, 78, 78, 43, 46, 43, 47, 48, 43,
675 57, 78, 58, 78, 78, 78, 78, 78, 78, 59,
676 65, 78, 66, 78, 78, 78, 78, 78, 78, 67,
677 57, 78, 58, 78, 78, 78, 78, 78, 78, 59,
678 57, 78, 78, 78, 36, 78, 70, 78, 78, 57,
679 57, 57, 57, 71, 57, 56, 78, 56, 78, 56,
680 56, 65, 78, 66, 78, 78, 78, 78, 78, 78,
681 67, 64, 78, 64, 78, 64, 64, 24, 24, 24,
683 24, 24, 24, 24, 29, 29, 29, 29, 29, 29,
684 29, 32, 32, 32, 32, 32, 32, 32, 34, 34,
685 34, 34, 34, 34, 34, 49, 78, 49, 49, 49,
686 49, 49, 50, 78, 50, 78, 50, 50, 50, 53,
687 78, 53, 53, 53, 53, 55, 78, 55, 55, 55,
688 55, 55, 56, 78, 78, 56, 78, 56, 56, 35,
689 78, 35, 35, 35, 35, 35, 63, 63, 64, 78,
690 78, 64, 78, 64, 64, 43, 78, 43, 43, 43,
691 43, 43, 73, 73, 75, 75, 57, 78, 57, 57,
692 57, 57, 57, 76, 76, 77, 77, 11, 78, 78,
694 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
698 static const flex_int16_t yy_chk
[315] =
700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
701 1, 1, 1, 1, 1, 1, 3, 13, 3, 13,
702 9, 10, 20, 27, 20, 27, 39, 3, 39, 3,
703 4, 77, 4, 9, 10, 40, 61, 40, 61, 76,
704 75, 4, 74, 4, 5, 73, 72, 70, 68, 66,
705 63, 60, 58, 54, 51, 50, 5, 5, 6, 47,
706 45, 41, 37, 31, 24, 17, 16, 11, 0, 0,
707 6, 6, 7, 0, 0, 0, 0, 0, 0, 0,
708 0, 0, 0, 0, 7, 7, 8, 0, 0, 0,
709 0, 0, 0, 0, 0, 0, 0, 0, 8, 8,
711 12, 0, 0, 0, 12, 0, 12, 0, 0, 12,
712 12, 12, 12, 12, 12, 21, 0, 0, 0, 21,
713 0, 21, 0, 0, 21, 21, 21, 21, 21, 21,
714 36, 0, 36, 0, 0, 0, 0, 0, 0, 36,
715 44, 0, 44, 0, 0, 0, 0, 0, 0, 44,
716 56, 0, 56, 0, 0, 0, 0, 0, 0, 56,
717 57, 0, 0, 0, 57, 0, 57, 0, 0, 57,
718 57, 57, 57, 57, 57, 59, 0, 59, 0, 59,
719 59, 64, 0, 64, 0, 0, 0, 0, 0, 0,
720 64, 67, 0, 67, 0, 67, 67, 79, 79, 79,
722 79, 79, 79, 79, 80, 80, 80, 80, 80, 80,
723 80, 81, 81, 81, 81, 81, 81, 81, 82, 82,
724 82, 82, 82, 82, 82, 83, 0, 83, 83, 83,
725 83, 83, 84, 0, 84, 0, 84, 84, 84, 85,
726 0, 85, 85, 85, 85, 86, 0, 86, 86, 86,
727 86, 86, 87, 0, 0, 87, 0, 87, 87, 88,
728 0, 88, 88, 88, 88, 88, 89, 89, 90, 0,
729 0, 90, 0, 90, 90, 91, 0, 91, 91, 91,
730 91, 91, 92, 92, 93, 93, 94, 0, 94, 94,
731 94, 94, 94, 95, 95, 96, 96, 78, 78, 78,
733 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
737 /* Table of booleans, true if rule could match eol. */
738 static const flex_int32_t yy_rule_can_match_eol
[25] =
740 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1,
743 /* The intent behind this definition is that it'll catch
744 * any uses of REJECT which flex missed.
746 #define REJECT reject_used_but_not_detected
747 #define yymore() yymore_used_but_not_detected
748 #define YY_MORE_ADJ 0
749 #define YY_RESTORE_YY_MORE_OFFSET
750 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
751 file Copyright.txt or https://cmake.org/licensing for details. */
754 This file must be translated to C and modified to build everywhere.
756 Run flex >= 2.6 like this:
758 flex --nounistd -DFLEXINT_H --noline -ocmListFileLexer.c cmListFileLexer.in.l
760 Modify cmListFileLexer.c:
761 - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
762 - remove blank lines at end of file: sed -i '${/^$/d;}' cmListFileLexer.c
763 - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmListFileLexer.c
767 /* IWYU pragma: no_forward_declare yyguts_t */
770 #include "cmsys/Encoding.h"
773 /* Setup the proper cmListFileLexer_yylex declaration. */
774 #define YY_EXTRA_TYPE cmListFileLexer*
775 #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
777 #include "cmListFileLexer.h"
779 /*--------------------------------------------------------------------------*/
780 struct cmListFileLexer_s
782 cmListFileLexer_Token token
;
791 char* string_position
;
796 static void cmListFileLexerSetToken(cmListFileLexer
* lexer
, const char* text
,
798 static void cmListFileLexerAppend(cmListFileLexer
* lexer
, const char* text
,
800 static int cmListFileLexerInput(cmListFileLexer
* lexer
, char* buffer
,
802 static void cmListFileLexerInit(cmListFileLexer
* lexer
);
803 static void cmListFileLexerDestroy(cmListFileLexer
* lexer
);
805 /* Replace the lexer input function. */
807 #define YY_INPUT(buf, result, max_size) \
808 do { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } while (0)
810 /*--------------------------------------------------------------------------*/
818 #ifndef YY_EXTRA_TYPE
819 #define YY_EXTRA_TYPE void *
822 /* Holds the entire state of the reentrant scanner. */
826 /* User-defined. Not touched by flex. */
827 YY_EXTRA_TYPE yyextra_r
;
829 /* The rest are the same as the globals declared in the non-reentrant scanner. */
830 FILE *yyin_r
, *yyout_r
;
831 size_t yy_buffer_stack_top
; /**< index of top of stack. */
832 size_t yy_buffer_stack_max
; /**< capacity of stack. */
833 YY_BUFFER_STATE
* yy_buffer_stack
; /**< Stack as an array. */
840 int yy_did_buffer_switch_on_eof
;
841 int yy_start_stack_ptr
;
842 int yy_start_stack_depth
;
844 yy_state_type yy_last_accepting_state
;
845 char* yy_last_accepting_cpos
;
854 }; /* end struct yyguts_t */
856 static int yy_init_globals ( yyscan_t yyscanner
);
858 int yylex_init (yyscan_t
* scanner
);
860 int yylex_init_extra ( YY_EXTRA_TYPE user_defined
, yyscan_t
* scanner
);
862 /* Accessor methods to globals.
863 These are made visible to non-reentrant scanners for convenience. */
865 int yylex_destroy ( yyscan_t yyscanner
);
867 int yyget_debug ( yyscan_t yyscanner
);
869 void yyset_debug ( int debug_flag
, yyscan_t yyscanner
);
871 YY_EXTRA_TYPE
yyget_extra ( yyscan_t yyscanner
);
873 void yyset_extra ( YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
);
875 FILE *yyget_in ( yyscan_t yyscanner
);
877 void yyset_in ( FILE * _in_str
, yyscan_t yyscanner
);
879 FILE *yyget_out ( yyscan_t yyscanner
);
881 void yyset_out ( FILE * _out_str
, yyscan_t yyscanner
);
883 int yyget_leng ( yyscan_t yyscanner
);
885 char *yyget_text ( yyscan_t yyscanner
);
887 int yyget_lineno ( yyscan_t yyscanner
);
889 void yyset_lineno ( int _line_number
, yyscan_t yyscanner
);
891 int yyget_column ( yyscan_t yyscanner
);
893 void yyset_column ( int _column_no
, yyscan_t yyscanner
);
895 /* Macros after this point can all be overridden by user definitions in
899 #ifndef YY_SKIP_YYWRAP
901 extern "C" int yywrap ( yyscan_t yyscanner
);
903 extern int yywrap ( yyscan_t yyscanner
);
909 static void yyunput ( int c
, char *buf_ptr
, yyscan_t yyscanner
);
914 static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner
);
917 #ifdef YY_NEED_STRLEN
918 static int yy_flex_strlen ( const char * , yyscan_t yyscanner
);
923 static int yyinput ( yyscan_t yyscanner
);
925 static int input ( yyscan_t yyscanner
);
930 /* Amount of stuff to slurp up with each read. */
931 #ifndef YY_READ_BUF_SIZE
933 /* On IA-64, the buffer size is 16k, not 8k */
934 #define YY_READ_BUF_SIZE 16384
936 #define YY_READ_BUF_SIZE 8192
937 #endif /* __ia64__ */
940 /* Copy whatever the last rule matched to the standard output. */
942 /* This used to be an fputs(), but since the string might contain NUL's,
943 * we now use fwrite().
945 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
948 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
949 * is returned in "result".
952 #define YY_INPUT(buf,result,max_size) \
953 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
957 for ( n = 0; n < max_size && \
958 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
961 buf[n++] = (char) c; \
962 if ( c == EOF && ferror( yyin ) ) \
963 YY_FATAL_ERROR( "input in flex scanner failed" ); \
969 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
971 if( errno != EINTR) \
973 YY_FATAL_ERROR( "input in flex scanner failed" ); \
984 /* No semi-colon after return; correct usage is to write "yyterminate();" -
985 * we don't want an extra ';' after the "return" because that will cause
986 * some compilers to complain about unreachable statements.
989 #define yyterminate() return YY_NULL
992 /* Number of entries by which start-condition stack grows. */
993 #ifndef YY_START_STACK_INCR
994 #define YY_START_STACK_INCR 25
997 /* Report a fatal error. */
998 #ifndef YY_FATAL_ERROR
999 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1002 /* end tables serialization structures and prototypes */
1004 /* Default declaration of generated scanner - a define so the user can
1005 * easily add parameters.
1008 #define YY_DECL_IS_OURS 1
1010 extern int yylex (yyscan_t yyscanner
);
1012 #define YY_DECL int yylex (yyscan_t yyscanner)
1013 #endif /* !YY_DECL */
1015 /* Code executed at the beginning of each rule, after yytext and yyleng
1018 #ifndef YY_USER_ACTION
1019 #define YY_USER_ACTION
1022 /* Code executed at the end of each rule. */
1024 #define YY_BREAK /*LINTED*/break;
1027 #define YY_RULE_SETUP \
1030 /** The main scanner function which does all the work.
1034 yy_state_type yy_current_state
;
1035 char *yy_cp
, *yy_bp
;
1037 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1039 if ( !yyg
->yy_init
)
1047 if ( ! yyg
->yy_start
)
1048 yyg
->yy_start
= 1; /* first start state */
1056 if ( ! YY_CURRENT_BUFFER
) {
1057 yyensure_buffer_stack (yyscanner
);
1058 YY_CURRENT_BUFFER_LVALUE
=
1059 yy_create_buffer( yyin
, YY_BUF_SIZE
, yyscanner
);
1062 yy_load_buffer_state( yyscanner
);
1067 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1069 yy_cp
= yyg
->yy_c_buf_p
;
1071 /* Support of yytext. */
1072 *yy_cp
= yyg
->yy_hold_char
;
1074 /* yy_bp points to the position in yy_ch_buf of the start of
1079 yy_current_state
= yyg
->yy_start
;
1083 YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)] ;
1084 if ( yy_accept
[yy_current_state
] )
1086 yyg
->yy_last_accepting_state
= yy_current_state
;
1087 yyg
->yy_last_accepting_cpos
= yy_cp
;
1089 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1091 yy_current_state
= (int) yy_def
[yy_current_state
];
1092 if ( yy_current_state
>= 79 )
1093 yy_c
= yy_meta
[yy_c
];
1095 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + yy_c
];
1098 while ( yy_base
[yy_current_state
] != 298 );
1101 yy_act
= yy_accept
[yy_current_state
];
1103 { /* have to back up */
1104 yy_cp
= yyg
->yy_last_accepting_cpos
;
1105 yy_current_state
= yyg
->yy_last_accepting_state
;
1106 yy_act
= yy_accept
[yy_current_state
];
1109 YY_DO_BEFORE_ACTION
;
1111 if ( yy_act
!= YY_END_OF_BUFFER
&& yy_rule_can_match_eol
[yy_act
] )
1114 for ( yyl
= 0; yyl
< yyleng
; ++yyl
)
1115 if ( yytext
[yyl
] == '\n' )
1123 do_action
: /* This label is used only to access EOF actions. */
1126 { /* beginning of action switch */
1127 case 0: /* must back up */
1128 /* undo the effects of YY_DO_BEFORE_ACTION */
1129 *yy_cp
= yyg
->yy_hold_char
;
1130 yy_cp
= yyg
->yy_last_accepting_cpos
;
1131 yy_current_state
= yyg
->yy_last_accepting_state
;
1132 goto yy_find_action
;
1135 /* rule 1 can match eol */
1138 lexer
->token
.type
= cmListFileLexer_Token_Newline
;
1139 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1147 /* rule 2 can match eol */
1150 const char* bracket
= yytext
;
1151 lexer
->comment
= yytext
[0] == '#';
1152 if (lexer
->comment
) {
1153 lexer
->token
.type
= cmListFileLexer_Token_CommentBracket
;
1156 lexer
->token
.type
= cmListFileLexer_Token_ArgumentBracket
;
1158 cmListFileLexerSetToken(lexer
, "", 0);
1159 lexer
->bracket
= strchr(bracket
+1, '[') - bracket
;
1160 if (yytext
[yyleng
-1] == '\n') {
1164 lexer
->column
+= yyleng
;
1172 lexer
->column
+= yyleng
;
1179 lexer
->column
+= yyleng
;
1185 lexer
->token
.type
= cmListFileLexer_Token_ParenLeft
;
1186 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1187 lexer
->column
+= yyleng
;
1194 lexer
->token
.type
= cmListFileLexer_Token_ParenRight
;
1195 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1196 lexer
->column
+= yyleng
;
1203 lexer
->token
.type
= cmListFileLexer_Token_Identifier
;
1204 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1205 lexer
->column
+= yyleng
;
1212 /* Handle ]]====]=======]*/
1213 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1214 lexer
->column
+= yyleng
;
1215 if (yyleng
== lexer
->bracket
) {
1223 lexer
->column
+= yyleng
;
1224 /* Erase the partial bracket from the token. */
1225 lexer
->token
.length
-= lexer
->bracket
;
1226 lexer
->token
.text
[lexer
->token
.length
] = 0;
1234 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1235 lexer
->column
+= yyleng
;
1239 /* rule 11 can match eol */
1242 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1251 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1252 lexer
->column
+= yyleng
;
1256 case YY_STATE_EOF(BRACKET
):
1257 case YY_STATE_EOF(BRACKETEND
):
1259 lexer
->token
.type
= cmListFileLexer_Token_BadBracket
;
1267 lexer
->token
.type
= cmListFileLexer_Token_ArgumentUnquoted
;
1268 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1269 lexer
->column
+= yyleng
;
1276 lexer
->token
.type
= cmListFileLexer_Token_ArgumentUnquoted
;
1277 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1278 lexer
->column
+= yyleng
;
1285 lexer
->token
.type
= cmListFileLexer_Token_ArgumentUnquoted
;
1286 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1287 lexer
->column
+= yyleng
;
1294 lexer
->token
.type
= cmListFileLexer_Token_ArgumentQuoted
;
1295 cmListFileLexerSetToken(lexer
, "", 0);
1296 lexer
->column
+= yyleng
;
1303 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1304 lexer
->column
+= yyleng
;
1308 /* rule 18 can match eol */
1311 /* Continuation: text is not part of string */
1317 /* rule 19 can match eol */
1320 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1328 lexer
->column
+= yyleng
;
1336 cmListFileLexerAppend(lexer
, yytext
, yyleng
);
1337 lexer
->column
+= yyleng
;
1340 case YY_STATE_EOF(STRING
):
1342 lexer
->token
.type
= cmListFileLexer_Token_BadString
;
1350 lexer
->token
.type
= cmListFileLexer_Token_Space
;
1351 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1352 lexer
->column
+= yyleng
;
1359 lexer
->token
.type
= cmListFileLexer_Token_BadCharacter
;
1360 cmListFileLexerSetToken(lexer
, yytext
, yyleng
);
1361 lexer
->column
+= yyleng
;
1365 case YY_STATE_EOF(INITIAL
):
1366 case YY_STATE_EOF(COMMENT
):
1368 lexer
->token
.type
= cmListFileLexer_Token_None
;
1369 cmListFileLexerSetToken(lexer
, 0, 0);
1378 case YY_END_OF_BUFFER
:
1380 /* Amount of text matched not including the EOB char. */
1381 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
1383 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1384 *yy_cp
= yyg
->yy_hold_char
;
1385 YY_RESTORE_YY_MORE_OFFSET
1387 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1389 /* We're scanning a new file or input source. It's
1390 * possible that this happened because the user
1391 * just pointed yyin at a new source and called
1392 * yylex(). If so, then we have to assure
1393 * consistency between YY_CURRENT_BUFFER and our
1394 * globals. Here is the right place to do so, because
1395 * this is the first action (other than possibly a
1396 * back-up) that will match for the new input source.
1398 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1399 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
1400 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1403 /* Note that here we test for yy_c_buf_p "<=" to the position
1404 * of the first EOB in the buffer, since yy_c_buf_p will
1405 * already have been incremented past the NUL character
1406 * (since all states make transitions on EOB to the
1407 * end-of-buffer state). Contrast this with the test
1410 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1411 { /* This was really a NUL. */
1412 yy_state_type yy_next_state
;
1414 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1416 yy_current_state
= yy_get_previous_state( yyscanner
);
1418 /* Okay, we're now positioned to make the NUL
1419 * transition. We couldn't have
1420 * yy_get_previous_state() go ahead and do it
1421 * for us because it doesn't know how to deal
1422 * with the possibility of jamming (and we don't
1423 * want to build jamming into it because then it
1424 * will run more slowly).
1427 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
1429 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1431 if ( yy_next_state
)
1433 /* Consume the NUL. */
1434 yy_cp
= ++yyg
->yy_c_buf_p
;
1435 yy_current_state
= yy_next_state
;
1441 yy_cp
= yyg
->yy_c_buf_p
;
1442 goto yy_find_action
;
1446 else switch ( yy_get_next_buffer( yyscanner
) )
1448 case EOB_ACT_END_OF_FILE
:
1450 yyg
->yy_did_buffer_switch_on_eof
= 0;
1452 if ( yywrap( yyscanner
) )
1454 /* Note: because we've taken care in
1455 * yy_get_next_buffer() to have set up
1456 * yytext, we can now set up
1457 * yy_c_buf_p so that if some total
1458 * hoser (like flex itself) wants to
1459 * call the scanner after we return the
1460 * YY_NULL, it'll still work - another
1461 * YY_NULL will get returned.
1463 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1465 yy_act
= YY_STATE_EOF(YY_START
);
1471 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1477 case EOB_ACT_CONTINUE_SCAN
:
1479 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1481 yy_current_state
= yy_get_previous_state( yyscanner
);
1483 yy_cp
= yyg
->yy_c_buf_p
;
1484 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1487 case EOB_ACT_LAST_MATCH
:
1489 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
1491 yy_current_state
= yy_get_previous_state( yyscanner
);
1493 yy_cp
= yyg
->yy_c_buf_p
;
1494 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1495 goto yy_find_action
;
1502 "fatal flex scanner internal error--no action found" );
1503 } /* end of action switch */
1504 } /* end of scanning one token */
1505 } /* end of user's declarations */
1506 } /* end of yylex */
1508 /* yy_get_next_buffer - try to read in a new buffer
1510 * Returns a code representing an action:
1511 * EOB_ACT_LAST_MATCH -
1512 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1513 * EOB_ACT_END_OF_FILE - end of file
1515 static int yy_get_next_buffer (yyscan_t yyscanner
)
1517 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1518 char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1519 char *source
= yyg
->yytext_ptr
;
1520 int number_to_move
, i
;
1523 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
1525 "fatal flex scanner internal error--end of buffer missed" );
1527 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1528 { /* Don't try to fill the buffer, so this is an EOF. */
1529 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
1531 /* We matched a single character, the EOB, so
1532 * treat this as a final EOF.
1534 return EOB_ACT_END_OF_FILE
;
1539 /* We matched some text prior to the EOB, first
1542 return EOB_ACT_LAST_MATCH
;
1546 /* Try to read more data. */
1548 /* First move last chars to start of buffer. */
1549 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- 1);
1551 for ( i
= 0; i
< number_to_move
; ++i
)
1552 *(dest
++) = *(source
++);
1554 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1555 /* don't do the read, it's not guaranteed to return an EOF,
1558 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
1563 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1565 while ( num_to_read
<= 0 )
1566 { /* Not enough room in the buffer - grow it. */
1568 /* just a shorter name for the current buffer */
1569 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER_LVALUE
;
1571 int yy_c_buf_p_offset
=
1572 (int) (yyg
->yy_c_buf_p
- b
->yy_ch_buf
);
1574 if ( b
->yy_is_our_buffer
)
1576 int new_size
= b
->yy_buf_size
* 2;
1578 if ( new_size
<= 0 )
1579 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1581 b
->yy_buf_size
*= 2;
1583 b
->yy_ch_buf
= (char *)
1584 /* Include room in for 2 EOB chars. */
1585 yyrealloc( (void *) b
->yy_ch_buf
,
1586 (yy_size_t
) (b
->yy_buf_size
+ 2) , yyscanner
);
1589 /* Can't grow it, we don't own it. */
1590 b
->yy_ch_buf
= NULL
;
1592 if ( ! b
->yy_ch_buf
)
1594 "fatal error - scanner input buffer overflow" );
1596 yyg
->yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1598 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1603 if ( num_to_read
> YY_READ_BUF_SIZE
)
1604 num_to_read
= YY_READ_BUF_SIZE
;
1606 /* Read in more data. */
1607 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1608 yyg
->yy_n_chars
, num_to_read
);
1610 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1613 if ( yyg
->yy_n_chars
== 0 )
1615 if ( number_to_move
== YY_MORE_ADJ
)
1617 ret_val
= EOB_ACT_END_OF_FILE
;
1618 yyrestart( yyin
, yyscanner
);
1623 ret_val
= EOB_ACT_LAST_MATCH
;
1624 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1625 YY_BUFFER_EOF_PENDING
;
1630 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1632 if ((yyg
->yy_n_chars
+ number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1633 /* Extend the array by 50%, plus the number we really need. */
1634 int new_size
= yyg
->yy_n_chars
+ number_to_move
+ (yyg
->yy_n_chars
>> 1);
1635 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) yyrealloc(
1636 (void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
, (yy_size_t
) new_size
, yyscanner
);
1637 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1638 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1639 /* "- 2" to take care of EOB's */
1640 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
= (int) (new_size
- 2);
1643 yyg
->yy_n_chars
+= number_to_move
;
1644 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1645 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1647 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1652 /* yy_get_previous_state - get the state just before the EOB char was reached */
1654 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
1656 yy_state_type yy_current_state
;
1658 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1660 yy_current_state
= yyg
->yy_start
;
1662 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
1664 YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 16);
1665 if ( yy_accept
[yy_current_state
] )
1667 yyg
->yy_last_accepting_state
= yy_current_state
;
1668 yyg
->yy_last_accepting_cpos
= yy_cp
;
1670 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1672 yy_current_state
= (int) yy_def
[yy_current_state
];
1673 if ( yy_current_state
>= 79 )
1674 yy_c
= yy_meta
[yy_c
];
1676 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + yy_c
];
1679 return yy_current_state
;
1682 /* yy_try_NUL_trans - try to make a transition on the NUL character
1685 * next_state = yy_try_NUL_trans( current_state );
1687 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
1690 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
; /* This var may be unused depending upon options. */
1691 char *yy_cp
= yyg
->yy_c_buf_p
;
1694 if ( yy_accept
[yy_current_state
] )
1696 yyg
->yy_last_accepting_state
= yy_current_state
;
1697 yyg
->yy_last_accepting_cpos
= yy_cp
;
1699 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1701 yy_current_state
= (int) yy_def
[yy_current_state
];
1702 if ( yy_current_state
>= 79 )
1703 yy_c
= yy_meta
[yy_c
];
1705 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + yy_c
];
1706 yy_is_jam
= (yy_current_state
== 78);
1709 return yy_is_jam
? 0 : yy_current_state
;
1714 static void yyunput (int c
, char * yy_bp
, yyscan_t yyscanner
)
1717 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1719 yy_cp
= yyg
->yy_c_buf_p
;
1721 /* undo effects of setting up yytext */
1722 *yy_cp
= yyg
->yy_hold_char
;
1724 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1725 { /* need to shift things up to make room */
1726 /* +2 for EOB chars. */
1727 int number_to_move
= yyg
->yy_n_chars
+ 2;
1728 char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1729 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1731 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1733 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1734 *--dest
= *--source
;
1736 yy_cp
+= (int) (dest
- source
);
1737 yy_bp
+= (int) (dest
- source
);
1738 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1739 yyg
->yy_n_chars
= (int) YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1741 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1742 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1745 *--yy_cp
= (char) c
;
1751 yyg
->yytext_ptr
= yy_bp
;
1752 yyg
->yy_hold_char
= *yy_cp
;
1753 yyg
->yy_c_buf_p
= yy_cp
;
1760 static int yyinput (yyscan_t yyscanner
)
1762 static int input (yyscan_t yyscanner
)
1767 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1769 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1771 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1773 /* yy_c_buf_p now points to the character we want to return.
1774 * If this occurs *before* the EOB characters, then it's a
1775 * valid NUL; if not, then we've hit the end of the buffer.
1777 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1778 /* This was really a NUL. */
1779 *yyg
->yy_c_buf_p
= '\0';
1782 { /* need more input */
1783 int offset
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
);
1786 switch ( yy_get_next_buffer( yyscanner
) )
1788 case EOB_ACT_LAST_MATCH
:
1789 /* This happens because yy_g_n_b()
1790 * sees that we've accumulated a
1791 * token and flags that we need to
1792 * try matching the token before
1793 * proceeding. But for input(),
1794 * there's no matching to consider.
1795 * So convert the EOB_ACT_LAST_MATCH
1796 * to EOB_ACT_END_OF_FILE.
1799 /* Reset buffer status. */
1800 yyrestart( yyin
, yyscanner
);
1804 case EOB_ACT_END_OF_FILE
:
1806 if ( yywrap( yyscanner
) )
1809 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1812 return yyinput(yyscanner
);
1814 return input(yyscanner
);
1818 case EOB_ACT_CONTINUE_SCAN
:
1819 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
1825 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
1826 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
1827 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
1838 #endif /* ifndef YY_NO_INPUT */
1840 /** Immediately switch to a different input stream.
1841 * @param input_file A readable stream.
1842 * @param yyscanner The scanner object.
1843 * @note This function does not reset the start condition to @c INITIAL .
1845 void yyrestart (FILE * input_file
, yyscan_t yyscanner
)
1847 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1849 if ( ! YY_CURRENT_BUFFER
){
1850 yyensure_buffer_stack (yyscanner
);
1851 YY_CURRENT_BUFFER_LVALUE
=
1852 yy_create_buffer( yyin
, YY_BUF_SIZE
, yyscanner
);
1855 yy_init_buffer( YY_CURRENT_BUFFER
, input_file
, yyscanner
);
1856 yy_load_buffer_state( yyscanner
);
1859 /** Switch to a different input buffer.
1860 * @param new_buffer The new input buffer.
1861 * @param yyscanner The scanner object.
1863 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1865 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1867 /* TODO. We should be able to replace this entire function body
1869 * yypop_buffer_state();
1870 * yypush_buffer_state(new_buffer);
1872 yyensure_buffer_stack (yyscanner
);
1873 if ( YY_CURRENT_BUFFER
== new_buffer
)
1876 if ( YY_CURRENT_BUFFER
)
1878 /* Flush out information for old buffer. */
1879 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1880 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
1881 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1884 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1885 yy_load_buffer_state( yyscanner
);
1887 /* We don't actually know whether we did this switch during
1888 * EOF (yywrap()) processing, but the only time this flag
1889 * is looked at is after yywrap() is called, so it's safe
1890 * to go ahead and always set it.
1892 yyg
->yy_did_buffer_switch_on_eof
= 1;
1895 static void yy_load_buffer_state (yyscan_t yyscanner
)
1897 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1898 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1899 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1900 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1901 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
1904 /** Allocate and initialize an input buffer state.
1905 * @param file A readable stream.
1906 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1907 * @param yyscanner The scanner object.
1908 * @return the allocated buffer state.
1910 YY_BUFFER_STATE
yy_create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
1914 b
= (YY_BUFFER_STATE
) yyalloc( sizeof( struct yy_buffer_state
) , yyscanner
);
1916 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1918 b
->yy_buf_size
= size
;
1920 /* yy_ch_buf has to be 2 characters longer than the size given because
1921 * we need to put in 2 end-of-buffer characters.
1923 b
->yy_ch_buf
= (char *) yyalloc( (yy_size_t
) (b
->yy_buf_size
+ 2) , yyscanner
);
1924 if ( ! b
->yy_ch_buf
)
1925 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1927 b
->yy_is_our_buffer
= 1;
1929 yy_init_buffer( b
, file
, yyscanner
);
1934 /** Destroy the buffer.
1935 * @param b a buffer created with yy_create_buffer()
1936 * @param yyscanner The scanner object.
1938 void yy_delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1940 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1945 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1946 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1948 if ( b
->yy_is_our_buffer
)
1949 yyfree( (void *) b
->yy_ch_buf
, yyscanner
);
1951 yyfree( (void *) b
, yyscanner
);
1954 /* Initializes or reinitializes a buffer.
1955 * This function is sometimes called more than once on the same buffer,
1956 * such as during a yyrestart() or at EOF.
1958 static void yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
1962 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1964 yy_flush_buffer( b
, yyscanner
);
1966 b
->yy_input_file
= file
;
1967 b
->yy_fill_buffer
= 1;
1969 /* If b is the current buffer, then yy_init_buffer was _probably_
1970 * called from yyrestart() or through yy_get_next_buffer.
1971 * In that case, we don't want to reset the lineno or column.
1973 if (b
!= YY_CURRENT_BUFFER
){
1974 b
->yy_bs_lineno
= 1;
1975 b
->yy_bs_column
= 0;
1978 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1983 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1984 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1985 * @param yyscanner The scanner object.
1987 void yy_flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1989 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1995 /* We always need two end-of-buffer characters. The first causes
1996 * a transition to the end-of-buffer state. The second causes
1997 * a jam in that state.
1999 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
2000 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
2002 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
2005 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2007 if ( b
== YY_CURRENT_BUFFER
)
2008 yy_load_buffer_state( yyscanner
);
2011 /** Pushes the new state onto the stack. The new state becomes
2012 * the current state. This function will allocate the stack
2014 * @param new_buffer The new state.
2015 * @param yyscanner The scanner object.
2017 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2019 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2020 if (new_buffer
== NULL
)
2023 yyensure_buffer_stack(yyscanner
);
2025 /* This block is copied from yy_switch_to_buffer. */
2026 if ( YY_CURRENT_BUFFER
)
2028 /* Flush out information for old buffer. */
2029 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2030 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2031 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2034 /* Only push if top exists. Otherwise, replace top. */
2035 if (YY_CURRENT_BUFFER
)
2036 yyg
->yy_buffer_stack_top
++;
2037 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2039 /* copied from yy_switch_to_buffer. */
2040 yy_load_buffer_state( yyscanner
);
2041 yyg
->yy_did_buffer_switch_on_eof
= 1;
2044 /** Removes and deletes the top of the stack, if present.
2045 * The next element becomes the new top.
2046 * @param yyscanner The scanner object.
2048 void yypop_buffer_state (yyscan_t yyscanner
)
2050 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2051 if (!YY_CURRENT_BUFFER
)
2054 yy_delete_buffer(YY_CURRENT_BUFFER
, yyscanner
);
2055 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2056 if (yyg
->yy_buffer_stack_top
> 0)
2057 --yyg
->yy_buffer_stack_top
;
2059 if (YY_CURRENT_BUFFER
) {
2060 yy_load_buffer_state( yyscanner
);
2061 yyg
->yy_did_buffer_switch_on_eof
= 1;
2065 /* Allocates the stack if it does not exist.
2066 * Guarantees space for at least one push.
2068 static void yyensure_buffer_stack (yyscan_t yyscanner
)
2070 yy_size_t num_to_alloc
;
2071 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2073 if (!yyg
->yy_buffer_stack
) {
2075 /* First allocation is just for 2 elements, since we don't know if this
2076 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2077 * immediate realloc on the next call.
2079 num_to_alloc
= 1; /* After all that talk, this was set to 1 anyways... */
2080 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)yyalloc
2081 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2083 if ( ! yyg
->yy_buffer_stack
)
2084 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2086 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2088 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2089 yyg
->yy_buffer_stack_top
= 0;
2093 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
2095 /* Increase the buffer to prepare for a possible push. */
2096 yy_size_t grow_size
= 8 /* arbitrary grow size */;
2098 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
2099 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)yyrealloc
2100 (yyg
->yy_buffer_stack
,
2101 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2103 if ( ! yyg
->yy_buffer_stack
)
2104 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2106 /* zero only the new slots.*/
2107 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
2108 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2112 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2113 * @param base the character buffer
2114 * @param size the size in bytes of the character buffer
2115 * @param yyscanner The scanner object.
2116 * @return the newly allocated buffer state object.
2118 YY_BUFFER_STATE
yy_scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
2123 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2124 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2125 /* They forgot to leave room for the EOB's. */
2128 b
= (YY_BUFFER_STATE
) yyalloc( sizeof( struct yy_buffer_state
) , yyscanner
);
2130 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2132 b
->yy_buf_size
= (int) (size
- 2); /* "- 2" to take care of EOB's */
2133 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2134 b
->yy_is_our_buffer
= 0;
2135 b
->yy_input_file
= NULL
;
2136 b
->yy_n_chars
= b
->yy_buf_size
;
2137 b
->yy_is_interactive
= 0;
2139 b
->yy_fill_buffer
= 0;
2140 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2142 yy_switch_to_buffer( b
, yyscanner
);
2147 /** Setup the input buffer state to scan a string. The next call to yylex() will
2148 * scan from a @e copy of @a str.
2149 * @param yystr a NUL-terminated string to scan
2150 * @param yyscanner The scanner object.
2151 * @return the newly allocated buffer state object.
2152 * @note If you want to scan bytes that may contain NUL values, then use
2153 * yy_scan_bytes() instead.
2155 YY_BUFFER_STATE
yy_scan_string (const char * yystr
, yyscan_t yyscanner
)
2158 return yy_scan_bytes( yystr
, (int) strlen(yystr
) , yyscanner
);
2161 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2162 * scan from a @e copy of @a bytes.
2163 * @param yybytes the byte buffer to scan
2164 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2165 * @param yyscanner The scanner object.
2166 * @return the newly allocated buffer state object.
2168 YY_BUFFER_STATE
yy_scan_bytes (const char * yybytes
, int _yybytes_len
, yyscan_t yyscanner
)
2175 /* Get memory for full buffer, including space for trailing EOB's. */
2176 n
= (yy_size_t
) (_yybytes_len
+ 2);
2177 buf
= (char *) yyalloc( n
, yyscanner
);
2179 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2181 for ( i
= 0; i
< _yybytes_len
; ++i
)
2182 buf
[i
] = yybytes
[i
];
2184 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2186 b
= yy_scan_buffer( buf
, n
, yyscanner
);
2188 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2190 /* It's okay to grow etc. this buffer, and we should throw it
2191 * away when we're done.
2193 b
->yy_is_our_buffer
= 1;
2198 #ifndef YY_EXIT_FAILURE
2199 #define YY_EXIT_FAILURE 2
2202 static void yynoreturn
yy_fatal_error (const char* msg
, yyscan_t yyscanner
)
2204 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2206 fprintf( stderr
, "%s\n", msg
);
2207 exit( YY_EXIT_FAILURE
);
2210 /* Redefine yyless() so it works in section 3 code. */
2216 /* Undo effects of setting up yytext. */ \
2217 int yyless_macro_arg = (n); \
2218 YY_LESS_LINENO(yyless_macro_arg);\
2219 yytext[yyleng] = yyg->yy_hold_char; \
2220 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2221 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2222 *yyg->yy_c_buf_p = '\0'; \
2223 yyleng = yyless_macro_arg; \
2227 /* Accessor methods (get/set functions) to struct members. */
2229 /** Get the user-defined data for this scanner.
2230 * @param yyscanner The scanner object.
2232 YY_EXTRA_TYPE
yyget_extra (yyscan_t yyscanner
)
2234 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2238 /** Get the current line number.
2239 * @param yyscanner The scanner object.
2241 int yyget_lineno (yyscan_t yyscanner
)
2243 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2245 if (! YY_CURRENT_BUFFER
)
2251 /** Get the current column number.
2252 * @param yyscanner The scanner object.
2254 int yyget_column (yyscan_t yyscanner
)
2256 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2258 if (! YY_CURRENT_BUFFER
)
2264 /** Get the input stream.
2265 * @param yyscanner The scanner object.
2267 FILE *yyget_in (yyscan_t yyscanner
)
2269 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2273 /** Get the output stream.
2274 * @param yyscanner The scanner object.
2276 FILE *yyget_out (yyscan_t yyscanner
)
2278 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2282 /** Get the length of the current token.
2283 * @param yyscanner The scanner object.
2285 int yyget_leng (yyscan_t yyscanner
)
2287 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2291 /** Get the current token.
2292 * @param yyscanner The scanner object.
2295 char *yyget_text (yyscan_t yyscanner
)
2297 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2301 /** Set the user-defined data. This data is never touched by the scanner.
2302 * @param user_defined The data to be associated with this scanner.
2303 * @param yyscanner The scanner object.
2305 void yyset_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
2307 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2308 yyextra
= user_defined
;
2311 /** Set the current line number.
2312 * @param _line_number line number
2313 * @param yyscanner The scanner object.
2315 void yyset_lineno (int _line_number
, yyscan_t yyscanner
)
2317 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2319 /* lineno is only valid if an input buffer exists. */
2320 if (! YY_CURRENT_BUFFER
)
2321 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2323 yylineno
= _line_number
;
2326 /** Set the current column.
2327 * @param _column_no column number
2328 * @param yyscanner The scanner object.
2330 void yyset_column (int _column_no
, yyscan_t yyscanner
)
2332 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2334 /* column is only valid if an input buffer exists. */
2335 if (! YY_CURRENT_BUFFER
)
2336 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2338 yycolumn
= _column_no
;
2341 /** Set the input stream. This does not discard the current
2343 * @param _in_str A readable stream.
2344 * @param yyscanner The scanner object.
2345 * @see yy_switch_to_buffer
2347 void yyset_in (FILE * _in_str
, yyscan_t yyscanner
)
2349 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2353 void yyset_out (FILE * _out_str
, yyscan_t yyscanner
)
2355 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2359 int yyget_debug (yyscan_t yyscanner
)
2361 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2362 return yy_flex_debug
;
2365 void yyset_debug (int _bdebug
, yyscan_t yyscanner
)
2367 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2368 yy_flex_debug
= _bdebug
;
2371 /* Accessor methods for yylval and yylloc */
2373 /* User-visible API */
2375 /* yylex_init is special because it creates the scanner itself, so it is
2376 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2377 * That's why we explicitly handle the declaration, instead of using our macros.
2379 int yylex_init(yyscan_t
* ptr_yy_globals
)
2381 if (ptr_yy_globals
== NULL
){
2386 *ptr_yy_globals
= (yyscan_t
) yyalloc ( sizeof( struct yyguts_t
), NULL
);
2388 if (*ptr_yy_globals
== NULL
){
2393 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2394 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2396 return yy_init_globals ( *ptr_yy_globals
);
2399 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2400 * convention of taking the scanner as the last argument. Note however, that
2401 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2402 * is the reason, too, why this function also must handle its own declaration).
2403 * The user defined value in the first argument will be available to yyalloc in
2404 * the yyextra field.
2406 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined
, yyscan_t
* ptr_yy_globals
)
2408 struct yyguts_t dummy_yyguts
;
2410 yyset_extra (yy_user_defined
, &dummy_yyguts
);
2412 if (ptr_yy_globals
== NULL
){
2417 *ptr_yy_globals
= (yyscan_t
) yyalloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
2419 if (*ptr_yy_globals
== NULL
){
2424 /* By setting to 0xAA, we expose bugs in
2425 yy_init_globals. Leave at 0x00 for releases. */
2426 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2428 yyset_extra (yy_user_defined
, *ptr_yy_globals
);
2430 return yy_init_globals ( *ptr_yy_globals
);
2433 static int yy_init_globals (yyscan_t yyscanner
)
2435 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2436 /* Initialization is the same as for the non-reentrant scanner.
2437 * This function is called from yylex_destroy(), so don't allocate here.
2440 yyg
->yy_buffer_stack
= NULL
;
2441 yyg
->yy_buffer_stack_top
= 0;
2442 yyg
->yy_buffer_stack_max
= 0;
2443 yyg
->yy_c_buf_p
= NULL
;
2447 yyg
->yy_start_stack_ptr
= 0;
2448 yyg
->yy_start_stack_depth
= 0;
2449 yyg
->yy_start_stack
= NULL
;
2451 /* Defined in main.c */
2460 /* For future reference: Set errno on error, since we are called by
2466 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2467 int yylex_destroy (yyscan_t yyscanner
)
2469 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2471 /* Pop the buffer stack, destroying each element. */
2472 while(YY_CURRENT_BUFFER
){
2473 yy_delete_buffer( YY_CURRENT_BUFFER
, yyscanner
);
2474 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2475 yypop_buffer_state(yyscanner
);
2478 /* Destroy the stack itself. */
2479 yyfree(yyg
->yy_buffer_stack
, yyscanner
);
2480 yyg
->yy_buffer_stack
= NULL
;
2482 /* Destroy the start condition stack. */
2483 yyfree( yyg
->yy_start_stack
, yyscanner
);
2484 yyg
->yy_start_stack
= NULL
;
2486 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2487 * yylex() is called, initialization will occur. */
2488 yy_init_globals( yyscanner
);
2490 /* Destroy the main struct (reentrant only). */
2491 yyfree ( yyscanner
, yyscanner
);
2497 * Internal utility routines.
2501 static void yy_flex_strncpy (char* s1
, const char * s2
, int n
, yyscan_t yyscanner
)
2503 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2507 for ( i
= 0; i
< n
; ++i
)
2512 #ifdef YY_NEED_STRLEN
2513 static int yy_flex_strlen (const char * s
, yyscan_t yyscanner
)
2516 for ( n
= 0; s
[n
]; ++n
)
2523 void *yyalloc (yy_size_t size
, yyscan_t yyscanner
)
2525 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2527 return malloc(size
);
2530 void *yyrealloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
2532 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2535 /* The cast to (char *) in the following accommodates both
2536 * implementations that use char* generic pointers, and those
2537 * that use void* generic pointers. It works with the latter
2538 * because both ANSI C and C++ allow castless assignment from
2539 * any pointer type to void*, and deal with argument conversions
2540 * as though doing an assignment.
2542 return realloc(ptr
, size
);
2545 void yyfree (void * ptr
, yyscan_t yyscanner
)
2547 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2549 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
2552 #define YYTABLES_NAME "yytables"
2554 /*--------------------------------------------------------------------------*/
2555 static void cmListFileLexerSetToken(cmListFileLexer
* lexer
, const char* text
,
2558 /* Set the token line and column number. */
2559 lexer
->token
.line
= lexer
->line
;
2560 lexer
->token
.column
= lexer
->column
;
2562 /* Use the same buffer if possible. */
2563 if (lexer
->token
.text
) {
2564 if (text
&& length
< lexer
->size
) {
2565 strcpy(lexer
->token
.text
, text
);
2566 lexer
->token
.length
= length
;
2569 free(lexer
->token
.text
);
2570 lexer
->token
.text
= 0;
2574 /* Need to extend the buffer. */
2576 lexer
->token
.text
= strdup(text
);
2577 lexer
->token
.length
= length
;
2578 lexer
->size
= length
+ 1;
2580 lexer
->token
.length
= 0;
2584 /*--------------------------------------------------------------------------*/
2585 static void cmListFileLexerAppend(cmListFileLexer
* lexer
, const char* text
,
2591 /* If the appended text will fit in the buffer, do not reallocate. */
2592 newSize
= lexer
->token
.length
+ length
+ 1;
2593 if (lexer
->token
.text
&& newSize
<= lexer
->size
) {
2594 strcpy(lexer
->token
.text
+ lexer
->token
.length
, text
);
2595 lexer
->token
.length
+= length
;
2599 /* We need to extend the buffer. */
2600 temp
= malloc(newSize
);
2601 if (lexer
->token
.text
) {
2602 memcpy(temp
, lexer
->token
.text
, lexer
->token
.length
);
2603 free(lexer
->token
.text
);
2605 memcpy(temp
+ lexer
->token
.length
, text
, length
);
2606 temp
[lexer
->token
.length
+ length
] = 0;
2607 lexer
->token
.text
= temp
;
2608 lexer
->token
.length
+= length
;
2609 lexer
->size
= newSize
;
2612 /*--------------------------------------------------------------------------*/
2613 static int cmListFileLexerInput(cmListFileLexer
* lexer
, char* buffer
,
2618 /* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
2619 does not convert newlines on all platforms. Move any
2620 trailing CR to the start of the buffer for the next read. */
2621 size_t cr
= lexer
->cr
;
2624 n
= fread(buffer
+ cr
, 1, bufferSize
- cr
, lexer
->file
);
2627 const char* i
= buffer
;
2630 cr
= (buffer
[n
- 1] == '\r') ? 1 : 0;
2631 e
= buffer
+ n
- cr
;
2633 if (i
[0] == '\r' && i
[1] == '\n') {
2645 } else if (lexer
->string_left
) {
2646 int length
= lexer
->string_left
;
2647 if ((int)bufferSize
< length
) {
2648 length
= (int)bufferSize
;
2650 memcpy(buffer
, lexer
->string_position
, length
);
2651 lexer
->string_position
+= length
;
2652 lexer
->string_left
-= length
;
2659 /*--------------------------------------------------------------------------*/
2660 static void cmListFileLexerInit(cmListFileLexer
* lexer
)
2662 if (lexer
->file
|| lexer
->string_buffer
) {
2663 cmListFileLexer_yylex_init(&lexer
->scanner
);
2664 cmListFileLexer_yyset_extra(lexer
, lexer
->scanner
);
2668 /*--------------------------------------------------------------------------*/
2669 static void cmListFileLexerDestroy(cmListFileLexer
* lexer
)
2671 cmListFileLexerSetToken(lexer
, 0, 0);
2672 if (lexer
->file
|| lexer
->string_buffer
) {
2673 cmListFileLexer_yylex_destroy(lexer
->scanner
);
2675 fclose(lexer
->file
);
2678 if (lexer
->string_buffer
) {
2679 free(lexer
->string_buffer
);
2680 lexer
->string_buffer
= 0;
2681 lexer
->string_left
= 0;
2682 lexer
->string_position
= 0;
2687 /*--------------------------------------------------------------------------*/
2688 cmListFileLexer
* cmListFileLexer_New(void)
2690 cmListFileLexer
* lexer
= (cmListFileLexer
*)malloc(sizeof(cmListFileLexer
));
2694 memset(lexer
, 0, sizeof(*lexer
));
2700 /*--------------------------------------------------------------------------*/
2701 void cmListFileLexer_Delete(cmListFileLexer
* lexer
)
2703 cmListFileLexer_SetFileName(lexer
, 0, 0);
2707 /*--------------------------------------------------------------------------*/
2708 static cmListFileLexer_BOM
cmListFileLexer_ReadBOM(FILE* f
)
2711 if (fread(b
, 1, 2, f
) == 2) {
2712 if (b
[0] == 0xEF && b
[1] == 0xBB) {
2713 if (fread(b
, 1, 1, f
) == 1 && b
[0] == 0xBF) {
2714 return cmListFileLexer_BOM_UTF8
;
2716 } else if (b
[0] == 0xFE && b
[1] == 0xFF) {
2718 return cmListFileLexer_BOM_UTF16BE
;
2719 } else if (b
[0] == 0 && b
[1] == 0) {
2720 if (fread(b
, 1, 2, f
) == 2 && b
[0] == 0xFE && b
[1] == 0xFF) {
2721 return cmListFileLexer_BOM_UTF32BE
;
2723 } else if (b
[0] == 0xFF && b
[1] == 0xFE) {
2726 if (fread(b
, 1, 2, f
) == 2 && b
[0] == 0 && b
[1] == 0) {
2727 return cmListFileLexer_BOM_UTF32LE
;
2729 if (fsetpos(f
, &p
) != 0) {
2730 return cmListFileLexer_BOM_Broken
;
2732 return cmListFileLexer_BOM_UTF16LE
;
2735 if (fseek(f
, 0, SEEK_SET
) != 0) {
2736 return cmListFileLexer_BOM_Broken
;
2738 return cmListFileLexer_BOM_None
;
2741 /*--------------------------------------------------------------------------*/
2742 int cmListFileLexer_SetFileName(cmListFileLexer
* lexer
, const char* name
,
2743 cmListFileLexer_BOM
* bom
)
2746 cmListFileLexerDestroy(lexer
);
2749 wchar_t* wname
= cmsysEncoding_DupToWide(name
);
2750 lexer
->file
= _wfopen(wname
, L
"rb");
2753 lexer
->file
= fopen(name
, "rb");
2757 *bom
= cmListFileLexer_ReadBOM(lexer
->file
);
2763 cmListFileLexerInit(lexer
);
2767 /*--------------------------------------------------------------------------*/
2768 int cmListFileLexer_SetString(cmListFileLexer
* lexer
, const char* text
)
2771 cmListFileLexerDestroy(lexer
);
2773 int length
= (int)strlen(text
);
2774 lexer
->string_buffer
= (char*)malloc(length
+ 1);
2775 if (lexer
->string_buffer
) {
2776 strcpy(lexer
->string_buffer
, text
);
2777 lexer
->string_position
= lexer
->string_buffer
;
2778 lexer
->string_left
= length
;
2783 cmListFileLexerInit(lexer
);
2787 /*--------------------------------------------------------------------------*/
2788 cmListFileLexer_Token
* cmListFileLexer_Scan(cmListFileLexer
* lexer
)
2790 if (!lexer
->file
&& !lexer
->string_buffer
) {
2793 if (cmListFileLexer_yylex(lexer
->scanner
, lexer
)) {
2794 return &lexer
->token
;
2796 cmListFileLexer_SetFileName(lexer
, 0, 0);
2801 /*--------------------------------------------------------------------------*/
2802 long cmListFileLexer_GetCurrentLine(cmListFileLexer
* lexer
)
2807 /*--------------------------------------------------------------------------*/
2808 long cmListFileLexer_GetCurrentColumn(cmListFileLexer
* lexer
)
2810 return lexer
->column
;
2813 /*--------------------------------------------------------------------------*/
2814 const char* cmListFileLexer_GetTypeAsString(cmListFileLexer
* lexer
,
2815 cmListFileLexer_Type type
)
2819 case cmListFileLexer_Token_None
:
2821 case cmListFileLexer_Token_Space
:
2823 case cmListFileLexer_Token_Newline
:
2825 case cmListFileLexer_Token_Identifier
:
2826 return "identifier";
2827 case cmListFileLexer_Token_ParenLeft
:
2828 return "left paren";
2829 case cmListFileLexer_Token_ParenRight
:
2830 return "right paren";
2831 case cmListFileLexer_Token_ArgumentUnquoted
:
2832 return "unquoted argument";
2833 case cmListFileLexer_Token_ArgumentQuoted
:
2834 return "quoted argument";
2835 case cmListFileLexer_Token_ArgumentBracket
:
2836 return "bracket argument";
2837 case cmListFileLexer_Token_CommentBracket
:
2838 return "bracket comment";
2839 case cmListFileLexer_Token_BadCharacter
:
2840 return "bad character";
2841 case cmListFileLexer_Token_BadBracket
:
2842 return "unterminated bracket";
2843 case cmListFileLexer_Token_BadString
:
2844 return "unterminated string";
2846 return "unknown token";