source: trunk/tools/wrc/lexyy.c@ 1036

Last change on this file since 1036 was 882, checked in by sandervl, 26 years ago

Created Wine port of wrc (using EMX/GCC)

File size: 88.2 KB
Line 
1/* A lexical scanner generated by flex */
2
3/* Scanner skeleton version:
4 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/tools/wrc/lexyy.c,v 1.1 1999-09-08 19:34:08 sandervl Exp $
5 */
6
7#define FLEX_SCANNER
8#define YY_FLEX_MAJOR_VERSION 2
9#define YY_FLEX_MINOR_VERSION 5
10
11#include <stdio.h>
12
13
14/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15#ifdef c_plusplus
16#ifndef __cplusplus
17#define __cplusplus
18#endif
19#endif
20
21
22#ifdef __cplusplus
23
24#include <stdlib.h>
25#include <unistd.h>
26
27/* Use prototypes in function declarations. */
28#define YY_USE_PROTOS
29
30/* The "const" storage-class-modifier is valid. */
31#define YY_USE_CONST
32
33#else /* ! __cplusplus */
34
35#if __STDC__
36
37#define YY_USE_PROTOS
38#define YY_USE_CONST
39
40#endif /* __STDC__ */
41#endif /* ! __cplusplus */
42
43#ifdef __TURBOC__
44 #pragma warn -rch
45 #pragma warn -use
46#include <io.h>
47#include <stdlib.h>
48#define YY_USE_CONST
49#define YY_USE_PROTOS
50#endif
51
52#ifdef YY_USE_CONST
53#define yyconst const
54#else
55#define yyconst
56#endif
57
58
59#ifdef YY_USE_PROTOS
60#define YY_PROTO(proto) proto
61#else
62#define YY_PROTO(proto) ()
63#endif
64
65/* Returned upon end-of-file. */
66#define YY_NULL 0
67
68/* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
71 * double cast.
72 */
73#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
75/* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
78 */
79#define BEGIN yy_start = 1 + 2 *
80
81/* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
83 * compatibility.
84 */
85#define YY_START ((yy_start - 1) / 2)
86#define YYSTATE YY_START
87
88/* Action number for EOF rule of a given start state. */
89#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91/* Special action meaning "start processing a new file". */
92#define YY_NEW_FILE yyrestart( yyin )
93
94#define YY_END_OF_BUFFER_CHAR 0
95
96/* Size of default input buffer. */
97#define YY_BUF_SIZE 16384
98
99typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101extern int yyleng;
102extern FILE *yyin, *yyout;
103
104#define EOB_ACT_CONTINUE_SCAN 0
105#define EOB_ACT_END_OF_FILE 1
106#define EOB_ACT_LAST_MATCH 2
107
108/* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
111 *
112 * if ( condition_holds )
113 * yyless( 5 );
114 * else
115 * do_something_else();
116 *
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
120 */
121
122/* Return all but the first 'n' matched characters back to the input stream. */
123
124#define yyless(n) \
125 do \
126 { \
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
130 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
131 } \
132 while ( 0 )
133
134#define unput(c) yyunput( c, yytext_ptr )
135
136/* The following is because we cannot portably get our hands on size_t
137 * (without autoconf's help, which isn't available because we want
138 * flex-generated scanners to compile on their own).
139 */
140typedef unsigned int yy_size_t;
141
142
143struct yy_buffer_state
144 {
145 FILE *yy_input_file;
146
147 char *yy_ch_buf; /* input buffer */
148 char *yy_buf_pos; /* current position in input buffer */
149
150 /* Size of input buffer in bytes, not including room for EOB
151 * characters.
152 */
153 yy_size_t yy_buf_size;
154
155 /* Number of characters read into yy_ch_buf, not including EOB
156 * characters.
157 */
158 int yy_n_chars;
159
160 /* Whether we "own" the buffer - i.e., we know we created it,
161 * and can realloc() it to grow it, and should free() it to
162 * delete it.
163 */
164 int yy_is_our_buffer;
165
166 /* Whether this is an "interactive" input source; if so, and
167 * if we're using stdio for input, then we want to use getc()
168 * instead of fread(), to make sure we stop fetching input after
169 * each newline.
170 */
171 int yy_is_interactive;
172
173 /* Whether we're considered to be at the beginning of a line.
174 * If so, '^' rules will be active on the next match, otherwise
175 * not.
176 */
177 int yy_at_bol;
178
179 /* Whether to try to fill the input buffer when we reach the
180 * end of it.
181 */
182 int yy_fill_buffer;
183
184 int yy_buffer_status;
185#define YY_BUFFER_NEW 0
186#define YY_BUFFER_NORMAL 1
187 /* When an EOF's been seen but there's still some text to process
188 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
189 * shouldn't try reading from the input source any more. We might
190 * still have a bunch of tokens to match, though, because of
191 * possible backing-up.
192 *
193 * When we actually see the EOF, we change the status to "new"
194 * (via yyrestart()), so that the user can continue scanning by
195 * just pointing yyin at a new input file.
196 */
197#define YY_BUFFER_EOF_PENDING 2
198 };
199
200static YY_BUFFER_STATE yy_current_buffer = 0;
201
202/* We provide macros for accessing buffer states in case in the
203 * future we want to put the buffer states in a more general
204 * "scanner state".
205 */
206#define YY_CURRENT_BUFFER yy_current_buffer
207
208
209/* yy_hold_char holds the character lost when yytext is formed. */
210static char yy_hold_char;
211
212static int yy_n_chars; /* number of characters read into yy_ch_buf */
213
214
215int yyleng;
216
217/* Points to current character in buffer. */
218static char *yy_c_buf_p = (char *) 0;
219static int yy_init = 1; /* whether we need to initialize */
220static int yy_start = 0; /* start state number */
221
222/* Flag which is used to allow yywrap()'s to do buffer switches
223 * instead of setting up a fresh yyin. A bit of a hack ...
224 */
225static int yy_did_buffer_switch_on_eof;
226
227void yyrestart YY_PROTO(( FILE *input_file ));
228
229void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
230void yy_load_buffer_state YY_PROTO(( void ));
231YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
232void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
233void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
234void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
235#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
236
237YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
238YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
239YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
240
241static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
242static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
243static void yy_flex_free YY_PROTO(( void * ));
244
245#define yy_new_buffer yy_create_buffer
246
247#define yy_set_interactive(is_interactive) \
248 { \
249 if ( ! yy_current_buffer ) \
250 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
251 yy_current_buffer->yy_is_interactive = is_interactive; \
252 }
253
254#define yy_set_bol(at_bol) \
255 { \
256 if ( ! yy_current_buffer ) \
257 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
258 yy_current_buffer->yy_at_bol = at_bol; \
259 }
260
261#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
262
263typedef unsigned char YY_CHAR;
264FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
265typedef int yy_state_type;
266extern char *yytext;
267#define yytext_ptr yytext
268
269static yy_state_type yy_get_previous_state YY_PROTO(( void ));
270static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
271static int yy_get_next_buffer YY_PROTO(( void ));
272static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
273
274/* Done after the current pattern has been matched and before the
275 * corresponding action - sets up yytext.
276 */
277#define YY_DO_BEFORE_ACTION \
278 yytext_ptr = yy_bp; \
279 yyleng = (int) (yy_cp - yy_bp); \
280 yy_hold_char = *yy_cp; \
281 *yy_cp = '\0'; \
282 yy_c_buf_p = yy_cp;
283
284#define YY_NUM_RULES 117
285#define YY_END_OF_BUFFER 118
286static yyconst short int yy_accept[346] =
287 { 0,
288 0, 0, 59, 59, 0, 0, 0, 0, 0, 0,
289 0, 0, 107, 107, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
291 0, 0, 22, 22, 9, 9, 9, 9, 39, 39,
292 0, 0, 29, 29, 33, 33, 34, 34, 118, 115,
293 114, 113, 115, 81, 115, 100, 115, 49, 49, 111,
294 115, 115, 115, 52, 52, 47, 115, 48, 114, 115,
295 59, 114, 60, 59, 59, 59, 59, 59, 59, 116,
296 62, 61, 95, 83, 82, 99, 80, 65, 64, 116,
297 105, 103, 104, 101, 105, 107, 109, 108, 4, 116,
298
299 4, 4, 8, 6, 14, 22, 9, 12, 116, 116,
300 39, 38, 38, 38, 29, 116, 27, 25, 26, 29,
301 116, 33, 30, 31, 116, 33, 37, 34, 36, 35,
302 114, 56, 54, 106, 112, 49, 52, 49, 52, 52,
303 111, 57, 55, 58, 63, 53, 114, 0, 0, 0,
304 0, 0, 0, 0, 0, 59, 59, 59, 59, 59,
305 59, 59, 59, 0, 61, 95, 0, 96, 94, 94,
306 84, 86, 87, 88, 89, 90, 91, 92, 93, 94,
307 80, 0, 77, 76, 76, 66, 68, 69, 70, 71,
308 72, 73, 74, 75, 76, 103, 102, 107, 108, 108,
309
310 110, 0, 0, 7, 6, 14, 22, 9, 10, 0,
311 11, 39, 0, 0, 0, 0, 0, 29, 28, 29,
312 33, 32, 33, 34, 112, 51, 50, 0, 0, 0,
313 0, 15, 0, 0, 0, 0, 59, 59, 59, 59,
314 59, 59, 59, 98, 97, 84, 86, 0, 79, 78,
315 66, 68, 0, 3, 2, 10, 51, 50, 0, 0,
316 0, 0, 0, 15, 0, 0, 0, 0, 0, 0,
317 59, 59, 59, 59, 59, 59, 46, 84, 85, 66,
318 0, 0, 18, 19, 0, 0, 0, 0, 0, 24,
319 0, 0, 59, 41, 59, 59, 59, 59, 66, 0,
320
321 0, 18, 19, 20, 21, 16, 0, 0, 24, 0,
322 13, 59, 42, 59, 59, 59, 66, 67, 5, 20,
323 21, 16, 17, 0, 23, 13, 59, 59, 59, 45,
324 66, 5, 17, 1, 23, 59, 59, 43, 1, 59,
325 59, 59, 44, 40, 0
326 } ;
327
328static yyconst int yy_ec[256] =
329 { 0,
330 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
331 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
334 10, 11, 1, 1, 1, 1, 12, 13, 14, 14,
335 14, 14, 14, 14, 14, 15, 15, 1, 16, 17,
336 18, 19, 1, 1, 20, 21, 22, 23, 24, 25,
337 26, 26, 27, 26, 26, 28, 29, 30, 31, 32,
338 26, 33, 34, 26, 35, 36, 26, 37, 26, 26,
339 1, 38, 1, 1, 26, 1, 39, 40, 41, 42,
340
341 43, 44, 45, 26, 46, 26, 26, 47, 48, 49,
342 50, 51, 26, 52, 53, 54, 55, 56, 26, 57,
343 26, 26, 58, 59, 60, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
356 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1
358 } ;
359
360static yyconst int yy_meta[61] =
361 { 0,
362 1, 2, 3, 1, 4, 5, 1, 1, 6, 7,
363 8, 9, 10, 10, 10, 5, 1, 1, 11, 10,
364 10, 10, 10, 10, 10, 12, 12, 12, 12, 12,
365 12, 12, 12, 12, 12, 12, 12, 13, 10, 10,
366 10, 10, 10, 10, 12, 12, 12, 12, 12, 12,
367 12, 12, 12, 12, 12, 12, 12, 14, 1, 14
368 } ;
369
370static yyconst short int yy_base[397] =
371 { 0,
372 0, 60, 119, 169, 17, 18, 42, 43, 46, 47,
373 219, 262, 21, 22, 24, 37, 306, 366, 426, 486,
374 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
375 0, 0, 626, 625, 79, 87, 89, 90, 624, 623,
376 622, 28, 94, 127, 170, 324, 41, 92, 624, 1265,
377 621, 1265, 604, 1265, 614, 1265, 24, 241, 98, 0,
378 602, 601, 600, 0, 612, 1265, 557, 1265, 81, 113,
379 0, 613, 1265, 10, 59, 75, 85, 100, 148, 609,
380 1265, 1265, 0, 1265, 132, 542, 0, 1265, 136, 595,
381 1265, 611, 1265, 1265, 0, 0, 1265, 146, 1265, 1265,
382
383 0, 0, 1265, 603, 0, 0, 0, 1265, 166, 186,
384 0, 1265, 101, 147, 0, 600, 1265, 1265, 1265, 130,
385 182, 0, 1265, 1265, 596, 189, 1265, 604, 1265, 1265,
386 603, 1265, 1265, 1265, 0, 191, 0, 0, 194, 640,
387 0, 1265, 1265, 1265, 1265, 1265, 208, 295, 345, 561,
388 177, 65, 557, 550, 552, 0, 165, 193, 180, 227,
389 201, 224, 216, 592, 1265, 0, 269, 1265, 1265, 590,
390 238, 266, 1265, 1265, 1265, 1265, 1265, 1265, 1265, 0,
391 0, 287, 1265, 1265, 588, 280, 338, 1265, 1265, 1265,
392 1265, 1265, 1265, 1265, 0, 590, 1265, 0, 224, 234,
393
394 1265, 585, 570, 1265, 579, 0, 0, 0, 0, 297,
395 1265, 0, 326, 343, 347, 6, 543, 0, 1265, 329,
396 0, 1265, 337, 583, 0, 433, 301, 540, 43, 541,
397 528, 160, 538, 529, 538, 534, 372, 371, 362, 376,
398 377, 374, 379, 1265, 1265, 341, 344, 0, 1265, 1265,
399 347, 392, 0, 570, 1265, 0, 0, 0, 528, 529,
400 529, 525, 520, 567, 525, 525, 519, 522, 519, 520,
401 428, 426, 417, 420, 432, 422, 0, 395, 1265, 441,
402 0, 513, 559, 558, 515, 506, 510, 510, 497, 0,
403 503, 506, 424, 0, 434, 429, 439, 442, 460, 0,
404
405 506, 546, 541, 540, 533, 527, 479, 441, 0, 427,
406 463, 440, 0, 484, 479, 485, 496, 1265, 421, 417,
407 414, 413, 410, 368, 0, 396, 492, 493, 490, 0,
408 502, 361, 294, 288, 0, 497, 491, 0, 271, 492,
409 493, 498, 0, 0, 1265, 684, 698, 712, 726, 740,
410 754, 768, 782, 796, 810, 824, 838, 852, 866, 880,
411 894, 908, 922, 518, 936, 950, 964, 978, 992, 1006,
412 1020, 213, 1034, 1048, 1062, 1076, 1085, 524, 1097, 1111,
413 1125, 1139, 1153, 1166, 1180, 1194, 1208, 165, 159, 1222,
414 143, 130, 29, 1236, 16, 1250
415
416 } ;
417
418static yyconst short int yy_def[397] =
419 { 0,
420 346, 346, 347, 347, 348, 348, 349, 349, 350, 350,
421 351, 351, 352, 352, 353, 353, 354, 354, 355, 355,
422 356, 356, 356, 356, 356, 356, 356, 356, 356, 356,
423 356, 356, 357, 357, 358, 358, 358, 358, 359, 359,
424 360, 360, 361, 361, 362, 362, 363, 363, 345, 345,
425 345, 345, 345, 345, 345, 345, 345, 364, 364, 365,
426 345, 345, 345, 364, 364, 345, 345, 345, 345, 345,
427 366, 345, 345, 366, 366, 366, 366, 366, 366, 367,
428 345, 345, 368, 345, 345, 369, 370, 345, 345, 371,
429 345, 345, 345, 345, 372, 373, 345, 374, 345, 345,
430
431 375, 376, 345, 377, 378, 379, 380, 345, 381, 345,
432 382, 345, 345, 345, 383, 384, 345, 345, 345, 383,
433 345, 385, 345, 345, 386, 385, 345, 345, 345, 345,
434 345, 345, 345, 345, 387, 364, 364, 364, 364, 364,
435 365, 345, 345, 345, 345, 345, 345, 345, 345, 345,
436 345, 345, 345, 345, 345, 366, 366, 366, 366, 366,
437 366, 366, 366, 367, 345, 368, 345, 345, 345, 345,
438 345, 345, 345, 345, 345, 345, 345, 345, 345, 388,
439 370, 345, 345, 345, 345, 345, 345, 345, 345, 345,
440 345, 345, 345, 345, 389, 345, 345, 373, 374, 374,
441
442 345, 375, 376, 345, 377, 378, 379, 380, 390, 345,
443 345, 382, 345, 345, 345, 345, 345, 383, 345, 383,
444 385, 345, 385, 345, 387, 364, 140, 345, 345, 345,
445 345, 345, 345, 345, 345, 345, 366, 366, 366, 366,
446 366, 366, 366, 345, 345, 345, 345, 391, 345, 345,
447 345, 345, 392, 375, 345, 390, 364, 364, 345, 345,
448 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
449 366, 366, 366, 366, 366, 366, 366, 345, 345, 345,
450 393, 345, 345, 345, 345, 345, 345, 345, 345, 394,
451 345, 345, 366, 366, 366, 366, 366, 366, 345, 395,
452
453 345, 345, 345, 345, 345, 345, 345, 345, 394, 345,
454 345, 366, 366, 366, 366, 366, 345, 345, 345, 345,
455 345, 345, 345, 345, 396, 345, 366, 366, 366, 366,
456 345, 345, 345, 345, 396, 366, 366, 366, 345, 366,
457 366, 366, 366, 366, 0, 345, 345, 345, 345, 345,
458 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
459 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
460 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
461 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
462 345, 345, 345, 345, 345, 345
463
464 } ;
465
466static yyconst short int yy_nxt[1326] =
467 { 0,
468 50, 51, 52, 53, 54, 50, 55, 56, 50, 50,
469 50, 57, 58, 59, 59, 60, 61, 62, 63, 81,
470 81, 82, 82, 97, 97, 318, 100, 65, 101, 113,
471 52, 98, 98, 114, 134, 135, 157, 50, 300, 100,
472 102, 101, 128, 129, 84, 84, 85, 85, 88, 88,
473 89, 89, 229, 102, 230, 157, 130, 66, 67, 68,
474 50, 69, 52, 53, 54, 70, 55, 56, 50, 50,
475 50, 57, 58, 59, 59, 60, 61, 62, 63, 86,
476 86, 108, 147, 90, 90, 158, 148, 65, 260, 108,
477 109, 108, 108, 128, 129, 261, 52, 50, 109, 100,
478
479 109, 109, 213, 159, 158, 116, 214, 130, 232, 117,
480 136, 136, 136, 233, 149, 160, 110, 66, 67, 68,
481 72, 52, 159, 73, 110, 138, 110, 110, 120, 52,
482 161, 220, 121, 167, 160, 214, 168, 182, 116, 281,
483 183, 74, 117, 75, 138, 76, 77, 78, 215, 161,
484 79, 118, 279, 119, 150, 151, 200, 201, 152, 153,
485 74, 264, 75, 154, 76, 77, 78, 155, 253, 79,
486 72, 52, 52, 73, 248, 100, 134, 135, 123, 124,
487 162, 125, 163, 215, 118, 100, 119, 210, 211, 216,
488 223, 74, 217, 75, 214, 76, 77, 78, 237, 162,
489
490 79, 265, 163, 136, 136, 136, 226, 226, 266, 147,
491 74, 239, 75, 148, 76, 77, 78, 237, 138, 79,
492 92, 93, 197, 229, 216, 230, 94, 217, 231, 238,
493 239, 95, 95, 95, 345, 345, 241, 138, 95, 95,
494 95, 95, 95, 95, 200, 201, 240, 242, 243, 238,
495 246, 246, 247, 136, 136, 136, 241, 95, 95, 95,
496 95, 95, 95, 92, 93, 240, 242, 243, 138, 94,
497 167, 139, 339, 244, 95, 95, 95, 140, 247, 247,
498 247, 95, 95, 95, 95, 95, 95, 138, 182, 339,
499 139, 249, 251, 251, 252, 333, 149, 140, 210, 211,
500
501 95, 95, 95, 95, 95, 95, 103, 103, 100, 103,
502 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
503 103, 103, 103, 103, 103, 126, 52, 213, 258, 121,
504 220, 214, 123, 124, 214, 125, 150, 151, 223, 100,
505 152, 153, 214, 103, 215, 154, 149, 258, 215, 155,
506 252, 252, 252, 278, 278, 247, 247, 247, 247, 280,
507 280, 252, 332, 103, 103, 103, 103, 103, 100, 103,
508 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
509 103, 103, 103, 103, 103, 216, 150, 151, 217, 216,
510 152, 153, 217, 271, 272, 154, 273, 326, 274, 155,
511
512 275, 276, 277, 103, 252, 252, 252, 247, 247, 247,
513 334, 333, 271, 272, 322, 321, 273, 274, 320, 275,
514 276, 277, 332, 103, 103, 103, 100, 100, 100, 100,
515 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
516 100, 100, 100, 100, 100, 226, 226, 293, 294, 295,
517 296, 297, 298, 299, 299, 252, 312, 313, 314, 315,
518 257, 316, 327, 100, 326, 325, 293, 294, 295, 296,
519 297, 298, 317, 317, 252, 312, 313, 314, 315, 257,
520 316, 327, 324, 100, 100, 100, 100, 100, 100, 100,
521 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
522
523 100, 100, 100, 100, 100, 328, 329, 330, 331, 331,
524 252, 336, 337, 338, 252, 252, 252, 340, 341, 342,
525 343, 344, 323, 100, 328, 329, 330, 137, 322, 137,
526 336, 337, 338, 206, 321, 206, 340, 341, 342, 343,
527 344, 320, 303, 100, 100, 100, 170, 302, 319, 311,
528 310, 308, 307, 306, 171, 171, 172, 305, 304, 303,
529 302, 301, 292, 291, 290, 289, 288, 287, 264, 286,
530 285, 284, 283, 282, 254, 270, 269, 268, 267, 263,
531 173, 174, 262, 259, 224, 175, 232, 204, 255, 254,
532 176, 196, 250, 177, 245, 178, 165, 179, 180, 185,
533
534 236, 235, 234, 228, 131, 224, 134, 186, 186, 187,
535 134, 204, 196, 165, 131, 146, 145, 144, 143, 142,
536 133, 132, 131, 345, 52, 100, 100, 100, 100, 345,
537 345, 345, 345, 188, 189, 345, 345, 345, 190, 345,
538 345, 345, 345, 191, 345, 345, 192, 345, 193, 345,
539 194, 195, 227, 227, 227, 345, 345, 345, 345, 227,
540 227, 227, 227, 227, 227, 345, 345, 345, 345, 345,
541 345, 345, 345, 345, 345, 345, 345, 345, 227, 227,
542 227, 227, 227, 227, 64, 64, 64, 64, 64, 64,
543 64, 64, 64, 64, 64, 64, 64, 64, 71, 71,
544
545 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
546 71, 71, 80, 80, 80, 80, 80, 80, 80, 80,
547 80, 80, 80, 80, 80, 80, 83, 83, 83, 83,
548 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
549 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
550 87, 87, 87, 87, 91, 91, 91, 91, 91, 91,
551 91, 91, 91, 91, 91, 91, 91, 91, 96, 96,
552 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
553 96, 96, 99, 99, 99, 99, 99, 99, 99, 99,
554 99, 99, 99, 99, 99, 99, 104, 104, 104, 104,
555
556 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
557 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
558 105, 105, 105, 105, 100, 100, 100, 100, 100, 100,
559 100, 100, 100, 100, 100, 100, 100, 100, 106, 106,
560 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
561 106, 106, 107, 107, 107, 107, 107, 107, 107, 107,
562 107, 107, 107, 107, 107, 107, 111, 111, 111, 111,
563 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
564 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
565 112, 112, 112, 112, 115, 115, 115, 115, 115, 115,
566
567 115, 115, 115, 115, 115, 115, 115, 115, 122, 122,
568 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
569 122, 122, 127, 127, 127, 127, 127, 127, 127, 127,
570 127, 127, 127, 127, 127, 127, 141, 141, 345, 141,
571 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
572 156, 345, 345, 345, 156, 156, 156, 156, 156, 156,
573 156, 156, 156, 156, 164, 164, 345, 164, 164, 164,
574 164, 164, 164, 164, 164, 164, 164, 164, 166, 166,
575 345, 345, 166, 166, 166, 166, 166, 166, 166, 166,
576 345, 166, 169, 169, 169, 169, 169, 169, 169, 169,
577
578 169, 169, 169, 169, 169, 169, 181, 181, 345, 345,
579 181, 181, 181, 181, 181, 181, 181, 181, 345, 181,
580 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
581 184, 184, 184, 184, 198, 198, 345, 198, 198, 198,
582 198, 345, 198, 198, 198, 198, 198, 198, 199, 199,
583 345, 199, 199, 199, 199, 199, 199, 199, 199, 199,
584 199, 199, 202, 202, 345, 202, 202, 202, 202, 202,
585 202, 202, 345, 202, 202, 202, 203, 203, 345, 203,
586 203, 203, 203, 203, 203, 203, 345, 203, 203, 203,
587 205, 345, 345, 345, 205, 345, 205, 207, 207, 345,
588
589 207, 207, 207, 207, 207, 207, 207, 207, 207, 207,
590 207, 208, 208, 345, 208, 208, 208, 208, 208, 345,
591 208, 208, 208, 345, 208, 209, 209, 209, 209, 209,
592 209, 209, 209, 209, 209, 209, 209, 209, 209, 212,
593 212, 345, 212, 212, 212, 212, 212, 212, 212, 212,
594 212, 212, 212, 218, 218, 345, 218, 345, 218, 218,
595 218, 345, 218, 218, 218, 218, 219, 219, 345, 219,
596 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
597 221, 221, 345, 221, 345, 345, 345, 221, 345, 221,
598 221, 221, 221, 221, 222, 222, 345, 222, 222, 222,
599
600 222, 222, 222, 222, 222, 222, 222, 222, 225, 225,
601 345, 225, 225, 225, 225, 225, 225, 225, 225, 225,
602 225, 225, 256, 256, 345, 256, 256, 256, 256, 256,
603 345, 256, 256, 256, 345, 256, 309, 309, 345, 309,
604 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
605 335, 335, 345, 335, 335, 335, 335, 335, 335, 335,
606 335, 335, 335, 335, 49, 345, 345, 345, 345, 345,
607 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
608 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
609 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
610
611 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
612 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
613 345, 345, 345, 345, 345
614 } ;
615
616static yyconst short int yy_chk[1326] =
617 { 0,
618 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
619 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
620 6, 5, 6, 13, 14, 395, 15, 1, 15, 42,
621 42, 13, 14, 42, 57, 57, 74, 1, 393, 16,
622 15, 16, 47, 47, 7, 8, 7, 8, 9, 10,
623 9, 10, 216, 16, 216, 74, 47, 1, 1, 1,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 7,
626 8, 35, 69, 9, 10, 75, 69, 2, 229, 36,
627 35, 37, 38, 48, 48, 229, 43, 2, 36, 43,
628
629 37, 38, 113, 76, 75, 43, 113, 48, 152, 43,
630 59, 59, 59, 152, 70, 77, 35, 2, 2, 2,
631 3, 3, 76, 3, 36, 59, 37, 38, 44, 44,
632 78, 120, 44, 85, 77, 120, 85, 89, 44, 392,
633 89, 3, 44, 3, 59, 3, 3, 3, 114, 78,
634 3, 43, 391, 43, 70, 70, 98, 98, 70, 70,
635 3, 232, 3, 70, 3, 3, 3, 70, 389, 3,
636 4, 4, 45, 4, 388, 45, 109, 109, 45, 45,
637 79, 45, 79, 121, 44, 45, 44, 110, 110, 114,
638 126, 4, 114, 4, 126, 4, 4, 4, 157, 79,
639
640 4, 232, 79, 136, 136, 136, 139, 139, 232, 147,
641 4, 159, 4, 147, 4, 4, 4, 157, 136, 4,
642 11, 11, 372, 151, 121, 151, 11, 121, 151, 158,
643 159, 11, 11, 11, 199, 199, 161, 136, 11, 11,
644 11, 11, 11, 11, 200, 200, 160, 162, 163, 158,
645 171, 171, 171, 58, 58, 58, 161, 11, 11, 11,
646 11, 11, 11, 12, 12, 160, 162, 163, 58, 12,
647 167, 58, 339, 167, 12, 12, 12, 58, 172, 172,
648 172, 12, 12, 12, 12, 12, 12, 58, 182, 334,
649 58, 182, 186, 186, 186, 333, 148, 58, 210, 210,
650
651 12, 12, 12, 12, 12, 12, 17, 17, 17, 17,
652 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
653 17, 17, 17, 17, 17, 46, 46, 213, 227, 46,
654 220, 213, 46, 46, 220, 46, 148, 148, 223, 46,
655 148, 148, 223, 17, 214, 148, 149, 227, 215, 148,
656 187, 187, 187, 246, 246, 246, 247, 247, 247, 251,
657 251, 251, 332, 17, 17, 17, 18, 18, 18, 18,
658 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
659 18, 18, 18, 18, 18, 214, 149, 149, 214, 215,
660 149, 149, 215, 237, 238, 149, 239, 326, 240, 149,
661
662 241, 242, 243, 18, 252, 252, 252, 278, 278, 278,
663 324, 323, 237, 238, 322, 321, 239, 240, 320, 241,
664 242, 243, 319, 18, 18, 18, 19, 19, 19, 19,
665 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
666 19, 19, 19, 19, 19, 226, 226, 271, 272, 273,
667 274, 275, 276, 280, 280, 280, 293, 295, 296, 297,
668 226, 298, 312, 19, 311, 310, 271, 272, 273, 274,
669 275, 276, 299, 299, 299, 293, 295, 296, 297, 226,
670 298, 312, 308, 19, 19, 19, 20, 20, 20, 20,
671 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
672
673 20, 20, 20, 20, 20, 314, 315, 316, 317, 317,
674 317, 327, 328, 329, 331, 331, 331, 336, 337, 340,
675 341, 342, 307, 20, 314, 315, 316, 364, 306, 364,
676 327, 328, 329, 378, 305, 378, 336, 337, 340, 341,
677 342, 304, 303, 20, 20, 20, 86, 302, 301, 292,
678 291, 289, 288, 287, 86, 86, 86, 286, 285, 284,
679 283, 282, 270, 269, 268, 267, 266, 265, 264, 263,
680 262, 261, 260, 259, 254, 236, 235, 234, 233, 231,
681 86, 86, 230, 228, 224, 86, 217, 205, 203, 202,
682 86, 196, 185, 86, 170, 86, 164, 86, 86, 90,
683
684 155, 154, 153, 150, 131, 128, 125, 90, 90, 90,
685 116, 104, 92, 80, 72, 67, 65, 63, 62, 61,
686 55, 53, 51, 49, 41, 40, 39, 34, 33, 0,
687 0, 0, 0, 90, 90, 0, 0, 0, 90, 0,
688 0, 0, 0, 90, 0, 0, 90, 0, 90, 0,
689 90, 90, 140, 140, 140, 0, 0, 0, 0, 140,
690 140, 140, 140, 140, 140, 0, 0, 0, 0, 0,
691 0, 0, 0, 0, 0, 0, 0, 0, 140, 140,
692 140, 140, 140, 140, 346, 346, 346, 346, 346, 346,
693 346, 346, 346, 346, 346, 346, 346, 346, 347, 347,
694
695 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
696 347, 347, 348, 348, 348, 348, 348, 348, 348, 348,
697 348, 348, 348, 348, 348, 348, 349, 349, 349, 349,
698 349, 349, 349, 349, 349, 349, 349, 349, 349, 349,
699 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
700 350, 350, 350, 350, 351, 351, 351, 351, 351, 351,
701 351, 351, 351, 351, 351, 351, 351, 351, 352, 352,
702 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
703 352, 352, 353, 353, 353, 353, 353, 353, 353, 353,
704 353, 353, 353, 353, 353, 353, 354, 354, 354, 354,
705
706 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
707 355, 355, 355, 355, 355, 355, 355, 355, 355, 355,
708 355, 355, 355, 355, 356, 356, 356, 356, 356, 356,
709 356, 356, 356, 356, 356, 356, 356, 356, 357, 357,
710 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
711 357, 357, 358, 358, 358, 358, 358, 358, 358, 358,
712 358, 358, 358, 358, 358, 358, 359, 359, 359, 359,
713 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
714 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
715 360, 360, 360, 360, 361, 361, 361, 361, 361, 361,
716
717 361, 361, 361, 361, 361, 361, 361, 361, 362, 362,
718 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
719 362, 362, 363, 363, 363, 363, 363, 363, 363, 363,
720 363, 363, 363, 363, 363, 363, 365, 365, 0, 365,
721 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
722 366, 0, 0, 0, 366, 366, 366, 366, 366, 366,
723 366, 366, 366, 366, 367, 367, 0, 367, 367, 367,
724 367, 367, 367, 367, 367, 367, 367, 367, 368, 368,
725 0, 0, 368, 368, 368, 368, 368, 368, 368, 368,
726 0, 368, 369, 369, 369, 369, 369, 369, 369, 369,
727
728 369, 369, 369, 369, 369, 369, 370, 370, 0, 0,
729 370, 370, 370, 370, 370, 370, 370, 370, 0, 370,
730 371, 371, 371, 371, 371, 371, 371, 371, 371, 371,
731 371, 371, 371, 371, 373, 373, 0, 373, 373, 373,
732 373, 0, 373, 373, 373, 373, 373, 373, 374, 374,
733 0, 374, 374, 374, 374, 374, 374, 374, 374, 374,
734 374, 374, 375, 375, 0, 375, 375, 375, 375, 375,
735 375, 375, 0, 375, 375, 375, 376, 376, 0, 376,
736 376, 376, 376, 376, 376, 376, 0, 376, 376, 376,
737 377, 0, 0, 0, 377, 0, 377, 379, 379, 0,
738
739 379, 379, 379, 379, 379, 379, 379, 379, 379, 379,
740 379, 380, 380, 0, 380, 380, 380, 380, 380, 0,
741 380, 380, 380, 0, 380, 381, 381, 381, 381, 381,
742 381, 381, 381, 381, 381, 381, 381, 381, 381, 382,
743 382, 0, 382, 382, 382, 382, 382, 382, 382, 382,
744 382, 382, 382, 383, 383, 0, 383, 0, 383, 383,
745 383, 0, 383, 383, 383, 383, 384, 384, 0, 384,
746 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
747 385, 385, 0, 385, 0, 0, 0, 385, 0, 385,
748 385, 385, 385, 385, 386, 386, 0, 386, 386, 386,
749
750 386, 386, 386, 386, 386, 386, 386, 386, 387, 387,
751 0, 387, 387, 387, 387, 387, 387, 387, 387, 387,
752 387, 387, 390, 390, 0, 390, 390, 390, 390, 390,
753 0, 390, 390, 390, 0, 390, 394, 394, 0, 394,
754 394, 394, 394, 394, 394, 394, 394, 394, 394, 394,
755 396, 396, 0, 396, 396, 396, 396, 396, 396, 396,
756 396, 396, 396, 396, 345, 345, 345, 345, 345, 345,
757 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
758 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
759 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
760
761 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
762 345, 345, 345, 345, 345, 345, 345, 345, 345, 345,
763 345, 345, 345, 345, 345
764 } ;
765
766static yy_state_type yy_last_accepting_state;
767static char *yy_last_accepting_cpos;
768
769/* The intent behind this definition is that it'll catch
770 * any uses of REJECT which flex missed.
771 */
772#define REJECT reject_used_but_not_detected
773#define yymore() yymore_used_but_not_detected
774#define YY_MORE_ADJ 0
775char *yytext;
776#line 1 "parser.l"
777#define INITIAL 0
778/* -*-C-*-
779 *
780 * Copyright 1994 Martin von Loewis
781 * Copyright 1998 Bertho A. Stultiens (BS)
782 *
783 * 20-Jun-1998 BS - Changed the filename conversion. Filenames are
784 * case-sensitive inder *nix, but not under dos.
785 * default behaviour is to convert to lower case.
786 * - All backslashes are converted to forward and
787 * both single and double slash is recognized as
788 * MS/Borland does.
789 * - Fixed a bug in 'yywf' case that prevented
790 * double quoted names to be scanned propperly.
791 *
792 * 19-May-1998 BS - Started to build a preprocessor.
793 * - Changed keyword processing completely to
794 * table-lookups.
795 *
796 * 20-Apr-1998 BS - Added ';' comment stripping
797 *
798 * 17-Apr-1998 BS - Made the win32 keywords optional when compiling in
799 * 16bit mode
800 *
801 * 15-Apr-1998 BS - Changed string handling to include escapes
802 * - Added unicode string handling (no codepage
803 * translation though).
804 * - 'Borrowed' the main idea of string scanning from
805 * the flex manual pages.
806 * - Added conditional handling of scanning depending
807 * on the state of the parser. This was mainly required
808 * to distinguish a file to load or raw data that
809 * follows. MS's definition of filenames is rather
810 * complex... It can be unquoted or double quoted. If
811 * double quoted, then the '\\' char is not automatically
812 * escaped according to Borland's rc compiler, but it
813 * accepts both "\\path\\file.rc" and "\path\file.rc".
814 * This makes life very hard! I go for the escaped
815 * version, as this seems to be the documented way...
816 * - Single quoted strings are now parsed and converted
817 * here.
818 * - Added comment stripping. The implementation is
819 * 'borrowed' from the flex manpages.
820 * - Rebuild string processing so that it may contain
821 * escaped '\0'.
822 */
823/* Exclusive rules when looking for a filename */
824#define yywf 1
825
826#define yywf_s 2
827
828/* Exclusive string handling */
829#define yystr 3
830
831/* Exclusive unicode string handling */
832#define yylstr 4
833
834/* Exclusive rcdata single quoted data handling */
835#define yyrcd 5
836
837/* Exclusive comment eating... */
838#define comment 6
839
840/* Preprocessor exclusives */
841#define pp_incl 7
842
843#define pp_def 8
844
845#define pp_undef 9
846
847#define pp_if 10
848
849#define pp_ifdef 11
850
851#define pp_ifndef 12
852
853#define pp_elif 13
854
855#define pp_else 14
856
857#define pp_endif 15
858
859#define pp_error 16
860
861/* Set when accumulating #define's expansion text */
862#define pp_def_s 17
863
864/* Set when processing function type defines */
865#define pp_ignore 18
866
867/* Set when need to strip to eol */
868#define pp_ignore_eol 19
869
870/* Set when handling a false #if case */
871#define pp_false 20
872
873/* Set when stripping c-junk */
874#define pp_strips 21
875
876#define pp_stripp 22
877
878#define pp_stripp_final 23
879
880/*%option stack*/
881#define YY_NEVER_INTERACTIVE 1
882/*%option noyywrap */
883/* Some shortcut definitions */
884#line 90 "parser.l"
885
886#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
887#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
888#endif
889
890/*#define LEX_DEBUG*/
891
892#include "config.h"
893
894#include <stdio.h>
895#include <stdlib.h>
896#include <string.h>
897#include <ctype.h>
898
899#include "wrc.h"
900#include "utils.h"
901#include "preproc.h"
902#include "parser.h"
903#include "newstruc.h"
904
905#include "y.tab.h"
906
907#define YY_USE_PROTOS
908#define YY_NO_UNPUT
909
910/* Always update the current character position within a line */
911#define YY_USER_ACTION char_number+=yyleng;
912
913raw_data_t *new_raw_data(void);
914
915void addcchar(char c);
916void addwchar(short s);
917string_t *get_buffered_cstring(void);
918string_t *get_buffered_wstring(void);
919string_t *make_string(char *s);
920string_t *make_filename(char *s, int len);
921
922int line_number = 1; /* The current line */
923int char_number = 1; /* The current char pos within the line */
924static char *cbuffer; /* Buffers for string collection */
925static int cbufidx;
926static int cbufalloc = 0;
927static short *wbuffer;
928static int wbufidx;
929static int wbufalloc = 0;
930static int want_nl = 0; /* Set when newline needs to go to parser */
931static int want_ident = 0; /* Set is #ifdef, #ifndef or defined is seen */
932static int stripslevel = 0; /* Count {} during pp_strips mode */
933static int stripplevel = 0; /* Count () during pp_strips mode */
934static char *substtext = NULL; /* Holds the substition text while getting a define */
935static int cjunk_tagline; /* Where did we start stripping (helps error tracking) */
936
937#ifdef YY_USE_STACK
938void push_to(int start) { yy_push_state(start); }
939void pop_start(void) { yy_pop_state(start); }
940#else
941#define MAXSTARTSTACK 32
942static int startstack[MAXSTARTSTACK];
943static int startstackidx = 0;
944
945void push_to(int start)
946{
947 if(yydebug)
948 printf("push_to(%d): %d -> %d\n", line_number, YY_START, start);
949 if(startstackidx >= MAXSTARTSTACK-1)
950 internal_error(__FILE__, __LINE__, "Start condition stack overflow");
951 startstack[startstackidx++] = YY_START;
952 BEGIN(start);
953}
954
955void pop_start(void)
956{
957 if(yydebug)
958 printf("pop_start(%d): %d <- %d\n", line_number, startstack[startstackidx-1], YY_START);
959 if(startstackidx <= 0)
960 internal_error(__FILE__, __LINE__, "Start condition stack underflow");
961 --startstackidx;
962 BEGIN(startstack[startstackidx]);
963}
964#endif
965
966
967struct bufferstackentry {
968 YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
969 struct pp_entry *define; /* Points to expanding define
970 or NULL if handling includes
971 */
972 int line_number; /* Line that we were handling */
973 int char_number; /* The current position */
974 char *filename; /* Filename that we were handling */
975};
976
977#define MAXBUFFERSTACK 128
978static struct bufferstackentry bufferstack[MAXBUFFERSTACK];
979static int bufferstackidx = 0;
980
981void push_buffer(YY_BUFFER_STATE buf, struct pp_entry *ppp, char *filename)
982{
983 if(yydebug)
984 printf("push_buffer: %p %p %p\n", buf, ppp, filename);
985 if(bufferstackidx >= MAXBUFFERSTACK-1)
986 internal_error(__FILE__, __LINE__, "Buffer stack overflow");
987 memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
988 bufferstack[bufferstackidx].bufferstate = buf;
989 bufferstack[bufferstackidx].define = ppp;
990 if(ppp)
991 ppp->expanding = 1;
992 else if(filename)
993 {
994 /* These will track the yyerror to the correct file and line */
995 bufferstack[bufferstackidx].line_number = line_number;
996 bufferstack[bufferstackidx].char_number = char_number;
997 line_number = 1;
998 char_number = 1;
999 bufferstack[bufferstackidx].filename = input_name;
1000 input_name = filename;
1001 }
1002 else
1003 internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
1004 bufferstackidx++;
1005}
1006
1007YY_BUFFER_STATE pop_buffer(void)
1008{
1009 if(bufferstackidx <= 0)
1010 return (YY_BUFFER_STATE)0;
1011 bufferstackidx--;
1012 if(bufferstack[bufferstackidx].define)
1013 bufferstack[bufferstackidx].define->expanding = 0;
1014 else
1015 {
1016 line_number = bufferstack[bufferstackidx].line_number;
1017 char_number = bufferstack[bufferstackidx].char_number;
1018 input_name = bufferstack[bufferstackidx].filename;
1019 fclose(yyin);
1020 }
1021 if(yydebug)
1022 printf("pop_buffer: %p %p (%d, %d) %p\n",
1023 bufferstack[bufferstackidx].bufferstate,
1024 bufferstack[bufferstackidx].define,
1025 bufferstack[bufferstackidx].line_number,
1026 bufferstack[bufferstackidx].char_number,
1027 bufferstack[bufferstackidx].filename);
1028 yy_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
1029 return bufferstack[bufferstackidx].bufferstate;
1030}
1031
1032void do_include(char *name, int namelen)
1033{
1034 char *cpy = (char *)xmalloc(namelen);
1035 strcpy(cpy, name+1); /* strip leading " or < */
1036 cpy[namelen-2] = '\0'; /* strip trailing " or > */
1037 if((yyin = open_include(cpy, name[0] == '"')) == NULL)
1038 yyerror("Unable to open include file %s", cpy);
1039 push_buffer(YY_CURRENT_BUFFER, NULL, cpy);
1040 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
1041}
1042
1043
1044struct keyword {
1045 char *keyword;
1046 int token;
1047 int isextension;
1048 int needcase;
1049 int alwayskeyword;
1050};
1051
1052static struct keyword keywords[] = {
1053 { "ACCELERATORS", ACCELERATORS, 0, 0, 0},
1054 { "ALT", ALT, 0, 0, 0},
1055 { "ASCII", ASCII, 0, 0, 0},
1056 { "AUTO3STATE", AUTO3STATE, 1, 0, 0},
1057 { "AUTOCHECKBOX", AUTOCHECKBOX, 1, 0, 0},
1058 { "AUTORADIOBUTTON", AUTORADIOBUTTON, 1, 0, 0},
1059 { "BEGIN", tBEGIN, 0, 0, 1},
1060 { "BITMAP", tBITMAP, 0, 0, 0},
1061 { "BLOCK", BLOCK, 0, 0, 1},
1062 { "BUTTON", BUTTON, 1, 0, 0},
1063 { "CAPTION", CAPTION, 0, 0, 0},
1064 { "CHARACTERISTICS", CHARACTERISTICS, 1, 0, 0},
1065 { "CHECKBOX", CHECKBOX, 0, 0, 0},
1066 { "CHECKED", CHECKED, 0, 0, 0},
1067 { "CLASS", CLASS, 0, 0, 0},
1068 { "COMBOBOX", COMBOBOX, 0, 0, 0},
1069 { "CONTROL", CONTROL, 0, 0, 0},
1070 { "CTEXT", CTEXT, 0, 0, 0},
1071 { "CURSOR", CURSOR, 0, 0, 0},
1072 { "defined", tDEFINED, 0, 1, 1},
1073 { "DEFPUSHBUTTON", DEFPUSHBUTTON, 0, 0, 1},
1074 { "DIALOG", DIALOG, 0, 0, 0},
1075 { "DIALOGEX", DIALOGEX, 1, 0, 0},
1076 { "DISCARDABLE", DISCARDABLE, 0, 0, 0},
1077 { "DLGINIT", DLGINIT, 0, 0, 0},
1078 { "EDITTEXT", EDITTEXT, 0, 0, 0},
1079 { "END", tEND, 0, 0, 1},
1080 { "EXSTYLE", EXSTYLE, 0, 0, 0},
1081 { "extern", tEXTERN, 0, 1, 1},
1082 { "FILEFLAGS", FILEFLAGS, 0, 0, 0},
1083 { "FILEFLAGSMASK", FILEFLAGSMASK, 0, 0, 0},
1084 { "FILEOS", FILEOS, 0, 0, 0},
1085 { "FILESUBTYPE", FILESUBTYPE, 0, 0, 0},
1086 { "FILETYPE", FILETYPE, 0, 0, 0},
1087 { "FILEVERSION", FILEVERSION, 0, 0, 0},
1088 { "FIXED", tFIXED, 0, 0, 0},
1089 { "FONT", FONT, 0, 0, 0},
1090 { "GRAYED", GRAYED, 0, 0, 0},
1091 { "GROUPBOX", GROUPBOX, 0, 0, 0},
1092 { "HELP", HELP, 0, 0, 0},
1093 { "ICON", ICON, 0, 0, 0},
1094 { "IMPURE", IMPURE, 0, 0, 0},
1095 { "INACTIVE", INACTIVE, 0, 0, 0},
1096 { "LANGUAGE", LANGUAGE, 1, 0, 1},
1097 { "LISTBOX", LISTBOX, 0, 0, 0},
1098 { "LOADONCALL", LOADONCALL, 0, 0, 0},
1099 { "LTEXT", LTEXT, 0, 0, 0},
1100 { "MENU", MENU, 0, 0, 0},
1101 { "MENUBARBREAK", MENUBARBREAK, 0, 0, 0},
1102 { "MENUBREAK", MENUBREAK, 0, 0, 0},
1103 { "MENUEX", MENUEX, 1, 0, 0},
1104 { "MENUITEM", MENUITEM, 0, 0, 0},
1105 { "MESSAGETABLE", MESSAGETABLE, 1, 0, 0},
1106 { "MOVEABLE", MOVEABLE, 0, 0, 0},
1107 { "NOINVERT", NOINVERT, 0, 0, 0},
1108 { "NOT", NOT, 0, 0, 0},
1109 { "POPUP", POPUP, 0, 0, 0},
1110 { "PRELOAD", PRELOAD, 0, 0, 0},
1111 { "PRODUCTVERSION", PRODUCTVERSION, 0, 0, 0},
1112 { "PURE", tPURE, 0, 0, 0},
1113 { "PUSHBUTTON", PUSHBUTTON, 0, 0, 0},
1114 { "RADIOBUTTON", RADIOBUTTON, 0, 0, 0},
1115 { "RCDATA", RCDATA, 0, 0, 0},
1116 { "RTEXT", RTEXT, 0, 0, 0},
1117 { "SCROLLBAR", SCROLLBAR, 0, 0, 0},
1118 { "SEPARATOR", SEPARATOR, 0, 0, 0},
1119 { "SHIFT", SHIFT, 0, 0, 0},
1120 { "STATE3", STATE3, 1, 0, 0},
1121 { "STRING", tSTRING, 0, 0, 0},
1122 { "STRINGTABLE", STRINGTABLE, 0, 0, 1},
1123 { "STYLE", STYLE, 0, 0, 0},
1124 { "TOOLBAR", TOOLBAR, 1, 0, 0},
1125 { "typedef", tTYPEDEF, 0, 1, 1},
1126 { "VALUE", VALUE, 0, 0, 0},
1127 { "VERSION", VERSION, 1, 0, 0},
1128 { "VERSIONINFO", VERSIONINFO, 0, 0, 0},
1129 { "VIRTKEY", VIRTKEY, 0, 0, 0}
1130};
1131
1132#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
1133#define KWP(p) ((struct keyword *)(p))
1134int kw_cmp_func(const void *s1, const void *s2)
1135{
1136 int ret;
1137 ret = strcasecmp(KWP(s1)->keyword, KWP(s2)->keyword);
1138 if(!ret && (KWP(s1)->needcase || KWP(s2)->needcase))
1139 return strcmp(KWP(s1)->keyword, KWP(s2)->keyword);
1140 else
1141 return ret;
1142}
1143
1144#define KW_BSEARCH
1145#define DO_SORT
1146struct keyword *iskeyword(char *kw)
1147{
1148 struct keyword *kwp;
1149 struct keyword key;
1150 key.keyword = kw;
1151 key.needcase = 0;
1152#ifdef DO_SORT
1153 {
1154 /* Make sure that it is sorted for bsearsh */
1155 static int sorted = 0;
1156 if(!sorted)
1157 {
1158 qsort(keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
1159 sorted = 1;
1160 }
1161 }
1162#endif
1163#ifdef KW_BSEARCH
1164 kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
1165#else
1166 {
1167 int i;
1168 for(i = 0; i < NKEYWORDS; i++)
1169 {
1170 if(!kw_cmp_func(&key, &keywords[i]))
1171 break;
1172 }
1173 if(i < NKEYWORDS)
1174 kwp = &keywords[i];
1175 else
1176 kwp = NULL;
1177 }
1178#endif
1179
1180#ifdef LEX_DEBUG
1181 if(kwp && !strcmp(kwp->keyword, "LANGUAGE"))
1182 printf("Got Language\n");
1183#endif
1184 if(kwp == NULL || (kwp->isextension && !extensions))
1185 return NULL;
1186 else
1187 return kwp;
1188}
1189
1190void add_to_substtext(char *text, int len)
1191{
1192 if(!substtext)
1193 {
1194 substtext = xstrdup(text);
1195 }
1196 else
1197 {
1198 substtext = (char *)xrealloc(substtext, strlen(substtext)+len+1);
1199 strcat(substtext, text);
1200 }
1201}
1202
1203#line 1204 "lexyy.c"
1204
1205/* Macros after this point can all be overridden by user definitions in
1206 * section 1.
1207 */
1208
1209#ifndef YY_SKIP_YYWRAP
1210#ifdef __cplusplus
1211extern "C" int yywrap YY_PROTO(( void ));
1212#else
1213extern int yywrap YY_PROTO(( void ));
1214#endif
1215#endif
1216
1217#ifndef YY_NO_UNPUT
1218static void yyunput YY_PROTO(( int c, char *buf_ptr ));
1219#endif
1220
1221#ifndef yytext_ptr
1222static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
1223#endif
1224
1225#ifndef YY_NO_INPUT
1226#ifdef __cplusplus
1227static int yyinput YY_PROTO(( void ));
1228#else
1229static int input YY_PROTO(( void ));
1230#endif
1231#endif
1232
1233#if YY_STACK_USED
1234static int yy_start_stack_ptr = 0;
1235static int yy_start_stack_depth = 0;
1236static int *yy_start_stack = 0;
1237#ifndef YY_NO_PUSH_STATE
1238static void yy_push_state YY_PROTO(( int new_state ));
1239#endif
1240#ifndef YY_NO_POP_STATE
1241static void yy_pop_state YY_PROTO(( void ));
1242#endif
1243#ifndef YY_NO_TOP_STATE
1244static int yy_top_state YY_PROTO(( void ));
1245#endif
1246
1247#else
1248#define YY_NO_PUSH_STATE 1
1249#define YY_NO_POP_STATE 1
1250#define YY_NO_TOP_STATE 1
1251#endif
1252
1253#ifdef YY_MALLOC_DECL
1254YY_MALLOC_DECL
1255#else
1256#if __STDC__
1257#ifndef __cplusplus
1258#include <stdlib.h>
1259#endif
1260#else
1261/* Just try to get by without declaring the routines. This will fail
1262 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1263 * or sizeof(void*) != sizeof(int).
1264 */
1265#endif
1266#endif
1267
1268/* Amount of stuff to slurp up with each read. */
1269#ifndef YY_READ_BUF_SIZE
1270#define YY_READ_BUF_SIZE 8192
1271#endif
1272
1273/* Copy whatever the last rule matched to the standard output. */
1274
1275#ifndef ECHO
1276/* This used to be an fputs(), but since the string might contain NUL's,
1277 * we now use fwrite().
1278 */
1279#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1280#endif
1281
1282/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1283 * is returned in "result".
1284 */
1285#ifndef YY_INPUT
1286#define YY_INPUT(buf,result,max_size) \
1287 if ( yy_current_buffer->yy_is_interactive ) \
1288 { \
1289 int c = '*', n; \
1290 for ( n = 0; n < max_size && \
1291 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1292 buf[n] = (char) c; \
1293 if ( c == '\n' ) \
1294 buf[n++] = (char) c; \
1295 if ( c == EOF && ferror( yyin ) ) \
1296 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1297 result = n; \
1298 } \
1299 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1300 && ferror( yyin ) ) \
1301 YY_FATAL_ERROR( "input in flex scanner failed" );
1302#endif
1303
1304/* No semi-colon after return; correct usage is to write "yyterminate();" -
1305 * we don't want an extra ';' after the "return" because that will cause
1306 * some compilers to complain about unreachable statements.
1307 */
1308#ifndef yyterminate
1309#define yyterminate() return YY_NULL
1310#endif
1311
1312/* Number of entries by which start-condition stack grows. */
1313#ifndef YY_START_STACK_INCR
1314#define YY_START_STACK_INCR 25
1315#endif
1316
1317/* Report a fatal error. */
1318#ifndef YY_FATAL_ERROR
1319#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1320#endif
1321
1322/* Default declaration of generated scanner - a define so the user can
1323 * easily add parameters.
1324 */
1325#ifndef YY_DECL
1326#define YY_DECL int yylex YY_PROTO(( void ))
1327#endif
1328
1329/* Code executed at the beginning of each rule, after yytext and yyleng
1330 * have been set up.
1331 */
1332#ifndef YY_USER_ACTION
1333#define YY_USER_ACTION
1334#endif
1335
1336/* Code executed at the end of each rule. */
1337#ifndef YY_BREAK
1338#define YY_BREAK break;
1339#endif
1340
1341#define YY_RULE_SETUP \
1342 if ( yyleng > 0 ) \
1343 yy_current_buffer->yy_at_bol = \
1344 (yytext[yyleng - 1] == '\n'); \
1345 YY_USER_ACTION
1346
1347YY_DECL
1348 {
1349 register yy_state_type yy_current_state;
1350 register char *yy_cp, *yy_bp;
1351 register int yy_act;
1352
1353#line 410 "parser.l"
1354
1355 /* #include handling */
1356#line 1357 "lexyy.c"
1357
1358 if ( yy_init )
1359 {
1360 yy_init = 0;
1361
1362#ifdef YY_USER_INIT
1363 YY_USER_INIT;
1364#endif
1365
1366 if ( ! yy_start )
1367 yy_start = 1; /* first start state */
1368
1369 if ( ! yyin )
1370 yyin = stdin;
1371
1372 if ( ! yyout )
1373 yyout = stdout;
1374
1375 if ( ! yy_current_buffer )
1376 yy_current_buffer =
1377 yy_create_buffer( yyin, YY_BUF_SIZE );
1378
1379 yy_load_buffer_state();
1380 }
1381
1382 while ( 1 ) /* loops until end-of-file is reached */
1383 {
1384 yy_cp = yy_c_buf_p;
1385
1386 /* Support of yytext. */
1387 *yy_cp = yy_hold_char;
1388
1389 /* yy_bp points to the position in yy_ch_buf of the start of
1390 * the current run.
1391 */
1392 yy_bp = yy_cp;
1393
1394 yy_current_state = yy_start;
1395 yy_current_state += YY_AT_BOL();
1396yy_match:
1397 do
1398 {
1399 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1400 if ( yy_accept[yy_current_state] )
1401 {
1402 yy_last_accepting_state = yy_current_state;
1403 yy_last_accepting_cpos = yy_cp;
1404 }
1405 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1406 {
1407 yy_current_state = (int) yy_def[yy_current_state];
1408 if ( yy_current_state >= 346 )
1409 yy_c = yy_meta[(unsigned int) yy_c];
1410 }
1411 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1412 ++yy_cp;
1413 }
1414 while ( yy_base[yy_current_state] != 1265 );
1415
1416yy_find_action:
1417 yy_act = yy_accept[yy_current_state];
1418 if ( yy_act == 0 )
1419 { /* have to back up */
1420 yy_cp = yy_last_accepting_cpos;
1421 yy_current_state = yy_last_accepting_state;
1422 yy_act = yy_accept[yy_current_state];
1423 }
1424
1425 YY_DO_BEFORE_ACTION;
1426
1427
1428do_action: /* This label is used only to access EOF actions. */
1429
1430
1431 switch ( yy_act )
1432 { /* beginning of action switch */
1433 case 0: /* must back up */
1434 /* undo the effects of YY_DO_BEFORE_ACTION */
1435 *yy_cp = yy_hold_char;
1436 yy_cp = yy_last_accepting_cpos;
1437 yy_current_state = yy_last_accepting_state;
1438 goto yy_find_action;
1439
1440case 1:
1441YY_RULE_SETUP
1442#line 412 "parser.l"
1443push_to(pp_incl);
1444 YY_BREAK
1445case 2:
1446YY_RULE_SETUP
1447#line 413 "parser.l"
1448do_include(yytext, yyleng); pop_start();
1449 YY_BREAK
1450case 3:
1451YY_RULE_SETUP
1452#line 414 "parser.l"
1453do_include(yytext, yyleng); pop_start();
1454 YY_BREAK
1455case 4:
1456YY_RULE_SETUP
1457#line 415 "parser.l"
1458yyerror("Malformed #include");
1459 YY_BREAK
1460/* #define handling */
1461case 5:
1462YY_RULE_SETUP
1463#line 418 "parser.l"
1464push_to(pp_def);
1465 YY_BREAK
1466case 6:
1467YY_RULE_SETUP
1468#line 419 "parser.l"
1469{
1470 set_define(yytext);
1471 push_to(pp_def_s);
1472 }
1473 YY_BREAK
1474case 7:
1475YY_RULE_SETUP
1476#line 423 "parser.l"
1477push_to(pp_ignore); /* Ignore function-like defines for now*/
1478 YY_BREAK
1479case 8:
1480YY_RULE_SETUP
1481#line 424 "parser.l"
1482yyerror("Malformed #define");
1483 YY_BREAK
1484case 9:
1485YY_RULE_SETUP
1486#line 426 "parser.l"
1487{
1488 if(YY_START == pp_def_s)
1489 add_to_substtext(yytext, yyleng);
1490 }
1491 YY_BREAK
1492case 10:
1493YY_RULE_SETUP
1494#line 430 "parser.l"
1495{ /* Comment is handled in normal handling */
1496 if(YY_START == pp_def_s)
1497 add_to_substtext(yytext, yyleng);
1498 }
1499 YY_BREAK
1500case 11:
1501YY_RULE_SETUP
1502#line 434 "parser.l"
1503line_number++; char_number = 1; /* Line continuation */
1504 YY_BREAK
1505case 12:
1506YY_RULE_SETUP
1507#line 435 "parser.l"
1508{
1509 if(YY_START == pp_def_s)
1510 {
1511 add_define(substtext ? substtext : "");
1512 free(substtext);
1513 substtext = NULL;
1514 }
1515 line_number++;
1516 char_number = 1;
1517 pop_start();
1518 pop_start();
1519 }
1520 YY_BREAK
1521/* #undef handling */
1522case 13:
1523YY_RULE_SETUP
1524#line 449 "parser.l"
1525push_to(pp_undef);
1526 YY_BREAK
1527case 14:
1528YY_RULE_SETUP
1529#line 450 "parser.l"
1530{
1531 del_define(yytext);
1532 pop_start();
1533 /*push_to(pp_ignore);*/
1534 }
1535 YY_BREAK
1536/* Conditional handling */
1537case 15:
1538YY_RULE_SETUP
1539#line 457 "parser.l"
1540{
1541 if(YY_START == pp_false)
1542 {
1543 if(yydebug)
1544 printf("(%d)#if ignored\n", line_number);
1545 push_if(0, 0, 1);
1546 push_to(pp_ignore_eol);
1547 }
1548 else
1549 {
1550 push_to(INITIAL);
1551 want_nl = 1;
1552 return tIF;
1553 }
1554 }
1555 YY_BREAK
1556case 16:
1557YY_RULE_SETUP
1558#line 472 "parser.l"
1559{
1560 if(YY_START == pp_false)
1561 {
1562 if(yydebug)
1563 printf("(%d)#ifdef ignored\n", line_number);
1564 push_if(0, 0, 1);
1565 push_to(pp_ignore_eol);
1566 }
1567 else
1568 {
1569 push_to(INITIAL);
1570 want_nl = 1;
1571 want_ident = 1;
1572 return tIFDEF;
1573 }
1574 }
1575 YY_BREAK
1576case 17:
1577YY_RULE_SETUP
1578#line 488 "parser.l"
1579{
1580 if(YY_START == pp_false)
1581 {
1582 if(yydebug)
1583 printf("(%d)#ifndef ignored\n", line_number);
1584 push_if(0, 0, 1);
1585 push_to(pp_ignore_eol);
1586 }
1587 else
1588 {
1589 push_to(INITIAL);
1590 want_nl = 1;
1591 want_ident = 1;
1592 return tIFNDEF;
1593 }
1594 }
1595 YY_BREAK
1596case 18:
1597YY_RULE_SETUP
1598#line 504 "parser.l"
1599{
1600 if(!isnevertrue_if())
1601 {
1602 push_to(INITIAL);
1603 want_nl = 1;
1604 return tELIF;
1605 }
1606 else if(YY_START == pp_false)
1607 push_to(pp_ignore_eol);
1608 if(yydebug)
1609 printf("(%d)#elif ignored\n", line_number);
1610 }
1611 YY_BREAK
1612case 19:
1613YY_RULE_SETUP
1614#line 516 "parser.l"
1615{
1616 if(!isnevertrue_if())
1617 {
1618 push_to(INITIAL);
1619 want_nl = 1;
1620 return tELSE;
1621 }
1622 if(yydebug)
1623 printf("(%d)#else ignored\n", line_number);
1624 }
1625 YY_BREAK
1626case 20:
1627YY_RULE_SETUP
1628#line 526 "parser.l"
1629{
1630 if(!isnevertrue_if())
1631 {
1632 want_nl = 1;
1633 return tENDIF;
1634 }
1635 else
1636 {
1637 if(yydebug)
1638 printf("(%d)#endif ignored\n", line_number);
1639 pop_if();
1640 }
1641 }
1642 YY_BREAK
1643/* The error directive */
1644case 21:
1645YY_RULE_SETUP
1646#line 541 "parser.l"
1647push_to(pp_error);
1648 YY_BREAK
1649case 22:
1650YY_RULE_SETUP
1651#line 542 "parser.l"
1652yyerror("Error directive: %s", yytext);
1653 YY_BREAK
1654/* preprocessor junk */
1655case 23:
1656YY_RULE_SETUP
1657#line 545 "parser.l"
1658; /* Ignore #pragma */
1659 YY_BREAK
1660case 24:
1661YY_RULE_SETUP
1662#line 546 "parser.l"
1663; /* Ignore #line */
1664 YY_BREAK
1665/* We'll get an error on malformed #xxx statements
1666 * by not recognising '#' at all. This helps tracking
1667 * preprocessor errors.
1668 */
1669/*^{ws}*#{ws}* ; Ignore # */
1670case 25:
1671YY_RULE_SETUP
1672#line 553 "parser.l"
1673stripslevel++;
1674 YY_BREAK
1675case 26:
1676YY_RULE_SETUP
1677#line 554 "parser.l"
1678stripslevel--;
1679 YY_BREAK
1680case 27:
1681YY_RULE_SETUP
1682#line 555 "parser.l"
1683if(!stripslevel) pop_start();
1684 YY_BREAK
1685case 28:
1686YY_RULE_SETUP
1687#line 556 "parser.l"
1688; /* To catch comments */
1689 YY_BREAK
1690case 29:
1691YY_RULE_SETUP
1692#line 557 "parser.l"
1693; /* Ignore rest */
1694 YY_BREAK
1695case 30:
1696YY_RULE_SETUP
1697#line 559 "parser.l"
1698stripplevel++;
1699 YY_BREAK
1700case 31:
1701YY_RULE_SETUP
1702#line 560 "parser.l"
1703{
1704 stripplevel--;
1705 if(!stripplevel)
1706 {
1707 pop_start();
1708 push_to(pp_stripp_final);
1709 }
1710 }
1711 YY_BREAK
1712case 32:
1713YY_RULE_SETUP
1714#line 568 "parser.l"
1715; /* To catch comments */
1716 YY_BREAK
1717case 33:
1718YY_RULE_SETUP
1719#line 569 "parser.l"
1720; /* Ignore rest */
1721 YY_BREAK
1722case 34:
1723YY_RULE_SETUP
1724#line 571 "parser.l"
1725; /* Ignore */
1726 YY_BREAK
1727case 35:
1728YY_RULE_SETUP
1729#line 572 "parser.l"
1730pop_start(); /* Kill the semicolon */
1731 YY_BREAK
1732case 36:
1733YY_RULE_SETUP
1734#line 573 "parser.l"
1735line_number++; char_number = 1; pop_start();
1736 YY_BREAK
1737case 37:
1738YY_RULE_SETUP
1739#line 574 "parser.l"
1740yyless(0); pop_start();
1741 YY_BREAK
1742case 38:
1743YY_RULE_SETUP
1744#line 576 "parser.l"
1745; /* Ignore everything except #xxx during false #if state */
1746 YY_BREAK
1747case 39:
1748YY_RULE_SETUP
1749#line 578 "parser.l"
1750pop_start();
1751 YY_BREAK
1752/* These are special cases due to filename scanning */
1753case 40:
1754YY_RULE_SETUP
1755#line 581 "parser.l"
1756return DISCARDABLE;
1757 YY_BREAK
1758case 41:
1759YY_RULE_SETUP
1760#line 582 "parser.l"
1761return tFIXED;
1762 YY_BREAK
1763case 42:
1764YY_RULE_SETUP
1765#line 583 "parser.l"
1766return IMPURE;
1767 YY_BREAK
1768case 43:
1769YY_RULE_SETUP
1770#line 584 "parser.l"
1771return MOVEABLE;
1772 YY_BREAK
1773case 44:
1774YY_RULE_SETUP
1775#line 585 "parser.l"
1776return LOADONCALL;
1777 YY_BREAK
1778case 45:
1779YY_RULE_SETUP
1780#line 586 "parser.l"
1781return PRELOAD;
1782 YY_BREAK
1783case 46:
1784YY_RULE_SETUP
1785#line 587 "parser.l"
1786return tPURE;
1787 YY_BREAK
1788case 47:
1789YY_RULE_SETUP
1790#line 589 "parser.l"
1791return tBEGIN;
1792 YY_BREAK
1793case 48:
1794YY_RULE_SETUP
1795#line 590 "parser.l"
1796return tEND;
1797 YY_BREAK
1798case 49:
1799YY_RULE_SETUP
1800#line 592 "parser.l"
1801{ yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1802 YY_BREAK
1803case 50:
1804YY_RULE_SETUP
1805#line 593 "parser.l"
1806{ yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1807 YY_BREAK
1808case 51:
1809YY_RULE_SETUP
1810#line 594 "parser.l"
1811{ yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1812 YY_BREAK
1813case 52:
1814YY_RULE_SETUP
1815#line 595 "parser.l"
1816{
1817 struct keyword *token;
1818 struct pp_entry *ppp;
1819
1820 want_rscname = 0;
1821
1822 if(want_ident)
1823 {
1824 /* Prevent preprocessor subst */
1825 want_ident = 0;
1826 yylval.str = make_string(yytext);
1827 #ifdef LEX_DEBUG
1828 printf("want IDENT (%s, %d, %d): <%s>\n", input_name, line_number, char_number, yytext);
1829 #endif
1830 return IDENT;
1831 }
1832 else if((ppp = pp_lookup(yytext)) != NULL)
1833 {
1834 /* Do preprocessor substitution,
1835 * but expand only if macro is not
1836 * already expanding.
1837 */
1838 if(!ppp->expanding)
1839 {
1840 #ifdef LEX_DEBUG
1841 printf("expand IDENT (%s, %d, %d): <%s>\n", input_name, line_number, char_number, yytext);
1842 #endif
1843 push_buffer(YY_CURRENT_BUFFER, ppp, NULL);
1844 yy_scan_string(ppp->subst);
1845 }
1846 }
1847 else if((token = iskeyword(yytext)) != NULL
1848 && !(!token->alwayskeyword && want_rscname))
1849 {
1850 switch(token->token)
1851 {
1852 case tDEFINED:
1853 want_ident = 1;
1854 break;
1855 /*case RCDATA:*/
1856 case CURSOR:
1857 case tBITMAP:
1858 case MESSAGETABLE:
1859 case DLGINIT:
1860 push_to(yywf);
1861 break;
1862 case FONT:
1863 case ICON:
1864 if(!indialog)
1865 push_to(yywf);
1866 break;
1867 case DIALOG:
1868 case DIALOGEX:
1869 indialog = 1;
1870 break;
1871 }
1872 return token->token;
1873 }
1874 else
1875 {
1876 yylval.str = make_string(yytext);
1877 #ifdef LEX_DEBUG
1878 printf("%s IDENT (%s, %d, %d): <%s>\n",
1879 want_rscname ? "rscname" : "just",
1880 input_name,
1881 line_number,
1882 char_number,
1883 yytext);
1884 #endif
1885 return IDENT;
1886 }
1887 }
1888 YY_BREAK
1889case 53:
1890YY_RULE_SETUP
1891#line 667 "parser.l"
1892return LOGOR;
1893 YY_BREAK
1894case 54:
1895YY_RULE_SETUP
1896#line 668 "parser.l"
1897return LOGAND;
1898 YY_BREAK
1899case 55:
1900YY_RULE_SETUP
1901#line 669 "parser.l"
1902return EQ;
1903 YY_BREAK
1904case 56:
1905YY_RULE_SETUP
1906#line 670 "parser.l"
1907return NE;
1908 YY_BREAK
1909case 57:
1910YY_RULE_SETUP
1911#line 671 "parser.l"
1912return LTE;
1913 YY_BREAK
1914case 58:
1915YY_RULE_SETUP
1916#line 672 "parser.l"
1917return GTE;
1918 YY_BREAK
1919case 59:
1920YY_RULE_SETUP
1921#line 674 "parser.l"
1922{ pop_start(); yylval.str = make_filename(yytext, yyleng); return FILENAME; }
1923 YY_BREAK
1924case 60:
1925YY_RULE_SETUP
1926#line 675 "parser.l"
1927push_to(yywf_s);
1928 YY_BREAK
1929case 61:
1930YY_RULE_SETUP
1931#line 676 "parser.l"
1932{ pop_start(); pop_start(); yylval.str = make_filename(yytext, yyleng-1); return FILENAME; }
1933 YY_BREAK
1934case 62:
1935YY_RULE_SETUP
1936#line 677 "parser.l"
1937yyerror("Newline in filename");
1938 YY_BREAK
1939case 63:
1940YY_RULE_SETUP
1941#line 679 "parser.l"
1942{
1943 push_to(yylstr);
1944 wbufidx = 0;
1945 if(!win32)
1946 yywarning("16bit resource contains unicode strings\n");
1947 }
1948 YY_BREAK
1949case 64:
1950YY_RULE_SETUP
1951#line 685 "parser.l"
1952{
1953 pop_start();
1954 yylval.str = get_buffered_wstring();
1955 return tSTRING;
1956 }
1957 YY_BREAK
1958case 65:
1959YY_RULE_SETUP
1960#line 690 "parser.l"
1961yyerror("Unterminated string");
1962 YY_BREAK
1963case 66:
1964YY_RULE_SETUP
1965#line 691 "parser.l"
1966{ /* octal escape sequence */
1967 int result;
1968 result = strtol(yytext+1, 0, 8);
1969 if ( result > 0xffff )
1970 yyerror("Character constant out of range");
1971 addwchar((short)result);
1972 }
1973 YY_BREAK
1974case 67:
1975YY_RULE_SETUP
1976#line 698 "parser.l"
1977{ /* hex escape sequence */
1978 int result;
1979 result = strtol(yytext+2, 0, 16);
1980 addwchar((short)result);
1981 }
1982 YY_BREAK
1983case 68:
1984YY_RULE_SETUP
1985#line 703 "parser.l"
1986yyerror("Bad escape secuence");
1987 YY_BREAK
1988case 69:
1989YY_RULE_SETUP
1990#line 704 "parser.l"
1991addwchar('\a');
1992 YY_BREAK
1993case 70:
1994YY_RULE_SETUP
1995#line 705 "parser.l"
1996addwchar('\b');
1997 YY_BREAK
1998case 71:
1999YY_RULE_SETUP
2000#line 706 "parser.l"
2001addwchar('\f');
2002 YY_BREAK
2003case 72:
2004YY_RULE_SETUP
2005#line 707 "parser.l"
2006addwchar('\n');
2007 YY_BREAK
2008case 73:
2009YY_RULE_SETUP
2010#line 708 "parser.l"
2011addwchar('\r');
2012 YY_BREAK
2013case 74:
2014YY_RULE_SETUP
2015#line 709 "parser.l"
2016addwchar('\t');
2017 YY_BREAK
2018case 75:
2019YY_RULE_SETUP
2020#line 710 "parser.l"
2021addwchar('\v');
2022 YY_BREAK
2023case 76:
2024YY_RULE_SETUP
2025#line 711 "parser.l"
2026addwchar(yytext[1]);
2027 YY_BREAK
2028case 77:
2029YY_RULE_SETUP
2030#line 712 "parser.l"
2031addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
2032 YY_BREAK
2033case 78:
2034YY_RULE_SETUP
2035#line 713 "parser.l"
2036addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
2037 YY_BREAK
2038case 79:
2039YY_RULE_SETUP
2040#line 714 "parser.l"
2041; /* "bla" "bla" -> "blabla" */
2042 YY_BREAK
2043case 80:
2044YY_RULE_SETUP
2045#line 715 "parser.l"
2046{
2047 char *yptr = yytext;
2048 while(*yptr) /* FIXME: codepage translation */
2049 addwchar(*yptr++ & 0xff);
2050 }
2051 YY_BREAK
2052case 81:
2053YY_RULE_SETUP
2054#line 721 "parser.l"
2055{
2056 push_to(yystr);
2057 cbufidx = 0;
2058 }
2059 YY_BREAK
2060case 82:
2061YY_RULE_SETUP
2062#line 725 "parser.l"
2063{
2064 pop_start();
2065 yylval.str = get_buffered_cstring();
2066 return tSTRING;
2067 }
2068 YY_BREAK
2069case 83:
2070YY_RULE_SETUP
2071#line 730 "parser.l"
2072yyerror("Unterminated string");
2073 YY_BREAK
2074case 84:
2075YY_RULE_SETUP
2076#line 731 "parser.l"
2077{ /* octal escape sequence */
2078 int result;
2079 result = strtol(yytext+1, 0, 8);
2080 if ( result > 0xff )
2081 yyerror("Character constant out of range");
2082 addcchar((char)result);
2083 }
2084 YY_BREAK
2085case 85:
2086YY_RULE_SETUP
2087#line 738 "parser.l"
2088{ /* hex escape sequence */
2089 int result;
2090 result = strtol(yytext+2, 0, 16);
2091 addcchar((char)result);
2092 }
2093 YY_BREAK
2094case 86:
2095YY_RULE_SETUP
2096#line 743 "parser.l"
2097yyerror("Bad escape secuence");
2098 YY_BREAK
2099case 87:
2100YY_RULE_SETUP
2101#line 744 "parser.l"
2102addcchar('\a');
2103 YY_BREAK
2104case 88:
2105YY_RULE_SETUP
2106#line 745 "parser.l"
2107addcchar('\b');
2108 YY_BREAK
2109case 89:
2110YY_RULE_SETUP
2111#line 746 "parser.l"
2112addcchar('\f');
2113 YY_BREAK
2114case 90:
2115YY_RULE_SETUP
2116#line 747 "parser.l"
2117addcchar('\n');
2118 YY_BREAK
2119case 91:
2120YY_RULE_SETUP
2121#line 748 "parser.l"
2122addcchar('\r');
2123 YY_BREAK
2124case 92:
2125YY_RULE_SETUP
2126#line 749 "parser.l"
2127addcchar('\t');
2128 YY_BREAK
2129case 93:
2130YY_RULE_SETUP
2131#line 750 "parser.l"
2132addcchar('\v');
2133 YY_BREAK
2134case 94:
2135YY_RULE_SETUP
2136#line 751 "parser.l"
2137addcchar(yytext[1]);
2138 YY_BREAK
2139case 95:
2140YY_RULE_SETUP
2141#line 752 "parser.l"
2142{
2143 char *yptr = yytext;
2144 while(*yptr)
2145 addcchar(*yptr++);
2146 }
2147 YY_BREAK
2148case 96:
2149YY_RULE_SETUP
2150#line 757 "parser.l"
2151addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
2152 YY_BREAK
2153case 97:
2154YY_RULE_SETUP
2155#line 758 "parser.l"
2156addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
2157 YY_BREAK
2158case 98:
2159YY_RULE_SETUP
2160#line 759 "parser.l"
2161; /* "bla" "bla" -> "blabla" */
2162 YY_BREAK
2163case 99:
2164YY_RULE_SETUP
2165#line 760 "parser.l"
2166yywarning("Matched %c");
2167 YY_BREAK
2168case 100:
2169YY_RULE_SETUP
2170#line 763 "parser.l"
2171{
2172 push_to(yyrcd);
2173 cbufidx = 0;
2174 }
2175 YY_BREAK
2176case 101:
2177YY_RULE_SETUP
2178#line 767 "parser.l"
2179{
2180 pop_start();
2181 yylval.raw = new_raw_data();
2182 yylval.raw->size = cbufidx;
2183 yylval.raw->data = xmalloc(yylval.raw->size);
2184 memcpy(yylval.raw->data, cbuffer, yylval.raw->size);
2185 return RAWDATA;
2186 }
2187 YY_BREAK
2188case 102:
2189YY_RULE_SETUP
2190#line 775 "parser.l"
2191{
2192 int result;
2193 result = strtol(yytext, 0, 16);
2194 addcchar((char)result);
2195 }
2196 YY_BREAK
2197case 103:
2198YY_RULE_SETUP
2199#line 780 "parser.l"
2200; /* Ignore space */
2201 YY_BREAK
2202case 104:
2203YY_RULE_SETUP
2204#line 781 "parser.l"
2205line_number++; char_number = 1;
2206 YY_BREAK
2207case 105:
2208YY_RULE_SETUP
2209#line 782 "parser.l"
2210yyerror("Malformed data-line");
2211 YY_BREAK
2212case 106:
2213YY_RULE_SETUP
2214#line 784 "parser.l"
2215push_to(comment); /* Eat comment */
2216 YY_BREAK
2217case 107:
2218YY_RULE_SETUP
2219#line 785 "parser.l"
2220;
2221 YY_BREAK
2222case 108:
2223YY_RULE_SETUP
2224#line 786 "parser.l"
2225;
2226 YY_BREAK
2227case 109:
2228YY_RULE_SETUP
2229#line 787 "parser.l"
2230line_number++; char_number = 1;
2231 YY_BREAK
2232case 110:
2233YY_RULE_SETUP
2234#line 788 "parser.l"
2235pop_start();
2236 YY_BREAK
2237case 111:
2238YY_RULE_SETUP
2239#line 790 "parser.l"
2240; /* Eat comment */
2241 YY_BREAK
2242case 112:
2243YY_RULE_SETUP
2244#line 791 "parser.l"
2245; /* Eat comment */
2246 YY_BREAK
2247case 113:
2248YY_RULE_SETUP
2249#line 793 "parser.l"
2250{
2251 if(YY_START == yywf)
2252 pop_start();
2253 line_number++;
2254 char_number = 1;
2255 if(want_nl)
2256 {
2257 want_nl = 0;
2258 return tNL;
2259 }
2260 }
2261 YY_BREAK
2262case 114:
2263YY_RULE_SETUP
2264#line 804 "parser.l"
2265; /* Eat whitespace */
2266 YY_BREAK
2267case 115:
2268YY_RULE_SETUP
2269#line 806 "parser.l"
2270return yytext[0];
2271 YY_BREAK
2272case YY_STATE_EOF(INITIAL):
2273case YY_STATE_EOF(yywf):
2274case YY_STATE_EOF(yywf_s):
2275case YY_STATE_EOF(yystr):
2276case YY_STATE_EOF(yylstr):
2277case YY_STATE_EOF(yyrcd):
2278case YY_STATE_EOF(comment):
2279case YY_STATE_EOF(pp_incl):
2280case YY_STATE_EOF(pp_def):
2281case YY_STATE_EOF(pp_undef):
2282case YY_STATE_EOF(pp_if):
2283case YY_STATE_EOF(pp_ifdef):
2284case YY_STATE_EOF(pp_ifndef):
2285case YY_STATE_EOF(pp_elif):
2286case YY_STATE_EOF(pp_else):
2287case YY_STATE_EOF(pp_endif):
2288case YY_STATE_EOF(pp_error):
2289case YY_STATE_EOF(pp_def_s):
2290case YY_STATE_EOF(pp_ignore):
2291case YY_STATE_EOF(pp_ignore_eol):
2292case YY_STATE_EOF(pp_false):
2293case YY_STATE_EOF(pp_strips):
2294case YY_STATE_EOF(pp_stripp):
2295case YY_STATE_EOF(pp_stripp_final):
2296#line 807 "parser.l"
2297{
2298 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2299 if(!pop_buffer())
2300 {
2301 if(YY_START == pp_strips || YY_START == pp_stripp || YY_START == pp_stripp_final)
2302 yyerror("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline);
2303 else
2304 yyterminate();
2305 }
2306 yy_delete_buffer(b);
2307 }
2308 YY_BREAK
2309case 116:
2310YY_RULE_SETUP
2311#line 819 "parser.l"
2312{
2313 /* Catch all rule to find any unmatched text */
2314 if(*yytext == '\n')
2315 {
2316 line_number++;
2317 char_number = 1;
2318 }
2319 yywarning("Unmatched text '%c' (0x%02x) YY_START=%d",
2320 isprint(*yytext) ? *yytext : '.', *yytext, YY_START);
2321 }
2322 YY_BREAK
2323case 117:
2324YY_RULE_SETUP
2325#line 830 "parser.l"
2326ECHO;
2327 YY_BREAK
2328#line 2329 "lexyy.c"
2329
2330 case YY_END_OF_BUFFER:
2331 {
2332 /* Amount of text matched not including the EOB char. */
2333 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2334
2335 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2336 *yy_cp = yy_hold_char;
2337
2338 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2339 {
2340 /* We're scanning a new file or input source. It's
2341 * possible that this happened because the user
2342 * just pointed yyin at a new source and called
2343 * yylex(). If so, then we have to assure
2344 * consistency between yy_current_buffer and our
2345 * globals. Here is the right place to do so, because
2346 * this is the first action (other than possibly a
2347 * back-up) that will match for the new input source.
2348 */
2349 yy_n_chars = yy_current_buffer->yy_n_chars;
2350 yy_current_buffer->yy_input_file = yyin;
2351 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2352 }
2353
2354 /* Note that here we test for yy_c_buf_p "<=" to the position
2355 * of the first EOB in the buffer, since yy_c_buf_p will
2356 * already have been incremented past the NUL character
2357 * (since all states make transitions on EOB to the
2358 * end-of-buffer state). Contrast this with the test
2359 * in input().
2360 */
2361 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2362 { /* This was really a NUL. */
2363 yy_state_type yy_next_state;
2364
2365 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2366
2367 yy_current_state = yy_get_previous_state();
2368
2369 /* Okay, we're now positioned to make the NUL
2370 * transition. We couldn't have
2371 * yy_get_previous_state() go ahead and do it
2372 * for us because it doesn't know how to deal
2373 * with the possibility of jamming (and we don't
2374 * want to build jamming into it because then it
2375 * will run more slowly).
2376 */
2377
2378 yy_next_state = yy_try_NUL_trans( yy_current_state );
2379
2380 yy_bp = yytext_ptr + YY_MORE_ADJ;
2381
2382 if ( yy_next_state )
2383 {
2384 /* Consume the NUL. */
2385 yy_cp = ++yy_c_buf_p;
2386 yy_current_state = yy_next_state;
2387 goto yy_match;
2388 }
2389
2390 else
2391 {
2392 yy_cp = yy_c_buf_p;
2393 goto yy_find_action;
2394 }
2395 }
2396
2397 else switch ( yy_get_next_buffer() )
2398 {
2399 case EOB_ACT_END_OF_FILE:
2400 {
2401 yy_did_buffer_switch_on_eof = 0;
2402
2403 if ( yywrap() )
2404 {
2405 /* Note: because we've taken care in
2406 * yy_get_next_buffer() to have set up
2407 * yytext, we can now set up
2408 * yy_c_buf_p so that if some total
2409 * hoser (like flex itself) wants to
2410 * call the scanner after we return the
2411 * YY_NULL, it'll still work - another
2412 * YY_NULL will get returned.
2413 */
2414 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2415
2416 yy_act = YY_STATE_EOF(YY_START);
2417 goto do_action;
2418 }
2419
2420 else
2421 {
2422 if ( ! yy_did_buffer_switch_on_eof )
2423 YY_NEW_FILE;
2424 }
2425 break;
2426 }
2427
2428 case EOB_ACT_CONTINUE_SCAN:
2429 yy_c_buf_p =
2430 yytext_ptr + yy_amount_of_matched_text;
2431
2432 yy_current_state = yy_get_previous_state();
2433
2434 yy_cp = yy_c_buf_p;
2435 yy_bp = yytext_ptr + YY_MORE_ADJ;
2436 goto yy_match;
2437
2438 case EOB_ACT_LAST_MATCH:
2439 yy_c_buf_p =
2440 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2441
2442 yy_current_state = yy_get_previous_state();
2443
2444 yy_cp = yy_c_buf_p;
2445 yy_bp = yytext_ptr + YY_MORE_ADJ;
2446 goto yy_find_action;
2447 }
2448 break;
2449 }
2450
2451 default:
2452 YY_FATAL_ERROR(
2453 "fatal flex scanner internal error--no action found" );
2454 } /* end of action switch */
2455 } /* end of scanning one token */
2456 } /* end of yylex */
2457
2458
2459/* yy_get_next_buffer - try to read in a new buffer
2460 *
2461 * Returns a code representing an action:
2462 * EOB_ACT_LAST_MATCH -
2463 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2464 * EOB_ACT_END_OF_FILE - end of file
2465 */
2466
2467static int yy_get_next_buffer()
2468 {
2469 register char *dest = yy_current_buffer->yy_ch_buf;
2470 register char *source = yytext_ptr;
2471 register int number_to_move, i;
2472 int ret_val;
2473
2474 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2475 YY_FATAL_ERROR(
2476 "fatal flex scanner internal error--end of buffer missed" );
2477
2478 if ( yy_current_buffer->yy_fill_buffer == 0 )
2479 { /* Don't try to fill the buffer, so this is an EOF. */
2480 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2481 {
2482 /* We matched a singled characater, the EOB, so
2483 * treat this as a final EOF.
2484 */
2485 return EOB_ACT_END_OF_FILE;
2486 }
2487
2488 else
2489 {
2490 /* We matched some text prior to the EOB, first
2491 * process it.
2492 */
2493 return EOB_ACT_LAST_MATCH;
2494 }
2495 }
2496
2497 /* Try to read more data. */
2498
2499 /* First move last chars to start of buffer. */
2500 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2501
2502 for ( i = 0; i < number_to_move; ++i )
2503 *(dest++) = *(source++);
2504
2505 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2506 /* don't do the read, it's not guaranteed to return an EOF,
2507 * just force an EOF
2508 */
2509 yy_n_chars = 0;
2510
2511 else
2512 {
2513 int num_to_read =
2514 yy_current_buffer->yy_buf_size - number_to_move - 1;
2515
2516 while ( num_to_read <= 0 )
2517 { /* Not enough room in the buffer - grow it. */
2518#ifdef YY_USES_REJECT
2519 YY_FATAL_ERROR(
2520"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2521#else
2522
2523 /* just a shorter name for the current buffer */
2524 YY_BUFFER_STATE b = yy_current_buffer;
2525
2526 int yy_c_buf_p_offset =
2527 (int) (yy_c_buf_p - b->yy_ch_buf);
2528
2529 if ( b->yy_is_our_buffer )
2530 {
2531 int new_size = b->yy_buf_size * 2;
2532
2533 if ( new_size <= 0 )
2534 b->yy_buf_size += b->yy_buf_size / 8;
2535 else
2536 b->yy_buf_size *= 2;
2537
2538 b->yy_ch_buf = (char *)
2539 /* Include room in for 2 EOB chars. */
2540 yy_flex_realloc( (void *) b->yy_ch_buf,
2541 b->yy_buf_size + 2 );
2542 }
2543 else
2544 /* Can't grow it, we don't own it. */
2545 b->yy_ch_buf = 0;
2546
2547 if ( ! b->yy_ch_buf )
2548 YY_FATAL_ERROR(
2549 "fatal error - scanner input buffer overflow" );
2550
2551 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2552
2553 num_to_read = yy_current_buffer->yy_buf_size -
2554 number_to_move - 1;
2555#endif
2556 }
2557
2558 if ( num_to_read > YY_READ_BUF_SIZE )
2559 num_to_read = YY_READ_BUF_SIZE;
2560
2561 /* Read in more data. */
2562 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2563 yy_n_chars, num_to_read );
2564 }
2565
2566 if ( yy_n_chars == 0 )
2567 {
2568 if ( number_to_move == YY_MORE_ADJ )
2569 {
2570 ret_val = EOB_ACT_END_OF_FILE;
2571 yyrestart( yyin );
2572 }
2573
2574 else
2575 {
2576 ret_val = EOB_ACT_LAST_MATCH;
2577 yy_current_buffer->yy_buffer_status =
2578 YY_BUFFER_EOF_PENDING;
2579 }
2580 }
2581
2582 else
2583 ret_val = EOB_ACT_CONTINUE_SCAN;
2584
2585 yy_n_chars += number_to_move;
2586 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2587 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2588
2589 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2590
2591 return ret_val;
2592 }
2593
2594
2595/* yy_get_previous_state - get the state just before the EOB char was reached */
2596
2597static yy_state_type yy_get_previous_state()
2598 {
2599 register yy_state_type yy_current_state;
2600 register char *yy_cp;
2601
2602 yy_current_state = yy_start;
2603 yy_current_state += YY_AT_BOL();
2604
2605 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2606 {
2607 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2608 if ( yy_accept[yy_current_state] )
2609 {
2610 yy_last_accepting_state = yy_current_state;
2611 yy_last_accepting_cpos = yy_cp;
2612 }
2613 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2614 {
2615 yy_current_state = (int) yy_def[yy_current_state];
2616 if ( yy_current_state >= 346 )
2617 yy_c = yy_meta[(unsigned int) yy_c];
2618 }
2619 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2620 }
2621
2622 return yy_current_state;
2623 }
2624
2625
2626/* yy_try_NUL_trans - try to make a transition on the NUL character
2627 *
2628 * synopsis
2629 * next_state = yy_try_NUL_trans( current_state );
2630 */
2631
2632#ifdef YY_USE_PROTOS
2633static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2634#else
2635static yy_state_type yy_try_NUL_trans( yy_current_state )
2636yy_state_type yy_current_state;
2637#endif
2638 {
2639 register int yy_is_jam;
2640 register char *yy_cp = yy_c_buf_p;
2641
2642 register YY_CHAR yy_c = 1;
2643 if ( yy_accept[yy_current_state] )
2644 {
2645 yy_last_accepting_state = yy_current_state;
2646 yy_last_accepting_cpos = yy_cp;
2647 }
2648 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2649 {
2650 yy_current_state = (int) yy_def[yy_current_state];
2651 if ( yy_current_state >= 346 )
2652 yy_c = yy_meta[(unsigned int) yy_c];
2653 }
2654 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2655 yy_is_jam = (yy_current_state == 345);
2656
2657 return yy_is_jam ? 0 : yy_current_state;
2658 }
2659
2660
2661#ifndef YY_NO_UNPUT
2662#ifdef YY_USE_PROTOS
2663static void yyunput( int c, register char *yy_bp )
2664#else
2665static void yyunput( c, yy_bp )
2666int c;
2667register char *yy_bp;
2668#endif
2669 {
2670 register char *yy_cp = yy_c_buf_p;
2671
2672 /* undo effects of setting up yytext */
2673 *yy_cp = yy_hold_char;
2674
2675 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2676 { /* need to shift things up to make room */
2677 /* +2 for EOB chars. */
2678 register int number_to_move = yy_n_chars + 2;
2679 register char *dest = &yy_current_buffer->yy_ch_buf[
2680 yy_current_buffer->yy_buf_size + 2];
2681 register char *source =
2682 &yy_current_buffer->yy_ch_buf[number_to_move];
2683
2684 while ( source > yy_current_buffer->yy_ch_buf )
2685 *--dest = *--source;
2686
2687 yy_cp += (int) (dest - source);
2688 yy_bp += (int) (dest - source);
2689 yy_n_chars = yy_current_buffer->yy_buf_size;
2690
2691 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2692 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2693 }
2694
2695 *--yy_cp = (char) c;
2696
2697
2698 yytext_ptr = yy_bp;
2699 yy_hold_char = *yy_cp;
2700 yy_c_buf_p = yy_cp;
2701 }
2702#endif /* ifndef YY_NO_UNPUT */
2703
2704
2705#ifdef __cplusplus
2706static int yyinput()
2707#else
2708static int input()
2709#endif
2710 {
2711 int c;
2712
2713 *yy_c_buf_p = yy_hold_char;
2714
2715 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2716 {
2717 /* yy_c_buf_p now points to the character we want to return.
2718 * If this occurs *before* the EOB characters, then it's a
2719 * valid NUL; if not, then we've hit the end of the buffer.
2720 */
2721 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2722 /* This was really a NUL. */
2723 *yy_c_buf_p = '\0';
2724
2725 else
2726 { /* need more input */
2727 yytext_ptr = yy_c_buf_p;
2728 ++yy_c_buf_p;
2729
2730 switch ( yy_get_next_buffer() )
2731 {
2732 case EOB_ACT_END_OF_FILE:
2733 {
2734 if ( yywrap() )
2735 {
2736 yy_c_buf_p =
2737 yytext_ptr + YY_MORE_ADJ;
2738 return EOF;
2739 }
2740
2741 if ( ! yy_did_buffer_switch_on_eof )
2742 YY_NEW_FILE;
2743#ifdef __cplusplus
2744 return yyinput();
2745#else
2746 return input();
2747#endif
2748 }
2749
2750 case EOB_ACT_CONTINUE_SCAN:
2751 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2752 break;
2753
2754 case EOB_ACT_LAST_MATCH:
2755#ifdef __cplusplus
2756 YY_FATAL_ERROR(
2757 "unexpected last match in yyinput()" );
2758#else
2759 YY_FATAL_ERROR(
2760 "unexpected last match in input()" );
2761#endif
2762 }
2763 }
2764 }
2765
2766 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2767 *yy_c_buf_p = '\0'; /* preserve yytext */
2768 yy_hold_char = *++yy_c_buf_p;
2769
2770 yy_current_buffer->yy_at_bol = (c == '\n');
2771
2772 return c;
2773 }
2774
2775
2776#ifdef YY_USE_PROTOS
2777void yyrestart( FILE *input_file )
2778#else
2779void yyrestart( input_file )
2780FILE *input_file;
2781#endif
2782 {
2783 if ( ! yy_current_buffer )
2784 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2785
2786 yy_init_buffer( yy_current_buffer, input_file );
2787 yy_load_buffer_state();
2788 }
2789
2790
2791#ifdef YY_USE_PROTOS
2792void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2793#else
2794void yy_switch_to_buffer( new_buffer )
2795YY_BUFFER_STATE new_buffer;
2796#endif
2797 {
2798 if ( yy_current_buffer == new_buffer )
2799 return;
2800
2801 if ( yy_current_buffer )
2802 {
2803 /* Flush out information for old buffer. */
2804 *yy_c_buf_p = yy_hold_char;
2805 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2806 yy_current_buffer->yy_n_chars = yy_n_chars;
2807 }
2808
2809 yy_current_buffer = new_buffer;
2810 yy_load_buffer_state();
2811
2812 /* We don't actually know whether we did this switch during
2813 * EOF (yywrap()) processing, but the only time this flag
2814 * is looked at is after yywrap() is called, so it's safe
2815 * to go ahead and always set it.
2816 */
2817 yy_did_buffer_switch_on_eof = 1;
2818 }
2819
2820
2821#ifdef YY_USE_PROTOS
2822void yy_load_buffer_state( void )
2823#else
2824void yy_load_buffer_state()
2825#endif
2826 {
2827 yy_n_chars = yy_current_buffer->yy_n_chars;
2828 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2829 yyin = yy_current_buffer->yy_input_file;
2830 yy_hold_char = *yy_c_buf_p;
2831 }
2832
2833
2834#ifdef YY_USE_PROTOS
2835YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2836#else
2837YY_BUFFER_STATE yy_create_buffer( file, size )
2838FILE *file;
2839int size;
2840#endif
2841 {
2842 YY_BUFFER_STATE b;
2843
2844 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2845 if ( ! b )
2846 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2847
2848 b->yy_buf_size = size;
2849
2850 /* yy_ch_buf has to be 2 characters longer than the size given because
2851 * we need to put in 2 end-of-buffer characters.
2852 */
2853 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2854 if ( ! b->yy_ch_buf )
2855 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2856
2857 b->yy_is_our_buffer = 1;
2858
2859 yy_init_buffer( b, file );
2860
2861 return b;
2862 }
2863
2864
2865#ifdef YY_USE_PROTOS
2866void yy_delete_buffer( YY_BUFFER_STATE b )
2867#else
2868void yy_delete_buffer( b )
2869YY_BUFFER_STATE b;
2870#endif
2871 {
2872 if ( ! b )
2873 return;
2874
2875 if ( b == yy_current_buffer )
2876 yy_current_buffer = (YY_BUFFER_STATE) 0;
2877
2878 if ( b->yy_is_our_buffer )
2879 yy_flex_free( (void *) b->yy_ch_buf );
2880
2881 yy_flex_free( (void *) b );
2882 }
2883
2884
2885#ifndef YY_ALWAYS_INTERACTIVE
2886#ifndef YY_NEVER_INTERACTIVE
2887extern int isatty YY_PROTO(( int ));
2888#endif
2889#endif
2890
2891#ifdef YY_USE_PROTOS
2892void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2893#else
2894void yy_init_buffer( b, file )
2895YY_BUFFER_STATE b;
2896FILE *file;
2897#endif
2898
2899
2900 {
2901 yy_flush_buffer( b );
2902
2903 b->yy_input_file = file;
2904 b->yy_fill_buffer = 1;
2905
2906#if YY_ALWAYS_INTERACTIVE
2907 b->yy_is_interactive = 1;
2908#else
2909#if YY_NEVER_INTERACTIVE
2910 b->yy_is_interactive = 0;
2911#else
2912 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2913#endif
2914#endif
2915 }
2916
2917
2918#ifdef YY_USE_PROTOS
2919void yy_flush_buffer( YY_BUFFER_STATE b )
2920#else
2921void yy_flush_buffer( b )
2922YY_BUFFER_STATE b;
2923#endif
2924
2925 {
2926 b->yy_n_chars = 0;
2927
2928 /* We always need two end-of-buffer characters. The first causes
2929 * a transition to the end-of-buffer state. The second causes
2930 * a jam in that state.
2931 */
2932 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2933 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2934
2935 b->yy_buf_pos = &b->yy_ch_buf[0];
2936
2937 b->yy_at_bol = 1;
2938 b->yy_buffer_status = YY_BUFFER_NEW;
2939
2940 if ( b == yy_current_buffer )
2941 yy_load_buffer_state();
2942 }
2943
2944
2945#ifndef YY_NO_SCAN_BUFFER
2946#ifdef YY_USE_PROTOS
2947YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2948#else
2949YY_BUFFER_STATE yy_scan_buffer( base, size )
2950char *base;
2951yy_size_t size;
2952#endif
2953 {
2954 YY_BUFFER_STATE b;
2955
2956 if ( size < 2 ||
2957 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2958 base[size-1] != YY_END_OF_BUFFER_CHAR )
2959 /* They forgot to leave room for the EOB's. */
2960 return 0;
2961
2962 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2963 if ( ! b )
2964 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2965
2966 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2967 b->yy_buf_pos = b->yy_ch_buf = base;
2968 b->yy_is_our_buffer = 0;
2969 b->yy_input_file = 0;
2970 b->yy_n_chars = b->yy_buf_size;
2971 b->yy_is_interactive = 0;
2972 b->yy_at_bol = 1;
2973 b->yy_fill_buffer = 0;
2974 b->yy_buffer_status = YY_BUFFER_NEW;
2975
2976 yy_switch_to_buffer( b );
2977
2978 return b;
2979 }
2980#endif
2981
2982
2983#ifndef YY_NO_SCAN_STRING
2984#ifdef YY_USE_PROTOS
2985YY_BUFFER_STATE yy_scan_string( yyconst char *str )
2986#else
2987YY_BUFFER_STATE yy_scan_string( str )
2988yyconst char *str;
2989#endif
2990 {
2991 int len;
2992 for ( len = 0; str[len]; ++len )
2993 ;
2994
2995 return yy_scan_bytes( str, len );
2996 }
2997#endif
2998
2999
3000#ifndef YY_NO_SCAN_BYTES
3001#ifdef YY_USE_PROTOS
3002YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
3003#else
3004YY_BUFFER_STATE yy_scan_bytes( bytes, len )
3005yyconst char *bytes;
3006int len;
3007#endif
3008 {
3009 YY_BUFFER_STATE b;
3010 char *buf;
3011 yy_size_t n;
3012 int i;
3013
3014 /* Get memory for full buffer, including space for trailing EOB's. */
3015 n = len + 2;
3016 buf = (char *) yy_flex_alloc( n );
3017 if ( ! buf )
3018 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3019
3020 for ( i = 0; i < len; ++i )
3021 buf[i] = bytes[i];
3022
3023 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
3024
3025 b = yy_scan_buffer( buf, n );
3026 if ( ! b )
3027 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3028
3029 /* It's okay to grow etc. this buffer, and we should throw it
3030 * away when we're done.
3031 */
3032 b->yy_is_our_buffer = 1;
3033
3034 return b;
3035 }
3036#endif
3037
3038
3039#ifndef YY_NO_PUSH_STATE
3040#ifdef YY_USE_PROTOS
3041static void yy_push_state( int new_state )
3042#else
3043static void yy_push_state( new_state )
3044int new_state;
3045#endif
3046 {
3047 if ( yy_start_stack_ptr >= yy_start_stack_depth )
3048 {
3049 yy_size_t new_size;
3050
3051 yy_start_stack_depth += YY_START_STACK_INCR;
3052 new_size = yy_start_stack_depth * sizeof( int );
3053
3054 if ( ! yy_start_stack )
3055 yy_start_stack = (int *) yy_flex_alloc( new_size );
3056
3057 else
3058 yy_start_stack = (int *) yy_flex_realloc(
3059 (void *) yy_start_stack, new_size );
3060
3061 if ( ! yy_start_stack )
3062 YY_FATAL_ERROR(
3063 "out of memory expanding start-condition stack" );
3064 }
3065
3066 yy_start_stack[yy_start_stack_ptr++] = YY_START;
3067
3068 BEGIN(new_state);
3069 }
3070#endif
3071
3072
3073#ifndef YY_NO_POP_STATE
3074static void yy_pop_state()
3075 {
3076 if ( --yy_start_stack_ptr < 0 )
3077 YY_FATAL_ERROR( "start-condition stack underflow" );
3078
3079 BEGIN(yy_start_stack[yy_start_stack_ptr]);
3080 }
3081#endif
3082
3083
3084#ifndef YY_NO_TOP_STATE
3085static int yy_top_state()
3086 {
3087 return yy_start_stack[yy_start_stack_ptr - 1];
3088 }
3089#endif
3090
3091#ifndef YY_EXIT_FAILURE
3092#define YY_EXIT_FAILURE 2
3093#endif
3094
3095#ifdef YY_USE_PROTOS
3096static void yy_fatal_error( yyconst char msg[] )
3097#else
3098static void yy_fatal_error( msg )
3099char msg[];
3100#endif
3101 {
3102 (void) fprintf( stderr, "%s\n", msg );
3103 exit( YY_EXIT_FAILURE );
3104 }
3105
3106
3107
3108/* Redefine yyless() so it works in section 3 code. */
3109
3110#undef yyless
3111#define yyless(n) \
3112 do \
3113 { \
3114 /* Undo effects of setting up yytext. */ \
3115 yytext[yyleng] = yy_hold_char; \
3116 yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
3117 yy_hold_char = *yy_c_buf_p; \
3118 *yy_c_buf_p = '\0'; \
3119 yyleng = n; \
3120 } \
3121 while ( 0 )
3122
3123
3124/* Internal utility routines. */
3125
3126#ifndef yytext_ptr
3127#ifdef YY_USE_PROTOS
3128static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
3129#else
3130static void yy_flex_strncpy( s1, s2, n )
3131char *s1;
3132yyconst char *s2;
3133int n;
3134#endif
3135 {
3136 register int i;
3137 for ( i = 0; i < n; ++i )
3138 s1[i] = s2[i];
3139 }
3140#endif
3141
3142
3143#ifdef YY_USE_PROTOS
3144static void *yy_flex_alloc( yy_size_t size )
3145#else
3146static void *yy_flex_alloc( size )
3147yy_size_t size;
3148#endif
3149 {
3150 return (void *) malloc( size );
3151 }
3152
3153#ifdef YY_USE_PROTOS
3154static void *yy_flex_realloc( void *ptr, yy_size_t size )
3155#else
3156static void *yy_flex_realloc( ptr, size )
3157void *ptr;
3158yy_size_t size;
3159#endif
3160 {
3161 /* The cast to (char *) in the following accommodates both
3162 * implementations that use char* generic pointers, and those
3163 * that use void* generic pointers. It works with the latter
3164 * because both ANSI C and C++ allow castless assignment from
3165 * any pointer type to void*, and deal with argument conversions
3166 * as though doing an assignment.
3167 */
3168 return (void *) realloc( (char *) ptr, size );
3169 }
3170
3171#ifdef YY_USE_PROTOS
3172static void yy_flex_free( void *ptr )
3173#else
3174static void yy_flex_free( ptr )
3175void *ptr;
3176#endif
3177 {
3178 free( ptr );
3179 }
3180
3181#if YY_MAIN
3182int main()
3183 {
3184 yylex();
3185 return 0;
3186 }
3187#endif
3188#line 830 "parser.l"
3189
3190
3191#ifndef yywrap
3192int yywrap(void)
3193{
3194#if 0
3195 if(bufferstackidx > 0)
3196 {
3197 return 0;
3198 }
3199#endif
3200 return 1;
3201}
3202#endif
3203
3204/* These dup functions copy the enclosed '\0' from
3205 * the resource string.
3206 */
3207void addcchar(char c)
3208{
3209 if(cbufidx >= cbufalloc)
3210 {
3211 cbufalloc += 1024;
3212 cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
3213 if(cbufalloc > 65536)
3214 yywarning("Reallocating string buffer larger than 64kB");
3215 }
3216 cbuffer[cbufidx++] = c;
3217}
3218
3219void addwchar(short s)
3220{
3221 if(wbufidx >= wbufalloc)
3222 {
3223 wbufalloc += 1024;
3224 wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
3225 if(wbufalloc > 65536)
3226 yywarning("Reallocating wide string buffer larger than 64kB");
3227 }
3228
3229 /*
3230 * BS 08-Aug-1999 FIXME: The '& 0xff' is probably a bug, but I have
3231 * not experienced it yet and I seem to remember that this was for
3232 * a reason. But, as so many things you tend to forget why.
3233 * I guess that there were problems due to the sign extension of
3234 * shorts WRT chars (e.g. 0x80 becomes 0xff80 instead of 0x0080).
3235 * This should then be fixed in the lexer calling the function.
3236 */
3237 wbuffer[wbufidx++] = (short)(s & 0xff);
3238}
3239
3240string_t *get_buffered_cstring(void)
3241{
3242 string_t *str = new_string();
3243 str->size = cbufidx;
3244 str->type = str_char;
3245 str->str.cstr = (char *)xmalloc(cbufidx+1);
3246 memcpy(str->str.cstr, cbuffer, cbufidx);
3247 str->str.cstr[cbufidx] = '\0';
3248/* printf("got cstring \"%s\"\n", str->str.cstr); */
3249 return str;
3250}
3251
3252string_t *get_buffered_wstring(void)
3253{
3254 string_t *str = new_string();
3255 str->size = wbufidx;
3256 str->type = str_unicode;
3257 str->str.wstr = (short *)xmalloc(2*(wbufidx+1));
3258 memcpy(str->str.wstr, wbuffer, wbufidx);
3259 str->str.wstr[wbufidx] = 0;
3260 return str;
3261}
3262
3263string_t *make_string(char *s)
3264{
3265 string_t *str = new_string();
3266 str->size = strlen(s);
3267 str->type = str_char;
3268 str->str.cstr = (char *)xmalloc(str->size+1);
3269 memcpy(str->str.cstr, s, str->size+1);
3270 return str;
3271}
3272
3273string_t *make_filename(char *s, int len)
3274{
3275 char *cptr;
3276 string_t *str = new_string();
3277
3278 str->size = len;
3279 str->type = str_char;
3280 str->str.cstr = (char *)xmalloc(str->size+1);
3281 memcpy(str->str.cstr, s, str->size);
3282 str->str.cstr[str->size] = '\0';
3283
3284 /* Remove escaped backslash and convert to forward */
3285 cptr = str->str.cstr;
3286 for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
3287 {
3288 if(cptr[1] == '\\')
3289 {
3290 memmove(cptr, cptr+1, strlen(cptr));
3291 str->size--;
3292 }
3293 *cptr = '/';
3294 }
3295
3296 /* Convert to lower case. Seems to be reasonable to do */
3297 for(cptr = str->str.cstr; !leave_case && *cptr; cptr++)
3298 {
3299 *cptr = tolower(*cptr);
3300 }
3301 return str;
3302}
3303
3304/* Called from the parser to signal filename request */
3305void set_yywf(void)
3306{
3307 push_to(yywf);
3308}
3309
3310/* Called from the parser to signal preprocessor if case */
3311void set_pp_ignore(int state)
3312{
3313 if(state)
3314 push_to(pp_false);
3315 else
3316 pop_start();
3317}
3318
3319/* Called from the parser to kill c-junk */
3320void strip_til_semicolon(void)
3321{
3322 cjunk_tagline = line_number;
3323 push_to(pp_strips);
3324}
3325
3326void strip_til_parenthesis(void)
3327{
3328 cjunk_tagline = line_number;
3329 stripplevel = 1; /* One scanned already */
3330 push_to(pp_stripp);
3331}
3332
3333
Note: See TracBrowser for help on using the repository browser.