From 3bc4153bc2d6ee6eb821275bfb303633b4c2d7f1 Mon Sep 17 00:00:00 2001 From: mhoffm Date: Sun, 20 Jun 2021 23:11:21 +0200 Subject: [PATCH] add sanity assertions --- src/scanner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scanner.c b/src/scanner.c index 6ac5bf6..5247c57 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -3,6 +3,7 @@ #include #include #include +#include enum TokenType { QUOTED_TEMPLATE_START, @@ -63,6 +64,7 @@ void scanner_enter_interpolation_context(Scanner *scanner) { } void scanner_exit_interpolation_context(Scanner *scanner) { + assert(scanner->template_interpolation_depth > 0); scanner->template_interpolation_depth--; scanner->in_template_interpolation = false; if (scanner->quoted_context_depth > 0) { @@ -77,6 +79,7 @@ void scanner_enter_quoted_context(Scanner *scanner) { } void scanner_exit_quoted_context(Scanner *scanner) { + assert(scanner->quoted_context_depth > 0); scanner->quoted_context_depth--; scanner->in_quoted_context = false; if (scanner->template_interpolation_depth > 0) {