-// You may modify, copy, and redistribute this code under the terms of
-// the GNU Library Public License version 2.1, with the exception of
-// the portion of clause 6a after the semicolon (aka the "obnoxious
-// relink clause").
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
package org.ibex.tool;
}
out.println("//#endif "+expr);
- } else if (trimmed.startsWith("//#switch")) {
+ } else if (trimmed.startsWith("//#switch") || trimmed.startsWith("//#jsswitch")) {
int expStart = trimmed.indexOf('(') +1;
if (expStart < 1) { err.add(new Error("expected ( in #switch")); continue PROCESS; }
int expEnd = trimmed.lastIndexOf(')');
if (expEnd == -1) { err.add(new Error("expected ) in #switch")); continue PROCESS; }
if (expEnd - expStart <= 1) { err.add(new Error("badly formed #switch statement")); continue PROCESS; }
String expr = trimmed.substring(expStart, expEnd);
-
+ if (trimmed.startsWith("//#jsswitch")) expr = "JSU.toString("+expr+")";
out.print("final String ccSwitch"+enumSwitch+" = (String)("+expr+"); ");
out.print("SUCCESS:do { switch(ccSwitch"+enumSwitch+".length()) {\n");