]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
1 package org
.tianocore
.migration
;
3 import java
.util
.regex
.*;
5 public class Critic
implements Common
.ForDoAll
{
13 private String filepath
= null;
15 private static Pattern ptnheadcomment
= Pattern
.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern
.DOTALL
);
16 private static Matcher mtrheadcomment
;
18 public void toDo(String filepath
) throws Exception
{
19 if (filepath
.contains(".c") || filepath
.contains(".h")) {
20 String wholeline
= Common
.file2string(filepath
);
21 mtrheadcomment
= ptnheadcomment
.matcher(wholeline
);
22 if (mtrheadcomment
.find()) { //as we find only the head comment here, use 'if' not 'while'
23 wholeline
= mtrheadcomment
.replaceFirst("/** @file$1**/");
24 Common
.string2file(wholeline
, filepath
+ "_");
29 public static void fireAt(String path
) throws Exception
{
30 Common
.toDoAll(path
, new Critic());
31 System
.out
.println("Critic Done");