~ubuntu-branches/ubuntu/oneiric/codelite/oneiric

« back to all changes in this revision

Viewing changes to CommentParser/CommentParser/comment_parser.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-07-29 19:42:47 UTC
  • mfrom: (0.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100729194247-hqgxamd2yl8f1l7x
* New upstream release.
* Bump Standards.
* Refresh patches.
* Add license information about files under ./Debugger/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
11
#define yyin cp_in
 
12
#define yyleng cp_leng
 
13
#define yylex cp_lex
 
14
#define yyout cp_out
 
15
#define yyrestart cp_restart
 
16
#define yytext cp_text
 
17
#define yylineno cp_lineno
 
18
#define yywrap cp_wrap
 
19
 
 
20
/* A lexical scanner generated by flex */
 
21
 
 
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 $
 
24
 */
 
25
 
 
26
#define FLEX_SCANNER
 
27
#define YY_FLEX_MAJOR_VERSION 2
 
28
#define YY_FLEX_MINOR_VERSION 5
 
29
 
 
30
#include <stdio.h>
 
31
 
 
32
 
 
33
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
 
34
#ifdef c_plusplus
 
35
#ifndef __cplusplus
 
36
#define __cplusplus
 
37
#endif
 
38
#endif
 
39
 
 
40
 
 
41
#ifdef __cplusplus
 
42
 
 
43
#include <stdlib.h>
 
44
#include <unistd.h>
 
45
 
 
46
/* Use prototypes in function declarations. */
 
47
#define YY_USE_PROTOS
 
48
 
 
49
/* The "const" storage-class-modifier is valid. */
 
50
#define YY_USE_CONST
 
51
 
 
52
#else   /* ! __cplusplus */
 
53
 
 
54
#if __STDC__
 
55
 
 
56
#define YY_USE_PROTOS
 
57
#define YY_USE_CONST
 
58
 
 
59
#endif  /* __STDC__ */
 
60
#endif  /* ! __cplusplus */
 
61
 
 
62
#ifdef __TURBOC__
 
63
 #pragma warn -rch
 
64
 #pragma warn -use
 
65
#include <io.h>
 
66
#include <stdlib.h>
 
67
#define YY_USE_CONST
 
68
#define YY_USE_PROTOS
 
69
#endif
 
70
 
 
71
#ifdef YY_USE_CONST
 
72
#define yyconst const
 
73
#else
 
74
#define yyconst
 
75
#endif
 
76
 
 
77
 
 
78
#ifdef YY_USE_PROTOS
 
79
#define YY_PROTO(proto) proto
 
80
#else
 
81
#define YY_PROTO(proto) ()
 
82
#endif
 
83
 
 
84
/* Returned upon end-of-file. */
 
85
#define YY_NULL 0
 
86
 
 
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
 
90
 * double cast.
 
91
 */
 
92
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
 
93
 
 
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.
 
97
 */
 
98
#define BEGIN yy_start = 1 + 2 *
 
99
 
 
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
 
102
 * compatibility.
 
103
 */
 
104
#define YY_START ((yy_start - 1) / 2)
 
105
#define YYSTATE YY_START
 
106
 
 
107
/* Action number for EOF rule of a given start state. */
 
108
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
109
 
 
110
/* Special action meaning "start processing a new file". */
 
111
#define YY_NEW_FILE yyrestart( yyin )
 
112
 
 
113
#define YY_END_OF_BUFFER_CHAR 0
 
114
 
 
115
/* Size of default input buffer. */
 
116
#define YY_BUF_SIZE 16384
 
117
 
 
118
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
119
 
 
120
extern int yyleng;
 
121
extern FILE *yyin, *yyout;
 
122
 
 
123
#define EOB_ACT_CONTINUE_SCAN 0
 
124
#define EOB_ACT_END_OF_FILE 1
 
125
#define EOB_ACT_LAST_MATCH 2
 
126
 
 
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:
 
130
 *
 
131
 *      if ( condition_holds )
 
132
 *              yyless( 5 );
 
133
 *      else
 
134
 *              do_something_else();
 
135
 *
 
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.
 
139
 */
 
140
 
 
141
/* Return all but the first 'n' matched characters back to the input stream. */
 
142
 
 
143
#define yyless(n) \
 
144
        do \
 
145
                { \
 
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 */ \
 
151
                } \
 
152
        while ( 0 )
 
153
 
 
154
#define unput(c) yyunput( c, yytext_ptr )
 
155
 
 
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).
 
159
 */
 
160
typedef unsigned int yy_size_t;
 
161
 
 
162
 
 
163
struct yy_buffer_state
 
164
        {
 
165
        FILE *yy_input_file;
 
166
 
 
167
        char *yy_ch_buf;                /* input buffer */
 
168
        char *yy_buf_pos;               /* current position in input buffer */
 
169
 
 
170
        /* Size of input buffer in bytes, not including room for EOB
 
171
         * characters.
 
172
         */
 
173
        yy_size_t yy_buf_size;
 
174
 
 
175
        /* Number of characters read into yy_ch_buf, not including EOB
 
176
         * characters.
 
177
         */
 
178
        int yy_n_chars;
 
179
 
 
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
 
182
         * delete it.
 
183
         */
 
184
        int yy_is_our_buffer;
 
185
 
 
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
 
189
         * each newline.
 
190
         */
 
191
        int yy_is_interactive;
 
192
 
 
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
 
195
         * not.
 
196
         */
 
197
        int yy_at_bol;
 
198
 
 
199
        /* Whether to try to fill the input buffer when we reach the
 
200
         * end of it.
 
201
         */
 
202
        int yy_fill_buffer;
 
203
 
 
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.
 
212
         *
 
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.
 
216
         */
 
217
#define YY_BUFFER_EOF_PENDING 2
 
218
        };
 
219
 
 
220
static YY_BUFFER_STATE yy_current_buffer = 0;
 
221
 
 
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
 
224
 * "scanner state".
 
225
 */
 
226
#define YY_CURRENT_BUFFER yy_current_buffer
 
227
 
 
228
 
 
229
/* yy_hold_char holds the character lost when yytext is formed. */
 
230
static char yy_hold_char;
 
231
 
 
232
static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 
233
 
 
234
 
 
235
int yyleng;
 
236
 
 
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 */
 
241
 
 
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 ...
 
244
 */
 
245
static int yy_did_buffer_switch_on_eof;
 
246
 
 
247
void yyrestart YY_PROTO(( FILE *input_file ));
 
248
 
 
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 )
 
256
 
 
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 ));
 
260
 
 
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 * ));
 
264
 
 
265
#define yy_new_buffer yy_create_buffer
 
266
 
 
267
#define yy_set_interactive(is_interactive) \
 
268
        { \
 
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; \
 
272
        }
 
273
 
 
274
#define yy_set_bol(at_bol) \
 
275
        { \
 
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; \
 
279
        }
 
280
 
 
281
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
 
282
 
 
283
 
 
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;
 
288
extern int yylineno;
 
289
int yylineno = 1;
 
290
extern char *yytext;
 
291
#define yytext_ptr yytext
 
292
 
 
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[] ));
 
297
 
 
298
/* Done after the current pattern has been matched and before the
 
299
 * corresponding action - sets up yytext.
 
300
 */
 
301
#define YY_DO_BEFORE_ACTION \
 
302
        yytext_ptr = yy_bp; \
 
303
        yyleng = (int) (yy_cp - yy_bp); \
 
304
        yy_hold_char = *yy_cp; \
 
305
        *yy_cp = '\0'; \
 
306
        yy_c_buf_p = yy_cp;
 
307
 
 
308
#define YY_NUM_RULES 16
 
309
#define YY_END_OF_BUFFER 17
 
310
static yyconst short int yy_acclist[37] =
 
311
    {   0,
 
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,
 
315
       16,    2,    1,    9,    3,    1
 
316
    } ;
 
317
 
 
318
static yyconst short int yy_accept[30] =
 
319
    {   0,
 
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
 
323
    } ;
 
324
 
 
325
static yyconst int yy_ec[256] =
 
326
    {   0,
 
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,
 
337
 
 
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,
 
348
 
 
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,
 
354
        1,    1,    1,    1,    1
 
355
    } ;
 
356
 
 
357
static yyconst int yy_meta[9] =
 
358
    {   0,
 
359
        1,    1,    1,    1,    1,    1,    1,    1
 
360
    } ;
 
361
 
 
362
static yyconst short int yy_base[31] =
 
363
    {   0,
 
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
 
367
    } ;
 
368
 
 
369
static yyconst short int yy_def[31] =
 
370
    {   0,
 
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
 
374
    } ;
 
375
 
 
376
static yyconst short int yy_nxt[37] =
 
377
    {   0,
 
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
 
382
    } ;
 
383
 
 
384
static yyconst short int yy_chk[37] =
 
385
    {   0,
 
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
 
390
    } ;
 
391
 
 
392
static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
 
393
static char *yy_full_match;
 
394
static int yy_lp;
 
395
#define REJECT \
 
396
{ \
 
397
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
 
398
yy_cp = yy_full_match; /* restore poss. backed-over text */ \
 
399
++yy_lp; \
 
400
goto find_rule; \
 
401
}
 
402
#define yymore() yymore_used_but_not_detected
 
403
#define YY_MORE_ADJ 0
 
404
#define YY_RESTORE_YY_MORE_OFFSET
 
405
char *yytext;
 
406
#define INITIAL 0
 
407
/**
 
408
 * the "incl" state is used for picking up the name
 
409
 * of an include file
 
410
 */
 
411
#define incl 1
 
412
 
 
413
#define c_comment 2
 
414
 
 
415
#define cpp_comment 3
 
416
 
 
417
// Avoid spam output
 
418
#ifdef  ECHO
 
419
#undef  ECHO
 
420
#endif
 
421
#define ECHO
 
422
 
 
423
// Never exit
 
424
#ifdef  YY_FATAL_ERROR
 
425
#undef  YY_FATAL_ERROR
 
426
#endif
 
427
#define YY_FATAL_ERROR(msg)
 
428
 
 
429
#include <list>
 
430
#include "comment_parser.h"
 
431
 
 
432
static CommentParseResult *pResults = NULL;
 
433
static std::string         strComment;
 
434
static std::string         strCppComment;
 
435
static int                 iCppCommentLine = -1;
 
436
 
 
437
/* Macros after this point can all be overridden by user definitions in
 
438
 * section 1.
 
439
 */
 
440
 
 
441
#ifndef YY_SKIP_YYWRAP
 
442
#ifdef __cplusplus
 
443
extern "C" int yywrap YY_PROTO(( void ));
 
444
#else
 
445
extern int yywrap YY_PROTO(( void ));
 
446
#endif
 
447
#endif
 
448
 
 
449
#ifndef YY_NO_UNPUT
 
450
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
 
451
#endif
 
452
 
 
453
#ifndef yytext_ptr
 
454
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
 
455
#endif
 
456
 
 
457
#ifdef YY_NEED_STRLEN
 
458
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
 
459
#endif
 
460
 
 
461
#ifndef YY_NO_INPUT
 
462
#ifdef __cplusplus
 
463
static int yyinput YY_PROTO(( void ));
 
464
#else
 
465
static int input YY_PROTO(( void ));
 
466
#endif
 
467
#endif
 
468
 
 
469
#if YY_STACK_USED
 
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 ));
 
475
#endif
 
476
#ifndef YY_NO_POP_STATE
 
477
static void yy_pop_state YY_PROTO(( void ));
 
478
#endif
 
479
#ifndef YY_NO_TOP_STATE
 
480
static int yy_top_state YY_PROTO(( void ));
 
481
#endif
 
482
 
 
483
#else
 
484
#define YY_NO_PUSH_STATE 1
 
485
#define YY_NO_POP_STATE 1
 
486
#define YY_NO_TOP_STATE 1
 
487
#endif
 
488
 
 
489
#ifdef YY_MALLOC_DECL
 
490
YY_MALLOC_DECL
 
491
#else
 
492
#if __STDC__
 
493
#ifndef __cplusplus
 
494
#include <stdlib.h>
 
495
#endif
 
496
#else
 
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).
 
500
 */
 
501
#endif
 
502
#endif
 
503
 
 
504
/* Amount of stuff to slurp up with each read. */
 
505
#ifndef YY_READ_BUF_SIZE
 
506
#define YY_READ_BUF_SIZE 8192
 
507
#endif
 
508
 
 
509
/* Copy whatever the last rule matched to the standard output. */
 
510
 
 
511
#ifndef ECHO
 
512
/* This used to be an fputs(), but since the string might contain NUL's,
 
513
 * we now use fwrite().
 
514
 */
 
515
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
 
516
#endif
 
517
 
 
518
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 
519
 * is returned in "result".
 
520
 */
 
521
#ifndef YY_INPUT
 
522
#define YY_INPUT(buf,result,max_size) \
 
523
        if ( yy_current_buffer->yy_is_interactive ) \
 
524
                { \
 
525
                int c = '*', n; \
 
526
                for ( n = 0; n < max_size && \
 
527
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 
528
                        buf[n] = (char) c; \
 
529
                if ( c == '\n' ) \
 
530
                        buf[n++] = (char) c; \
 
531
                if ( c == EOF && ferror( yyin ) ) \
 
532
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
533
                result = n; \
 
534
                } \
 
535
        else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
 
536
                  && ferror( yyin ) ) \
 
537
                YY_FATAL_ERROR( "input in flex scanner failed" );
 
538
#endif
 
539
 
 
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.
 
543
 */
 
544
#ifndef yyterminate
 
545
#define yyterminate() return YY_NULL
 
546
#endif
 
547
 
 
548
/* Number of entries by which start-condition stack grows. */
 
549
#ifndef YY_START_STACK_INCR
 
550
#define YY_START_STACK_INCR 25
 
551
#endif
 
552
 
 
553
/* Report a fatal error. */
 
554
#ifndef YY_FATAL_ERROR
 
555
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
 
556
#endif
 
557
 
 
558
/* Default declaration of generated scanner - a define so the user can
 
559
 * easily add parameters.
 
560
 */
 
561
#ifndef YY_DECL
 
562
#define YY_DECL int yylex YY_PROTO(( void ))
 
563
#endif
 
564
 
 
565
/* Code executed at the beginning of each rule, after yytext and yyleng
 
566
 * have been set up.
 
567
 */
 
568
#ifndef YY_USER_ACTION
 
569
#define YY_USER_ACTION
 
570
#endif
 
571
 
 
572
/* Code executed at the end of each rule. */
 
573
#ifndef YY_BREAK
 
574
#define YY_BREAK break;
 
575
#endif
 
576
 
 
577
#define YY_RULE_SETUP \
 
578
        YY_USER_ACTION
 
579
 
 
580
YY_DECL
 
581
        {
 
582
        register yy_state_type yy_current_state;
 
583
        register char *yy_cp, *yy_bp;
 
584
        register int yy_act;
 
585
 
 
586
 
 
587
 
 
588
 
 
589
        if ( yy_init )
 
590
                {
 
591
                yy_init = 0;
 
592
 
 
593
#ifdef YY_USER_INIT
 
594
                YY_USER_INIT;
 
595
#endif
 
596
 
 
597
                if ( ! yy_start )
 
598
                        yy_start = 1;   /* first start state */
 
599
 
 
600
                if ( ! yyin )
 
601
                        yyin = stdin;
 
602
 
 
603
                if ( ! yyout )
 
604
                        yyout = stdout;
 
605
 
 
606
                if ( ! yy_current_buffer )
 
607
                        yy_current_buffer =
 
608
                                yy_create_buffer( yyin, YY_BUF_SIZE );
 
609
 
 
610
                yy_load_buffer_state();
 
611
                }
 
612
 
 
613
        while ( 1 )             /* loops until end-of-file is reached */
 
614
                {
 
615
                yy_cp = yy_c_buf_p;
 
616
 
 
617
                /* Support of yytext. */
 
618
                *yy_cp = yy_hold_char;
 
619
 
 
620
                /* yy_bp points to the position in yy_ch_buf of the start of
 
621
                 * the current run.
 
622
                 */
 
623
                yy_bp = yy_cp;
 
624
 
 
625
                yy_current_state = yy_start;
 
626
                yy_state_ptr = yy_state_buf;
 
627
                *yy_state_ptr++ = yy_current_state;
 
628
yy_match:
 
629
                do
 
630
                        {
 
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 )
 
633
                                {
 
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];
 
637
                                }
 
638
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
639
                        *yy_state_ptr++ = yy_current_state;
 
640
                        ++yy_cp;
 
641
                        }
 
642
                while ( yy_base[yy_current_state] != 28 );
 
643
 
 
644
yy_find_action:
 
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 */
 
649
                        {
 
650
                        if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
 
651
                                {
 
652
                                yy_act = yy_acclist[yy_lp];
 
653
                                        {
 
654
                                        yy_full_match = yy_cp;
 
655
                                        break;
 
656
                                        }
 
657
                                }
 
658
                        --yy_cp;
 
659
                        yy_current_state = *--yy_state_ptr;
 
660
                        yy_lp = yy_accept[yy_current_state];
 
661
                        }
 
662
 
 
663
                YY_DO_BEFORE_ACTION;
 
664
 
 
665
                if ( yy_act != YY_END_OF_BUFFER )
 
666
                        {
 
667
                        int yyl;
 
668
                        for ( yyl = 0; yyl < yyleng; ++yyl )
 
669
                                if ( yytext[yyl] == '\n' )
 
670
                                        ++yylineno;
 
671
                        }
 
672
 
 
673
do_action:      /* This label is used only to access EOF actions. */
 
674
 
 
675
 
 
676
                switch ( yy_act )
 
677
        { /* beginning of action switch */
 
678
case 1:
 
679
YY_RULE_SETUP
 
680
{
 
681
        if(strCppComment.empty() == false) {
 
682
                strCppComment += "\n";
 
683
        }
 
684
        iCppCommentLine = cp_lineno;
 
685
        BEGIN(cpp_comment);
 
686
}
 
687
        YY_BREAK
 
688
case 2:
 
689
YY_RULE_SETUP
 
690
{
 
691
        /* if we kept some C++ comment, it is time to flush it to the 
 
692
         * result output */
 
693
        if(strCppComment.empty() == false && pResults) {
 
694
                pResults->addComment(strCppComment, iCppCommentLine, false);
 
695
                strCppComment.clear();
 
696
                iCppCommentLine = -1;
 
697
        }
 
698
        strComment.clear();
 
699
        BEGIN(c_comment);
 
700
}
 
701
        YY_BREAK
 
702
case 3:
 
703
YY_RULE_SETUP
 
704
{
 
705
        /* if we kept some C++ comment, it is time to flush it to the 
 
706
         * result output */
 
707
        if(strCppComment.empty() == false && pResults) {
 
708
                pResults->addComment(strCppComment, iCppCommentLine, false);
 
709
                strCppComment.clear();
 
710
                iCppCommentLine = -1;
 
711
        }
 
712
        strComment.clear();
 
713
        BEGIN(c_comment);
 
714
}
 
715
        YY_BREAK
 
716
case 4:
 
717
YY_RULE_SETUP
 
718
{ /* skip whitespaces */}
 
719
        YY_BREAK
 
720
case 5:
 
721
YY_RULE_SETUP
 
722
{
 
723
        /* if we kept some C++ comment, it is time to flush it to the 
 
724
         * result output */
 
725
        if(strCppComment.empty() == false && pResults) {
 
726
                pResults->addComment(strCppComment, iCppCommentLine, false);
 
727
                strCppComment.clear();
 
728
                iCppCommentLine = -1;
 
729
        }
 
730
}
 
731
        YY_BREAK
 
732
case 6:
 
733
YY_RULE_SETUP
 
734
{
 
735
        /* if we kept some C++ comment, it is time to flush it to the 
 
736
         * result output */
 
737
        if(strCppComment.empty() == false && pResults) {
 
738
                pResults->addComment(strCppComment, iCppCommentLine, false);
 
739
                strCppComment.clear();
 
740
                iCppCommentLine = -1;
 
741
        }
 
742
}
 
743
        YY_BREAK
 
744
case 7:
 
745
YY_RULE_SETUP
 
746
{
 
747
        BEGIN(INITIAL);
 
748
}
 
749
        YY_BREAK
 
750
case 8:
 
751
YY_RULE_SETUP
 
752
{strCppComment += yytext;} /* do nothing */
 
753
        YY_BREAK
 
754
case 9:
 
755
YY_RULE_SETUP
 
756
{
 
757
        pResults->addComment(strComment, cp_lineno, false);
 
758
        BEGIN(INITIAL);
 
759
}
 
760
        YY_BREAK
 
761
case 10:
 
762
YY_RULE_SETUP
 
763
{}
 
764
        YY_BREAK
 
765
case 11:
 
766
YY_RULE_SETUP
 
767
{}
 
768
        YY_BREAK
 
769
case 12:
 
770
YY_RULE_SETUP
 
771
 
772
        if(strComment.empty() == false) {
 
773
                if(strComment.at(strComment.length() -1) == '\n'){
 
774
                        // dont add indentation tabs
 
775
                } else {
 
776
                        strComment += " ";
 
777
                }
 
778
        } else {
 
779
                // empty comment: dont prepend whitespaces at start
 
780
        }
 
781
}
 
782
        YY_BREAK
 
783
case 13:
 
784
YY_RULE_SETUP
 
785
{
 
786
        if(strComment.empty() == false) {
 
787
                if(strComment.at(strComment.length() -1) == '\n'){
 
788
                        // dont add indentation tabs
 
789
                } else {
 
790
                        strComment += "*";
 
791
                }
 
792
        } else {
 
793
                // empty comment: dont prepend '*'
 
794
        }
 
795
}
 
796
        YY_BREAK
 
797
case 14:
 
798
YY_RULE_SETUP
 
799
{ strComment += "\n";}
 
800
        YY_BREAK
 
801
case 15:
 
802
YY_RULE_SETUP
 
803
{ strComment += yytext;}
 
804
        YY_BREAK
 
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):
 
809
{
 
810
        if(strCppComment.empty() == false && pResults) {
 
811
                pResults->addComment(strCppComment, iCppCommentLine, false);
 
812
                strCppComment.clear();
 
813
                iCppCommentLine = -1;
 
814
        }
 
815
        
 
816
        if ( YY_CURRENT_BUFFER->yy_input_file ) {
 
817
                fclose( YY_CURRENT_BUFFER->yy_input_file );
 
818
                YY_CURRENT_BUFFER->yy_input_file = NULL;
 
819
        }
 
820
 
 
821
        yy_delete_buffer    ( YY_CURRENT_BUFFER    );
 
822
        yyterminate();
 
823
}
 
824
        YY_BREAK
 
825
case 16:
 
826
YY_RULE_SETUP
 
827
ECHO;
 
828
        YY_BREAK
 
829
 
 
830
        case YY_END_OF_BUFFER:
 
831
                {
 
832
                /* Amount of text matched not including the EOB char. */
 
833
                int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
 
834
 
 
835
                /* Undo the effects of YY_DO_BEFORE_ACTION. */
 
836
                *yy_cp = yy_hold_char;
 
837
                YY_RESTORE_YY_MORE_OFFSET
 
838
 
 
839
                if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
 
840
                        {
 
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.
 
849
                         */
 
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;
 
853
                        }
 
854
 
 
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
 
860
                 * in input().
 
861
                 */
 
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;
 
865
 
 
866
                        yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
 
867
 
 
868
                        yy_current_state = yy_get_previous_state();
 
869
 
 
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).
 
877
                         */
 
878
 
 
879
                        yy_next_state = yy_try_NUL_trans( yy_current_state );
 
880
 
 
881
                        yy_bp = yytext_ptr + YY_MORE_ADJ;
 
882
 
 
883
                        if ( yy_next_state )
 
884
                                {
 
885
                                /* Consume the NUL. */
 
886
                                yy_cp = ++yy_c_buf_p;
 
887
                                yy_current_state = yy_next_state;
 
888
                                goto yy_match;
 
889
                                }
 
890
 
 
891
                        else
 
892
                                {
 
893
                                yy_cp = yy_c_buf_p;
 
894
                                goto yy_find_action;
 
895
                                }
 
896
                        }
 
897
 
 
898
                else switch ( yy_get_next_buffer() )
 
899
                        {
 
900
                        case EOB_ACT_END_OF_FILE:
 
901
                                {
 
902
                                yy_did_buffer_switch_on_eof = 0;
 
903
 
 
904
                                if ( yywrap() )
 
905
                                        {
 
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.
 
914
                                         */
 
915
                                        yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
 
916
 
 
917
                                        yy_act = YY_STATE_EOF(YY_START);
 
918
                                        goto do_action;
 
919
                                        }
 
920
 
 
921
                                else
 
922
                                        {
 
923
                                        if ( ! yy_did_buffer_switch_on_eof )
 
924
                                                YY_NEW_FILE;
 
925
                                        }
 
926
                                break;
 
927
                                }
 
928
 
 
929
                        case EOB_ACT_CONTINUE_SCAN:
 
930
                                yy_c_buf_p =
 
931
                                        yytext_ptr + yy_amount_of_matched_text;
 
932
 
 
933
                                yy_current_state = yy_get_previous_state();
 
934
 
 
935
                                yy_cp = yy_c_buf_p;
 
936
                                yy_bp = yytext_ptr + YY_MORE_ADJ;
 
937
                                goto yy_match;
 
938
 
 
939
                        case EOB_ACT_LAST_MATCH:
 
940
                                yy_c_buf_p =
 
941
                                &yy_current_buffer->yy_ch_buf[yy_n_chars];
 
942
 
 
943
                                yy_current_state = yy_get_previous_state();
 
944
 
 
945
                                yy_cp = yy_c_buf_p;
 
946
                                yy_bp = yytext_ptr + YY_MORE_ADJ;
 
947
                                goto yy_find_action;
 
948
                        }
 
949
                break;
 
950
                }
 
951
 
 
952
        default:
 
953
                YY_FATAL_ERROR(
 
954
                        "fatal flex scanner internal error--no action found" );
 
955
        } /* end of action switch */
 
956
                } /* end of scanning one token */
 
957
        } /* end of yylex */
 
958
 
 
959
 
 
960
/* yy_get_next_buffer - try to read in a new buffer
 
961
 *
 
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
 
966
 */
 
967
 
 
968
static int yy_get_next_buffer()
 
969
        {
 
970
        register char *dest = yy_current_buffer->yy_ch_buf;
 
971
        register char *source = yytext_ptr;
 
972
        register int number_to_move, i;
 
973
        int ret_val;
 
974
 
 
975
        if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
 
976
                YY_FATAL_ERROR(
 
977
                "fatal flex scanner internal error--end of buffer missed" );
 
978
 
 
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 )
 
982
                        {
 
983
                        /* We matched a single character, the EOB, so
 
984
                         * treat this as a final EOF.
 
985
                         */
 
986
                        return EOB_ACT_END_OF_FILE;
 
987
                        }
 
988
 
 
989
                else
 
990
                        {
 
991
                        /* We matched some text prior to the EOB, first
 
992
                         * process it.
 
993
                         */
 
994
                        return EOB_ACT_LAST_MATCH;
 
995
                        }
 
996
                }
 
997
 
 
998
        /* Try to read more data. */
 
999
 
 
1000
        /* First move last chars to start of buffer. */
 
1001
        number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
 
1002
 
 
1003
        for ( i = 0; i < number_to_move; ++i )
 
1004
                *(dest++) = *(source++);
 
1005
 
 
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,
 
1008
                 * just force an EOF
 
1009
                 */
 
1010
                yy_current_buffer->yy_n_chars = yy_n_chars = 0;
 
1011
 
 
1012
        else
 
1013
                {
 
1014
                int num_to_read =
 
1015
                        yy_current_buffer->yy_buf_size - number_to_move - 1;
 
1016
 
 
1017
                while ( num_to_read <= 0 )
 
1018
                        { /* Not enough room in the buffer - grow it. */
 
1019
#ifdef YY_USES_REJECT
 
1020
                        YY_FATAL_ERROR(
 
1021
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
 
1022
#else
 
1023
 
 
1024
                        /* just a shorter name for the current buffer */
 
1025
                        YY_BUFFER_STATE b = yy_current_buffer;
 
1026
 
 
1027
                        int yy_c_buf_p_offset =
 
1028
                                (int) (yy_c_buf_p - b->yy_ch_buf);
 
1029
 
 
1030
                        if ( b->yy_is_our_buffer )
 
1031
                                {
 
1032
                                int new_size = b->yy_buf_size * 2;
 
1033
 
 
1034
                                if ( new_size <= 0 )
 
1035
                                        b->yy_buf_size += b->yy_buf_size / 8;
 
1036
                                else
 
1037
                                        b->yy_buf_size *= 2;
 
1038
 
 
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 );
 
1043
                                }
 
1044
                        else
 
1045
                                /* Can't grow it, we don't own it. */
 
1046
                                b->yy_ch_buf = 0;
 
1047
 
 
1048
                        if ( ! b->yy_ch_buf )
 
1049
                                YY_FATAL_ERROR(
 
1050
                                "fatal error - scanner input buffer overflow" );
 
1051
 
 
1052
                        yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
 
1053
 
 
1054
                        num_to_read = yy_current_buffer->yy_buf_size -
 
1055
                                                number_to_move - 1;
 
1056
#endif
 
1057
                        }
 
1058
 
 
1059
                if ( num_to_read > YY_READ_BUF_SIZE )
 
1060
                        num_to_read = YY_READ_BUF_SIZE;
 
1061
 
 
1062
                /* Read in more data. */
 
1063
                YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
 
1064
                        yy_n_chars, num_to_read );
 
1065
 
 
1066
                yy_current_buffer->yy_n_chars = yy_n_chars;
 
1067
                }
 
1068
 
 
1069
        if ( yy_n_chars == 0 )
 
1070
                {
 
1071
                if ( number_to_move == YY_MORE_ADJ )
 
1072
                        {
 
1073
                        ret_val = EOB_ACT_END_OF_FILE;
 
1074
                        yyrestart( yyin );
 
1075
                        }
 
1076
 
 
1077
                else
 
1078
                        {
 
1079
                        ret_val = EOB_ACT_LAST_MATCH;
 
1080
                        yy_current_buffer->yy_buffer_status =
 
1081
                                YY_BUFFER_EOF_PENDING;
 
1082
                        }
 
1083
                }
 
1084
 
 
1085
        else
 
1086
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
1087
 
 
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;
 
1091
 
 
1092
        yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
 
1093
 
 
1094
        return ret_val;
 
1095
        }
 
1096
 
 
1097
 
 
1098
/* yy_get_previous_state - get the state just before the EOB char was reached */
 
1099
 
 
1100
static yy_state_type yy_get_previous_state()
 
1101
        {
 
1102
        register yy_state_type yy_current_state;
 
1103
        register char *yy_cp;
 
1104
 
 
1105
        yy_current_state = yy_start;
 
1106
        yy_state_ptr = yy_state_buf;
 
1107
        *yy_state_ptr++ = yy_current_state;
 
1108
 
 
1109
        for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
 
1110
                {
 
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 )
 
1113
                        {
 
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];
 
1117
                        }
 
1118
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1119
                *yy_state_ptr++ = yy_current_state;
 
1120
                }
 
1121
 
 
1122
        return yy_current_state;
 
1123
        }
 
1124
 
 
1125
 
 
1126
/* yy_try_NUL_trans - try to make a transition on the NUL character
 
1127
 *
 
1128
 * synopsis
 
1129
 *      next_state = yy_try_NUL_trans( current_state );
 
1130
 */
 
1131
 
 
1132
#ifdef YY_USE_PROTOS
 
1133
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
 
1134
#else
 
1135
static yy_state_type yy_try_NUL_trans( yy_current_state )
 
1136
yy_state_type yy_current_state;
 
1137
#endif
 
1138
        {
 
1139
        register int yy_is_jam;
 
1140
 
 
1141
        register YY_CHAR yy_c = 1;
 
1142
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1143
                {
 
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];
 
1147
                }
 
1148
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1149
        yy_is_jam = (yy_current_state == 28);
 
1150
        if ( ! yy_is_jam )
 
1151
                *yy_state_ptr++ = yy_current_state;
 
1152
 
 
1153
        return yy_is_jam ? 0 : yy_current_state;
 
1154
        }
 
1155
 
 
1156
 
 
1157
#ifndef YY_NO_UNPUT
 
1158
#ifdef YY_USE_PROTOS
 
1159
static void yyunput( int c, register char *yy_bp )
 
1160
#else
 
1161
static void yyunput( c, yy_bp )
 
1162
int c;
 
1163
register char *yy_bp;
 
1164
#endif
 
1165
        {
 
1166
        register char *yy_cp = yy_c_buf_p;
 
1167
 
 
1168
        /* undo effects of setting up yytext */
 
1169
        *yy_cp = yy_hold_char;
 
1170
 
 
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];
 
1179
 
 
1180
                while ( source > yy_current_buffer->yy_ch_buf )
 
1181
                        *--dest = *--source;
 
1182
 
 
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;
 
1187
 
 
1188
                if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
 
1189
                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
 
1190
                }
 
1191
 
 
1192
        *--yy_cp = (char) c;
 
1193
 
 
1194
        if ( c == '\n' )
 
1195
                --yylineno;
 
1196
 
 
1197
        yytext_ptr = yy_bp;
 
1198
        yy_hold_char = *yy_cp;
 
1199
        yy_c_buf_p = yy_cp;
 
1200
        }
 
1201
#endif  /* ifndef YY_NO_UNPUT */
 
1202
 
 
1203
 
 
1204
#ifdef __cplusplus
 
1205
static int yyinput()
 
1206
#else
 
1207
static int input()
 
1208
#endif
 
1209
        {
 
1210
        int c;
 
1211
 
 
1212
        *yy_c_buf_p = yy_hold_char;
 
1213
 
 
1214
        if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
 
1215
                {
 
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.
 
1219
                 */
 
1220
                if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
 
1221
                        /* This was really a NUL. */
 
1222
                        *yy_c_buf_p = '\0';
 
1223
 
 
1224
                else
 
1225
                        { /* need more input */
 
1226
                        int offset = yy_c_buf_p - yytext_ptr;
 
1227
                        ++yy_c_buf_p;
 
1228
 
 
1229
                        switch ( yy_get_next_buffer() )
 
1230
                                {
 
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.
 
1240
                                         */
 
1241
 
 
1242
                                        /* Reset buffer status. */
 
1243
                                        yyrestart( yyin );
 
1244
 
 
1245
                                        /* fall through */
 
1246
 
 
1247
                                case EOB_ACT_END_OF_FILE:
 
1248
                                        {
 
1249
                                        if ( yywrap() )
 
1250
                                                return EOF;
 
1251
 
 
1252
                                        if ( ! yy_did_buffer_switch_on_eof )
 
1253
                                                YY_NEW_FILE;
 
1254
#ifdef __cplusplus
 
1255
                                        return yyinput();
 
1256
#else
 
1257
                                        return input();
 
1258
#endif
 
1259
                                        }
 
1260
 
 
1261
                                case EOB_ACT_CONTINUE_SCAN:
 
1262
                                        yy_c_buf_p = yytext_ptr + offset;
 
1263
                                        break;
 
1264
                                }
 
1265
                        }
 
1266
                }
 
1267
 
 
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;
 
1271
 
 
1272
        if ( c == '\n' )
 
1273
                ++yylineno;
 
1274
 
 
1275
        return c;
 
1276
        }
 
1277
 
 
1278
 
 
1279
#ifdef YY_USE_PROTOS
 
1280
void yyrestart( FILE *input_file )
 
1281
#else
 
1282
void yyrestart( input_file )
 
1283
FILE *input_file;
 
1284
#endif
 
1285
        {
 
1286
        if ( ! yy_current_buffer )
 
1287
                yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
 
1288
 
 
1289
        yy_init_buffer( yy_current_buffer, input_file );
 
1290
        yy_load_buffer_state();
 
1291
        }
 
1292
 
 
1293
 
 
1294
#ifdef YY_USE_PROTOS
 
1295
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
 
1296
#else
 
1297
void yy_switch_to_buffer( new_buffer )
 
1298
YY_BUFFER_STATE new_buffer;
 
1299
#endif
 
1300
        {
 
1301
        if ( yy_current_buffer == new_buffer )
 
1302
                return;
 
1303
 
 
1304
        if ( yy_current_buffer )
 
1305
                {
 
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;
 
1310
                }
 
1311
 
 
1312
        yy_current_buffer = new_buffer;
 
1313
        yy_load_buffer_state();
 
1314
 
 
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.
 
1319
         */
 
1320
        yy_did_buffer_switch_on_eof = 1;
 
1321
        }
 
1322
 
 
1323
 
 
1324
#ifdef YY_USE_PROTOS
 
1325
void yy_load_buffer_state( void )
 
1326
#else
 
1327
void yy_load_buffer_state()
 
1328
#endif
 
1329
        {
 
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;
 
1334
        }
 
1335
 
 
1336
 
 
1337
#ifdef YY_USE_PROTOS
 
1338
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
 
1339
#else
 
1340
YY_BUFFER_STATE yy_create_buffer( file, size )
 
1341
FILE *file;
 
1342
int size;
 
1343
#endif
 
1344
        {
 
1345
        YY_BUFFER_STATE b;
 
1346
 
 
1347
        b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
 
1348
        if ( ! b )
 
1349
                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
1350
 
 
1351
        b->yy_buf_size = size;
 
1352
 
 
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.
 
1355
         */
 
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()" );
 
1359
 
 
1360
        b->yy_is_our_buffer = 1;
 
1361
 
 
1362
        yy_init_buffer( b, file );
 
1363
 
 
1364
        return b;
 
1365
        }
 
1366
 
 
1367
 
 
1368
#ifdef YY_USE_PROTOS
 
1369
void yy_delete_buffer( YY_BUFFER_STATE b )
 
1370
#else
 
1371
void yy_delete_buffer( b )
 
1372
YY_BUFFER_STATE b;
 
1373
#endif
 
1374
        {
 
1375
        if ( ! b )
 
1376
                return;
 
1377
 
 
1378
        if ( b == yy_current_buffer )
 
1379
                yy_current_buffer = (YY_BUFFER_STATE) 0;
 
1380
 
 
1381
        if ( b->yy_is_our_buffer )
 
1382
                yy_flex_free( (void *) b->yy_ch_buf );
 
1383
 
 
1384
        yy_flex_free( (void *) b );
 
1385
        }
 
1386
 
 
1387
 
 
1388
#ifndef YY_ALWAYS_INTERACTIVE
 
1389
#ifndef YY_NEVER_INTERACTIVE
 
1390
extern int isatty YY_PROTO(( int ));
 
1391
#endif
 
1392
#endif
 
1393
 
 
1394
#ifdef YY_USE_PROTOS
 
1395
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
 
1396
#else
 
1397
void yy_init_buffer( b, file )
 
1398
YY_BUFFER_STATE b;
 
1399
FILE *file;
 
1400
#endif
 
1401
 
 
1402
 
 
1403
        {
 
1404
        yy_flush_buffer( b );
 
1405
 
 
1406
        b->yy_input_file = file;
 
1407
        b->yy_fill_buffer = 1;
 
1408
 
 
1409
#if YY_ALWAYS_INTERACTIVE
 
1410
        b->yy_is_interactive = 1;
 
1411
#else
 
1412
#if YY_NEVER_INTERACTIVE
 
1413
        b->yy_is_interactive = 0;
 
1414
#else
 
1415
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
 
1416
#endif
 
1417
#endif
 
1418
        }
 
1419
 
 
1420
 
 
1421
#ifdef YY_USE_PROTOS
 
1422
void yy_flush_buffer( YY_BUFFER_STATE b )
 
1423
#else
 
1424
void yy_flush_buffer( b )
 
1425
YY_BUFFER_STATE b;
 
1426
#endif
 
1427
 
 
1428
        {
 
1429
        if ( ! b )
 
1430
                return;
 
1431
 
 
1432
        b->yy_n_chars = 0;
 
1433
 
 
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.
 
1437
         */
 
1438
        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
 
1439
        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
1440
 
 
1441
        b->yy_buf_pos = &b->yy_ch_buf[0];
 
1442
 
 
1443
        b->yy_at_bol = 1;
 
1444
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1445
 
 
1446
        if ( b == yy_current_buffer )
 
1447
                yy_load_buffer_state();
 
1448
        }
 
1449
 
 
1450
 
 
1451
#ifndef YY_NO_SCAN_BUFFER
 
1452
#ifdef YY_USE_PROTOS
 
1453
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
 
1454
#else
 
1455
YY_BUFFER_STATE yy_scan_buffer( base, size )
 
1456
char *base;
 
1457
yy_size_t size;
 
1458
#endif
 
1459
        {
 
1460
        YY_BUFFER_STATE b;
 
1461
 
 
1462
        if ( size < 2 ||
 
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. */
 
1466
                return 0;
 
1467
 
 
1468
        b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
 
1469
        if ( ! b )
 
1470
                YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
 
1471
 
 
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;
 
1478
        b->yy_at_bol = 1;
 
1479
        b->yy_fill_buffer = 0;
 
1480
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1481
 
 
1482
        yy_switch_to_buffer( b );
 
1483
 
 
1484
        return b;
 
1485
        }
 
1486
#endif
 
1487
 
 
1488
 
 
1489
#ifndef YY_NO_SCAN_STRING
 
1490
#ifdef YY_USE_PROTOS
 
1491
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
 
1492
#else
 
1493
YY_BUFFER_STATE yy_scan_string( yy_str )
 
1494
yyconst char *yy_str;
 
1495
#endif
 
1496
        {
 
1497
        int len;
 
1498
        for ( len = 0; yy_str[len]; ++len )
 
1499
                ;
 
1500
 
 
1501
        return yy_scan_bytes( yy_str, len );
 
1502
        }
 
1503
#endif
 
1504
 
 
1505
 
 
1506
#ifndef YY_NO_SCAN_BYTES
 
1507
#ifdef YY_USE_PROTOS
 
1508
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
 
1509
#else
 
1510
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
 
1511
yyconst char *bytes;
 
1512
int len;
 
1513
#endif
 
1514
        {
 
1515
        YY_BUFFER_STATE b;
 
1516
        char *buf;
 
1517
        yy_size_t n;
 
1518
        int i;
 
1519
 
 
1520
        /* Get memory for full buffer, including space for trailing EOB's. */
 
1521
        n = len + 2;
 
1522
        buf = (char *) yy_flex_alloc( n );
 
1523
        if ( ! buf )
 
1524
                YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
 
1525
 
 
1526
        for ( i = 0; i < len; ++i )
 
1527
                buf[i] = bytes[i];
 
1528
 
 
1529
        buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
 
1530
 
 
1531
        b = yy_scan_buffer( buf, n );
 
1532
        if ( ! b )
 
1533
                YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
 
1534
 
 
1535
        /* It's okay to grow etc. this buffer, and we should throw it
 
1536
         * away when we're done.
 
1537
         */
 
1538
        b->yy_is_our_buffer = 1;
 
1539
 
 
1540
        return b;
 
1541
        }
 
1542
#endif
 
1543
 
 
1544
 
 
1545
#ifndef YY_NO_PUSH_STATE
 
1546
#ifdef YY_USE_PROTOS
 
1547
static void yy_push_state( int new_state )
 
1548
#else
 
1549
static void yy_push_state( new_state )
 
1550
int new_state;
 
1551
#endif
 
1552
        {
 
1553
        if ( yy_start_stack_ptr >= yy_start_stack_depth )
 
1554
                {
 
1555
                yy_size_t new_size;
 
1556
 
 
1557
                yy_start_stack_depth += YY_START_STACK_INCR;
 
1558
                new_size = yy_start_stack_depth * sizeof( int );
 
1559
 
 
1560
                if ( ! yy_start_stack )
 
1561
                        yy_start_stack = (int *) yy_flex_alloc( new_size );
 
1562
 
 
1563
                else
 
1564
                        yy_start_stack = (int *) yy_flex_realloc(
 
1565
                                        (void *) yy_start_stack, new_size );
 
1566
 
 
1567
                if ( ! yy_start_stack )
 
1568
                        YY_FATAL_ERROR(
 
1569
                        "out of memory expanding start-condition stack" );
 
1570
                }
 
1571
 
 
1572
        yy_start_stack[yy_start_stack_ptr++] = YY_START;
 
1573
 
 
1574
        BEGIN(new_state);
 
1575
        }
 
1576
#endif
 
1577
 
 
1578
 
 
1579
#ifndef YY_NO_POP_STATE
 
1580
static void yy_pop_state()
 
1581
        {
 
1582
        if ( --yy_start_stack_ptr < 0 )
 
1583
                YY_FATAL_ERROR( "start-condition stack underflow" );
 
1584
 
 
1585
        BEGIN(yy_start_stack[yy_start_stack_ptr]);
 
1586
        }
 
1587
#endif
 
1588
 
 
1589
 
 
1590
#ifndef YY_NO_TOP_STATE
 
1591
static int yy_top_state()
 
1592
        {
 
1593
        return yy_start_stack[yy_start_stack_ptr - 1];
 
1594
        }
 
1595
#endif
 
1596
 
 
1597
#ifndef YY_EXIT_FAILURE
 
1598
#define YY_EXIT_FAILURE 2
 
1599
#endif
 
1600
 
 
1601
#ifdef YY_USE_PROTOS
 
1602
static void yy_fatal_error( yyconst char msg[] )
 
1603
#else
 
1604
static void yy_fatal_error( msg )
 
1605
char msg[];
 
1606
#endif
 
1607
        {
 
1608
        (void) fprintf( stderr, "%s\n", msg );
 
1609
        exit( YY_EXIT_FAILURE );
 
1610
        }
 
1611
 
 
1612
 
 
1613
 
 
1614
/* Redefine yyless() so it works in section 3 code. */
 
1615
 
 
1616
#undef yyless
 
1617
#define yyless(n) \
 
1618
        do \
 
1619
                { \
 
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'; \
 
1625
                yyleng = n; \
 
1626
                } \
 
1627
        while ( 0 )
 
1628
 
 
1629
 
 
1630
/* Internal utility routines. */
 
1631
 
 
1632
#ifndef yytext_ptr
 
1633
#ifdef YY_USE_PROTOS
 
1634
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
 
1635
#else
 
1636
static void yy_flex_strncpy( s1, s2, n )
 
1637
char *s1;
 
1638
yyconst char *s2;
 
1639
int n;
 
1640
#endif
 
1641
        {
 
1642
        register int i;
 
1643
        for ( i = 0; i < n; ++i )
 
1644
                s1[i] = s2[i];
 
1645
        }
 
1646
#endif
 
1647
 
 
1648
#ifdef YY_NEED_STRLEN
 
1649
#ifdef YY_USE_PROTOS
 
1650
static int yy_flex_strlen( yyconst char *s )
 
1651
#else
 
1652
static int yy_flex_strlen( s )
 
1653
yyconst char *s;
 
1654
#endif
 
1655
        {
 
1656
        register int n;
 
1657
        for ( n = 0; s[n]; ++n )
 
1658
                ;
 
1659
 
 
1660
        return n;
 
1661
        }
 
1662
#endif
 
1663
 
 
1664
 
 
1665
#ifdef YY_USE_PROTOS
 
1666
static void *yy_flex_alloc( yy_size_t size )
 
1667
#else
 
1668
static void *yy_flex_alloc( size )
 
1669
yy_size_t size;
 
1670
#endif
 
1671
        {
 
1672
        return (void *) malloc( size );
 
1673
        }
 
1674
 
 
1675
#ifdef YY_USE_PROTOS
 
1676
static void *yy_flex_realloc( void *ptr, yy_size_t size )
 
1677
#else
 
1678
static void *yy_flex_realloc( ptr, size )
 
1679
void *ptr;
 
1680
yy_size_t size;
 
1681
#endif
 
1682
        {
 
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.
 
1689
         */
 
1690
        return (void *) realloc( (char *) ptr, size );
 
1691
        }
 
1692
 
 
1693
#ifdef YY_USE_PROTOS
 
1694
static void yy_flex_free( void *ptr )
 
1695
#else
 
1696
static void yy_flex_free( ptr )
 
1697
void *ptr;
 
1698
#endif
 
1699
        {
 
1700
        free( ptr );
 
1701
        }
 
1702
 
 
1703
#if YY_MAIN
 
1704
int main()
 
1705
        {
 
1706
        yylex();
 
1707
        return 0;
 
1708
        }
 
1709
#endif
 
1710
 
 
1711
 
 
1712
int yywrap() {
 
1713
        return 1;
 
1714
}
 
1715
 
 
1716
int ParseComments(const char* filePath, CommentParseResult &comments)
 
1717
{
 
1718
        BEGIN INITIAL;
 
1719
        cp_lineno = 1;
 
1720
 
 
1721
        FILE* fp = fopen(filePath, "r");
 
1722
        if ( fp == NULL ) {
 
1723
                return -1;
 
1724
        }
 
1725
 
 
1726
        pResults    = &comments;
 
1727
        strComment.clear();
 
1728
        strCppComment.clear();
 
1729
        iCppCommentLine = -1;
 
1730
        
 
1731
        yy_switch_to_buffer( yy_create_buffer(fp, YY_BUF_SIZE) );
 
1732
        cp_in = fp;
 
1733
        int rc = cp_lex();
 
1734
        yy_delete_buffer    ( YY_CURRENT_BUFFER    );
 
1735
 
 
1736
        // Cleanup
 
1737
        pResults = NULL;
 
1738
        strComment.clear();
 
1739
        strCppComment.clear();
 
1740
        iCppCommentLine = -1;
 
1741
        return rc;
 
1742
}
 
1743