diff: term_io__quote_string

Fergus Henderson fjh at cs.mu.oz.au
Thu Apr 24 02:22:10 AEST 1997


library/term_io.m:
compiler/mercury_to_mercury.m:
	Change term_io__quote_string to match its specification:
	it should write out the enclosing double-quotes itself,
	rather than leaving that to its caller.

Index: term_io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/term_io.m,v
retrieving revision 1.40
diff -u -r1.40 term_io.m
--- term_io.m	1997/02/26 09:24:28	1.40
+++ term_io.m	1997/04/23 16:10:01
@@ -275,9 +275,7 @@
 term_io__write_constant(term__atom(A))  -->
 	term_io__quote_atom(A).
 term_io__write_constant(term__string(S)) -->
-	io__write_char('"'),
-	term_io__quote_string(S),
-	io__write_char('"').
+	term_io__quote_string(S).
 
 %-----------------------------------------------------------------------------%
 
@@ -295,14 +293,19 @@
 		io__write_string(S)
 	;
 		io__write_char(''''),
-		term_io__quote_string(S),
+		term_io__write_quoted_string(S),
 		io__write_char('''')
 	).
 
-term_io__quote_string(S0) -->
+term_io__quote_string(S) -->
+	io__write_char('"'),
+	term_io__write_quoted_string(S),
+	io__write_char('"').
+
+term_io__write_quoted_string(S0) -->
 	( { string__first_char(S0, Char, S1) } ->
 		term_io__quote_single_char(Char),
-		term_io__quote_string(S1)
+		term_io__write_quoted_string(S1)
 	;
 		[]
 	).
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.98
diff -u -r1.98 mercury_to_mercury.m
--- mercury_to_mercury.m	1997/04/03 01:17:53	1.98
+++ mercury_to_mercury.m	1997/04/23 11:25:39
@@ -1383,9 +1383,9 @@
 %-----------------------------------------------------------------------------%
 
 mercury_output_pragma_c_header(C_HeaderString) -->
-	io__write_string(":- pragma c_header_code("""),
+	io__write_string(":- pragma c_header_code("),
 	term_io__quote_string(C_HeaderString),
-	io__write_string(""").\n").
+	io__write_string(").\n").
 
 %-----------------------------------------------------------------------------%
 
@@ -1394,9 +1394,9 @@
 :- mode mercury_output_pragma_source_file(in, di, uo) is det.
 
 mercury_output_pragma_source_file(SourceFileString) -->
-	io__write_string(":- pragma source_file("""),
+	io__write_string(":- pragma source_file("),
 	term_io__quote_string(SourceFileString),
-	io__write_string(""").\n").
+	io__write_string(").\n").
 
 %-----------------------------------------------------------------------------%
 
@@ -1405,9 +1405,9 @@
 :- mode mercury_output_pragma_c_body_code(in, di, uo) is det.
 
 mercury_output_pragma_c_body_code(C_CodeString) -->
-	io__write_string(":- pragma c_code("""),
+	io__write_string(":- pragma c_code("),
 	term_io__quote_string(C_CodeString),
-	io__write_string(""").\n").
+	io__write_string(").\n").
 
 %-----------------------------------------------------------------------------%
 
@@ -1456,9 +1456,8 @@
 		mercury_output_c_ident_list(LabelNames),
 		io__write_string(", ")
 	),
-	io__write_string(""""),
 	term_io__quote_string(C_CodeString),
-	io__write_string(""").\n").
+	io__write_string(").\n").
 
 :- pred mercury_output_c_ident_list(list(string), io__state, io__state).
 :- mode mercury_output_c_ident_list(in, di, uo) is det.
@@ -1552,9 +1551,9 @@
 	mercury_output_sym_name(Pred),
 	io__write_string("/"),
 	io__write_int(Arity),
-	io__write_string(","""),
+	io__write_string(", "),
 	term_io__quote_string(FileName),
-	io__write_string(""").\n").
+	io__write_string(").\n").
 
 %-----------------------------------------------------------------------------%
 
-- 
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.



More information about the developers mailing list