speedy-antlr-tool
speedy-antlr-tool copied to clipboard
tree.parser attribute is None
It seems that the tree.parser
attribute does not set to its correct reference when using USE_CPP_BACKEND
to create a parse tree.
It returns None
. However, this attribute is set to a valid reference of ANTLR parser when using Python backend
It is required to initialize the TokenStreamRewriter
class with parse tree tokens in the following code (line 4 raise an exception):
'NoneType' object has no attribute 'getInputStream'
file_stream = FileStream(java_file_path)
sa_javalabeled.USE_CPP_IMPLEMENTATION = config.USE_CPP_BACKEND
tree = sa_javalabeled.parse(file_stream, 'compilationUnit')
tokens = tree.parser.getInputStream()
rewriter = TokenStreamRewriter(tokens)
I also watched that token_stream.fill();
is called in C++ do_parse
function but it did not affects the returned PyObject
.
It seems that the
tree.parser
attribute does not set to its correct reference when usingUSE_CPP_BACKEND
to create a parse tree. It returnsNone
. However, this attribute is set to a valid reference of ANTLR parser when using Python backend It is required to initialize theTokenStreamRewriter
class with parse tree tokens in the following code (line 4 raise an exception):'NoneType' object has no attribute 'getInputStream'
file_stream = FileStream(java_file_path) sa_javalabeled.USE_CPP_IMPLEMENTATION = config.USE_CPP_BACKEND tree = sa_javalabeled.parse(file_stream, 'compilationUnit') tokens = tree.parser.getInputStream() rewriter = TokenStreamRewriter(tokens)
Can anyone help me implement the binding of the input stream tokens?