comparison lisp/regexp-opt.el @ 5473:ac37a5f7e5be

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Thu, 17 Mar 2011 23:42:59 +0100
parents 308d34e9f07d f00192e1cd49
children
comparison
equal deleted inserted replaced
5472:e79980ee5efe 5473:ac37a5f7e5be
171 (open-charset (if lax "" open-group)) 171 (open-charset (if lax "" open-group))
172 (close-charset (if lax "" close-group))) 172 (close-charset (if lax "" close-group)))
173 (cond 173 (cond
174 ;; 174 ;;
175 ;; If there are no strings, just return the empty string. 175 ;; If there are no strings, just return the empty string.
176 ((= (length strings) 0) 176 ((eql (length strings) 0)
177 "") 177 "")
178 ;; 178 ;;
179 ;; If there is only one string, just return it. 179 ;; If there is only one string, just return it.
180 ((= (length strings) 1) 180 ((eql (length strings) 1)
181 (if (= (length (car strings)) 1) 181 (if (eql (length (car strings)) 1)
182 (concat open-charset (regexp-quote (car strings)) close-charset) 182 (concat open-charset (regexp-quote (car strings)) close-charset)
183 (concat open-group (regexp-quote (car strings)) close-group))) 183 (concat open-group (regexp-quote (car strings)) close-group)))
184 ;; 184 ;;
185 ;; If there is an empty string, remove it and recurse on the rest. 185 ;; If there is an empty string, remove it and recurse on the rest.
186 ((= (length (car strings)) 0) 186 ((eql (length (car strings)) 0)
187 (concat open-charset 187 (concat open-charset
188 (regexp-opt-group (cdr strings) t t) "?" 188 (regexp-opt-group (cdr strings) t t) "?"
189 close-charset)) 189 close-charset))
190 ;; 190 ;;
191 ;; If all are one-character strings, just return a character set. 191 ;; If all are one-character strings, just return a character set.
192 ((= (length strings) (apply '+ (mapcar 'length strings))) 192 ((eql (length strings) (apply '+ (mapcar 'length strings)))
193 (concat open-charset 193 (concat open-charset
194 (regexp-opt-charset strings) 194 (regexp-opt-charset strings)
195 close-charset)) 195 close-charset))
196 ;; 196 ;;
197 ;; We have a list of different length strings. 197 ;; We have a list of different length strings.