scsh-users
[Top] [All Lists]

Re: let-match and don't-care elements in 0.6.3

To: stktrc <stktrc@yahoo.com>
Subject: Re: let-match and don't-care elements in 0.6.3
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Thu, 23 Jan 2003 18:18:47 +0100
Cc: scsh-news@zurich.ai.mit.edu
>>>>> "stktrc" == stktrc  <stktrc@yahoo.com> writes:

stktrc> The manual says about let-match:
stktrc> "Mvars is a list of vars that is bound to the match and submatches of
stktrc> the string; #F is allowed as a don't-care element."

stktrc> With 0.6.3 I try

stktrc> (let-match (regexp-search (rx (submatch "aa") (submatch "bb")) "aabb")
stktrc>            (#f aa bb)
stktrc>            (format #t "aa: ~a bb: ~a~%" aa bb))

stktrc> and get

stktrc> Warning: use of macro doesn't match definition
stktrc>          (let ((#f (match:substring ?match-var 0))) (let-match-aux 
?match-var (+ 1 0) (aa bb) (format #t "aa: ~a bb: ~a~%" aa bb)))
stktrc> 'syntax-error

stktrc> This seemed to work in 0.6.2.

Yes, this is a bug in 0.6.3. Here is the patch:

Index: re-match-syntax.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-0.6/scsh/rx/re-match-syntax.scm,v
retrieving revision 1.2
diff -u -c -r1.2 re-match-syntax.scm
*** re-match-syntax.scm 17 Dec 2002 13:33:33 -0000      1.2
--- re-match-syntax.scm 23 Jan 2003 17:14:37 -0000
***************
*** 18,23 ****
--- 18,25 ----
  
  (define-syntax let-match-aux
    (syntax-rules ()
+     ((let-match-aux ?match-var ?i0 (#f ?mvars ...) ?body0 ?body ...)
+      (let-match-aux ?match-var (+ 1 ?i0) (?mvars ...) ?body0 ?body ...))
      ((let-match-aux ?match-var ?i0 (?mvar0 ?mvars ...) ?body0 ?body ...)
       (let ((?mvar0 (match:substring ?match-var ?i0)))
         (let-match-aux ?match-var (+ 1 ?i0) (?mvars ...) ?body0 ?body ...)))


Note that the behavior is still different from 0.6.2 because let-match
was broken there (and in all previous versions).

Thanks for the report!

-- 
Martin

<Prev in Thread] Current Thread [Next in Thread>