stree/serdes.py: Allow quoted = in rhs of assignment

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-11-12 16:08:34 +01:00
commit 5a87040e10

View file

@ -41,11 +41,20 @@ def parse(s): # export
assert(len(sec) > 0) assert(len(sec) > 0)
sec = '.'.join(sec.split('.')[0:-1]) sec = '.'.join(sec.split('.')[0:-1])
continue continue
assignment = line.split('=') lhs = ''
if len(assignment) != 2: rhs = None
for c in line:
if rhs is None:
if c == '=':
rhs = ''
continue
lhs += c
continue
rhs += c
if rhs is None:
raise Exception("failed to parse assignment", line) raise Exception("failed to parse assignment", line)
slog(DEBUG, "sec=", sec, "assignment=", assignment) root.add(sec + '.' + cleanup_string(lhs), quote(cleanup_string(rhs)))
root.add(sec + '.' + cleanup_string(assignment[0]), quote(assignment[1]))
return root return root
def read(path): # export def read(path): # export