KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javacc > jjtree > JJTreeOptions


1 package org.javacc.jjtree;
2
3 import java.io.File JavaDoc;
4
5 import org.javacc.parser.Options;
6
7 /**
8  * The JJTree-specific options.
9  *
10  * @author Kees Jan Koster <kjkoster@kjkoster.org>
11  */

12 class JJTreeOptions extends Options {
13
14     /**
15      * Limit subclassing to derived classes.
16      */

17     protected JJTreeOptions() {
18         super();
19     }
20
21     /**
22      * Initialize the JJTree-specific options.
23      */

24     public static void init() {
25         Options.init();
26
27         Options.optionValues.put("JDK_VERSION", "1.4");
28         Options.optionValues.put("MULTI", Boolean.FALSE);
29         Options.optionValues.put("NODE_DEFAULT_VOID", Boolean.FALSE);
30         Options.optionValues.put("NODE_SCOPE_HOOK", Boolean.FALSE);
31         Options.optionValues.put("NODE_FACTORY", Boolean.FALSE);
32         Options.optionValues.put("NODE_USES_PARSER", Boolean.FALSE);
33         Options.optionValues.put("BUILD_NODE_FILES", Boolean.TRUE);
34         Options.optionValues.put("VISITOR", Boolean.FALSE);
35
36         Options.optionValues.put("NODE_PREFIX", "AST");
37         Options.optionValues.put("NODE_PACKAGE", "");
38         Options.optionValues.put("NODE_EXTENDS", "");
39         Options.optionValues.put("OUTPUT_FILE", "");
40         Options.optionValues.put("VISITOR_EXCEPTION", "");
41
42         Options.optionValues.put("JJTREE_OUTPUT_DIRECTORY", null);
43     }
44
45     /**
46      * Find the multi value.
47      *
48      * @return The requested multi value.
49      */

50     public static String JavaDoc getJdkVersion() {
51         return stringValue("JDK_VERSION");
52     }
53
54     /**
55      * Find the multi value.
56      *
57      * @return The requested multi value.
58      */

59     public static boolean getMulti() {
60         return booleanValue("MULTI");
61     }
62
63     /**
64      * Find the node default void value.
65      *
66      * @return The requested node default void value.
67      */

68     public static boolean getNodeDefaultVoid() {
69         return booleanValue("NODE_DEFAULT_VOID");
70     }
71
72     /**
73      * Find the node scope hook value.
74      *
75      * @return The requested node scope hook value.
76      */

77     public static boolean getNodeScopeHook() {
78         return booleanValue("NODE_SCOPE_HOOK");
79     }
80
81     /**
82      * Find the node factory value.
83      *
84      * @return The requested node factory value.
85      */

86     public static boolean getNodeFactory() {
87         return booleanValue("NODE_FACTORY");
88     }
89
90     /**
91      * Find the node uses parser value.
92      *
93      * @return The requested node uses parser value.
94      */

95     public static boolean getNodeUsesParser() {
96         return booleanValue("NODE_USES_PARSER");
97     }
98
99     /**
100      * Find the build node files value.
101      *
102      * @return The requested build node files value.
103      */

104     public static boolean getBuildNodeFiles() {
105         return booleanValue("BUILD_NODE_FILES");
106     }
107
108     /**
109      * Find the visitor value.
110      *
111      * @return The requested visitor value.
112      */

113     public static boolean getVisitor() {
114         return booleanValue("VISITOR");
115     }
116
117     /**
118      * Find the node prefix value.
119      *
120      * @return The requested node prefix value.
121      */

122     public static String JavaDoc getNodePrefix() {
123         return stringValue("NODE_PREFIX");
124     }
125
126     /**
127      * Find the node super class name.
128      *
129      * @return The requested node super class
130      */

131     public static String JavaDoc getNodeExtends() {
132         return stringValue("NODE_EXTENDS");
133     }
134
135     /**
136      * Find the node package value.
137      *
138      * @return The requested node package value.
139      */

140     public static String JavaDoc getNodePackage() {
141         return stringValue("NODE_PACKAGE");
142     }
143
144     /**
145      * Find the output file value.
146      *
147      * @return The requested output file value.
148      */

149     public static String JavaDoc getOutputFile() {
150         return stringValue("OUTPUT_FILE");
151     }
152
153     /**
154      * Find the visitor exception value
155      *
156      * @return The requested visitor exception value.
157      */

158     public static String JavaDoc getVisitorException() {
159         return stringValue("VISITOR_EXCEPTION");
160     }
161
162     /**
163      * Find the output directory to place the generated <code>.jj</code> files
164      * into. If none is configured, use the value of
165      * <code>getOutputDirectory()</code>.
166      *
167      * @return The requested JJTree output directory
168      */

169     public static File JavaDoc getJJTreeOutputDirectory() {
170         final String JavaDoc dirName = stringValue("JJTREE_OUTPUT_DIRECTORY");
171         File JavaDoc dir = null;
172         
173         if (dirName == null) {
174             dir = getOutputDirectory();
175         } else {
176             dir = new File JavaDoc(dirName);
177         }
178         
179         return dir;
180     }
181 }
182
Popular Tags