# HG changeset patch # User Michael Pavone # Date 1550303914 28800 # Node ID 043cf458704cfcd48da332f915c3ebb1fc5f13f1 # Parent 33ec5df77fac4ec218e37619396eb73142c5af2b Basic support for string operands in CPU DSL diff -r 33ec5df77fac -r 043cf458704c cpu_dsl.py --- a/cpu_dsl.py Tue Feb 12 09:58:04 2019 -0800 +++ b/cpu_dsl.py Fri Feb 15 23:58:34 2019 -0800 @@ -1576,11 +1576,22 @@ continue if line[0].isspace(): if not cur_object is None: - parts = [el.strip() for el in line.split(' ')] + sep = True + parts = [] + while sep: + before,sep,after = line.partition('"') + before = before.strip() + if before: + parts += [el.strip() for el in before.split(' ')] + if sep: + #TODO: deal with escaped quotes + inside,sep,after = after.partition('"') + parts.append('"' + inside + '"') + line = after if type(cur_object) is dict: cur_object[parts[0]] = parts[1:] elif type(cur_object) is list: - cur_object.append(line.strip()) + cur_object.append(' '.join(parts)) else: cur_object = cur_object.processLine(parts)