@@ -58,20 +58,22 @@ public class XQPreprocessor {
5858
5959 private String [] coreImports , defaultImports ;
6060
61+
6162 public XQPreprocessor () {
6263 PdePreprocessor p = new PdePreprocessor (null );
6364 defaultImports = p .getDefaultImports ();
6465 coreImports = p .getCoreImports ();
6566 }
6667
68+
6769 /**
6870 * The main method that performs preprocessing. Converts code into compilable java.
6971 * @param source - String
7072 * @param programImports - List of import statements
7173 * @return String - Compile ready java code
7274 */
7375 public String doYourThing (String source ,
74- ArrayList <ImportStatement > programImports ) {
76+ ArrayList <ImportStatement > programImports ) {
7577 this .extraImports = programImports ;
7678 //source = prepareImports() + source;
7779 Document doc = new Document (source );
@@ -118,9 +120,9 @@ public String doYourThing(String source,
118120 return doc .get ();
119121 }
120122
123+
121124 /**
122125 * Returns all import statements as lines of code
123- *
124126 * @return String - All import statements combined. Each import in a separate line.
125127 */
126128 public String prepareImports () {
@@ -143,11 +145,13 @@ public String prepareImports() {
143145 return totalImports ;
144146 }
145147
148+
146149 public String prepareImports (ArrayList <ImportStatement > programImports ) {
147150 this .extraImports = programImports ;
148151 return prepareImports ();
149152 }
150153
154+
151155 /**
152156 * Visitor implementation that does all the substitution dirty work. <br>
153157 * <LI>Any function not specified as being protected or private will be made
@@ -190,6 +194,7 @@ public boolean visit(MethodDeclaration node) {
190194
191195 return true ;
192196 }
197+
193198
194199 public boolean visit (NumberLiteral node ) {
195200 if (!node .getToken ().endsWith ("f" )
@@ -206,6 +211,7 @@ public boolean visit(NumberLiteral node) {
206211 return true ;
207212 }
208213
214+
209215 // public boolean visit(FieldDeclaration node) {
210216 // if (node.getType().toString().equals("color")){
211217 // System.err.println("color type detected!");
@@ -231,13 +237,9 @@ public boolean visit(NumberLiteral node) {
231237 */
232238 public boolean visit (SimpleType node ) {
233239 if (node .toString ().equals ("color" )) {
234- System .err
235- .println ("color type detected! \n This shouldn't be happening! Please report this as an issue." );
240+ System .err .println ("color type detected! \n This shouldn't be happening! Please report this as an issue." );
236241 }
237242 return true ;
238-
239243 }
240-
241244 }
242-
243245}
0 commit comments