Upstream tarball 20080414
[amule.git] / src / Scanner.cpp
blob39430a4d5ba942770be0b2179f13121036819498
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 33
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 __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 #if __STDC__
99 #define YY_USE_CONST
101 #endif /* __STDC__ */
102 #endif /* ! __cplusplus */
104 #ifdef YY_USE_CONST
105 #define yyconst const
106 #else
107 #define yyconst
108 #endif
110 /* Returned upon end-of-file. */
111 #define YY_NULL 0
113 /* Promotes a possibly negative, possibly signed char to an unsigned
114 * integer for use as an array index. If the signed char is negative,
115 * we want to instead treat it as an 8-bit unsigned char, hence the
116 * double cast.
118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120 /* Enter a start condition. This macro really ought to take a parameter,
121 * but we do it the disgusting crufty way forced on us by the ()-less
122 * definition of BEGIN.
124 #define BEGIN (yy_start) = 1 + 2 *
126 /* Translate the current start state into a value that can be later handed
127 * to BEGIN to return to the state. The YYSTATE alias is for lex
128 * compatibility.
130 #define YY_START (((yy_start) - 1) / 2)
131 #define YYSTATE YY_START
133 /* Action number for EOF rule of a given start state. */
134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
136 /* Special action meaning "start processing a new file". */
137 #define YY_NEW_FILE yyrestart(yyin )
139 #define YY_END_OF_BUFFER_CHAR 0
141 /* Size of default input buffer. */
142 #ifndef YY_BUF_SIZE
143 #define YY_BUF_SIZE 16384
144 #endif
146 /* The state buf must be large enough to hold one state per character in the main buffer.
148 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
151 #define YY_TYPEDEF_YY_BUFFER_STATE
152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
153 #endif
155 extern int yyleng;
157 extern FILE *yyin, *yyout;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 #define YY_LESS_LINENO(n)
165 /* Return all but the first "n" matched characters back to the input stream. */
166 #define yyless(n) \
167 do \
169 /* Undo effects of setting up yytext. */ \
170 int yyless_macro_arg = (n); \
171 YY_LESS_LINENO(yyless_macro_arg);\
172 *yy_cp = (yy_hold_char); \
173 YY_RESTORE_YY_MORE_OFFSET \
174 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
175 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
177 while ( 0 )
179 #define unput(c) yyunput( c, (yytext_ptr) )
181 /* The following is because we cannot portably get our hands on size_t
182 * (without autoconf's help, which isn't available because we want
183 * flex-generated scanners to compile on their own).
186 #ifndef YY_TYPEDEF_YY_SIZE_T
187 #define YY_TYPEDEF_YY_SIZE_T
188 typedef unsigned int yy_size_t;
189 #endif
191 #ifndef YY_STRUCT_YY_BUFFER_STATE
192 #define YY_STRUCT_YY_BUFFER_STATE
193 struct yy_buffer_state
195 FILE *yy_input_file;
197 char *yy_ch_buf; /* input buffer */
198 char *yy_buf_pos; /* current position in input buffer */
200 /* Size of input buffer in bytes, not including room for EOB
201 * characters.
203 yy_size_t yy_buf_size;
205 /* Number of characters read into yy_ch_buf, not including EOB
206 * characters.
208 int yy_n_chars;
210 /* Whether we "own" the buffer - i.e., we know we created it,
211 * and can realloc() it to grow it, and should free() it to
212 * delete it.
214 int yy_is_our_buffer;
216 /* Whether this is an "interactive" input source; if so, and
217 * if we're using stdio for input, then we want to use getc()
218 * instead of fread(), to make sure we stop fetching input after
219 * each newline.
221 int yy_is_interactive;
223 /* Whether we're considered to be at the beginning of a line.
224 * If so, '^' rules will be active on the next match, otherwise
225 * not.
227 int yy_at_bol;
229 int yy_bs_lineno; /**< The line count. */
230 int yy_bs_column; /**< The column count. */
232 /* Whether to try to fill the input buffer when we reach the
233 * end of it.
235 int yy_fill_buffer;
237 int yy_buffer_status;
239 #define YY_BUFFER_NEW 0
240 #define YY_BUFFER_NORMAL 1
241 /* When an EOF's been seen but there's still some text to process
242 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
243 * shouldn't try reading from the input source any more. We might
244 * still have a bunch of tokens to match, though, because of
245 * possible backing-up.
247 * When we actually see the EOF, we change the status to "new"
248 * (via yyrestart()), so that the user can continue scanning by
249 * just pointing yyin at a new input file.
251 #define YY_BUFFER_EOF_PENDING 2
254 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
256 /* Stack of input buffers. */
257 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
258 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
259 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
261 /* We provide macros for accessing buffer states in case in the
262 * future we want to put the buffer states in a more general
263 * "scanner state".
265 * Returns the top of the stack, or NULL.
267 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
268 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
269 : NULL)
271 /* Same as previous macro, but useful when we know that the buffer stack is not
272 * NULL or when we need an lvalue. For internal use only.
274 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
276 /* yy_hold_char holds the character lost when yytext is formed. */
277 static char yy_hold_char;
278 static int yy_n_chars; /* number of characters read into yy_ch_buf */
279 int yyleng;
281 /* Points to current character in buffer. */
282 static char *yy_c_buf_p = (char *) 0;
283 static int yy_init = 0; /* whether we need to initialize */
284 static int yy_start = 0; /* start state number */
286 /* Flag which is used to allow yywrap()'s to do buffer switches
287 * instead of setting up a fresh yyin. A bit of a hack ...
289 static int yy_did_buffer_switch_on_eof;
291 void yyrestart (FILE *input_file );
292 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
293 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
294 void yy_delete_buffer (YY_BUFFER_STATE b );
295 void yy_flush_buffer (YY_BUFFER_STATE b );
296 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
297 void yypop_buffer_state (void );
299 static void yyensure_buffer_stack (void );
300 static void yy_load_buffer_state (void );
301 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
303 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
305 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
306 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
307 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
309 void *yyalloc (yy_size_t );
310 void *yyrealloc (void *,yy_size_t );
311 void yyfree (void * );
313 #define yy_new_buffer yy_create_buffer
315 #define yy_set_interactive(is_interactive) \
317 if ( ! YY_CURRENT_BUFFER ){ \
318 yyensure_buffer_stack (); \
319 YY_CURRENT_BUFFER_LVALUE = \
320 yy_create_buffer(yyin,YY_BUF_SIZE ); \
322 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
325 #define yy_set_bol(at_bol) \
327 if ( ! YY_CURRENT_BUFFER ){\
328 yyensure_buffer_stack (); \
329 YY_CURRENT_BUFFER_LVALUE = \
330 yy_create_buffer(yyin,YY_BUF_SIZE ); \
332 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
335 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
337 /* Begin user sect3 */
339 #define yywrap(n) 1
340 #define YY_SKIP_YYWRAP
342 typedef unsigned char YY_CHAR;
344 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
346 typedef int yy_state_type;
348 extern int yylineno;
350 int yylineno = 1;
352 extern char *yytext;
353 #define yytext_ptr yytext
355 static yy_state_type yy_get_previous_state (void );
356 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
357 static int yy_get_next_buffer (void );
358 static void yy_fatal_error (yyconst char msg[] );
360 /* Done after the current pattern has been matched and before the
361 * corresponding action - sets up yytext.
363 #define YY_DO_BEFORE_ACTION \
364 (yytext_ptr) = yy_bp; \
365 yyleng = (size_t) (yy_cp - yy_bp); \
366 (yy_hold_char) = *yy_cp; \
367 *yy_cp = '\0'; \
368 (yy_c_buf_p) = yy_cp;
370 #define YY_NUM_RULES 9
371 #define YY_END_OF_BUFFER 10
372 /* This struct is not used in this scanner,
373 but its presence is necessary. */
374 struct yy_trans_info
376 flex_int32_t yy_verify;
377 flex_int32_t yy_nxt;
379 static yyconst flex_int16_t yy_accept[57] =
380 { 0,
381 6, 6, 10, 6, 6, 1, 7, 8, 6, 6,
382 6, 6, 6, 6, 6, 2, 6, 3, 4, 6,
383 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
384 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
385 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
386 6, 6, 6, 6, 5, 0
389 static yyconst flex_int32_t yy_ec[256] =
390 { 0,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 3, 1, 4, 1, 1, 1, 1, 1, 5,
395 5, 1, 1, 1, 1, 1, 1, 6, 6, 7,
396 6, 6, 6, 6, 6, 6, 6, 8, 1, 1,
397 1, 1, 1, 1, 9, 6, 6, 10, 6, 6,
398 1, 1, 1, 1, 1, 1, 1, 11, 12, 1,
399 1, 13, 1, 14, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 6, 6, 6, 15,
402 16, 6, 1, 1, 1, 1, 17, 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,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 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, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1
421 static yyconst flex_int32_t yy_meta[18] =
422 { 0,
423 1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1
427 static yyconst flex_int16_t yy_base[58] =
428 { 0,
429 0, 0, 45, 0, 0, 370, 370, 370, 31, 25,
430 23, 20, 0, 24, 17, 0, 19, 0, 0, 8,
431 16, 15, 12, 23, 34, 45, 56, 67, 78, 89,
432 100, 111, 122, 133, 144, 155, 166, 177, 188, 199,
433 210, 221, 232, 243, 254, 265, 276, 287, 298, 309,
434 320, 331, 342, 353, 0, 370, 19
437 static yyconst flex_int16_t yy_def[58] =
438 { 0,
439 56, 1, 56, 57, 57, 56, 56, 56, 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, 57, 57, 57, 57, 57,
443 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
444 57, 57, 57, 57, 57, 0, 56
447 static yyconst flex_int16_t yy_nxt[388] =
448 { 0,
449 4, 5, 6, 7, 8, 4, 4, 4, 9, 4,
450 10, 11, 4, 4, 4, 12, 4, 24, 24, 13,
451 24, 24, 23, 22, 21, 20, 24, 24, 25, 25,
452 19, 25, 25, 18, 17, 16, 15, 25, 25, 26,
453 26, 14, 26, 26, 56, 56, 56, 56, 26, 26,
454 27, 27, 56, 27, 27, 56, 56, 56, 56, 27,
455 27, 28, 28, 56, 28, 28, 56, 56, 56, 56,
456 28, 28, 29, 29, 56, 29, 29, 56, 56, 56,
457 56, 29, 29, 30, 30, 56, 30, 30, 56, 56,
458 56, 56, 30, 30, 31, 31, 56, 31, 31, 56,
460 56, 56, 56, 31, 31, 32, 32, 56, 32, 32,
461 56, 56, 56, 56, 32, 32, 33, 33, 56, 33,
462 33, 56, 56, 56, 56, 33, 33, 34, 34, 56,
463 34, 34, 56, 56, 56, 56, 34, 34, 35, 35,
464 56, 35, 35, 56, 56, 56, 56, 35, 35, 36,
465 36, 56, 36, 36, 56, 56, 56, 56, 36, 36,
466 37, 37, 56, 37, 37, 56, 56, 56, 56, 37,
467 37, 38, 38, 56, 38, 38, 56, 56, 56, 56,
468 38, 38, 39, 39, 56, 39, 39, 56, 56, 56,
469 56, 39, 39, 40, 40, 56, 40, 40, 56, 56,
471 56, 56, 40, 40, 41, 41, 56, 41, 41, 56,
472 56, 56, 56, 41, 41, 42, 42, 56, 42, 42,
473 56, 56, 56, 56, 42, 42, 43, 43, 56, 43,
474 43, 56, 56, 56, 56, 43, 43, 44, 44, 56,
475 44, 44, 56, 56, 56, 56, 44, 44, 45, 45,
476 56, 45, 45, 56, 56, 56, 56, 45, 45, 46,
477 46, 56, 46, 46, 56, 56, 56, 56, 46, 46,
478 47, 47, 56, 47, 47, 56, 56, 56, 56, 47,
479 47, 48, 48, 56, 48, 48, 56, 56, 56, 56,
480 48, 48, 49, 49, 56, 49, 49, 56, 56, 56,
482 56, 49, 49, 50, 50, 56, 50, 50, 56, 56,
483 56, 56, 50, 50, 51, 51, 56, 51, 51, 56,
484 56, 56, 56, 51, 51, 52, 52, 56, 52, 52,
485 56, 56, 56, 56, 52, 52, 53, 53, 56, 53,
486 53, 56, 56, 56, 56, 53, 53, 54, 54, 56,
487 54, 54, 56, 56, 56, 56, 54, 54, 55, 55,
488 56, 55, 55, 56, 56, 56, 56, 55, 55, 3,
489 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
490 56, 56, 56, 56, 56, 56, 56
493 static yyconst flex_int16_t yy_chk[388] =
494 { 0,
495 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
496 1, 1, 1, 1, 1, 1, 1, 23, 23, 57,
497 23, 23, 22, 21, 20, 17, 23, 23, 24, 24,
498 15, 24, 24, 14, 12, 11, 10, 24, 24, 25,
499 25, 9, 25, 25, 3, 0, 0, 0, 25, 25,
500 26, 26, 0, 26, 26, 0, 0, 0, 0, 26,
501 26, 27, 27, 0, 27, 27, 0, 0, 0, 0,
502 27, 27, 28, 28, 0, 28, 28, 0, 0, 0,
503 0, 28, 28, 29, 29, 0, 29, 29, 0, 0,
504 0, 0, 29, 29, 30, 30, 0, 30, 30, 0,
506 0, 0, 0, 30, 30, 31, 31, 0, 31, 31,
507 0, 0, 0, 0, 31, 31, 32, 32, 0, 32,
508 32, 0, 0, 0, 0, 32, 32, 33, 33, 0,
509 33, 33, 0, 0, 0, 0, 33, 33, 34, 34,
510 0, 34, 34, 0, 0, 0, 0, 34, 34, 35,
511 35, 0, 35, 35, 0, 0, 0, 0, 35, 35,
512 36, 36, 0, 36, 36, 0, 0, 0, 0, 36,
513 36, 37, 37, 0, 37, 37, 0, 0, 0, 0,
514 37, 37, 38, 38, 0, 38, 38, 0, 0, 0,
515 0, 38, 38, 39, 39, 0, 39, 39, 0, 0,
517 0, 0, 39, 39, 40, 40, 0, 40, 40, 0,
518 0, 0, 0, 40, 40, 41, 41, 0, 41, 41,
519 0, 0, 0, 0, 41, 41, 42, 42, 0, 42,
520 42, 0, 0, 0, 0, 42, 42, 43, 43, 0,
521 43, 43, 0, 0, 0, 0, 43, 43, 44, 44,
522 0, 44, 44, 0, 0, 0, 0, 44, 44, 45,
523 45, 0, 45, 45, 0, 0, 0, 0, 45, 45,
524 46, 46, 0, 46, 46, 0, 0, 0, 0, 46,
525 46, 47, 47, 0, 47, 47, 0, 0, 0, 0,
526 47, 47, 48, 48, 0, 48, 48, 0, 0, 0,
528 0, 48, 48, 49, 49, 0, 49, 49, 0, 0,
529 0, 0, 49, 49, 50, 50, 0, 50, 50, 0,
530 0, 0, 0, 50, 50, 51, 51, 0, 51, 51,
531 0, 0, 0, 0, 51, 51, 52, 52, 0, 52,
532 52, 0, 0, 0, 0, 52, 52, 53, 53, 0,
533 53, 53, 0, 0, 0, 0, 53, 53, 54, 54,
534 0, 54, 54, 0, 0, 0, 0, 54, 54, 56,
535 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
536 56, 56, 56, 56, 56, 56, 56
539 static yy_state_type yy_last_accepting_state;
540 static char *yy_last_accepting_cpos;
542 extern int yy_flex_debug;
543 int yy_flex_debug = 0;
545 /* The intent behind this definition is that it'll catch
546 * any uses of REJECT which flex missed.
548 #define REJECT reject_used_but_not_detected
549 #define yymore() yymore_used_but_not_detected
550 #define YY_MORE_ADJ 0
551 #define YY_RESTORE_YY_MORE_OFFSET
552 char *yytext;
553 #line 1 "./Scanner.l"
554 #line 2 "./Scanner.l"
555 #include <stdio.h>
556 #include "SearchExpr.h"
557 #include "Parser.hpp"
558 #include "ED2KLink.h"
559 #include <wx/string.h>
561 #include "libs/common/StringFunctions.h"
563 #ifdef _DEBUG
564 #undef THIS_FILE
565 static char THIS_FILE[] = __FILE__;
566 #endif
568 #define YY_NEVER_INTERACTIVE 1
570 extern int yyerror(const char* errstr);
571 extern int yyerror(wxString errstr);
573 #define YY_INPUT ReadLexBuff
574 #define YY_FATAL_ERROR FatalLexError
576 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize);
577 static void FatalLexError(yyconst char msg[]);
579 static char* _pszLexBuff;
580 static char* _pszLexStr;
582 #line 584 "Scanner.cpp"
584 #define INITIAL 0
586 #ifndef YY_NO_UNISTD_H
587 /* Special case for "unistd.h", since it is non-ANSI. We include it way
588 * down here because we want the user's section 1 to have been scanned first.
589 * The user has a chance to override it with an option.
591 #ifndef _MSC_VER
592 #include <unistd.h>
593 #endif
594 #endif
596 #ifndef YY_EXTRA_TYPE
597 #define YY_EXTRA_TYPE void *
598 #endif
600 static int yy_init_globals (void );
602 /* Macros after this point can all be overridden by user definitions in
603 * section 1.
606 #ifndef YY_SKIP_YYWRAP
607 #ifdef __cplusplus
608 extern "C" int yywrap (void );
609 #else
610 extern int yywrap (void );
611 #endif
612 #endif
614 static void yyunput (int c,char *buf_ptr );
616 #ifndef yytext_ptr
617 static void yy_flex_strncpy (char *,yyconst char *,int );
618 #endif
620 #ifdef YY_NEED_STRLEN
621 static int yy_flex_strlen (yyconst char * );
622 #endif
624 #ifndef YY_NO_INPUT
626 #ifdef __cplusplus
627 static int yyinput (void );
628 #else
629 static int input (void );
630 #endif
632 #endif
634 /* Amount of stuff to slurp up with each read. */
635 #ifndef YY_READ_BUF_SIZE
636 #define YY_READ_BUF_SIZE 8192
637 #endif
639 /* Copy whatever the last rule matched to the standard output. */
640 #ifndef ECHO
641 /* This used to be an fputs(), but since the string might contain NUL's,
642 * we now use fwrite().
644 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
645 #endif
647 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
648 * is returned in "result".
650 #ifndef YY_INPUT
651 #define YY_INPUT(buf,result,max_size) \
652 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
654 int c = '*'; \
655 size_t n; \
656 for ( n = 0; n < max_size && \
657 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
658 buf[n] = (char) c; \
659 if ( c == '\n' ) \
660 buf[n++] = (char) c; \
661 if ( c == EOF && ferror( yyin ) ) \
662 YY_FATAL_ERROR( "input in flex scanner failed" ); \
663 result = n; \
665 else \
667 errno=0; \
668 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
670 if( errno != EINTR) \
672 YY_FATAL_ERROR( "input in flex scanner failed" ); \
673 break; \
675 errno=0; \
676 clearerr(yyin); \
681 #endif
683 /* No semi-colon after return; correct usage is to write "yyterminate();" -
684 * we don't want an extra ';' after the "return" because that will cause
685 * some compilers to complain about unreachable statements.
687 #ifndef yyterminate
688 #define yyterminate() return YY_NULL
689 #endif
691 /* Number of entries by which start-condition stack grows. */
692 #ifndef YY_START_STACK_INCR
693 #define YY_START_STACK_INCR 25
694 #endif
696 /* Report a fatal error. */
697 #ifndef YY_FATAL_ERROR
698 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
699 #endif
701 /* end tables serialization structures and prototypes */
703 /* Default declaration of generated scanner - a define so the user can
704 * easily add parameters.
706 #ifndef YY_DECL
707 #define YY_DECL_IS_OURS 1
709 extern int yylex (void);
711 #define YY_DECL int yylex (void)
712 #endif /* !YY_DECL */
714 /* Code executed at the beginning of each rule, after yytext and yyleng
715 * have been set up.
717 #ifndef YY_USER_ACTION
718 #define YY_USER_ACTION
719 #endif
721 /* Code executed at the end of each rule. */
722 #ifndef YY_BREAK
723 #define YY_BREAK break;
724 #endif
726 #define YY_RULE_SETUP \
727 YY_USER_ACTION
729 /** The main scanner function which does all the work.
731 YY_DECL
733 register yy_state_type yy_current_state;
734 register char *yy_cp, *yy_bp;
735 register int yy_act;
737 #line 36 "./Scanner.l"
740 #line 740 "Scanner.cpp"
742 if ( !(yy_init) )
744 (yy_init) = 1;
746 #ifdef YY_USER_INIT
747 YY_USER_INIT;
748 #endif
750 if ( ! (yy_start) )
751 (yy_start) = 1; /* first start state */
753 if ( ! yyin )
754 yyin = stdin;
756 if ( ! yyout )
757 yyout = stdout;
759 if ( ! YY_CURRENT_BUFFER ) {
760 yyensure_buffer_stack ();
761 YY_CURRENT_BUFFER_LVALUE =
762 yy_create_buffer(yyin,YY_BUF_SIZE );
765 yy_load_buffer_state( );
768 while ( 1 ) /* loops until end-of-file is reached */
770 yy_cp = (yy_c_buf_p);
772 /* Support of yytext. */
773 *yy_cp = (yy_hold_char);
775 /* yy_bp points to the position in yy_ch_buf of the start of
776 * the current run.
778 yy_bp = yy_cp;
780 yy_current_state = (yy_start);
781 yy_match:
784 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
785 if ( yy_accept[yy_current_state] )
787 (yy_last_accepting_state) = yy_current_state;
788 (yy_last_accepting_cpos) = yy_cp;
790 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
792 yy_current_state = (int) yy_def[yy_current_state];
793 if ( yy_current_state >= 57 )
794 yy_c = yy_meta[(unsigned int) yy_c];
796 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
797 ++yy_cp;
799 while ( yy_base[yy_current_state] != 370 );
801 yy_find_action:
802 yy_act = yy_accept[yy_current_state];
803 if ( yy_act == 0 )
804 { /* have to back up */
805 yy_cp = (yy_last_accepting_cpos);
806 yy_current_state = (yy_last_accepting_state);
807 yy_act = yy_accept[yy_current_state];
810 YY_DO_BEFORE_ACTION;
812 do_action: /* This label is used only to access EOF actions. */
814 switch ( yy_act )
815 { /* beginning of action switch */
816 case 0: /* must back up */
817 /* undo the effects of YY_DO_BEFORE_ACTION */
818 *yy_cp = (yy_hold_char);
819 yy_cp = (yy_last_accepting_cpos);
820 yy_current_state = (yy_last_accepting_state);
821 goto yy_find_action;
823 case 1:
824 YY_RULE_SETUP
825 #line 38 "./Scanner.l"
826 { /* Skip blanks. */ }
827 YY_BREAK
828 case 2:
829 YY_RULE_SETUP
830 #line 39 "./Scanner.l"
831 { return TOK_OR; }
832 YY_BREAK
833 case 3:
834 YY_RULE_SETUP
835 #line 40 "./Scanner.l"
836 { return TOK_AND; }
837 YY_BREAK
838 case 4:
839 YY_RULE_SETUP
840 #line 41 "./Scanner.l"
841 { return TOK_NOT; }
842 YY_BREAK
843 case 5:
844 YY_RULE_SETUP
845 #line 43 "./Scanner.l"
847 yylval.pstr = new wxString(UTF82unicode(yytext));
848 return TOK_ED2K_LINK;
850 YY_BREAK
851 case 6:
852 /* rule 6 can match eol */
853 YY_RULE_SETUP
854 #line 48 "./Scanner.l"
856 yylval.pstr = new wxString(UTF82unicode(yytext));
857 return TOK_STRING;
859 YY_BREAK
860 case 7:
861 YY_RULE_SETUP
862 #line 53 "./Scanner.l"
864 int l = 128;
865 char* psz = (char*)malloc(l);
866 int i = 0;
867 int c;
868 while ((c = yyinput()) != '\"')
870 if (c == EOF || c == '\n'){
871 unput(c);
872 yyerror(wxT("Search expression error: unterminated string"));
873 break;
875 if (c == '\\'){ /*Escape sequence*/
876 switch (c = yyinput())
878 case '\n':
879 continue;
880 case 't': /*Tab*/
881 c = '\t';
882 break;
883 case 'n': /*Linefeed*/
884 c = '\n';
885 break;
886 case 'f': /*Formfeed*/
887 c = '\f';
888 break;
889 case 'r': /*Carriage return*/
890 c = '\r';
891 break;
892 case '\\': /*Backslash*/
893 c = '\\';
894 break;
895 case '"': /*Double quotation mark*/
896 c = '\"';
897 break;
898 case '\'': /*Single quotation mark*/
899 c = '\'';
900 break;
901 case '?': /*Question mark*/
902 c = '\?';
903 break;
904 case 'v': /*Vertical Tab*/
905 c = '\v';
906 break;
907 case 'a': /*Alert*/
908 c = '\a';
909 break;
910 case 'b': /*Backspace*/
911 c = '\b';
912 break;
913 case 'x': /*Hexadecimal number*/
915 int n, octv;
916 for (n = 1, octv = 0; n <= 3; n++) {
917 if ((c = yyinput()) >= '0' && c <= '9')
918 c -= '0';
919 else if (c >= 'a' && c <= 'f')
920 c = (c - 'a') + 10;
921 else if (c >= 'A' && c <= 'F')
922 c = (c - 'A') + 10;
923 else
924 break;
925 octv = octv * 16 + c;
927 unput(c);
928 if (n == 1)
929 c = 'x';
930 else
931 c = octv;
933 break;
935 } else {
936 if ((unsigned char)c >= 0x80/* && IsDBCSLeadByte(yytext[0]) */){
937 psz[i++] = (unsigned char)c;
938 if (i >= l){
939 psz = (char*)realloc(psz, l += 128);
940 if (psz == NULL){
941 yyerror("Less memory for string");
942 break;
945 c = yyinput();
949 psz[i++] = (unsigned char)c;
950 if (i >= l){
951 psz = (char*)realloc(psz, l += 128);
952 if (psz == NULL){
953 yyerror("Less memory for string");
954 break;
958 psz[i] = '\0';
959 yylval.pstr = new wxString(UTF82unicode(psz));
960 free(psz);
961 return TOK_STRING;
963 YY_BREAK
964 case 8:
965 YY_RULE_SETUP
966 #line 154 "./Scanner.l"
967 { return yytext[0]; }
968 YY_BREAK
969 case 9:
970 YY_RULE_SETUP
971 #line 156 "./Scanner.l"
972 ECHO;
973 YY_BREAK
974 #line 974 "Scanner.cpp"
975 case YY_STATE_EOF(INITIAL):
976 yyterminate();
978 case YY_END_OF_BUFFER:
980 /* Amount of text matched not including the EOB char. */
981 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
983 /* Undo the effects of YY_DO_BEFORE_ACTION. */
984 *yy_cp = (yy_hold_char);
985 YY_RESTORE_YY_MORE_OFFSET
987 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
989 /* We're scanning a new file or input source. It's
990 * possible that this happened because the user
991 * just pointed yyin at a new source and called
992 * yylex(). If so, then we have to assure
993 * consistency between YY_CURRENT_BUFFER and our
994 * globals. Here is the right place to do so, because
995 * this is the first action (other than possibly a
996 * back-up) that will match for the new input source.
998 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
999 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1000 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1003 /* Note that here we test for yy_c_buf_p "<=" to the position
1004 * of the first EOB in the buffer, since yy_c_buf_p will
1005 * already have been incremented past the NUL character
1006 * (since all states make transitions on EOB to the
1007 * end-of-buffer state). Contrast this with the test
1008 * in input().
1010 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1011 { /* This was really a NUL. */
1012 yy_state_type yy_next_state;
1014 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1016 yy_current_state = yy_get_previous_state( );
1018 /* Okay, we're now positioned to make the NUL
1019 * transition. We couldn't have
1020 * yy_get_previous_state() go ahead and do it
1021 * for us because it doesn't know how to deal
1022 * with the possibility of jamming (and we don't
1023 * want to build jamming into it because then it
1024 * will run more slowly).
1027 yy_next_state = yy_try_NUL_trans( yy_current_state );
1029 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1031 if ( yy_next_state )
1033 /* Consume the NUL. */
1034 yy_cp = ++(yy_c_buf_p);
1035 yy_current_state = yy_next_state;
1036 goto yy_match;
1039 else
1041 yy_cp = (yy_c_buf_p);
1042 goto yy_find_action;
1046 else switch ( yy_get_next_buffer( ) )
1048 case EOB_ACT_END_OF_FILE:
1050 (yy_did_buffer_switch_on_eof) = 0;
1052 if ( yywrap( ) )
1054 /* Note: because we've taken care in
1055 * yy_get_next_buffer() to have set up
1056 * yytext, we can now set up
1057 * yy_c_buf_p so that if some total
1058 * hoser (like flex itself) wants to
1059 * call the scanner after we return the
1060 * YY_NULL, it'll still work - another
1061 * YY_NULL will get returned.
1063 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1065 yy_act = YY_STATE_EOF(YY_START);
1066 goto do_action;
1069 else
1071 if ( ! (yy_did_buffer_switch_on_eof) )
1072 YY_NEW_FILE;
1074 break;
1077 case EOB_ACT_CONTINUE_SCAN:
1078 (yy_c_buf_p) =
1079 (yytext_ptr) + yy_amount_of_matched_text;
1081 yy_current_state = yy_get_previous_state( );
1083 yy_cp = (yy_c_buf_p);
1084 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1085 goto yy_match;
1087 case EOB_ACT_LAST_MATCH:
1088 (yy_c_buf_p) =
1089 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1091 yy_current_state = yy_get_previous_state( );
1093 yy_cp = (yy_c_buf_p);
1094 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1095 goto yy_find_action;
1097 break;
1100 default:
1101 YY_FATAL_ERROR(
1102 "fatal flex scanner internal error--no action found" );
1103 } /* end of action switch */
1104 } /* end of scanning one token */
1105 } /* end of yylex */
1107 /* yy_get_next_buffer - try to read in a new buffer
1109 * Returns a code representing an action:
1110 * EOB_ACT_LAST_MATCH -
1111 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1112 * EOB_ACT_END_OF_FILE - end of file
1114 static int yy_get_next_buffer (void)
1116 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1117 register char *source = (yytext_ptr);
1118 register int number_to_move, i;
1119 int ret_val;
1121 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1122 YY_FATAL_ERROR(
1123 "fatal flex scanner internal error--end of buffer missed" );
1125 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1126 { /* Don't try to fill the buffer, so this is an EOF. */
1127 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1129 /* We matched a single character, the EOB, so
1130 * treat this as a final EOF.
1132 return EOB_ACT_END_OF_FILE;
1135 else
1137 /* We matched some text prior to the EOB, first
1138 * process it.
1140 return EOB_ACT_LAST_MATCH;
1144 /* Try to read more data. */
1146 /* First move last chars to start of buffer. */
1147 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1149 for ( i = 0; i < number_to_move; ++i )
1150 *(dest++) = *(source++);
1152 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1153 /* don't do the read, it's not guaranteed to return an EOF,
1154 * just force an EOF
1156 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1158 else
1160 int num_to_read =
1161 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1163 while ( num_to_read <= 0 )
1164 { /* Not enough room in the buffer - grow it. */
1166 /* just a shorter name for the current buffer */
1167 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1169 int yy_c_buf_p_offset =
1170 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1172 if ( b->yy_is_our_buffer )
1174 int new_size = b->yy_buf_size * 2;
1176 if ( new_size <= 0 )
1177 b->yy_buf_size += b->yy_buf_size / 8;
1178 else
1179 b->yy_buf_size *= 2;
1181 b->yy_ch_buf = (char *)
1182 /* Include room in for 2 EOB chars. */
1183 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1185 else
1186 /* Can't grow it, we don't own it. */
1187 b->yy_ch_buf = 0;
1189 if ( ! b->yy_ch_buf )
1190 YY_FATAL_ERROR(
1191 "fatal error - scanner input buffer overflow" );
1193 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1195 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1196 number_to_move - 1;
1200 if ( num_to_read > YY_READ_BUF_SIZE )
1201 num_to_read = YY_READ_BUF_SIZE;
1203 /* Read in more data. */
1204 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1205 (yy_n_chars), num_to_read );
1207 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1210 if ( (yy_n_chars) == 0 )
1212 if ( number_to_move == YY_MORE_ADJ )
1214 ret_val = EOB_ACT_END_OF_FILE;
1215 yyrestart(yyin );
1218 else
1220 ret_val = EOB_ACT_LAST_MATCH;
1221 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1222 YY_BUFFER_EOF_PENDING;
1226 else
1227 ret_val = EOB_ACT_CONTINUE_SCAN;
1229 (yy_n_chars) += number_to_move;
1230 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1231 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1233 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1235 return ret_val;
1238 /* yy_get_previous_state - get the state just before the EOB char was reached */
1240 static yy_state_type yy_get_previous_state (void)
1242 register yy_state_type yy_current_state;
1243 register char *yy_cp;
1245 yy_current_state = (yy_start);
1247 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1249 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1250 if ( yy_accept[yy_current_state] )
1252 (yy_last_accepting_state) = yy_current_state;
1253 (yy_last_accepting_cpos) = yy_cp;
1255 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1257 yy_current_state = (int) yy_def[yy_current_state];
1258 if ( yy_current_state >= 57 )
1259 yy_c = yy_meta[(unsigned int) yy_c];
1261 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1264 return yy_current_state;
1267 /* yy_try_NUL_trans - try to make a transition on the NUL character
1269 * synopsis
1270 * next_state = yy_try_NUL_trans( current_state );
1272 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1274 register int yy_is_jam;
1275 register char *yy_cp = (yy_c_buf_p);
1277 register YY_CHAR yy_c = 1;
1278 if ( yy_accept[yy_current_state] )
1280 (yy_last_accepting_state) = yy_current_state;
1281 (yy_last_accepting_cpos) = yy_cp;
1283 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1285 yy_current_state = (int) yy_def[yy_current_state];
1286 if ( yy_current_state >= 57 )
1287 yy_c = yy_meta[(unsigned int) yy_c];
1289 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1290 yy_is_jam = (yy_current_state == 56);
1292 return yy_is_jam ? 0 : yy_current_state;
1295 static void yyunput (int c, register char * yy_bp )
1297 register char *yy_cp;
1299 yy_cp = (yy_c_buf_p);
1301 /* undo effects of setting up yytext */
1302 *yy_cp = (yy_hold_char);
1304 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1305 { /* need to shift things up to make room */
1306 /* +2 for EOB chars. */
1307 register int number_to_move = (yy_n_chars) + 2;
1308 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1309 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1310 register char *source =
1311 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1313 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1314 *--dest = *--source;
1316 yy_cp += (int) (dest - source);
1317 yy_bp += (int) (dest - source);
1318 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1319 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1321 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1322 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1325 *--yy_cp = (char) c;
1327 (yytext_ptr) = yy_bp;
1328 (yy_hold_char) = *yy_cp;
1329 (yy_c_buf_p) = yy_cp;
1332 #ifndef YY_NO_INPUT
1333 #ifdef __cplusplus
1334 static int yyinput (void)
1335 #else
1336 static int input (void)
1337 #endif
1340 int c;
1342 *(yy_c_buf_p) = (yy_hold_char);
1344 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1346 /* yy_c_buf_p now points to the character we want to return.
1347 * If this occurs *before* the EOB characters, then it's a
1348 * valid NUL; if not, then we've hit the end of the buffer.
1350 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1351 /* This was really a NUL. */
1352 *(yy_c_buf_p) = '\0';
1354 else
1355 { /* need more input */
1356 int offset = (yy_c_buf_p) - (yytext_ptr);
1357 ++(yy_c_buf_p);
1359 switch ( yy_get_next_buffer( ) )
1361 case EOB_ACT_LAST_MATCH:
1362 /* This happens because yy_g_n_b()
1363 * sees that we've accumulated a
1364 * token and flags that we need to
1365 * try matching the token before
1366 * proceeding. But for input(),
1367 * there's no matching to consider.
1368 * So convert the EOB_ACT_LAST_MATCH
1369 * to EOB_ACT_END_OF_FILE.
1372 /* Reset buffer status. */
1373 yyrestart(yyin );
1375 /*FALLTHROUGH*/
1377 case EOB_ACT_END_OF_FILE:
1379 if ( yywrap( ) )
1380 return EOF;
1382 if ( ! (yy_did_buffer_switch_on_eof) )
1383 YY_NEW_FILE;
1384 #ifdef __cplusplus
1385 return yyinput();
1386 #else
1387 return input();
1388 #endif
1391 case EOB_ACT_CONTINUE_SCAN:
1392 (yy_c_buf_p) = (yytext_ptr) + offset;
1393 break;
1398 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1399 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1400 (yy_hold_char) = *++(yy_c_buf_p);
1402 return c;
1404 #endif /* ifndef YY_NO_INPUT */
1406 /** Immediately switch to a different input stream.
1407 * @param input_file A readable stream.
1409 * @note This function does not reset the start condition to @c INITIAL .
1411 void yyrestart (FILE * input_file )
1414 if ( ! YY_CURRENT_BUFFER ){
1415 yyensure_buffer_stack ();
1416 YY_CURRENT_BUFFER_LVALUE =
1417 yy_create_buffer(yyin,YY_BUF_SIZE );
1420 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1421 yy_load_buffer_state( );
1424 /** Switch to a different input buffer.
1425 * @param new_buffer The new input buffer.
1428 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1431 /* TODO. We should be able to replace this entire function body
1432 * with
1433 * yypop_buffer_state();
1434 * yypush_buffer_state(new_buffer);
1436 yyensure_buffer_stack ();
1437 if ( YY_CURRENT_BUFFER == new_buffer )
1438 return;
1440 if ( YY_CURRENT_BUFFER )
1442 /* Flush out information for old buffer. */
1443 *(yy_c_buf_p) = (yy_hold_char);
1444 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1445 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1448 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1449 yy_load_buffer_state( );
1451 /* We don't actually know whether we did this switch during
1452 * EOF (yywrap()) processing, but the only time this flag
1453 * is looked at is after yywrap() is called, so it's safe
1454 * to go ahead and always set it.
1456 (yy_did_buffer_switch_on_eof) = 1;
1459 static void yy_load_buffer_state (void)
1461 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1462 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1463 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1464 (yy_hold_char) = *(yy_c_buf_p);
1467 /** Allocate and initialize an input buffer state.
1468 * @param file A readable stream.
1469 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1471 * @return the allocated buffer state.
1473 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1475 YY_BUFFER_STATE b;
1477 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1478 if ( ! b )
1479 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1481 b->yy_buf_size = size;
1483 /* yy_ch_buf has to be 2 characters longer than the size given because
1484 * we need to put in 2 end-of-buffer characters.
1486 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1487 if ( ! b->yy_ch_buf )
1488 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1490 b->yy_is_our_buffer = 1;
1492 yy_init_buffer(b,file );
1494 return b;
1497 /** Destroy the buffer.
1498 * @param b a buffer created with yy_create_buffer()
1501 void yy_delete_buffer (YY_BUFFER_STATE b )
1504 if ( ! b )
1505 return;
1507 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1508 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1510 if ( b->yy_is_our_buffer )
1511 yyfree((void *) b->yy_ch_buf );
1513 yyfree((void *) b );
1516 #ifndef __cplusplus
1517 extern int isatty (int );
1518 #endif /* __cplusplus */
1520 /* Initializes or reinitializes a buffer.
1521 * This function is sometimes called more than once on the same buffer,
1522 * such as during a yyrestart() or at EOF.
1524 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1527 int oerrno = errno;
1529 yy_flush_buffer(b );
1531 b->yy_input_file = file;
1532 b->yy_fill_buffer = 1;
1534 /* If b is the current buffer, then yy_init_buffer was _probably_
1535 * called from yyrestart() or through yy_get_next_buffer.
1536 * In that case, we don't want to reset the lineno or column.
1538 if (b != YY_CURRENT_BUFFER){
1539 b->yy_bs_lineno = 1;
1540 b->yy_bs_column = 0;
1543 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1545 errno = oerrno;
1548 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1549 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1552 void yy_flush_buffer (YY_BUFFER_STATE b )
1554 if ( ! b )
1555 return;
1557 b->yy_n_chars = 0;
1559 /* We always need two end-of-buffer characters. The first causes
1560 * a transition to the end-of-buffer state. The second causes
1561 * a jam in that state.
1563 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1564 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1566 b->yy_buf_pos = &b->yy_ch_buf[0];
1568 b->yy_at_bol = 1;
1569 b->yy_buffer_status = YY_BUFFER_NEW;
1571 if ( b == YY_CURRENT_BUFFER )
1572 yy_load_buffer_state( );
1575 /** Pushes the new state onto the stack. The new state becomes
1576 * the current state. This function will allocate the stack
1577 * if necessary.
1578 * @param new_buffer The new state.
1581 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1583 if (new_buffer == NULL)
1584 return;
1586 yyensure_buffer_stack();
1588 /* This block is copied from yy_switch_to_buffer. */
1589 if ( YY_CURRENT_BUFFER )
1591 /* Flush out information for old buffer. */
1592 *(yy_c_buf_p) = (yy_hold_char);
1593 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1594 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1597 /* Only push if top exists. Otherwise, replace top. */
1598 if (YY_CURRENT_BUFFER)
1599 (yy_buffer_stack_top)++;
1600 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1602 /* copied from yy_switch_to_buffer. */
1603 yy_load_buffer_state( );
1604 (yy_did_buffer_switch_on_eof) = 1;
1607 /** Removes and deletes the top of the stack, if present.
1608 * The next element becomes the new top.
1611 void yypop_buffer_state (void)
1613 if (!YY_CURRENT_BUFFER)
1614 return;
1616 yy_delete_buffer(YY_CURRENT_BUFFER );
1617 YY_CURRENT_BUFFER_LVALUE = NULL;
1618 if ((yy_buffer_stack_top) > 0)
1619 --(yy_buffer_stack_top);
1621 if (YY_CURRENT_BUFFER) {
1622 yy_load_buffer_state( );
1623 (yy_did_buffer_switch_on_eof) = 1;
1627 /* Allocates the stack if it does not exist.
1628 * Guarantees space for at least one push.
1630 static void yyensure_buffer_stack (void)
1632 int num_to_alloc;
1634 if (!(yy_buffer_stack)) {
1636 /* First allocation is just for 2 elements, since we don't know if this
1637 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1638 * immediate realloc on the next call.
1640 num_to_alloc = 1;
1641 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1642 (num_to_alloc * sizeof(struct yy_buffer_state*)
1645 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1647 (yy_buffer_stack_max) = num_to_alloc;
1648 (yy_buffer_stack_top) = 0;
1649 return;
1652 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1654 /* Increase the buffer to prepare for a possible push. */
1655 int grow_size = 8 /* arbitrary grow size */;
1657 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1658 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1659 ((yy_buffer_stack),
1660 num_to_alloc * sizeof(struct yy_buffer_state*)
1663 /* zero only the new slots.*/
1664 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1665 (yy_buffer_stack_max) = num_to_alloc;
1669 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1670 * @param base the character buffer
1671 * @param size the size in bytes of the character buffer
1673 * @return the newly allocated buffer state object.
1675 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1677 YY_BUFFER_STATE b;
1679 if ( size < 2 ||
1680 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1681 base[size-1] != YY_END_OF_BUFFER_CHAR )
1682 /* They forgot to leave room for the EOB's. */
1683 return 0;
1685 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1686 if ( ! b )
1687 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1689 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1690 b->yy_buf_pos = b->yy_ch_buf = base;
1691 b->yy_is_our_buffer = 0;
1692 b->yy_input_file = 0;
1693 b->yy_n_chars = b->yy_buf_size;
1694 b->yy_is_interactive = 0;
1695 b->yy_at_bol = 1;
1696 b->yy_fill_buffer = 0;
1697 b->yy_buffer_status = YY_BUFFER_NEW;
1699 yy_switch_to_buffer(b );
1701 return b;
1704 /** Setup the input buffer state to scan a string. The next call to yylex() will
1705 * scan from a @e copy of @a str.
1706 * @param str a NUL-terminated string to scan
1708 * @return the newly allocated buffer state object.
1709 * @note If you want to scan bytes that may contain NUL values, then use
1710 * yy_scan_bytes() instead.
1712 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1715 return yy_scan_bytes(yystr,strlen(yystr) );
1718 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1719 * scan from a @e copy of @a bytes.
1720 * @param bytes the byte buffer to scan
1721 * @param len the number of bytes in the buffer pointed to by @a bytes.
1723 * @return the newly allocated buffer state object.
1725 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1727 YY_BUFFER_STATE b;
1728 char *buf;
1729 yy_size_t n;
1730 int i;
1732 /* Get memory for full buffer, including space for trailing EOB's. */
1733 n = _yybytes_len + 2;
1734 buf = (char *) yyalloc(n );
1735 if ( ! buf )
1736 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1738 for ( i = 0; i < _yybytes_len; ++i )
1739 buf[i] = yybytes[i];
1741 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1743 b = yy_scan_buffer(buf,n );
1744 if ( ! b )
1745 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1747 /* It's okay to grow etc. this buffer, and we should throw it
1748 * away when we're done.
1750 b->yy_is_our_buffer = 1;
1752 return b;
1755 #ifndef YY_EXIT_FAILURE
1756 #define YY_EXIT_FAILURE 2
1757 #endif
1759 static void yy_fatal_error (yyconst char* msg )
1761 (void) fprintf( stderr, "%s\n", msg );
1762 exit( YY_EXIT_FAILURE );
1765 /* Redefine yyless() so it works in section 3 code. */
1767 #undef yyless
1768 #define yyless(n) \
1769 do \
1771 /* Undo effects of setting up yytext. */ \
1772 int yyless_macro_arg = (n); \
1773 YY_LESS_LINENO(yyless_macro_arg);\
1774 yytext[yyleng] = (yy_hold_char); \
1775 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1776 (yy_hold_char) = *(yy_c_buf_p); \
1777 *(yy_c_buf_p) = '\0'; \
1778 yyleng = yyless_macro_arg; \
1780 while ( 0 )
1782 /* Accessor methods (get/set functions) to struct members. */
1784 /** Get the current line number.
1787 int yyget_lineno (void)
1790 return yylineno;
1793 /** Get the input stream.
1796 FILE *yyget_in (void)
1798 return yyin;
1801 /** Get the output stream.
1804 FILE *yyget_out (void)
1806 return yyout;
1809 /** Get the length of the current token.
1812 int yyget_leng (void)
1814 return yyleng;
1817 /** Get the current token.
1821 char *yyget_text (void)
1823 return yytext;
1826 /** Set the current line number.
1827 * @param line_number
1830 void yyset_lineno (int line_number )
1833 yylineno = line_number;
1836 /** Set the input stream. This does not discard the current
1837 * input buffer.
1838 * @param in_str A readable stream.
1840 * @see yy_switch_to_buffer
1842 void yyset_in (FILE * in_str )
1844 yyin = in_str ;
1847 void yyset_out (FILE * out_str )
1849 yyout = out_str ;
1852 int yyget_debug (void)
1854 return yy_flex_debug;
1857 void yyset_debug (int bdebug )
1859 yy_flex_debug = bdebug ;
1862 static int yy_init_globals (void)
1864 /* Initialization is the same as for the non-reentrant scanner.
1865 * This function is called from yylex_destroy(), so don't allocate here.
1868 (yy_buffer_stack) = 0;
1869 (yy_buffer_stack_top) = 0;
1870 (yy_buffer_stack_max) = 0;
1871 (yy_c_buf_p) = (char *) 0;
1872 (yy_init) = 0;
1873 (yy_start) = 0;
1875 /* Defined in main.c */
1876 #ifdef YY_STDINIT
1877 yyin = stdin;
1878 yyout = stdout;
1879 #else
1880 yyin = (FILE *) 0;
1881 yyout = (FILE *) 0;
1882 #endif
1884 /* For future reference: Set errno on error, since we are called by
1885 * yylex_init()
1887 return 0;
1890 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1891 int yylex_destroy (void)
1894 /* Pop the buffer stack, destroying each element. */
1895 while(YY_CURRENT_BUFFER){
1896 yy_delete_buffer(YY_CURRENT_BUFFER );
1897 YY_CURRENT_BUFFER_LVALUE = NULL;
1898 yypop_buffer_state();
1901 /* Destroy the stack itself. */
1902 yyfree((yy_buffer_stack) );
1903 (yy_buffer_stack) = NULL;
1905 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1906 * yylex() is called, initialization will occur. */
1907 yy_init_globals( );
1909 return 0;
1913 * Internal utility routines.
1916 #ifndef yytext_ptr
1917 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1919 register int i;
1920 for ( i = 0; i < n; ++i )
1921 s1[i] = s2[i];
1923 #endif
1925 #ifdef YY_NEED_STRLEN
1926 static int yy_flex_strlen (yyconst char * s )
1928 register int n;
1929 for ( n = 0; s[n]; ++n )
1932 return n;
1934 #endif
1936 void *yyalloc (yy_size_t size )
1938 return (void *) malloc( size );
1941 void *yyrealloc (void * ptr, yy_size_t size )
1943 /* The cast to (char *) in the following accommodates both
1944 * implementations that use char* generic pointers, and those
1945 * that use void* generic pointers. It works with the latter
1946 * because both ANSI C and C++ allow castless assignment from
1947 * any pointer type to void*, and deal with argument conversions
1948 * as though doing an assignment.
1950 return (void *) realloc( (char *) ptr, size );
1953 void yyfree (void * ptr )
1955 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1958 #define YYTABLES_NAME "yytables"
1960 #line 156 "./Scanner.l"
1964 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize)
1966 wxASSERT( _pszLexBuff != NULL );
1968 if (_pszLexBuff == NULL) {
1969 YY_FATAL_ERROR("Input in flex scanner failed");
1972 wxASSERT( sizeof(YY_CHAR) == sizeof(char) );
1973 size_t uCharsInBuff = strlen(_pszLexBuff);
1974 size_t uCharsRead = min(uMaxSize, uCharsInBuff);
1975 riResult = uCharsRead;
1976 memcpy(pcBuff, _pszLexBuff, uCharsRead);
1977 _pszLexBuff += uCharsRead;
1980 static void FatalLexError(yyconst char msg[])
1982 #ifdef _CONSOLE
1983 printf("Fatal error in flex scanner: %s\n", msg);
1984 #else
1985 printf("Fatal error in flex scanner: %s\n", msg);
1986 #endif
1989 void LexInit(const wxString& pszInput)
1991 _pszLexStr = strdup(unicode2UTF8(pszInput));
1992 _pszLexBuff = _pszLexStr;
1995 void LexFree()
1997 yylex_destroy();
1999 yyleng = 0;
2000 yytext = NULL;
2001 yyin = NULL;
2002 yyout = NULL;
2003 yy_hold_char = '\0';
2004 yy_n_chars = 0;
2005 yy_c_buf_p = NULL;
2006 yy_start = 0;
2007 yy_did_buffer_switch_on_eof = 0;
2008 yy_last_accepting_state = 0;
2009 yy_last_accepting_cpos = NULL;
2011 #if YY_STACK_USED
2012 yy_start_stack_ptr = 0;
2013 yy_start_stack_depth = 0;
2014 yy_start_stack = NULL;
2015 #endif
2017 free(_pszLexStr);