From 3741c73ba78babd2ed88f2acf2fcd6dafdb878e8 Mon Sep 17 00:00:00 2001 From: Mai-Lapyst <67418776+Mai-Lapyst@users.noreply.github.com> Date: Sun, 19 Mar 2023 20:00:22 +0100 Subject: [PATCH] Fixes the json exception when using "\\" inside a string; closes #257 (#264) --- include/inja/lexer.hpp | 2 +- single_include/inja/inja.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/inja/lexer.hpp b/include/inja/lexer.hpp index e0fb574..789c61a 100644 --- a/include/inja/lexer.hpp +++ b/include/inja/lexer.hpp @@ -213,7 +213,7 @@ class Lexer { } const char ch = m_in[pos++]; if (ch == '\\') { - escape = true; + escape = !escape; } else if (!escape && ch == m_in[tok_start]) { break; } else { diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 3fdc0f7..64f9957 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -1198,7 +1198,7 @@ class Lexer { } const char ch = m_in[pos++]; if (ch == '\\') { - escape = true; + escape = !escape; } else if (!escape && ch == m_in[tok_start]) { break; } else {