1 20 21 package JFlex; 22 23 import java.io.File ; 24 25 32 public class Options { 33 34 36 public final static boolean DEBUG = false; 37 38 39 final public static int PACK = 0; 40 41 final public static int TABLE = 1; 42 43 final public static int SWITCH = 2; 44 45 46 47 private static File directory; 48 49 public static boolean jlex; 50 51 public static boolean no_minimize; 52 53 public static boolean no_backup; 54 55 public static int gen_method; 56 57 public static boolean verbose; 58 59 public static boolean progress; 60 61 public static boolean time; 62 63 public static boolean dot; 64 65 public static boolean dump; 66 67 static { setDefaults(); } 68 69 70 73 public static File getDir() { 74 return directory; 75 } 76 77 82 public static void setDir(String dirName) { 83 setDir(new File (dirName)); 84 } 85 86 87 92 public static void setDir(File d) { 93 if ( d.isFile() ) { 94 Out.error("Error: \""+d+"\" is not a directory."); 95 throw new GeneratorException(); 96 } 97 98 if ( !d.isDirectory() && !d.mkdirs() ) { 99 Out.error("Error: couldn't create directory \""+d+"\""); 100 throw new GeneratorException(); 101 } 102 103 directory = d; 104 } 105 106 109 public static void setDefaults() { 110 directory = null; 111 jlex = false; 112 no_minimize = false; 113 no_backup = false; 114 gen_method = Options.PACK; 115 verbose = true; 116 progress = true; 117 time = false; 118 dot = false; 119 dump = false; 120 } 121 122 public static void setSkeleton(File skel) { 123 Skeleton.readSkelFile(skel); 124 } 125 } 126 | Popular Tags |