From f96da2939c35df5d1c550540a26a09e81b84115b Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Thu, 25 Oct 2018 12:27:03 -0400 Subject: [PATCH] purge duplicate targets only once per macro --- OscCommentMacroListener.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OscCommentMacroListener.py b/OscCommentMacroListener.py index c737b25..54edc13 100644 --- a/OscCommentMacroListener.py +++ b/OscCommentMacroListener.py @@ -73,6 +73,9 @@ class OscCommentMacroListener(CommentMacroListener): lisp_tree_str = ctx.toStringTree(recog=ctx.parser) logger.info(beautify_lisp_string(lisp_tree_str)) + # disallow duplicate targets + ctx.targets = set(ctx.targets) + # execute macro from name name = ctx.children[0].getText() try: @@ -86,7 +89,6 @@ class OscCommentMacroListener(CommentMacroListener): ctx.targets = [] def exitMaster(self, ctx: CommentMacroParser.MasterContext): - ctx.targets = set(ctx.targets) # no duplicates if isinstance(ctx.parentCtx, CommentMacroParser.MacroContext): ctx.parentCtx.master = ctx @@ -116,7 +118,6 @@ class OscCommentMacroListener(CommentMacroListener): ctx.targets = [] def exitTarget(self, ctx: CommentMacroParser.TargetContext): - ctx.target = set(ctx.targets) # no duplicates ctx.parentCtx.targets.extend(ctx.targets) # add to parent targets def exitNodeType(self, ctx: CommentMacroParser.NodeTypeContext):