private PrintWriter out;
private Hashtable replace = new Hashtable();
- private Hashtable repeatreplace = null;
+ private Hashtable[] repeatreplaces = null;
private Vector sinceLastRepeat = null;
private Vector err = new Vector();
out.print("\n"); // preserve line numbers
}
StringTokenizer st = new StringTokenizer(trimmed, " ");
- repeatreplace = (Hashtable)replace.clone();
+ repeatreplaces = null;
while (st.hasMoreTokens()) {
String tok = st.nextToken().trim();
String key = tok.substring(0, tok.indexOf('/'));
- String val = tok.substring(tok.indexOf('/') + 1);
- repeatreplace.put(key, val);
+ String vals = tok.substring(tok.indexOf('/') + 1);
+ StringTokenizer st2 = new StringTokenizer(vals,"/");
+ if(repeatreplaces == null) {
+ repeatreplaces = new Hashtable[st2.countTokens()];
+ for(int i=0;i<repeatreplaces.length;i++) repeatreplaces[i] = (Hashtable) replace.clone();
+ }
+ for(int i=0;st2.hasMoreTokens() && i<repeatreplaces.length;i++)
+ repeatreplaces[i].put(key, st2.nextToken());
}
sinceLastRepeat = new Vector();
out.print("\n"); // preserve line numbers
} else if (trimmed.startsWith("//#end")) {
if (sinceLastRepeat == null) { err.add(new Warning("#end orphaned")); continue PROCESS; }
Hashtable save = replace;
- replace = repeatreplace;
out.print("\n");
- for(int i=0; i<sinceLastRepeat.size() - 1; i++) out.print(processLine((String)sinceLastRepeat.elementAt(i), true));
+ for(int i=0;i<repeatreplaces.length;i++) {
+ replace = repeatreplaces[i];
+ for(int j=0; j<sinceLastRepeat.size() - 1; j++) out.print(processLine((String)sinceLastRepeat.elementAt(j), true));
+ }
sinceLastRepeat = null;
replace = save;
buildTrie("", byLength[i]);
out.print("}; break; } ");
}
- out.print("} /* switch */ ");
+ out.print("} "); /* switch */
if (Default != null) out.print(" " + Default);
- out.print(" } while(false); /* OUTER */\n");
+ out.print(" } while(false);\n"); /* OUTER */
enumSwitch++;
} else {
ret += tok;
i = j - 1;
} else if (val instanceof JSFunctionMacro) {
- if (s.charAt(j) != '(') { err.add(new Error("open paren must follow macro binding for macro " + tok)); continue; }
+ if (s.charAt(j) != '(') { ret += tok; i = j - 1; continue; }
ret += ((JSFunctionMacro)val).process(s.substring(j+1, s.indexOf(')', j)));
i = s.indexOf(')', j);
} else {