diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fdbbfad2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/__pycache__ +venv/ diff --git a/slothy/helper.py b/slothy/helper.py index d3a6a95c..016b7576 100644 --- a/slothy/helper.py +++ b/slothy/helper.py @@ -789,7 +789,7 @@ def unfold_in(self, source, change_callback=None, inherit_comments=False): for arg in self.args: arg_regexps.append(rf"\s*(?P<{arg}>[^,]+)\s*") - macro_regexp_txt += ','.join(arg_regexps) + macro_regexp_txt += '(,|\s)'.join(arg_regexps) macro_regexp = re.compile(macro_regexp_txt) output = [] @@ -875,7 +875,7 @@ def extract(source): if cur.tags.get("no-unfold", None) is not None: continue - current_args = [ a.strip() for a in p.group("args").split(',') ] + current_args = [ a.strip() for a in re.split(r'\s|\,', p.group("args")) if a.strip() != ""] current_macro = p.group("name") current_body = []