re-organize file tree
This commit is contained in:
parent
7fd48be3bc
commit
57a432f2bc
|
@ -1 +0,0 @@
|
||||||
__all__ = ["comment", "CommentMacroLexer", "CommentMacroListener", "CommentMacroParser", "OscCommentMacroListener"]
|
|
|
@ -1,32 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
"""OscCommentMacroListener.py: Hog 4 comment macro antlr4 listener for OSC.
|
||||||
# -*- coding: utf-8 -*-
|
"""
|
||||||
|
|
||||||
"""OscCommentMacroListener.py: Hog 4 comment macro antlr4 listener for OSC."""
|
|
||||||
|
|
||||||
__author__ = "Kevin Matz"
|
|
||||||
__copyright__ = "Copyright 2018, Company 235, LLC"
|
|
||||||
__credits__ = ["Kevin Matz"]
|
|
||||||
|
|
||||||
__license__ = "MIT"
|
|
||||||
__version__ = "3.9"
|
|
||||||
__maintainer__ = "Kevin Matz"
|
|
||||||
__email__ = "kevin@company235.com"
|
|
||||||
|
|
||||||
__status__ = "Prototype"
|
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pythonosc import osc_message_builder
|
from pythonosc import osc_message_builder
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
try:
|
from .commentmacro.CommentMacroParser import CommentMacroParser
|
||||||
# include reletive path imports when a module
|
from .commentmacro.CommentMacroListener import CommentMacroListener
|
||||||
from .CommentMacroParser import CommentMacroParser
|
|
||||||
from .CommentMacroListener import CommentMacroListener
|
|
||||||
except ImportError:
|
|
||||||
# include directly when called directly
|
|
||||||
from CommentMacroParser import CommentMacroParser
|
|
||||||
from CommentMacroListener import CommentMacroListener
|
|
||||||
|
|
||||||
logger = logging.getLogger('__main__')
|
logger = logging.getLogger('__main__')
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
__all__ = ["baconscript", "OscCommentMacroListener"]
|
|
@ -0,0 +1 @@
|
||||||
|
__all__ = ["CommentMacroLexer", "CommentMacroListener", "CommentMacroParser"]
|
|
@ -1,40 +1,17 @@
|
||||||
#!/usr/bin/env python3
|
"""comment.py: Hog 4 comment macro interpreter and OSC bridge.
|
||||||
# -*- coding: utf-8 -*-
|
"""
|
||||||
|
|
||||||
"""comment.py: Hog 4 comment macro interpreter and OSC bridge."""
|
|
||||||
|
|
||||||
__author__ = "Kevin Matz"
|
|
||||||
__copyright__ = "Copyright 2018, Company 235, LLC"
|
|
||||||
__credits__ = ["Kevin Matz"]
|
|
||||||
|
|
||||||
__license__ = "MIT"
|
|
||||||
__version__ = "3.9"
|
|
||||||
__maintainer__ = "Kevin Matz"
|
|
||||||
__email__ = "kevin@company235.com"
|
|
||||||
|
|
||||||
__status__ = "Prototype"
|
|
||||||
|
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from antlr4 import CommonTokenStream
|
from antlr4 import CommonTokenStream, InputStream, ParseTreeWalker
|
||||||
from antlr4 import InputStream
|
|
||||||
from antlr4 import ParseTreeWalker
|
|
||||||
from antlr4.error.ErrorListener import ErrorListener
|
from antlr4.error.ErrorListener import ErrorListener
|
||||||
from pythonosc import udp_client
|
from pythonosc import udp_client
|
||||||
|
|
||||||
try:
|
from .commentmacro.CommentMacroLexer import CommentMacroLexer
|
||||||
# include reletive path imports when a module
|
from .commentmacro.CommentMacroParser import CommentMacroParser
|
||||||
from .CommentMacroLexer import CommentMacroLexer
|
from .OscListener import OscCommentMacroListener
|
||||||
from .CommentMacroParser import CommentMacroParser
|
|
||||||
from .OscCommentMacroListener import OscCommentMacroListener
|
|
||||||
except ImportError:
|
|
||||||
# include directly when called directly
|
|
||||||
from CommentMacroLexer import CommentMacroLexer
|
|
||||||
from CommentMacroParser import CommentMacroParser
|
|
||||||
from OscCommentMacroListener import OscCommentMacroListener
|
|
||||||
|
|
||||||
|
|
||||||
# define an error listener that raises SyntaxError exceptions
|
# define an error listener that raises SyntaxError exceptions
|
||||||
|
@ -109,27 +86,3 @@ def comment(text):
|
||||||
except SyntaxError as e:
|
except SyntaxError as e:
|
||||||
logger.debug(e) # antlr internal listener prints the error
|
logger.debug(e) # antlr internal listener prints the error
|
||||||
# # log it to the debug logger anyway
|
# # log it to the debug logger anyway
|
||||||
|
|
||||||
|
|
||||||
# handle user input if run directly
|
|
||||||
if __name__ == '__main__':
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
# look for macros passed as arguments
|
|
||||||
logger.debug("found macro at argv[1]")
|
|
||||||
comment(sys.argv[1])
|
|
||||||
else:
|
|
||||||
# for input history and line editing
|
|
||||||
import readline
|
|
||||||
# be an interactive shell
|
|
||||||
while True:
|
|
||||||
# get user input
|
|
||||||
try:
|
|
||||||
text = input("comment# ")
|
|
||||||
except (KeyboardInterrupt, EOFError):
|
|
||||||
text = 'exit'
|
|
||||||
print(text)
|
|
||||||
# catch exit keyword
|
|
||||||
if text.lower() == 'exit':
|
|
||||||
break
|
|
||||||
# exec user input
|
|
||||||
comment(text)
|
|
Loading…
Reference in New Issue