\r
public class Critic implements Common.ForDoAll {\r
private static Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);\r
\r
public class Critic implements Common.ForDoAll {\r
private static Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",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 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
boolean description = false;\r
boolean arguments = false;\r
boolean returns = false;\r
boolean description = false;\r
boolean arguments = false;\r
boolean returns = false;\r
String wholeline = Common.file2string(filepath);\r
\r
wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");\r
String wholeline = Common.file2string(filepath);\r
\r
wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");\r
//wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");\r
//wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
templine.append(" @param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
templine.append(" @param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
templine.append(" @retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
mtrinfequation = ptninfequation.matcher(line);\r
if (mtrinfequation.find()) {\r
templine.append(" @retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
} else {\r
templine.append(line + "\n");\r
}\r
/* -----slow edition of replacefirst with stringbuffer-----\r
line.append(wholeline);\r
mtrfunccomment = ptnfunccomment.matcher(line);\r
/* -----slow edition of replacefirst with stringbuffer-----\r
line.append(wholeline);\r
mtrfunccomment = ptnfunccomment.matcher(line);\r
while ((mtrfunccomment = ptnfunccomment.matcher(wholeline)).find()) {\r
//funccomment = mtrfunccomment.group(2);\r
//mtrcommentstructure = ptncommentstructure.matcher(funccomment);\r
wholeline = mtrfunccomment.replaceFirst("$2$4$3$1$5");\r
}\r
while ((mtrfunccomment = ptnfunccomment.matcher(wholeline)).find()) {\r
//funccomment = mtrfunccomment.group(2);\r
//mtrcommentstructure = ptncommentstructure.matcher(funccomment);\r
wholeline = mtrfunccomment.replaceFirst("$2$4$3$1$5");\r
}\r