diff --git a/src/utils/parse.py b/src/utils/parse.py index 2680df48..fe26d7aa 100644 --- a/src/utils/parse.py +++ b/src/utils/parse.py @@ -136,11 +136,15 @@ def format_tokens(s: str, names: typing.List[str], sigil: str="$" tokens.append((i-1, "%s%s" % (sigil, name))) i += len(name) break + else: + tokens.append((i, "$")) i += 1 return tokens def format_token_replace(s: str, vars: typing.Dict[str, str], sigil: str="$") -> str: + vars = vars.copy() + vars.update({"": ""}) tokens = format_tokens(s, list(vars.keys()), sigil) tokens.sort(key=lambda x: x[0]) tokens.reverse()