2014-07-08 16:24:56 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#include "frontends/lean/pp_options.h"
|
|
|
|
|
|
|
|
#ifndef LEAN_DEFAULT_PP_MAX_DEPTH
|
2014-08-29 19:59:22 +00:00
|
|
|
#define LEAN_DEFAULT_PP_MAX_DEPTH 1000000
|
2014-07-08 16:24:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LEAN_DEFAULT_PP_MAX_STEPS
|
2014-08-29 19:59:22 +00:00
|
|
|
#define LEAN_DEFAULT_PP_MAX_STEPS 10000000
|
2014-07-08 16:24:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LEAN_DEFAULT_PP_NOTATION
|
|
|
|
#define LEAN_DEFAULT_PP_NOTATION true
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LEAN_DEFAULT_PP_IMPLICIT
|
|
|
|
#define LEAN_DEFAULT_PP_IMPLICIT false
|
|
|
|
#endif
|
|
|
|
|
2014-09-08 15:30:08 +00:00
|
|
|
#ifndef LEAN_DEFAULT_PP_COERCIONS
|
|
|
|
#define LEAN_DEFAULT_PP_COERCIONS false
|
2014-07-08 16:24:56 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-09 08:12:36 +00:00
|
|
|
#ifndef LEAN_DEFAULT_PP_UNIVERSES
|
|
|
|
#define LEAN_DEFAULT_PP_UNIVERSES false
|
2014-07-08 16:24:56 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-10 14:55:19 +00:00
|
|
|
#ifndef LEAN_DEFAULT_PP_FULL_NAMES
|
|
|
|
#define LEAN_DEFAULT_PP_FULL_NAMES false
|
|
|
|
#endif
|
|
|
|
|
2014-07-25 18:03:54 +00:00
|
|
|
#ifndef LEAN_DEFAULT_PP_PRIVATE_NAMES
|
|
|
|
#define LEAN_DEFAULT_PP_PRIVATE_NAMES false
|
|
|
|
#endif
|
|
|
|
|
2014-07-31 23:44:57 +00:00
|
|
|
#ifndef LEAN_DEFAULT_PP_METAVAR_ARGS
|
|
|
|
#define LEAN_DEFAULT_PP_METAVAR_ARGS false
|
|
|
|
#endif
|
|
|
|
|
2014-07-08 16:24:56 +00:00
|
|
|
namespace lean {
|
2014-07-10 02:19:35 +00:00
|
|
|
static name g_pp_max_depth {"pp", "max_depth"};
|
|
|
|
static name g_pp_max_steps {"pp", "max_steps"};
|
|
|
|
static name g_pp_notation {"pp", "notation"};
|
|
|
|
static name g_pp_implicit {"pp", "implicit"};
|
2014-09-08 15:30:08 +00:00
|
|
|
static name g_pp_coercions {"pp", "coercions"};
|
2014-07-10 02:19:35 +00:00
|
|
|
static name g_pp_universes {"pp", "universes"};
|
2014-07-10 14:55:19 +00:00
|
|
|
static name g_pp_full_names {"pp", "full_names"};
|
2014-07-25 18:03:54 +00:00
|
|
|
static name g_pp_private_names {"pp", "private_names"};
|
2014-07-31 23:44:57 +00:00
|
|
|
static name g_pp_metavar_args {"pp", "metavar_args"};
|
2014-07-08 16:24:56 +00:00
|
|
|
|
2014-09-08 15:30:08 +00:00
|
|
|
name const & get_pp_coercions_option_name() { return g_pp_coercions; }
|
2014-08-07 02:13:09 +00:00
|
|
|
name const & get_pp_full_names_option_name() { return g_pp_full_names; }
|
2014-08-06 22:25:28 +00:00
|
|
|
|
2014-07-27 16:41:25 +00:00
|
|
|
list<options> const & get_distinguishing_pp_options() {
|
|
|
|
static options g_universes_true(g_pp_universes, true);
|
|
|
|
static options g_implicit_true(g_pp_implicit, true);
|
2014-09-08 15:30:08 +00:00
|
|
|
static options g_coercions_true(g_pp_coercions, true);
|
2014-07-27 16:41:25 +00:00
|
|
|
static options g_notation_false(g_pp_notation, false);
|
2014-09-08 15:30:08 +00:00
|
|
|
static options g_implicit_coercions = join(g_coercions_true, g_implicit_true);
|
2014-07-27 16:41:25 +00:00
|
|
|
static options g_implicit_notation = join(g_notation_false, g_implicit_true);
|
2014-09-08 15:30:08 +00:00
|
|
|
static options g_all = join(join(g_universes_true, g_implicit_true), join(g_coercions_true, g_notation_false));
|
|
|
|
static list<options> g_distinguishing_pp_options({g_implicit_true, g_coercions_true, g_implicit_coercions, g_implicit_notation, g_universes_true, g_all});
|
2014-07-27 16:41:25 +00:00
|
|
|
return g_distinguishing_pp_options;
|
|
|
|
}
|
|
|
|
|
2014-07-08 16:24:56 +00:00
|
|
|
RegisterUnsignedOption(g_pp_max_depth, LEAN_DEFAULT_PP_MAX_DEPTH,
|
2014-07-10 02:19:35 +00:00
|
|
|
"(pretty printer) maximum expression depth, after that it will use ellipsis");
|
2014-07-08 16:24:56 +00:00
|
|
|
RegisterUnsignedOption(g_pp_max_steps, LEAN_DEFAULT_PP_MAX_STEPS,
|
2014-07-10 02:19:35 +00:00
|
|
|
"(pretty printer) maximum number of visited expressions, after that it will use ellipsis");
|
2014-07-08 16:24:56 +00:00
|
|
|
RegisterBoolOption(g_pp_notation, LEAN_DEFAULT_PP_NOTATION,
|
2014-07-10 02:19:35 +00:00
|
|
|
"(pretty printer) disable/enable notation (infix, mixfix, postfix operators and unicode characters)");
|
2014-07-08 16:24:56 +00:00
|
|
|
RegisterBoolOption(g_pp_implicit, LEAN_DEFAULT_PP_IMPLICIT,
|
2014-07-10 02:19:35 +00:00
|
|
|
"(pretty printer) display implicit parameters");
|
2014-09-08 15:30:08 +00:00
|
|
|
RegisterBoolOption(g_pp_coercions, LEAN_DEFAULT_PP_COERCIONS,
|
|
|
|
"(pretty printer) display coercionss");
|
2014-07-10 02:17:00 +00:00
|
|
|
RegisterBoolOption(g_pp_universes, LEAN_DEFAULT_PP_UNIVERSES,
|
2014-07-10 02:19:35 +00:00
|
|
|
"(pretty printer) display universes");
|
2014-07-10 14:55:19 +00:00
|
|
|
RegisterBoolOption(g_pp_full_names, LEAN_DEFAULT_PP_FULL_NAMES,
|
|
|
|
"(pretty printer) display fully qualified names");
|
2014-07-25 18:03:54 +00:00
|
|
|
RegisterBoolOption(g_pp_private_names, LEAN_DEFAULT_PP_PRIVATE_NAMES,
|
|
|
|
"(pretty printer) display internal names assigned to private declarations");
|
2014-07-31 23:44:57 +00:00
|
|
|
RegisterBoolOption(g_pp_metavar_args, LEAN_DEFAULT_PP_METAVAR_ARGS,
|
|
|
|
"(pretty printer) display metavariable arguments");
|
2014-07-09 08:12:36 +00:00
|
|
|
|
2014-07-25 18:03:54 +00:00
|
|
|
unsigned get_pp_max_depth(options const & opts) { return opts.get_unsigned(g_pp_max_depth, LEAN_DEFAULT_PP_MAX_DEPTH); }
|
|
|
|
unsigned get_pp_max_steps(options const & opts) { return opts.get_unsigned(g_pp_max_steps, LEAN_DEFAULT_PP_MAX_STEPS); }
|
|
|
|
bool get_pp_notation(options const & opts) { return opts.get_bool(g_pp_notation, LEAN_DEFAULT_PP_NOTATION); }
|
|
|
|
bool get_pp_implicit(options const & opts) { return opts.get_bool(g_pp_implicit, LEAN_DEFAULT_PP_IMPLICIT); }
|
2014-09-08 15:30:08 +00:00
|
|
|
bool get_pp_coercions(options const & opts) { return opts.get_bool(g_pp_coercions, LEAN_DEFAULT_PP_COERCIONS); }
|
2014-07-25 18:03:54 +00:00
|
|
|
bool get_pp_universes(options const & opts) { return opts.get_bool(g_pp_universes, LEAN_DEFAULT_PP_UNIVERSES); }
|
|
|
|
bool get_pp_full_names(options const & opts) { return opts.get_bool(g_pp_full_names, LEAN_DEFAULT_PP_FULL_NAMES); }
|
|
|
|
bool get_pp_private_names(options const & opts) { return opts.get_bool(g_pp_private_names, LEAN_DEFAULT_PP_PRIVATE_NAMES); }
|
2014-07-31 23:44:57 +00:00
|
|
|
bool get_pp_metavar_args(options const & opts) { return opts.get_bool(g_pp_metavar_args, LEAN_DEFAULT_PP_METAVAR_ARGS); }
|
2014-07-08 16:24:56 +00:00
|
|
|
}
|