亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? dfa.c

?? 編譯原理(Flex):生成詞法和語(yǔ)法分析程序的源代碼的程序。
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* dfa - DFA construction routines */

/*-
 * 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: /home/daffy/u0/vern/flex/RCS/dfa.c,v 2.26 95/04/20 13:53:14 vern Exp $ */

#include "flexdef.h"


/* declare functions that have forward references */

void dump_associated_rules PROTO((FILE*, int));
void dump_transitions PROTO((FILE*, int[]));
void sympartition PROTO((int[], int, int[], int[]));
int symfollowset PROTO((int[], int, int, int[]));


/* check_for_backing_up - check a DFA state for backing up
 *
 * synopsis
 *     void check_for_backing_up( int ds, int state[numecs] );
 *
 * ds is the number of the state to check and state[] is its out-transitions,
 * indexed by equivalence class.
 */

void check_for_backing_up( ds, state )
int ds;
int state[];
	{
	if ( (reject && ! dfaacc[ds].dfaacc_set) ||
	     (! reject && ! dfaacc[ds].dfaacc_state) )
		{ /* state is non-accepting */
		++num_backing_up;

		if ( backing_up_report )
			{
			fprintf( backing_up_file,
				_( "State #%d is non-accepting -\n" ), ds );

			/* identify the state */
			dump_associated_rules( backing_up_file, ds );

			/* Now identify it further using the out- and
			 * jam-transitions.
			 */
			dump_transitions( backing_up_file, state );

			putc( '\n', backing_up_file );
			}
		}
	}


/* check_trailing_context - check to see if NFA state set constitutes
 *                          "dangerous" trailing context
 *
 * synopsis
 *    void check_trailing_context( int nfa_states[num_states+1], int num_states,
 *				int accset[nacc+1], int nacc );
 *
 * NOTES
 *  Trailing context is "dangerous" if both the head and the trailing
 *  part are of variable size \and/ there's a DFA state which contains
 *  both an accepting state for the head part of the rule and NFA states
 *  which occur after the beginning of the trailing context.
 *
 *  When such a rule is matched, it's impossible to tell if having been
 *  in the DFA state indicates the beginning of the trailing context or
 *  further-along scanning of the pattern.  In these cases, a warning
 *  message is issued.
 *
 *    nfa_states[1 .. num_states] is the list of NFA states in the DFA.
 *    accset[1 .. nacc] is the list of accepting numbers for the DFA state.
 */

void check_trailing_context( nfa_states, num_states, accset, nacc )
int *nfa_states, num_states;
int *accset;
int nacc;
	{
	register int i, j;

	for ( i = 1; i <= num_states; ++i )
		{
		int ns = nfa_states[i];
		register int type = state_type[ns];
		register int ar = assoc_rule[ns];

		if ( type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE )
			{ /* do nothing */
			}

		else if ( type == STATE_TRAILING_CONTEXT )
			{
			/* Potential trouble.  Scan set of accepting numbers
			 * for the one marking the end of the "head".  We
			 * assume that this looping will be fairly cheap
			 * since it's rare that an accepting number set
			 * is large.
			 */
			for ( j = 1; j <= nacc; ++j )
				if ( accset[j] & YY_TRAILING_HEAD_MASK )
					{
					line_warning(
					_( "dangerous trailing context" ),
						rule_linenum[ar] );
					return;
					}
			}
		}
	}


/* dump_associated_rules - list the rules associated with a DFA state
 *
 * Goes through the set of NFA states associated with the DFA and
 * extracts the first MAX_ASSOC_RULES unique rules, sorts them,
 * and writes a report to the given file.
 */

void dump_associated_rules( file, ds )
FILE *file;
int ds;
	{
	register int i, j;
	register int num_associated_rules = 0;
	int rule_set[MAX_ASSOC_RULES + 1];
	int *dset = dss[ds];
	int size = dfasiz[ds];

	for ( i = 1; i <= size; ++i )
		{
		register int rule_num = rule_linenum[assoc_rule[dset[i]]];

		for ( j = 1; j <= num_associated_rules; ++j )
			if ( rule_num == rule_set[j] )
				break;

		if ( j > num_associated_rules )
			{ /* new rule */
			if ( num_associated_rules < MAX_ASSOC_RULES )
				rule_set[++num_associated_rules] = rule_num;
			}
		}

	bubble( rule_set, num_associated_rules );

	fprintf( file, _( " associated rule line numbers:" ) );

	for ( i = 1; i <= num_associated_rules; ++i )
		{
		if ( i % 8 == 1 )
			putc( '\n', file );

		fprintf( file, "\t%d", rule_set[i] );
		}

	putc( '\n', file );
	}


/* dump_transitions - list the transitions associated with a DFA state
 *
 * synopsis
 *     dump_transitions( FILE *file, int state[numecs] );
 *
 * Goes through the set of out-transitions and lists them in human-readable
 * form (i.e., not as equivalence classes); also lists jam transitions
 * (i.e., all those which are not out-transitions, plus EOF).  The dump
 * is done to the given file.
 */

void dump_transitions( file, state )
FILE *file;
int state[];
	{
	register int i, ec;
	int out_char_set[CSIZE];

	for ( i = 0; i < csize; ++i )
		{
		ec = ABS( ecgroup[i] );
		out_char_set[i] = state[ec];
		}

	fprintf( file, _( " out-transitions: " ) );

	list_character_set( file, out_char_set );

	/* now invert the members of the set to get the jam transitions */
	for ( i = 0; i < csize; ++i )
		out_char_set[i] = ! out_char_set[i];

	fprintf( file, _( "\n jam-transitions: EOF " ) );

	list_character_set( file, out_char_set );

	putc( '\n', file );
	}


/* epsclosure - construct the epsilon closure of a set of ndfa states
 *
 * synopsis
 *    int *epsclosure( int t[num_states], int *numstates_addr,
 *			int accset[num_rules+1], int *nacc_addr,
 *			int *hashval_addr );
 *
 * NOTES
 *  The epsilon closure is the set of all states reachable by an arbitrary
 *  number of epsilon transitions, which themselves do not have epsilon
 *  transitions going out, unioned with the set of states which have non-null
 *  accepting numbers.  t is an array of size numstates of nfa state numbers.
 *  Upon return, t holds the epsilon closure and *numstates_addr is updated.
 *  accset holds a list of the accepting numbers, and the size of accset is
 *  given by *nacc_addr.  t may be subjected to reallocation if it is not
 *  large enough to hold the epsilon closure.
 *
 *  hashval is the hash value for the dfa corresponding to the state set.
 */

int *epsclosure( t, ns_addr, accset, nacc_addr, hv_addr )
int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
	{
	register int stkpos, ns, tsp;
	int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
	int stkend, nstate;
	static int did_stk_init = false, *stk; 

#define MARK_STATE(state) \
trans1[state] = trans1[state] - MARKER_DIFFERENCE;

#define IS_MARKED(state) (trans1[state] < 0)

#define UNMARK_STATE(state) \
trans1[state] = trans1[state] + MARKER_DIFFERENCE;

#define CHECK_ACCEPT(state) \
{ \
nfaccnum = accptnum[state]; \
if ( nfaccnum != NIL ) \
accset[++nacc] = nfaccnum; \
}

#define DO_REALLOCATION \
{ \
current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \
++num_reallocs; \
t = reallocate_integer_array( t, current_max_dfa_size ); \
stk = reallocate_integer_array( stk, current_max_dfa_size ); \
} \

#define PUT_ON_STACK(state) \
{ \
if ( ++stkend >= current_max_dfa_size ) \
DO_REALLOCATION \
stk[stkend] = state; \
MARK_STATE(state) \
}

#define ADD_STATE(state) \
{ \
if ( ++numstates >= current_max_dfa_size ) \
DO_REALLOCATION \
t[numstates] = state; \
hashval += state; \
}

#define STACK_STATE(state) \
{ \
PUT_ON_STACK(state) \
CHECK_ACCEPT(state) \
if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \
ADD_STATE(state) \
}


	if ( ! did_stk_init )
		{
		stk = allocate_integer_array( current_max_dfa_size );
		did_stk_init = true;
		}

	nacc = stkend = hashval = 0;

	for ( nstate = 1; nstate <= numstates; ++nstate )
		{
		ns = t[nstate];

		/* The state could be marked if we've already pushed it onto
		 * the stack.
		 */
		if ( ! IS_MARKED(ns) )
			{
			PUT_ON_STACK(ns)
			CHECK_ACCEPT(ns)
			hashval += ns;
			}
		}

	for ( stkpos = 1; stkpos <= stkend; ++stkpos )
		{
		ns = stk[stkpos];
		transsym = transchar[ns];

		if ( transsym == SYM_EPSILON )
			{
			tsp = trans1[ns] + MARKER_DIFFERENCE;

			if ( tsp != NO_TRANSITION )
				{
				if ( ! IS_MARKED(tsp) )
					STACK_STATE(tsp)

				tsp = trans2[ns];

				if ( tsp != NO_TRANSITION && ! IS_MARKED(tsp) )
					STACK_STATE(tsp)
				}
			}
		}

	/* Clear out "visit" markers. */

	for ( stkpos = 1; stkpos <= stkend; ++stkpos )
		{
		if ( IS_MARKED(stk[stkpos]) )
			UNMARK_STATE(stk[stkpos])
		else
			flexfatal(
			_( "consistency check failed in epsclosure()" ) );
		}

	*ns_addr = numstates;
	*hv_addr = hashval;
	*nacc_addr = nacc;

	return t;
	}


/* increase_max_dfas - increase the maximum number of DFAs */

void increase_max_dfas()
	{
	current_max_dfas += MAX_DFAS_INCREMENT;

	++num_reallocs;

	base = reallocate_integer_array( base, current_max_dfas );
	def = reallocate_integer_array( def, current_max_dfas );
	dfasiz = reallocate_integer_array( dfasiz, current_max_dfas );
	accsiz = reallocate_integer_array( accsiz, current_max_dfas );
	dhash = reallocate_integer_array( dhash, current_max_dfas );
	dss = reallocate_int_ptr_array( dss, current_max_dfas );
	dfaacc = reallocate_dfaacc_union( dfaacc, current_max_dfas );

	if ( nultrans )
		nultrans =
			reallocate_integer_array( nultrans, current_max_dfas );
	}


/* ntod - convert an ndfa to a dfa
 *
 * Creates the dfa corresponding to the ndfa we've constructed.  The
 * dfa starts out in state #1.
 */

void ntod()
	{
	int *accset, ds, nacc, newds;
	int sym, hashval, numstates, dsize;
	int num_full_table_rows;	/* used only for -f */
	int *nset, *dset;
	int targptr, totaltrans, i, comstate, comfreq, targ;
	int symlist[CSIZE + 1];
	int num_start_states;
	int todo_head, todo_next;

	/* Note that the following are indexed by *equivalence classes*
	 * and not by characters.  Since equivalence classes are indexed
	 * beginning with 1, even if the scanner accepts NUL's, this
	 * means that (since every character is potentially in its own
	 * equivalence class) these arrays must have room for indices
	 * from 1 to CSIZE, so their size must be CSIZE + 1.
	 */
	int duplist[CSIZE + 1], state[CSIZE + 1];
	int targfreq[CSIZE + 1], targstate[CSIZE + 1];

	accset = allocate_integer_array( num_rules + 1 );
	nset = allocate_integer_array( current_max_dfa_size );

	/* The "todo" queue is represented by the head, which is the DFA
	 * state currently being processed, and the "next", which is the
	 * next DFA state number available (not in use).  We depend on the
	 * fact that snstods() returns DFA's \in increasing order/, and thus
	 * need only know the bounds of the dfas to be processed.
	 */
	todo_head = todo_next = 0;

	for ( i = 0; i <= csize; ++i )
		{
		duplist[i] = NIL;
		symlist[i] = false;
		}

	for ( i = 0; i <= num_rules; ++i )
		accset[i] = NIL;

	if ( trace )
		{
		dumpnfa( scset[1] );
		fputs( _( "\n\nDFA Dump:\n\n" ), stderr );
		}

	inittbl();

	/* Check to see whether we should build a separate table for
	 * transitions on NUL characters.  We don't do this for full-speed
	 * (-F) scanners, since for them we don't have a simple state
	 * number lying around with which to index the table.  We also
	 * don't bother doing it for scanners unless (1) NUL is in its own
	 * equivalence class (indicated by a positive value of
	 * ecgroup[NUL]), (2) NUL's equivalence class is the last
	 * equivalence class, and (3) the number of equivalence classes is
	 * the same as the number of characters.  This latter case comes
	 * about when useecs is false or when it's true but every character
	 * still manages to land in its own class (unlikely, but it's
	 * cheap to check for).  If all these things are true then the
	 * character code needed to represent NUL's equivalence class for
	 * indexing the tables is going to take one more bit than the
	 * number of characters, and therefore we won't be assured of
	 * being able to fit it into a YY_CHAR variable.  This rules out
	 * storing the transitions in a compressed table, since the code
	 * for interpreting them uses a YY_CHAR variable (perhaps it
	 * should just use an integer, though; this is worth pondering ...
	 * ###).
	 *
	 * Finally, for full tables, we want the number of entries in the
	 * table to be a power of two so the array references go fast (it
	 * will just take a shift to compute the major index).  If
	 * encoding NUL's transitions in the table will spoil this, we
	 * give it its own table (note that this will be the case if we're
	 * not using equivalence classes).
	 */

	/* Note that the test for ecgroup[0] == numecs below accomplishes
	 * both (1) and (2) above
	 */
	if ( ! fullspd && ecgroup[0] == numecs )
		{
		/* NUL is alone in its equivalence class, which is the
		 * last one.
		 */
		int use_NUL_table = (numecs == csize);

		if ( fulltbl && ! use_NUL_table )
			{
			/* We still may want to use the table if numecs
			 * is a power of 2.
			 */
			int power_of_two;

			for ( power_of_two = 1; power_of_two <= csize;
			      power_of_two *= 2 )
				if ( numecs == power_of_two )
					{
					use_NUL_table = true;
					break;
					}
			}

		if ( use_NUL_table )
			nultrans = allocate_integer_array( current_max_dfas );

		/* From now on, nultrans != nil indicates that we're
		 * saving null transitions for later, separate encoding.
		 */
		}


	if ( fullspd )
		{
		for ( i = 0; i <= numecs; ++i )
			state[i] = 0;

		place_state( state, 0, 0 );
		dfaacc[0].dfaacc_state = 0;
		}

	else if ( fulltbl )
		{
		if ( nultrans )
			/* We won't be including NUL's transitions in the
			 * table, so build it for entries from 0 .. numecs - 1.
			 */
			num_full_table_rows = numecs;

		else
			/* Take into account the fact that we'll be including
			 * the NUL entries in the transition table.  Build it
			 * from 0 .. numecs.
			 */
			num_full_table_rows = numecs + 1;

		/* Unless -Ca, declare it "short" because it's a real
		 * long-shot that that won't be large enough.
		 */
		out_str_dec( "static yyconst %s yy_nxt[][%d] =\n    {\n",
			/* '}' so vi doesn't get too confused */
			long_align ? "long" : "short", num_full_table_rows );

		outn( "    {" );

		/* Generate 0 entries for state #0. */
		for ( i = 0; i < num_full_table_rows; ++i )
			mk2data( 0 );

		dataflush();
		outn( "    },\n" );
		}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕中文字幕一区| 国产精品亚洲视频| 亚洲国产精品尤物yw在线观看| 国产精品国产三级国产三级人妇 | 亚洲小说欧美激情另类| 亚洲免费观看高清完整版在线观看熊| 国产精品久久久久影院色老大| 国产精品无遮挡| 中文字幕av资源一区| 国产精品短视频| 亚洲婷婷综合久久一本伊一区 | 国产一区二区三区在线观看精品| 久久99深爱久久99精品| 国产在线看一区| 国产成人综合网站| 成人少妇影院yyyy| 色综合久久中文综合久久牛| 91国产丝袜在线播放| 欧美日韩卡一卡二| 日韩欧美一区二区免费| 久久久久久99久久久精品网站| 国产欧美日韩精品一区| 中文字幕一区二区5566日韩| 一个色妞综合视频在线观看| 婷婷夜色潮精品综合在线| 美国毛片一区二区| 国产精品中文欧美| 91麻豆福利精品推荐| 8x8x8国产精品| 国产日产精品1区| 亚洲综合色丁香婷婷六月图片| 日韩福利电影在线| 国产激情一区二区三区| 91免费看视频| 欧美一区二区成人| 国产三级三级三级精品8ⅰ区| 亚洲欧洲99久久| 午夜av一区二区三区| 国产麻豆午夜三级精品| 97se狠狠狠综合亚洲狠狠| 欧美日韩极品在线观看一区| 久久欧美中文字幕| 亚洲综合成人在线视频| 久久99国产精品久久| 97se狠狠狠综合亚洲狠狠| 69久久99精品久久久久婷婷| 国产午夜精品一区二区三区视频| 亚洲一区在线观看视频| 国产一区二区三区四区五区入口 | 亚洲一区二区3| 狠狠色丁香久久婷婷综合丁香| 91亚洲国产成人精品一区二区三| 欧美日本国产视频| 亚洲国产精华液网站w| 亚洲成年人影院| 国产乱子伦一区二区三区国色天香| 97精品电影院| 久久伊人中文字幕| 亚洲国产另类精品专区| 成人免费观看视频| 欧美一区二区精品久久911| 国产精品成人免费精品自在线观看| 天堂蜜桃91精品| 99久久综合精品| 久久这里只有精品首页| 亚洲国产精品自拍| 成人av电影在线观看| 欧美成人伊人久久综合网| 玉米视频成人免费看| 国产精品资源在线观看| 欧美一区二区美女| 亚洲一二三四在线| 成人av资源下载| 久久精品夜夜夜夜久久| 日本一区中文字幕| 在线看日韩精品电影| 综合在线观看色| 国产一区二区三区日韩| 777久久久精品| 樱桃国产成人精品视频| 成人黄色a**站在线观看| 久久亚洲一级片| 麻豆视频一区二区| 91精品国产综合久久精品麻豆| 一区二区三区四区五区视频在线观看 | 亚洲精品视频免费看| 福利电影一区二区三区| 日韩精品一区二区三区中文不卡| 亚洲激情网站免费观看| 97久久精品人人澡人人爽| 国产欧美日韩激情| 国产高清亚洲一区| 精品不卡在线视频| 麻豆国产精品视频| 91精品国产乱码| 日韩高清中文字幕一区| 欧美日韩国产123区| 亚洲成av人片在线| 91国偷自产一区二区开放时间| 亚洲欧美一区二区三区国产精品| 不卡视频一二三四| 国产精品青草综合久久久久99| 国产激情视频一区二区三区欧美| 久久午夜免费电影| 紧缚奴在线一区二区三区| 精品国产一区二区在线观看| 奇米影视7777精品一区二区| 7799精品视频| 青青草91视频| 精品捆绑美女sm三区| 国产做a爰片久久毛片| 精品国产乱码91久久久久久网站| 欧美aaa在线| 337p日本欧洲亚洲大胆精品| 国产乱码一区二区三区| 久久精品人人做| 成人免费高清视频在线观看| 国产精品久久久久久久久免费丝袜| 成人免费观看av| 亚洲激情欧美激情| 91超碰这里只有精品国产| 日本亚洲天堂网| 精品国产三级a在线观看| 国产精品一品二品| 中文字幕一区日韩精品欧美| 91蜜桃免费观看视频| 亚洲国产精品一区二区www在线| 欧美日韩精品一区二区三区蜜桃| 日韩精品一级二级| 久久婷婷一区二区三区| 成人综合日日夜夜| 亚洲卡通欧美制服中文| 欧美日韩mp4| 国产精品正在播放| 亚洲一区视频在线| 精品久久久久久无| 99视频精品在线| 亚洲成精国产精品女| 精品乱人伦小说| 91免费视频观看| 热久久久久久久| 成人免费一区二区三区视频| 欧美丝袜第三区| 紧缚捆绑精品一区二区| 亚洲美腿欧美偷拍| 91精品国产综合久久精品app| 韩国成人在线视频| 亚洲精品国产成人久久av盗摄| 欧美精品在线观看一区二区| 国产精品66部| 亚洲成在人线免费| 精品欧美一区二区在线观看| 福利视频网站一区二区三区| 亚洲成a人片在线不卡一二三区| 精品国产1区二区| 色综合天天狠狠| 经典三级在线一区| 亚洲一区二区三区小说| 国产亚洲视频系列| 欧美福利视频导航| 97超碰欧美中文字幕| 久久99精品久久久久婷婷| 亚洲免费高清视频在线| 久久久久久久久久看片| 欧美日韩中文字幕一区| 成人免费看黄yyy456| 久久精品国产**网站演员| 亚洲自拍偷拍综合| 国产精品国产三级国产专播品爱网| 欧美一区二区啪啪| 在线精品观看国产| 不卡高清视频专区| 国内精品伊人久久久久av一坑| 艳妇臀荡乳欲伦亚洲一区| 久久综合久久99| 欧美一级在线观看| 欧美系列一区二区| 97久久久精品综合88久久| 韩国欧美国产一区| 日韩精品成人一区二区在线| 亚洲视频在线一区| 国产日产亚洲精品系列| 日韩欧美成人午夜| 欧美日韩国产影片| 色噜噜夜夜夜综合网| 99天天综合性| 国产suv精品一区二区883| 六月婷婷色综合| 三级不卡在线观看| 亚洲亚洲人成综合网络| 曰韩精品一区二区| 亚洲视频中文字幕| 国产精品国产三级国产普通话99| 久久综合网色—综合色88| 日韩欧美一二三| 日韩精品一区二区三区四区视频| 91精品国产全国免费观看| 欧美久久久影院| 欧美日韩在线播| 欧美影院午夜播放|