From 83652ad811a3a5e2f94ac5ae7760e98b3dace3f9 Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Wed, 25 May 2022 13:08:11 -0500 Subject: [PATCH] #660 sanitize hyphen in attributes (#1267) closes #660 --- trick_source/codegen/Interface_Code_Gen/Utilities.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trick_source/codegen/Interface_Code_Gen/Utilities.cpp b/trick_source/codegen/Interface_Code_Gen/Utilities.cpp index e5ee3bcf..c90052b3 100644 --- a/trick_source/codegen/Interface_Code_Gen/Utilities.cpp +++ b/trick_source/codegen/Interface_Code_Gen/Utilities.cpp @@ -11,6 +11,10 @@ std::string sanitize(const std::string& text) { for (char c : {'<', '>', ' ', ',', ':', '*', '[', ']'}) { std::replace(result.begin(), result.end(), c, '_'); } + // Catches templates with negative default values (iss #660) + for (char c : {'-'}) { + std::replace(result.begin(), result.end(), c, 'n'); + } return result ; }