modify critic
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 17 Aug 2006 10:22:09 +0000 (10:22 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 17 Aug 2006 10:22:09 +0000 (10:22 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1312 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/MigrationTools/org/tianocore/migration/Critic.java

index c933cccaf091c48305017e5b6ecaf32a6bae7257..23ad95abfcad28016368a0d3307a4faef2d63f02 100644 (file)
@@ -17,7 +17,7 @@ import java.io.*;
 \r
 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 ptnfunccomment = Pattern.compile("([\\};\\/]\\s*)([\\w\\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 ptninfequation = Pattern.compile("([^\\s]*)\\s*-\\s*(.*)\\s*");\r
        private static Matcher mtrinfequation;\r
@@ -32,12 +32,13 @@ public class Critic implements Common.ForDoAll {
                        boolean arguments = false;\r
                        boolean returns = false;\r
                        boolean inequation = false;\r
-                       \r
+\r
                        System.out.println("Criticing   " + filepath);\r
                        String wholeline = Common.file2string(filepath);\r
-                       \r
+\r
+                       wholeline = wholeline.replaceAll("\t", "  ");\r
                        wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");\r
-                       wholeline = Common.replaceAll(wholeline, ptnfunccomment, "/**$2**/$3$1$4");\r
+                       wholeline = Common.replaceAll(wholeline, ptnfunccomment, "$1/**$3**/$4$2$5");\r
                        //wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");\r
                        \r
                        rd = new BufferedReader(new StringReader(wholeline));\r
@@ -66,7 +67,7 @@ public class Critic implements Common.ForDoAll {
                                        mtrinfequation = ptninfequation.matcher(line);\r
                                        if (mtrinfequation.find()) {\r
                                                inequation = true;\r
-                                               templine.append("  @param   " + mtrinfequation.group(1) + "     " + mtrinfequation.group(2) + "\n");\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
@@ -79,7 +80,7 @@ public class Critic implements Common.ForDoAll {
                                        mtrinfequation = ptninfequation.matcher(line);\r
                                        if (mtrinfequation.find()) {\r
                                                inequation = true;\r
-                                               templine.append("  @retval   " + mtrinfequation.group(1) + "     " + mtrinfequation.group(2) + "\n");\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