Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/smlnj-lib/RegExp/Glue/regexp-fn.sml
ViewVC logotype

View of /sml/trunk/src/smlnj-lib/RegExp/Glue/regexp-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 104 - (download) (annotate)
Thu May 28 21:25:35 1998 UTC (23 years, 11 months ago) by monnier
File size: 1007 byte(s)
Initial revision
(* 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 =
	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
							     SOME (v,s')
	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'
		fn getc => fn stream => m getc stream


ViewVC Help
Powered by ViewVC 1.0.0