Debian Codegraph @

CodeLite/pp_lexer.cpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : pp_lexer.cpp
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26
27 #line 3 "lex.pp_.c"
28
29 #define YY_INT_ALIGNED short int
30
31 /* A lexical scanner generated by flex */
32
33 #define yy_create_buffer pp__create_buffer
34 #define yy_delete_buffer pp__delete_buffer
35 #define yy_flex_debug pp__flex_debug
36 #define yy_init_buffer pp__init_buffer
37 #define yy_flush_buffer pp__flush_buffer
38 #define yy_load_buffer_state pp__load_buffer_state
39 #define yy_switch_to_buffer pp__switch_to_buffer
40 #define yyin pp_in
41 #define yyleng pp_leng
42 #define yylex pp_lex
43 #define yylineno pp_lineno
44 #define yyout pp_out
45 #define yyrestart pp_restart
46 #define yytext pp_text
47 #define yywrap pp_wrap
48 #define yyalloc pp_alloc
49 #define yyrealloc pp_realloc
50 #define yyfree pp_free
51
52 #define FLEX_SCANNER
53 #define YY_FLEX_MAJOR_VERSION 2
54 #define YY_FLEX_MINOR_VERSION 5
55 #define YY_FLEX_SUBMINOR_VERSION 35
56 #if YY_FLEX_SUBMINOR_VERSION > 0
57 #define FLEX_BETA
58 #endif
59
60 /* First, we deal with platform-specific or compiler-specific issues. */
61
62 /* begin standard C headers. */
63 #include <stdio.h>
64 #include <string.h>
65 #include <errno.h>
66 #include <stdlib.h>
67
68 /* end standard C headers. */
69
70 /* flex integer type definitions */
71
72 #ifndef FLEXINT_H
73 #define FLEXINT_H
74
75 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
76
77 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
78
79 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
80 * if you want the limit (max/min) macros for int types.
81 */
82 #ifndef __STDC_LIMIT_MACROS
83 #define __STDC_LIMIT_MACROS 1
84 #endif
85
86 #include <inttypes.h>
87 typedef int8_t flex_int8_t;
88 typedef uint8_t flex_uint8_t;
89 typedef int16_t flex_int16_t;
90 typedef uint16_t flex_uint16_t;
91 typedef int32_t flex_int32_t;
92 typedef uint32_t flex_uint32_t;
93 #else
94 typedef signed char flex_int8_t;
95 typedef short int flex_int16_t;
96 typedef int flex_int32_t;
97 typedef unsigned char flex_uint8_t;
98 typedef unsigned short int flex_uint16_t;
99 typedef unsigned int flex_uint32_t;
100
101 /* Limits of integral types. */
102 #ifndef INT8_MIN
103 #define INT8_MIN (-128)
104 #endif
105 #ifndef INT16_MIN
106 #define INT16_MIN (-32767-1)
107 #endif
108 #ifndef INT32_MIN
109 #define INT32_MIN (-2147483647-1)
110 #endif
111 #ifndef INT8_MAX
112 #define INT8_MAX (127)
113 #endif
114 #ifndef INT16_MAX
115 #define INT16_MAX (32767)
116 #endif
117 #ifndef INT32_MAX
118 #define INT32_MAX (2147483647)
119 #endif
120 #ifndef UINT8_MAX
121 #define UINT8_MAX (255U)
122 #endif
123 #ifndef UINT16_MAX
124 #define UINT16_MAX (65535U)
125 #endif
126 #ifndef UINT32_MAX
127 #define UINT32_MAX (4294967295U)
128 #endif
129
130 #endif /* ! C99 */
131
132 #endif /* ! FLEXINT_H */
133
134 #ifdef __cplusplus
135
136 /* The "const" storage-class-modifier is valid. */
137 #define YY_USE_CONST
138
139 #else /* ! __cplusplus */
140
141 /* C99 requires __STDC__ to be defined as 1. */
142 #if defined (__STDC__)
143
144 #define YY_USE_CONST
145
146 #endif /* defined (__STDC__) */
147 #endif /* ! __cplusplus */
148
149 #ifdef YY_USE_CONST
150 #define yyconst const
151 #else
152 #define yyconst
153 #endif
154
155 /* Returned upon end-of-file. */
156 #define YY_NULL 0
157
158 /* Promotes a possibly negative, possibly signed char to an unsigned
159 * integer for use as an array index. If the signed char is negative,
160 * we want to instead treat it as an 8-bit unsigned char, hence the
161 * double cast.
162 */
163 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
164
165 /* Enter a start condition. This macro really ought to take a parameter,
166 * but we do it the disgusting crufty way forced on us by the ()-less
167 * definition of BEGIN.
168 */
169 #define BEGIN (yy_start) = 1 + 2 *
170
171 /* Translate the current start state into a value that can be later handed
172 * to BEGIN to return to the state. The YYSTATE alias is for lex
173 * compatibility.
174 */
175 #define YY_START (((yy_start) - 1) / 2)
176 #define YYSTATE YY_START
177
178 /* Action number for EOF rule of a given start state. */
179 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
180
181 /* Special action meaning "start processing a new file". */
182 #define YY_NEW_FILE pp_restart(pp_in )
183
184 #define YY_END_OF_BUFFER_CHAR 0
185
186 /* Size of default input buffer. */
187 #ifndef YY_BUF_SIZE
188 #ifdef __ia64__
189 /* On IA-64, the buffer size is 16k, not 8k.
190 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
191 * Ditto for the __ia64__ case accordingly.
192 */
193 #define YY_BUF_SIZE 32768
194 #else
195 #define YY_BUF_SIZE 16384
196 #endif /* __ia64__ */
197 #endif
198
199 /* The state buf must be large enough to hold one state per character in the main buffer.
200 */
201 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
202
203 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
204 #define YY_TYPEDEF_YY_BUFFER_STATE
205 typedef struct yy_buffer_state *YY_BUFFER_STATE;
206 #endif
207
208 extern int pp_leng;
209
210 extern FILE *pp_in, *pp_out;
211
212 #define EOB_ACT_CONTINUE_SCAN 0
213 #define EOB_ACT_END_OF_FILE 1
214 #define EOB_ACT_LAST_MATCH 2
215
216 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
217 * access to the local variable yy_act. Since yyless() is a macro, it would break
218 * existing scanners that call yyless() from OUTSIDE pp_lex.
219 * One obvious solution it to make yy_act a global. I tried that, and saw
220 * a 5% performance hit in a non-pp_lineno scanner, because yy_act is
221 * normally declared as a register variable-- so it is not worth it.
222 */
223 #define YY_LESS_LINENO(n) \
224 do { \
225 int yyl;\
226 for ( yyl = n; yyl < pp_leng; ++yyl )\
227 if ( pp_text[yyl] == '\n' )\
228 --pp_lineno;\
229 }while(0)
230
231 /* Return all but the first "n" matched characters back to the input stream. */
232 #define yyless(n) \
233 do \
234 { \
235 /* Undo effects of setting up pp_text. */ \
236 int yyless_macro_arg = (n); \
237 YY_LESS_LINENO(yyless_macro_arg);\
238 *yy_cp = (yy_hold_char); \
239 YY_RESTORE_YY_MORE_OFFSET \
240 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
241 YY_DO_BEFORE_ACTION; /* set up pp_text again */ \
242 } \
243 while ( 0 )
244
245 #define unput(c) yyunput( c, (yytext_ptr) )
246
247 #ifndef YY_TYPEDEF_YY_SIZE_T
248 #define YY_TYPEDEF_YY_SIZE_T
249 typedef size_t yy_size_t;
250 #endif
251
252 #ifndef YY_STRUCT_YY_BUFFER_STATE
253 #define YY_STRUCT_YY_BUFFER_STATE
254 struct yy_buffer_state
255 {
256 FILE *yy_input_file;
257
258 char *yy_ch_buf; /* input buffer */
259 char *yy_buf_pos; /* current position in input buffer */
260
261 /* Size of input buffer in bytes, not including room for EOB
262 * characters.
263 */
264 yy_size_t yy_buf_size;
265
266 /* Number of characters read into yy_ch_buf, not including EOB
267 * characters.
268 */
269 int yy_n_chars;
270
271 /* Whether we "own" the buffer - i.e., we know we created it,
272 * and can realloc() it to grow it, and should free() it to
273 * delete it.
274 */
275 int yy_is_our_buffer;
276
277 /* Whether this is an "interactive" input source; if so, and
278 * if we're using stdio for input, then we want to use getc()
279 * instead of fread(), to make sure we stop fetching input after
280 * each newline.
281 */
282 int yy_is_interactive;
283
284 /* Whether we're considered to be at the beginning of a line.
285 * If so, '^' rules will be active on the next match, otherwise
286 * not.
287 */
288 int yy_at_bol;
289
290 int yy_bs_lineno; /**< The line count. */
291 int yy_bs_column; /**< The column count. */
292
293 /* Whether to try to fill the input buffer when we reach the
294 * end of it.
295 */
296 int yy_fill_buffer;
297
298 int yy_buffer_status;
299
300 #define YY_BUFFER_NEW 0
301 #define YY_BUFFER_NORMAL 1
302 /* When an EOF's been seen but there's still some text to process
303 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
304 * shouldn't try reading from the input source any more. We might
305 * still have a bunch of tokens to match, though, because of
306 * possible backing-up.
307 *
308 * When we actually see the EOF, we change the status to "new"
309 * (via pp_restart()), so that the user can continue scanning by
310 * just pointing pp_in at a new input file.
311 */
312 #define YY_BUFFER_EOF_PENDING 2
313
314 };
315 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
316
317 /* Stack of input buffers. */
318 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
319 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
320 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
321
322 /* We provide macros for accessing buffer states in case in the
323 * future we want to put the buffer states in a more general
324 * "scanner state".
325 *
326 * Returns the top of the stack, or NULL.
327 */
328 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
329 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
330 : NULL)
331
332 /* Same as previous macro, but useful when we know that the buffer stack is not
333 * NULL or when we need an lvalue. For internal use only.
334 */
335 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
336
337 /* yy_hold_char holds the character lost when pp_text is formed. */
338 static char yy_hold_char;
339 static int yy_n_chars; /* number of characters read into yy_ch_buf */
340 int pp_leng;
341
342 /* Points to current character in buffer. */
343 static char *yy_c_buf_p = (char *) 0;
344 static int yy_init = 0; /* whether we need to initialize */
345 static int yy_start = 0; /* start state number */
346
347 /* Flag which is used to allow pp_wrap()'s to do buffer switches
348 * instead of setting up a fresh pp_in. A bit of a hack ...
349 */
350 static int yy_did_buffer_switch_on_eof;
351
352 void pp_restart (FILE *input_file );
353 void pp__switch_to_buffer (YY_BUFFER_STATE new_buffer );
354 YY_BUFFER_STATE pp__create_buffer (FILE *file,int size );
355 void pp__delete_buffer (YY_BUFFER_STATE b );
356 void pp__flush_buffer (YY_BUFFER_STATE b );
357 void pp_push_buffer_state (YY_BUFFER_STATE new_buffer );
358 void pp_pop_buffer_state (void );
359
360 static void pp_ensure_buffer_stack (void );
361 static void pp__load_buffer_state (void );
362 static void pp__init_buffer (YY_BUFFER_STATE b,FILE *file );
363
364 #define YY_FLUSH_BUFFER pp__flush_buffer(YY_CURRENT_BUFFER )
365
366 YY_BUFFER_STATE pp__scan_buffer (char *base,yy_size_t size );
367 YY_BUFFER_STATE pp__scan_string (yyconst char *yy_str );
368 YY_BUFFER_STATE pp__scan_bytes (yyconst char *bytes,int len );
369
370 void *pp_alloc (yy_size_t );
371 void *pp_realloc (void *,yy_size_t );
372 void pp_free (void * );
373
374 #define yy_new_buffer pp__create_buffer
375
376 #define yy_set_interactive(is_interactive) \
377 { \
378 if ( ! YY_CURRENT_BUFFER ){ \
379 pp_ensure_buffer_stack (); \
380 YY_CURRENT_BUFFER_LVALUE = \
381 pp__create_buffer(pp_in,YY_BUF_SIZE ); \
382 } \
383 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
384 }
385
386 #define yy_set_bol(at_bol) \
387 { \
388 if ( ! YY_CURRENT_BUFFER ){\
389 pp_ensure_buffer_stack (); \
390 YY_CURRENT_BUFFER_LVALUE = \
391 pp__create_buffer(pp_in,YY_BUF_SIZE ); \
392 } \
393 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
394 }
395
396 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
397
398 /* Begin user sect3 */
399
400 typedef unsigned char YY_CHAR;
401
402 FILE *pp_in = (FILE *) 0, *pp_out = (FILE *) 0;
403
404 typedef int yy_state_type;
405
406 extern int pp_lineno;
407
408 int pp_lineno = 1;
409
410 extern char *pp_text;
411 #define yytext_ptr pp_text
412
413 static yy_state_type yy_get_previous_state (void );
414 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
415 static int yy_get_next_buffer (void );
416 static void yy_fatal_error (yyconst char msg[] );
417
418 /* Done after the current pattern has been matched and before the
419 * corresponding action - sets up pp_text.
420 */
421 #define YY_DO_BEFORE_ACTION \
422 (yytext_ptr) = yy_bp; \
423 pp_leng = (size_t) (yy_cp - yy_bp); \
424 (yy_hold_char) = *yy_cp; \
425 *yy_cp = '\0'; \
426 (yy_c_buf_p) = yy_cp;
427
428 #define YY_NUM_RULES 73
429 #define YY_END_OF_BUFFER 74
430 /* This struct is not used in this scanner,
431 but its presence is necessary. */
432 struct yy_trans_info
433 {
434 flex_int32_t yy_verify;
435 flex_int32_t yy_nxt;
436 };
437 static yyconst flex_int16_t yy_accept[210] =
438 { 0,
439 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
440 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
441 0, 0, 0, 0, 0, 0, 0, 0, 74, 62,
442 73, 62, 5, 62, 62, 62, 64, 63, 72, 72,
443 70, 69, 19, 18, 8, 19, 19, 19, 19, 19,
444 44, 43, 41, 44, 50, 45, 49, 48, 50, 54,
445 53, 52, 51, 61, 59, 58, 60, 61, 61, 66,
446 66, 68, 67, 25, 24, 22, 23, 21, 21, 40,
447 39, 40, 40, 30, 31, 38, 37, 34, 36, 29,
448 29, 29, 40, 0, 4, 0, 0, 0, 2, 1,
449
450 0, 0, 71, 0, 0, 0, 0, 7, 0, 0,
451 41, 42, 46, 47, 51, 55, 56, 57, 65, 21,
452 21, 35, 0, 32, 38, 29, 29, 29, 33, 0,
453 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
454 0, 0, 0, 42, 21, 0, 29, 29, 0, 0,
455 0, 0, 0, 0, 15, 14, 0, 0, 0, 0,
456 0, 21, 0, 29, 29, 0, 0, 0, 0, 0,
457 0, 16, 10, 0, 0, 13, 21, 0, 29, 29,
458 0, 6, 12, 0, 21, 0, 29, 29, 0, 11,
459 17, 21, 0, 29, 28, 0, 21, 27, 29, 0,
460
461 21, 29, 0, 21, 29, 9, 20, 26, 0
462 } ;
463
464 static yyconst flex_int32_t yy_ec[256] =
465 { 0,
466 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
467 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 5, 6, 7, 8, 1, 1, 9, 10, 11,
470 12, 13, 1, 14, 1, 1, 15, 16, 17, 17,
471 17, 17, 17, 17, 17, 18, 18, 1, 1, 19,
472 20, 21, 22, 1, 23, 23, 23, 23, 23, 23,
473 24, 24, 24, 24, 24, 25, 24, 24, 24, 24,
474 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
475 1, 26, 1, 1, 27, 1, 28, 28, 29, 30,
476
477 31, 32, 24, 24, 33, 24, 24, 34, 24, 35,
478 24, 36, 24, 37, 38, 37, 39, 37, 24, 40,
479 24, 24, 1, 41, 1, 1, 1, 1, 1, 1,
480 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
481 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
482 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
483 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
484 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
485 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
486 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
487
488 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
489 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
491 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
492 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
493 1, 1, 1, 1, 1
494 } ;
495
496 static yyconst flex_int32_t yy_meta[42] =
497 { 0,
498 1, 1, 2, 1, 1, 1, 3, 1, 1, 4,
499 1, 1, 1, 1, 1, 5, 5, 6, 1, 1,
500 1, 3, 6, 7, 7, 3, 7, 5, 6, 6,
501 6, 5, 7, 7, 8, 7, 8, 7, 7, 8,
502 1
503 } ;
504
505 static yyconst flex_int16_t yy_base[230] =
506 { 0,
507 0, 6, 505, 504, 9, 14, 503, 502, 0, 0,
508 29, 66, 105, 0, 31, 36, 146, 0, 46, 50,
509 15, 16, 501, 500, 187, 0, 228, 0, 502, 509,
510 509, 4, 509, 475, 11, 13, 509, 509, 509, 485,
511 509, 509, 509, 509, 509, 472, 467, 9, 5, 462,
512 509, 509, 0, 1, 509, 509, 509, 509, 42, 509,
513 509, 509, 0, 509, 509, 509, 509, 51, 493, 509,
514 480, 509, 509, 509, 509, 509, 509, 0, 467, 509,
515 509, 43, 484, 509, 509, 61, 509, 509, 509, 0,
516 465, 460, 449, 60, 509, 54, 48, 64, 509, 509,
517
518 76, 463, 509, 459, 455, 51, 456, 55, 456, 454,
519 0, 84, 509, 509, 0, 509, 509, 509, 509, 0,
520 454, 509, 451, 509, 254, 0, 452, 448, 509, 266,
521 0, 509, 264, 0, 443, 445, 445, 445, 442, 443,
522 443, 438, 435, 509, 429, 428, 423, 402, 268, 288,
523 281, 311, 399, 390, 509, 509, 306, 304, 304, 294,
524 300, 297, 297, 292, 290, 270, 0, 65, 0, 285,
525 292, 509, 509, 290, 285, 509, 274, 277, 271, 278,
526 270, 273, 509, 271, 263, 269, 261, 263, 253, 509,
527 509, 252, 257, 250, 0, 245, 244, 509, 242, 64,
528
529 62, 61, 60, 57, 54, 509, 0, 0, 509, 343,
530 351, 359, 367, 375, 383, 391, 399, 407, 415, 423,
531 431, 435, 439, 443, 447, 453, 459, 463, 465
532 } ;
533
534 static yyconst flex_int16_t yy_def[230] =
535 { 0,
536 210, 210, 211, 211, 212, 212, 213, 213, 214, 214,
537 215, 215, 209, 13, 216, 216, 209, 17, 217, 217,
538 218, 218, 219, 219, 209, 25, 209, 27, 209, 209,
539 209, 220, 209, 221, 209, 209, 209, 209, 209, 209,
540 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
541 209, 209, 222, 209, 209, 209, 209, 209, 209, 209,
542 209, 209, 223, 209, 209, 209, 209, 209, 209, 209,
543 209, 209, 209, 209, 209, 209, 209, 224, 224, 209,
544 209, 209, 209, 209, 209, 209, 209, 209, 209, 225,
545 225, 225, 209, 220, 209, 226, 221, 227, 209, 209,
546
547 220, 221, 209, 209, 209, 209, 209, 209, 209, 209,
548 222, 209, 209, 209, 223, 209, 209, 209, 209, 224,
549 224, 209, 209, 209, 209, 225, 225, 225, 209, 220,
550 228, 209, 221, 229, 209, 209, 209, 209, 209, 209,
551 209, 209, 209, 209, 224, 209, 225, 225, 220, 220,
552 221, 221, 209, 209, 209, 209, 209, 209, 209, 209,
553 209, 224, 209, 225, 225, 220, 150, 221, 152, 209,
554 209, 209, 209, 209, 209, 209, 224, 209, 225, 225,
555 209, 209, 209, 209, 224, 209, 225, 225, 209, 209,
556 209, 224, 209, 225, 225, 209, 224, 209, 225, 209,
557
558 224, 225, 209, 224, 225, 209, 224, 225, 0, 209,
559 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
560 209, 209, 209, 209, 209, 209, 209, 209, 209
561 } ;
562
563 static yyconst flex_int16_t yy_nxt[551] =
564 { 0,
565 209, 209, 31, 112, 112, 209, 32, 33, 31, 34,
566 95, 31, 32, 33, 35, 34, 31, 31, 31, 101,
567 35, 40, 102, 99, 36, 100, 40, 71, 71, 96,
568 36, 44, 56, 57, 209, 56, 108, 56, 57, 109,
569 56, 58, 106, 107, 45, 59, 58, 65, 66, 67,
570 59, 65, 66, 67, 113, 46, 114, 132, 47, 48,
571 68, 49, 122, 116, 68, 117, 95, 50, 44, 130,
572 130, 69, 123, 98, 132, 69, 125, 125, 125, 133,
573 133, 45, 95, 137, 140, 96, 144, 144, 138, 141,
574 98, 208, 46, 131, 207, 47, 48, 206, 49, 205,
575
576 204, 96, 203, 134, 50, 51, 51, 52, 51, 51,
577 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
578 51, 51, 51, 51, 51, 51, 51, 53, 53, 53,
579 54, 53, 53, 53, 53, 53, 53, 53, 53, 53,
580 53, 53, 53, 53, 53, 51, 60, 60, 31, 60,
581 60, 60, 60, 60, 60, 60, 60, 61, 60, 62,
582 60, 60, 60, 60, 60, 60, 60, 60, 63, 63,
583 63, 60, 63, 63, 63, 63, 63, 63, 63, 63,
584 63, 63, 63, 63, 63, 63, 60, 74, 74, 75,
585 74, 74, 74, 74, 74, 74, 74, 76, 77, 74,
586
587 74, 74, 74, 74, 74, 74, 74, 74, 74, 78,
588 78, 78, 74, 79, 78, 78, 78, 78, 78, 78,
589 78, 78, 78, 78, 78, 78, 78, 74, 80, 80,
590 81, 80, 80, 82, 80, 80, 83, 80, 84, 85,
591 80, 80, 80, 86, 86, 86, 87, 88, 89, 80,
592 90, 90, 90, 80, 91, 90, 90, 92, 90, 90,
593 90, 90, 90, 90, 90, 90, 90, 90, 93, 125,
594 125, 125, 95, 132, 95, 202, 95, 201, 200, 151,
595 151, 149, 149, 166, 166, 199, 198, 197, 196, 98,
596 132, 96, 195, 96, 95, 96, 168, 168, 194, 193,
597
598 192, 191, 190, 167, 167, 167, 98, 189, 188, 187,
599 167, 186, 185, 96, 184, 167, 167, 167, 167, 167,
600 132, 183, 182, 181, 180, 179, 169, 169, 169, 178,
601 177, 176, 175, 169, 174, 173, 98, 172, 169, 169,
602 169, 169, 169, 30, 30, 30, 30, 30, 30, 30,
603 30, 37, 37, 37, 37, 37, 37, 37, 37, 39,
604 39, 39, 39, 39, 39, 39, 39, 41, 41, 41,
605 41, 41, 41, 41, 41, 31, 31, 31, 31, 31,
606 31, 31, 31, 43, 43, 43, 43, 43, 43, 43,
607 43, 55, 55, 55, 55, 55, 55, 55, 55, 64,
608
609 64, 64, 64, 64, 64, 64, 64, 70, 70, 70,
610 70, 70, 70, 70, 70, 72, 72, 72, 72, 72,
611 72, 72, 72, 94, 171, 94, 94, 94, 94, 94,
612 94, 97, 170, 97, 165, 97, 97, 97, 97, 111,
613 111, 111, 111, 115, 115, 115, 115, 120, 120, 120,
614 120, 126, 126, 126, 126, 94, 94, 94, 164, 163,
615 94, 97, 97, 97, 162, 161, 97, 150, 150, 152,
616 152, 160, 159, 158, 157, 156, 155, 154, 153, 148,
617 147, 146, 145, 143, 142, 139, 136, 135, 98, 129,
618 128, 127, 124, 121, 119, 118, 110, 105, 104, 103,
619
620 98, 209, 73, 73, 42, 42, 38, 38, 29, 209,
621 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
622 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
623 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
624 209, 209, 209, 209, 209, 209, 209, 209, 209, 209
625 } ;
626
627 static yyconst flex_int16_t yy_chk[551] =
628 { 0,
629 0, 0, 1, 54, 54, 0, 1, 1, 2, 1,
630 32, 5, 2, 2, 1, 2, 6, 21, 22, 36,
631 2, 5, 36, 35, 1, 35, 6, 21, 22, 32,
632 2, 11, 15, 15, 0, 15, 49, 16, 16, 49,
633 16, 15, 48, 48, 11, 15, 16, 19, 19, 19,
634 16, 20, 20, 20, 59, 11, 59, 97, 11, 11,
635 19, 11, 82, 68, 20, 68, 94, 11, 12, 96,
636 96, 19, 82, 97, 168, 20, 86, 86, 86, 98,
637 98, 12, 101, 106, 108, 94, 112, 112, 106, 108,
638 168, 205, 12, 96, 204, 12, 12, 203, 12, 202,
639
640 201, 101, 200, 98, 12, 13, 13, 13, 13, 13,
641 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
642 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
643 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
644 13, 13, 13, 13, 13, 13, 17, 17, 17, 17,
645 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
646 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
647 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
648 17, 17, 17, 17, 17, 17, 17, 25, 25, 25,
649 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
650
651 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
652 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
653 25, 25, 25, 25, 25, 25, 25, 25, 27, 27,
654 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
655 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
656 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
657 27, 27, 27, 27, 27, 27, 27, 27, 27, 125,
658 125, 125, 130, 133, 149, 199, 166, 197, 196, 133,
659 133, 130, 130, 149, 149, 194, 193, 192, 189, 133,
660 151, 130, 188, 149, 150, 166, 151, 151, 187, 186,
661
662 185, 184, 182, 150, 150, 150, 151, 181, 180, 179,
663 150, 178, 177, 150, 175, 150, 150, 150, 150, 150,
664 152, 174, 171, 170, 165, 164, 152, 152, 152, 163,
665 162, 161, 160, 152, 159, 158, 152, 157, 152, 152,
666 152, 152, 152, 210, 210, 210, 210, 210, 210, 210,
667 210, 211, 211, 211, 211, 211, 211, 211, 211, 212,
668 212, 212, 212, 212, 212, 212, 212, 213, 213, 213,
669 213, 213, 213, 213, 213, 214, 214, 214, 214, 214,
670 214, 214, 214, 215, 215, 215, 215, 215, 215, 215,
671 215, 216, 216, 216, 216, 216, 216, 216, 216, 217,
672
673 217, 217, 217, 217, 217, 217, 217, 218, 218, 218,
674 218, 218, 218, 218, 218, 219, 219, 219, 219, 219,
675 219, 219, 219, 220, 154, 220, 220, 220, 220, 220,
676 220, 221, 153, 221, 148, 221, 221, 221, 221, 222,
677 222, 222, 222, 223, 223, 223, 223, 224, 224, 224,
678 224, 225, 225, 225, 225, 226, 226, 226, 147, 146,
679 226, 227, 227, 227, 145, 143, 227, 228, 228, 229,
680 229, 142, 141, 140, 139, 138, 137, 136, 135, 128,
681 127, 123, 121, 110, 109, 107, 105, 104, 102, 93,
682 92, 91, 83, 79, 71, 69, 50, 47, 46, 40,
683
684 34, 29, 24, 23, 8, 7, 4, 3, 209, 209,
685 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
686 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
687 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
688 209, 209, 209, 209, 209, 209, 209, 209, 209, 209
689 } ;
690
691 /* Table of booleans, true if rule could match eol. */
692 static yyconst flex_int32_t yy_rule_can_match_eol[74] =
693 { 0,
694 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
695 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
696 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
697 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, };
698
699 static yy_state_type yy_last_accepting_state;
700 static char *yy_last_accepting_cpos;
701
702 extern int pp__flex_debug;
703 int pp__flex_debug = 0;
704
705 /* The intent behind this definition is that it'll catch
706 * any uses of REJECT which flex missed.
707 */
708 #define REJECT reject_used_but_not_detected
709 #define yymore() yymore_used_but_not_detected
710 #define YY_MORE_ADJ 0
711 #define YY_RESTORE_YY_MORE_OFFSET
712 char *pp_text;
713 /**
714 * the "incl" state is used for picking up the name
715 * of an include file
716 */
717
718 /** #define related states **/
719
720 // Avoid spam output
721 #ifdef ECHO
722 #undef ECHO
723 #endif
724 #define ECHO
725
726 // Never exit
727 #ifdef YY_FATAL_ERROR
728 #undef YY_FATAL_ERROR
729 #endif
730 #define YY_FATAL_ERROR(msg)
731
732 #include <list>
733 #include <wx/string.h>
734 #include <string>
735 #include "pp_include.h"
736 #include "pp_lexer.h"
737 #include "pptable.h"
738
739 #define YYSTYPE wxString
740 extern wxString pp_lval;
741
742 int return_to_state = 0;
743 int in_if_1 = 0;
744
745 #define RET_VAL(x) {\
746 pp_lval = wxString::From8BitData(pp_text);\
747 return x;\
748 }
749
750 std::string _definition;
751 wxString g_definition;
752 bool g_forCC = false;
753 wxString g_filename;
754
755 extern int pp_parse();
756
757 #define INITIAL 0
758 #define incl 1
759 #define c_comment 2
760 #define cpp_comment 3
761 #define using_namespace 4
762 #define PP 5
763 #define define_state 6
764 #define define_state_2 7
765 #define define_state_signature 8
766 #define define_state_definition 9
767 #define define_generic_c_comment 10
768 #define define_generic_cpp_comment 11
769 #define ifdef_state 12
770 #define if_state 13
771
772 #ifndef YY_NO_UNISTD_H
773 /* Special case for "unistd.h", since it is non-ANSI. We include it way
774 * down here because we want the user's section 1 to have been scanned first.
775 * The user has a chance to override it with an option.
776 */
777 #include <unistd.h>
778 #endif
779
780 #ifndef YY_EXTRA_TYPE
781 #define YY_EXTRA_TYPE void *
782 #endif
783
784 static int yy_init_globals (void );
785
786 /* Accessor methods to globals.
787 These are made visible to non-reentrant scanners for convenience. */
788
789 int pp_lex_destroy (void );
790
791 int pp_get_debug (void );
792
793 void pp_set_debug (int debug_flag );
794
795 YY_EXTRA_TYPE pp_get_extra (void );
796
797 void pp_set_extra (YY_EXTRA_TYPE user_defined );
798
799 FILE *pp_get_in (void );
800
801 void pp_set_in (FILE * in_str );
802
803 FILE *pp_get_out (void );
804
805 void pp_set_out (FILE * out_str );
806
807 int pp_get_leng (void );
808
809 char *pp_get_text (void );
810
811 int pp_get_lineno (void );
812
813 void pp_set_lineno (int line_number );
814
815 /* Macros after this point can all be overridden by user definitions in
816 * section 1.
817 */
818
819 #ifndef YY_SKIP_YYWRAP
820 #ifdef __cplusplus
821 extern "C" int pp_wrap (void );
822 #else
823 extern int pp_wrap (void );
824 #endif
825 #endif
826
827 static void yyunput (int c,char *buf_ptr );
828
829 #ifndef yytext_ptr
830 static void yy_flex_strncpy (char *,yyconst char *,int );
831 #endif
832
833 #ifdef YY_NEED_STRLEN
834 static int yy_flex_strlen (yyconst char * );
835 #endif
836
837 #ifndef YY_NO_INPUT
838
839 #ifdef __cplusplus
840 static int yyinput (void );
841 #else
842 static int input (void );
843 #endif
844
845 #endif
846
847 /* Amount of stuff to slurp up with each read. */
848 #ifndef YY_READ_BUF_SIZE
849 #ifdef __ia64__
850 /* On IA-64, the buffer size is 16k, not 8k */
851 #define YY_READ_BUF_SIZE 16384
852 #else
853 #define YY_READ_BUF_SIZE 8192
854 #endif /* __ia64__ */
855 #endif
856
857 /* Copy whatever the last rule matched to the standard output. */
858 #ifndef ECHO
859 /* This used to be an fputs(), but since the string might contain NUL's,
860 * we now use fwrite().
861 */
862 #define ECHO do { if (fwrite( pp_text, pp_leng, 1, pp_out )) {} } while (0)
863 #endif
864
865 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
866 * is returned in "result".
867 */
868 #ifndef YY_INPUT
869 #define YY_INPUT(buf,result,max_size) \
870 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
871 { \
872 int c = '*'; \
873 size_t n; \
874 for ( n = 0; n < max_size && \
875 (c = getc( pp_in )) != EOF && c != '\n'; ++n ) \
876 buf[n] = (char) c; \
877 if ( c == '\n' ) \
878 buf[n++] = (char) c; \
879 if ( c == EOF && ferror( pp_in ) ) \
880 YY_FATAL_ERROR( "input in flex scanner failed" ); \
881 result = n; \
882 } \
883 else \
884 { \
885 errno=0; \
886 while ( (result = fread(buf, 1, max_size, pp_in))==0 && ferror(pp_in)) \
887 { \
888 if( errno != EINTR) \
889 { \
890 YY_FATAL_ERROR( "input in flex scanner failed" ); \
891 break; \
892 } \
893 errno=0; \
894 clearerr(pp_in); \
895 } \
896 }\
897 \
898
899 #endif
900
901 /* No semi-colon after return; correct usage is to write "yyterminate();" -
902 * we don't want an extra ';' after the "return" because that will cause
903 * some compilers to complain about unreachable statements.
904 */
905 #ifndef yyterminate
906 #define yyterminate() return YY_NULL
907 #endif
908
909 /* Number of entries by which start-condition stack grows. */
910 #ifndef YY_START_STACK_INCR
911 #define YY_START_STACK_INCR 25
912 #endif
913
914 /* Report a fatal error. */
915 #ifndef YY_FATAL_ERROR
916 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
917 #endif
918
919 /* end tables serialization structures and prototypes */
920
921 /* Default declaration of generated scanner - a define so the user can
922 * easily add parameters.
923 */
924 #ifndef YY_DECL
925 #define YY_DECL_IS_OURS 1
926
927 extern int pp_lex (void);
928
929 #define YY_DECL int pp_lex (void)
930 #endif /* !YY_DECL */
931
932 /* Code executed at the beginning of each rule, after pp_text and pp_leng
933 * have been set up.
934 */
935 #ifndef YY_USER_ACTION
936 #define YY_USER_ACTION
937 #endif
938
939 /* Code executed at the end of each rule. */
940 #ifndef YY_BREAK
941 #define YY_BREAK break;
942 #endif
943
944 #define YY_RULE_SETUP \
945 YY_USER_ACTION
946
947 /** The main scanner function which does all the work.
948 */
949 YY_DECL
950 {
951 register yy_state_type yy_current_state;
952 register char *yy_cp, *yy_bp;
953 register int yy_act;
954
955 if ( !(yy_init) )
956 {
957 (yy_init) = 1;
958
959 #ifdef YY_USER_INIT
960 YY_USER_INIT;
961 #endif
962
963 if ( ! (yy_start) )
964 (yy_start) = 1; /* first start state */
965
966 if ( ! pp_in )
967 pp_in = stdin;
968
969 if ( ! pp_out )
970 pp_out = stdout;
971
972 if ( ! YY_CURRENT_BUFFER ) {
973 pp_ensure_buffer_stack ();
974 YY_CURRENT_BUFFER_LVALUE =
975 pp__create_buffer(pp_in,YY_BUF_SIZE );
976 }
977
978 pp__load_buffer_state( );
979 }
980
981 while ( 1 ) /* loops until end-of-file is reached */
982 {
983 yy_cp = (yy_c_buf_p);
984
985 /* Support of pp_text. */
986 *yy_cp = (yy_hold_char);
987
988 /* yy_bp points to the position in yy_ch_buf of the start of
989 * the current run.
990 */
991 yy_bp = yy_cp;
992
993 yy_current_state = (yy_start);
994 yy_match:
995 do
996 {
997 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
998 if ( yy_accept[yy_current_state] )
999 {
1000 (yy_last_accepting_state) = yy_current_state;
1001 (yy_last_accepting_cpos) = yy_cp;
1002 }
1003 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1004 {
1005 yy_current_state = (int) yy_def[yy_current_state];
1006 if ( yy_current_state >= 210 )
1007 yy_c = yy_meta[(unsigned int) yy_c];
1008 }
1009 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1010 ++yy_cp;
1011 }
1012 while ( yy_base[yy_current_state] != 509 );
1013
1014 yy_find_action:
1015 yy_act = yy_accept[yy_current_state];
1016 if ( yy_act == 0 )
1017 { /* have to back up */
1018 yy_cp = (yy_last_accepting_cpos);
1019 yy_current_state = (yy_last_accepting_state);
1020 yy_act = yy_accept[yy_current_state];
1021 }
1022
1023 YY_DO_BEFORE_ACTION;
1024
1025 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1026 {
1027 int yyl;
1028 for ( yyl = 0; yyl < pp_leng; ++yyl )
1029 if ( pp_text[yyl] == '\n' )
1030
1031 pp_lineno++;
1032 ;
1033 }
1034
1035 do_action: /* This label is used only to access EOF actions. */
1036
1037 switch ( yy_act )
1038 { /* beginning of action switch */
1039 case 0: /* must back up */
1040 /* undo the effects of YY_DO_BEFORE_ACTION */
1041 *yy_cp = (yy_hold_char);
1042 yy_cp = (yy_last_accepting_cpos);
1043 yy_current_state = (yy_last_accepting_state);
1044 goto yy_find_action;
1045
1046 case 1:
1047 YY_RULE_SETUP
1048 {
1049 BEGIN(cpp_comment);
1050 }
1051 YY_BREAK
1052 case 2:
1053 YY_RULE_SETUP
1054 {
1055 BEGIN(c_comment);
1056 }
1057 YY_BREAK
1058 case 3:
1059 YY_RULE_SETUP
1060 {/* eat a string */}
1061 YY_BREAK
1062 case 4:
1063 YY_RULE_SETUP
1064 {/* eat a string */}
1065 YY_BREAK
1066 case 5:
1067 YY_RULE_SETUP
1068 { BEGIN(PP); }
1069 YY_BREAK
1070 case 6:
1071 YY_RULE_SETUP
1072 { BEGIN(define_state); RET_VAL(PP_DEFINE); }
1073 YY_BREAK
1074 case 7:
1075 YY_RULE_SETUP
1076 { if(in_if_1) in_if_1++; BEGIN(if_state); RET_VAL(PP_IF); }
1077 YY_BREAK
1078 case 8:
1079 YY_RULE_SETUP
1080 { RET_VAL(PP_ZERO); }
1081 YY_BREAK
1082 case 9:
1083 YY_RULE_SETUP
1084 { RET_VAL(PP_CPLUSPLUS); }
1085 YY_BREAK
1086 case 10:
1087 YY_RULE_SETUP
1088 { if(in_if_1) in_if_1++;BEGIN(ifdef_state); RET_VAL(PP_IFDEF); }
1089 YY_BREAK
1090 case 11:
1091 YY_RULE_SETUP
1092 { RET_VAL(PP_DEFINED); }
1093 YY_BREAK
1094 case 12:
1095 YY_RULE_SETUP
1096 { if(in_if_1) in_if_1++; BEGIN(ifdef_state); RET_VAL(PP_IFDEF); }
1097 YY_BREAK
1098 case 13:
1099 YY_RULE_SETUP
1100 { RET_VAL(PP_UNDEF); }
1101 YY_BREAK
1102 case 14:
1103 YY_RULE_SETUP
1104 { if(in_if_1 == 1) in_if_1 = 0;RET_VAL(PP_ELSE); }
1105 YY_BREAK
1106 case 15:
1107 YY_RULE_SETUP
1108 { if(in_if_1 == 1) in_if_1--; BEGIN(if_state); RET_VAL(PP_ELIF); }
1109 YY_BREAK
1110 case 16:
1111 YY_RULE_SETUP
1112 { if(in_if_1) in_if_1--; RET_VAL(PP_ENDIF); }
1113 YY_BREAK
1114 case 17:
1115 YY_RULE_SETUP
1116 { BEGIN(incl); RET_VAL(PP_INCLUDE); }
1117 YY_BREAK
1118 case 18:
1119 /* rule 18 can match eol */
1120 YY_RULE_SETUP
1121 { BEGIN(INITIAL); }
1122 YY_BREAK
1123 case 19:
1124 YY_RULE_SETUP
1125 {}
1126 YY_BREAK
1127 case 20:
1128 YY_RULE_SETUP
1129 { RET_VAL(PP_CPLUSPLUS); }
1130 YY_BREAK
1131 case 21:
1132 YY_RULE_SETUP
1133 { RET_VAL(PP_IDENTIFIER); }
1134 YY_BREAK
1135 case 22:
1136 YY_RULE_SETUP
1137 { RET_VAL(((int)'(')); }
1138 YY_BREAK
1139 case 23:
1140 YY_RULE_SETUP
1141 { RET_VAL(((int)')')); }
1142 YY_BREAK
1143 case 24:
1144 /* rule 24 can match eol */
1145 YY_RULE_SETUP
1146 { BEGIN(INITIAL); }
1147 YY_BREAK
1148 case 25:
1149 YY_RULE_SETUP
1150 {}
1151 YY_BREAK
1152 case 26:
1153 YY_RULE_SETUP
1154 { RET_VAL(PP_CPLUSPLUS); }
1155 YY_BREAK
1156 case 27:
1157 YY_RULE_SETUP
1158 { RET_VAL(PP_DEFINED); }
1159 YY_BREAK
1160 case 28:
1161 YY_RULE_SETUP
1162 { RET_VAL(PP_DEFINED); }
1163 YY_BREAK
1164 case 29:
1165 YY_RULE_SETUP
1166 { RET_VAL(PP_IDENTIFIER); }
1167 YY_BREAK
1168 case 30:
1169 YY_RULE_SETUP
1170 { RET_VAL(((int)'(')); }
1171 YY_BREAK
1172 case 31:
1173 YY_RULE_SETUP
1174 { RET_VAL(((int)')')); }
1175 YY_BREAK
1176 case 32:
1177 YY_RULE_SETUP
1178 { RET_VAL(PP_AND); }
1179 YY_BREAK
1180 case 33:
1181 YY_RULE_SETUP
1182 { RET_VAL(PP_OR); }
1183 YY_BREAK
1184 case 34:
1185 YY_RULE_SETUP
1186 { RET_VAL(PP_EQUAL); }
1187 YY_BREAK
1188 case 35:
1189 YY_RULE_SETUP
1190 { RET_VAL(PP_NEQUAL); }
1191 YY_BREAK
1192 case 36:
1193 YY_RULE_SETUP
1194 { RET_VAL(PP_GREATERTHAN); }
1195 YY_BREAK
1196 case 37:
1197 YY_RULE_SETUP
1198 { RET_VAL(PP_LOWERTHAN); }
1199 YY_BREAK
1200 case 38:
1201 YY_RULE_SETUP
1202 { RET_VAL(PP_INT); }
1203 YY_BREAK
1204 case 39:
1205 /* rule 39 can match eol */
1206 YY_RULE_SETUP
1207 { BEGIN(INITIAL); }
1208 YY_BREAK
1209 case 40:
1210 YY_RULE_SETUP
1211 {}
1212 YY_BREAK
1213 case 41:
1214 YY_RULE_SETUP
1215 { BEGIN(define_state_2); RET_VAL(PP_IDENTIFIER); }
1216 YY_BREAK
1217 case 42:
1218 /* rule 42 can match eol */
1219 YY_RULE_SETUP
1220 { /* continue define_state */}
1221 YY_BREAK
1222 case 43:
1223 /* rule 43 can match eol */
1224 YY_RULE_SETUP
1225 { BEGIN(INITIAL);}
1226 YY_BREAK
1227 case 44:
1228 YY_RULE_SETUP
1229 {}
1230 YY_BREAK
1231 case 45:
1232 YY_RULE_SETUP
1233 {
1234 /* whitespaces are NOT allowed between the signature and the macro's name,
1235 * if we found a whitespace, handle this macro as a simple macro */
1236 BEGIN(define_state_definition);
1237 _definition.clear();
1238 }
1239 YY_BREAK
1240 case 46:
1241 YY_RULE_SETUP
1242 { return_to_state = define_state_2; BEGIN(define_generic_c_comment);}
1243 YY_BREAK
1244 case 47:
1245 YY_RULE_SETUP
1246 {
1247 BEGIN(define_generic_cpp_comment);
1248 _definition.clear();
1249 g_definition.Clear();
1250 RET_VAL(PP_COMPLEX_REPLACEMENT);
1251 }
1252 YY_BREAK
1253 case 48:
1254 YY_RULE_SETUP
1255 { BEGIN(define_state_signature); RET_VAL(((int)'(')); }
1256 YY_BREAK
1257 case 49:
1258 /* rule 49 can match eol */
1259 YY_RULE_SETUP
1260 { BEGIN(INITIAL); _definition.clear(); g_definition.Clear(); RET_VAL(PP_COMPLEX_REPLACEMENT);}
1261 YY_BREAK
1262 case 50:
1263 YY_RULE_SETUP
1264 { BEGIN(define_state_definition); _definition = pp_text;}
1265 YY_BREAK
1266 case 51:
1267 YY_RULE_SETUP
1268 { RET_VAL(PP_IDENTIFIER); }
1269 YY_BREAK
1270 case 52:
1271 YY_RULE_SETUP
1272 { RET_VAL(((int)*pp_text)); }
1273 YY_BREAK
1274 case 53:
1275 YY_RULE_SETUP
1276 { BEGIN(define_state_definition); _definition.clear(); g_definition.Clear(); RET_VAL(((int)*pp_text));}
1277 YY_BREAK
1278 case 54:
1279 YY_RULE_SETUP
1280 {}
1281 YY_BREAK
1282 case 55:
1283 YY_RULE_SETUP
1284 { return_to_state = define_state_definition; BEGIN(define_generic_c_comment);}
1285 YY_BREAK
1286 case 56:
1287 YY_RULE_SETUP
1288 {
1289 BEGIN(define_generic_cpp_comment);
1290 g_definition = wxString::From8BitData(_definition.c_str());
1291 RET_VAL(PP_COMPLEX_REPLACEMENT);
1292 }
1293 YY_BREAK
1294 case 57:
1295 /* rule 57 can match eol */
1296 YY_RULE_SETUP
1297 {}
1298 YY_BREAK
1299 case 58:
1300 /* rule 58 can match eol */
1301 YY_RULE_SETUP
1302 { BEGIN(INITIAL); g_definition = wxString::From8BitData(_definition.c_str()); RET_VAL(PP_COMPLEX_REPLACEMENT);}
1303 YY_BREAK
1304 case 59:
1305 YY_RULE_SETUP
1306 { _definition += " ";}
1307 YY_BREAK
1308 case 60:
1309 YY_RULE_SETUP
1310 {}
1311 YY_BREAK
1312 case 61:
1313 YY_RULE_SETUP
1314 { _definition += pp_text;}
1315 YY_BREAK
1316 case 62:
1317 YY_RULE_SETUP
1318 {}
1319 YY_BREAK
1320 case 63:
1321 /* rule 63 can match eol */
1322 YY_RULE_SETUP
1323 {BEGIN(INITIAL);}
1324 YY_BREAK
1325 case 64:
1326 YY_RULE_SETUP
1327 {}
1328 YY_BREAK
1329 case 65:
1330 YY_RULE_SETUP
1331 {
1332 BEGIN(return_to_state);
1333 }
1334 YY_BREAK
1335 case 66:
1336 YY_RULE_SETUP
1337 {}
1338 YY_BREAK
1339 case 67:
1340 /* rule 67 can match eol */
1341 YY_RULE_SETUP
1342 {
1343 BEGIN(INITIAL);
1344 }
1345 YY_BREAK
1346 case 68:
1347 YY_RULE_SETUP
1348 {}
1349 YY_BREAK
1350 case 69:
1351 /* rule 69 can match eol */
1352 YY_RULE_SETUP
1353 {
1354 BEGIN(INITIAL);
1355 }
1356 YY_BREAK
1357 case 70:
1358 YY_RULE_SETUP
1359 {} /* do nothing */
1360 YY_BREAK
1361 case 71:
1362 YY_RULE_SETUP
1363 {
1364 BEGIN(INITIAL);
1365 }
1366 YY_BREAK
1367 case 72:
1368 YY_RULE_SETUP
1369 {}
1370 YY_BREAK
1371 case YY_STATE_EOF(INITIAL):
1372 case YY_STATE_EOF(incl):
1373 case YY_STATE_EOF(c_comment):
1374 case YY_STATE_EOF(cpp_comment):
1375 case YY_STATE_EOF(using_namespace):
1376 case YY_STATE_EOF(PP):
1377 case YY_STATE_EOF(define_state):
1378 case YY_STATE_EOF(define_state_2):
1379 case YY_STATE_EOF(define_state_signature):
1380 case YY_STATE_EOF(define_state_definition):
1381 case YY_STATE_EOF(define_generic_c_comment):
1382 case YY_STATE_EOF(define_generic_cpp_comment):
1383 case YY_STATE_EOF(ifdef_state):
1384 case YY_STATE_EOF(if_state):
1385 {
1386 yyterminate();
1387 }
1388 YY_BREAK
1389 case 73:
1390 YY_RULE_SETUP
1391 ECHO;
1392 YY_BREAK
1393
1394 case YY_END_OF_BUFFER:
1395 {
1396 /* Amount of text matched not including the EOB char. */
1397 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1398
1399 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1400 *yy_cp = (yy_hold_char);
1401 YY_RESTORE_YY_MORE_OFFSET
1402
1403 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1404 {
1405 /* We're scanning a new file or input source. It's
1406 * possible that this happened because the user
1407 * just pointed pp_in at a new source and called
1408 * pp_lex(). If so, then we have to assure
1409 * consistency between YY_CURRENT_BUFFER and our
1410 * globals. Here is the right place to do so, because
1411 * this is the first action (other than possibly a
1412 * back-up) that will match for the new input source.
1413 */
1414 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1415 YY_CURRENT_BUFFER_LVALUE->yy_input_file = pp_in;
1416 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1417 }
1418
1419 /* Note that here we test for yy_c_buf_p "<=" to the position
1420 * of the first EOB in the buffer, since yy_c_buf_p will
1421 * already have been incremented past the NUL character
1422 * (since all states make transitions on EOB to the
1423 * end-of-buffer state). Contrast this with the test
1424 * in input().
1425 */
1426 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1427 { /* This was really a NUL. */
1428 yy_state_type yy_next_state;
1429
1430 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1431
1432 yy_current_state = yy_get_previous_state( );
1433
1434 /* Okay, we're now positioned to make the NUL
1435 * transition. We couldn't have
1436 * yy_get_previous_state() go ahead and do it
1437 * for us because it doesn't know how to deal
1438 * with the possibility of jamming (and we don't
1439 * want to build jamming into it because then it
1440 * will run more slowly).
1441 */
1442
1443 yy_next_state = yy_try_NUL_trans( yy_current_state );
1444
1445 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1446
1447 if ( yy_next_state )
1448 {
1449 /* Consume the NUL. */
1450 yy_cp = ++(yy_c_buf_p);
1451 yy_current_state = yy_next_state;
1452 goto yy_match;
1453 }
1454
1455 else
1456 {
1457 yy_cp = (yy_c_buf_p);
1458 goto yy_find_action;
1459 }
1460 }
1461
1462 else switch ( yy_get_next_buffer( ) )
1463 {
1464 case EOB_ACT_END_OF_FILE:
1465 {
1466 (yy_did_buffer_switch_on_eof) = 0;
1467
1468 if ( pp_wrap( ) )
1469 {
1470 /* Note: because we've taken care in
1471 * yy_get_next_buffer() to have set up
1472 * pp_text, we can now set up
1473 * yy_c_buf_p so that if some total
1474 * hoser (like flex itself) wants to
1475 * call the scanner after we return the
1476 * YY_NULL, it'll still work - another
1477 * YY_NULL will get returned.
1478 */
1479 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1480
1481 yy_act = YY_STATE_EOF(YY_START);
1482 goto do_action;
1483 }
1484
1485 else
1486 {
1487 if ( ! (yy_did_buffer_switch_on_eof) )
1488 YY_NEW_FILE;
1489 }
1490 break;
1491 }
1492
1493 case EOB_ACT_CONTINUE_SCAN:
1494 (yy_c_buf_p) =
1495 (yytext_ptr) + yy_amount_of_matched_text;
1496
1497 yy_current_state = yy_get_previous_state( );
1498
1499 yy_cp = (yy_c_buf_p);
1500 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1501 goto yy_match;
1502
1503 case EOB_ACT_LAST_MATCH:
1504 (yy_c_buf_p) =
1505 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1506
1507 yy_current_state = yy_get_previous_state( );
1508
1509 yy_cp = (yy_c_buf_p);
1510 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1511 goto yy_find_action;
1512 }
1513 break;
1514 }
1515
1516 default:
1517 YY_FATAL_ERROR(
1518 "fatal flex scanner internal error--no action found" );
1519 } /* end of action switch */
1520 } /* end of scanning one token */
1521 } /* end of pp_lex */
1522
1523 /* yy_get_next_buffer - try to read in a new buffer
1524 *
1525 * Returns a code representing an action:
1526 * EOB_ACT_LAST_MATCH -
1527 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1528 * EOB_ACT_END_OF_FILE - end of file
1529 */
1530 static int yy_get_next_buffer (void)
1531 {
1532 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1533 register char *source = (yytext_ptr);
1534 register int number_to_move, i;
1535 int ret_val;
1536
1537 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1538 YY_FATAL_ERROR(
1539 "fatal flex scanner internal error--end of buffer missed" );
1540
1541 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1542 { /* Don't try to fill the buffer, so this is an EOF. */
1543 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1544 {
1545 /* We matched a single character, the EOB, so
1546 * treat this as a final EOF.
1547 */
1548 return EOB_ACT_END_OF_FILE;
1549 }
1550
1551 else
1552 {
1553 /* We matched some text prior to the EOB, first
1554 * process it.
1555 */
1556 return EOB_ACT_LAST_MATCH;
1557 }
1558 }
1559
1560 /* Try to read more data. */
1561
1562 /* First move last chars to start of buffer. */
1563 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1564
1565 for ( i = 0; i < number_to_move; ++i )
1566 *(dest++) = *(source++);
1567
1568 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1569 /* don't do the read, it's not guaranteed to return an EOF,
1570 * just force an EOF
1571 */
1572 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1573
1574 else
1575 {
1576 int num_to_read =
1577 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1578
1579 while ( num_to_read <= 0 )
1580 { /* Not enough room in the buffer - grow it. */
1581
1582 /* just a shorter name for the current buffer */
1583 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1584
1585 int yy_c_buf_p_offset =
1586 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1587
1588 if ( b->yy_is_our_buffer )
1589 {
1590 int new_size = b->yy_buf_size * 2;
1591
1592 if ( new_size <= 0 )
1593 b->yy_buf_size += b->yy_buf_size / 8;
1594 else
1595 b->yy_buf_size *= 2;
1596
1597 b->yy_ch_buf = (char *)
1598 /* Include room in for 2 EOB chars. */
1599 pp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1600 }
1601 else
1602 /* Can't grow it, we don't own it. */
1603 b->yy_ch_buf = 0;
1604
1605 if ( ! b->yy_ch_buf )
1606 YY_FATAL_ERROR(
1607 "fatal error - scanner input buffer overflow" );
1608
1609 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1610
1611 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1612 number_to_move - 1;
1613
1614 }
1615
1616 if ( num_to_read > YY_READ_BUF_SIZE )
1617 num_to_read = YY_READ_BUF_SIZE;
1618
1619 /* Read in more data. */
1620 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1621 (yy_n_chars), (size_t) num_to_read );
1622
1623 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1624 }
1625
1626 if ( (yy_n_chars) == 0 )
1627 {
1628 if ( number_to_move == YY_MORE_ADJ )
1629 {
1630 ret_val = EOB_ACT_END_OF_FILE;
1631 pp_restart(pp_in );
1632 }
1633
1634 else
1635 {
1636 ret_val = EOB_ACT_LAST_MATCH;
1637 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1638 YY_BUFFER_EOF_PENDING;
1639 }
1640 }
1641
1642 else
1643 ret_val = EOB_ACT_CONTINUE_SCAN;
1644
1645 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1646 /* Extend the array by 50%, plus the number we really need. */
1647 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1648 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1649 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1650 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1651 }
1652
1653 (yy_n_chars) += number_to_move;
1654 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1655 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1656
1657 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1658
1659 return ret_val;
1660 }
1661
1662 /* yy_get_previous_state - get the state just before the EOB char was reached */
1663
1664 static yy_state_type yy_get_previous_state (void)
1665 {
1666 register yy_state_type yy_current_state;
1667 register char *yy_cp;
1668
1669 yy_current_state = (yy_start);
1670
1671 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1672 {
1673 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1674 if ( yy_accept[yy_current_state] )
1675 {
1676 (yy_last_accepting_state) = yy_current_state;
1677 (yy_last_accepting_cpos) = yy_cp;
1678 }
1679 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1680 {
1681 yy_current_state = (int) yy_def[yy_current_state];
1682 if ( yy_current_state >= 210 )
1683 yy_c = yy_meta[(unsigned int) yy_c];
1684 }
1685 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1686 }
1687
1688 return yy_current_state;
1689 }
1690
1691 /* yy_try_NUL_trans - try to make a transition on the NUL character
1692 *
1693 * synopsis
1694 * next_state = yy_try_NUL_trans( current_state );
1695 */
1696 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1697 {
1698 register int yy_is_jam;
1699 register char *yy_cp = (yy_c_buf_p);
1700
1701 register YY_CHAR yy_c = 1;
1702 if ( yy_accept[yy_current_state] )
1703 {
1704 (yy_last_accepting_state) = yy_current_state;
1705 (yy_last_accepting_cpos) = yy_cp;
1706 }
1707 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1708 {
1709 yy_current_state = (int) yy_def[yy_current_state];
1710 if ( yy_current_state >= 210 )
1711 yy_c = yy_meta[(unsigned int) yy_c];
1712 }
1713 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1714 yy_is_jam = (yy_current_state == 209);
1715
1716 return yy_is_jam ? 0 : yy_current_state;
1717 }
1718
1719 static void yyunput (int c, register char * yy_bp )
1720 {
1721 register char *yy_cp;
1722
1723 yy_cp = (yy_c_buf_p);
1724
1725 /* undo effects of setting up pp_text */
1726 *yy_cp = (yy_hold_char);
1727
1728 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1729 { /* need to shift things up to make room */
1730 /* +2 for EOB chars. */
1731 register int number_to_move = (yy_n_chars) + 2;
1732 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1733 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1734 register char *source =
1735 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1736
1737 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1738 *--dest = *--source;
1739
1740 yy_cp += (int) (dest - source);
1741 yy_bp += (int) (dest - source);
1742 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1743 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1744
1745 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1746 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1747 }
1748
1749 *--yy_cp = (char) c;
1750
1751 if ( c == '\n' ){
1752 --pp_lineno;
1753 }
1754
1755 (yytext_ptr) = yy_bp;
1756 (yy_hold_char) = *yy_cp;
1757 (yy_c_buf_p) = yy_cp;
1758 }
1759
1760 #ifndef YY_NO_INPUT
1761 #ifdef __cplusplus
1762 static int yyinput (void)
1763 #else
1764 static int input (void)
1765 #endif
1766
1767 {
1768 int c;
1769
1770 *(yy_c_buf_p) = (yy_hold_char);
1771
1772 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1773 {
1774 /* yy_c_buf_p now points to the character we want to return.
1775 * If this occurs *before* the EOB characters, then it's a
1776 * valid NUL; if not, then we've hit the end of the buffer.
1777 */
1778 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1779 /* This was really a NUL. */
1780 *(yy_c_buf_p) = '\0';
1781
1782 else
1783 { /* need more input */
1784 int offset = (yy_c_buf_p) - (yytext_ptr);
1785 ++(yy_c_buf_p);
1786
1787 switch ( yy_get_next_buffer( ) )
1788 {
1789 case EOB_ACT_LAST_MATCH:
1790 /* This happens because yy_g_n_b()
1791 * sees that we've accumulated a
1792 * token and flags that we need to
1793 * try matching the token before
1794 * proceeding. But for input(),
1795 * there's no matching to consider.
1796 * So convert the EOB_ACT_LAST_MATCH
1797 * to EOB_ACT_END_OF_FILE.
1798 */
1799
1800 /* Reset buffer status. */
1801 pp_restart(pp_in );
1802
1803 /*FALLTHROUGH*/
1804
1805 case EOB_ACT_END_OF_FILE:
1806 {
1807 if ( pp_wrap( ) )
1808 return EOF;
1809
1810 if ( ! (yy_did_buffer_switch_on_eof) )
1811 YY_NEW_FILE;
1812 #ifdef __cplusplus
1813 return yyinput();
1814 #else
1815 return input();
1816 #endif
1817 }
1818
1819 case EOB_ACT_CONTINUE_SCAN:
1820 (yy_c_buf_p) = (yytext_ptr) + offset;
1821 break;
1822 }
1823 }
1824 }
1825
1826 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1827 *(yy_c_buf_p) = '\0'; /* preserve pp_text */
1828 (yy_hold_char) = *++(yy_c_buf_p);
1829
1830 if ( c == '\n' )
1831
1832 pp_lineno++;
1833 ;
1834
1835 return c;
1836 }
1837 #endif /* ifndef YY_NO_INPUT */
1838
1839 /** Immediately switch to a different input stream.
1840 * @param input_file A readable stream.
1841 *
1842 * @note This function does not reset the start condition to @c INITIAL .
1843 */
1844 void pp_restart (FILE * input_file )
1845 {
1846
1847 if ( ! YY_CURRENT_BUFFER ){
1848 pp_ensure_buffer_stack ();
1849 YY_CURRENT_BUFFER_LVALUE =
1850 pp__create_buffer(pp_in,YY_BUF_SIZE );
1851 }
1852
1853 pp__init_buffer(YY_CURRENT_BUFFER,input_file );
1854 pp__load_buffer_state( );
1855 }
1856
1857 /** Switch to a different input buffer.
1858 * @param new_buffer The new input buffer.
1859 *
1860 */
1861 void pp__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1862 {
1863
1864 /* TODO. We should be able to replace this entire function body
1865 * with
1866 * pp_pop_buffer_state();
1867 * pp_push_buffer_state(new_buffer);
1868 */
1869 pp_ensure_buffer_stack ();
1870 if ( YY_CURRENT_BUFFER == new_buffer )
1871 return;
1872
1873 if ( YY_CURRENT_BUFFER )
1874 {
1875 /* Flush out information for old buffer. */
1876 *(yy_c_buf_p) = (yy_hold_char);
1877 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1878 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1879 }
1880
1881 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1882 pp__load_buffer_state( );
1883
1884 /* We don't actually know whether we did this switch during
1885 * EOF (pp_wrap()) processing, but the only time this flag
1886 * is looked at is after pp_wrap() is called, so it's safe
1887 * to go ahead and always set it.
1888 */
1889 (yy_did_buffer_switch_on_eof) = 1;
1890 }
1891
1892 static void pp__load_buffer_state (void)
1893 {
1894 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1895 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1896 pp_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1897 (yy_hold_char) = *(yy_c_buf_p);
1898 }
1899
1900 /** Allocate and initialize an input buffer state.
1901 * @param file A readable stream.
1902 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1903 *
1904 * @return the allocated buffer state.
1905 */
1906 YY_BUFFER_STATE pp__create_buffer (FILE * file, int size )
1907 {
1908 YY_BUFFER_STATE b;
1909
1910 b = (YY_BUFFER_STATE) pp_alloc(sizeof( struct yy_buffer_state ) );
1911 if ( ! b )
1912 YY_FATAL_ERROR( "out of dynamic memory in pp__create_buffer()" );
1913
1914 b->yy_buf_size = size;
1915
1916 /* yy_ch_buf has to be 2 characters longer than the size given because
1917 * we need to put in 2 end-of-buffer characters.
1918 */
1919 b->yy_ch_buf = (char *) pp_alloc(b->yy_buf_size + 2 );
1920 if ( ! b->yy_ch_buf )
1921 YY_FATAL_ERROR( "out of dynamic memory in pp__create_buffer()" );
1922
1923 b->yy_is_our_buffer = 1;
1924
1925 pp__init_buffer(b,file );
1926
1927 return b;
1928 }
1929
1930 /** Destroy the buffer.
1931 * @param b a buffer created with pp__create_buffer()
1932 *
1933 */
1934 void pp__delete_buffer (YY_BUFFER_STATE b )
1935 {
1936
1937 if ( ! b )
1938 return;
1939
1940 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1941 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1942
1943 if ( b->yy_is_our_buffer )
1944 pp_free((void *) b->yy_ch_buf );
1945
1946 pp_free((void *) b );
1947 }
1948
1949 #ifndef __cplusplus
1950 extern int isatty (int );
1951 #endif /* __cplusplus */
1952
1953 /* Initializes or reinitializes a buffer.
1954 * This function is sometimes called more than once on the same buffer,
1955 * such as during a pp_restart() or at EOF.
1956 */
1957 static void pp__init_buffer (YY_BUFFER_STATE b, FILE * file )
1958
1959 {
1960 int oerrno = errno;
1961
1962 pp__flush_buffer(b );
1963
1964 b->yy_input_file = file;
1965 b->yy_fill_buffer = 1;
1966
1967 /* If b is the current buffer, then pp__init_buffer was _probably_
1968 * called from pp_restart() or through yy_get_next_buffer.
1969 * In that case, we don't want to reset the lineno or column.
1970 */
1971 if (b != YY_CURRENT_BUFFER){
1972 b->yy_bs_lineno = 1;
1973 b->yy_bs_column = 0;
1974 }
1975
1976 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1977
1978 errno = oerrno;
1979 }
1980
1981 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1982 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1983 *
1984 */
1985 void pp__flush_buffer (YY_BUFFER_STATE b )
1986 {
1987 if ( ! b )
1988 return;
1989
1990 b->yy_n_chars = 0;
1991
1992 /* We always need two end-of-buffer characters. The first causes
1993 * a transition to the end-of-buffer state. The second causes
1994 * a jam in that state.
1995 */
1996 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1997 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1998
1999 b->yy_buf_pos = &b->yy_ch_buf[0];
2000
2001 b->yy_at_bol = 1;
2002 b->yy_buffer_status = YY_BUFFER_NEW;
2003
2004 if ( b == YY_CURRENT_BUFFER )
2005 pp__load_buffer_state( );
2006 }
2007
2008 /** Pushes the new state onto the stack. The new state becomes
2009 * the current state. This function will allocate the stack
2010 * if necessary.
2011 * @param new_buffer The new state.
2012 *
2013 */
2014 void pp_push_buffer_state (YY_BUFFER_STATE new_buffer )
2015 {
2016 if (new_buffer == NULL)
2017 return;
2018
2019 pp_ensure_buffer_stack();
2020
2021 /* This block is copied from pp__switch_to_buffer. */
2022 if ( YY_CURRENT_BUFFER )
2023 {
2024 /* Flush out information for old buffer. */
2025 *(yy_c_buf_p) = (yy_hold_char);
2026 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2027 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2028 }
2029
2030 /* Only push if top exists. Otherwise, replace top. */
2031 if (YY_CURRENT_BUFFER)
2032 (yy_buffer_stack_top)++;
2033 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2034
2035 /* copied from pp__switch_to_buffer. */
2036 pp__load_buffer_state( );
2037 (yy_did_buffer_switch_on_eof) = 1;
2038 }
2039
2040 /** Removes and deletes the top of the stack, if present.
2041 * The next element becomes the new top.
2042 *
2043 */
2044 void pp_pop_buffer_state (void)
2045 {
2046 if (!YY_CURRENT_BUFFER)
2047 return;
2048
2049 pp__delete_buffer(YY_CURRENT_BUFFER );
2050 YY_CURRENT_BUFFER_LVALUE = NULL;
2051 if ((yy_buffer_stack_top) > 0)
2052 --(yy_buffer_stack_top);
2053
2054 if (YY_CURRENT_BUFFER) {
2055 pp__load_buffer_state( );
2056 (yy_did_buffer_switch_on_eof) = 1;
2057 }
2058 }
2059
2060 /* Allocates the stack if it does not exist.
2061 * Guarantees space for at least one push.
2062 */
2063 static void pp_ensure_buffer_stack (void)
2064 {
2065 int num_to_alloc;
2066
2067 if (!(yy_buffer_stack)) {
2068
2069 /* First allocation is just for 2 elements, since we don't know if this
2070 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2071 * immediate realloc on the next call.
2072 */
2073 num_to_alloc = 1;
2074 (yy_buffer_stack) = (struct yy_buffer_state**)pp_alloc
2075 (num_to_alloc * sizeof(struct yy_buffer_state*)
2076 );
2077 if ( ! (yy_buffer_stack) )
2078 YY_FATAL_ERROR( "out of dynamic memory in pp_ensure_buffer_stack()" );
2079
2080 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2081
2082 (yy_buffer_stack_max) = num_to_alloc;
2083 (yy_buffer_stack_top) = 0;
2084 return;
2085 }
2086
2087 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2088
2089 /* Increase the buffer to prepare for a possible push. */
2090 int grow_size = 8 /* arbitrary grow size */;
2091
2092 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2093 (yy_buffer_stack) = (struct yy_buffer_state**)pp_realloc
2094 ((yy_buffer_stack),
2095 num_to_alloc * sizeof(struct yy_buffer_state*)
2096 );
2097 if ( ! (yy_buffer_stack) )
2098 YY_FATAL_ERROR( "out of dynamic memory in pp_ensure_buffer_stack()" );
2099
2100 /* zero only the new slots.*/
2101 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2102 (yy_buffer_stack_max) = num_to_alloc;
2103 }
2104 }
2105
2106 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2107 * @param base the character buffer
2108 * @param size the size in bytes of the character buffer
2109 *
2110 * @return the newly allocated buffer state object.
2111 */
2112 YY_BUFFER_STATE pp__scan_buffer (char * base, yy_size_t size )
2113 {
2114 YY_BUFFER_STATE b;
2115
2116 if ( size < 2 ||
2117 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2118 base[size-1] != YY_END_OF_BUFFER_CHAR )
2119 /* They forgot to leave room for the EOB's. */
2120 return 0;
2121
2122 b = (YY_BUFFER_STATE) pp_alloc(sizeof( struct yy_buffer_state ) );
2123 if ( ! b )
2124 YY_FATAL_ERROR( "out of dynamic memory in pp__scan_buffer()" );
2125
2126 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2127 b->yy_buf_pos = b->yy_ch_buf = base;
2128 b->yy_is_our_buffer = 0;
2129 b->yy_input_file = 0;
2130 b->yy_n_chars = b->yy_buf_size;
2131 b->yy_is_interactive = 0;
2132 b->yy_at_bol = 1;
2133 b->yy_fill_buffer = 0;
2134 b->yy_buffer_status = YY_BUFFER_NEW;
2135
2136 pp__switch_to_buffer(b );
2137
2138 return b;
2139 }
2140
2141 /** Setup the input buffer state to scan a string. The next call to pp_lex() will
2142 * scan from a @e copy of @a str.
2143 * @param yystr a NUL-terminated string to scan
2144 *
2145 * @return the newly allocated buffer state object.
2146 * @note If you want to scan bytes that may contain NUL values, then use
2147 * pp__scan_bytes() instead.
2148 */
2149 YY_BUFFER_STATE pp__scan_string (yyconst char * yystr )
2150 {
2151
2152 return pp__scan_bytes(yystr,strlen(yystr) );
2153 }
2154
2155 /** Setup the input buffer state to scan the given bytes. The next call to pp_lex() will
2156 * scan from a @e copy of @a bytes.
2157 * @param yybytes the byte buffer to scan
2158 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2159 *
2160 * @return the newly allocated buffer state object.
2161 */
2162 YY_BUFFER_STATE pp__scan_bytes (yyconst char * yybytes, int _yybytes_len )
2163 {
2164 YY_BUFFER_STATE b;
2165 char *buf;
2166 yy_size_t n;
2167 int i;
2168
2169 /* Get memory for full buffer, including space for trailing EOB's. */
2170 n = _yybytes_len + 2;
2171 buf = (char *) pp_alloc(n );
2172 if ( ! buf )
2173 YY_FATAL_ERROR( "out of dynamic memory in pp__scan_bytes()" );
2174
2175 for ( i = 0; i < _yybytes_len; ++i )
2176 buf[i] = yybytes[i];
2177
2178 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2179
2180 b = pp__scan_buffer(buf,n );
2181 if ( ! b )
2182 YY_FATAL_ERROR( "bad buffer in pp__scan_bytes()" );
2183
2184 /* It's okay to grow etc. this buffer, and we should throw it
2185 * away when we're done.
2186 */
2187 b->yy_is_our_buffer = 1;
2188
2189 return b;
2190 }
2191
2192 #ifndef YY_EXIT_FAILURE
2193 #define YY_EXIT_FAILURE 2
2194 #endif
2195
2196 static void yy_fatal_error (yyconst char* msg )
2197 {
2198 (void) fprintf( stderr, "%s\n", msg );
2199
2200 }
2201
2202 /* Redefine yyless() so it works in section 3 code. */
2203
2204 #undef yyless
2205 #define yyless(n) \
2206 do \
2207 { \
2208 /* Undo effects of setting up pp_text. */ \
2209 int yyless_macro_arg = (n); \
2210 YY_LESS_LINENO(yyless_macro_arg);\
2211 pp_text[pp_leng] = (yy_hold_char); \
2212 (yy_c_buf_p) = pp_text + yyless_macro_arg; \
2213 (yy_hold_char) = *(yy_c_buf_p); \
2214 *(yy_c_buf_p) = '\0'; \
2215 pp_leng = yyless_macro_arg; \
2216 } \
2217 while ( 0 )
2218
2219 /* Accessor methods (get/set functions) to struct members. */
2220
2221 /** Get the current line number.
2222 *
2223 */
2224 int pp_get_lineno (void)
2225 {
2226
2227 return pp_lineno;
2228 }
2229
2230 /** Get the input stream.
2231 *
2232 */
2233 FILE *pp_get_in (void)
2234 {
2235 return pp_in;
2236 }
2237
2238 /** Get the output stream.
2239 *
2240 */
2241 FILE *pp_get_out (void)
2242 {
2243 return pp_out;
2244 }
2245
2246 /** Get the length of the current token.
2247 *
2248 */
2249 int pp_get_leng (void)
2250 {
2251 return pp_leng;
2252 }
2253
2254 /** Get the current token.
2255 *
2256 */
2257
2258 char *pp_get_text (void)
2259 {
2260 return pp_text;
2261 }
2262
2263 /** Set the current line number.
2264 * @param line_number
2265 *
2266 */
2267 void pp_set_lineno (int line_number )
2268 {
2269
2270 pp_lineno = line_number;
2271 }
2272
2273 /** Set the input stream. This does not discard the current
2274 * input buffer.
2275 * @param in_str A readable stream.
2276 *
2277 * @see pp__switch_to_buffer
2278 */
2279 void pp_set_in (FILE * in_str )
2280 {
2281 pp_in = in_str ;
2282 }
2283
2284 void pp_set_out (FILE * out_str )
2285 {
2286 pp_out = out_str ;
2287 }
2288
2289 int pp_get_debug (void)
2290 {
2291 return pp__flex_debug;
2292 }
2293
2294 void pp_set_debug (int bdebug )
2295 {
2296 pp__flex_debug = bdebug ;
2297 }
2298
2299 static int yy_init_globals (void)
2300 {
2301 /* Initialization is the same as for the non-reentrant scanner.
2302 * This function is called from pp_lex_destroy(), so don't allocate here.
2303 */
2304
2305 /* We do not touch pp_lineno unless the option is enabled. */
2306 pp_lineno = 1;
2307
2308 (yy_buffer_stack) = 0;
2309 (yy_buffer_stack_top) = 0;
2310 (yy_buffer_stack_max) = 0;
2311 (yy_c_buf_p) = (char *) 0;
2312 (yy_init) = 0;
2313 (yy_start) = 0;
2314
2315 /* Defined in main.c */
2316 #ifdef YY_STDINIT
2317 pp_in = stdin;
2318 pp_out = stdout;
2319 #else
2320 pp_in = (FILE *) 0;
2321 pp_out = (FILE *) 0;
2322 #endif
2323
2324 /* For future reference: Set errno on error, since we are called by
2325 * pp_lex_init()
2326 */
2327 return 0;
2328 }
2329
2330 /* pp_lex_destroy is for both reentrant and non-reentrant scanners. */
2331 int pp_lex_destroy (void)
2332 {
2333
2334 /* Pop the buffer stack, destroying each element. */
2335 while(YY_CURRENT_BUFFER){
2336 pp__delete_buffer(YY_CURRENT_BUFFER );
2337 YY_CURRENT_BUFFER_LVALUE = NULL;
2338 pp_pop_buffer_state();
2339 }
2340
2341 /* Destroy the stack itself. */
2342 pp_free((yy_buffer_stack) );
2343 (yy_buffer_stack) = NULL;
2344
2345 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2346 * pp_lex() is called, initialization will occur. */
2347 yy_init_globals( );
2348
2349 return 0;
2350 }
2351
2352 /*
2353 * Internal utility routines.
2354 */
2355
2356 #ifndef yytext_ptr
2357 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2358 {
2359 register int i;
2360 for ( i = 0; i < n; ++i )
2361 s1[i] = s2[i];
2362 }
2363 #endif
2364
2365 #ifdef YY_NEED_STRLEN
2366 static int yy_flex_strlen (yyconst char * s )
2367 {
2368 register int n;
2369 for ( n = 0; s[n]; ++n )
2370 ;
2371
2372 return n;
2373 }
2374 #endif
2375
2376 void *pp_alloc (yy_size_t size )
2377 {
2378 return (void *) malloc( size );
2379 }
2380
2381 void *pp_realloc (void * ptr, yy_size_t size )
2382 {
2383 /* The cast to (char *) in the following accommodates both
2384 * implementations that use char* generic pointers, and those
2385 * that use void* generic pointers. It works with the latter
2386 * because both ANSI C and C++ allow castless assignment from
2387 * any pointer type to void*, and deal with argument conversions
2388 * as though doing an assignment.
2389 */
2390 return (void *) realloc( (char *) ptr, size );
2391 }
2392
2393 void pp_free (void * ptr )
2394 {
2395 free( (char *) ptr ); /* see pp_realloc() for (char *) cast */
2396 }
2397
2398 #define YYTABLES_NAME "yytables"
2399
2400 int pp_wrap() {
2401 return 1;
2402 }
2403
2404 int PPScan( const wxString &filePath, bool forCC )
2405 {
2406 g_filename = filePath;
2407
2408 BEGIN INITIAL;
2409 pp_lineno = 1;
2410 FILE* fp = fopen(filePath.To8BitData(), "r");
2411 if ( fp == NULL ) {
2412 //printf("%s\n", strerror(errno));
2413 // failed to open input file...
2414 return -1;
2415 }
2416
2417 pp__switch_to_buffer(pp__create_buffer(fp,YY_BUF_SIZE) );
2418 pp_in = fp;
2419 g_forCC = forCC;
2420 int rc = pp_parse();
2421 g_forCC = false;
2422
2423 if ( YY_CURRENT_BUFFER->yy_input_file ) {
2424 fclose( YY_CURRENT_BUFFER->yy_input_file );
2425 YY_CURRENT_BUFFER->yy_input_file = NULL;
2426
2427 }
2428
2429 pp__delete_buffer ( YY_CURRENT_BUFFER );
2430 yyterminate();
2431 return rc;
2432 }
2433
2434 int PPLex( const wxString &filePath)
2435 {
2436 g_filename = filePath;
2437
2438 BEGIN INITIAL;
2439 pp_lineno = 1;
2440 FILE* fp = fopen(filePath.To8BitData(), "r");
2441 if ( fp == NULL ) {
2442 return -1;
2443 }
2444
2445 pp__switch_to_buffer(pp__create_buffer(fp,YY_BUF_SIZE) );
2446 pp_in = fp;
2447 g_forCC = false;
2448 int type = 0;
2449 while( true ) {
2450 type = pp_lex();
2451 if(type == 0) break;
2452 //printf("%s, %d\n", pp_lval.c_str(), type);
2453 }
2454
2455 if ( YY_CURRENT_BUFFER->yy_input_file ) {
2456 fclose( YY_CURRENT_BUFFER->yy_input_file );
2457 YY_CURRENT_BUFFER->yy_input_file = NULL;
2458
2459 }
2460
2461 pp__delete_buffer ( YY_CURRENT_BUFFER );
2462 return type;
2463 }
2464
2465 int PPScanString( const wxString &inputString )
2466 {
2467 BEGIN INITIAL;
2468 pp__scan_string(inputString.To8BitData() );
2469 pp_lineno = 1;
2470
2471 int rc = pp_parse();
2472
2473 yyterminate();
2474 return rc;
2475 }
2476
2477 void pp_error(char* st)
2478 {
2479 }
2480