String s2 = in.readLine().trim();
if (s2.startsWith("//")) s2 = s2.substring(2).trim();
trimmed = trimmed.substring(0, trimmed.length() - 1) + " " + s2;
String s2 = in.readLine().trim();
if (s2.startsWith("//")) s2 = s2.substring(2).trim();
trimmed = trimmed.substring(0, trimmed.length() - 1) + " " + s2;
}
StringTokenizer st = new StringTokenizer(trimmed, " ");
repeatreplace = (Hashtable)replace.clone();
}
StringTokenizer st = new StringTokenizer(trimmed, " ");
repeatreplace = (Hashtable)replace.clone();
repeatreplace.put(key, val);
}
sinceLastRepeat = new Vector();
repeatreplace.put(key, val);
}
sinceLastRepeat = new Vector();
} else if (trimmed.startsWith("//#end")) {
if (sinceLastRepeat == null) { err.add(new Warning("#end orphaned")); continue PROCESS; }
Hashtable save = replace;
replace = repeatreplace;
} else if (trimmed.startsWith("//#end")) {
if (sinceLastRepeat == null) { err.add(new Warning("#end orphaned")); continue PROCESS; }
Hashtable save = replace;
replace = repeatreplace;
if (expEnd - expStart <= 1) { err.add(new Error("badly formed #switch statement")); continue PROCESS; }
String expr = trimmed.substring(expStart, expEnd);
if (expEnd - expStart <= 1) { err.add(new Error("badly formed #switch statement")); continue PROCESS; }
String expr = trimmed.substring(expStart, expEnd);
- out.println("final String ccSwitch"+enumSwitch+" = (String)("+expr+");");
- out.println("SUCCESS:do { switch(ccSwitch"+enumSwitch+".length()) {");
+ out.print("final String ccSwitch"+enumSwitch+" = (String)("+expr+"); ");
+ out.print("SUCCESS:do { switch(ccSwitch"+enumSwitch+".length()) {\n");
- hash.put(key, (String)hash.get(key) + processLine(trimmed, false) + "\n");
+ hash.put(key, (String)hash.get(key) + processLine(trimmed, false).replaceAll("//[^\"]*$", ""));
- out.println("} //switch");
- if (Default != null) out.println(Default);
- out.println("} while(false); //OUTER");
+ out.print("} /* switch */ ");
+ if (Default != null) out.print("\n" + Default);
+ out.print(" } while(false); //OUTER\n");
if (!((String)keys.elementAt(i)).startsWith(prefix)) continue;
String prefixPlusOne = ((String)keys.elementAt(i)).substring(0, prefix.length() + 1);
if (i<keys.size()-1 && prefixPlusOne.equals((((String)keys.elementAt(i + 1)).substring(0, prefix.length() + 1)))) {
if (!((String)keys.elementAt(i)).startsWith(prefix)) continue;
String prefixPlusOne = ((String)keys.elementAt(i)).substring(0, prefix.length() + 1);
if (i<keys.size()-1 && prefixPlusOne.equals((((String)keys.elementAt(i + 1)).substring(0, prefix.length() + 1)))) {
- out.println("case \'" + prefixPlusOne.charAt(prefixPlusOne.length() - 1) + "\': {");
- out.println("switch(ccSwitch"+enumSwitch+".charAt(" + (prefix.length()+1) + ")) {");
+ out.print("case \'" + prefixPlusOne.charAt(prefixPlusOne.length() - 1) + "\': { ");
+ out.print("switch(ccSwitch"+enumSwitch+".charAt(" + (prefix.length()+1) + ")) { ");
while(i<keys.size() && prefixPlusOne.equals(((String)keys.elementAt(i)).substring(0, prefix.length() + 1))) i++;
if (i<keys.size()) { i--; continue; }
} else {
while(i<keys.size() && prefixPlusOne.equals(((String)keys.elementAt(i)).substring(0, prefix.length() + 1))) i++;
if (i<keys.size()) { i--; continue; }
} else {
String code = (String)cases.get(keys.elementAt(i));
code = code.substring(0, code.length() - 1);
String key = (String)keys.elementAt(i);
String code = (String)cases.get(keys.elementAt(i));
code = code.substring(0, code.length() - 1);
String key = (String)keys.elementAt(i);