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.3 2001-04-16 17:10:49 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 |
|
---|
99 | typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
---|
100 |
|
---|
101 | extern int yyleng;
|
---|
102 | extern 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 | */
|
---|
140 | typedef unsigned int yy_size_t;
|
---|
141 |
|
---|
142 |
|
---|
143 | struct 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 |
|
---|
200 | static 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. */
|
---|
210 | static char yy_hold_char;
|
---|
211 |
|
---|
212 | static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
---|
213 |
|
---|
214 |
|
---|
215 | int yyleng;
|
---|
216 |
|
---|
217 | /* Points to current character in buffer. */
|
---|
218 | static char *yy_c_buf_p = (char *) 0;
|
---|
219 | static int yy_init = 1; /* whether we need to initialize */
|
---|
220 | static 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 | */
|
---|
225 | static int yy_did_buffer_switch_on_eof;
|
---|
226 |
|
---|
227 | void yyrestart YY_PROTO(( FILE *input_file ));
|
---|
228 |
|
---|
229 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
---|
230 | void yy_load_buffer_state YY_PROTO(( void ));
|
---|
231 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
---|
232 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
---|
233 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
---|
234 | void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
---|
235 | #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
|
---|
236 |
|
---|
237 | YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
|
---|
238 | YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
|
---|
239 | YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
|
---|
240 |
|
---|
241 | static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
|
---|
242 | static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
|
---|
243 | static 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 |
|
---|
263 |
|
---|
264 | #define FLEX_DEBUG
|
---|
265 | typedef unsigned char YY_CHAR;
|
---|
266 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
|
---|
267 | typedef int yy_state_type;
|
---|
268 |
|
---|
269 | #define FLEX_DEBUG
|
---|
270 | extern char *yytext;
|
---|
271 | #define yytext_ptr yytext
|
---|
272 |
|
---|
273 | static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
---|
274 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
---|
275 | static int yy_get_next_buffer YY_PROTO(( void ));
|
---|
276 | static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
---|
277 |
|
---|
278 | /* Done after the current pattern has been matched and before the
|
---|
279 | * corresponding action - sets up yytext.
|
---|
280 | */
|
---|
281 | #define YY_DO_BEFORE_ACTION \
|
---|
282 | yytext_ptr = yy_bp; \
|
---|
283 | yyleng = (int) (yy_cp - yy_bp); \
|
---|
284 | yy_hold_char = *yy_cp; \
|
---|
285 | *yy_cp = '\0'; \
|
---|
286 | yy_c_buf_p = yy_cp;
|
---|
287 |
|
---|
288 | #define YY_NUM_RULES 84
|
---|
289 | #define YY_END_OF_BUFFER 85
|
---|
290 | static yyconst short int yy_accept[162] =
|
---|
291 | { 0,
|
---|
292 | 0, 0, 0, 0, 0, 0, 0, 0, 74, 74,
|
---|
293 | 0, 0, 7, 7, 12, 12, 14, 14, 2, 2,
|
---|
294 | 85, 82, 81, 80, 46, 67, 24, 24, 20, 20,
|
---|
295 | 78, 23, 23, 18, 19, 81, 1, 62, 66, 48,
|
---|
296 | 83, 44, 45, 27, 83, 72, 70, 71, 68, 72,
|
---|
297 | 74, 76, 75, 83, 7, 8, 83, 5, 3, 4,
|
---|
298 | 7, 1, 12, 13, 9, 10, 83, 12, 17, 14,
|
---|
299 | 16, 15, 2, 81, 24, 73, 24, 20, 23, 20,
|
---|
300 | 23, 23, 78, 25, 81, 1, 1, 62, 47, 63,
|
---|
301 | 60, 60, 60, 49, 52, 53, 54, 55, 56, 57,
|
---|
302 |
|
---|
303 | 58, 59, 60, 44, 26, 41, 39, 39, 39, 28,
|
---|
304 | 31, 32, 33, 34, 35, 36, 37, 38, 39, 70,
|
---|
305 | 69, 74, 75, 75, 77, 7, 6, 7, 12, 11,
|
---|
306 | 12, 14, 2, 79, 24, 22, 21, 65, 61, 64,
|
---|
307 | 49, 52, 51, 43, 40, 42, 28, 31, 30, 22,
|
---|
308 | 21, 49, 50, 28, 30, 28, 30, 28, 29, 28,
|
---|
309 | 0
|
---|
310 | } ;
|
---|
311 |
|
---|
312 | static yyconst int yy_ec[256] =
|
---|
313 | { 0,
|
---|
314 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
---|
315 | 1, 2, 4, 1, 1, 1, 1, 1, 1, 1,
|
---|
316 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
317 | 1, 2, 1, 5, 6, 1, 1, 1, 7, 8,
|
---|
318 | 9, 10, 1, 1, 1, 11, 12, 13, 14, 14,
|
---|
319 | 14, 14, 14, 14, 14, 15, 15, 1, 16, 1,
|
---|
320 | 1, 1, 1, 1, 17, 17, 17, 17, 17, 17,
|
---|
321 | 18, 18, 18, 18, 18, 19, 18, 18, 20, 18,
|
---|
322 | 18, 18, 18, 18, 18, 18, 18, 21, 18, 18,
|
---|
323 | 1, 22, 1, 1, 18, 1, 23, 24, 17, 17,
|
---|
324 |
|
---|
325 | 17, 25, 18, 18, 18, 18, 18, 26, 18, 27,
|
---|
326 | 20, 18, 18, 28, 18, 29, 18, 30, 18, 31,
|
---|
327 | 18, 18, 32, 1, 33, 1, 1, 1, 1, 1,
|
---|
328 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
329 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
330 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
331 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
332 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
333 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
334 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
335 |
|
---|
336 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
337 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
338 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
339 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
340 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
341 | 1, 1, 1, 1, 1
|
---|
342 | } ;
|
---|
343 |
|
---|
344 | static yyconst int yy_meta[34] =
|
---|
345 | { 0,
|
---|
346 | 1, 1, 2, 1, 3, 4, 1, 5, 5, 6,
|
---|
347 | 7, 8, 9, 9, 9, 4, 9, 7, 7, 7,
|
---|
348 | 7, 10, 9, 9, 9, 7, 7, 7, 7, 7,
|
---|
349 | 7, 11, 11
|
---|
350 | } ;
|
---|
351 |
|
---|
352 | static yyconst short int yy_base[191] =
|
---|
353 | { 0,
|
---|
354 | 0, 32, 32, 36, 37, 40, 61, 85, 41, 43,
|
---|
355 | 0, 0, 108, 140, 171, 186, 45, 53, 183, 182,
|
---|
356 | 181, 622, 48, 622, 622, 622, 0, 60, 192, 46,
|
---|
357 | 0, 211, 170, 622, 622, 77, 69, 0, 622, 89,
|
---|
358 | 242, 0, 622, 99, 275, 622, 78, 622, 622, 0,
|
---|
359 | 0, 622, 85, 622, 0, 622, 161, 622, 622, 622,
|
---|
360 | 111, 103, 0, 622, 622, 622, 160, 117, 622, 114,
|
---|
361 | 622, 622, 0, 123, 0, 622, 308, 108, 0, 0,
|
---|
362 | 117, 329, 0, 622, 130, 131, 143, 0, 146, 622,
|
---|
363 | 622, 158, 144, 140, 144, 622, 622, 622, 622, 622,
|
---|
364 |
|
---|
365 | 622, 622, 0, 0, 158, 622, 622, 135, 132, 151,
|
---|
366 | 154, 622, 622, 622, 622, 622, 622, 622, 0, 174,
|
---|
367 | 622, 0, 172, 181, 622, 0, 622, 195, 0, 622,
|
---|
368 | 232, 225, 0, 0, 354, 306, 209, 622, 622, 622,
|
---|
369 | 226, 308, 0, 622, 622, 622, 313, 316, 0, 0,
|
---|
370 | 0, 320, 622, 323, 0, 334, 0, 352, 622, 358,
|
---|
371 | 622, 387, 398, 409, 420, 431, 442, 453, 464, 475,
|
---|
372 | 480, 490, 501, 512, 117, 523, 534, 545, 555, 566,
|
---|
373 | 577, 588, 599, 113, 103, 610, 97, 87, 81, 51
|
---|
374 | } ;
|
---|
375 |
|
---|
376 | static yyconst short int yy_def[191] =
|
---|
377 | { 0,
|
---|
378 | 161, 1, 162, 162, 163, 163, 164, 164, 165, 165,
|
---|
379 | 166, 166, 167, 167, 168, 168, 169, 169, 170, 170,
|
---|
380 | 161, 161, 161, 161, 161, 161, 171, 171, 161, 29,
|
---|
381 | 172, 29, 32, 161, 161, 161, 161, 173, 161, 161,
|
---|
382 | 161, 174, 161, 161, 161, 161, 161, 161, 161, 175,
|
---|
383 | 176, 161, 177, 161, 178, 161, 179, 161, 161, 161,
|
---|
384 | 178, 161, 180, 161, 161, 161, 181, 180, 161, 161,
|
---|
385 | 161, 161, 182, 161, 171, 161, 183, 29, 32, 32,
|
---|
386 | 32, 32, 172, 161, 161, 161, 161, 173, 161, 161,
|
---|
387 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
388 |
|
---|
389 | 161, 161, 184, 174, 161, 161, 161, 161, 161, 161,
|
---|
390 | 161, 161, 161, 161, 161, 161, 161, 161, 185, 161,
|
---|
391 | 161, 176, 177, 177, 161, 178, 161, 178, 180, 161,
|
---|
392 | 180, 161, 182, 186, 183, 32, 82, 161, 161, 161,
|
---|
393 | 161, 161, 187, 161, 161, 161, 161, 161, 188, 32,
|
---|
394 | 32, 161, 161, 161, 189, 161, 190, 161, 161, 161,
|
---|
395 | 0, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
396 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
397 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161
|
---|
398 | } ;
|
---|
399 |
|
---|
400 | static yyconst short int yy_nxt[656] =
|
---|
401 | { 0,
|
---|
402 | 22, 23, 24, 23, 25, 22, 26, 22, 22, 22,
|
---|
403 | 27, 28, 29, 30, 30, 31, 32, 32, 33, 32,
|
---|
404 | 32, 27, 32, 32, 32, 32, 32, 32, 32, 32,
|
---|
405 | 32, 34, 35, 36, 39, 36, 40, 37, 39, 43,
|
---|
406 | 40, 44, 43, 52, 44, 52, 70, 71, 70, 74,
|
---|
407 | 53, 74, 53, 41, 70, 71, 70, 41, 45, 159,
|
---|
408 | 72, 45, 47, 48, 47, 79, 79, 49, 72, 76,
|
---|
409 | 87, 77, 87, 50, 50, 50, 79, 50, 85, 120,
|
---|
410 | 85, 120, 86, 50, 50, 50, 47, 48, 47, 157,
|
---|
411 | 89, 49, 89, 90, 124, 155, 125, 50, 50, 50,
|
---|
412 |
|
---|
413 | 105, 50, 105, 106, 87, 153, 87, 50, 50, 50,
|
---|
414 | 56, 149, 128, 54, 128, 132, 86, 132, 131, 57,
|
---|
415 | 131, 143, 86, 58, 74, 121, 74, 79, 79, 136,
|
---|
416 | 136, 85, 87, 85, 87, 86, 146, 145, 79, 59,
|
---|
417 | 60, 61, 56, 61, 87, 62, 87, 89, 140, 89,
|
---|
418 | 138, 57, 141, 141, 142, 58, 142, 142, 142, 105,
|
---|
419 | 139, 105, 144, 147, 147, 148, 148, 148, 148, 76,
|
---|
420 | 76, 59, 60, 64, 84, 120, 54, 120, 65, 66,
|
---|
421 | 161, 161, 67, 161, 54, 54, 54, 68, 64, 68,
|
---|
422 | 124, 62, 125, 65, 66, 161, 128, 67, 128, 161,
|
---|
423 |
|
---|
424 | 86, 54, 75, 75, 78, 78, 78, 161, 79, 79,
|
---|
425 | 80, 81, 82, 75, 79, 79, 79, 80, 79, 79,
|
---|
426 | 79, 79, 82, 79, 79, 79, 132, 151, 132, 79,
|
---|
427 | 79, 79, 161, 131, 151, 131, 79, 86, 152, 152,
|
---|
428 | 142, 79, 91, 91, 91, 92, 93, 91, 91, 91,
|
---|
429 | 91, 91, 91, 91, 94, 94, 95, 91, 91, 91,
|
---|
430 | 91, 91, 91, 91, 96, 97, 98, 91, 99, 100,
|
---|
431 | 101, 102, 103, 91, 91, 107, 107, 107, 108, 109,
|
---|
432 | 107, 107, 107, 107, 107, 107, 107, 110, 110, 111,
|
---|
433 | 107, 107, 107, 107, 107, 107, 107, 112, 113, 114,
|
---|
434 |
|
---|
435 | 107, 115, 116, 117, 118, 119, 107, 107, 134, 134,
|
---|
436 | 161, 134, 134, 134, 134, 134, 134, 134, 136, 136,
|
---|
437 | 142, 142, 142, 134, 150, 154, 154, 148, 148, 148,
|
---|
438 | 148, 150, 142, 142, 142, 156, 156, 148, 161, 134,
|
---|
439 | 134, 137, 137, 137, 161, 137, 158, 158, 148, 161,
|
---|
440 | 161, 137, 137, 137, 134, 134, 161, 134, 134, 134,
|
---|
441 | 134, 134, 134, 134, 160, 160, 148, 161, 161, 134,
|
---|
442 | 148, 148, 148, 161, 161, 161, 161, 161, 161, 161,
|
---|
443 | 161, 161, 161, 161, 161, 134, 134, 38, 38, 38,
|
---|
444 | 38, 38, 38, 38, 38, 38, 38, 38, 42, 42,
|
---|
445 |
|
---|
446 | 42, 42, 42, 42, 42, 42, 42, 42, 42, 46,
|
---|
447 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
|
---|
448 | 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
---|
449 | 51, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
---|
450 | 54, 54, 55, 55, 55, 55, 55, 55, 55, 55,
|
---|
451 | 55, 55, 55, 63, 63, 63, 63, 63, 63, 63,
|
---|
452 | 63, 63, 63, 63, 69, 69, 69, 69, 69, 69,
|
---|
453 | 69, 69, 69, 69, 69, 73, 73, 73, 73, 73,
|
---|
454 | 73, 73, 73, 73, 73, 73, 75, 75, 75, 75,
|
---|
455 | 83, 161, 83, 83, 83, 83, 83, 83, 83, 83,
|
---|
456 |
|
---|
457 | 83, 88, 161, 161, 88, 88, 88, 88, 88, 88,
|
---|
458 | 161, 88, 104, 161, 161, 104, 104, 104, 104, 104,
|
---|
459 | 104, 161, 104, 122, 161, 122, 122, 122, 161, 122,
|
---|
460 | 122, 122, 122, 122, 123, 161, 123, 123, 123, 123,
|
---|
461 | 123, 123, 123, 123, 123, 126, 161, 126, 161, 126,
|
---|
462 | 126, 126, 161, 126, 126, 127, 161, 127, 127, 127,
|
---|
463 | 127, 127, 127, 127, 127, 127, 129, 161, 129, 161,
|
---|
464 | 161, 129, 129, 161, 129, 129, 129, 130, 161, 130,
|
---|
465 | 130, 130, 130, 130, 130, 130, 130, 130, 133, 161,
|
---|
466 | 133, 133, 133, 133, 133, 133, 133, 133, 133, 135,
|
---|
467 |
|
---|
468 | 161, 135, 135, 135, 135, 135, 135, 135, 135, 135,
|
---|
469 | 134, 161, 134, 134, 134, 134, 134, 134, 134, 134,
|
---|
470 | 134, 21, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
471 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
472 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
473 | 161, 161, 161, 161, 161
|
---|
474 | } ;
|
---|
475 |
|
---|
476 | static yyconst short int yy_chk[656] =
|
---|
477 | { 0,
|
---|
478 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
479 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
480 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
481 | 1, 1, 1, 2, 3, 2, 3, 2, 4, 5,
|
---|
482 | 4, 5, 6, 9, 6, 10, 17, 17, 17, 23,
|
---|
483 | 9, 23, 10, 3, 18, 18, 18, 4, 5, 190,
|
---|
484 | 17, 6, 7, 7, 7, 30, 30, 7, 18, 28,
|
---|
485 | 37, 28, 37, 7, 7, 7, 30, 7, 36, 47,
|
---|
486 | 36, 47, 36, 7, 7, 7, 8, 8, 8, 189,
|
---|
487 | 40, 8, 40, 40, 53, 188, 53, 8, 8, 8,
|
---|
488 |
|
---|
489 | 44, 8, 44, 44, 62, 187, 62, 8, 8, 8,
|
---|
490 | 13, 185, 61, 13, 61, 70, 61, 70, 68, 13,
|
---|
491 | 68, 184, 68, 13, 74, 175, 74, 78, 78, 81,
|
---|
492 | 81, 85, 86, 85, 86, 85, 109, 108, 78, 13,
|
---|
493 | 13, 14, 14, 14, 87, 14, 87, 89, 93, 89,
|
---|
494 | 89, 14, 94, 94, 94, 14, 95, 95, 95, 105,
|
---|
495 | 92, 105, 105, 110, 110, 110, 111, 111, 111, 67,
|
---|
496 | 57, 14, 14, 15, 33, 120, 15, 120, 15, 15,
|
---|
497 | 21, 123, 15, 123, 20, 19, 15, 16, 16, 16,
|
---|
498 | 124, 16, 124, 16, 16, 0, 128, 16, 128, 0,
|
---|
499 |
|
---|
500 | 128, 16, 29, 29, 29, 29, 29, 0, 29, 29,
|
---|
501 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
---|
502 | 29, 29, 29, 32, 32, 32, 132, 137, 132, 32,
|
---|
503 | 32, 32, 0, 131, 137, 131, 32, 131, 141, 141,
|
---|
504 | 141, 32, 41, 41, 41, 41, 41, 41, 41, 41,
|
---|
505 | 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
---|
506 | 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
---|
507 | 41, 41, 41, 41, 41, 45, 45, 45, 45, 45,
|
---|
508 | 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
|
---|
509 | 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
|
---|
510 |
|
---|
511 | 45, 45, 45, 45, 45, 45, 45, 45, 77, 77,
|
---|
512 | 0, 77, 77, 77, 77, 77, 77, 77, 136, 136,
|
---|
513 | 142, 142, 142, 77, 136, 147, 147, 147, 148, 148,
|
---|
514 | 148, 136, 152, 152, 152, 154, 154, 154, 0, 77,
|
---|
515 | 77, 82, 82, 82, 0, 82, 156, 156, 156, 0,
|
---|
516 | 0, 82, 82, 82, 135, 135, 0, 135, 135, 135,
|
---|
517 | 135, 135, 135, 135, 158, 158, 158, 0, 0, 135,
|
---|
518 | 160, 160, 160, 0, 0, 0, 0, 0, 0, 0,
|
---|
519 | 0, 0, 0, 0, 0, 135, 135, 162, 162, 162,
|
---|
520 | 162, 162, 162, 162, 162, 162, 162, 162, 163, 163,
|
---|
521 |
|
---|
522 | 163, 163, 163, 163, 163, 163, 163, 163, 163, 164,
|
---|
523 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
|
---|
524 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
|
---|
525 | 165, 166, 166, 166, 166, 166, 166, 166, 166, 166,
|
---|
526 | 166, 166, 167, 167, 167, 167, 167, 167, 167, 167,
|
---|
527 | 167, 167, 167, 168, 168, 168, 168, 168, 168, 168,
|
---|
528 | 168, 168, 168, 168, 169, 169, 169, 169, 169, 169,
|
---|
529 | 169, 169, 169, 169, 169, 170, 170, 170, 170, 170,
|
---|
530 | 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
|
---|
531 | 172, 0, 172, 172, 172, 172, 172, 172, 172, 172,
|
---|
532 |
|
---|
533 | 172, 173, 0, 0, 173, 173, 173, 173, 173, 173,
|
---|
534 | 0, 173, 174, 0, 0, 174, 174, 174, 174, 174,
|
---|
535 | 174, 0, 174, 176, 0, 176, 176, 176, 0, 176,
|
---|
536 | 176, 176, 176, 176, 177, 0, 177, 177, 177, 177,
|
---|
537 | 177, 177, 177, 177, 177, 178, 0, 178, 0, 178,
|
---|
538 | 178, 178, 0, 178, 178, 179, 0, 179, 179, 179,
|
---|
539 | 179, 179, 179, 179, 179, 179, 180, 0, 180, 0,
|
---|
540 | 0, 180, 180, 0, 180, 180, 180, 181, 0, 181,
|
---|
541 | 181, 181, 181, 181, 181, 181, 181, 181, 182, 0,
|
---|
542 | 182, 182, 182, 182, 182, 182, 182, 182, 182, 183,
|
---|
543 |
|
---|
544 | 0, 183, 183, 183, 183, 183, 183, 183, 183, 183,
|
---|
545 | 186, 0, 186, 186, 186, 186, 186, 186, 186, 186,
|
---|
546 | 186, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
547 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
548 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
|
---|
549 | 161, 161, 161, 161, 161
|
---|
550 | } ;
|
---|
551 |
|
---|
552 | static yy_state_type yy_last_accepting_state;
|
---|
553 | static char *yy_last_accepting_cpos;
|
---|
554 |
|
---|
555 | extern int yy_flex_debug;
|
---|
556 | int yy_flex_debug = 1;
|
---|
557 |
|
---|
558 | static yyconst short int yy_rule_linenum[84] =
|
---|
559 | { 0,
|
---|
560 | 313, 314, 339, 340, 341, 342, 343, 344, 346, 347,
|
---|
561 | 355, 356, 357, 359, 360, 361, 362, 364, 365, 367,
|
---|
562 | 368, 369, 378, 399, 404, 410, 411, 416, 423, 428,
|
---|
563 | 430, 431, 432, 433, 434, 435, 436, 437, 438, 439,
|
---|
564 | 440, 441, 442, 443, 448, 453, 454, 455, 460, 467,
|
---|
565 | 472, 474, 475, 476, 477, 478, 479, 480, 481, 482,
|
---|
566 | 483, 484, 489, 490, 491, 492, 497, 498, 506, 511,
|
---|
567 | 512, 513, 519, 525, 526, 527, 528, 530, 531, 533,
|
---|
568 | 543, 545, 554
|
---|
569 | } ;
|
---|
570 |
|
---|
571 | /* The intent behind this definition is that it'll catch
|
---|
572 | * any uses of REJECT which flex missed.
|
---|
573 | */
|
---|
574 | #define REJECT reject_used_but_not_detected
|
---|
575 | #define yymore() yymore_used_but_not_detected
|
---|
576 | #define YY_MORE_ADJ 0
|
---|
577 | char *yytext;
|
---|
578 | #line 1 "parser.l"
|
---|
579 | #define INITIAL 0
|
---|
580 | /* -*-C-*-
|
---|
581 | *
|
---|
582 | * Copyright 1998-2000 Bertho A. Stultiens (BS)
|
---|
583 | *
|
---|
584 | * 21-May-2000 BS - Fixed the ident requirement of resource names
|
---|
585 | * which can be keywords.
|
---|
586 | * 30-Apr-2000 BS - Reintegration into the wine-tree
|
---|
587 | * 11-Jan-2000 BS - Very drastic cleanup because we don't have a
|
---|
588 | * preprocessor in here anymore.
|
---|
589 | * 02-Jan-2000 BS - Removed the preprocessor code
|
---|
590 | * 23-Dec-1999 BS - Removed the copyright for Martin von Loewis.
|
---|
591 | * There is really nothing left of his code in
|
---|
592 | * this parser.
|
---|
593 | * 20-Jun-1998 BS - Changed the filename conversion. Filenames are
|
---|
594 | * case-sensitive inder *nix, but not under dos.
|
---|
595 | * default behaviour is to convert to lower case.
|
---|
596 | * - All backslashes are converted to forward and
|
---|
597 | * both single and double slash is recognized as
|
---|
598 | * MS/Borland does.
|
---|
599 | * - Fixed a bug in 'yywf' case that prevented
|
---|
600 | * double quoted names to be scanned propperly.
|
---|
601 | *
|
---|
602 | * 19-May-1998 BS - Started to build a preprocessor.
|
---|
603 | * - Changed keyword processing completely to
|
---|
604 | * table-lookups.
|
---|
605 | *
|
---|
606 | * 20-Apr-1998 BS - Added ';' comment stripping
|
---|
607 | *
|
---|
608 | * 17-Apr-1998 BS - Made the win32 keywords optional when compiling in
|
---|
609 | * 16bit mode
|
---|
610 | *
|
---|
611 | * 15-Apr-1998 BS - Changed string handling to include escapes
|
---|
612 | * - Added unicode string handling (no codepage
|
---|
613 | * translation though).
|
---|
614 | * - 'Borrowed' the main idea of string scanning from
|
---|
615 | * the flex manual pages.
|
---|
616 | * - Added conditional handling of scanning depending
|
---|
617 | * on the state of the parser. This was mainly required
|
---|
618 | * to distinguish a file to load or raw data that
|
---|
619 | * follows. MS's definition of filenames is rather
|
---|
620 | * complex... It can be unquoted or double quoted. If
|
---|
621 | * double quoted, then the '\\' char is not automatically
|
---|
622 | * escaped according to Borland's rc compiler, but it
|
---|
623 | * accepts both "\\path\\file.rc" and "\path\file.rc".
|
---|
624 | * This makes life very hard! I go for the escaped
|
---|
625 | * version, as this seems to be the documented way...
|
---|
626 | * - Single quoted strings are now parsed and converted
|
---|
627 | * here.
|
---|
628 | * - Added comment stripping. The implementation is
|
---|
629 | * 'borrowed' from the flex manpages.
|
---|
630 | * - Rebuild string processing so that it may contain
|
---|
631 | * escaped '\0'.
|
---|
632 | */
|
---|
633 | /* Exclusive string handling */
|
---|
634 | #define yystr 1
|
---|
635 |
|
---|
636 | /* Exclusive unicode string handling */
|
---|
637 | #define yylstr 2
|
---|
638 |
|
---|
639 | /* Exclusive rcdata single quoted data handling */
|
---|
640 | #define yyrcd 3
|
---|
641 |
|
---|
642 | /* Exclusive comment eating... */
|
---|
643 | #define comment 4
|
---|
644 |
|
---|
645 | /* Set when stripping c-junk */
|
---|
646 | #define pp_stripe 5
|
---|
647 |
|
---|
648 | #define pp_strips 6
|
---|
649 |
|
---|
650 | #define pp_stripp 7
|
---|
651 |
|
---|
652 | #define pp_stripp_final 8
|
---|
653 |
|
---|
654 | /* Set when scanning #line style directives */
|
---|
655 | #define pp_line 9
|
---|
656 |
|
---|
657 | #define YY_STACK_USED 1
|
---|
658 | #define YY_NEVER_INTERACTIVE 1
|
---|
659 | /* Some shortcut definitions */
|
---|
660 | #line 79 "parser.l"
|
---|
661 |
|
---|
662 | /*#define LEX_DEBUG*/
|
---|
663 |
|
---|
664 | #include "config.h"
|
---|
665 |
|
---|
666 | #include <stdio.h>
|
---|
667 | #include <stdlib.h>
|
---|
668 | #include <string.h>
|
---|
669 | #include <ctype.h>
|
---|
670 | #include <assert.h>
|
---|
671 |
|
---|
672 | #include "wrc.h"
|
---|
673 | #include "utils.h"
|
---|
674 | #include "preproc.h"
|
---|
675 | #include "parser.h"
|
---|
676 | #include "newstruc.h"
|
---|
677 |
|
---|
678 | #include "y.tab.h"
|
---|
679 |
|
---|
680 | #define YY_USE_PROTOS
|
---|
681 | #define YY_NO_UNPUT
|
---|
682 | #define YY_NO_TOP_STATE
|
---|
683 |
|
---|
684 | /* Always update the current character position within a line */
|
---|
685 | #define YY_USER_ACTION char_number+=yyleng; wanted_id = want_id; want_id = 0;
|
---|
686 |
|
---|
687 | static void addcchar(char c);
|
---|
688 | static void addwchar(short s);
|
---|
689 | static string_t *get_buffered_cstring(void);
|
---|
690 | static string_t *get_buffered_wstring(void);
|
---|
691 | static string_t *make_string(char *s);
|
---|
692 |
|
---|
693 | static char *cbuffer; /* Buffers for string collection */
|
---|
694 | static int cbufidx;
|
---|
695 | static int cbufalloc = 0;
|
---|
696 | static short *wbuffer;
|
---|
697 | static int wbufidx;
|
---|
698 | static int wbufalloc = 0;
|
---|
699 | static int stripslevel = 0; /* Count {} during pp_strips/pp_stripe mode */
|
---|
700 | static int stripplevel = 0; /* Count () during pp_strips mode */
|
---|
701 | static int cjunk_tagline; /* Where did we start stripping (helps error tracking) */
|
---|
702 |
|
---|
703 | /*
|
---|
704 | * This one is a bit tricky.
|
---|
705 | * We set 'want_id' in the parser to get the first
|
---|
706 | * identifier we get across in the scanner, but we
|
---|
707 | * also want it to be reset at nearly any token we
|
---|
708 | * see. Exceptions are:
|
---|
709 | * - newlines
|
---|
710 | * - comments
|
---|
711 | * - whitespace
|
---|
712 | *
|
---|
713 | * The scanner will automatically reset 'want_id'
|
---|
714 | * after *each* scanner reduction and puts is value
|
---|
715 | * into the var below. In this way we can see the
|
---|
716 | * state after the YY_RULE_SETUP (i.e. the user action;
|
---|
717 | * see above) and don't have to worry too much when
|
---|
718 | * it needs to be reset.
|
---|
719 | */
|
---|
720 | static int wanted_id = 0;
|
---|
721 | static int save_wanted_id; /* To save across comment reductions */
|
---|
722 |
|
---|
723 | struct keyword {
|
---|
724 | char *keyword;
|
---|
725 | int token;
|
---|
726 | int isextension;
|
---|
727 | int needcase;
|
---|
728 | int alwayskw;
|
---|
729 | };
|
---|
730 |
|
---|
731 | static struct keyword keywords[] = {
|
---|
732 | { "ACCELERATORS", tACCELERATORS, 0, 0, 0},
|
---|
733 | { "ALT", tALT, 0, 0, 0},
|
---|
734 | { "ASCII", tASCII, 0, 0, 0},
|
---|
735 | { "AUTO3STATE", tAUTO3STATE, 1, 0, 0},
|
---|
736 | { "AUTOCHECKBOX", tAUTOCHECKBOX, 1, 0, 0},
|
---|
737 | { "AUTORADIOBUTTON", tAUTORADIOBUTTON, 1, 0, 0},
|
---|
738 | { "BEGIN", tBEGIN, 0, 0, 0},
|
---|
739 | { "BITMAP", tBITMAP, 0, 0, 0},
|
---|
740 | { "BLOCK", tBLOCK, 0, 0, 0},
|
---|
741 | { "BUTTON", tBUTTON, 1, 0, 0},
|
---|
742 | { "CAPTION", tCAPTION, 0, 0, 0},
|
---|
743 | { "CHARACTERISTICS", tCHARACTERISTICS, 1, 0, 0},
|
---|
744 | { "CHECKBOX", tCHECKBOX, 0, 0, 0},
|
---|
745 | { "CHECKED", tCHECKED, 0, 0, 0},
|
---|
746 | { "CLASS", tCLASS, 0, 0, 0},
|
---|
747 | { "COMBOBOX", tCOMBOBOX, 0, 0, 0},
|
---|
748 | { "CONTROL", tCONTROL, 0, 0, 0},
|
---|
749 | { "CTEXT", tCTEXT, 0, 0, 0},
|
---|
750 | { "CURSOR", tCURSOR, 0, 0, 0},
|
---|
751 | { "DEFPUSHBUTTON", tDEFPUSHBUTTON, 0, 0, 0},
|
---|
752 | { "DIALOG", tDIALOG, 0, 0, 0},
|
---|
753 | { "DIALOGEX", tDIALOGEX, 1, 0, 0},
|
---|
754 | { "DISCARDABLE", tDISCARDABLE, 0, 0, 0},
|
---|
755 | { "DLGINIT", tDLGINIT, 0, 0, 0},
|
---|
756 | { "EDITTEXT", tEDITTEXT, 0, 0, 0},
|
---|
757 | { "END", tEND, 0, 0, 0},
|
---|
758 | { "enum", tENUM, 0, 1, 1},
|
---|
759 | { "EXSTYLE", tEXSTYLE, 0, 0, 0},
|
---|
760 | { "extern", tEXTERN, 0, 1, 1},
|
---|
761 | { "FILEFLAGS", tFILEFLAGS, 0, 0, 0},
|
---|
762 | { "FILEFLAGSMASK", tFILEFLAGSMASK, 0, 0, 0},
|
---|
763 | { "FILEOS", tFILEOS, 0, 0, 0},
|
---|
764 | { "FILESUBTYPE", tFILESUBTYPE, 0, 0, 0},
|
---|
765 | { "FILETYPE", tFILETYPE, 0, 0, 0},
|
---|
766 | { "FILEVERSION", tFILEVERSION, 0, 0, 0},
|
---|
767 | { "FIXED", tFIXED, 0, 0, 0},
|
---|
768 | { "FONT", tFONT, 0, 0, 0},
|
---|
769 | { "FONTDIR", tFONTDIR, 0, 0, 0}, /* This is a Borland BRC extension */
|
---|
770 | { "GRAYED", tGRAYED, 0, 0, 0},
|
---|
771 | { "GROUPBOX", tGROUPBOX, 0, 0, 0},
|
---|
772 | { "HELP", tHELP, 0, 0, 0},
|
---|
773 | { "ICON", tICON, 0, 0, 0},
|
---|
774 | { "IMPURE", tIMPURE, 0, 0, 0},
|
---|
775 | { "INACTIVE", tINACTIVE, 0, 0, 0},
|
---|
776 | { "inline", tINLINE, 0, 1, 1},
|
---|
777 | { "LANGUAGE", tLANGUAGE, 1, 0, 1},
|
---|
778 | { "LISTBOX", tLISTBOX, 0, 0, 0},
|
---|
779 | { "LOADONCALL", tLOADONCALL, 0, 0, 0},
|
---|
780 | { "LTEXT", tLTEXT, 0, 0, 0},
|
---|
781 | { "MENU", tMENU, 0, 0, 0},
|
---|
782 | { "MENUBARBREAK", tMENUBARBREAK, 0, 0, 0},
|
---|
783 | { "MENUBREAK", tMENUBREAK, 0, 0, 0},
|
---|
784 | { "MENUEX", tMENUEX, 1, 0, 0},
|
---|
785 | { "MENUITEM", tMENUITEM, 0, 0, 0},
|
---|
786 | { "MESSAGETABLE", tMESSAGETABLE, 1, 0, 0},
|
---|
787 | { "MOVEABLE", tMOVEABLE, 0, 0, 0},
|
---|
788 | { "NOINVERT", tNOINVERT, 0, 0, 0},
|
---|
789 | { "NOT", tNOT, 0, 0, 0},
|
---|
790 | { "POPUP", tPOPUP, 0, 0, 0},
|
---|
791 | { "PRELOAD", tPRELOAD, 0, 0, 0},
|
---|
792 | { "PRODUCTVERSION", tPRODUCTVERSION, 0, 0, 0},
|
---|
793 | { "PURE", tPURE, 0, 0, 0},
|
---|
794 | { "PUSHBUTTON", tPUSHBUTTON, 0, 0, 0},
|
---|
795 | { "RADIOBUTTON", tRADIOBUTTON, 0, 0, 0},
|
---|
796 | { "RCDATA", tRCDATA, 0, 0, 0},
|
---|
797 | { "RTEXT", tRTEXT, 0, 0, 0},
|
---|
798 | { "SCROLLBAR", tSCROLLBAR, 0, 0, 0},
|
---|
799 | { "SEPARATOR", tSEPARATOR, 0, 0, 0},
|
---|
800 | { "SHIFT", tSHIFT, 0, 0, 0},
|
---|
801 | { "STATE3", tSTATE3, 1, 0, 0},
|
---|
802 | { "static", tSTATIC, 0, 1, 1},
|
---|
803 | { "STRING", tSTRING, 0, 0, 0},
|
---|
804 | { "STRINGTABLE", tSTRINGTABLE, 0, 0, 1},
|
---|
805 | { "struct", tSTRUCT, 0, 1, 1},
|
---|
806 | { "STYLE", tSTYLE, 0, 0, 0},
|
---|
807 | { "TOOLBAR", tTOOLBAR, 1, 0, 0},
|
---|
808 | { "typedef", tTYPEDEF, 0, 1, 1},
|
---|
809 | { "VALUE", tVALUE, 0, 0, 0},
|
---|
810 | { "VERSION", tVERSION, 1, 0, 0},
|
---|
811 | { "VERSIONINFO", tVERSIONINFO, 0, 0, 0},
|
---|
812 | { "VIRTKEY", tVIRTKEY, 0, 0, 0}
|
---|
813 | };
|
---|
814 |
|
---|
815 | #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
|
---|
816 | #define KWP(p) ((struct keyword *)(p))
|
---|
817 | static int kw_cmp_func(const void *s1, const void *s2)
|
---|
818 | {
|
---|
819 | int ret;
|
---|
820 | ret = strcasecmp(KWP(s1)->keyword, KWP(s2)->keyword);
|
---|
821 | if(!ret && (KWP(s1)->needcase || KWP(s2)->needcase))
|
---|
822 | return strcmp(KWP(s1)->keyword, KWP(s2)->keyword);
|
---|
823 | else
|
---|
824 | return ret;
|
---|
825 | }
|
---|
826 |
|
---|
827 | #define KW_BSEARCH
|
---|
828 | #define DO_SORT
|
---|
829 | static struct keyword *iskeyword(char *kw)
|
---|
830 | {
|
---|
831 | struct keyword *kwp;
|
---|
832 | struct keyword key;
|
---|
833 | key.keyword = kw;
|
---|
834 | key.needcase = 0;
|
---|
835 | #ifdef DO_SORT
|
---|
836 | {
|
---|
837 | /* Make sure that it is sorted for bsearsh */
|
---|
838 | static int sorted = 0;
|
---|
839 | if(!sorted)
|
---|
840 | {
|
---|
841 | qsort(keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
|
---|
842 | sorted = 1;
|
---|
843 | }
|
---|
844 | }
|
---|
845 | #endif
|
---|
846 | #ifdef KW_BSEARCH
|
---|
847 | kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
|
---|
848 | #else
|
---|
849 | {
|
---|
850 | int i;
|
---|
851 | for(i = 0; i < NKEYWORDS; i++)
|
---|
852 | {
|
---|
853 | if(!kw_cmp_func(&key, &keywords[i]))
|
---|
854 | break;
|
---|
855 | }
|
---|
856 | if(i < NKEYWORDS)
|
---|
857 | kwp = &keywords[i];
|
---|
858 | else
|
---|
859 | kwp = NULL;
|
---|
860 | }
|
---|
861 | #endif
|
---|
862 |
|
---|
863 | if(kwp == NULL || (kwp->isextension && !extensions))
|
---|
864 | return NULL;
|
---|
865 | else
|
---|
866 | return kwp;
|
---|
867 | }
|
---|
868 |
|
---|
869 | /*
|
---|
870 | **************************************************************************
|
---|
871 | * The flexer starts here
|
---|
872 | **************************************************************************
|
---|
873 | */
|
---|
874 | #line 875 "lexyy.c"
|
---|
875 |
|
---|
876 | /* Macros after this point can all be overridden by user definitions in
|
---|
877 | * section 1.
|
---|
878 | */
|
---|
879 |
|
---|
880 | #ifndef YY_SKIP_YYWRAP
|
---|
881 | #ifdef __cplusplus
|
---|
882 | extern "C" int yywrap YY_PROTO(( void ));
|
---|
883 | #else
|
---|
884 | extern int yywrap YY_PROTO(( void ));
|
---|
885 | #endif
|
---|
886 | #endif
|
---|
887 |
|
---|
888 | #ifndef YY_NO_UNPUT
|
---|
889 | static void yyunput YY_PROTO(( int c, char *buf_ptr ));
|
---|
890 | #endif
|
---|
891 |
|
---|
892 | #ifndef yytext_ptr
|
---|
893 | static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
|
---|
894 | #endif
|
---|
895 |
|
---|
896 | #ifndef YY_NO_INPUT
|
---|
897 | #ifdef __cplusplus
|
---|
898 | static int yyinput YY_PROTO(( void ));
|
---|
899 | #else
|
---|
900 | static int input YY_PROTO(( void ));
|
---|
901 | #endif
|
---|
902 | #endif
|
---|
903 |
|
---|
904 | #if YY_STACK_USED
|
---|
905 | static int yy_start_stack_ptr = 0;
|
---|
906 | static int yy_start_stack_depth = 0;
|
---|
907 | static int *yy_start_stack = 0;
|
---|
908 | #ifndef YY_NO_PUSH_STATE
|
---|
909 | static void yy_push_state YY_PROTO(( int new_state ));
|
---|
910 | #endif
|
---|
911 | #ifndef YY_NO_POP_STATE
|
---|
912 | static void yy_pop_state YY_PROTO(( void ));
|
---|
913 | #endif
|
---|
914 | #ifndef YY_NO_TOP_STATE
|
---|
915 | static int yy_top_state YY_PROTO(( void ));
|
---|
916 | #endif
|
---|
917 |
|
---|
918 | #else
|
---|
919 | #define YY_NO_PUSH_STATE 1
|
---|
920 | #define YY_NO_POP_STATE 1
|
---|
921 | #define YY_NO_TOP_STATE 1
|
---|
922 | #endif
|
---|
923 |
|
---|
924 | #ifdef YY_MALLOC_DECL
|
---|
925 | YY_MALLOC_DECL
|
---|
926 | #else
|
---|
927 | #if __STDC__
|
---|
928 | #ifndef __cplusplus
|
---|
929 | #include <stdlib.h>
|
---|
930 | #endif
|
---|
931 | #else
|
---|
932 | /* Just try to get by without declaring the routines. This will fail
|
---|
933 | * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
|
---|
934 | * or sizeof(void*) != sizeof(int).
|
---|
935 | */
|
---|
936 | #endif
|
---|
937 | #endif
|
---|
938 |
|
---|
939 | /* Amount of stuff to slurp up with each read. */
|
---|
940 | #ifndef YY_READ_BUF_SIZE
|
---|
941 | #define YY_READ_BUF_SIZE 8192
|
---|
942 | #endif
|
---|
943 |
|
---|
944 | /* Copy whatever the last rule matched to the standard output. */
|
---|
945 |
|
---|
946 | #ifndef ECHO
|
---|
947 | /* This used to be an fputs(), but since the string might contain NUL's,
|
---|
948 | * we now use fwrite().
|
---|
949 | */
|
---|
950 | #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
|
---|
951 | #endif
|
---|
952 |
|
---|
953 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
---|
954 | * is returned in "result".
|
---|
955 | */
|
---|
956 | #ifndef YY_INPUT
|
---|
957 | #define YY_INPUT(buf,result,max_size) \
|
---|
958 | if ( yy_current_buffer->yy_is_interactive ) \
|
---|
959 | { \
|
---|
960 | int c = '*', n; \
|
---|
961 | for ( n = 0; n < max_size && \
|
---|
962 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
---|
963 | buf[n] = (char) c; \
|
---|
964 | if ( c == '\n' ) \
|
---|
965 | buf[n++] = (char) c; \
|
---|
966 | if ( c == EOF && ferror( yyin ) ) \
|
---|
967 | YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
---|
968 | result = n; \
|
---|
969 | } \
|
---|
970 | else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
|
---|
971 | && ferror( yyin ) ) \
|
---|
972 | YY_FATAL_ERROR( "input in flex scanner failed" );
|
---|
973 | #endif
|
---|
974 |
|
---|
975 | /* No semi-colon after return; correct usage is to write "yyterminate();" -
|
---|
976 | * we don't want an extra ';' after the "return" because that will cause
|
---|
977 | * some compilers to complain about unreachable statements.
|
---|
978 | */
|
---|
979 | #ifndef yyterminate
|
---|
980 | #define yyterminate() return YY_NULL
|
---|
981 | #endif
|
---|
982 |
|
---|
983 | /* Number of entries by which start-condition stack grows. */
|
---|
984 | #ifndef YY_START_STACK_INCR
|
---|
985 | #define YY_START_STACK_INCR 25
|
---|
986 | #endif
|
---|
987 |
|
---|
988 | /* Report a fatal error. */
|
---|
989 | #ifndef YY_FATAL_ERROR
|
---|
990 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
|
---|
991 | #endif
|
---|
992 |
|
---|
993 | /* Default declaration of generated scanner - a define so the user can
|
---|
994 | * easily add parameters.
|
---|
995 | */
|
---|
996 | #ifndef YY_DECL
|
---|
997 | #define YY_DECL int yylex YY_PROTO(( void ))
|
---|
998 | #endif
|
---|
999 |
|
---|
1000 | /* Code executed at the beginning of each rule, after yytext and yyleng
|
---|
1001 | * have been set up.
|
---|
1002 | */
|
---|
1003 | #ifndef YY_USER_ACTION
|
---|
1004 | #define YY_USER_ACTION
|
---|
1005 | #endif
|
---|
1006 |
|
---|
1007 | /* Code executed at the end of each rule. */
|
---|
1008 | #ifndef YY_BREAK
|
---|
1009 | #define YY_BREAK break;
|
---|
1010 | #endif
|
---|
1011 |
|
---|
1012 | #define YY_RULE_SETUP \
|
---|
1013 | if ( yyleng > 0 ) \
|
---|
1014 | yy_current_buffer->yy_at_bol = \
|
---|
1015 | (yytext[yyleng - 1] == '\n'); \
|
---|
1016 | YY_USER_ACTION
|
---|
1017 |
|
---|
1018 | YY_DECL
|
---|
1019 | {
|
---|
1020 | register yy_state_type yy_current_state;
|
---|
1021 | register char *yy_cp, *yy_bp;
|
---|
1022 | register int yy_act;
|
---|
1023 |
|
---|
1024 | #line 294 "parser.l"
|
---|
1025 |
|
---|
1026 | /*
|
---|
1027 | * Catch the GCC-style line statements here and parse them.
|
---|
1028 | * This has the advantage that you can #include at any
|
---|
1029 | * stage in the resource file.
|
---|
1030 | * The preprocessor generates line directives in the format:
|
---|
1031 | * # <linenum> "filename" <codes>
|
---|
1032 | *
|
---|
1033 | * Codes can be a sequence of:
|
---|
1034 | * - 1 start of new file
|
---|
1035 | * - 2 returning to previous
|
---|
1036 | * - 3 system header
|
---|
1037 | * - 4 interpret as C-code
|
---|
1038 | *
|
---|
1039 | * 4 is not used and 1 mutually excludes 2
|
---|
1040 | * Anyhow, we are not really interested in these at all
|
---|
1041 | * because we only want to know the linenumber and
|
---|
1042 | * filename.
|
---|
1043 | */
|
---|
1044 | #line 1045 "lexyy.c"
|
---|
1045 |
|
---|
1046 | if ( yy_init )
|
---|
1047 | {
|
---|
1048 | yy_init = 0;
|
---|
1049 |
|
---|
1050 | #ifdef YY_USER_INIT
|
---|
1051 | YY_USER_INIT;
|
---|
1052 | #endif
|
---|
1053 |
|
---|
1054 | if ( ! yy_start )
|
---|
1055 | yy_start = 1; /* first start state */
|
---|
1056 |
|
---|
1057 | if ( ! yyin )
|
---|
1058 | yyin = stdin;
|
---|
1059 |
|
---|
1060 | if ( ! yyout )
|
---|
1061 | yyout = stdout;
|
---|
1062 |
|
---|
1063 | if ( ! yy_current_buffer )
|
---|
1064 | yy_current_buffer =
|
---|
1065 | yy_create_buffer( yyin, YY_BUF_SIZE );
|
---|
1066 |
|
---|
1067 | yy_load_buffer_state();
|
---|
1068 | }
|
---|
1069 |
|
---|
1070 | while ( 1 ) /* loops until end-of-file is reached */
|
---|
1071 | {
|
---|
1072 | yy_cp = yy_c_buf_p;
|
---|
1073 |
|
---|
1074 | /* Support of yytext. */
|
---|
1075 | *yy_cp = yy_hold_char;
|
---|
1076 |
|
---|
1077 | /* yy_bp points to the position in yy_ch_buf of the start of
|
---|
1078 | * the current run.
|
---|
1079 | */
|
---|
1080 | yy_bp = yy_cp;
|
---|
1081 |
|
---|
1082 | yy_current_state = yy_start;
|
---|
1083 | yy_current_state += YY_AT_BOL();
|
---|
1084 | yy_match:
|
---|
1085 | do
|
---|
1086 | {
|
---|
1087 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
---|
1088 | if ( yy_accept[yy_current_state] )
|
---|
1089 | {
|
---|
1090 | yy_last_accepting_state = yy_current_state;
|
---|
1091 | yy_last_accepting_cpos = yy_cp;
|
---|
1092 | }
|
---|
1093 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
---|
1094 | {
|
---|
1095 | yy_current_state = (int) yy_def[yy_current_state];
|
---|
1096 | if ( yy_current_state >= 162 )
|
---|
1097 | yy_c = yy_meta[(unsigned int) yy_c];
|
---|
1098 | }
|
---|
1099 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
---|
1100 | ++yy_cp;
|
---|
1101 | }
|
---|
1102 | while ( yy_base[yy_current_state] != 622 );
|
---|
1103 |
|
---|
1104 | yy_find_action:
|
---|
1105 | yy_act = yy_accept[yy_current_state];
|
---|
1106 | if ( yy_act == 0 )
|
---|
1107 | { /* have to back up */
|
---|
1108 | yy_cp = yy_last_accepting_cpos;
|
---|
1109 | yy_current_state = yy_last_accepting_state;
|
---|
1110 | yy_act = yy_accept[yy_current_state];
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 | YY_DO_BEFORE_ACTION;
|
---|
1114 |
|
---|
1115 |
|
---|
1116 | do_action: /* This label is used only to access EOF actions. */
|
---|
1117 |
|
---|
1118 | if ( yy_flex_debug )
|
---|
1119 | {
|
---|
1120 | if ( yy_act == 0 )
|
---|
1121 | fprintf( stderr, "--scanner backing up\n" );
|
---|
1122 | else if ( yy_act < 84 )
|
---|
1123 | fprintf( stderr, "--accepting rule at line %d (\"%s\")\n",
|
---|
1124 | yy_rule_linenum[yy_act], yytext );
|
---|
1125 | else if ( yy_act == 84 )
|
---|
1126 | fprintf( stderr, "--accepting default rule (\"%s\")\n",
|
---|
1127 | yytext );
|
---|
1128 | else if ( yy_act == 85 )
|
---|
1129 | fprintf( stderr, "--(end of buffer or a NUL)\n" );
|
---|
1130 | else
|
---|
1131 | fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | switch ( yy_act )
|
---|
1135 | { /* beginning of action switch */
|
---|
1136 | case 0: /* must back up */
|
---|
1137 | /* undo the effects of YY_DO_BEFORE_ACTION */
|
---|
1138 | *yy_cp = yy_hold_char;
|
---|
1139 | yy_cp = yy_last_accepting_cpos;
|
---|
1140 | yy_current_state = yy_last_accepting_state;
|
---|
1141 | goto yy_find_action;
|
---|
1142 |
|
---|
1143 | case 1:
|
---|
1144 | YY_RULE_SETUP
|
---|
1145 | #line 313 "parser.l"
|
---|
1146 | yy_push_state(pp_line);
|
---|
1147 | YY_BREAK
|
---|
1148 | case 2:
|
---|
1149 | YY_RULE_SETUP
|
---|
1150 | #line 314 "parser.l"
|
---|
1151 | {
|
---|
1152 | int lineno;
|
---|
1153 | char *cptr;
|
---|
1154 | char *fname;
|
---|
1155 | yy_pop_state();
|
---|
1156 | lineno = (int)strtol(yytext, &cptr, 10);
|
---|
1157 | if(!lineno)
|
---|
1158 | yyerror("Malformed '#...' line-directive; invalid linenumber");
|
---|
1159 | fname = strchr(cptr, '"');
|
---|
1160 | if(!fname)
|
---|
1161 | yyerror("Malformed '#...' line-directive; missing filename");
|
---|
1162 | fname++;
|
---|
1163 | cptr = strchr(fname, '"');
|
---|
1164 | if(!cptr)
|
---|
1165 | yyerror("Malformed '#...' line-directive; missing terminating \"");
|
---|
1166 | *cptr = '\0';
|
---|
1167 | line_number = lineno - 1; /* We didn't read the newline */
|
---|
1168 | input_name = xstrdup(fname);
|
---|
1169 | }
|
---|
1170 | YY_BREAK
|
---|
1171 | /*
|
---|
1172 | * Strip everything until a ';' taking
|
---|
1173 | * into account braces {} for structures,
|
---|
1174 | * classes and enums.
|
---|
1175 | */
|
---|
1176 | case 3:
|
---|
1177 | YY_RULE_SETUP
|
---|
1178 | #line 339 "parser.l"
|
---|
1179 | stripslevel++;
|
---|
1180 | YY_BREAK
|
---|
1181 | case 4:
|
---|
1182 | YY_RULE_SETUP
|
---|
1183 | #line 340 "parser.l"
|
---|
1184 | stripslevel--;
|
---|
1185 | YY_BREAK
|
---|
1186 | case 5:
|
---|
1187 | YY_RULE_SETUP
|
---|
1188 | #line 341 "parser.l"
|
---|
1189 | if(!stripslevel) yy_pop_state();
|
---|
1190 | YY_BREAK
|
---|
1191 | case 6:
|
---|
1192 | YY_RULE_SETUP
|
---|
1193 | #line 342 "parser.l"
|
---|
1194 | ; /* To catch comments */
|
---|
1195 | YY_BREAK
|
---|
1196 | case 7:
|
---|
1197 | YY_RULE_SETUP
|
---|
1198 | #line 343 "parser.l"
|
---|
1199 | ; /* Ignore rest */
|
---|
1200 | YY_BREAK
|
---|
1201 | case 8:
|
---|
1202 | YY_RULE_SETUP
|
---|
1203 | #line 344 "parser.l"
|
---|
1204 | line_number++; char_number = 1;
|
---|
1205 | YY_BREAK
|
---|
1206 | case 9:
|
---|
1207 | YY_RULE_SETUP
|
---|
1208 | #line 346 "parser.l"
|
---|
1209 | stripplevel++;
|
---|
1210 | YY_BREAK
|
---|
1211 | case 10:
|
---|
1212 | YY_RULE_SETUP
|
---|
1213 | #line 347 "parser.l"
|
---|
1214 | {
|
---|
1215 | stripplevel--;
|
---|
1216 | if(!stripplevel)
|
---|
1217 | {
|
---|
1218 | yy_pop_state();
|
---|
1219 | yy_push_state(pp_stripp_final);
|
---|
1220 | }
|
---|
1221 | }
|
---|
1222 | YY_BREAK
|
---|
1223 | case 11:
|
---|
1224 | YY_RULE_SETUP
|
---|
1225 | #line 355 "parser.l"
|
---|
1226 | ; /* To catch comments */
|
---|
1227 | YY_BREAK
|
---|
1228 | case 12:
|
---|
1229 | YY_RULE_SETUP
|
---|
1230 | #line 356 "parser.l"
|
---|
1231 | ; /* Ignore rest */
|
---|
1232 | YY_BREAK
|
---|
1233 | case 13:
|
---|
1234 | YY_RULE_SETUP
|
---|
1235 | #line 357 "parser.l"
|
---|
1236 | line_number++; char_number = 1;
|
---|
1237 | YY_BREAK
|
---|
1238 | case 14:
|
---|
1239 | YY_RULE_SETUP
|
---|
1240 | #line 359 "parser.l"
|
---|
1241 | ; /* Ignore */
|
---|
1242 | YY_BREAK
|
---|
1243 | case 15:
|
---|
1244 | YY_RULE_SETUP
|
---|
1245 | #line 360 "parser.l"
|
---|
1246 | yy_pop_state(); /* Kill the semicolon */
|
---|
1247 | YY_BREAK
|
---|
1248 | case 16:
|
---|
1249 | YY_RULE_SETUP
|
---|
1250 | #line 361 "parser.l"
|
---|
1251 | line_number++; char_number = 1; yy_pop_state();
|
---|
1252 | YY_BREAK
|
---|
1253 | case 17:
|
---|
1254 | YY_RULE_SETUP
|
---|
1255 | #line 362 "parser.l"
|
---|
1256 | yyless(0); yy_pop_state();
|
---|
1257 | YY_BREAK
|
---|
1258 | case 18:
|
---|
1259 | YY_RULE_SETUP
|
---|
1260 | #line 364 "parser.l"
|
---|
1261 | return tBEGIN;
|
---|
1262 | YY_BREAK
|
---|
1263 | case 19:
|
---|
1264 | YY_RULE_SETUP
|
---|
1265 | #line 365 "parser.l"
|
---|
1266 | return tEND;
|
---|
1267 | YY_BREAK
|
---|
1268 | case 20:
|
---|
1269 | YY_RULE_SETUP
|
---|
1270 | #line 367 "parser.l"
|
---|
1271 | { yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
|
---|
1272 | YY_BREAK
|
---|
1273 | case 21:
|
---|
1274 | YY_RULE_SETUP
|
---|
1275 | #line 368 "parser.l"
|
---|
1276 | { yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
|
---|
1277 | YY_BREAK
|
---|
1278 | case 22:
|
---|
1279 | YY_RULE_SETUP
|
---|
1280 | #line 369 "parser.l"
|
---|
1281 | { yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
|
---|
1282 | YY_BREAK
|
---|
1283 | /*
|
---|
1284 | * The next two rules scan identifiers and filenames.
|
---|
1285 | * This is achieved by using the priority ruling
|
---|
1286 | * of the scanner where a '.' is valid in a filename
|
---|
1287 | * and *only* in a filename. In this case, the second
|
---|
1288 | * rule will be reduced because it is longer.
|
---|
1289 | */
|
---|
1290 | case 23:
|
---|
1291 | YY_RULE_SETUP
|
---|
1292 | #line 378 "parser.l"
|
---|
1293 | {
|
---|
1294 | struct keyword *tok = iskeyword(yytext);
|
---|
1295 |
|
---|
1296 | if(tok)
|
---|
1297 | {
|
---|
1298 | if(tok->token == tCLASS && !strcmp(yytext, "class"))
|
---|
1299 | return tCPPCLASS;
|
---|
1300 | else if(wanted_id && !tok->alwayskw)
|
---|
1301 | {
|
---|
1302 | yylval.str = make_string(yytext);
|
---|
1303 | return tIDENT;
|
---|
1304 | }
|
---|
1305 | else
|
---|
1306 | return tok->token;
|
---|
1307 | }
|
---|
1308 | else
|
---|
1309 | {
|
---|
1310 | yylval.str = make_string(yytext);
|
---|
1311 | return tIDENT;
|
---|
1312 | }
|
---|
1313 | }
|
---|
1314 | YY_BREAK
|
---|
1315 | case 24:
|
---|
1316 | YY_RULE_SETUP
|
---|
1317 | #line 399 "parser.l"
|
---|
1318 | yylval.str = make_string(yytext); return tFILENAME;
|
---|
1319 | YY_BREAK
|
---|
1320 | /*
|
---|
1321 | * Wide string scanning
|
---|
1322 | */
|
---|
1323 | case 25:
|
---|
1324 | YY_RULE_SETUP
|
---|
1325 | #line 404 "parser.l"
|
---|
1326 | {
|
---|
1327 | yy_push_state(yylstr);
|
---|
1328 | wbufidx = 0;
|
---|
1329 | if(!win32)
|
---|
1330 | yywarning("16bit resource contains unicode strings\n");
|
---|
1331 | }
|
---|
1332 | YY_BREAK
|
---|
1333 | case 26:
|
---|
1334 | #line 411 "parser.l"
|
---|
1335 | case 27:
|
---|
1336 | YY_RULE_SETUP
|
---|
1337 | #line 411 "parser.l"
|
---|
1338 | {
|
---|
1339 | yy_pop_state();
|
---|
1340 | yylval.str = get_buffered_wstring();
|
---|
1341 | return tSTRING;
|
---|
1342 | }
|
---|
1343 | YY_BREAK
|
---|
1344 | case 28:
|
---|
1345 | YY_RULE_SETUP
|
---|
1346 | #line 416 "parser.l"
|
---|
1347 | { /* octal escape sequence */
|
---|
1348 | int result;
|
---|
1349 | result = strtol(yytext+1, 0, 8);
|
---|
1350 | if ( result > 0xffff )
|
---|
1351 | yyerror("Character constant out of range");
|
---|
1352 | addwchar((short)result);
|
---|
1353 | }
|
---|
1354 | YY_BREAK
|
---|
1355 | case 29:
|
---|
1356 | YY_RULE_SETUP
|
---|
1357 | #line 423 "parser.l"
|
---|
1358 | { /* hex escape sequence */
|
---|
1359 | int result;
|
---|
1360 | result = strtol(yytext+2, 0, 16);
|
---|
1361 | addwchar((short)result);
|
---|
1362 | }
|
---|
1363 | YY_BREAK
|
---|
1364 | case 30:
|
---|
1365 | YY_RULE_SETUP
|
---|
1366 | #line 428 "parser.l"
|
---|
1367 | { yyerror("Invalid hex escape sequence '%s'", yytext); }
|
---|
1368 | YY_BREAK
|
---|
1369 | case 31:
|
---|
1370 | YY_RULE_SETUP
|
---|
1371 | #line 430 "parser.l"
|
---|
1372 | yyerror("Bad escape secuence");
|
---|
1373 | YY_BREAK
|
---|
1374 | case 32:
|
---|
1375 | YY_RULE_SETUP
|
---|
1376 | #line 431 "parser.l"
|
---|
1377 | addwchar('\a');
|
---|
1378 | YY_BREAK
|
---|
1379 | case 33:
|
---|
1380 | YY_RULE_SETUP
|
---|
1381 | #line 432 "parser.l"
|
---|
1382 | addwchar('\b');
|
---|
1383 | YY_BREAK
|
---|
1384 | case 34:
|
---|
1385 | YY_RULE_SETUP
|
---|
1386 | #line 433 "parser.l"
|
---|
1387 | addwchar('\f');
|
---|
1388 | YY_BREAK
|
---|
1389 | case 35:
|
---|
1390 | YY_RULE_SETUP
|
---|
1391 | #line 434 "parser.l"
|
---|
1392 | addwchar('\n');
|
---|
1393 | YY_BREAK
|
---|
1394 | case 36:
|
---|
1395 | YY_RULE_SETUP
|
---|
1396 | #line 435 "parser.l"
|
---|
1397 | addwchar('\r');
|
---|
1398 | YY_BREAK
|
---|
1399 | case 37:
|
---|
1400 | YY_RULE_SETUP
|
---|
1401 | #line 436 "parser.l"
|
---|
1402 | addwchar('\t');
|
---|
1403 | YY_BREAK
|
---|
1404 | case 38:
|
---|
1405 | YY_RULE_SETUP
|
---|
1406 | #line 437 "parser.l"
|
---|
1407 | addwchar('\v');
|
---|
1408 | YY_BREAK
|
---|
1409 | case 39:
|
---|
1410 | YY_RULE_SETUP
|
---|
1411 | #line 438 "parser.l"
|
---|
1412 | addwchar(yytext[1]);
|
---|
1413 | YY_BREAK
|
---|
1414 | case 40:
|
---|
1415 | YY_RULE_SETUP
|
---|
1416 | #line 439 "parser.l"
|
---|
1417 | addwchar(yytext[2]);
|
---|
1418 | YY_BREAK
|
---|
1419 | case 41:
|
---|
1420 | YY_RULE_SETUP
|
---|
1421 | #line 440 "parser.l"
|
---|
1422 | addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
|
---|
1423 | YY_BREAK
|
---|
1424 | case 42:
|
---|
1425 | YY_RULE_SETUP
|
---|
1426 | #line 441 "parser.l"
|
---|
1427 | addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
|
---|
1428 | YY_BREAK
|
---|
1429 | case 43:
|
---|
1430 | YY_RULE_SETUP
|
---|
1431 | #line 442 "parser.l"
|
---|
1432 | ; /* "bla" "bla" -> "blabla" */
|
---|
1433 | YY_BREAK
|
---|
1434 | case 44:
|
---|
1435 | YY_RULE_SETUP
|
---|
1436 | #line 443 "parser.l"
|
---|
1437 | {
|
---|
1438 | char *yptr = yytext;
|
---|
1439 | while(*yptr) /* FIXME: codepage translation */
|
---|
1440 | addwchar(*yptr++ & 0xff);
|
---|
1441 | }
|
---|
1442 | YY_BREAK
|
---|
1443 | case 45:
|
---|
1444 | YY_RULE_SETUP
|
---|
1445 | #line 448 "parser.l"
|
---|
1446 | yyerror("Unterminated string");
|
---|
1447 | YY_BREAK
|
---|
1448 | /*
|
---|
1449 | * Normal string scanning
|
---|
1450 | */
|
---|
1451 | case 46:
|
---|
1452 | YY_RULE_SETUP
|
---|
1453 | #line 453 "parser.l"
|
---|
1454 | yy_push_state(yystr); cbufidx = 0;
|
---|
1455 | YY_BREAK
|
---|
1456 | case 47:
|
---|
1457 | #line 455 "parser.l"
|
---|
1458 | case 48:
|
---|
1459 | YY_RULE_SETUP
|
---|
1460 | #line 455 "parser.l"
|
---|
1461 | {
|
---|
1462 | yy_pop_state();
|
---|
1463 | yylval.str = get_buffered_cstring();
|
---|
1464 | return tSTRING;
|
---|
1465 | }
|
---|
1466 | YY_BREAK
|
---|
1467 | case 49:
|
---|
1468 | YY_RULE_SETUP
|
---|
1469 | #line 460 "parser.l"
|
---|
1470 | { /* octal escape sequence */
|
---|
1471 | int result;
|
---|
1472 | result = strtol(yytext+1, 0, 8);
|
---|
1473 | if ( result > 0xff )
|
---|
1474 | yyerror("Character constant out of range");
|
---|
1475 | addcchar((char)result);
|
---|
1476 | }
|
---|
1477 | YY_BREAK
|
---|
1478 | case 50:
|
---|
1479 | YY_RULE_SETUP
|
---|
1480 | #line 467 "parser.l"
|
---|
1481 | { /* hex escape sequence */
|
---|
1482 | int result;
|
---|
1483 | result = strtol(yytext+2, 0, 16);
|
---|
1484 | addcchar((char)result);
|
---|
1485 | }
|
---|
1486 | YY_BREAK
|
---|
1487 | case 51:
|
---|
1488 | YY_RULE_SETUP
|
---|
1489 | #line 472 "parser.l"
|
---|
1490 | { yyerror("Invalid hex escape sequence '%s'", yytext); }
|
---|
1491 | YY_BREAK
|
---|
1492 | case 52:
|
---|
1493 | YY_RULE_SETUP
|
---|
1494 | #line 474 "parser.l"
|
---|
1495 | yyerror("Bad escape secuence");
|
---|
1496 | YY_BREAK
|
---|
1497 | case 53:
|
---|
1498 | YY_RULE_SETUP
|
---|
1499 | #line 475 "parser.l"
|
---|
1500 | addcchar('\a');
|
---|
1501 | YY_BREAK
|
---|
1502 | case 54:
|
---|
1503 | YY_RULE_SETUP
|
---|
1504 | #line 476 "parser.l"
|
---|
1505 | addcchar('\b');
|
---|
1506 | YY_BREAK
|
---|
1507 | case 55:
|
---|
1508 | YY_RULE_SETUP
|
---|
1509 | #line 477 "parser.l"
|
---|
1510 | addcchar('\f');
|
---|
1511 | YY_BREAK
|
---|
1512 | case 56:
|
---|
1513 | YY_RULE_SETUP
|
---|
1514 | #line 478 "parser.l"
|
---|
1515 | addcchar('\n');
|
---|
1516 | YY_BREAK
|
---|
1517 | case 57:
|
---|
1518 | YY_RULE_SETUP
|
---|
1519 | #line 479 "parser.l"
|
---|
1520 | addcchar('\r');
|
---|
1521 | YY_BREAK
|
---|
1522 | case 58:
|
---|
1523 | YY_RULE_SETUP
|
---|
1524 | #line 480 "parser.l"
|
---|
1525 | addcchar('\t');
|
---|
1526 | YY_BREAK
|
---|
1527 | case 59:
|
---|
1528 | YY_RULE_SETUP
|
---|
1529 | #line 481 "parser.l"
|
---|
1530 | addcchar('\v');
|
---|
1531 | YY_BREAK
|
---|
1532 | case 60:
|
---|
1533 | YY_RULE_SETUP
|
---|
1534 | #line 482 "parser.l"
|
---|
1535 | addcchar(yytext[1]);
|
---|
1536 | YY_BREAK
|
---|
1537 | case 61:
|
---|
1538 | YY_RULE_SETUP
|
---|
1539 | #line 483 "parser.l"
|
---|
1540 | addcchar(yytext[2]);
|
---|
1541 | YY_BREAK
|
---|
1542 | case 62:
|
---|
1543 | YY_RULE_SETUP
|
---|
1544 | #line 484 "parser.l"
|
---|
1545 | {
|
---|
1546 | char *yptr = yytext;
|
---|
1547 | while(*yptr)
|
---|
1548 | addcchar(*yptr++);
|
---|
1549 | }
|
---|
1550 | YY_BREAK
|
---|
1551 | case 63:
|
---|
1552 | YY_RULE_SETUP
|
---|
1553 | #line 489 "parser.l"
|
---|
1554 | addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
|
---|
1555 | YY_BREAK
|
---|
1556 | case 64:
|
---|
1557 | YY_RULE_SETUP
|
---|
1558 | #line 490 "parser.l"
|
---|
1559 | addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
|
---|
1560 | YY_BREAK
|
---|
1561 | case 65:
|
---|
1562 | YY_RULE_SETUP
|
---|
1563 | #line 491 "parser.l"
|
---|
1564 | ; /* "bla" "bla" -> "blabla" */
|
---|
1565 | YY_BREAK
|
---|
1566 | case 66:
|
---|
1567 | YY_RULE_SETUP
|
---|
1568 | #line 492 "parser.l"
|
---|
1569 | yyerror("Unterminated string");
|
---|
1570 | YY_BREAK
|
---|
1571 | /*
|
---|
1572 | * Raw data scanning
|
---|
1573 | */
|
---|
1574 | case 67:
|
---|
1575 | YY_RULE_SETUP
|
---|
1576 | #line 497 "parser.l"
|
---|
1577 | yy_push_state(yyrcd); cbufidx = 0;
|
---|
1578 | YY_BREAK
|
---|
1579 | case 68:
|
---|
1580 | YY_RULE_SETUP
|
---|
1581 | #line 498 "parser.l"
|
---|
1582 | {
|
---|
1583 | yy_pop_state();
|
---|
1584 | yylval.raw = new_raw_data();
|
---|
1585 | yylval.raw->size = cbufidx;
|
---|
1586 | yylval.raw->data = xmalloc(yylval.raw->size);
|
---|
1587 | memcpy(yylval.raw->data, cbuffer, yylval.raw->size);
|
---|
1588 | return tRAWDATA;
|
---|
1589 | }
|
---|
1590 | YY_BREAK
|
---|
1591 | case 69:
|
---|
1592 | YY_RULE_SETUP
|
---|
1593 | #line 506 "parser.l"
|
---|
1594 | {
|
---|
1595 | int result;
|
---|
1596 | result = strtol(yytext, 0, 16);
|
---|
1597 | addcchar((char)result);
|
---|
1598 | }
|
---|
1599 | YY_BREAK
|
---|
1600 | case 70:
|
---|
1601 | YY_RULE_SETUP
|
---|
1602 | #line 511 "parser.l"
|
---|
1603 | ; /* Ignore space */
|
---|
1604 | YY_BREAK
|
---|
1605 | case 71:
|
---|
1606 | YY_RULE_SETUP
|
---|
1607 | #line 512 "parser.l"
|
---|
1608 | line_number++; char_number = 1;
|
---|
1609 | YY_BREAK
|
---|
1610 | case 72:
|
---|
1611 | YY_RULE_SETUP
|
---|
1612 | #line 513 "parser.l"
|
---|
1613 | yyerror("Malformed data-line");
|
---|
1614 | YY_BREAK
|
---|
1615 | /*
|
---|
1616 | * Comment stripping
|
---|
1617 | * Should never occur after preprocessing
|
---|
1618 | */
|
---|
1619 | case 73:
|
---|
1620 | YY_RULE_SETUP
|
---|
1621 | #line 519 "parser.l"
|
---|
1622 | {
|
---|
1623 | yy_push_state(comment);
|
---|
1624 | save_wanted_id = wanted_id;
|
---|
1625 | if(!no_preprocess)
|
---|
1626 | yywarning("Found comments after preprocessing, please report");
|
---|
1627 | }
|
---|
1628 | YY_BREAK
|
---|
1629 | case 74:
|
---|
1630 | YY_RULE_SETUP
|
---|
1631 | #line 525 "parser.l"
|
---|
1632 | ;
|
---|
1633 | YY_BREAK
|
---|
1634 | case 75:
|
---|
1635 | YY_RULE_SETUP
|
---|
1636 | #line 526 "parser.l"
|
---|
1637 | ;
|
---|
1638 | YY_BREAK
|
---|
1639 | case 76:
|
---|
1640 | YY_RULE_SETUP
|
---|
1641 | #line 527 "parser.l"
|
---|
1642 | line_number++; char_number = 1;
|
---|
1643 | YY_BREAK
|
---|
1644 | case 77:
|
---|
1645 | YY_RULE_SETUP
|
---|
1646 | #line 528 "parser.l"
|
---|
1647 | yy_pop_state(); want_id = save_wanted_id;
|
---|
1648 | YY_BREAK
|
---|
1649 | case 78:
|
---|
1650 | YY_RULE_SETUP
|
---|
1651 | #line 530 "parser.l"
|
---|
1652 | want_id = wanted_id; /* not really comment, but left-over c-junk */
|
---|
1653 | YY_BREAK
|
---|
1654 | case 79:
|
---|
1655 | YY_RULE_SETUP
|
---|
1656 | #line 531 "parser.l"
|
---|
1657 | want_id = wanted_id; if(!no_preprocess) yywarning("Found comments after preprocessing, please report");
|
---|
1658 | YY_BREAK
|
---|
1659 | case 80:
|
---|
1660 | YY_RULE_SETUP
|
---|
1661 | #line 533 "parser.l"
|
---|
1662 | {
|
---|
1663 | want_id = wanted_id;
|
---|
1664 | line_number++;
|
---|
1665 | char_number = 1;
|
---|
1666 | if(want_nl)
|
---|
1667 | {
|
---|
1668 | want_nl = 0;
|
---|
1669 | return tNL;
|
---|
1670 | }
|
---|
1671 | }
|
---|
1672 | YY_BREAK
|
---|
1673 | case 81:
|
---|
1674 | YY_RULE_SETUP
|
---|
1675 | #line 543 "parser.l"
|
---|
1676 | want_id = wanted_id; /* Eat whitespace */
|
---|
1677 | YY_BREAK
|
---|
1678 | case 82:
|
---|
1679 | YY_RULE_SETUP
|
---|
1680 | #line 545 "parser.l"
|
---|
1681 | return yytext[0];
|
---|
1682 | YY_BREAK
|
---|
1683 | case YY_STATE_EOF(INITIAL):
|
---|
1684 | case YY_STATE_EOF(yystr):
|
---|
1685 | case YY_STATE_EOF(yylstr):
|
---|
1686 | case YY_STATE_EOF(yyrcd):
|
---|
1687 | case YY_STATE_EOF(comment):
|
---|
1688 | case YY_STATE_EOF(pp_stripe):
|
---|
1689 | case YY_STATE_EOF(pp_strips):
|
---|
1690 | case YY_STATE_EOF(pp_stripp):
|
---|
1691 | case YY_STATE_EOF(pp_stripp_final):
|
---|
1692 | case YY_STATE_EOF(pp_line):
|
---|
1693 | #line 547 "parser.l"
|
---|
1694 | {
|
---|
1695 | if(YY_START == pp_strips || YY_START == pp_stripe || YY_START == pp_stripp || YY_START == pp_stripp_final)
|
---|
1696 | yyerror("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline);
|
---|
1697 | else
|
---|
1698 | yyterminate();
|
---|
1699 | }
|
---|
1700 | YY_BREAK
|
---|
1701 | case 83:
|
---|
1702 | YY_RULE_SETUP
|
---|
1703 | #line 554 "parser.l"
|
---|
1704 | {
|
---|
1705 | /* Catch all rule to find any unmatched text */
|
---|
1706 | if(*yytext == '\n')
|
---|
1707 | {
|
---|
1708 | line_number++;
|
---|
1709 | char_number = 1;
|
---|
1710 | }
|
---|
1711 | yywarning("Unmatched text '%c' (0x%02x) YY_START=%d stripslevel=%d",
|
---|
1712 | isprint(*yytext & 0xff) ? *yytext : '.', *yytext, YY_START,stripslevel);
|
---|
1713 | }
|
---|
1714 | YY_BREAK
|
---|
1715 | case 84:
|
---|
1716 | YY_RULE_SETUP
|
---|
1717 | #line 565 "parser.l"
|
---|
1718 | ECHO;
|
---|
1719 | YY_BREAK
|
---|
1720 | #line 1721 "lexyy.c"
|
---|
1721 |
|
---|
1722 | case YY_END_OF_BUFFER:
|
---|
1723 | {
|
---|
1724 | /* Amount of text matched not including the EOB char. */
|
---|
1725 | int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
|
---|
1726 |
|
---|
1727 | /* Undo the effects of YY_DO_BEFORE_ACTION. */
|
---|
1728 | *yy_cp = yy_hold_char;
|
---|
1729 |
|
---|
1730 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
|
---|
1731 | {
|
---|
1732 | /* We're scanning a new file or input source. It's
|
---|
1733 | * possible that this happened because the user
|
---|
1734 | * just pointed yyin at a new source and called
|
---|
1735 | * yylex(). If so, then we have to assure
|
---|
1736 | * consistency between yy_current_buffer and our
|
---|
1737 | * globals. Here is the right place to do so, because
|
---|
1738 | * this is the first action (other than possibly a
|
---|
1739 | * back-up) that will match for the new input source.
|
---|
1740 | */
|
---|
1741 | yy_n_chars = yy_current_buffer->yy_n_chars;
|
---|
1742 | yy_current_buffer->yy_input_file = yyin;
|
---|
1743 | yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
|
---|
1744 | }
|
---|
1745 |
|
---|
1746 | /* Note that here we test for yy_c_buf_p "<=" to the position
|
---|
1747 | * of the first EOB in the buffer, since yy_c_buf_p will
|
---|
1748 | * already have been incremented past the NUL character
|
---|
1749 | * (since all states make transitions on EOB to the
|
---|
1750 | * end-of-buffer state). Contrast this with the test
|
---|
1751 | * in input().
|
---|
1752 | */
|
---|
1753 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
|
---|
1754 | { /* This was really a NUL. */
|
---|
1755 | yy_state_type yy_next_state;
|
---|
1756 |
|
---|
1757 | yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
|
---|
1758 |
|
---|
1759 | yy_current_state = yy_get_previous_state();
|
---|
1760 |
|
---|
1761 | /* Okay, we're now positioned to make the NUL
|
---|
1762 | * transition. We couldn't have
|
---|
1763 | * yy_get_previous_state() go ahead and do it
|
---|
1764 | * for us because it doesn't know how to deal
|
---|
1765 | * with the possibility of jamming (and we don't
|
---|
1766 | * want to build jamming into it because then it
|
---|
1767 | * will run more slowly).
|
---|
1768 | */
|
---|
1769 |
|
---|
1770 | yy_next_state = yy_try_NUL_trans( yy_current_state );
|
---|
1771 |
|
---|
1772 | yy_bp = yytext_ptr + YY_MORE_ADJ;
|
---|
1773 |
|
---|
1774 | if ( yy_next_state )
|
---|
1775 | {
|
---|
1776 | /* Consume the NUL. */
|
---|
1777 | yy_cp = ++yy_c_buf_p;
|
---|
1778 | yy_current_state = yy_next_state;
|
---|
1779 | goto yy_match;
|
---|
1780 | }
|
---|
1781 |
|
---|
1782 | else
|
---|
1783 | {
|
---|
1784 | yy_cp = yy_c_buf_p;
|
---|
1785 | goto yy_find_action;
|
---|
1786 | }
|
---|
1787 | }
|
---|
1788 |
|
---|
1789 | else switch ( yy_get_next_buffer() )
|
---|
1790 | {
|
---|
1791 | case EOB_ACT_END_OF_FILE:
|
---|
1792 | {
|
---|
1793 | yy_did_buffer_switch_on_eof = 0;
|
---|
1794 |
|
---|
1795 | if ( yywrap() )
|
---|
1796 | {
|
---|
1797 | /* Note: because we've taken care in
|
---|
1798 | * yy_get_next_buffer() to have set up
|
---|
1799 | * yytext, we can now set up
|
---|
1800 | * yy_c_buf_p so that if some total
|
---|
1801 | * hoser (like flex itself) wants to
|
---|
1802 | * call the scanner after we return the
|
---|
1803 | * YY_NULL, it'll still work - another
|
---|
1804 | * YY_NULL will get returned.
|
---|
1805 | */
|
---|
1806 | yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
|
---|
1807 |
|
---|
1808 | yy_act = YY_STATE_EOF(YY_START);
|
---|
1809 | goto do_action;
|
---|
1810 | }
|
---|
1811 |
|
---|
1812 | else
|
---|
1813 | {
|
---|
1814 | if ( ! yy_did_buffer_switch_on_eof )
|
---|
1815 | YY_NEW_FILE;
|
---|
1816 | }
|
---|
1817 | break;
|
---|
1818 | }
|
---|
1819 |
|
---|
1820 | case EOB_ACT_CONTINUE_SCAN:
|
---|
1821 | yy_c_buf_p =
|
---|
1822 | yytext_ptr + yy_amount_of_matched_text;
|
---|
1823 |
|
---|
1824 | yy_current_state = yy_get_previous_state();
|
---|
1825 |
|
---|
1826 | yy_cp = yy_c_buf_p;
|
---|
1827 | yy_bp = yytext_ptr + YY_MORE_ADJ;
|
---|
1828 | goto yy_match;
|
---|
1829 |
|
---|
1830 | case EOB_ACT_LAST_MATCH:
|
---|
1831 | yy_c_buf_p =
|
---|
1832 | &yy_current_buffer->yy_ch_buf[yy_n_chars];
|
---|
1833 |
|
---|
1834 | yy_current_state = yy_get_previous_state();
|
---|
1835 |
|
---|
1836 | yy_cp = yy_c_buf_p;
|
---|
1837 | yy_bp = yytext_ptr + YY_MORE_ADJ;
|
---|
1838 | goto yy_find_action;
|
---|
1839 | }
|
---|
1840 | break;
|
---|
1841 | }
|
---|
1842 |
|
---|
1843 | default:
|
---|
1844 | YY_FATAL_ERROR(
|
---|
1845 | "fatal flex scanner internal error--no action found" );
|
---|
1846 | } /* end of action switch */
|
---|
1847 | } /* end of scanning one token */
|
---|
1848 | } /* end of yylex */
|
---|
1849 |
|
---|
1850 |
|
---|
1851 | /* yy_get_next_buffer - try to read in a new buffer
|
---|
1852 | *
|
---|
1853 | * Returns a code representing an action:
|
---|
1854 | * EOB_ACT_LAST_MATCH -
|
---|
1855 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
|
---|
1856 | * EOB_ACT_END_OF_FILE - end of file
|
---|
1857 | */
|
---|
1858 |
|
---|
1859 | static int yy_get_next_buffer()
|
---|
1860 | {
|
---|
1861 | register char *dest = yy_current_buffer->yy_ch_buf;
|
---|
1862 | register char *source = yytext_ptr;
|
---|
1863 | register int number_to_move, i;
|
---|
1864 | int ret_val;
|
---|
1865 |
|
---|
1866 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
|
---|
1867 | YY_FATAL_ERROR(
|
---|
1868 | "fatal flex scanner internal error--end of buffer missed" );
|
---|
1869 |
|
---|
1870 | if ( yy_current_buffer->yy_fill_buffer == 0 )
|
---|
1871 | { /* Don't try to fill the buffer, so this is an EOF. */
|
---|
1872 | if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
|
---|
1873 | {
|
---|
1874 | /* We matched a singled characater, the EOB, so
|
---|
1875 | * treat this as a final EOF.
|
---|
1876 | */
|
---|
1877 | return EOB_ACT_END_OF_FILE;
|
---|
1878 | }
|
---|
1879 |
|
---|
1880 | else
|
---|
1881 | {
|
---|
1882 | /* We matched some text prior to the EOB, first
|
---|
1883 | * process it.
|
---|
1884 | */
|
---|
1885 | return EOB_ACT_LAST_MATCH;
|
---|
1886 | }
|
---|
1887 | }
|
---|
1888 |
|
---|
1889 | /* Try to read more data. */
|
---|
1890 |
|
---|
1891 | /* First move last chars to start of buffer. */
|
---|
1892 | number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
|
---|
1893 |
|
---|
1894 | for ( i = 0; i < number_to_move; ++i )
|
---|
1895 | *(dest++) = *(source++);
|
---|
1896 |
|
---|
1897 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
|
---|
1898 | /* don't do the read, it's not guaranteed to return an EOF,
|
---|
1899 | * just force an EOF
|
---|
1900 | */
|
---|
1901 | yy_n_chars = 0;
|
---|
1902 |
|
---|
1903 | else
|
---|
1904 | {
|
---|
1905 | int num_to_read =
|
---|
1906 | yy_current_buffer->yy_buf_size - number_to_move - 1;
|
---|
1907 |
|
---|
1908 | while ( num_to_read <= 0 )
|
---|
1909 | { /* Not enough room in the buffer - grow it. */
|
---|
1910 | #ifdef YY_USES_REJECT
|
---|
1911 | YY_FATAL_ERROR(
|
---|
1912 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
|
---|
1913 | #else
|
---|
1914 |
|
---|
1915 | /* just a shorter name for the current buffer */
|
---|
1916 | YY_BUFFER_STATE b = yy_current_buffer;
|
---|
1917 |
|
---|
1918 | int yy_c_buf_p_offset =
|
---|
1919 | (int) (yy_c_buf_p - b->yy_ch_buf);
|
---|
1920 |
|
---|
1921 | if ( b->yy_is_our_buffer )
|
---|
1922 | {
|
---|
1923 | int new_size = b->yy_buf_size * 2;
|
---|
1924 |
|
---|
1925 | if ( new_size <= 0 )
|
---|
1926 | b->yy_buf_size += b->yy_buf_size / 8;
|
---|
1927 | else
|
---|
1928 | b->yy_buf_size *= 2;
|
---|
1929 |
|
---|
1930 | b->yy_ch_buf = (char *)
|
---|
1931 | /* Include room in for 2 EOB chars. */
|
---|
1932 | yy_flex_realloc( (void *) b->yy_ch_buf,
|
---|
1933 | b->yy_buf_size + 2 );
|
---|
1934 | }
|
---|
1935 | else
|
---|
1936 | /* Can't grow it, we don't own it. */
|
---|
1937 | b->yy_ch_buf = 0;
|
---|
1938 |
|
---|
1939 | if ( ! b->yy_ch_buf )
|
---|
1940 | YY_FATAL_ERROR(
|
---|
1941 | "fatal error - scanner input buffer overflow" );
|
---|
1942 |
|
---|
1943 | yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
|
---|
1944 |
|
---|
1945 | num_to_read = yy_current_buffer->yy_buf_size -
|
---|
1946 | number_to_move - 1;
|
---|
1947 | #endif
|
---|
1948 | }
|
---|
1949 |
|
---|
1950 | if ( num_to_read > YY_READ_BUF_SIZE )
|
---|
1951 | num_to_read = YY_READ_BUF_SIZE;
|
---|
1952 |
|
---|
1953 | /* Read in more data. */
|
---|
1954 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
|
---|
1955 | yy_n_chars, num_to_read );
|
---|
1956 | }
|
---|
1957 |
|
---|
1958 | if ( yy_n_chars == 0 )
|
---|
1959 | {
|
---|
1960 | if ( number_to_move == YY_MORE_ADJ )
|
---|
1961 | {
|
---|
1962 | ret_val = EOB_ACT_END_OF_FILE;
|
---|
1963 | yyrestart( yyin );
|
---|
1964 | }
|
---|
1965 |
|
---|
1966 | else
|
---|
1967 | {
|
---|
1968 | ret_val = EOB_ACT_LAST_MATCH;
|
---|
1969 | yy_current_buffer->yy_buffer_status =
|
---|
1970 | YY_BUFFER_EOF_PENDING;
|
---|
1971 | }
|
---|
1972 | }
|
---|
1973 |
|
---|
1974 | else
|
---|
1975 | ret_val = EOB_ACT_CONTINUE_SCAN;
|
---|
1976 |
|
---|
1977 | yy_n_chars += number_to_move;
|
---|
1978 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
|
---|
1979 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
|
---|
1980 |
|
---|
1981 | yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
|
---|
1982 |
|
---|
1983 | return ret_val;
|
---|
1984 | }
|
---|
1985 |
|
---|
1986 |
|
---|
1987 | /* yy_get_previous_state - get the state just before the EOB char was reached */
|
---|
1988 |
|
---|
1989 | static yy_state_type yy_get_previous_state()
|
---|
1990 | {
|
---|
1991 | register yy_state_type yy_current_state;
|
---|
1992 | register char *yy_cp;
|
---|
1993 |
|
---|
1994 | yy_current_state = yy_start;
|
---|
1995 | yy_current_state += YY_AT_BOL();
|
---|
1996 |
|
---|
1997 | for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
|
---|
1998 | {
|
---|
1999 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
---|
2000 | if ( yy_accept[yy_current_state] )
|
---|
2001 | {
|
---|
2002 | yy_last_accepting_state = yy_current_state;
|
---|
2003 | yy_last_accepting_cpos = yy_cp;
|
---|
2004 | }
|
---|
2005 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
---|
2006 | {
|
---|
2007 | yy_current_state = (int) yy_def[yy_current_state];
|
---|
2008 | if ( yy_current_state >= 162 )
|
---|
2009 | yy_c = yy_meta[(unsigned int) yy_c];
|
---|
2010 | }
|
---|
2011 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
---|
2012 | }
|
---|
2013 |
|
---|
2014 | return yy_current_state;
|
---|
2015 | }
|
---|
2016 |
|
---|
2017 |
|
---|
2018 | /* yy_try_NUL_trans - try to make a transition on the NUL character
|
---|
2019 | *
|
---|
2020 | * synopsis
|
---|
2021 | * next_state = yy_try_NUL_trans( current_state );
|
---|
2022 | */
|
---|
2023 |
|
---|
2024 | #ifdef YY_USE_PROTOS
|
---|
2025 | static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
|
---|
2026 | #else
|
---|
2027 | static yy_state_type yy_try_NUL_trans( yy_current_state )
|
---|
2028 | yy_state_type yy_current_state;
|
---|
2029 | #endif
|
---|
2030 | {
|
---|
2031 | register int yy_is_jam;
|
---|
2032 | register char *yy_cp = yy_c_buf_p;
|
---|
2033 |
|
---|
2034 | register YY_CHAR yy_c = 1;
|
---|
2035 | if ( yy_accept[yy_current_state] )
|
---|
2036 | {
|
---|
2037 | yy_last_accepting_state = yy_current_state;
|
---|
2038 | yy_last_accepting_cpos = yy_cp;
|
---|
2039 | }
|
---|
2040 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
---|
2041 | {
|
---|
2042 | yy_current_state = (int) yy_def[yy_current_state];
|
---|
2043 | if ( yy_current_state >= 162 )
|
---|
2044 | yy_c = yy_meta[(unsigned int) yy_c];
|
---|
2045 | }
|
---|
2046 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
---|
2047 | yy_is_jam = (yy_current_state == 161);
|
---|
2048 |
|
---|
2049 | return yy_is_jam ? 0 : yy_current_state;
|
---|
2050 | }
|
---|
2051 |
|
---|
2052 |
|
---|
2053 | #ifndef YY_NO_UNPUT
|
---|
2054 | #ifdef YY_USE_PROTOS
|
---|
2055 | static void yyunput( int c, register char *yy_bp )
|
---|
2056 | #else
|
---|
2057 | static void yyunput( c, yy_bp )
|
---|
2058 | int c;
|
---|
2059 | register char *yy_bp;
|
---|
2060 | #endif
|
---|
2061 | {
|
---|
2062 | register char *yy_cp = yy_c_buf_p;
|
---|
2063 |
|
---|
2064 | /* undo effects of setting up yytext */
|
---|
2065 | *yy_cp = yy_hold_char;
|
---|
2066 |
|
---|
2067 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
|
---|
2068 | { /* need to shift things up to make room */
|
---|
2069 | /* +2 for EOB chars. */
|
---|
2070 | register int number_to_move = yy_n_chars + 2;
|
---|
2071 | register char *dest = &yy_current_buffer->yy_ch_buf[
|
---|
2072 | yy_current_buffer->yy_buf_size + 2];
|
---|
2073 | register char *source =
|
---|
2074 | &yy_current_buffer->yy_ch_buf[number_to_move];
|
---|
2075 |
|
---|
2076 | while ( source > yy_current_buffer->yy_ch_buf )
|
---|
2077 | *--dest = *--source;
|
---|
2078 |
|
---|
2079 | yy_cp += (int) (dest - source);
|
---|
2080 | yy_bp += (int) (dest - source);
|
---|
2081 | yy_n_chars = yy_current_buffer->yy_buf_size;
|
---|
2082 |
|
---|
2083 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
|
---|
2084 | YY_FATAL_ERROR( "flex scanner push-back overflow" );
|
---|
2085 | }
|
---|
2086 |
|
---|
2087 | *--yy_cp = (char) c;
|
---|
2088 |
|
---|
2089 |
|
---|
2090 | yytext_ptr = yy_bp;
|
---|
2091 | yy_hold_char = *yy_cp;
|
---|
2092 | yy_c_buf_p = yy_cp;
|
---|
2093 | }
|
---|
2094 | #endif /* ifndef YY_NO_UNPUT */
|
---|
2095 |
|
---|
2096 |
|
---|
2097 | #ifdef __cplusplus
|
---|
2098 | static int yyinput()
|
---|
2099 | #else
|
---|
2100 | static int input()
|
---|
2101 | #endif
|
---|
2102 | {
|
---|
2103 | int c;
|
---|
2104 |
|
---|
2105 | *yy_c_buf_p = yy_hold_char;
|
---|
2106 |
|
---|
2107 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
|
---|
2108 | {
|
---|
2109 | /* yy_c_buf_p now points to the character we want to return.
|
---|
2110 | * If this occurs *before* the EOB characters, then it's a
|
---|
2111 | * valid NUL; if not, then we've hit the end of the buffer.
|
---|
2112 | */
|
---|
2113 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
|
---|
2114 | /* This was really a NUL. */
|
---|
2115 | *yy_c_buf_p = '\0';
|
---|
2116 |
|
---|
2117 | else
|
---|
2118 | { /* need more input */
|
---|
2119 | yytext_ptr = yy_c_buf_p;
|
---|
2120 | ++yy_c_buf_p;
|
---|
2121 |
|
---|
2122 | switch ( yy_get_next_buffer() )
|
---|
2123 | {
|
---|
2124 | case EOB_ACT_END_OF_FILE:
|
---|
2125 | {
|
---|
2126 | if ( yywrap() )
|
---|
2127 | {
|
---|
2128 | yy_c_buf_p =
|
---|
2129 | yytext_ptr + YY_MORE_ADJ;
|
---|
2130 | return EOF;
|
---|
2131 | }
|
---|
2132 |
|
---|
2133 | if ( ! yy_did_buffer_switch_on_eof )
|
---|
2134 | YY_NEW_FILE;
|
---|
2135 | #ifdef __cplusplus
|
---|
2136 | return yyinput();
|
---|
2137 | #else
|
---|
2138 | return input();
|
---|
2139 | #endif
|
---|
2140 | }
|
---|
2141 |
|
---|
2142 | case EOB_ACT_CONTINUE_SCAN:
|
---|
2143 | yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
|
---|
2144 | break;
|
---|
2145 |
|
---|
2146 | case EOB_ACT_LAST_MATCH:
|
---|
2147 | #ifdef __cplusplus
|
---|
2148 | YY_FATAL_ERROR(
|
---|
2149 | "unexpected last match in yyinput()" );
|
---|
2150 | #else
|
---|
2151 | YY_FATAL_ERROR(
|
---|
2152 | "unexpected last match in input()" );
|
---|
2153 | #endif
|
---|
2154 | }
|
---|
2155 | }
|
---|
2156 | }
|
---|
2157 |
|
---|
2158 | c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
|
---|
2159 | *yy_c_buf_p = '\0'; /* preserve yytext */
|
---|
2160 | yy_hold_char = *++yy_c_buf_p;
|
---|
2161 |
|
---|
2162 | yy_current_buffer->yy_at_bol = (c == '\n');
|
---|
2163 |
|
---|
2164 | return c;
|
---|
2165 | }
|
---|
2166 |
|
---|
2167 |
|
---|
2168 | #ifdef YY_USE_PROTOS
|
---|
2169 | void yyrestart( FILE *input_file )
|
---|
2170 | #else
|
---|
2171 | void yyrestart( input_file )
|
---|
2172 | FILE *input_file;
|
---|
2173 | #endif
|
---|
2174 | {
|
---|
2175 | if ( ! yy_current_buffer )
|
---|
2176 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
|
---|
2177 |
|
---|
2178 | yy_init_buffer( yy_current_buffer, input_file );
|
---|
2179 | yy_load_buffer_state();
|
---|
2180 | }
|
---|
2181 |
|
---|
2182 |
|
---|
2183 | #ifdef YY_USE_PROTOS
|
---|
2184 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
---|
2185 | #else
|
---|
2186 | void yy_switch_to_buffer( new_buffer )
|
---|
2187 | YY_BUFFER_STATE new_buffer;
|
---|
2188 | #endif
|
---|
2189 | {
|
---|
2190 | if ( yy_current_buffer == new_buffer )
|
---|
2191 | return;
|
---|
2192 |
|
---|
2193 | if ( yy_current_buffer )
|
---|
2194 | {
|
---|
2195 | /* Flush out information for old buffer. */
|
---|
2196 | *yy_c_buf_p = yy_hold_char;
|
---|
2197 | yy_current_buffer->yy_buf_pos = yy_c_buf_p;
|
---|
2198 | yy_current_buffer->yy_n_chars = yy_n_chars;
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | yy_current_buffer = new_buffer;
|
---|
2202 | yy_load_buffer_state();
|
---|
2203 |
|
---|
2204 | /* We don't actually know whether we did this switch during
|
---|
2205 | * EOF (yywrap()) processing, but the only time this flag
|
---|
2206 | * is looked at is after yywrap() is called, so it's safe
|
---|
2207 | * to go ahead and always set it.
|
---|
2208 | */
|
---|
2209 | yy_did_buffer_switch_on_eof = 1;
|
---|
2210 | }
|
---|
2211 |
|
---|
2212 |
|
---|
2213 | #ifdef YY_USE_PROTOS
|
---|
2214 | void yy_load_buffer_state( void )
|
---|
2215 | #else
|
---|
2216 | void yy_load_buffer_state()
|
---|
2217 | #endif
|
---|
2218 | {
|
---|
2219 | yy_n_chars = yy_current_buffer->yy_n_chars;
|
---|
2220 | yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
---|
2221 | yyin = yy_current_buffer->yy_input_file;
|
---|
2222 | yy_hold_char = *yy_c_buf_p;
|
---|
2223 | }
|
---|
2224 |
|
---|
2225 |
|
---|
2226 | #ifdef YY_USE_PROTOS
|
---|
2227 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
---|
2228 | #else
|
---|
2229 | YY_BUFFER_STATE yy_create_buffer( file, size )
|
---|
2230 | FILE *file;
|
---|
2231 | int size;
|
---|
2232 | #endif
|
---|
2233 | {
|
---|
2234 | YY_BUFFER_STATE b;
|
---|
2235 |
|
---|
2236 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
|
---|
2237 | if ( ! b )
|
---|
2238 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
---|
2239 |
|
---|
2240 | b->yy_buf_size = size;
|
---|
2241 |
|
---|
2242 | /* yy_ch_buf has to be 2 characters longer than the size given because
|
---|
2243 | * we need to put in 2 end-of-buffer characters.
|
---|
2244 | */
|
---|
2245 | b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
|
---|
2246 | if ( ! b->yy_ch_buf )
|
---|
2247 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
---|
2248 |
|
---|
2249 | b->yy_is_our_buffer = 1;
|
---|
2250 |
|
---|
2251 | yy_init_buffer( b, file );
|
---|
2252 |
|
---|
2253 | return b;
|
---|
2254 | }
|
---|
2255 |
|
---|
2256 |
|
---|
2257 | #ifdef YY_USE_PROTOS
|
---|
2258 | void yy_delete_buffer( YY_BUFFER_STATE b )
|
---|
2259 | #else
|
---|
2260 | void yy_delete_buffer( b )
|
---|
2261 | YY_BUFFER_STATE b;
|
---|
2262 | #endif
|
---|
2263 | {
|
---|
2264 | if ( ! b )
|
---|
2265 | return;
|
---|
2266 |
|
---|
2267 | if ( b == yy_current_buffer )
|
---|
2268 | yy_current_buffer = (YY_BUFFER_STATE) 0;
|
---|
2269 |
|
---|
2270 | if ( b->yy_is_our_buffer )
|
---|
2271 | yy_flex_free( (void *) b->yy_ch_buf );
|
---|
2272 |
|
---|
2273 | yy_flex_free( (void *) b );
|
---|
2274 | }
|
---|
2275 |
|
---|
2276 |
|
---|
2277 | #ifndef YY_ALWAYS_INTERACTIVE
|
---|
2278 | #ifndef YY_NEVER_INTERACTIVE
|
---|
2279 | extern int isatty YY_PROTO(( int ));
|
---|
2280 | #endif
|
---|
2281 | #endif
|
---|
2282 |
|
---|
2283 | #ifdef YY_USE_PROTOS
|
---|
2284 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
---|
2285 | #else
|
---|
2286 | void yy_init_buffer( b, file )
|
---|
2287 | YY_BUFFER_STATE b;
|
---|
2288 | FILE *file;
|
---|
2289 | #endif
|
---|
2290 |
|
---|
2291 |
|
---|
2292 | {
|
---|
2293 | yy_flush_buffer( b );
|
---|
2294 |
|
---|
2295 | b->yy_input_file = file;
|
---|
2296 | b->yy_fill_buffer = 1;
|
---|
2297 |
|
---|
2298 | #if YY_ALWAYS_INTERACTIVE
|
---|
2299 | b->yy_is_interactive = 1;
|
---|
2300 | #else
|
---|
2301 | #if YY_NEVER_INTERACTIVE
|
---|
2302 | b->yy_is_interactive = 0;
|
---|
2303 | #else
|
---|
2304 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
---|
2305 | #endif
|
---|
2306 | #endif
|
---|
2307 | }
|
---|
2308 |
|
---|
2309 |
|
---|
2310 | #ifdef YY_USE_PROTOS
|
---|
2311 | void yy_flush_buffer( YY_BUFFER_STATE b )
|
---|
2312 | #else
|
---|
2313 | void yy_flush_buffer( b )
|
---|
2314 | YY_BUFFER_STATE b;
|
---|
2315 | #endif
|
---|
2316 |
|
---|
2317 | {
|
---|
2318 | b->yy_n_chars = 0;
|
---|
2319 |
|
---|
2320 | /* We always need two end-of-buffer characters. The first causes
|
---|
2321 | * a transition to the end-of-buffer state. The second causes
|
---|
2322 | * a jam in that state.
|
---|
2323 | */
|
---|
2324 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
|
---|
2325 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
|
---|
2326 |
|
---|
2327 | b->yy_buf_pos = &b->yy_ch_buf[0];
|
---|
2328 |
|
---|
2329 | b->yy_at_bol = 1;
|
---|
2330 | b->yy_buffer_status = YY_BUFFER_NEW;
|
---|
2331 |
|
---|
2332 | if ( b == yy_current_buffer )
|
---|
2333 | yy_load_buffer_state();
|
---|
2334 | }
|
---|
2335 |
|
---|
2336 |
|
---|
2337 | #ifndef YY_NO_SCAN_BUFFER
|
---|
2338 | #ifdef YY_USE_PROTOS
|
---|
2339 | YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
|
---|
2340 | #else
|
---|
2341 | YY_BUFFER_STATE yy_scan_buffer( base, size )
|
---|
2342 | char *base;
|
---|
2343 | yy_size_t size;
|
---|
2344 | #endif
|
---|
2345 | {
|
---|
2346 | YY_BUFFER_STATE b;
|
---|
2347 |
|
---|
2348 | if ( size < 2 ||
|
---|
2349 | base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
---|
2350 | base[size-1] != YY_END_OF_BUFFER_CHAR )
|
---|
2351 | /* They forgot to leave room for the EOB's. */
|
---|
2352 | return 0;
|
---|
2353 |
|
---|
2354 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
|
---|
2355 | if ( ! b )
|
---|
2356 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
|
---|
2357 |
|
---|
2358 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
|
---|
2359 | b->yy_buf_pos = b->yy_ch_buf = base;
|
---|
2360 | b->yy_is_our_buffer = 0;
|
---|
2361 | b->yy_input_file = 0;
|
---|
2362 | b->yy_n_chars = b->yy_buf_size;
|
---|
2363 | b->yy_is_interactive = 0;
|
---|
2364 | b->yy_at_bol = 1;
|
---|
2365 | b->yy_fill_buffer = 0;
|
---|
2366 | b->yy_buffer_status = YY_BUFFER_NEW;
|
---|
2367 |
|
---|
2368 | yy_switch_to_buffer( b );
|
---|
2369 |
|
---|
2370 | return b;
|
---|
2371 | }
|
---|
2372 | #endif
|
---|
2373 |
|
---|
2374 |
|
---|
2375 | #ifndef YY_NO_SCAN_STRING
|
---|
2376 | #ifdef YY_USE_PROTOS
|
---|
2377 | YY_BUFFER_STATE yy_scan_string( yyconst char *str )
|
---|
2378 | #else
|
---|
2379 | YY_BUFFER_STATE yy_scan_string( str )
|
---|
2380 | yyconst char *str;
|
---|
2381 | #endif
|
---|
2382 | {
|
---|
2383 | int len;
|
---|
2384 | for ( len = 0; str[len]; ++len )
|
---|
2385 | ;
|
---|
2386 |
|
---|
2387 | return yy_scan_bytes( str, len );
|
---|
2388 | }
|
---|
2389 | #endif
|
---|
2390 |
|
---|
2391 |
|
---|
2392 | #ifndef YY_NO_SCAN_BYTES
|
---|
2393 | #ifdef YY_USE_PROTOS
|
---|
2394 | YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
|
---|
2395 | #else
|
---|
2396 | YY_BUFFER_STATE yy_scan_bytes( bytes, len )
|
---|
2397 | yyconst char *bytes;
|
---|
2398 | int len;
|
---|
2399 | #endif
|
---|
2400 | {
|
---|
2401 | YY_BUFFER_STATE b;
|
---|
2402 | char *buf;
|
---|
2403 | yy_size_t n;
|
---|
2404 | int i;
|
---|
2405 |
|
---|
2406 | /* Get memory for full buffer, including space for trailing EOB's. */
|
---|
2407 | n = len + 2;
|
---|
2408 | buf = (char *) yy_flex_alloc( n );
|
---|
2409 | if ( ! buf )
|
---|
2410 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
|
---|
2411 |
|
---|
2412 | for ( i = 0; i < len; ++i )
|
---|
2413 | buf[i] = bytes[i];
|
---|
2414 |
|
---|
2415 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
|
---|
2416 |
|
---|
2417 | b = yy_scan_buffer( buf, n );
|
---|
2418 | if ( ! b )
|
---|
2419 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
|
---|
2420 |
|
---|
2421 | /* It's okay to grow etc. this buffer, and we should throw it
|
---|
2422 | * away when we're done.
|
---|
2423 | */
|
---|
2424 | b->yy_is_our_buffer = 1;
|
---|
2425 |
|
---|
2426 | return b;
|
---|
2427 | }
|
---|
2428 | #endif
|
---|
2429 |
|
---|
2430 |
|
---|
2431 | #ifndef YY_NO_PUSH_STATE
|
---|
2432 | #ifdef YY_USE_PROTOS
|
---|
2433 | static void yy_push_state( int new_state )
|
---|
2434 | #else
|
---|
2435 | static void yy_push_state( new_state )
|
---|
2436 | int new_state;
|
---|
2437 | #endif
|
---|
2438 | {
|
---|
2439 | if ( yy_start_stack_ptr >= yy_start_stack_depth )
|
---|
2440 | {
|
---|
2441 | yy_size_t new_size;
|
---|
2442 |
|
---|
2443 | yy_start_stack_depth += YY_START_STACK_INCR;
|
---|
2444 | new_size = yy_start_stack_depth * sizeof( int );
|
---|
2445 |
|
---|
2446 | if ( ! yy_start_stack )
|
---|
2447 | yy_start_stack = (int *) yy_flex_alloc( new_size );
|
---|
2448 |
|
---|
2449 | else
|
---|
2450 | yy_start_stack = (int *) yy_flex_realloc(
|
---|
2451 | (void *) yy_start_stack, new_size );
|
---|
2452 |
|
---|
2453 | if ( ! yy_start_stack )
|
---|
2454 | YY_FATAL_ERROR(
|
---|
2455 | "out of memory expanding start-condition stack" );
|
---|
2456 | }
|
---|
2457 |
|
---|
2458 | yy_start_stack[yy_start_stack_ptr++] = YY_START;
|
---|
2459 |
|
---|
2460 | BEGIN(new_state);
|
---|
2461 | }
|
---|
2462 | #endif
|
---|
2463 |
|
---|
2464 |
|
---|
2465 | #ifndef YY_NO_POP_STATE
|
---|
2466 | static void yy_pop_state()
|
---|
2467 | {
|
---|
2468 | if ( --yy_start_stack_ptr < 0 )
|
---|
2469 | YY_FATAL_ERROR( "start-condition stack underflow" );
|
---|
2470 |
|
---|
2471 | BEGIN(yy_start_stack[yy_start_stack_ptr]);
|
---|
2472 | }
|
---|
2473 | #endif
|
---|
2474 |
|
---|
2475 |
|
---|
2476 | #ifndef YY_NO_TOP_STATE
|
---|
2477 | static int yy_top_state()
|
---|
2478 | {
|
---|
2479 | return yy_start_stack[yy_start_stack_ptr - 1];
|
---|
2480 | }
|
---|
2481 | #endif
|
---|
2482 |
|
---|
2483 | #ifndef YY_EXIT_FAILURE
|
---|
2484 | #define YY_EXIT_FAILURE 2
|
---|
2485 | #endif
|
---|
2486 |
|
---|
2487 | #ifdef YY_USE_PROTOS
|
---|
2488 | static void yy_fatal_error( yyconst char msg[] )
|
---|
2489 | #else
|
---|
2490 | static void yy_fatal_error( msg )
|
---|
2491 | char msg[];
|
---|
2492 | #endif
|
---|
2493 | {
|
---|
2494 | (void) fprintf( stderr, "%s\n", msg );
|
---|
2495 | exit( YY_EXIT_FAILURE );
|
---|
2496 | }
|
---|
2497 |
|
---|
2498 |
|
---|
2499 |
|
---|
2500 | /* Redefine yyless() so it works in section 3 code. */
|
---|
2501 |
|
---|
2502 | #undef yyless
|
---|
2503 | #define yyless(n) \
|
---|
2504 | do \
|
---|
2505 | { \
|
---|
2506 | /* Undo effects of setting up yytext. */ \
|
---|
2507 | yytext[yyleng] = yy_hold_char; \
|
---|
2508 | yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
|
---|
2509 | yy_hold_char = *yy_c_buf_p; \
|
---|
2510 | *yy_c_buf_p = '\0'; \
|
---|
2511 | yyleng = n; \
|
---|
2512 | } \
|
---|
2513 | while ( 0 )
|
---|
2514 |
|
---|
2515 |
|
---|
2516 | /* Internal utility routines. */
|
---|
2517 |
|
---|
2518 | #ifndef yytext_ptr
|
---|
2519 | #ifdef YY_USE_PROTOS
|
---|
2520 | static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
|
---|
2521 | #else
|
---|
2522 | static void yy_flex_strncpy( s1, s2, n )
|
---|
2523 | char *s1;
|
---|
2524 | yyconst char *s2;
|
---|
2525 | int n;
|
---|
2526 | #endif
|
---|
2527 | {
|
---|
2528 | register int i;
|
---|
2529 | for ( i = 0; i < n; ++i )
|
---|
2530 | s1[i] = s2[i];
|
---|
2531 | }
|
---|
2532 | #endif
|
---|
2533 |
|
---|
2534 |
|
---|
2535 | #ifdef YY_USE_PROTOS
|
---|
2536 | static void *yy_flex_alloc( yy_size_t size )
|
---|
2537 | #else
|
---|
2538 | static void *yy_flex_alloc( size )
|
---|
2539 | yy_size_t size;
|
---|
2540 | #endif
|
---|
2541 | {
|
---|
2542 | return (void *) malloc( size );
|
---|
2543 | }
|
---|
2544 |
|
---|
2545 | #ifdef YY_USE_PROTOS
|
---|
2546 | static void *yy_flex_realloc( void *ptr, yy_size_t size )
|
---|
2547 | #else
|
---|
2548 | static void *yy_flex_realloc( ptr, size )
|
---|
2549 | void *ptr;
|
---|
2550 | yy_size_t size;
|
---|
2551 | #endif
|
---|
2552 | {
|
---|
2553 | /* The cast to (char *) in the following accommodates both
|
---|
2554 | * implementations that use char* generic pointers, and those
|
---|
2555 | * that use void* generic pointers. It works with the latter
|
---|
2556 | * because both ANSI C and C++ allow castless assignment from
|
---|
2557 | * any pointer type to void*, and deal with argument conversions
|
---|
2558 | * as though doing an assignment.
|
---|
2559 | */
|
---|
2560 | return (void *) realloc( (char *) ptr, size );
|
---|
2561 | }
|
---|
2562 |
|
---|
2563 | #ifdef YY_USE_PROTOS
|
---|
2564 | static void yy_flex_free( void *ptr )
|
---|
2565 | #else
|
---|
2566 | static void yy_flex_free( ptr )
|
---|
2567 | void *ptr;
|
---|
2568 | #endif
|
---|
2569 | {
|
---|
2570 | free( ptr );
|
---|
2571 | }
|
---|
2572 |
|
---|
2573 | #if YY_MAIN
|
---|
2574 | int main()
|
---|
2575 | {
|
---|
2576 | yylex();
|
---|
2577 | return 0;
|
---|
2578 | }
|
---|
2579 | #endif
|
---|
2580 | #line 565 "parser.l"
|
---|
2581 |
|
---|
2582 |
|
---|
2583 | #ifndef yywrap
|
---|
2584 | int yywrap(void)
|
---|
2585 | {
|
---|
2586 | #if 0
|
---|
2587 | if(bufferstackidx > 0)
|
---|
2588 | {
|
---|
2589 | return 0;
|
---|
2590 | }
|
---|
2591 | #endif
|
---|
2592 | return 1;
|
---|
2593 | }
|
---|
2594 | #endif
|
---|
2595 |
|
---|
2596 | /* These dup functions copy the enclosed '\0' from
|
---|
2597 | * the resource string.
|
---|
2598 | */
|
---|
2599 | static void addcchar(char c)
|
---|
2600 | {
|
---|
2601 | if(cbufidx >= cbufalloc)
|
---|
2602 | {
|
---|
2603 | cbufalloc += 1024;
|
---|
2604 | cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
|
---|
2605 | if(cbufalloc > 65536)
|
---|
2606 | yywarning("Reallocating string buffer larger than 64kB");
|
---|
2607 | }
|
---|
2608 | cbuffer[cbufidx++] = c;
|
---|
2609 | }
|
---|
2610 |
|
---|
2611 | static void addwchar(short s)
|
---|
2612 | {
|
---|
2613 | if(wbufidx >= wbufalloc)
|
---|
2614 | {
|
---|
2615 | wbufalloc += 1024;
|
---|
2616 | wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
|
---|
2617 | if(wbufalloc > 65536)
|
---|
2618 | yywarning("Reallocating wide string buffer larger than 64kB");
|
---|
2619 | }
|
---|
2620 |
|
---|
2621 | /*
|
---|
2622 | * BS 08-Aug-1999 FIXME: The '& 0xff' is probably a bug, but I have
|
---|
2623 | * not experienced it yet and I seem to remember that this was for
|
---|
2624 | * a reason. But, as so many things you tend to forget why.
|
---|
2625 | * I guess that there were problems due to the sign extension of
|
---|
2626 | * shorts WRT chars (e.g. 0x80 becomes 0xff80 instead of 0x0080).
|
---|
2627 | * This should then be fixed in the lexer calling the function.
|
---|
2628 | */
|
---|
2629 | wbuffer[wbufidx++] = (short)(s & 0xff);
|
---|
2630 | }
|
---|
2631 |
|
---|
2632 | static string_t *get_buffered_cstring(void)
|
---|
2633 | {
|
---|
2634 | string_t *str = new_string();
|
---|
2635 | str->size = cbufidx;
|
---|
2636 | str->type = str_char;
|
---|
2637 | str->str.cstr = (char *)xmalloc(cbufidx+1);
|
---|
2638 | memcpy(str->str.cstr, cbuffer, cbufidx);
|
---|
2639 | str->str.cstr[cbufidx] = '\0';
|
---|
2640 | return str;
|
---|
2641 | }
|
---|
2642 |
|
---|
2643 | static string_t *get_buffered_wstring(void)
|
---|
2644 | {
|
---|
2645 | string_t *str = new_string();
|
---|
2646 | str->size = wbufidx;
|
---|
2647 | str->type = str_unicode;
|
---|
2648 | str->str.wstr = (short *)xmalloc(2*(wbufidx+1));
|
---|
2649 | memcpy(str->str.wstr, wbuffer, wbufidx);
|
---|
2650 | str->str.wstr[wbufidx] = 0;
|
---|
2651 | return str;
|
---|
2652 | }
|
---|
2653 |
|
---|
2654 | static string_t *make_string(char *s)
|
---|
2655 | {
|
---|
2656 | string_t *str = new_string();
|
---|
2657 | str->size = strlen(s);
|
---|
2658 | str->type = str_char;
|
---|
2659 | str->str.cstr = (char *)xmalloc(str->size+1);
|
---|
2660 | memcpy(str->str.cstr, s, str->size+1);
|
---|
2661 | return str;
|
---|
2662 | }
|
---|
2663 |
|
---|
2664 | /* Called from the parser to kill c-junk */
|
---|
2665 | void strip_extern(void)
|
---|
2666 | {
|
---|
2667 | cjunk_tagline = line_number;
|
---|
2668 | yy_push_state(pp_stripe);
|
---|
2669 | }
|
---|
2670 |
|
---|
2671 | void strip_til_semicolon(void)
|
---|
2672 | {
|
---|
2673 | cjunk_tagline = line_number;
|
---|
2674 | yy_push_state(pp_strips);
|
---|
2675 | }
|
---|
2676 |
|
---|
2677 | void strip_til_parenthesis(void)
|
---|
2678 | {
|
---|
2679 | cjunk_tagline = line_number;
|
---|
2680 | stripplevel = 1; /* One scanned already */
|
---|
2681 | yy_push_state(pp_stripp);
|
---|
2682 | }
|
---|
2683 |
|
---|