lexer.c

来自「CORBA上的libIDL源代码」· C语言 代码 · 共 2,203 行 · 第 1/5 页

C
2,203
字号
			}		if ( num_to_read > YY_READ_BUF_SIZE )			num_to_read = YY_READ_BUF_SIZE;		/* Read in more data. */		YY_INPUT( (&__IDL__current_buffer->__IDL__ch_buf[number_to_move]),			__IDL__n_chars, num_to_read );		__IDL__current_buffer->__IDL__n_chars = __IDL__n_chars;		}	if ( __IDL__n_chars == 0 )		{		if ( number_to_move == YY_MORE_ADJ )			{			ret_val = EOB_ACT_END_OF_FILE;			__IDL_restart( __IDL_in );			}		else			{			ret_val = EOB_ACT_LAST_MATCH;			__IDL__current_buffer->__IDL__buffer_status =				YY_BUFFER_EOF_PENDING;			}		}	else		ret_val = EOB_ACT_CONTINUE_SCAN;	__IDL__n_chars += number_to_move;	__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars] = YY_END_OF_BUFFER_CHAR;	__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars + 1] = YY_END_OF_BUFFER_CHAR;	__IDL_text_ptr = &__IDL__current_buffer->__IDL__ch_buf[0];	return ret_val;	}/* __IDL__get_previous_state - get the state just before the EOB char was reached */static __IDL__state_type __IDL__get_previous_state()	{	register __IDL__state_type __IDL__current_state;	register char *__IDL__cp;	__IDL__current_state = __IDL__start;	__IDL__current_state += YY_AT_BOL();	for ( __IDL__cp = __IDL_text_ptr + YY_MORE_ADJ; __IDL__cp < __IDL__c_buf_p; ++__IDL__cp )		{		register YY_CHAR __IDL__c = (*__IDL__cp ? __IDL__ec[YY_SC_TO_UI(*__IDL__cp)] : 1);		if ( __IDL__accept[__IDL__current_state] )			{			__IDL__last_accepting_state = __IDL__current_state;			__IDL__last_accepting_cpos = __IDL__cp;			}		while ( __IDL__chk[__IDL__base[__IDL__current_state] + __IDL__c] != __IDL__current_state )			{			__IDL__current_state = (int) __IDL__def[__IDL__current_state];			if ( __IDL__current_state >= 348 )				__IDL__c = __IDL__meta[(unsigned int) __IDL__c];			}		__IDL__current_state = __IDL__nxt[__IDL__base[__IDL__current_state] + (unsigned int) __IDL__c];		}	return __IDL__current_state;	}/* __IDL__try_NUL_trans - try to make a transition on the NUL character * * synopsis *	next_state = __IDL__try_NUL_trans( current_state ); */#ifdef YY_USE_PROTOSstatic __IDL__state_type __IDL__try_NUL_trans( __IDL__state_type __IDL__current_state )#elsestatic __IDL__state_type __IDL__try_NUL_trans( __IDL__current_state )__IDL__state_type __IDL__current_state;#endif	{	register int __IDL__is_jam;	register char *__IDL__cp = __IDL__c_buf_p;	register YY_CHAR __IDL__c = 1;	if ( __IDL__accept[__IDL__current_state] )		{		__IDL__last_accepting_state = __IDL__current_state;		__IDL__last_accepting_cpos = __IDL__cp;		}	while ( __IDL__chk[__IDL__base[__IDL__current_state] + __IDL__c] != __IDL__current_state )		{		__IDL__current_state = (int) __IDL__def[__IDL__current_state];		if ( __IDL__current_state >= 348 )			__IDL__c = __IDL__meta[(unsigned int) __IDL__c];		}	__IDL__current_state = __IDL__nxt[__IDL__base[__IDL__current_state] + (unsigned int) __IDL__c];	__IDL__is_jam = (__IDL__current_state == 347);	return __IDL__is_jam ? 0 : __IDL__current_state;	}#ifndef YY_NO_UNPUT#ifdef YY_USE_PROTOSstatic void __IDL_unput( int c, register char *__IDL__bp )#elsestatic void __IDL_unput( c, __IDL__bp )int c;register char *__IDL__bp;#endif	{	register char *__IDL__cp = __IDL__c_buf_p;	/* undo effects of setting up __IDL_text */	*__IDL__cp = __IDL__hold_char;	if ( __IDL__cp < __IDL__current_buffer->__IDL__ch_buf + 2 )		{ /* need to shift things up to make room */		/* +2 for EOB chars. */		register int number_to_move = __IDL__n_chars + 2;		register char *dest = &__IDL__current_buffer->__IDL__ch_buf[					__IDL__current_buffer->__IDL__buf_size + 2];		register char *source =				&__IDL__current_buffer->__IDL__ch_buf[number_to_move];		while ( source > __IDL__current_buffer->__IDL__ch_buf )			*--dest = *--source;		__IDL__cp += (int) (dest - source);		__IDL__bp += (int) (dest - source);		__IDL__current_buffer->__IDL__n_chars =			__IDL__n_chars = __IDL__current_buffer->__IDL__buf_size;		if ( __IDL__cp < __IDL__current_buffer->__IDL__ch_buf + 2 )			YY_FATAL_ERROR( "flex scanner push-back overflow" );		}	*--__IDL__cp = (char) c;	__IDL_text_ptr = __IDL__bp;	__IDL__hold_char = *__IDL__cp;	__IDL__c_buf_p = __IDL__cp;	}#endif	/* ifndef YY_NO_UNPUT */#ifdef __cplusplusstatic int __IDL_input()#elsestatic int input()#endif	{	int c;	*__IDL__c_buf_p = __IDL__hold_char;	if ( *__IDL__c_buf_p == YY_END_OF_BUFFER_CHAR )		{		/* __IDL__c_buf_p now points to the character we want to return.		 * If this occurs *before* the EOB characters, then it's a		 * valid NUL; if not, then we've hit the end of the buffer.		 */		if ( __IDL__c_buf_p < &__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars] )			/* This was really a NUL. */			*__IDL__c_buf_p = '\0';		else			{ /* need more input */			int offset = __IDL__c_buf_p - __IDL_text_ptr;			++__IDL__c_buf_p;			switch ( __IDL__get_next_buffer() )				{				case EOB_ACT_LAST_MATCH:					/* This happens because __IDL__g_n_b()					 * sees that we've accumulated a					 * token and flags that we need to					 * try matching the token before					 * proceeding.  But for input(),					 * there's no matching to consider.					 * So convert the EOB_ACT_LAST_MATCH					 * to EOB_ACT_END_OF_FILE.					 */					/* Reset buffer status. */					__IDL_restart( __IDL_in );					/* fall through */				case EOB_ACT_END_OF_FILE:					{					if ( __IDL_wrap() )						return EOF;					if ( ! __IDL__did_buffer_switch_on_eof )						YY_NEW_FILE;#ifdef __cplusplus					return __IDL_input();#else					return input();#endif					}				case EOB_ACT_CONTINUE_SCAN:					__IDL__c_buf_p = __IDL_text_ptr + offset;					break;				}			}		}	c = *(unsigned char *) __IDL__c_buf_p;	/* cast for 8-bit char's */	*__IDL__c_buf_p = '\0';	/* preserve __IDL_text */	__IDL__hold_char = *++__IDL__c_buf_p;	__IDL__current_buffer->__IDL__at_bol = (c == '\n');	return c;	}#ifdef YY_USE_PROTOSvoid __IDL_restart( FILE *input_file )#elsevoid __IDL_restart( input_file )FILE *input_file;#endif	{	if ( ! __IDL__current_buffer )		__IDL__current_buffer = __IDL__create_buffer( __IDL_in, YY_BUF_SIZE );	__IDL__init_buffer( __IDL__current_buffer, input_file );	__IDL__load_buffer_state();	}#ifdef YY_USE_PROTOSvoid __IDL__switch_to_buffer( YY_BUFFER_STATE new_buffer )#elsevoid __IDL__switch_to_buffer( new_buffer )YY_BUFFER_STATE new_buffer;#endif	{	if ( __IDL__current_buffer == new_buffer )		return;	if ( __IDL__current_buffer )		{		/* Flush out information for old buffer. */		*__IDL__c_buf_p = __IDL__hold_char;		__IDL__current_buffer->__IDL__buf_pos = __IDL__c_buf_p;		__IDL__current_buffer->__IDL__n_chars = __IDL__n_chars;		}	__IDL__current_buffer = new_buffer;	__IDL__load_buffer_state();	/* We don't actually know whether we did this switch during	 * EOF (__IDL_wrap()) processing, but the only time this flag	 * is looked at is after __IDL_wrap() is called, so it's safe	 * to go ahead and always set it.	 */	__IDL__did_buffer_switch_on_eof = 1;	}#ifdef YY_USE_PROTOSvoid __IDL__load_buffer_state( void )#elsevoid __IDL__load_buffer_state()#endif	{	__IDL__n_chars = __IDL__current_buffer->__IDL__n_chars;	__IDL_text_ptr = __IDL__c_buf_p = __IDL__current_buffer->__IDL__buf_pos;	__IDL_in = __IDL__current_buffer->__IDL__input_file;	__IDL__hold_char = *__IDL__c_buf_p;	}#ifdef YY_USE_PROTOSYY_BUFFER_STATE __IDL__create_buffer( FILE *file, int size )#elseYY_BUFFER_STATE __IDL__create_buffer( file, size )FILE *file;int size;#endif	{	YY_BUFFER_STATE b;	b = (YY_BUFFER_STATE) __IDL__flex_alloc( sizeof( struct __IDL__buffer_state ) );	if ( ! b )		YY_FATAL_ERROR( "out of dynamic memory in __IDL__create_buffer()" );	b->__IDL__buf_size = size;	/* __IDL__ch_buf has to be 2 characters longer than the size given because	 * we need to put in 2 end-of-buffer characters.	 */	b->__IDL__ch_buf = (char *) __IDL__flex_alloc( b->__IDL__buf_size + 2 );	if ( ! b->__IDL__ch_buf )		YY_FATAL_ERROR( "out of dynamic memory in __IDL__create_buffer()" );	b->__IDL__is_our_buffer = 1;	__IDL__init_buffer( b, file );	return b;	}#ifdef YY_USE_PROTOSvoid __IDL__delete_buffer( YY_BUFFER_STATE b )#elsevoid __IDL__delete_buffer( b )YY_BUFFER_STATE b;#endif	{	if ( ! b )		return;	if ( b == __IDL__current_buffer )		__IDL__current_buffer = (YY_BUFFER_STATE) 0;	if ( b->__IDL__is_our_buffer )		__IDL__flex_free( (void *) b->__IDL__ch_buf );	__IDL__flex_free( (void *) b );	}#ifndef YY_ALWAYS_INTERACTIVE#ifndef YY_NEVER_INTERACTIVEextern int isatty YY_PROTO(( int ));#endif#endif#ifdef YY_USE_PROTOSvoid __IDL__init_buffer( YY_BUFFER_STATE b, FILE *file )#elsevoid __IDL__init_buffer( b, file )YY_BUFFER_STATE b;FILE *file;#endif	{	__IDL__flush_buffer( b );	b->__IDL__input_file = file;	b->__IDL__fill_buffer = 1;#if YY_ALWAYS_INTERACTIVE	b->__IDL__is_interactive = 1;#else#if YY_NEVER_INTERACTIVE	b->__IDL__is_interactive = 0;#else	b->__IDL__is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;#endif#endif	}#ifdef YY_USE_PROTOSvoid __IDL__flush_buffer( YY_BUFFER_STATE b )#elsevoid __IDL__flush_buffer( b )YY_BUFFER_STATE b;#endif	{	if ( ! b )		return;	b->__IDL__n_chars = 0;	/* We always need two end-of-buffer characters.  The first causes	 * a transition to the end-of-buffer state.  The second causes	 * a jam in that state.	 */	b->__IDL__ch_buf[0] = YY_END_OF_BUFFER_CHAR;	b->__IDL__ch_buf[1] = YY_END_OF_BUFFER_CHAR;	b->__IDL__buf_pos = &b->__IDL__ch_buf[0];	b->__IDL__at_bol = 1;	b->__IDL__buffer_status = YY_BUFFER_NEW;	if ( b == __IDL__current_buffer )		__IDL__load_buffer_state();	}#ifndef YY_NO_SCAN_BUFFER#ifdef YY_USE_PROTOSYY_BUFFER_STATE __IDL__scan_buffer( char *base, __IDL__size_t size )#elseYY_BUFFER_STATE __IDL__scan_buffer( base, size )char *base;__IDL__size_t size;#endif	{	YY_BUFFER_STATE b;	if ( size < 2 ||	     base[size-2] != YY_END_OF_BUFFER_CHAR ||	     base[size-1] != YY_END_OF_BUFFER_CHAR )		/* They forgot to leave room for the EOB's. */		return 0;	b = (YY_BUFFER_STATE) __IDL__flex_alloc( sizeof( struct __IDL__buffer_state ) );	if ( ! b )		YY_FATAL_ERROR( "out of dynamic memory in __IDL__scan_buffer()" );	b->__IDL__buf_size = size - 2;	/* "- 2" to take care of EOB's */	b->__IDL__buf_pos = b->__IDL__ch_buf = base;	b->__IDL__is_our_buffer = 0;	b->__IDL__input_file = 0;	b->__IDL__n_chars = b->__IDL__buf_size;	b->__IDL__is_interactive = 0;	b->__IDL__at_bol = 1;	b->__IDL__fill_buffer = 0;	b->__IDL__buffer_status = YY_BUFFER_NEW;	__IDL__switch_to_buffer( b );	return b;	}#endif#ifndef YY_NO_SCAN_STRING#ifdef YY_USE_PROTOSYY_BUFFER_STATE __IDL__scan_string( __IDL

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?