From cb9d0a414dc899c3821af0e8f6231f887540c7a2 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 30 Jan 2015 22:51:16 +0100 Subject: [PATCH] Synced RTLIL::unescape_id() to log_id() behavior --- kernel/rtlil.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index d8ebae71d..4d13897b9 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -267,9 +267,15 @@ namespace RTLIL } static inline std::string unescape_id(std::string str) { - if (str.size() > 1 && str[0] == '\\' && str[1] != '$') - return str.substr(1); - return str; + if (str.size() < 2) + return str; + if (str[0] != '\\') + return str; + if (str[1] == '$' || str[1] == '\\') + return str; + if (str[1] >= '0' && str[1] <= '9') + return str; + return str.substr(1); } static inline std::string unescape_id(RTLIL::IdString str) { -- 2.30.2