[m-rev.] for post-commit review: indent.m
Julien Fischer
jfischer at opturion.com
Wed May 10 14:29:37 AEST 2023
On Tue, 9 May 2023, Zoltan Somogyi wrote:
> Carve indent.m out of parse_tree_out_misc.m.
...
> diff --git a/compiler/hlds_out_goal.m b/compiler/hlds_out_goal.m
> index 696a1feeb..2dbaac6f9 100644
> --- a/compiler/hlds_out_goal.m
> +++ b/compiler/hlds_out_goal.m
...
> @@ -1555,42 +1495,44 @@ write_goal_generic_call(Info, Stream, _ModuleInfo, VarNameSrc, _TypeQual,
...
> PredOrFunc = write_cast_as_pred_or_func(CastType),
> (
> PredOrFunc = pf_predicate,
> - Functor = term.atom(CastTypeString),
> - term_subst.var_list_to_term_list(ArgVars, ArgTerms),
> - Term = term.functor(Functor, ArgTerms, dummy_context),
> - write_indent(Stream, Indent, !IO),
> - mercury_output_term_src(VarNameSrc, VarNamePrint, Term,
> - Stream, !IO)
> + % Functor = term.atom(CastTypeString),
> + % term_subst.var_list_to_term_list(ArgVars, ArgTerms),
> + % Term = term.functor(Functor, ArgTerms, dummy_context),
> + % ZZZ
> + % io.write_string(Stream, IndentStr, !IO),
> + % mercury_output_term_src(VarNameSrc, VarNamePrint, Term,
> + % Stream, !IO)
> + CallStr = functor_to_string(VarNameSrc, VarNamePrint,
> + term.atom(CastTypeString), ArgVars),
> + io.format(Stream, "%s%s",
> + [s(IndentStr), s(CallStr)], !IO)
What's the ZZZ for?
...
> diff --git a/compiler/indent.m b/compiler/indent.m
> index e69de29bb..13fdb0fd1 100644
> --- a/compiler/indent.m
> +++ b/compiler/indent.m
> @@ -0,0 +1,89 @@
> +%---------------------------------------------------------------------------%
> +% vim: ft=mercury ts=4 sw=4 et
> +%---------------------------------------------------------------------------%
> +% Copyright (C) 2023 The Mercury team.
> +% This file may only be copied under the terms of the GNU General
> +% Public License - see the file COPYING in the Mercury distribution.
> +%---------------------------------------------------------------------------%
> +%
> +% File: indent.m.
> +%
> +% This module provides utility functions and predicates dealing with
> +% indentation.
> +%
> +%---------------------------------------------------------------------------%
> +
> +:- module libs.indent.
> +:- interface.
> +
> +:- import_module io.
> +
> +%---------------------------------------------------------------------------%
> +%
> +% Write out indentation.
> +%
> +
> +:- func indent2_increment = int.
> +
> + % Write out the given indent level (indent_increment spaces per indent).
> + % error_util.m
Why does it say error_util.m there?
> + %
> +:- pred write_indent2(io.text_output_stream::in, int::in,
> + io::di, io::uo) is det.
> +
> + % Return the indent for the given level as a string.
> + %
> +:- func indent2_string(int) = string.
That looks fine otherwise.
Julien.
More information about the reviews
mailing list