public final class Critic {\r
public static final Pattern PTN_NEW_HEAD_COMMENT = Pattern.compile("^\\/\\*\\*.*?\\*\\*\\/",Pattern.DOTALL);\r
private static final Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);\r
- private static final Pattern ptnfunccomment = Pattern.compile("([\\};\\/\">]\\s*)([\\w\\s]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)(?=[\\{;])",Pattern.DOTALL); // find function with {;">/ , may be unsafe\r
+ private static final Pattern ptnfunccomment = Pattern.compile("([\\};\\/\">]\\s*)([\\w\\s\\*]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)(?=[\\{;])",Pattern.DOTALL); // find function with {;">/ , may be unsafe\r
//private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);\r
private static final Pattern ptncommentequation = Pattern.compile("([^\\s]*)\\s+-\\s+(.*)\\s*");\r
private static Matcher mtrcommentequation;\r
templine.append(line + "\n");\r
} else if (line.matches("\\*\\*\\/")) {\r
incomment = false;\r
- templine.append(line + "\n");\r
+ templine.append("\n" + line + "\n");\r
} else if (incomment) {\r
if (line.contains("Routine Description:")) {\r
description = true;\r
description = false;\r
arguments = true;\r
returns = false;\r
+ templine.append("\n");\r
} else if (line.contains("Returns:")) {\r
description = false;\r
arguments = false;\r
returns = true;\r
+ templine.append("\n");\r
} else if (description) {\r
if (line.trim().length() != 0) {\r
templine.append(" " + line.trim() + "\n");\r
templine.append(" @param " + mtrcommentequation.group(1) + " " + mtrcommentequation.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.trim() + "\n");\r
+ if (line.trim().length() != 0) {\r
+ templine.append(" " + line.trim() + "\n");\r
+ }\r
}\r
} else if (returns) {\r
mtrcommentequation = ptncommentequation.matcher(line);\r
templine.append(" @retval " + mtrcommentequation.group(1) + " " + mtrcommentequation.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
- if (line.trim().length() == 0) {\r
- templine.append(" " + line.trim() + "\n");\r
- } else {\r
+ if (line.trim().length() != 0) {\r
templine.append(" @return " + line.trim() + "\n");\r
}\r
}\r