diff --git a/tools/python/jwutils/stree/StringTree.py b/tools/python/jwutils/stree/StringTree.py index 244371b..653f01a 100644 --- a/tools/python/jwutils/stree/StringTree.py +++ b/tools/python/jwutils/stree/StringTree.py @@ -26,7 +26,7 @@ def cleanup_string(s): return s s = s.strip() if is_quoted(s): - return s[1:-1] + return s[1:-1].replace('\\' + s[0], s[0]) return s class StringTree: # export @@ -52,18 +52,18 @@ class StringTree: # export logcontent = "not-yet" if hasattr(self, "content"): logcontent = self.content - slog(DEBUG, "+ setting", content, "at path \"" + str(path_) + "\" to", logcontent) - if content is not None: - content = cleanup_string(content) + slog(DEBUG, "+ setting >" + str(content) + "< at path \"" + str(path_) + "\" to", logcontent) if path_ is None: - self.content = content + self.content = cleanup_string(content) + slog(DEBUG, " -- content = >" + str(content) + "<, self.content = >" + str(self.content) + "<") return self path = cleanup_string(path_) components = path.split('.') l = len(components) if len(path) == 0 or l == 0: assert self.content is None - self.content = content + self.content = cleanup_string(content) + slog(DEBUG, " -- content = >" + str(content) + "<, self.content = >" + str(self.content) + "<") #self.children[content] = StringTree(None, content) return self @@ -142,7 +142,7 @@ class StringTree: # export def value(self): if len(self.children) == 0: return None - return next(reversed(self.children)) + return self.children[next(reversed(self.children))].content def dump(self, prio, caller=None, *args): if caller is None: diff --git a/tools/python/jwutils/stree/serdes.py b/tools/python/jwutils/stree/serdes.py index eb1d8fd..50e5c07 100644 --- a/tools/python/jwutils/stree/serdes.py +++ b/tools/python/jwutils/stree/serdes.py @@ -11,7 +11,7 @@ def _cleanup_line(line): else: if c in [ '"', "'" ]: in_quote = c - elif c == '#': + elif in_quote is None and c == '#': return r.strip() r += c return r