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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? research.cxx

?? 非常好用的可移植的多平臺C/C++源代碼編輯器
?? CXX
?? 第 1 頁 / 共 2 頁
字號:
// Scintilla source code edit control
/** @file RESearch.cxx
 ** Regular expression search library.
 **/

/*
 * regex - Regular expression pattern matching  and replacement
 *
 * By:  Ozan S. Yigit (oz)
 *      Dept. of Computer Science
 *      York University
 *
 * Original code available from http://www.cs.yorku.ca/~oz/
 * Translation to C++ by Neil Hodgson neilh@scintilla.org
 * Removed all use of register.
 * Converted to modern function prototypes.
 * Put all global/static variables into an object so this code can be
 * used from multiple threads etc.
 *
 * These routines are the PUBLIC DOMAIN equivalents of regex
 * routines as found in 4.nBSD UN*X, with minor extensions.
 *
 * These routines are derived from various implementations found
 * in software tools books, and Conroy's grep. They are NOT derived
 * from licensed/restricted software.
 * For more interesting/academic/complicated implementations,
 * see Henry Spencer's regexp routines, or GNU Emacs pattern
 * matching module.
 *
 * Modification history removed.
 *
 * Interfaces:
 *      RESearch::Compile:        compile a regular expression into a NFA.
 *
 *			char *RESearch::Compile(s)
 *			char *s;
 *
 *      RESearch::Execute:        execute the NFA to match a pattern.
 *
 *			int RESearch::Execute(s)
 *			char *s;
 *
 *	RESearch::ModifyWord		change RESearch::Execute's understanding of what a "word"
 *			looks like (for \< and \>) by adding into the
 *			hidden word-syntax table.
 *
 *			void RESearch::ModifyWord(s)
 *			char *s;
 *
 *      RESearch::Substitute:	substitute the matched portions in a new string.
 *
 *			int RESearch::Substitute(src, dst)
 *			char *src;
 *			char *dst;
 *
 *	re_fail:	failure routine for RESearch::Execute.
 *
 *			void re_fail(msg, op)
 *			char *msg;
 *			char op;
 *
 * Regular Expressions:
 *
 *      [1]     char    matches itself, unless it is a special
 *                      character (metachar): . \ [ ] * + ^ $
 *
 *      [2]     .       matches any character.
 *
 *      [3]     \       matches the character following it, except
 *			when followed by a left or right round bracket,
 *			a digit 1 to 9 or a left or right angle bracket.
 *			(see [7], [8] and [9])
 *			It is used as an escape character for all
 *			other meta-characters, and itself. When used
 *			in a set ([4]), it is treated as an ordinary
 *			character.
 *
 *      [4]     [set]   matches one of the characters in the set.
 *                      If the first character in the set is "^",
 *                      it matches a character NOT in the set, i.e.
 *			complements the set. A shorthand S-E is
 *			used to specify a set of characters S upto
 *			E, inclusive. The special characters "]" and
 *			"-" have no special meaning if they appear
 *			as the first chars in the set.
 *                      examples:        match:
 *
 *                              [a-z]    any lowercase alpha
 *
 *                              [^]-]    any char except ] and -
 *
 *                              [^A-Z]   any char except uppercase
 *                                       alpha
 *
 *                              [a-zA-Z] any alpha
 *
 *      [5]     *       any regular expression form [1] to [4], followed by
 *                      closure char (*) matches zero or more matches of
 *                      that form.
 *
 *      [6]     +       same as [5], except it matches one or more.
 *
 *      [7]             a regular expression in the form [1] to [10], enclosed
 *                      as \(form\) matches what form matches. The enclosure
 *                      creates a set of tags, used for [8] and for
 *                      pattern substution. The tagged forms are numbered
 *			starting from 1.
 *
 *      [8]             a \ followed by a digit 1 to 9 matches whatever a
 *                      previously tagged regular expression ([7]) matched.
 *
 *	[9]	\<	a regular expression starting with a \< construct
 *		\>	and/or ending with a \> construct, restricts the
 *			pattern matching to the beginning of a word, and/or
 *			the end of a word. A word is defined to be a character
 *			string beginning and/or ending with the characters
 *			A-Z a-z 0-9 and _. It must also be preceded and/or
 *			followed by any character outside those mentioned.
 *
 *      [10]            a composite regular expression xy where x and y
 *                      are in the form [1] to [10] matches the longest
 *                      match of x followed by a match for y.
 *
 *      [11]	^	a regular expression starting with a ^ character
 *		$	and/or ending with a $ character, restricts the
 *                      pattern matching to the beginning of the line,
 *                      or the end of line. [anchors] Elsewhere in the
 *			pattern, ^ and $ are treated as ordinary characters.
 *
 *
 * Acknowledgements:
 *
 *	HCR's Hugh Redelmeier has been most helpful in various
 *	stages of development. He convinced me to include BOW
 *	and EOW constructs, originally invented by Rob Pike at
 *	the University of Toronto.
 *
 * References:
 *              Software tools			Kernighan & Plauger
 *              Software tools in Pascal        Kernighan & Plauger
 *              Grep [rsx-11 C dist]            David Conroy
 *		ed - text editor		Un*x Programmer's Manual
 *		Advanced editing on Un*x	B. W. Kernighan
 *		RegExp routines			Henry Spencer
 *
 * Notes:
 *
 *	This implementation uses a bit-set representation for character
 *	classes for speed and compactness. Each character is represented
 *	by one bit in a 128-bit block. Thus, CCL always takes a
 *	constant 16 bytes in the internal nfa, and RESearch::Execute does a single
 *	bit comparison to locate the character in the set.
 *
 * Examples:
 *
 *	pattern:	foo*.*
 *	compile:	CHR f CHR o CLO CHR o END CLO ANY END END
 *	matches:	fo foo fooo foobar fobar foxx ...
 *
 *	pattern:	fo[ob]a[rz]
 *	compile:	CHR f CHR o CCL bitset CHR a CCL bitset END
 *	matches:	fobar fooar fobaz fooaz
 *
 *	pattern:	foo\\+
 *	compile:	CHR f CHR o CHR o CHR \ CLO CHR \ END END
 *	matches:	foo\ foo\\ foo\\\  ...
 *
 *	pattern:	\(foo\)[1-3]\1	(same as foo[1-3]foo)
 *	compile:	BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
 *	matches:	foo1foo foo2foo foo3foo
 *
 *	pattern:	\(fo.*\)-\1
 *	compile:	BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
 *	matches:	foo-foo fo-fo fob-fob foobar-foobar ...
 */

#include "RESearch.h"

#define OKP     1
#define NOP     0

#define CHR     1
#define ANY     2
#define CCL     3
#define BOL     4
#define EOL     5
#define BOT     6
#define EOT     7
#define BOW	8
#define EOW	9
#define REF     10
#define CLO     11

#define END     0

/*
 * The following defines are not meant to be changeable.
 * They are for readability only.
 */
#define BLKIND	0370
#define BITIND	07

#define ASCIIB	0177

const char bitarr[] = {1,2,4,8,16,32,64,'\200'};

#define badpat(x)	(*nfa = END, x)

RESearch::RESearch() {
	Init();
}

RESearch::~RESearch() {
	Clear();
}

void RESearch::Init() {
	sta = NOP;               	/* status of lastpat */
	bol = 0;
	for (int i=0; i<MAXTAG; i++)
		pat[i] = 0;
	for (int j=0; j<BITBLK; j++)
		bittab[j] = 0;
}

void RESearch::Clear() {
	for (int i=0; i<MAXTAG; i++) {
		delete []pat[i];
		pat[i] = 0;
		bopat[i] = NOTFOUND;
		eopat[i] = NOTFOUND;
	}
}

bool RESearch::GrabMatches(CharacterIndexer &ci) {
	bool success = true;
	for (unsigned int i=0; i<MAXTAG; i++) {
		if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
			unsigned int len = eopat[i] - bopat[i];
			pat[i] = new char[len + 1];
			if (pat[i]) {
				for (unsigned int j=0; j<len; j++)
					pat[i][j] = ci.CharAt(bopat[i] + j);
				pat[i][len] = '\0';
			} else {
				success = false;
			}
		}
	}
	return success;
}

void RESearch::ChSet(char c) {
	bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
}

void RESearch::ChSetWithCase(char c, bool caseSensitive) {
	if (caseSensitive) {
		ChSet(c);
	} else {
		if ((c >= 'a') && (c <= 'z')) {
			ChSet(c);
			ChSet(static_cast<char>(c - 'a' + 'A'));
		} else if ((c >= 'A') && (c <= 'Z')) {
			ChSet(c);
			ChSet(static_cast<char>(c - 'A' + 'a'));
		} else {
			ChSet(c);
		}
	}
}

const char escapeValue(char ch) {
	switch (ch) {
	case 'a':	return '\a';
	case 'b':	return '\b';
	case 'f':	return '\f';
	case 'n':	return '\n';
	case 'r':	return '\r';
	case 't':	return '\t';
	case 'v':	return '\v';
	}
	return 0;
}

const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
	char *mp=nfa;          /* nfa pointer       */
	char *lp;              /* saved pointer..   */
	char *sp=nfa;          /* another one..     */
    char *mpMax = mp + MAXNFA - BITBLK - 10;

	int tagi = 0;          /* tag stack index   */
	int tagc = 1;          /* actual tag count  */

	int n;
	char mask;		/* xor mask -CCL/NCL */
	int c1, c2;

	if (!pat || !length)
		if (sta)
			return 0;
		else
			return badpat("No previous regular expression");
	sta = NOP;

	const char *p=pat;               /* pattern pointer   */
	for (int i=0; i<length; i++, p++) {
		if (mp > mpMax)
			return badpat("Pattern too long");
		lp = mp;
		switch(*p) {

		case '.':               /* match any char..  */
			*mp++ = ANY;
			break;

		case '^':               /* match beginning.. */
			if (p == pat)
				*mp++ = BOL;
			else {
				*mp++ = CHR;
				*mp++ = *p;
			}
			break;

		case '$':               /* match endofline.. */
			if (!*(p+1))
				*mp++ = EOL;
			else {
				*mp++ = CHR;
				*mp++ = *p;
			}
			break;

		case '[':               /* match char class..*/
			*mp++ = CCL;

			i++;
			if (*++p == '^') {
				mask = '\377';
				i++;
				p++;
			} else
				mask = 0;

			if (*p == '-') {		/* real dash */
				i++;
				ChSet(*p++);
			}
			if (*p == ']') {	/* real brace */
				i++;
				ChSet(*p++);
			}
			while (*p && *p != ']') {
				if (*p == '-' && *(p+1) && *(p+1) != ']') {
					i++;
					p++;
					c1 = *(p-2) + 1;
					i++;
					c2 = *p++;
					while (c1 <= c2) {
						ChSetWithCase(static_cast<char>(c1++), caseSensitive);
					}
				} else if (*p == '\\' && *(p+1)) {
					i++;
					p++;
					char escape = escapeValue(*p);
					if (escape)
						ChSetWithCase(escape, caseSensitive);
					else
						ChSetWithCase(*p, caseSensitive);
					i++;
					p++;
				} else {
					i++;
					ChSetWithCase(*p++, caseSensitive);
				}
			}
			if (!*p)
				return badpat("Missing ]");

			for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
				*mp++ = static_cast<char>(mask ^ bittab[n]);

			break;

		case '*':               /* match 0 or more.. */
		case '+':               /* match 1 or more.. */
			if (p == pat)
				return badpat("Empty closure");
			lp = sp;		/* previous opcode */
			if (*lp == CLO)		/* equivalence..   */
				break;
			switch(*lp) {

			case BOL:
			case BOT:
			case EOT:
			case BOW:
			case EOW:
			case REF:
				return badpat("Illegal closure");
			default:
				break;
			}

			if (*p == '+')
				for (sp = mp; lp < sp; lp++)
					*mp++ = *lp;

			*mp++ = END;
			*mp++ = END;
			sp = mp;
			while (--mp > lp)
				*mp = mp[-1];
			*mp = CLO;
			mp = sp;
			break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日产欧产美韩系列久久99| 秋霞成人午夜伦在线观看| 久久久久国产一区二区三区四区| 99久久精品国产毛片| 亚洲成人自拍一区| 亚洲一区二区三区四区五区黄 | 蜜臀久久久久久久| 中文字幕在线不卡一区| 日韩一级黄色片| 精品国产三级电影在线观看| 欧美精品一区二| 欧美吻胸吃奶大尺度电影| 欧美日韩激情在线| 欧美大片日本大片免费观看| 久久综合久久综合亚洲| 国产精品色哟哟网站| 亚洲免费观看视频| 日韩在线一二三区| 一区二区三区在线免费视频| 亚洲h在线观看| 久久精品国产一区二区三| 国产高清在线精品| 91麻豆福利精品推荐| 欧美三级三级三级| 精品粉嫩超白一线天av| 国产精品久久久一本精品| 亚洲综合色视频| 蜜桃精品视频在线| 丁香婷婷深情五月亚洲| 欧美影院精品一区| 精品国产一区二区亚洲人成毛片| 欧美亚日韩国产aⅴ精品中极品| av一区二区不卡| 欧美日韩国产大片| 久久综合久久99| 一区二区三区精品在线| 久久精品av麻豆的观看方式| 成av人片一区二区| 成人午夜在线视频| 欧美日韩一区在线观看| 久久久91精品国产一区二区精品 | 成人福利视频在线看| 91国产视频在线观看| 日韩一区二区在线观看视频 | 欧美高清视频一二三区| 久久一留热品黄| 亚洲免费大片在线观看| 美女被吸乳得到大胸91| 91麻豆自制传媒国产之光| 精品精品国产高清a毛片牛牛| 日韩一区二区免费电影| 中文字幕视频一区二区三区久| 国产视频视频一区| 日韩激情视频在线观看| 国产精品1024| 欧美精品 国产精品| 中文字幕一区日韩精品欧美| 中文字幕视频一区| 久久精品国产精品青草| 国产伦精一区二区三区| 欧美三级视频在线观看| 日韩视频免费观看高清完整版在线观看 | 亚洲美女少妇撒尿| 黄色精品一二区| 666欧美在线视频| 亚洲欧美日韩一区| 国产精品69毛片高清亚洲| 不卡视频一二三四| 久久众筹精品私拍模特| 亚洲成人av一区二区| 91亚洲国产成人精品一区二三| 欧美调教femdomvk| 中文字幕亚洲电影| 粉嫩在线一区二区三区视频| 一本一本久久a久久精品综合麻豆| 欧美日韩五月天| 亚洲免费在线观看| 成人的网站免费观看| 国产午夜精品一区二区三区嫩草 | 欧美在线色视频| 亚洲欧美一区二区不卡| 成人av资源在线观看| 337p日本欧洲亚洲大胆精品| 日韩精品1区2区3区| 国产suv精品一区二区6| 久久夜色精品国产欧美乱极品| 国产精品久久久久久久久久久免费看 | 亚洲激情图片一区| 99热99精品| 国产精品第13页| 成人教育av在线| 中文久久乱码一区二区| 国产福利精品一区| 欧美国产欧美亚州国产日韩mv天天看完整 | 国产色91在线| 国产成人超碰人人澡人人澡| 国产日韩欧美综合在线| 国产成人在线视频网站| 欧美日韩不卡在线| 天堂成人免费av电影一区| 欧美日韩精品一区二区天天拍小说| 久久久久久久久97黄色工厂| 国产一区免费电影| 国产午夜精品一区二区三区四区| 亚洲福利视频三区| 欧美精品xxxxbbbb| 美女视频网站黄色亚洲| 精品久久久久99| 国产综合色在线视频区| 国产欧美一区二区三区鸳鸯浴| 日日摸夜夜添夜夜添精品视频| eeuss鲁片一区二区三区 | 蜜桃视频在线观看一区二区| 91精品黄色片免费大全| 久久av资源站| 欧美激情在线观看视频免费| 99国产精品99久久久久久| 91精品国产91久久久久久最新毛片 | 久久男人中文字幕资源站| 成人一级片在线观看| 国产精品初高中害羞小美女文| 毛片一区二区三区| 欧美人妇做爰xxxⅹ性高电影| 自拍偷拍欧美激情| 欧美视频在线播放| 精品一区二区三区欧美| 久久久午夜电影| 99国产精品视频免费观看| 国产欧美中文在线| 97久久久精品综合88久久| 亚洲午夜三级在线| 精品国产乱码久久| 97精品超碰一区二区三区| 亚洲成人tv网| 久久青草国产手机看片福利盒子| 717成人午夜免费福利电影| 经典三级在线一区| 亚洲视频资源在线| 制服丝袜中文字幕一区| 亚洲已满18点击进入久久| 欧美一二三区在线| av在线这里只有精品| 日产欧产美韩系列久久99| 欧美福利视频导航| 国产成人aaaa| 性久久久久久久久| 久久精品亚洲国产奇米99| 一本色道**综合亚洲精品蜜桃冫| 国产精品伦一区| 欧美一区2区视频在线观看| 丰满放荡岳乱妇91ww| 国产精品美日韩| 国产不卡一区视频| 日韩一区欧美二区| 自拍偷拍亚洲激情| 久久综合色婷婷| 欧美日韩激情一区| 99国产精品久久久久| 精品一二三四在线| 亚洲综合网站在线观看| 久久久电影一区二区三区| 欧美高清视频不卡网| 久久国内精品自在自线400部| 亚洲高清免费观看| 亚洲国产高清aⅴ视频| www.成人网.com| 久久97超碰色| 中文字幕在线观看一区二区| 精品三级在线看| 欧美三级日韩在线| 91丨porny丨户外露出| 国内久久婷婷综合| 免费在线一区观看| 国产午夜亚洲精品午夜鲁丝片| 日韩精品国产精品| 亚洲黄色片在线观看| 激情五月婷婷综合| 丝袜亚洲另类欧美| 亚洲精品免费视频| 国产精品国产精品国产专区不片| 色哟哟亚洲精品| 99在线热播精品免费| 国产v日产∨综合v精品视频| 久久精品999| 蜜桃视频一区二区三区在线观看| 樱花草国产18久久久久| 国产日韩欧美高清| 亚洲精品在线观看网站| 日韩美一区二区三区| 国产成人午夜精品5599| 欧美电影免费观看高清完整版在线观看| 久久电影网站中文字幕| 1024成人网| 国产精品久久久久久妇女6080| 欧美网站一区二区| 国产酒店精品激情| 国产综合久久久久影院| 一区二区三区四区在线免费观看| 欧美一区日本一区韩国一区| 欧美老女人在线|