minor logging adds
This commit is contained in:
parent
d3ad841806
commit
dc056cbc37
8 changed files with 27 additions and 5 deletions
|
|
@ -26,5 +26,6 @@ namespace xo {
|
|||
return x.pretty_print(ppii);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@
|
|||
|
||||
namespace xo {
|
||||
namespace print {
|
||||
template <>
|
||||
struct ppdetail<xo::scm::Environment> {
|
||||
static bool print_pretty(const ppindentinfo & ppii, const xo::scm::Environment & x) {
|
||||
return x.pretty_print(ppii);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ppdetail<xo::scm::LocalEnv> {
|
||||
static bool print_pretty(const ppindentinfo & ppii, const xo::scm::LocalEnv & x) {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,16 @@ namespace xo {
|
|||
namespace print {
|
||||
template <>
|
||||
struct ppdetail<xo::scm::Variable> {
|
||||
static bool print_pretty(const ppindentinfo & ppii, const xo::scm::Expression & x) {
|
||||
static bool print_pretty(const ppindentinfo & ppii, const xo::scm::Variable & x) {
|
||||
return x.pretty_print(ppii);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ppdetail<xo::scm::Variable *> {
|
||||
static bool print_pretty(const ppindentinfo & ppii, const xo::scm::Variable * x) {
|
||||
return x->pretty_print(ppii);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace xo {
|
|||
// Defining this means ppdetail_atomic is not used.
|
||||
// In that case where not explicitly specialized ppdetail will revert to ordinary printing for a type,
|
||||
// instead of giving compile-time error about missing template specialization of ppdetail.
|
||||
#define ppdetail_atomic ppdetail
|
||||
//#define ppdetail_atomic ppdetail
|
||||
|
||||
struct ppindentinfo {
|
||||
ppindentinfo(ppstate * pps, std::uint32_t ci0, std::uint32_t indent_width, bool upto)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ namespace xo {
|
|||
*
|
||||
* deftype point :: {x : f64, y : f64};
|
||||
* deftype polar :: {arg : f64, mag : f64};
|
||||
* deftype converter :: (point -> polar);
|
||||
*
|
||||
* def polar2rect(pt : polar) -> point {
|
||||
* point(x = pt.mag * cos(arg),
|
||||
|
|
|
|||
|
|
@ -221,8 +221,7 @@ namespace xo {
|
|||
exprstate::on_leftparen_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()));
|
||||
|
||||
constexpr const char * c_self_name = "exprstate::on_leftparen_token";
|
||||
const char * exp = get_expect_str();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include "expect_formal_arglist_xs.hpp"
|
||||
#include "expect_expr_xs.hpp"
|
||||
#include "expect_type_xs.hpp"
|
||||
#include "pretty_expression.hpp"
|
||||
#include "pretty_variable.hpp"
|
||||
#include "xo/expression/Lambda.hpp"
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -198,7 +200,7 @@ namespace xo {
|
|||
|
||||
if (def_var->valuetype() == nullptr) {
|
||||
log && log("assign discovered lambda type T to enclosing define",
|
||||
xtag("lhs", def_var),
|
||||
xtag("lhs", def_var.get()),
|
||||
xtag("T", print::unq(this->lambda_td_->canonical_name())));
|
||||
|
||||
def_var->assign_valuetype(lambda_td_);
|
||||
|
|
|
|||
|
|
@ -56,9 +56,14 @@ namespace xo {
|
|||
expr_span += used_span;
|
||||
|
||||
if (tk.is_valid()) {
|
||||
log && log("input_state.current_line", tokenizer_.input_state().current_line());
|
||||
|
||||
/* forward just-read token to parser */
|
||||
auto parser_result = this->parser_.include_token(tk);
|
||||
|
||||
log && log("after parser.include_token");
|
||||
log && log("input_state.current_line", tokenizer_.input_state().current_line());
|
||||
|
||||
if (parser_result.is_expression()) {
|
||||
log && log(xtag("outcome", "victory!"),
|
||||
xtag("expr", parser_result.result_expr()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue