From Alan-Shields at omrf.ouhsc.edu Tue Apr 12 16:10:55 2005 From: Alan-Shields at omrf.ouhsc.edu (Alan Shields) Date: Tue, 12 Apr 2005 11:10:55 -0500 Subject: [cl-ppcre-devel] Proposed patch to clean up implicit generic warnings Message-ID: <20050412161055.GR14800@inquisitor.omrf.org> Hello all, Please find enclosed a patch that adds defgenerics for the methods that didn't have them; I got a bit sick of SBCL yammering at me. ;-) A few other issues arose while I was cleaning that up, I'll include those in a separate email. Alan Shields diff -ur cl-ppcre-1.2.5.old/api.lisp cl-ppcre-1.2.5/api.lisp --- cl-ppcre-1.2.5.old/api.lisp 2005-03-09 08:05:56.000000000 -0600 +++ cl-ppcre-1.2.5/api.lisp 2005-04-12 10:47:59.744181048 -0500 @@ -694,14 +694,18 @@ ;; first create a scanner to identify the special parts of the ;; replacement string (eat your own dog food...) + +(defgeneric build-replacement-template (replacement-string) + (declare #.*standard-optimize-settings*) + (:documentation "Converts a replacement string for REGEX-REPLACE or +REGEX-REPLACE-ALL into a replacement template which is an +S-expression.")) + #-:cormanlisp (let* ((*use-bmh-matchers* nil) (reg-scanner (create-scanner "\\\\(?:\\\\|\\{\\d+\\}|\\d+|&|`|')"))) (defmethod build-replacement-template ((replacement-string string)) (declare #.*standard-optimize-settings*) - "Converts a replacement string for REGEX-REPLACE or -REGEX-REPLACE-ALL into a replacement template which is an -S-expression." (let ((from 0) ;; COLLECTOR will hold the (reversed) template (collector '())) diff -ur cl-ppcre-1.2.5.old/optimize.lisp cl-ppcre-1.2.5/optimize.lisp --- cl-ppcre-1.2.5.old/optimize.lisp 2005-03-09 08:05:56.000000000 -0600 +++ cl-ppcre-1.2.5/optimize.lisp 2005-04-12 10:35:53.465401561 -0500 @@ -474,11 +474,14 @@ ;; REPETITION, FILTER) nil))) +(defgeneric end-string (regex) + (declare #.*standard-optimize-settings*) + (:documentation "Returns the constant string (if it exists) REGEX ends with wrapped +into a STR object, otherwise NIL.")) + (defmethod end-string ((regex regex)) (declare (special end-string-offset)) (declare #.*standard-optimize-settings*) - "Returns the constant string (if it exists) REGEX ends with wrapped -into a STR object, otherwise NIL." ;; LAST-STR points to the last STR object (seen from the end) that's ;; part of END-STRING; CONTINUEP is set to T if we stop collecting ;; in the middle of a SEQ diff -ur cl-ppcre-1.2.5.old/repetition-closures.lisp cl-ppcre-1.2.5/repetition-closures.lisp --- cl-ppcre-1.2.5.old/repetition-closures.lisp 2005-03-09 08:05:56.000000000 -0600 +++ cl-ppcre-1.2.5/repetition-closures.lisp 2005-04-12 10:46:40.468588864 -0500 @@ -144,13 +144,16 @@ (loop for curr-pos of-type fixnum from target-end-pos downto start-pos thereis (funcall next-fn curr-pos)))))) -(defmethod create-greedy-constant-length-matcher ((repetition repetition) - next-fn) +(defgeneric create-greedy-constant-length-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is greedy and the minimal number of repetitions is zero. It is furthermore assumed that the inner regex of REPETITION is -of fixed length and doesn't contain registers." +of fixed length and doesn't contain registers.")) + +(defmethod create-greedy-constant-length-matcher ((repetition repetition) + next-fn) + (declare #.*standard-optimize-settings*) (let ((len (len repetition)) (maximum (maximum repetition)) (regex (regex repetition)) @@ -202,14 +205,17 @@ (declare (type function inner-matcher)) (greedy-constant-length-closure (funcall inner-matcher curr-pos))))))))) - -(defmethod create-greedy-no-zero-matcher ((repetition repetition) next-fn) + +(defgeneric create-greedy-no-zero-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is greedy and the minimal number of repetitions is zero. It is furthermore assumed that the inner regex of REPETITION can never match a zero-length string (or instead the maximal number of -repetitions is 1)." +repetitions is 1).")) + +(defmethod create-greedy-no-zero-matcher ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) (let ((maximum (maximum repetition)) ;; REPEAT-MATCHER is part of the closure's environment but it ;; can only be defined after GREEDY-AUX is defined @@ -268,11 +274,14 @@ (create-matcher-aux (regex repetition) #'greedy-aux)) #'greedy-aux))))) -(defmethod create-greedy-matcher ((repetition repetition) next-fn) +(defgeneric create-greedy-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is greedy and the minimal number of repetitions is -zero." +zero.")) + +(defmethod create-greedy-matcher ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) (let ((maximum (maximum repetition)) ;; we make a reservation for our slot in *LAST-POS-STORES* because ;; we have to watch out for endless loops as the inner regex might @@ -389,12 +398,15 @@ while ,check-curr-pos finally (return (funcall next-fn curr-pos))))))) -(defmethod create-non-greedy-constant-length-matcher ((repetition repetition) next-fn) +(defgeneric create-non-greedy-constant-length-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is non-greedy and the minimal number of repetitions is zero. It is furthermore assumed that the inner regex of REPETITION is -of fixed length and doesn't contain registers." +of fixed length and doesn't contain registers.")) + +(defmethod create-non-greedy-constant-length-matcher ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) (let ((len (len repetition)) (maximum (maximum repetition)) (regex (regex repetition)) @@ -450,13 +462,16 @@ (non-greedy-constant-length-closure (funcall inner-matcher curr-pos))))))))) -(defmethod create-non-greedy-no-zero-matcher ((repetition repetition) next-fn) +(defgeneric create-non-greedy-no-zero-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is non-greedy and the minimal number of repetitions is zero. It is furthermore assumed that the inner regex of REPETITION can never match a zero-length string (or instead the maximal number of -repetitions is 1)." +repetitions is 1).")) + +(defmethod create-non-greedy-no-zero-matcher ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) (let ((maximum (maximum repetition)) ;; REPEAT-MATCHER is part of the closure's environment but it ;; can only be defined after NON-GREEDY-AUX is defined @@ -513,11 +528,14 @@ (create-matcher-aux (regex repetition) #'non-greedy-aux)) #'non-greedy-aux))))) -(defmethod create-non-greedy-matcher ((repetition repetition) next-fn) +(defgeneric create-non-greedy-matcher (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION is non-greedy and the minimal number of repetitions is -zero." +zero.")) + +(defmethod create-non-greedy-matcher ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) ;; we make a reservation for our slot in *LAST-POS-STORES* because ;; we have to watch out for endless loops as the inner regex might ;; match zero-length strings @@ -621,13 +639,17 @@ ;; finally call NEXT-FN if we made it that far (funcall next-fn target-end-pos))))) -(defmethod create-constant-repetition-constant-length-matcher - ((repetition repetition) next-fn) +(defgeneric create-constant-repetition-constant-length-matcher + (repetition next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed + (:documentation "Creates a closure which tries to match REPETITION. It is assumed that REPETITION has a constant number of repetitions. It is furthermore assumed that the inner regex of REPETITION is of fixed -length and doesn't contain registers." +length and doesn't contain registers.")) + +(defmethod create-constant-repetition-constant-length-matcher + ((repetition repetition) next-fn) + (declare #.*standard-optimize-settings*) (let ((len (len repetition)) (repetitions (minimum repetition)) (regex (regex repetition))) @@ -696,10 +718,13 @@ (constant-repetition-constant-length-closure (funcall inner-matcher curr-pos)))))))) +(defgeneric create-constant-repetition-matcher (repetition next-fn) + (declare #.*standard-optimize-settings*) + (:documentation "Creates a closure which tries to match REPETITION. It is assumed +that REPETITION has a constant number of repetitions.")) + (defmethod create-constant-repetition-matcher ((repetition repetition) next-fn) (declare #.*standard-optimize-settings*) - "Creates a closure which tries to match REPETITION. It is assumed -that REPETITION has a constant number of repetitions." (let ((repetitions (minimum repetition)) ;; we make a reservation for our slot in *REPEAT-COUNTERS* ;; because we need to keep track of the number of repetitions From Alan-Shields at omrf.ouhsc.edu Tue Apr 12 17:22:35 2005 From: Alan-Shields at omrf.ouhsc.edu (Alan Shields) Date: Tue, 12 Apr 2005 12:22:35 -0500 Subject: [cl-ppcre-devel] FTYPE warnings Message-ID: <20050412172235.GS14800@inquisitor.omrf.org> After the generic warnings were gone, this little jewel reared its head: `-- new FTYPE proclamation # for STR does not match old FTYPE proclamation # (Alan Shields's message of "Tue, 12 Apr 2005 11:10:55 -0500") References: <20050412161055.GR14800@inquisitor.omrf.org> Message-ID: On Tue, 12 Apr 2005 11:10:55 -0500, Alan Shields wrote: > Please find enclosed a patch that adds defgenerics for the methods > that didn't have them; I got a bit sick of SBCL yammering at me. ;-) Thanks Alan, both of your patches will be in the next release. Cheers, Edi. From edi at agharta.de Wed Apr 13 15:40:24 2005 From: edi at agharta.de (Edi Weitz) Date: Wed, 13 Apr 2005 17:40:24 +0200 Subject: [cl-ppcre-devel] New version 1.2.6 Message-ID: Changelog: Version 1.2.6 2005-04-13 Added some DEFGENERICs to appease SBCL (thanks to Alan Shields) Removed wrong FTYPE declaration for STR (thanks to Alan Shields) Download: Cheers, Edi.