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

📄 regexp-fn.sml

📁 这是我们参加06年全国开源软件的竞赛作品
💻 SML
字号:
(* regexp-fn.sml * * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies. * * Functor that implements a regular expressions matcher by combining * a surface syntax and a matching engine. *)functor RegExpFn (structure P : REGEXP_PARSER 		  structure E : REGEXP_ENGINE) : REGEXP =    struct		structure M = MatchTree	type regexp = E.regexp	    	fun compile reader s = (case (P.scan reader s) 				  of NONE => NONE				   | SOME (syntax,s') => let val v = E.compile syntax							 in							     SOME (v,s')							 end)	    	fun compileString str = (case (StringCvt.scanString P.scan str)				   of SOME r => E.compile (r) 				    | NONE => raise RegExpSyntax.CannotParse)	    	val prefix = E.prefix	val find = E.find	fun match l =	    let val l' = map (fn (s,f) => ((case (StringCvt.scanString P.scan s)					      of SOME r => r					       | NONE => raise RegExpSyntax.CannotParse),					   f)) l		val m = E.match l'	    in		fn getc => fn stream => m getc stream	    end    end

⌨️ 快捷键说明

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