I have to parse JAVA classes with PHP. All java classes implement my interface, so there is always corresponding function required by me in the class. It looks like:
public void init(Something driver, Parameters params) { ... }
I came up with the following regular expression:
/public\s+void\s+init\s*\(\s*Something\s+(\w+)\s*,\s*Parameters\s+(\w+)\s*\)\s*\{([^\}]+)\}\s*/
It works fine except the situations when there is "}" symbol somewhere inside the body of my function. Is there any way to handle these situations?