From cf236d37ae98abadab36a042290c92e72f0b809b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 17 Jul 2024 13:24:30 +0200
Subject: [PATCH] =?UTF-8?q?Correctly=20handle=20whitespaces=20when=20parsi?=
 =?UTF-8?q?ng=20contents=20of=20legacy=20=E2=80=9Cmcp=E2=80=9D=20tags?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/ParsingDriver.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index b3f43827..eab3dd00 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -2653,6 +2653,12 @@ ParsingDriver::add_model_equal(expr_t arg1, expr_t arg2, map<string, string> eq_
           error("'mcp' tag does not contain an inequality");
       }()};
 
+      // Trim whitespace
+      var_name.erase(var_name.find_last_not_of(" \n\t") + 1);
+      var_name.erase(0, var_name.find_first_not_of(" \n\t"));
+      constant.erase(constant.find_last_not_of(" \n\t") + 1);
+      constant.erase(0, constant.find_first_not_of(" \n\t"));
+
       int symb_id {[&] {
         try
           {
-- 
GitLab