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

How to parse a java file? #56

Open
DennisShaw opened this issue Oct 29, 2018 · 1 comment
Open

How to parse a java file? #56

DennisShaw opened this issue Oct 29, 2018 · 1 comment

Comments

@DennisShaw
Copy link

For example,I want to parse a java file.
src="source/test.java"
But when I use tree = javalang.parse.parse(src) it failed.
I am totally new at this area.Would you mind helping me?Thank you

@mvkarthikeyan
Copy link

Hi buddy this won't work . as the parse method expects java code not the location of java code . so you should read this using

data = open("./source/test.java").read()
tree = javalang.parse.parse(data)

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

2 participants