From fa48f9478f4bc9b05eb2366ca5bc3463127bc353 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sun, 25 Aug 2013 16:57:22 +0200 Subject: [PATCH] highlights: new lines removed from hilight call, some not highlighted strings are highlighted --- .../abc/avm2/model/ApplyTypeAVM2Item.java | 4 +- .../flash/abc/avm2/model/CallAVM2Item.java | 4 +- .../abc/avm2/model/CallMethodAVM2Item.java | 2 +- .../abc/avm2/model/CallStaticAVM2Item.java | 2 +- .../abc/avm2/model/CallSuperAVM2Item.java | 2 +- .../abc/avm2/model/ConstructAVM2Item.java | 3 +- .../abc/avm2/model/ConstructPropAVM2Item.java | 4 +- .../avm2/model/ConstructSuperAVM2Item.java | 4 +- .../abc/avm2/model/FullMultinameAVM2Item.java | 4 +- .../abc/avm2/model/GetSuperAVM2Item.java | 2 +- .../flash/abc/avm2/model/HasNextAVM2Item.java | 2 +- .../abc/avm2/model/NameSpaceAVM2Item.java | 2 +- .../flash/abc/avm2/model/NameValuePair.java | 2 +- .../abc/avm2/model/NewArrayAVM2Item.java | 2 +- .../avm2/model/NewFunctionAVM2Item.java.orig | 43 +++++++++++ .../abc/avm2/model/NewObjectAVM2Item.java | 2 +- .../abc/avm2/model/NextNameAVM2Item.java | 2 +- .../abc/avm2/model/NextValueAVM2Item.java | 2 +- .../flash/abc/avm2/model/ScriptAVM2Item.java | 2 +- .../flash/abc/avm2/model/ThisAVM2Item.java | 2 +- .../abc/avm2/model/UnparsedAVM2Item.java | 2 +- .../flash/abc/avm2/model/WithAVM2Item.java | 2 +- .../model/clauses/DeclarationAVM2Item.java | 2 +- .../avm2/model/clauses/ExceptionAVM2Item.java | 2 +- .../avm2/model/clauses/ForEachInAVM2Item.java | 6 +- .../abc/avm2/model/clauses/ForInAVM2Item.java | 6 +- .../abc/avm2/model/clauses/TryAVM2Item.java | 12 +-- .../avm2/model/operations/AddAVM2Item.java | 4 +- .../operations/DeletePropertyAVM2Item.java | 2 +- .../model/operations/SubtractAVM2Item.java | 4 +- .../action/model/CallMethodActionItem.java | 2 +- .../action/model/DefineLocalActionItem.java | 4 +- .../model/DefineRegisterActionItem.java | 2 +- .../flash/action/model/DeleteActionItem.java | 2 +- .../action/model/EnumerateActionItem.java | 2 +- .../action/model/FSCommand2ActionItem.java | 2 +- .../model/FSCommandActionItem.java.orig | 52 +++++++++++++ .../action/model/FunctionActionItem.java | 2 +- .../action/model/GetMemberActionItem.java | 4 +- .../flash/action/model/GetURLActionItem.java | 2 +- .../action/model/GotoFrame2ActionItem.java | 2 +- .../action/model/GotoFrameActionItem.java | 2 +- .../action/model/GotoLabelActionItem.java | 2 +- .../action/model/ImplementsOpActionItem.java | 2 +- .../action/model/InitObjectActionItem.java | 2 +- .../LoadVariablesNumActionItem.java.orig | 75 +++++++++++++++++++ .../model/MBStringLengthActionItem.java | 4 +- .../action/model/NewMethodActionItem.java | 2 +- .../action/model/NewObjectActionItem.java | 2 +- .../action/model/SetMemberActionItem.java | 4 +- .../action/model/SetTargetActionItem.java | 2 +- .../action/model/StrictModeActionItem.java | 2 +- .../action/model/StringExtractActionItem.java | 2 +- .../action/model/TargetPathActionItem.java | 2 +- .../model/UnLoadMovieNumActionItem.java.orig | 64 ++++++++++++++++ .../action/model/UnsupportedActionItem.java | 2 +- .../action/model/clauses/ClassActionItem.java | 14 ++-- .../action/model/clauses/ForInActionItem.java | 4 +- .../model/clauses/InterfaceActionItem.java | 8 +- .../model/clauses/TellTargetActionItem.java | 2 +- .../action/model/clauses/TryActionItem.java | 12 +-- .../action/model/clauses/WithActionItem.java | 2 +- .../model/operations/AddActionItem.java | 4 +- .../model/operations/SubtractActionItem.java | 4 +- .../com/jpexs/decompiler/graph/MarkItem.java | 2 +- .../decompiler/graph/model/BinaryOpItem.java | 4 +- .../decompiler/graph/model/BlockItem.java | 2 +- .../decompiler/graph/model/BreakItem.java | 2 +- .../decompiler/graph/model/DoWhileItem.java | 4 +- .../jpexs/decompiler/graph/model/ForItem.java | 2 +- .../jpexs/decompiler/graph/model/IfItem.java | 2 +- .../decompiler/graph/model/SwitchItem.java | 4 +- .../decompiler/graph/model/WhileItem.java | 2 +- 73 files changed, 343 insertions(+), 110 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java.orig create mode 100644 trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java.orig create mode 100644 trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java.orig create mode 100644 trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java.orig diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java index 222b95c60..615d7bb3d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java @@ -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(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallAVM2Item.java index e348401c9..0af9b27ae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallMethodAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallMethodAVM2Item.java index 16ff0b690..4cdfc1b58 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallMethodAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallMethodAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallStaticAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallStaticAVM2Item.java index 78264b12f..031295ec8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallStaticAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallStaticAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallSuperAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallSuperAVM2Item.java index c967f0b9d..4e8f959b1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallSuperAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallSuperAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructAVM2Item.java index 124edda6b..2457a4c42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructAVM2Item.java @@ -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); - } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java index aeff1406e..c1eacce6c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java index d0da2dea4..376190f61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java @@ -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 = ""; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java index 3efa90de9..ddb1df9a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java @@ -77,12 +77,12 @@ public class FullMultinameAVM2Item extends AVM2Item { public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSuperAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSuperAVM2Item.java index a4d5cd0f2..ed503c4d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSuperAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSuperAVM2Item.java @@ -36,7 +36,7 @@ public class GetSuperAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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 = ""; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/HasNextAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/HasNextAVM2Item.java index fa8e09d3c..a880fd3dc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/HasNextAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/HasNextAVM2Item.java @@ -40,6 +40,6 @@ public class HasNextAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameSpaceAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameSpaceAVM2Item.java index 8f36bc6f3..3efa171a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameSpaceAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameSpaceAVM2Item.java @@ -33,7 +33,7 @@ public class NameSpaceAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { if (namespaceIndex == 0) { - return "*"; + return hilight("*", highlight); } return hilight(constants.constant_namespace[namespaceIndex].toString(constants), highlight); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameValuePair.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameValuePair.java index 6baba1f78..a1c7d4c4f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameValuePair.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NameValuePair.java @@ -37,7 +37,7 @@ public class NameValuePair extends AVM2Item { public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java index bd02d7a65..c8daeb43b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java.orig b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java.orig new file mode 100644 index 000000000..fc61430d9 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java.orig @@ -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 . + */ +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 localRegNames, List fullyQualifiedNames) { + return hilight("function" + (!functionName.equals("") ? " " + functionName : "") + "(" + paramStr + "):" + returnStr, highlight) + "\r\n" + hilight("{", highlight) + "\r\n" + hilight(functionBody, highlight) + "\r\n" + hilight("}", highlight); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java index 14832b255..21b7011d5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextNameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextNameAVM2Item.java index 469fbaf21..9c5362068 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextNameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextNameAVM2Item.java @@ -40,6 +40,6 @@ public class NextNameAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextValueAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextValueAVM2Item.java index 1931419f9..38d2d65f6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextValueAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NextValueAVM2Item.java @@ -40,6 +40,6 @@ public class NextValueAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java index 056fa6f5b..64ed2073e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java @@ -35,6 +35,6 @@ public class ScriptAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return "script" + scriptIndex; + return hilight("script" + scriptIndex, highlight); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java index c003380b3..342ef7fe9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java @@ -32,6 +32,6 @@ public class ThisAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return "this"; + return hilight("this", highlight); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UnparsedAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UnparsedAVM2Item.java index 0b1e24a4e..de16c5d07 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UnparsedAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UnparsedAVM2Item.java @@ -32,6 +32,6 @@ public class UnparsedAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return value; + return hilight(value, highlight); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/WithAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/WithAVM2Item.java index 62ad061db..9073b3041 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/WithAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/WithAVM2Item.java @@ -43,7 +43,7 @@ public class WithAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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"; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java index afa898911..52f0f0017 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java @@ -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; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java index 5f07a4d71..a0f0a2d92 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java @@ -33,6 +33,6 @@ public class ExceptionAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return exception.getVarName(constants, fullyQualifiedNames); + return hilight(exception.getVarName(constants, fullyQualifiedNames), highlight); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java index 659153f5a..e0b8f5201 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java @@ -69,15 +69,15 @@ public class ForEachInAVM2Item extends LoopItem implements Block { @Override public String toString(boolean highlight, List 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java index 2efea175e..29efd70b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java @@ -69,15 +69,15 @@ public class ForInAVM2Item extends LoopItem implements Block { @Override public String toString(boolean highlight, List 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java index 87f1ea320..5bb13c167 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java @@ -54,31 +54,31 @@ public class TryAVM2Item extends AVM2Item implements Block { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java index 598e8b8a5..876530414 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java index 38da000e2..8788753b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java @@ -37,6 +37,6 @@ public class DeletePropertyAVM2Item extends AVM2Item { @Override public String toString(boolean highlight, ConstantPool constants, HashMap localRegNames, List 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); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java index 25b472715..23143a5ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java index 0562e9311..d20122b28 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java index da395a41d..a62f249b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineRegisterActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineRegisterActionItem.java index 51623a1a6..73334b920 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineRegisterActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineRegisterActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java index e5b0f8412..3c7206881 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/EnumerateActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/EnumerateActionItem.java index fc6842097..287ca086e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/EnumerateActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/EnumerateActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java index c50f44167..82198d335 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java.orig b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java.orig new file mode 100644 index 000000000..35109a05f --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java.orig @@ -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 . + */ +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 toSource(List localData, SourceGenerator generator) { + return toSourceMerge(localData, generator, new ActionGetURL("FSCommand:" + command, "")); + } + + @Override + public boolean hasReturnValue() { + return false; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index 82d48042d..8dfcadfd1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java index 409b4e1cd..992aa2630 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java index 852f4797a..60e7c3523 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java @@ -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) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java index 82603afb5..8efe173a2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java index 8bf8afd0c..a40cb04ec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java index 205a440ad..9871adca0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ImplementsOpActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ImplementsOpActionItem.java index 9851634df..018a2d9a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ImplementsOpActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ImplementsOpActionItem.java @@ -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)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java index 367ff9164..7d83d4bef 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java @@ -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 } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java.orig b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java.orig new file mode 100644 index 000000000..3c3917cfd --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java.orig @@ -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 . + */ +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 getAllSubItems() { + List 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 toSource(List 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; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java index 774b9633b..95d844021 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java index bfbd8df95..043f2cbba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java index c02dba3b0..f8f25a3f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java @@ -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); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java index 780ab5e7f..bbe551237 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java index 864c9fbec..74a8e11c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StrictModeActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StrictModeActionItem.java index 9f4dcb89b..e927a7324 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StrictModeActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StrictModeActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java index 788c93e83..5899d7f35 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java index 4c23c3dde..0f3d0f262 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java.orig b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java.orig new file mode 100644 index 000000000..23c08e40d --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java.orig @@ -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 . + */ +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 getAllSubItems() { + List 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 toSource(List 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; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java index f35710dee..e71f3f287 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java @@ -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 diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java index e4966597a..abe8bda06 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java @@ -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 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 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java index 48df0332d..f11622eac 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java @@ -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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java index 2603e1ccd..4dab41564 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java @@ -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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java index 4142d1b2d..0b5e7fecc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java @@ -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"; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java index a84ff53f9..ca8bd7c43 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java @@ -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 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 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; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java index 7047f165f..b82b9b941 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java @@ -49,7 +49,7 @@ public class WithActionItem extends ActionItem { String ret; List 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"; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java index 59b4fd14b..5bd922e78 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java index b559ddf8b..7d0760e30 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/graph/MarkItem.java b/trunk/src/com/jpexs/decompiler/graph/MarkItem.java index 3bfb26831..3d2648013 100644 --- a/trunk/src/com/jpexs/decompiler/graph/MarkItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/MarkItem.java @@ -33,7 +33,7 @@ public class MarkItem extends GraphTargetItem { @Override public String toString(boolean highlight, List localData) { - return "//decompiler mark:" + mark; + return hilight("//decompiler mark:" + mark, highlight); } public String getMark() { diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java index 10a19595a..b912ae76f 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java @@ -49,7 +49,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp { public String toString(boolean highlight, List 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); } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java index a2125f051..6eb0204a7 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java @@ -37,7 +37,7 @@ public class BlockItem extends GraphTargetItem { @Override public String toString(boolean highlight, List 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 diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java index 1f4bc70be..78a8cec9e 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java @@ -20,7 +20,7 @@ public class BreakItem extends GraphTargetItem { @Override public String toString(boolean highlight, List localData) { - return hilight("break", highlight) + " " + "loop" + loopId; + return hilight("break", highlight) + " " + hilight("loop" + loopId, highlight); } @Override diff --git a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java index acc33c6d5..74ff1128b 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java @@ -51,7 +51,7 @@ public class DoWhileItem extends LoopItem implements Block { public String toString(boolean highlight, List 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; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java index ed39016b1..645c948f2 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java @@ -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"; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java index 8cdda2185..a87098ead 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java @@ -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"; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java index e82ca593a..4c96db4fa 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java @@ -54,7 +54,7 @@ public class SwitchItem extends LoopItem implements Block { public String toString(boolean highlight, List 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()) { diff --git a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java index 18a244cba..b37029d3d 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java @@ -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";