Changeset 13074 in project for chicken


Ignore:
Timestamp:
01/24/09 16:11:27 (11 years ago)
Author:
felix winkelmann
Message:

applied regex patches fixing indices from chicken-3 branch by Ivan to trunk (not tested yet)

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/irregex.scm

    r12920 r13074  
    14931493  (let ((irx (irregex x)))
    14941494    (let ((start (if (pair? o) (car o) 0))
    1495           (end (if (and (pair? o) (pair? (cdr o)))
    1496                    (cadr o)
    1497                    (string-length str)))
     1495          (end   (if (and (pair? o) (pair? (cdr o)))
     1496                     (cadr o) (string-length str)))
    14981497          (matches (irregex-new-matches irx)))
    14991498      (irregex-match-string-set! matches str)
  • chicken/trunk/regex.scm

    r12937 r13074  
    105105(define (string-search rx str #!optional (start 0) (range (string-length str)))
    106106  (let ((rx (unregexp rx)))
    107     (and-let* ((m (irregex-search rx str start (fx+ start range))))
     107    (and-let* ((n (string-length str))
     108               (m (irregex-search rx str start (min n (fx+ start range)))))
    108109      (let loop ((i (irregex-match-num-submatches m))
    109110                 (res '()))
     
    114115(define (string-search-positions rx str #!optional (start 0) (range (string-length str)))
    115116  (let ((rx (unregexp rx)))
    116     (and-let* ((m (irregex-search rx str start (fx+ start range))))
     117    (and-let* ((n (string-length str))
     118               (m (irregex-search rx str start (min n (fx+ start (fx- n 1))))))
    117119      (let loop ((i (irregex-match-num-submatches m))
    118120                 (res '()))
Note: See TracChangeset for help on using the changeset viewer.