Commit | Line | Data |
---|---|---|
1c15e888 C |
1 | /* A lexical scanner generated by flex */ |
2 | ||
3 | /* scanner skeleton version: | |
4 | * | |
5 | * $Header: flex/RCS/flex.skel,v 2.13 90/05/26 17:24:13 vern Exp $ | |
6 | * | |
ad787160 | 7 | * @(#)lex.skel 8.1 (Berkeley) 6/6/93 |
1c15e888 C |
8 | */ |
9 | ||
10 | #define FLEX_SCANNER | |
11 | ||
12 | #include <stdio.h> | |
ad787160 | 13 | #include <stdlib.h> |
1c15e888 C |
14 | |
15 | #ifdef __STDC__ | |
16 | ||
1c15e888 | 17 | #define YY_USE_PROTOS |
1c15e888 C |
18 | #endif |
19 | ||
20 | ||
21 | /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ | |
22 | #ifdef c_plusplus | |
23 | #ifndef __cplusplus | |
24 | #define __cplusplus | |
25 | #endif | |
26 | #endif | |
27 | ||
28 | ||
29 | #ifdef __cplusplus | |
30 | ||
1c15e888 C |
31 | #include <osfcn.h> |
32 | ||
33 | /* use prototypes in function declarations */ | |
34 | #define YY_USE_PROTOS | |
35 | ||
1c15e888 C |
36 | #endif |
37 | ||
38 | ||
39 | #ifdef YY_USE_PROTOS | |
40 | #define YY_PROTO(proto) proto | |
41 | #else | |
42 | #define YY_PROTO(proto) () | |
1c15e888 C |
43 | #endif |
44 | ||
45 | ||
46 | /* amount of stuff to slurp up with each read */ | |
47 | #ifndef YY_READ_BUF_SIZE | |
48 | #define YY_READ_BUF_SIZE 8192 | |
49 | #endif | |
50 | ||
51 | /* returned upon end-of-file */ | |
52 | #define YY_END_TOK 0 | |
53 | ||
54 | /* copy whatever the last rule matched to the standard output */ | |
55 | ||
56 | /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ | |
57 | /* this used to be an fputs(), but since the string might contain NUL's, | |
58 | * we now use fwrite() | |
59 | */ | |
60 | #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) | |
61 | ||
62 | /* gets input and stuffs it into "buf". number of characters read, or YY_NULL, | |
63 | * is returned in "result". | |
64 | */ | |
65 | #define YY_INPUT(buf,result,max_size) \ | |
66 | if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ | |
67 | YY_FATAL_ERROR( "read() in flex scanner failed" ); | |
68 | #define YY_NULL 0 | |
69 | ||
70 | /* no semi-colon after return; correct usage is to write "yyterminate();" - | |
71 | * we don't want an extra ';' after the "return" because that will cause | |
72 | * some compilers to complain about unreachable statements. | |
73 | */ | |
74 | #define yyterminate() return ( YY_NULL ) | |
75 | ||
76 | /* report a fatal error */ | |
77 | ||
78 | /* The funky do-while is used to turn this macro definition into | |
79 | * a single C statement (which needs a semi-colon terminator). | |
80 | * This avoids problems with code like: | |
81 | * | |
82 | * if ( something_happens ) | |
83 | * YY_FATAL_ERROR( "oops, the something happened" ); | |
84 | * else | |
85 | * everything_okay(); | |
86 | * | |
87 | * Prior to using the do-while the compiler would get upset at the | |
88 | * "else" because it interpreted the "if" statement as being all | |
89 | * done when it reached the ';' after the YY_FATAL_ERROR() call. | |
90 | */ | |
91 | ||
92 | #define YY_FATAL_ERROR(msg) \ | |
93 | do \ | |
94 | { \ | |
95 | (void) fputs( msg, stderr ); \ | |
96 | (void) putc( '\n', stderr ); \ | |
97 | exit( 1 ); \ | |
98 | } \ | |
99 | while ( 0 ) | |
100 | ||
1c15e888 C |
101 | /* enter a start condition. This macro really ought to take a parameter, |
102 | * but we do it the disgusting crufty way forced on us by the ()-less | |
103 | * definition of BEGIN | |
104 | */ | |
105 | #define BEGIN yy_start = 1 + 2 * | |
106 | ||
107 | /* action number for EOF rule of a given start state */ | |
108 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | |
109 | ||
110 | /* special action meaning "start processing a new file" */ | |
111 | #define YY_NEW_FILE \ | |
112 | do \ | |
113 | { \ | |
114 | yy_init_buffer( yy_current_buffer, yyin ); \ | |
115 | yy_load_buffer_state(); \ | |
116 | } \ | |
117 | while ( 0 ) | |
118 | ||
119 | /* default declaration of generated scanner - a define so the user can | |
120 | * easily add parameters | |
121 | */ | |
122 | #define YY_DECL int yylex YY_PROTO(( void )) | |
123 | ||
124 | /* code executed at the end of each rule */ | |
125 | #define YY_BREAK break; | |
126 | ||
127 | #define YY_END_OF_BUFFER_CHAR 0 | |
128 | ||
129 | #ifndef YY_BUF_SIZE | |
130 | #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ | |
131 | #endif | |
132 | ||
133 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | |
134 | ||
135 | %% section 1 definitions go here | |
136 | ||
137 | /* done after the current pattern has been matched and before the | |
138 | * corresponding action - sets up yytext | |
139 | */ | |
140 | #define YY_DO_BEFORE_ACTION \ | |
141 | yytext = yy_bp; \ | |
142 | %% code to fiddle yytext and yyleng for yymore() goes here | |
143 | yy_hold_char = *yy_cp; \ | |
144 | *yy_cp = '\0'; \ | |
145 | yy_c_buf_p = yy_cp; | |
146 | ||
147 | #define EOB_ACT_CONTINUE_SCAN 0 | |
148 | #define EOB_ACT_END_OF_FILE 1 | |
149 | #define EOB_ACT_LAST_MATCH 2 | |
150 | ||
151 | /* return all but the first 'n' matched characters back to the input stream */ | |
152 | #define yyless(n) \ | |
153 | do \ | |
154 | { \ | |
155 | /* undo effects of setting up yytext */ \ | |
156 | *yy_cp = yy_hold_char; \ | |
157 | yy_c_buf_p = yy_cp = yy_bp + n; \ | |
158 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | |
159 | } \ | |
160 | while ( 0 ) | |
161 | ||
162 | #define unput(c) yyunput( c, yytext ) | |
163 | ||
164 | ||
165 | struct yy_buffer_state | |
166 | { | |
167 | FILE *yy_input_file; | |
168 | ||
169 | YY_CHAR *yy_ch_buf; /* input buffer */ | |
170 | YY_CHAR *yy_buf_pos; /* current position in input buffer */ | |
171 | ||
172 | /* size of input buffer in bytes, not including room for EOB characters*/ | |
173 | int yy_buf_size; | |
174 | ||
175 | /* number of characters read into yy_ch_buf, not including EOB characters */ | |
176 | int yy_n_chars; | |
177 | ||
178 | int yy_eof_status; /* whether we've seen an EOF on this buffer */ | |
179 | #define EOF_NOT_SEEN 0 | |
180 | /* "pending" happens when the EOF has been seen but there's still | |
181 | * some text process | |
182 | */ | |
183 | #define EOF_PENDING 1 | |
184 | #define EOF_DONE 2 | |
185 | }; | |
186 | ||
187 | static YY_BUFFER_STATE yy_current_buffer; | |
188 | ||
189 | /* we provide macros for accessing buffer states in case in the | |
190 | * future we want to put the buffer states in a more general | |
191 | * "scanner state" | |
192 | */ | |
193 | #define YY_CURRENT_BUFFER yy_current_buffer | |
194 | ||
195 | ||
196 | /* yy_hold_char holds the character lost when yytext is formed */ | |
197 | static YY_CHAR yy_hold_char; | |
198 | ||
199 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | |
200 | ||
201 | ||
202 | ||
203 | #ifndef YY_USER_ACTION | |
204 | #define YY_USER_ACTION | |
205 | #endif | |
206 | ||
207 | #ifndef YY_USER_INIT | |
208 | #define YY_USER_INIT | |
209 | #endif | |
210 | ||
211 | extern YY_CHAR *yytext; | |
212 | extern int yyleng; | |
213 | extern FILE *yyin, *yyout; | |
214 | ||
215 | YY_CHAR *yytext; | |
216 | int yyleng; | |
217 | ||
218 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | |
219 | ||
220 | %% data tables for the DFA go here | |
221 | ||
222 | /* these variables are all declared out here so that section 3 code can | |
223 | * manipulate them | |
224 | */ | |
225 | /* points to current character in buffer */ | |
226 | static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; | |
227 | static int yy_init = 1; /* whether we need to initialize */ | |
228 | static int yy_start = 0; /* start state number */ | |
229 | ||
230 | /* flag which is used to allow yywrap()'s to do buffer switches | |
231 | * instead of setting up a fresh yyin. A bit of a hack ... | |
232 | */ | |
233 | static int yy_did_buffer_switch_on_eof; | |
234 | ||
235 | static yy_state_type yy_get_previous_state YY_PROTO(( void )); | |
236 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); | |
237 | static int yy_get_next_buffer YY_PROTO(( void )); | |
238 | static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); | |
239 | void yyrestart YY_PROTO(( FILE *input_file )); | |
240 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); | |
241 | void yy_load_buffer_state YY_PROTO(( void )); | |
242 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); | |
243 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); | |
244 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); | |
245 | ||
246 | #define yy_new_buffer yy_create_buffer | |
247 | ||
248 | #ifdef __cplusplus | |
249 | static int yyinput YY_PROTO(( void )); | |
250 | #else | |
251 | static int input YY_PROTO(( void )); | |
252 | #endif | |
253 | ||
254 | YY_DECL | |
255 | { | |
256 | register yy_state_type yy_current_state; | |
257 | register YY_CHAR *yy_cp, *yy_bp; | |
258 | register int yy_act; | |
259 | ||
260 | %% user's declarations go here | |
261 | ||
262 | if ( yy_init ) | |
263 | { | |
264 | YY_USER_INIT; | |
265 | ||
266 | if ( ! yy_start ) | |
267 | yy_start = 1; /* first start state */ | |
268 | ||
269 | if ( ! yyin ) | |
270 | yyin = stdin; | |
271 | ||
272 | if ( ! yyout ) | |
273 | yyout = stdout; | |
274 | ||
275 | if ( yy_current_buffer ) | |
276 | yy_init_buffer( yy_current_buffer, yyin ); | |
277 | else | |
278 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); | |
279 | ||
280 | yy_load_buffer_state(); | |
281 | ||
282 | yy_init = 0; | |
283 | } | |
284 | ||
285 | while ( 1 ) /* loops until end-of-file is reached */ | |
286 | { | |
287 | %% yymore()-related code goes here | |
288 | yy_cp = yy_c_buf_p; | |
289 | ||
290 | /* support of yytext */ | |
291 | *yy_cp = yy_hold_char; | |
292 | ||
293 | /* yy_bp points to the position in yy_ch_buf of the start of the | |
294 | * current run. | |
295 | */ | |
296 | yy_bp = yy_cp; | |
297 | ||
298 | %% code to set up and find next match goes here | |
299 | ||
300 | yy_find_action: | |
301 | %% code to find the action number goes here | |
302 | ||
303 | YY_DO_BEFORE_ACTION; | |
304 | YY_USER_ACTION; | |
305 | ||
306 | do_action: /* this label is used only to access EOF actions */ | |
307 | ||
308 | %% debug code goes here | |
309 | ||
310 | switch ( yy_act ) | |
311 | { | |
312 | %% actions go here | |
313 | ||
314 | case YY_END_OF_BUFFER: | |
315 | { | |
316 | /* amount of text matched not including the EOB char */ | |
317 | int yy_amount_of_matched_text = yy_cp - yytext - 1; | |
318 | ||
319 | /* undo the effects of YY_DO_BEFORE_ACTION */ | |
320 | *yy_cp = yy_hold_char; | |
321 | ||
322 | /* note that here we test for yy_c_buf_p "<=" to the position | |
323 | * of the first EOB in the buffer, since yy_c_buf_p will | |
324 | * already have been incremented past the NUL character | |
325 | * (since all states make transitions on EOB to the end- | |
326 | * of-buffer state). Contrast this with the test in yyinput(). | |
327 | */ | |
328 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | |
329 | /* this was really a NUL */ | |
330 | { | |
331 | yy_state_type yy_next_state; | |
332 | ||
333 | yy_c_buf_p = yytext + yy_amount_of_matched_text; | |
334 | ||
335 | yy_current_state = yy_get_previous_state(); | |
336 | ||
337 | /* okay, we're now positioned to make the | |
338 | * NUL transition. We couldn't have | |
339 | * yy_get_previous_state() go ahead and do it | |
340 | * for us because it doesn't know how to deal | |
341 | * with the possibility of jamming (and we | |
342 | * don't want to build jamming into it because | |
343 | * then it will run more slowly) | |
344 | */ | |
345 | ||
346 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | |
347 | ||
348 | yy_bp = yytext + YY_MORE_ADJ; | |
349 | ||
350 | if ( yy_next_state ) | |
351 | { | |
352 | /* consume the NUL */ | |
353 | yy_cp = ++yy_c_buf_p; | |
354 | yy_current_state = yy_next_state; | |
355 | goto yy_match; | |
356 | } | |
357 | ||
358 | else | |
359 | { | |
360 | %% code to do backtracking for compressed tables and set up yy_cp goes here | |
361 | goto yy_find_action; | |
362 | } | |
363 | } | |
364 | ||
365 | else switch ( yy_get_next_buffer() ) | |
366 | { | |
367 | case EOB_ACT_END_OF_FILE: | |
368 | { | |
369 | yy_did_buffer_switch_on_eof = 0; | |
370 | ||
371 | if ( yywrap() ) | |
372 | { | |
373 | /* note: because we've taken care in | |
374 | * yy_get_next_buffer() to have set up yytext, | |
375 | * we can now set up yy_c_buf_p so that if some | |
376 | * total hoser (like flex itself) wants | |
377 | * to call the scanner after we return the | |
378 | * YY_NULL, it'll still work - another YY_NULL | |
379 | * will get returned. | |
380 | */ | |
381 | yy_c_buf_p = yytext + YY_MORE_ADJ; | |
382 | ||
383 | yy_act = YY_STATE_EOF((yy_start - 1) / 2); | |
384 | goto do_action; | |
385 | } | |
386 | ||
387 | else | |
388 | { | |
389 | if ( ! yy_did_buffer_switch_on_eof ) | |
390 | YY_NEW_FILE; | |
391 | } | |
392 | } | |
393 | break; | |
394 | ||
395 | case EOB_ACT_CONTINUE_SCAN: | |
396 | yy_c_buf_p = yytext + yy_amount_of_matched_text; | |
397 | ||
398 | yy_current_state = yy_get_previous_state(); | |
399 | ||
400 | yy_cp = yy_c_buf_p; | |
401 | yy_bp = yytext + YY_MORE_ADJ; | |
402 | goto yy_match; | |
403 | ||
404 | case EOB_ACT_LAST_MATCH: | |
405 | yy_c_buf_p = | |
406 | &yy_current_buffer->yy_ch_buf[yy_n_chars]; | |
407 | ||
408 | yy_current_state = yy_get_previous_state(); | |
409 | ||
410 | yy_cp = yy_c_buf_p; | |
411 | yy_bp = yytext + YY_MORE_ADJ; | |
412 | goto yy_find_action; | |
413 | } | |
414 | break; | |
415 | } | |
416 | ||
417 | default: | |
418 | #ifdef FLEX_DEBUG | |
419 | printf( "action # %d\n", yy_act ); | |
420 | #endif | |
421 | YY_FATAL_ERROR( | |
422 | "fatal flex scanner internal error--no action found" ); | |
423 | } | |
424 | } | |
425 | } | |
426 | ||
427 | ||
428 | /* yy_get_next_buffer - try to read in a new buffer | |
429 | * | |
430 | * synopsis | |
431 | * int yy_get_next_buffer(); | |
432 | * | |
433 | * returns a code representing an action | |
434 | * EOB_ACT_LAST_MATCH - | |
435 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | |
436 | * EOB_ACT_END_OF_FILE - end of file | |
437 | */ | |
438 | ||
439 | static int yy_get_next_buffer() | |
440 | ||
441 | { | |
442 | register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; | |
443 | register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ | |
444 | register int number_to_move, i; | |
445 | int ret_val; | |
446 | ||
447 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) | |
448 | YY_FATAL_ERROR( | |
449 | "fatal flex scanner internal error--end of buffer missed" ); | |
450 | ||
451 | /* try to read more data */ | |
452 | ||
453 | /* first move last chars to start of buffer */ | |
454 | number_to_move = yy_c_buf_p - yytext; | |
455 | ||
456 | for ( i = 0; i < number_to_move; ++i ) | |
457 | *(dest++) = *(source++); | |
458 | ||
459 | if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) | |
460 | /* don't do the read, it's not guaranteed to return an EOF, | |
461 | * just force an EOF | |
462 | */ | |
463 | yy_n_chars = 0; | |
464 | ||
465 | else | |
466 | { | |
467 | int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; | |
468 | ||
469 | if ( num_to_read > YY_READ_BUF_SIZE ) | |
470 | num_to_read = YY_READ_BUF_SIZE; | |
471 | ||
472 | else if ( num_to_read <= 0 ) | |
473 | YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); | |
474 | ||
475 | /* read in more data */ | |
476 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), | |
477 | yy_n_chars, num_to_read ); | |
478 | } | |
479 | ||
480 | if ( yy_n_chars == 0 ) | |
481 | { | |
ad787160 | 482 | if ( number_to_move - YY_MORE_ADJ == 1 ) |
1c15e888 C |
483 | { |
484 | ret_val = EOB_ACT_END_OF_FILE; | |
485 | yy_current_buffer->yy_eof_status = EOF_DONE; | |
486 | } | |
487 | ||
488 | else | |
489 | { | |
490 | ret_val = EOB_ACT_LAST_MATCH; | |
491 | yy_current_buffer->yy_eof_status = EOF_PENDING; | |
492 | } | |
493 | } | |
494 | ||
495 | else | |
496 | ret_val = EOB_ACT_CONTINUE_SCAN; | |
497 | ||
498 | yy_n_chars += number_to_move; | |
499 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; | |
500 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; | |
501 | ||
502 | /* yytext begins at the second character in yy_ch_buf; the first | |
503 | * character is the one which preceded it before reading in the latest | |
504 | * buffer; it needs to be kept around in case it's a newline, so | |
505 | * yy_get_previous_state() will have with '^' rules active | |
506 | */ | |
507 | ||
508 | yytext = &yy_current_buffer->yy_ch_buf[1]; | |
509 | ||
510 | return ( ret_val ); | |
511 | } | |
512 | ||
513 | ||
514 | /* yy_get_previous_state - get the state just before the EOB char was reached | |
515 | * | |
516 | * synopsis | |
517 | * yy_state_type yy_get_previous_state(); | |
518 | */ | |
519 | ||
520 | static yy_state_type yy_get_previous_state() | |
521 | ||
522 | { | |
523 | register yy_state_type yy_current_state; | |
524 | register YY_CHAR *yy_cp; | |
525 | ||
526 | %% code to get the start state into yy_current_state goes here | |
527 | ||
528 | for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) | |
529 | { | |
530 | %% code to find the next state goes here | |
531 | } | |
532 | ||
533 | return ( yy_current_state ); | |
534 | } | |
535 | ||
536 | ||
537 | /* yy_try_NUL_trans - try to make a transition on the NUL character | |
538 | * | |
539 | * synopsis | |
540 | * next_state = yy_try_NUL_trans( current_state ); | |
541 | */ | |
542 | ||
543 | #ifdef YY_USE_PROTOS | |
544 | static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) | |
545 | #else | |
546 | static yy_state_type yy_try_NUL_trans( yy_current_state ) | |
547 | register yy_state_type yy_current_state; | |
548 | #endif | |
549 | ||
550 | { | |
551 | register int yy_is_jam; | |
552 | %% code to find the next state, and perhaps do backtracking, goes here | |
553 | ||
554 | return ( yy_is_jam ? 0 : yy_current_state ); | |
555 | } | |
556 | ||
557 | ||
558 | #ifdef YY_USE_PROTOS | |
559 | static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) | |
560 | #else | |
561 | static void yyunput( c, yy_bp ) | |
562 | YY_CHAR c; | |
563 | register YY_CHAR *yy_bp; | |
564 | #endif | |
565 | ||
566 | { | |
567 | register YY_CHAR *yy_cp = yy_c_buf_p; | |
568 | ||
569 | /* undo effects of setting up yytext */ | |
570 | *yy_cp = yy_hold_char; | |
571 | ||
572 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | |
573 | { /* need to shift things up to make room */ | |
574 | register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ | |
575 | register YY_CHAR *dest = | |
576 | &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; | |
577 | register YY_CHAR *source = | |
578 | &yy_current_buffer->yy_ch_buf[number_to_move]; | |
579 | ||
580 | while ( source > yy_current_buffer->yy_ch_buf ) | |
581 | *--dest = *--source; | |
582 | ||
583 | yy_cp += dest - source; | |
584 | yy_bp += dest - source; | |
585 | yy_n_chars = yy_current_buffer->yy_buf_size; | |
586 | ||
587 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | |
588 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | |
589 | } | |
590 | ||
591 | if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) | |
592 | yy_cp[-2] = '\n'; | |
593 | ||
594 | *--yy_cp = c; | |
595 | ||
596 | /* note: the formal parameter *must* be called "yy_bp" for this | |
597 | * macro to now work correctly | |
598 | */ | |
599 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | |
600 | } | |
601 | ||
602 | ||
603 | #ifdef __cplusplus | |
604 | static int yyinput() | |
605 | #else | |
606 | static int input() | |
607 | #endif | |
608 | ||
609 | { | |
610 | int c; | |
611 | YY_CHAR *yy_cp = yy_c_buf_p; | |
612 | ||
613 | *yy_cp = yy_hold_char; | |
614 | ||
615 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) | |
616 | { | |
617 | /* yy_c_buf_p now points to the character we want to return. | |
618 | * If this occurs *before* the EOB characters, then it's a | |
619 | * valid NUL; if not, then we've hit the end of the buffer. | |
620 | */ | |
621 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | |
622 | /* this was really a NUL */ | |
623 | *yy_c_buf_p = '\0'; | |
624 | ||
625 | else | |
626 | { /* need more input */ | |
627 | yytext = yy_c_buf_p; | |
628 | ++yy_c_buf_p; | |
629 | ||
630 | switch ( yy_get_next_buffer() ) | |
631 | { | |
632 | case EOB_ACT_END_OF_FILE: | |
633 | { | |
634 | if ( yywrap() ) | |
635 | { | |
636 | yy_c_buf_p = yytext + YY_MORE_ADJ; | |
637 | return ( EOF ); | |
638 | } | |
639 | ||
640 | YY_NEW_FILE; | |
641 | ||
642 | #ifdef __cplusplus | |
643 | return ( yyinput() ); | |
644 | #else | |
645 | return ( input() ); | |
646 | #endif | |
647 | } | |
648 | break; | |
649 | ||
650 | case EOB_ACT_CONTINUE_SCAN: | |
651 | yy_c_buf_p = yytext + YY_MORE_ADJ; | |
652 | break; | |
653 | ||
654 | case EOB_ACT_LAST_MATCH: | |
655 | #ifdef __cplusplus | |
656 | YY_FATAL_ERROR( "unexpected last match in yyinput()" ); | |
657 | #else | |
658 | YY_FATAL_ERROR( "unexpected last match in input()" ); | |
659 | #endif | |
660 | } | |
661 | } | |
662 | } | |
663 | ||
664 | c = *yy_c_buf_p; | |
665 | yy_hold_char = *++yy_c_buf_p; | |
666 | ||
667 | return ( c ); | |
668 | } | |
669 | ||
670 | ||
671 | #ifdef YY_USE_PROTOS | |
672 | void yyrestart( FILE *input_file ) | |
673 | #else | |
674 | void yyrestart( input_file ) | |
675 | FILE *input_file; | |
676 | #endif | |
677 | ||
678 | { | |
679 | yy_init_buffer( yy_current_buffer, input_file ); | |
680 | yy_load_buffer_state(); | |
681 | } | |
682 | ||
683 | ||
684 | #ifdef YY_USE_PROTOS | |
685 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) | |
686 | #else | |
687 | void yy_switch_to_buffer( new_buffer ) | |
688 | YY_BUFFER_STATE new_buffer; | |
689 | #endif | |
690 | ||
691 | { | |
692 | if ( yy_current_buffer == new_buffer ) | |
693 | return; | |
694 | ||
695 | if ( yy_current_buffer ) | |
696 | { | |
697 | /* flush out information for old buffer */ | |
698 | *yy_c_buf_p = yy_hold_char; | |
699 | yy_current_buffer->yy_buf_pos = yy_c_buf_p; | |
700 | yy_current_buffer->yy_n_chars = yy_n_chars; | |
701 | } | |
702 | ||
703 | yy_current_buffer = new_buffer; | |
704 | yy_load_buffer_state(); | |
705 | ||
706 | /* we don't actually know whether we did this switch during | |
707 | * EOF (yywrap()) processing, but the only time this flag | |
708 | * is looked at is after yywrap() is called, so it's safe | |
709 | * to go ahead and always set it. | |
710 | */ | |
711 | yy_did_buffer_switch_on_eof = 1; | |
712 | } | |
713 | ||
714 | ||
715 | #ifdef YY_USE_PROTOS | |
716 | void yy_load_buffer_state( void ) | |
717 | #else | |
718 | void yy_load_buffer_state() | |
719 | #endif | |
720 | ||
721 | { | |
722 | yy_n_chars = yy_current_buffer->yy_n_chars; | |
723 | yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; | |
724 | yyin = yy_current_buffer->yy_input_file; | |
725 | yy_hold_char = *yy_c_buf_p; | |
726 | } | |
727 | ||
728 | ||
729 | #ifdef YY_USE_PROTOS | |
730 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) | |
731 | #else | |
732 | YY_BUFFER_STATE yy_create_buffer( file, size ) | |
733 | FILE *file; | |
734 | int size; | |
735 | #endif | |
736 | ||
737 | { | |
738 | YY_BUFFER_STATE b; | |
739 | ||
740 | b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); | |
741 | ||
742 | if ( ! b ) | |
743 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
744 | ||
745 | b->yy_buf_size = size; | |
746 | ||
747 | /* yy_ch_buf has to be 2 characters longer than the size given because | |
748 | * we need to put in 2 end-of-buffer characters. | |
749 | */ | |
750 | b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); | |
751 | ||
752 | if ( ! b->yy_ch_buf ) | |
753 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
754 | ||
755 | yy_init_buffer( b, file ); | |
756 | ||
757 | return ( b ); | |
758 | } | |
759 | ||
760 | ||
761 | #ifdef YY_USE_PROTOS | |
762 | void yy_delete_buffer( YY_BUFFER_STATE b ) | |
763 | #else | |
764 | void yy_delete_buffer( b ) | |
765 | YY_BUFFER_STATE b; | |
766 | #endif | |
767 | ||
768 | { | |
769 | if ( b == yy_current_buffer ) | |
770 | yy_current_buffer = (YY_BUFFER_STATE) 0; | |
771 | ||
772 | free( (char *) b->yy_ch_buf ); | |
773 | free( (char *) b ); | |
774 | } | |
775 | ||
776 | ||
777 | #ifdef YY_USE_PROTOS | |
778 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) | |
779 | #else | |
780 | void yy_init_buffer( b, file ) | |
781 | YY_BUFFER_STATE b; | |
782 | FILE *file; | |
783 | #endif | |
784 | ||
785 | { | |
786 | b->yy_input_file = file; | |
787 | ||
788 | /* we put in the '\n' and start reading from [1] so that an | |
789 | * initial match-at-newline will be true. | |
790 | */ | |
791 | ||
792 | b->yy_ch_buf[0] = '\n'; | |
793 | b->yy_n_chars = 1; | |
794 | ||
795 | /* we always need two end-of-buffer characters. The first causes | |
796 | * a transition to the end-of-buffer state. The second causes | |
797 | * a jam in that state. | |
798 | */ | |
799 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | |
800 | b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; | |
801 | ||
802 | b->yy_buf_pos = &b->yy_ch_buf[1]; | |
803 | ||
804 | b->yy_eof_status = EOF_NOT_SEEN; | |
805 | } |