[m-rev.] diff: do not hardcode quoting style in error messages

Julien Fischer jfischer at opturion.com
Mon Jul 28 12:08:03 AEST 2014


Branches: master

Do not hardcode quoting style in error messages.

Replace spots in error message specs. where single quotes are hardcoded as `' with
the error_util library's quote/1 constructor.

Fix minor issues with some error messages and add a couple of XXX comments
about some others.

compiler/accumulator.m:
compiler/add_clause.m:
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/goal_expr_to_goal.m:
compiler/make_hlds_error.m:
compiler/mercury_compile.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/modules.m:
compiler/options_file.m:
compiler/post_typecheck.m:
compiler/prog_io.m:
compiler/prog_io_pragma.m:
compiler/simplify_goal.m:
compiler/simplify_proc.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
 	As above.

tests/invalid/errors.err_exp:
tests/invalid/missing_det_decl.err_exp:
tests/invalid/no_exports.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/undef_type.err_exp:
 	Conform to the above changes.

Julien.

diff --git a/compiler/accumulator.m b/compiler/accumulator.m
index 0bb259b..586bcc4 100644
--- a/compiler/accumulator.m
+++ b/compiler/accumulator.m
@@ -288,13 +288,13 @@ accu_transform_proc(proc(PredId, ProcId), PredInfo, !ProcInfo, !ModuleInfo,
              ),
              SuppressPieces =
                  [words("These warnings can be suppressed by"),
-                words("`--inhibit-accumulator-warnings'.")],
+                quote("--inhibit-accumulator-warnings"), suffix(".")],
              EnsureSuppressMsg = simple_msg(Context,
                  [option_is_set(inhibit_accumulator_warnings, no,
                      [always(EnsurePieces), always(SuppressPieces)])]),

              VerbosePieces = [words("If a predicate has been declared"),
-                words("associative via a `promise' declaration,"),
+                words("associative via a"), quote("promise"), words("declaration,"),
                  words("the compiler will rearrange the order of"),
                  words("the arguments in calls to that predicate,"),
                  words("if by so doing it makes the containing predicate"),
@@ -302,9 +302,9 @@ accu_transform_proc(proc(PredId, ProcId), PredInfo, !ProcInfo, !ModuleInfo,
                  words("will issue this warning. If this reordering"),
                  words("changes the performance characteristics"),
                  words("of the call to the predicate, use"),
-                words("`--no-accumulator-introduction'"),
+                quote("--no-accumulator-introduction"),
                  words("to turn the optimization off, or "),
-                words("`--inhibit-accumulator-warnings'"),
+                quote("--inhibit-accumulator-warnings"),
                  words("to turn off the warnings.")],
              VerboseMsg = simple_msg(Context, [verbose_only(VerbosePieces)]),

diff --git a/compiler/add_clause.m b/compiler/add_clause.m
index ec8e861..3c3a0cb 100644
--- a/compiler/add_clause.m
+++ b/compiler/add_clause.m
@@ -118,7 +118,8 @@ module_add_clause(ClauseVarSet, PredOrFunc, PredName, Args0, Body, Status,
              )
          else if unqualify_name(PredName) = ",", Arity = 2 then
              MaybePredId = no,
-            Pieces = [words("Attempt to define a clause for `,'/2."),
+            Pieces = [words("Attempt to define a clause for"),
+                quote(","), suffix("/2."),
                  words("This is usually caused by"),
                  words("inadvertently writing a period instead of a comma"),
                  words("at the end of the preceding line."), nl],
diff --git a/compiler/add_pragma.m b/compiler/add_pragma.m
index 5f6b504..8751f41 100644
--- a/compiler/add_pragma.m
+++ b/compiler/add_pragma.m
@@ -148,7 +148,8 @@ add_pass_2_pragma(ItemPragma, !Status, !ModuleInfo, !Specs) :-
          % This can only appear in .opt files.
          Pragma = pragma_unused_args(UnusedArgsInfo),
          ( ImportStatus \= status_opt_imported ->
-            Pieces = [words("Error: illegal use of pragma `unused_args'.")],
+            Pieces = [words("Error: illegal use of pragma"),
+                quote("unused_args"), suffix(".")],
              Msg = simple_msg(Context, [always(Pieces)]),
              Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
              !:Specs = [Spec | !.Specs]
@@ -159,7 +160,8 @@ add_pass_2_pragma(ItemPragma, !Status, !ModuleInfo, !Specs) :-
      ;
          Pragma = pragma_exceptions(ExceptionsInfo),
          ( ImportStatus \= status_opt_imported ->
-            Pieces = [words("Error: illegal use of pragma `exceptions'.")],
+            Pieces = [words("Error: illegal use of pragma"),
+                quote("exceptions"), suffix(".")],
              Msg = simple_msg(Context, [always(Pieces)]),
              Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
              !:Specs = [Spec | !.Specs]
@@ -169,7 +171,8 @@ add_pass_2_pragma(ItemPragma, !Status, !ModuleInfo, !Specs) :-
      ;
          Pragma = pragma_trailing_info(TrailingInfo),
          ( ImportStatus \= status_opt_imported ->
-            Pieces = [words("Error: illegal use of pragma `trailing_info'.")],
+            Pieces = [words("Error: illegal use of pragma"),
+                quote("trailing_info"), suffix(".")],
              Msg = simple_msg(Context, [always(Pieces)]),
              Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
              !:Specs = [Spec | !.Specs]
@@ -180,8 +183,8 @@ add_pass_2_pragma(ItemPragma, !Status, !ModuleInfo, !Specs) :-
      ;
          Pragma = pragma_mm_tabling_info(MMTablingInfo),
          ( ImportStatus \= status_opt_imported ->
-            Pieces =
-                [words("Error: illegal use of pragma `mm_tabling_info',")],
+            Pieces = [words("Error: illegal use of pragma"),
+                    quote("mm_tabling_info"), suffix(".")],
              Msg = simple_msg(Context, [always(Pieces)]),
              Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
              !:Specs = [Spec | !.Specs]
@@ -470,7 +473,7 @@ add_pragma_foreign_export_2(Arity, PredTable, Origin, Lang, Name, PredId,
              )
          ->
              Pieces = [words("Error: "),
-                fixed("`:- pragma foreign_export' declaration"),
+                quote(":- pragma foreign_export"), words("declaration"),
                  words("for a procedure that has"),
                  words("a declared determinism of"),
                  fixed(determinism_to_string(Detism) ++ "."), nl],
@@ -1271,7 +1274,7 @@ add_foreign_enum_bijection_error(Context, ContextPieces, !Specs) :-
  add_foreign_enum_pragma_in_interface_error(Context, TypeName, TypeArity,
          !Specs) :-
      ErrorPieces = [words("Error: "),
-        words("`pragma foreign_enum' declaration for"),
+        quote("pragma foreign_enum"), words("declaration for"),
          sym_name_and_arity(TypeName / TypeArity),
          words("in module interface."), nl ],
      Msg = simple_msg(Context, [always(ErrorPieces)]),
@@ -1781,15 +1784,15 @@ report_unknown_vars_to_subst(PredInfo, Context, TVarSet, UnknownVars,
      PredOrFunc = pred_info_is_pred_or_func(PredInfo),
      (
          PredOrFunc = pf_predicate,
-        Decl = "`:- pred'"
+        Decl = ":- pred"
      ;
          PredOrFunc = pf_function,
-        Decl = "`:- func'"
+        Decl = ":- func"
      ),
      Pieces = pragma_type_spec_to_pieces(PredInfo) ++
          [words("error:")] ++ report_variables(UnknownVars, TVarSet) ++
          [words(choose_number(UnknownVars, "does not", "do not")),
-        words("occur in the"), fixed(Decl), words("declaration.")],
+        words("occur in the"), quote(Decl), words("declaration.")],
      Msg = simple_msg(Context, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
      !:Specs = [Spec | !.Specs].
@@ -1903,7 +1906,7 @@ add_pragma_termination2_info(Term2Info, Context, !ModuleInfo, !Specs) :-
              map.det_update(PredId, PredInfo, PredTable0, PredTable),
              module_info_set_preds(PredTable, !ModuleInfo)
          ;
-            Pieces = [words("Error: `:- pragma termination2_info'"),
+            Pieces = [words("Error:"), quote(":- pragma termination2_info"),
                  words("declaration for undeclared mode of"),
                  simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
                  suffix("."), nl],
@@ -1915,7 +1918,8 @@ add_pragma_termination2_info(Term2Info, Context, !ModuleInfo, !Specs) :-
          PredIds = [_, _ | _],
          Pieces = [words("Error: ambiguous predicate name"),
              simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
-            words("in"), fixed("`pragma termination2_info'."), nl],
+            words("in"), quote("pragma termination2_info"),
+            suffix("."), nl],
          Msg = simple_msg(Context, [always(Pieces)]),
          Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
          !:Specs = [Spec | !.Specs]
@@ -1964,7 +1968,7 @@ add_pragma_structure_sharing(SharingInfo, Context, !ModuleInfo, !Specs):-
                  map.det_update(PredId, PredInfo, PredTable0, PredTable),
                  module_info_set_preds(PredTable, !ModuleInfo)
              ;
-                Pieces = [words("Error: `:- pragma structure_sharing'"),
+                Pieces = [words("Error:"), quote(":- pragma structure_sharing"),
                      words("declaration for undeclared mode of"),
                      simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
                      suffix("."), nl],
@@ -2029,7 +2033,7 @@ add_pragma_structure_reuse(ReuseInfo, Context, !ModuleInfo, !Specs):-
                  map.det_update(PredId, PredInfo, PredTable0, PredTable),
                  module_info_set_preds(PredTable, !ModuleInfo)
              ;
-                Pieces = [words("Error: `:- pragma structure_reuse'"),
+                Pieces = [words("Error:"), quote(":- pragma structure_reuse"),
                      words("declaration for undeclared mode of"),
                      simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
                      suffix("."), nl],
@@ -2095,7 +2099,7 @@ add_pragma_termination_info(TermInfo, Context, !ModuleInfo, !Specs) :-
              module_info_set_preds(PredTable, !ModuleInfo)
          ;
              module_info_incr_errors(!ModuleInfo),
-            Pieces = [words("Error: `:- pragma termination_info'"),
+            Pieces = [words("Error:"), quote(":- pragma termination_info"),
                  words("declaration for undeclared mode of"),
                  simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
                  suffix("."), nl],
diff --git a/compiler/add_pred.m b/compiler/add_pred.m
index f095723..b5bb932 100644
--- a/compiler/add_pred.m
+++ b/compiler/add_pred.m
@@ -554,8 +554,9 @@ unspecified_det_for_local(Name, Arity, PredOrFunc, Context, !Specs) :-
      MainPieces = [words("Error: no determinism declaration for local"),
          simple_call(simple_call_id(PredOrFunc, Name, Arity)), suffix(".")],
      VerbosePieces = [words("(This is an error because"),
-        words("you specified the `--no-infer-det' options."),
-        words("Use the `--infer-det' option if you want the compiler"),
+        words("you specified the"), quote("--no-infer-det"), words("option."),
+        words("Use the"), quote("--infer-det"),
+        words("option if you want the compiler"),
          words("to automatically infer the determinism"),
          words("of local predicates.)")],
      InnerComponents = [always(MainPieces), verbose_only(VerbosePieces)],
diff --git a/compiler/add_type.m b/compiler/add_type.m
index 080e4a4..03f58fb 100644
--- a/compiler/add_type.m
+++ b/compiler/add_type.m
@@ -141,7 +141,7 @@ module_add_type_defn(TVarSet, Name, Args, TypeDefn, _Cond, Context,
              SolverPieces = [words("In definition of type"),
                  sym_name_and_arity(Name / Arity), suffix(":"), nl,
                  words("error: all definitions of a type must have"),
-                words("consistent `solver' annotations")],
+                words("consistent"), quote("solver"), words("annotations")],
              SolverMsg = simple_msg(Context, [always(SolverPieces)]),
              SolverSpec = error_spec(severity_error, phase_parse_tree_to_hlds,
                  [SolverMsg]),
@@ -458,7 +458,7 @@ check_foreign_type(TypeCtor, ForeignTypeBody, Context, FoundError, !ModuleInfo,
          ; Target = target_erlang, LangStr = "Erlang"
          ),
          MainPieces = [words("Error: no"), fixed(LangStr),
-            fixed("`pragma foreign_type'"), words("declaration for"),
+            quote("pragma foreign_type"), words("declaration for"),
              sym_name_and_arity(Name/Arity), nl],
          VerbosePieces = [words("There are representations for this type"),
              words("on other back-ends, but none for this back-end."), nl],
diff --git a/compiler/det_analysis.m b/compiler/det_analysis.m
index 6824b4b..6e51fc1 100644
--- a/compiler/det_analysis.m
+++ b/compiler/det_analysis.m
@@ -367,8 +367,8 @@ det_infer_proc(PredId, ProcId, !ModuleInfo, OldDetism, NewDetism, !Specs) :-
              get_exported_proc_context(ExportedProcs, PredId, ProcId,
                  PragmaContext)
          ->
-            ExportPieces = [words("Error: "),
-                fixed("`:- pragma foreign_export' declaration"),
+            ExportPieces = [words("Error:"),
+                quote(":- pragma foreign_export"), words("declaration"),
                  words("for a procedure that has a determinism of"),
                  fixed(determinism_to_string(NewDetism) ++ ".")],
              ExportSpec = error_spec(severity_error, phase_detism_check,
@@ -1162,7 +1162,7 @@ det_infer_foreign_proc(Attributes, PredId, ProcId, _PragmaCode,
              WillNotThrowPieces = WillNotThrowProcPieces ++
                  [words("has determinism erroneous but also has"),
                  words("foreign clauses that have a"),
-                fixed("`will_not_throw_exception' attribute."),
+                quote("will_not_throw_exception"), words("attribute."),
                  words("This attribute cannot be applied"),
                  words("to erroneous procedures.")],
              WillNotThrowSpec = error_spec(severity_error, phase_detism_check,
@@ -1212,7 +1212,7 @@ det_infer_foreign_proc(Attributes, PredId, ProcId, _PragmaCode,
          ProcPieces = describe_one_proc_name_mode(ModuleInfo,
              should_not_module_qualify, proc(PredId, ProcId)),
          Pieces = [words("In")] ++ ProcPieces ++ [suffix(":"), nl,
-            words("error: `:- pragma foreign_proc(...)'"),
+            words("error:"), quote(":- pragma foreign_proc(...)"),
              words("for a procedure without a determinism declaration.")],
          Spec = error_spec(severity_error, phase_detism_check,
              [simple_msg(Context, [always(Pieces)])]),
@@ -1570,10 +1570,10 @@ det_infer_scope(Reason, Goal0, Goal, GoalInfo, InstMap0, SolnContext,
                  MaybePromiseEqvSolutionSets0 = yes(PESSInfo),
                  PESSInfo = pess_info(OuterVars, OuterContext),
                  NestedPieces = [words("Error: "),
-                    words("`promise_equivalent_solution_sets' scope"),
-                    words("is nested inside another.")],
+                    quote("promise_equivalent_solution_sets"),
+                    words("scope is nested inside another.")],
                  NestedOuterPieces = [words("This is the outer"),
-                    words("`promise_equivalent_solution_sets' scope.")],
+                    quote("promise_equivalent_solution_sets"), words("scope.")],
                  NestedSeverity = severity_conditional(warn_simple_code, yes,
                      severity_warning, no),
                  NestedSpec = error_spec(NestedSeverity, phase_detism_check,
@@ -1595,8 +1595,9 @@ det_infer_scope(Reason, Goal0, Goal, GoalInfo, InstMap0, SolnContext,
              (
                  MaybePromiseEqvSolutionSets0 = no,
                  ArbitraryPieces = [words("Error: "),
-                    words("this `arbitrary' scope is not nested inside"),
-                    words("a `promise_equivalent_solution_sets' scope.")],
+                    words("this"), quote("arbitrary"),
+                    words("scope is not nested inside a"),
+                    quote("promise_equivalent_solution_sets"), words("scope.")],
                  ArbitrarySpec = error_spec(severity_error, phase_detism_check,
                      [simple_msg(Context, [always(ArbitraryPieces)])]),
                  det_info_add_error_spec(ArbitrarySpec, !DetInfo)
@@ -1623,14 +1624,14 @@ det_infer_scope(Reason, Goal0, Goal, GoalInfo, InstMap0, SolnContext,
                          OverlapVarNames = [_, _ | _],
                          OverlapVarStr = "the following variables:"
                      ),
-                    OverlapPieces = [words("Error: "),
-                        words("this `arbitrary' scope and the"),
-                        words("`promise_equivalent_solution_sets' scope"),
-                        words("it is nested inside overlap on"),
+                    OverlapPieces = [words("Error: this"), quote("arbitrary"),
+                        words("scope and the"),
+                        quote("promise_equivalent_solution_sets"),
+                        words("scope it is nested inside overlap on"),
                          words(OverlapVarStr)] ++
                          list_to_pieces(OverlapVarNames) ++ [suffix(".")],
-                    OverlapPromisePieces = [words("This is the outer "),
-                        words("`promise_equivalent_solution_sets' scope.")],
+                    OverlapPromisePieces = [words("This is the outer"),
+                        quote("promise_equivalent_solution_sets"), words("scope.")],
                      OverlapSpec = error_spec(severity_error,
                          phase_detism_check,
                          [simple_msg(Context, [always(OverlapPieces)]),
diff --git a/compiler/det_report.m b/compiler/det_report.m
index afe20b4..10dcd01 100644
--- a/compiler/det_report.m
+++ b/compiler/det_report.m
@@ -390,7 +390,8 @@ check_determinism_of_main(_PredId, _ProcId, PredInfo, ProcInfo, !Specs) :-
          )
      ->
          proc_info_get_context(ProcInfo, ProcContext),
-        Pieces = [words("Error: main/2 must be `det' or `cc_multi'.")],
+        Pieces = [words("Error: main/2 must be"), quote("det"),
+            words("or"), quote("cc_multi"), suffix(".")],
          Spec = error_spec(severity_error, phase_detism_check,
              [simple_msg(ProcContext, [always(Pieces)])]),
          !:Specs = [Spec | !.Specs]
diff --git a/compiler/goal_expr_to_goal.m b/compiler/goal_expr_to_goal.m
index 704d907..93ebdaa 100644
--- a/compiler/goal_expr_to_goal.m
+++ b/compiler/goal_expr_to_goal.m
@@ -356,8 +356,9 @@ transform_goal_expr_to_goal(LocKind, Expr, Context, Renaming, Goal,
                      !VarSet, !ModuleInfo, !QualInfo, !Specs)
              ;
                  MaybeElse0 = yes(_),
-                Pieces = [words("Error: a `try' goal with an `io' parameter"),
-                    words("cannot have an else part."), nl],
+                Pieces = [words("Error: a"), quote("try"),
+                    words("goal with an"), quote("io"),
+                    words("parameter cannot have an else part."), nl],
                  Msg = simple_msg(Context, [always(Pieces)]),
                  Spec = error_spec(severity_error,
                      phase_parse_tree_to_hlds, [Msg]),
diff --git a/compiler/make_hlds_error.m b/compiler/make_hlds_error.m
index 0db72f7..a5baca0 100644
--- a/compiler/make_hlds_error.m
+++ b/compiler/make_hlds_error.m
@@ -110,7 +110,8 @@ undefined_pred_or_func_error(Name, Arity, Context, DescPieces, !Specs) :-
      % Which is more correct?
      Pieces = [words("Error:") | DescPieces] ++ [words("for"),
          sym_name_and_arity(Name / Arity),
-        words("without corresponding `pred' or `func' declaration.")],
+        words("without corresponding"), quote("pred"), words("or"),
+        quote("func"), words("declaration.")],
      Msg = simple_msg(Context, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
      !:Specs = [Spec | !.Specs].
diff --git a/compiler/mercury_compile.m b/compiler/mercury_compile.m
index c588289..4fd07ca 100644
--- a/compiler/mercury_compile.m
+++ b/compiler/mercury_compile.m
@@ -950,7 +950,7 @@ read_module_or_file(Globals0, Globals, FileOrModuleName, ReturnTimestamp,
                          sym_name(ModuleName), suffix("."), nl,
                          words("Smart recompilation will not work unless"),
                          words("a module name to file name mapping is created"),
-                        words("using `mmc -f *.m'."), nl],
+                        words("using"), quote("mmc -f *.m"), suffix("."), nl],
                      write_error_pieces_plain(Globals, Pieces, !IO),
                      record_warning(Globals, !IO)
                  ;
diff --git a/compiler/mode_errors.m b/compiler/mode_errors.m
index 7d04e1a..9321db5 100644
--- a/compiler/mode_errors.m
+++ b/compiler/mode_errors.m
@@ -663,7 +663,7 @@ mode_error_bind_var_to_spec(ModeInfo, Reason, Var, VarInst, Inst) = Spec :-
              [words("The condition of an if-then-else is only"),
              words("allowed to bind variables which are local to the"),
              words("condition or which occur only in the condition"),
-            words("and the `then' part."), nl]
+            words("and the"), quote("then"), words("part."), nl]
      ;
          Reason = var_lock_lambda(_),
          VerbosePieces =
@@ -705,7 +705,7 @@ mode_error_non_local_lambda_var_to_spec(ModeInfo, Var, VarInst) = Spec :-
          words_quote(inst_to_string(ModeInfo, VarInst)),
          suffix(","), nl,
          words("expected instantiatedness for non-local variables"),
-        words("of lambda goals is `ground'."), nl],
+        words("of lambda goals is"), quote("ground"), suffix("."), nl],
      Spec = error_spec(severity_error, phase_mode_check(report_in_any_mode),
          [simple_msg(Context, [always(Preamble ++ Pieces)])]).

@@ -837,12 +837,13 @@ mode_error_poly_unify_to_spec(ModeInfo, Var, VarInst) = Spec :-
          quote(mercury_var_to_string(VarSet, no, Var)),
          words("has instantiatedness"),
          words_quote(inst_to_string(ModeInfo, VarInst)), suffix(","), nl,
-        words("expected instantiatedness was `ground' or `any'."), nl],
+        words("expected instantiatedness was"), quote("ground"),
+        words("or"), quote("any"), suffix("."), nl],
      VerbosePieces = [words("When unifying two variables whose type"),
          words("will not be known until runtime, the variables must both"),
-        words("be ground (or have inst `any'). Unifications of"),
-        words("polymorphically-typed variables with partially"),
-        words("instantiated modes are not allowed.")],
+        words("be ground (or have inst"), quote("any"), suffix(")."),
+        words("Unifications of polymorphically-typed variables with"),
+        words("partially instantiated modes are not allowed.")],
      Spec = error_spec(severity_error, phase_mode_check(report_in_any_mode),
          [simple_msg(Context,
              [always(Preamble ++ MainPieces), verbose_only(VerbosePieces)])]).
@@ -945,8 +946,8 @@ mode_error_unify_pred_to_spec(ModeInfo, X, RHS, Type, PredOrFunc) = Spec :-
          words("and so this is not allowed by the Mercury mode system."),
          words("In some cases, you can achieve the same effect by"),
          words("writing an explicit universal quantification, e.g."),
-        fixed("`all [X] call(P, X) <=> call(Q, X)',"),
-        words("instead of"), fixed("`P = Q'.")],
+        quote("all [X] call(P, X) <=> call(Q, X)"), suffix(","),
+        words("instead of"), quote("P = Q"), suffix(".")],
      Spec = error_spec(severity_error, phase_mode_check(report_in_any_mode),
          [simple_msg(Context,
              [always(Preamble ++ MainPieces), verbose_only(VerbosePieces)])]).
@@ -1243,18 +1244,20 @@ purity_error_lambda_should_be_any_to_spec(ModeInfo, Vars) = Spec :-
      mode_info_get_context(ModeInfo, Context),
      mode_info_get_varset(ModeInfo, VarSet),
      Pieces = [
-        words("purity error: lambda is `ground' but contains the"),
-        words("following non-local variables whose insts contain `any':"),
+        words("purity error: lambda is"), quote("ground"),
+        words("but contains the"),
+        words("following non-local variables whose insts contain"),
+        quote("any"), suffix(":"),
          words(mercury_vars_to_string(VarSet, no, Vars)),
          suffix("."), nl
      ],
      Always = always(Preamble ++ Pieces),
      VerboseOnly = verbose_only([
-        words("Predicate expressions with inst `any' can be written"),
-        quote("any_pred(Args) is det :- ..."),
+        words("Predicate expressions with inst"), quote("any"),
+        words("can be written"), quote("any_pred(Args) is det :- ..."),
          suffix("."),
-        words("Function expressions with inst `any' can be written"),
-        quote("any_func(Args) = Result is det :- ..."),
+        words("Function expressions with inst"), quote("any"),
+        words("can be written"), quote("any_func(Args) = Result is det :- ..."),
          suffix(".")
      ]),
      Spec = error_spec(severity_error, phase_mode_check(report_in_any_mode),
@@ -1287,7 +1290,8 @@ maybe_report_error_no_modes(ModuleInfo, PredId, PredInfo) = Specs :-
                  describe_one_pred_name(ModuleInfo, should_not_module_qualify,
                      PredId) ++ [suffix("."), nl],
              VerbosePieces =
-                [words("(Use `--infer-modes' to enable mode inference.)"), nl],
+                [words("(Use"), quote("--infer-modes"),
+                words("to enable mode inference.)"), nl],
              Spec = error_spec(severity_error,
                  phase_mode_check(report_in_any_mode),
                  [simple_msg(Context,
diff --git a/compiler/modes.m b/compiler/modes.m
index 5922326..805a2b3 100644
--- a/compiler/modes.m
+++ b/compiler/modes.m
@@ -341,8 +341,8 @@ report_max_iterations_exceeded(ModuleInfo) = Spec :-
          MaxIterations),
      Pieces = [words("Mode analysis iteration limit exceeded."), nl,
          words("You may need to declare the modes explicitly"),
-        words("or use the `--mode-inference-iteration-limit' option"),
-        words("to increase the limit."),
+        words("or use the"), quote("--mode-inference-iteration-limit"),
+        words("option to increase the limit."),
          words("(The current limit is"), int_fixed(MaxIterations),
          words("iterations.)"), nl],
      Msg = error_msg(no, do_not_treat_as_first, 0, [always(Pieces)]),
@@ -1438,7 +1438,8 @@ report_eval_method_destroys_uniqueness(ProcInfo) = Spec :-

  report_wrong_mode_for_main(ProcInfo) = Spec :-
      proc_info_get_context(ProcInfo, Context),
-    Pieces = [words("Error: main/2 must have mode `(di, uo)'."), nl],
+    Pieces = [words("Error: main/2 must have mode"), quote("(di, uo)"),
+        suffix("."), nl],
      Msg = simple_msg(Context, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_mode_check(report_in_any_mode),
          [Msg]).
diff --git a/compiler/module_qual.m b/compiler/module_qual.m
index 56db56b..5cf0788 100644
--- a/compiler/module_qual.m
+++ b/compiler/module_qual.m
@@ -2019,7 +2019,7 @@ mq_error_context_to_pieces(mqec_class(Id)) =
  mq_error_context_to_pieces(mqec_instance(Id)) =
      [words("declaration of instance of typeclass"), wrap_id(Id)].
  mq_error_context_to_pieces(mqec_mutable(Name)) =
-    [words("declaration for mutable "), prefix("`"), words(Name), suffix("'")].
+    [words("declaration for mutable "), quote(Name)].
  mq_error_context_to_pieces(mqec_event_spec_attr(EventName, AttrName)) =
      [words("attribute"), quote(AttrName), words("for"), quote(EventName)].

diff --git a/compiler/modules.m b/compiler/modules.m
index 7bcf077..f92a766 100644
--- a/compiler/modules.m
+++ b/compiler/modules.m
@@ -1764,12 +1764,12 @@ generate_no_exports_warning(Globals, ModuleName, Spec, !IO) :-
          verbose_only(
              [words("To be useful, a module should export something."),
              words("A file should contain at least one declaration"),
-            words("other than"), fixed("`:- import_module'"),
+            words("other than"), quote(":- import_module"),
              words("in its interface section(s)."),
              words("This would normally be a"),
-            fixed("`:- pred',"), fixed("`:- func',"),
-            fixed("`:- type',"), fixed("`:- inst'"),
-            fixed("or `:- mode'"), words("declaration.")])
+            quote(":- pred"), suffix(","), quote(":- func"), suffix(","),
+            quote(":- type"), suffix(","), quote(":- inst"), words("or"),
+            quote(":- mode"), words("declaration.")])
          ]),
      Msg = simple_msg(Context, [Component]),
      Spec = error_spec(Severity, phase_term_to_parse_tree, [Msg]).
@@ -2216,8 +2216,8 @@ do_warn_if_duplicate_use_import_decls(_ModuleName, FileName,
              words(choose_number(BothList, "module", "modules"))] ++
              component_list_to_pieces(list.map(wrap_symname, BothList)) ++
              [words(choose_number(BothList, "is", "are")),
-            words("imported using both `:- import_module'"),
-            words("`:- use_module' declarations."), nl],
+            words("imported using both"), quote(":- import_module"),
+            words("and"), quote(":- use_module"), words("declarations."), nl],
          Msg = simple_msg(Context,
              [option_is_set(warn_simple_code, yes, [always(Pieces)])]),
          Severity = severity_conditional(warn_simple_code, yes,
@@ -3496,9 +3496,11 @@ report_error_implementation_in_interface(ModuleName, Context, !Specs) :-
          unexpected($module, $pred, "unqualified module name")
      ),
      Pieces = [words("In interface for module"), sym_name(ParentModule),
-        suffix(":"), nl,
-        words("in definition of sub-module `" ++ ChildModule ++ "':"), nl,
-        words("error: `:- implementation.' declaration for sub-module\n"),
+        suffix(":"), nl, words("in definition of sub-module"),
+        quote(ChildModule), suffix(":"), nl,
+        % XXX should there be a full stop after implementation?
+        words("error:"), quote(":- implementation."),
+        words("declaration for sub-module\n"),
          words("occurs in interface section of parent module.")],
      Msg = simple_msg(Context, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
@@ -3553,7 +3555,7 @@ report_error_duplicate_module_decl(ModuleName - Context, !Specs) :-
          unexpected($module, $pred, "unqualified module name")
      ),
      Pieces = [words("In module"), sym_name(ParentModule), suffix(":"), nl,
-        words("error: sub-module `" ++ ChildModule ++ "' declared"),
+        words("error: sub-module"), quote(ChildModule), words("declared"),
          words("as both a separate sub-module and a nested sub-module.")],
      Msg = simple_msg(Context, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
diff --git a/compiler/options_file.m b/compiler/options_file.m
index 6ad9a27..cd63520 100644
--- a/compiler/options_file.m
+++ b/compiler/options_file.m
@@ -1138,7 +1138,7 @@ lookup_options_variable(Globals, Vars, OptionsVariableClass, FlagsVar, Result,
              ;
                  BadLibs = [_ | _],
                  Pieces = [words("Error: MLLIBS must contain only"),
-                    words("`-l' options, found") |
+                    quote("-l"), words("options, found") |
                      list_to_pieces(
                          list.map(func(Lib) = add_quotes(Lib), BadLibs))]
                      ++ [suffix(".")],
diff --git a/compiler/post_typecheck.m b/compiler/post_typecheck.m
index 50b1e7f..0579480 100644
--- a/compiler/post_typecheck.m
+++ b/compiler/post_typecheck.m
@@ -521,7 +521,8 @@ report_unresolved_type_warning(ModuleInfo, PredId, PredInfo, VarSet, Errs,
          VarTypePieces ++
          [nl_indent_delta(-1), words("The unbound type"),
          words(choose_number(Errs, "variable", "variables")),
-        words("will be implicitly bound to the builtin type `void'."), nl],
+        words("will be implicitly bound to the builtin type"),
+        quote("void"), suffix("."), nl],
      VerbosePieces = [words("The body of the clause contains a call"),
          words("to a polymorphic predicate,"),
          words("but I can't determine which version should be called,"),
@@ -848,7 +849,7 @@ check_type_of_main(PredInfo, !Specs) :-
          ;
              pred_info_get_context(PredInfo, Context),
              Pieces = [words("Error: arguments of main/2"),
-                words("must have type `io.state'."), nl],
+                words("must have type"), quote("io.state"), suffix("."), nl],
              Msg = simple_msg(Context, [always(Pieces)]),
              Spec = error_spec(severity_error, phase_type_check, [Msg]),
              !:Specs = [Spec | !.Specs]
diff --git a/compiler/prog_io.m b/compiler/prog_io.m
index 40178e5..02044ca 100644
--- a/compiler/prog_io.m
+++ b/compiler/prog_io.m
@@ -1033,7 +1033,8 @@ parse_attrs_and_decl(ModuleName, VarSet, Term, !.Attributes, SeqNum,
          )
      ;
          Context = get_term_context(Term),
-        Pieces = [words("Error: atom expected after `:-'."), nl],
+        Pieces = [words("Error: atom expected after"), quote(":-"),
+            suffix("."), nl],
          Spec = error_spec(severity_error, phase_term_to_parse_tree,
              [simple_msg(Context, [always(Pieces)])]),
          MaybeItem = error1([Spec])
diff --git a/compiler/prog_io_pragma.m b/compiler/prog_io_pragma.m
index 2d75724..f308b65 100644
--- a/compiler/prog_io_pragma.m
+++ b/compiler/prog_io_pragma.m
@@ -2368,7 +2368,8 @@ parse_pragma_foreign_proc_varlist(VarSet, [HeadTerm | TailTerm],
              % If the variable wasn't in the varset it must be an
              % underscore variable.
              Pieces = [words("Sorry, not implemented: "),
-                words("anonymous `_' variable in pragma foreign_proc."), nl],
+                words("anonymous"), quote("_"),
+                words("variable in pragma foreign_proc."), nl],
              Spec = error_spec(severity_error, phase_term_to_parse_tree,
                  [simple_msg(VarContext, [always(Pieces)])]),
              MaybePragmaVars = error1([Spec])
diff --git a/compiler/simplify_goal.m b/compiler/simplify_goal.m
index 441908b..b2070a1 100644
--- a/compiler/simplify_goal.m
+++ b/compiler/simplify_goal.m
@@ -147,7 +147,7 @@ simplify_goal(Goal0, Goal, !Info) :-
              MainPieces = [words("Warning: this goal cannot succeed.")],
              VerbosePieces = [
                  words("The compiler will optimize away this goal,"),
-                words("replacing it with `fail'.")
+                words("replacing it with"), quote("fail"), suffix(".")
              ],
              Msg = simple_msg(Context,
                  [option_is_set(warn_simple_code, yes,
diff --git a/compiler/simplify_proc.m b/compiler/simplify_proc.m
index 8f61820..251c75b 100644
--- a/compiler/simplify_proc.m
+++ b/compiler/simplify_proc.m
@@ -417,10 +417,9 @@ simplify_proc_maybe_warn_about_duplicates(ModuleInfo, PredId, ProcInfo,
              MayDuplicate = proc_may_duplicate,
              ( check_marker(Markers, marker_user_marked_no_inline) ->
                  Context = goal_info_get_context(GoalInfo),
-                Pieces = [words("Error: the `may_duplicate' attribute"),
-                    words("on the foreign_proc"),
-                    words("contradicts the `no_inline' pragma"),
-                    words("on the predicate.")],
+                Pieces = [words("Error: the"), quote("may_duplicate"),
+                    words("attribute on the foreign_proc contradicts the"),
+                    quote("no_inline"), words("pragma on the predicate.")],
                  Msg = simple_msg(Context, [always(Pieces)]),
                  Severity = severity_error,
                  Spec = error_spec(Severity, phase_simplify(report_in_any_mode),
@@ -433,10 +432,9 @@ simplify_proc_maybe_warn_about_duplicates(ModuleInfo, PredId, ProcInfo,
              MayDuplicate = proc_may_not_duplicate,
              ( check_marker(Markers, marker_user_marked_inline) ->
                  Context = goal_info_get_context(GoalInfo),
-                Pieces = [words("Error: the `may_not_duplicate' attribute"),
-                    words("on the foreign_proc"),
-                    words("contradicts the `inline' pragma"),
-                    words("on the predicate.")],
+                Pieces = [words("Error: the"), quote("may_not_duplicate"),
+                    words("attribute on the foreign_proc contradicts the"),
+                    quote("inline"), words("pragma on the predicate.")],
                  Msg = simple_msg(Context, [always(Pieces)]),
                  Severity = severity_error,
                  Spec = error_spec(Severity, phase_simplify(report_in_any_mode),
diff --git a/compiler/term_constr_errors.m b/compiler/term_constr_errors.m
index 18c297f..e8cf266 100644
--- a/compiler/term_constr_errors.m
+++ b/compiler/term_constr_errors.m
@@ -252,7 +252,7 @@ description(horder_call, _, _, Pieces, no) :-
  description(does_not_term_pragma(PredId), Single, Module, Pieces, no) :-
      Pieces1 = [
              words("There is a"),
-            fixed("`:- pragma does_not_terminate'"), 
+            quote(":- pragma does_not_terminate"),
              words("declaration for")
      ],
      (
diff --git a/compiler/term_errors.m b/compiler/term_errors.m
index b9eaefe..24bd4e9 100644
--- a/compiler/term_errors.m
+++ b/compiler/term_errors.m
@@ -348,7 +348,7 @@ description(pragma_foreign_code, _, _, Pieces, no) :-
      Pieces = [
          words("It depends on the properties of"),
          words("foreign language code included via a"),
-        fixed("`:- pragma foreign_proc'"),
+        quote(":- pragma foreign_proc"),
          words("declaration.")
      ].

@@ -532,8 +532,9 @@ description(is_builtin(_PredId), _Single, _, Pieces, no) :-

  description(does_not_term_pragma(PredId), Single, Module,
          Pieces, no) :-
-    Pieces1 = [words(
-        "There is a `:- pragma does_not_terminate' declaration for")],
+    Pieces1 = [
+        words("There is a"), quote(":- pragma does_not_terminate"),
+        words("declaration for")],
      (
          Single = yes(PPId),
          PPId = proc(SCCPredId, _),
diff --git a/compiler/termination.m b/compiler/termination.m
index 64744d9..de45648 100644
--- a/compiler/termination.m
+++ b/compiler/termination.m
@@ -192,8 +192,9 @@ check_foreign_code_attributes_2([PPId], !ModuleInfo, !Specs) :-
                          should_module_qualify, PPId),
                      Pieces =
                          [words("Warning:") | ProcNamePieces] ++
-                        [words("has a `pragma terminates' declaration"),
-                        words("but also has the `does_not_terminate'"),
+                        [words("has a"), quote("pragma terminates"),
+                        words("declaration but also has the"),
+                        quote("does_not_terminate"),
                          words("foreign code attribute set.")],
                      Msg = simple_msg(Context, [always(Pieces)]),
                      Spec = error_spec(severity_warning, phase_read_files,
@@ -219,10 +220,10 @@ check_foreign_code_attributes_2([PPId], !ModuleInfo, !Specs) :-
                          should_module_qualify, PPId),
                      Pieces =
                          [words("Warning:") | ProcNamePieces] ++
-                        [words("has a `pragma does_not_terminate'"),
+                        [words("has a"), quote("pragma does_not_terminate"),
                          words("declaration but also has the"),
-                        words("`terminates' foreign code"),
-                        words("attribute set.")],
+                        quote("terminates"),
+                        words("foreign code attribute set.")],
                      Msg = simple_msg(Context, [always(Pieces)]),
                      Spec = error_spec(severity_warning, phase_read_files,
                          [Msg]),
diff --git a/compiler/typecheck.m b/compiler/typecheck.m
index 3def881..8831697 100644
--- a/compiler/typecheck.m
+++ b/compiler/typecheck.m
@@ -332,8 +332,8 @@ typecheck_report_max_iterations_exceeded(MaxIterations) = Spec :-
          words("You should declare the types explicitly."),
          words("(The current limit is"), int_fixed(MaxIterations),
          words("iterations."),
-        words("You can use the `--type-inference-iteration-limit' option"),
-        words("to increase the limit).")],
+        words("You can use the"), quote("--type-inference-iteration-limit"),
+        words("option to increase the limit).")],
      Msg = error_msg(no, do_not_treat_as_first, 0, [always(Pieces)]),
      Spec = error_spec(severity_error, phase_type_check, [Msg]).

diff --git a/compiler/typecheck_errors.m b/compiler/typecheck_errors.m
index 0ac2b3f..87a6469 100644
--- a/compiler/typecheck_errors.m
+++ b/compiler/typecheck_errors.m
@@ -194,7 +194,8 @@ report_error_func_instead_of_pred(Info, PredOrFunc) = Msg :-
          Pieces = [words("(There is a"),
              prefix("*"), p_or_f(PredOrFunc), suffix("*"),
              words("with that name, however."), nl,
-            words("Perhaps you forgot to add"), fixed("` = ...'?)"), nl]
+            words("Perhaps you forgot to add"),
+            quote(" = ..."), suffix("?)"), nl]
      ;
          PredOrFunc = pf_predicate,
          Pieces = [words("(There is a"),
@@ -215,7 +216,8 @@ report_error_undef_pred(Info, SimpleCallId) = Msg :-
          PredName = unqualified("->"),
          ( Arity = 2 ; Arity = 4 )
      ->
-        MainPieces = [words("error: `->' without `;'."), nl],
+        MainPieces = [words("error:"), quote("->"), words("without"),
+            quote(";"), suffix("."), nl],
          MainComponent = always(MainPieces),
          VerbosePieces =
              [words("Note: the else part is not optional."), nl,
@@ -226,22 +228,26 @@ report_error_undef_pred(Info, SimpleCallId) = Msg :-
          PredName = unqualified("else"),
          ( Arity = 2 ; Arity = 4 )
      ->
-        Components = [always([words("error: unmatched `else'."), nl])]
+        Components = [always([words("error: unmatched"), quote("else"),
+            suffix("."), nl])]
      ;
          PredName = unqualified("if"),
          ( Arity = 2 ; Arity = 4 )
      ->
-        Pieces = [words("error: `if' without `then' or `else'."), nl],
+        Pieces = [words("error:"), quote("if"), words("without"),
+            quote("then"), words("or"), quote("else"), suffix("."), nl],
          Components = [always(Pieces)]
      ;
          PredName = unqualified("then"),
          ( Arity = 2 ; Arity = 4 )
      ->
-        MainPieces = [words("error: `then' without `if' or `else'."), nl],
+        MainPieces = [words("error:"), quote("then"), words("without"),
+            quote("if"), words("or"), quote("else"), suffix("."), nl],
          MainComponent = always(MainPieces),
          VerbosePieces =
-            [words("Note: the `else' part is not optional."), nl,
-            words("Every if-then must have an `else'."), nl],
+            [words("Note: the"), quote("else"), words("part is not optional."),
+            nl, words("Every if-then must have an"),
+            quote("else"), suffix("."), nl],
          VerboseComponent = verbose_only(VerbosePieces),
          Components = [MainComponent, VerboseComponent]
      ;
@@ -266,8 +272,8 @@ report_error_undef_pred(Info, SimpleCallId) = Msg :-
          Arity = 2
      ->
          Pieces = [words("syntax error in existential quantification:"),
-            words("first argument of `some' should be a list of variables."),
-            nl],
+            words("first argument of"), quote("some"),
+            words("should be a list of variables."), nl],
          Components = [always(Pieces)]
      ;
          MainPieces = [words("error: undefined"), simple_call(SimpleCallId)],
@@ -286,20 +292,21 @@ report_error_undef_pred(Info, SimpleCallId) = Msg :-
  :- func report_apply_instead_of_pred = list(error_msg_component).

  report_apply_instead_of_pred = Components :-
-    MainPieces = [words("error: the language construct `apply'"),
+    MainPieces = [words("error: the language construct"), quote("apply"),
          words("should be used as an expression, not as a goal."), nl],
      MainComponent = always(MainPieces),
      VerbosePieces =
-        [words("Perhaps you forgot to add"), fixed("` = ...'?)"), nl,
+        [words("Perhaps you forgot to add"), quote(" = ..."), suffix("?)"), nl,
          words("If you're trying to invoke a higher-order predicate,"),
-        words("use `call', not `apply'."), nl,
+        words("use"), quote("call"), suffix(","), words("not"),
+            quote("apply"), suffix("."), nl,
          words("If you're trying to curry a higher-order function,"),
          words("use a forwarding function:"), nl,
-        words("e.g. instead of "), fixed("`NewFunc = apply(OldFunc, X)'"),
-        words("use"), fixed("`NewFunc = my_apply(OldFunc, X)'"),
-        words("where `my_apply' is defined"),
+        words("e.g. instead of "), quote("NewFunc = apply(OldFunc, X)"),
+        words("use"), quote("NewFunc = my_apply(OldFunc, X)"),
+        words("where"), quote("my_apply"), words("is defined"),
          words("with the appropriate arity, e.g."),
-        fixed("`my_apply(Func, X, Y) :- apply(Func, X, Y).'")],
+        quote("my_apply(Func, X, Y) :- apply(Func, X, Y).")],
      VerboseComponent = verbose_only(VerbosePieces),
      Components = [MainComponent, VerboseComponent].

@@ -556,13 +563,13 @@ describe_cons_type_info_source(ModuleInfo, Source) = Pieces :-
      ;
          Source = source_get_field_access(TypeCtor),
          TypeCtor = type_ctor(SymName, Arity),
-        Pieces = [words("a `get' field access function"),
+        Pieces = [words("a"), quote("get"), words("field access function"),
              words("for the type constructor"),
              sym_name_and_arity(SymName / Arity)]
      ;
          Source = source_set_field_access(TypeCtor),
          TypeCtor = type_ctor(SymName, Arity),
-        Pieces = [words("a `set' field access function"),
+        Pieces = [words("a"), quote("set"), quote("field access function"),
              words("for the type constructor"),
              sym_name_and_arity(SymName / Arity)]
      ;
@@ -1141,16 +1148,17 @@ language_builtin_functor_components(Name, Arity, Components) :-
          VerboseCallPieces =
              [words("If you are trying to invoke"),
              words("a higher-order function,"),
-            words("you should use `apply', not `call'."), nl,
+            words("you should use"), quote("apply"), suffix(","),
+            words("not"), quote("call"), suffix("."), nl,
              words("If you're trying to curry"),
              words("a higher-order predicate,"),
              words("see the ""Creating higher-order terms"" section of"),
              words("the Mercury Language Reference Manual."), nl,
-            words("If you really are trying to use `call'"),
+            words("If you really are trying to use"), quote("call"),
              words("as an expression and not as an application of"),
              words("the language builtin call/N, make sure that"),
              words("you have the arity correct, and that the functor"),
-            words("`call' is actually defined (if it is defined"),
+            quote("call"), words("is actually defined (if it is defined"),
              words("in a separate module, check that the module is"),
              words("correctly imported)."), nl]
      ;
@@ -1184,47 +1192,56 @@ language_builtin_functor("some", 2).
      list(error_msg_component)::out) is semidet.

  syntax_functor_components("else", 2, Components) :-
-    Pieces = [words("error: unmatched `else'."), nl],
+    Pieces = [words("error: unmatched"), quote("else"), suffix("."), nl],
      Components = [always(Pieces)].
  syntax_functor_components("if", 2, Components) :-
-    Pieces = [words("error: `if' without `then' or `else'."), nl],
+    Pieces = [words("error:"), quote("if"), words("without"), quote("then"),
+         words("or"), quote("else"), suffix("."), nl],
      Components = [always(Pieces)].
  syntax_functor_components("then", 2, Components) :-
-    Pieces1 = [words("error: `then' without `if' or `else'."), nl],
-    Pieces2 = [words("Note: the `else' part is not optional."),
-        words("Every if-then must have an `else'."), nl],
+    Pieces1 = [words("error:"), quote("then"), words("without"),
+        quote("if"), words("or"), quote("else"), suffix("."), nl],
+    Pieces2 = [words("Note: the"), quote("else"),
+        words("part is not optional."),
+        words("Every if-then must have an"), quote("else"), suffix("."), nl],
      Components = [always(Pieces1), verbose_only(Pieces2)].
  syntax_functor_components("->", 2, Components) :-
-    Pieces1 = [words("error: `->' without `;'."), nl],
+    Pieces1 = [words("error:"), quote("->"), words("without"),
+        quote(";"), suffix("."), nl],
      Pieces2 = [words("Note: the else part is not optional."),
          words("Every if-then must have an else."), nl],
      Components = [always(Pieces1), verbose_only(Pieces2)].
  syntax_functor_components("^", 2, Components) :-
-    Pieces1 =
-        [words("error: invalid use of field selection operator (`^')."), nl],
+    Pieces1 = [words("error: invalid use of field selection operator"),
+        prefix("("), quote("^"), suffix(")."), nl],
      Pieces2 = [words("This is probably some kind of syntax error."),
          words("The field name must be an atom,"),
          words("not a variable or other term."), nl],
      Components = [always(Pieces1), verbose_only(Pieces2)].
  syntax_functor_components(":=", 2, Components) :-
      Pieces1 = [words("error: invalid use of field update operator"),
-        words("(`:=')."), nl],
+        prefix("("), quote(":="), suffix(")."), nl],
      Pieces2 = [words("This is probably some kind of syntax error."), nl],
      Components = [always(Pieces1), verbose_only(Pieces2)].
  syntax_functor_components(":-", 2, Components) :-
-    Pieces = [words("syntax error in lambda expression (`:-')."), nl],
+    Pieces = [words("syntax error in lambda expression"),
+         prefix("("), quote(":-"), suffix(")."), nl],
      Components = [always(Pieces)].
  syntax_functor_components("-->", 2, Components) :-
-    Pieces = [words("syntax error in DCG lambda expression (`-->')."), nl],
+    Pieces = [words("syntax error in DCG lambda expression"),
+        prefix("("), quote("-->"), suffix(")."), nl],
      Components = [always(Pieces)].
  syntax_functor_components(".", 2, Components) :-
-    Pieces =
-        [words("error: the list constructor is now `[|]/2', not `./2'."), nl],
+    Pieces = [words("error: the list constructor is now"),
+        % XXX should the arity be unquoted in the following?
+        quote("[|]/2"), suffix(","), words("not"), quote("./2"),
+        suffix("."), nl],
      Components = [always(Pieces)].
  syntax_functor_components("!", 1, Components) :-
-    Pieces1 =
-        [words("error: invalid use of `!' state variable operator."), nl],
-    Pieces2 = [words("You probably meant to use `!.' or `!:'."), nl],
+    Pieces1 = [words("error: invalid use of"), quote("!"),
+        words("state variable operator."), nl],
+    Pieces2 = [words("You probably meant to use"), quote("!."),
+        words("or"), quote("!:"), suffix("."), nl],
      Components = [always(Pieces1), verbose_only(Pieces2)].

  :- func wrong_arity_constructor_to_pieces(sym_name, arity, list(int))
@@ -1244,7 +1261,7 @@ report_cons_error(Context, ConsError) = Msgs :-
          ConsError = foreign_type_constructor(TypeCtor, _),
          TypeCtor = type_ctor(TypeName, TypeArity),
          Pieces = [words("There are"),
-            fixed("`:- pragma foreign_type'"),
+            quote(":- pragma foreign_type"),
              words("declarations for type"),
              sym_name_and_arity(TypeName / TypeArity),
              suffix(","),
@@ -1281,13 +1298,13 @@ report_cons_error(Context, ConsError) = Msgs :-
          Pieces3 = [words("in the types of field"), sym_name(FieldName),
              words("and some other field"),
              words("in definition of constructor"),
-            fixed("`" ++ ConsIdStr ++ "'.")],
+            quote(ConsIdStr), suffix(".")],
          Pieces = Pieces1 ++ Pieces2 ++ Pieces3,
          Msgs = [simple_msg(DefnContext, [always(Pieces)])]
      ;
          ConsError = new_on_non_existential_type(TypeCtor),
          TypeCtor = type_ctor(TypeName, TypeArity),
-        Pieces = [words("Invalid use of `new'"),
+        Pieces = [words("Invalid use of"), quote("new"),
              words("on a constructor of type"),
              sym_name_and_arity(TypeName / TypeArity),
              words("which is not existentially typed.")],
diff --git a/tests/invalid/errors.err_exp b/tests/invalid/errors.err_exp
index 88770b9..405a654 100644
--- a/tests/invalid/errors.err_exp
+++ b/tests/invalid/errors.err_exp
@@ -1,6 +1,6 @@
  errors.m:001: Warning: interface for module `errors' does not export anything.
  errors.m:001: Warning: module `int' is imported using both `:- import_module'
-errors.m:001:   `:- use_module' declarations.
+errors.m:001:   and `:- use_module' declarations.
  errors.m:010: Error: module must start with a `:- module' declaration.
  errors.m:028: Error: mode declaration for predicate
  errors.m:028:   `errors.mode_declaration_without_pred_declaration'/0
diff --git a/tests/invalid/missing_det_decls.err_exp b/tests/invalid/missing_det_decls.err_exp
index cb3f74e..7a1cbec 100644
--- a/tests/invalid/missing_det_decls.err_exp
+++ b/tests/invalid/missing_det_decls.err_exp
@@ -8,13 +8,13 @@ missing_det_decls.m:012: Error: no clauses for predicate `loc1'/0.
  missing_det_decls.m:013: Error: no determinism declaration for local predicate
  missing_det_decls.m:013:   `missing_det_decls.loc1'/0.
  missing_det_decls.m:013:   (This is an error because you specified the
-missing_det_decls.m:013:   `--no-infer-det' options. Use the `--infer-det'
+missing_det_decls.m:013:   `--no-infer-det' option. Use the `--infer-det'
  missing_det_decls.m:013:   option if you want the compiler to automatically
  missing_det_decls.m:013:   infer the determinism of local predicates.)
  missing_det_decls.m:015: Error: no clauses for predicate `loc2'/1.
  missing_det_decls.m:016: Error: no determinism declaration for local predicate
  missing_det_decls.m:016:   `missing_det_decls.loc2'/1.
  missing_det_decls.m:016:   (This is an error because you specified the
-missing_det_decls.m:016:   `--no-infer-det' options. Use the `--infer-det'
+missing_det_decls.m:016:   `--no-infer-det' option. Use the `--infer-det'
  missing_det_decls.m:016:   option if you want the compiler to automatically
  missing_det_decls.m:016:   infer the determinism of local predicates.)
diff --git a/tests/invalid/no_exports.err_exp b/tests/invalid/no_exports.err_exp
index d1625fc..6e00ad9 100644
--- a/tests/invalid/no_exports.err_exp
+++ b/tests/invalid/no_exports.err_exp
@@ -3,5 +3,5 @@ no_exports.m:001:   anything.
  no_exports.m:001:   To be useful, a module should export something. A file
  no_exports.m:001:   should contain at least one declaration other than
  no_exports.m:001:   `:- import_module' in its interface section(s). This would
-no_exports.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst'
-no_exports.m:001:   or `:- mode' declaration.
+no_exports.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst' or
+no_exports.m:001:   `:- mode' declaration.
diff --git a/tests/invalid/predmode.err_exp b/tests/invalid/predmode.err_exp
index d970ed2..a85e65b 100644
--- a/tests/invalid/predmode.err_exp
+++ b/tests/invalid/predmode.err_exp
@@ -3,6 +3,6 @@ predmode.m:001:   anything.
  predmode.m:001:   To be useful, a module should export something. A file should
  predmode.m:001:   contain at least one declaration other than
  predmode.m:001:   `:- import_module' in its interface section(s). This would
-predmode.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst'
-predmode.m:001:   or `:- mode' declaration.
+predmode.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst' or
+predmode.m:001:   `:- mode' declaration.
  predmode.m:005: Error: some but not all arguments have modes.
diff --git a/tests/invalid/undef_type.err_exp b/tests/invalid/undef_type.err_exp
index 137fb7d..c9a1ae5 100644
--- a/tests/invalid/undef_type.err_exp
+++ b/tests/invalid/undef_type.err_exp
@@ -3,8 +3,8 @@ undef_type.m:001:   anything.
  undef_type.m:001:   To be useful, a module should export something. A file
  undef_type.m:001:   should contain at least one declaration other than
  undef_type.m:001:   `:- import_module' in its interface section(s). This would
-undef_type.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst'
-undef_type.m:001:   or `:- mode' declaration.
+undef_type.m:001:   normally be a `:- pred', `:- func', `:- type', `:- inst' or
+undef_type.m:001:   `:- mode' declaration.
  undef_type.m:003: In definition of type `undef_type.t1'/0:
  undef_type.m:003:   error: undefined type `undef1'/0.
  undef_type.m:010: In definition of predicate `undef_type.q'/1:



More information about the reviews mailing list