[cl-unification-cvs] CVS cl-unification/lib-dependent

mantoniotti mantoniotti at common-lisp.net
Thu Dec 17 16:57:45 UTC 2009


Update of /project/cl-unification/cvsroot/cl-unification/lib-dependent
In directory cl-net:/tmp/cvs-serv20396

Modified Files:
	cl-ppcre-template.lisp 
Log Message:
Patched to use Cl-PPCRE:SCAN-TO-STRINGS (thanks to Pixel // pinterface [a] gmail dot com).


--- /project/cl-unification/cvsroot/cl-unification/lib-dependent/cl-ppcre-template.lisp	2009/04/17 22:40:29	1.2
+++ /project/cl-unification/cvsroot/cl-unification/lib-dependent/cl-ppcre-template.lisp	2009/12/17 16:57:45	1.3
@@ -120,13 +120,10 @@
            (type (or null (integer 0 #.most-positive-fixnum)) end))
   (let ((end (or end (length s))))
     (declare (type (integer 0 #.most-positive-fixnum) end))
-    (multiple-value-bind (m-start m-end r-starts r-ends)
-        (cl-ppcre:scan (scanner re-t) s :start start :end end)
-      ;; Maybe SCAN-TO-STRINGS would be simpler to use...
 
-      (declare (type (integer 0 #.most-positive-fixnum) m-start m-end)
-               (type (vector (integer 0 #.most-positive-fixnum)) r-starts r-ends))
-      (unless (and (= start m-start) (= m-end end))
+    (multiple-value-bind (matched-p strings)
+	(cl-ppcre:scan-to-strings (scanner re-t) s :start start :end end)
+      (unless matched-p
         (error 'unification-failure
                :format-control "String ~S cannot be matched against ~
                                 regular expression ~S."
@@ -135,9 +132,7 @@
       (let ((vars (variables re-t)))
         (if (null vars)
             env
-            (loop for r-start across r-starts
-                  for r-end   across r-ends
-                  for r-string of-type string = (subseq s r-start r-end)
+            (loop for r-string of-type string across strings
                   for v in vars
                   for result-env = (var-unify v r-string env)
                   then (var-unify v r-string result-env)





More information about the Cl-unification-cvs mailing list