fixed rx: submatches now contain bos/eos
This commit is contained in:
		
							parent
							
								
									68a122a2a5
								
							
						
					
					
						commit
						92821d9337
					
				| 
						 | 
				
			
			@ -100,12 +100,12 @@
 | 
			
		|||
	       (middle (list-ref submatches 1))
 | 
			
		||||
	       (right (list-ref submatches 2))
 | 
			
		||||
	       (constructed-rx (if (and (string? middle) (string=? "%" middle))
 | 
			
		||||
				   (rx (: (submatch ,left) 
 | 
			
		||||
				   (rx (: (submatch (: bos ,left))
 | 
			
		||||
					  (submatch (* any))
 | 
			
		||||
					  (submatch ,right)))
 | 
			
		||||
				   (rx (: (submatch ,left)
 | 
			
		||||
					  (submatch (: ,right eos))))
 | 
			
		||||
				   (rx (: (submatch (: bos ,left))
 | 
			
		||||
					  (submatch ,middle)
 | 
			
		||||
					  (submatch ,right)))))
 | 
			
		||||
					  (submatch (: ,right eos))))))
 | 
			
		||||
	       (maybe-match (regexp-search constructed-rx target-name)))
 | 
			
		||||
	  (if maybe-match
 | 
			
		||||
	      (map (lambda (match-no)
 | 
			
		||||
| 
						 | 
				
			
			@ -120,9 +120,9 @@
 | 
			
		|||
 | 
			
		||||
(define (get-submatches-percent target-descr)
 | 
			
		||||
  (map (lambda (match-no)
 | 
			
		||||
	 (match:substring (regexp-search (rx (: (submatch (* any))
 | 
			
		||||
	 (match:substring (regexp-search (rx (: (submatch (: bos (* any)))
 | 
			
		||||
						(submatch "%") 
 | 
			
		||||
						(submatch (* any)))) 
 | 
			
		||||
						(submatch (: (* any) eos))))
 | 
			
		||||
					 target-descr)
 | 
			
		||||
			  match-no))
 | 
			
		||||
       (list 1 2 3)))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue