[m-rev.] New regex module in extras/lex

Ralph Becket rafe at cs.mu.OZ.AU
Thu Nov 28 15:17:18 AEDT 2002


Fergus Henderson, Thursday, 28 November 2002:
> 
> I don't have time to review this thoroughly right now.
> However, I did notice one serious problem (see below).
> I think fixing this will require non-trivial changes.

I think this one should be pretty easy, to be honest.

> > +++ README.regex	26 Nov 2002 01:08:56 -0000
> > @@ -0,0 +1,70 @@
> > +THE REGEX MODULE
> > +
> > +The regex/1 function converts standard string-type regular expression
> > +definitions into values of type regex.
> > +
> > +EXAMPLE OF REGEXES
> > +
> > +regex(".")		matches any char except `\n'
> > +regex("abc")		matches `abc'
> > +regex("abc*")		matches zero or more contiguous occurrences of `abc'
> 
> That's different to the meaning used by "grep" or "perl".
> In those programs, `abc*' is `ab' followed by zero or more
> contiguous occurrences of `c'.  That is, "*" binds tighter
> than juxtaposition.  (There are probably similar issues for
> other operators.  I didn't check in detail.)

Yes, I can change that.  IMHO it would have been preferable to
make character concatenation bind more tightly than kleene closure etc,
but you're right, there's little point in bucking the standard.
 
> So, when you said "standard" string-type regular expression definitions,
> which standard were you referring to?

"Conventional" would be a better word.  Would it work for you if I
changed the comment?

> If this is a difference between POSIX regexps and grep/perl regexps,
> then the documentation should explain that clearly.

Okay, I'll fix it up so it conforms to (a subset of) modern POSIX 1003.2
as specified under `man 7 regex' and add a comment to this effect.

> If this is just an unintended difference, then it should be fixed.
> Also, there should be some additional tests to test that these
> regexps behave the same as those in one of the other popular tools
> that uses regexps, e.g. grep, sed, or perl.

Okay, I'll extend the test suite.

- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list