public class Critic implements Common.ForDoAll {\r
private static Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);\r
private static Pattern ptnfunccomment = Pattern.compile("([\\w\\d]*\\s*[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)([\\{;])",Pattern.DOTALL);\r
- private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);\r
+ //private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);\r
private static Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*-\\s*(.*)\\s*");\r
private static Matcher mtrinfequation;\r
- private static Matcher mtrfunccomment;\r
\r
public void toDo(String filepath) throws Exception {\r
if (filepath.contains(".c") || filepath.contains(".h")) {\r
boolean description = false;\r
boolean arguments = false;\r
boolean returns = false;\r
+ boolean inequation = false;\r
\r
System.out.println("Criticing " + filepath);\r
String wholeline = Common.file2string(filepath);\r
} else if (incomment && arguments) {\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
+ inequation = true;\r
templine.append(" @param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
+ } else if (inequation && line.trim().length() == 0) {\r
+ inequation = false;\r
+ templine.append(line + "\n");\r
+ } else if (inequation && line.trim().length() != 0) {\r
+ templine.append("#%#%" + line + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
} else if (incomment && returns) {\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
+ inequation = true;\r
templine.append(" @retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
+ } else if (inequation && line.trim().length() == 0) {\r
+ inequation = false;\r
+ templine.append(line + "\n");\r
+ } else if (inequation && line.trim().length() != 0) {\r
+ templine.append("#%#%" + line + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
}\r
}\r
wholeline = templine.toString();\r
+ wholeline = wholeline.replaceAll("\n#%#%\\s*", " ");\r
\r
/* -----slow edition of replacefirst with stringbuffer-----\r
line.append(wholeline);\r