[m-rev.] for review: use semidet predicate for whitespace skipper

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Apr 20 11:20:15 AEST 2011


On Wed, Apr 20, 2011 at 10:41:31AM +1000, Paul Bone wrote:
> On Tue, Apr 19, 2011 at 06:34:34PM +1000, Ian MacLarty wrote:
> > For review by anyone.
> > 
> > Estimated hours taken: 2
> > Branches: main
> > 
> > Turn the whitespace skipping function into a semidet
> > predicate with the same signature as all the other parsing
> > predicates.
> > 
> > Sometimes you want whitespace skipping to fail, for example
> > if there is no matching */ in a C style comment.
> > 
> > library/parsing_utils.m:
> >     Make the whitespace skipping function a predicate.
> > 
> > tests/general/test_parsing_utils.m:
> > tests/general/test_parsing_utils.exp:
> >     Test failure of whitespace skipping predicate.
> 
> This is fine with me.  The diff looks good.
> 

Committed, with the following fix to the skip_ws predicate in the test
program (it didn't previously handle multiple comments in a row).

diff -u tests/general/test_parsing_utils.m tests/general/test_parsing_utils.m
--- tests/general/test_parsing_utils.m	19 Apr 2011 08:32:15 -0000
+++ tests/general/test_parsing_utils.m	20 Apr 2011 01:14:34 -0000
@@ -419,7 +419,7 @@
     whitespace(Src, _),
     ( next_char(Src, ('/')), next_char(Src, ('*')) ->
         find_close_comment(Src),
-        whitespace(Src, _)
+        skip_ws(Src, _)
     ;
         { true }
     ).
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list