From: Clifford Wolf Date: Fri, 30 Jan 2015 21:51:16 +0000 (+0100) Subject: Synced RTLIL::unescape_id() to log_id() behavior X-Git-Tag: yosys-0.5~53 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb9d0a414dc899c3821af0e8f6231f887540c7a2;p=yosys.git Synced RTLIL::unescape_id() to log_id() behavior --- 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) {