Annotation of src/usr.bin/lex/flex.skl, Revision 1.3
1.3 ! millert 1: /* $OpenBSD: flex.skl,v 1.2 1996/06/26 05:35:32 deraadt Exp $ */
1.2 deraadt 2:
1.1 deraadt 3: /* A lexical scanner generated by flex */
4:
5: /* Scanner skeleton version:
1.3 ! millert 6: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.89 96/05/25 21:02:21 vern Exp $
1.1 deraadt 7: */
8:
9: #define FLEX_SCANNER
10: #define YY_FLEX_MAJOR_VERSION 2
11: #define YY_FLEX_MINOR_VERSION 5
12:
13: %-
14: #include <stdio.h>
15: %*
16:
17:
18: /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
19: #ifdef c_plusplus
20: #ifndef __cplusplus
21: #define __cplusplus
22: #endif
23: #endif
24:
25:
26: #ifdef __cplusplus
27:
28: #include <stdlib.h>
29: %+
30: class istream;
31: %*
32: #include <unistd.h>
33:
34: /* Use prototypes in function declarations. */
35: #define YY_USE_PROTOS
36:
37: /* The "const" storage-class-modifier is valid. */
38: #define YY_USE_CONST
39:
40: #else /* ! __cplusplus */
41:
42: #if __STDC__
43:
44: #define YY_USE_PROTOS
45: #define YY_USE_CONST
46:
47: #endif /* __STDC__ */
48: #endif /* ! __cplusplus */
49:
50: #ifdef __TURBOC__
51: #pragma warn -rch
52: #pragma warn -use
53: #include <io.h>
54: #include <stdlib.h>
55: #define YY_USE_CONST
56: #define YY_USE_PROTOS
57: #endif
58:
59: #ifdef YY_USE_CONST
60: #define yyconst const
61: #else
62: #define yyconst
63: #endif
64:
65:
66: #ifdef YY_USE_PROTOS
67: #define YY_PROTO(proto) proto
68: #else
69: #define YY_PROTO(proto) ()
70: #endif
71:
72: /* Returned upon end-of-file. */
73: #define YY_NULL 0
74:
75: /* Promotes a possibly negative, possibly signed char to an unsigned
76: * integer for use as an array index. If the signed char is negative,
77: * we want to instead treat it as an 8-bit unsigned char, hence the
78: * double cast.
79: */
80: #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
81:
82: /* Enter a start condition. This macro really ought to take a parameter,
83: * but we do it the disgusting crufty way forced on us by the ()-less
84: * definition of BEGIN.
85: */
86: #define BEGIN yy_start = 1 + 2 *
87:
88: /* Translate the current start state into a value that can be later handed
89: * to BEGIN to return to the state. The YYSTATE alias is for lex
90: * compatibility.
91: */
92: #define YY_START ((yy_start - 1) / 2)
93: #define YYSTATE YY_START
94:
95: /* Action number for EOF rule of a given start state. */
96: #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
97:
98: /* Special action meaning "start processing a new file". */
99: #define YY_NEW_FILE yyrestart( yyin )
100:
101: #define YY_END_OF_BUFFER_CHAR 0
102:
103: /* Size of default input buffer. */
104: #define YY_BUF_SIZE 16384
105:
106: typedef struct yy_buffer_state *YY_BUFFER_STATE;
107:
108: extern int yyleng;
109: %-
110: extern FILE *yyin, *yyout;
111: %*
112:
113: #define EOB_ACT_CONTINUE_SCAN 0
114: #define EOB_ACT_END_OF_FILE 1
115: #define EOB_ACT_LAST_MATCH 2
116:
117: /* The funky do-while in the following #define is used to turn the definition
118: * int a single C statement (which needs a semi-colon terminator). This
119: * avoids problems with code like:
120: *
121: * if ( condition_holds )
122: * yyless( 5 );
123: * else
124: * do_something_else();
125: *
126: * Prior to using the do-while the compiler would get upset at the
127: * "else" because it interpreted the "if" statement as being all
128: * done when it reached the ';' after the yyless() call.
129: */
130:
131: /* Return all but the first 'n' matched characters back to the input stream. */
132:
133: #define yyless(n) \
134: do \
135: { \
136: /* Undo effects of setting up yytext. */ \
137: *yy_cp = yy_hold_char; \
1.3 ! millert 138: YY_RESTORE_YY_MORE_OFFSET \
1.1 deraadt 139: yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
140: YY_DO_BEFORE_ACTION; /* set up yytext again */ \
141: } \
142: while ( 0 )
143:
144: #define unput(c) yyunput( c, yytext_ptr )
145:
146: /* The following is because we cannot portably get our hands on size_t
147: * (without autoconf's help, which isn't available because we want
148: * flex-generated scanners to compile on their own).
149: */
150: typedef unsigned int yy_size_t;
151:
152:
153: struct yy_buffer_state
154: {
155: %-
156: FILE *yy_input_file;
157: %+
158: istream* yy_input_file;
159: %*
160:
161: char *yy_ch_buf; /* input buffer */
162: char *yy_buf_pos; /* current position in input buffer */
163:
164: /* Size of input buffer in bytes, not including room for EOB
165: * characters.
166: */
167: yy_size_t yy_buf_size;
168:
169: /* Number of characters read into yy_ch_buf, not including EOB
170: * characters.
171: */
172: int yy_n_chars;
173:
174: /* Whether we "own" the buffer - i.e., we know we created it,
175: * and can realloc() it to grow it, and should free() it to
176: * delete it.
177: */
178: int yy_is_our_buffer;
179:
180: /* Whether this is an "interactive" input source; if so, and
181: * if we're using stdio for input, then we want to use getc()
182: * instead of fread(), to make sure we stop fetching input after
183: * each newline.
184: */
185: int yy_is_interactive;
186:
187: /* Whether we're considered to be at the beginning of a line.
188: * If so, '^' rules will be active on the next match, otherwise
189: * not.
190: */
191: int yy_at_bol;
192:
193: /* Whether to try to fill the input buffer when we reach the
194: * end of it.
195: */
196: int yy_fill_buffer;
197:
198: int yy_buffer_status;
199: #define YY_BUFFER_NEW 0
200: #define YY_BUFFER_NORMAL 1
201: /* When an EOF's been seen but there's still some text to process
202: * then we mark the buffer as YY_EOF_PENDING, to indicate that we
203: * shouldn't try reading from the input source any more. We might
204: * still have a bunch of tokens to match, though, because of
205: * possible backing-up.
206: *
207: * When we actually see the EOF, we change the status to "new"
208: * (via yyrestart()), so that the user can continue scanning by
209: * just pointing yyin at a new input file.
210: */
211: #define YY_BUFFER_EOF_PENDING 2
212: };
213:
214: %- Standard (non-C++) definition
215: static YY_BUFFER_STATE yy_current_buffer = 0;
216: %*
217:
218: /* We provide macros for accessing buffer states in case in the
219: * future we want to put the buffer states in a more general
220: * "scanner state".
221: */
222: #define YY_CURRENT_BUFFER yy_current_buffer
223:
224:
225: %- Standard (non-C++) definition
226: /* yy_hold_char holds the character lost when yytext is formed. */
227: static char yy_hold_char;
228:
229: static int yy_n_chars; /* number of characters read into yy_ch_buf */
230:
231:
232: int yyleng;
233:
234: /* Points to current character in buffer. */
235: static char *yy_c_buf_p = (char *) 0;
236: static int yy_init = 1; /* whether we need to initialize */
237: static int yy_start = 0; /* start state number */
238:
239: /* Flag which is used to allow yywrap()'s to do buffer switches
240: * instead of setting up a fresh yyin. A bit of a hack ...
241: */
242: static int yy_did_buffer_switch_on_eof;
243:
244: void yyrestart YY_PROTO(( FILE *input_file ));
245:
246: void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
247: void yy_load_buffer_state YY_PROTO(( void ));
248: YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
249: void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
250: void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
251: void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
252: #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
253:
254: YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
255: YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
256: YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
257: %*
258:
259: static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
260: static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
261: static void yy_flex_free YY_PROTO(( void * ));
262:
263: #define yy_new_buffer yy_create_buffer
264:
265: #define yy_set_interactive(is_interactive) \
266: { \
267: if ( ! yy_current_buffer ) \
268: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
269: yy_current_buffer->yy_is_interactive = is_interactive; \
270: }
271:
272: #define yy_set_bol(at_bol) \
273: { \
274: if ( ! yy_current_buffer ) \
275: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
276: yy_current_buffer->yy_at_bol = at_bol; \
277: }
278:
279: #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
280:
281: %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
282:
283: %- Standard (non-C++) definition
284: static yy_state_type yy_get_previous_state YY_PROTO(( void ));
285: static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
286: static int yy_get_next_buffer YY_PROTO(( void ));
287: static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
288: %*
289:
290: /* Done after the current pattern has been matched and before the
291: * corresponding action - sets up yytext.
292: */
293: #define YY_DO_BEFORE_ACTION \
294: yytext_ptr = yy_bp; \
295: %% code to fiddle yytext and yyleng for yymore() goes here
296: yy_hold_char = *yy_cp; \
297: *yy_cp = '\0'; \
298: %% code to copy yytext_ptr to yytext[] goes here, if %array
299: yy_c_buf_p = yy_cp;
300:
301: %% data tables for the DFA and the user's section 1 definitions go here
302:
303: /* Macros after this point can all be overridden by user definitions in
304: * section 1.
305: */
306:
307: #ifndef YY_SKIP_YYWRAP
308: #ifdef __cplusplus
309: extern "C" int yywrap YY_PROTO(( void ));
310: #else
311: extern int yywrap YY_PROTO(( void ));
312: #endif
313: #endif
314:
315: %-
316: #ifndef YY_NO_UNPUT
317: static void yyunput YY_PROTO(( int c, char *buf_ptr ));
318: #endif
319: %*
320:
321: #ifndef yytext_ptr
322: static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
323: #endif
324:
1.3 ! millert 325: #ifdef YY_NEED_STRLEN
! 326: static int yy_flex_strlen YY_PROTO(( yyconst char * ));
! 327: #endif
! 328:
1.1 deraadt 329: #ifndef YY_NO_INPUT
330: %- Standard (non-C++) definition
331: #ifdef __cplusplus
332: static int yyinput YY_PROTO(( void ));
333: #else
334: static int input YY_PROTO(( void ));
335: #endif
336: %*
337: #endif
338:
339: #if YY_STACK_USED
340: static int yy_start_stack_ptr = 0;
341: static int yy_start_stack_depth = 0;
342: static int *yy_start_stack = 0;
343: #ifndef YY_NO_PUSH_STATE
344: static void yy_push_state YY_PROTO(( int new_state ));
345: #endif
346: #ifndef YY_NO_POP_STATE
347: static void yy_pop_state YY_PROTO(( void ));
348: #endif
349: #ifndef YY_NO_TOP_STATE
350: static int yy_top_state YY_PROTO(( void ));
351: #endif
352:
353: #else
354: #define YY_NO_PUSH_STATE 1
355: #define YY_NO_POP_STATE 1
356: #define YY_NO_TOP_STATE 1
357: #endif
358:
359: #ifdef YY_MALLOC_DECL
360: YY_MALLOC_DECL
361: #else
362: #if __STDC__
363: #ifndef __cplusplus
364: #include <stdlib.h>
365: #endif
366: #else
367: /* Just try to get by without declaring the routines. This will fail
368: * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
369: * or sizeof(void*) != sizeof(int).
370: */
371: #endif
372: #endif
373:
374: /* Amount of stuff to slurp up with each read. */
375: #ifndef YY_READ_BUF_SIZE
376: #define YY_READ_BUF_SIZE 8192
377: #endif
378:
379: /* Copy whatever the last rule matched to the standard output. */
380:
381: #ifndef ECHO
382: %- Standard (non-C++) definition
383: /* This used to be an fputs(), but since the string might contain NUL's,
384: * we now use fwrite().
385: */
386: #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
387: %+ C++ definition
388: #define ECHO LexerOutput( yytext, yyleng )
389: %*
390: #endif
391:
392: /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
393: * is returned in "result".
394: */
395: #ifndef YY_INPUT
396: #define YY_INPUT(buf,result,max_size) \
397: %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
398: %+ C++ definition
399: if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
400: YY_FATAL_ERROR( "input in flex scanner failed" );
401: %*
402: #endif
403:
404: /* No semi-colon after return; correct usage is to write "yyterminate();" -
405: * we don't want an extra ';' after the "return" because that will cause
406: * some compilers to complain about unreachable statements.
407: */
408: #ifndef yyterminate
409: #define yyterminate() return YY_NULL
410: #endif
411:
412: /* Number of entries by which start-condition stack grows. */
413: #ifndef YY_START_STACK_INCR
414: #define YY_START_STACK_INCR 25
415: #endif
416:
417: /* Report a fatal error. */
418: #ifndef YY_FATAL_ERROR
419: %-
420: #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
421: %+
422: #define YY_FATAL_ERROR(msg) LexerError( msg )
423: %*
424: #endif
425:
426: /* Default declaration of generated scanner - a define so the user can
427: * easily add parameters.
428: */
429: #ifndef YY_DECL
430: %- Standard (non-C++) definition
431: #define YY_DECL int yylex YY_PROTO(( void ))
432: %+ C++ definition
433: #define YY_DECL int yyFlexLexer::yylex()
434: %*
435: #endif
436:
437: /* Code executed at the beginning of each rule, after yytext and yyleng
438: * have been set up.
439: */
440: #ifndef YY_USER_ACTION
441: #define YY_USER_ACTION
442: #endif
443:
444: /* Code executed at the end of each rule. */
445: #ifndef YY_BREAK
446: #define YY_BREAK break;
447: #endif
448:
449: %% YY_RULE_SETUP definition goes here
450:
451: YY_DECL
452: {
453: register yy_state_type yy_current_state;
454: register char *yy_cp, *yy_bp;
455: register int yy_act;
456:
457: %% user's declarations go here
458:
459: if ( yy_init )
460: {
461: yy_init = 0;
462:
463: #ifdef YY_USER_INIT
464: YY_USER_INIT;
465: #endif
466:
467: if ( ! yy_start )
468: yy_start = 1; /* first start state */
469:
470: if ( ! yyin )
471: %-
472: yyin = stdin;
473: %+
474: yyin = &cin;
475: %*
476:
477: if ( ! yyout )
478: %-
479: yyout = stdout;
480: %+
481: yyout = &cout;
482: %*
483:
484: if ( ! yy_current_buffer )
485: yy_current_buffer =
486: yy_create_buffer( yyin, YY_BUF_SIZE );
487:
488: yy_load_buffer_state();
489: }
490:
491: while ( 1 ) /* loops until end-of-file is reached */
492: {
493: %% yymore()-related code goes here
494: yy_cp = yy_c_buf_p;
495:
496: /* Support of yytext. */
497: *yy_cp = yy_hold_char;
498:
499: /* yy_bp points to the position in yy_ch_buf of the start of
500: * the current run.
501: */
502: yy_bp = yy_cp;
503:
504: %% code to set up and find next match goes here
505:
506: yy_find_action:
507: %% code to find the action number goes here
508:
509: YY_DO_BEFORE_ACTION;
510:
511: %% code for yylineno update goes here
512:
513: do_action: /* This label is used only to access EOF actions. */
514:
515: %% debug code goes here
516:
517: switch ( yy_act )
518: { /* beginning of action switch */
519: %% actions go here
520:
521: case YY_END_OF_BUFFER:
522: {
523: /* Amount of text matched not including the EOB char. */
524: int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
525:
526: /* Undo the effects of YY_DO_BEFORE_ACTION. */
527: *yy_cp = yy_hold_char;
1.3 ! millert 528: YY_RESTORE_YY_MORE_OFFSET
1.1 deraadt 529:
530: if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
531: {
532: /* We're scanning a new file or input source. It's
533: * possible that this happened because the user
534: * just pointed yyin at a new source and called
535: * yylex(). If so, then we have to assure
536: * consistency between yy_current_buffer and our
537: * globals. Here is the right place to do so, because
538: * this is the first action (other than possibly a
539: * back-up) that will match for the new input source.
540: */
541: yy_n_chars = yy_current_buffer->yy_n_chars;
542: yy_current_buffer->yy_input_file = yyin;
543: yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
544: }
545:
546: /* Note that here we test for yy_c_buf_p "<=" to the position
547: * of the first EOB in the buffer, since yy_c_buf_p will
548: * already have been incremented past the NUL character
549: * (since all states make transitions on EOB to the
550: * end-of-buffer state). Contrast this with the test
551: * in input().
552: */
553: if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
554: { /* This was really a NUL. */
555: yy_state_type yy_next_state;
556:
557: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
558:
559: yy_current_state = yy_get_previous_state();
560:
561: /* Okay, we're now positioned to make the NUL
562: * transition. We couldn't have
563: * yy_get_previous_state() go ahead and do it
564: * for us because it doesn't know how to deal
565: * with the possibility of jamming (and we don't
566: * want to build jamming into it because then it
567: * will run more slowly).
568: */
569:
570: yy_next_state = yy_try_NUL_trans( yy_current_state );
571:
572: yy_bp = yytext_ptr + YY_MORE_ADJ;
573:
574: if ( yy_next_state )
575: {
576: /* Consume the NUL. */
577: yy_cp = ++yy_c_buf_p;
578: yy_current_state = yy_next_state;
579: goto yy_match;
580: }
581:
582: else
583: {
584: %% code to do back-up for compressed tables and set up yy_cp goes here
585: goto yy_find_action;
586: }
587: }
588:
589: else switch ( yy_get_next_buffer() )
590: {
591: case EOB_ACT_END_OF_FILE:
592: {
593: yy_did_buffer_switch_on_eof = 0;
594:
595: if ( yywrap() )
596: {
597: /* Note: because we've taken care in
598: * yy_get_next_buffer() to have set up
599: * yytext, we can now set up
600: * yy_c_buf_p so that if some total
601: * hoser (like flex itself) wants to
602: * call the scanner after we return the
603: * YY_NULL, it'll still work - another
604: * YY_NULL will get returned.
605: */
606: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
607:
608: yy_act = YY_STATE_EOF(YY_START);
609: goto do_action;
610: }
611:
612: else
613: {
614: if ( ! yy_did_buffer_switch_on_eof )
615: YY_NEW_FILE;
616: }
617: break;
618: }
619:
620: case EOB_ACT_CONTINUE_SCAN:
621: yy_c_buf_p =
622: yytext_ptr + yy_amount_of_matched_text;
623:
624: yy_current_state = yy_get_previous_state();
625:
626: yy_cp = yy_c_buf_p;
627: yy_bp = yytext_ptr + YY_MORE_ADJ;
628: goto yy_match;
629:
630: case EOB_ACT_LAST_MATCH:
631: yy_c_buf_p =
632: &yy_current_buffer->yy_ch_buf[yy_n_chars];
633:
634: yy_current_state = yy_get_previous_state();
635:
636: yy_cp = yy_c_buf_p;
637: yy_bp = yytext_ptr + YY_MORE_ADJ;
638: goto yy_find_action;
639: }
640: break;
641: }
642:
643: default:
644: YY_FATAL_ERROR(
645: "fatal flex scanner internal error--no action found" );
646: } /* end of action switch */
647: } /* end of scanning one token */
648: } /* end of yylex */
649:
650: %+
651: yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
652: {
653: yyin = arg_yyin;
654: yyout = arg_yyout;
655: yy_c_buf_p = 0;
656: yy_init = 1;
657: yy_start = 0;
658: yy_flex_debug = 0;
659: yylineno = 1; // this will only get updated if %option yylineno
660:
661: yy_did_buffer_switch_on_eof = 0;
662:
663: yy_looking_for_trail_begin = 0;
664: yy_more_flag = 0;
665: yy_more_len = 0;
1.3 ! millert 666: yy_more_offset = yy_prev_more_offset = 0;
1.1 deraadt 667:
668: yy_start_stack_ptr = yy_start_stack_depth = 0;
669: yy_start_stack = 0;
670:
671: yy_current_buffer = 0;
672:
673: #ifdef YY_USES_REJECT
674: yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
675: #else
676: yy_state_buf = 0;
677: #endif
678: }
679:
680: yyFlexLexer::~yyFlexLexer()
681: {
682: delete yy_state_buf;
683: yy_delete_buffer( yy_current_buffer );
684: }
685:
686: void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
687: {
688: if ( new_in )
689: {
690: yy_delete_buffer( yy_current_buffer );
691: yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
692: }
693:
694: if ( new_out )
695: yyout = new_out;
696: }
697:
698: #ifdef YY_INTERACTIVE
699: int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
700: #else
701: int yyFlexLexer::LexerInput( char* buf, int max_size )
702: #endif
703: {
704: if ( yyin->eof() || yyin->fail() )
705: return 0;
706:
707: #ifdef YY_INTERACTIVE
708: yyin->get( buf[0] );
709:
710: if ( yyin->eof() )
711: return 0;
712:
713: if ( yyin->bad() )
714: return -1;
715:
716: return 1;
717:
718: #else
719: (void) yyin->read( buf, max_size );
720:
721: if ( yyin->bad() )
722: return -1;
723: else
724: return yyin->gcount();
725: #endif
726: }
727:
728: void yyFlexLexer::LexerOutput( const char* buf, int size )
729: {
730: (void) yyout->write( buf, size );
731: }
732: %*
733:
734: /* yy_get_next_buffer - try to read in a new buffer
735: *
736: * Returns a code representing an action:
737: * EOB_ACT_LAST_MATCH -
738: * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
739: * EOB_ACT_END_OF_FILE - end of file
740: */
741:
742: %-
743: static int yy_get_next_buffer()
744: %+
745: int yyFlexLexer::yy_get_next_buffer()
746: %*
747: {
748: register char *dest = yy_current_buffer->yy_ch_buf;
749: register char *source = yytext_ptr;
750: register int number_to_move, i;
751: int ret_val;
752:
753: if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
754: YY_FATAL_ERROR(
755: "fatal flex scanner internal error--end of buffer missed" );
756:
757: if ( yy_current_buffer->yy_fill_buffer == 0 )
758: { /* Don't try to fill the buffer, so this is an EOF. */
759: if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
760: {
1.3 ! millert 761: /* We matched a single character, the EOB, so
1.1 deraadt 762: * treat this as a final EOF.
763: */
764: return EOB_ACT_END_OF_FILE;
765: }
766:
767: else
768: {
769: /* We matched some text prior to the EOB, first
770: * process it.
771: */
772: return EOB_ACT_LAST_MATCH;
773: }
774: }
775:
776: /* Try to read more data. */
777:
778: /* First move last chars to start of buffer. */
779: number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
780:
781: for ( i = 0; i < number_to_move; ++i )
782: *(dest++) = *(source++);
783:
784: if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
785: /* don't do the read, it's not guaranteed to return an EOF,
786: * just force an EOF
787: */
788: yy_n_chars = 0;
789:
790: else
791: {
792: int num_to_read =
793: yy_current_buffer->yy_buf_size - number_to_move - 1;
794:
795: while ( num_to_read <= 0 )
796: { /* Not enough room in the buffer - grow it. */
797: #ifdef YY_USES_REJECT
798: YY_FATAL_ERROR(
799: "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
800: #else
801:
802: /* just a shorter name for the current buffer */
803: YY_BUFFER_STATE b = yy_current_buffer;
804:
805: int yy_c_buf_p_offset =
806: (int) (yy_c_buf_p - b->yy_ch_buf);
807:
808: if ( b->yy_is_our_buffer )
809: {
810: int new_size = b->yy_buf_size * 2;
811:
812: if ( new_size <= 0 )
813: b->yy_buf_size += b->yy_buf_size / 8;
814: else
815: b->yy_buf_size *= 2;
816:
817: b->yy_ch_buf = (char *)
818: /* Include room in for 2 EOB chars. */
819: yy_flex_realloc( (void *) b->yy_ch_buf,
820: b->yy_buf_size + 2 );
821: }
822: else
823: /* Can't grow it, we don't own it. */
824: b->yy_ch_buf = 0;
825:
826: if ( ! b->yy_ch_buf )
827: YY_FATAL_ERROR(
828: "fatal error - scanner input buffer overflow" );
829:
830: yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
831:
832: num_to_read = yy_current_buffer->yy_buf_size -
833: number_to_move - 1;
834: #endif
835: }
836:
837: if ( num_to_read > YY_READ_BUF_SIZE )
838: num_to_read = YY_READ_BUF_SIZE;
839:
840: /* Read in more data. */
841: YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
842: yy_n_chars, num_to_read );
843: }
844:
845: if ( yy_n_chars == 0 )
846: {
847: if ( number_to_move == YY_MORE_ADJ )
848: {
849: ret_val = EOB_ACT_END_OF_FILE;
850: yyrestart( yyin );
851: }
852:
853: else
854: {
855: ret_val = EOB_ACT_LAST_MATCH;
856: yy_current_buffer->yy_buffer_status =
857: YY_BUFFER_EOF_PENDING;
858: }
859: }
860:
861: else
862: ret_val = EOB_ACT_CONTINUE_SCAN;
863:
864: yy_n_chars += number_to_move;
865: yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
866: yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
867:
868: yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
869:
870: return ret_val;
871: }
872:
873:
874: /* yy_get_previous_state - get the state just before the EOB char was reached */
875:
876: %-
877: static yy_state_type yy_get_previous_state()
878: %+
879: yy_state_type yyFlexLexer::yy_get_previous_state()
880: %*
881: {
882: register yy_state_type yy_current_state;
883: register char *yy_cp;
884:
885: %% code to get the start state into yy_current_state goes here
886:
887: for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
888: {
889: %% code to find the next state goes here
890: }
891:
892: return yy_current_state;
893: }
894:
895:
896: /* yy_try_NUL_trans - try to make a transition on the NUL character
897: *
898: * synopsis
899: * next_state = yy_try_NUL_trans( current_state );
900: */
901:
902: %-
903: #ifdef YY_USE_PROTOS
904: static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
905: #else
906: static yy_state_type yy_try_NUL_trans( yy_current_state )
907: yy_state_type yy_current_state;
908: #endif
909: %+
910: yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
911: %*
912: {
913: register int yy_is_jam;
914: %% code to find the next state, and perhaps do backing up, goes here
915:
916: return yy_is_jam ? 0 : yy_current_state;
917: }
918:
919:
920: %-
921: #ifndef YY_NO_UNPUT
922: #ifdef YY_USE_PROTOS
923: static void yyunput( int c, register char *yy_bp )
924: #else
925: static void yyunput( c, yy_bp )
926: int c;
927: register char *yy_bp;
928: #endif
929: %+
930: void yyFlexLexer::yyunput( int c, register char* yy_bp )
931: %*
932: {
933: register char *yy_cp = yy_c_buf_p;
934:
935: /* undo effects of setting up yytext */
936: *yy_cp = yy_hold_char;
937:
938: if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
939: { /* need to shift things up to make room */
940: /* +2 for EOB chars. */
941: register int number_to_move = yy_n_chars + 2;
942: register char *dest = &yy_current_buffer->yy_ch_buf[
943: yy_current_buffer->yy_buf_size + 2];
944: register char *source =
945: &yy_current_buffer->yy_ch_buf[number_to_move];
946:
947: while ( source > yy_current_buffer->yy_ch_buf )
948: *--dest = *--source;
949:
950: yy_cp += (int) (dest - source);
951: yy_bp += (int) (dest - source);
952: yy_n_chars = yy_current_buffer->yy_buf_size;
953:
954: if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
955: YY_FATAL_ERROR( "flex scanner push-back overflow" );
956: }
957:
958: *--yy_cp = (char) c;
959:
960: %% update yylineno here
961:
962: yytext_ptr = yy_bp;
963: yy_hold_char = *yy_cp;
964: yy_c_buf_p = yy_cp;
965: }
966: %-
967: #endif /* ifndef YY_NO_UNPUT */
968: %*
969:
970:
971: %-
972: #ifdef __cplusplus
973: static int yyinput()
974: #else
975: static int input()
976: #endif
977: %+
978: int yyFlexLexer::yyinput()
979: %*
980: {
981: int c;
982:
983: *yy_c_buf_p = yy_hold_char;
984:
985: if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
986: {
987: /* yy_c_buf_p now points to the character we want to return.
988: * If this occurs *before* the EOB characters, then it's a
989: * valid NUL; if not, then we've hit the end of the buffer.
990: */
991: if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
992: /* This was really a NUL. */
993: *yy_c_buf_p = '\0';
994:
995: else
996: { /* need more input */
1.3 ! millert 997: int offset = yy_c_buf_p - yytext_ptr;
1.1 deraadt 998: ++yy_c_buf_p;
999:
1000: switch ( yy_get_next_buffer() )
1001: {
1002: case EOB_ACT_END_OF_FILE:
1003: {
1004: if ( yywrap() )
1005: {
1.3 ! millert 1006: yy_c_buf_p = yytext_ptr + offset;
1.1 deraadt 1007: return EOF;
1008: }
1009:
1010: if ( ! yy_did_buffer_switch_on_eof )
1011: YY_NEW_FILE;
1012: #ifdef __cplusplus
1013: return yyinput();
1014: #else
1015: return input();
1016: #endif
1017: }
1018:
1019: case EOB_ACT_CONTINUE_SCAN:
1.3 ! millert 1020: yy_c_buf_p = yytext_ptr + offset;
1.1 deraadt 1021: break;
1022:
1023: case EOB_ACT_LAST_MATCH:
1024: #ifdef __cplusplus
1025: YY_FATAL_ERROR(
1026: "unexpected last match in yyinput()" );
1027: #else
1028: YY_FATAL_ERROR(
1029: "unexpected last match in input()" );
1030: #endif
1031: }
1032: }
1033: }
1034:
1035: c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1036: *yy_c_buf_p = '\0'; /* preserve yytext */
1037: yy_hold_char = *++yy_c_buf_p;
1038:
1039: %% update BOL and yylineno
1040:
1041: return c;
1042: }
1043:
1044:
1045: %-
1046: #ifdef YY_USE_PROTOS
1047: void yyrestart( FILE *input_file )
1048: #else
1049: void yyrestart( input_file )
1050: FILE *input_file;
1051: #endif
1052: %+
1053: void yyFlexLexer::yyrestart( istream* input_file )
1054: %*
1055: {
1056: if ( ! yy_current_buffer )
1057: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1058:
1059: yy_init_buffer( yy_current_buffer, input_file );
1060: yy_load_buffer_state();
1061: }
1062:
1063:
1064: %-
1065: #ifdef YY_USE_PROTOS
1066: void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1067: #else
1068: void yy_switch_to_buffer( new_buffer )
1069: YY_BUFFER_STATE new_buffer;
1070: #endif
1071: %+
1072: void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1073: %*
1074: {
1075: if ( yy_current_buffer == new_buffer )
1076: return;
1077:
1078: if ( yy_current_buffer )
1079: {
1080: /* Flush out information for old buffer. */
1081: *yy_c_buf_p = yy_hold_char;
1082: yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1083: yy_current_buffer->yy_n_chars = yy_n_chars;
1084: }
1085:
1086: yy_current_buffer = new_buffer;
1087: yy_load_buffer_state();
1088:
1089: /* We don't actually know whether we did this switch during
1090: * EOF (yywrap()) processing, but the only time this flag
1091: * is looked at is after yywrap() is called, so it's safe
1092: * to go ahead and always set it.
1093: */
1094: yy_did_buffer_switch_on_eof = 1;
1095: }
1096:
1097:
1098: %-
1099: #ifdef YY_USE_PROTOS
1100: void yy_load_buffer_state( void )
1101: #else
1102: void yy_load_buffer_state()
1103: #endif
1104: %+
1105: void yyFlexLexer::yy_load_buffer_state()
1106: %*
1107: {
1108: yy_n_chars = yy_current_buffer->yy_n_chars;
1109: yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1110: yyin = yy_current_buffer->yy_input_file;
1111: yy_hold_char = *yy_c_buf_p;
1112: }
1113:
1114:
1115: %-
1116: #ifdef YY_USE_PROTOS
1117: YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1118: #else
1119: YY_BUFFER_STATE yy_create_buffer( file, size )
1120: FILE *file;
1121: int size;
1122: #endif
1123: %+
1124: YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1125: %*
1126: {
1127: YY_BUFFER_STATE b;
1128:
1129: b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1130: if ( ! b )
1131: YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1132:
1133: b->yy_buf_size = size;
1134:
1135: /* yy_ch_buf has to be 2 characters longer than the size given because
1136: * we need to put in 2 end-of-buffer characters.
1137: */
1138: b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1139: if ( ! b->yy_ch_buf )
1140: YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1141:
1142: b->yy_is_our_buffer = 1;
1143:
1144: yy_init_buffer( b, file );
1145:
1146: return b;
1147: }
1148:
1149:
1150: %-
1151: #ifdef YY_USE_PROTOS
1152: void yy_delete_buffer( YY_BUFFER_STATE b )
1153: #else
1154: void yy_delete_buffer( b )
1155: YY_BUFFER_STATE b;
1156: #endif
1157: %+
1158: void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1159: %*
1160: {
1161: if ( ! b )
1162: return;
1163:
1164: if ( b == yy_current_buffer )
1165: yy_current_buffer = (YY_BUFFER_STATE) 0;
1166:
1167: if ( b->yy_is_our_buffer )
1168: yy_flex_free( (void *) b->yy_ch_buf );
1169:
1170: yy_flex_free( (void *) b );
1171: }
1172:
1173:
1174: %-
1175: #ifndef YY_ALWAYS_INTERACTIVE
1176: #ifndef YY_NEVER_INTERACTIVE
1177: extern int isatty YY_PROTO(( int ));
1178: #endif
1179: #endif
1180:
1181: #ifdef YY_USE_PROTOS
1182: void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1183: #else
1184: void yy_init_buffer( b, file )
1185: YY_BUFFER_STATE b;
1186: FILE *file;
1187: #endif
1188:
1189: %+
1190: extern "C" int isatty YY_PROTO(( int ));
1191: void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1192: %*
1193:
1194: {
1195: yy_flush_buffer( b );
1196:
1197: b->yy_input_file = file;
1198: b->yy_fill_buffer = 1;
1199:
1200: %-
1201: #if YY_ALWAYS_INTERACTIVE
1202: b->yy_is_interactive = 1;
1203: #else
1204: #if YY_NEVER_INTERACTIVE
1205: b->yy_is_interactive = 0;
1206: #else
1207: b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1208: #endif
1209: #endif
1210: %+
1211: b->yy_is_interactive = 0;
1212: %*
1213: }
1214:
1215:
1216: %-
1217: #ifdef YY_USE_PROTOS
1218: void yy_flush_buffer( YY_BUFFER_STATE b )
1219: #else
1220: void yy_flush_buffer( b )
1221: YY_BUFFER_STATE b;
1222: #endif
1223:
1224: %+
1225: void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1226: %*
1227: {
1228: b->yy_n_chars = 0;
1229:
1230: /* We always need two end-of-buffer characters. The first causes
1231: * a transition to the end-of-buffer state. The second causes
1232: * a jam in that state.
1233: */
1234: b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1235: b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1236:
1237: b->yy_buf_pos = &b->yy_ch_buf[0];
1238:
1239: b->yy_at_bol = 1;
1240: b->yy_buffer_status = YY_BUFFER_NEW;
1241:
1242: if ( b == yy_current_buffer )
1243: yy_load_buffer_state();
1244: }
1245: %*
1246:
1247:
1248: #ifndef YY_NO_SCAN_BUFFER
1249: %-
1250: #ifdef YY_USE_PROTOS
1251: YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1252: #else
1253: YY_BUFFER_STATE yy_scan_buffer( base, size )
1254: char *base;
1255: yy_size_t size;
1256: #endif
1257: {
1258: YY_BUFFER_STATE b;
1259:
1260: if ( size < 2 ||
1261: base[size-2] != YY_END_OF_BUFFER_CHAR ||
1262: base[size-1] != YY_END_OF_BUFFER_CHAR )
1263: /* They forgot to leave room for the EOB's. */
1264: return 0;
1265:
1266: b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1267: if ( ! b )
1268: YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1269:
1270: b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1271: b->yy_buf_pos = b->yy_ch_buf = base;
1272: b->yy_is_our_buffer = 0;
1273: b->yy_input_file = 0;
1274: b->yy_n_chars = b->yy_buf_size;
1275: b->yy_is_interactive = 0;
1276: b->yy_at_bol = 1;
1277: b->yy_fill_buffer = 0;
1278: b->yy_buffer_status = YY_BUFFER_NEW;
1279:
1280: yy_switch_to_buffer( b );
1281:
1282: return b;
1283: }
1284: %*
1285: #endif
1286:
1287:
1288: #ifndef YY_NO_SCAN_STRING
1289: %-
1290: #ifdef YY_USE_PROTOS
1291: YY_BUFFER_STATE yy_scan_string( yyconst char *str )
1292: #else
1293: YY_BUFFER_STATE yy_scan_string( str )
1294: yyconst char *str;
1295: #endif
1296: {
1297: int len;
1298: for ( len = 0; str[len]; ++len )
1299: ;
1300:
1301: return yy_scan_bytes( str, len );
1302: }
1303: %*
1304: #endif
1305:
1306:
1307: #ifndef YY_NO_SCAN_BYTES
1308: %-
1309: #ifdef YY_USE_PROTOS
1310: YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1311: #else
1312: YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1313: yyconst char *bytes;
1314: int len;
1315: #endif
1316: {
1317: YY_BUFFER_STATE b;
1318: char *buf;
1319: yy_size_t n;
1320: int i;
1321:
1322: /* Get memory for full buffer, including space for trailing EOB's. */
1323: n = len + 2;
1324: buf = (char *) yy_flex_alloc( n );
1325: if ( ! buf )
1326: YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1327:
1328: for ( i = 0; i < len; ++i )
1329: buf[i] = bytes[i];
1330:
1331: buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1332:
1333: b = yy_scan_buffer( buf, n );
1334: if ( ! b )
1335: YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1336:
1337: /* It's okay to grow etc. this buffer, and we should throw it
1338: * away when we're done.
1339: */
1340: b->yy_is_our_buffer = 1;
1341:
1342: return b;
1343: }
1344: %*
1345: #endif
1346:
1347:
1348: #ifndef YY_NO_PUSH_STATE
1349: %-
1350: #ifdef YY_USE_PROTOS
1351: static void yy_push_state( int new_state )
1352: #else
1353: static void yy_push_state( new_state )
1354: int new_state;
1355: #endif
1356: %+
1357: void yyFlexLexer::yy_push_state( int new_state )
1358: %*
1359: {
1360: if ( yy_start_stack_ptr >= yy_start_stack_depth )
1361: {
1362: yy_size_t new_size;
1363:
1364: yy_start_stack_depth += YY_START_STACK_INCR;
1365: new_size = yy_start_stack_depth * sizeof( int );
1366:
1367: if ( ! yy_start_stack )
1368: yy_start_stack = (int *) yy_flex_alloc( new_size );
1369:
1370: else
1371: yy_start_stack = (int *) yy_flex_realloc(
1372: (void *) yy_start_stack, new_size );
1373:
1374: if ( ! yy_start_stack )
1375: YY_FATAL_ERROR(
1376: "out of memory expanding start-condition stack" );
1377: }
1378:
1379: yy_start_stack[yy_start_stack_ptr++] = YY_START;
1380:
1381: BEGIN(new_state);
1382: }
1383: #endif
1384:
1385:
1386: #ifndef YY_NO_POP_STATE
1387: %-
1388: static void yy_pop_state()
1389: %+
1390: void yyFlexLexer::yy_pop_state()
1391: %*
1392: {
1393: if ( --yy_start_stack_ptr < 0 )
1394: YY_FATAL_ERROR( "start-condition stack underflow" );
1395:
1396: BEGIN(yy_start_stack[yy_start_stack_ptr]);
1397: }
1398: #endif
1399:
1400:
1401: #ifndef YY_NO_TOP_STATE
1402: %-
1403: static int yy_top_state()
1404: %+
1405: int yyFlexLexer::yy_top_state()
1406: %*
1407: {
1408: return yy_start_stack[yy_start_stack_ptr - 1];
1409: }
1410: #endif
1411:
1412: #ifndef YY_EXIT_FAILURE
1413: #define YY_EXIT_FAILURE 2
1414: #endif
1415:
1416: %-
1417: #ifdef YY_USE_PROTOS
1418: static void yy_fatal_error( yyconst char msg[] )
1419: #else
1420: static void yy_fatal_error( msg )
1421: char msg[];
1422: #endif
1423: {
1424: (void) fprintf( stderr, "%s\n", msg );
1425: exit( YY_EXIT_FAILURE );
1426: }
1427:
1428: %+
1429:
1430: void yyFlexLexer::LexerError( yyconst char msg[] )
1431: {
1432: cerr << msg << '\n';
1433: exit( YY_EXIT_FAILURE );
1434: }
1435: %*
1436:
1437:
1438: /* Redefine yyless() so it works in section 3 code. */
1439:
1440: #undef yyless
1441: #define yyless(n) \
1442: do \
1443: { \
1444: /* Undo effects of setting up yytext. */ \
1445: yytext[yyleng] = yy_hold_char; \
1.3 ! millert 1446: yy_c_buf_p = yytext + n; \
1.1 deraadt 1447: yy_hold_char = *yy_c_buf_p; \
1448: *yy_c_buf_p = '\0'; \
1449: yyleng = n; \
1450: } \
1451: while ( 0 )
1452:
1453:
1454: /* Internal utility routines. */
1455:
1456: #ifndef yytext_ptr
1457: #ifdef YY_USE_PROTOS
1458: static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1459: #else
1460: static void yy_flex_strncpy( s1, s2, n )
1461: char *s1;
1462: yyconst char *s2;
1463: int n;
1464: #endif
1465: {
1466: register int i;
1467: for ( i = 0; i < n; ++i )
1468: s1[i] = s2[i];
1.3 ! millert 1469: }
! 1470: #endif
! 1471:
! 1472: #ifdef YY_NEED_STRLEN
! 1473: #ifdef YY_USE_PROTOS
! 1474: static int yy_flex_strlen( yyconst char *s )
! 1475: #else
! 1476: static int yy_flex_strlen( s )
! 1477: yyconst char *s;
! 1478: #endif
! 1479: {
! 1480: register int n;
! 1481: for ( n = 0; s[n]; ++n )
! 1482: ;
! 1483:
! 1484: return n;
1.1 deraadt 1485: }
1486: #endif
1487:
1488:
1489: #ifdef YY_USE_PROTOS
1490: static void *yy_flex_alloc( yy_size_t size )
1491: #else
1492: static void *yy_flex_alloc( size )
1493: yy_size_t size;
1494: #endif
1495: {
1496: return (void *) malloc( size );
1497: }
1498:
1499: #ifdef YY_USE_PROTOS
1500: static void *yy_flex_realloc( void *ptr, yy_size_t size )
1501: #else
1502: static void *yy_flex_realloc( ptr, size )
1503: void *ptr;
1504: yy_size_t size;
1505: #endif
1506: {
1507: /* The cast to (char *) in the following accommodates both
1508: * implementations that use char* generic pointers, and those
1509: * that use void* generic pointers. It works with the latter
1510: * because both ANSI C and C++ allow castless assignment from
1511: * any pointer type to void*, and deal with argument conversions
1512: * as though doing an assignment.
1513: */
1514: return (void *) realloc( (char *) ptr, size );
1515: }
1516:
1517: #ifdef YY_USE_PROTOS
1518: static void yy_flex_free( void *ptr )
1519: #else
1520: static void yy_flex_free( ptr )
1521: void *ptr;
1522: #endif
1523: {
1524: free( ptr );
1525: }
1526:
1527: #if YY_MAIN
1528: int main()
1529: {
1530: yylex();
1531: return 0;
1532: }
1533: #endif