Mercurial > emacs
comparison lisp/emacs-lisp/regexp-opt.el @ 41616:8ba7e2fecead
(regexp-opt-depth): Fix off-by-two error.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 28 Nov 2001 03:06:10 +0000 |
parents | 253f761ad37b |
children | fde712c2fd73 |
comparison
equal
deleted
inserted
replaced
41615:6486180ed9ef | 41616:8ba7e2fecead |
---|---|
118 (string-match regexp "") | 118 (string-match regexp "") |
119 ;; Count the number of open parentheses in REGEXP. | 119 ;; Count the number of open parentheses in REGEXP. |
120 (let ((count 0) start) | 120 (let ((count 0) start) |
121 (while (string-match "\\(\\`\\|[^\\]\\)\\\\\\(\\\\\\\\\\)*([^?]" | 121 (while (string-match "\\(\\`\\|[^\\]\\)\\\\\\(\\\\\\\\\\)*([^?]" |
122 regexp start) | 122 regexp start) |
123 (setq count (1+ count) start (match-end 0))) | 123 (setq count (1+ count) |
124 ;; Go back 2 chars (one for [^?] and one for [^\\]). | |
125 start (- (match-end 0) 2)) | |
124 count))) | 126 count))) |
125 | 127 |
126 ;;; Workhorse functions. | 128 ;;; Workhorse functions. |
127 | 129 |
128 (eval-when-compile | 130 (eval-when-compile |