[MKHIVE] Minor improvements.
[reactos.git] / sdk / tools / wpp / ppl.yy.c
1 #line 2 "ppl.yy.c"
2 #line 125 "ppl.l"
3 #include "config.h"
4 #include "wine/port.h"
5
6
7
8 #line 9 "ppl.yy.c"
9
10 #define YY_INT_ALIGNED short int
11
12 /* A lexical scanner generated by flex */
13
14 #define yy_create_buffer ppy__create_buffer
15 #define yy_delete_buffer ppy__delete_buffer
16 #define yy_flex_debug ppy__flex_debug
17 #define yy_init_buffer ppy__init_buffer
18 #define yy_flush_buffer ppy__flush_buffer
19 #define yy_load_buffer_state ppy__load_buffer_state
20 #define yy_switch_to_buffer ppy__switch_to_buffer
21 #define yyin ppy_in
22 #define yyleng ppy_leng
23 #define yylex ppy_lex
24 #define yylineno ppy_lineno
25 #define yyout ppy_out
26 #define yyrestart ppy_restart
27 #define yytext ppy_text
28 #define yywrap ppy_wrap
29 #define yyalloc ppy_alloc
30 #define yyrealloc ppy_realloc
31 #define yyfree ppy_free
32
33 #define FLEX_SCANNER
34 #define YY_FLEX_MAJOR_VERSION 2
35 #define YY_FLEX_MINOR_VERSION 5
36 #define YY_FLEX_SUBMINOR_VERSION 35
37 #if YY_FLEX_SUBMINOR_VERSION > 0
38 #define FLEX_BETA
39 #endif
40
41 /* First, we deal with platform-specific or compiler-specific issues. */
42
43 /* begin standard C headers. */
44 #include <stdio.h>
45 #include <string.h>
46 #include <errno.h>
47 #include <stdlib.h>
48
49 /* end standard C headers. */
50
51 /* flex integer type definitions */
52
53 #ifndef FLEXINT_H
54 #define FLEXINT_H
55
56 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
57
58 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
59
60 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
61 * if you want the limit (max/min) macros for int types.
62 */
63 #ifndef __STDC_LIMIT_MACROS
64 #define __STDC_LIMIT_MACROS 1
65 #endif
66
67 #include <inttypes.h>
68 typedef int8_t flex_int8_t;
69 typedef uint8_t flex_uint8_t;
70 typedef int16_t flex_int16_t;
71 typedef uint16_t flex_uint16_t;
72 typedef int32_t flex_int32_t;
73 typedef uint32_t flex_uint32_t;
74 #else
75 typedef signed char flex_int8_t;
76 typedef short int flex_int16_t;
77 typedef int flex_int32_t;
78 typedef unsigned char flex_uint8_t;
79 typedef unsigned short int flex_uint16_t;
80 typedef unsigned int flex_uint32_t;
81
82 /* Limits of integral types. */
83 #ifndef INT8_MIN
84 #define INT8_MIN (-128)
85 #endif
86 #ifndef INT16_MIN
87 #define INT16_MIN (-32767-1)
88 #endif
89 #ifndef INT32_MIN
90 #define INT32_MIN (-2147483647-1)
91 #endif
92 #ifndef INT8_MAX
93 #define INT8_MAX (127)
94 #endif
95 #ifndef INT16_MAX
96 #define INT16_MAX (32767)
97 #endif
98 #ifndef INT32_MAX
99 #define INT32_MAX (2147483647)
100 #endif
101 #ifndef UINT8_MAX
102 #define UINT8_MAX (255U)
103 #endif
104 #ifndef UINT16_MAX
105 #define UINT16_MAX (65535U)
106 #endif
107 #ifndef UINT32_MAX
108 #define UINT32_MAX (4294967295U)
109 #endif
110
111 #endif /* ! C99 */
112
113 #endif /* ! FLEXINT_H */
114
115 #ifdef __cplusplus
116
117 /* The "const" storage-class-modifier is valid. */
118 #define YY_USE_CONST
119
120 #else /* ! __cplusplus */
121
122 /* C99 requires __STDC__ to be defined as 1. */
123 #if defined (__STDC__)
124
125 #define YY_USE_CONST
126
127 #endif /* defined (__STDC__) */
128 #endif /* ! __cplusplus */
129
130 #ifdef YY_USE_CONST
131 #define yyconst const
132 #else
133 #define yyconst
134 #endif
135
136 /* Returned upon end-of-file. */
137 #define YY_NULL 0
138
139 /* Promotes a possibly negative, possibly signed char to an unsigned
140 * integer for use as an array index. If the signed char is negative,
141 * we want to instead treat it as an 8-bit unsigned char, hence the
142 * double cast.
143 */
144 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
145
146 /* Enter a start condition. This macro really ought to take a parameter,
147 * but we do it the disgusting crufty way forced on us by the ()-less
148 * definition of BEGIN.
149 */
150 #define BEGIN (yy_start) = 1 + 2 *
151
152 /* Translate the current start state into a value that can be later handed
153 * to BEGIN to return to the state. The YYSTATE alias is for lex
154 * compatibility.
155 */
156 #define YY_START (((yy_start) - 1) / 2)
157 #define YYSTATE YY_START
158
159 /* Action number for EOF rule of a given start state. */
160 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
161
162 /* Special action meaning "start processing a new file". */
163 #define YY_NEW_FILE ppy_restart(ppy_in )
164
165 #define YY_END_OF_BUFFER_CHAR 0
166
167 /* Size of default input buffer. */
168 #ifndef YY_BUF_SIZE
169 #ifdef __ia64__
170 /* On IA-64, the buffer size is 16k, not 8k.
171 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
172 * Ditto for the __ia64__ case accordingly.
173 */
174 #define YY_BUF_SIZE 32768
175 #else
176 #define YY_BUF_SIZE 16384
177 #endif /* __ia64__ */
178 #endif
179
180 /* The state buf must be large enough to hold one state per character in the main buffer.
181 */
182 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
183
184 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
185 #define YY_TYPEDEF_YY_BUFFER_STATE
186 typedef struct yy_buffer_state *YY_BUFFER_STATE;
187 #endif
188
189 extern int ppy_leng;
190
191 extern FILE *ppy_in, *ppy_out;
192
193 #define EOB_ACT_CONTINUE_SCAN 0
194 #define EOB_ACT_END_OF_FILE 1
195 #define EOB_ACT_LAST_MATCH 2
196
197 #define YY_LESS_LINENO(n)
198
199 /* Return all but the first "n" matched characters back to the input stream. */
200 #define yyless(n) \
201 do \
202 { \
203 /* Undo effects of setting up ppy_text. */ \
204 int yyless_macro_arg = (n); \
205 YY_LESS_LINENO(yyless_macro_arg);\
206 *yy_cp = (yy_hold_char); \
207 YY_RESTORE_YY_MORE_OFFSET \
208 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
209 YY_DO_BEFORE_ACTION; /* set up ppy_text again */ \
210 } \
211 while ( 0 )
212
213 #define unput(c) yyunput( c, (yytext_ptr) )
214
215 #ifndef YY_TYPEDEF_YY_SIZE_T
216 #define YY_TYPEDEF_YY_SIZE_T
217 typedef size_t yy_size_t;
218 #endif
219
220 #ifndef YY_STRUCT_YY_BUFFER_STATE
221 #define YY_STRUCT_YY_BUFFER_STATE
222 struct yy_buffer_state
223 {
224 FILE *yy_input_file;
225
226 char *yy_ch_buf; /* input buffer */
227 char *yy_buf_pos; /* current position in input buffer */
228
229 /* Size of input buffer in bytes, not including room for EOB
230 * characters.
231 */
232 yy_size_t yy_buf_size;
233
234 /* Number of characters read into yy_ch_buf, not including EOB
235 * characters.
236 */
237 int yy_n_chars;
238
239 /* Whether we "own" the buffer - i.e., we know we created it,
240 * and can realloc() it to grow it, and should free() it to
241 * delete it.
242 */
243 int yy_is_our_buffer;
244
245 /* Whether this is an "interactive" input source; if so, and
246 * if we're using stdio for input, then we want to use getc()
247 * instead of fread(), to make sure we stop fetching input after
248 * each newline.
249 */
250 int yy_is_interactive;
251
252 /* Whether we're considered to be at the beginning of a line.
253 * If so, '^' rules will be active on the next match, otherwise
254 * not.
255 */
256 int yy_at_bol;
257
258 int yy_bs_lineno; /**< The line count. */
259 int yy_bs_column; /**< The column count. */
260
261 /* Whether to try to fill the input buffer when we reach the
262 * end of it.
263 */
264 int yy_fill_buffer;
265
266 int yy_buffer_status;
267
268 #define YY_BUFFER_NEW 0
269 #define YY_BUFFER_NORMAL 1
270 /* When an EOF's been seen but there's still some text to process
271 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
272 * shouldn't try reading from the input source any more. We might
273 * still have a bunch of tokens to match, though, because of
274 * possible backing-up.
275 *
276 * When we actually see the EOF, we change the status to "new"
277 * (via ppy_restart()), so that the user can continue scanning by
278 * just pointing ppy_in at a new input file.
279 */
280 #define YY_BUFFER_EOF_PENDING 2
281
282 };
283 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
284
285 /* Stack of input buffers. */
286 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
287 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
288 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
289
290 /* We provide macros for accessing buffer states in case in the
291 * future we want to put the buffer states in a more general
292 * "scanner state".
293 *
294 * Returns the top of the stack, or NULL.
295 */
296 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
297 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
298 : NULL)
299
300 /* Same as previous macro, but useful when we know that the buffer stack is not
301 * NULL or when we need an lvalue. For internal use only.
302 */
303 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
304
305 /* yy_hold_char holds the character lost when ppy_text is formed. */
306 static char yy_hold_char;
307 static int yy_n_chars; /* number of characters read into yy_ch_buf */
308 int ppy_leng;
309
310 /* Points to current character in buffer. */
311 static char *yy_c_buf_p = (char *) 0;
312 static int yy_init = 0; /* whether we need to initialize */
313 static int yy_start = 0; /* start state number */
314
315 /* Flag which is used to allow ppy_wrap()'s to do buffer switches
316 * instead of setting up a fresh ppy_in. A bit of a hack ...
317 */
318 static int yy_did_buffer_switch_on_eof;
319
320 void ppy_restart (FILE *input_file );
321 void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer );
322 YY_BUFFER_STATE ppy__create_buffer (FILE *file,int size );
323 void ppy__delete_buffer (YY_BUFFER_STATE b );
324 void ppy__flush_buffer (YY_BUFFER_STATE b );
325 void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer );
326 void ppy_pop_buffer_state (void );
327
328 static void ppy_ensure_buffer_stack (void );
329 static void ppy__load_buffer_state (void );
330 static void ppy__init_buffer (YY_BUFFER_STATE b,FILE *file );
331
332 #define YY_FLUSH_BUFFER ppy__flush_buffer(YY_CURRENT_BUFFER )
333
334 YY_BUFFER_STATE ppy__scan_buffer (char *base,yy_size_t size );
335 YY_BUFFER_STATE ppy__scan_string (yyconst char *yy_str );
336 YY_BUFFER_STATE ppy__scan_bytes (yyconst char *bytes,int len );
337
338 void *ppy_alloc (yy_size_t );
339 void *ppy_realloc (void *,yy_size_t );
340 void ppy_free (void * );
341
342 #define yy_new_buffer ppy__create_buffer
343
344 #define yy_set_interactive(is_interactive) \
345 { \
346 if ( ! YY_CURRENT_BUFFER ){ \
347 ppy_ensure_buffer_stack (); \
348 YY_CURRENT_BUFFER_LVALUE = \
349 ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \
350 } \
351 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
352 }
353
354 #define yy_set_bol(at_bol) \
355 { \
356 if ( ! YY_CURRENT_BUFFER ){\
357 ppy_ensure_buffer_stack (); \
358 YY_CURRENT_BUFFER_LVALUE = \
359 ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \
360 } \
361 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
362 }
363
364 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
365
366 /* Begin user sect3 */
367
368 typedef unsigned char YY_CHAR;
369
370 FILE *ppy_in = (FILE *) 0, *ppy_out = (FILE *) 0;
371
372 typedef int yy_state_type;
373
374 extern int ppy_lineno;
375
376 int ppy_lineno = 1;
377
378 extern char *ppy_text;
379 #define yytext_ptr ppy_text
380
381 static yy_state_type yy_get_previous_state (void );
382 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
383 static int yy_get_next_buffer (void );
384 static void yy_fatal_error (yyconst char msg[] );
385
386 /* Done after the current pattern has been matched and before the
387 * corresponding action - sets up ppy_text.
388 */
389 #define YY_DO_BEFORE_ACTION \
390 (yytext_ptr) = yy_bp; \
391 ppy_leng = (size_t) (yy_cp - yy_bp); \
392 (yy_hold_char) = *yy_cp; \
393 *yy_cp = '\0'; \
394 (yy_c_buf_p) = yy_cp;
395
396 #define YY_NUM_RULES 143
397 #define YY_END_OF_BUFFER 144
398 /* This struct is not used in this scanner,
399 but its presence is necessary. */
400 struct yy_trans_info
401 {
402 flex_int32_t yy_verify;
403 flex_int32_t yy_nxt;
404 };
405 static yyconst flex_int16_t yy_accept[416] =
406 { 0,
407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
408 0, 0, 0, 0, 117, 117, 0, 0, 0, 0,
409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
410 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
411 0, 0, 0, 0, 144, 133, 134, 135, 121, 142,
412 122, 133, 132, 133, 134, 1, 21, 16, 18, 16,
413 21, 20, 17, 17, 17, 17, 17, 17, 17, 17,
414 68, 71, 69, 70, 28, 25, 26, 24, 28, 23,
415 28, 28, 123, 131, 124, 142, 125, 126, 142, 127,
416 128, 117, 118, 117, 77, 75, 77, 77, 74, 77,
417
418 78, 82, 84, 83, 142, 79, 90, 86, 90, 85,
419 88, 90, 90, 87, 90, 92, 100, 102, 95, 101,
420 97, 96, 93, 97, 92, 106, 106, 104, 103, 106,
421 114, 113, 110, 111, 107, 108, 109, 114, 114, 133,
422 134, 138, 121, 138, 122, 133, 132, 133, 53, 50,
423 47, 53, 52, 53, 51, 53, 33, 35, 53, 53,
424 53, 53, 49, 53, 53, 58, 55, 56, 58, 54,
425 58, 62, 59, 60, 62, 62, 22, 67, 64, 67,
426 65, 67, 63, 67, 29, 30, 32, 32, 32, 29,
427 1, 140, 143, 141, 139, 139, 133, 134, 133, 116,
428
429 120, 132, 136, 137, 134, 1, 16, 17, 17, 17,
430 17, 17, 17, 17, 17, 18, 19, 20, 17, 17,
431 17, 17, 17, 11, 17, 17, 17, 17, 17, 68,
432 69, 70, 72, 70, 25, 27, 28, 123, 130, 129,
433 130, 125, 127, 117, 117, 117, 119, 75, 73, 74,
434 76, 77, 78, 79, 81, 79, 86, 85, 90, 87,
435 91, 90, 92, 94, 97, 96, 96, 93, 99, 97,
436 92, 106, 104, 103, 106, 105, 106, 114, 114, 112,
437 115, 114, 133, 138, 138, 50, 44, 41, 33, 34,
438 33, 33, 37, 35, 35, 35, 39, 45, 43, 46,
439
440 40, 48, 49, 132, 42, 55, 54, 57, 58, 59,
441 61, 0, 22, 64, 63, 67, 66, 67, 29, 31,
442 32, 29, 140, 139, 120, 120, 17, 17, 17, 17,
443 17, 17, 11, 17, 17, 17, 17, 17, 17, 17,
444 69, 80, 89, 98, 34, 34, 33, 33, 33, 36,
445 35, 35, 35, 132, 120, 17, 12, 13, 17, 17,
446 17, 17, 17, 17, 15, 17, 17, 17, 34, 34,
447 34, 33, 36, 36, 35, 132, 17, 12, 13, 14,
448 4, 7, 9, 17, 17, 15, 17, 8, 17, 34,
449 36, 36, 36, 132, 3, 14, 4, 7, 9, 10,
450
451 17, 6, 8, 17, 36, 132, 3, 10, 2, 6,
452 5, 38, 2, 5, 0
453 } ;
454
455 static yyconst flex_int32_t yy_ec[256] =
456 { 0,
457 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
458 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
460 1, 2, 5, 6, 7, 1, 1, 8, 9, 10,
461 11, 12, 1, 13, 1, 14, 15, 16, 17, 17,
462 17, 17, 17, 17, 17, 18, 18, 1, 1, 19,
463 20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
464 23, 23, 23, 23, 23, 24, 23, 23, 23, 23,
465 23, 23, 23, 23, 25, 23, 23, 26, 23, 23,
466 1, 27, 1, 1, 28, 1, 29, 30, 31, 32,
467
468 33, 34, 35, 36, 37, 36, 36, 38, 39, 40,
469 41, 42, 36, 43, 44, 45, 46, 36, 47, 48,
470 36, 36, 1, 49, 1, 1, 1, 1, 1, 1,
471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
474 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
476 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
477 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
478
479 1, 1, 1, 1, 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
485 } ;
486
487 static yyconst flex_int32_t yy_meta[50] =
488 { 0,
489 1, 2, 3, 2, 1, 4, 5, 1, 6, 7,
490 8, 9, 8, 10, 11, 12, 12, 12, 1, 1,
491 13, 14, 15, 15, 15, 15, 16, 17, 14, 14,
492 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
493 15, 15, 15, 15, 15, 15, 15, 15, 1
494 } ;
495
496 static yyconst flex_int16_t yy_base[460] =
497 { 0,
498 0, 48, 55, 0, 102, 103, 130, 0, 177, 178,
499 179, 182, 186, 187, 104, 107, 214, 0, 261, 262,
500 289, 0, 338, 0, 386, 389, 414, 439, 466, 0,
501 515, 0, 564, 0, 399, 403, 612, 638, 665, 0,
502 428, 618, 714, 763, 1130, 0, 49, 1886, 1886, 1886,
503 1886, 96, 0, 109, 118, 1886, 1886, 811, 1886, 1126,
504 111, 111, 858, 1095, 154, 161, 1090, 1083, 1085, 1095,
505 0, 1886, 184, 124, 1886, 196, 1886, 1886, 254, 1886,
506 0, 199, 0, 1886, 1886, 269, 0, 1886, 1120, 0,
507 1886, 0, 1886, 263, 1886, 208, 1886, 267, 1112, 277,
508
509 0, 1886, 1886, 1886, 271, 281, 1886, 393, 1886, 396,
510 1886, 1107, 396, 0, 406, 0, 1886, 1886, 1113, 1886,
511 400, 905, 0, 418, 954, 1886, 430, 1886, 1886, 433,
512 0, 1886, 1886, 1886, 1886, 1886, 1886, 432, 435, 0,
513 449, 1886, 1886, 1886, 1886, 444, 0, 1003, 1886, 456,
514 1886, 1099, 1886, 1110, 1886, 449, 1037, 714, 443, 1097,
515 603, 0, 623, 1083, 1066, 1886, 615, 1886, 619, 0,
516 632, 1886, 644, 1886, 635, 634, 635, 1886, 655, 1886,
517 1886, 646, 0, 659, 0, 1886, 1886, 725, 738, 741,
518 1886, 742, 1886, 1886, 0, 735, 0, 747, 741, 1886,
519
520 0, 0, 1886, 1111, 755, 1886, 0, 0, 1079, 747,
521 754, 1074, 1067, 1069, 1079, 1886, 1886, 1104, 1069, 717,
522 1070, 1058, 1067, 777, 1063, 1052, 1062, 1056, 1041, 0,
523 0, 1886, 1886, 1079, 787, 1886, 1078, 0, 1886, 1886,
524 1077, 0, 0, 0, 743, 765, 1886, 791, 1886, 1069,
525 1886, 1075, 0, 1886, 794, 1074, 795, 798, 1062, 0,
526 1886, 1071, 0, 1886, 789, 0, 1085, 0, 801, 1070,
527 0, 804, 1886, 1886, 807, 1886, 1069, 0, 804, 1886,
528 1886, 1068, 806, 1886, 0, 818, 1886, 1886, 847, 843,
529 874, 799, 0, 905, 903, 800, 1886, 1886, 1886, 1886,
530
531 1886, 1886, 1066, 1026, 1886, 823, 0, 1886, 1048, 824,
532 1886, 1047, 816, 871, 0, 1886, 1886, 1027, 0, 1886,
533 1006, 872, 876, 0, 1134, 0, 969, 971, 948, 943,
534 906, 897, 880, 875, 871, 864, 844, 835, 833, 799,
535 0, 884, 1886, 890, 907, 845, 618, 863, 873, 914,
536 889, 910, 912, 799, 1183, 795, 938, 942, 796, 786,
537 747, 702, 695, 614, 959, 610, 598, 428, 932, 945,
538 946, 1886, 947, 952, 1886, 406, 395, 975, 984, 985,
539 990, 993, 994, 385, 372, 997, 365, 998, 247, 1886,
540 966, 991, 994, 241, 1023, 1024, 1029, 1032, 1033, 1036,
541
542 153, 1037, 1040, 74, 1886, 22, 1041, 1044, 1045, 1054,
543 1055, 0, 1062, 1063, 1886, 1232, 1249, 1266, 1283, 1300,
544 1317, 1334, 1351, 1368, 1385, 1402, 1419, 1436, 1449, 1451,
545 1468, 1485, 1502, 1519, 1536, 1553, 1570, 1587, 1598, 1615,
546 1632, 1638, 1655, 1672, 1689, 1695, 1712, 1729, 1746, 1752,
547 1758, 1775, 1792, 1800, 1817, 1834, 1851, 1056, 1868
548 } ;
549
550 static yyconst flex_int16_t yy_def[460] =
551 { 0,
552 415, 1, 415, 3, 416, 416, 415, 7, 417, 417,
553 418, 418, 419, 419, 420, 420, 415, 17, 421, 421,
554 415, 21, 415, 23, 422, 422, 423, 423, 415, 29,
555 415, 31, 415, 33, 424, 424, 425, 425, 415, 39,
556 426, 426, 427, 427, 415, 428, 415, 415, 415, 415,
557 415, 429, 430, 429, 415, 415, 415, 415, 415, 58,
558 415, 415, 58, 63, 63, 63, 63, 63, 63, 63,
559 431, 415, 432, 415, 415, 415, 415, 415, 415, 415,
560 430, 415, 433, 415, 415, 434, 435, 415, 434, 436,
561 415, 437, 415, 438, 415, 415, 415, 415, 439, 415,
562
563 440, 415, 415, 415, 441, 415, 415, 415, 415, 415,
564 415, 415, 415, 442, 415, 443, 415, 415, 415, 415,
565 444, 445, 446, 415, 446, 415, 415, 415, 415, 415,
566 447, 415, 415, 415, 415, 415, 415, 448, 415, 428,
567 415, 415, 415, 415, 415, 429, 430, 449, 415, 415,
568 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
569 415, 430, 415, 430, 415, 415, 415, 415, 415, 450,
570 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
571 415, 415, 451, 452, 453, 415, 415, 415, 415, 453,
572 415, 415, 415, 415, 454, 454, 428, 415, 429, 415,
573
574 455, 430, 415, 415, 415, 415, 58, 63, 63, 63,
575 63, 63, 63, 63, 63, 415, 415, 415, 63, 63,
576 63, 63, 63, 63, 63, 63, 63, 63, 63, 431,
577 456, 415, 415, 415, 415, 415, 415, 433, 415, 415,
578 415, 435, 436, 437, 438, 438, 415, 415, 415, 439,
579 415, 415, 440, 415, 415, 415, 415, 415, 415, 442,
580 415, 415, 443, 415, 444, 457, 445, 446, 415, 415,
581 125, 415, 415, 415, 415, 415, 415, 447, 448, 415,
582 415, 415, 429, 415, 449, 415, 415, 415, 415, 415,
583 415, 415, 458, 415, 415, 415, 415, 415, 415, 415,
584
585 415, 415, 415, 430, 415, 415, 450, 415, 415, 415,
586 415, 415, 415, 415, 451, 415, 415, 415, 453, 415,
587 415, 453, 415, 454, 459, 455, 63, 63, 63, 63,
588 63, 63, 415, 63, 63, 63, 63, 63, 63, 63,
589 456, 415, 415, 415, 415, 415, 415, 415, 415, 458,
590 415, 415, 415, 430, 459, 63, 63, 63, 63, 63,
591 63, 63, 63, 63, 63, 63, 63, 63, 415, 415,
592 415, 415, 415, 415, 415, 430, 63, 415, 415, 63,
593 63, 63, 63, 63, 63, 415, 63, 63, 63, 415,
594 415, 415, 415, 430, 63, 415, 415, 415, 415, 63,
595
596 63, 63, 415, 63, 415, 430, 415, 415, 63, 415,
597 63, 430, 415, 415, 0, 415, 415, 415, 415, 415,
598 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
599 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
600 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
601 415, 415, 415, 415, 415, 415, 415, 415, 415
602 } ;
603
604 static yyconst flex_int16_t yy_nxt[1936] =
605 { 0,
606 46, 47, 48, 47, 46, 49, 50, 46, 51, 46,
607 46, 46, 46, 46, 52, 46, 46, 46, 46, 46,
608 46, 53, 53, 53, 53, 53, 54, 53, 53, 53,
609 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
610 53, 53, 53, 53, 53, 53, 53, 53, 46, 55,
611 198, 55, 198, 412, 56, 57, 58, 59, 60, 57,
612 57, 57, 57, 57, 57, 57, 57, 57, 57, 61,
613 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
614 57, 62, 57, 63, 63, 63, 64, 65, 63, 63,
615 63, 66, 67, 63, 63, 63, 68, 63, 63, 63,
616
617 69, 70, 63, 57, 72, 72, 93, 200, 411, 93,
618 201, 203, 204, 217, 218, 94, 73, 73, 94, 205,
619 415, 205, 200, 415, 206, 201, 233, 234, 74, 74,
620 75, 76, 77, 76, 75, 78, 75, 75, 75, 75,
621 75, 75, 75, 75, 79, 75, 75, 75, 80, 75,
622 75, 81, 81, 81, 81, 81, 82, 81, 81, 81,
623 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
624 81, 81, 81, 81, 81, 81, 81, 81, 75, 84,
625 84, 84, 85, 85, 84, 409, 232, 88, 84, 84,
626 88, 220, 223, 221, 224, 200, 222, 235, 201, 235,
627
628 225, 236, 237, 86, 86, 89, 91, 91, 89, 248,
629 232, 248, 89, 89, 95, 96, 97, 96, 95, 95,
630 95, 95, 95, 95, 95, 95, 95, 95, 98, 95,
631 95, 95, 95, 95, 95, 99, 99, 99, 99, 99,
632 100, 99, 99, 99, 99, 99, 99, 99, 99, 99,
633 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
634 99, 99, 95, 102, 102, 200, 103, 103, 201, 104,
635 104, 240, 241, 406, 246, 105, 105, 247, 200, 251,
636 252, 201, 200, 255, 256, 201, 404, 106, 106, 107,
637 108, 109, 108, 107, 107, 107, 107, 107, 107, 110,
638
639 107, 111, 112, 113, 107, 107, 107, 107, 107, 107,
640 114, 114, 114, 114, 114, 115, 114, 114, 114, 114,
641 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
642 114, 114, 114, 114, 114, 114, 114, 107, 116, 116,
643 117, 116, 116, 118, 119, 116, 120, 116, 116, 116,
644 116, 116, 121, 122, 122, 122, 116, 116, 116, 123,
645 123, 123, 123, 123, 124, 125, 123, 123, 123, 123,
646 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
647 123, 123, 123, 123, 123, 123, 116, 127, 128, 127,
648 127, 128, 127, 402, 257, 129, 257, 258, 129, 258,
649
650 173, 174, 173, 401, 173, 174, 173, 200, 261, 262,
651 201, 200, 130, 175, 201, 130, 132, 175, 400, 133,
652 269, 270, 134, 135, 136, 176, 137, 395, 138, 176,
653 186, 272, 273, 272, 187, 276, 277, 281, 282, 274,
654 139, 132, 188, 280, 133, 394, 201, 134, 135, 136,
655 198, 137, 198, 138, 189, 415, 275, 286, 415, 286,
656 200, 297, 298, 201, 389, 139, 140, 141, 142, 141,
657 140, 143, 144, 140, 145, 140, 140, 140, 140, 140,
658 146, 140, 140, 140, 140, 140, 140, 147, 147, 147,
659 147, 147, 148, 147, 147, 147, 147, 147, 147, 147,
660
661 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
662 147, 147, 147, 147, 140, 149, 150, 151, 150, 152,
663 153, 149, 154, 155, 149, 149, 149, 149, 149, 156,
664 157, 158, 158, 159, 160, 161, 162, 162, 162, 162,
665 162, 163, 162, 162, 162, 162, 164, 162, 162, 162,
666 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
667 162, 162, 162, 165, 166, 167, 168, 167, 166, 166,
668 166, 166, 166, 166, 166, 166, 166, 166, 169, 166,
669 166, 166, 166, 166, 166, 170, 170, 170, 170, 170,
670 171, 170, 170, 170, 170, 170, 170, 170, 170, 170,
671
672 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
673 170, 170, 166, 76, 77, 76, 306, 78, 306, 190,
674 186, 190, 300, 301, 191, 302, 303, 177, 177, 177,
675 200, 388, 188, 201, 308, 309, 311, 312, 82, 76,
676 77, 76, 372, 78, 189, 310, 200, 310, 387, 201,
677 313, 313, 313, 177, 177, 177, 314, 200, 314, 385,
678 201, 317, 318, 372, 82, 178, 179, 180, 179, 178,
679 178, 178, 178, 178, 181, 181, 178, 178, 178, 182,
680 178, 178, 178, 178, 178, 178, 183, 183, 183, 183,
681 183, 184, 183, 183, 183, 183, 183, 183, 183, 183,
682
683 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
684 183, 183, 183, 178, 50, 192, 193, 192, 50, 194,
685 50, 50, 50, 50, 50, 50, 50, 384, 196, 294,
686 294, 294, 50, 50, 50, 383, 200, 295, 296, 201,
687 320, 321, 322, 323, 322, 323, 200, 206, 198, 325,
688 198, 295, 415, 328, 415, 415, 205, 415, 205, 296,
689 329, 206, 50, 50, 192, 193, 192, 50, 194, 50,
690 50, 50, 50, 50, 50, 50, 246, 196, 333, 247,
691 333, 50, 50, 50, 220, 223, 221, 224, 235, 222,
692 235, 382, 248, 225, 248, 342, 257, 342, 257, 258,
693
694 415, 258, 344, 415, 344, 272, 273, 272, 334, 276,
695 277, 50, 207, 274, 207, 415, 335, 415, 415, 286,
696 415, 286, 349, 353, 306, 310, 306, 310, 381, 380,
697 275, 313, 313, 313, 377, 376, 349, 353, 368, 208,
698 208, 208, 209, 210, 208, 208, 208, 211, 212, 208,
699 208, 208, 213, 208, 208, 208, 214, 215, 208, 415,
700 290, 415, 289, 289, 290, 367, 345, 346, 371, 366,
701 291, 292, 314, 322, 314, 322, 365, 323, 206, 323,
702 345, 333, 371, 333, 291, 342, 372, 342, 346, 208,
703 208, 344, 292, 344, 208, 208, 372, 347, 348, 208,
704
705 372, 364, 363, 208, 208, 266, 266, 362, 266, 266,
706 372, 347, 266, 375, 266, 266, 266, 266, 266, 348,
707 294, 294, 294, 266, 266, 266, 351, 352, 295, 296,
708 369, 370, 266, 375, 375, 375, 361, 373, 374, 378,
709 351, 378, 295, 379, 369, 379, 360, 375, 352, 375,
710 296, 373, 370, 266, 263, 263, 390, 263, 263, 374,
711 386, 263, 386, 263, 263, 263, 263, 263, 390, 390,
712 391, 392, 263, 263, 263, 393, 378, 390, 378, 359,
713 358, 271, 390, 390, 391, 379, 396, 379, 396, 393,
714 405, 397, 392, 397, 398, 399, 398, 399, 386, 403,
715
716 386, 403, 263, 283, 357, 356, 285, 283, 320, 283,
717 283, 405, 283, 283, 405, 283, 283, 405, 283, 283,
718 283, 283, 283, 283, 407, 396, 407, 396, 405, 317,
719 397, 405, 397, 398, 399, 398, 399, 408, 410, 408,
720 410, 403, 407, 403, 407, 408, 413, 408, 413, 311,
721 308, 283, 289, 289, 290, 410, 414, 410, 414, 354,
722 291, 292, 293, 413, 414, 413, 414, 350, 302, 350,
723 281, 276, 269, 261, 291, 343, 255, 251, 249, 240,
724 236, 233, 292, 340, 293, 266, 266, 339, 266, 266,
725 338, 337, 266, 336, 266, 266, 266, 266, 266, 332,
726
727 331, 330, 327, 266, 266, 266, 217, 229, 228, 227,
728 226, 219, 266, 203, 305, 304, 299, 288, 287, 264,
729 259, 249, 415, 229, 228, 227, 226, 219, 216, 415,
730 415, 415, 415, 266, 326, 326, 415, 326, 326, 326,
731 326, 326, 326, 326, 326, 326, 326, 415, 415, 415,
732 415, 415, 326, 326, 326, 415, 415, 415, 415, 415,
733 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
734 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
735 415, 415, 326, 326, 326, 415, 326, 326, 326, 326,
736 326, 326, 326, 326, 326, 326, 415, 415, 415, 415,
737
738 415, 326, 326, 326, 415, 415, 415, 415, 415, 415,
739 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
740 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
741 415, 326, 71, 71, 71, 71, 71, 71, 71, 71,
742 71, 71, 71, 71, 71, 71, 71, 71, 71, 83,
743 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
744 83, 83, 83, 83, 83, 83, 87, 87, 87, 87,
745 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
746 87, 87, 87, 90, 90, 90, 90, 90, 90, 90,
747 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
748
749 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
750 92, 92, 92, 92, 92, 92, 92, 101, 101, 101,
751 101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
752 101, 101, 101, 101, 126, 126, 126, 126, 126, 126,
753 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
754 126, 131, 131, 131, 131, 131, 131, 131, 131, 131,
755 131, 131, 131, 131, 131, 131, 131, 131, 172, 172,
756 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
757 172, 172, 172, 172, 172, 75, 75, 75, 75, 75,
758 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
759
760 75, 75, 185, 185, 185, 185, 185, 185, 185, 185,
761 185, 185, 185, 185, 185, 185, 185, 185, 185, 195,
762 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
763 195, 195, 195, 195, 195, 195, 197, 415, 415, 415,
764 415, 415, 197, 197, 197, 197, 415, 197, 197, 199,
765 415, 415, 415, 199, 415, 199, 199, 199, 199, 199,
766 199, 199, 202, 415, 202, 202, 415, 202, 230, 230,
767 415, 230, 230, 230, 230, 230, 230, 230, 415, 230,
768 230, 230, 230, 415, 230, 231, 231, 231, 231, 231,
769 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
770
771 231, 231, 238, 238, 415, 415, 238, 238, 238, 238,
772 238, 238, 238, 238, 238, 238, 238, 415, 238, 239,
773 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
774 239, 239, 239, 239, 239, 239, 242, 242, 415, 242,
775 242, 415, 242, 242, 242, 242, 242, 242, 242, 242,
776 242, 415, 242, 243, 243, 415, 243, 243, 243, 243,
777 243, 243, 243, 243, 243, 415, 243, 243, 415, 243,
778 244, 244, 415, 244, 244, 244, 244, 244, 415, 244,
779 244, 244, 244, 244, 244, 244, 244, 245, 245, 415,
780 245, 245, 245, 245, 245, 245, 245, 245, 245, 245,
781
782 245, 245, 245, 245, 250, 415, 415, 415, 415, 250,
783 415, 250, 250, 415, 250, 253, 253, 415, 415, 253,
784 415, 253, 253, 253, 253, 415, 253, 253, 253, 253,
785 415, 253, 254, 254, 254, 254, 254, 254, 254, 254,
786 254, 254, 254, 254, 254, 254, 254, 254, 254, 260,
787 415, 260, 260, 415, 260, 263, 263, 415, 415, 415,
788 415, 263, 263, 263, 263, 415, 415, 263, 415, 415,
789 415, 263, 265, 265, 415, 415, 415, 415, 265, 265,
790 265, 265, 265, 265, 265, 265, 265, 415, 265, 267,
791 267, 415, 415, 415, 415, 267, 267, 267, 267, 415,
792
793 267, 267, 267, 267, 415, 267, 268, 415, 268, 268,
794 415, 268, 278, 278, 415, 415, 278, 415, 415, 415,
795 278, 278, 415, 278, 278, 278, 278, 415, 278, 279,
796 279, 415, 415, 279, 415, 415, 415, 279, 279, 279,
797 279, 279, 279, 279, 415, 279, 284, 284, 284, 284,
798 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
799 284, 284, 284, 307, 415, 307, 307, 415, 307, 315,
800 415, 315, 315, 415, 315, 316, 316, 316, 316, 316,
801 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
802 316, 316, 319, 319, 415, 319, 415, 319, 319, 319,
803
804 319, 319, 415, 319, 319, 319, 319, 415, 319, 324,
805 324, 324, 415, 324, 324, 324, 324, 326, 326, 415,
806 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
807 326, 326, 326, 326, 341, 341, 415, 341, 341, 341,
808 341, 341, 415, 341, 415, 341, 341, 341, 341, 415,
809 341, 266, 266, 415, 415, 415, 415, 266, 266, 266,
810 266, 415, 415, 266, 415, 415, 415, 266, 355, 355,
811 415, 355, 355, 355, 355, 355, 355, 355, 355, 355,
812 355, 355, 355, 355, 355, 45, 415, 415, 415, 415,
813 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
814
815 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
816 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
817 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
818 415, 415, 415, 415, 415
819 } ;
820
821 static yyconst flex_int16_t yy_chk[1936] =
822 { 0,
823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
825 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
826 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
827 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
828 47, 2, 47, 406, 2, 3, 3, 3, 3, 3,
829 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
830 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
831 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
832 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
833
834 3, 3, 3, 3, 5, 6, 15, 52, 404, 16,
835 52, 54, 54, 62, 62, 15, 5, 6, 16, 55,
836 54, 55, 61, 54, 55, 61, 74, 74, 5, 6,
837 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
838 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
839 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
840 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
841 7, 7, 7, 7, 7, 7, 7, 7, 7, 9,
842 10, 11, 9, 10, 12, 401, 73, 11, 13, 14,
843 12, 65, 66, 65, 66, 73, 65, 76, 73, 76,
844
845 66, 82, 82, 9, 10, 11, 13, 14, 12, 96,
846 73, 96, 13, 14, 17, 17, 17, 17, 17, 17,
847 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
848 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
849 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
850 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
851 17, 17, 17, 19, 20, 79, 19, 20, 79, 19,
852 20, 86, 86, 394, 94, 19, 20, 94, 98, 100,
853 100, 98, 105, 106, 106, 105, 389, 19, 20, 21,
854 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
855
856 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
857 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
858 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
859 21, 21, 21, 21, 21, 21, 21, 21, 23, 23,
860 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
861 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
862 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
863 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
864 23, 23, 23, 23, 23, 23, 23, 25, 25, 25,
865 26, 26, 26, 387, 108, 25, 108, 110, 26, 110,
866
867 35, 35, 35, 385, 36, 36, 36, 113, 115, 115,
868 113, 121, 25, 35, 121, 26, 27, 36, 384, 27,
869 124, 124, 27, 27, 27, 35, 27, 377, 27, 36,
870 41, 127, 127, 127, 41, 130, 130, 139, 139, 127,
871 27, 28, 41, 138, 28, 376, 138, 28, 28, 28,
872 141, 28, 141, 28, 41, 146, 127, 150, 146, 150,
873 156, 159, 159, 156, 368, 28, 29, 29, 29, 29,
874 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
875 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
876 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
877
878 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
879 29, 29, 29, 29, 29, 31, 31, 31, 31, 31,
880 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
881 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
882 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
883 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
884 31, 31, 31, 31, 33, 33, 33, 33, 33, 33,
885 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
886 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
887 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
888
889 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
890 33, 33, 33, 37, 37, 37, 167, 37, 167, 42,
891 42, 42, 161, 161, 42, 163, 163, 37, 37, 37,
892 169, 367, 42, 169, 171, 171, 176, 176, 37, 38,
893 38, 38, 347, 38, 42, 173, 175, 173, 366, 175,
894 177, 177, 177, 38, 38, 38, 179, 182, 179, 364,
895 182, 184, 184, 347, 38, 39, 39, 39, 39, 39,
896 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
897 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
898 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
899
900 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
901 39, 39, 39, 39, 43, 43, 43, 43, 43, 43,
902 43, 43, 43, 43, 43, 43, 43, 363, 43, 158,
903 158, 158, 43, 43, 43, 362, 188, 158, 158, 188,
904 189, 189, 190, 192, 190, 192, 196, 190, 198, 196,
905 198, 158, 199, 220, 245, 199, 205, 245, 205, 158,
906 220, 205, 43, 44, 44, 44, 44, 44, 44, 44,
907 44, 44, 44, 44, 44, 44, 246, 44, 224, 246,
908 224, 44, 44, 44, 210, 211, 210, 211, 235, 210,
909 235, 361, 248, 211, 248, 255, 257, 255, 257, 258,
910
911 265, 258, 269, 265, 269, 272, 272, 272, 224, 275,
912 275, 44, 58, 272, 58, 279, 224, 283, 279, 286,
913 283, 286, 292, 296, 306, 310, 306, 310, 360, 359,
914 272, 313, 313, 313, 356, 354, 292, 296, 340, 58,
915 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
916 58, 58, 58, 58, 58, 58, 58, 58, 58, 63,
917 290, 63, 289, 289, 289, 339, 290, 290, 346, 338,
918 289, 289, 314, 322, 314, 322, 337, 323, 322, 323,
919 290, 333, 346, 333, 289, 342, 348, 342, 290, 63,
920 63, 344, 289, 344, 63, 63, 349, 291, 291, 63,
921
922 348, 336, 335, 63, 63, 122, 122, 334, 122, 122,
923 349, 291, 122, 351, 122, 122, 122, 122, 122, 291,
924 294, 294, 294, 122, 122, 122, 295, 295, 294, 294,
925 345, 345, 122, 352, 351, 353, 332, 350, 350, 357,
926 295, 357, 294, 358, 345, 358, 331, 352, 295, 353,
927 294, 350, 345, 122, 125, 125, 369, 125, 125, 350,
928 365, 125, 365, 125, 125, 125, 125, 125, 370, 371,
929 373, 373, 125, 125, 125, 374, 378, 369, 378, 330,
930 329, 125, 370, 371, 373, 379, 380, 379, 380, 374,
931 391, 381, 373, 381, 382, 383, 382, 383, 386, 388,
932
933 386, 388, 125, 148, 328, 327, 148, 148, 321, 148,
934 148, 391, 148, 148, 392, 148, 148, 393, 148, 148,
935 148, 148, 148, 148, 395, 396, 395, 396, 392, 318,
936 397, 393, 397, 398, 399, 398, 399, 400, 402, 400,
937 402, 403, 407, 403, 407, 408, 409, 408, 409, 312,
938 309, 148, 157, 157, 157, 410, 411, 410, 411, 304,
939 157, 157, 157, 413, 414, 413, 414, 458, 303, 458,
940 282, 277, 270, 262, 157, 259, 256, 252, 250, 241,
941 237, 234, 157, 229, 157, 267, 267, 228, 267, 267,
942 227, 226, 267, 225, 267, 267, 267, 267, 267, 223,
943
944 222, 221, 219, 267, 267, 267, 218, 215, 214, 213,
945 212, 209, 267, 204, 165, 164, 160, 154, 152, 119,
946 112, 99, 89, 70, 69, 68, 67, 64, 60, 45,
947 0, 0, 0, 267, 325, 325, 0, 325, 325, 325,
948 325, 325, 325, 325, 325, 325, 325, 0, 0, 0,
949 0, 0, 325, 325, 325, 0, 0, 0, 0, 0,
950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
951 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
952 0, 0, 325, 355, 355, 0, 355, 355, 355, 355,
953 355, 355, 355, 355, 355, 355, 0, 0, 0, 0,
954
955 0, 355, 355, 355, 0, 0, 0, 0, 0, 0,
956 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
957 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
958 0, 355, 416, 416, 416, 416, 416, 416, 416, 416,
959 416, 416, 416, 416, 416, 416, 416, 416, 416, 417,
960 417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
961 417, 417, 417, 417, 417, 417, 418, 418, 418, 418,
962 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
963 418, 418, 418, 419, 419, 419, 419, 419, 419, 419,
964 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
965
966 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
967 420, 420, 420, 420, 420, 420, 420, 421, 421, 421,
968 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
969 421, 421, 421, 421, 422, 422, 422, 422, 422, 422,
970 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
971 422, 423, 423, 423, 423, 423, 423, 423, 423, 423,
972 423, 423, 423, 423, 423, 423, 423, 423, 424, 424,
973 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
974 424, 424, 424, 424, 424, 425, 425, 425, 425, 425,
975 425, 425, 425, 425, 425, 425, 425, 425, 425, 425,
976
977 425, 425, 426, 426, 426, 426, 426, 426, 426, 426,
978 426, 426, 426, 426, 426, 426, 426, 426, 426, 427,
979 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
980 427, 427, 427, 427, 427, 427, 428, 0, 0, 0,
981 0, 0, 428, 428, 428, 428, 0, 428, 428, 429,
982 0, 0, 0, 429, 0, 429, 429, 429, 429, 429,
983 429, 429, 430, 0, 430, 430, 0, 430, 431, 431,
984 0, 431, 431, 431, 431, 431, 431, 431, 0, 431,
985 431, 431, 431, 0, 431, 432, 432, 432, 432, 432,
986 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
987
988 432, 432, 433, 433, 0, 0, 433, 433, 433, 433,
989 433, 433, 433, 433, 433, 433, 433, 0, 433, 434,
990 434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
991 434, 434, 434, 434, 434, 434, 435, 435, 0, 435,
992 435, 0, 435, 435, 435, 435, 435, 435, 435, 435,
993 435, 0, 435, 436, 436, 0, 436, 436, 436, 436,
994 436, 436, 436, 436, 436, 0, 436, 436, 0, 436,
995 437, 437, 0, 437, 437, 437, 437, 437, 0, 437,
996 437, 437, 437, 437, 437, 437, 437, 438, 438, 0,
997 438, 438, 438, 438, 438, 438, 438, 438, 438, 438,
998
999 438, 438, 438, 438, 439, 0, 0, 0, 0, 439,
1000 0, 439, 439, 0, 439, 440, 440, 0, 0, 440,
1001 0, 440, 440, 440, 440, 0, 440, 440, 440, 440,
1002 0, 440, 441, 441, 441, 441, 441, 441, 441, 441,
1003 441, 441, 441, 441, 441, 441, 441, 441, 441, 442,
1004 0, 442, 442, 0, 442, 443, 443, 0, 0, 0,
1005 0, 443, 443, 443, 443, 0, 0, 443, 0, 0,
1006 0, 443, 444, 444, 0, 0, 0, 0, 444, 444,
1007 444, 444, 444, 444, 444, 444, 444, 0, 444, 445,
1008 445, 0, 0, 0, 0, 445, 445, 445, 445, 0,
1009
1010 445, 445, 445, 445, 0, 445, 446, 0, 446, 446,
1011 0, 446, 447, 447, 0, 0, 447, 0, 0, 0,
1012 447, 447, 0, 447, 447, 447, 447, 0, 447, 448,
1013 448, 0, 0, 448, 0, 0, 0, 448, 448, 448,
1014 448, 448, 448, 448, 0, 448, 449, 449, 449, 449,
1015 449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
1016 449, 449, 449, 450, 0, 450, 450, 0, 450, 451,
1017 0, 451, 451, 0, 451, 452, 452, 452, 452, 452,
1018 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
1019 452, 452, 453, 453, 0, 453, 0, 453, 453, 453,
1020
1021 453, 453, 0, 453, 453, 453, 453, 0, 453, 454,
1022 454, 454, 0, 454, 454, 454, 454, 455, 455, 0,
1023 455, 455, 455, 455, 455, 455, 455, 455, 455, 455,
1024 455, 455, 455, 455, 456, 456, 0, 456, 456, 456,
1025 456, 456, 0, 456, 0, 456, 456, 456, 456, 0,
1026 456, 457, 457, 0, 0, 0, 0, 457, 457, 457,
1027 457, 0, 0, 457, 0, 0, 0, 457, 459, 459,
1028 0, 459, 459, 459, 459, 459, 459, 459, 459, 459,
1029 459, 459, 459, 459, 459, 415, 415, 415, 415, 415,
1030 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
1031
1032 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
1033 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
1034 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
1035 415, 415, 415, 415, 415
1036 } ;
1037
1038 static yy_state_type yy_last_accepting_state;
1039 static char *yy_last_accepting_cpos;
1040
1041 extern int ppy__flex_debug;
1042 int ppy__flex_debug = 0;
1043
1044 /* The intent behind this definition is that it'll catch
1045 * any uses of REJECT which flex missed.
1046 */
1047 #define REJECT reject_used_but_not_detected
1048 #define yymore() yymore_used_but_not_detected
1049 #define YY_MORE_ADJ 0
1050 #define YY_RESTORE_YY_MORE_OFFSET
1051 char *ppy_text;
1052 #line 1 "ppl.l"
1053 /* -*-C-*-
1054 * Wrc preprocessor lexical analysis
1055 *
1056 * Copyright 1999-2000 Bertho A. Stultiens (BS)
1057 *
1058 * This library is free software; you can redistribute it and/or
1059 * modify it under the terms of the GNU Lesser General Public
1060 * License as published by the Free Software Foundation; either
1061 * version 2.1 of the License, or (at your option) any later version.
1062 *
1063 * This library is distributed in the hope that it will be useful,
1064 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1065 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1066 * Lesser General Public License for more details.
1067 *
1068 * You should have received a copy of the GNU Lesser General Public
1069 * License along with this library; if not, write to the Free Software
1070 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
1071 *
1072 * History:
1073 * 24-Apr-2000 BS - Started from scratch to restructure everything
1074 * and reintegrate the source into the wine-tree.
1075 * 04-Jan-2000 BS - Added comments about the lexicographical
1076 * grammar to give some insight in the complexity.
1077 * 28-Dec-1999 BS - Eliminated backing-up of the flexer by running
1078 * `flex -b' on the source. This results in some
1079 * weirdo extra rules, but a much faster scanner.
1080 * 23-Dec-1999 BS - Started this file
1081 *
1082 *-------------------------------------------------------------------------
1083 * The preprocessor's lexographical grammar (approximately):
1084 *
1085 * pp := {ws} # {ws} if {ws} {expr} {ws} \n
1086 * | {ws} # {ws} ifdef {ws} {id} {ws} \n
1087 * | {ws} # {ws} ifndef {ws} {id} {ws} \n
1088 * | {ws} # {ws} elif {ws} {expr} {ws} \n
1089 * | {ws} # {ws} else {ws} \n
1090 * | {ws} # {ws} endif {ws} \n
1091 * | {ws} # {ws} include {ws} < {anytext} > \n
1092 * | {ws} # {ws} include {ws} " {anytext} " \n
1093 * | {ws} # {ws} define {ws} {anytext} \n
1094 * | {ws} # {ws} define( {arglist} ) {ws} {expansion} \n
1095 * | {ws} # {ws} pragma {ws} {anytext} \n
1096 * | {ws} # {ws} ident {ws} {anytext} \n
1097 * | {ws} # {ws} error {ws} {anytext} \n
1098 * | {ws} # {ws} warning {ws} {anytext} \n
1099 * | {ws} # {ws} line {ws} " {anytext} " {number} \n
1100 * | {ws} # {ws} {number} " {anytext} " {number} [ {number} [{number}] ] \n
1101 * | {ws} # {ws} \n
1102 *
1103 * ws := [ \t\r\f\v]*
1104 *
1105 * expr := {expr} [+-*%^/|&] {expr}
1106 * | {expr} {logor|logand} {expr}
1107 * | [!~+-] {expr}
1108 * | {expr} ? {expr} : {expr}
1109 *
1110 * logor := ||
1111 *
1112 * logand := &&
1113 *
1114 * id := [a-zA-Z_][a-zA-Z0-9_]*
1115 *
1116 * anytext := [^\n]* (see note)
1117 *
1118 * arglist :=
1119 * | {id}
1120 * | {arglist} , {id}
1121 * | {arglist} , {id} ...
1122 *
1123 * expansion := {id}
1124 * | # {id}
1125 * | {anytext}
1126 * | {anytext} ## {anytext}
1127 *
1128 * number := [0-9]+
1129 *
1130 * Note: "anytext" is not always "[^\n]*". This is because the
1131 * trailing context must be considered as well.
1132 *
1133 * The only certain assumption for the preprocessor to make is that
1134 * directives start at the beginning of the line, followed by a '#'
1135 * and end with a newline.
1136 * Any directive may be suffixed with a line-continuation. Also
1137 * classical comment / *...* / (note: no comments within comments,
1138 * therefore spaces) is considered to be a line-continuation
1139 * (according to gcc and egcs AFAIK, ANSI is a bit vague).
1140 * Comments have not been added to the above grammar for simplicity
1141 * reasons. However, it is allowed to enter comment anywhere within
1142 * the directives as long as they do not interfere with the context.
1143 * All comments are considered to be deletable whitespace (both
1144 * classical form "/ *...* /" and C++ form "//...\n").
1145 *
1146 * All recursive scans, except for macro-expansion, are done by the
1147 * parser, whereas the simple state transitions of non-recursive
1148 * directives are done in the scanner. This results in the many
1149 * exclusive start-conditions of the scanner.
1150 *
1151 * Macro expansions are slightly more difficult because they have to
1152 * prescan the arguments. Parameter substitution is literal if the
1153 * substitution is # or ## (either side). This enables new identifiers
1154 * to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more
1155 * information).
1156 *
1157 * FIXME: Variable macro parameters is recognized, but not yet
1158 * expanded. I have to reread the ANSI standard on the subject (yes,
1159 * ANSI defines it).
1160 *
1161 * The following special defines are supported:
1162 * __FILE__ -> "thissource.c"
1163 * __LINE__ -> 123
1164 * __DATE__ -> "May 1 2000"
1165 * __TIME__ -> "23:59:59"
1166 * These macros expand, as expected, into their ANSI defined values.
1167 *
1168 * The same include prevention is implemented as gcc and egcs does.
1169 * This results in faster processing because we do not read the text
1170 * at all. Some wine-sources attempt to include the same file 4 or 5
1171 * times. This strategy also saves a lot blank output-lines, which in
1172 * its turn improves the real resource scanner/parser.
1173 *
1174 */
1175
1176 /*
1177 * Special flex options and exclusive scanner start-conditions
1178 */
1179 #define YY_NO_INPUT 1
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201 #line 164 "ppl.l"
1202 #include <stdio.h>
1203 #include <stdlib.h>
1204 #include <string.h>
1205 #include <ctype.h>
1206 #include <assert.h>
1207 #include <errno.h>
1208 #include <limits.h>
1209
1210 #ifndef LLONG_MAX
1211 # define LLONG_MAX ((long long)0x7fffffff << 32 | 0xffffffff)
1212 # define LLONG_MIN (-LLONG_MAX - 1)
1213 #endif
1214 #ifndef ULLONG_MAX
1215 # define ULLONG_MAX ((long long)0xffffffff << 32 | 0xffffffff)
1216 #endif
1217
1218 #ifndef HAVE_UNISTD_H
1219 #define YY_NO_UNISTD_H
1220 #endif
1221
1222 #include "wine/wpp.h"
1223 #include "wpp_private.h"
1224 #include "ppy.tab.h"
1225
1226 /*
1227 * Make sure that we are running an appropriate version of flex.
1228 */
1229 #if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
1230 #error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
1231 #endif
1232
1233 #define YY_READ_BUF_SIZE 65536 /* So we read most of a file at once */
1234
1235 #define yy_current_state() YY_START
1236 #define yy_pp_state(x) yy_pop_state(); yy_push_state(x)
1237
1238 /*
1239 * Always update the current character position within a line
1240 */
1241 #define YY_USER_ACTION pp_status.char_number+=ppy_leng;
1242
1243 /*
1244 * Buffer management for includes and expansions
1245 */
1246 #define MAXBUFFERSTACK 128 /* Nesting more than 128 includes or macro expansion textss is insane */
1247
1248 typedef struct bufferstackentry {
1249 YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
1250 void *filehandle; /* Handle to be used with wpp_callbacks->read */
1251 pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
1252 int line_number; /* Line that we were handling */
1253 int char_number; /* The current position on that line */
1254 char *filename; /* Filename that we were handling */
1255 int if_depth; /* How many #if:s deep to check matching #endif:s */
1256 int ncontinuations; /* Remember the continuation state */
1257 int should_pop; /* Set if we must pop the start-state on EOF */
1258 /* Include management */
1259 include_state_t incl;
1260 char *include_filename;
1261 } bufferstackentry_t;
1262
1263 #define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */
1264
1265 /*
1266 * Macro expansion nesting
1267 * We need the stack to handle expansions while scanning
1268 * a macro's arguments. The TOS must always be the macro
1269 * that receives the current expansion from the scanner.
1270 */
1271 #define MAXMACEXPSTACK 128 /* Nesting more than 128 macro expansions is insane */
1272
1273 typedef struct macexpstackentry {
1274 pp_entry_t *ppp; /* This macro we are scanning */
1275 char **args; /* With these arguments */
1276 char **ppargs; /* Resulting in these preprocessed arguments */
1277 int *nnls; /* Number of newlines per argument */
1278 int nargs; /* And this many arguments scanned */
1279 int parentheses; /* Nesting level of () */
1280 int curargsize; /* Current scanning argument's size */
1281 int curargalloc; /* Current scanning argument's block allocated */
1282 char *curarg; /* Current scanning argument's content */
1283 } macexpstackentry_t;
1284
1285 #define MACROPARENTHESES() (top_macro()->parentheses)
1286
1287 /*
1288 * Prototypes
1289 */
1290 static void newline(int);
1291 static int make_number(int radix, YYSTYPE *val, const char *str, int len);
1292 static void put_buffer(const char *s, int len);
1293 /* Buffer management */
1294 static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
1295 static bufferstackentry_t *pop_buffer(void);
1296 /* String functions */
1297 static void new_string(void);
1298 static void add_string(const char *str, int len);
1299 static char *get_string(void);
1300 static void put_string(void);
1301 static int string_start(void);
1302 /* Macro functions */
1303 static void push_macro(pp_entry_t *ppp);
1304 static macexpstackentry_t *top_macro(void);
1305 static macexpstackentry_t *pop_macro(void);
1306 static void free_macro(macexpstackentry_t *mep);
1307 static void add_text_to_macro(const char *text, int len);
1308 static void macro_add_arg(int last);
1309 static void macro_add_expansion(void);
1310 /* Expansion */
1311 static void expand_special(pp_entry_t *ppp);
1312 static void expand_define(pp_entry_t *ppp);
1313 static void expand_macro(macexpstackentry_t *mep);
1314
1315 /*
1316 * Local variables
1317 */
1318 static int ncontinuations;
1319
1320 static int strbuf_idx = 0;
1321 static int strbuf_alloc = 0;
1322 static char *strbuffer = NULL;
1323 static int str_startline;
1324
1325 static macexpstackentry_t *macexpstack[MAXMACEXPSTACK];
1326 static int macexpstackidx = 0;
1327
1328 static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
1329 static int bufferstackidx = 0;
1330
1331 /*
1332 * Global variables
1333 */
1334 include_state_t pp_incl_state =
1335 {
1336 -1, /* state */
1337 NULL, /* ppp */
1338 0, /* ifdepth */
1339 0 /* seen_junk */
1340 };
1341
1342 includelogicentry_t *pp_includelogiclist = NULL;
1343
1344 #define YY_INPUT(buf,result,max_size) \
1345 { \
1346 result = wpp_callbacks->read(pp_status.file, buf, max_size); \
1347 }
1348
1349 #define BUFFERINITIALCAPACITY 256
1350
1351 void pp_writestring(const char *format, ...)
1352 {
1353 va_list valist;
1354 int len;
1355 static char *buffer;
1356 static int buffercapacity;
1357 char *new_buffer;
1358
1359 if(buffercapacity == 0)
1360 {
1361 buffer = pp_xmalloc(BUFFERINITIALCAPACITY);
1362 if(buffer == NULL)
1363 return;
1364 buffercapacity = BUFFERINITIALCAPACITY;
1365 }
1366
1367 va_start(valist, format);
1368 len = vsnprintf(buffer, buffercapacity,
1369 format, valist);
1370 va_end(valist);
1371 /* If the string is longer than buffersize, vsnprintf returns
1372 * the string length with glibc >= 2.1, -1 with glibc < 2.1 */
1373 while(len > buffercapacity || len < 0)
1374 {
1375 do
1376 {
1377 buffercapacity *= 2;
1378 } while(len > buffercapacity);
1379
1380 new_buffer = pp_xrealloc(buffer, buffercapacity);
1381 if(new_buffer == NULL)
1382 {
1383 va_end(valist);
1384 return;
1385 }
1386 buffer = new_buffer;
1387 va_start(valist, format);
1388 len = vsnprintf(buffer, buffercapacity,
1389 format, valist);
1390 va_end(valist);
1391 }
1392
1393 wpp_callbacks->write(buffer, len);
1394 }
1395
1396 /*
1397 **************************************************************************
1398 * The scanner starts here
1399 **************************************************************************
1400 */
1401 #line 1402 "ppl.yy.c"
1402
1403 #define INITIAL 0
1404 #define pp_pp 1
1405 #define pp_eol 2
1406 #define pp_inc 3
1407 #define pp_dqs 4
1408 #define pp_sqs 5
1409 #define pp_iqs 6
1410 #define pp_comment 7
1411 #define pp_def 8
1412 #define pp_define 9
1413 #define pp_macro 10
1414 #define pp_mbody 11
1415 #define pp_macign 12
1416 #define pp_macscan 13
1417 #define pp_macexp 14
1418 #define pp_if 15
1419 #define pp_ifd 16
1420 #define pp_endif 17
1421 #define pp_line 18
1422 #define pp_defined 19
1423 #define pp_ignore 20
1424 #define RCINCL 21
1425
1426 #ifndef YY_NO_UNISTD_H
1427 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1428 * down here because we want the user's section 1 to have been scanned first.
1429 * The user has a chance to override it with an option.
1430 */
1431 #include <unistd.h>
1432 #endif
1433
1434 #ifndef YY_EXTRA_TYPE
1435 #define YY_EXTRA_TYPE void *
1436 #endif
1437
1438 static int yy_init_globals (void );
1439
1440 /* Accessor methods to globals.
1441 These are made visible to non-reentrant scanners for convenience. */
1442
1443 int ppy_lex_destroy (void );
1444
1445 int ppy_get_debug (void );
1446
1447 void ppy_set_debug (int debug_flag );
1448
1449 YY_EXTRA_TYPE ppy_get_extra (void );
1450
1451 void ppy_set_extra (YY_EXTRA_TYPE user_defined );
1452
1453 FILE *ppy_get_in (void );
1454
1455 void ppy_set_in (FILE * in_str );
1456
1457 FILE *ppy_get_out (void );
1458
1459 void ppy_set_out (FILE * out_str );
1460
1461 int ppy_get_leng (void );
1462
1463 char *ppy_get_text (void );
1464
1465 int ppy_get_lineno (void );
1466
1467 void ppy_set_lineno (int line_number );
1468
1469 /* Macros after this point can all be overridden by user definitions in
1470 * section 1.
1471 */
1472
1473 #ifndef YY_SKIP_YYWRAP
1474 #ifdef __cplusplus
1475 extern "C" int ppy_wrap (void );
1476 #else
1477 extern int ppy_wrap (void );
1478 #endif
1479 #endif
1480
1481 #ifndef yytext_ptr
1482 static void yy_flex_strncpy (char *,yyconst char *,int );
1483 #endif
1484
1485 #ifdef YY_NEED_STRLEN
1486 static int yy_flex_strlen (yyconst char * );
1487 #endif
1488
1489 #ifndef YY_NO_INPUT
1490
1491 #ifdef __cplusplus
1492 static int yyinput (void );
1493 #else
1494 static int input (void );
1495 #endif
1496
1497 #endif
1498
1499 static int yy_start_stack_ptr = 0;
1500 static int yy_start_stack_depth = 0;
1501 static int *yy_start_stack = NULL;
1502
1503 static void yy_push_state (int new_state );
1504
1505 static void yy_pop_state (void );
1506
1507 static int yy_top_state (void );
1508
1509 /* Amount of stuff to slurp up with each read. */
1510 #ifndef YY_READ_BUF_SIZE
1511 #ifdef __ia64__
1512 /* On IA-64, the buffer size is 16k, not 8k */
1513 #define YY_READ_BUF_SIZE 16384
1514 #else
1515 #define YY_READ_BUF_SIZE 8192
1516 #endif /* __ia64__ */
1517 #endif
1518
1519 /* Copy whatever the last rule matched to the standard output. */
1520 #ifndef ECHO
1521 /* This used to be an fputs(), but since the string might contain NUL's,
1522 * we now use fwrite().
1523 */
1524 #define ECHO do { if (fwrite( ppy_text, ppy_leng, 1, ppy_out )) {} } while (0)
1525 #endif
1526
1527 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1528 * is returned in "result".
1529 */
1530 #ifndef YY_INPUT
1531 #define YY_INPUT(buf,result,max_size) \
1532 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1533 { \
1534 int c = '*'; \
1535 size_t n; \
1536 for ( n = 0; n < max_size && \
1537 (c = getc( ppy_in )) != EOF && c != '\n'; ++n ) \
1538 buf[n] = (char) c; \
1539 if ( c == '\n' ) \
1540 buf[n++] = (char) c; \
1541 if ( c == EOF && ferror( ppy_in ) ) \
1542 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1543 result = n; \
1544 } \
1545 else \
1546 { \
1547 errno=0; \
1548 while ( (result = fread(buf, 1, max_size, ppy_in))==0 && ferror(ppy_in)) \
1549 { \
1550 if( errno != EINTR) \
1551 { \
1552 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1553 break; \
1554 } \
1555 errno=0; \
1556 clearerr(ppy_in); \
1557 } \
1558 }\
1559 \
1560
1561 #endif
1562
1563 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1564 * we don't want an extra ';' after the "return" because that will cause
1565 * some compilers to complain about unreachable statements.
1566 */
1567 #ifndef yyterminate
1568 #define yyterminate() return YY_NULL
1569 #endif
1570
1571 /* Number of entries by which start-condition stack grows. */
1572 #ifndef YY_START_STACK_INCR
1573 #define YY_START_STACK_INCR 25
1574 #endif
1575
1576 /* Report a fatal error. */
1577 #ifndef YY_FATAL_ERROR
1578 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1579 #endif
1580
1581 /* end tables serialization structures and prototypes */
1582
1583 /* Default declaration of generated scanner - a define so the user can
1584 * easily add parameters.
1585 */
1586 #ifndef YY_DECL
1587 #define YY_DECL_IS_OURS 1
1588
1589 extern int ppy_lex (void);
1590
1591 #define YY_DECL int ppy_lex (void)
1592 #endif /* !YY_DECL */
1593
1594 /* Code executed at the beginning of each rule, after ppy_text and ppy_leng
1595 * have been set up.
1596 */
1597 #ifndef YY_USER_ACTION
1598 #define YY_USER_ACTION
1599 #endif
1600
1601 /* Code executed at the end of each rule. */
1602 #ifndef YY_BREAK
1603 #define YY_BREAK break;
1604 #endif
1605
1606 #define YY_RULE_SETUP \
1607 if ( ppy_leng > 0 ) \
1608 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1609 (ppy_text[ppy_leng - 1] == '\n'); \
1610 YY_USER_ACTION
1611
1612 /** The main scanner function which does all the work.
1613 */
1614 YY_DECL
1615 {
1616 register yy_state_type yy_current_state;
1617 register char *yy_cp, *yy_bp;
1618 register int yy_act;
1619
1620 #line 366 "ppl.l"
1621
1622 /*
1623 * Catch line-continuations.
1624 * Note: Gcc keeps the line-continuations in, for example, strings
1625 * intact. However, I prefer to remove them all so that the next
1626 * scanner will not need to reduce the continuation state.
1627 *
1628 * <*>\\\n newline(0);
1629 */
1630
1631 /*
1632 * Detect the leading # of a preprocessor directive.
1633 */
1634 #line 1635 "ppl.yy.c"
1635
1636 if ( !(yy_init) )
1637 {
1638 (yy_init) = 1;
1639
1640 #ifdef YY_USER_INIT
1641 YY_USER_INIT;
1642 #endif
1643
1644 if ( ! (yy_start) )
1645 (yy_start) = 1; /* first start state */
1646
1647 if ( ! ppy_in )
1648 ppy_in = stdin;
1649
1650 if ( ! ppy_out )
1651 ppy_out = stdout;
1652
1653 if ( ! YY_CURRENT_BUFFER ) {
1654 ppy_ensure_buffer_stack ();
1655 YY_CURRENT_BUFFER_LVALUE =
1656 ppy__create_buffer(ppy_in,YY_BUF_SIZE );
1657 }
1658
1659 ppy__load_buffer_state( );
1660 }
1661
1662 while ( 1 ) /* loops until end-of-file is reached */
1663 {
1664 yy_cp = (yy_c_buf_p);
1665
1666 /* Support of ppy_text. */
1667 *yy_cp = (yy_hold_char);
1668
1669 /* yy_bp points to the position in yy_ch_buf of the start of
1670 * the current run.
1671 */
1672 yy_bp = yy_cp;
1673
1674 yy_current_state = (yy_start);
1675 yy_current_state += YY_AT_BOL();
1676 yy_match:
1677 do
1678 {
1679 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1680 if ( yy_accept[yy_current_state] )
1681 {
1682 (yy_last_accepting_state) = yy_current_state;
1683 (yy_last_accepting_cpos) = yy_cp;
1684 }
1685 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1686 {
1687 yy_current_state = (int) yy_def[yy_current_state];
1688 if ( yy_current_state >= 416 )
1689 yy_c = yy_meta[(unsigned int) yy_c];
1690 }
1691 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1692 ++yy_cp;
1693 }
1694 while ( yy_current_state != 415 );
1695 yy_cp = (yy_last_accepting_cpos);
1696 yy_current_state = (yy_last_accepting_state);
1697
1698 yy_find_action:
1699 yy_act = yy_accept[yy_current_state];
1700
1701 YY_DO_BEFORE_ACTION;
1702
1703 do_action: /* This label is used only to access EOF actions. */
1704
1705 switch ( yy_act )
1706 { /* beginning of action switch */
1707 case 0: /* must back up */
1708 /* undo the effects of YY_DO_BEFORE_ACTION */
1709 *yy_cp = (yy_hold_char);
1710 yy_cp = (yy_last_accepting_cpos);
1711 yy_current_state = (yy_last_accepting_state);
1712 goto yy_find_action;
1713
1714 case 1:
1715 YY_RULE_SETUP
1716 #line 379 "ppl.l"
1717 pp_incl_state.seen_junk++; yy_push_state(pp_pp);
1718 YY_BREAK
1719 /*
1720 * Scan for the preprocessor directives
1721 */
1722 case 2:
1723 YY_RULE_SETUP
1724 #line 384 "ppl.l"
1725 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);}
1726 YY_BREAK
1727 case 3:
1728 YY_RULE_SETUP
1729 #line 385 "ppl.l"
1730 yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol);
1731 YY_BREAK
1732 case 4:
1733 YY_RULE_SETUP
1734 #line 386 "ppl.l"
1735 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR;
1736 YY_BREAK
1737 case 5:
1738 YY_RULE_SETUP
1739 #line 387 "ppl.l"
1740 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING;
1741 YY_BREAK
1742 case 6:
1743 YY_RULE_SETUP
1744 #line 388 "ppl.l"
1745 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA;
1746 YY_BREAK
1747 case 7:
1748 YY_RULE_SETUP
1749 #line 389 "ppl.l"
1750 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT;
1751 YY_BREAK
1752 case 8:
1753 YY_RULE_SETUP
1754 #line 390 "ppl.l"
1755 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
1756 YY_BREAK
1757 case 9:
1758 YY_RULE_SETUP
1759 #line 391 "ppl.l"
1760 yy_pp_state(pp_ifd); return tIFDEF;
1761 YY_BREAK
1762 case 10:
1763 YY_RULE_SETUP
1764 #line 392 "ppl.l"
1765 pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF;
1766 YY_BREAK
1767 case 11:
1768 YY_RULE_SETUP
1769 #line 393 "ppl.l"
1770 yy_pp_state(pp_if); return tIF;
1771 YY_BREAK
1772 case 12:
1773 YY_RULE_SETUP
1774 #line 394 "ppl.l"
1775 yy_pp_state(pp_if); return tELIF;
1776 YY_BREAK
1777 case 13:
1778 YY_RULE_SETUP
1779 #line 395 "ppl.l"
1780 yy_pp_state(pp_endif); return tELSE;
1781 YY_BREAK
1782 case 14:
1783 YY_RULE_SETUP
1784 #line 396 "ppl.l"
1785 yy_pp_state(pp_endif); return tENDIF;
1786 YY_BREAK
1787 case 15:
1788 YY_RULE_SETUP
1789 #line 397 "ppl.l"
1790 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
1791 YY_BREAK
1792 case 16:
1793 YY_RULE_SETUP
1794 #line 398 "ppl.l"
1795 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
1796 YY_BREAK
1797 case 17:
1798 YY_RULE_SETUP
1799 #line 399 "ppl.l"
1800 ppy_error("Invalid preprocessor token '%s'", ppy_text);
1801 YY_BREAK
1802 case 18:
1803 /* rule 18 can match eol */
1804 YY_RULE_SETUP
1805 #line 400 "ppl.l"
1806 newline(1); yy_pop_state(); return tNL; /* This could be the null-token */
1807 YY_BREAK
1808 case 19:
1809 /* rule 19 can match eol */
1810 YY_RULE_SETUP
1811 #line 401 "ppl.l"
1812 newline(0);
1813 YY_BREAK
1814 case 20:
1815 YY_RULE_SETUP
1816 #line 402 "ppl.l"
1817 ppy_error("Preprocessor junk '%s'", ppy_text);
1818 YY_BREAK
1819 case 21:
1820 YY_RULE_SETUP
1821 #line 403 "ppl.l"
1822 return *ppy_text;
1823 YY_BREAK
1824 /*
1825 * Handle #include and #line
1826 */
1827 case 22:
1828 YY_RULE_SETUP
1829 #line 408 "ppl.l"
1830 return make_number(10, &ppy_lval, ppy_text, ppy_leng);
1831 YY_BREAK
1832 case 23:
1833 YY_RULE_SETUP
1834 #line 409 "ppl.l"
1835 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs);
1836 YY_BREAK
1837 case 24:
1838 YY_RULE_SETUP
1839 #line 410 "ppl.l"
1840 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
1841 YY_BREAK
1842 case 25:
1843 YY_RULE_SETUP
1844 #line 411 "ppl.l"
1845 ;
1846 YY_BREAK
1847 case 26:
1848 /* rule 26 can match eol */
1849 YY_RULE_SETUP
1850 #line 412 "ppl.l"
1851 newline(1); yy_pop_state(); return tNL;
1852 YY_BREAK
1853 case 27:
1854 /* rule 27 can match eol */
1855 YY_RULE_SETUP
1856 #line 413 "ppl.l"
1857 newline(0);
1858 YY_BREAK
1859 case 28:
1860 YY_RULE_SETUP
1861 #line 414 "ppl.l"
1862 ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
1863 YY_BREAK
1864 /*
1865 * Ignore all input when a false clause is parsed
1866 */
1867 case 29:
1868 YY_RULE_SETUP
1869 #line 419 "ppl.l"
1870 ;
1871 YY_BREAK
1872 case 30:
1873 /* rule 30 can match eol */
1874 YY_RULE_SETUP
1875 #line 420 "ppl.l"
1876 newline(1);
1877 YY_BREAK
1878 case 31:
1879 /* rule 31 can match eol */
1880 YY_RULE_SETUP
1881 #line 421 "ppl.l"
1882 newline(0);
1883 YY_BREAK
1884 case 32:
1885 YY_RULE_SETUP
1886 #line 422 "ppl.l"
1887 ;
1888 YY_BREAK
1889 /*
1890 * Handle #if and #elif.
1891 * These require conditionals to be evaluated, but we do not
1892 * want to jam the scanner normally when we see these tokens.
1893 * Note: tIDENT is handled below.
1894 */
1895 case 33:
1896 YY_RULE_SETUP
1897 #line 431 "ppl.l"
1898 return make_number(8, &ppy_lval, ppy_text, ppy_leng);
1899 YY_BREAK
1900 case 34:
1901 YY_RULE_SETUP
1902 #line 432 "ppl.l"
1903 ppy_error("Invalid octal digit");
1904 YY_BREAK
1905 case 35:
1906 YY_RULE_SETUP
1907 #line 433 "ppl.l"
1908 return make_number(10, &ppy_lval, ppy_text, ppy_leng);
1909 YY_BREAK
1910 case 36:
1911 YY_RULE_SETUP
1912 #line 434 "ppl.l"
1913 return make_number(16, &ppy_lval, ppy_text, ppy_leng);
1914 YY_BREAK
1915 case 37:
1916 YY_RULE_SETUP
1917 #line 435 "ppl.l"
1918 ppy_error("Invalid hex number");
1919 YY_BREAK
1920 case 38:
1921 YY_RULE_SETUP
1922 #line 436 "ppl.l"
1923 yy_push_state(pp_defined); return tDEFINED;
1924 YY_BREAK
1925 case 39:
1926 YY_RULE_SETUP
1927 #line 437 "ppl.l"
1928 return tLSHIFT;
1929 YY_BREAK
1930 case 40:
1931 YY_RULE_SETUP
1932 #line 438 "ppl.l"
1933 return tRSHIFT;
1934 YY_BREAK
1935 case 41:
1936 YY_RULE_SETUP
1937 #line 439 "ppl.l"
1938 return tLOGAND;
1939 YY_BREAK
1940 case 42:
1941 YY_RULE_SETUP
1942 #line 440 "ppl.l"
1943 return tLOGOR;
1944 YY_BREAK
1945 case 43:
1946 YY_RULE_SETUP
1947 #line 441 "ppl.l"
1948 return tEQ;
1949 YY_BREAK
1950 case 44:
1951 YY_RULE_SETUP
1952 #line 442 "ppl.l"
1953 return tNE;
1954 YY_BREAK
1955 case 45:
1956 YY_RULE_SETUP
1957 #line 443 "ppl.l"
1958 return tLTE;
1959 YY_BREAK
1960 case 46:
1961 YY_RULE_SETUP
1962 #line 444 "ppl.l"
1963 return tGTE;
1964 YY_BREAK
1965 case 47:
1966 /* rule 47 can match eol */
1967 YY_RULE_SETUP
1968 #line 445 "ppl.l"
1969 newline(1); yy_pop_state(); return tNL;
1970 YY_BREAK
1971 case 48:
1972 /* rule 48 can match eol */
1973 YY_RULE_SETUP
1974 #line 446 "ppl.l"
1975 newline(0);
1976 YY_BREAK
1977 case 49:
1978 YY_RULE_SETUP
1979 #line 447 "ppl.l"
1980 ppy_error("Junk in conditional expression");
1981 YY_BREAK
1982 case 50:
1983 YY_RULE_SETUP
1984 #line 448 "ppl.l"
1985 ;
1986 YY_BREAK
1987 case 51:
1988 YY_RULE_SETUP
1989 #line 449 "ppl.l"
1990 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
1991 YY_BREAK
1992 case 52:
1993 YY_RULE_SETUP
1994 #line 450 "ppl.l"
1995 ppy_error("String constants not allowed in conditionals");
1996 YY_BREAK
1997 case 53:
1998 YY_RULE_SETUP
1999 #line 451 "ppl.l"
2000 return *ppy_text;
2001 YY_BREAK
2002 /*
2003 * Handle #ifdef, #ifndef and #undef
2004 * to get only an untranslated/unexpanded identifier
2005 */
2006 case 54:
2007 YY_RULE_SETUP
2008 #line 457 "ppl.l"
2009 ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
2010 YY_BREAK
2011 case 55:
2012 YY_RULE_SETUP
2013 #line 458 "ppl.l"
2014 ;
2015 YY_BREAK
2016 case 56:
2017 /* rule 56 can match eol */
2018 YY_RULE_SETUP
2019 #line 459 "ppl.l"
2020 newline(1); yy_pop_state(); return tNL;
2021 YY_BREAK
2022 case 57:
2023 /* rule 57 can match eol */
2024 YY_RULE_SETUP
2025 #line 460 "ppl.l"
2026 newline(0);
2027 YY_BREAK
2028 case 58:
2029 YY_RULE_SETUP
2030 #line 461 "ppl.l"
2031 ppy_error("Identifier expected");
2032 YY_BREAK
2033 /*
2034 * Handle #else and #endif.
2035 */
2036 case 59:
2037 YY_RULE_SETUP
2038 #line 466 "ppl.l"
2039 ;
2040 YY_BREAK
2041 case 60:
2042 /* rule 60 can match eol */
2043 YY_RULE_SETUP
2044 #line 467 "ppl.l"
2045 newline(1); yy_pop_state(); return tNL;
2046 YY_BREAK
2047 case 61:
2048 /* rule 61 can match eol */
2049 YY_RULE_SETUP
2050 #line 468 "ppl.l"
2051 newline(0);
2052 YY_BREAK
2053 case 62:
2054 YY_RULE_SETUP
2055 #line 469 "ppl.l"
2056 ppy_error("Garbage after #else or #endif.");
2057 YY_BREAK
2058 /*
2059 * Handle the special 'defined' keyword.
2060 * This is necessary to get the identifier prior to any
2061 * substitutions.
2062 */
2063 case 63:
2064 YY_RULE_SETUP
2065 #line 476 "ppl.l"
2066 yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
2067 YY_BREAK
2068 case 64:
2069 YY_RULE_SETUP
2070 #line 477 "ppl.l"
2071 ;
2072 YY_BREAK
2073 case 65:
2074 YY_RULE_SETUP
2075 #line 478 "ppl.l"
2076 return *ppy_text;
2077 YY_BREAK
2078 case 66:
2079 /* rule 66 can match eol */
2080 YY_RULE_SETUP
2081 #line 479 "ppl.l"
2082 newline(0);
2083 YY_BREAK
2084 case 67:
2085 /* rule 67 can match eol */
2086 YY_RULE_SETUP
2087 #line 480 "ppl.l"
2088 ppy_error("Identifier expected");
2089 YY_BREAK
2090 /*
2091 * Handle #error, #warning, #pragma and #ident.
2092 * Pass everything literally to the parser, which
2093 * will act appropriately.
2094 * Comments are stripped from the literal text.
2095 */
2096 case 68:
2097 YY_RULE_SETUP
2098 #line 488 "ppl.l"
2099 if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
2100 YY_BREAK
2101 case 69:
2102 YY_RULE_SETUP
2103 #line 489 "ppl.l"
2104 if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
2105 YY_BREAK
2106 case 70:
2107 /* rule 70 can match eol */
2108 YY_RULE_SETUP
2109 #line 490 "ppl.l"
2110 if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
2111 YY_BREAK
2112 case 71:
2113 /* rule 71 can match eol */
2114 YY_RULE_SETUP
2115 #line 491 "ppl.l"
2116 newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
2117 YY_BREAK
2118 case 72:
2119 /* rule 72 can match eol */
2120 YY_RULE_SETUP
2121 #line 492 "ppl.l"
2122 newline(0);
2123 YY_BREAK
2124 /*
2125 * Handle left side of #define
2126 */
2127 case 73:
2128 YY_RULE_SETUP
2129 #line 497 "ppl.l"
2130 ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
2131 YY_BREAK
2132 case 74:
2133 YY_RULE_SETUP
2134 #line 498 "ppl.l"
2135 ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE;
2136 YY_BREAK
2137 case 75:
2138 YY_RULE_SETUP
2139 #line 499 "ppl.l"
2140 ;
2141 YY_BREAK
2142 case 76:
2143 /* rule 76 can match eol */
2144 YY_RULE_SETUP
2145 #line 500 "ppl.l"
2146 newline(0);
2147 YY_BREAK
2148 case 77:
2149 /* rule 77 can match eol */
2150 YY_RULE_SETUP
2151 #line 501 "ppl.l"
2152 perror("Identifier expected");
2153 YY_BREAK
2154 /*
2155 * Scan the substitution of a define
2156 */
2157 case 78:
2158 YY_RULE_SETUP
2159 #line 506 "ppl.l"
2160 ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
2161 YY_BREAK
2162 case 79:
2163 /* rule 79 can match eol */
2164 YY_RULE_SETUP
2165 #line 507 "ppl.l"
2166 ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
2167 YY_BREAK
2168 case 80:
2169 /* rule 80 can match eol */
2170 YY_RULE_SETUP
2171 #line 508 "ppl.l"
2172 newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL;
2173 YY_BREAK
2174 case 81:
2175 /* rule 81 can match eol */
2176 YY_RULE_SETUP
2177 #line 509 "ppl.l"
2178 newline(0);
2179 YY_BREAK
2180 case 82:
2181 /* rule 82 can match eol */
2182 YY_RULE_SETUP
2183 #line 510 "ppl.l"
2184 newline(1); yy_pop_state(); return tNL;
2185 YY_BREAK
2186 case 83:
2187 YY_RULE_SETUP
2188 #line 511 "ppl.l"
2189 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
2190 YY_BREAK
2191 case 84:
2192 YY_RULE_SETUP
2193 #line 512 "ppl.l"
2194 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
2195 YY_BREAK
2196 /*
2197 * Scan the definition macro arguments
2198 */
2199 case 85:
2200 YY_RULE_SETUP
2201 #line 517 "ppl.l"
2202 yy_pp_state(pp_mbody); return tMACROEND;
2203 YY_BREAK
2204 case 86:
2205 YY_RULE_SETUP
2206 #line 518 "ppl.l"
2207 ;
2208 YY_BREAK
2209 case 87:
2210 YY_RULE_SETUP
2211 #line 519 "ppl.l"
2212 ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
2213 YY_BREAK
2214 case 88:
2215 YY_RULE_SETUP
2216 #line 520 "ppl.l"
2217 return ',';
2218 YY_BREAK
2219 case 89:
2220 YY_RULE_SETUP
2221 #line 521 "ppl.l"
2222 return tELIPSIS;
2223 YY_BREAK
2224 case 90:
2225 /* rule 90 can match eol */
2226 YY_RULE_SETUP
2227 #line 522 "ppl.l"
2228 ppy_error("Argument identifier expected");
2229 YY_BREAK
2230 case 91:
2231 /* rule 91 can match eol */
2232 YY_RULE_SETUP
2233 #line 523 "ppl.l"
2234 newline(0);
2235 YY_BREAK
2236 /*
2237 * Scan the substitution of a macro
2238 */
2239 case 92:
2240 YY_RULE_SETUP
2241 #line 528 "ppl.l"
2242 ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
2243 YY_BREAK
2244 case 93:
2245 YY_RULE_SETUP
2246 #line 529 "ppl.l"
2247 ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
2248 YY_BREAK
2249 case 94:
2250 YY_RULE_SETUP
2251 #line 530 "ppl.l"
2252 return tCONCAT;
2253 YY_BREAK
2254 case 95:
2255 YY_RULE_SETUP
2256 #line 531 "ppl.l"
2257 return tSTRINGIZE;
2258 YY_BREAK
2259 case 96:
2260 YY_RULE_SETUP
2261 #line 532 "ppl.l"
2262 ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
2263 YY_BREAK
2264 case 97:
2265 YY_RULE_SETUP
2266 #line 533 "ppl.l"
2267 ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
2268 YY_BREAK
2269 case 98:
2270 /* rule 98 can match eol */
2271 YY_RULE_SETUP
2272 #line 534 "ppl.l"
2273 newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL;
2274 YY_BREAK
2275 case 99:
2276 /* rule 99 can match eol */
2277 YY_RULE_SETUP
2278 #line 535 "ppl.l"
2279 newline(0);
2280 YY_BREAK
2281 case 100:
2282 /* rule 100 can match eol */
2283 YY_RULE_SETUP
2284 #line 536 "ppl.l"
2285 newline(1); yy_pop_state(); return tNL;
2286 YY_BREAK
2287 case 101:
2288 YY_RULE_SETUP
2289 #line 537 "ppl.l"
2290 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
2291 YY_BREAK
2292 case 102:
2293 YY_RULE_SETUP
2294 #line 538 "ppl.l"
2295 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
2296 YY_BREAK
2297 /*
2298 * Macro expansion text scanning.
2299 * This state is active just after the identifier is scanned
2300 * that triggers an expansion. We *must* delete the leading
2301 * whitespace before we can start scanning for arguments.
2302 *
2303 * If we do not see a '(' as next trailing token, then we have
2304 * a false alarm. We just continue with a nose-bleed...
2305 */
2306 case 103:
2307 *yy_cp = (yy_hold_char); /* undo effects of setting up ppy_text */
2308 (yy_c_buf_p) = yy_cp -= 1;
2309 YY_DO_BEFORE_ACTION; /* set up ppy_text again */
2310 YY_RULE_SETUP
2311 #line 549 "ppl.l"
2312 yy_pp_state(pp_macscan);
2313 YY_BREAK
2314 case 104:
2315 /* rule 104 can match eol */
2316 YY_RULE_SETUP
2317 #line 550 "ppl.l"
2318 {
2319 if(yy_top_state() != pp_macscan)
2320 newline(0);
2321 }
2322 YY_BREAK
2323 case 105:
2324 /* rule 105 can match eol */
2325 YY_RULE_SETUP
2326 #line 554 "ppl.l"
2327 newline(0);
2328 YY_BREAK
2329 case 106:
2330 YY_RULE_SETUP
2331 #line 555 "ppl.l"
2332 {
2333 macexpstackentry_t *mac = pop_macro();
2334 yy_pop_state();
2335 put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
2336 put_buffer(ppy_text, ppy_leng);
2337 free_macro(mac);
2338 }
2339 YY_BREAK
2340 /*
2341 * Macro expansion argument text scanning.
2342 * This state is active when a macro's arguments are being read for expansion.
2343 */
2344 case 107:
2345 YY_RULE_SETUP
2346 #line 567 "ppl.l"
2347 {
2348 if(++MACROPARENTHESES() > 1)
2349 add_text_to_macro(ppy_text, ppy_leng);
2350 }
2351 YY_BREAK
2352 case 108:
2353 YY_RULE_SETUP
2354 #line 571 "ppl.l"
2355 {
2356 if(--MACROPARENTHESES() == 0)
2357 {
2358 yy_pop_state();
2359 macro_add_arg(1);
2360 }
2361 else
2362 add_text_to_macro(ppy_text, ppy_leng);
2363 }
2364 YY_BREAK
2365 case 109:
2366 YY_RULE_SETUP
2367 #line 580 "ppl.l"
2368 {
2369 if(MACROPARENTHESES() > 1)
2370 add_text_to_macro(ppy_text, ppy_leng);
2371 else
2372 macro_add_arg(0);
2373 }
2374 YY_BREAK
2375 case 110:
2376 YY_RULE_SETUP
2377 #line 586 "ppl.l"
2378 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
2379 YY_BREAK
2380 case 111:
2381 YY_RULE_SETUP
2382 #line 587 "ppl.l"
2383 new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
2384 YY_BREAK
2385 case 112:
2386 YY_RULE_SETUP
2387 #line 588 "ppl.l"
2388 yy_push_state(pp_comment); add_text_to_macro(" ", 1);
2389 YY_BREAK
2390 case 113:
2391 /* rule 113 can match eol */
2392 YY_RULE_SETUP
2393 #line 589 "ppl.l"
2394 pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng);
2395 YY_BREAK
2396 case 114:
2397 YY_RULE_SETUP
2398 #line 590 "ppl.l"
2399 add_text_to_macro(ppy_text, ppy_leng);
2400 YY_BREAK
2401 case 115:
2402 /* rule 115 can match eol */
2403 YY_RULE_SETUP
2404 #line 591 "ppl.l"
2405 newline(0);
2406 YY_BREAK
2407 /*
2408 * Comment handling (almost all start-conditions)
2409 */
2410 case 116:
2411 YY_RULE_SETUP
2412 #line 596 "ppl.l"
2413 yy_push_state(pp_comment);
2414 YY_BREAK
2415 case 117:
2416 YY_RULE_SETUP
2417 #line 597 "ppl.l"
2418 ;
2419 YY_BREAK
2420 case 118:
2421 /* rule 118 can match eol */
2422 YY_RULE_SETUP
2423 #line 598 "ppl.l"
2424 newline(0);
2425 YY_BREAK
2426 case 119:
2427 YY_RULE_SETUP
2428 #line 599 "ppl.l"
2429 yy_pop_state();
2430 YY_BREAK
2431 /*
2432 * Remove C++ style comment (almost all start-conditions)
2433 */
2434 case 120:
2435 YY_RULE_SETUP
2436 #line 604 "ppl.l"
2437 {
2438 if(ppy_text[ppy_leng-1] == '\\')
2439 ppy_warning("C++ style comment ends with an escaped newline (escape ignored)");
2440 }
2441 YY_BREAK
2442 /*
2443 * Single, double and <> quoted constants
2444 */
2445 case 121:
2446 YY_RULE_SETUP
2447 #line 612 "ppl.l"
2448 pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
2449 YY_BREAK
2450 case 122:
2451 YY_RULE_SETUP
2452 #line 613 "ppl.l"
2453 pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
2454 YY_BREAK
2455 case 123:
2456 YY_RULE_SETUP
2457 #line 614 "ppl.l"
2458 add_string(ppy_text, ppy_leng);
2459 YY_BREAK
2460 case 124:
2461 YY_RULE_SETUP
2462 #line 615 "ppl.l"
2463 {
2464 add_string(ppy_text, ppy_leng);
2465 yy_pop_state();
2466 switch(yy_current_state())
2467 {
2468 case pp_pp:
2469 case pp_define:
2470 case pp_mbody:
2471 case pp_inc:
2472 case RCINCL:
2473 if (yy_current_state()==RCINCL) yy_pop_state();
2474 ppy_lval.cptr = get_string();
2475 return tDQSTRING;
2476 case pp_line:
2477 ppy_lval.cptr = get_string();
2478 return tDQSTRING;
2479 default:
2480 put_string();
2481 }
2482 }
2483 YY_BREAK
2484 case 125:
2485 YY_RULE_SETUP
2486 #line 635 "ppl.l"
2487 add_string(ppy_text, ppy_leng);
2488 YY_BREAK
2489 case 126:
2490 YY_RULE_SETUP
2491 #line 636 "ppl.l"
2492 {
2493 add_string(ppy_text, ppy_leng);
2494 yy_pop_state();
2495 switch(yy_current_state())
2496 {
2497 case pp_if:
2498 case pp_define:
2499 case pp_mbody:
2500 ppy_lval.cptr = get_string();
2501 return tSQSTRING;
2502 default:
2503 put_string();
2504 }
2505 }
2506 YY_BREAK
2507 case 127:
2508 YY_RULE_SETUP
2509 #line 650 "ppl.l"
2510 add_string(ppy_text, ppy_leng);
2511 YY_BREAK
2512 case 128:
2513 YY_RULE_SETUP
2514 #line 651 "ppl.l"
2515 {
2516 add_string(ppy_text, ppy_leng);
2517 yy_pop_state();
2518 ppy_lval.cptr = get_string();
2519 return tIQSTRING;
2520 }
2521 YY_BREAK
2522 case 129:
2523 /* rule 129 can match eol */
2524 YY_RULE_SETUP
2525 #line 657 "ppl.l"
2526 {
2527 /*
2528 * This is tricky; we need to remove the line-continuation
2529 * from preprocessor strings, but OTOH retain them in all
2530 * other strings. This is because the resource grammar is
2531 * even more braindead than initially analysed and line-
2532 * continuations in strings introduce, sigh, newlines in
2533 * the output. There goes the concept of non-breaking, non-
2534 * spacing whitespace.
2535 */
2536 switch(yy_top_state())
2537 {
2538 case pp_pp:
2539 case pp_define:
2540 case pp_mbody:
2541 case pp_inc:
2542 case pp_line:
2543 newline(0);
2544 break;
2545 default:
2546 add_string(ppy_text, ppy_leng);
2547 newline(-1);
2548 }
2549 }
2550 YY_BREAK
2551 case 130:
2552 YY_RULE_SETUP
2553 #line 681 "ppl.l"
2554 add_string(ppy_text, ppy_leng);
2555 YY_BREAK
2556 case 131:
2557 /* rule 131 can match eol */
2558 YY_RULE_SETUP
2559 #line 682 "ppl.l"
2560 {
2561 newline(1);
2562 add_string(ppy_text, ppy_leng);
2563 ppy_warning("Newline in string constant encountered (started line %d)", string_start());
2564 }
2565 YY_BREAK
2566 /*
2567 * Identifier scanning
2568 */
2569 case 132:
2570 YY_RULE_SETUP
2571 #line 691 "ppl.l"
2572 {
2573 pp_entry_t *ppp;
2574 pp_incl_state.seen_junk++;
2575 if(!(ppp = pplookup(ppy_text)))
2576 {
2577 if(yy_current_state() == pp_inc)
2578 ppy_error("Expected include filename");
2579
2580 else if(yy_current_state() == pp_if)
2581 {
2582 ppy_lval.cptr = pp_xstrdup(ppy_text);
2583 return tIDENT;
2584 }
2585 else {
2586 if((yy_current_state()==INITIAL) && (strcasecmp(ppy_text,"RCINCLUDE")==0)){
2587 yy_push_state(RCINCL);
2588 return tRCINCLUDE;
2589 }
2590 else put_buffer(ppy_text, ppy_leng);
2591 }
2592 }
2593 else if(!ppp->expanding)
2594 {
2595 switch(ppp->type)
2596 {
2597 case def_special:
2598 expand_special(ppp);
2599 break;
2600 case def_define:
2601 expand_define(ppp);
2602 break;
2603 case def_macro:
2604 yy_push_state(pp_macign);
2605 push_macro(ppp);
2606 break;
2607 default:
2608 pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type);
2609 }
2610 }
2611 else put_buffer(ppy_text, ppy_leng);
2612 }
2613 YY_BREAK
2614 /*
2615 * Everything else that needs to be passed and
2616 * newline and continuation handling
2617 */
2618 case 133:
2619 YY_RULE_SETUP
2620 #line 737 "ppl.l"
2621 pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng);
2622 YY_BREAK
2623 case 134:
2624 YY_RULE_SETUP
2625 #line 738 "ppl.l"
2626 put_buffer(ppy_text, ppy_leng);
2627 YY_BREAK
2628 case 135:
2629 /* rule 135 can match eol */
2630 YY_RULE_SETUP
2631 #line 739 "ppl.l"
2632 newline(1);
2633 YY_BREAK
2634 case 136:
2635 /* rule 136 can match eol */
2636 YY_RULE_SETUP
2637 #line 740 "ppl.l"
2638 newline(0);
2639 YY_BREAK
2640 case 137:
2641 YY_RULE_SETUP
2642 #line 741 "ppl.l"
2643 pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng);
2644 YY_BREAK
2645 /*
2646 * Special catcher for macro argmument expansion to prevent
2647 * newlines to propagate to the output or admin.
2648 */
2649 case 138:
2650 /* rule 138 can match eol */
2651 YY_RULE_SETUP
2652 #line 747 "ppl.l"
2653 put_buffer(ppy_text, ppy_leng);
2654 YY_BREAK
2655 case 139:
2656 YY_RULE_SETUP
2657 #line 749 "ppl.l"
2658 {
2659 ppy_lval.cptr=pp_xstrdup(ppy_text);
2660 yy_pop_state();
2661 return tRCINCLUDEPATH;
2662 }
2663 YY_BREAK
2664 case 140:
2665 YY_RULE_SETUP
2666 #line 755 "ppl.l"
2667 ;
2668 YY_BREAK
2669 case 141:
2670 YY_RULE_SETUP
2671 #line 757 "ppl.l"
2672 {
2673 new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs);
2674 }
2675 YY_BREAK
2676 /*
2677 * This is a 'catch-all' rule to discover errors in the scanner
2678 * in an orderly manner.
2679 */
2680 case 142:
2681 YY_RULE_SETUP
2682 #line 765 "ppl.l"
2683 pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text);
2684 YY_BREAK
2685 case YY_STATE_EOF(INITIAL):
2686 case YY_STATE_EOF(pp_pp):
2687 case YY_STATE_EOF(pp_eol):
2688 case YY_STATE_EOF(pp_inc):
2689 case YY_STATE_EOF(pp_dqs):
2690 case YY_STATE_EOF(pp_sqs):
2691 case YY_STATE_EOF(pp_iqs):
2692 case YY_STATE_EOF(pp_comment):
2693 case YY_STATE_EOF(pp_def):
2694 case YY_STATE_EOF(pp_define):
2695 case YY_STATE_EOF(pp_macro):
2696 case YY_STATE_EOF(pp_mbody):
2697 case YY_STATE_EOF(pp_macign):
2698 case YY_STATE_EOF(pp_macscan):
2699 case YY_STATE_EOF(pp_macexp):
2700 case YY_STATE_EOF(pp_if):
2701 case YY_STATE_EOF(pp_ifd):
2702 case YY_STATE_EOF(pp_endif):
2703 case YY_STATE_EOF(pp_line):
2704 case YY_STATE_EOF(pp_defined):
2705 case YY_STATE_EOF(pp_ignore):
2706 case YY_STATE_EOF(RCINCL):
2707 #line 767 "ppl.l"
2708 {
2709 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2710 bufferstackentry_t *bep = pop_buffer();
2711
2712 if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth))
2713 ppy_warning("Unmatched #if/#endif at end of file");
2714
2715 if(!bep)
2716 {
2717 if(YY_START != INITIAL)
2718 {
2719 ppy_error("Unexpected end of file during preprocessing");
2720 BEGIN(INITIAL);
2721 }
2722 yyterminate();
2723 }
2724 else if(bep->should_pop == 2)
2725 {
2726 macexpstackentry_t *mac;
2727 mac = pop_macro();
2728 expand_macro(mac);
2729 }
2730 ppy__delete_buffer(b);
2731 }
2732 YY_BREAK
2733 case 143:
2734 YY_RULE_SETUP
2735 #line 792 "ppl.l"
2736 ECHO;
2737 YY_BREAK
2738 #line 2739 "ppl.yy.c"
2739
2740 case YY_END_OF_BUFFER:
2741 {
2742 /* Amount of text matched not including the EOB char. */
2743 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2744
2745 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2746 *yy_cp = (yy_hold_char);
2747 YY_RESTORE_YY_MORE_OFFSET
2748
2749 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2750 {
2751 /* We're scanning a new file or input source. It's
2752 * possible that this happened because the user
2753 * just pointed ppy_in at a new source and called
2754 * ppy_lex(). If so, then we have to assure
2755 * consistency between YY_CURRENT_BUFFER and our
2756 * globals. Here is the right place to do so, because
2757 * this is the first action (other than possibly a
2758 * back-up) that will match for the new input source.
2759 */
2760 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2761 YY_CURRENT_BUFFER_LVALUE->yy_input_file = ppy_in;
2762 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2763 }
2764
2765 /* Note that here we test for yy_c_buf_p "<=" to the position
2766 * of the first EOB in the buffer, since yy_c_buf_p will
2767 * already have been incremented past the NUL character
2768 * (since all states make transitions on EOB to the
2769 * end-of-buffer state). Contrast this with the test
2770 * in input().
2771 */
2772 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2773 { /* This was really a NUL. */
2774 yy_state_type yy_next_state;
2775
2776 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2777
2778 yy_current_state = yy_get_previous_state( );
2779
2780 /* Okay, we're now positioned to make the NUL
2781 * transition. We couldn't have
2782 * yy_get_previous_state() go ahead and do it
2783 * for us because it doesn't know how to deal
2784 * with the possibility of jamming (and we don't
2785 * want to build jamming into it because then it
2786 * will run more slowly).
2787 */
2788
2789 yy_next_state = yy_try_NUL_trans( yy_current_state );
2790
2791 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2792
2793 if ( yy_next_state )
2794 {
2795 /* Consume the NUL. */
2796 yy_cp = ++(yy_c_buf_p);
2797 yy_current_state = yy_next_state;
2798 goto yy_match;
2799 }
2800
2801 else
2802 {
2803 yy_cp = (yy_last_accepting_cpos);
2804 yy_current_state = (yy_last_accepting_state);
2805 goto yy_find_action;
2806 }
2807 }
2808
2809 else switch ( yy_get_next_buffer( ) )
2810 {
2811 case EOB_ACT_END_OF_FILE:
2812 {
2813 (yy_did_buffer_switch_on_eof) = 0;
2814
2815 if ( ppy_wrap( ) )
2816 {
2817 /* Note: because we've taken care in
2818 * yy_get_next_buffer() to have set up
2819 * ppy_text, we can now set up
2820 * yy_c_buf_p so that if some total
2821 * hoser (like flex itself) wants to
2822 * call the scanner after we return the
2823 * YY_NULL, it'll still work - another
2824 * YY_NULL will get returned.
2825 */
2826 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2827
2828 yy_act = YY_STATE_EOF(YY_START);
2829 goto do_action;
2830 }
2831
2832 else
2833 {
2834 if ( ! (yy_did_buffer_switch_on_eof) )
2835 YY_NEW_FILE;
2836 }
2837 break;
2838 }
2839
2840 case EOB_ACT_CONTINUE_SCAN:
2841 (yy_c_buf_p) =
2842 (yytext_ptr) + yy_amount_of_matched_text;
2843
2844 yy_current_state = yy_get_previous_state( );
2845
2846 yy_cp = (yy_c_buf_p);
2847 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2848 goto yy_match;
2849
2850 case EOB_ACT_LAST_MATCH:
2851 (yy_c_buf_p) =
2852 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2853
2854 yy_current_state = yy_get_previous_state( );
2855
2856 yy_cp = (yy_c_buf_p);
2857 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2858 goto yy_find_action;
2859 }
2860 break;
2861 }
2862
2863 default:
2864 YY_FATAL_ERROR(
2865 "fatal flex scanner internal error--no action found" );
2866 } /* end of action switch */
2867 } /* end of scanning one token */
2868 } /* end of ppy_lex */
2869
2870 /* yy_get_next_buffer - try to read in a new buffer
2871 *
2872 * Returns a code representing an action:
2873 * EOB_ACT_LAST_MATCH -
2874 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2875 * EOB_ACT_END_OF_FILE - end of file
2876 */
2877 static int yy_get_next_buffer (void)
2878 {
2879 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2880 register char *source = (yytext_ptr);
2881 register int number_to_move, i;
2882 int ret_val;
2883
2884 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2885 YY_FATAL_ERROR(
2886 "fatal flex scanner internal error--end of buffer missed" );
2887
2888 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2889 { /* Don't try to fill the buffer, so this is an EOF. */
2890 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2891 {
2892 /* We matched a single character, the EOB, so
2893 * treat this as a final EOF.
2894 */
2895 return EOB_ACT_END_OF_FILE;
2896 }
2897
2898 else
2899 {
2900 /* We matched some text prior to the EOB, first
2901 * process it.
2902 */
2903 return EOB_ACT_LAST_MATCH;
2904 }
2905 }
2906
2907 /* Try to read more data. */
2908
2909 /* First move last chars to start of buffer. */
2910 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2911
2912 for ( i = 0; i < number_to_move; ++i )
2913 *(dest++) = *(source++);
2914
2915 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2916 /* don't do the read, it's not guaranteed to return an EOF,
2917 * just force an EOF
2918 */
2919 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2920
2921 else
2922 {
2923 int num_to_read =
2924 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2925
2926 while ( num_to_read <= 0 )
2927 { /* Not enough room in the buffer - grow it. */
2928
2929 /* just a shorter name for the current buffer */
2930 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2931
2932 int yy_c_buf_p_offset =
2933 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2934
2935 if ( b->yy_is_our_buffer )
2936 {
2937 int new_size = b->yy_buf_size * 2;
2938
2939 if ( new_size <= 0 )
2940 b->yy_buf_size += b->yy_buf_size / 8;
2941 else
2942 b->yy_buf_size *= 2;
2943
2944 b->yy_ch_buf = (char *)
2945 /* Include room in for 2 EOB chars. */
2946 ppy_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
2947 }
2948 else
2949 /* Can't grow it, we don't own it. */
2950 b->yy_ch_buf = 0;
2951
2952 if ( ! b->yy_ch_buf )
2953 YY_FATAL_ERROR(
2954 "fatal error - scanner input buffer overflow" );
2955
2956 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2957
2958 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2959 number_to_move - 1;
2960
2961 }
2962
2963 if ( num_to_read > YY_READ_BUF_SIZE )
2964 num_to_read = YY_READ_BUF_SIZE;
2965
2966 /* Read in more data. */
2967 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2968 (yy_n_chars), (size_t) num_to_read );
2969
2970 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2971 }
2972
2973 if ( (yy_n_chars) == 0 )
2974 {
2975 if ( number_to_move == YY_MORE_ADJ )
2976 {
2977 ret_val = EOB_ACT_END_OF_FILE;
2978 ppy_restart(ppy_in );
2979 }
2980
2981 else
2982 {
2983 ret_val = EOB_ACT_LAST_MATCH;
2984 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2985 YY_BUFFER_EOF_PENDING;
2986 }
2987 }
2988
2989 else
2990 ret_val = EOB_ACT_CONTINUE_SCAN;
2991
2992 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2993 /* Extend the array by 50%, plus the number we really need. */
2994 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2995 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ppy_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
2996 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2997 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2998 }
2999
3000 (yy_n_chars) += number_to_move;
3001 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
3002 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
3003
3004 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3005
3006 return ret_val;
3007 }
3008
3009 /* yy_get_previous_state - get the state just before the EOB char was reached */
3010
3011 static yy_state_type yy_get_previous_state (void)
3012 {
3013 register yy_state_type yy_current_state;
3014 register char *yy_cp;
3015
3016 yy_current_state = (yy_start);
3017 yy_current_state += YY_AT_BOL();
3018
3019 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3020 {
3021 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3022 if ( yy_accept[yy_current_state] )
3023 {
3024 (yy_last_accepting_state) = yy_current_state;
3025 (yy_last_accepting_cpos) = yy_cp;
3026 }
3027 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3028 {
3029 yy_current_state = (int) yy_def[yy_current_state];
3030 if ( yy_current_state >= 416 )
3031 yy_c = yy_meta[(unsigned int) yy_c];
3032 }
3033 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3034 }
3035
3036 return yy_current_state;
3037 }
3038
3039 /* yy_try_NUL_trans - try to make a transition on the NUL character
3040 *
3041 * synopsis
3042 * next_state = yy_try_NUL_trans( current_state );
3043 */
3044 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
3045 {
3046 register int yy_is_jam;
3047 register char *yy_cp = (yy_c_buf_p);
3048
3049 register YY_CHAR yy_c = 1;
3050 if ( yy_accept[yy_current_state] )
3051 {
3052 (yy_last_accepting_state) = yy_current_state;
3053 (yy_last_accepting_cpos) = yy_cp;
3054 }
3055 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3056 {
3057 yy_current_state = (int) yy_def[yy_current_state];
3058 if ( yy_current_state >= 416 )
3059 yy_c = yy_meta[(unsigned int) yy_c];
3060 }
3061 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3062 yy_is_jam = (yy_current_state == 415);
3063
3064 return yy_is_jam ? 0 : yy_current_state;
3065 }
3066
3067 #ifndef YY_NO_INPUT
3068 #ifdef __cplusplus
3069 static int yyinput (void)
3070 #else
3071 static int input (void)
3072 #endif
3073
3074 {
3075 int c;
3076
3077 *(yy_c_buf_p) = (yy_hold_char);
3078
3079 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3080 {
3081 /* yy_c_buf_p now points to the character we want to return.
3082 * If this occurs *before* the EOB characters, then it's a
3083 * valid NUL; if not, then we've hit the end of the buffer.
3084 */
3085 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3086 /* This was really a NUL. */
3087 *(yy_c_buf_p) = '\0';
3088
3089 else
3090 { /* need more input */
3091 int offset = (yy_c_buf_p) - (yytext_ptr);
3092 ++(yy_c_buf_p);
3093
3094 switch ( yy_get_next_buffer( ) )
3095 {
3096 case EOB_ACT_LAST_MATCH:
3097 /* This happens because yy_g_n_b()
3098 * sees that we've accumulated a
3099 * token and flags that we need to
3100 * try matching the token before
3101 * proceeding. But for input(),
3102 * there's no matching to consider.
3103 * So convert the EOB_ACT_LAST_MATCH
3104 * to EOB_ACT_END_OF_FILE.
3105 */
3106
3107 /* Reset buffer status. */
3108 ppy_restart(ppy_in );
3109
3110 /*FALLTHROUGH*/
3111
3112 case EOB_ACT_END_OF_FILE:
3113 {
3114 if ( ppy_wrap( ) )
3115 return EOF;
3116
3117 if ( ! (yy_did_buffer_switch_on_eof) )
3118 YY_NEW_FILE;
3119 #ifdef __cplusplus
3120 return yyinput();
3121 #else
3122 return input();
3123 #endif
3124 }
3125
3126 case EOB_ACT_CONTINUE_SCAN:
3127 (yy_c_buf_p) = (yytext_ptr) + offset;
3128 break;
3129 }
3130 }
3131 }
3132
3133 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
3134 *(yy_c_buf_p) = '\0'; /* preserve ppy_text */
3135 (yy_hold_char) = *++(yy_c_buf_p);
3136
3137 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3138
3139 return c;
3140 }
3141 #endif /* ifndef YY_NO_INPUT */
3142
3143 /** Immediately switch to a different input stream.
3144 * @param input_file A readable stream.
3145 *
3146 * @note This function does not reset the start condition to @c INITIAL .
3147 */
3148 void ppy_restart (FILE * input_file )
3149 {
3150
3151 if ( ! YY_CURRENT_BUFFER ){
3152 ppy_ensure_buffer_stack ();
3153 YY_CURRENT_BUFFER_LVALUE =
3154 ppy__create_buffer(ppy_in,YY_BUF_SIZE );
3155 }
3156
3157 ppy__init_buffer(YY_CURRENT_BUFFER,input_file );
3158 ppy__load_buffer_state( );
3159 }
3160
3161 /** Switch to a different input buffer.
3162 * @param new_buffer The new input buffer.
3163 *
3164 */
3165 void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer )
3166 {
3167
3168 /* TODO. We should be able to replace this entire function body
3169 * with
3170 * ppy_pop_buffer_state();
3171 * ppy_push_buffer_state(new_buffer);
3172 */
3173 ppy_ensure_buffer_stack ();
3174 if ( YY_CURRENT_BUFFER == new_buffer )
3175 return;
3176
3177 if ( YY_CURRENT_BUFFER )
3178 {
3179 /* Flush out information for old buffer. */
3180 *(yy_c_buf_p) = (yy_hold_char);
3181 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3182 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3183 }
3184
3185 YY_CURRENT_BUFFER_LVALUE = new_buffer;
3186 ppy__load_buffer_state( );
3187
3188 /* We don't actually know whether we did this switch during
3189 * EOF (ppy_wrap()) processing, but the only time this flag
3190 * is looked at is after ppy_wrap() is called, so it's safe
3191 * to go ahead and always set it.
3192 */
3193 (yy_did_buffer_switch_on_eof) = 1;
3194 }
3195
3196 static void ppy__load_buffer_state (void)
3197 {
3198 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3199 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3200 ppy_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3201 (yy_hold_char) = *(yy_c_buf_p);
3202 }
3203
3204 /** Allocate and initialize an input buffer state.
3205 * @param file A readable stream.
3206 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
3207 *
3208 * @return the allocated buffer state.
3209 */
3210 YY_BUFFER_STATE ppy__create_buffer (FILE * file, int size )
3211 {
3212 YY_BUFFER_STATE b;
3213
3214 b = (YY_BUFFER_STATE) ppy_alloc(sizeof( struct yy_buffer_state ) );
3215 if ( ! b )
3216 YY_FATAL_ERROR( "out of dynamic memory in ppy__create_buffer()" );
3217
3218 b->yy_buf_size = size;
3219
3220 /* yy_ch_buf has to be 2 characters longer than the size given because
3221 * we need to put in 2 end-of-buffer characters.
3222 */
3223 b->yy_ch_buf = (char *) ppy_alloc(b->yy_buf_size + 2 );
3224 if ( ! b->yy_ch_buf )
3225 YY_FATAL_ERROR( "out of dynamic memory in ppy__create_buffer()" );
3226
3227 b->yy_is_our_buffer = 1;
3228
3229 ppy__init_buffer(b,file );
3230
3231 return b;
3232 }
3233
3234 /** Destroy the buffer.
3235 * @param b a buffer created with ppy__create_buffer()
3236 *
3237 */
3238 void ppy__delete_buffer (YY_BUFFER_STATE b )
3239 {
3240
3241 if ( ! b )
3242 return;
3243
3244 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3245 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
3246
3247 if ( b->yy_is_our_buffer )
3248 ppy_free((void *) b->yy_ch_buf );
3249
3250 ppy_free((void *) b );
3251 }
3252
3253 /* Initializes or reinitializes a buffer.
3254 * This function is sometimes called more than once on the same buffer,
3255 * such as during a ppy_restart() or at EOF.
3256 */
3257 static void ppy__init_buffer (YY_BUFFER_STATE b, FILE * file )
3258
3259 {
3260 int oerrno = errno;
3261
3262 ppy__flush_buffer(b );
3263
3264 b->yy_input_file = file;
3265 b->yy_fill_buffer = 1;
3266
3267 /* If b is the current buffer, then ppy__init_buffer was _probably_
3268 * called from ppy_restart() or through yy_get_next_buffer.
3269 * In that case, we don't want to reset the lineno or column.
3270 */
3271 if (b != YY_CURRENT_BUFFER){
3272 b->yy_bs_lineno = 1;
3273 b->yy_bs_column = 0;
3274 }
3275
3276 b->yy_is_interactive = 0;
3277
3278 errno = oerrno;
3279 }
3280
3281 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
3282 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
3283 *
3284 */
3285 void ppy__flush_buffer (YY_BUFFER_STATE b )
3286 {
3287 if ( ! b )
3288 return;
3289
3290 b->yy_n_chars = 0;
3291
3292 /* We always need two end-of-buffer characters. The first causes
3293 * a transition to the end-of-buffer state. The second causes
3294 * a jam in that state.
3295 */
3296 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3297 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3298
3299 b->yy_buf_pos = &b->yy_ch_buf[0];
3300
3301 b->yy_at_bol = 1;
3302 b->yy_buffer_status = YY_BUFFER_NEW;
3303
3304 if ( b == YY_CURRENT_BUFFER )
3305 ppy__load_buffer_state( );
3306 }
3307
3308 /** Pushes the new state onto the stack. The new state becomes
3309 * the current state. This function will allocate the stack
3310 * if necessary.
3311 * @param new_buffer The new state.
3312 *
3313 */
3314 void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer )
3315 {
3316 if (new_buffer == NULL)
3317 return;
3318
3319 ppy_ensure_buffer_stack();
3320
3321 /* This block is copied from ppy__switch_to_buffer. */
3322 if ( YY_CURRENT_BUFFER )
3323 {
3324 /* Flush out information for old buffer. */
3325 *(yy_c_buf_p) = (yy_hold_char);
3326 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3327 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3328 }
3329
3330 /* Only push if top exists. Otherwise, replace top. */
3331 if (YY_CURRENT_BUFFER)
3332 (yy_buffer_stack_top)++;
3333 YY_CURRENT_BUFFER_LVALUE = new_buffer;
3334
3335 /* copied from ppy__switch_to_buffer. */
3336 ppy__load_buffer_state( );
3337 (yy_did_buffer_switch_on_eof) = 1;
3338 }
3339
3340 /** Removes and deletes the top of the stack, if present.
3341 * The next element becomes the new top.
3342 *
3343 */
3344 void ppy_pop_buffer_state (void)
3345 {
3346 if (!YY_CURRENT_BUFFER)
3347 return;
3348
3349 ppy__delete_buffer(YY_CURRENT_BUFFER );
3350 YY_CURRENT_BUFFER_LVALUE = NULL;
3351 if ((yy_buffer_stack_top) > 0)
3352 --(yy_buffer_stack_top);
3353
3354 if (YY_CURRENT_BUFFER) {
3355 ppy__load_buffer_state( );
3356 (yy_did_buffer_switch_on_eof) = 1;
3357 }
3358 }
3359
3360 /* Allocates the stack if it does not exist.
3361 * Guarantees space for at least one push.
3362 */
3363 static void ppy_ensure_buffer_stack (void)
3364 {
3365 int num_to_alloc;
3366
3367 if (!(yy_buffer_stack)) {
3368
3369 /* First allocation is just for 2 elements, since we don't know if this
3370 * scanner will even need a stack. We use 2 instead of 1 to avoid an
3371 * immediate realloc on the next call.
3372 */
3373 num_to_alloc = 1;
3374 (yy_buffer_stack) = (struct yy_buffer_state**)ppy_alloc
3375 (num_to_alloc * sizeof(struct yy_buffer_state*)
3376 );
3377 if ( ! (yy_buffer_stack) )
3378 YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" );
3379
3380 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3381
3382 (yy_buffer_stack_max) = num_to_alloc;
3383 (yy_buffer_stack_top) = 0;
3384 return;
3385 }
3386
3387 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3388
3389 /* Increase the buffer to prepare for a possible push. */
3390 int grow_size = 8 /* arbitrary grow size */;
3391
3392 num_to_alloc = (yy_buffer_stack_max) + grow_size;
3393 (yy_buffer_stack) = (struct yy_buffer_state**)ppy_realloc
3394 ((yy_buffer_stack),
3395 num_to_alloc * sizeof(struct yy_buffer_state*)
3396 );
3397 if ( ! (yy_buffer_stack) )
3398 YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" );
3399
3400 /* zero only the new slots.*/
3401 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3402 (yy_buffer_stack_max) = num_to_alloc;
3403 }
3404 }
3405
3406 /** Setup the input buffer state to scan directly from a user-specified character buffer.
3407 * @param base the character buffer
3408 * @param size the size in bytes of the character buffer
3409 *
3410 * @return the newly allocated buffer state object.
3411 */
3412 YY_BUFFER_STATE ppy__scan_buffer (char * base, yy_size_t size )
3413 {
3414 YY_BUFFER_STATE b;
3415
3416 if ( size < 2 ||
3417 base[size-2] != YY_END_OF_BUFFER_CHAR ||
3418 base[size-1] != YY_END_OF_BUFFER_CHAR )
3419 /* They forgot to leave room for the EOB's. */
3420 return 0;
3421
3422 b = (YY_BUFFER_STATE) ppy_alloc(sizeof( struct yy_buffer_state ) );
3423 if ( ! b )
3424 YY_FATAL_ERROR( "out of dynamic memory in ppy__scan_buffer()" );
3425
3426 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3427 b->yy_buf_pos = b->yy_ch_buf = base;
3428 b->yy_is_our_buffer = 0;
3429 b->yy_input_file = 0;
3430 b->yy_n_chars = b->yy_buf_size;
3431 b->yy_is_interactive = 0;
3432 b->yy_at_bol = 1;
3433 b->yy_fill_buffer = 0;
3434 b->yy_buffer_status = YY_BUFFER_NEW;
3435
3436 ppy__switch_to_buffer(b );
3437
3438 return b;
3439 }
3440
3441 /** Setup the input buffer state to scan a string. The next call to ppy_lex() will
3442 * scan from a @e copy of @a str.
3443 * @param yystr a NUL-terminated string to scan
3444 *
3445 * @return the newly allocated buffer state object.
3446 * @note If you want to scan bytes that may contain NUL values, then use
3447 * ppy__scan_bytes() instead.
3448 */
3449 YY_BUFFER_STATE ppy__scan_string (yyconst char * yystr )
3450 {
3451
3452 return ppy__scan_bytes(yystr,strlen(yystr) );
3453 }
3454
3455 /** Setup the input buffer state to scan the given bytes. The next call to ppy_lex() will
3456 * scan from a @e copy of @a bytes.
3457 * @param yybytes the byte buffer to scan
3458 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
3459 *
3460 * @return the newly allocated buffer state object.
3461 */
3462 YY_BUFFER_STATE ppy__scan_bytes (yyconst char * yybytes, int _yybytes_len )
3463 {
3464 YY_BUFFER_STATE b;
3465 char *buf;
3466 yy_size_t n;
3467 int i;
3468
3469 /* Get memory for full buffer, including space for trailing EOB's. */
3470 n = _yybytes_len + 2;
3471 buf = (char *) ppy_alloc(n );
3472 if ( ! buf )
3473 YY_FATAL_ERROR( "out of dynamic memory in ppy__scan_bytes()" );
3474
3475 for ( i = 0; i < _yybytes_len; ++i )
3476 buf[i] = yybytes[i];
3477
3478 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3479
3480 b = ppy__scan_buffer(buf,n );
3481 if ( ! b )
3482 YY_FATAL_ERROR( "bad buffer in ppy__scan_bytes()" );
3483
3484 /* It's okay to grow etc. this buffer, and we should throw it
3485 * away when we're done.
3486 */
3487 b->yy_is_our_buffer = 1;
3488
3489 return b;
3490 }
3491
3492 static void yy_push_state (int new_state )
3493 {
3494 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
3495 {
3496 yy_size_t new_size;
3497
3498 (yy_start_stack_depth) += YY_START_STACK_INCR;
3499 new_size = (yy_start_stack_depth) * sizeof( int );
3500
3501 if ( ! (yy_start_stack) )
3502 (yy_start_stack) = (int *) ppy_alloc(new_size );
3503
3504 else
3505 (yy_start_stack) = (int *) ppy_realloc((void *) (yy_start_stack),new_size );
3506
3507 if ( ! (yy_start_stack) )
3508 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
3509 }
3510
3511 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
3512
3513 BEGIN(new_state);
3514 }
3515
3516 static void yy_pop_state (void)
3517 {
3518 if ( --(yy_start_stack_ptr) < 0 )
3519 YY_FATAL_ERROR( "start-condition stack underflow" );
3520
3521 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
3522 }
3523
3524 static int yy_top_state (void)
3525 {
3526 return (yy_start_stack)[(yy_start_stack_ptr) - 1];
3527 }
3528
3529 #ifndef YY_EXIT_FAILURE
3530 #define YY_EXIT_FAILURE 2
3531 #endif
3532
3533 static void yy_fatal_error (yyconst char* msg )
3534 {
3535 (void) fprintf( stderr, "%s\n", msg );
3536 exit( YY_EXIT_FAILURE );
3537 }
3538
3539 /* Redefine yyless() so it works in section 3 code. */
3540
3541 #undef yyless
3542 #define yyless(n) \
3543 do \
3544 { \
3545 /* Undo effects of setting up ppy_text. */ \
3546 int yyless_macro_arg = (n); \
3547 YY_LESS_LINENO(yyless_macro_arg);\
3548 ppy_text[ppy_leng] = (yy_hold_char); \
3549 (yy_c_buf_p) = ppy_text + yyless_macro_arg; \
3550 (yy_hold_char) = *(yy_c_buf_p); \
3551 *(yy_c_buf_p) = '\0'; \
3552 ppy_leng = yyless_macro_arg; \
3553 } \
3554 while ( 0 )
3555
3556 /* Accessor methods (get/set functions) to struct members. */
3557
3558 /** Get the current line number.
3559 *
3560 */
3561 int ppy_get_lineno (void)
3562 {
3563
3564 return ppy_lineno;
3565 }
3566
3567 /** Get the input stream.
3568 *
3569 */
3570 FILE *ppy_get_in (void)
3571 {
3572 return ppy_in;
3573 }
3574
3575 /** Get the output stream.
3576 *
3577 */
3578 FILE *ppy_get_out (void)
3579 {
3580 return ppy_out;
3581 }
3582
3583 /** Get the length of the current token.
3584 *
3585 */
3586 int ppy_get_leng (void)
3587 {
3588 return ppy_leng;
3589 }
3590
3591 /** Get the current token.
3592 *
3593 */
3594
3595 char *ppy_get_text (void)
3596 {
3597 return ppy_text;
3598 }
3599
3600 /** Set the current line number.
3601 * @param line_number
3602 *
3603 */
3604 void ppy_set_lineno (int line_number )
3605 {
3606
3607 ppy_lineno = line_number;
3608 }
3609
3610 /** Set the input stream. This does not discard the current
3611 * input buffer.
3612 * @param in_str A readable stream.
3613 *
3614 * @see ppy__switch_to_buffer
3615 */
3616 void ppy_set_in (FILE * in_str )
3617 {
3618 ppy_in = in_str ;
3619 }
3620
3621 void ppy_set_out (FILE * out_str )
3622 {
3623 ppy_out = out_str ;
3624 }
3625
3626 int ppy_get_debug (void)
3627 {
3628 return ppy__flex_debug;
3629 }
3630
3631 void ppy_set_debug (int bdebug )
3632 {
3633 ppy__flex_debug = bdebug ;
3634 }
3635
3636 static int yy_init_globals (void)
3637 {
3638 /* Initialization is the same as for the non-reentrant scanner.
3639 * This function is called from ppy_lex_destroy(), so don't allocate here.
3640 */
3641
3642 (yy_buffer_stack) = 0;
3643 (yy_buffer_stack_top) = 0;
3644 (yy_buffer_stack_max) = 0;
3645 (yy_c_buf_p) = (char *) 0;
3646 (yy_init) = 0;
3647 (yy_start) = 0;
3648
3649 (yy_start_stack_ptr) = 0;
3650 (yy_start_stack_depth) = 0;
3651 (yy_start_stack) = NULL;
3652
3653 /* Defined in main.c */
3654 #ifdef YY_STDINIT
3655 ppy_in = stdin;
3656 ppy_out = stdout;
3657 #else
3658 ppy_in = (FILE *) 0;
3659 ppy_out = (FILE *) 0;
3660 #endif
3661
3662 /* For future reference: Set errno on error, since we are called by
3663 * ppy_lex_init()
3664 */
3665 return 0;
3666 }
3667
3668 /* ppy_lex_destroy is for both reentrant and non-reentrant scanners. */
3669 int ppy_lex_destroy (void)
3670 {
3671
3672 /* Pop the buffer stack, destroying each element. */
3673 while(YY_CURRENT_BUFFER){
3674 ppy__delete_buffer(YY_CURRENT_BUFFER );
3675 YY_CURRENT_BUFFER_LVALUE = NULL;
3676 ppy_pop_buffer_state();
3677 }
3678
3679 /* Destroy the stack itself. */
3680 ppy_free((yy_buffer_stack) );
3681 (yy_buffer_stack) = NULL;
3682
3683 /* Destroy the start condition stack. */
3684 ppy_free((yy_start_stack) );
3685 (yy_start_stack) = NULL;
3686
3687 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3688 * ppy_lex() is called, initialization will occur. */
3689 yy_init_globals( );
3690
3691 return 0;
3692 }
3693
3694 /*
3695 * Internal utility routines.
3696 */
3697
3698 #ifndef yytext_ptr
3699 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3700 {
3701 register int i;
3702 for ( i = 0; i < n; ++i )
3703 s1[i] = s2[i];
3704 }
3705 #endif
3706
3707 #ifdef YY_NEED_STRLEN
3708 static int yy_flex_strlen (yyconst char * s )
3709 {
3710 register int n;
3711 for ( n = 0; s[n]; ++n )
3712 ;
3713
3714 return n;
3715 }
3716 #endif
3717
3718 void *ppy_alloc (yy_size_t size )
3719 {
3720 return (void *) malloc( size );
3721 }
3722
3723 void *ppy_realloc (void * ptr, yy_size_t size )
3724 {
3725 /* The cast to (char *) in the following accommodates both
3726 * implementations that use char* generic pointers, and those
3727 * that use void* generic pointers. It works with the latter
3728 * because both ANSI C and C++ allow castless assignment from
3729 * any pointer type to void*, and deal with argument conversions
3730 * as though doing an assignment.
3731 */
3732 return (void *) realloc( (char *) ptr, size );
3733 }
3734
3735 void ppy_free (void * ptr )
3736 {
3737 free( (char *) ptr ); /* see ppy_realloc() for (char *) cast */
3738 }
3739
3740 #define YYTABLES_NAME "yytables"
3741
3742 #line 792 "ppl.l"
3743
3744
3745 /*
3746 **************************************************************************
3747 * Support functions
3748 **************************************************************************
3749 */
3750
3751 #ifndef ppy_wrap
3752 int ppy_wrap(void)
3753 {
3754 return 1;
3755 }
3756 #endif
3757
3758
3759 /*
3760 *-------------------------------------------------------------------------
3761 * Output newlines or set them as continuations
3762 *
3763 * Input: -1 - Don't count this one, but update local position (see pp_dqs)
3764 * 0 - Line-continuation seen and cache output
3765 * 1 - Newline seen and flush output
3766 *-------------------------------------------------------------------------
3767 */
3768 static void newline(int dowrite)
3769 {
3770 pp_status.line_number++;
3771 pp_status.char_number = 1;
3772
3773 if(dowrite == -1)
3774 return;
3775
3776 ncontinuations++;
3777 if(dowrite)
3778 {
3779 for(;ncontinuations; ncontinuations--)
3780 put_buffer("\n", 1);
3781 }
3782 }
3783
3784
3785 /*
3786 *-------------------------------------------------------------------------
3787 * Make a number out of an any-base and suffixed string
3788 *
3789 * Possible number extensions:
3790 * - "" int
3791 * - "L" long int
3792 * - "LL" long long int
3793 * - "U" unsigned int
3794 * - "UL" unsigned long int
3795 * - "ULL" unsigned long long int
3796 * - "LU" unsigned long int
3797 * - "LLU" unsigned long long int
3798 * - "LUL" invalid
3799 *
3800 * FIXME:
3801 * The sizes of resulting 'int' and 'long' are compiler specific.
3802 * I depend on sizeof(int) > 2 here (although a relatively safe
3803 * assumption).
3804 * Long longs are not yet implemented because this is very compiler
3805 * specific and I don't want to think too much about the problems.
3806 *
3807 *-------------------------------------------------------------------------
3808 */
3809 static int make_number(int radix, YYSTYPE *val, const char *str, int len)
3810 {
3811 int is_l = 0;
3812 int is_ll = 0;
3813 int is_u = 0;
3814 char ext[4];
3815 long l;
3816
3817 ext[3] = '\0';
3818 ext[2] = toupper(str[len-1]);
3819 ext[1] = len > 1 ? toupper(str[len-2]) : ' ';
3820 ext[0] = len > 2 ? toupper(str[len-3]) : ' ';
3821
3822 if(!strcmp(ext, "LUL"))
3823 {
3824 ppy_error("Invalid constant suffix");
3825 return 0;
3826 }
3827 else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
3828 {
3829 is_ll++;
3830 is_u++;
3831 }
3832 else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL"))
3833 {
3834 is_l++;
3835 is_u++;
3836 }
3837 else if(!strcmp(ext+1, "LL"))
3838 {
3839 is_ll++;
3840 }
3841 else if(!strcmp(ext+2, "L"))
3842 {
3843 is_l++;
3844 }
3845 else if(!strcmp(ext+2, "U"))
3846 {
3847 is_u++;
3848 }
3849
3850 if(is_ll)
3851 {
3852 /* Assume as in the declaration of wrc_ull_t and wrc_sll_t */
3853 #ifdef HAVE_LONG_LONG
3854 if (is_u)
3855 {
3856 errno = 0;
3857 val->ull = strtoull(str, NULL, radix);
3858 if (val->ull == ULLONG_MAX && errno == ERANGE)
3859 ppy_error("integer constant %s is too large\n", str);
3860 return tULONGLONG;
3861 }
3862 else
3863 {
3864 errno = 0;
3865 val->sll = strtoll(str, NULL, radix);
3866 if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE)
3867 ppy_error("integer constant %s is too large\n", str);
3868 return tSLONGLONG;
3869 }
3870 #else
3871 pp_internal_error(__FILE__, __LINE__, "long long constants not supported on this platform");
3872 #endif
3873 }
3874 else if(is_u && is_l)
3875 {
3876 errno = 0;
3877 val->ulong = strtoul(str, NULL, radix);
3878 if (val->ulong == ULONG_MAX && errno == ERANGE)
3879 ppy_error("integer constant %s is too large\n", str);
3880 return tULONG;
3881 }
3882 else if(!is_u && is_l)
3883 {
3884 errno = 0;
3885 val->slong = strtol(str, NULL, radix);
3886 if ((val->slong == LONG_MIN || val->slong == LONG_MAX) && errno == ERANGE)
3887 ppy_error("integer constant %s is too large\n", str);
3888 return tSLONG;
3889 }
3890 else if(is_u && !is_l)
3891 {
3892 unsigned long ul;
3893 errno = 0;
3894 ul = strtoul(str, NULL, radix);
3895 if ((ul == ULONG_MAX && errno == ERANGE) || (ul > UINT_MAX))
3896 ppy_error("integer constant %s is too large\n", str);
3897 val->uint = (unsigned int)ul;
3898 return tUINT;
3899 }
3900
3901 /* Else it must be an int... */
3902 errno = 0;
3903 l = strtol(str, NULL, radix);
3904 if (((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE) ||
3905 (l > INT_MAX) || (l < INT_MIN))
3906 ppy_error("integer constant %s is too large\n", str);
3907 val->sint = (int)l;
3908 return tSINT;
3909 }
3910
3911
3912 /*
3913 *-------------------------------------------------------------------------
3914 * Macro and define expansion support
3915 *
3916 * FIXME: Variable macro arguments.
3917 *-------------------------------------------------------------------------
3918 */
3919 static void expand_special(pp_entry_t *ppp)
3920 {
3921 static char *buf = NULL;
3922 char *new_buf;
3923
3924 assert(ppp->type == def_special);
3925
3926 if(!strcmp(ppp->ident, "__LINE__"))
3927 {
3928 new_buf = pp_xrealloc(buf, 32);
3929 if(!new_buf)
3930 return;
3931 buf = new_buf;
3932 sprintf(buf, "%d", pp_status.line_number);
3933 }
3934 else if(!strcmp(ppp->ident, "__FILE__"))
3935 {
3936 new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3);
3937 if(!new_buf)
3938 return;
3939 buf = new_buf;
3940 sprintf(buf, "\"%s\"", pp_status.input);
3941 }
3942 else
3943 pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident);
3944
3945 if(pp_flex_debug)
3946 fprintf(stderr, "expand_special(%d): %s:%d: '%s' -> '%s'\n",
3947 macexpstackidx,
3948 pp_status.input,
3949 pp_status.line_number,
3950 ppp->ident,
3951 buf ? buf : "");
3952
3953 if(buf && buf[0])
3954 {
3955 push_buffer(ppp, NULL, NULL, 0);
3956 ppy__scan_string(buf);
3957 }
3958 }
3959
3960 static void expand_define(pp_entry_t *ppp)
3961 {
3962 assert(ppp->type == def_define);
3963
3964 if(pp_flex_debug)
3965 fprintf(stderr, "expand_define(%d): %s:%d: '%s' -> '%s'\n",
3966 macexpstackidx,
3967 pp_status.input,
3968 pp_status.line_number,
3969 ppp->ident,
3970 ppp->subst.text);
3971 if(ppp->subst.text && ppp->subst.text[0])
3972 {
3973 push_buffer(ppp, NULL, NULL, 0);
3974 ppy__scan_string(ppp->subst.text);
3975 }
3976 }
3977
3978 static int curdef_idx = 0;
3979 static int curdef_alloc = 0;
3980 static char *curdef_text = NULL;
3981
3982 static void add_text(const char *str, int len)
3983 {
3984 int new_alloc;
3985 char *new_text;
3986
3987 if(len == 0)
3988 return;
3989 if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len)
3990 {
3991 new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1));
3992 new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0]));
3993 if(!new_text)
3994 return;
3995 curdef_text = new_text;
3996 curdef_alloc = new_alloc;
3997 if(curdef_alloc > 65536)
3998 ppy_warning("Reallocating macro-expansion buffer larger than 64kB");
3999 }
4000 memcpy(&curdef_text[curdef_idx], str, len);
4001 curdef_idx += len;
4002 }
4003
4004 static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl)
4005 {
4006 char *cptr;
4007 char *exp;
4008 int tag;
4009 int n;
4010
4011 if(mtp == NULL)
4012 return NULL;
4013
4014 switch(mtp->type)
4015 {
4016 case exp_text:
4017 if(pp_flex_debug)
4018 fprintf(stderr, "add_expand_text: exp_text: '%s'\n", mtp->subst.text);
4019 add_text(mtp->subst.text, strlen(mtp->subst.text));
4020 break;
4021
4022 case exp_stringize:
4023 if(pp_flex_debug)
4024 fprintf(stderr, "add_expand_text: exp_stringize(%d): '%s'\n",
4025 mtp->subst.argidx,
4026 mep->args[mtp->subst.argidx]);
4027 cptr = mep->args[mtp->subst.argidx];
4028 add_text("\"", 1);
4029 while(*cptr)
4030 {
4031 if(*cptr == '"' || *cptr == '\\')
4032 add_text("\\", 1);
4033 add_text(cptr, 1);
4034 cptr++;
4035 }
4036 add_text("\"", 1);
4037 break;
4038
4039 case exp_concat:
4040 if(pp_flex_debug)
4041 fprintf(stderr, "add_expand_text: exp_concat\n");
4042 /* Remove trailing whitespace from current expansion text */
4043 while(curdef_idx)
4044 {
4045 if(isspace(curdef_text[curdef_idx-1] & 0xff))
4046 curdef_idx--;
4047 else
4048 break;
4049 }
4050 /* tag current position and recursively expand the next part */
4051 tag = curdef_idx;
4052 mtp = add_expand_text(mtp->next, mep, nnl);
4053
4054 /* Now get rid of the leading space of the expansion */
4055 cptr = &curdef_text[tag];
4056 n = curdef_idx - tag;
4057 while(n)
4058 {
4059 if(isspace(*cptr & 0xff))
4060 {
4061 cptr++;
4062 n--;
4063 }
4064 else
4065 break;
4066 }
4067 if(cptr != &curdef_text[tag])
4068 {
4069 memmove(&curdef_text[tag], cptr, n);
4070 curdef_idx -= (curdef_idx - tag) - n;
4071 }
4072 break;
4073
4074 case exp_subst:
4075 if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat))
4076 exp = mep->args[mtp->subst.argidx];
4077 else
4078 exp = mep->ppargs[mtp->subst.argidx];
4079 if(exp)
4080 {
4081 add_text(exp, strlen(exp));
4082 *nnl -= mep->nnls[mtp->subst.argidx];
4083 cptr = strchr(exp, '\n');
4084 while(cptr)
4085 {
4086 *cptr = ' ';
4087 cptr = strchr(cptr+1, '\n');
4088 }
4089 mep->nnls[mtp->subst.argidx] = 0;
4090 }
4091 if(pp_flex_debug)
4092 fprintf(stderr, "add_expand_text: exp_subst(%d): '%s'\n", mtp->subst.argidx, exp);
4093 break;
4094
4095 default:
4096 pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type);
4097 }
4098 return mtp;
4099 }
4100
4101 static void expand_macro(macexpstackentry_t *mep)
4102 {
4103 mtext_t *mtp;
4104 int n, k;
4105 char *cptr;
4106 int nnl = 0;
4107 pp_entry_t *ppp = mep->ppp;
4108 int nargs = mep->nargs;
4109
4110 assert(ppp->type == def_macro);
4111 assert(ppp->expanding == 0);
4112
4113 if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
4114 {
4115 ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
4116 return;
4117 }
4118
4119 for(n = 0; n < nargs; n++)
4120 nnl += mep->nnls[n];
4121
4122 if(pp_flex_debug)
4123 fprintf(stderr, "expand_macro(%d): %s:%d: '%s'(%d,%d) -> ...\n",
4124 macexpstackidx,
4125 pp_status.input,
4126 pp_status.line_number,
4127 ppp->ident,
4128 mep->nargs,
4129 nnl);
4130
4131 curdef_idx = 0;
4132
4133 for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next)
4134 {
4135 if(!(mtp = add_expand_text(mtp, mep, &nnl)))
4136 break;
4137 }
4138
4139 for(n = 0; n < nnl; n++)
4140 add_text("\n", 1);
4141
4142 /* To make sure there is room and termination (see below) */
4143 add_text(" \0", 2);
4144
4145 /* Strip trailing whitespace from expansion */
4146 for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--)
4147 {
4148 if(!isspace(*cptr & 0xff))
4149 break;
4150 }
4151
4152 /*
4153 * We must add *one* whitespace to make sure that there
4154 * is a token-separation after the expansion.
4155 */
4156 *(++cptr) = ' ';
4157 *(++cptr) = '\0';
4158 k++;
4159
4160 /* Strip leading whitespace from expansion */
4161 for(n = 0, cptr = curdef_text; n < k; n++, cptr++)
4162 {
4163 if(!isspace(*cptr & 0xff))
4164 break;
4165 }
4166
4167 if(k - n > 0)
4168 {
4169 if(pp_flex_debug)
4170 fprintf(stderr, "expand_text: '%s'\n", curdef_text + n);
4171 push_buffer(ppp, NULL, NULL, 0);
4172 /*ppy__scan_bytes(curdef_text + n,k - n);*/
4173 ppy__scan_string(curdef_text + n);
4174 }
4175 }
4176
4177 /*
4178 *-------------------------------------------------------------------------
4179 * String collection routines
4180 *-------------------------------------------------------------------------
4181 */
4182 static void new_string(void)
4183 {
4184 #ifdef DEBUG
4185 if(strbuf_idx)
4186 ppy_warning("new_string: strbuf_idx != 0");
4187 #endif
4188 strbuf_idx = 0;
4189 str_startline = pp_status.line_number;
4190 }
4191
4192 static void add_string(const char *str, int len)
4193 {
4194 int new_alloc;
4195 char *new_buffer;
4196
4197 if(len == 0)
4198 return;
4199 if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len)
4200 {
4201 new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1));
4202 new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0]));
4203 if(!new_buffer)
4204 return;
4205 strbuffer = new_buffer;
4206 strbuf_alloc = new_alloc;
4207 if(strbuf_alloc > 65536)
4208 ppy_warning("Reallocating string buffer larger than 64kB");
4209 }
4210 memcpy(&strbuffer[strbuf_idx], str, len);
4211 strbuf_idx += len;
4212 }
4213
4214 static char *get_string(void)
4215 {
4216 char *str = pp_xmalloc(strbuf_idx + 1);
4217 if(!str)
4218 return NULL;
4219 memcpy(str, strbuffer, strbuf_idx);
4220 str[strbuf_idx] = '\0';
4221 #ifdef DEBUG
4222 strbuf_idx = 0;
4223 #endif
4224 return str;
4225 }
4226
4227 static void put_string(void)
4228 {
4229 put_buffer(strbuffer, strbuf_idx);
4230 #ifdef DEBUG
4231 strbuf_idx = 0;
4232 #endif
4233 }
4234
4235 static int string_start(void)
4236 {
4237 return str_startline;
4238 }
4239
4240
4241 /*
4242 *-------------------------------------------------------------------------
4243 * Buffer management
4244 *-------------------------------------------------------------------------
4245 */
4246 static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
4247 {
4248 if(ppy_debug)
4249 printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
4250 if(bufferstackidx >= MAXBUFFERSTACK)
4251 pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow");
4252
4253 memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
4254 bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
4255 bufferstack[bufferstackidx].filehandle = pp_status.file;
4256 bufferstack[bufferstackidx].define = ppp;
4257 bufferstack[bufferstackidx].line_number = pp_status.line_number;
4258 bufferstack[bufferstackidx].char_number = pp_status.char_number;
4259 bufferstack[bufferstackidx].if_depth = pp_get_if_depth();
4260 bufferstack[bufferstackidx].should_pop = pop;
4261 bufferstack[bufferstackidx].filename = pp_status.input;
4262 bufferstack[bufferstackidx].ncontinuations = ncontinuations;
4263 bufferstack[bufferstackidx].incl = pp_incl_state;
4264 bufferstack[bufferstackidx].include_filename = incname;
4265
4266 if(ppp)
4267 ppp->expanding = 1;
4268 else if(filename)
4269 {
4270 /* These will track the ppy_error to the correct file and line */
4271 pp_status.line_number = 1;
4272 pp_status.char_number = 1;
4273 pp_status.input = filename;
4274 ncontinuations = 0;
4275 }
4276 else if(!pop)
4277 pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
4278 bufferstackidx++;
4279 }
4280
4281 static bufferstackentry_t *pop_buffer(void)
4282 {
4283 if(bufferstackidx < 0)
4284 pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?");
4285
4286 if(bufferstackidx == 0)
4287 return NULL;
4288
4289 bufferstackidx--;
4290
4291 if(bufferstack[bufferstackidx].define)
4292 bufferstack[bufferstackidx].define->expanding = 0;
4293 else
4294 {
4295 includelogicentry_t *iep = NULL;
4296
4297 if(!bufferstack[bufferstackidx].should_pop)
4298 {
4299 wpp_callbacks->close(pp_status.file);
4300 pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename);
4301
4302 /* We have EOF, check the include logic */
4303 if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp)
4304 {
4305 pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
4306 if(ppp)
4307 {
4308 iep = pp_xmalloc(sizeof(includelogicentry_t));
4309 if (iep)
4310 {
4311 iep->ppp = ppp;
4312 ppp->iep = iep;
4313 iep->filename = bufferstack[bufferstackidx].include_filename;
4314 iep->prev = NULL;
4315 iep->next = pp_includelogiclist;
4316 if(iep->next)
4317 iep->next->prev = iep;
4318 pp_includelogiclist = iep;
4319 if(pp_status.debug)
4320 fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n",
4321 bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
4322 }
4323 }
4324 }
4325 free(pp_incl_state.ppp);
4326 pp_incl_state = bufferstack[bufferstackidx].incl;
4327
4328 }
4329 if (bufferstack[bufferstackidx].include_filename)
4330 {
4331 free(pp_status.input);
4332 pp_status.input = bufferstack[bufferstackidx].filename;
4333 }
4334 pp_status.line_number = bufferstack[bufferstackidx].line_number;
4335 pp_status.char_number = bufferstack[bufferstackidx].char_number;
4336 ncontinuations = bufferstack[bufferstackidx].ncontinuations;
4337 if (!iep)
4338 free(bufferstack[bufferstackidx].include_filename);
4339 }
4340
4341 if(ppy_debug)
4342 printf("pop_buffer(%d): %p %p (%d, %d, %d) %p %d\n",
4343 bufferstackidx,
4344 bufferstack[bufferstackidx].bufferstate,
4345 bufferstack[bufferstackidx].define,
4346 bufferstack[bufferstackidx].line_number,
4347 bufferstack[bufferstackidx].char_number,
4348 bufferstack[bufferstackidx].if_depth,
4349 bufferstack[bufferstackidx].filename,
4350 bufferstack[bufferstackidx].should_pop);
4351
4352 pp_status.file = bufferstack[bufferstackidx].filehandle;
4353 ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
4354
4355 if(bufferstack[bufferstackidx].should_pop)
4356 {
4357 if(yy_current_state() == pp_macexp)
4358 macro_add_expansion();
4359 else
4360 pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state");
4361 yy_pop_state();
4362 }
4363
4364 return &bufferstack[bufferstackidx];
4365 }
4366
4367
4368 /*
4369 *-------------------------------------------------------------------------
4370 * Macro nestng support
4371 *-------------------------------------------------------------------------
4372 */
4373 static void push_macro(pp_entry_t *ppp)
4374 {
4375 if(macexpstackidx >= MAXMACEXPSTACK)
4376 {
4377 ppy_error("Too many nested macros");
4378 return;
4379 }
4380
4381 macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
4382 if(!macexpstack[macexpstackidx])
4383 return;
4384 memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0]));
4385 macexpstack[macexpstackidx]->ppp = ppp;
4386 macexpstackidx++;
4387 }
4388
4389 static macexpstackentry_t *top_macro(void)
4390 {
4391 return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL;
4392 }
4393
4394 static macexpstackentry_t *pop_macro(void)
4395 {
4396 if(macexpstackidx <= 0)
4397 pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n");
4398 return macexpstack[--macexpstackidx];
4399 }
4400
4401 static void free_macro(macexpstackentry_t *mep)
4402 {
4403 int i;
4404
4405 for(i = 0; i < mep->nargs; i++)
4406 free(mep->args[i]);
4407 free(mep->args);
4408 free(mep->nnls);
4409 free(mep->curarg);
4410 free(mep);
4411 }
4412
4413 static void add_text_to_macro(const char *text, int len)
4414 {
4415 macexpstackentry_t *mep = top_macro();
4416
4417 assert(mep->ppp->expanding == 0);
4418
4419 if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */
4420 {
4421 char *new_curarg;
4422 int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1);
4423 new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0]));
4424 if(!new_curarg)
4425 return;
4426 mep->curarg = new_curarg;
4427 mep->curargalloc = new_alloc;
4428 }
4429 memcpy(mep->curarg + mep->curargsize, text, len);
4430 mep->curargsize += len;
4431 mep->curarg[mep->curargsize] = '\0';
4432 }
4433
4434 static void macro_add_arg(int last)
4435 {
4436 int nnl = 0;
4437 char *cptr;
4438 char **new_args, **new_ppargs;
4439 int *new_nnls;
4440 macexpstackentry_t *mep = top_macro();
4441
4442 assert(mep->ppp->expanding == 0);
4443
4444 new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0]));
4445 if(!new_args)
4446 return;
4447 mep->args = new_args;
4448
4449 new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0]));
4450 if(!new_ppargs)
4451 return;
4452 mep->ppargs = new_ppargs;
4453
4454 new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0]));
4455 if(!new_nnls)
4456 return;
4457 mep->nnls = new_nnls;
4458
4459 mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : "");
4460 if(!mep->args[mep->nargs])
4461 return;
4462 cptr = mep->args[mep->nargs]-1;
4463 while((cptr = strchr(cptr+1, '\n')))
4464 {
4465 nnl++;
4466 }
4467 mep->nnls[mep->nargs] = nnl;
4468 mep->nargs++;
4469 free(mep->curarg);
4470 mep->curargalloc = mep->curargsize = 0;
4471 mep->curarg = NULL;
4472
4473 if(pp_flex_debug)
4474 fprintf(stderr, "macro_add_arg: %s:%d: %d -> '%s'\n",
4475 pp_status.input,
4476 pp_status.line_number,
4477 mep->nargs-1,
4478 mep->args[mep->nargs-1]);
4479
4480 /* Each macro argument must be expanded to cope with stingize */
4481 if(last || mep->args[mep->nargs-1][0])
4482 {
4483 yy_push_state(pp_macexp);
4484 push_buffer(NULL, NULL, NULL, last ? 2 : 1);
4485 ppy__scan_string(mep->args[mep->nargs-1]);
4486 /*mep->bufferstackidx = bufferstackidx; But not nested! */
4487 }
4488 }
4489
4490 static void macro_add_expansion(void)
4491 {
4492 macexpstackentry_t *mep = top_macro();
4493
4494 assert(mep->ppp->expanding == 0);
4495
4496 mep->ppargs[mep->nargs-1] = pp_xstrdup(mep->curarg ? mep->curarg : "");
4497 free(mep->curarg);
4498 mep->curargalloc = mep->curargsize = 0;
4499 mep->curarg = NULL;
4500
4501 if(pp_flex_debug)
4502 fprintf(stderr, "macro_add_expansion: %s:%d: %d -> '%s'\n",
4503 pp_status.input,
4504 pp_status.line_number,
4505 mep->nargs-1,
4506 mep->ppargs[mep->nargs-1] ? mep->ppargs[mep->nargs-1] : "");
4507 }
4508
4509
4510 /*
4511 *-------------------------------------------------------------------------
4512 * Output management
4513 *-------------------------------------------------------------------------
4514 */
4515 static void put_buffer(const char *s, int len)
4516 {
4517 if(top_macro())
4518 add_text_to_macro(s, len);
4519 else
4520 wpp_callbacks->write(s, len);
4521 }
4522
4523
4524 /*
4525 *-------------------------------------------------------------------------
4526 * Include management
4527 *-------------------------------------------------------------------------
4528 */
4529 void pp_do_include(char *fname, int type)
4530 {
4531 char *newpath;
4532 int n;
4533 includelogicentry_t *iep;
4534 void *fp;
4535
4536 if(!fname)
4537 return;
4538
4539 for(iep = pp_includelogiclist; iep; iep = iep->next)
4540 {
4541 if(!strcmp(iep->filename, fname))
4542 {
4543 /*
4544 * We are done. The file was included before.
4545 * If the define was deleted, then this entry would have
4546 * been deleted too.
4547 */
4548 free(fname);
4549 return;
4550 }
4551 }
4552
4553 n = strlen(fname);
4554
4555 if(n <= 2)
4556 {
4557 ppy_error("Empty include filename");
4558 free(fname);
4559 return;
4560 }
4561
4562 /* Undo the effect of the quotation */
4563 fname[n-1] = '\0';
4564
4565 if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL)
4566 {
4567 ppy_error("Unable to open include file %s", fname+1);
4568 free(fname);
4569 return;
4570 }
4571
4572 fname[n-1] = *fname; /* Redo the quotes */
4573 push_buffer(NULL, newpath, fname, 0);
4574 pp_incl_state.seen_junk = 0;
4575 pp_incl_state.state = 0;
4576 pp_incl_state.ppp = NULL;
4577
4578 if(pp_status.debug)
4579 fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n",
4580 pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth);
4581 pp_status.file = fp;
4582 ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE));
4583
4584 pp_writestring("# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
4585 }
4586
4587 /*
4588 *-------------------------------------------------------------------------
4589 * Push/pop preprocessor ignore state when processing conditionals
4590 * which are false.
4591 *-------------------------------------------------------------------------
4592 */
4593 void pp_push_ignore_state(void)
4594 {
4595 yy_push_state(pp_ignore);
4596 }
4597
4598 void pp_pop_ignore_state(void)
4599 {
4600 yy_pop_state();
4601 }
4602