Synced RTLIL::unescape_id() to log_id() behavior
authorClifford Wolf <clifford@clifford.at>
Fri, 30 Jan 2015 21:51:16 +0000 (22:51 +0100)
committerClifford Wolf <clifford@clifford.at>
Fri, 30 Jan 2015 21:51:16 +0000 (22:51 +0100)
kernel/rtlil.h

index d8ebae71d8eb5d329843676f8c49c650ee1ea947..4d13897b9f5779d28913ceeca85a0839dde7c1e6 100644 (file)
@@ -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) {