⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lexer.c

📁 CORBA上的libIDL源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
YY_RULE_SETUP#line 252 "./lexer.l"tokreturn (TOK_STRING);	YY_BREAKcase 43:YY_RULE_SETUP#line 253 "./lexer.l"tokreturn (TOK_STRUCT);	YY_BREAKcase 44:YY_RULE_SETUP#line 254 "./lexer.l"tokreturn (TOK_SWITCH);	YY_BREAKcase 45:YY_RULE_SETUP#line 255 "./lexer.l"tokreturn (TOK_TYPEDEF);	YY_BREAKcase 46:YY_RULE_SETUP#line 256 "./lexer.l"tokreturn (TOK_UNION);	YY_BREAKcase 47:YY_RULE_SETUP#line 257 "./lexer.l"tokreturn (TOK_UNSIGNED);	YY_BREAKcase 48:YY_RULE_SETUP#line 258 "./lexer.l"tokreturn (TOK_VARARGS);	YY_BREAKcase 49:YY_RULE_SETUP#line 259 "./lexer.l"tokreturn (TOK_VOID);	YY_BREAKcase 50:YY_RULE_SETUP#line 260 "./lexer.l"tokreturn (TOK_WCHAR);	YY_BREAKcase 51:YY_RULE_SETUP#line 261 "./lexer.l"tokreturn (TOK_WSTRING);	YY_BREAKcase 52:YY_RULE_SETUP#line 262 "./lexer.l"tokreturn (TOK_OP_SCOPE);	YY_BREAKcase 53:YY_RULE_SETUP#line 263 "./lexer.l"tokreturn (TOK_OP_SHR);	YY_BREAKcase 54:YY_RULE_SETUP#line 264 "./lexer.l"tokreturn (TOK_OP_SHL);	YY_BREAKcase 55:YY_RULE_SETUP#line 265 "./lexer.l"{	char *s = g_strdup (__IDL_text);	/* Get the parenthesized expression (ignoring whitespace) */	sscanf (__IDL_text, "__declspec %*[(] %[A-Za-z_] %*[)]", s);	__IDL_lval.str = s;	__IDL_cur_line += count_nl (__IDL_text);	tokreturn (TOK_DECLSPEC);}	YY_BREAKcase 56:YY_RULE_SETUP#line 274 "./lexer.l"{	if (__IDL_flags & IDLF_TYPECODES && strcmp (__IDL_text, "TypeCode") == 0)		tokreturn (TOK_TYPECODE);	__IDL_lval.str = g_strdup (__IDL_text);	tokreturn (TOK_IDENT);}	YY_BREAKcase 57:YY_RULE_SETUP#line 280 "./lexer.l"{	__IDL_errorv ("`%s' is not a valid identifier in IDL", __IDL_text);	__IDL_error ("(Identifiers cannot start with an underscore)");	__IDL_lval.str = g_strdup (__IDL_text);	tokreturn (TOK_IDENT);}	YY_BREAKcase 58:YY_RULE_SETUP#line 286 "./lexer.l"{	if (!warn_underscores) {		__IDL_warningv (IDL_WARNING2,			   "`%s' underscores within identifiers are discouraged for use "			   "with C-language IDL mappings", __IDL_text);		warn_underscores = 1;	}	__IDL_lval.str = g_strdup (__IDL_text);	tokreturn (TOK_IDENT);}	YY_BREAKcase 59:YY_RULE_SETUP#line 296 "./lexer.l"{	__IDL_flagsi &= ~IDLFP_PROPERTIES;	SELECT_RESTART;	tokreturn (__IDL_text[0]);}	YY_BREAKcase 60:YY_RULE_SETUP#line 301 "./lexer.l"{	__IDL_lval.str = g_strdup (__IDL_text);	tokreturn (TOK_PROP_KEY);}	YY_BREAKcase 61:YY_RULE_SETUP#line 305 "./lexer.l"{	__IDL_lval.str = g_strdup (__IDL_text + 1);	__IDL_lval.str[strlen (__IDL_lval.str) - 1] = 0;	tokreturn (TOK_PROP_VALUE);}	YY_BREAKcase 62:YY_RULE_SETUP#line 310 "./lexer.l"{	__IDL_flagsi &= ~IDLFP_NATIVE;	__IDL_lval.str = g_strdup (__IDL_text);	__IDL_lval.str[strlen (__IDL_lval.str) - 1] = 0;	tokreturn (TOK_NATIVE_TYPE);}	YY_BREAKcase 63:YY_RULE_SETUP#line 316 "./lexer.l"{	__IDL_lval.str = g_strdup (__IDL_text + 1);	__IDL_lval.str[strlen (__IDL_text) - 2] = 0;	tokreturn (TOK_SQSTRING);}	YY_BREAKcase 64:YY_RULE_SETUP#line 321 "./lexer.l"{	__IDL_lval.str = g_strdup (__IDL_text + 1);	__IDL_lval.str[strlen (__IDL_text) - 2] = 0;	tokreturn (TOK_DQSTRING);}	YY_BREAKcase 65:YY_RULE_SETUP#line 326 "./lexer.l"++__IDL_cur_line;	YY_BREAKcase 66:YY_RULE_SETUP#line 327 "./lexer.l";	YY_BREAKcase 67:YY_RULE_SETUP#line 328 "./lexer.l"{	int c;	while (1) {		while ((c = input ()) != '*' && c != EOF)			if (c == '\n') ++__IDL_cur_line;		if (c == '*') {			while ((c = input ()) == '*') ;			if (c == '/') break;		}		if (c == '\n') ++__IDL_cur_line;		if (c == EOF) {			__IDL_warning (IDL_WARNING1, "End of file in comment");			break;		}	}}	YY_BREAKcase 68:YY_RULE_SETUP#line 345 "./lexer.l"tokreturn (__IDL_text[0]);	YY_BREAKcase 69:YY_RULE_SETUP#line 347 "./lexer.l"ECHO;	YY_BREAKcase YY_STATE_EOF(INITIAL):case YY_STATE_EOF(XP):case YY_STATE_EOF(PROP):case YY_STATE_EOF(NATIVE):case YY_STATE_EOF(CFRG):case YY_STATE_EOF(CFRGX):	__IDL_terminate();	case YY_END_OF_BUFFER:		{		/* Amount of text matched not including the EOB char. */		int __IDL__amount_of_matched_text = (int) (__IDL__cp - __IDL_text_ptr) - 1;		/* Undo the effects of YY_DO_BEFORE_ACTION. */		*__IDL__cp = __IDL__hold_char;		YY_RESTORE_YY_MORE_OFFSET		if ( __IDL__current_buffer->__IDL__buffer_status == YY_BUFFER_NEW )			{			/* We're scanning a new file or input source.  It's			 * possible that this happened because the user			 * just pointed __IDL_in at a new source and called			 * __IDL_lex().  If so, then we have to assure			 * consistency between __IDL__current_buffer and our			 * globals.  Here is the right place to do so, because			 * this is the first action (other than possibly a			 * back-up) that will match for the new input source.			 */			__IDL__n_chars = __IDL__current_buffer->__IDL__n_chars;			__IDL__current_buffer->__IDL__input_file = __IDL_in;			__IDL__current_buffer->__IDL__buffer_status = YY_BUFFER_NORMAL;			}		/* Note that here we test for __IDL__c_buf_p "<=" to the position		 * of the first EOB in the buffer, since __IDL__c_buf_p will		 * already have been incremented past the NUL character		 * (since all states make transitions on EOB to the		 * end-of-buffer state).  Contrast this with the test		 * in input().		 */		if ( __IDL__c_buf_p <= &__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars] )			{ /* This was really a NUL. */			__IDL__state_type __IDL__next_state;			__IDL__c_buf_p = __IDL_text_ptr + __IDL__amount_of_matched_text;			__IDL__current_state = __IDL__get_previous_state();			/* Okay, we're now positioned to make the NUL			 * transition.  We couldn't have			 * __IDL__get_previous_state() go ahead and do it			 * for us because it doesn't know how to deal			 * with the possibility of jamming (and we don't			 * want to build jamming into it because then it			 * will run more slowly).			 */			__IDL__next_state = __IDL__try_NUL_trans( __IDL__current_state );			__IDL__bp = __IDL_text_ptr + YY_MORE_ADJ;			if ( __IDL__next_state )				{				/* Consume the NUL. */				__IDL__cp = ++__IDL__c_buf_p;				__IDL__current_state = __IDL__next_state;				goto __IDL__match;				}			else				{				__IDL__cp = __IDL__c_buf_p;				goto __IDL__find_action;				}			}		else switch ( __IDL__get_next_buffer() )			{			case EOB_ACT_END_OF_FILE:				{				__IDL__did_buffer_switch_on_eof = 0;				if ( __IDL_wrap() )					{					/* Note: because we've taken care in					 * __IDL__get_next_buffer() to have set up					 * __IDL_text, we can now set up					 * __IDL__c_buf_p so that if some total					 * hoser (like flex itself) wants to					 * call the scanner after we return the					 * YY_NULL, it'll still work - another					 * YY_NULL will get returned.					 */					__IDL__c_buf_p = __IDL_text_ptr + YY_MORE_ADJ;					__IDL__act = YY_STATE_EOF(YY_START);					goto do_action;					}				else					{					if ( ! __IDL__did_buffer_switch_on_eof )						YY_NEW_FILE;					}				break;				}			case EOB_ACT_CONTINUE_SCAN:				__IDL__c_buf_p =					__IDL_text_ptr + __IDL__amount_of_matched_text;				__IDL__current_state = __IDL__get_previous_state();				__IDL__cp = __IDL__c_buf_p;				__IDL__bp = __IDL_text_ptr + YY_MORE_ADJ;				goto __IDL__match;			case EOB_ACT_LAST_MATCH:				__IDL__c_buf_p =				&__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars];				__IDL__current_state = __IDL__get_previous_state();				__IDL__cp = __IDL__c_buf_p;				__IDL__bp = __IDL_text_ptr + YY_MORE_ADJ;				goto __IDL__find_action;			}		break;		}	default:		YY_FATAL_ERROR(			"fatal flex scanner internal error--no action found" );	} /* end of action switch */		} /* end of scanning one token */	} /* end of __IDL_lex *//* __IDL__get_next_buffer - try to read in a new buffer * * Returns a code representing an action: *	EOB_ACT_LAST_MATCH - *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position *	EOB_ACT_END_OF_FILE - end of file */static int __IDL__get_next_buffer()	{	register char *dest = __IDL__current_buffer->__IDL__ch_buf;	register char *source = __IDL_text_ptr;	register int number_to_move, i;	int ret_val;	if ( __IDL__c_buf_p > &__IDL__current_buffer->__IDL__ch_buf[__IDL__n_chars + 1] )		YY_FATAL_ERROR(		"fatal flex scanner internal error--end of buffer missed" );	if ( __IDL__current_buffer->__IDL__fill_buffer == 0 )		{ /* Don't try to fill the buffer, so this is an EOF. */		if ( __IDL__c_buf_p - __IDL_text_ptr - YY_MORE_ADJ == 1 )			{			/* We matched a single character, the EOB, so			 * treat this as a final EOF.			 */			return EOB_ACT_END_OF_FILE;			}		else			{			/* We matched some text prior to the EOB, first			 * process it.			 */			return EOB_ACT_LAST_MATCH;			}		}	/* Try to read more data. */	/* First move last chars to start of buffer. */	number_to_move = (int) (__IDL__c_buf_p - __IDL_text_ptr) - 1;	for ( i = 0; i < number_to_move; ++i )		*(dest++) = *(source++);	if ( __IDL__current_buffer->__IDL__buffer_status == YY_BUFFER_EOF_PENDING )		/* don't do the read, it's not guaranteed to return an EOF,		 * just force an EOF		 */		__IDL__current_buffer->__IDL__n_chars = __IDL__n_chars = 0;	else		{		int num_to_read =			__IDL__current_buffer->__IDL__buf_size - number_to_move - 1;		while ( num_to_read <= 0 )			{ /* Not enough room in the buffer - grow it. */#ifdef YY_USES_REJECT			YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT" );#else			/* just a shorter name for the current buffer */			YY_BUFFER_STATE b = __IDL__current_buffer;			int __IDL__c_buf_p_offset =				(int) (__IDL__c_buf_p - b->__IDL__ch_buf);			if ( b->__IDL__is_our_buffer )				{				int new_size = b->__IDL__buf_size * 2;				if ( new_size <= 0 )					b->__IDL__buf_size += b->__IDL__buf_size / 8;				else					b->__IDL__buf_size *= 2;				b->__IDL__ch_buf = (char *)					/* Include room in for 2 EOB chars. */					__IDL__flex_realloc( (void *) b->__IDL__ch_buf,							 b->__IDL__buf_size + 2 );				}			else				/* Can't grow it, we don't own it. */				b->__IDL__ch_buf = 0;			if ( ! b->__IDL__ch_buf )				YY_FATAL_ERROR(				"fatal error - scanner input buffer overflow" );			__IDL__c_buf_p = &b->__IDL__ch_buf[__IDL__c_buf_p_offset];			num_to_read = __IDL__current_buffer->__IDL__buf_size -						number_to_move - 1;#endif

⌨️ 快捷键说明

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