1
0
Fork 0

purge duplicate targets only once per macro

This commit is contained in:
Kevin Matz 2018-10-25 12:27:03 -04:00
parent 5f808f4cf6
commit f96da2939c
1 changed files with 3 additions and 2 deletions

View File

@ -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):