diff options
author | alfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-08-17 10:22:09 +0000 |
---|---|---|
committer | alfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-08-17 10:22:09 +0000 |
commit | 63406ead63e23b6714853a1758d6abaf4deef4a8 (patch) | |
tree | ad8c3cc78bdbcf9a54513006cc93afef04fab2cf | |
parent | 35a95424104b125e03ef42e2a2220c03b8492ff9 (diff) | |
download | edk2-platforms-63406ead63e23b6714853a1758d6abaf4deef4a8.tar.xz |
modify critic
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1312 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | Tools/Source/MigrationTools/org/tianocore/migration/Critic.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java b/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java index c933cccaf0..23ad95abfc 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java @@ -17,7 +17,7 @@ import java.io.*; public class Critic implements Common.ForDoAll {
private static Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);
- private static Pattern ptnfunccomment = Pattern.compile("([\\w\\d]*\\s*[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)([\\{;])",Pattern.DOTALL);
+ private static Pattern ptnfunccomment = Pattern.compile("([\\};\\/]\\s*)([\\w\\s]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)([\\{;])",Pattern.DOTALL);
//private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);
private static Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*-\\s*(.*)\\s*");
private static Matcher mtrinfequation;
@@ -32,12 +32,13 @@ public class Critic implements Common.ForDoAll { boolean arguments = false;
boolean returns = false;
boolean inequation = false;
-
+
System.out.println("Criticing " + filepath);
String wholeline = Common.file2string(filepath);
-
+
+ wholeline = wholeline.replaceAll("\t", " ");
wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");
- wholeline = Common.replaceAll(wholeline, ptnfunccomment, "/**$2**/$3$1$4");
+ wholeline = Common.replaceAll(wholeline, ptnfunccomment, "$1/**$3**/$4$2$5");
//wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");
rd = new BufferedReader(new StringReader(wholeline));
@@ -66,7 +67,7 @@ public class Critic implements Common.ForDoAll { mtrinfequation = ptninfequation.matcher(line);
if (mtrinfequation.find()) {
inequation = true;
- templine.append(" @param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");
+ templine.append(" @param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) {
inequation = false;
templine.append(line + "\n");
@@ -79,7 +80,7 @@ public class Critic implements Common.ForDoAll { mtrinfequation = ptninfequation.matcher(line);
if (mtrinfequation.find()) {
inequation = true;
- templine.append(" @retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");
+ templine.append(" @retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) {
inequation = false;
templine.append(line + "\n");
|