Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree.parser attribute is None #11

Open
m-zakeri opened this issue Jan 9, 2022 · 2 comments
Open

tree.parser attribute is None #11

m-zakeri opened this issue Jan 9, 2022 · 2 comments

Comments

@m-zakeri
Copy link

m-zakeri commented Jan 9, 2022

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)
@m-zakeri
Copy link
Author

m-zakeri commented Jan 9, 2022

I also watched that token_stream.fill(); is called in C++ do_parse function but it did not affects the returned PyObject.

@m-zakeri
Copy link
Author

m-zakeri commented Apr 30, 2022

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)

Can anyone help me implement the binding of the input stream tokens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant