[MLton-devel] Regexp.fromString

Matthew Fluet MLton@mlton.org
Tue, 11 Feb 2003 12:12:59 -0500 (EST)


> I notice that Regexp.fromString "" = NONE.  I was wondering if that is
> the correct behavior, or if it should return the regexp that accepts
> the empty string, like Regexp.fromString "()".

I wrote Regexp.fromString to match POSIX 1003.2 regular expressions to the
best of my ability.  From that document:

A (modern)  RE is one- or more non-empty- branches, separated by `|'.  It
matches anything that matches one of the branches.

An atom is a regular expression enclosed in `()' (matching a match for the
regular expression), an empty set of `()' (matching the null string), ...

So, my interpretation is that "" isn't a legal RE, while "()" is a legal
RE corresponding to the regexp that accepts the empty string.

I don't have that strong feelings, but I kind of prefer keeping it in
compliance with the POSIX standard.  Are you running into problems with
the mlprof graph language REs?




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel