Patched to use Cl-PPCRE:SCAN-TO-STRINGS (thanks to Pixel // pinterface [a] gmail dot com).
Thu Dec 17 16:57:45 UTC 2009 mantoniotti
* Patched to use Cl-PPCRE:SCAN-TO-STRINGS (thanks to Pixel // pinterface [a] gmail dot com).
diff -rN -u old-cl-unification-1/lib-dependent/cl-ppcre-template.lisp new-cl-unification-1/lib-dependent/cl-ppcre-template.lisp
--- old-cl-unification-1/lib-dependent/cl-ppcre-template.lisp 2013-07-21 19:25:25.000000000 +0000
+++ new-cl-unification-1/lib-dependent/cl-ppcre-template.lisp 2013-07-21 19:25:25.000000000 +0000
@@ -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)