Moved ConfigDir from theApp to thePrefs
[amule.git] / src / Scanner.cpp
blob549e416d1507c880182daf68a4d5e70926389321
1 #line 2 "Scanner.cpp"
3 #line 4 "Scanner.cpp"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
25 /* end standard C headers. */
27 /* flex integer type definitions */
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
57 #endif /* ! C99 */
59 /* Limits of integral types. */
60 #ifndef INT8_MIN
61 #define INT8_MIN (-128)
62 #endif
63 #ifndef INT16_MIN
64 #define INT16_MIN (-32767-1)
65 #endif
66 #ifndef INT32_MIN
67 #define INT32_MIN (-2147483647-1)
68 #endif
69 #ifndef INT8_MAX
70 #define INT8_MAX (127)
71 #endif
72 #ifndef INT16_MAX
73 #define INT16_MAX (32767)
74 #endif
75 #ifndef INT32_MAX
76 #define INT32_MAX (2147483647)
77 #endif
78 #ifndef UINT8_MAX
79 #define UINT8_MAX (255U)
80 #endif
81 #ifndef UINT16_MAX
82 #define UINT16_MAX (65535U)
83 #endif
84 #ifndef UINT32_MAX
85 #define UINT32_MAX (4294967295U)
86 #endif
88 #endif /* ! FLEXINT_H */
90 #ifdef __cplusplus
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
100 #define YY_USE_CONST
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
105 #ifdef YY_USE_CONST
106 #define yyconst const
107 #else
108 #define yyconst
109 #endif
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
117 * double cast.
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* Enter a start condition. This macro really ought to take a parameter,
122 * but we do it the disgusting crufty way forced on us by the ()-less
123 * definition of BEGIN.
125 #define BEGIN (yy_start) = 1 + 2 *
127 /* Translate the current start state into a value that can be later handed
128 * to BEGIN to return to the state. The YYSTATE alias is for lex
129 * compatibility.
131 #define YY_START (((yy_start) - 1) / 2)
132 #define YYSTATE YY_START
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE yyrestart(yyin )
140 #define YY_END_OF_BUFFER_CHAR 0
142 /* Size of default input buffer. */
143 #ifndef YY_BUF_SIZE
144 #define YY_BUF_SIZE 16384
145 #endif
147 /* The state buf must be large enough to hold one state per character in the main buffer.
149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
152 #define YY_TYPEDEF_YY_BUFFER_STATE
153 typedef struct yy_buffer_state *YY_BUFFER_STATE;
154 #endif
156 extern int yyleng;
158 extern FILE *yyin, *yyout;
160 #define EOB_ACT_CONTINUE_SCAN 0
161 #define EOB_ACT_END_OF_FILE 1
162 #define EOB_ACT_LAST_MATCH 2
164 #define YY_LESS_LINENO(n)
166 /* Return all but the first "n" matched characters back to the input stream. */
167 #define yyless(n) \
168 do \
170 /* Undo effects of setting up yytext. */ \
171 int yyless_macro_arg = (n); \
172 YY_LESS_LINENO(yyless_macro_arg);\
173 *yy_cp = (yy_hold_char); \
174 YY_RESTORE_YY_MORE_OFFSET \
175 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
176 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
178 while ( 0 )
180 #define unput(c) yyunput( c, (yytext_ptr) )
182 #ifndef YY_TYPEDEF_YY_SIZE_T
183 #define YY_TYPEDEF_YY_SIZE_T
184 typedef size_t yy_size_t;
185 #endif
187 #ifndef YY_STRUCT_YY_BUFFER_STATE
188 #define YY_STRUCT_YY_BUFFER_STATE
189 struct yy_buffer_state
191 FILE *yy_input_file;
193 char *yy_ch_buf; /* input buffer */
194 char *yy_buf_pos; /* current position in input buffer */
196 /* Size of input buffer in bytes, not including room for EOB
197 * characters.
199 yy_size_t yy_buf_size;
201 /* Number of characters read into yy_ch_buf, not including EOB
202 * characters.
204 int yy_n_chars;
206 /* Whether we "own" the buffer - i.e., we know we created it,
207 * and can realloc() it to grow it, and should free() it to
208 * delete it.
210 int yy_is_our_buffer;
212 /* Whether this is an "interactive" input source; if so, and
213 * if we're using stdio for input, then we want to use getc()
214 * instead of fread(), to make sure we stop fetching input after
215 * each newline.
217 int yy_is_interactive;
219 /* Whether we're considered to be at the beginning of a line.
220 * If so, '^' rules will be active on the next match, otherwise
221 * not.
223 int yy_at_bol;
225 int yy_bs_lineno; /**< The line count. */
226 int yy_bs_column; /**< The column count. */
228 /* Whether to try to fill the input buffer when we reach the
229 * end of it.
231 int yy_fill_buffer;
233 int yy_buffer_status;
235 #define YY_BUFFER_NEW 0
236 #define YY_BUFFER_NORMAL 1
237 /* When an EOF's been seen but there's still some text to process
238 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
239 * shouldn't try reading from the input source any more. We might
240 * still have a bunch of tokens to match, though, because of
241 * possible backing-up.
243 * When we actually see the EOF, we change the status to "new"
244 * (via yyrestart()), so that the user can continue scanning by
245 * just pointing yyin at a new input file.
247 #define YY_BUFFER_EOF_PENDING 2
250 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
252 /* Stack of input buffers. */
253 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
254 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
255 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
257 /* We provide macros for accessing buffer states in case in the
258 * future we want to put the buffer states in a more general
259 * "scanner state".
261 * Returns the top of the stack, or NULL.
263 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
264 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
265 : NULL)
267 /* Same as previous macro, but useful when we know that the buffer stack is not
268 * NULL or when we need an lvalue. For internal use only.
270 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
272 /* yy_hold_char holds the character lost when yytext is formed. */
273 static char yy_hold_char;
274 static int yy_n_chars; /* number of characters read into yy_ch_buf */
275 int yyleng;
277 /* Points to current character in buffer. */
278 static char *yy_c_buf_p = (char *) 0;
279 static int yy_init = 0; /* whether we need to initialize */
280 static int yy_start = 0; /* start state number */
282 /* Flag which is used to allow yywrap()'s to do buffer switches
283 * instead of setting up a fresh yyin. A bit of a hack ...
285 static int yy_did_buffer_switch_on_eof;
287 void yyrestart (FILE *input_file );
288 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
289 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
290 void yy_delete_buffer (YY_BUFFER_STATE b );
291 void yy_flush_buffer (YY_BUFFER_STATE b );
292 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
293 void yypop_buffer_state (void );
295 static void yyensure_buffer_stack (void );
296 static void yy_load_buffer_state (void );
297 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
299 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
301 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
302 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
303 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
305 void *yyalloc (yy_size_t );
306 void *yyrealloc (void *,yy_size_t );
307 void yyfree (void * );
309 #define yy_new_buffer yy_create_buffer
311 #define yy_set_interactive(is_interactive) \
313 if ( ! YY_CURRENT_BUFFER ){ \
314 yyensure_buffer_stack (); \
315 YY_CURRENT_BUFFER_LVALUE = \
316 yy_create_buffer(yyin,YY_BUF_SIZE ); \
318 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
321 #define yy_set_bol(at_bol) \
323 if ( ! YY_CURRENT_BUFFER ){\
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
331 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
333 /* Begin user sect3 */
335 #define yywrap(n) 1
336 #define YY_SKIP_YYWRAP
338 typedef unsigned char YY_CHAR;
340 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
342 typedef int yy_state_type;
344 extern int yylineno;
346 int yylineno = 1;
348 extern char *yytext;
349 #define yytext_ptr yytext
351 static yy_state_type yy_get_previous_state (void );
352 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
353 static int yy_get_next_buffer (void );
354 static void yy_fatal_error (yyconst char msg[] );
356 /* Done after the current pattern has been matched and before the
357 * corresponding action - sets up yytext.
359 #define YY_DO_BEFORE_ACTION \
360 (yytext_ptr) = yy_bp; \
361 yyleng = (size_t) (yy_cp - yy_bp); \
362 (yy_hold_char) = *yy_cp; \
363 *yy_cp = '\0'; \
364 (yy_c_buf_p) = yy_cp;
366 #define YY_NUM_RULES 9
367 #define YY_END_OF_BUFFER 10
368 /* This struct is not used in this scanner,
369 but its presence is necessary. */
370 struct yy_trans_info
372 flex_int32_t yy_verify;
373 flex_int32_t yy_nxt;
375 static yyconst flex_int16_t yy_accept[57] =
376 { 0,
377 6, 6, 10, 6, 6, 1, 7, 8, 6, 6,
378 6, 6, 6, 6, 6, 2, 6, 3, 4, 6,
379 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
380 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
381 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
382 6, 6, 6, 6, 5, 0
385 static yyconst flex_int32_t yy_ec[256] =
386 { 0,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390 1, 3, 1, 4, 1, 1, 1, 1, 1, 5,
391 5, 1, 1, 1, 1, 1, 1, 6, 6, 7,
392 6, 6, 6, 6, 6, 6, 6, 8, 1, 1,
393 1, 1, 1, 1, 9, 6, 6, 10, 6, 6,
394 1, 1, 1, 1, 1, 1, 1, 11, 12, 1,
395 1, 13, 1, 14, 1, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 6, 6, 6, 15,
398 16, 6, 1, 1, 1, 1, 17, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1
417 static yyconst flex_int32_t yy_meta[18] =
418 { 0,
419 1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1
423 static yyconst flex_int16_t yy_base[58] =
424 { 0,
425 0, 0, 45, 0, 0, 370, 370, 370, 31, 25,
426 23, 20, 0, 24, 17, 0, 19, 0, 0, 8,
427 16, 15, 12, 23, 34, 45, 56, 67, 78, 89,
428 100, 111, 122, 133, 144, 155, 166, 177, 188, 199,
429 210, 221, 232, 243, 254, 265, 276, 287, 298, 309,
430 320, 331, 342, 353, 0, 370, 19
433 static yyconst flex_int16_t yy_def[58] =
434 { 0,
435 56, 1, 56, 57, 57, 56, 56, 56, 57, 57,
436 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
437 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
438 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
439 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
440 57, 57, 57, 57, 57, 0, 56
443 static yyconst flex_int16_t yy_nxt[388] =
444 { 0,
445 4, 5, 6, 7, 8, 4, 4, 4, 9, 4,
446 10, 11, 4, 4, 4, 12, 4, 24, 24, 13,
447 24, 24, 23, 22, 21, 20, 24, 24, 25, 25,
448 19, 25, 25, 18, 17, 16, 15, 25, 25, 26,
449 26, 14, 26, 26, 56, 56, 56, 56, 26, 26,
450 27, 27, 56, 27, 27, 56, 56, 56, 56, 27,
451 27, 28, 28, 56, 28, 28, 56, 56, 56, 56,
452 28, 28, 29, 29, 56, 29, 29, 56, 56, 56,
453 56, 29, 29, 30, 30, 56, 30, 30, 56, 56,
454 56, 56, 30, 30, 31, 31, 56, 31, 31, 56,
456 56, 56, 56, 31, 31, 32, 32, 56, 32, 32,
457 56, 56, 56, 56, 32, 32, 33, 33, 56, 33,
458 33, 56, 56, 56, 56, 33, 33, 34, 34, 56,
459 34, 34, 56, 56, 56, 56, 34, 34, 35, 35,
460 56, 35, 35, 56, 56, 56, 56, 35, 35, 36,
461 36, 56, 36, 36, 56, 56, 56, 56, 36, 36,
462 37, 37, 56, 37, 37, 56, 56, 56, 56, 37,
463 37, 38, 38, 56, 38, 38, 56, 56, 56, 56,
464 38, 38, 39, 39, 56, 39, 39, 56, 56, 56,
465 56, 39, 39, 40, 40, 56, 40, 40, 56, 56,
467 56, 56, 40, 40, 41, 41, 56, 41, 41, 56,
468 56, 56, 56, 41, 41, 42, 42, 56, 42, 42,
469 56, 56, 56, 56, 42, 42, 43, 43, 56, 43,
470 43, 56, 56, 56, 56, 43, 43, 44, 44, 56,
471 44, 44, 56, 56, 56, 56, 44, 44, 45, 45,
472 56, 45, 45, 56, 56, 56, 56, 45, 45, 46,
473 46, 56, 46, 46, 56, 56, 56, 56, 46, 46,
474 47, 47, 56, 47, 47, 56, 56, 56, 56, 47,
475 47, 48, 48, 56, 48, 48, 56, 56, 56, 56,
476 48, 48, 49, 49, 56, 49, 49, 56, 56, 56,
478 56, 49, 49, 50, 50, 56, 50, 50, 56, 56,
479 56, 56, 50, 50, 51, 51, 56, 51, 51, 56,
480 56, 56, 56, 51, 51, 52, 52, 56, 52, 52,
481 56, 56, 56, 56, 52, 52, 53, 53, 56, 53,
482 53, 56, 56, 56, 56, 53, 53, 54, 54, 56,
483 54, 54, 56, 56, 56, 56, 54, 54, 55, 55,
484 56, 55, 55, 56, 56, 56, 56, 55, 55, 3,
485 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
486 56, 56, 56, 56, 56, 56, 56
489 static yyconst flex_int16_t yy_chk[388] =
490 { 0,
491 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
492 1, 1, 1, 1, 1, 1, 1, 23, 23, 57,
493 23, 23, 22, 21, 20, 17, 23, 23, 24, 24,
494 15, 24, 24, 14, 12, 11, 10, 24, 24, 25,
495 25, 9, 25, 25, 3, 0, 0, 0, 25, 25,
496 26, 26, 0, 26, 26, 0, 0, 0, 0, 26,
497 26, 27, 27, 0, 27, 27, 0, 0, 0, 0,
498 27, 27, 28, 28, 0, 28, 28, 0, 0, 0,
499 0, 28, 28, 29, 29, 0, 29, 29, 0, 0,
500 0, 0, 29, 29, 30, 30, 0, 30, 30, 0,
502 0, 0, 0, 30, 30, 31, 31, 0, 31, 31,
503 0, 0, 0, 0, 31, 31, 32, 32, 0, 32,
504 32, 0, 0, 0, 0, 32, 32, 33, 33, 0,
505 33, 33, 0, 0, 0, 0, 33, 33, 34, 34,
506 0, 34, 34, 0, 0, 0, 0, 34, 34, 35,
507 35, 0, 35, 35, 0, 0, 0, 0, 35, 35,
508 36, 36, 0, 36, 36, 0, 0, 0, 0, 36,
509 36, 37, 37, 0, 37, 37, 0, 0, 0, 0,
510 37, 37, 38, 38, 0, 38, 38, 0, 0, 0,
511 0, 38, 38, 39, 39, 0, 39, 39, 0, 0,
513 0, 0, 39, 39, 40, 40, 0, 40, 40, 0,
514 0, 0, 0, 40, 40, 41, 41, 0, 41, 41,
515 0, 0, 0, 0, 41, 41, 42, 42, 0, 42,
516 42, 0, 0, 0, 0, 42, 42, 43, 43, 0,
517 43, 43, 0, 0, 0, 0, 43, 43, 44, 44,
518 0, 44, 44, 0, 0, 0, 0, 44, 44, 45,
519 45, 0, 45, 45, 0, 0, 0, 0, 45, 45,
520 46, 46, 0, 46, 46, 0, 0, 0, 0, 46,
521 46, 47, 47, 0, 47, 47, 0, 0, 0, 0,
522 47, 47, 48, 48, 0, 48, 48, 0, 0, 0,
524 0, 48, 48, 49, 49, 0, 49, 49, 0, 0,
525 0, 0, 49, 49, 50, 50, 0, 50, 50, 0,
526 0, 0, 0, 50, 50, 51, 51, 0, 51, 51,
527 0, 0, 0, 0, 51, 51, 52, 52, 0, 52,
528 52, 0, 0, 0, 0, 52, 52, 53, 53, 0,
529 53, 53, 0, 0, 0, 0, 53, 53, 54, 54,
530 0, 54, 54, 0, 0, 0, 0, 54, 54, 56,
531 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
532 56, 56, 56, 56, 56, 56, 56
535 static yy_state_type yy_last_accepting_state;
536 static char *yy_last_accepting_cpos;
538 extern int yy_flex_debug;
539 int yy_flex_debug = 0;
541 /* The intent behind this definition is that it'll catch
542 * any uses of REJECT which flex missed.
544 #define REJECT reject_used_but_not_detected
545 #define yymore() yymore_used_but_not_detected
546 #define YY_MORE_ADJ 0
547 #define YY_RESTORE_YY_MORE_OFFSET
548 char *yytext;
549 #line 1 "./Scanner.l"
550 #line 2 "./Scanner.l"
551 #include <stdio.h>
552 #include "SearchExpr.h"
553 #include "Parser.hpp"
554 #include "ED2KLink.h"
555 #include <wx/string.h>
557 #include "libs/common/StringFunctions.h"
559 #ifdef _MSC_VER
560 #define isatty(DUMMY) 0
561 #endif
563 #ifdef _DEBUG
564 #define new DEBUG_NEW
565 #undef THIS_FILE
566 static char THIS_FILE[] = __FILE__;
567 #endif
569 #define YY_NEVER_INTERACTIVE 1
571 extern int yyerror(const char* errstr);
572 extern int yyerror(wxString errstr);
574 #define YY_INPUT ReadLexBuff
575 #define YY_FATAL_ERROR FatalLexError
577 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize);
578 static void FatalLexError(yyconst char msg[]);
580 static char* _pszLexBuff;
581 static char* _pszLexStr;
583 #line 584 "Scanner.cpp"
585 #define INITIAL 0
587 #ifndef YY_NO_UNISTD_H
588 /* Special case for "unistd.h", since it is non-ANSI. We include it way
589 * down here because we want the user's section 1 to have been scanned first.
590 * The user has a chance to override it with an option.
592 #include <unistd.h>
593 #endif
595 #ifndef YY_EXTRA_TYPE
596 #define YY_EXTRA_TYPE void *
597 #endif
599 static int yy_init_globals (void );
601 /* Accessor methods to globals.
602 These are made visible to non-reentrant scanners for convenience. */
604 int yylex_destroy (void );
606 int yyget_debug (void );
608 void yyset_debug (int debug_flag );
610 YY_EXTRA_TYPE yyget_extra (void );
612 void yyset_extra (YY_EXTRA_TYPE user_defined );
614 FILE *yyget_in (void );
616 void yyset_in (FILE * in_str );
618 FILE *yyget_out (void );
620 void yyset_out (FILE * out_str );
622 int yyget_leng (void );
624 char *yyget_text (void );
626 int yyget_lineno (void );
628 void yyset_lineno (int line_number );
630 /* Macros after this point can all be overridden by user definitions in
631 * section 1.
634 #ifndef YY_SKIP_YYWRAP
635 #ifdef __cplusplus
636 extern "C" int yywrap (void );
637 #else
638 extern int yywrap (void );
639 #endif
640 #endif
642 static void yyunput (int c,char *buf_ptr );
644 #ifndef yytext_ptr
645 static void yy_flex_strncpy (char *,yyconst char *,int );
646 #endif
648 #ifdef YY_NEED_STRLEN
649 static int yy_flex_strlen (yyconst char * );
650 #endif
652 #ifndef YY_NO_INPUT
654 #ifdef __cplusplus
655 static int yyinput (void );
656 #else
657 static int input (void );
658 #endif
660 #endif
662 /* Amount of stuff to slurp up with each read. */
663 #ifndef YY_READ_BUF_SIZE
664 #define YY_READ_BUF_SIZE 8192
665 #endif
667 /* Copy whatever the last rule matched to the standard output. */
668 #ifndef ECHO
669 /* This used to be an fputs(), but since the string might contain NUL's,
670 * we now use fwrite().
672 #define ECHO fwrite( yytext, yyleng, 1, yyout )
673 #endif
675 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
676 * is returned in "result".
678 #ifndef YY_INPUT
679 #define YY_INPUT(buf,result,max_size) \
680 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
682 int c = '*'; \
683 int n; \
684 for ( n = 0; n < max_size && \
685 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
686 buf[n] = (char) c; \
687 if ( c == '\n' ) \
688 buf[n++] = (char) c; \
689 if ( c == EOF && ferror( yyin ) ) \
690 YY_FATAL_ERROR( "input in flex scanner failed" ); \
691 result = n; \
693 else \
695 errno=0; \
696 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
698 if( errno != EINTR) \
700 YY_FATAL_ERROR( "input in flex scanner failed" ); \
701 break; \
703 errno=0; \
704 clearerr(yyin); \
709 #endif
711 /* No semi-colon after return; correct usage is to write "yyterminate();" -
712 * we don't want an extra ';' after the "return" because that will cause
713 * some compilers to complain about unreachable statements.
715 #ifndef yyterminate
716 #define yyterminate() return YY_NULL
717 #endif
719 /* Number of entries by which start-condition stack grows. */
720 #ifndef YY_START_STACK_INCR
721 #define YY_START_STACK_INCR 25
722 #endif
724 /* Report a fatal error. */
725 #ifndef YY_FATAL_ERROR
726 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
727 #endif
729 /* end tables serialization structures and prototypes */
731 /* Default declaration of generated scanner - a define so the user can
732 * easily add parameters.
734 #ifndef YY_DECL
735 #define YY_DECL_IS_OURS 1
737 extern int yylex (void);
739 #define YY_DECL int yylex (void)
740 #endif /* !YY_DECL */
742 /* Code executed at the beginning of each rule, after yytext and yyleng
743 * have been set up.
745 #ifndef YY_USER_ACTION
746 #define YY_USER_ACTION
747 #endif
749 /* Code executed at the end of each rule. */
750 #ifndef YY_BREAK
751 #define YY_BREAK break;
752 #endif
754 #define YY_RULE_SETUP \
755 YY_USER_ACTION
757 /** The main scanner function which does all the work.
759 YY_DECL
761 register yy_state_type yy_current_state;
762 register char *yy_cp, *yy_bp;
763 register int yy_act;
765 #line 40 "./Scanner.l"
768 #line 769 "Scanner.cpp"
770 if ( !(yy_init) )
772 (yy_init) = 1;
774 #ifdef YY_USER_INIT
775 YY_USER_INIT;
776 #endif
778 if ( ! (yy_start) )
779 (yy_start) = 1; /* first start state */
781 if ( ! yyin )
782 yyin = stdin;
784 if ( ! yyout )
785 yyout = stdout;
787 if ( ! YY_CURRENT_BUFFER ) {
788 yyensure_buffer_stack ();
789 YY_CURRENT_BUFFER_LVALUE =
790 yy_create_buffer(yyin,YY_BUF_SIZE );
793 yy_load_buffer_state( );
796 while ( 1 ) /* loops until end-of-file is reached */
798 yy_cp = (yy_c_buf_p);
800 /* Support of yytext. */
801 *yy_cp = (yy_hold_char);
803 /* yy_bp points to the position in yy_ch_buf of the start of
804 * the current run.
806 yy_bp = yy_cp;
808 yy_current_state = (yy_start);
809 yy_match:
812 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
813 if ( yy_accept[yy_current_state] )
815 (yy_last_accepting_state) = yy_current_state;
816 (yy_last_accepting_cpos) = yy_cp;
818 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
820 yy_current_state = (int) yy_def[yy_current_state];
821 if ( yy_current_state >= 57 )
822 yy_c = yy_meta[(unsigned int) yy_c];
824 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
825 ++yy_cp;
827 while ( yy_base[yy_current_state] != 370 );
829 yy_find_action:
830 yy_act = yy_accept[yy_current_state];
831 if ( yy_act == 0 )
832 { /* have to back up */
833 yy_cp = (yy_last_accepting_cpos);
834 yy_current_state = (yy_last_accepting_state);
835 yy_act = yy_accept[yy_current_state];
838 YY_DO_BEFORE_ACTION;
840 do_action: /* This label is used only to access EOF actions. */
842 switch ( yy_act )
843 { /* beginning of action switch */
844 case 0: /* must back up */
845 /* undo the effects of YY_DO_BEFORE_ACTION */
846 *yy_cp = (yy_hold_char);
847 yy_cp = (yy_last_accepting_cpos);
848 yy_current_state = (yy_last_accepting_state);
849 goto yy_find_action;
851 case 1:
852 YY_RULE_SETUP
853 #line 42 "./Scanner.l"
854 { /* Skip blanks. */ }
855 YY_BREAK
856 case 2:
857 YY_RULE_SETUP
858 #line 43 "./Scanner.l"
859 { return TOK_OR; }
860 YY_BREAK
861 case 3:
862 YY_RULE_SETUP
863 #line 44 "./Scanner.l"
864 { return TOK_AND; }
865 YY_BREAK
866 case 4:
867 YY_RULE_SETUP
868 #line 45 "./Scanner.l"
869 { return TOK_NOT; }
870 YY_BREAK
871 case 5:
872 YY_RULE_SETUP
873 #line 47 "./Scanner.l"
875 yylval.pstr = new wxString(UTF82unicode(yytext));
876 return TOK_ED2K_LINK;
878 YY_BREAK
879 case 6:
880 /* rule 6 can match eol */
881 YY_RULE_SETUP
882 #line 52 "./Scanner.l"
884 yylval.pstr = new wxString(UTF82unicode(yytext));
885 return TOK_STRING;
887 YY_BREAK
888 case 7:
889 YY_RULE_SETUP
890 #line 57 "./Scanner.l"
892 int l = 128;
893 char* psz = (char*)malloc(l);
894 int i = 0;
895 int c;
896 while ((c = yyinput()) != '\"')
898 if (c == EOF || c == '\n'){
899 unput(c);
900 yyerror(wxT("Search expression error: unterminated string"));
901 break;
903 if (c == '\\'){ /*Escape sequence*/
904 switch (c = yyinput())
906 case '\n':
907 continue;
908 case 't': /*Tab*/
909 c = '\t';
910 break;
911 case 'n': /*Linefeed*/
912 c = '\n';
913 break;
914 case 'f': /*Formfeed*/
915 c = '\f';
916 break;
917 case 'r': /*Carriage return*/
918 c = '\r';
919 break;
920 case '\\': /*Backslash*/
921 c = '\\';
922 break;
923 case '"': /*Double quotation mark*/
924 c = '\"';
925 break;
926 case '\'': /*Single quotation mark*/
927 c = '\'';
928 break;
929 case '?': /*Question mark*/
930 c = '\?';
931 break;
932 case 'v': /*Vertical Tab*/
933 c = '\v';
934 break;
935 case 'a': /*Alert*/
936 c = '\a';
937 break;
938 case 'b': /*Backspace*/
939 c = '\b';
940 break;
941 case 'x': /*Hexadecimal number*/
943 int n, octv;
944 for (n = 1, octv = 0; n <= 3; n++) {
945 if ((c = yyinput()) >= '0' && c <= '9')
946 c -= '0';
947 else if (c >= 'a' && c <= 'f')
948 c = (c - 'a') + 10;
949 else if (c >= 'A' && c <= 'F')
950 c = (c - 'A') + 10;
951 else
952 break;
953 octv = octv * 16 + c;
955 unput(c);
956 if (n == 1)
957 c = 'x';
958 else
959 c = octv;
961 break;
963 } else {
964 if ((unsigned char)c >= 0x80/* && IsDBCSLeadByte(yytext[0]) */){
965 psz[i++] = (unsigned char)c;
966 if (i >= l) {
967 char *tmp = (char*)realloc(psz, l += 128);
968 if (tmp == NULL){
969 yyerror("Less memory for string");
970 break;
971 } else {
972 psz = tmp;
975 c = yyinput();
979 psz[i++] = (unsigned char)c;
980 if (i >= l) {
981 char *tmp = (char*)realloc(psz, l += 128);
982 if (tmp == NULL){
983 yyerror("Less memory for string");
984 break;
985 } else {
986 psz = tmp;
990 psz[i] = '\0';
991 yylval.pstr = new wxString(UTF82unicode(psz));
992 free(psz);
993 return TOK_STRING;
995 YY_BREAK
996 case 8:
997 YY_RULE_SETUP
998 #line 162 "./Scanner.l"
999 { return yytext[0]; }
1000 YY_BREAK
1001 case 9:
1002 YY_RULE_SETUP
1003 #line 164 "./Scanner.l"
1004 ECHO;
1005 YY_BREAK
1006 #line 1007 "Scanner.cpp"
1007 case YY_STATE_EOF(INITIAL):
1008 yyterminate();
1010 case YY_END_OF_BUFFER:
1012 /* Amount of text matched not including the EOB char. */
1013 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1015 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1016 *yy_cp = (yy_hold_char);
1017 YY_RESTORE_YY_MORE_OFFSET
1019 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1021 /* We're scanning a new file or input source. It's
1022 * possible that this happened because the user
1023 * just pointed yyin at a new source and called
1024 * yylex(). If so, then we have to assure
1025 * consistency between YY_CURRENT_BUFFER and our
1026 * globals. Here is the right place to do so, because
1027 * this is the first action (other than possibly a
1028 * back-up) that will match for the new input source.
1030 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1031 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1032 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1035 /* Note that here we test for yy_c_buf_p "<=" to the position
1036 * of the first EOB in the buffer, since yy_c_buf_p will
1037 * already have been incremented past the NUL character
1038 * (since all states make transitions on EOB to the
1039 * end-of-buffer state). Contrast this with the test
1040 * in input().
1042 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1043 { /* This was really a NUL. */
1044 yy_state_type yy_next_state;
1046 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1048 yy_current_state = yy_get_previous_state( );
1050 /* Okay, we're now positioned to make the NUL
1051 * transition. We couldn't have
1052 * yy_get_previous_state() go ahead and do it
1053 * for us because it doesn't know how to deal
1054 * with the possibility of jamming (and we don't
1055 * want to build jamming into it because then it
1056 * will run more slowly).
1059 yy_next_state = yy_try_NUL_trans( yy_current_state );
1061 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1063 if ( yy_next_state )
1065 /* Consume the NUL. */
1066 yy_cp = ++(yy_c_buf_p);
1067 yy_current_state = yy_next_state;
1068 goto yy_match;
1071 else
1073 yy_cp = (yy_c_buf_p);
1074 goto yy_find_action;
1078 else switch ( yy_get_next_buffer( ) )
1080 case EOB_ACT_END_OF_FILE:
1082 (yy_did_buffer_switch_on_eof) = 0;
1084 if ( yywrap( ) )
1086 /* Note: because we've taken care in
1087 * yy_get_next_buffer() to have set up
1088 * yytext, we can now set up
1089 * yy_c_buf_p so that if some total
1090 * hoser (like flex itself) wants to
1091 * call the scanner after we return the
1092 * YY_NULL, it'll still work - another
1093 * YY_NULL will get returned.
1095 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1097 yy_act = YY_STATE_EOF(YY_START);
1098 goto do_action;
1101 else
1103 if ( ! (yy_did_buffer_switch_on_eof) )
1104 YY_NEW_FILE;
1106 break;
1109 case EOB_ACT_CONTINUE_SCAN:
1110 (yy_c_buf_p) =
1111 (yytext_ptr) + yy_amount_of_matched_text;
1113 yy_current_state = yy_get_previous_state( );
1115 yy_cp = (yy_c_buf_p);
1116 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1117 goto yy_match;
1119 case EOB_ACT_LAST_MATCH:
1120 (yy_c_buf_p) =
1121 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1123 yy_current_state = yy_get_previous_state( );
1125 yy_cp = (yy_c_buf_p);
1126 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1127 goto yy_find_action;
1129 break;
1132 default:
1133 YY_FATAL_ERROR(
1134 "fatal flex scanner internal error--no action found" );
1135 } /* end of action switch */
1136 } /* end of scanning one token */
1137 } /* end of yylex */
1139 /* yy_get_next_buffer - try to read in a new buffer
1141 * Returns a code representing an action:
1142 * EOB_ACT_LAST_MATCH -
1143 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1144 * EOB_ACT_END_OF_FILE - end of file
1146 static int yy_get_next_buffer (void)
1148 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1149 register char *source = (yytext_ptr);
1150 register int number_to_move, i;
1151 int ret_val;
1153 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1154 YY_FATAL_ERROR(
1155 "fatal flex scanner internal error--end of buffer missed" );
1157 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1158 { /* Don't try to fill the buffer, so this is an EOF. */
1159 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1161 /* We matched a single character, the EOB, so
1162 * treat this as a final EOF.
1164 return EOB_ACT_END_OF_FILE;
1167 else
1169 /* We matched some text prior to the EOB, first
1170 * process it.
1172 return EOB_ACT_LAST_MATCH;
1176 /* Try to read more data. */
1178 /* First move last chars to start of buffer. */
1179 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1181 for ( i = 0; i < number_to_move; ++i )
1182 *(dest++) = *(source++);
1184 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1185 /* don't do the read, it's not guaranteed to return an EOF,
1186 * just force an EOF
1188 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1190 else
1192 int num_to_read =
1193 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1195 while ( num_to_read <= 0 )
1196 { /* Not enough room in the buffer - grow it. */
1198 /* just a shorter name for the current buffer */
1199 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1201 int yy_c_buf_p_offset =
1202 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1204 if ( b->yy_is_our_buffer )
1206 int new_size = b->yy_buf_size * 2;
1208 if ( new_size <= 0 )
1209 b->yy_buf_size += b->yy_buf_size / 8;
1210 else
1211 b->yy_buf_size *= 2;
1213 b->yy_ch_buf = (char *)
1214 /* Include room in for 2 EOB chars. */
1215 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1217 else
1218 /* Can't grow it, we don't own it. */
1219 b->yy_ch_buf = 0;
1221 if ( ! b->yy_ch_buf )
1222 YY_FATAL_ERROR(
1223 "fatal error - scanner input buffer overflow" );
1225 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1227 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1228 number_to_move - 1;
1232 if ( num_to_read > YY_READ_BUF_SIZE )
1233 num_to_read = YY_READ_BUF_SIZE;
1235 /* Read in more data. */
1236 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1237 (yy_n_chars), (size_t) num_to_read );
1239 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1242 if ( (yy_n_chars) == 0 )
1244 if ( number_to_move == YY_MORE_ADJ )
1246 ret_val = EOB_ACT_END_OF_FILE;
1247 yyrestart(yyin );
1250 else
1252 ret_val = EOB_ACT_LAST_MATCH;
1253 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1254 YY_BUFFER_EOF_PENDING;
1258 else
1259 ret_val = EOB_ACT_CONTINUE_SCAN;
1261 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1262 /* Extend the array by 50%, plus the number we really need. */
1263 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1264 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1265 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1266 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1269 (yy_n_chars) += number_to_move;
1270 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1271 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1273 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1275 return ret_val;
1278 /* yy_get_previous_state - get the state just before the EOB char was reached */
1280 static yy_state_type yy_get_previous_state (void)
1282 register yy_state_type yy_current_state;
1283 register char *yy_cp;
1285 yy_current_state = (yy_start);
1287 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1289 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1290 if ( yy_accept[yy_current_state] )
1292 (yy_last_accepting_state) = yy_current_state;
1293 (yy_last_accepting_cpos) = yy_cp;
1295 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1297 yy_current_state = (int) yy_def[yy_current_state];
1298 if ( yy_current_state >= 57 )
1299 yy_c = yy_meta[(unsigned int) yy_c];
1301 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1304 return yy_current_state;
1307 /* yy_try_NUL_trans - try to make a transition on the NUL character
1309 * synopsis
1310 * next_state = yy_try_NUL_trans( current_state );
1312 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1314 register int yy_is_jam;
1315 register char *yy_cp = (yy_c_buf_p);
1317 register YY_CHAR yy_c = 1;
1318 if ( yy_accept[yy_current_state] )
1320 (yy_last_accepting_state) = yy_current_state;
1321 (yy_last_accepting_cpos) = yy_cp;
1323 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1325 yy_current_state = (int) yy_def[yy_current_state];
1326 if ( yy_current_state >= 57 )
1327 yy_c = yy_meta[(unsigned int) yy_c];
1329 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1330 yy_is_jam = (yy_current_state == 56);
1332 return yy_is_jam ? 0 : yy_current_state;
1335 static void yyunput (int c, register char * yy_bp )
1337 register char *yy_cp;
1339 yy_cp = (yy_c_buf_p);
1341 /* undo effects of setting up yytext */
1342 *yy_cp = (yy_hold_char);
1344 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1345 { /* need to shift things up to make room */
1346 /* +2 for EOB chars. */
1347 register int number_to_move = (yy_n_chars) + 2;
1348 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1349 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1350 register char *source =
1351 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1353 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1354 *--dest = *--source;
1356 yy_cp += (int) (dest - source);
1357 yy_bp += (int) (dest - source);
1358 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1359 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1361 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1362 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1365 *--yy_cp = (char) c;
1367 (yytext_ptr) = yy_bp;
1368 (yy_hold_char) = *yy_cp;
1369 (yy_c_buf_p) = yy_cp;
1372 #ifndef YY_NO_INPUT
1373 #ifdef __cplusplus
1374 static int yyinput (void)
1375 #else
1376 static int input (void)
1377 #endif
1380 int c;
1382 *(yy_c_buf_p) = (yy_hold_char);
1384 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1386 /* yy_c_buf_p now points to the character we want to return.
1387 * If this occurs *before* the EOB characters, then it's a
1388 * valid NUL; if not, then we've hit the end of the buffer.
1390 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1391 /* This was really a NUL. */
1392 *(yy_c_buf_p) = '\0';
1394 else
1395 { /* need more input */
1396 int offset = (yy_c_buf_p) - (yytext_ptr);
1397 ++(yy_c_buf_p);
1399 switch ( yy_get_next_buffer( ) )
1401 case EOB_ACT_LAST_MATCH:
1402 /* This happens because yy_g_n_b()
1403 * sees that we've accumulated a
1404 * token and flags that we need to
1405 * try matching the token before
1406 * proceeding. But for input(),
1407 * there's no matching to consider.
1408 * So convert the EOB_ACT_LAST_MATCH
1409 * to EOB_ACT_END_OF_FILE.
1412 /* Reset buffer status. */
1413 yyrestart(yyin );
1415 /*FALLTHROUGH*/
1417 case EOB_ACT_END_OF_FILE:
1419 if ( yywrap( ) )
1420 return EOF;
1422 if ( ! (yy_did_buffer_switch_on_eof) )
1423 YY_NEW_FILE;
1424 #ifdef __cplusplus
1425 return yyinput();
1426 #else
1427 return input();
1428 #endif
1431 case EOB_ACT_CONTINUE_SCAN:
1432 (yy_c_buf_p) = (yytext_ptr) + offset;
1433 break;
1438 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1439 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1440 (yy_hold_char) = *++(yy_c_buf_p);
1442 return c;
1444 #endif /* ifndef YY_NO_INPUT */
1446 /** Immediately switch to a different input stream.
1447 * @param input_file A readable stream.
1449 * @note This function does not reset the start condition to @c INITIAL .
1451 void yyrestart (FILE * input_file )
1454 if ( ! YY_CURRENT_BUFFER ){
1455 yyensure_buffer_stack ();
1456 YY_CURRENT_BUFFER_LVALUE =
1457 yy_create_buffer(yyin,YY_BUF_SIZE );
1460 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1461 yy_load_buffer_state( );
1464 /** Switch to a different input buffer.
1465 * @param new_buffer The new input buffer.
1468 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1471 /* TODO. We should be able to replace this entire function body
1472 * with
1473 * yypop_buffer_state();
1474 * yypush_buffer_state(new_buffer);
1476 yyensure_buffer_stack ();
1477 if ( YY_CURRENT_BUFFER == new_buffer )
1478 return;
1480 if ( YY_CURRENT_BUFFER )
1482 /* Flush out information for old buffer. */
1483 *(yy_c_buf_p) = (yy_hold_char);
1484 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1485 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1488 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1489 yy_load_buffer_state( );
1491 /* We don't actually know whether we did this switch during
1492 * EOF (yywrap()) processing, but the only time this flag
1493 * is looked at is after yywrap() is called, so it's safe
1494 * to go ahead and always set it.
1496 (yy_did_buffer_switch_on_eof) = 1;
1499 static void yy_load_buffer_state (void)
1501 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1502 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1503 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1504 (yy_hold_char) = *(yy_c_buf_p);
1507 /** Allocate and initialize an input buffer state.
1508 * @param file A readable stream.
1509 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1511 * @return the allocated buffer state.
1513 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1515 YY_BUFFER_STATE b;
1517 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1518 if ( ! b )
1519 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1521 b->yy_buf_size = size;
1523 /* yy_ch_buf has to be 2 characters longer than the size given because
1524 * we need to put in 2 end-of-buffer characters.
1526 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1527 if ( ! b->yy_ch_buf )
1528 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1530 b->yy_is_our_buffer = 1;
1532 yy_init_buffer(b,file );
1534 return b;
1537 /** Destroy the buffer.
1538 * @param b a buffer created with yy_create_buffer()
1541 void yy_delete_buffer (YY_BUFFER_STATE b )
1544 if ( ! b )
1545 return;
1547 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1548 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1550 if ( b->yy_is_our_buffer )
1551 yyfree((void *) b->yy_ch_buf );
1553 yyfree((void *) b );
1556 #ifndef __cplusplus
1557 extern int isatty (int );
1558 #endif /* __cplusplus */
1560 /* Initializes or reinitializes a buffer.
1561 * This function is sometimes called more than once on the same buffer,
1562 * such as during a yyrestart() or at EOF.
1564 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1567 int oerrno = errno;
1569 yy_flush_buffer(b );
1571 b->yy_input_file = file;
1572 b->yy_fill_buffer = 1;
1574 /* If b is the current buffer, then yy_init_buffer was _probably_
1575 * called from yyrestart() or through yy_get_next_buffer.
1576 * In that case, we don't want to reset the lineno or column.
1578 if (b != YY_CURRENT_BUFFER){
1579 b->yy_bs_lineno = 1;
1580 b->yy_bs_column = 0;
1583 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1585 errno = oerrno;
1588 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1589 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1592 void yy_flush_buffer (YY_BUFFER_STATE b )
1594 if ( ! b )
1595 return;
1597 b->yy_n_chars = 0;
1599 /* We always need two end-of-buffer characters. The first causes
1600 * a transition to the end-of-buffer state. The second causes
1601 * a jam in that state.
1603 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1604 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1606 b->yy_buf_pos = &b->yy_ch_buf[0];
1608 b->yy_at_bol = 1;
1609 b->yy_buffer_status = YY_BUFFER_NEW;
1611 if ( b == YY_CURRENT_BUFFER )
1612 yy_load_buffer_state( );
1615 /** Pushes the new state onto the stack. The new state becomes
1616 * the current state. This function will allocate the stack
1617 * if necessary.
1618 * @param new_buffer The new state.
1621 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1623 if (new_buffer == NULL)
1624 return;
1626 yyensure_buffer_stack();
1628 /* This block is copied from yy_switch_to_buffer. */
1629 if ( YY_CURRENT_BUFFER )
1631 /* Flush out information for old buffer. */
1632 *(yy_c_buf_p) = (yy_hold_char);
1633 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1634 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1637 /* Only push if top exists. Otherwise, replace top. */
1638 if (YY_CURRENT_BUFFER)
1639 (yy_buffer_stack_top)++;
1640 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1642 /* copied from yy_switch_to_buffer. */
1643 yy_load_buffer_state( );
1644 (yy_did_buffer_switch_on_eof) = 1;
1647 /** Removes and deletes the top of the stack, if present.
1648 * The next element becomes the new top.
1651 void yypop_buffer_state (void)
1653 if (!YY_CURRENT_BUFFER)
1654 return;
1656 yy_delete_buffer(YY_CURRENT_BUFFER );
1657 YY_CURRENT_BUFFER_LVALUE = NULL;
1658 if ((yy_buffer_stack_top) > 0)
1659 --(yy_buffer_stack_top);
1661 if (YY_CURRENT_BUFFER) {
1662 yy_load_buffer_state( );
1663 (yy_did_buffer_switch_on_eof) = 1;
1667 /* Allocates the stack if it does not exist.
1668 * Guarantees space for at least one push.
1670 static void yyensure_buffer_stack (void)
1672 int num_to_alloc;
1674 if (!(yy_buffer_stack)) {
1676 /* First allocation is just for 2 elements, since we don't know if this
1677 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1678 * immediate realloc on the next call.
1680 num_to_alloc = 1;
1681 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1682 (num_to_alloc * sizeof(struct yy_buffer_state*)
1684 if ( ! (yy_buffer_stack) )
1685 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1687 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1689 (yy_buffer_stack_max) = num_to_alloc;
1690 (yy_buffer_stack_top) = 0;
1691 return;
1694 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1696 /* Increase the buffer to prepare for a possible push. */
1697 int grow_size = 8 /* arbitrary grow size */;
1699 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1700 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1701 ((yy_buffer_stack),
1702 num_to_alloc * sizeof(struct yy_buffer_state*)
1704 if ( ! (yy_buffer_stack) )
1705 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1707 /* zero only the new slots.*/
1708 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1709 (yy_buffer_stack_max) = num_to_alloc;
1713 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1714 * @param base the character buffer
1715 * @param size the size in bytes of the character buffer
1717 * @return the newly allocated buffer state object.
1719 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1721 YY_BUFFER_STATE b;
1723 if ( size < 2 ||
1724 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1725 base[size-1] != YY_END_OF_BUFFER_CHAR )
1726 /* They forgot to leave room for the EOB's. */
1727 return 0;
1729 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1730 if ( ! b )
1731 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1733 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1734 b->yy_buf_pos = b->yy_ch_buf = base;
1735 b->yy_is_our_buffer = 0;
1736 b->yy_input_file = 0;
1737 b->yy_n_chars = b->yy_buf_size;
1738 b->yy_is_interactive = 0;
1739 b->yy_at_bol = 1;
1740 b->yy_fill_buffer = 0;
1741 b->yy_buffer_status = YY_BUFFER_NEW;
1743 yy_switch_to_buffer(b );
1745 return b;
1748 /** Setup the input buffer state to scan a string. The next call to yylex() will
1749 * scan from a @e copy of @a str.
1750 * @param yystr a NUL-terminated string to scan
1752 * @return the newly allocated buffer state object.
1753 * @note If you want to scan bytes that may contain NUL values, then use
1754 * yy_scan_bytes() instead.
1756 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1759 return yy_scan_bytes(yystr,strlen(yystr) );
1762 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1763 * scan from a @e copy of @a bytes.
1764 * @param bytes the byte buffer to scan
1765 * @param len the number of bytes in the buffer pointed to by @a bytes.
1767 * @return the newly allocated buffer state object.
1769 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1771 YY_BUFFER_STATE b;
1772 char *buf;
1773 yy_size_t n;
1774 int i;
1776 /* Get memory for full buffer, including space for trailing EOB's. */
1777 n = _yybytes_len + 2;
1778 buf = (char *) yyalloc(n );
1779 if ( ! buf )
1780 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1782 for ( i = 0; i < _yybytes_len; ++i )
1783 buf[i] = yybytes[i];
1785 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1787 b = yy_scan_buffer(buf,n );
1788 if ( ! b )
1789 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1791 /* It's okay to grow etc. this buffer, and we should throw it
1792 * away when we're done.
1794 b->yy_is_our_buffer = 1;
1796 return b;
1799 #ifndef YY_EXIT_FAILURE
1800 #define YY_EXIT_FAILURE 2
1801 #endif
1803 static void yy_fatal_error (yyconst char* msg )
1805 (void) fprintf( stderr, "%s\n", msg );
1806 exit( YY_EXIT_FAILURE );
1809 /* Redefine yyless() so it works in section 3 code. */
1811 #undef yyless
1812 #define yyless(n) \
1813 do \
1815 /* Undo effects of setting up yytext. */ \
1816 int yyless_macro_arg = (n); \
1817 YY_LESS_LINENO(yyless_macro_arg);\
1818 yytext[yyleng] = (yy_hold_char); \
1819 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1820 (yy_hold_char) = *(yy_c_buf_p); \
1821 *(yy_c_buf_p) = '\0'; \
1822 yyleng = yyless_macro_arg; \
1824 while ( 0 )
1826 /* Accessor methods (get/set functions) to struct members. */
1828 /** Get the current line number.
1831 int yyget_lineno (void)
1834 return yylineno;
1837 /** Get the input stream.
1840 FILE *yyget_in (void)
1842 return yyin;
1845 /** Get the output stream.
1848 FILE *yyget_out (void)
1850 return yyout;
1853 /** Get the length of the current token.
1856 int yyget_leng (void)
1858 return yyleng;
1861 /** Get the current token.
1865 char *yyget_text (void)
1867 return yytext;
1870 /** Set the current line number.
1871 * @param line_number
1874 void yyset_lineno (int line_number )
1877 yylineno = line_number;
1880 /** Set the input stream. This does not discard the current
1881 * input buffer.
1882 * @param in_str A readable stream.
1884 * @see yy_switch_to_buffer
1886 void yyset_in (FILE * in_str )
1888 yyin = in_str ;
1891 void yyset_out (FILE * out_str )
1893 yyout = out_str ;
1896 int yyget_debug (void)
1898 return yy_flex_debug;
1901 void yyset_debug (int bdebug )
1903 yy_flex_debug = bdebug ;
1906 static int yy_init_globals (void)
1908 /* Initialization is the same as for the non-reentrant scanner.
1909 * This function is called from yylex_destroy(), so don't allocate here.
1912 (yy_buffer_stack) = 0;
1913 (yy_buffer_stack_top) = 0;
1914 (yy_buffer_stack_max) = 0;
1915 (yy_c_buf_p) = (char *) 0;
1916 (yy_init) = 0;
1917 (yy_start) = 0;
1919 /* Defined in main.c */
1920 #ifdef YY_STDINIT
1921 yyin = stdin;
1922 yyout = stdout;
1923 #else
1924 yyin = (FILE *) 0;
1925 yyout = (FILE *) 0;
1926 #endif
1928 /* For future reference: Set errno on error, since we are called by
1929 * yylex_init()
1931 return 0;
1934 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1935 int yylex_destroy (void)
1938 /* Pop the buffer stack, destroying each element. */
1939 while(YY_CURRENT_BUFFER){
1940 yy_delete_buffer(YY_CURRENT_BUFFER );
1941 YY_CURRENT_BUFFER_LVALUE = NULL;
1942 yypop_buffer_state();
1945 /* Destroy the stack itself. */
1946 yyfree((yy_buffer_stack) );
1947 (yy_buffer_stack) = NULL;
1949 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1950 * yylex() is called, initialization will occur. */
1951 yy_init_globals( );
1953 return 0;
1957 * Internal utility routines.
1960 #ifndef yytext_ptr
1961 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1963 register int i;
1964 for ( i = 0; i < n; ++i )
1965 s1[i] = s2[i];
1967 #endif
1969 #ifdef YY_NEED_STRLEN
1970 static int yy_flex_strlen (yyconst char * s )
1972 register int n;
1973 for ( n = 0; s[n]; ++n )
1976 return n;
1978 #endif
1980 void *yyalloc (yy_size_t size )
1982 return (void *) malloc( size );
1985 void *yyrealloc (void * ptr, yy_size_t size )
1987 /* The cast to (char *) in the following accommodates both
1988 * implementations that use char* generic pointers, and those
1989 * that use void* generic pointers. It works with the latter
1990 * because both ANSI C and C++ allow castless assignment from
1991 * any pointer type to void*, and deal with argument conversions
1992 * as though doing an assignment.
1994 return (void *) realloc( (char *) ptr, size );
1997 void yyfree (void * ptr )
1999 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2002 #define YYTABLES_NAME "yytables"
2004 #line 164 "./Scanner.l"
2008 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize)
2010 wxASSERT( _pszLexBuff != NULL );
2012 if (_pszLexBuff == NULL) {
2013 YY_FATAL_ERROR("Input in flex scanner failed");
2016 wxASSERT( sizeof(YY_CHAR) == sizeof(char) );
2017 size_t uCharsInBuff = strlen(_pszLexBuff);
2018 size_t uCharsRead = min(uMaxSize, uCharsInBuff);
2019 riResult = uCharsRead;
2020 memcpy(pcBuff, _pszLexBuff, uCharsRead);
2021 _pszLexBuff += uCharsRead;
2024 static void FatalLexError(yyconst char msg[])
2026 #ifdef _CONSOLE
2027 printf("Fatal error in flex scanner: %s\n", msg);
2028 #else
2029 printf("Fatal error in flex scanner: %s\n", msg);
2030 #endif
2033 void LexInit(const wxString& pszInput)
2035 _pszLexStr = strdup(unicode2UTF8(pszInput));
2036 _pszLexBuff = _pszLexStr;
2039 void LexFree()
2041 yylex_destroy();
2043 yyleng = 0;
2044 yytext = NULL;
2045 yyin = NULL;
2046 yyout = NULL;
2047 yy_hold_char = '\0';
2048 yy_n_chars = 0;
2049 yy_c_buf_p = NULL;
2050 yy_start = 0;
2051 yy_did_buffer_switch_on_eof = 0;
2052 yy_last_accepting_state = 0;
2053 yy_last_accepting_cpos = NULL;
2055 #if YY_STACK_USED
2056 yy_start_stack_ptr = 0;
2057 yy_start_stack_depth = 0;
2058 yy_start_stack = NULL;
2059 #endif
2061 free(_pszLexStr);