Debian Codegraph @

CodeLite/crawler_lexer.cpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : crawler_lexer.cpp
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #define yy_create_buffer fc__create_buffer
27 #define yy_delete_buffer fc__delete_buffer
28 #define yy_scan_buffer fc__scan_buffer
29 #define yy_scan_string fc__scan_string
30 #define yy_scan_bytes fc__scan_bytes
31 #define yy_flex_debug fc__flex_debug
32 #define yy_init_buffer fc__init_buffer
33 #define yy_flush_buffer fc__flush_buffer
34 #define yy_load_buffer_state fc__load_buffer_state
35 #define yy_switch_to_buffer fc__switch_to_buffer
36 #define yyin fc_in
37 #define yyleng fc_leng
38 #define yylex fc_lex
39 #define yyout fc_out
40 #define yyrestart fc_restart
41 #define yytext fc_text
42 #define yylineno fc_lineno
43 #define yywrap fc_wrap
44
45 /* A lexical scanner generated by flex */
46
47 /* Scanner skeleton version:
48 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
49 */
50
51 #define FLEX_SCANNER
52 #define YY_FLEX_MAJOR_VERSION 2
53 #define YY_FLEX_MINOR_VERSION 5
54
55 #include <stdio.h>
56
57
58 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
59 #ifdef c_plusplus
60 #ifndef __cplusplus
61 #define __cplusplus
62 #endif
63 #endif
64
65
66 #ifdef __cplusplus
67
68 #include <stdlib.h>
69 #include <unistd.h>
70
71 /* Use prototypes in function declarations. */
72 #define YY_USE_PROTOS
73
74 /* The "const" storage-class-modifier is valid. */
75 #define YY_USE_CONST
76
77 #else /* ! __cplusplus */
78
79 #if __STDC__
80
81 #define YY_USE_PROTOS
82 #define YY_USE_CONST
83
84 #endif /* __STDC__ */
85 #endif /* ! __cplusplus */
86
87 #ifdef __TURBOC__
88 #pragma warn -rch
89 #pragma warn -use
90 #include <io.h>
91 #include <stdlib.h>
92 #define YY_USE_CONST
93 #define YY_USE_PROTOS
94 #endif
95
96 #ifdef YY_USE_CONST
97 #define yyconst const
98 #else
99 #define yyconst
100 #endif
101
102
103 #ifdef YY_USE_PROTOS
104 #define YY_PROTO(proto) proto
105 #else
106 #define YY_PROTO(proto) ()
107 #endif
108
109 /* Returned upon end-of-file. */
110 #define YY_NULL 0
111
112 /* Promotes a possibly negative, possibly signed char to an unsigned
113 * integer for use as an array index. If the signed char is negative,
114 * we want to instead treat it as an 8-bit unsigned char, hence the
115 * double cast.
116 */
117 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
118
119 /* Enter a start condition. This macro really ought to take a parameter,
120 * but we do it the disgusting crufty way forced on us by the ()-less
121 * definition of BEGIN.
122 */
123 #define BEGIN yy_start = 1 + 2 *
124
125 /* Translate the current start state into a value that can be later handed
126 * to BEGIN to return to the state. The YYSTATE alias is for lex
127 * compatibility.
128 */
129 #define YY_START ((yy_start - 1) / 2)
130 #define YYSTATE YY_START
131
132 /* Action number for EOF rule of a given start state. */
133 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
134
135 /* Special action meaning "start processing a new file". */
136 #define YY_NEW_FILE yyrestart( yyin )
137
138 #define YY_END_OF_BUFFER_CHAR 0
139
140 /* Size of default input buffer. */
141 #define YY_BUF_SIZE 16384*5
142
143 typedef struct yy_buffer_state *YY_BUFFER_STATE;
144
145 extern int yyleng;
146 extern FILE *yyin, *yyout;
147
148 #define EOB_ACT_CONTINUE_SCAN 0
149 #define EOB_ACT_END_OF_FILE 1
150 #define EOB_ACT_LAST_MATCH 2
151
152 /* The funky do-while in the following #define is used to turn the definition
153 * int a single C statement (which needs a semi-colon terminator). This
154 * avoids problems with code like:
155 *
156 * if ( condition_holds )
157 * yyless( 5 );
158 * else
159 * do_something_else();
160 *
161 * Prior to using the do-while the compiler would get upset at the
162 * "else" because it interpreted the "if" statement as being all
163 * done when it reached the ';' after the yyless() call.
164 */
165
166 /* Return all but the first 'n' matched characters back to the input stream. */
167
168 #define yyless(n) \
169 do \
170 { \
171 /* Undo effects of setting up yytext. */ \
172 *yy_cp = yy_hold_char; \
173 YY_RESTORE_YY_MORE_OFFSET \
174 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
175 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
176 } \
177 while ( 0 )
178
179 #define unput(c) yyunput( c, yytext_ptr )
180
181 /* The following is because we cannot portably get our hands on size_t
182 * (without autoconf's help, which isn't available because we want
183 * flex-generated scanners to compile on their own).
184 */
185 typedef unsigned int yy_size_t;
186
187
188 struct yy_buffer_state
189 {
190 FILE *yy_input_file;
191
192 char *yy_ch_buf; /* input buffer */
193 char *yy_buf_pos; /* current position in input buffer */
194
195 /* Size of input buffer in bytes, not including room for EOB
196 * characters.
197 */
198 yy_size_t yy_buf_size;
199
200 /* Number of characters read into yy_ch_buf, not including EOB
201 * characters.
202 */
203 int yy_n_chars;
204
205 /* Whether we "own" the buffer - i.e., we know we created it,
206 * and can realloc() it to grow it, and should free() it to
207 * delete it.
208 */
209 int yy_is_our_buffer;
210
211 /* Whether this is an "interactive" input source; if so, and
212 * if we're using stdio for input, then we want to use getc()
213 * instead of fread(), to make sure we stop fetching input after
214 * each newline.
215 */
216 int yy_is_interactive;
217
218 /* Whether we're considered to be at the beginning of a line.
219 * If so, '^' rules will be active on the next match, otherwise
220 * not.
221 */
222 int yy_at_bol;
223
224 /* Whether to try to fill the input buffer when we reach the
225 * end of it.
226 */
227 int yy_fill_buffer;
228
229 int yy_buffer_status;
230 #define YY_BUFFER_NEW 0
231 #define YY_BUFFER_NORMAL 1
232 /* When an EOF's been seen but there's still some text to process
233 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
234 * shouldn't try reading from the input source any more. We might
235 * still have a bunch of tokens to match, though, because of
236 * possible backing-up.
237 *
238 * When we actually see the EOF, we change the status to "new"
239 * (via yyrestart()), so that the user can continue scanning by
240 * just pointing yyin at a new input file.
241 */
242 #define YY_BUFFER_EOF_PENDING 2
243 };
244
245 static YY_BUFFER_STATE yy_current_buffer = 0;
246
247 /* We provide macros for accessing buffer states in case in the
248 * future we want to put the buffer states in a more general
249 * "scanner state".
250 */
251 #define YY_CURRENT_BUFFER yy_current_buffer
252
253
254 /* yy_hold_char holds the character lost when yytext is formed. */
255 static char yy_hold_char;
256
257 static int yy_n_chars; /* number of characters read into yy_ch_buf */
258
259
260 int yyleng;
261
262 /* Points to current character in buffer. */
263 static char *yy_c_buf_p = (char *) 0;
264 static int yy_init = 1; /* whether we need to initialize */
265 static int yy_start = 0; /* start state number */
266
267 /* Flag which is used to allow yywrap()'s to do buffer switches
268 * instead of setting up a fresh yyin. A bit of a hack ...
269 */
270 static int yy_did_buffer_switch_on_eof;
271
272 void yyrestart YY_PROTO(( FILE *input_file ));
273
274 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
275 void yy_load_buffer_state YY_PROTO(( void ));
276 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
277 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
278 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
279 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
280 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
281
282 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
283 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
284 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
285
286 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
287 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
288 static void yy_flex_free YY_PROTO(( void * ));
289
290 #define yy_new_buffer yy_create_buffer
291
292 #define yy_set_interactive(is_interactive) \
293 { \
294 if ( ! yy_current_buffer ) \
295 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
296 yy_current_buffer->yy_is_interactive = is_interactive; \
297 }
298
299 #define yy_set_bol(at_bol) \
300 { \
301 if ( ! yy_current_buffer ) \
302 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
303 yy_current_buffer->yy_at_bol = at_bol; \
304 }
305
306 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
307
308
309 #define YY_USES_REJECT
310 typedef unsigned char YY_CHAR;
311 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
312 typedef int yy_state_type;
313 extern int yylineno;
314 int yylineno = 1;
315 extern char *yytext;
316 #define yytext_ptr yytext
317
318 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
319 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
320 static int yy_get_next_buffer YY_PROTO(( void ));
321 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
322
323 /* Done after the current pattern has been matched and before the
324 * corresponding action - sets up yytext.
325 */
326 #define YY_DO_BEFORE_ACTION \
327 yytext_ptr = yy_bp; \
328 yyleng = (int) (yy_cp - yy_bp); \
329 yy_hold_char = *yy_cp; \
330 *yy_cp = '\0'; \
331 yy_c_buf_p = yy_cp;
332
333 #define YY_NUM_RULES 19
334 #define YY_END_OF_BUFFER 20
335 static yyconst short int yy_acclist[53] =
336 { 0,
337 13, 13, 20, 11, 19, 19, 11, 19, 11, 19,
338 11, 19, 11, 19, 11, 19, 11, 19, 11, 19,
339 13, 19, 12, 19, 19, 18, 19, 18, 19, 16,
340 19, 15, 19, 8, 19, 7, 8, 19, 6, 8,
341 19, 4, 2, 1, 13, 17, 6, 3, 14, 10,
342 9, 5
343 } ;
344
345 static yyconst short int yy_accept[99] =
346 { 0,
347 1, 1, 1, 2, 3, 3, 3, 3, 3, 3,
348 3, 4, 6, 7, 9, 11, 13, 15, 17, 19,
349 21, 23, 25, 26, 28, 30, 32, 34, 36, 39,
350 42, 42, 43, 43, 43, 43, 44, 45, 45, 45,
351 45, 45, 45, 46, 46, 47, 48, 48, 48, 49,
352 49, 49, 49, 49, 49, 50, 50, 50, 50, 50,
353 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
354 50, 50, 50, 51, 51, 51, 51, 51, 51, 51,
355 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
356 51, 51, 51, 51, 52, 52, 53, 53
357
358 } ;
359
360 static yyconst int yy_ec[256] =
361 { 0,
362 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
364 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
365 1, 4, 1, 5, 1, 1, 1, 1, 6, 1,
366 1, 7, 1, 1, 1, 1, 8, 9, 9, 9,
367 9, 9, 9, 9, 9, 10, 10, 11, 12, 13,
368 14, 15, 16, 1, 17, 17, 17, 17, 17, 17,
369 18, 18, 18, 18, 18, 19, 18, 18, 18, 18,
370 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
371 1, 20, 1, 1, 11, 1, 21, 22, 23, 24,
372
373 25, 22, 26, 18, 27, 18, 18, 28, 29, 30,
374 18, 31, 18, 32, 33, 32, 34, 32, 18, 35,
375 18, 18, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389 1, 1, 1, 1, 1
390 } ;
391
392 static yyconst int yy_meta[36] =
393 { 0,
394 1, 2, 3, 4, 5, 6, 1, 1, 7, 8,
395 9, 10, 1, 11, 1, 5, 12, 13, 13, 5,
396 14, 14, 12, 12, 12, 13, 13, 13, 13, 15,
397 13, 15, 13, 13, 15
398 } ;
399
400 static yyconst short int yy_base[114] =
401 { 0,
402 0, 32, 7, 11, 14, 15, 283, 282, 66, 0,
403 277, 360, 360, 21, 256, 21, 26, 233, 241, 228,
404 0, 360, 0, 360, 242, 360, 360, 360, 360, 0,
405 28, 360, 14, 19, 93, 360, 360, 37, 227, 209,
406 134, 135, 41, 31, 360, 0, 45, 0, 360, 38,
407 0, 132, 134, 128, 48, 98, 124, 99, 144, 123,
408 123, 129, 101, 0, 103, 0, 128, 120, 139, 117,
409 119, 100, 360, 116, 106, 117, 112, 103, 127, 101,
410 0, 87, 108, 86, 110, 111, 112, 92, 107, 48,
411 38, 52, 123, 360, 30, 360, 360, 169, 184, 199,
412
413 214, 229, 244, 259, 266, 277, 288, 297, 305, 308,
414 320, 332, 344
415 } ;
416
417 static yyconst short int yy_def[114] =
418 { 0,
419 98, 98, 99, 99, 100, 100, 101, 101, 97, 9,
420 97, 97, 97, 102, 103, 97, 97, 97, 97, 97,
421 97, 97, 104, 97, 97, 97, 97, 97, 97, 105,
422 102, 97, 106, 103, 107, 97, 97, 102, 103, 97,
423 97, 97, 97, 104, 97, 105, 102, 108, 97, 103,
424 109, 97, 97, 97, 104, 102, 102, 103, 103, 97,
425 97, 97, 102, 57, 103, 59, 97, 97, 97, 97,
426 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
427 110, 97, 111, 97, 97, 111, 112, 97, 112, 113,
428 97, 97, 113, 97, 97, 97, 0, 97, 97, 97,
429
430 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
431 97, 97, 97
432 } ;
433
434 static yyconst short int yy_nxt[396] =
435 { 0,
436 97, 43, 13, 43, 14, 15, 97, 16, 21, 22,
437 21, 23, 21, 22, 21, 23, 13, 13, 17, 23,
438 25, 25, 47, 23, 49, 32, 18, 36, 37, 19,
439 38, 39, 32, 20, 13, 55, 14, 15, 35, 16,
440 33, 32, 43, 49, 43, 55, 58, 33, 48, 32,
441 17, 92, 55, 56, 96, 92, 33, 35, 18, 94,
442 95, 19, 55, 94, 33, 20, 28, 28, 13, 28,
443 28, 28, 28, 28, 28, 28, 28, 29, 28, 28,
444 28, 28, 30, 30, 30, 28, 30, 30, 30, 30,
445 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
446
447 30, 50, 32, 75, 49, 32, 63, 65, 49, 75,
448 89, 85, 91, 85, 85, 89, 88, 33, 35, 84,
449 33, 87, 35, 87, 87, 82, 92, 51, 32, 76,
450 81, 80, 64, 64, 94, 76, 79, 78, 77, 74,
451 64, 73, 72, 33, 64, 64, 64, 64, 64, 49,
452 71, 70, 66, 66, 69, 68, 67, 62, 61, 60,
453 66, 54, 53, 35, 66, 66, 66, 66, 66, 12,
454 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
455 12, 12, 12, 12, 13, 13, 13, 13, 13, 13,
456 13, 13, 13, 13, 13, 13, 13, 13, 13, 24,
457
458 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
459 24, 24, 24, 24, 26, 26, 26, 26, 26, 26,
460 26, 26, 26, 26, 26, 26, 26, 26, 26, 31,
461 31, 52, 31, 31, 31, 31, 31, 31, 31, 31,
462 31, 31, 31, 31, 34, 34, 35, 34, 34, 45,
463 34, 34, 34, 34, 34, 34, 34, 34, 34, 44,
464 42, 41, 40, 44, 44, 44, 44, 44, 44, 44,
465 44, 44, 44, 44, 46, 35, 97, 46, 46, 46,
466 46, 31, 31, 31, 27, 27, 97, 97, 97, 97,
467 31, 31, 34, 34, 34, 97, 97, 97, 97, 97,
468
469 97, 34, 34, 57, 57, 97, 97, 97, 57, 97,
470 57, 59, 59, 97, 97, 97, 59, 97, 59, 83,
471 83, 83, 83, 86, 97, 97, 97, 97, 86, 97,
472 86, 86, 86, 86, 86, 90, 97, 97, 97, 97,
473 97, 97, 97, 90, 90, 90, 90, 93, 97, 97,
474 97, 97, 93, 93, 97, 93, 93, 93, 93, 11,
475 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
476 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
477 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
478 97, 97, 97, 97, 97
479
480 } ;
481
482 static yyconst short int yy_chk[396] =
483 { 0,
484 0, 21, 1, 21, 1, 1, 0, 1, 3, 3,
485 3, 3, 4, 4, 4, 4, 5, 6, 1, 3,
486 5, 6, 33, 4, 34, 14, 1, 16, 16, 1,
487 17, 17, 31, 1, 2, 44, 2, 2, 34, 2,
488 14, 38, 43, 50, 43, 44, 50, 31, 33, 47,
489 2, 90, 55, 47, 95, 92, 38, 50, 2, 90,
490 91, 2, 55, 92, 47, 2, 9, 9, 9, 9,
491 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
492 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
493 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
494
495 9, 35, 56, 72, 58, 63, 56, 58, 65, 75,
496 89, 83, 88, 85, 86, 87, 84, 56, 58, 82,
497 63, 83, 65, 85, 86, 80, 93, 35, 57, 72,
498 79, 78, 57, 57, 93, 75, 77, 76, 74, 71,
499 57, 70, 69, 57, 57, 57, 57, 57, 57, 59,
500 68, 67, 59, 59, 62, 61, 60, 54, 53, 52,
501 59, 42, 41, 59, 59, 59, 59, 59, 59, 98,
502 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
503 98, 98, 98, 98, 99, 99, 99, 99, 99, 99,
504 99, 99, 99, 99, 99, 99, 99, 99, 99, 100,
505
506 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
507 100, 100, 100, 100, 101, 101, 101, 101, 101, 101,
508 101, 101, 101, 101, 101, 101, 101, 101, 101, 102,
509 102, 40, 102, 102, 102, 102, 102, 102, 102, 102,
510 102, 102, 102, 102, 103, 103, 39, 103, 103, 25,
511 103, 103, 103, 103, 103, 103, 103, 103, 103, 104,
512 20, 19, 18, 104, 104, 104, 104, 104, 104, 104,
513 104, 104, 104, 104, 105, 15, 11, 105, 105, 105,
514 105, 106, 106, 106, 8, 7, 0, 0, 0, 0,
515 106, 106, 107, 107, 107, 0, 0, 0, 0, 0,
516
517 0, 107, 107, 108, 108, 0, 0, 0, 108, 0,
518 108, 109, 109, 0, 0, 0, 109, 0, 109, 110,
519 110, 110, 110, 111, 0, 0, 0, 0, 111, 0,
520 111, 111, 111, 111, 111, 112, 0, 0, 0, 0,
521 0, 0, 0, 112, 112, 112, 112, 113, 0, 0,
522 0, 0, 113, 113, 0, 113, 113, 113, 113, 97,
523 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
524 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
525 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
526 97, 97, 97, 97, 97
527
528 } ;
529
530 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
531 static char *yy_full_match;
532 static int yy_lp;
533 #define REJECT \
534 { \
535 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
536 yy_cp = yy_full_match; /* restore poss. backed-over text */ \
537 ++yy_lp; \
538 goto find_rule; \
539 }
540 #define yymore() yymore_used_but_not_detected
541 #define YY_MORE_ADJ 0
542 #define YY_RESTORE_YY_MORE_OFFSET
543 char *yytext;
544 #define INITIAL 0
545 /**
546 * the "incl" state is used for picking up the name
547 * of an include file
548 */
549 #define incl 1
550
551 #define c_comment 2
552
553 #define cpp_comment 3
554
555 #define using_namespace 4
556
557 // Avoid spam output
558 #ifdef ECHO
559 #undef ECHO
560 #endif
561 #define ECHO
562
563 // Never exit
564 #ifdef YY_FATAL_ERROR
565 #undef YY_FATAL_ERROR
566 #endif
567 #define YY_FATAL_ERROR(msg)
568
569 #include <list>
570 #include <wx/filename.h>
571 #include "crawler_include.h"
572
573
574 /* Macros after this point can all be overridden by user definitions in
575 * section 1.
576 */
577
578 #ifndef YY_SKIP_YYWRAP
579 #ifdef __cplusplus
580 extern "C" int yywrap YY_PROTO(( void ));
581 #else
582 extern int yywrap YY_PROTO(( void ));
583 #endif
584 #endif
585
586 #ifndef YY_NO_UNPUT
587 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
588 #endif
589
590 #ifndef yytext_ptr
591 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
592 #endif
593
594 #ifdef YY_NEED_STRLEN
595 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
596 #endif
597
598 #ifndef YY_NO_INPUT
599 #ifdef __cplusplus
600 static int yyinput YY_PROTO(( void ));
601 #else
602 static int input YY_PROTO(( void ));
603 #endif
604 #endif
605
606 #if YY_STACK_USED
607 static int yy_start_stack_ptr = 0;
608 static int yy_start_stack_depth = 0;
609 static int *yy_start_stack = 0;
610 #ifndef YY_NO_PUSH_STATE
611 static void yy_push_state YY_PROTO(( int new_state ));
612 #endif
613 #ifndef YY_NO_POP_STATE
614 static void yy_pop_state YY_PROTO(( void ));
615 #endif
616 #ifndef YY_NO_TOP_STATE
617 static int yy_top_state YY_PROTO(( void ));
618 #endif
619
620 #else
621 #define YY_NO_PUSH_STATE 1
622 #define YY_NO_POP_STATE 1
623 #define YY_NO_TOP_STATE 1
624 #endif
625
626 #ifdef YY_MALLOC_DECL
627 YY_MALLOC_DECL
628 #else
629 #if __STDC__
630 #ifndef __cplusplus
631 #include <stdlib.h>
632 #endif
633 #else
634 /* Just try to get by without declaring the routines. This will fail
635 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
636 * or sizeof(void*) != sizeof(int).
637 */
638 #endif
639 #endif
640
641 /* Amount of stuff to slurp up with each read. */
642 #ifndef YY_READ_BUF_SIZE
643 #define YY_READ_BUF_SIZE 8192
644 #endif
645
646 /* Copy whatever the last rule matched to the standard output. */
647
648 #ifndef ECHO
649 /* This used to be an fputs(), but since the string might contain NUL's,
650 * we now use fwrite().
651 */
652 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
653 #endif
654
655 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
656 * is returned in "result".
657 */
658 #ifndef YY_INPUT
659 #define YY_INPUT(buf,result,max_size) \
660 if ( yy_current_buffer->yy_is_interactive ) \
661 { \
662 int c = '*', n; \
663 for ( n = 0; n < max_size && \
664 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
665 buf[n] = (char) c; \
666 if ( c == '\n' ) \
667 buf[n++] = (char) c; \
668 if ( c == EOF && ferror( yyin ) ) \
669 YY_FATAL_ERROR( "input in flex scanner failed" ); \
670 result = n; \
671 } \
672 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
673 && ferror( yyin ) ) \
674 YY_FATAL_ERROR( "input in flex scanner failed" );
675 #endif
676
677 /* No semi-colon after return; correct usage is to write "yyterminate();" -
678 * we don't want an extra ';' after the "return" because that will cause
679 * some compilers to complain about unreachable statements.
680 */
681 #ifndef yyterminate
682 #define yyterminate() return YY_NULL
683 #endif
684
685 /* Number of entries by which start-condition stack grows. */
686 #ifndef YY_START_STACK_INCR
687 #define YY_START_STACK_INCR 25
688 #endif
689
690 /* Report a fatal error. */
691 #ifndef YY_FATAL_ERROR
692 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
693 #endif
694
695 /* Default declaration of generated scanner - a define so the user can
696 * easily add parameters.
697 */
698 #ifndef YY_DECL
699 #define YY_DECL int yylex YY_PROTO(( void ))
700 #endif
701
702 /* Code executed at the beginning of each rule, after yytext and yyleng
703 * have been set up.
704 */
705 #ifndef YY_USER_ACTION
706 #define YY_USER_ACTION
707 #endif
708
709 /* Code executed at the end of each rule. */
710 #ifndef YY_BREAK
711 #define YY_BREAK break;
712 #endif
713
714 #define YY_RULE_SETUP \
715 YY_USER_ACTION
716
717 YY_DECL
718 {
719 register yy_state_type yy_current_state;
720 register char *yy_cp, *yy_bp;
721 register int yy_act;
722
723
724
725
726 if ( yy_init )
727 {
728 yy_init = 0;
729
730 #ifdef YY_USER_INIT
731 YY_USER_INIT;
732 #endif
733
734 if ( ! yy_start )
735 yy_start = 1; /* first start state */
736
737 if ( ! yyin )
738 yyin = stdin;
739
740 if ( ! yyout )
741 yyout = stdout;
742
743 if ( ! yy_current_buffer )
744 yy_current_buffer =
745 yy_create_buffer( yyin, YY_BUF_SIZE );
746
747 yy_load_buffer_state();
748 }
749
750 while ( 1 ) /* loops until end-of-file is reached */
751 {
752 yy_cp = yy_c_buf_p;
753
754 /* Support of yytext. */
755 *yy_cp = yy_hold_char;
756
757 /* yy_bp points to the position in yy_ch_buf of the start of
758 * the current run.
759 */
760 yy_bp = yy_cp;
761
762 yy_current_state = yy_start;
763 yy_state_ptr = yy_state_buf;
764 *yy_state_ptr++ = yy_current_state;
765 yy_match:
766 do
767 {
768 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
769 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
770 {
771 yy_current_state = (int) yy_def[yy_current_state];
772 if ( yy_current_state >= 98 )
773 yy_c = yy_meta[(unsigned int) yy_c];
774 }
775 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
776 *yy_state_ptr++ = yy_current_state;
777 ++yy_cp;
778 }
779 while ( yy_base[yy_current_state] != 360 );
780
781 yy_find_action:
782 yy_current_state = *--yy_state_ptr;
783 yy_lp = yy_accept[yy_current_state];
784 find_rule: /* we branch to this label when backing up */
785 for ( ; ; ) /* until we find what rule we matched */
786 {
787 if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
788 {
789 yy_act = yy_acclist[yy_lp];
790 {
791 yy_full_match = yy_cp;
792 break;
793 }
794 }
795 --yy_cp;
796 yy_current_state = *--yy_state_ptr;
797 yy_lp = yy_accept[yy_current_state];
798 }
799
800 YY_DO_BEFORE_ACTION;
801
802 if ( yy_act != YY_END_OF_BUFFER )
803 {
804 int yyl;
805 for ( yyl = 0; yyl < yyleng; ++yyl )
806 if ( yytext[yyl] == '\n' )
807 ++yylineno;
808 }
809
810 do_action: /* This label is used only to access EOF actions. */
811
812
813 switch ( yy_act )
814 { /* beginning of action switch */
815 case 1:
816 YY_RULE_SETUP
817 {
818 BEGIN(cpp_comment);
819 }
820 YY_BREAK
821 case 2:
822 YY_RULE_SETUP
823 {
824 BEGIN(c_comment);
825 }
826 YY_BREAK
827 case 3:
828 YY_RULE_SETUP
829 {/* eat a string */}
830 YY_BREAK
831 case 4:
832 YY_RULE_SETUP
833 {/* eat a string */}
834 YY_BREAK
835 case 5:
836 YY_RULE_SETUP
837 {BEGIN(using_namespace);}
838 YY_BREAK
839 case 6:
840 YY_RULE_SETUP
841 { /* got the namespace */
842 fcFileOpener::Get()->AddNamespace(yytext);
843 BEGIN(INITIAL);
844 }
845 YY_BREAK
846 case 7:
847 YY_RULE_SETUP
848 {BEGIN(INITIAL);}
849 YY_BREAK
850 case 8:
851 YY_RULE_SETUP
852 {}
853 YY_BREAK
854 case 9:
855 YY_RULE_SETUP
856 {fcFileOpener::Get()->AddNamespaceAlias(yytext);}
857 YY_BREAK
858 case 10:
859 YY_RULE_SETUP
860 {BEGIN(incl);}
861 YY_BREAK
862 case 11:
863 YY_RULE_SETUP
864 {}
865 YY_BREAK
866 case 12:
867 YY_RULE_SETUP
868 {BEGIN(INITIAL);}
869 YY_BREAK
870 case 13:
871 YY_RULE_SETUP
872 {} /* eat the whitespace */
873 YY_BREAK
874 case 14:
875 YY_RULE_SETUP
876 { /* got the include file name */
877 // Open the new file
878 FILE * new_file(NULL);
879
880 // keep the include statement
881 fcFileOpener::Get()->AddIncludeStatement( yytext );
882 wxString filepath;
883 if ( fcFileOpener::Get()->getDepth() < fcFileOpener::Get()->getMaxDepth() ) {
884 new_file = fcFileOpener::Get()->OpenFile( yytext, filepath );
885 }
886
887 if ( ! new_file ) {
888 // We got some error
889 BEGIN(INITIAL);
890
891 } else {
892 // keep the current buffer
893 fc_in = new_file;
894 fcFileOpener::Get()->PushBufferState( YY_CURRENT_BUFFER, filepath );
895
896 yy_switch_to_buffer( yy_create_buffer( new_file, YY_BUF_SIZE ) );
897 BEGIN(INITIAL);
898 }
899 }
900 YY_BREAK
901 case 15:
902 YY_RULE_SETUP
903 {
904 BEGIN(INITIAL);
905 }
906 YY_BREAK
907 case 16:
908 YY_RULE_SETUP
909 {} /* do nothing */
910 YY_BREAK
911 case 17:
912 YY_RULE_SETUP
913 {
914 BEGIN(INITIAL);
915 }
916 YY_BREAK
917 case 18:
918 YY_RULE_SETUP
919 {}
920 YY_BREAK
921 case YY_STATE_EOF(INITIAL):
922 case YY_STATE_EOF(incl):
923 case YY_STATE_EOF(c_comment):
924 case YY_STATE_EOF(cpp_comment):
925 case YY_STATE_EOF(using_namespace):
926 {
927 if ( !fcFileOpener::Get()->IsStateStackEmpty() ) {
928
929 if ( YY_CURRENT_BUFFER->yy_input_file ) {
930 fclose( YY_CURRENT_BUFFER->yy_input_file );
931 YY_CURRENT_BUFFER->yy_input_file = NULL;
932 }
933
934 yy_delete_buffer ( YY_CURRENT_BUFFER );
935 yy_switch_to_buffer ( fcFileOpener::Get()->PopBufferState() );
936
937 } else {
938
939 if ( YY_CURRENT_BUFFER->yy_input_file ) {
940 fclose( YY_CURRENT_BUFFER->yy_input_file );
941 YY_CURRENT_BUFFER->yy_input_file = NULL;
942
943 }
944
945 yy_delete_buffer ( YY_CURRENT_BUFFER );
946 yyterminate();
947 }
948 }
949 YY_BREAK
950 case 19:
951 YY_RULE_SETUP
952 ECHO;
953 YY_BREAK
954
955 case YY_END_OF_BUFFER:
956 {
957 /* Amount of text matched not including the EOB char. */
958 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
959
960 /* Undo the effects of YY_DO_BEFORE_ACTION. */
961 *yy_cp = yy_hold_char;
962 YY_RESTORE_YY_MORE_OFFSET
963
964 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
965 {
966 /* We're scanning a new file or input source. It's
967 * possible that this happened because the user
968 * just pointed yyin at a new source and called
969 * yylex(). If so, then we have to assure
970 * consistency between yy_current_buffer and our
971 * globals. Here is the right place to do so, because
972 * this is the first action (other than possibly a
973 * back-up) that will match for the new input source.
974 */
975 yy_n_chars = yy_current_buffer->yy_n_chars;
976 yy_current_buffer->yy_input_file = yyin;
977 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
978 }
979
980 /* Note that here we test for yy_c_buf_p "<=" to the position
981 * of the first EOB in the buffer, since yy_c_buf_p will
982 * already have been incremented past the NUL character
983 * (since all states make transitions on EOB to the
984 * end-of-buffer state). Contrast this with the test
985 * in input().
986 */
987 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
988 { /* This was really a NUL. */
989 yy_state_type yy_next_state;
990
991 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
992
993 yy_current_state = yy_get_previous_state();
994
995 /* Okay, we're now positioned to make the NUL
996 * transition. We couldn't have
997 * yy_get_previous_state() go ahead and do it
998 * for us because it doesn't know how to deal
999 * with the possibility of jamming (and we don't
1000 * want to build jamming into it because then it
1001 * will run more slowly).
1002 */
1003
1004 yy_next_state = yy_try_NUL_trans( yy_current_state );
1005
1006 yy_bp = yytext_ptr + YY_MORE_ADJ;
1007
1008 if ( yy_next_state )
1009 {
1010 /* Consume the NUL. */
1011 yy_cp = ++yy_c_buf_p;
1012 yy_current_state = yy_next_state;
1013 goto yy_match;
1014 }
1015
1016 else
1017 {
1018 yy_cp = yy_c_buf_p;
1019 goto yy_find_action;
1020 }
1021 }
1022
1023 else switch ( yy_get_next_buffer() )
1024 {
1025 case EOB_ACT_END_OF_FILE:
1026 {
1027 yy_did_buffer_switch_on_eof = 0;
1028
1029 if ( yywrap() )
1030 {
1031 /* Note: because we've taken care in
1032 * yy_get_next_buffer() to have set up
1033 * yytext, we can now set up
1034 * yy_c_buf_p so that if some total
1035 * hoser (like flex itself) wants to
1036 * call the scanner after we return the
1037 * YY_NULL, it'll still work - another
1038 * YY_NULL will get returned.
1039 */
1040 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1041
1042 yy_act = YY_STATE_EOF(YY_START);
1043 goto do_action;
1044 }
1045
1046 else
1047 {
1048 if ( ! yy_did_buffer_switch_on_eof )
1049 YY_NEW_FILE;
1050 }
1051 break;
1052 }
1053
1054 case EOB_ACT_CONTINUE_SCAN:
1055 yy_c_buf_p =
1056 yytext_ptr + yy_amount_of_matched_text;
1057
1058 yy_current_state = yy_get_previous_state();
1059
1060 yy_cp = yy_c_buf_p;
1061 yy_bp = yytext_ptr + YY_MORE_ADJ;
1062 goto yy_match;
1063
1064 case EOB_ACT_LAST_MATCH:
1065 yy_c_buf_p =
1066 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1067
1068 yy_current_state = yy_get_previous_state();
1069
1070 yy_cp = yy_c_buf_p;
1071 yy_bp = yytext_ptr + YY_MORE_ADJ;
1072 goto yy_find_action;
1073 }
1074 break;
1075 }
1076
1077 default:
1078 YY_FATAL_ERROR(
1079 "fatal flex scanner internal error--no action found" );
1080 } /* end of action switch */
1081 } /* end of scanning one token */
1082 } /* end of yylex */
1083
1084
1085 /* yy_get_next_buffer - try to read in a new buffer
1086 *
1087 * Returns a code representing an action:
1088 * EOB_ACT_LAST_MATCH -
1089 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1090 * EOB_ACT_END_OF_FILE - end of file
1091 */
1092
1093 static int yy_get_next_buffer()
1094 {
1095 register char *dest = yy_current_buffer->yy_ch_buf;
1096 register char *source = yytext_ptr;
1097 register int number_to_move, i;
1098 int ret_val;
1099
1100 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1101 YY_FATAL_ERROR(
1102 "fatal flex scanner internal error--end of buffer missed" );
1103
1104 if ( yy_current_buffer->yy_fill_buffer == 0 )
1105 { /* Don't try to fill the buffer, so this is an EOF. */
1106 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1107 {
1108 /* We matched a single character, the EOB, so
1109 * treat this as a final EOF.
1110 */
1111 return EOB_ACT_END_OF_FILE;
1112 }
1113
1114 else
1115 {
1116 /* We matched some text prior to the EOB, first
1117 * process it.
1118 */
1119 return EOB_ACT_LAST_MATCH;
1120 }
1121 }
1122
1123 /* Try to read more data. */
1124
1125 /* First move last chars to start of buffer. */
1126 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1127
1128 for ( i = 0; i < number_to_move; ++i )
1129 *(dest++) = *(source++);
1130
1131 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1132 /* don't do the read, it's not guaranteed to return an EOF,
1133 * just force an EOF
1134 */
1135 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1136
1137 else
1138 {
1139 int num_to_read =
1140 yy_current_buffer->yy_buf_size - number_to_move - 1;
1141
1142 while ( num_to_read <= 0 )
1143 { /* Not enough room in the buffer - grow it. */
1144 #ifdef YY_USES_REJECT
1145 YY_FATAL_ERROR(
1146 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1147 #else
1148
1149 /* just a shorter name for the current buffer */
1150 YY_BUFFER_STATE b = yy_current_buffer;
1151
1152 int yy_c_buf_p_offset =
1153 (int) (yy_c_buf_p - b->yy_ch_buf);
1154
1155 if ( b->yy_is_our_buffer )
1156 {
1157 int new_size = b->yy_buf_size * 2;
1158
1159 if ( new_size <= 0 )
1160 b->yy_buf_size += b->yy_buf_size / 8;
1161 else
1162 b->yy_buf_size *= 2;
1163
1164 b->yy_ch_buf = (char *)
1165 /* Include room in for 2 EOB chars. */
1166 yy_flex_realloc( (void *) b->yy_ch_buf,
1167 b->yy_buf_size + 2 );
1168 }
1169 else
1170 /* Can't grow it, we don't own it. */
1171 b->yy_ch_buf = 0;
1172
1173 if ( ! b->yy_ch_buf )
1174 YY_FATAL_ERROR(
1175 "fatal error - scanner input buffer overflow" );
1176
1177 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1178
1179 num_to_read = yy_current_buffer->yy_buf_size -
1180 number_to_move - 1;
1181 #endif
1182 }
1183
1184 if ( num_to_read > YY_READ_BUF_SIZE )
1185 num_to_read = YY_READ_BUF_SIZE;
1186
1187 /* Read in more data. */
1188 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1189 yy_n_chars, num_to_read );
1190
1191 yy_current_buffer->yy_n_chars = yy_n_chars;
1192 }
1193
1194 if ( yy_n_chars == 0 )
1195 {
1196 if ( number_to_move == YY_MORE_ADJ )
1197 {
1198 ret_val = EOB_ACT_END_OF_FILE;
1199 yyrestart( yyin );
1200 }
1201
1202 else
1203 {
1204 ret_val = EOB_ACT_LAST_MATCH;
1205 yy_current_buffer->yy_buffer_status =
1206 YY_BUFFER_EOF_PENDING;
1207 }
1208 }
1209
1210 else
1211 ret_val = EOB_ACT_CONTINUE_SCAN;
1212
1213 yy_n_chars += number_to_move;
1214 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1215 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1216
1217 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1218
1219 return ret_val;
1220 }
1221
1222
1223 /* yy_get_previous_state - get the state just before the EOB char was reached */
1224
1225 static yy_state_type yy_get_previous_state()
1226 {
1227 register yy_state_type yy_current_state;
1228 register char *yy_cp;
1229
1230 yy_current_state = yy_start;
1231 yy_state_ptr = yy_state_buf;
1232 *yy_state_ptr++ = yy_current_state;
1233
1234 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1235 {
1236 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1237 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1238 {
1239 yy_current_state = (int) yy_def[yy_current_state];
1240 if ( yy_current_state >= 98 )
1241 yy_c = yy_meta[(unsigned int) yy_c];
1242 }
1243 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1244 *yy_state_ptr++ = yy_current_state;
1245 }
1246
1247 return yy_current_state;
1248 }
1249
1250
1251 /* yy_try_NUL_trans - try to make a transition on the NUL character
1252 *
1253 * synopsis
1254 * next_state = yy_try_NUL_trans( current_state );
1255 */
1256
1257 #ifdef YY_USE_PROTOS
1258 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1259 #else
1260 static yy_state_type yy_try_NUL_trans( yy_current_state )
1261 yy_state_type yy_current_state;
1262 #endif
1263 {
1264 register int yy_is_jam;
1265
1266 register YY_CHAR yy_c = 1;
1267 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1268 {
1269 yy_current_state = (int) yy_def[yy_current_state];
1270 if ( yy_current_state >= 98 )
1271 yy_c = yy_meta[(unsigned int) yy_c];
1272 }
1273 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1274 yy_is_jam = (yy_current_state == 97);
1275 if ( ! yy_is_jam )
1276 *yy_state_ptr++ = yy_current_state;
1277
1278 return yy_is_jam ? 0 : yy_current_state;
1279 }
1280
1281
1282 #ifndef YY_NO_UNPUT
1283 #ifdef YY_USE_PROTOS
1284 static void yyunput( int c, register char *yy_bp )
1285 #else
1286 static void yyunput( c, yy_bp )
1287 int c;
1288 register char *yy_bp;
1289 #endif
1290 {
1291 register char *yy_cp = yy_c_buf_p;
1292
1293 /* undo effects of setting up yytext */
1294 *yy_cp = yy_hold_char;
1295
1296 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1297 { /* need to shift things up to make room */
1298 /* +2 for EOB chars. */
1299 register int number_to_move = yy_n_chars + 2;
1300 register char *dest = &yy_current_buffer->yy_ch_buf[
1301 yy_current_buffer->yy_buf_size + 2];
1302 register char *source =
1303 &yy_current_buffer->yy_ch_buf[number_to_move];
1304
1305 while ( source > yy_current_buffer->yy_ch_buf )
1306 *--dest = *--source;
1307
1308 yy_cp += (int) (dest - source);
1309 yy_bp += (int) (dest - source);
1310 yy_current_buffer->yy_n_chars =
1311 yy_n_chars = yy_current_buffer->yy_buf_size;
1312
1313 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1314 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1315 }
1316
1317 *--yy_cp = (char) c;
1318
1319 if ( c == '\n' )
1320 --yylineno;
1321
1322 yytext_ptr = yy_bp;
1323 yy_hold_char = *yy_cp;
1324 yy_c_buf_p = yy_cp;
1325 }
1326 #endif /* ifndef YY_NO_UNPUT */
1327
1328
1329 #ifdef __cplusplus
1330 static int yyinput()
1331 #else
1332 static int input()
1333 #endif
1334 {
1335 int c;
1336
1337 *yy_c_buf_p = yy_hold_char;
1338
1339 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1340 {
1341 /* yy_c_buf_p now points to the character we want to return.
1342 * If this occurs *before* the EOB characters, then it's a
1343 * valid NUL; if not, then we've hit the end of the buffer.
1344 */
1345 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1346 /* This was really a NUL. */
1347 *yy_c_buf_p = '\0';
1348
1349 else
1350 { /* need more input */
1351 int offset = yy_c_buf_p - yytext_ptr;
1352 ++yy_c_buf_p;
1353
1354 switch ( yy_get_next_buffer() )
1355 {
1356 case EOB_ACT_LAST_MATCH:
1357 /* This happens because yy_g_n_b()
1358 * sees that we've accumulated a
1359 * token and flags that we need to
1360 * try matching the token before
1361 * proceeding. But for input(),
1362 * there's no matching to consider.
1363 * So convert the EOB_ACT_LAST_MATCH
1364 * to EOB_ACT_END_OF_FILE.
1365 */
1366
1367 /* Reset buffer status. */
1368 yyrestart( yyin );
1369
1370 /* fall through */
1371
1372 case EOB_ACT_END_OF_FILE:
1373 {
1374 if ( yywrap() )
1375 return EOF;
1376
1377 if ( ! yy_did_buffer_switch_on_eof )
1378 YY_NEW_FILE;
1379 #ifdef __cplusplus
1380 return yyinput();
1381 #else
1382 return input();
1383 #endif
1384 }
1385
1386 case EOB_ACT_CONTINUE_SCAN:
1387 yy_c_buf_p = yytext_ptr + offset;
1388 break;
1389 }
1390 }
1391 }
1392
1393 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1394 *yy_c_buf_p = '\0'; /* preserve yytext */
1395 yy_hold_char = *++yy_c_buf_p;
1396
1397 if ( c == '\n' )
1398 ++yylineno;
1399
1400 return c;
1401 }
1402
1403
1404 #ifdef YY_USE_PROTOS
1405 void yyrestart( FILE *input_file )
1406 #else
1407 void yyrestart( input_file )
1408 FILE *input_file;
1409 #endif
1410 {
1411 if ( ! yy_current_buffer )
1412 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1413
1414 yy_init_buffer( yy_current_buffer, input_file );
1415 yy_load_buffer_state();
1416 }
1417
1418
1419 #ifdef YY_USE_PROTOS
1420 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1421 #else
1422 void yy_switch_to_buffer( new_buffer )
1423 YY_BUFFER_STATE new_buffer;
1424 #endif
1425 {
1426 if ( yy_current_buffer == new_buffer )
1427 return;
1428
1429 if ( yy_current_buffer )
1430 {
1431 /* Flush out information for old buffer. */
1432 *yy_c_buf_p = yy_hold_char;
1433 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1434 yy_current_buffer->yy_n_chars = yy_n_chars;
1435 }
1436
1437 yy_current_buffer = new_buffer;
1438 yy_load_buffer_state();
1439
1440 /* We don't actually know whether we did this switch during
1441 * EOF (yywrap()) processing, but the only time this flag
1442 * is looked at is after yywrap() is called, so it's safe
1443 * to go ahead and always set it.
1444 */
1445 yy_did_buffer_switch_on_eof = 1;
1446 }
1447
1448
1449 #ifdef YY_USE_PROTOS
1450 void yy_load_buffer_state( void )
1451 #else
1452 void yy_load_buffer_state()
1453 #endif
1454 {
1455 yy_n_chars = yy_current_buffer->yy_n_chars;
1456 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1457 yyin = yy_current_buffer->yy_input_file;
1458 yy_hold_char = *yy_c_buf_p;
1459 }
1460
1461
1462 #ifdef YY_USE_PROTOS
1463 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1464 #else
1465 YY_BUFFER_STATE yy_create_buffer( file, size )
1466 FILE *file;
1467 int size;
1468 #endif
1469 {
1470 YY_BUFFER_STATE b;
1471
1472 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1473 if ( ! b )
1474 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1475
1476 b->yy_buf_size = size;
1477
1478 /* yy_ch_buf has to be 2 characters longer than the size given because
1479 * we need to put in 2 end-of-buffer characters.
1480 */
1481 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1482 if ( ! b->yy_ch_buf )
1483 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1484
1485 b->yy_is_our_buffer = 1;
1486
1487 yy_init_buffer( b, file );
1488
1489 return b;
1490 }
1491
1492
1493 #ifdef YY_USE_PROTOS
1494 void yy_delete_buffer( YY_BUFFER_STATE b )
1495 #else
1496 void yy_delete_buffer( b )
1497 YY_BUFFER_STATE b;
1498 #endif
1499 {
1500 if ( ! b )
1501 return;
1502
1503 if ( b == yy_current_buffer )
1504 yy_current_buffer = (YY_BUFFER_STATE) 0;
1505
1506 if ( b->yy_is_our_buffer )
1507 yy_flex_free( (void *) b->yy_ch_buf );
1508
1509 yy_flex_free( (void *) b );
1510 }
1511
1512
1513 #ifndef YY_ALWAYS_INTERACTIVE
1514 #ifndef YY_NEVER_INTERACTIVE
1515 extern int isatty YY_PROTO(( int ));
1516 #endif
1517 #endif
1518
1519 #ifdef YY_USE_PROTOS
1520 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1521 #else
1522 void yy_init_buffer( b, file )
1523 YY_BUFFER_STATE b;
1524 FILE *file;
1525 #endif
1526
1527
1528 {
1529 yy_flush_buffer( b );
1530
1531 b->yy_input_file = file;
1532 b->yy_fill_buffer = 1;
1533
1534 #if YY_ALWAYS_INTERACTIVE
1535 b->yy_is_interactive = 1;
1536 #else
1537 #if YY_NEVER_INTERACTIVE
1538 b->yy_is_interactive = 0;
1539 #else
1540 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1541 #endif
1542 #endif
1543 }
1544
1545
1546 #ifdef YY_USE_PROTOS
1547 void yy_flush_buffer( YY_BUFFER_STATE b )
1548 #else
1549 void yy_flush_buffer( b )
1550 YY_BUFFER_STATE b;
1551 #endif
1552
1553 {
1554 if ( ! b )
1555 return;
1556
1557 b->yy_n_chars = 0;
1558
1559 /* We always need two end-of-buffer characters. The first causes
1560 * a transition to the end-of-buffer state. The second causes
1561 * a jam in that state.
1562 */
1563 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1564 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1565
1566 b->yy_buf_pos = &b->yy_ch_buf[0];
1567
1568 b->yy_at_bol = 1;
1569 b->yy_buffer_status = YY_BUFFER_NEW;
1570
1571 if ( b == yy_current_buffer )
1572 yy_load_buffer_state();
1573 }
1574
1575
1576 #ifndef YY_NO_SCAN_BUFFER
1577 #ifdef YY_USE_PROTOS
1578 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1579 #else
1580 YY_BUFFER_STATE yy_scan_buffer( base, size )
1581 char *base;
1582 yy_size_t size;
1583 #endif
1584 {
1585 YY_BUFFER_STATE b;
1586
1587 if ( size < 2 ||
1588 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1589 base[size-1] != YY_END_OF_BUFFER_CHAR )
1590 /* They forgot to leave room for the EOB's. */
1591 return 0;
1592
1593 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1594 if ( ! b )
1595 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1596
1597 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1598 b->yy_buf_pos = b->yy_ch_buf = base;
1599 b->yy_is_our_buffer = 0;
1600 b->yy_input_file = 0;
1601 b->yy_n_chars = b->yy_buf_size;
1602 b->yy_is_interactive = 0;
1603 b->yy_at_bol = 1;
1604 b->yy_fill_buffer = 0;
1605 b->yy_buffer_status = YY_BUFFER_NEW;
1606
1607 yy_switch_to_buffer( b );
1608
1609 return b;
1610 }
1611 #endif
1612
1613
1614 #ifndef YY_NO_SCAN_STRING
1615 #ifdef YY_USE_PROTOS
1616 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1617 #else
1618 YY_BUFFER_STATE yy_scan_string( yy_str )
1619 yyconst char *yy_str;
1620 #endif
1621 {
1622 int len;
1623 for ( len = 0; yy_str[len]; ++len )
1624 ;
1625
1626 return yy_scan_bytes( yy_str, len );
1627 }
1628 #endif
1629
1630
1631 #ifndef YY_NO_SCAN_BYTES
1632 #ifdef YY_USE_PROTOS
1633 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1634 #else
1635 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1636 yyconst char *bytes;
1637 int len;
1638 #endif
1639 {
1640 YY_BUFFER_STATE b;
1641 char *buf;
1642 yy_size_t n;
1643 int i;
1644
1645 /* Get memory for full buffer, including space for trailing EOB's. */
1646 n = len + 2;
1647 buf = (char *) yy_flex_alloc( n );
1648 if ( ! buf )
1649 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1650
1651 for ( i = 0; i < len; ++i )
1652 buf[i] = bytes[i];
1653
1654 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1655
1656 b = yy_scan_buffer( buf, n );
1657 if ( ! b )
1658 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1659
1660 /* It's okay to grow etc. this buffer, and we should throw it
1661 * away when we're done.
1662 */
1663 b->yy_is_our_buffer = 1;
1664
1665 return b;
1666 }
1667 #endif
1668
1669
1670 #ifndef YY_NO_PUSH_STATE
1671 #ifdef YY_USE_PROTOS
1672 static void yy_push_state( int new_state )
1673 #else
1674 static void yy_push_state( new_state )
1675 int new_state;
1676 #endif
1677 {
1678 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1679 {
1680 yy_size_t new_size;
1681
1682 yy_start_stack_depth += YY_START_STACK_INCR;
1683 new_size = yy_start_stack_depth * sizeof( int );
1684
1685 if ( ! yy_start_stack )
1686 yy_start_stack = (int *) yy_flex_alloc( new_size );
1687
1688 else
1689 yy_start_stack = (int *) yy_flex_realloc(
1690 (void *) yy_start_stack, new_size );
1691
1692 if ( ! yy_start_stack )
1693 YY_FATAL_ERROR(
1694 "out of memory expanding start-condition stack" );
1695 }
1696
1697 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1698
1699 BEGIN(new_state);
1700 }
1701 #endif
1702
1703
1704 #ifndef YY_NO_POP_STATE
1705 static void yy_pop_state()
1706 {
1707 if ( --yy_start_stack_ptr < 0 )
1708 YY_FATAL_ERROR( "start-condition stack underflow" );
1709
1710 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1711 }
1712 #endif
1713
1714
1715 #ifndef YY_NO_TOP_STATE
1716 static int yy_top_state()
1717 {
1718 return yy_start_stack[yy_start_stack_ptr - 1];
1719 }
1720 #endif
1721
1722 #ifndef YY_EXIT_FAILURE
1723 #define YY_EXIT_FAILURE 2
1724 #endif
1725
1726 #ifdef YY_USE_PROTOS
1727 static void yy_fatal_error( yyconst char msg[] )
1728 #else
1729 static void yy_fatal_error( msg )
1730 char msg[];
1731 #endif
1732 {
1733 (void) fprintf( stderr, "%s\n", msg );
1734
1735 }
1736
1737
1738
1739 /* Redefine yyless() so it works in section 3 code. */
1740
1741 #undef yyless
1742 #define yyless(n) \
1743 do \
1744 { \
1745 /* Undo effects of setting up yytext. */ \
1746 yytext[yyleng] = yy_hold_char; \
1747 yy_c_buf_p = yytext + n; \
1748 yy_hold_char = *yy_c_buf_p; \
1749 *yy_c_buf_p = '\0'; \
1750 yyleng = n; \
1751 } \
1752 while ( 0 )
1753
1754
1755 /* Internal utility routines. */
1756
1757 #ifndef yytext_ptr
1758 #ifdef YY_USE_PROTOS
1759 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1760 #else
1761 static void yy_flex_strncpy( s1, s2, n )
1762 char *s1;
1763 yyconst char *s2;
1764 int n;
1765 #endif
1766 {
1767 register int i;
1768 for ( i = 0; i < n; ++i )
1769 s1[i] = s2[i];
1770 }
1771 #endif
1772
1773 #ifdef YY_NEED_STRLEN
1774 #ifdef YY_USE_PROTOS
1775 static int yy_flex_strlen( yyconst char *s )
1776 #else
1777 static int yy_flex_strlen( s )
1778 yyconst char *s;
1779 #endif
1780 {
1781 register int n;
1782 for ( n = 0; s[n]; ++n )
1783 ;
1784
1785 return n;
1786 }
1787 #endif
1788
1789
1790 #ifdef YY_USE_PROTOS
1791 static void *yy_flex_alloc( yy_size_t size )
1792 #else
1793 static void *yy_flex_alloc( size )
1794 yy_size_t size;
1795 #endif
1796 {
1797 return (void *) malloc( size );
1798 }
1799
1800 #ifdef YY_USE_PROTOS
1801 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1802 #else
1803 static void *yy_flex_realloc( ptr, size )
1804 void *ptr;
1805 yy_size_t size;
1806 #endif
1807 {
1808 /* The cast to (char *) in the following accommodates both
1809 * implementations that use char* generic pointers, and those
1810 * that use void* generic pointers. It works with the latter
1811 * because both ANSI C and C++ allow castless assignment from
1812 * any pointer type to void*, and deal with argument conversions
1813 * as though doing an assignment.
1814 */
1815 return (void *) realloc( (char *) ptr, size );
1816 }
1817
1818 #ifdef YY_USE_PROTOS
1819 static void yy_flex_free( void *ptr )
1820 #else
1821 static void yy_flex_free( ptr )
1822 void *ptr;
1823 #endif
1824 {
1825 free( ptr );
1826 }
1827
1828 #if YY_MAIN
1829 int main()
1830 {
1831 yylex();
1832 return 0;
1833 }
1834 #endif
1835
1836
1837 int yywrap() {
1838 return 1;
1839 }
1840
1841 int crawlerScan( const char* filePath )
1842 {
1843 BEGIN INITIAL;
1844 fc_lineno = 1;
1845
1846 wxFileName fn(filePath);
1847 if ( fn.IsRelative() ) {
1848 fn.MakeAbsolute();
1849 }
1850
1851 FILE* fp = fopen(fn.GetFullPath().mb_str(wxConvUTF8).data(), "r");
1852 if ( fp == NULL ) {
1853 //printf("%s\n", strerror(errno));
1854 // failed to open input file...
1855 return -1;
1856 }
1857
1858 // set the initial search directory
1859 fcFileOpener::Get()->SetCwd( fn.GetPath() );
1860
1861 yy_switch_to_buffer( yy_create_buffer(fp, YY_BUF_SIZE) );
1862 fc_in = fp;
1863 int rc = fc_lex();
1864 yy_delete_buffer( YY_CURRENT_BUFFER );
1865
1866 return rc;
1867 }
1868