From d1fe089804274393532e2c8256f1b8e6c12298b3 Mon Sep 17 00:00:00 2001 From: ryanfleury Date: Thu, 24 Jun 2021 22:46:56 -0600 Subject: [PATCH] bugfix; build dummy root node for error marker nodes, to ensure that they have an accurate way to tell their location --- source/md_impl.c | 2 ++ tests/sanity_tests.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/source/md_impl.c b/source/md_impl.c index 809ca9d..a6de8c1 100644 --- a/source/md_impl.c +++ b/source/md_impl.c @@ -1234,9 +1234,11 @@ MD_PushNodeErrorF(MD_ParseCtx *ctx, MD_Node *node, MD_MessageKind kind, char *fm MD_FUNCTION void MD_PushTokenError(MD_ParseCtx *ctx, MD_Token token, MD_MessageKind kind, MD_String8 str){ + MD_Node *stub_file = MD_MakeNode(MD_NodeKind_ErrorMarker, ctx->file_contents, ctx->file_contents, ctx->file_contents.str); MD_Node *stub = _MD_MakeNode_Ctx(ctx, MD_NodeKind_ErrorMarker, token.string, token.outer_string, token.outer_string.str); MD_PushNodeError(ctx, stub, kind, str); + MD_PushChild(stub_file, stub); } MD_FUNCTION void diff --git a/tests/sanity_tests.c b/tests/sanity_tests.c index 64536a5..c800638 100644 --- a/tests/sanity_tests.c +++ b/tests/sanity_tests.c @@ -31,6 +31,13 @@ TestResult(MD_b32 result) test_ctx.number_of_tests += 1; test_ctx.number_passed += !!result; printf(result ? "." : "X"); + +#if 0 + if(result == 0) + { + __debugbreak(); + } +#endif } static void