mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
stree/serdes.py: Allow quoted = in rhs of assignment
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
c2c409ed4b
commit
5a87040e10
1 changed files with 13 additions and 4 deletions
|
|
@ -41,11 +41,20 @@ def parse(s): # export
|
|||
assert(len(sec) > 0)
|
||||
sec = '.'.join(sec.split('.')[0:-1])
|
||||
continue
|
||||
assignment = line.split('=')
|
||||
if len(assignment) != 2:
|
||||
lhs = ''
|
||||
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)
|
||||
slog(DEBUG, "sec=", sec, "assignment=", assignment)
|
||||
root.add(sec + '.' + cleanup_string(assignment[0]), quote(assignment[1]))
|
||||
root.add(sec + '.' + cleanup_string(lhs), quote(cleanup_string(rhs)))
|
||||
return root
|
||||
|
||||
def read(path): # export
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue