diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 14:41:34 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 14:41:34 -0400 |
| commit | 176205a22de8bc356109edc2aceaaa07ae1d24a4 (patch) | |
| tree | 25d1f9052c940be4fcd8d38a38d23e377d6d7c56 /parse.c | |
| parent | 817235cfbc3162e136d53ec5bffe234d4d87c79b (diff) | |
Print stack trace if $TOMO_STACKTRACE is set
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -11,6 +11,7 @@ #include <signal.h> #include "ast.h" +#include "builtins/functions.h" #include "builtins/integers.h" #include "builtins/text.h" #include "builtins/table.h" @@ -134,8 +135,12 @@ static void vparser_err(parse_ctx_t *ctx, const char *start, const char *end, co highlight_error(ctx->file, start, end, "\x1b[31;1;7m", 2, isatty(STDERR_FILENO) && !getenv("NO_COLOR")); fputs("\n", stderr); + if (getenv("TOMO_STACKTRACE")) + print_stack_trace(stderr, 1, 3); + if (ctx->on_err) longjmp(*ctx->on_err, 1); + raise(SIGABRT); exit(1); } |
