mirror of
https://github.com/janet-lang/janet
synced 2026-07-25 12:38:52 +00:00
Move peg debug output to stderr in line with other internal debug tools.
Also allow disabling color in the debug output.
This commit is contained in:
+1
-1
@@ -460,7 +460,7 @@ Janet janet_dyn(const char *name) {
|
||||
return janet_table_get(janet_vm.top_dyns, janet_ckeywordv(name));
|
||||
}
|
||||
if (janet_vm.fiber->env) {
|
||||
return janet_table_get(janet_vm.fiber->env, janet_ckeywordv(name));
|
||||
return janet_table_get_keyword(janet_vm.fiber->env, name);
|
||||
} else {
|
||||
return janet_wrap_nil();
|
||||
}
|
||||
|
||||
+8
-2
@@ -198,10 +198,16 @@ tail:
|
||||
char buffer[32] = {0};
|
||||
size_t len = (size_t)(s->outer_text_end - text);
|
||||
memcpy(buffer, text, (len > 31 ? 31 : len));
|
||||
janet_printf("\n?? at [%s]\nstack [%d]:\n", buffer, s->captures->count);
|
||||
janet_eprintf("\n?? at [%s]\nstack [%d]:\n", buffer, s->captures->count);
|
||||
int has_color = janet_truthy(janet_dyn("err-color"));
|
||||
for (int32_t i = 0; i < s->captures->count; i++) {
|
||||
janet_printf(" [%d]: %M\n", i, s->captures->data[i]);
|
||||
if (has_color) {
|
||||
janet_eprintf(" [%d]: %M\n", i, s->captures->data[i]);
|
||||
} else {
|
||||
janet_eprintf(" [%d]: %m\n", i, s->captures->data[i]);
|
||||
}
|
||||
}
|
||||
janet_eprintf("\n");
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user