[m-dev.] diff: improve error messages for DCG if-then-else

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jul 8 20:01:35 AEST 1999


Estimated hours taken: 0.25

compiler/typecheck.m:
	Do special error-handling for if-then-else in DCGs in the same
	way that we currently do for ordinary (non-DCG) if-then-elses.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.260
diff -u -r1.260 typecheck.m
--- typecheck.m	1999/07/08 08:15:18	1.260
+++ typecheck.m	1999/07/08 09:09:13
@@ -4740,7 +4740,7 @@
 	{ typecheck_info_get_context(TypeCheckInfo, Context) },
 	write_typecheck_info_context(TypeCheckInfo),
 	(
-		{ PredName = unqualified("->"), Arity = 2 }
+		{ PredName = unqualified("->"), (Arity = 2 ; Arity = 4) }
 	->
 		io__write_string("  error: `->' without `;'.\n"),
 		globals__io_lookup_bool_option(verbose_errors, VerboseErrors),
@@ -4755,15 +4755,15 @@
 			[]
 		)
 	;
-		{ PredName = unqualified("else"), Arity = 2 }
+		{ PredName = unqualified("else"), (Arity = 2 ; Arity = 4) }
 	->
 		io__write_string("  error: unmatched `else'.\n")
 	;
-		{ PredName = unqualified("if"), Arity = 2 }
+		{ PredName = unqualified("if"), (Arity = 2 ; Arity = 4) }
 	->
 		io__write_string("  error: `if' without `then' or `else'.\n")
 	;
-		{ PredName = unqualified("then"), Arity = 2 }
+		{ PredName = unqualified("then"), (Arity = 2 ; Arity = 4) }
 	->
 		io__write_string("  error: `then' without `if' or `else'.\n"),
 		globals__io_lookup_bool_option(verbose_errors, VerboseErrors),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list