* empty regular expressions don't work on the BSDs
@ 2004-05-28 20:28 Andreas Vögele
2004-05-29 22:16 ` Kevin Ryde
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Vögele @ 2004-05-28 20:28 UTC (permalink / raw)
There are five tests in test-suite/tests/numbers.test that use an empty
regular expression. Here's the first test:
(pass-if-exception
"Proper exception with 0 modulus"
(cons 'numerical-overflow "") <-- empty RE
(modulo-expt 17 23 0))
The problem is that on Mac OS X and the other BSDs regcomp() does not
accept empty regular expressions. The BSD regex implementation is based
on Henry Spencer's implementation. I don't know what POSIX says about
empty REs but Henry Spencer's manual page says that "an empty string is
not a legal RE" (see http://arglist.com/regex/regex3.html).
The tests in numbers.test succeed if the empty REs are replaced with
".". Another option would be to handle empty REs in string-match.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: empty regular expressions don't work on the BSDs
2004-05-28 20:28 empty regular expressions don't work on the BSDs Andreas Vögele
@ 2004-05-29 22:16 ` Kevin Ryde
2004-05-30 8:07 ` Andreas Vögele
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2004-05-29 22:16 UTC (permalink / raw)
Andreas Vögele <voegelas@gmx.net> writes:
>
> (cons 'numerical-overflow "") <-- empty RE
Thanks, I introduced an exception:numerical-overflow doing this
properly, and used exception:wrong-type-arg for the other empties.
> Another option would be to handle empty REs in string-match.
I think it could follow the libc, as long as it doesn't crash.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: empty regular expressions don't work on the BSDs
2004-05-29 22:16 ` Kevin Ryde
@ 2004-05-30 8:07 ` Andreas Vögele
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Vögele @ 2004-05-30 8:07 UTC (permalink / raw)
Kevin Ryde writes:
>> Another option would be to handle empty REs in string-match.
>
> I think it could follow the libc, as long as it doesn't crash.
Yes. In practice empty regular expression aren't common anyway.
Henry Spencer's regcomp doesn't crash if the regular expression is
empty. Instead the error code REG_EMPTY is returned. POSIX doesn't
define REG_EMPTY but the RE grammar presented in the POSIX
specification doesn't seem to allow empty REs either. See
http://www.opengroup.org/onlinepubs/009695399/basedefs/
xbd_chap09.html#tag_09_05
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-30 8:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28 20:28 empty regular expressions don't work on the BSDs Andreas Vögele
2004-05-29 22:16 ` Kevin Ryde
2004-05-30 8:07 ` Andreas Vögele
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).