diff --git a/OscCommentMacroListener.py b/OscCommentMacroListener.py index dea5e42..c737b25 100644 --- a/OscCommentMacroListener.py +++ b/OscCommentMacroListener.py @@ -54,8 +54,7 @@ def beautify_lisp_string(in_string): class OscCommentMacroListener(CommentMacroListener): - def __init__(self, parser, servers): - self.parser = parser + def __init__(self, servers): self.osc = HogDevice(servers) def exitDevice(self, ctx: CommentMacroParser.DeviceContext): @@ -71,7 +70,7 @@ class OscCommentMacroListener(CommentMacroListener): def exitMacro(self, ctx: CommentMacroParser.MacroContext): # print the lisp tree of this macro - lisp_tree_str = ctx.toStringTree(recog=self.parser) + lisp_tree_str = ctx.toStringTree(recog=ctx.parser) logger.info(beautify_lisp_string(lisp_tree_str)) # execute macro from name diff --git a/comment.py b/comment.py index b918b08..6117672 100755 --- a/comment.py +++ b/comment.py @@ -53,7 +53,7 @@ def comment(text): stream = antlr4.CommonTokenStream(lexer) parser = CommentMacroParser(stream) tree = parser.prog() - oscMacro = OscCommentMacroListener(parser, hog4) + oscMacro = OscCommentMacroListener(hog4) walker = antlr4.ParseTreeWalker() walker.walk(oscMacro, tree)