sort variable $names descending so longer ones are caught first

This commit is contained in:
jesopo 2020-01-03 06:59:22 +00:00
parent 82ba7a0922
commit e9f82fc645

View file

@ -122,6 +122,10 @@ def timed_args(args, min_args):
def format_tokens(s: str, names: typing.List[str], sigil: str="$" def format_tokens(s: str, names: typing.List[str], sigil: str="$"
) -> typing.List[typing.Tuple[int, str]]: ) -> typing.List[typing.Tuple[int, str]]:
names = names.copy()
names.sort()
names.reverse()
i = 0 i = 0
max = len(s)-1 max = len(s)-1
sigil_found = False sigil_found = False