#102 Fixed highlighting in export

This commit is contained in:
Jindra Petk
2013-06-16 17:04:28 +02:00
parent 4d28e60320
commit f7bac4eb8e
4 changed files with 14 additions and 8 deletions

View File

@@ -309,7 +309,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
public String convert(String path, List<ABCContainerTag> abcTags, ABC abc, boolean isStatic, boolean pcode, int scriptIndex, int classIndex, boolean highlight, List<String> fullyQualifiedNames) {
if (!highlight) {
Highlighting.doHighlight = false;
//Highlighting.doHighlight = false;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream out = null;
@@ -408,6 +408,9 @@ public class TraitClass extends Trait implements TraitWithSlot {
if (bodyIndex != -1) {
if (Configuration.DO_DECOMPILE) {
bodyStr = abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", pcode, true, scriptIndex, class_info, abc, abc.constants, abc.method_info, new Stack<GraphTargetItem>(), true, highlight, fullyQualifiedNames, abc.class_info[class_info].static_traits);
if (!highlight) {
bodyStr = Highlighting.stripHilights(bodyStr);
}
}
}
if (Highlighting.stripHilights(bodyStr).equals("")) {
@@ -444,6 +447,9 @@ public class TraitClass extends Trait implements TraitWithSlot {
if (bodyIndex != -1) {
if (Configuration.DO_DECOMPILE) {
bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", pcode, false, scriptIndex, class_info, abc, abc.constants, abc.method_info, new Stack<GraphTargetItem>(), false, highlight, fullyQualifiedNames, abc.instance_info[class_info].instance_traits), 3);
if (!highlight) {
bodyStr = Highlighting.stripHilights(bodyStr);
}
}
constructorParams = abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants, abc.bodies[bodyIndex], abc, fullyQualifiedNames);
} else {
@@ -485,7 +491,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
out.println(bui.toString());
out.println(ABC.IDENT_STRING + "}");//class
out.flush();
Highlighting.doHighlight = true;
//Highlighting.doHighlight = true;
try {
if (highlight) {
return Highlighting.hilighClass(new String(baos.toByteArray(), "UTF-8"), class_info);

View File

@@ -64,11 +64,11 @@ public class TraitMethodGetterSetter extends Trait {
String bodyStr = "";
int bodyIndex = abc.findBodyIndex(method_info);
if ((bodyIndex != -1) && (Configuration.DO_DECOMPILE)) {
try{
bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames), pcode, isStatic, scriptIndex, classIndex, abc, abc.constants, abc.method_info, new Stack<GraphTargetItem>(), false, highlight, fullyQualifiedNames, null), 3);
}catch(StackOverflowError er){
try {
bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames), pcode, isStatic, scriptIndex, classIndex, abc, abc.constants, abc.method_info, new Stack<GraphTargetItem>(), false, highlight, fullyQualifiedNames, null), 3);
} catch (StackOverflowError er) {
er.printStackTrace();
bodyStr="//StackOverflowError";
bodyStr = "//StackOverflowError";
}
}
return ABC.IDENT_STRING + ABC.IDENT_STRING + header + ((classIndex != -1 && abc.instance_info[classIndex].isInterface()) ? ";" : " {\r\n" + bodyStr + "\r\n" + ABC.IDENT_STRING + ABC.IDENT_STRING + "}");

View File

@@ -128,7 +128,7 @@ public class Traits implements Serializable {
Future<String> future = executor.submit(new TraitConvertTask(traits[t], makePackages, path, abcTags, abc, isStatic, pcode, scriptIndex, classIndex, highlighting, fullyQualifiedNames, t));
futureResults.add(future);
}
for (int f = 0; f < futureResults.size(); f++) {
if (f > 0) {
s += "\r\n\r\n";

View File

@@ -45,7 +45,7 @@ public class Highlighting implements Serializable {
/**
* Turn hignlighting on/off
*/
public static boolean doHighlight = true;
private static boolean doHighlight = true;
/**
* Returns a string representation of the object