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

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

?? regular-expressions.zc

?? 實現樹形結構
?? ZC
?? 第 1 頁 / 共 2 頁
字號:
public func test with groups (m: regex, string: string)

	reset groups (m)

	def stack: [stack size] local scan
	def top = stack + stack size
	def sp = top

	def final = final (m)
	def s = initial (m)
	def p = string
	repeat
		if group start (s) <> 0
			set group start (m, s, p)
		end
		if group stop (s) <> 0
			set group stop (m, s, p)
		end
		if s == final
			return p
		end
		
		def c = p[]

		each (rules (s)) ? r
			equ rule = r : rule
			if epsilon (rule)
				if sp == stack
					return nil // stack overflow
				end
				sp -= 1
				s (sp []) = state (rule)
				p (sp []) = p
			elsif match (rule, c)
				if sp == stack
					return nil // stack overflow
				end
				sp -= 1
				s (sp []) = state (rule)
				p (sp []) = p + 1
			end
		end
		
		// pop next
		if sp == top
			break
		end
		
		s = s (sp [])
		p = p (sp [])
		sp += 1
	end
	
	return nil

end
//[c]
//[c]Structures:
//[c]
struct scan
	s: state
	p: string
end
//[c]
//[c]Subfunctions:
//[of]:set group start
func set group start (m: regex, s: state, p: string)

	def i = 0
	def mask = group start (s)
	while mask <> 0
		if (mask & 1) <> 0
			group starts (m) [i] = p
		end
		i += 1
		mask >>= 1
	end

end
//[cf]
//[of]:set group stop
func set group stop (m: regex, s: state, p: string)

	def i = 0
	def mask = group stop (s)
	while mask <> 0
		if (mask & 1) <> 0
			group stops (m) [i] = p
		end
		i += 1
		mask >>= 1
	end

end
//[cf]
//[of]:reset groups
//[c]
func reset groups (m: regex)
	
	def i = 0
	def n = number of groups (m)
	while i < n
		group starts (m) [i] = nil
		group stops (m) [i] = nil
		i += 1
	end

end
//[cf]
//[cf]
//[cf]
//[of]:accessing
//[of]:number of groups
//[c]Returns the number of groups
//[c]
//[c]The number of groups is known after compilation.
//[c]
public func number of groups (m: regex)
	return groups (m)
end
//[cf]
//[of]:append (index, s)
//[c]Appends the content of the i-th group to the string buffer
//[c]
//[c]The method can be invoked after the first call to match().
//[c]This method is valid as long as the source string is not modified.
//[c]
public func append (m: regex, index: int, s: string buffer)

	def start = group starts (m) [index] : string
	def stop = group stops (m) [index] : string
	if not nil (start) && not nil (stop)
		append (s, start, stop - start)
	end

end
//[cf]
//[of]:size (index)
//[c]Returns the size of the i-th group
//[c]
public func size (m: regex, index: int)

	def start = group starts (m) [index] : string
	def stop = group stops (m) [index] : string
	if not nil (start) && not nil (stop)
		return stop - start
	end

	return 0

end
//[cf]
//[cf]
//[of]:testing
//[of]:must match beginning
//[c]Returns true if the expression must starts at the beginning of the line
//[c]
//[c]This is not handled by this component, this is the responsibility
//[c]of the caller to handle begin and end matches because the end
//[c]of line can be \n as well as a nul char and the beginning of the 
//[c]line should be optimized by the caller (avoid scanning all the line).
//[c]
public equ must match beginning (m: regex) = match beginning (m)
//[cf]
//[of]:must match ending
//[c]Returns true if the expression must ends at the end of the line
//[c]
//[c]This is not handled by this component, this is the responsibility
//[c]of the caller to handle begin and end matches because the end
//[c]of line can be \n as well as a nul char and the beginning of the 
//[c]line should be optimized by the caller (avoid scanning all the line).
//[c]
public equ must match ending (m: regex) = match ending (m)
//[cf]
//[of]:is empty
//[c]Returns true if the regular expression matches an empty string
//[c]
public func is empty (m: regex)
	return not nil (match (m, empty string))
end
//[cf]
//[cf]
//[c]
//[of]:private
//[of]:regex
//[of]:delete all
//[c]Deletes all states, nodes and rules
//[c]
func delete all (m: regex)

	each (states (m)) ? s
		delete (s : state)
	end
	
	each (nodes (m)) ? n
		delete (n : node)
	end

	each (rules (m)) ? r
		delete (r : rule)
	end

end
//[cf]
//[cf]
//[of]:state
//[of]:definition
struct state
	rules: local collection
	group start: int
	group stop: int
	mark: bool
end	
//[cf]
//[c]
//[of]:new state 
//[c]
func new state (r: regex)
	def s = allocate memory (sizeof local state): state
	initialize (rules (s))
	group start (s) = 0
	group stop (s) = 0
	mark (s) = false
	add (states (r), s)
	return s
end
//[cf]
//[of]:delete
//[c]
func delete (s: state)
	free memory (s)
end
//[cf]
//[c]
//[of]:add rule (s1, s2, rule)
func add rule (s1: state, s2: state, rule: rule)
	add (rules (s1), rule)
	state (rule) = s2
end
//[cf]
//[of]:add epsilon (s1, s2)
func add epsilon (m: regex, s1: state, s2: state)
	def rule = new epsilon rule (m)
	add (rules (s1), rule)
	state (rule) = s2
end
//[cf]
//[cf]
//[of]:rule
//[of]:definition
//[c]
struct rule: local element
	epsilon: bool
	chars: char map
	state: state
end
//[cf]
//[c]
//[of]:new rule
//[c]
func new rule (m: regex)
	def r = allocate memory (sizeof local rule): rule
	add (rules (m), r)
	return r
end
//[cf]
//[of]:new epsilon rule
//[c]
func new epsilon rule (m: regex)

	def r = new rule (m)
	epsilon (r) = true
	return r

end
//[cf]
//[of]:new char rule
//[c]
func new char rule (m: regex)

	def r = new rule (m)
	epsilon (r) = false
	initialize (chars (r))
	return r

end
//[cf]
//[of]:new any rule
//[c]
func new any rule (m: regex)

	def r = new char rule (m)
	invert (r)
	return r

end
//[cf]
//[of]:new char rule (c)
//[c]
func new char rule (m: regex, c: char)

	def r = new char rule (m)
	set (r, c, is case sensitive (m))
	return r

end
//[cf]
//[of]:delete
//[c]
func delete (rule: rule)
	free memory (rule)
end
//[cf]
//[c]
//[of]:set (c)
//[c]
func set (r: rule, c: char, is case sensitive: bool)

	chars (r) [c:byte:int] = 1:byte

	if ~ is case sensitive
		if c >= $a && c <= $z
			chars (r) [(c - $a + $A):byte:int] = 1:byte
		elsif c >= $A && c <= $Z
			chars (r) [(c - $A + $a):byte:int] = 1:byte
		end
	end

end
//[cf]
//[of]:set (c1, c2)
//[c]
func set (r: rule, c1: char, c2: char, is case sensitive: bool)

	def c = c1
	while c <= c2
		set (r, c, is case sensitive)
		c += \1
	end

end
//[cf]
//[of]:invert
//[c]
func invert (r: rule)

	def i = 1
	while i < 256
		chars (r) [i] = 1:byte - chars (r) [i]
		i += 1
	end

end
//[cf]
//[c]
//[of]:match (c)
//[c]
equ match (r: rule, c: char) = chars (r) [c:byte:int] <> 0:byte
//[cf]
//[cf]
//[c]
//[of]:node
//[of]:definition
struct node : local element
	type: node type
end
//[cf]
//[of]:constants
enum node type
	nt rules
	nt or
	nt zero or many
	nt one or many
	nt zero or one
end
//[cf]
//[of]:delete
func delete (m: node)
	if type (m) == nt or
		release (sequences (m : or node))
	end
	
	free memory (m)
end
//[cf]
//[cf]
//[of]:rule node
//[of]:definition
struct rule node : local node
	rule: rule
end
//[cf]
//[of]:create
func new rule node (m: regex, rule: rule)

	def n = allocate memory (sizeof local rule node) : rule node
	type (n) = nt rules
	rule (n) = rule

	add (nodes (m), n)

	return n

end
//[cf]
//[cf]
//[of]:or node
//[of]:definition
struct or node : local node
	sequences: local vector
end
//[cf]
//[of]:create
func new or node (m: regex)

	def n = allocate memory (sizeof local or node) : or node
	type (n) = nt or
	initialize (sequences (n))

	add (nodes (m), n)

	return n

end
//[cf]
//[cf]
//[of]:rep node
//[of]:definition
struct rep node : local node
	node: node
end
//[cf]
//[of]:create
func new repeat node (m: regex, node: node, type: node type)

	def n = allocate memory (sizeof local rep node) : rep node
	type (n) = type
	node (n) = node

	add (nodes (m), n)

	return n

end
//[cf]
//[cf]
//[c]
//[of]:utility functions
//[of]:initialize (char map)
func initialize (m: []byte)

	def p = m
	def i = 0
	while i < 256
		p [i] = 0:byte
		i += 1
	end

end
//[cf]
//[of]:get escape char (c)
//[c]Returns the char for an escape sequence \x
//[c]
func get escape char (x: char)
	
	def c: char

	switch x
	case nul char
		c = $\
	case $a
		c = \a
	case $b
		c = \b
	case $n
		c = \n
	case $f
		c = \f
	case $r
		c = \r
	case $t
		c = \t
	case $v
		c = \v
	else
		c = x
	end

	return c

end
//[cf]
//[cf]
//[cf]

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲777理论| 欧美综合天天夜夜久久| 欧美性大战久久| 青娱乐精品视频| 久久久五月婷婷| 国产精品12区| 一二三区精品福利视频| 日韩一区二区电影在线| 奇米色777欧美一区二区| 丝袜亚洲另类欧美综合| 国产日韩欧美一区二区三区综合| va亚洲va日韩不卡在线观看| 欧美激情一区二区三区不卡| 视频一区二区中文字幕| 亚洲免费观看在线视频| 精品第一国产综合精品aⅴ| 99热精品一区二区| 91麻豆免费视频| 国精品**一区二区三区在线蜜桃| 日韩一区二区精品在线观看| 欧美成va人片在线观看| 欧美性生活影院| 欧美日韩免费视频| a4yy欧美一区二区三区| 欧洲日韩一区二区三区| 在线播放欧美女士性生活| 99久久久久久| 国产高清视频一区| 91毛片在线观看| 欧美猛男超大videosgay| 91亚洲精品久久久蜜桃| 欧美在线观看视频一区二区| 日韩一区二区三| 国产精品久久久久久久久免费樱桃 | 久久久久久电影| 亚洲色图在线播放| 国产欧美一区二区精品性| 国产精品国产三级国产有无不卡 | 久久99久久99| 丝袜美腿亚洲一区二区图片| 老司机午夜精品99久久| 日韩av网站在线观看| 亚洲高清在线精品| 亚洲电影一区二区三区| 伦理电影国产精品| 一本一道久久a久久精品 | 91免费国产视频网站| 欧美精品视频www在线观看 | 国产夫妻精品视频| 欧美三级电影精品| 亚洲国产三级在线| 欧美视频三区在线播放| 久久久三级国产网站| 亚洲尤物在线视频观看| 一区二区三区精品在线| 久久精品国产成人一区二区三区| 99久久综合狠狠综合久久| 欧美一区二区视频在线观看2020 | 国产精品久久久久影院| 蜜桃视频免费观看一区| 精品亚洲porn| 欧美日精品一区视频| 国产欧美一区二区三区网站| 天天综合网天天综合色| 日日夜夜精品视频免费| 99久久精品国产观看| 欧美成人精品高清在线播放| 亚洲另类春色校园小说| 亚洲愉拍自拍另类高清精品| 高清国产午夜精品久久久久久| 国产suv一区二区三区88区| 欧美三级日韩三级国产三级| 国产精品成人在线观看| 国产成人精品影视| 精品日产卡一卡二卡麻豆| 日韩影视精彩在线| 欧美亚洲综合色| 亚洲欧美一区二区不卡| 国产成人精品免费看| 久久天天做天天爱综合色| 久久久99精品久久| 亚洲欧美视频在线观看视频| 国产麻豆精品一区二区| 色久综合一二码| 欧美一区2区视频在线观看| 一区二区在线观看免费| 成人av网址在线| 欧美日韩一区二区欧美激情| 亚洲另类一区二区| 97精品国产97久久久久久久久久久久| 久久精品夜色噜噜亚洲aⅴ| 九九精品视频在线看| 欧美成人精品高清在线播放| 免费欧美在线视频| 不卡的电视剧免费网站有什么| 欧美三级三级三级爽爽爽| 亚洲午夜国产一区99re久久| 91麻豆文化传媒在线观看| 亚洲欧美国产毛片在线| 91啪在线观看| 一区二区三区欧美在线观看| 色综合久久综合网| 亚洲国产裸拍裸体视频在线观看乱了 | 国产精品系列在线播放| 欧洲另类一二三四区| 一区二区三区日韩| 欧美日韩成人综合天天影院 | 色悠悠久久综合| 亚洲最大色网站| 精品视频一区二区不卡| 五月天中文字幕一区二区| 6080午夜不卡| 亚洲欧美一区二区久久| 欧美性受xxxx黑人xyx性爽| 亚洲成av人片一区二区三区| 51午夜精品国产| 久久99精品久久只有精品| 26uuu欧美日本| 波波电影院一区二区三区| 亚洲欧美视频在线观看| 欧美三级中文字幕| 蜜臀va亚洲va欧美va天堂| 26uuu精品一区二区| 国产成人精品亚洲午夜麻豆| 综合激情成人伊人| 欧美日韩免费高清一区色橹橹| 三级精品在线观看| 久久久国产精品午夜一区ai换脸| 丁香亚洲综合激情啪啪综合| 亚洲免费观看视频| 4438x亚洲最大成人网| 国产美女在线观看一区| 亚洲免费三区一区二区| 日韩视频免费直播| 粉嫩欧美一区二区三区高清影视 | 久久av中文字幕片| 国产精品久久久久一区二区三区共| 日本久久一区二区| 蓝色福利精品导航| 中文字幕一区二区三区不卡在线 | 日韩三级精品电影久久久| 国产精品亚洲午夜一区二区三区| 日韩伦理免费电影| 欧美一级理论片| 成人97人人超碰人人99| 五月天中文字幕一区二区| 国产欧美一区二区精品秋霞影院 | 一区二区三区中文字幕在线观看| 7777精品伊人久久久大香线蕉| 日韩理论电影院| 不卡的电视剧免费网站有什么| 性久久久久久久久久久久| 欧美电影免费观看高清完整版在线| 亚洲影视资源网| 久久免费看少妇高潮| 欧美又粗又大又爽| 国产乱人伦偷精品视频免下载| 一区二区三区在线看| 久久先锋资源网| 欧美色综合天天久久综合精品| 国产精品影视在线观看| 日日骚欧美日韩| 成人欧美一区二区三区1314| 精品国产第一区二区三区观看体验| 91最新地址在线播放| 精品一区二区国语对白| 亚洲成av人片| 亚洲欧美另类在线| 欧美精品一区二区三区很污很色的| 色婷婷综合久久久中文一区二区| 国产老肥熟一区二区三区| 日韩福利电影在线观看| 亚洲一区视频在线观看视频| 欧美韩日一区二区三区四区| 日韩一区二区中文字幕| 欧美色综合天天久久综合精品| 成人黄色av网站在线| 国产综合色在线| 美女在线视频一区| 亚洲国产日韩在线一区模特 | 国内精品伊人久久久久av一坑| 亚洲国产va精品久久久不卡综合| 一色屋精品亚洲香蕉网站| 久久欧美一区二区| 日韩欧美一级精品久久| 欧美人动与zoxxxx乱| 91国偷自产一区二区三区观看| 成人激情免费网站| 国产成人av一区| 国产经典欧美精品| 国产精品一二三四五| 国产真实乱偷精品视频免| 麻豆精品精品国产自在97香蕉| 性感美女久久精品| 性久久久久久久久久久久| 午夜精品福利久久久| 爽爽淫人综合网网站| 五月天中文字幕一区二区| 午夜av一区二区| 视频一区欧美精品|