scsh-users
[Top] [All Lists]

Re: Cset-sre question

To: Matthias Hertel <mhertel-re-news@bigfoot.de>
Subject: Re: Cset-sre question
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Fri, 09 Jan 2004 23:50:05 +0100
Cc: scsh-news@zurich.csail.mit.edu
Matthias Hertel <mhertel-re-news@bigfoot.de> writes:

> Apparently, ,c expressions yielding characters, single-character strings 
> or re-char-sets are not always coerced into char-sets by the rx 
> machinery.  Here are a few more data points:
>
> Welcome to scsh 0.6.4 (Olin Shivers)
> Type ,? for help.
>  > (rx (- any #\x))
> '#{re-char-set}
>  > (let ((x (char-set #\x))) (rx (- any ,x)))
> '#{re-char-set}
>  > (let ((x #\x)) (rx (- any ,x)))
>
> Error: Not a char-set
>         #\x
>         #{Procedure 8372 (char-set-difference in srfi-14)}
> 1>
>
> In other words, the quick fix is to say (until-char (char-set #\.)) in 
> your code fragment, which works with both definitions of until-char.

Here is the not-so-quick-fix that should make the both of you happy:

Index: parse.scm
===================================================================
RCS file: /cvsroot/scsh/scsh/scsh/rx/parse.scm,v
retrieving revision 1.12.2.1
diff -u -c -r1.12.2.1 parse.scm
*** parse.scm   23 Oct 2003 15:55:54 -0000      1.12.2.1
--- parse.scm   9 Jan 2004 22:43:26 -0000
***************
*** 273,279 ****
                                      cs1)
                                 . ,(if (char-set? cs2)
                                        (list (char-set->scheme cs2 r))
!                                       (cdr cs2))))))
                  (if cset? cs (make-re-char-set cs)))
                (error "SRE set-difference operator (- ...) requires at least 
one argument")))
             
--- 273,279 ----
                                      cs1)
                                 . ,(if (char-set? cs2)
                                        (list (char-set->scheme cs2 r))
!                                       (list cs2))))))
                  (if cset? cs (make-re-char-set cs)))
                (error "SRE set-difference operator (- ...) requires at least 
one argument")))



--
Martin

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