1 #line 1 "cpp.c"
2 /*
3 * Copyright (c) 2002, 2004 Tama Communications Corporation
4 *
5 * This file is part of GNU GLOBAL.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 /*
22 * scanner for C++ source code.
23 */
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 #include <stdio.h>
28 #ifdef STDC_HEADERS
29 #include <stdlib.h>
30 #endif
31 #include "global.h"
32 #include "anchor.h"
33 #include "incop.h"
34 #include "common.h"
35 #include "htags.h"
36 #include "../libparser/cpp_res.h"
37
38 #define lex_symbol_generation_rule(x) cpp_ ## x
39 #include "lexcommon.h"
40
41 #ifdef ECHO
42 #undef ECHO
43 #endif
44 #define ECHO echos(LEXTEXT)
45
46 #define YY_USER_ACTION DEFAULT_YY_USER_ACTION
47
48 static int last_directive;
49
50 #line 50 "cpp.c"
51
52 #define YY_INT_ALIGNED short int
53
54 /* A lexical scanner generated by flex */
55
56 #define yy_create_buffer cpp__create_buffer
57 #define yy_delete_buffer cpp__delete_buffer
58 #define yy_scan_buffer cpp__scan_buffer
59 #define yy_scan_string cpp__scan_string
60 #define yy_scan_bytes cpp__scan_bytes
61 #define yy_init_buffer cpp__init_buffer
62 #define yy_flush_buffer cpp__flush_buffer
63 #define yy_load_buffer_state cpp__load_buffer_state
64 #define yy_switch_to_buffer cpp__switch_to_buffer
65 #define yypush_buffer_state cpp_push_buffer_state
66 #define yypop_buffer_state cpp_pop_buffer_state
67 #define yyensure_buffer_stack cpp_ensure_buffer_stack
68 #define yy_flex_debug cpp__flex_debug
69 #define yyin cpp_in
70 #define yyleng cpp_leng
71 #define yylex cpp_lex
72 #define yylineno cpp_lineno
73 #define yyout cpp_out
74 #define yyrestart cpp_restart
75 #define yytext cpp_text
76 #define yywrap cpp_wrap
77 #define yyalloc cpp_alloc
78 #define yyrealloc cpp_realloc
79 #define yyfree cpp_free
80
81 #define FLEX_SCANNER
82 #define YY_FLEX_MAJOR_VERSION 2
83 #define YY_FLEX_MINOR_VERSION 6
84 #define YY_FLEX_SUBMINOR_VERSION 4
85 #if YY_FLEX_SUBMINOR_VERSION > 0
86 #define FLEX_BETA
87 #endif
88
89 #ifdef yy_create_buffer
90 #define cpp__create_buffer_ALREADY_DEFINED
91 #else
92 #define yy_create_buffer cpp__create_buffer
93 #endif
94
95 #ifdef yy_delete_buffer
96 #define cpp__delete_buffer_ALREADY_DEFINED
97 #else
98 #define yy_delete_buffer cpp__delete_buffer
99 #endif
100
101 #ifdef yy_scan_buffer
102 #define cpp__scan_buffer_ALREADY_DEFINED
103 #else
104 #define yy_scan_buffer cpp__scan_buffer
105 #endif
106
107 #ifdef yy_scan_string
108 #define cpp__scan_string_ALREADY_DEFINED
109 #else
110 #define yy_scan_string cpp__scan_string
111 #endif
112
113 #ifdef yy_scan_bytes
114 #define cpp__scan_bytes_ALREADY_DEFINED
115 #else
116 #define yy_scan_bytes cpp__scan_bytes
117 #endif
118
119 #ifdef yy_init_buffer
120 #define cpp__init_buffer_ALREADY_DEFINED
121 #else
122 #define yy_init_buffer cpp__init_buffer
123 #endif
124
125 #ifdef yy_flush_buffer
126 #define cpp__flush_buffer_ALREADY_DEFINED
127 #else
128 #define yy_flush_buffer cpp__flush_buffer
129 #endif
130
131 #ifdef yy_load_buffer_state
132 #define cpp__load_buffer_state_ALREADY_DEFINED
133 #else
134 #define yy_load_buffer_state cpp__load_buffer_state
135 #endif
136
137 #ifdef yy_switch_to_buffer
138 #define cpp__switch_to_buffer_ALREADY_DEFINED
139 #else
140 #define yy_switch_to_buffer cpp__switch_to_buffer
141 #endif
142
143 #ifdef yypush_buffer_state
144 #define cpp_push_buffer_state_ALREADY_DEFINED
145 #else
146 #define yypush_buffer_state cpp_push_buffer_state
147 #endif
148
149 #ifdef yypop_buffer_state
150 #define cpp_pop_buffer_state_ALREADY_DEFINED
151 #else
152 #define yypop_buffer_state cpp_pop_buffer_state
153 #endif
154
155 #ifdef yyensure_buffer_stack
156 #define cpp_ensure_buffer_stack_ALREADY_DEFINED
157 #else
158 #define yyensure_buffer_stack cpp_ensure_buffer_stack
159 #endif
160
161 #ifdef yylex
162 #define cpp_lex_ALREADY_DEFINED
163 #else
164 #define yylex cpp_lex
165 #endif
166
167 #ifdef yyrestart
168 #define cpp_restart_ALREADY_DEFINED
169 #else
170 #define yyrestart cpp_restart
171 #endif
172
173 #ifdef yylex_init
174 #define cpp_lex_init_ALREADY_DEFINED
175 #else
176 #define yylex_init cpp_lex_init
177 #endif
178
179 #ifdef yylex_init_extra
180 #define cpp_lex_init_extra_ALREADY_DEFINED
181 #else
182 #define yylex_init_extra cpp_lex_init_extra
183 #endif
184
185 #ifdef yylex_destroy
186 #define cpp_lex_destroy_ALREADY_DEFINED
187 #else
188 #define yylex_destroy cpp_lex_destroy
189 #endif
190
191 #ifdef yyget_debug
192 #define cpp_get_debug_ALREADY_DEFINED
193 #else
194 #define yyget_debug cpp_get_debug
195 #endif
196
197 #ifdef yyset_debug
198 #define cpp_set_debug_ALREADY_DEFINED
199 #else
200 #define yyset_debug cpp_set_debug
201 #endif
202
203 #ifdef yyget_extra
204 #define cpp_get_extra_ALREADY_DEFINED
205 #else
206 #define yyget_extra cpp_get_extra
207 #endif
208
209 #ifdef yyset_extra
210 #define cpp_set_extra_ALREADY_DEFINED
211 #else
212 #define yyset_extra cpp_set_extra
213 #endif
214
215 #ifdef yyget_in
216 #define cpp_get_in_ALREADY_DEFINED
217 #else
218 #define yyget_in cpp_get_in
219 #endif
220
221 #ifdef yyset_in
222 #define cpp_set_in_ALREADY_DEFINED
223 #else
224 #define yyset_in cpp_set_in
225 #endif
226
227 #ifdef yyget_out
228 #define cpp_get_out_ALREADY_DEFINED
229 #else
230 #define yyget_out cpp_get_out
231 #endif
232
233 #ifdef yyset_out
234 #define cpp_set_out_ALREADY_DEFINED
235 #else
236 #define yyset_out cpp_set_out
237 #endif
238
239 #ifdef yyget_leng
240 #define cpp_get_leng_ALREADY_DEFINED
241 #else
242 #define yyget_leng cpp_get_leng
243 #endif
244
245 #ifdef yyget_text
246 #define cpp_get_text_ALREADY_DEFINED
247 #else
248 #define yyget_text cpp_get_text
249 #endif
250
251 #ifdef yyget_lineno
252 #define cpp_get_lineno_ALREADY_DEFINED
253 #else
254 #define yyget_lineno cpp_get_lineno
255 #endif
256
257 #ifdef yyset_lineno
258 #define cpp_set_lineno_ALREADY_DEFINED
259 #else
260 #define yyset_lineno cpp_set_lineno
261 #endif
262
263 #ifdef yywrap
264 #define cpp_wrap_ALREADY_DEFINED
265 #else
266 #define yywrap cpp_wrap
267 #endif
268
269 #ifdef yyalloc
270 #define cpp_alloc_ALREADY_DEFINED
271 #else
272 #define yyalloc cpp_alloc
273 #endif
274
275 #ifdef yyrealloc
276 #define cpp_realloc_ALREADY_DEFINED
277 #else
278 #define yyrealloc cpp_realloc
279 #endif
280
281 #ifdef yyfree
282 #define cpp_free_ALREADY_DEFINED
283 #else
284 #define yyfree cpp_free
285 #endif
286
287 #ifdef yytext
288 #define cpp_text_ALREADY_DEFINED
289 #else
290 #define yytext cpp_text
291 #endif
292
293 #ifdef yyleng
294 #define cpp_leng_ALREADY_DEFINED
295 #else
296 #define yyleng cpp_leng
297 #endif
298
299 #ifdef yyin
300 #define cpp_in_ALREADY_DEFINED
301 #else
302 #define yyin cpp_in
303 #endif
304
305 #ifdef yyout
306 #define cpp_out_ALREADY_DEFINED
307 #else
308 #define yyout cpp_out
309 #endif
310
311 #ifdef yy_flex_debug
312 #define cpp__flex_debug_ALREADY_DEFINED
313 #else
314 #define yy_flex_debug cpp__flex_debug
315 #endif
316
317 #ifdef yylineno
318 #define cpp_lineno_ALREADY_DEFINED
319 #else
320 #define yylineno cpp_lineno
321 #endif
322
323 /* First, we deal with platform-specific or compiler-specific issues. */
324
325 /* begin standard C headers. */
326 #include <stdio.h>
327 #include <string.h>
328 #include <errno.h>
329 #include <stdlib.h>
330
331 /* end standard C headers. */
332
333 /* flex integer type definitions */
334
335 #ifndef FLEXINT_H
336 #define FLEXINT_H
337
338 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
339
340 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341
342 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
343 * if you want the limit (max/min) macros for int types.
344 */
345 #ifndef __STDC_LIMIT_MACROS
346 #define __STDC_LIMIT_MACROS 1
347 #endif
348
349 #include <inttypes.h>
350 typedef int8_t flex_int8_t;
351 typedef uint8_t flex_uint8_t;
352 typedef int16_t flex_int16_t;
353 typedef uint16_t flex_uint16_t;
354 typedef int32_t flex_int32_t;
355 typedef uint32_t flex_uint32_t;
356 #else
357 typedef signed char flex_int8_t;
358 typedef short int flex_int16_t;
359 typedef int flex_int32_t;
360 typedef unsigned char flex_uint8_t;
361 typedef unsigned short int flex_uint16_t;
362 typedef unsigned int flex_uint32_t;
363
364 /* Limits of integral types. */
365 #ifndef INT8_MIN
366 #define INT8_MIN (-128)
367 #endif
368 #ifndef INT16_MIN
369 #define INT16_MIN (-32767-1)
370 #endif
371 #ifndef INT32_MIN
372 #define INT32_MIN (-2147483647-1)
373 #endif
374 #ifndef INT8_MAX
375 #define INT8_MAX (127)
376 #endif
377 #ifndef INT16_MAX
378 #define INT16_MAX (32767)
379 #endif
380 #ifndef INT32_MAX
381 #define INT32_MAX (2147483647)
382 #endif
383 #ifndef UINT8_MAX
384 #define UINT8_MAX (255U)
385 #endif
386 #ifndef UINT16_MAX
387 #define UINT16_MAX (65535U)
388 #endif
389 #ifndef UINT32_MAX
390 #define UINT32_MAX (4294967295U)
391 #endif
392
393 #ifndef SIZE_MAX
394 #define SIZE_MAX (~(size_t)0)
395 #endif
396
397 #endif /* ! C99 */
398
399 #endif /* ! FLEXINT_H */
400
401 /* begin standard C++ headers. */
402
403 /* TODO: this is always defined, so inline it */
404 #define yyconst const
405
406 #if defined(__GNUC__) && __GNUC__ >= 3
407 #define yynoreturn __attribute__((__noreturn__))
408 #else
409 #define yynoreturn
410 #endif
411
412 /* Returned upon end-of-file. */
413 #define YY_NULL 0
414
415 /* Promotes a possibly negative, possibly signed char to an
416 * integer in range [0..255] for use as an array index.
417 */
418 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
419
420 /* Enter a start condition. This macro really ought to take a parameter,
421 * but we do it the disgusting crufty way forced on us by the ()-less
422 * definition of BEGIN.
423 */
424 #define BEGIN (yy_start) = 1 + 2 *
425 /* Translate the current start state into a value that can be later handed
426 * to BEGIN to return to the state. The YYSTATE alias is for lex
427 * compatibility.
428 */
429 #define YY_START (((yy_start) - 1) / 2)
430 #define YYSTATE YY_START
431 /* Action number for EOF rule of a given start state. */
432 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
433 /* Special action meaning "start processing a new file". */
434 #define YY_NEW_FILE yyrestart( yyin )
435 #define YY_END_OF_BUFFER_CHAR 0
436
437 /* Size of default input buffer. */
438 #ifndef YY_BUF_SIZE
439 #ifdef __ia64__
440 /* On IA-64, the buffer size is 16k, not 8k.
441 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
442 * Ditto for the __ia64__ case accordingly.
443 */
444 #define YY_BUF_SIZE 32768
445 #else
446 #define YY_BUF_SIZE 16384
447 #endif /* __ia64__ */
448 #endif
449
450 /* The state buf must be large enough to hold one state per character in the main buffer.
451 */
452 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
453
454 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
455 #define YY_TYPEDEF_YY_BUFFER_STATE
456 typedef struct yy_buffer_state *YY_BUFFER_STATE;
457 #endif
458
459 #ifndef YY_TYPEDEF_YY_SIZE_T
460 #define YY_TYPEDEF_YY_SIZE_T
461 typedef size_t yy_size_t;
462 #endif
463
464 extern int yyleng;
465
466 extern FILE *yyin, *yyout;
467
468 #define EOB_ACT_CONTINUE_SCAN 0
469 #define EOB_ACT_END_OF_FILE 1
470 #define EOB_ACT_LAST_MATCH 2
471
472 #define YY_LESS_LINENO(n)
473 #define YY_LINENO_REWIND_TO(ptr)
474
475 /* Return all but the first "n" matched characters back to the input stream. */
476 #define yyless(n) \
477 do \
478 { \
479 /* Undo effects of setting up yytext. */ \
480 int yyless_macro_arg = (n); \
481 YY_LESS_LINENO(yyless_macro_arg);\
482 *yy_cp = (yy_hold_char); \
483 YY_RESTORE_YY_MORE_OFFSET \
484 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
485 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
486 } \
487 while ( 0 )
488 #define unput(c) yyunput( c, (yytext_ptr) )
489
490 #ifndef YY_STRUCT_YY_BUFFER_STATE
491 #define YY_STRUCT_YY_BUFFER_STATE
492 struct yy_buffer_state
493 {
494 FILE *yy_input_file;
495
496 char *yy_ch_buf; /* input buffer */
497 char *yy_buf_pos; /* current position in input buffer */
498
499 /* Size of input buffer in bytes, not including room for EOB
500 * characters.
501 */
502 int yy_buf_size;
503
504 /* Number of characters read into yy_ch_buf, not including EOB
505 * characters.
506 */
507 int yy_n_chars;
508
509 /* Whether we "own" the buffer - i.e., we know we created it,
510 * and can realloc() it to grow it, and should free() it to
511 * delete it.
512 */
513 int yy_is_our_buffer;
514
515 /* Whether this is an "interactive" input source; if so, and
516 * if we're using stdio for input, then we want to use getc()
517 * instead of fread(), to make sure we stop fetching input after
518 * each newline.
519 */
520 int yy_is_interactive;
521
522 /* Whether we're considered to be at the beginning of a line.
523 * If so, '^' rules will be active on the next match, otherwise
524 * not.
525 */
526 int yy_at_bol;
527
528 int yy_bs_lineno; /**< The line count. */
529 int yy_bs_column; /**< The column count. */
530
531 /* Whether to try to fill the input buffer when we reach the
532 * end of it.
533 */
534 int yy_fill_buffer;
535
536 int yy_buffer_status;
537
538 #define YY_BUFFER_NEW 0
539 #define YY_BUFFER_NORMAL 1
540 /* When an EOF's been seen but there's still some text to process
541 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
542 * shouldn't try reading from the input source any more. We might
543 * still have a bunch of tokens to match, though, because of
544 * possible backing-up.
545 *
546 * When we actually see the EOF, we change the status to "new"
547 * (via yyrestart()), so that the user can continue scanning by
548 * just pointing yyin at a new input file.
549 */
550 #define YY_BUFFER_EOF_PENDING 2
551
552 };
553 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
554
555 /* Stack of input buffers. */
556 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
557 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
558 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
559
560 /* We provide macros for accessing buffer states in case in the
561 * future we want to put the buffer states in a more general
562 * "scanner state".
563 *
564 * Returns the top of the stack, or NULL.
565 */
566 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
567 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
568 : NULL)
569 /* Same as previous macro, but useful when we know that the buffer stack is not
570 * NULL or when we need an lvalue. For internal use only.
571 */
572 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
573
574 /* yy_hold_char holds the character lost when yytext is formed. */
575 static char yy_hold_char;
576 static int yy_n_chars; /* number of characters read into yy_ch_buf */
577 int yyleng;
578
579 /* Points to current character in buffer. */
580 static char *yy_c_buf_p = NULL;
581 static int yy_init = 0; /* whether we need to initialize */
582 static int yy_start = 0; /* start state number */
583
584 /* Flag which is used to allow yywrap()'s to do buffer switches
585 * instead of setting up a fresh yyin. A bit of a hack ...
586 */
587 static int yy_did_buffer_switch_on_eof;
588
589 void yyrestart ( FILE *input_file );
590 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
591 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
592 void yy_delete_buffer ( YY_BUFFER_STATE b );
593 void yy_flush_buffer ( YY_BUFFER_STATE b );
594 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
595 void yypop_buffer_state ( void );
596
597 static void yyensure_buffer_stack ( void );
598 static void yy_load_buffer_state ( void );
599 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
600 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
601
602 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
603 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
604 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
605
606 void *yyalloc ( yy_size_t );
607 void *yyrealloc ( void *, yy_size_t );
608 void yyfree ( void * );
609
610 #define yy_new_buffer yy_create_buffer
611 #define yy_set_interactive(is_interactive) \
612 { \
613 if ( ! YY_CURRENT_BUFFER ){ \
614 yyensure_buffer_stack (); \
615 YY_CURRENT_BUFFER_LVALUE = \
616 yy_create_buffer( yyin, YY_BUF_SIZE ); \
617 } \
618 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
619 }
620 #define yy_set_bol(at_bol) \
621 { \
622 if ( ! YY_CURRENT_BUFFER ){\
623 yyensure_buffer_stack (); \
624 YY_CURRENT_BUFFER_LVALUE = \
625 yy_create_buffer( yyin, YY_BUF_SIZE ); \
626 } \
627 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
628 }
629 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
630
631 /* Begin user sect3 */
632
633 #define cpp_wrap() (/*CONSTCOND*/1)
634 #define YY_SKIP_YYWRAP
635 typedef flex_uint8_t YY_CHAR;
636
637 FILE *yyin = NULL, *yyout = NULL;
638
639 typedef int yy_state_type;
640
641 extern int yylineno;
642 int yylineno = 1;
643
644 extern char *yytext;
645 #ifdef yytext_ptr
646 #undef yytext_ptr
647 #endif
648 #define yytext_ptr yytext
649
650 static yy_state_type yy_get_previous_state ( void );
651 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
652 static int yy_get_next_buffer ( void );
653 static void yynoreturn yy_fatal_error ( const char* msg );
654
655 /* Done after the current pattern has been matched and before the
656 * corresponding action - sets up yytext.
657 */
658 #define YY_DO_BEFORE_ACTION \
659 (yytext_ptr) = yy_bp; \
660 yyleng = (int) (yy_cp - yy_bp); \
661 (yy_hold_char) = *yy_cp; \
662 *yy_cp = '\0'; \
663 (yy_c_buf_p) = yy_cp;
664 #define YY_NUM_RULES 20
665 #define YY_END_OF_BUFFER 21
666 /* This struct is not used in this scanner,
667 but its presence is necessary. */
668 struct yy_trans_info
669 {
670 flex_int32_t yy_verify;
671 flex_int32_t yy_nxt;
672 };
673 static const flex_int16_t yy_accept[79] =
674 { 0,
675 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
676 0, 0, 0, 0, 0, 0, 21, 19, 18, 19,
677 6, 9, 19, 19, 19, 15, 16, 17, 19, 14,
678 4, 4, 4, 7, 19, 10, 19, 1, 0, 15,
679 15, 2, 5, 0, 15, 16, 0, 14, 0, 13,
680 13, 3, 8, 11, 0, 15, 13, 13, 13, 0,
681 15, 0, 13, 13, 0, 15, 13, 13, 13, 13,
682 12, 13, 12, 13, 13, 13, 13, 0
683 } ;
684
685 static const YY_CHAR yy_ec[256] =
686 { 0,
687 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
688 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
689 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
690 1, 2, 1, 4, 5, 1, 1, 1, 6, 1,
691 1, 7, 8, 1, 9, 10, 11, 12, 12, 12,
692 12, 12, 12, 12, 12, 12, 12, 1, 1, 1,
693 1, 1, 1, 1, 13, 13, 13, 13, 14, 13,
694 13, 13, 13, 13, 13, 15, 13, 13, 13, 13,
695 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
696 1, 16, 1, 1, 17, 1, 13, 13, 18, 19,
697
698 20, 13, 13, 13, 21, 13, 13, 22, 23, 24,
699 25, 26, 13, 27, 13, 28, 29, 13, 13, 30,
700 13, 13, 31, 1, 31, 1, 1, 13, 13, 13,
701 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
702 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
703 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
704 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
705 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
706 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
707 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
708
709 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
710 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
711 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
712 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
713 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
714 13, 13, 13, 13, 13
715 } ;
716
717 static const YY_CHAR yy_meta[32] =
718 { 0,
719 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
720 1, 3, 4, 4, 4, 1, 4, 4, 4, 4,
721 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
722 1
723 } ;
724
725 static const flex_int16_t yy_base[86] =
726 { 0,
727 0, 1, 17, 0, 46, 47, 48, 49, 52, 53,
728 54, 56, 68, 70, 0, 0, 151, 152, 152, 147,
729 152, 152, 0, 137, 0, 65, 0, 152, 4, 64,
730 152, 137, 144, 152, 143, 152, 142, 152, 132, 77,
731 76, 152, 152, 131, 152, 0, 76, 77, 80, 0,
732 70, 152, 152, 152, 91, 90, 0, 116, 123, 128,
733 127, 97, 113, 115, 124, 123, 107, 93, 80, 88,
734 0, 77, 78, 67, 63, 37, 33, 152, 110, 114,
735 116, 119, 123, 127, 129
736 } ;
737
738 static const flex_int16_t yy_def[86] =
739 { 0,
740 79, 79, 78, 3, 80, 80, 79, 79, 79, 79,
741 79, 79, 79, 79, 3, 3, 78, 78, 78, 78,
742 78, 78, 78, 78, 78, 78, 81, 78, 78, 82,
743 78, 78, 78, 78, 83, 78, 84, 78, 78, 78,
744 78, 78, 78, 78, 78, 81, 78, 82, 82, 85,
745 85, 78, 78, 78, 78, 78, 85, 85, 85, 78,
746 78, 78, 85, 85, 78, 78, 85, 85, 85, 85,
747 85, 85, 85, 85, 85, 85, 85, 0, 78, 78,
748 78, 78, 78, 78, 78
749 } ;
750
751 static const flex_int16_t yy_nxt[184] =
752 { 0,
753 78, 29, 19, 19, 30, 47, 42, 78, 48, 39,
754 43, 40, 78, 78, 78, 20, 20, 18, 18, 19,
755 21, 18, 22, 18, 18, 23, 24, 25, 26, 27,
756 27, 27, 20, 27, 27, 27, 27, 27, 27, 27,
757 27, 27, 27, 27, 27, 27, 27, 28, 19, 19,
758 19, 19, 32, 32, 19, 19, 19, 34, 19, 34,
759 71, 33, 33, 20, 20, 49, 77, 20, 20, 35,
760 19, 35, 19, 36, 44, 36, 40, 47, 49, 45,
761 48, 49, 76, 37, 51, 37, 44, 41, 40, 55,
762 75, 45, 58, 59, 74, 55, 73, 51, 60, 60,
763
764 51, 56, 61, 62, 65, 65, 72, 71, 66, 62,
765 18, 18, 18, 18, 31, 31, 31, 31, 46, 46,
766 50, 70, 50, 53, 53, 53, 53, 54, 54, 54,
767 54, 57, 57, 69, 66, 66, 68, 67, 61, 61,
768 64, 63, 56, 41, 38, 38, 38, 52, 41, 38,
769 78, 17, 78, 78, 78, 78, 78, 78, 78, 78,
770 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
771 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
772 78, 78, 78
773 } ;
774
775 static const flex_int16_t yy_chk[184] =
776 { 0,
777 0, 4, 1, 2, 4, 29, 25, 0, 29, 23,
778 25, 23, 0, 0, 0, 1, 2, 3, 3, 3,
779 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
780 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
781 3, 3, 3, 3, 3, 3, 3, 3, 5, 6,
782 7, 8, 5, 6, 9, 10, 11, 11, 12, 12,
783 77, 5, 6, 7, 8, 30, 76, 9, 10, 11,
784 13, 12, 14, 13, 26, 14, 26, 47, 48, 26,
785 47, 49, 75, 13, 30, 14, 40, 41, 40, 41,
786 74, 40, 51, 51, 73, 41, 72, 48, 55, 55,
787
788 49, 56, 55, 56, 62, 62, 70, 69, 62, 56,
789 79, 79, 79, 79, 80, 80, 80, 80, 81, 81,
790 82, 68, 82, 83, 83, 83, 83, 84, 84, 84,
791 84, 85, 85, 67, 66, 65, 64, 63, 61, 60,
792 59, 58, 44, 39, 37, 35, 33, 32, 24, 20,
793 17, 78, 78, 78, 78, 78, 78, 78, 78, 78,
794 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
795 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
796 78, 78, 78
797 } ;
798
799 static yy_state_type yy_last_accepting_state;
800 static char *yy_last_accepting_cpos;
801
802 extern int yy_flex_debug;
803 int yy_flex_debug = 0;
804
805 /* The intent behind this definition is that it'll catch
806 * any uses of REJECT which flex missed.
807 */
808 #define REJECT reject_used_but_not_detected
809 #define yymore() yymore_used_but_not_detected
810 #define YY_MORE_ADJ 0
811 #define YY_RESTORE_YY_MORE_OFFSET
812 char *yytext;
813 #line 1 "cpp.l"
814
815 #line 51 "cpp.l"
816 /* Definitions */
817
818 #line 818 "cpp.c"
819
820 #define INITIAL 0
821 #define CPP 1
822 #define C_COMMENT 2
823 #define CPP_COMMENT 3
824 #define SHELL_COMMENT 4
825 #define STRING 5
826 #define LITERAL 6
827 #define PREPROCESSOR_LINE 7
828
829 #ifndef YY_NO_UNISTD_H
830 /* Special case for "unistd.h", since it is non-ANSI. We include it way
831 * down here because we want the user's section 1 to have been scanned first.
832 * The user has a chance to override it with an option.
833 */
834 #include <unistd.h>
835 #endif
836
837 #ifndef YY_EXTRA_TYPE
838 #define YY_EXTRA_TYPE void *
839 #endif
840
841 static int yy_init_globals ( void );
842
843 /* Accessor methods to globals.
844 These are made visible to non-reentrant scanners for convenience. */
845
846 int yylex_destroy ( void );
847
848 int yyget_debug ( void );
849
850 void yyset_debug ( int debug_flag );
851
852 YY_EXTRA_TYPE yyget_extra ( void );
853
854 void yyset_extra ( YY_EXTRA_TYPE user_defined );
855
856 FILE *yyget_in ( void );
857
858 void yyset_in ( FILE * _in_str );
859
860 FILE *yyget_out ( void );
861
862 void yyset_out ( FILE * _out_str );
863
864 int yyget_leng ( void );
865
866 char *yyget_text ( void );
867
868 int yyget_lineno ( void );
869
870 void yyset_lineno ( int _line_number );
871
872 /* Macros after this point can all be overridden by user definitions in
873 * section 1.
874 */
875
876 #ifndef YY_SKIP_YYWRAP
877 #ifdef __cplusplus
878 extern "C" int yywrap ( void );
879 #else
880 extern int yywrap ( void );
881 #endif
882 #endif
883
884 #ifndef YY_NO_UNPUT
885
886 static void yyunput ( int c, char *buf_ptr );
887
888 #endif
889
890 #ifndef yytext_ptr
891 static void yy_flex_strncpy ( char *, const char *, int );
892 #endif
893
894 #ifdef YY_NEED_STRLEN
895 static int yy_flex_strlen ( const char * );
896 #endif
897
898 #ifndef YY_NO_INPUT
899 #ifdef __cplusplus
900 static int yyinput ( void );
901 #else
902 static int input ( void );
903 #endif
904
905 #endif
906
907 static int yy_start_stack_ptr = 0;
908 static int yy_start_stack_depth = 0;
909 static int *yy_start_stack = NULL;
910
911 static void yy_push_state ( int _new_state );
912
913 static void yy_pop_state ( void );
914
915 /* Amount of stuff to slurp up with each read. */
916 #ifndef YY_READ_BUF_SIZE
917 #ifdef __ia64__
918 /* On IA-64, the buffer size is 16k, not 8k */
919 #define YY_READ_BUF_SIZE 16384
920 #else
921 #define YY_READ_BUF_SIZE 8192
922 #endif /* __ia64__ */
923 #endif
924
925 /* Copy whatever the last rule matched to the standard output. */
926 #ifndef ECHO
927 /* This used to be an fputs(), but since the string might contain NUL's,
928 * we now use fwrite().
929 */
930 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
931 #endif
932
933 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
934 * is returned in "result".
935 */
936 #ifndef YY_INPUT
937 #define YY_INPUT(buf,result,max_size) \
938 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
939 { \
940 int c = '*'; \
941 int n; \
942 for ( n = 0; n < max_size && \
943 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
944 buf[n] = (char) c; \
945 if ( c == '\n' ) \
946 buf[n++] = (char) c; \
947 if ( c == EOF && ferror( yyin ) ) \
948 YY_FATAL_ERROR( "input in flex scanner failed" ); \
949 result = n; \
950 } \
951 else \
952 { \
953 errno=0; \
954 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
955 { \
956 if( errno != EINTR) \
957 { \
958 YY_FATAL_ERROR( "input in flex scanner failed" ); \
959 break; \
960 } \
961 errno=0; \
962 clearerr(yyin); \
963 } \
964 }\
965 \
966
967 #endif
968
969 /* No semi-colon after return; correct usage is to write "yyterminate();" -
970 * we don't want an extra ';' after the "return" because that will cause
971 * some compilers to complain about unreachable statements.
972 */
973 #ifndef yyterminate
974 #define yyterminate() return YY_NULL
975 #endif
976
977 /* Number of entries by which start-condition stack grows. */
978 #ifndef YY_START_STACK_INCR
979 #define YY_START_STACK_INCR 25
980 #endif
981
982 /* Report a fatal error. */
983 #ifndef YY_FATAL_ERROR
984 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
985 #endif
986
987 /* end tables serialization structures and prototypes */
988
989 /* Default declaration of generated scanner - a define so the user can
990 * easily add parameters.
991 */
992 #ifndef YY_DECL
993 #define YY_DECL_IS_OURS 1
994
995 extern int yylex (void);
996
997 #define YY_DECL int yylex (void)
998 #endif /* !YY_DECL */
999
1000 /* Code executed at the beginning of each rule, after yytext and yyleng
1001 * have been set up.
1002 */
1003 #ifndef YY_USER_ACTION
1004 #define YY_USER_ACTION
1005 #endif
1006
1007 /* Code executed at the end of each rule. */
1008 #ifndef YY_BREAK
1009 #define YY_BREAK /*LINTED*/break;
1010 #endif
1011
1012 #define YY_RULE_SETUP \
1013 if ( yyleng > 0 ) \
1014 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1015 (yytext[yyleng - 1] == '\n'); \
1016 YY_USER_ACTION
1017
1018 /** The main scanner function which does all the work.
1019 */
1020 YY_DECL
1021 {
1022 yy_state_type yy_current_state;
1023 char *yy_cp, *yy_bp;
1024 int yy_act;
1025
1026 if ( !(yy_init) )
1027 {
1028 (yy_init) = 1;
1029
1030 #ifdef YY_USER_INIT
1031 YY_USER_INIT;
1032 #endif
1033
1034 if ( ! (yy_start) )
1035 (yy_start) = 1; /* first start state */
1036
1037 if ( ! yyin )
1038 yyin = stdin;
1039
1040 if ( ! yyout )
1041 yyout = stdout;
1042
1043 if ( ! YY_CURRENT_BUFFER ) {
1044 yyensure_buffer_stack ();
1045 YY_CURRENT_BUFFER_LVALUE =
1046 yy_create_buffer( yyin, YY_BUF_SIZE );
1047 }
1048
1049 yy_load_buffer_state( );
1050 }
1051
1052 {
1053 #line 64 "cpp.l"
1054
1055 /* Backslash-newline */
1056 #line 1056 "cpp.c"
1057
1058 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1059 {
1060 yy_cp = (yy_c_buf_p);
1061
1062 /* Support of yytext. */
1063 *yy_cp = (yy_hold_char);
1064
1065 /* yy_bp points to the position in yy_ch_buf of the start of
1066 * the current run.
1067 */
1068 yy_bp = yy_cp;
1069
1070 yy_current_state = (yy_start);
1071 yy_current_state += YY_AT_BOL();
1072 yy_match:
1073 do
1074 {
1075 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1076 if ( yy_accept[yy_current_state] )
1077 {
1078 (yy_last_accepting_state) = yy_current_state;
1079 (yy_last_accepting_cpos) = yy_cp;
1080 }
1081 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1082 {
1083 yy_current_state = (int) yy_def[yy_current_state];
1084 if ( yy_current_state >= 79 )
1085 yy_c = yy_meta[yy_c];
1086 }
1087 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1088 ++yy_cp;
1089 }
1090 while ( yy_current_state != 78 );
1091 yy_cp = (yy_last_accepting_cpos);
1092 yy_current_state = (yy_last_accepting_state);
1093
1094 yy_find_action:
1095 yy_act = yy_accept[yy_current_state];
1096
1097 YY_DO_BEFORE_ACTION;
1098
1099 do_action: /* This label is used only to access EOF actions. */
1100
1101 switch ( yy_act )
1102 { /* beginning of action switch */
1103 case 0: /* must back up */
1104 /* undo the effects of YY_DO_BEFORE_ACTION */
1105 *yy_cp = (yy_hold_char);
1106 yy_cp = (yy_last_accepting_cpos);
1107 yy_current_state = (yy_last_accepting_state);
1108 goto yy_find_action;
1109
1110 case 1:
1111 /* rule 1 can match eol */
1112 YY_RULE_SETUP
1113 #line 66 "cpp.l"
1114 DEFAULT_BACKSLASH_NEWLINE_ACTION
1115 YY_BREAK
1116 /* Comment */
1117 case 2:
1118 YY_RULE_SETUP
1119 #line 69 "cpp.l"
1120 { echos(comment_begin); ECHO; yy_push_state(C_COMMENT); }
1121 YY_BREAK
1122 case 3:
1123 YY_RULE_SETUP
1124 #line 70 "cpp.l"
1125 { ECHO; echos(comment_end); yy_pop_state(); }
1126 YY_BREAK
1127 case 4:
1128 YY_RULE_SETUP
1129 #line 71 "cpp.l"
1130 { put_char(LEXTEXT[0]); }
1131 YY_BREAK
1132 case YY_STATE_EOF(C_COMMENT):
1133 #line 72 "cpp.l"
1134 {
1135 if (wflag)
1136 unexpected_eof(LINENO);
1137 yyterminate();
1138 }
1139 YY_BREAK
1140 case 5:
1141 YY_RULE_SETUP
1142 #line 77 "cpp.l"
1143 { echos(comment_begin); ECHO; yy_push_state(CPP_COMMENT); }
1144 YY_BREAK
1145 /* String */
1146 case 6:
1147 YY_RULE_SETUP
1148 #line 80 "cpp.l"
1149 { ECHO; yy_push_state(STRING); }
1150 YY_BREAK
1151 case 7:
1152 YY_RULE_SETUP
1153 #line 81 "cpp.l"
1154 { ECHO; yy_pop_state(); }
1155 YY_BREAK
1156 case 8:
1157 YY_RULE_SETUP
1158 #line 82 "cpp.l"
1159 { put_char(LEXTEXT[0]); put_char(LEXTEXT[1]); }
1160 YY_BREAK
1161 /* Literal */
1162 case 9:
1163 YY_RULE_SETUP
1164 #line 85 "cpp.l"
1165 { ECHO; yy_push_state(LITERAL); }
1166 YY_BREAK
1167 case 10:
1168 YY_RULE_SETUP
1169 #line 86 "cpp.l"
1170 { ECHO; yy_pop_state(); }
1171 YY_BREAK
1172 case 11:
1173 YY_RULE_SETUP
1174 #line 87 "cpp.l"
1175 { put_char(LEXTEXT[0]); put_char(LEXTEXT[1]); }
1176 YY_BREAK
1177 /* Preprocessing directive */
1178 case 12:
1179 YY_RULE_SETUP
1180 #line 90 "cpp.l"
1181 {
1182 int c;
1183
1184 put_macro(LEXTEXT);
1185 /*
1186 * #include| <aaa/bbb.h>|
1187 * ~~~~~~~~~~~~~~~~
1188 */
1189 while ((c = input()) && c != EOF && c != '\n' && isspace(c))
1190 echoc(c);
1191 if (c == EOF)
1192 c = '\n';
1193 if (c == '\n') {
1194 unput(c);
1195 } else if (c) {
1196 char path[MAXPATHLEN], *p = path, *lim = p + MAXPATHLEN - 1;
1197 int sep = 0;
1198
1199 if (c == '"')
1200 sep = c;
1201 else if (c == '<')
1202 sep = '>';
1203 put_char(c);
1204
1205 /* pick up path name */
1206 while ((c = input()) && c != EOF && c != sep && c != '\n')
1207 if (p < lim)
1208 *p++ = c;
1209 *p = '\0';
1210 if (c == EOF)
1211 c = '\n';
1212 if (c == sep) {
1213 struct data *inc;
1214 const char *basename = locatestring(path, "/", MATCH_LAST);
1215
1216 if (basename)
1217 basename++;
1218 else
1219 basename = path;
1220 inc = get_inc(basename);
1221 if (inc)
1222 put_include_anchor(inc, path);
1223 else
1224 echos(path);
1225 put_char(sep);
1226 } else {
1227 echos(path);
1228 if (c)
1229 unput(c);
1230 }
1231 }
1232 }
1233 YY_BREAK
1234 case 13:
1235 YY_RULE_SETUP
1236 #line 142 "cpp.l"
1237 {
1238 if ((last_directive = cpp_reserved_sharp(LEXTEXT, LINENO)) != 0)
1239 put_macro(LEXTEXT);
1240 else {
1241 ECHO;
1242 if (wflag)
1243 unknown_preprocessing_directive(LEXTEXT, LINENO);
1244 }
1245 yy_push_state(PREPROCESSOR_LINE);
1246 }
1247 YY_BREAK
1248 /* Null directive */
1249 case 14:
1250 YY_RULE_SETUP
1251 #line 153 "cpp.l"
1252 { put_macro(LEXTEXT); }
1253 YY_BREAK
1254 case 15:
1255 YY_RULE_SETUP
1256 #line 155 "cpp.l"
1257 ECHO;
1258 YY_BREAK
1259 case 16:
1260 YY_RULE_SETUP
1261 #line 156 "cpp.l"
1262 {
1263 if (cpp_reserved_word(LEXTEXT, LEXLENG))
1264 put_reserved_word(LEXTEXT);
1265 else if (YY_START == PREPROCESSOR_LINE
1266 && (last_directive == SHARP_IF || last_directive == SHARP_ELIF)
1267 && strcmp(LEXTEXT, "defined") == 0)
1268 put_reserved_word(LEXTEXT);
1269 else {
1270 struct anchor *a = anchor_get(LEXTEXT, LEXLENG, 0, LINENO);
1271 if (a) {
1272 put_anchor(gettag(a), a->type, LINENO);
1273 a->done = 1;
1274 } else if (grtags_is_empty) {
1275 put_anchor_force(LEXTEXT, LEXLENG, LINENO);
1276 } else {
1277 ECHO;
1278 }
1279 }
1280 }
1281 YY_BREAK
1282 case 17:
1283 YY_RULE_SETUP
1284 #line 175 "cpp.l"
1285 { put_brace(LEXTEXT); }
1286 YY_BREAK
1287 /* New line */
1288 case 18:
1289 /* rule 18 can match eol */
1290 YY_RULE_SETUP
1291 #line 177 "cpp.l"
1292 DEFAULT_END_OF_LINE_ACTION
1293 YY_BREAK
1294 case 19:
1295 YY_RULE_SETUP
1296 #line 178 "cpp.l"
1297 { put_char(LEXTEXT[0]); }
1298 YY_BREAK
1299 case 20:
1300 YY_RULE_SETUP
1301 #line 180 "cpp.l"
1302 ECHO;
1303 YY_BREAK
1304 #line 1304 "cpp.c"
1305 case YY_STATE_EOF(INITIAL):
1306 case YY_STATE_EOF(CPP):
1307 case YY_STATE_EOF(CPP_COMMENT):
1308 case YY_STATE_EOF(SHELL_COMMENT):
1309 case YY_STATE_EOF(STRING):
1310 case YY_STATE_EOF(LITERAL):
1311 case YY_STATE_EOF(PREPROCESSOR_LINE):
1312 yyterminate();
1313
1314 case YY_END_OF_BUFFER:
1315 {
1316 /* Amount of text matched not including the EOB char. */
1317 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1318
1319 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1320 *yy_cp = (yy_hold_char);
1321 YY_RESTORE_YY_MORE_OFFSET
1322
1323 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1324 {
1325 /* We're scanning a new file or input source. It's
1326 * possible that this happened because the user
1327 * just pointed yyin at a new source and called
1328 * yylex(). If so, then we have to assure
1329 * consistency between YY_CURRENT_BUFFER and our
1330 * globals. Here is the right place to do so, because
1331 * this is the first action (other than possibly a
1332 * back-up) that will match for the new input source.
1333 */
1334 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1335 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1336 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1337 }
1338
1339 /* Note that here we test for yy_c_buf_p "<=" to the position
1340 * of the first EOB in the buffer, since yy_c_buf_p will
1341 * already have been incremented past the NUL character
1342 * (since all states make transitions on EOB to the
1343 * end-of-buffer state). Contrast this with the test
1344 * in input().
1345 */
1346 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1347 { /* This was really a NUL. */
1348 yy_state_type yy_next_state;
1349
1350 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1351
1352 yy_current_state = yy_get_previous_state( );
1353
1354 /* Okay, we're now positioned to make the NUL
1355 * transition. We couldn't have
1356 * yy_get_previous_state() go ahead and do it
1357 * for us because it doesn't know how to deal
1358 * with the possibility of jamming (and we don't
1359 * want to build jamming into it because then it
1360 * will run more slowly).
1361 */
1362
1363 yy_next_state = yy_try_NUL_trans( yy_current_state );
1364
1365 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1366
1367 if ( yy_next_state )
1368 {
1369 /* Consume the NUL. */
1370 yy_cp = ++(yy_c_buf_p);
1371 yy_current_state = yy_next_state;
1372 goto yy_match;
1373 }
1374
1375 else
1376 {
1377 yy_cp = (yy_last_accepting_cpos);
1378 yy_current_state = (yy_last_accepting_state);
1379 goto yy_find_action;
1380 }
1381 }
1382
1383 else switch ( yy_get_next_buffer( ) )
1384 {
1385 case EOB_ACT_END_OF_FILE:
1386 {
1387 (yy_did_buffer_switch_on_eof) = 0;
1388
1389 if ( yywrap( ) )
1390 {
1391 /* Note: because we've taken care in
1392 * yy_get_next_buffer() to have set up
1393 * yytext, we can now set up
1394 * yy_c_buf_p so that if some total
1395 * hoser (like flex itself) wants to
1396 * call the scanner after we return the
1397 * YY_NULL, it'll still work - another
1398 * YY_NULL will get returned.
1399 */
1400 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1401
1402 yy_act = YY_STATE_EOF(YY_START);
1403 goto do_action;
1404 }
1405
1406 else
1407 {
1408 if ( ! (yy_did_buffer_switch_on_eof) )
1409 YY_NEW_FILE;
1410 }
1411 break;
1412 }
1413
1414 case EOB_ACT_CONTINUE_SCAN:
1415 (yy_c_buf_p) =
1416 (yytext_ptr) + yy_amount_of_matched_text;
1417
1418 yy_current_state = yy_get_previous_state( );
1419
1420 yy_cp = (yy_c_buf_p);
1421 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1422 goto yy_match;
1423
1424 case EOB_ACT_LAST_MATCH:
1425 (yy_c_buf_p) =
1426 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1427
1428 yy_current_state = yy_get_previous_state( );
1429
1430 yy_cp = (yy_c_buf_p);
1431 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1432 goto yy_find_action;
1433 }
1434 break;
1435 }
1436
1437 default:
1438 YY_FATAL_ERROR(
1439 "fatal flex scanner internal error--no action found" );
1440 } /* end of action switch */
1441 } /* end of scanning one token */
1442 } /* end of user's declarations */
1443 } /* end of yylex */
1444
1445 /* yy_get_next_buffer - try to read in a new buffer
1446 *
1447 * Returns a code representing an action:
1448 * EOB_ACT_LAST_MATCH -
1449 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1450 * EOB_ACT_END_OF_FILE - end of file
1451 */
yy_get_next_buffer(void)1452 static int yy_get_next_buffer (void)
1453 {
1454 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1455 char *source = (yytext_ptr);
1456 int number_to_move, i;
1457 int ret_val;
1458
1459 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1460 YY_FATAL_ERROR(
1461 "fatal flex scanner internal error--end of buffer missed" );
1462
1463 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1464 { /* Don't try to fill the buffer, so this is an EOF. */
1465 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1466 {
1467 /* We matched a single character, the EOB, so
1468 * treat this as a final EOF.
1469 */
1470 return EOB_ACT_END_OF_FILE;
1471 }
1472
1473 else
1474 {
1475 /* We matched some text prior to the EOB, first
1476 * process it.
1477 */
1478 return EOB_ACT_LAST_MATCH;
1479 }
1480 }
1481
1482 /* Try to read more data. */
1483
1484 /* First move last chars to start of buffer. */
1485 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1486
1487 for ( i = 0; i < number_to_move; ++i )
1488 *(dest++) = *(source++);
1489
1490 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1491 /* don't do the read, it's not guaranteed to return an EOF,
1492 * just force an EOF
1493 */
1494 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1495
1496 else
1497 {
1498 int num_to_read =
1499 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1500
1501 while ( num_to_read <= 0 )
1502 { /* Not enough room in the buffer - grow it. */
1503
1504 /* just a shorter name for the current buffer */
1505 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1506
1507 int yy_c_buf_p_offset =
1508 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1509
1510 if ( b->yy_is_our_buffer )
1511 {
1512 int new_size = b->yy_buf_size * 2;
1513
1514 if ( new_size <= 0 )
1515 b->yy_buf_size += b->yy_buf_size / 8;
1516 else
1517 b->yy_buf_size *= 2;
1518
1519 b->yy_ch_buf = (char *)
1520 /* Include room in for 2 EOB chars. */
1521 yyrealloc( (void *) b->yy_ch_buf,
1522 (yy_size_t) (b->yy_buf_size + 2) );
1523 }
1524 else
1525 /* Can't grow it, we don't own it. */
1526 b->yy_ch_buf = NULL;
1527
1528 if ( ! b->yy_ch_buf )
1529 YY_FATAL_ERROR(
1530 "fatal error - scanner input buffer overflow" );
1531
1532 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1533
1534 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1535 number_to_move - 1;
1536
1537 }
1538
1539 if ( num_to_read > YY_READ_BUF_SIZE )
1540 num_to_read = YY_READ_BUF_SIZE;
1541
1542 /* Read in more data. */
1543 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1544 (yy_n_chars), num_to_read );
1545
1546 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1547 }
1548
1549 if ( (yy_n_chars) == 0 )
1550 {
1551 if ( number_to_move == YY_MORE_ADJ )
1552 {
1553 ret_val = EOB_ACT_END_OF_FILE;
1554 yyrestart( yyin );
1555 }
1556
1557 else
1558 {
1559 ret_val = EOB_ACT_LAST_MATCH;
1560 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1561 YY_BUFFER_EOF_PENDING;
1562 }
1563 }
1564
1565 else
1566 ret_val = EOB_ACT_CONTINUE_SCAN;
1567
1568 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1569 /* Extend the array by 50%, plus the number we really need. */
1570 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1571 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1572 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1573 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1574 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1575 /* "- 2" to take care of EOB's */
1576 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1577 }
1578
1579 (yy_n_chars) += number_to_move;
1580 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1581 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1582
1583 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1584
1585 return ret_val;
1586 }
1587
1588 /* yy_get_previous_state - get the state just before the EOB char was reached */
1589
yy_get_previous_state(void)1590 static yy_state_type yy_get_previous_state (void)
1591 {
1592 yy_state_type yy_current_state;
1593 char *yy_cp;
1594
1595 yy_current_state = (yy_start);
1596 yy_current_state += YY_AT_BOL();
1597
1598 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1599 {
1600 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1601 if ( yy_accept[yy_current_state] )
1602 {
1603 (yy_last_accepting_state) = yy_current_state;
1604 (yy_last_accepting_cpos) = yy_cp;
1605 }
1606 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1607 {
1608 yy_current_state = (int) yy_def[yy_current_state];
1609 if ( yy_current_state >= 79 )
1610 yy_c = yy_meta[yy_c];
1611 }
1612 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1613 }
1614
1615 return yy_current_state;
1616 }
1617
1618 /* yy_try_NUL_trans - try to make a transition on the NUL character
1619 *
1620 * synopsis
1621 * next_state = yy_try_NUL_trans( current_state );
1622 */
yy_try_NUL_trans(yy_state_type yy_current_state)1623 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1624 {
1625 int yy_is_jam;
1626 char *yy_cp = (yy_c_buf_p);
1627
1628 YY_CHAR yy_c = 1;
1629 if ( yy_accept[yy_current_state] )
1630 {
1631 (yy_last_accepting_state) = yy_current_state;
1632 (yy_last_accepting_cpos) = yy_cp;
1633 }
1634 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1635 {
1636 yy_current_state = (int) yy_def[yy_current_state];
1637 if ( yy_current_state >= 79 )
1638 yy_c = yy_meta[yy_c];
1639 }
1640 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1641 yy_is_jam = (yy_current_state == 78);
1642
1643 return yy_is_jam ? 0 : yy_current_state;
1644 }
1645
1646 #ifndef YY_NO_UNPUT
1647
yyunput(int c,char * yy_bp)1648 static void yyunput (int c, char * yy_bp )
1649 {
1650 char *yy_cp;
1651
1652 yy_cp = (yy_c_buf_p);
1653
1654 /* undo effects of setting up yytext */
1655 *yy_cp = (yy_hold_char);
1656
1657 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1658 { /* need to shift things up to make room */
1659 /* +2 for EOB chars. */
1660 int number_to_move = (yy_n_chars) + 2;
1661 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1662 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1663 char *source =
1664 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1665
1666 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1667 *--dest = *--source;
1668
1669 yy_cp += (int) (dest - source);
1670 yy_bp += (int) (dest - source);
1671 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1672 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1673
1674 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1675 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1676 }
1677
1678 *--yy_cp = (char) c;
1679
1680 (yytext_ptr) = yy_bp;
1681 (yy_hold_char) = *yy_cp;
1682 (yy_c_buf_p) = yy_cp;
1683 }
1684
1685 #endif
1686
1687 #ifndef YY_NO_INPUT
1688 #ifdef __cplusplus
yyinput(void)1689 static int yyinput (void)
1690 #else
1691 static int input (void)
1692 #endif
1693
1694 {
1695 int c;
1696
1697 *(yy_c_buf_p) = (yy_hold_char);
1698
1699 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1700 {
1701 /* yy_c_buf_p now points to the character we want to return.
1702 * If this occurs *before* the EOB characters, then it's a
1703 * valid NUL; if not, then we've hit the end of the buffer.
1704 */
1705 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1706 /* This was really a NUL. */
1707 *(yy_c_buf_p) = '\0';
1708
1709 else
1710 { /* need more input */
1711 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1712 ++(yy_c_buf_p);
1713
1714 switch ( yy_get_next_buffer( ) )
1715 {
1716 case EOB_ACT_LAST_MATCH:
1717 /* This happens because yy_g_n_b()
1718 * sees that we've accumulated a
1719 * token and flags that we need to
1720 * try matching the token before
1721 * proceeding. But for input(),
1722 * there's no matching to consider.
1723 * So convert the EOB_ACT_LAST_MATCH
1724 * to EOB_ACT_END_OF_FILE.
1725 */
1726
1727 /* Reset buffer status. */
1728 yyrestart( yyin );
1729
1730 /*FALLTHROUGH*/
1731
1732 case EOB_ACT_END_OF_FILE:
1733 {
1734 if ( yywrap( ) )
1735 return 0;
1736
1737 if ( ! (yy_did_buffer_switch_on_eof) )
1738 YY_NEW_FILE;
1739 #ifdef __cplusplus
1740 return yyinput();
1741 #else
1742 return input();
1743 #endif
1744 }
1745
1746 case EOB_ACT_CONTINUE_SCAN:
1747 (yy_c_buf_p) = (yytext_ptr) + offset;
1748 break;
1749 }
1750 }
1751 }
1752
1753 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1754 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1755 (yy_hold_char) = *++(yy_c_buf_p);
1756
1757 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1758
1759 return c;
1760 }
1761 #endif /* ifndef YY_NO_INPUT */
1762
1763 /** Immediately switch to a different input stream.
1764 * @param input_file A readable stream.
1765 *
1766 * @note This function does not reset the start condition to @c INITIAL .
1767 */
yyrestart(FILE * input_file)1768 void yyrestart (FILE * input_file )
1769 {
1770
1771 if ( ! YY_CURRENT_BUFFER ){
1772 yyensure_buffer_stack ();
1773 YY_CURRENT_BUFFER_LVALUE =
1774 yy_create_buffer( yyin, YY_BUF_SIZE );
1775 }
1776
1777 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1778 yy_load_buffer_state( );
1779 }
1780
1781 /** Switch to a different input buffer.
1782 * @param new_buffer The new input buffer.
1783 *
1784 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1785 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1786 {
1787
1788 /* TODO. We should be able to replace this entire function body
1789 * with
1790 * yypop_buffer_state();
1791 * yypush_buffer_state(new_buffer);
1792 */
1793 yyensure_buffer_stack ();
1794 if ( YY_CURRENT_BUFFER == new_buffer )
1795 return;
1796
1797 if ( YY_CURRENT_BUFFER )
1798 {
1799 /* Flush out information for old buffer. */
1800 *(yy_c_buf_p) = (yy_hold_char);
1801 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1802 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1803 }
1804
1805 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1806 yy_load_buffer_state( );
1807
1808 /* We don't actually know whether we did this switch during
1809 * EOF (yywrap()) processing, but the only time this flag
1810 * is looked at is after yywrap() is called, so it's safe
1811 * to go ahead and always set it.
1812 */
1813 (yy_did_buffer_switch_on_eof) = 1;
1814 }
1815
yy_load_buffer_state(void)1816 static void yy_load_buffer_state (void)
1817 {
1818 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1819 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1820 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1821 (yy_hold_char) = *(yy_c_buf_p);
1822 }
1823
1824 /** Allocate and initialize an input buffer state.
1825 * @param file A readable stream.
1826 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1827 *
1828 * @return the allocated buffer state.
1829 */
yy_create_buffer(FILE * file,int size)1830 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1831 {
1832 YY_BUFFER_STATE b;
1833
1834 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1835 if ( ! b )
1836 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1837
1838 b->yy_buf_size = size;
1839
1840 /* yy_ch_buf has to be 2 characters longer than the size given because
1841 * we need to put in 2 end-of-buffer characters.
1842 */
1843 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1844 if ( ! b->yy_ch_buf )
1845 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1846
1847 b->yy_is_our_buffer = 1;
1848
1849 yy_init_buffer( b, file );
1850
1851 return b;
1852 }
1853
1854 /** Destroy the buffer.
1855 * @param b a buffer created with yy_create_buffer()
1856 *
1857 */
yy_delete_buffer(YY_BUFFER_STATE b)1858 void yy_delete_buffer (YY_BUFFER_STATE b )
1859 {
1860
1861 if ( ! b )
1862 return;
1863
1864 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1865 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1866
1867 if ( b->yy_is_our_buffer )
1868 yyfree( (void *) b->yy_ch_buf );
1869
1870 yyfree( (void *) b );
1871 }
1872
1873 /* Initializes or reinitializes a buffer.
1874 * This function is sometimes called more than once on the same buffer,
1875 * such as during a yyrestart() or at EOF.
1876 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1877 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1878
1879 {
1880 int oerrno = errno;
1881
1882 yy_flush_buffer( b );
1883
1884 b->yy_input_file = file;
1885 b->yy_fill_buffer = 1;
1886
1887 /* If b is the current buffer, then yy_init_buffer was _probably_
1888 * called from yyrestart() or through yy_get_next_buffer.
1889 * In that case, we don't want to reset the lineno or column.
1890 */
1891 if (b != YY_CURRENT_BUFFER){
1892 b->yy_bs_lineno = 1;
1893 b->yy_bs_column = 0;
1894 }
1895
1896 b->yy_is_interactive = 0;
1897
1898 errno = oerrno;
1899 }
1900
1901 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1902 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1903 *
1904 */
yy_flush_buffer(YY_BUFFER_STATE b)1905 void yy_flush_buffer (YY_BUFFER_STATE b )
1906 {
1907 if ( ! b )
1908 return;
1909
1910 b->yy_n_chars = 0;
1911
1912 /* We always need two end-of-buffer characters. The first causes
1913 * a transition to the end-of-buffer state. The second causes
1914 * a jam in that state.
1915 */
1916 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1917 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1918
1919 b->yy_buf_pos = &b->yy_ch_buf[0];
1920
1921 b->yy_at_bol = 1;
1922 b->yy_buffer_status = YY_BUFFER_NEW;
1923
1924 if ( b == YY_CURRENT_BUFFER )
1925 yy_load_buffer_state( );
1926 }
1927
1928 /** Pushes the new state onto the stack. The new state becomes
1929 * the current state. This function will allocate the stack
1930 * if necessary.
1931 * @param new_buffer The new state.
1932 *
1933 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)1934 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1935 {
1936 if (new_buffer == NULL)
1937 return;
1938
1939 yyensure_buffer_stack();
1940
1941 /* This block is copied from yy_switch_to_buffer. */
1942 if ( YY_CURRENT_BUFFER )
1943 {
1944 /* Flush out information for old buffer. */
1945 *(yy_c_buf_p) = (yy_hold_char);
1946 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1947 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1948 }
1949
1950 /* Only push if top exists. Otherwise, replace top. */
1951 if (YY_CURRENT_BUFFER)
1952 (yy_buffer_stack_top)++;
1953 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1954
1955 /* copied from yy_switch_to_buffer. */
1956 yy_load_buffer_state( );
1957 (yy_did_buffer_switch_on_eof) = 1;
1958 }
1959
1960 /** Removes and deletes the top of the stack, if present.
1961 * The next element becomes the new top.
1962 *
1963 */
yypop_buffer_state(void)1964 void yypop_buffer_state (void)
1965 {
1966 if (!YY_CURRENT_BUFFER)
1967 return;
1968
1969 yy_delete_buffer(YY_CURRENT_BUFFER );
1970 YY_CURRENT_BUFFER_LVALUE = NULL;
1971 if ((yy_buffer_stack_top) > 0)
1972 --(yy_buffer_stack_top);
1973
1974 if (YY_CURRENT_BUFFER) {
1975 yy_load_buffer_state( );
1976 (yy_did_buffer_switch_on_eof) = 1;
1977 }
1978 }
1979
1980 /* Allocates the stack if it does not exist.
1981 * Guarantees space for at least one push.
1982 */
yyensure_buffer_stack(void)1983 static void yyensure_buffer_stack (void)
1984 {
1985 yy_size_t num_to_alloc;
1986
1987 if (!(yy_buffer_stack)) {
1988
1989 /* First allocation is just for 2 elements, since we don't know if this
1990 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1991 * immediate realloc on the next call.
1992 */
1993 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1994 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1995 (num_to_alloc * sizeof(struct yy_buffer_state*)
1996 );
1997 if ( ! (yy_buffer_stack) )
1998 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1999
2000 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2001
2002 (yy_buffer_stack_max) = num_to_alloc;
2003 (yy_buffer_stack_top) = 0;
2004 return;
2005 }
2006
2007 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2008
2009 /* Increase the buffer to prepare for a possible push. */
2010 yy_size_t grow_size = 8 /* arbitrary grow size */;
2011
2012 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2013 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2014 ((yy_buffer_stack),
2015 num_to_alloc * sizeof(struct yy_buffer_state*)
2016 );
2017 if ( ! (yy_buffer_stack) )
2018 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2019
2020 /* zero only the new slots.*/
2021 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2022 (yy_buffer_stack_max) = num_to_alloc;
2023 }
2024 }
2025
2026 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2027 * @param base the character buffer
2028 * @param size the size in bytes of the character buffer
2029 *
2030 * @return the newly allocated buffer state object.
2031 */
yy_scan_buffer(char * base,yy_size_t size)2032 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
2033 {
2034 YY_BUFFER_STATE b;
2035
2036 if ( size < 2 ||
2037 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2038 base[size-1] != YY_END_OF_BUFFER_CHAR )
2039 /* They forgot to leave room for the EOB's. */
2040 return NULL;
2041
2042 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
2043 if ( ! b )
2044 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2045
2046 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
2047 b->yy_buf_pos = b->yy_ch_buf = base;
2048 b->yy_is_our_buffer = 0;
2049 b->yy_input_file = NULL;
2050 b->yy_n_chars = b->yy_buf_size;
2051 b->yy_is_interactive = 0;
2052 b->yy_at_bol = 1;
2053 b->yy_fill_buffer = 0;
2054 b->yy_buffer_status = YY_BUFFER_NEW;
2055
2056 yy_switch_to_buffer( b );
2057
2058 return b;
2059 }
2060
2061 /** Setup the input buffer state to scan a string. The next call to yylex() will
2062 * scan from a @e copy of @a str.
2063 * @param yystr a NUL-terminated string to scan
2064 *
2065 * @return the newly allocated buffer state object.
2066 * @note If you want to scan bytes that may contain NUL values, then use
2067 * yy_scan_bytes() instead.
2068 */
yy_scan_string(const char * yystr)2069 YY_BUFFER_STATE yy_scan_string (const char * yystr )
2070 {
2071
2072 return yy_scan_bytes( yystr, (int) strlen(yystr) );
2073 }
2074
2075 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2076 * scan from a @e copy of @a bytes.
2077 * @param yybytes the byte buffer to scan
2078 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2079 *
2080 * @return the newly allocated buffer state object.
2081 */
yy_scan_bytes(const char * yybytes,int _yybytes_len)2082 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
2083 {
2084 YY_BUFFER_STATE b;
2085 char *buf;
2086 yy_size_t n;
2087 int i;
2088
2089 /* Get memory for full buffer, including space for trailing EOB's. */
2090 n = (yy_size_t) (_yybytes_len + 2);
2091 buf = (char *) yyalloc( n );
2092 if ( ! buf )
2093 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2094
2095 for ( i = 0; i < _yybytes_len; ++i )
2096 buf[i] = yybytes[i];
2097
2098 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2099
2100 b = yy_scan_buffer( buf, n );
2101 if ( ! b )
2102 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2103
2104 /* It's okay to grow etc. this buffer, and we should throw it
2105 * away when we're done.
2106 */
2107 b->yy_is_our_buffer = 1;
2108
2109 return b;
2110 }
2111
yy_push_state(int _new_state)2112 static void yy_push_state (int _new_state )
2113 {
2114 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
2115 {
2116 yy_size_t new_size;
2117
2118 (yy_start_stack_depth) += YY_START_STACK_INCR;
2119 new_size = (yy_size_t) (yy_start_stack_depth) * sizeof( int );
2120
2121 if ( ! (yy_start_stack) )
2122 (yy_start_stack) = (int *) yyalloc( new_size );
2123
2124 else
2125 (yy_start_stack) = (int *) yyrealloc(
2126 (void *) (yy_start_stack), new_size );
2127
2128 if ( ! (yy_start_stack) )
2129 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2130 }
2131
2132 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
2133
2134 BEGIN(_new_state);
2135 }
2136
yy_pop_state(void)2137 static void yy_pop_state (void)
2138 {
2139 if ( --(yy_start_stack_ptr) < 0 )
2140 YY_FATAL_ERROR( "start-condition stack underflow" );
2141
2142 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
2143 }
2144
2145 #ifndef YY_EXIT_FAILURE
2146 #define YY_EXIT_FAILURE 2
2147 #endif
2148
yy_fatal_error(const char * msg)2149 static void yynoreturn yy_fatal_error (const char* msg )
2150 {
2151 fprintf( stderr, "%s\n", msg );
2152 exit( YY_EXIT_FAILURE );
2153 }
2154
2155 /* Redefine yyless() so it works in section 3 code. */
2156
2157 #undef yyless
2158 #define yyless(n) \
2159 do \
2160 { \
2161 /* Undo effects of setting up yytext. */ \
2162 int yyless_macro_arg = (n); \
2163 YY_LESS_LINENO(yyless_macro_arg);\
2164 yytext[yyleng] = (yy_hold_char); \
2165 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2166 (yy_hold_char) = *(yy_c_buf_p); \
2167 *(yy_c_buf_p) = '\0'; \
2168 yyleng = yyless_macro_arg; \
2169 } \
2170 while ( 0 )
2171
2172 /* Accessor methods (get/set functions) to struct members. */
2173
2174 /** Get the current line number.
2175 *
2176 */
yyget_lineno(void)2177 int yyget_lineno (void)
2178 {
2179
2180 return yylineno;
2181 }
2182
2183 /** Get the input stream.
2184 *
2185 */
yyget_in(void)2186 FILE *yyget_in (void)
2187 {
2188 return yyin;
2189 }
2190
2191 /** Get the output stream.
2192 *
2193 */
yyget_out(void)2194 FILE *yyget_out (void)
2195 {
2196 return yyout;
2197 }
2198
2199 /** Get the length of the current token.
2200 *
2201 */
yyget_leng(void)2202 int yyget_leng (void)
2203 {
2204 return yyleng;
2205 }
2206
2207 /** Get the current token.
2208 *
2209 */
2210
yyget_text(void)2211 char *yyget_text (void)
2212 {
2213 return yytext;
2214 }
2215
2216 /** Set the current line number.
2217 * @param _line_number line number
2218 *
2219 */
yyset_lineno(int _line_number)2220 void yyset_lineno (int _line_number )
2221 {
2222
2223 yylineno = _line_number;
2224 }
2225
2226 /** Set the input stream. This does not discard the current
2227 * input buffer.
2228 * @param _in_str A readable stream.
2229 *
2230 * @see yy_switch_to_buffer
2231 */
yyset_in(FILE * _in_str)2232 void yyset_in (FILE * _in_str )
2233 {
2234 yyin = _in_str ;
2235 }
2236
yyset_out(FILE * _out_str)2237 void yyset_out (FILE * _out_str )
2238 {
2239 yyout = _out_str ;
2240 }
2241
yyget_debug(void)2242 int yyget_debug (void)
2243 {
2244 return yy_flex_debug;
2245 }
2246
yyset_debug(int _bdebug)2247 void yyset_debug (int _bdebug )
2248 {
2249 yy_flex_debug = _bdebug ;
2250 }
2251
yy_init_globals(void)2252 static int yy_init_globals (void)
2253 {
2254 /* Initialization is the same as for the non-reentrant scanner.
2255 * This function is called from yylex_destroy(), so don't allocate here.
2256 */
2257
2258 (yy_buffer_stack) = NULL;
2259 (yy_buffer_stack_top) = 0;
2260 (yy_buffer_stack_max) = 0;
2261 (yy_c_buf_p) = NULL;
2262 (yy_init) = 0;
2263 (yy_start) = 0;
2264
2265 (yy_start_stack_ptr) = 0;
2266 (yy_start_stack_depth) = 0;
2267 (yy_start_stack) = NULL;
2268
2269 /* Defined in main.c */
2270 #ifdef YY_STDINIT
2271 yyin = stdin;
2272 yyout = stdout;
2273 #else
2274 yyin = NULL;
2275 yyout = NULL;
2276 #endif
2277
2278 /* For future reference: Set errno on error, since we are called by
2279 * yylex_init()
2280 */
2281 return 0;
2282 }
2283
2284 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)2285 int yylex_destroy (void)
2286 {
2287
2288 /* Pop the buffer stack, destroying each element. */
2289 while(YY_CURRENT_BUFFER){
2290 yy_delete_buffer( YY_CURRENT_BUFFER );
2291 YY_CURRENT_BUFFER_LVALUE = NULL;
2292 yypop_buffer_state();
2293 }
2294
2295 /* Destroy the stack itself. */
2296 yyfree((yy_buffer_stack) );
2297 (yy_buffer_stack) = NULL;
2298
2299 /* Destroy the start condition stack. */
2300 yyfree( (yy_start_stack) );
2301 (yy_start_stack) = NULL;
2302
2303 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2304 * yylex() is called, initialization will occur. */
2305 yy_init_globals( );
2306
2307 return 0;
2308 }
2309
2310 /*
2311 * Internal utility routines.
2312 */
2313
2314 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n)2315 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2316 {
2317
2318 int i;
2319 for ( i = 0; i < n; ++i )
2320 s1[i] = s2[i];
2321 }
2322 #endif
2323
2324 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s)2325 static int yy_flex_strlen (const char * s )
2326 {
2327 int n;
2328 for ( n = 0; s[n]; ++n )
2329 ;
2330
2331 return n;
2332 }
2333 #endif
2334
yyalloc(yy_size_t size)2335 void *yyalloc (yy_size_t size )
2336 {
2337 return malloc(size);
2338 }
2339
yyrealloc(void * ptr,yy_size_t size)2340 void *yyrealloc (void * ptr, yy_size_t size )
2341 {
2342
2343 /* The cast to (char *) in the following accommodates both
2344 * implementations that use char* generic pointers, and those
2345 * that use void* generic pointers. It works with the latter
2346 * because both ANSI C and C++ allow castless assignment from
2347 * any pointer type to void*, and deal with argument conversions
2348 * as though doing an assignment.
2349 */
2350 return realloc(ptr, size);
2351 }
2352
yyfree(void * ptr)2353 void yyfree (void * ptr )
2354 {
2355 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2356 }
2357
2358 #define YYTABLES_NAME "yytables"
2359
2360 #line 180 "cpp.l"
2361
2362 void
cpp_parser_init(FILE * ip)2363 cpp_parser_init(FILE *ip)
2364 {
2365 newline_terminate_string = 1;
2366 DEFAULT_BEGIN_OF_FILE_ACTION
2367 BEGIN CPP;
2368 }
2369
2370