highlights: new lines removed from hilight call, some not highlighted strings are highlighted

This commit is contained in:
Honfika
2013-08-25 16:57:22 +02:00
parent b28e8de18f
commit fa48f9478f
73 changed files with 343 additions and 110 deletions

View File

@@ -46,12 +46,12 @@ public class ApplyTypeAVM2Item extends AVM2Item {
}
GraphTargetItem p = params.get(i);
if (p instanceof NullAVM2Item) {
ret.append("*");
ret.append(hilight("*", highlight));
} else {
ret.append(p.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)));
}
}
ret.append(">");
ret.append(hilight(">", highlight));
}
return ret.toString();
}

View File

@@ -40,7 +40,7 @@ public class CallAVM2Item extends AVM2Item {
String args = "";
for (int a = 0; a < arguments.size(); a++) {
if (a > 0) {
args = args + ",";
args = args + hilight(",", highlight);
}
args = args + arguments.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}
@@ -53,7 +53,7 @@ public class CallAVM2Item extends AVM2Item {
}*/
String fstr = function.toString(highlight, constants, localRegNames, fullyQualifiedNames);
if (function.precedence > precedence) {
fstr = "(" + fstr + ")";
fstr = hilight("(", highlight) + fstr + hilight(")", highlight);
}
return fstr + hilight("(", highlight) + args + hilight(")", highlight);
}

View File

@@ -41,7 +41,7 @@ public class CallMethodAVM2Item extends AVM2Item {
String args = "";
for (int a = 0; a < arguments.size(); a++) {
if (a > 0) {
args = args + ",";
args = args + hilight(",", highlight);
}
args = args + arguments.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}

View File

@@ -41,7 +41,7 @@ public class CallStaticAVM2Item extends AVM2Item {
String args = "";
for (int a = 0; a < arguments.size(); a++) {
if (a > 0) {
args = args + ",";
args = args + hilight(",", highlight);
}
args = args + arguments.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}

View File

@@ -43,7 +43,7 @@ public class CallSuperAVM2Item extends AVM2Item {
String args = "";
for (int a = 0; a < arguments.size(); a++) {
if (a > 0) {
args = args + ",";
args = args + hilight(",", highlight);
}
args = args + arguments.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames, highlight);
}

View File

@@ -38,7 +38,7 @@ public class ConstructAVM2Item extends AVM2Item {
String argStr = "";
for (int a = 0; a < args.size(); a++) {
if (a > 0) {
argStr = argStr + ",";
argStr = argStr + hilight(",", highlight);
}
argStr = argStr + args.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}
@@ -47,6 +47,5 @@ public class ConstructAVM2Item extends AVM2Item {
}
String obStr = object.toString(highlight, constants, localRegNames, fullyQualifiedNames);
return hilight("new ", highlight) + obStr + hilight("(", highlight) + argStr + hilight(")", highlight);
}
}

View File

@@ -40,13 +40,13 @@ public class ConstructPropAVM2Item extends AVM2Item {
String argStr = "";
for (int a = 0; a < args.size(); a++) {
if (a > 0) {
argStr = argStr + ",";
argStr = argStr + hilight(",", highlight);
}
argStr = argStr + args.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}
String objstr = object.toString(highlight, constants, localRegNames, fullyQualifiedNames);
if (!objstr.equals("")) {
objstr += ".";
objstr += hilight(".", highlight);
}
return hilight("new ", highlight) + objstr + propertyName.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight("(", highlight) + argStr + hilight(")", highlight);

View File

@@ -39,11 +39,11 @@ public class ConstructSuperAVM2Item extends AVM2Item {
String argStr = "";
for (int a = 0; a < args.size(); a++) {
if (a > 0) {
argStr = argStr + ",";
argStr = argStr + hilight(",", highlight);
}
argStr = argStr + args.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}
String calee = object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + ".";
String calee = object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight(".", highlight);
if (Highlighting.stripHilights(calee).equals("this.")) {
calee = "";
}

View File

@@ -77,12 +77,12 @@ public class FullMultinameAVM2Item extends AVM2Item {
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
String ret = "";
if (name != null) {
ret = "[" + name.toString(highlight, constants, localRegNames, fullyQualifiedNames) + "]";
ret = hilight("[", highlight) + name.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight("]", highlight);
} else {
ret = hilight(constants.constant_multiname[multinameIndex].getName(constants, fullyQualifiedNames), highlight);
}
if (namespace != null) {
ret = namespace.toString(highlight, constants, localRegNames, fullyQualifiedNames) + "::" + ret;
ret = namespace.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight("::", highlight) + ret;
} else {
/*Namespace ns = constants.constant_multiname[multinameIndex].getNamespace(constants);
if ((ns != null)&&(ns.name_index!=0)) {

View File

@@ -36,7 +36,7 @@ public class GetSuperAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
String calee = object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + ".";
String calee = object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight(".", highlight);
if (Highlighting.stripHilights(calee).equals("this.")) {
calee = "";
}

View File

@@ -40,6 +40,6 @@ public class HasNextAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return collection.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + " hasNext " + object.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames));
return collection.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight(" hasNext ", highlight) + object.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames));
}
}

View File

@@ -33,7 +33,7 @@ public class NameSpaceAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
if (namespaceIndex == 0) {
return "*";
return hilight("*", highlight);
}
return hilight(constants.constant_namespace[namespaceIndex].toString(constants), highlight);
}

View File

@@ -37,7 +37,7 @@ public class NameValuePair extends AVM2Item {
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
String valueStr = value.toString(highlight, constants, localRegNames, fullyQualifiedNames);
if (value instanceof TernarOpItem) { //Ternar operator contains ":"
valueStr = "(" + valueStr + ")";
valueStr = hilight("(", highlight) + valueStr + hilight(")", highlight);
}
return name.toString(highlight, constants, localRegNames, fullyQualifiedNames) + ":" + valueStr;
}

View File

@@ -36,7 +36,7 @@ public class NewArrayAVM2Item extends AVM2Item {
String args = "";
for (int a = 0; a < values.size(); a++) {
if (a > 0) {
args = args + ",";
args = args + hilight(",", highlight);
}
args = args + values.get(a).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2010-2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import java.util.HashMap;
import java.util.List;
public class NewFunctionAVM2Item extends AVM2Item {
public String paramStr;
public String returnStr;
public String functionBody;
public String functionName;
public NewFunctionAVM2Item(AVM2Instruction instruction, String functionName, String paramStr, String returnStr, String functionBody) {
super(instruction, PRECEDENCE_PRIMARY);
this.paramStr = paramStr;
this.returnStr = returnStr;
this.functionBody = functionBody;
this.functionName = functionName;
}
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return hilight("function" + (!functionName.equals("") ? " " + functionName : "") + "(" + paramStr + "):" + returnStr, highlight) + "\r\n" + hilight("{", highlight) + "\r\n" + hilight(functionBody, highlight) + "\r\n" + hilight("}", highlight);
}
}

View File

@@ -36,7 +36,7 @@ public class NewObjectAVM2Item extends AVM2Item {
String params = "";
for (int n = 0; n < pairs.size(); n++) {
if (n > 0) {
params += ",\r\n";
params += hilight(",", highlight) + "\r\n";
}
params += pairs.get(n).toString(highlight, constants, localRegNames, fullyQualifiedNames);
}

View File

@@ -40,6 +40,6 @@ public class NextNameAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "nextName(" + index.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "," + obj.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + ")";
return hilight("nextName(", highlight) + index.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight(",", highlight) + obj.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight(")", highlight);
}
}

View File

@@ -40,6 +40,6 @@ public class NextValueAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "nextValue(" + index.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "," + obj.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + ")";
return hilight("nextValue(", highlight) + index.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight(",", highlight) + obj.toString(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight(")", highlight);
}
}

View File

@@ -35,6 +35,6 @@ public class ScriptAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "script" + scriptIndex;
return hilight("script" + scriptIndex, highlight);
}
}

View File

@@ -32,6 +32,6 @@ public class ThisAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "this";
return hilight("this", highlight);
}
}

View File

@@ -32,6 +32,6 @@ public class UnparsedAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return value;
return hilight(value, highlight);
}
}

View File

@@ -43,7 +43,7 @@ public class WithAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
String ret;
ret = hilight("with(", highlight) + scope.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight(")\r\n{\r\n", highlight);
ret = hilight("with(", highlight) + scope.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
/*for (GraphTargetItem ti : items) {
ret += ti.toString(constants, localRegNames, fullyQualifiedNames) + "\r\n";
}

View File

@@ -57,7 +57,7 @@ public class DeclarationAVM2Item extends AVM2Item {
if (lti.value instanceof ConvertAVM2Item) {
type = ((ConvertAVM2Item) lti.value).type;
}
return "var " + hilight(localRegName(localRegNames, lti.regIndex) + ":" + type + " = ", highlight) + lti.value.toString(highlight, constants, localRegNames, fullyQualifiedNames);
return hilight("var ", highlight) + hilight(localRegName(localRegNames, lti.regIndex) + ":" + hilight(type, highlight) + " = ", highlight) + lti.value.toString(highlight, constants, localRegNames, fullyQualifiedNames);
}
if (assignment instanceof SetSlotAVM2Item) {
SetSlotAVM2Item ssti = (SetSlotAVM2Item) assignment;

View File

@@ -33,6 +33,6 @@ public class ExceptionAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return exception.getVarName(constants, fullyQualifiedNames);
return hilight(exception.getVarName(constants, fullyQualifiedNames), highlight);
}
}

View File

@@ -69,15 +69,15 @@ public class ForEachInAVM2Item extends LoopItem implements Block {
@Override
public String toString(boolean highlight, List<Object> localData) {
String ret = "";
ret += "loop" + loop.id + ":\r\n";
ret += hilight("for each (", highlight) + expression.toString(highlight, localData) + ")\r\n{\r\n";
ret += hilight("loop" + loop.id + ":", highlight) + "\r\n";
ret += hilight("for each (", highlight) + expression.toString(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
}
}
ret += hilight("}", highlight) + "\r\n";
ret += ":loop" + loop.id;
ret += hilight(":loop" + loop.id, highlight);
return ret;
}

View File

@@ -69,15 +69,15 @@ public class ForInAVM2Item extends LoopItem implements Block {
@Override
public String toString(boolean highlight, List<Object> localData) {
String ret = "";
ret += "loop" + loop.id + ":\r\n";
ret += hilight("for (", highlight) + expression.toString(highlight, localData) + hilight(")", highlight) + "\r\n{\r\n";
ret += hilight("loop" + loop.id + ":", highlight) + "\r\n";
ret += hilight("for (", highlight) + expression.toString(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
}
}
ret += hilight("}", highlight) + "\r\n";
ret += ":loop" + loop.id;
ret += hilight(":loop" + loop.id, highlight);
return ret;
}

View File

@@ -54,31 +54,31 @@ public class TryAVM2Item extends AVM2Item implements Block {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
String ret = "";
ret += "try\r\n{\r\n";
ret += hilight("try", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : tryCommands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
for (int e = 0; e < catchExceptions.size(); e++) {
ret += "\r\ncatch(" + catchExceptions.get(e).getVarName(constants, fullyQualifiedNames) + ":" + catchExceptions.get(e).getTypeName(constants, fullyQualifiedNames) + ")\r\n{\r\n";
ret += "\r\n" + hilight("catch(", highlight) + catchExceptions.get(e).getVarName(constants, fullyQualifiedNames) + ":" + catchExceptions.get(e).getTypeName(constants, fullyQualifiedNames) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) +"\r\n";
List<GraphTargetItem> commands = catchCommands.get(e);
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
}
if (finallyCommands.size() > 0) {
ret += "\r\nfinally\r\n{\r\n";
ret += "\r\n" + hilight("finally", highlight) +"\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : finallyCommands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
}
return ret;
}

View File

@@ -34,7 +34,7 @@ public class AddAVM2Item extends BinaryOpItem {
if (rightSide.precedence >= precedence) { //string + vs number +
String ret = "";
if (leftSide.precedence > precedence) {
ret += "(" + leftSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + leftSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += leftSide.toString(highlight, localData);
}
@@ -42,7 +42,7 @@ public class AddAVM2Item extends BinaryOpItem {
ret += hilight(operator, highlight);
ret += " ";
ret += "(" + rightSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + rightSide.toString(highlight, localData) + hilight(")", highlight);
return ret;
} else {
return super.toString(highlight, localData);

View File

@@ -37,6 +37,6 @@ public class DeletePropertyAVM2Item extends AVM2Item {
@Override
public String toString(boolean highlight, ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return hilight("delete ", highlight) + object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + "[" + propertyName.toString(highlight, constants, localRegNames, fullyQualifiedNames) + "]";
return hilight("delete ", highlight) + object.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight("[", highlight) + propertyName.toString(highlight, constants, localRegNames, fullyQualifiedNames) + hilight("]", highlight);
}
}

View File

@@ -38,7 +38,7 @@ public class SubtractAVM2Item extends BinaryOpItem {
if (rightSide.precedence >= precedence) { // >= add or subtract too
String ret = "";
if (leftSide.precedence > precedence) {
ret += "(" + leftSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + leftSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += leftSide.toString(highlight, localData);
}
@@ -46,7 +46,7 @@ public class SubtractAVM2Item extends BinaryOpItem {
ret += hilight(operator, highlight);
ret += " ";
ret += "(" + rightSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + rightSide.toString(highlight, localData) + hilight(")", highlight);
return ret;
} else {
return super.toString(highlight, localData);

View File

@@ -70,7 +70,7 @@ public class CallMethodActionItem extends ActionItem {
}
String soStr = scriptObject.toString(highlight, constants);
if (scriptObject.precedence > this.precedence) {
soStr = "(" + soStr + ")";
soStr = hilight("(", highlight) + soStr + hilight(")", highlight);
}
return soStr + hilight(".", highlight) + stripQuotes(methodName, constants, highlight) + hilight("(", highlight) + paramStr + hilight(")", highlight);
}

View File

@@ -69,9 +69,9 @@ public class DefineLocalActionItem extends ActionItem implements SetTypeActionIt
@Override
public String toString(boolean highlight, ConstantPool constants) {
if (value == null) {
return hilight("var ", highlight) + stripQuotes(name, constants, highlight);
return hilight("var ", highlight) + stripQuotes(name, constants, highlight);
}
return hilight("var ", highlight) + stripQuotes(name, constants, highlight) + hilight(" = ", highlight) + value.toString(highlight, constants);
return hilight("var ", highlight) + stripQuotes(name, constants, highlight) + hilight(" = ", highlight) + value.toString(highlight, constants);
}
@Override

View File

@@ -33,7 +33,7 @@ public class DefineRegisterActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return "var " + identifier;
return hilight("var " + identifier, highlight);
}
@Override

View File

@@ -47,7 +47,7 @@ public class DeleteActionItem extends ActionItem {
if (object == null) {
return hilight("delete ", highlight) + propertyName.toString(highlight, constants);
}
return hilight("delete ", highlight) + object.toString(highlight, constants) + "." + stripQuotes(propertyName, constants, highlight);
return hilight("delete ", highlight) + object.toString(highlight, constants) + hilight(".", highlight) + stripQuotes(propertyName, constants, highlight);
}
@Override

View File

@@ -40,7 +40,7 @@ public class EnumerateActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return "enumerate " + object.toString(highlight, Helper.toList(constants));
return hilight("enumerate ", highlight) + object.toString(highlight, Helper.toList(constants));
}
@Override

View File

@@ -48,7 +48,7 @@ public class FSCommand2ActionItem extends ActionItem {
public String toString(boolean highlight, ConstantPool constants) {
String paramStr = "";
for (int t = 0; t < arguments.size(); t++) {
paramStr += ",";
paramStr += hilight(",", highlight);
paramStr += arguments.get(t).toString(highlight, constants);
}
return hilight("FSCommand2(", highlight) + command.toString(highlight, constants) + paramStr + hilight(")", highlight);

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.helpers.Helper;
import java.util.List;
/**
*
* @author JPEXS
*/
public class FSCommandActionItem extends ActionItem {
private String command;
public FSCommandActionItem(GraphSourceItem instruction, String command) {
super(instruction, PRECEDENCE_PRIMARY);
this.command = command;
}
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("fscommand(\"", highlight) + hilight(Helper.escapeString(command), highlight) + hilight("\", highlight)", highlight);
}
@Override
public List<GraphSourceItem> toSource(List<Object> localData, SourceGenerator generator) {
return toSourceMerge(localData, generator, new ActionGetURL("FSCommand:" + command, ""));
}
@Override
public boolean hasReturnValue() {
return false;
}
}

View File

@@ -91,7 +91,7 @@ public class FunctionActionItem extends ActionItem {
}
ret += hilight(pname, highlight);
}
ret += hilight(")", highlight) + "\r\n{\r\n" + Graph.graphToString(actions, highlight, constants) + "}";
ret += hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n" + Graph.graphToString(actions, highlight, constants) + "}";
return ret;
}

View File

@@ -45,9 +45,9 @@ public class GetMemberActionItem extends ActionItem {
public String toString(boolean highlight, ConstantPool constants) {
if (!((memberName instanceof DirectValueActionItem) && (((DirectValueActionItem) memberName).value instanceof String))) {
//if(!(functionName instanceof GetVariableActionItem))
return object.toString(highlight, constants) + "[" + stripQuotes(memberName, constants, highlight) + "]";
return object.toString(highlight, constants) + hilight("[", highlight) + stripQuotes(memberName, constants, highlight) + hilight("]", highlight);
}
return object.toString(highlight, constants) + "." + stripQuotes(memberName, constants, highlight);
return object.toString(highlight, constants) + hilight(".", highlight) + stripQuotes(memberName, constants, highlight);
}
@Override

View File

@@ -29,7 +29,7 @@ public class GetURLActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("getUrl(\"", highlight) + Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString) + hilight("\")", highlight);
return hilight("getUrl(\"", highlight) + hilight(Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString), highlight) + hilight("\")", highlight);
}
public GetURLActionItem(GraphSourceItem instruction, String urlString, String targetString) {

View File

@@ -51,7 +51,7 @@ public class GotoFrame2ActionItem extends ActionItem {
if (playFlag) {
prefix = "gotoAndPlay";
}
return hilight(prefix + "(", highlight) + frame.toString(highlight, constants) + (sceneBiasFlag ? "," + sceneBias : "") + hilight(")", highlight);
return hilight(prefix + "(", highlight) + frame.toString(highlight, constants) + hilight((sceneBiasFlag ? "," + sceneBias : ""), highlight) + hilight(")", highlight);
}
@Override

View File

@@ -32,7 +32,7 @@ public class GotoFrameActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("gotoAndStop(", highlight) + (frame + 1) + hilight(")", highlight);
return hilight("gotoAndStop(", highlight) + hilight("" + (frame + 1), highlight) + hilight(")", highlight);
}
@Override

View File

@@ -33,7 +33,7 @@ public class GotoLabelActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("gotoAndStop(\"", highlight) + Helper.escapeString(label) + hilight("\", highlight)", highlight);
return hilight("gotoAndStop(\"", highlight) + hilight(Helper.escapeString(label), highlight) + hilight("\")", highlight);
}
@Override

View File

@@ -37,7 +37,7 @@ public class ImplementsOpActionItem extends ActionItem {
String impStr = "";
for (int i = 0; i < superclasses.size(); i++) {
if (i > 0) {
impStr += ",";
impStr += hilight(",", highlight);
}
impStr += superclasses.get(i).toString(highlight, Helper.toList(constants));
}

View File

@@ -52,7 +52,7 @@ public class InitObjectActionItem extends ActionItem {
}
String valueStr = values.get(i).toString(highlight, constants);
if (values.get(i) instanceof TernarOpItem) { //Ternar operator contains ":"
valueStr = "(" + valueStr + ")";
valueStr = hilight("(", highlight) + valueStr + hilight(")", highlight);
}
objStr += names.get(i).toStringNoQuotes(highlight, constants) + hilight(":", highlight) + valueStr; //AS1/2 do not allow quotes in name here
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SourceGenerator;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author JPEXS
*/
public class LoadVariablesNumActionItem extends ActionItem {
private GraphTargetItem urlString;
private GraphTargetItem num;
private int method;
@Override
public List<GraphTargetItem> getAllSubItems() {
List<GraphTargetItem> ret = new ArrayList<>();
ret.add(urlString);
ret.add(num);
return ret;
}
public LoadVariablesNumActionItem(GraphSourceItem instruction, GraphTargetItem urlString, GraphTargetItem num, int method) {
super(instruction, PRECEDENCE_PRIMARY);
this.urlString = urlString;
this.num = num;
this.method = method;
}
@Override
public String toString(boolean highlight, ConstantPool constants) {
String methodStr = "";
if (method == 1) {
methodStr = ",\"GET\"";
}
if (method == 2) {
methodStr = ",\"POST\"";
}
return hilight("loadVariablesNum(", highlight) + urlString.toString(highlight, constants) + hilight(",", highlight) + hilight("" + num, highlight) + hilight(methodStr + ")", highlight);
}
@Override
public List<GraphSourceItem> toSource(List<Object> localData, SourceGenerator generator) {
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
return toSourceMerge(localData, generator, urlString, new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(method, false, true));
}
@Override
public boolean hasReturnValue() {
return false;
}
}

View File

@@ -34,9 +34,9 @@ public class MBStringLengthActionItem extends ActionItem {
public String toString(boolean highlight, ConstantPool constants) {
String s = value.toString(highlight, constants);
if (value.precedence > precedence) {
s = "(" + s + ")";
s = hilight("(", highlight) + s + hilight(")", highlight);
}
return hilight("mblength(", highlight) + s + ")";
return hilight("mblength(", highlight) + s + hilight(")", highlight);
}
@Override

View File

@@ -50,7 +50,7 @@ public class NewMethodActionItem extends ActionItem {
String paramStr = "";
for (int t = 0; t < arguments.size(); t++) {
if (t > 0) {
paramStr += ",";
paramStr += hilight(",", highlight);
}
paramStr += arguments.get(t).toString(highlight, constants);
}

View File

@@ -47,7 +47,7 @@ public class NewObjectActionItem extends ActionItem {
String paramStr = "";
for (int t = 0; t < arguments.size(); t++) {
if (t > 0) {
paramStr += ",";
paramStr += hilight(",", highlight);
}
paramStr += arguments.get(t).toString(highlight, constants);
}

View File

@@ -79,9 +79,9 @@ public class SetMemberActionItem extends ActionItem implements SetTypeActionItem
public String toString(boolean highlight, ConstantPool constants) {
if (!((objectName instanceof DirectValueActionItem) && (((DirectValueActionItem) objectName).value instanceof String))) {
//if(!(functionName instanceof GetVariableActionItem))
return object.toString(highlight, constants) + "[" + stripQuotes(objectName, constants, highlight) + "]" + " = " + value.toString(highlight, constants);
return object.toString(highlight, constants) + hilight("[", highlight) + stripQuotes(objectName, constants, highlight) + hilight("]", highlight) + hilight(" = ", highlight) + value.toString(highlight, constants);
}
return object.toString(highlight, constants) + "." + stripQuotes(objectName, constants, highlight) + " = " + value.toString(highlight, constants);
return object.toString(highlight, constants) + hilight(".", highlight) + stripQuotes(objectName, constants, highlight) + hilight(" = ", highlight) + value.toString(highlight, constants);
}
@Override

View File

@@ -32,7 +32,7 @@ public class SetTargetActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("tellTarget(\"", highlight) + Helper.escapeString(target) + hilight("\")", highlight);
return hilight("tellTarget(\"", highlight) + hilight(Helper.escapeString(target), highlight) + hilight("\")", highlight);
}
@Override

View File

@@ -29,7 +29,7 @@ public class StrictModeActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return "StrictMode(" + mode + ");"; //I still don't know how AS source of Strict Mode instruction looks like, assuming this...
return hilight("StrictMode(" + mode + ");", highlight); //I still don't know how AS source of Strict Mode instruction looks like, assuming this...
}
@Override

View File

@@ -37,7 +37,7 @@ public class StringExtractActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return value.toString(highlight, constants) + ".substr(" + index.toString(highlight, constants) + "," + count.toString(highlight, constants) + ")";
return value.toString(highlight, constants) + hilight(".substr(", highlight) + index.toString(highlight, constants) + hilight(",", highlight) + count.toString(highlight, constants) + hilight(")", highlight);
}
@Override

View File

@@ -31,7 +31,7 @@ public class TargetPathActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return "targetPath(" + value.toString(highlight, constants) + ")";
return hilight("targetPath(", highlight) + value.toString(highlight, constants) + hilight(")", highlight);
}
@Override

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SourceGenerator;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author JPEXS
*/
public class UnLoadMovieNumActionItem extends ActionItem {
private GraphTargetItem num;
@Override
public List<GraphTargetItem> getAllSubItems() {
List<GraphTargetItem> ret = new ArrayList<>();
ret.add(num);
return ret;
}
public UnLoadMovieNumActionItem(GraphSourceItem instruction, GraphTargetItem num) {
super(instruction, PRECEDENCE_PRIMARY);
this.num = num;
}
@Override
public String toString(boolean highlight, ConstantPool constants) {
return hilight("unloadMovieNum(", highlight) + hilight("" + num, highlight) + hilight(")", highlight);
}
@Override
public List<GraphSourceItem> toSource(List<Object> localData, SourceGenerator generator) {
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
return toSourceMerge(localData, generator, new ActionPush(""), new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, true, false));
}
@Override
public boolean hasReturnValue() {
return false;
}
}

View File

@@ -29,7 +29,7 @@ public class UnsupportedActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
return "//Unsupported by decompiler:" + value;
return hilight("//Unsupported by decompiler:" + value, highlight);
}
@Override

View File

@@ -166,26 +166,26 @@ public class ClassActionItem extends ActionItem implements Block {
boolean first = true;
for (GraphTargetItem t : implementsOp) {
if (!first) {
ret += ", ";
ret += hilight(", ", highlight);
}
first = false;
ret += Action.getWithoutGlobal(t).toString(highlight, constants);
}
}
ret += "\r\n{\r\n";
ret += "\r\n" + hilight("{", highlight) + "\r\n";
if (constructor != null) {
ret += constructor.toString(highlight, constants) + "\r\n";
}
for (MyEntry<GraphTargetItem, GraphTargetItem> item : vars) {
ret += "var " + item.key.toStringNoQuotes(highlight, constants) + " = " + item.value.toString(highlight, constants) + ";\r\n";
ret += hilight("var ", highlight) + item.key.toStringNoQuotes(highlight, constants) + hilight(" = ", highlight) + item.value.toString(highlight, constants) + hilight(";", highlight) + "\r\n";
}
for (String v : uninitializedVars) {
ret += "var " + v + ";\r\n";
ret += hilight("var ", highlight) + hilight(v, highlight) + hilight(";", highlight) + "\r\n";
}
for (MyEntry<GraphTargetItem, GraphTargetItem> item : staticVars) {
ret += "static var " + item.key.toStringNoQuotes(highlight, constants) + " = " + item.value.toString(highlight, constants) + ";\r\n";
ret += hilight("static var ", highlight) + item.key.toStringNoQuotes(highlight, constants) + hilight(" = ", highlight) + item.value.toString(highlight, constants) + hilight(";", highlight) + "\r\n";
}
@@ -193,10 +193,10 @@ public class ClassActionItem extends ActionItem implements Block {
ret += f.toString(highlight, constants) + "\r\n";
}
for (GraphTargetItem f : staticFunctions) {
ret += "static " + f.toString(highlight, constants) + "\r\n";
ret += hilight("static ", highlight) + f.toString(highlight, constants) + "\r\n";
}
ret += "}\r\n";
ret += hilight("}", highlight) + "\r\n";
return ret;
}

View File

@@ -64,13 +64,13 @@ public class ForInActionItem extends LoopActionItem implements Block {
@Override
public String toString(boolean highlight, ConstantPool constants) {
String ret = "";
ret += "loop" + loop.id + ":\r\n";
ret += hilight("loop" + loop.id + ":", highlight) + "\r\n";
ret += hilight("for(", highlight) + ((variableName instanceof DirectValueActionItem) && (((DirectValueActionItem) variableName).value instanceof RegisterNumber) ? "var " : "") + stripQuotes(variableName, constants, highlight) + " in " + enumVariable.toString(highlight, constants) + ")\r\n{\r\n";
for (GraphTargetItem ti : commands) {
ret += ti.toStringSemicoloned(highlight, constants) + "\r\n";
}
ret += hilight("}", highlight) + "\r\n";
ret += ":loop" + loop.id;
ret += hilight(":loop" + loop.id, highlight);
return ret;
}

View File

@@ -44,19 +44,19 @@ public class InterfaceActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
String ret = "";
ret += "interface " + name.toStringNoQuotes(highlight, constants);
ret += hilight("interface ", highlight) + name.toStringNoQuotes(highlight, constants);
boolean first = true;
if (!superInterfaces.isEmpty()) {
ret += " extends ";
ret += hilight(" extends ", highlight);
}
for (GraphTargetItem ti : superInterfaces) {
if (!first) {
ret += ", ";
ret += hilight(", ", highlight);
}
first = false;
ret += Action.getWithoutGlobal(ti).toStringNoQuotes(highlight, constants);
}
ret += "\r\n{\r\n}\r\n";
ret += "\r\n" + hilight("{", highlight) + "\r\n" + hilight("}", highlight) + "\r\n";
return ret;
}

View File

@@ -39,7 +39,7 @@ public class TellTargetActionItem extends ActionItem {
@Override
public String toString(boolean highlight, ConstantPool constants) {
String ret = hilight("tellTarget(", highlight) + target.toString(highlight, constants) + hilight(")\r\n{\r\n", highlight);
String ret = hilight("tellTarget(", highlight) + target.toString(highlight, constants) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
ret += ti.toString(highlight, constants) + "\r\n";
}

View File

@@ -58,7 +58,7 @@ public class TryActionItem extends ActionItem implements Block {
@Override
public String toString(boolean highlight, ConstantPool constants) {
String ret = "";
ret += "try\r\n{\r\n";
ret += hilight("try", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
List<Object> localData = new ArrayList<>();
localData.add(constants);
for (GraphTargetItem ti : tryCommands) {
@@ -66,25 +66,25 @@ public class TryActionItem extends ActionItem implements Block {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
for (int e = 0; e < catchExceptions.size(); e++) {
ret += "\r\ncatch(" + catchExceptions.get(e).toStringNoQuotes(highlight, localData) + ")\r\n{\r\n";
ret += "\r\n" + hilight("catch(", highlight) + catchExceptions.get(e).toStringNoQuotes(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
List<GraphTargetItem> commands = catchCommands.get(e);
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
}
if (finallyCommands.size() > 0) {
ret += "\r\nfinally\r\n{\r\n";
ret += "\r\n" + hilight("finally", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : finallyCommands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
}
}
ret += "}";
ret += hilight("}", highlight);
}
return ret;
}

View File

@@ -49,7 +49,7 @@ public class WithActionItem extends ActionItem {
String ret;
List<Object> localData = new ArrayList<>();
localData.add(constants);
ret = hilight("with(", highlight) + scope.toString(highlight, localData) + hilight(")\r\n{\r\n", highlight);
ret = hilight("with(", highlight) + scope.toString(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{",highlight) + "\r\n";
for (GraphTargetItem ti : items) {
ret += ti.toString(highlight, localData) + "\r\n";
}

View File

@@ -39,14 +39,14 @@ public class AddActionItem extends BinaryOpItem {
if (rightSide.precedence >= precedence) { //string + vs number +
String ret = "";
if (leftSide.precedence > precedence) {
ret += "(" + leftSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + leftSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += leftSide.toString(highlight, localData);
}
ret += " ";
ret += hilight(operator, highlight);
ret += " ";
ret += "(" + rightSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + rightSide.toString(highlight, localData) + hilight(")", highlight);
return ret;
} else {
return super.toString(highlight, localData);

View File

@@ -40,7 +40,7 @@ public class SubtractActionItem extends BinaryOpItem {
if (rightSide.precedence >= precedence) { // >= add or subtract too
String ret = "";
if (leftSide.precedence > precedence) {
ret += "(" + leftSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + leftSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += leftSide.toString(highlight, localData);
}
@@ -48,7 +48,7 @@ public class SubtractActionItem extends BinaryOpItem {
ret += hilight(operator, highlight);
ret += " ";
ret += "(" + rightSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + rightSide.toString(highlight, localData) + hilight(")", highlight);
return ret;
} else {
return super.toString(highlight, localData);

View File

@@ -33,7 +33,7 @@ public class MarkItem extends GraphTargetItem {
@Override
public String toString(boolean highlight, List<Object> localData) {
return "//decompiler mark:" + mark;
return hilight("//decompiler mark:" + mark, highlight);
}
public String getMark() {

View File

@@ -49,7 +49,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
public String toString(boolean highlight, List<Object> localData) {
String ret = "";
if (leftSide.getPrecedence() > precedence) {
ret += "(" + leftSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + leftSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += leftSide.toString(highlight, localData);
}
@@ -59,7 +59,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
ret += " ";
if (rightSide.getPrecedence() > precedence) {
ret += "(" + rightSide.toString(highlight, localData) + ")";
ret += hilight("(", highlight) + rightSide.toString(highlight, localData) + hilight(")", highlight);
} else {
ret += rightSide.toString(highlight, localData);
}

View File

@@ -37,7 +37,7 @@ public class BlockItem extends GraphTargetItem {
@Override
public String toString(boolean highlight, List<Object> localData) {
return "{\r\n" + Graph.graphToString(commands, highlight, localData) + "\r\n}";
return hilight("{", highlight) + "\r\n" + Graph.graphToString(commands, highlight, localData) + "\r\n" + hilight("}", highlight);
}
@Override

View File

@@ -20,7 +20,7 @@ public class BreakItem extends GraphTargetItem {
@Override
public String toString(boolean highlight, List<Object> localData) {
return hilight("break", highlight) + " " + "loop" + loopId;
return hilight("break", highlight) + " " + hilight("loop" + loopId, highlight);
}
@Override

View File

@@ -51,7 +51,7 @@ public class DoWhileItem extends LoopItem implements Block {
public String toString(boolean highlight, List<Object> localData) {
String ret = "";
ret += "loop" + loop.id + ":\r\n";
ret += hilight("do\r\n{", highlight) + "\r\n";
ret += hilight("do", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";
@@ -67,7 +67,7 @@ public class DoWhileItem extends LoopItem implements Block {
}
expStr += expression.get(i).toString(highlight, localData);
}
ret += hilight("}\r\nwhile(", highlight) + expStr + hilight(");", highlight) + "\r\n";
ret += hilight("}", highlight) + "\r\n" + hilight("while(", highlight) + expStr + hilight(");", highlight) + "\r\n";
ret += ":loop" + loop.id;
return ret;

View File

@@ -86,7 +86,7 @@ public class ForItem extends LoopItem implements Block {
ret += stripSemicolon(finalCommands.get(i).toString(highlight, localData));
p++;
}
ret += hilight(")", highlight) + "\r\n{\r\n";
ret += hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";

View File

@@ -70,7 +70,7 @@ public class IfItem extends GraphTargetItem implements Block {
elseBranch = onTrue;
}
}
ret = hilight("if(", highlight) + expr.toString(highlight, localData) + hilight(")", highlight) + "\r\n{\r\n";
ret = hilight("if(", highlight) + expr.toString(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : ifBranch) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";

View File

@@ -54,7 +54,7 @@ public class SwitchItem extends LoopItem implements Block {
public String toString(boolean highlight, List<Object> localData) {
String ret = "";
ret += "loopswitch" + loop.id + ":\r\n";
ret += hilight("switch(", highlight) + switchedObject.toString(highlight, localData) + hilight(")", highlight) + "\r\n{\r\n";
ret += hilight("switch(", highlight) + switchedObject.toString(highlight, localData) + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (int i = 0; i < caseCommands.size(); i++) {
for (int k = 0; k < valuesMapping.size(); k++) {
if (valuesMapping.get(k) == i) {
@@ -71,7 +71,7 @@ public class SwitchItem extends LoopItem implements Block {
}
if (defaultCommands != null) {
if (defaultCommands.size() > 0) {
ret += hilight("default", highlight) + ":\r\n";
ret += hilight("default", highlight) + hilight(":", highlight) + "\r\n";
ret += Graph.INDENTOPEN + "\r\n";
for (int j = 0; j < defaultCommands.size(); j++) {
if (!defaultCommands.get(j).isEmpty()) {

View File

@@ -56,7 +56,7 @@ public class WhileItem extends LoopItem implements Block {
}
expStr += expression.get(i).toString(highlight, localData);
}
ret += hilight("while(", highlight) + expStr + hilight(")", highlight) + "\r\n{\r\n";
ret += hilight("while(", highlight) + expStr + hilight(")", highlight) + "\r\n" + hilight("{", highlight) + "\r\n";
for (GraphTargetItem ti : commands) {
if (!ti.isEmpty()) {
ret += ti.toStringSemicoloned(highlight, localData) + "\r\n";