scsh-hackers
[Top] [All Lists]

[ scsh-Bugs-1063781 ] rx-choice doesn't create char-sets

To: scsh-hackers@scsh.net
Subject: [ scsh-Bugs-1063781 ] rx-choice doesn't create char-sets
From: "SourceForge.net" <noreply@sourceforge.net>
Date: Tue, 18 Oct 2005 07:05:09 -0700
List-id: Discussion among the implementors <scsh-hackers.list-id.scsh.net>
Sender: Nobody <nobody@projects.sourceforge.net>
Bugs item #1063781, was opened at 2004-11-10 13:51
Message generated for change (Comment added) made by mainzelm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110493&aid=1063781&group_id=10493

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: run-time
Group: None
>Status: Pending
>Resolution: Duplicate
Priority: 5
Submitted By: Martin Gasbichler (mainzelm)
Assigned to: Mike Sperber (sperber)
Summary: rx-choice doesn't create char-sets

Initial Comment:

 (rx (| numeric alphabetic)) yields a char-set: but 
(rx (| ,(rx numeric) ,(rx alphabetic))) doesn't:, even
though the "type-checking rules" for char-sets says
that it should:

> (rx (| numeric alphabetic))
'#{re-char-set}
> (rx (| ,(rx numeric) ,(rx alphabetic))) 
'#{Re-choice}

The following patch fixes this but I'm not sure if
make-re-choice is the right place to tackle this problem:

Index: re.scm
===================================================================
RCS file: /cvsroot/scsh/scsh/scsh/rx/re.scm,v
retrieving revision 1.8
diff -u -c -r1.8 re.scm
*** re.scm      30 Oct 2002 12:33:51 -0000      1.8
--- re.scm      10 Nov 2004 12:48:25 -0000
***************
*** 133,146 ****
    (really-make-re-choice elts tsm (new-cre posix-str
tvec)))
  
  (define (make-re-choice res)
!   (make-re-choice/tsm res
!                     (fold (lambda (re sm-count)
!                          (let ((maybe-tsm (re-tsm re)))
!                            (if (and (number? maybe-tsm)
!                                     (number? sm-count))
!                                (+ maybe-tsm sm-count)
!                                (unspecific))))
!                           0 res)))
  
  ;;; Slightly smart choice constructor:
  ;;; - Flattens nested choices
--- 133,148 ----
    (really-make-re-choice elts tsm (new-cre posix-str
tvec)))
  
  (define (make-re-choice res)
!   (if (every re-char-set? res)
!       (make-re-char-set (apply char-set-union (map
re-char-set:cset res)))
!       (make-re-choice/tsm res
!                           (fold (lambda (re sm-count)
!                                   (let ((maybe-tsm
(re-tsm re)))
!                                     (if (and (number?
maybe-tsm)
!                                              (number?
sm-count))
!                                         (+ maybe-tsm
sm-count)
!                                         (unspecific))))
!                                 0 res))))
  
  ;;; Slightly smart choice constructor:
  ;;; - Flattens nested choices


----------------------------------------------------------------------

>Comment By: Martin Gasbichler (mainzelm)
Date: 2005-10-18 16:05

Message:
Logged In: YES 
user_id=17553

I've committed the above patch to CVS. It will be in 0.6.7.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110493&aid=1063781&group_id=10493

<Prev in Thread] Current Thread [Next in Thread>
  • [ scsh-Bugs-1063781 ] rx-choice doesn't create char-sets, SourceForge.net <=