Improve speed of category tab title updates
[amule.git] / src / Scanner.cpp
blobcb3a773a44e9767a86dc8b877d59867870069fb5
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 _MSC_VER
564 #define isatty(DUMMY) 0
565 #endif
567 #ifdef _DEBUG
568 #undef THIS_FILE
569 static char THIS_FILE[] = __FILE__;
570 #endif
572 #define YY_NEVER_INTERACTIVE 1
574 extern int yyerror(const char* errstr);
575 extern int yyerror(wxString errstr);
577 #define YY_INPUT ReadLexBuff
578 #define YY_FATAL_ERROR FatalLexError
580 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize);
581 static void FatalLexError(yyconst char msg[]);
583 static char* _pszLexBuff;
584 static char* _pszLexStr;
586 #line 584 "Scanner.cpp"
588 #define INITIAL 0
590 #ifndef YY_NO_UNISTD_H
591 /* Special case for "unistd.h", since it is non-ANSI. We include it way
592 * down here because we want the user's section 1 to have been scanned first.
593 * The user has a chance to override it with an option.
595 #ifndef _MSC_VER
596 #include <unistd.h>
597 #endif
598 #endif
600 #ifndef YY_EXTRA_TYPE
601 #define YY_EXTRA_TYPE void *
602 #endif
604 static int yy_init_globals (void );
606 /* Macros after this point can all be overridden by user definitions in
607 * section 1.
610 #ifndef YY_SKIP_YYWRAP
611 #ifdef __cplusplus
612 extern "C" int yywrap (void );
613 #else
614 extern int yywrap (void );
615 #endif
616 #endif
618 static void yyunput (int c,char *buf_ptr );
620 #ifndef yytext_ptr
621 static void yy_flex_strncpy (char *,yyconst char *,int );
622 #endif
624 #ifdef YY_NEED_STRLEN
625 static int yy_flex_strlen (yyconst char * );
626 #endif
628 #ifndef YY_NO_INPUT
630 #ifdef __cplusplus
631 static int yyinput (void );
632 #else
633 static int input (void );
634 #endif
636 #endif
638 /* Amount of stuff to slurp up with each read. */
639 #ifndef YY_READ_BUF_SIZE
640 #define YY_READ_BUF_SIZE 8192
641 #endif
643 /* Copy whatever the last rule matched to the standard output. */
644 #ifndef ECHO
645 /* This used to be an fputs(), but since the string might contain NUL's,
646 * we now use fwrite().
648 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
649 #endif
651 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
652 * is returned in "result".
654 #ifndef YY_INPUT
655 #define YY_INPUT(buf,result,max_size) \
656 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
658 int c = '*'; \
659 size_t n; \
660 for ( n = 0; n < max_size && \
661 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
662 buf[n] = (char) c; \
663 if ( c == '\n' ) \
664 buf[n++] = (char) c; \
665 if ( c == EOF && ferror( yyin ) ) \
666 YY_FATAL_ERROR( "input in flex scanner failed" ); \
667 result = n; \
669 else \
671 errno=0; \
672 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
674 if( errno != EINTR) \
676 YY_FATAL_ERROR( "input in flex scanner failed" ); \
677 break; \
679 errno=0; \
680 clearerr(yyin); \
685 #endif
687 /* No semi-colon after return; correct usage is to write "yyterminate();" -
688 * we don't want an extra ';' after the "return" because that will cause
689 * some compilers to complain about unreachable statements.
691 #ifndef yyterminate
692 #define yyterminate() return YY_NULL
693 #endif
695 /* Number of entries by which start-condition stack grows. */
696 #ifndef YY_START_STACK_INCR
697 #define YY_START_STACK_INCR 25
698 #endif
700 /* Report a fatal error. */
701 #ifndef YY_FATAL_ERROR
702 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
703 #endif
705 /* end tables serialization structures and prototypes */
707 /* Default declaration of generated scanner - a define so the user can
708 * easily add parameters.
710 #ifndef YY_DECL
711 #define YY_DECL_IS_OURS 1
713 extern int yylex (void);
715 #define YY_DECL int yylex (void)
716 #endif /* !YY_DECL */
718 /* Code executed at the beginning of each rule, after yytext and yyleng
719 * have been set up.
721 #ifndef YY_USER_ACTION
722 #define YY_USER_ACTION
723 #endif
725 /* Code executed at the end of each rule. */
726 #ifndef YY_BREAK
727 #define YY_BREAK break;
728 #endif
730 #define YY_RULE_SETUP \
731 YY_USER_ACTION
733 /** The main scanner function which does all the work.
735 YY_DECL
737 register yy_state_type yy_current_state;
738 register char *yy_cp, *yy_bp;
739 register int yy_act;
741 #line 36 "./Scanner.l"
744 #line 740 "Scanner.cpp"
746 if ( !(yy_init) )
748 (yy_init) = 1;
750 #ifdef YY_USER_INIT
751 YY_USER_INIT;
752 #endif
754 if ( ! (yy_start) )
755 (yy_start) = 1; /* first start state */
757 if ( ! yyin )
758 yyin = stdin;
760 if ( ! yyout )
761 yyout = stdout;
763 if ( ! YY_CURRENT_BUFFER ) {
764 yyensure_buffer_stack ();
765 YY_CURRENT_BUFFER_LVALUE =
766 yy_create_buffer(yyin,YY_BUF_SIZE );
769 yy_load_buffer_state( );
772 while ( 1 ) /* loops until end-of-file is reached */
774 yy_cp = (yy_c_buf_p);
776 /* Support of yytext. */
777 *yy_cp = (yy_hold_char);
779 /* yy_bp points to the position in yy_ch_buf of the start of
780 * the current run.
782 yy_bp = yy_cp;
784 yy_current_state = (yy_start);
785 yy_match:
788 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
789 if ( yy_accept[yy_current_state] )
791 (yy_last_accepting_state) = yy_current_state;
792 (yy_last_accepting_cpos) = yy_cp;
794 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
796 yy_current_state = (int) yy_def[yy_current_state];
797 if ( yy_current_state >= 57 )
798 yy_c = yy_meta[(unsigned int) yy_c];
800 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
801 ++yy_cp;
803 while ( yy_base[yy_current_state] != 370 );
805 yy_find_action:
806 yy_act = yy_accept[yy_current_state];
807 if ( yy_act == 0 )
808 { /* have to back up */
809 yy_cp = (yy_last_accepting_cpos);
810 yy_current_state = (yy_last_accepting_state);
811 yy_act = yy_accept[yy_current_state];
814 YY_DO_BEFORE_ACTION;
816 do_action: /* This label is used only to access EOF actions. */
818 switch ( yy_act )
819 { /* beginning of action switch */
820 case 0: /* must back up */
821 /* undo the effects of YY_DO_BEFORE_ACTION */
822 *yy_cp = (yy_hold_char);
823 yy_cp = (yy_last_accepting_cpos);
824 yy_current_state = (yy_last_accepting_state);
825 goto yy_find_action;
827 case 1:
828 YY_RULE_SETUP
829 #line 38 "./Scanner.l"
830 { /* Skip blanks. */ }
831 YY_BREAK
832 case 2:
833 YY_RULE_SETUP
834 #line 39 "./Scanner.l"
835 { return TOK_OR; }
836 YY_BREAK
837 case 3:
838 YY_RULE_SETUP
839 #line 40 "./Scanner.l"
840 { return TOK_AND; }
841 YY_BREAK
842 case 4:
843 YY_RULE_SETUP
844 #line 41 "./Scanner.l"
845 { return TOK_NOT; }
846 YY_BREAK
847 case 5:
848 YY_RULE_SETUP
849 #line 43 "./Scanner.l"
851 yylval.pstr = new wxString(UTF82unicode(yytext));
852 return TOK_ED2K_LINK;
854 YY_BREAK
855 case 6:
856 /* rule 6 can match eol */
857 YY_RULE_SETUP
858 #line 48 "./Scanner.l"
860 yylval.pstr = new wxString(UTF82unicode(yytext));
861 return TOK_STRING;
863 YY_BREAK
864 case 7:
865 YY_RULE_SETUP
866 #line 53 "./Scanner.l"
868 int l = 128;
869 char* psz = (char*)malloc(l);
870 int i = 0;
871 int c;
872 while ((c = yyinput()) != '\"')
874 if (c == EOF || c == '\n'){
875 unput(c);
876 yyerror(wxT("Search expression error: unterminated string"));
877 break;
879 if (c == '\\'){ /*Escape sequence*/
880 switch (c = yyinput())
882 case '\n':
883 continue;
884 case 't': /*Tab*/
885 c = '\t';
886 break;
887 case 'n': /*Linefeed*/
888 c = '\n';
889 break;
890 case 'f': /*Formfeed*/
891 c = '\f';
892 break;
893 case 'r': /*Carriage return*/
894 c = '\r';
895 break;
896 case '\\': /*Backslash*/
897 c = '\\';
898 break;
899 case '"': /*Double quotation mark*/
900 c = '\"';
901 break;
902 case '\'': /*Single quotation mark*/
903 c = '\'';
904 break;
905 case '?': /*Question mark*/
906 c = '\?';
907 break;
908 case 'v': /*Vertical Tab*/
909 c = '\v';
910 break;
911 case 'a': /*Alert*/
912 c = '\a';
913 break;
914 case 'b': /*Backspace*/
915 c = '\b';
916 break;
917 case 'x': /*Hexadecimal number*/
919 int n, octv;
920 for (n = 1, octv = 0; n <= 3; n++) {
921 if ((c = yyinput()) >= '0' && c <= '9')
922 c -= '0';
923 else if (c >= 'a' && c <= 'f')
924 c = (c - 'a') + 10;
925 else if (c >= 'A' && c <= 'F')
926 c = (c - 'A') + 10;
927 else
928 break;
929 octv = octv * 16 + c;
931 unput(c);
932 if (n == 1)
933 c = 'x';
934 else
935 c = octv;
937 break;
939 } else {
940 if ((unsigned char)c >= 0x80/* && IsDBCSLeadByte(yytext[0]) */){
941 psz[i++] = (unsigned char)c;
942 if (i >= l){
943 psz = (char*)realloc(psz, l += 128);
944 if (psz == NULL){
945 yyerror("Less memory for string");
946 break;
949 c = yyinput();
953 psz[i++] = (unsigned char)c;
954 if (i >= l){
955 psz = (char*)realloc(psz, l += 128);
956 if (psz == NULL){
957 yyerror("Less memory for string");
958 break;
962 psz[i] = '\0';
963 yylval.pstr = new wxString(UTF82unicode(psz));
964 free(psz);
965 return TOK_STRING;
967 YY_BREAK
968 case 8:
969 YY_RULE_SETUP
970 #line 154 "./Scanner.l"
971 { return yytext[0]; }
972 YY_BREAK
973 case 9:
974 YY_RULE_SETUP
975 #line 156 "./Scanner.l"
976 ECHO;
977 YY_BREAK
978 #line 974 "Scanner.cpp"
979 case YY_STATE_EOF(INITIAL):
980 yyterminate();
982 case YY_END_OF_BUFFER:
984 /* Amount of text matched not including the EOB char. */
985 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
987 /* Undo the effects of YY_DO_BEFORE_ACTION. */
988 *yy_cp = (yy_hold_char);
989 YY_RESTORE_YY_MORE_OFFSET
991 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
993 /* We're scanning a new file or input source. It's
994 * possible that this happened because the user
995 * just pointed yyin at a new source and called
996 * yylex(). If so, then we have to assure
997 * consistency between YY_CURRENT_BUFFER and our
998 * globals. Here is the right place to do so, because
999 * this is the first action (other than possibly a
1000 * back-up) that will match for the new input source.
1002 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1003 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1004 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1007 /* Note that here we test for yy_c_buf_p "<=" to the position
1008 * of the first EOB in the buffer, since yy_c_buf_p will
1009 * already have been incremented past the NUL character
1010 * (since all states make transitions on EOB to the
1011 * end-of-buffer state). Contrast this with the test
1012 * in input().
1014 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1015 { /* This was really a NUL. */
1016 yy_state_type yy_next_state;
1018 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1020 yy_current_state = yy_get_previous_state( );
1022 /* Okay, we're now positioned to make the NUL
1023 * transition. We couldn't have
1024 * yy_get_previous_state() go ahead and do it
1025 * for us because it doesn't know how to deal
1026 * with the possibility of jamming (and we don't
1027 * want to build jamming into it because then it
1028 * will run more slowly).
1031 yy_next_state = yy_try_NUL_trans( yy_current_state );
1033 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1035 if ( yy_next_state )
1037 /* Consume the NUL. */
1038 yy_cp = ++(yy_c_buf_p);
1039 yy_current_state = yy_next_state;
1040 goto yy_match;
1043 else
1045 yy_cp = (yy_c_buf_p);
1046 goto yy_find_action;
1050 else switch ( yy_get_next_buffer( ) )
1052 case EOB_ACT_END_OF_FILE:
1054 (yy_did_buffer_switch_on_eof) = 0;
1056 if ( yywrap( ) )
1058 /* Note: because we've taken care in
1059 * yy_get_next_buffer() to have set up
1060 * yytext, we can now set up
1061 * yy_c_buf_p so that if some total
1062 * hoser (like flex itself) wants to
1063 * call the scanner after we return the
1064 * YY_NULL, it'll still work - another
1065 * YY_NULL will get returned.
1067 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1069 yy_act = YY_STATE_EOF(YY_START);
1070 goto do_action;
1073 else
1075 if ( ! (yy_did_buffer_switch_on_eof) )
1076 YY_NEW_FILE;
1078 break;
1081 case EOB_ACT_CONTINUE_SCAN:
1082 (yy_c_buf_p) =
1083 (yytext_ptr) + yy_amount_of_matched_text;
1085 yy_current_state = yy_get_previous_state( );
1087 yy_cp = (yy_c_buf_p);
1088 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1089 goto yy_match;
1091 case EOB_ACT_LAST_MATCH:
1092 (yy_c_buf_p) =
1093 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1095 yy_current_state = yy_get_previous_state( );
1097 yy_cp = (yy_c_buf_p);
1098 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1099 goto yy_find_action;
1101 break;
1104 default:
1105 YY_FATAL_ERROR(
1106 "fatal flex scanner internal error--no action found" );
1107 } /* end of action switch */
1108 } /* end of scanning one token */
1109 } /* end of yylex */
1111 /* yy_get_next_buffer - try to read in a new buffer
1113 * Returns a code representing an action:
1114 * EOB_ACT_LAST_MATCH -
1115 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1116 * EOB_ACT_END_OF_FILE - end of file
1118 static int yy_get_next_buffer (void)
1120 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1121 register char *source = (yytext_ptr);
1122 register int number_to_move, i;
1123 int ret_val;
1125 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1126 YY_FATAL_ERROR(
1127 "fatal flex scanner internal error--end of buffer missed" );
1129 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1130 { /* Don't try to fill the buffer, so this is an EOF. */
1131 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1133 /* We matched a single character, the EOB, so
1134 * treat this as a final EOF.
1136 return EOB_ACT_END_OF_FILE;
1139 else
1141 /* We matched some text prior to the EOB, first
1142 * process it.
1144 return EOB_ACT_LAST_MATCH;
1148 /* Try to read more data. */
1150 /* First move last chars to start of buffer. */
1151 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1153 for ( i = 0; i < number_to_move; ++i )
1154 *(dest++) = *(source++);
1156 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1157 /* don't do the read, it's not guaranteed to return an EOF,
1158 * just force an EOF
1160 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1162 else
1164 int num_to_read =
1165 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1167 while ( num_to_read <= 0 )
1168 { /* Not enough room in the buffer - grow it. */
1170 /* just a shorter name for the current buffer */
1171 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1173 int yy_c_buf_p_offset =
1174 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1176 if ( b->yy_is_our_buffer )
1178 int new_size = b->yy_buf_size * 2;
1180 if ( new_size <= 0 )
1181 b->yy_buf_size += b->yy_buf_size / 8;
1182 else
1183 b->yy_buf_size *= 2;
1185 b->yy_ch_buf = (char *)
1186 /* Include room in for 2 EOB chars. */
1187 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1189 else
1190 /* Can't grow it, we don't own it. */
1191 b->yy_ch_buf = 0;
1193 if ( ! b->yy_ch_buf )
1194 YY_FATAL_ERROR(
1195 "fatal error - scanner input buffer overflow" );
1197 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1199 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1200 number_to_move - 1;
1204 if ( num_to_read > YY_READ_BUF_SIZE )
1205 num_to_read = YY_READ_BUF_SIZE;
1207 /* Read in more data. */
1208 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1209 (yy_n_chars), num_to_read );
1211 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1214 if ( (yy_n_chars) == 0 )
1216 if ( number_to_move == YY_MORE_ADJ )
1218 ret_val = EOB_ACT_END_OF_FILE;
1219 yyrestart(yyin );
1222 else
1224 ret_val = EOB_ACT_LAST_MATCH;
1225 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1226 YY_BUFFER_EOF_PENDING;
1230 else
1231 ret_val = EOB_ACT_CONTINUE_SCAN;
1233 (yy_n_chars) += number_to_move;
1234 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1235 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1237 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1239 return ret_val;
1242 /* yy_get_previous_state - get the state just before the EOB char was reached */
1244 static yy_state_type yy_get_previous_state (void)
1246 register yy_state_type yy_current_state;
1247 register char *yy_cp;
1249 yy_current_state = (yy_start);
1251 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1253 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1254 if ( yy_accept[yy_current_state] )
1256 (yy_last_accepting_state) = yy_current_state;
1257 (yy_last_accepting_cpos) = yy_cp;
1259 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1261 yy_current_state = (int) yy_def[yy_current_state];
1262 if ( yy_current_state >= 57 )
1263 yy_c = yy_meta[(unsigned int) yy_c];
1265 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1268 return yy_current_state;
1271 /* yy_try_NUL_trans - try to make a transition on the NUL character
1273 * synopsis
1274 * next_state = yy_try_NUL_trans( current_state );
1276 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1278 register int yy_is_jam;
1279 register char *yy_cp = (yy_c_buf_p);
1281 register YY_CHAR yy_c = 1;
1282 if ( yy_accept[yy_current_state] )
1284 (yy_last_accepting_state) = yy_current_state;
1285 (yy_last_accepting_cpos) = yy_cp;
1287 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1289 yy_current_state = (int) yy_def[yy_current_state];
1290 if ( yy_current_state >= 57 )
1291 yy_c = yy_meta[(unsigned int) yy_c];
1293 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1294 yy_is_jam = (yy_current_state == 56);
1296 return yy_is_jam ? 0 : yy_current_state;
1299 static void yyunput (int c, register char * yy_bp )
1301 register char *yy_cp;
1303 yy_cp = (yy_c_buf_p);
1305 /* undo effects of setting up yytext */
1306 *yy_cp = (yy_hold_char);
1308 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1309 { /* need to shift things up to make room */
1310 /* +2 for EOB chars. */
1311 register int number_to_move = (yy_n_chars) + 2;
1312 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1313 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1314 register char *source =
1315 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1317 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1318 *--dest = *--source;
1320 yy_cp += (int) (dest - source);
1321 yy_bp += (int) (dest - source);
1322 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1323 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1325 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1326 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1329 *--yy_cp = (char) c;
1331 (yytext_ptr) = yy_bp;
1332 (yy_hold_char) = *yy_cp;
1333 (yy_c_buf_p) = yy_cp;
1336 #ifndef YY_NO_INPUT
1337 #ifdef __cplusplus
1338 static int yyinput (void)
1339 #else
1340 static int input (void)
1341 #endif
1344 int c;
1346 *(yy_c_buf_p) = (yy_hold_char);
1348 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1350 /* yy_c_buf_p now points to the character we want to return.
1351 * If this occurs *before* the EOB characters, then it's a
1352 * valid NUL; if not, then we've hit the end of the buffer.
1354 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1355 /* This was really a NUL. */
1356 *(yy_c_buf_p) = '\0';
1358 else
1359 { /* need more input */
1360 int offset = (yy_c_buf_p) - (yytext_ptr);
1361 ++(yy_c_buf_p);
1363 switch ( yy_get_next_buffer( ) )
1365 case EOB_ACT_LAST_MATCH:
1366 /* This happens because yy_g_n_b()
1367 * sees that we've accumulated a
1368 * token and flags that we need to
1369 * try matching the token before
1370 * proceeding. But for input(),
1371 * there's no matching to consider.
1372 * So convert the EOB_ACT_LAST_MATCH
1373 * to EOB_ACT_END_OF_FILE.
1376 /* Reset buffer status. */
1377 yyrestart(yyin );
1379 /*FALLTHROUGH*/
1381 case EOB_ACT_END_OF_FILE:
1383 if ( yywrap( ) )
1384 return EOF;
1386 if ( ! (yy_did_buffer_switch_on_eof) )
1387 YY_NEW_FILE;
1388 #ifdef __cplusplus
1389 return yyinput();
1390 #else
1391 return input();
1392 #endif
1395 case EOB_ACT_CONTINUE_SCAN:
1396 (yy_c_buf_p) = (yytext_ptr) + offset;
1397 break;
1402 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1403 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1404 (yy_hold_char) = *++(yy_c_buf_p);
1406 return c;
1408 #endif /* ifndef YY_NO_INPUT */
1410 /** Immediately switch to a different input stream.
1411 * @param input_file A readable stream.
1413 * @note This function does not reset the start condition to @c INITIAL .
1415 void yyrestart (FILE * input_file )
1418 if ( ! YY_CURRENT_BUFFER ){
1419 yyensure_buffer_stack ();
1420 YY_CURRENT_BUFFER_LVALUE =
1421 yy_create_buffer(yyin,YY_BUF_SIZE );
1424 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1425 yy_load_buffer_state( );
1428 /** Switch to a different input buffer.
1429 * @param new_buffer The new input buffer.
1432 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1435 /* TODO. We should be able to replace this entire function body
1436 * with
1437 * yypop_buffer_state();
1438 * yypush_buffer_state(new_buffer);
1440 yyensure_buffer_stack ();
1441 if ( YY_CURRENT_BUFFER == new_buffer )
1442 return;
1444 if ( YY_CURRENT_BUFFER )
1446 /* Flush out information for old buffer. */
1447 *(yy_c_buf_p) = (yy_hold_char);
1448 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1449 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1452 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1453 yy_load_buffer_state( );
1455 /* We don't actually know whether we did this switch during
1456 * EOF (yywrap()) processing, but the only time this flag
1457 * is looked at is after yywrap() is called, so it's safe
1458 * to go ahead and always set it.
1460 (yy_did_buffer_switch_on_eof) = 1;
1463 static void yy_load_buffer_state (void)
1465 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1466 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1467 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1468 (yy_hold_char) = *(yy_c_buf_p);
1471 /** Allocate and initialize an input buffer state.
1472 * @param file A readable stream.
1473 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1475 * @return the allocated buffer state.
1477 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1479 YY_BUFFER_STATE b;
1481 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1482 if ( ! b )
1483 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1485 b->yy_buf_size = size;
1487 /* yy_ch_buf has to be 2 characters longer than the size given because
1488 * we need to put in 2 end-of-buffer characters.
1490 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1491 if ( ! b->yy_ch_buf )
1492 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1494 b->yy_is_our_buffer = 1;
1496 yy_init_buffer(b,file );
1498 return b;
1501 /** Destroy the buffer.
1502 * @param b a buffer created with yy_create_buffer()
1505 void yy_delete_buffer (YY_BUFFER_STATE b )
1508 if ( ! b )
1509 return;
1511 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1512 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1514 if ( b->yy_is_our_buffer )
1515 yyfree((void *) b->yy_ch_buf );
1517 yyfree((void *) b );
1520 #ifndef __cplusplus
1521 extern int isatty (int );
1522 #endif /* __cplusplus */
1524 /* Initializes or reinitializes a buffer.
1525 * This function is sometimes called more than once on the same buffer,
1526 * such as during a yyrestart() or at EOF.
1528 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1531 int oerrno = errno;
1533 yy_flush_buffer(b );
1535 b->yy_input_file = file;
1536 b->yy_fill_buffer = 1;
1538 /* If b is the current buffer, then yy_init_buffer was _probably_
1539 * called from yyrestart() or through yy_get_next_buffer.
1540 * In that case, we don't want to reset the lineno or column.
1542 if (b != YY_CURRENT_BUFFER){
1543 b->yy_bs_lineno = 1;
1544 b->yy_bs_column = 0;
1547 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1549 errno = oerrno;
1552 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1553 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1556 void yy_flush_buffer (YY_BUFFER_STATE b )
1558 if ( ! b )
1559 return;
1561 b->yy_n_chars = 0;
1563 /* We always need two end-of-buffer characters. The first causes
1564 * a transition to the end-of-buffer state. The second causes
1565 * a jam in that state.
1567 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1568 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1570 b->yy_buf_pos = &b->yy_ch_buf[0];
1572 b->yy_at_bol = 1;
1573 b->yy_buffer_status = YY_BUFFER_NEW;
1575 if ( b == YY_CURRENT_BUFFER )
1576 yy_load_buffer_state( );
1579 /** Pushes the new state onto the stack. The new state becomes
1580 * the current state. This function will allocate the stack
1581 * if necessary.
1582 * @param new_buffer The new state.
1585 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1587 if (new_buffer == NULL)
1588 return;
1590 yyensure_buffer_stack();
1592 /* This block is copied from yy_switch_to_buffer. */
1593 if ( YY_CURRENT_BUFFER )
1595 /* Flush out information for old buffer. */
1596 *(yy_c_buf_p) = (yy_hold_char);
1597 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1598 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1601 /* Only push if top exists. Otherwise, replace top. */
1602 if (YY_CURRENT_BUFFER)
1603 (yy_buffer_stack_top)++;
1604 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1606 /* copied from yy_switch_to_buffer. */
1607 yy_load_buffer_state( );
1608 (yy_did_buffer_switch_on_eof) = 1;
1611 /** Removes and deletes the top of the stack, if present.
1612 * The next element becomes the new top.
1615 void yypop_buffer_state (void)
1617 if (!YY_CURRENT_BUFFER)
1618 return;
1620 yy_delete_buffer(YY_CURRENT_BUFFER );
1621 YY_CURRENT_BUFFER_LVALUE = NULL;
1622 if ((yy_buffer_stack_top) > 0)
1623 --(yy_buffer_stack_top);
1625 if (YY_CURRENT_BUFFER) {
1626 yy_load_buffer_state( );
1627 (yy_did_buffer_switch_on_eof) = 1;
1631 /* Allocates the stack if it does not exist.
1632 * Guarantees space for at least one push.
1634 static void yyensure_buffer_stack (void)
1636 int num_to_alloc;
1638 if (!(yy_buffer_stack)) {
1640 /* First allocation is just for 2 elements, since we don't know if this
1641 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1642 * immediate realloc on the next call.
1644 num_to_alloc = 1;
1645 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1646 (num_to_alloc * sizeof(struct yy_buffer_state*)
1649 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1651 (yy_buffer_stack_max) = num_to_alloc;
1652 (yy_buffer_stack_top) = 0;
1653 return;
1656 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1658 /* Increase the buffer to prepare for a possible push. */
1659 int grow_size = 8 /* arbitrary grow size */;
1661 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1662 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1663 ((yy_buffer_stack),
1664 num_to_alloc * sizeof(struct yy_buffer_state*)
1667 /* zero only the new slots.*/
1668 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1669 (yy_buffer_stack_max) = num_to_alloc;
1673 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1674 * @param base the character buffer
1675 * @param size the size in bytes of the character buffer
1677 * @return the newly allocated buffer state object.
1679 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1681 YY_BUFFER_STATE b;
1683 if ( size < 2 ||
1684 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1685 base[size-1] != YY_END_OF_BUFFER_CHAR )
1686 /* They forgot to leave room for the EOB's. */
1687 return 0;
1689 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1690 if ( ! b )
1691 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1693 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1694 b->yy_buf_pos = b->yy_ch_buf = base;
1695 b->yy_is_our_buffer = 0;
1696 b->yy_input_file = 0;
1697 b->yy_n_chars = b->yy_buf_size;
1698 b->yy_is_interactive = 0;
1699 b->yy_at_bol = 1;
1700 b->yy_fill_buffer = 0;
1701 b->yy_buffer_status = YY_BUFFER_NEW;
1703 yy_switch_to_buffer(b );
1705 return b;
1708 /** Setup the input buffer state to scan a string. The next call to yylex() will
1709 * scan from a @e copy of @a str.
1710 * @param str a NUL-terminated string to scan
1712 * @return the newly allocated buffer state object.
1713 * @note If you want to scan bytes that may contain NUL values, then use
1714 * yy_scan_bytes() instead.
1716 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1719 return yy_scan_bytes(yystr,strlen(yystr) );
1722 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1723 * scan from a @e copy of @a bytes.
1724 * @param bytes the byte buffer to scan
1725 * @param len the number of bytes in the buffer pointed to by @a bytes.
1727 * @return the newly allocated buffer state object.
1729 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1731 YY_BUFFER_STATE b;
1732 char *buf;
1733 yy_size_t n;
1734 int i;
1736 /* Get memory for full buffer, including space for trailing EOB's. */
1737 n = _yybytes_len + 2;
1738 buf = (char *) yyalloc(n );
1739 if ( ! buf )
1740 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1742 for ( i = 0; i < _yybytes_len; ++i )
1743 buf[i] = yybytes[i];
1745 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1747 b = yy_scan_buffer(buf,n );
1748 if ( ! b )
1749 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1751 /* It's okay to grow etc. this buffer, and we should throw it
1752 * away when we're done.
1754 b->yy_is_our_buffer = 1;
1756 return b;
1759 #ifndef YY_EXIT_FAILURE
1760 #define YY_EXIT_FAILURE 2
1761 #endif
1763 static void yy_fatal_error (yyconst char* msg )
1765 (void) fprintf( stderr, "%s\n", msg );
1766 exit( YY_EXIT_FAILURE );
1769 /* Redefine yyless() so it works in section 3 code. */
1771 #undef yyless
1772 #define yyless(n) \
1773 do \
1775 /* Undo effects of setting up yytext. */ \
1776 int yyless_macro_arg = (n); \
1777 YY_LESS_LINENO(yyless_macro_arg);\
1778 yytext[yyleng] = (yy_hold_char); \
1779 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1780 (yy_hold_char) = *(yy_c_buf_p); \
1781 *(yy_c_buf_p) = '\0'; \
1782 yyleng = yyless_macro_arg; \
1784 while ( 0 )
1786 /* Accessor methods (get/set functions) to struct members. */
1788 /** Get the current line number.
1791 int yyget_lineno (void)
1794 return yylineno;
1797 /** Get the input stream.
1800 FILE *yyget_in (void)
1802 return yyin;
1805 /** Get the output stream.
1808 FILE *yyget_out (void)
1810 return yyout;
1813 /** Get the length of the current token.
1816 int yyget_leng (void)
1818 return yyleng;
1821 /** Get the current token.
1825 char *yyget_text (void)
1827 return yytext;
1830 /** Set the current line number.
1831 * @param line_number
1834 void yyset_lineno (int line_number )
1837 yylineno = line_number;
1840 /** Set the input stream. This does not discard the current
1841 * input buffer.
1842 * @param in_str A readable stream.
1844 * @see yy_switch_to_buffer
1846 void yyset_in (FILE * in_str )
1848 yyin = in_str ;
1851 void yyset_out (FILE * out_str )
1853 yyout = out_str ;
1856 int yyget_debug (void)
1858 return yy_flex_debug;
1861 void yyset_debug (int bdebug )
1863 yy_flex_debug = bdebug ;
1866 static int yy_init_globals (void)
1868 /* Initialization is the same as for the non-reentrant scanner.
1869 * This function is called from yylex_destroy(), so don't allocate here.
1872 (yy_buffer_stack) = 0;
1873 (yy_buffer_stack_top) = 0;
1874 (yy_buffer_stack_max) = 0;
1875 (yy_c_buf_p) = (char *) 0;
1876 (yy_init) = 0;
1877 (yy_start) = 0;
1879 /* Defined in main.c */
1880 #ifdef YY_STDINIT
1881 yyin = stdin;
1882 yyout = stdout;
1883 #else
1884 yyin = (FILE *) 0;
1885 yyout = (FILE *) 0;
1886 #endif
1888 /* For future reference: Set errno on error, since we are called by
1889 * yylex_init()
1891 return 0;
1894 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1895 int yylex_destroy (void)
1898 /* Pop the buffer stack, destroying each element. */
1899 while(YY_CURRENT_BUFFER){
1900 yy_delete_buffer(YY_CURRENT_BUFFER );
1901 YY_CURRENT_BUFFER_LVALUE = NULL;
1902 yypop_buffer_state();
1905 /* Destroy the stack itself. */
1906 yyfree((yy_buffer_stack) );
1907 (yy_buffer_stack) = NULL;
1909 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1910 * yylex() is called, initialization will occur. */
1911 yy_init_globals( );
1913 return 0;
1917 * Internal utility routines.
1920 #ifndef yytext_ptr
1921 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1923 register int i;
1924 for ( i = 0; i < n; ++i )
1925 s1[i] = s2[i];
1927 #endif
1929 #ifdef YY_NEED_STRLEN
1930 static int yy_flex_strlen (yyconst char * s )
1932 register int n;
1933 for ( n = 0; s[n]; ++n )
1936 return n;
1938 #endif
1940 void *yyalloc (yy_size_t size )
1942 return (void *) malloc( size );
1945 void *yyrealloc (void * ptr, yy_size_t size )
1947 /* The cast to (char *) in the following accommodates both
1948 * implementations that use char* generic pointers, and those
1949 * that use void* generic pointers. It works with the latter
1950 * because both ANSI C and C++ allow castless assignment from
1951 * any pointer type to void*, and deal with argument conversions
1952 * as though doing an assignment.
1954 return (void *) realloc( (char *) ptr, size );
1957 void yyfree (void * ptr )
1959 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1962 #define YYTABLES_NAME "yytables"
1964 #line 156 "./Scanner.l"
1968 static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize)
1970 wxASSERT( _pszLexBuff != NULL );
1972 if (_pszLexBuff == NULL) {
1973 YY_FATAL_ERROR("Input in flex scanner failed");
1976 wxASSERT( sizeof(YY_CHAR) == sizeof(char) );
1977 size_t uCharsInBuff = strlen(_pszLexBuff);
1978 size_t uCharsRead = min(uMaxSize, uCharsInBuff);
1979 riResult = uCharsRead;
1980 memcpy(pcBuff, _pszLexBuff, uCharsRead);
1981 _pszLexBuff += uCharsRead;
1984 static void FatalLexError(yyconst char msg[])
1986 #ifdef _CONSOLE
1987 printf("Fatal error in flex scanner: %s\n", msg);
1988 #else
1989 printf("Fatal error in flex scanner: %s\n", msg);
1990 #endif
1993 void LexInit(const wxString& pszInput)
1995 _pszLexStr = strdup(unicode2UTF8(pszInput));
1996 _pszLexBuff = _pszLexStr;
1999 void LexFree()
2001 yylex_destroy();
2003 yyleng = 0;
2004 yytext = NULL;
2005 yyin = NULL;
2006 yyout = NULL;
2007 yy_hold_char = '\0';
2008 yy_n_chars = 0;
2009 yy_c_buf_p = NULL;
2010 yy_start = 0;
2011 yy_did_buffer_switch_on_eof = 0;
2012 yy_last_accepting_state = 0;
2013 yy_last_accepting_cpos = NULL;
2015 #if YY_STACK_USED
2016 yy_start_stack_ptr = 0;
2017 yy_start_stack_depth = 0;
2018 yy_start_stack = NULL;
2019 #endif
2021 free(_pszLexStr);