diff --git a/src/utils/parse.py b/src/utils/parse.py index 5beb4637..d1b66cf3 100644 --- a/src/utils/parse.py +++ b/src/utils/parse.py @@ -129,17 +129,13 @@ def format_tokens(s: str, names: typing.List[str], sigil: str="$" while i < max: if s[i] == sigil: - if s[i+1] == sigil: + if not s[i+1] == sigil: i += 1 - else: - sigil_found = True - elif sigil_found: - sigil_found = False - for name in names: - if len(name) <= (len(s)-i) and s[i:i+len(name)] == name: - tokens.append((i-1, "%s%s" % (sigil, name))) - i += len(name) - break + for name in names: + if len(name) <= (len(s)-i) and s[i:i+len(name)] == name: + tokens.append((i-1, "%s%s" % (sigil, name))) + i += len(name) + break i += 1 return tokens