change antlr4 includes to specific members
This commit is contained in:
parent
e7d0a59ccb
commit
9378112570
12
comment.py
12
comment.py
|
@ -15,11 +15,13 @@ __email__ = "kevin@company235.com"
|
||||||
__status__ = "Prototype"
|
__status__ = "Prototype"
|
||||||
|
|
||||||
|
|
||||||
import antlr4
|
|
||||||
import configparser
|
import configparser
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from antlr4 import CommonTokenStream
|
||||||
|
from antlr4 import InputStream
|
||||||
|
from antlr4 import ParseTreeWalker
|
||||||
from antlr4.error.ErrorListener import ErrorListener
|
from antlr4.error.ErrorListener import ErrorListener
|
||||||
from CommentMacroLexer import CommentMacroLexer
|
from CommentMacroLexer import CommentMacroLexer
|
||||||
from CommentMacroParser import CommentMacroParser
|
from CommentMacroParser import CommentMacroParser
|
||||||
|
@ -43,7 +45,7 @@ logger.addHandler(ch) # add console log handler
|
||||||
# TODO: refactor this to support multiple net#s
|
# TODO: refactor this to support multiple net#s
|
||||||
config = configparser.ConfigParser(allow_no_value=True)
|
config = configparser.ConfigParser(allow_no_value=True)
|
||||||
config.read('server.cfg') # open config file
|
config.read('server.cfg') # open config file
|
||||||
servers = {} # init an empty dictionary
|
servers = {} # init an empty dictionary
|
||||||
server = config['hog4'] # section of config file
|
server = config['hog4'] # section of config file
|
||||||
net = server.getint("net", 1) # default to net #1
|
net = server.getint("net", 1) # default to net #1
|
||||||
logger.info("Adding Hog device at net# " + str(net))
|
logger.info("Adding Hog device at net# " + str(net))
|
||||||
|
@ -52,13 +54,13 @@ servers[net] = udp_client.SimpleUDPClient(server.get("ip", "10.0.0.1"),
|
||||||
server.getint("port", 6600))
|
server.getint("port", 6600))
|
||||||
|
|
||||||
oscMacro = OscCommentMacroListener(servers)
|
oscMacro = OscCommentMacroListener(servers)
|
||||||
walker = antlr4.ParseTreeWalker()
|
walker = ParseTreeWalker()
|
||||||
|
|
||||||
|
|
||||||
def comment(text):
|
def comment(text):
|
||||||
input_stream = antlr4.InputStream(text)
|
input_stream = InputStream(text)
|
||||||
lexer = CommentMacroLexer(input_stream)
|
lexer = CommentMacroLexer(input_stream)
|
||||||
stream = antlr4.CommonTokenStream(lexer)
|
stream = CommonTokenStream(lexer)
|
||||||
parser = CommentMacroParser(stream)
|
parser = CommentMacroParser(stream)
|
||||||
parser._listeners.append(SyntaxErrorListener())
|
parser._listeners.append(SyntaxErrorListener())
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue