Hex Artifact Content
Not logged in

Artifact ff76b7d0fb065dd18da5ee28d8d666e0412b17fe:


0000: 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b  ;;;;;;;;;;;;;;;;
0010: 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b  ;;;;;;;;;;;;;;;;
0020: 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b  ;;;;;;;;;;;;;;;;
0030: 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b  ;;;;;;;;;;;;;;;;
0040: 3b 3b 3b 3b 3b 3b 3b 3b 0a 3b 3b 3b 20 52 36 52  ;;;;;;;;.;;; R6R
0050: 53 20 6c 69 62 72 61 72 79 20 66 6f 72 20 41 6c  S library for Al
0060: 65 78 20 53 68 69 6e 6e 27 73 20 49 72 72 65 67  ex Shinn's Irreg
0070: 65 78 0a 3b 3b 3b 20 0a 3b 3b 3b 20 43 6f 70 79  ex.;;; .;;; Copy
0080: 72 69 67 68 74 20 28 63 29 20 32 30 30 39 20 41  right (c) 2009 A
0090: 61 72 6f 6e 20 57 2e 20 48 73 75 20 3c 61 72 63  aron W. Hsu <arc
00a0: 66 69 64 65 40 73 61 63 72 69 64 65 6f 2e 75 73  fide@sacrideo.us
00b0: 3e 0a 3b 3b 3b 20 0a 3b 3b 3b 20 50 65 72 6d 69  >.;;; .;;; Permi
00c0: 73 73 69 6f 6e 20 74 6f 20 75 73 65 2c 20 63 6f  ssion to use, co
00d0: 70 79 2c 20 6d 6f 64 69 66 79 2c 20 61 6e 64 20  py, modify, and 
00e0: 64 69 73 74 72 69 62 75 74 65 20 74 68 69 73 20  distribute this 
00f0: 73 6f 66 74 77 61 72 65 20 66 6f 72 0a 3b 3b 3b  software for.;;;
0100: 20 61 6e 79 20 70 75 72 70 6f 73 65 20 77 69 74   any purpose wit
0110: 68 20 6f 72 20 77 69 74 68 6f 75 74 20 66 65 65  h or without fee
0120: 20 69 73 20 68 65 72 65 62 79 20 67 72 61 6e 74   is hereby grant
0130: 65 64 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61  ed, provided tha
0140: 74 20 74 68 65 0a 3b 3b 3b 20 61 62 6f 76 65 20  t the.;;; above 
0150: 63 6f 70 79 72 69 67 68 74 20 6e 6f 74 69 63 65  copyright notice
0160: 20 61 6e 64 20 74 68 69 73 20 70 65 72 6d 69 73   and this permis
0170: 73 69 6f 6e 20 6e 6f 74 69 63 65 20 61 70 70 65  sion notice appe
0180: 61 72 20 69 6e 20 61 6c 6c 0a 3b 3b 3b 20 63 6f  ar in all.;;; co
0190: 70 69 65 73 2e 0a 3b 3b 3b 20 0a 3b 3b 3b 20 54  pies..;;; .;;; T
01a0: 48 45 20 53 4f 46 54 57 41 52 45 20 49 53 20 50  HE SOFTWARE IS P
01b0: 52 4f 56 49 44 45 44 20 22 41 53 20 49 53 22 20  ROVIDED "AS IS" 
01c0: 41 4e 44 20 54 48 45 20 41 55 54 48 4f 52 20 44  AND THE AUTHOR D
01d0: 49 53 43 4c 41 49 4d 53 20 41 4c 4c 0a 3b 3b 3b  ISCLAIMS ALL.;;;
01e0: 20 57 41 52 52 41 4e 54 49 45 53 20 57 49 54 48   WARRANTIES WITH
01f0: 20 52 45 47 41 52 44 20 54 4f 20 54 48 49 53 20   REGARD TO THIS 
0200: 53 4f 46 54 57 41 52 45 20 49 4e 43 4c 55 44 49  SOFTWARE INCLUDI
0210: 4e 47 20 41 4c 4c 20 49 4d 50 4c 49 45 44 0a 3b  NG ALL IMPLIED.;
0220: 3b 3b 20 57 41 52 52 41 4e 54 49 45 53 20 4f 46  ;; WARRANTIES OF
0230: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0240: 20 41 4e 44 20 46 49 54 4e 45 53 53 2e 20 49 4e   AND FITNESS. IN
0250: 20 4e 4f 20 45 56 45 4e 54 20 53 48 41 4c 4c 20   NO EVENT SHALL 
0260: 54 48 45 0a 3b 3b 3b 20 41 55 54 48 4f 52 20 42  THE.;;; AUTHOR B
0270: 45 20 4c 49 41 42 4c 45 20 46 4f 52 20 41 4e 59  E LIABLE FOR ANY
0280: 20 53 50 45 43 49 41 4c 2c 20 44 49 52 45 43 54   SPECIAL, DIRECT
0290: 2c 20 49 4e 44 49 52 45 43 54 2c 20 4f 52 20 43  , INDIRECT, OR C
02a0: 4f 4e 53 45 51 55 45 4e 54 49 41 4c 0a 3b 3b 3b  ONSEQUENTIAL.;;;
02b0: 20 44 41 4d 41 47 45 53 20 4f 52 20 41 4e 59 20   DAMAGES OR ANY 
02c0: 44 41 4d 41 47 45 53 20 57 48 41 54 53 4f 45 56  DAMAGES WHATSOEV
02d0: 45 52 20 52 45 53 55 4c 54 49 4e 47 20 46 52 4f  ER RESULTING FRO
02e0: 4d 20 4c 4f 53 53 20 4f 46 20 55 53 45 2c 20 44  M LOSS OF USE, D
02f0: 41 54 41 0a 3b 3b 3b 20 4f 52 20 50 52 4f 46 49  ATA.;;; OR PROFI
0300: 54 53 2c 20 57 48 45 54 48 45 52 20 49 4e 20 41  TS, WHETHER IN A
0310: 4e 20 41 43 54 49 4f 4e 20 4f 46 20 43 4f 4e 54  N ACTION OF CONT
0320: 52 41 43 54 2c 20 4e 45 47 4c 49 47 45 4e 43 45  RACT, NEGLIGENCE
0330: 20 4f 52 20 4f 54 48 45 52 0a 3b 3b 3b 20 54 4f   OR OTHER.;;; TO
0340: 52 54 49 4f 55 53 20 41 43 54 49 4f 4e 2c 20 41  RTIOUS ACTION, A
0350: 52 49 53 49 4e 47 20 4f 55 54 20 4f 46 20 4f 52  RISING OUT OF OR
0360: 20 49 4e 20 43 4f 4e 4e 45 43 54 49 4f 4e 20 57   IN CONNECTION W
0370: 49 54 48 20 54 48 45 20 55 53 45 20 4f 52 0a 3b  ITH THE USE OR.;
0380: 3b 3b 20 50 45 52 46 4f 52 4d 41 4e 43 45 20 4f  ;; PERFORMANCE O
0390: 46 20 54 48 49 53 20 53 4f 46 54 57 41 52 45 2e  F THIS SOFTWARE.
03a0: 0a 0a 28 6c 69 62 72 61 72 79 20 28 66 6f 6f 66  ..(library (foof
03b0: 20 69 72 72 65 67 65 78 29 0a 20 20 28 65 78 70   irregex).  (exp
03c0: 6f 72 74 20 0a 20 20 20 20 69 72 72 65 67 65 78  ort .    irregex
03d0: 20 0a 20 20 20 20 73 74 72 69 6e 67 2d 3e 69 72   .    string->ir
03e0: 72 65 67 65 78 20 0a 20 20 20 20 73 72 65 2d 3e  regex .    sre->
03f0: 69 72 72 65 67 65 78 20 0a 20 20 20 20 69 72 72  irregex .    irr
0400: 65 67 65 78 3f 0a 20 20 20 20 69 72 72 65 67 65  egex?.    irrege
0410: 78 2d 73 65 61 72 63 68 0a 20 20 20 20 69 72 72  x-search.    irr
0420: 65 67 65 78 2d 6d 61 74 63 68 0a 20 20 20 20 69  egex-match.    i
0430: 72 72 65 67 65 78 2d 6d 61 74 63 68 2d 64 61 74  rregex-match-dat
0440: 61 3f 0a 20 20 20 20 69 72 72 65 67 65 78 2d 6d  a?.    irregex-m
0450: 61 74 63 68 2d 73 75 62 73 74 72 69 6e 67 20 69  atch-substring i
0460: 72 72 65 67 65 78 2d 6d 61 74 63 68 2d 73 74 61  rregex-match-sta
0470: 72 74 2d 69 6e 64 65 78 0a 20 20 20 20 69 72 72  rt-index.    irr
0480: 65 67 65 78 2d 6d 61 74 63 68 2d 65 6e 64 2d 69  egex-match-end-i
0490: 6e 64 65 78 20 0a 20 20 20 20 69 72 72 65 67 65  ndex .    irrege
04a0: 78 2d 6d 61 74 63 68 2d 73 75 62 63 68 75 6e 6b  x-match-subchunk
04b0: 0a 20 20 20 20 69 72 72 65 67 65 78 2d 72 65 70  .    irregex-rep
04c0: 6c 61 63 65 20 69 72 72 65 67 65 78 2d 72 65 70  lace irregex-rep
04d0: 6c 61 63 65 2f 61 6c 6c 0a 20 20 20 20 69 72 72  lace/all.    irr
04e0: 65 67 65 78 2d 66 6f 6c 64 0a 20 20 20 20 69 72  egex-fold.    ir
04f0: 72 65 67 65 78 2d 66 6f 6c 64 2f 63 68 75 6e 6b  regex-fold/chunk
0500: 65 64 0a 20 20 20 20 6d 61 6b 65 2d 69 72 72 65  ed.    make-irre
0510: 67 65 78 2d 63 68 75 6e 6b 65 72 0a 20 20 20 20  gex-chunker.    
0520: 69 72 72 65 67 65 78 2d 73 65 61 72 63 68 2f 63  irregex-search/c
0530: 68 75 6e 6b 65 64 20 69 72 72 65 67 65 78 2d 6d  hunked irregex-m
0540: 61 74 63 68 2f 63 68 75 6e 6b 65 64 29 0a 20 20  atch/chunked).  
0550: 28 69 6d 70 6f 72 74 20 0a 20 20 20 20 28 65 78  (import .    (ex
0560: 63 65 70 74 20 28 72 6e 72 73 20 62 61 73 65 29  cept (rnrs base)
0570: 20 65 72 72 6f 72 29 0a 20 20 20 20 28 72 6e 72   error).    (rnr
0580: 73 20 63 6f 6e 74 72 6f 6c 29 0a 20 20 20 20 28  s control).    (
0590: 72 6e 72 73 20 6c 69 73 74 73 29 0a 20 20 20 20  rnrs lists).    
05a0: 28 72 6e 72 73 20 72 35 72 73 29 0a 20 20 20 20  (rnrs r5rs).    
05b0: 28 72 6e 72 73 20 6d 75 74 61 62 6c 65 2d 70 61  (rnrs mutable-pa
05c0: 69 72 73 29 0a 20 20 20 20 28 72 6e 72 73 20 6d  irs).    (rnrs m
05d0: 75 74 61 62 6c 65 2d 73 74 72 69 6e 67 73 29 0a  utable-strings).
05e0: 20 20 20 20 28 72 6e 72 73 20 75 6e 69 63 6f 64      (rnrs unicod
05f0: 65 29 0a 20 20 20 20 28 73 72 66 69 20 3a 32 33  e).    (srfi :23
0600: 29 0a 20 20 20 20 28 73 72 66 69 20 70 72 69 76  ).    (srfi priv
0610: 61 74 65 20 69 6e 63 6c 75 64 65 29 29 0a 0a 28  ate include))..(
0620: 69 6e 63 6c 75 64 65 2f 72 65 73 6f 6c 76 65 20  include/resolve 
0630: 28 22 66 6f 6f 66 22 29 20 22 69 72 72 65 67 65  ("foof") "irrege
0640: 78 2d 72 36 72 73 2e 73 63 6d 22 29 0a 0a 29     x-r6rs.scm")..)