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

📄 scan.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
static yy_state_type yy_last_accepting_state;static char *yy_last_accepting_cpos;/* The intent behind this definition is that it'll catch * any uses of REJECT which lex missed. */#define REJECT reject_used_but_not_detected#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0char *yytext;# line 1 "scan.l"/* scan.l - scanner for flex input */# line 4 "scan.l"/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Vern Paxson. *  * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. * * Redistribution and use in source and binary forms are permitted provided * that: (1) source distributions retain this entire copyright notice and * comment, and (2) distributions including binaries display the following * acknowledgement:  ``This product includes software developed by the * University of California, Berkeley and its contributors'' in the * documentation or other materials provided with the distribution and in * all advertising materials mentioning features or use of this software. * Neither the name of the University nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *//* $Header: scan.l,v 1.2 94/01/04 14:33:09 vern Exp $ */#include "flexdef.h"#include "parse.h"#define ACTION_ECHO add_action( yytext )#define MARK_END_OF_PROLOG mark_prolog();#define YY_DECL \	int flexscan()#define RETURNCHAR \	yylval = (unsigned char) yytext[0]; \	return CHAR;#define RETURNNAME \	strcpy( nmstr, yytext ); \	return NAME;#define PUT_BACK_STRING(str, start) \	for ( i = strlen( str ) - 1; i >= start; --i ) \		unput((str)[i])#define CHECK_REJECT(str) \	if ( all_upper( str ) ) \		reject = true;#define CHECK_YYMORE(str) \	if ( all_lower( str ) ) \		yymore_used = true;/* Macros after this point can all be overridden by user definitions in * section 1. */#ifdef YY_MALLOC_DECLYY_MALLOC_DECL#else#if __STDC__#ifndef __cplusplus#include <stdlib.h>#endif#else/* Just try to get by without declaring the routines.  This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \	if ( yy_current_buffer->yy_is_interactive ) \		{ \		int c = getc( yyin ); \		result = c == EOF ? 0 : 1; \		buf[0] = (char) c; \		} \	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \		  && ferror( yyin ) ) \		YY_FATAL_ERROR( "input in lex scanner failed" );#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL int yylex YY_PROTO(( void ))#endif/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endifYY_DECL	{	register yy_state_type yy_current_state;	register char *yy_cp, *yy_bp;	register int yy_act;# line 82 "scan.l"	static int bracelevel, didadef, indented_code, checking_used;	int doing_codeblock = false;	int i;	Char nmdef[MAXLINE], myesc();	if ( yy_init )		{#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! yy_start )			yy_start = 1;	/* first start state */		if ( ! yyin )			yyin = stdin;		if ( ! yyout )			yyout = stdout;		if ( yy_current_buffer )			yy_init_buffer( yy_current_buffer, yyin );		else			yy_current_buffer =				yy_create_buffer( yyin, YY_BUF_SIZE );		yy_load_buffer_state();		yy_init = 0;		}	while ( 1 )		/* loops until end-of-file is reached */		{		yy_cp = yy_c_buf_p;		/* Support of yytext. */		*yy_cp = yy_hold_char;		/* yy_bp points to the position in yy_ch_buf of the start of		 * the current run.		 */		yy_bp = yy_cp;		yy_current_state = yy_start;		if ( yy_bp[-1] == '\n' )			++yy_current_state;yy_match:		do			{			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];			if ( yy_accept[yy_current_state] )				{				yy_last_accepting_state = yy_current_state;				yy_last_accepting_cpos = yy_cp;				}			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )				{				yy_current_state = (int) yy_def[yy_current_state];				if ( yy_current_state >= 408 )					yy_c = yy_meta[(unsigned int) yy_c];				}			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];			++yy_cp;			}		while ( yy_base[yy_current_state] != 1615 );yy_find_action:		yy_act = yy_accept[yy_current_state];		YY_DO_BEFORE_ACTION;do_action:	/* This label is used only to access EOF actions. */		switch ( yy_act )	{ /* beginning of action switch */			case 0: /* must back up */			/* undo the effects of YY_DO_BEFORE_ACTION */			*yy_cp = yy_hold_char;			yy_cp = yy_last_accepting_cpos;			yy_current_state = yy_last_accepting_state;			goto yy_find_action;case 1:YY_USER_ACTION# line 90 "scan.l"indented_code = true; BEGIN(CODEBLOCK);	YY_BREAKcase 2:YY_USER_ACTION# line 91 "scan.l"ACTION_ECHO; BEGIN(C_COMMENT);	YY_BREAKcase 3:YY_USER_ACTION# line 92 "scan.l"return SCDECL;	YY_BREAKcase 4:YY_USER_ACTION# line 93 "scan.l"return XSCDECL;	YY_BREAKcase 5:YY_USER_ACTION# line 94 "scan.l"{			++linenum;			line_directive_out( (FILE *) 0 );			indented_code = false;			BEGIN(CODEBLOCK);			}	YY_BREAKcase 6:YY_USER_ACTION# line 101 "scan.l"return WHITESPACE;	YY_BREAKcase 7:YY_USER_ACTION# line 103 "scan.l"{			sectnum = 2;			bracelevel = 0;			mark_defs1();			line_directive_out( (FILE *) 0 );			BEGIN(SECT2PROLOG);			return SECTEND;			}	YY_BREAKcase 8:YY_USER_ACTION# line 112 "scan.l"{			if ( lex_compat )				warn( "%pointer incompatible with -l option" );			else				yytext_is_array = false;			++linenum;			}	YY_BREAKcase 9:YY_USER_ACTION# line 119 "scan.l"{			if ( C_plus_plus )				warn( "%array incompatible with -+ option" );			else				yytext_is_array = true;			++linenum;			}	YY_BREAKcase 10:YY_USER_ACTION# line 127 "scan.l"{			warn( "%used/%unused have been deprecated" );			checking_used = REALLY_USED; BEGIN(USED_LIST);			}	YY_BREAKcase 11:YY_USER_ACTION# line 131 "scan.l"{			warn( "%used/%unused have been deprecated" );			checking_used = REALLY_NOT_USED; BEGIN(USED_LIST);			}	YY_BREAKcase 12:YY_USER_ACTION# line 137 "scan.l"++linenum;	/* ignore */	YY_BREAKcase 13:YY_USER_ACTION# line 139 "scan.l"synerr( "unrecognized '%' directive" );	YY_BREAKcase 14:YY_USER_ACTION# line 141 "scan.l"{			strcpy( nmstr, yytext );			didadef = false;			BEGIN(PICKUPDEF);			}	YY_BREAKcase 15:YY_USER_ACTION# line 147 "scan.l"RETURNNAME;	YY_BREAKcase 16:YY_USER_ACTION# line 148 "scan.l"++linenum; /* allows blank lines in section 1 */	YY_BREAKcase 17:YY_USER_ACTION# line 149 "scan.l"++linenum; return '\n';	YY_BREAKcase 18:YY_USER_ACTION# line 152 "scan.l"ACTION_ECHO; BEGIN(INITIAL);	YY_BREAKcase 19:YY_USER_ACTION# line 153 "scan.l"++linenum; ACTION_ECHO; BEGIN(INITIAL);	YY_BREAKcase 20:YY_USER_ACTION# line 154 "scan.l"ACTION_ECHO;	YY_BREAKcase 21:YY_USER_ACTION# line 155 "scan.l"ACTION_ECHO;	YY_BREAKcase 22:YY_USER_ACTION# line 156 "scan.l"++linenum; ACTION_ECHO;	YY_BREAKcase 23:YY_USER_ACTION# line 159 "scan.l"++linenum; BEGIN(INITIAL);	YY_BREAKcase 24:YY_USER_ACTION# line 160 "scan.l"ACTION_ECHO; CHECK_REJECT(yytext);	YY_BREAKcase 25:YY_USER_ACTION# line 161 "scan.l"ACTION_ECHO; CHECK_YYMORE(yytext);	YY_BREAKcase 26:YY_USER_ACTION# line 162 "scan.l"ACTION_ECHO;	YY_BREAKcase 27:YY_USER_ACTION# line 163 "scan.l"{			++linenum;			ACTION_ECHO;			if ( indented_code )				BEGIN(INITIAL);			}	YY_BREAK

⌨️ 快捷键说明

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