source: other-projects/rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Options.java@ 25584

Last change on this file since 25584 was 25584, checked in by davidb, 12 years ago

Initial cut an a text edit area for GLI that supports color syntax highlighting

File size: 4.1 KB
Line 
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * JFlex 1.4.3 *
3 * Copyright (C) 1998-2009 Gerwin Klein <[email protected]> *
4 * All rights reserved. *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License. See the file *
8 * COPYRIGHT for more information. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License along *
16 * with this program; if not, write to the Free Software Foundation, Inc., *
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
18 * *
19 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20
21package JFlex;
22
23import java.io.File;
24
25/**
26 * Collects all global JFlex options. Can be set from command line parser,
27 * ant taks, gui, etc.
28 *
29 * @author Gerwin Klein
30 * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
31 */
32public class Options {
33
34 /** If true, additional verbose debug information is produced
35 * This is a compile time option */
36 public final static boolean DEBUG = false;
37
38 /** code generation method: maximum packing */
39 final public static int PACK = 0;
40 /** code generation method: traditional */
41 final public static int TABLE = 1;
42 /** code generation method: switch statement */
43 final public static int SWITCH = 2;
44
45
46 /** output directory */
47 private static File directory;
48 /** strict JLex compatibility */
49 public static boolean jlex;
50 /** don't run minimization algorithm if this is true */
51 public static boolean no_minimize;
52 /** don't write backup files if this is true */
53 public static boolean no_backup;
54 /** default code generation method */
55 public static int gen_method;
56 /** If false, only error/warning output will be generated */
57 public static boolean verbose;
58 /** If true, progress dots will be printed */
59 public static boolean progress;
60 /** If true, jflex will print time statistics about the generation process */
61 public static boolean time;
62 /** If true, jflex will write graphviz .dot files for generated automata */
63 public static boolean dot;
64 /** If true, you will be flooded with information (e.g. dfa tables). */
65 public static boolean dump;
66
67 static { setDefaults(); }
68
69
70 /**
71 * @return the output directory
72 */
73 public static File getDir() {
74 return directory;
75 }
76
77 /**
78 * Set output directory
79 *
80 * @param dirName the name of the directory to write output files to
81 */
82 public static void setDir(String dirName) {
83 setDir(new File(dirName));
84 }
85
86
87 /**
88 * Set output directory
89 *
90 * @param d the directory to write output files to
91 */
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 /**
107 * Sets all options back to default values.
108 */
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 Skeleton.readDefault();
121 }
122
123 public static void setSkeleton(File skel) {
124 Skeleton.readSkelFile(skel);
125 }
126}
Note: See TracBrowser for help on using the repository browser.