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: Wed, 02 Nov 2005 09:20:46 +0100
List-id: Discussion among the implementors <scsh-hackers.list-id.scsh.net>
Bugs item #1063781, was opened at 11/10/04 04:51
Message generated for change (Comment added) made by sf-robot
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: Closed
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: SourceForge Robot (sf-robot)
Date: 11/01/05 19:20

Message:
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

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

Comment By: Martin Gasbichler (mainzelm)
Date: 10/18/05 07: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 <=