1
#define yy_create_buffer cp__create_buffer
2
#define yy_delete_buffer cp__delete_buffer
3
#define yy_scan_buffer cp__scan_buffer
4
#define yy_scan_string cp__scan_string
5
#define yy_scan_bytes cp__scan_bytes
6
#define yy_flex_debug cp__flex_debug
7
#define yy_init_buffer cp__init_buffer
8
#define yy_flush_buffer cp__flush_buffer
9
#define yy_load_buffer_state cp__load_buffer_state
10
#define yy_switch_to_buffer cp__switch_to_buffer
12
#define yyleng cp_leng
15
#define yyrestart cp_restart
16
#define yytext cp_text
17
#define yylineno cp_lineno
18
#define yywrap cp_wrap
20
/* A lexical scanner generated by flex */
22
/* Scanner skeleton version:
23
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
27
#define YY_FLEX_MAJOR_VERSION 2
28
#define YY_FLEX_MINOR_VERSION 5
33
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
46
/* Use prototypes in function declarations. */
49
/* The "const" storage-class-modifier is valid. */
52
#else /* ! __cplusplus */
60
#endif /* ! __cplusplus */
79
#define YY_PROTO(proto) proto
81
#define YY_PROTO(proto) ()
84
/* Returned upon end-of-file. */
87
/* Promotes a possibly negative, possibly signed char to an unsigned
88
* integer for use as an array index. If the signed char is negative,
89
* we want to instead treat it as an 8-bit unsigned char, hence the
92
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
94
/* Enter a start condition. This macro really ought to take a parameter,
95
* but we do it the disgusting crufty way forced on us by the ()-less
96
* definition of BEGIN.
98
#define BEGIN yy_start = 1 + 2 *
100
/* Translate the current start state into a value that can be later handed
101
* to BEGIN to return to the state. The YYSTATE alias is for lex
104
#define YY_START ((yy_start - 1) / 2)
105
#define YYSTATE YY_START
107
/* Action number for EOF rule of a given start state. */
108
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
110
/* Special action meaning "start processing a new file". */
111
#define YY_NEW_FILE yyrestart( yyin )
113
#define YY_END_OF_BUFFER_CHAR 0
115
/* Size of default input buffer. */
116
#define YY_BUF_SIZE 16384
118
typedef struct yy_buffer_state *YY_BUFFER_STATE;
121
extern FILE *yyin, *yyout;
123
#define EOB_ACT_CONTINUE_SCAN 0
124
#define EOB_ACT_END_OF_FILE 1
125
#define EOB_ACT_LAST_MATCH 2
127
/* The funky do-while in the following #define is used to turn the definition
128
* int a single C statement (which needs a semi-colon terminator). This
129
* avoids problems with code like:
131
* if ( condition_holds )
134
* do_something_else();
136
* Prior to using the do-while the compiler would get upset at the
137
* "else" because it interpreted the "if" statement as being all
138
* done when it reached the ';' after the yyless() call.
141
/* Return all but the first 'n' matched characters back to the input stream. */
146
/* Undo effects of setting up yytext. */ \
147
*yy_cp = yy_hold_char; \
148
YY_RESTORE_YY_MORE_OFFSET \
149
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
150
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
154
#define unput(c) yyunput( c, yytext_ptr )
156
/* The following is because we cannot portably get our hands on size_t
157
* (without autoconf's help, which isn't available because we want
158
* flex-generated scanners to compile on their own).
160
typedef unsigned int yy_size_t;
163
struct yy_buffer_state
167
char *yy_ch_buf; /* input buffer */
168
char *yy_buf_pos; /* current position in input buffer */
170
/* Size of input buffer in bytes, not including room for EOB
173
yy_size_t yy_buf_size;
175
/* Number of characters read into yy_ch_buf, not including EOB
180
/* Whether we "own" the buffer - i.e., we know we created it,
181
* and can realloc() it to grow it, and should free() it to
184
int yy_is_our_buffer;
186
/* Whether this is an "interactive" input source; if so, and
187
* if we're using stdio for input, then we want to use getc()
188
* instead of fread(), to make sure we stop fetching input after
191
int yy_is_interactive;
193
/* Whether we're considered to be at the beginning of a line.
194
* If so, '^' rules will be active on the next match, otherwise
199
/* Whether to try to fill the input buffer when we reach the
204
int yy_buffer_status;
205
#define YY_BUFFER_NEW 0
206
#define YY_BUFFER_NORMAL 1
207
/* When an EOF's been seen but there's still some text to process
208
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
209
* shouldn't try reading from the input source any more. We might
210
* still have a bunch of tokens to match, though, because of
211
* possible backing-up.
213
* When we actually see the EOF, we change the status to "new"
214
* (via yyrestart()), so that the user can continue scanning by
215
* just pointing yyin at a new input file.
217
#define YY_BUFFER_EOF_PENDING 2
220
static YY_BUFFER_STATE yy_current_buffer = 0;
222
/* We provide macros for accessing buffer states in case in the
223
* future we want to put the buffer states in a more general
226
#define YY_CURRENT_BUFFER yy_current_buffer
229
/* yy_hold_char holds the character lost when yytext is formed. */
230
static char yy_hold_char;
232
static int yy_n_chars; /* number of characters read into yy_ch_buf */
237
/* Points to current character in buffer. */
238
static char *yy_c_buf_p = (char *) 0;
239
static int yy_init = 1; /* whether we need to initialize */
240
static int yy_start = 0; /* start state number */
242
/* Flag which is used to allow yywrap()'s to do buffer switches
243
* instead of setting up a fresh yyin. A bit of a hack ...
245
static int yy_did_buffer_switch_on_eof;
247
void yyrestart YY_PROTO(( FILE *input_file ));
249
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
250
void yy_load_buffer_state YY_PROTO(( void ));
251
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
252
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
253
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
254
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
255
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
257
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
258
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
259
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
261
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
262
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
263
static void yy_flex_free YY_PROTO(( void * ));
265
#define yy_new_buffer yy_create_buffer
267
#define yy_set_interactive(is_interactive) \
269
if ( ! yy_current_buffer ) \
270
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
271
yy_current_buffer->yy_is_interactive = is_interactive; \
274
#define yy_set_bol(at_bol) \
276
if ( ! yy_current_buffer ) \
277
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
278
yy_current_buffer->yy_at_bol = at_bol; \
281
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
284
#define YY_USES_REJECT
285
typedef unsigned char YY_CHAR;
286
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
287
typedef int yy_state_type;
291
#define yytext_ptr yytext
293
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
294
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
295
static int yy_get_next_buffer YY_PROTO(( void ));
296
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
298
/* Done after the current pattern has been matched and before the
299
* corresponding action - sets up yytext.
301
#define YY_DO_BEFORE_ACTION \
302
yytext_ptr = yy_bp; \
303
yyleng = (int) (yy_cp - yy_bp); \
304
yy_hold_char = *yy_cp; \
308
#define YY_NUM_RULES 16
309
#define YY_END_OF_BUFFER 17
310
static yyconst short int yy_acclist[37] =
312
17, 6, 16, 4, 6, 16, 5, 16, 6, 16,
313
16, 15, 16, 12, 15, 16, 14, 16, 11, 15,
314
16, 10, 15, 16, 13, 15, 16, 8, 16, 7,
318
static yyconst short int yy_accept[30] =
320
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
321
4, 7, 9, 11, 12, 14, 17, 19, 22, 25,
322
28, 30, 32, 33, 34, 35, 36, 37, 37
325
static yyconst int yy_ec[256] =
327
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
328
4, 1, 5, 1, 1, 1, 1, 1, 1, 1,
329
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330
1, 2, 6, 1, 1, 1, 1, 1, 1, 1,
331
1, 7, 1, 1, 1, 1, 8, 1, 1, 1,
332
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
335
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
338
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357
static yyconst int yy_meta[9] =
359
1, 1, 1, 1, 1, 1, 1, 1
362
static yyconst short int yy_base[31] =
364
0, 0, 0, 0, 8, 0, 24, 23, 25, 28,
365
28, 28, 10, 28, 28, 28, 28, 28, 28, 16,
366
28, 28, 17, 14, 28, 28, 13, 28, 19, 18
369
static yyconst short int yy_def[31] =
371
28, 1, 29, 29, 28, 5, 30, 30, 28, 28,
372
28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
373
28, 28, 28, 28, 28, 28, 28, 0, 28, 28
376
static yyconst short int yy_nxt[37] =
378
10, 11, 12, 11, 10, 10, 10, 13, 15, 16,
379
17, 18, 19, 15, 20, 15, 23, 24, 21, 14,
380
27, 27, 26, 25, 28, 22, 22, 9, 28, 28,
381
28, 28, 28, 28, 28, 28
384
static yyconst short int yy_chk[37] =
386
1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
387
5, 5, 5, 5, 5, 5, 13, 13, 30, 29,
388
27, 24, 23, 20, 9, 8, 7, 28, 28, 28,
389
28, 28, 28, 28, 28, 28
392
static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
393
static char *yy_full_match;
397
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
398
yy_cp = yy_full_match; /* restore poss. backed-over text */ \
402
#define yymore() yymore_used_but_not_detected
403
#define YY_MORE_ADJ 0
404
#define YY_RESTORE_YY_MORE_OFFSET
408
* the "incl" state is used for picking up the name
415
#define cpp_comment 3
424
#ifdef YY_FATAL_ERROR
425
#undef YY_FATAL_ERROR
427
#define YY_FATAL_ERROR(msg)
430
#include "comment_parser.h"
432
static CommentParseResult *pResults = NULL;
433
static std::string strComment;
434
static std::string strCppComment;
435
static int iCppCommentLine = -1;
437
/* Macros after this point can all be overridden by user definitions in
441
#ifndef YY_SKIP_YYWRAP
443
extern "C" int yywrap YY_PROTO(( void ));
445
extern int yywrap YY_PROTO(( void ));
450
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
454
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
457
#ifdef YY_NEED_STRLEN
458
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
463
static int yyinput YY_PROTO(( void ));
465
static int input YY_PROTO(( void ));
470
static int yy_start_stack_ptr = 0;
471
static int yy_start_stack_depth = 0;
472
static int *yy_start_stack = 0;
473
#ifndef YY_NO_PUSH_STATE
474
static void yy_push_state YY_PROTO(( int new_state ));
476
#ifndef YY_NO_POP_STATE
477
static void yy_pop_state YY_PROTO(( void ));
479
#ifndef YY_NO_TOP_STATE
480
static int yy_top_state YY_PROTO(( void ));
484
#define YY_NO_PUSH_STATE 1
485
#define YY_NO_POP_STATE 1
486
#define YY_NO_TOP_STATE 1
489
#ifdef YY_MALLOC_DECL
497
/* Just try to get by without declaring the routines. This will fail
498
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
499
* or sizeof(void*) != sizeof(int).
504
/* Amount of stuff to slurp up with each read. */
505
#ifndef YY_READ_BUF_SIZE
506
#define YY_READ_BUF_SIZE 8192
509
/* Copy whatever the last rule matched to the standard output. */
512
/* This used to be an fputs(), but since the string might contain NUL's,
513
* we now use fwrite().
515
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
518
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
519
* is returned in "result".
522
#define YY_INPUT(buf,result,max_size) \
523
if ( yy_current_buffer->yy_is_interactive ) \
526
for ( n = 0; n < max_size && \
527
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
530
buf[n++] = (char) c; \
531
if ( c == EOF && ferror( yyin ) ) \
532
YY_FATAL_ERROR( "input in flex scanner failed" ); \
535
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
536
&& ferror( yyin ) ) \
537
YY_FATAL_ERROR( "input in flex scanner failed" );
540
/* No semi-colon after return; correct usage is to write "yyterminate();" -
541
* we don't want an extra ';' after the "return" because that will cause
542
* some compilers to complain about unreachable statements.
545
#define yyterminate() return YY_NULL
548
/* Number of entries by which start-condition stack grows. */
549
#ifndef YY_START_STACK_INCR
550
#define YY_START_STACK_INCR 25
553
/* Report a fatal error. */
554
#ifndef YY_FATAL_ERROR
555
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
558
/* Default declaration of generated scanner - a define so the user can
559
* easily add parameters.
562
#define YY_DECL int yylex YY_PROTO(( void ))
565
/* Code executed at the beginning of each rule, after yytext and yyleng
568
#ifndef YY_USER_ACTION
569
#define YY_USER_ACTION
572
/* Code executed at the end of each rule. */
574
#define YY_BREAK break;
577
#define YY_RULE_SETUP \
582
register yy_state_type yy_current_state;
583
register char *yy_cp, *yy_bp;
598
yy_start = 1; /* first start state */
606
if ( ! yy_current_buffer )
608
yy_create_buffer( yyin, YY_BUF_SIZE );
610
yy_load_buffer_state();
613
while ( 1 ) /* loops until end-of-file is reached */
617
/* Support of yytext. */
618
*yy_cp = yy_hold_char;
620
/* yy_bp points to the position in yy_ch_buf of the start of
625
yy_current_state = yy_start;
626
yy_state_ptr = yy_state_buf;
627
*yy_state_ptr++ = yy_current_state;
631
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
632
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
634
yy_current_state = (int) yy_def[yy_current_state];
635
if ( yy_current_state >= 29 )
636
yy_c = yy_meta[(unsigned int) yy_c];
638
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
639
*yy_state_ptr++ = yy_current_state;
642
while ( yy_base[yy_current_state] != 28 );
645
yy_current_state = *--yy_state_ptr;
646
yy_lp = yy_accept[yy_current_state];
647
find_rule: /* we branch to this label when backing up */
648
for ( ; ; ) /* until we find what rule we matched */
650
if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
652
yy_act = yy_acclist[yy_lp];
654
yy_full_match = yy_cp;
659
yy_current_state = *--yy_state_ptr;
660
yy_lp = yy_accept[yy_current_state];
665
if ( yy_act != YY_END_OF_BUFFER )
668
for ( yyl = 0; yyl < yyleng; ++yyl )
669
if ( yytext[yyl] == '\n' )
673
do_action: /* This label is used only to access EOF actions. */
677
{ /* beginning of action switch */
681
if(strCppComment.empty() == false) {
682
strCppComment += "\n";
684
iCppCommentLine = cp_lineno;
691
/* if we kept some C++ comment, it is time to flush it to the
693
if(strCppComment.empty() == false && pResults) {
694
pResults->addComment(strCppComment, iCppCommentLine, false);
695
strCppComment.clear();
696
iCppCommentLine = -1;
705
/* if we kept some C++ comment, it is time to flush it to the
707
if(strCppComment.empty() == false && pResults) {
708
pResults->addComment(strCppComment, iCppCommentLine, false);
709
strCppComment.clear();
710
iCppCommentLine = -1;
718
{ /* skip whitespaces */}
723
/* if we kept some C++ comment, it is time to flush it to the
725
if(strCppComment.empty() == false && pResults) {
726
pResults->addComment(strCppComment, iCppCommentLine, false);
727
strCppComment.clear();
728
iCppCommentLine = -1;
735
/* if we kept some C++ comment, it is time to flush it to the
737
if(strCppComment.empty() == false && pResults) {
738
pResults->addComment(strCppComment, iCppCommentLine, false);
739
strCppComment.clear();
740
iCppCommentLine = -1;
752
{strCppComment += yytext;} /* do nothing */
757
pResults->addComment(strComment, cp_lineno, false);
772
if(strComment.empty() == false) {
773
if(strComment.at(strComment.length() -1) == '\n'){
774
// dont add indentation tabs
779
// empty comment: dont prepend whitespaces at start
786
if(strComment.empty() == false) {
787
if(strComment.at(strComment.length() -1) == '\n'){
788
// dont add indentation tabs
793
// empty comment: dont prepend '*'
799
{ strComment += "\n";}
803
{ strComment += yytext;}
805
case YY_STATE_EOF(INITIAL):
806
case YY_STATE_EOF(incl):
807
case YY_STATE_EOF(c_comment):
808
case YY_STATE_EOF(cpp_comment):
810
if(strCppComment.empty() == false && pResults) {
811
pResults->addComment(strCppComment, iCppCommentLine, false);
812
strCppComment.clear();
813
iCppCommentLine = -1;
816
if ( YY_CURRENT_BUFFER->yy_input_file ) {
817
fclose( YY_CURRENT_BUFFER->yy_input_file );
818
YY_CURRENT_BUFFER->yy_input_file = NULL;
821
yy_delete_buffer ( YY_CURRENT_BUFFER );
830
case YY_END_OF_BUFFER:
832
/* Amount of text matched not including the EOB char. */
833
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
835
/* Undo the effects of YY_DO_BEFORE_ACTION. */
836
*yy_cp = yy_hold_char;
837
YY_RESTORE_YY_MORE_OFFSET
839
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
841
/* We're scanning a new file or input source. It's
842
* possible that this happened because the user
843
* just pointed yyin at a new source and called
844
* yylex(). If so, then we have to assure
845
* consistency between yy_current_buffer and our
846
* globals. Here is the right place to do so, because
847
* this is the first action (other than possibly a
848
* back-up) that will match for the new input source.
850
yy_n_chars = yy_current_buffer->yy_n_chars;
851
yy_current_buffer->yy_input_file = yyin;
852
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
855
/* Note that here we test for yy_c_buf_p "<=" to the position
856
* of the first EOB in the buffer, since yy_c_buf_p will
857
* already have been incremented past the NUL character
858
* (since all states make transitions on EOB to the
859
* end-of-buffer state). Contrast this with the test
862
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
863
{ /* This was really a NUL. */
864
yy_state_type yy_next_state;
866
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
868
yy_current_state = yy_get_previous_state();
870
/* Okay, we're now positioned to make the NUL
871
* transition. We couldn't have
872
* yy_get_previous_state() go ahead and do it
873
* for us because it doesn't know how to deal
874
* with the possibility of jamming (and we don't
875
* want to build jamming into it because then it
876
* will run more slowly).
879
yy_next_state = yy_try_NUL_trans( yy_current_state );
881
yy_bp = yytext_ptr + YY_MORE_ADJ;
885
/* Consume the NUL. */
886
yy_cp = ++yy_c_buf_p;
887
yy_current_state = yy_next_state;
898
else switch ( yy_get_next_buffer() )
900
case EOB_ACT_END_OF_FILE:
902
yy_did_buffer_switch_on_eof = 0;
906
/* Note: because we've taken care in
907
* yy_get_next_buffer() to have set up
908
* yytext, we can now set up
909
* yy_c_buf_p so that if some total
910
* hoser (like flex itself) wants to
911
* call the scanner after we return the
912
* YY_NULL, it'll still work - another
913
* YY_NULL will get returned.
915
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
917
yy_act = YY_STATE_EOF(YY_START);
923
if ( ! yy_did_buffer_switch_on_eof )
929
case EOB_ACT_CONTINUE_SCAN:
931
yytext_ptr + yy_amount_of_matched_text;
933
yy_current_state = yy_get_previous_state();
936
yy_bp = yytext_ptr + YY_MORE_ADJ;
939
case EOB_ACT_LAST_MATCH:
941
&yy_current_buffer->yy_ch_buf[yy_n_chars];
943
yy_current_state = yy_get_previous_state();
946
yy_bp = yytext_ptr + YY_MORE_ADJ;
954
"fatal flex scanner internal error--no action found" );
955
} /* end of action switch */
956
} /* end of scanning one token */
960
/* yy_get_next_buffer - try to read in a new buffer
962
* Returns a code representing an action:
963
* EOB_ACT_LAST_MATCH -
964
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
965
* EOB_ACT_END_OF_FILE - end of file
968
static int yy_get_next_buffer()
970
register char *dest = yy_current_buffer->yy_ch_buf;
971
register char *source = yytext_ptr;
972
register int number_to_move, i;
975
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
977
"fatal flex scanner internal error--end of buffer missed" );
979
if ( yy_current_buffer->yy_fill_buffer == 0 )
980
{ /* Don't try to fill the buffer, so this is an EOF. */
981
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
983
/* We matched a single character, the EOB, so
984
* treat this as a final EOF.
986
return EOB_ACT_END_OF_FILE;
991
/* We matched some text prior to the EOB, first
994
return EOB_ACT_LAST_MATCH;
998
/* Try to read more data. */
1000
/* First move last chars to start of buffer. */
1001
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1003
for ( i = 0; i < number_to_move; ++i )
1004
*(dest++) = *(source++);
1006
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1007
/* don't do the read, it's not guaranteed to return an EOF,
1010
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1015
yy_current_buffer->yy_buf_size - number_to_move - 1;
1017
while ( num_to_read <= 0 )
1018
{ /* Not enough room in the buffer - grow it. */
1019
#ifdef YY_USES_REJECT
1021
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1024
/* just a shorter name for the current buffer */
1025
YY_BUFFER_STATE b = yy_current_buffer;
1027
int yy_c_buf_p_offset =
1028
(int) (yy_c_buf_p - b->yy_ch_buf);
1030
if ( b->yy_is_our_buffer )
1032
int new_size = b->yy_buf_size * 2;
1034
if ( new_size <= 0 )
1035
b->yy_buf_size += b->yy_buf_size / 8;
1037
b->yy_buf_size *= 2;
1039
b->yy_ch_buf = (char *)
1040
/* Include room in for 2 EOB chars. */
1041
yy_flex_realloc( (void *) b->yy_ch_buf,
1042
b->yy_buf_size + 2 );
1045
/* Can't grow it, we don't own it. */
1048
if ( ! b->yy_ch_buf )
1050
"fatal error - scanner input buffer overflow" );
1052
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1054
num_to_read = yy_current_buffer->yy_buf_size -
1059
if ( num_to_read > YY_READ_BUF_SIZE )
1060
num_to_read = YY_READ_BUF_SIZE;
1062
/* Read in more data. */
1063
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1064
yy_n_chars, num_to_read );
1066
yy_current_buffer->yy_n_chars = yy_n_chars;
1069
if ( yy_n_chars == 0 )
1071
if ( number_to_move == YY_MORE_ADJ )
1073
ret_val = EOB_ACT_END_OF_FILE;
1079
ret_val = EOB_ACT_LAST_MATCH;
1080
yy_current_buffer->yy_buffer_status =
1081
YY_BUFFER_EOF_PENDING;
1086
ret_val = EOB_ACT_CONTINUE_SCAN;
1088
yy_n_chars += number_to_move;
1089
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1090
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1092
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1098
/* yy_get_previous_state - get the state just before the EOB char was reached */
1100
static yy_state_type yy_get_previous_state()
1102
register yy_state_type yy_current_state;
1103
register char *yy_cp;
1105
yy_current_state = yy_start;
1106
yy_state_ptr = yy_state_buf;
1107
*yy_state_ptr++ = yy_current_state;
1109
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1111
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1112
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1114
yy_current_state = (int) yy_def[yy_current_state];
1115
if ( yy_current_state >= 29 )
1116
yy_c = yy_meta[(unsigned int) yy_c];
1118
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1119
*yy_state_ptr++ = yy_current_state;
1122
return yy_current_state;
1126
/* yy_try_NUL_trans - try to make a transition on the NUL character
1129
* next_state = yy_try_NUL_trans( current_state );
1132
#ifdef YY_USE_PROTOS
1133
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1135
static yy_state_type yy_try_NUL_trans( yy_current_state )
1136
yy_state_type yy_current_state;
1139
register int yy_is_jam;
1141
register YY_CHAR yy_c = 1;
1142
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1144
yy_current_state = (int) yy_def[yy_current_state];
1145
if ( yy_current_state >= 29 )
1146
yy_c = yy_meta[(unsigned int) yy_c];
1148
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1149
yy_is_jam = (yy_current_state == 28);
1151
*yy_state_ptr++ = yy_current_state;
1153
return yy_is_jam ? 0 : yy_current_state;
1158
#ifdef YY_USE_PROTOS
1159
static void yyunput( int c, register char *yy_bp )
1161
static void yyunput( c, yy_bp )
1163
register char *yy_bp;
1166
register char *yy_cp = yy_c_buf_p;
1168
/* undo effects of setting up yytext */
1169
*yy_cp = yy_hold_char;
1171
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1172
{ /* need to shift things up to make room */
1173
/* +2 for EOB chars. */
1174
register int number_to_move = yy_n_chars + 2;
1175
register char *dest = &yy_current_buffer->yy_ch_buf[
1176
yy_current_buffer->yy_buf_size + 2];
1177
register char *source =
1178
&yy_current_buffer->yy_ch_buf[number_to_move];
1180
while ( source > yy_current_buffer->yy_ch_buf )
1181
*--dest = *--source;
1183
yy_cp += (int) (dest - source);
1184
yy_bp += (int) (dest - source);
1185
yy_current_buffer->yy_n_chars =
1186
yy_n_chars = yy_current_buffer->yy_buf_size;
1188
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1189
YY_FATAL_ERROR( "flex scanner push-back overflow" );
1192
*--yy_cp = (char) c;
1198
yy_hold_char = *yy_cp;
1201
#endif /* ifndef YY_NO_UNPUT */
1205
static int yyinput()
1212
*yy_c_buf_p = yy_hold_char;
1214
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1216
/* yy_c_buf_p now points to the character we want to return.
1217
* If this occurs *before* the EOB characters, then it's a
1218
* valid NUL; if not, then we've hit the end of the buffer.
1220
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1221
/* This was really a NUL. */
1225
{ /* need more input */
1226
int offset = yy_c_buf_p - yytext_ptr;
1229
switch ( yy_get_next_buffer() )
1231
case EOB_ACT_LAST_MATCH:
1232
/* This happens because yy_g_n_b()
1233
* sees that we've accumulated a
1234
* token and flags that we need to
1235
* try matching the token before
1236
* proceeding. But for input(),
1237
* there's no matching to consider.
1238
* So convert the EOB_ACT_LAST_MATCH
1239
* to EOB_ACT_END_OF_FILE.
1242
/* Reset buffer status. */
1247
case EOB_ACT_END_OF_FILE:
1252
if ( ! yy_did_buffer_switch_on_eof )
1261
case EOB_ACT_CONTINUE_SCAN:
1262
yy_c_buf_p = yytext_ptr + offset;
1268
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1269
*yy_c_buf_p = '\0'; /* preserve yytext */
1270
yy_hold_char = *++yy_c_buf_p;
1279
#ifdef YY_USE_PROTOS
1280
void yyrestart( FILE *input_file )
1282
void yyrestart( input_file )
1286
if ( ! yy_current_buffer )
1287
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1289
yy_init_buffer( yy_current_buffer, input_file );
1290
yy_load_buffer_state();
1294
#ifdef YY_USE_PROTOS
1295
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1297
void yy_switch_to_buffer( new_buffer )
1298
YY_BUFFER_STATE new_buffer;
1301
if ( yy_current_buffer == new_buffer )
1304
if ( yy_current_buffer )
1306
/* Flush out information for old buffer. */
1307
*yy_c_buf_p = yy_hold_char;
1308
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1309
yy_current_buffer->yy_n_chars = yy_n_chars;
1312
yy_current_buffer = new_buffer;
1313
yy_load_buffer_state();
1315
/* We don't actually know whether we did this switch during
1316
* EOF (yywrap()) processing, but the only time this flag
1317
* is looked at is after yywrap() is called, so it's safe
1318
* to go ahead and always set it.
1320
yy_did_buffer_switch_on_eof = 1;
1324
#ifdef YY_USE_PROTOS
1325
void yy_load_buffer_state( void )
1327
void yy_load_buffer_state()
1330
yy_n_chars = yy_current_buffer->yy_n_chars;
1331
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1332
yyin = yy_current_buffer->yy_input_file;
1333
yy_hold_char = *yy_c_buf_p;
1337
#ifdef YY_USE_PROTOS
1338
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1340
YY_BUFFER_STATE yy_create_buffer( file, size )
1347
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1349
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1351
b->yy_buf_size = size;
1353
/* yy_ch_buf has to be 2 characters longer than the size given because
1354
* we need to put in 2 end-of-buffer characters.
1356
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1357
if ( ! b->yy_ch_buf )
1358
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1360
b->yy_is_our_buffer = 1;
1362
yy_init_buffer( b, file );
1368
#ifdef YY_USE_PROTOS
1369
void yy_delete_buffer( YY_BUFFER_STATE b )
1371
void yy_delete_buffer( b )
1378
if ( b == yy_current_buffer )
1379
yy_current_buffer = (YY_BUFFER_STATE) 0;
1381
if ( b->yy_is_our_buffer )
1382
yy_flex_free( (void *) b->yy_ch_buf );
1384
yy_flex_free( (void *) b );
1388
#ifndef YY_ALWAYS_INTERACTIVE
1389
#ifndef YY_NEVER_INTERACTIVE
1390
extern int isatty YY_PROTO(( int ));
1394
#ifdef YY_USE_PROTOS
1395
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1397
void yy_init_buffer( b, file )
1404
yy_flush_buffer( b );
1406
b->yy_input_file = file;
1407
b->yy_fill_buffer = 1;
1409
#if YY_ALWAYS_INTERACTIVE
1410
b->yy_is_interactive = 1;
1412
#if YY_NEVER_INTERACTIVE
1413
b->yy_is_interactive = 0;
1415
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1421
#ifdef YY_USE_PROTOS
1422
void yy_flush_buffer( YY_BUFFER_STATE b )
1424
void yy_flush_buffer( b )
1434
/* We always need two end-of-buffer characters. The first causes
1435
* a transition to the end-of-buffer state. The second causes
1436
* a jam in that state.
1438
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1439
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1441
b->yy_buf_pos = &b->yy_ch_buf[0];
1444
b->yy_buffer_status = YY_BUFFER_NEW;
1446
if ( b == yy_current_buffer )
1447
yy_load_buffer_state();
1451
#ifndef YY_NO_SCAN_BUFFER
1452
#ifdef YY_USE_PROTOS
1453
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1455
YY_BUFFER_STATE yy_scan_buffer( base, size )
1463
base[size-2] != YY_END_OF_BUFFER_CHAR ||
1464
base[size-1] != YY_END_OF_BUFFER_CHAR )
1465
/* They forgot to leave room for the EOB's. */
1468
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1470
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1472
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1473
b->yy_buf_pos = b->yy_ch_buf = base;
1474
b->yy_is_our_buffer = 0;
1475
b->yy_input_file = 0;
1476
b->yy_n_chars = b->yy_buf_size;
1477
b->yy_is_interactive = 0;
1479
b->yy_fill_buffer = 0;
1480
b->yy_buffer_status = YY_BUFFER_NEW;
1482
yy_switch_to_buffer( b );
1489
#ifndef YY_NO_SCAN_STRING
1490
#ifdef YY_USE_PROTOS
1491
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1493
YY_BUFFER_STATE yy_scan_string( yy_str )
1494
yyconst char *yy_str;
1498
for ( len = 0; yy_str[len]; ++len )
1501
return yy_scan_bytes( yy_str, len );
1506
#ifndef YY_NO_SCAN_BYTES
1507
#ifdef YY_USE_PROTOS
1508
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1510
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1511
yyconst char *bytes;
1520
/* Get memory for full buffer, including space for trailing EOB's. */
1522
buf = (char *) yy_flex_alloc( n );
1524
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1526
for ( i = 0; i < len; ++i )
1529
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1531
b = yy_scan_buffer( buf, n );
1533
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1535
/* It's okay to grow etc. this buffer, and we should throw it
1536
* away when we're done.
1538
b->yy_is_our_buffer = 1;
1545
#ifndef YY_NO_PUSH_STATE
1546
#ifdef YY_USE_PROTOS
1547
static void yy_push_state( int new_state )
1549
static void yy_push_state( new_state )
1553
if ( yy_start_stack_ptr >= yy_start_stack_depth )
1557
yy_start_stack_depth += YY_START_STACK_INCR;
1558
new_size = yy_start_stack_depth * sizeof( int );
1560
if ( ! yy_start_stack )
1561
yy_start_stack = (int *) yy_flex_alloc( new_size );
1564
yy_start_stack = (int *) yy_flex_realloc(
1565
(void *) yy_start_stack, new_size );
1567
if ( ! yy_start_stack )
1569
"out of memory expanding start-condition stack" );
1572
yy_start_stack[yy_start_stack_ptr++] = YY_START;
1579
#ifndef YY_NO_POP_STATE
1580
static void yy_pop_state()
1582
if ( --yy_start_stack_ptr < 0 )
1583
YY_FATAL_ERROR( "start-condition stack underflow" );
1585
BEGIN(yy_start_stack[yy_start_stack_ptr]);
1590
#ifndef YY_NO_TOP_STATE
1591
static int yy_top_state()
1593
return yy_start_stack[yy_start_stack_ptr - 1];
1597
#ifndef YY_EXIT_FAILURE
1598
#define YY_EXIT_FAILURE 2
1601
#ifdef YY_USE_PROTOS
1602
static void yy_fatal_error( yyconst char msg[] )
1604
static void yy_fatal_error( msg )
1608
(void) fprintf( stderr, "%s\n", msg );
1609
exit( YY_EXIT_FAILURE );
1614
/* Redefine yyless() so it works in section 3 code. */
1620
/* Undo effects of setting up yytext. */ \
1621
yytext[yyleng] = yy_hold_char; \
1622
yy_c_buf_p = yytext + n; \
1623
yy_hold_char = *yy_c_buf_p; \
1624
*yy_c_buf_p = '\0'; \
1630
/* Internal utility routines. */
1633
#ifdef YY_USE_PROTOS
1634
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1636
static void yy_flex_strncpy( s1, s2, n )
1643
for ( i = 0; i < n; ++i )
1648
#ifdef YY_NEED_STRLEN
1649
#ifdef YY_USE_PROTOS
1650
static int yy_flex_strlen( yyconst char *s )
1652
static int yy_flex_strlen( s )
1657
for ( n = 0; s[n]; ++n )
1665
#ifdef YY_USE_PROTOS
1666
static void *yy_flex_alloc( yy_size_t size )
1668
static void *yy_flex_alloc( size )
1672
return (void *) malloc( size );
1675
#ifdef YY_USE_PROTOS
1676
static void *yy_flex_realloc( void *ptr, yy_size_t size )
1678
static void *yy_flex_realloc( ptr, size )
1683
/* The cast to (char *) in the following accommodates both
1684
* implementations that use char* generic pointers, and those
1685
* that use void* generic pointers. It works with the latter
1686
* because both ANSI C and C++ allow castless assignment from
1687
* any pointer type to void*, and deal with argument conversions
1688
* as though doing an assignment.
1690
return (void *) realloc( (char *) ptr, size );
1693
#ifdef YY_USE_PROTOS
1694
static void yy_flex_free( void *ptr )
1696
static void yy_flex_free( ptr )
1716
int ParseComments(const char* filePath, CommentParseResult &comments)
1721
FILE* fp = fopen(filePath, "r");
1726
pResults = &comments;
1728
strCppComment.clear();
1729
iCppCommentLine = -1;
1731
yy_switch_to_buffer( yy_create_buffer(fp, YY_BUF_SIZE) );
1734
yy_delete_buffer ( YY_CURRENT_BUFFER );
1739
strCppComment.clear();
1740
iCppCommentLine = -1;