I have a java code and i need to parse it in python.I am using regex in python for this purpose. I was successfully able to find method names , but to find method body i need to write regular expression with conditions. for ex. code i was parsing?
class abc
{
public void main()
{
//some code
if(blabla)
{
}
else
{
}
//some code
}
public static int method1(int asd,int bad)
{
//body
}
}
I need output as [(int,method1,"body"),('void',main,"body")]
So I wrote regular expression like
r'[public|private|protected]\s+[static]\s+(\w+)\s+(\w+)\(.*\)\n\{'
to find method name ,but how to find body as it may contain several '{','}'
?