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