javalang
javalang copied to clipboard
How to parse a java file?
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
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)