Changeset 12131 in project
- Timestamp:
- 10/09/08 12:46:42 (12 years ago)
- Location:
- chicken/branches/irregular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
chicken/branches/irregular/regex.scm
r12124 r12131 76 76 opts))) ) 77 77 78 (define (unregexp x) 79 (cond ((regexp? x) (regexp-x x)) 80 ((irregex? x) x) 81 (else (irregex x)))) 82 78 83 (define (string-match rx str) 79 (let ((rx ( irregexrx)))84 (let ((rx (unregexp rx))) 80 85 (and-let* ((m (irregex-match rx str))) 81 86 (let ((n (irregex-submatches rx))) … … 88 93 89 94 (define (string-match-positions rx str) 90 (let ((rx ( irregexrx)))95 (let ((rx (unregexp rx))) 91 96 (and-let* ((m (irregex-match rx str))) 92 97 (let ((n (irregex-submatches m))) … … 102 107 103 108 (define (string-search rx str #!optional (start 0) (range (string-length str))) 104 (let ((rx ( irregexrx)))109 (let ((rx (unregexp rx))) 105 110 (and-let* ((m (irregex-search rx str start (fx+ start range)))) 106 111 (let loop ((i (irregex-submatches rx)) … … 112 117 113 118 (define (string-search-positions rx str #!optional (start 0) (range (string-length str))) 114 (let ((rx ( irregexrx)))119 (let ((rx (unregexp rx))) 115 120 (and-let* ((m (irregex-search rx str start (fx+ start range)))) 116 121 (let loop ((i (irregex-submatches rx)) -
chicken/branches/irregular/tests/re-tests.txt
r12124 r12131 119 119 (bc+d$|ef*g.|h?i(j|k)) bcdd n - - 120 120 (bc+d$|ef*g.|h?i(j|k)) reffgz y &-\1-\2 effgz-effgz- 121 ((((((((((a)))))))))) - c - -122 121 (((((((((a))))))))) a y & a 123 122 multiple words of text uh-uh n - -
Note: See TracChangeset
for help on using the changeset viewer.