shithub: martian9

Download patch

ref: e26bf9e3ac9cd57902b158feaef9234e2901ce9c
parent: 0a55d7957a05211ff86d530d12fafa02e8a11abf
author: smazga <[email protected]>
date: Wed Sep 30 18:32:53 EDT 2020

split gsub into utils to enable printer <-> reader cross requirements

--- a/mkfile
+++ b/mkfile
@@ -3,10 +3,11 @@
 BIN=m9
 
 FILES=\
+	utils.ml\
 	types.ml\
 	env.ml\
-	reader.ml\
 	printer.ml\
+	reader.ml\
 	core.ml\
 	macro.ml\
 	eval.ml
--- /dev/null
+++ b/utils.ml
@@ -1,0 +1,10 @@
+(* copied verbatim - must needs grok *)
+let gsub re f str =
+  String.concat
+    ""
+    (List.map
+       (function
+         | Str.Delim x -> f x
+         | Str.Text x -> x)
+       (Str.full_split re str))
+;;