summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-01-30 22:51:16 +0100
committerClifford Wolf <clifford@clifford.at>2015-01-30 22:51:16 +0100
commitcb9d0a414dc899c3821af0e8f6231f887540c7a2 (patch)
treeb93add485d5c67770daac44333ff96759b6a2ee3
parentbedd46338fecd93c4c1c3b35017c26b080a990dc (diff)
Synced RTLIL::unescape_id() to log_id() behavior
-rw-r--r--kernel/rtlil.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index d8ebae71..4d13897b 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) {