import java.io.InputStream;
import jp.sourceforge.mikutoga.parser.MmdFormatException;
import jp.sourceforge.mikutoga.parser.MmdSource;
-import jp.sourceforge.mikutoga.parser.pmd.PmdParser;
+import jp.sourceforge.mikutoga.pmd.parser.PmdParser;
/**
* パーサ利用のサンプルプログラム。
+ * これはユニットテストではない。
*/
public class DummyMain {
private static final DummyHandler handler = new DummyHandler();
static{
- PMDFILE = "D:\\Test\\test.pmd";
+ PMDFILE =
+ "D:\\Test\\test.pmd";
+ }
+
+ /**
+ * アプリを終了する。
+ * 制御は戻らない。
+ * @param code 終了コード。
+ */
+ private static void exit(int code){
+ System.exit(code);
+ assert false;
+ return;
+ }
+
+ /**
+ * 標準エラー出力にエラー情報を出し改行する。
+ * @param text エラー情報文字列
+ */
+ private static void errprintln(Object text){
+ System.err.println(text);
+ return;
}
/**
try{
is = new FileInputStream(file);
}catch(FileNotFoundException e){
- System.err.println(e);
- System.exit(1);
+ errprintln(e);
+ exit(1);
return null;
}
is = new BufferedInputStream(is, BUF_SZ);
try{
parser.parsePmd();
}catch(IOException e){
- System.err.println(e);
- System.exit(1);
+ errprintln(e);
+ exit(1);
}catch(MmdFormatException e){
- System.err.println(e);
- System.exit(1);
+ errprintln(e);
+ exit(1);
}
- System.exit(0);
+ exit(0);
return;
}