Don't allow autoconf 2.70, it's known to fail
[amule.git] / src / Scanner.cpp
bloba55e0e15c0a71b6bc9751be3911994200a9e0595
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 39
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;
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
87 #endif /* ! C99 */
89 #endif /* ! FLEXINT_H */
91 #ifdef __cplusplus
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
101 #define YY_USE_CONST
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
118 * double cast.
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 * compatibility.
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
144 #ifndef YY_BUF_SIZE
145 #define YY_BUF_SIZE 16384
146 #endif
148 /* The state buf must be large enough to hold one state per character in the main buffer.
150 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
152 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
153 #define YY_TYPEDEF_YY_BUFFER_STATE
154 typedef struct yy_buffer_state *YY_BUFFER_STATE;
155 #endif
157 #ifndef YY_TYPEDEF_YY_SIZE_T
158 #define YY_TYPEDEF_YY_SIZE_T
159 typedef size_t yy_size_t;
160 #endif
162 extern yy_size_t yyleng;
164 extern FILE *yyin, *yyout;
166 #define EOB_ACT_CONTINUE_SCAN 0
167 #define EOB_ACT_END_OF_FILE 1
168 #define EOB_ACT_LAST_MATCH 2
170 #define YY_LESS_LINENO(n)
171 #define YY_LINENO_REWIND_TO(ptr)
173 /* Return all but the first "n" matched characters back to the input stream. */
174 #define yyless(n) \
175 do \
177 /* Undo effects of setting up yytext. */ \
178 int yyless_macro_arg = (n); \
179 YY_LESS_LINENO(yyless_macro_arg);\
180 *yy_cp = (yy_hold_char); \
181 YY_RESTORE_YY_MORE_OFFSET \
182 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
183 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
185 while ( 0 )
187 #define unput(c) yyunput( c, (yytext_ptr) )
189 #ifndef YY_STRUCT_YY_BUFFER_STATE
190 #define YY_STRUCT_YY_BUFFER_STATE
191 struct yy_buffer_state
193 FILE *yy_input_file;
195 char *yy_ch_buf; /* input buffer */
196 char *yy_buf_pos; /* current position in input buffer */
198 /* Size of input buffer in bytes, not including room for EOB
199 * characters.
201 yy_size_t yy_buf_size;
203 /* Number of characters read into yy_ch_buf, not including EOB
204 * characters.
206 yy_size_t yy_n_chars;
208 /* Whether we "own" the buffer - i.e., we know we created it,
209 * and can realloc() it to grow it, and should free() it to
210 * delete it.
212 int yy_is_our_buffer;
214 /* Whether this is an "interactive" input source; if so, and
215 * if we're using stdio for input, then we want to use getc()
216 * instead of fread(), to make sure we stop fetching input after
217 * each newline.
219 int yy_is_interactive;
221 /* Whether we're considered to be at the beginning of a line.
222 * If so, '^' rules will be active on the next match, otherwise
223 * not.
225 int yy_at_bol;
227 int yy_bs_lineno; /**< The line count. */
228 int yy_bs_column; /**< The column count. */
230 /* Whether to try to fill the input buffer when we reach the
231 * end of it.
233 int yy_fill_buffer;
235 int yy_buffer_status;
237 #define YY_BUFFER_NEW 0
238 #define YY_BUFFER_NORMAL 1
239 /* When an EOF's been seen but there's still some text to process
240 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
241 * shouldn't try reading from the input source any more. We might
242 * still have a bunch of tokens to match, though, because of
243 * possible backing-up.
245 * When we actually see the EOF, we change the status to "new"
246 * (via yyrestart()), so that the user can continue scanning by
247 * just pointing yyin at a new input file.
249 #define YY_BUFFER_EOF_PENDING 2
252 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
254 /* Stack of input buffers. */
255 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
256 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
257 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
259 /* We provide macros for accessing buffer states in case in the
260 * future we want to put the buffer states in a more general
261 * "scanner state".
263 * Returns the top of the stack, or NULL.
265 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
266 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
267 : NULL)
269 /* Same as previous macro, but useful when we know that the buffer stack is not
270 * NULL or when we need an lvalue. For internal use only.
272 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
274 /* yy_hold_char holds the character lost when yytext is formed. */
275 static char yy_hold_char;
276 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
277 yy_size_t yyleng;
279 /* Points to current character in buffer. */
280 static char *yy_c_buf_p = (char *) 0;
281 static int yy_init = 0; /* whether we need to initialize */
282 static int yy_start = 0; /* start state number */
284 /* Flag which is used to allow yywrap()'s to do buffer switches
285 * instead of setting up a fresh yyin. A bit of a hack ...
287 static int yy_did_buffer_switch_on_eof;
289 void yyrestart (FILE *input_file );
290 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
291 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
292 void yy_delete_buffer (YY_BUFFER_STATE b );
293 void yy_flush_buffer (YY_BUFFER_STATE b );
294 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
295 void yypop_buffer_state (void );
297 static void yyensure_buffer_stack (void );
298 static void yy_load_buffer_state (void );
299 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
301 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
303 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
304 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
305 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
307 void *yyalloc (yy_size_t );
308 void *yyrealloc (void *,yy_size_t );
309 void yyfree (void * );
311 #define yy_new_buffer yy_create_buffer
313 #define yy_set_interactive(is_interactive) \
315 if ( ! YY_CURRENT_BUFFER ){ \
316 yyensure_buffer_stack (); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 yy_create_buffer(yyin,YY_BUF_SIZE ); \
320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
323 #define yy_set_bol(at_bol) \
325 if ( ! YY_CURRENT_BUFFER ){\
326 yyensure_buffer_stack (); \
327 YY_CURRENT_BUFFER_LVALUE = \
328 yy_create_buffer(yyin,YY_BUF_SIZE ); \
330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
333 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
335 /* Begin user sect3 */
337 #define yywrap() 1
338 #define YY_SKIP_YYWRAP
340 typedef unsigned char YY_CHAR;
342 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
344 typedef int yy_state_type;
346 extern int yylineno;
348 int yylineno = 1;
350 extern char *yytext;
351 #define yytext_ptr yytext
353 static yy_state_type yy_get_previous_state (void );
354 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
355 static int yy_get_next_buffer (void );
356 static void yy_fatal_error (yyconst char msg[] );
358 /* Done after the current pattern has been matched and before the
359 * corresponding action - sets up yytext.
361 #define YY_DO_BEFORE_ACTION \
362 (yytext_ptr) = yy_bp; \
363 yyleng = (size_t) (yy_cp - yy_bp); \
364 (yy_hold_char) = *yy_cp; \
365 *yy_cp = '\0'; \
366 (yy_c_buf_p) = yy_cp;
368 #define YY_NUM_RULES 9
369 #define YY_END_OF_BUFFER 10
370 /* This struct is not used in this scanner,
371 but its presence is necessary. */
372 struct yy_trans_info
374 flex_int32_t yy_verify;
375 flex_int32_t yy_nxt;
377 static yyconst flex_int16_t yy_accept[57] =
378 { 0,
379 6, 6, 10, 6, 6, 1, 7, 8, 6, 6,
380 6, 6, 6, 6, 6, 2, 6, 3, 4, 6,
381 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
382 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
383 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
384 6, 6, 6, 6, 5, 0
387 static yyconst flex_int32_t yy_ec[256] =
388 { 0,
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 3, 1, 4, 1, 1, 1, 1, 1, 5,
393 5, 1, 1, 1, 1, 1, 1, 6, 6, 7,
394 6, 6, 6, 6, 6, 6, 6, 8, 1, 1,
395 1, 1, 1, 1, 9, 6, 6, 10, 6, 6,
396 1, 1, 1, 1, 1, 1, 1, 11, 12, 1,
397 1, 13, 1, 14, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 6, 6, 6, 15,
400 16, 6, 1, 1, 1, 1, 17, 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,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 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, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1
419 static yyconst flex_int32_t yy_meta[18] =
420 { 0,
421 1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1
425 static yyconst flex_int16_t yy_base[58] =
426 { 0,
427 0, 0, 45, 0, 0, 370, 370, 370, 31, 25,
428 23, 20, 0, 24, 17, 0, 19, 0, 0, 8,
429 16, 15, 12, 23, 34, 45, 56, 67, 78, 89,
430 100, 111, 122, 133, 144, 155, 166, 177, 188, 199,
431 210, 221, 232, 243, 254, 265, 276, 287, 298, 309,
432 320, 331, 342, 353, 0, 370, 19
435 static yyconst flex_int16_t yy_def[58] =
436 { 0,
437 56, 1, 56, 57, 57, 56, 56, 56, 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, 57, 57, 57, 57, 57,
441 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
442 57, 57, 57, 57, 57, 0, 56
445 static yyconst flex_int16_t yy_nxt[388] =
446 { 0,
447 4, 5, 6, 7, 8, 4, 4, 4, 9, 4,
448 10, 11, 4, 4, 4, 12, 4, 24, 24, 13,
449 24, 24, 23, 22, 21, 20, 24, 24, 25, 25,
450 19, 25, 25, 18, 17, 16, 15, 25, 25, 26,
451 26, 14, 26, 26, 56, 56, 56, 56, 26, 26,
452 27, 27, 56, 27, 27, 56, 56, 56, 56, 27,
453 27, 28, 28, 56, 28, 28, 56, 56, 56, 56,
454 28, 28, 29, 29, 56, 29, 29, 56, 56, 56,
455 56, 29, 29, 30, 30, 56, 30, 30, 56, 56,
456 56, 56, 30, 30, 31, 31, 56, 31, 31, 56,
458 56, 56, 56, 31, 31, 32, 32, 56, 32, 32,
459 56, 56, 56, 56, 32, 32, 33, 33, 56, 33,
460 33, 56, 56, 56, 56, 33, 33, 34, 34, 56,
461 34, 34, 56, 56, 56, 56, 34, 34, 35, 35,
462 56, 35, 35, 56, 56, 56, 56, 35, 35, 36,
463 36, 56, 36, 36, 56, 56, 56, 56, 36, 36,
464 37, 37, 56, 37, 37, 56, 56, 56, 56, 37,
465 37, 38, 38, 56, 38, 38, 56, 56, 56, 56,
466 38, 38, 39, 39, 56, 39, 39, 56, 56, 56,
467 56, 39, 39, 40, 40, 56, 40, 40, 56, 56,
469 56, 56, 40, 40, 41, 41, 56, 41, 41, 56,
470 56, 56, 56, 41, 41, 42, 42, 56, 42, 42,
471 56, 56, 56, 56, 42, 42, 43, 43, 56, 43,
472 43, 56, 56, 56, 56, 43, 43, 44, 44, 56,
473 44, 44, 56, 56, 56, 56, 44, 44, 45, 45,
474 56, 45, 45, 56, 56, 56, 56, 45, 45, 46,
475 46, 56, 46, 46, 56, 56, 56, 56, 46, 46,
476 47, 47, 56, 47, 47, 56, 56, 56, 56, 47,
477 47, 48, 48, 56, 48, 48, 56, 56, 56, 56,
478 48, 48, 49, 49, 56, 49, 49, 56, 56, 56,
480 56, 49, 49, 50, 50, 56, 50, 50, 56, 56,
481 56, 56, 50, 50, 51, 51, 56, 51, 51, 56,
482 56, 56, 56, 51, 51, 52, 52, 56, 52, 52,
483 56, 56, 56, 56, 52, 52, 53, 53, 56, 53,
484 53, 56, 56, 56, 56, 53, 53, 54, 54, 56,
485 54, 54, 56, 56, 56, 56, 54, 54, 55, 55,
486 56, 55, 55, 56, 56, 56, 56, 55, 55, 3,
487 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
488 56, 56, 56, 56, 56, 56, 56
491 static yyconst flex_int16_t yy_chk[388] =
492 { 0,
493 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
494 1, 1, 1, 1, 1, 1, 1, 23, 23, 57,
495 23, 23, 22, 21, 20, 17, 23, 23, 24, 24,
496 15, 24, 24, 14, 12, 11, 10, 24, 24, 25,
497 25, 9, 25, 25, 3, 0, 0, 0, 25, 25,
498 26, 26, 0, 26, 26, 0, 0, 0, 0, 26,
499 26, 27, 27, 0, 27, 27, 0, 0, 0, 0,
500 27, 27, 28, 28, 0, 28, 28, 0, 0, 0,
501 0, 28, 28, 29, 29, 0, 29, 29, 0, 0,
502 0, 0, 29, 29, 30, 30, 0, 30, 30, 0,
504 0, 0, 0, 30, 30, 31, 31, 0, 31, 31,
505 0, 0, 0, 0, 31, 31, 32, 32, 0, 32,
506 32, 0, 0, 0, 0, 32, 32, 33, 33, 0,
507 33, 33, 0, 0, 0, 0, 33, 33, 34, 34,
508 0, 34, 34, 0, 0, 0, 0, 34, 34, 35,
509 35, 0, 35, 35, 0, 0, 0, 0, 35, 35,
510 36, 36, 0, 36, 36, 0, 0, 0, 0, 36,
511 36, 37, 37, 0, 37, 37, 0, 0, 0, 0,
512 37, 37, 38, 38, 0, 38, 38, 0, 0, 0,
513 0, 38, 38, 39, 39, 0, 39, 39, 0, 0,
515 0, 0, 39, 39, 40, 40, 0, 40, 40, 0,
516 0, 0, 0, 40, 40, 41, 41, 0, 41, 41,
517 0, 0, 0, 0, 41, 41, 42, 42, 0, 42,
518 42, 0, 0, 0, 0, 42, 42, 43, 43, 0,
519 43, 43, 0, 0, 0, 0, 43, 43, 44, 44,
520 0, 44, 44, 0, 0, 0, 0, 44, 44, 45,
521 45, 0, 45, 45, 0, 0, 0, 0, 45, 45,
522 46, 46, 0, 46, 46, 0, 0, 0, 0, 46,
523 46, 47, 47, 0, 47, 47, 0, 0, 0, 0,
524 47, 47, 48, 48, 0, 48, 48, 0, 0, 0,
526 0, 48, 48, 49, 49, 0, 49, 49, 0, 0,
527 0, 0, 49, 49, 50, 50, 0, 50, 50, 0,
528 0, 0, 0, 50, 50, 51, 51, 0, 51, 51,
529 0, 0, 0, 0, 51, 51, 52, 52, 0, 52,
530 52, 0, 0, 0, 0, 52, 52, 53, 53, 0,
531 53, 53, 0, 0, 0, 0, 53, 53, 54, 54,
532 0, 54, 54, 0, 0, 0, 0, 54, 54, 56,
533 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
534 56, 56, 56, 56, 56, 56, 56
537 static yy_state_type yy_last_accepting_state;
538 static char *yy_last_accepting_cpos;
540 extern int yy_flex_debug;
541 int yy_flex_debug = 0;
543 /* The intent behind this definition is that it'll catch
544 * any uses of REJECT which flex missed.
546 #define REJECT reject_used_but_not_detected
547 #define yymore() yymore_used_but_not_detected
548 #define YY_MORE_ADJ 0
549 #define YY_RESTORE_YY_MORE_OFFSET
550 char *yytext;
551 #line 1 "./Scanner.l"
552 #line 2 "./Scanner.l"
553 #include <stdio.h>
554 #include "SearchExpr.h"
555 #include "Parser.hpp"
556 #include "ED2KLink.h"
557 #include <wx/string.h>
559 #include "libs/common/StringFunctions.h"
561 #ifdef _MSC_VER
562 #define isatty(DUMMY) 0
563 #endif
565 #if defined(_MSC_VER) && (_MSC_VER >= 1800)
566 #include <algorithm> // for std::min and std::max
567 #endif
569 #ifdef _DEBUG
570 #define new DEBUG_NEW
571 #undef THIS_FILE
572 static char THIS_FILE[] = __FILE__;
573 #endif
575 #define YY_NEVER_INTERACTIVE 1
577 extern int yyerror(const char* errstr);
578 extern int yyerror(wxString errstr);
580 #define YY_INPUT ReadLexBuff
581 #define YY_FATAL_ERROR FatalLexError
583 static void ReadLexBuff(char* pcBuff, size_t& riResult, size_t uMaxSize);
584 static void FatalLexError(yyconst char msg[]);
586 static char* _pszLexBuff;
587 static char* _pszLexStr;
589 void LexInit(const wxString& pszInput);
590 void LexFree();
592 #line 593 "Scanner.cpp"
594 #define INITIAL 0
596 #ifndef YY_NO_UNISTD_H
597 /* Special case for "unistd.h", since it is non-ANSI. We include it way
598 * down here because we want the user's section 1 to have been scanned first.
599 * The user has a chance to override it with an option.
601 #include <unistd.h>
602 #endif
604 #ifndef YY_EXTRA_TYPE
605 #define YY_EXTRA_TYPE void *
606 #endif
608 static int yy_init_globals (void );
610 /* Accessor methods to globals.
611 These are made visible to non-reentrant scanners for convenience. */
613 int yylex_destroy (void );
615 int yyget_debug (void );
617 void yyset_debug (int debug_flag );
619 YY_EXTRA_TYPE yyget_extra (void );
621 void yyset_extra (YY_EXTRA_TYPE user_defined );
623 FILE *yyget_in (void );
625 void yyset_in (FILE * in_str );
627 FILE *yyget_out (void );
629 void yyset_out (FILE * out_str );
631 yy_size_t yyget_leng (void );
633 char *yyget_text (void );
635 int yyget_lineno (void );
637 void yyset_lineno (int line_number );
639 /* Macros after this point can all be overridden by user definitions in
640 * section 1.
643 #ifndef YY_SKIP_YYWRAP
644 #ifdef __cplusplus
645 extern "C" int yywrap (void );
646 #else
647 extern int yywrap (void );
648 #endif
649 #endif
651 static void yyunput (int c,char *buf_ptr );
653 #ifndef yytext_ptr
654 static void yy_flex_strncpy (char *,yyconst char *,int );
655 #endif
657 #ifdef YY_NEED_STRLEN
658 static int yy_flex_strlen (yyconst char * );
659 #endif
661 #ifndef YY_NO_INPUT
663 #ifdef __cplusplus
664 static int yyinput (void );
665 #else
666 static int input (void );
667 #endif
669 #endif
671 /* Amount of stuff to slurp up with each read. */
672 #ifndef YY_READ_BUF_SIZE
673 #define YY_READ_BUF_SIZE 8192
674 #endif
676 /* Copy whatever the last rule matched to the standard output. */
677 #ifndef ECHO
678 /* This used to be an fputs(), but since the string might contain NUL's,
679 * we now use fwrite().
681 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
682 #endif
684 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
685 * is returned in "result".
687 #ifndef YY_INPUT
688 #define YY_INPUT(buf,result,max_size) \
689 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
691 int c = '*'; \
692 size_t n; \
693 for ( n = 0; n < max_size && \
694 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
695 buf[n] = (char) c; \
696 if ( c == '\n' ) \
697 buf[n++] = (char) c; \
698 if ( c == EOF && ferror( yyin ) ) \
699 YY_FATAL_ERROR( "input in flex scanner failed" ); \
700 result = n; \
702 else \
704 errno=0; \
705 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
707 if( errno != EINTR) \
709 YY_FATAL_ERROR( "input in flex scanner failed" ); \
710 break; \
712 errno=0; \
713 clearerr(yyin); \
718 #endif
720 /* No semi-colon after return; correct usage is to write "yyterminate();" -
721 * we don't want an extra ';' after the "return" because that will cause
722 * some compilers to complain about unreachable statements.
724 #ifndef yyterminate
725 #define yyterminate() return YY_NULL
726 #endif
728 /* Number of entries by which start-condition stack grows. */
729 #ifndef YY_START_STACK_INCR
730 #define YY_START_STACK_INCR 25
731 #endif
733 /* Report a fatal error. */
734 #ifndef YY_FATAL_ERROR
735 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
736 #endif
738 /* end tables serialization structures and prototypes */
740 /* Default declaration of generated scanner - a define so the user can
741 * easily add parameters.
743 #ifndef YY_DECL
744 #define YY_DECL_IS_OURS 1
746 extern int yylex (void);
748 #define YY_DECL int yylex (void)
749 #endif /* !YY_DECL */
751 /* Code executed at the beginning of each rule, after yytext and yyleng
752 * have been set up.
754 #ifndef YY_USER_ACTION
755 #define YY_USER_ACTION
756 #endif
758 /* Code executed at the end of each rule. */
759 #ifndef YY_BREAK
760 #define YY_BREAK break;
761 #endif
763 #define YY_RULE_SETUP \
764 YY_USER_ACTION
766 /** The main scanner function which does all the work.
768 YY_DECL
770 register yy_state_type yy_current_state;
771 register char *yy_cp, *yy_bp;
772 register int yy_act;
774 if ( !(yy_init) )
776 (yy_init) = 1;
778 #ifdef YY_USER_INIT
779 YY_USER_INIT;
780 #endif
782 if ( ! (yy_start) )
783 (yy_start) = 1; /* first start state */
785 if ( ! yyin )
786 yyin = stdin;
788 if ( ! yyout )
789 yyout = stdout;
791 if ( ! YY_CURRENT_BUFFER ) {
792 yyensure_buffer_stack ();
793 YY_CURRENT_BUFFER_LVALUE =
794 yy_create_buffer(yyin,YY_BUF_SIZE );
797 yy_load_buffer_state( );
801 #line 47 "./Scanner.l"
804 #line 805 "Scanner.cpp"
806 while ( 1 ) /* loops until end-of-file is reached */
808 yy_cp = (yy_c_buf_p);
810 /* Support of yytext. */
811 *yy_cp = (yy_hold_char);
813 /* yy_bp points to the position in yy_ch_buf of the start of
814 * the current run.
816 yy_bp = yy_cp;
818 yy_current_state = (yy_start);
819 yy_match:
822 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
823 if ( yy_accept[yy_current_state] )
825 (yy_last_accepting_state) = yy_current_state;
826 (yy_last_accepting_cpos) = yy_cp;
828 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
830 yy_current_state = (int) yy_def[yy_current_state];
831 if ( yy_current_state >= 57 )
832 yy_c = yy_meta[(unsigned int) yy_c];
834 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
835 ++yy_cp;
837 while ( yy_base[yy_current_state] != 370 );
839 yy_find_action:
840 yy_act = yy_accept[yy_current_state];
841 if ( yy_act == 0 )
842 { /* have to back up */
843 yy_cp = (yy_last_accepting_cpos);
844 yy_current_state = (yy_last_accepting_state);
845 yy_act = yy_accept[yy_current_state];
848 YY_DO_BEFORE_ACTION;
850 do_action: /* This label is used only to access EOF actions. */
852 switch ( yy_act )
853 { /* beginning of action switch */
854 case 0: /* must back up */
855 /* undo the effects of YY_DO_BEFORE_ACTION */
856 *yy_cp = (yy_hold_char);
857 yy_cp = (yy_last_accepting_cpos);
858 yy_current_state = (yy_last_accepting_state);
859 goto yy_find_action;
861 case 1:
862 YY_RULE_SETUP
863 #line 49 "./Scanner.l"
864 { /* Skip blanks. */ }
865 YY_BREAK
866 case 2:
867 YY_RULE_SETUP
868 #line 50 "./Scanner.l"
869 { return TOK_OR; }
870 YY_BREAK
871 case 3:
872 YY_RULE_SETUP
873 #line 51 "./Scanner.l"
874 { return TOK_AND; }
875 YY_BREAK
876 case 4:
877 YY_RULE_SETUP
878 #line 52 "./Scanner.l"
879 { return TOK_NOT; }
880 YY_BREAK
881 case 5:
882 YY_RULE_SETUP
883 #line 54 "./Scanner.l"
885 yylval.pstr = new wxString(UTF82unicode(yytext));
886 return TOK_ED2K_LINK;
888 YY_BREAK
889 case 6:
890 /* rule 6 can match eol */
891 YY_RULE_SETUP
892 #line 59 "./Scanner.l"
894 yylval.pstr = new wxString(UTF82unicode(yytext));
895 return TOK_STRING;
897 YY_BREAK
898 case 7:
899 YY_RULE_SETUP
900 #line 64 "./Scanner.l"
902 int l = 128;
903 char* psz = (char*)malloc(l);
904 int i = 0;
905 int c;
906 while ((c = yyinput()) != '\"')
908 if (c == EOF || c == '\n'){
909 unput(c);
910 yyerror(wxT("Search expression error: unterminated string"));
911 break;
913 if (c == '\\'){ /*Escape sequence*/
914 switch (c = yyinput())
916 case '\n':
917 continue;
918 case 't': /*Tab*/
919 c = '\t';
920 break;
921 case 'n': /*Linefeed*/
922 c = '\n';
923 break;
924 case 'f': /*Formfeed*/
925 c = '\f';
926 break;
927 case 'r': /*Carriage return*/
928 c = '\r';
929 break;
930 case '\\': /*Backslash*/
931 c = '\\';
932 break;
933 case '"': /*Double quotation mark*/
934 c = '\"';
935 break;
936 case '\'': /*Single quotation mark*/
937 c = '\'';
938 break;
939 case '?': /*Question mark*/
940 c = '\?';
941 break;
942 case 'v': /*Vertical Tab*/
943 c = '\v';
944 break;
945 case 'a': /*Alert*/
946 c = '\a';
947 break;
948 case 'b': /*Backspace*/
949 c = '\b';
950 break;
951 case 'x': /*Hexadecimal number*/
953 int n, octv;
954 for (n = 1, octv = 0; n <= 3; n++) {
955 if ((c = yyinput()) >= '0' && c <= '9')
956 c -= '0';
957 else if (c >= 'a' && c <= 'f')
958 c = (c - 'a') + 10;
959 else if (c >= 'A' && c <= 'F')
960 c = (c - 'A') + 10;
961 else
962 break;
963 octv = octv * 16 + c;
965 unput(c);
966 if (n == 1)
967 c = 'x';
968 else
969 c = octv;
971 break;
973 } else {
974 if ((unsigned char)c >= 0x80/* && IsDBCSLeadByte(yytext[0]) */){
975 psz[i++] = (unsigned char)c;
976 if (i >= l) {
977 char *tmp = (char*)realloc(psz, l += 128);
978 if (tmp == NULL){
979 yyerror("Less memory for string");
980 break;
981 } else {
982 psz = tmp;
985 c = yyinput();
989 psz[i++] = (unsigned char)c;
990 if (i >= l) {
991 char *tmp = (char*)realloc(psz, l += 128);
992 if (tmp == NULL){
993 yyerror("Less memory for string");
994 break;
995 } else {
996 psz = tmp;
1000 psz[i] = '\0';
1001 yylval.pstr = new wxString(UTF82unicode(psz));
1002 free(psz);
1003 return TOK_STRING;
1005 YY_BREAK
1006 case 8:
1007 YY_RULE_SETUP
1008 #line 169 "./Scanner.l"
1009 { return yytext[0]; }
1010 YY_BREAK
1011 case 9:
1012 YY_RULE_SETUP
1013 #line 171 "./Scanner.l"
1014 ECHO;
1015 YY_BREAK
1016 #line 1017 "Scanner.cpp"
1017 case YY_STATE_EOF(INITIAL):
1018 yyterminate();
1020 case YY_END_OF_BUFFER:
1022 /* Amount of text matched not including the EOB char. */
1023 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1025 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1026 *yy_cp = (yy_hold_char);
1027 YY_RESTORE_YY_MORE_OFFSET
1029 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1031 /* We're scanning a new file or input source. It's
1032 * possible that this happened because the user
1033 * just pointed yyin at a new source and called
1034 * yylex(). If so, then we have to assure
1035 * consistency between YY_CURRENT_BUFFER and our
1036 * globals. Here is the right place to do so, because
1037 * this is the first action (other than possibly a
1038 * back-up) that will match for the new input source.
1040 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1041 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1042 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1045 /* Note that here we test for yy_c_buf_p "<=" to the position
1046 * of the first EOB in the buffer, since yy_c_buf_p will
1047 * already have been incremented past the NUL character
1048 * (since all states make transitions on EOB to the
1049 * end-of-buffer state). Contrast this with the test
1050 * in input().
1052 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1053 { /* This was really a NUL. */
1054 yy_state_type yy_next_state;
1056 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1058 yy_current_state = yy_get_previous_state( );
1060 /* Okay, we're now positioned to make the NUL
1061 * transition. We couldn't have
1062 * yy_get_previous_state() go ahead and do it
1063 * for us because it doesn't know how to deal
1064 * with the possibility of jamming (and we don't
1065 * want to build jamming into it because then it
1066 * will run more slowly).
1069 yy_next_state = yy_try_NUL_trans( yy_current_state );
1071 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1073 if ( yy_next_state )
1075 /* Consume the NUL. */
1076 yy_cp = ++(yy_c_buf_p);
1077 yy_current_state = yy_next_state;
1078 goto yy_match;
1081 else
1083 yy_cp = (yy_c_buf_p);
1084 goto yy_find_action;
1088 else switch ( yy_get_next_buffer( ) )
1090 case EOB_ACT_END_OF_FILE:
1092 (yy_did_buffer_switch_on_eof) = 0;
1094 if ( yywrap( ) )
1096 /* Note: because we've taken care in
1097 * yy_get_next_buffer() to have set up
1098 * yytext, we can now set up
1099 * yy_c_buf_p so that if some total
1100 * hoser (like flex itself) wants to
1101 * call the scanner after we return the
1102 * YY_NULL, it'll still work - another
1103 * YY_NULL will get returned.
1105 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1107 yy_act = YY_STATE_EOF(YY_START);
1108 goto do_action;
1111 else
1113 if ( ! (yy_did_buffer_switch_on_eof) )
1114 YY_NEW_FILE;
1116 break;
1119 case EOB_ACT_CONTINUE_SCAN:
1120 (yy_c_buf_p) =
1121 (yytext_ptr) + yy_amount_of_matched_text;
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_match;
1129 case EOB_ACT_LAST_MATCH:
1130 (yy_c_buf_p) =
1131 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1133 yy_current_state = yy_get_previous_state( );
1135 yy_cp = (yy_c_buf_p);
1136 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1137 goto yy_find_action;
1139 break;
1142 default:
1143 YY_FATAL_ERROR(
1144 "fatal flex scanner internal error--no action found" );
1145 } /* end of action switch */
1146 } /* end of scanning one token */
1147 } /* end of user's declarations */
1148 } /* end of yylex */
1150 /* yy_get_next_buffer - try to read in a new buffer
1152 * Returns a code representing an action:
1153 * EOB_ACT_LAST_MATCH -
1154 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1155 * EOB_ACT_END_OF_FILE - end of file
1157 static int yy_get_next_buffer (void)
1159 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1160 register char *source = (yytext_ptr);
1161 register int number_to_move, i;
1162 int ret_val;
1164 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1165 YY_FATAL_ERROR(
1166 "fatal flex scanner internal error--end of buffer missed" );
1168 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1169 { /* Don't try to fill the buffer, so this is an EOF. */
1170 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1172 /* We matched a single character, the EOB, so
1173 * treat this as a final EOF.
1175 return EOB_ACT_END_OF_FILE;
1178 else
1180 /* We matched some text prior to the EOB, first
1181 * process it.
1183 return EOB_ACT_LAST_MATCH;
1187 /* Try to read more data. */
1189 /* First move last chars to start of buffer. */
1190 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1192 for ( i = 0; i < number_to_move; ++i )
1193 *(dest++) = *(source++);
1195 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1196 /* don't do the read, it's not guaranteed to return an EOF,
1197 * just force an EOF
1199 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1201 else
1203 yy_size_t num_to_read =
1204 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1206 while ( num_to_read <= 0 )
1207 { /* Not enough room in the buffer - grow it. */
1209 /* just a shorter name for the current buffer */
1210 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1212 int yy_c_buf_p_offset =
1213 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1215 if ( b->yy_is_our_buffer )
1217 yy_size_t new_size = b->yy_buf_size * 2;
1219 if ( new_size <= 0 )
1220 b->yy_buf_size += b->yy_buf_size / 8;
1221 else
1222 b->yy_buf_size *= 2;
1224 b->yy_ch_buf = (char *)
1225 /* Include room in for 2 EOB chars. */
1226 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1228 else
1229 /* Can't grow it, we don't own it. */
1230 b->yy_ch_buf = 0;
1232 if ( ! b->yy_ch_buf )
1233 YY_FATAL_ERROR(
1234 "fatal error - scanner input buffer overflow" );
1236 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1238 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1239 number_to_move - 1;
1243 if ( num_to_read > YY_READ_BUF_SIZE )
1244 num_to_read = YY_READ_BUF_SIZE;
1246 /* Read in more data. */
1247 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1248 (yy_n_chars), num_to_read );
1250 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1253 if ( (yy_n_chars) == 0 )
1255 if ( number_to_move == YY_MORE_ADJ )
1257 ret_val = EOB_ACT_END_OF_FILE;
1258 yyrestart(yyin );
1261 else
1263 ret_val = EOB_ACT_LAST_MATCH;
1264 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1265 YY_BUFFER_EOF_PENDING;
1269 else
1270 ret_val = EOB_ACT_CONTINUE_SCAN;
1272 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1273 /* Extend the array by 50%, plus the number we really need. */
1274 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1275 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1276 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1277 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1280 (yy_n_chars) += number_to_move;
1281 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1282 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1284 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1286 return ret_val;
1289 /* yy_get_previous_state - get the state just before the EOB char was reached */
1291 static yy_state_type yy_get_previous_state (void)
1293 register yy_state_type yy_current_state;
1294 register char *yy_cp;
1296 yy_current_state = (yy_start);
1298 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1300 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1301 if ( yy_accept[yy_current_state] )
1303 (yy_last_accepting_state) = yy_current_state;
1304 (yy_last_accepting_cpos) = yy_cp;
1306 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1308 yy_current_state = (int) yy_def[yy_current_state];
1309 if ( yy_current_state >= 57 )
1310 yy_c = yy_meta[(unsigned int) yy_c];
1312 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1315 return yy_current_state;
1318 /* yy_try_NUL_trans - try to make a transition on the NUL character
1320 * synopsis
1321 * next_state = yy_try_NUL_trans( current_state );
1323 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1325 register int yy_is_jam;
1326 register char *yy_cp = (yy_c_buf_p);
1328 register YY_CHAR yy_c = 1;
1329 if ( yy_accept[yy_current_state] )
1331 (yy_last_accepting_state) = yy_current_state;
1332 (yy_last_accepting_cpos) = yy_cp;
1334 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1336 yy_current_state = (int) yy_def[yy_current_state];
1337 if ( yy_current_state >= 57 )
1338 yy_c = yy_meta[(unsigned int) yy_c];
1340 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1341 yy_is_jam = (yy_current_state == 56);
1343 return yy_is_jam ? 0 : yy_current_state;
1346 static void yyunput (int c, register char * yy_bp )
1348 register char *yy_cp;
1350 yy_cp = (yy_c_buf_p);
1352 /* undo effects of setting up yytext */
1353 *yy_cp = (yy_hold_char);
1355 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1356 { /* need to shift things up to make room */
1357 /* +2 for EOB chars. */
1358 register yy_size_t number_to_move = (yy_n_chars) + 2;
1359 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1360 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1361 register char *source =
1362 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1364 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1365 *--dest = *--source;
1367 yy_cp += (int) (dest - source);
1368 yy_bp += (int) (dest - source);
1369 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1370 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1372 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1373 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1376 *--yy_cp = (char) c;
1378 (yytext_ptr) = yy_bp;
1379 (yy_hold_char) = *yy_cp;
1380 (yy_c_buf_p) = yy_cp;
1383 #ifndef YY_NO_INPUT
1384 #ifdef __cplusplus
1385 static int yyinput (void)
1386 #else
1387 static int input (void)
1388 #endif
1391 int c;
1393 *(yy_c_buf_p) = (yy_hold_char);
1395 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1397 /* yy_c_buf_p now points to the character we want to return.
1398 * If this occurs *before* the EOB characters, then it's a
1399 * valid NUL; if not, then we've hit the end of the buffer.
1401 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1402 /* This was really a NUL. */
1403 *(yy_c_buf_p) = '\0';
1405 else
1406 { /* need more input */
1407 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1408 ++(yy_c_buf_p);
1410 switch ( yy_get_next_buffer( ) )
1412 case EOB_ACT_LAST_MATCH:
1413 /* This happens because yy_g_n_b()
1414 * sees that we've accumulated a
1415 * token and flags that we need to
1416 * try matching the token before
1417 * proceeding. But for input(),
1418 * there's no matching to consider.
1419 * So convert the EOB_ACT_LAST_MATCH
1420 * to EOB_ACT_END_OF_FILE.
1423 /* Reset buffer status. */
1424 yyrestart(yyin );
1426 /*FALLTHROUGH*/
1428 case EOB_ACT_END_OF_FILE:
1430 if ( yywrap( ) )
1431 return EOF;
1433 if ( ! (yy_did_buffer_switch_on_eof) )
1434 YY_NEW_FILE;
1435 #ifdef __cplusplus
1436 return yyinput();
1437 #else
1438 return input();
1439 #endif
1442 case EOB_ACT_CONTINUE_SCAN:
1443 (yy_c_buf_p) = (yytext_ptr) + offset;
1444 break;
1449 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1450 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1451 (yy_hold_char) = *++(yy_c_buf_p);
1453 return c;
1455 #endif /* ifndef YY_NO_INPUT */
1457 /** Immediately switch to a different input stream.
1458 * @param input_file A readable stream.
1460 * @note This function does not reset the start condition to @c INITIAL .
1462 void yyrestart (FILE * input_file )
1465 if ( ! YY_CURRENT_BUFFER ){
1466 yyensure_buffer_stack ();
1467 YY_CURRENT_BUFFER_LVALUE =
1468 yy_create_buffer(yyin,YY_BUF_SIZE );
1471 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1472 yy_load_buffer_state( );
1475 /** Switch to a different input buffer.
1476 * @param new_buffer The new input buffer.
1479 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1482 /* TODO. We should be able to replace this entire function body
1483 * with
1484 * yypop_buffer_state();
1485 * yypush_buffer_state(new_buffer);
1487 yyensure_buffer_stack ();
1488 if ( YY_CURRENT_BUFFER == new_buffer )
1489 return;
1491 if ( YY_CURRENT_BUFFER )
1493 /* Flush out information for old buffer. */
1494 *(yy_c_buf_p) = (yy_hold_char);
1495 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1496 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1499 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1500 yy_load_buffer_state( );
1502 /* We don't actually know whether we did this switch during
1503 * EOF (yywrap()) processing, but the only time this flag
1504 * is looked at is after yywrap() is called, so it's safe
1505 * to go ahead and always set it.
1507 (yy_did_buffer_switch_on_eof) = 1;
1510 static void yy_load_buffer_state (void)
1512 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1513 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1514 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1515 (yy_hold_char) = *(yy_c_buf_p);
1518 /** Allocate and initialize an input buffer state.
1519 * @param file A readable stream.
1520 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1522 * @return the allocated buffer state.
1524 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1526 YY_BUFFER_STATE b;
1528 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1529 if ( ! b )
1530 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1532 b->yy_buf_size = size;
1534 /* yy_ch_buf has to be 2 characters longer than the size given because
1535 * we need to put in 2 end-of-buffer characters.
1537 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1538 if ( ! b->yy_ch_buf )
1539 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1541 b->yy_is_our_buffer = 1;
1543 yy_init_buffer(b,file );
1545 return b;
1548 /** Destroy the buffer.
1549 * @param b a buffer created with yy_create_buffer()
1552 void yy_delete_buffer (YY_BUFFER_STATE b )
1555 if ( ! b )
1556 return;
1558 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1559 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1561 if ( b->yy_is_our_buffer )
1562 yyfree((void *) b->yy_ch_buf );
1564 yyfree((void *) b );
1567 /* Initializes or reinitializes a buffer.
1568 * This function is sometimes called more than once on the same buffer,
1569 * such as during a yyrestart() or at EOF.
1571 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1574 int oerrno = errno;
1576 yy_flush_buffer(b );
1578 b->yy_input_file = file;
1579 b->yy_fill_buffer = 1;
1581 /* If b is the current buffer, then yy_init_buffer was _probably_
1582 * called from yyrestart() or through yy_get_next_buffer.
1583 * In that case, we don't want to reset the lineno or column.
1585 if (b != YY_CURRENT_BUFFER){
1586 b->yy_bs_lineno = 1;
1587 b->yy_bs_column = 0;
1590 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1592 errno = oerrno;
1595 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1596 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1599 void yy_flush_buffer (YY_BUFFER_STATE b )
1601 if ( ! b )
1602 return;
1604 b->yy_n_chars = 0;
1606 /* We always need two end-of-buffer characters. The first causes
1607 * a transition to the end-of-buffer state. The second causes
1608 * a jam in that state.
1610 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1611 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1613 b->yy_buf_pos = &b->yy_ch_buf[0];
1615 b->yy_at_bol = 1;
1616 b->yy_buffer_status = YY_BUFFER_NEW;
1618 if ( b == YY_CURRENT_BUFFER )
1619 yy_load_buffer_state( );
1622 /** Pushes the new state onto the stack. The new state becomes
1623 * the current state. This function will allocate the stack
1624 * if necessary.
1625 * @param new_buffer The new state.
1628 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1630 if (new_buffer == NULL)
1631 return;
1633 yyensure_buffer_stack();
1635 /* This block is copied from yy_switch_to_buffer. */
1636 if ( YY_CURRENT_BUFFER )
1638 /* Flush out information for old buffer. */
1639 *(yy_c_buf_p) = (yy_hold_char);
1640 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1641 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1644 /* Only push if top exists. Otherwise, replace top. */
1645 if (YY_CURRENT_BUFFER)
1646 (yy_buffer_stack_top)++;
1647 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1649 /* copied from yy_switch_to_buffer. */
1650 yy_load_buffer_state( );
1651 (yy_did_buffer_switch_on_eof) = 1;
1654 /** Removes and deletes the top of the stack, if present.
1655 * The next element becomes the new top.
1658 void yypop_buffer_state (void)
1660 if (!YY_CURRENT_BUFFER)
1661 return;
1663 yy_delete_buffer(YY_CURRENT_BUFFER );
1664 YY_CURRENT_BUFFER_LVALUE = NULL;
1665 if ((yy_buffer_stack_top) > 0)
1666 --(yy_buffer_stack_top);
1668 if (YY_CURRENT_BUFFER) {
1669 yy_load_buffer_state( );
1670 (yy_did_buffer_switch_on_eof) = 1;
1674 /* Allocates the stack if it does not exist.
1675 * Guarantees space for at least one push.
1677 static void yyensure_buffer_stack (void)
1679 yy_size_t num_to_alloc;
1681 if (!(yy_buffer_stack)) {
1683 /* First allocation is just for 2 elements, since we don't know if this
1684 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1685 * immediate realloc on the next call.
1687 num_to_alloc = 1;
1688 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1689 (num_to_alloc * sizeof(struct yy_buffer_state*)
1691 if ( ! (yy_buffer_stack) )
1692 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1694 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1696 (yy_buffer_stack_max) = num_to_alloc;
1697 (yy_buffer_stack_top) = 0;
1698 return;
1701 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1703 /* Increase the buffer to prepare for a possible push. */
1704 int grow_size = 8 /* arbitrary grow size */;
1706 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1707 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1708 ((yy_buffer_stack),
1709 num_to_alloc * sizeof(struct yy_buffer_state*)
1711 if ( ! (yy_buffer_stack) )
1712 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1714 /* zero only the new slots.*/
1715 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1716 (yy_buffer_stack_max) = num_to_alloc;
1720 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1721 * @param base the character buffer
1722 * @param size the size in bytes of the character buffer
1724 * @return the newly allocated buffer state object.
1726 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1728 YY_BUFFER_STATE b;
1730 if ( size < 2 ||
1731 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1732 base[size-1] != YY_END_OF_BUFFER_CHAR )
1733 /* They forgot to leave room for the EOB's. */
1734 return 0;
1736 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1737 if ( ! b )
1738 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1740 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1741 b->yy_buf_pos = b->yy_ch_buf = base;
1742 b->yy_is_our_buffer = 0;
1743 b->yy_input_file = 0;
1744 b->yy_n_chars = b->yy_buf_size;
1745 b->yy_is_interactive = 0;
1746 b->yy_at_bol = 1;
1747 b->yy_fill_buffer = 0;
1748 b->yy_buffer_status = YY_BUFFER_NEW;
1750 yy_switch_to_buffer(b );
1752 return b;
1755 /** Setup the input buffer state to scan a string. The next call to yylex() will
1756 * scan from a @e copy of @a str.
1757 * @param yystr a NUL-terminated string to scan
1759 * @return the newly allocated buffer state object.
1760 * @note If you want to scan bytes that may contain NUL values, then use
1761 * yy_scan_bytes() instead.
1763 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1766 return yy_scan_bytes(yystr,strlen(yystr) );
1769 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1770 * scan from a @e copy of @a bytes.
1771 * @param yybytes the byte buffer to scan
1772 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1774 * @return the newly allocated buffer state object.
1776 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
1778 YY_BUFFER_STATE b;
1779 char *buf;
1780 yy_size_t n;
1781 yy_size_t i;
1783 /* Get memory for full buffer, including space for trailing EOB's. */
1784 n = _yybytes_len + 2;
1785 buf = (char *) yyalloc(n );
1786 if ( ! buf )
1787 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1789 for ( i = 0; i < _yybytes_len; ++i )
1790 buf[i] = yybytes[i];
1792 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1794 b = yy_scan_buffer(buf,n );
1795 if ( ! b )
1796 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1798 /* It's okay to grow etc. this buffer, and we should throw it
1799 * away when we're done.
1801 b->yy_is_our_buffer = 1;
1803 return b;
1806 #ifndef YY_EXIT_FAILURE
1807 #define YY_EXIT_FAILURE 2
1808 #endif
1810 static void yy_fatal_error (yyconst char* msg )
1812 (void) fprintf( stderr, "%s\n", msg );
1813 exit( YY_EXIT_FAILURE );
1816 /* Redefine yyless() so it works in section 3 code. */
1818 #undef yyless
1819 #define yyless(n) \
1820 do \
1822 /* Undo effects of setting up yytext. */ \
1823 int yyless_macro_arg = (n); \
1824 YY_LESS_LINENO(yyless_macro_arg);\
1825 yytext[yyleng] = (yy_hold_char); \
1826 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1827 (yy_hold_char) = *(yy_c_buf_p); \
1828 *(yy_c_buf_p) = '\0'; \
1829 yyleng = yyless_macro_arg; \
1831 while ( 0 )
1833 /* Accessor methods (get/set functions) to struct members. */
1835 /** Get the current line number.
1838 int yyget_lineno (void)
1841 return yylineno;
1844 /** Get the input stream.
1847 FILE *yyget_in (void)
1849 return yyin;
1852 /** Get the output stream.
1855 FILE *yyget_out (void)
1857 return yyout;
1860 /** Get the length of the current token.
1863 yy_size_t yyget_leng (void)
1865 return yyleng;
1868 /** Get the current token.
1872 char *yyget_text (void)
1874 return yytext;
1877 /** Set the current line number.
1878 * @param line_number
1881 void yyset_lineno (int line_number )
1884 yylineno = line_number;
1887 /** Set the input stream. This does not discard the current
1888 * input buffer.
1889 * @param in_str A readable stream.
1891 * @see yy_switch_to_buffer
1893 void yyset_in (FILE * in_str )
1895 yyin = in_str ;
1898 void yyset_out (FILE * out_str )
1900 yyout = out_str ;
1903 int yyget_debug (void)
1905 return yy_flex_debug;
1908 void yyset_debug (int bdebug )
1910 yy_flex_debug = bdebug ;
1913 static int yy_init_globals (void)
1915 /* Initialization is the same as for the non-reentrant scanner.
1916 * This function is called from yylex_destroy(), so don't allocate here.
1919 (yy_buffer_stack) = 0;
1920 (yy_buffer_stack_top) = 0;
1921 (yy_buffer_stack_max) = 0;
1922 (yy_c_buf_p) = (char *) 0;
1923 (yy_init) = 0;
1924 (yy_start) = 0;
1926 /* Defined in main.c */
1927 #ifdef YY_STDINIT
1928 yyin = stdin;
1929 yyout = stdout;
1930 #else
1931 yyin = (FILE *) 0;
1932 yyout = (FILE *) 0;
1933 #endif
1935 /* For future reference: Set errno on error, since we are called by
1936 * yylex_init()
1938 return 0;
1941 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1942 int yylex_destroy (void)
1945 /* Pop the buffer stack, destroying each element. */
1946 while(YY_CURRENT_BUFFER){
1947 yy_delete_buffer(YY_CURRENT_BUFFER );
1948 YY_CURRENT_BUFFER_LVALUE = NULL;
1949 yypop_buffer_state();
1952 /* Destroy the stack itself. */
1953 yyfree((yy_buffer_stack) );
1954 (yy_buffer_stack) = NULL;
1956 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1957 * yylex() is called, initialization will occur. */
1958 yy_init_globals( );
1960 return 0;
1964 * Internal utility routines.
1967 #ifndef yytext_ptr
1968 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1970 register int i;
1971 for ( i = 0; i < n; ++i )
1972 s1[i] = s2[i];
1974 #endif
1976 #ifdef YY_NEED_STRLEN
1977 static int yy_flex_strlen (yyconst char * s )
1979 register int n;
1980 for ( n = 0; s[n]; ++n )
1983 return n;
1985 #endif
1987 void *yyalloc (yy_size_t size )
1989 return (void *) malloc( size );
1992 void *yyrealloc (void * ptr, yy_size_t size )
1994 /* The cast to (char *) in the following accommodates both
1995 * implementations that use char* generic pointers, and those
1996 * that use void* generic pointers. It works with the latter
1997 * because both ANSI C and C++ allow castless assignment from
1998 * any pointer type to void*, and deal with argument conversions
1999 * as though doing an assignment.
2001 return (void *) realloc( (char *) ptr, size );
2004 void yyfree (void * ptr )
2006 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2009 #define YYTABLES_NAME "yytables"
2011 #line 171 "./Scanner.l"
2015 static void ReadLexBuff(char* pcBuff, size_t& riResult, size_t uMaxSize)
2017 wxASSERT( _pszLexBuff != NULL );
2019 if (_pszLexBuff == NULL) {
2020 YY_FATAL_ERROR("Input in flex scanner failed");
2023 wxASSERT( sizeof(YY_CHAR) == sizeof(char) );
2024 size_t uCharsInBuff = strlen(_pszLexBuff);
2025 size_t uCharsRead = min(uMaxSize, uCharsInBuff);
2026 riResult = uCharsRead;
2027 memcpy(pcBuff, _pszLexBuff, uCharsRead);
2028 _pszLexBuff += uCharsRead;
2031 static void FatalLexError(yyconst char msg[])
2033 #ifdef _CONSOLE
2034 printf("Fatal error in flex scanner: %s\n", msg);
2035 #else
2036 printf("Fatal error in flex scanner: %s\n", msg);
2037 #endif
2040 void LexInit(const wxString& pszInput)
2042 _pszLexStr = strdup(unicode2UTF8(pszInput));
2043 _pszLexBuff = _pszLexStr;
2046 void LexFree()
2048 yylex_destroy();
2050 yyleng = 0;
2051 yytext = NULL;
2052 yyin = NULL;
2053 yyout = NULL;
2054 yy_hold_char = '\0';
2055 yy_n_chars = 0;
2056 yy_c_buf_p = NULL;
2057 yy_start = 0;
2058 yy_did_buffer_switch_on_eof = 0;
2059 yy_last_accepting_state = 0;
2060 yy_last_accepting_cpos = NULL;
2062 free(_pszLexStr);