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

📄 skel.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 3 页
字号:
  "",  "		yy_cp += dest - source;",  "		yy_bp += dest - source;",  "		yy_n_chars = yy_current_buffer->yy_buf_size;",  "",  "		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )",  "			YY_FATAL_ERROR( \"flex scanner push-back overflow\" );",  "		}",  "",  "	if ( yy_cp > yy_bp && yy_cp[-1] == '\\n' )",  "		yy_cp[-2] = '\\n';",  "",  "	*--yy_cp = (char) c;",  "",  "%% update yylineno here, if doing -l",  "",  "	/* Note: the formal parameter *must* be called \"yy_bp\" for this",  "	 * macro to now work correctly.",  "	 */",  "	YY_DO_BEFORE_ACTION; /* set up yytext again */",  "	}",  "",  "",  "%-",  "#ifdef __cplusplus",  "static int yyinput()",  "#else",  "static int input()",  "#endif",  "%+",  "int yyFlexLexer::yyinput()",  "%*",  "	{",  "	int c;",  "",  "	*yy_c_buf_p = yy_hold_char;",  "",  "	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )",  "		{",  "		/* yy_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 ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )",  "			/* This was really a NUL. */",  "			*yy_c_buf_p = '\\0';",  "",  "		else",  "			{ /* need more input */",  "			yytext_ptr = yy_c_buf_p;",  "			++yy_c_buf_p;",  "",  "			switch ( yy_get_next_buffer() )",  "				{",  "				case EOB_ACT_END_OF_FILE:",  "					{",  "					if ( yywrap() )",  "						{",  "						yy_c_buf_p =",  "						yytext_ptr + YY_MORE_ADJ;",  "						return EOF;",  "						}",  "",  "					YY_NEW_FILE;",  "#ifdef __cplusplus",  "					return yyinput();",  "#else",  "					return input();",  "#endif",  "					}",  "",  "				case EOB_ACT_CONTINUE_SCAN:",  "					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;",  "					break;",  "",  "				case EOB_ACT_LAST_MATCH:",  "#ifdef __cplusplus",  "					YY_FATAL_ERROR(",  "					\"unexpected last match in yyinput()\" );",  "#else",  "					YY_FATAL_ERROR(",  "					\"unexpected last match in input()\" );",  "#endif",  "				}",  "			}",  "		}",  "",  "	c = *yy_c_buf_p;",  "	*yy_c_buf_p = '\\0';	/* preserve yytext */",  "	yy_hold_char = *++yy_c_buf_p;",  "",  "	return c;",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "void yyrestart( FILE *input_file )",  "#else",  "void yyrestart( input_file )",  "FILE *input_file;",  "#endif",  "%+",  "void yyFlexLexer::yyrestart( istream* input_file )",  "%*",  "	{",  "	if ( ! yy_current_buffer )",  "		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );",  "",  "	yy_init_buffer( yy_current_buffer, input_file );",  "	yy_load_buffer_state();",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",  "#else",  "void yy_switch_to_buffer( new_buffer )",  "YY_BUFFER_STATE new_buffer;",  "#endif",  "%+",  "void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",  "%*",  "	{",  "	if ( yy_current_buffer == new_buffer )",  "		return;",  "",  "	if ( yy_current_buffer )",  "		{",  "		/* Flush out information for old buffer. */",  "		*yy_c_buf_p = yy_hold_char;",  "		yy_current_buffer->yy_buf_pos = yy_c_buf_p;",  "		yy_current_buffer->yy_n_chars = yy_n_chars;",  "		}",  "",  "	yy_current_buffer = new_buffer;",  "	yy_load_buffer_state();",  "",  "	/* We don't actually know whether we did this switch during",  "	 * EOF (yywrap()) processing, but the only time this flag",  "	 * is looked at is after yywrap() is called, so it's safe",  "	 * to go ahead and always set it.",  "	 */",  "	yy_did_buffer_switch_on_eof = 1;",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "void yy_load_buffer_state( void )",  "#else",  "void yy_load_buffer_state()",  "#endif",  "%+",  "void yyFlexLexer::yy_load_buffer_state()",  "%*",  "	{",  "	yy_n_chars = yy_current_buffer->yy_n_chars;",  "	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;",  "	yyin = yy_current_buffer->yy_input_file;",  "	yy_hold_char = *yy_c_buf_p;",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )",  "#else",  "YY_BUFFER_STATE yy_create_buffer( file, size )",  "FILE *file;",  "int size;",  "#endif",  "%+",  "YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )",  "%*",  "	{",  "	YY_BUFFER_STATE b;",  "",  "	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );",  "",  "	if ( ! b )",  "		YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",  "",  "	b->yy_buf_size = size;",  "",  "	/* yy_ch_buf has to be 2 characters longer than the size given because",  "	 * we need to put in 2 end-of-buffer characters.",  "	 */",  "	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );",  "",  "	if ( ! b->yy_ch_buf )",  "		YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",  "",  "	yy_init_buffer( b, file );",  "",  "	return b;",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "void yy_delete_buffer( YY_BUFFER_STATE b )",  "#else",  "void yy_delete_buffer( b )",  "YY_BUFFER_STATE b;",  "#endif",  "%+",  "void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )",  "%*",  "	{",  "	if ( b == yy_current_buffer )",  "		yy_current_buffer = (YY_BUFFER_STATE) 0;",  "",  "	yy_flex_free( (void *) b->yy_ch_buf );",  "	yy_flex_free( (void *) b );",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )",  "#else",  "void yy_init_buffer( b, file )",  "YY_BUFFER_STATE b;",  "FILE *file;",  "#endif",  "%+",  "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )",  "%*",  "	{",  "	b->yy_input_file = file;",  "",  "	/* We put in the '\\n' and start reading from [1] so that an",  "	 * initial match-at-newline will be true.",  "	 */",  "",  "	b->yy_ch_buf[0] = '\\n';",  "	b->yy_n_chars = 1;",  "",  "	/* 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->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;",  "	b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;",  "",  "	b->yy_buf_pos = &b->yy_ch_buf[1];",  "",  "%-",  "	b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;",  "%+",  "	b->yy_is_interactive = 0;",  "%*",  "",  "	b->yy_fill_buffer = 1;",  "",  "	b->yy_eof_status = EOF_NOT_SEEN;",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "static void yy_push_state( int new_state )",  "#else",  "static void yy_push_state( new_state )",  "int new_state;",  "#endif",  "%+",  "void yyFlexLexer::yy_push_state( int new_state )",  "%*",  "	{",  "	if ( yy_start_stack_ptr >= yy_start_stack_depth )",  "		{",  "		int new_size;",  "",  "		yy_start_stack_depth += YY_START_STACK_INCR;",  "		new_size = yy_start_stack_depth * sizeof( int );",  "",  "		if ( ! yy_start_stack )",  "			yy_start_stack = (int *) yy_flex_alloc( new_size );",  "",  "		else",  "			yy_start_stack = (int *) yy_flex_realloc(",  "					(void *) yy_start_stack, new_size );",  "",  "		if ( ! yy_start_stack )",  "			YY_FATAL_ERROR(",  "			\"out of memory expanding start-condition stack\" );",  "		}",  "",  "	yy_start_stack[yy_start_stack_ptr++] = YY_START;",  "",  "	BEGIN(new_state);",  "	}",  "",  "",  "%-",  "static void yy_pop_state()",  "%+",  "void yyFlexLexer::yy_pop_state()",  "%*",  "	{",  "	if ( --yy_start_stack_ptr < 0 )",  "		YY_FATAL_ERROR( \"start-condition stack underflow\" );",  "",  "	BEGIN(yy_start_stack[yy_start_stack_ptr]);",  "	}",  "",  "",  "%-",  "static int yy_top_state()",  "%+",  "int yyFlexLexer::yy_top_state()",  "%*",  "	{",  "	return yy_start_stack[yy_start_stack_ptr - 1];",  "	}",  "",  "",  "%-",  "#ifdef YY_USE_PROTOS",  "static void yy_fatal_error( const char msg[] )",  "#else",  "static void yy_fatal_error( msg )",  "char msg[];",  "#endif",  "	{",  "	(void) fprintf( stderr, \"%s\\n\", msg );",  "	exit( 1 );",  "	}",  "",  "%+",  "",  "void yyFlexLexer::LexerError( const char msg[] )",  "	{",  "	cerr << msg << '\\n';",  "	exit( 1 );",  "	}",  "%*",  "",  "",  "/* Redefine yyless() so it works in section 3 code. */",  "",  "#undef yyless",  "#define yyless(n) \\",  "	do \\",  "		{ \\",  "		/* Undo effects of setting up yytext. */ \\",  "		yytext[yyleng] = yy_hold_char; \\",  "		yy_c_buf_p = yytext + n - YY_MORE_ADJ; \\",  "		yy_hold_char = *yy_c_buf_p; \\",  "		*yy_c_buf_p = '\\0'; \\",  "		yyleng = n; \\",  "		} \\",  "	while ( 0 )",  "",  "",  "/* Internal utility routines. */",  "",  "#ifndef yytext_ptr",  "#ifdef YY_USE_PROTOS",  "static void yy_flex_strcpy( char *s1, const char *s2 )",  "#else",  "static void yy_flex_strcpy( s1, s2 )",  "char *s1;",  "const char *s2;",  "#endif",  "	{",  "	while ( (*(s1++) = *(s2++)) )",  "		;",  "	}",  "#endif",  "",  "",  "#ifdef YY_USE_PROTOS",  "static void *yy_flex_alloc( unsigned int size )",  "#else",  "static void *yy_flex_alloc( size )",  "unsigned int size;",  "#endif",  "	{",  "	return (void *) malloc( size );",  "	}",  "",  "#ifdef YY_USE_PROTOS",  "static void *yy_flex_realloc( void *ptr, unsigned int size )",  "#else",  "static void *yy_flex_realloc( ptr, size )",  "void *ptr;",  "unsigned int size;",  "#endif",  "	{",  "	return (void *) realloc( ptr, size );",  "	}",  "",  "#ifdef YY_USE_PROTOS",  "static void yy_flex_free( void *ptr )",  "#else",  "static void yy_flex_free( ptr )",  "void *ptr;",  "#endif",  "	{",  "	free( ptr );",  "	}",  0};

⌨️ 快捷键说明

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