mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 17:30:46 +00:00
Stack handling improved - no more StackEmptyException
And/Or handling improved Preprocessor instructions introduced - §§pop,§§push...
This commit is contained in:
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -56,9 +57,10 @@ public class AVM2LocalData extends BaseLocalData {
|
||||
|
||||
public ArrayList<ABCException> parsedExceptions;
|
||||
|
||||
public ArrayList<Integer> finallyJumps;
|
||||
public Map<Integer, List<Integer>> finallyJumps;
|
||||
|
||||
public ArrayList<Integer> ignoredSwitches;
|
||||
public Map<Integer, Integer> ignoredSwitches;
|
||||
public List<Integer> ignoredSwitches2;
|
||||
|
||||
public Integer scriptIndex;
|
||||
|
||||
@@ -88,6 +90,7 @@ public class AVM2LocalData extends BaseLocalData {
|
||||
parsedExceptions = localData.parsedExceptions;
|
||||
finallyJumps = localData.finallyJumps;
|
||||
ignoredSwitches = localData.ignoredSwitches;
|
||||
ignoredSwitches2 = localData.ignoredSwitches2;
|
||||
scriptIndex = localData.scriptIndex;
|
||||
localRegAssignmentIps = localData.localRegAssignmentIps;
|
||||
ip = localData.ip;
|
||||
|
||||
@@ -282,6 +282,7 @@ import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.ExitItem;
|
||||
import com.jpexs.decompiler.graph.model.ScriptEndItem;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -1243,8 +1244,8 @@ public class AVM2Code implements Cloneable {
|
||||
if (isKilled(((SetLocalAVM2Item) output.get(i)).regIndex, 0, code.size() - 1)) {
|
||||
SetLocalAVM2Item lsi = (SetLocalAVM2Item) output.get(i);
|
||||
if (i + 1 < output.size()) {
|
||||
if (output.get(i + 1) instanceof ReturnValueAVM2Item) {
|
||||
ReturnValueAVM2Item rv = (ReturnValueAVM2Item) output.get(i + 1);
|
||||
if (output.get(i + 1) instanceof ExitItem) {
|
||||
GraphTargetItem rv = output.get(i + 1);
|
||||
if (rv.value instanceof LocalRegAVM2Item) {
|
||||
LocalRegAVM2Item lr = (LocalRegAVM2Item) rv.value;
|
||||
if (lr.regIndex == lsi.regIndex) {
|
||||
@@ -1442,7 +1443,7 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
}
|
||||
if (!isKilled(reg, 0, end)) {
|
||||
GraphTargetItem vx = stack.pop();
|
||||
GraphTargetItem vx = stack.pop().getThroughDuplicate();
|
||||
int dupCnt = 1;
|
||||
for (int i = ip - 1; i >= start; i--) {
|
||||
if (code.get(i).definition instanceof DupIns) {
|
||||
@@ -1899,6 +1900,7 @@ public class AVM2Code implements Cloneable {
|
||||
ret.parsedExceptions = localData.parsedExceptions;
|
||||
ret.finallyJumps = localData.finallyJumps;
|
||||
ret.ignoredSwitches = localData.ignoredSwitches;
|
||||
ret.ignoredSwitches2 = localData.ignoredSwitches2;
|
||||
ret.scriptIndex = localData.scriptIndex;
|
||||
ret.localRegAssignmentIps = localData.localRegAssignmentIps;
|
||||
ret.ip = localData.ip;
|
||||
@@ -1921,8 +1923,9 @@ public class AVM2Code implements Cloneable {
|
||||
localData.localRegNames = body.getLocalRegNames(abc);
|
||||
localData.fullyQualifiedNames = new ArrayList<>();
|
||||
localData.parsedExceptions = new ArrayList<>();
|
||||
localData.finallyJumps = new ArrayList<>();
|
||||
localData.ignoredSwitches = new ArrayList<>();
|
||||
localData.finallyJumps = new HashMap<>();
|
||||
localData.ignoredSwitches = new HashMap<>();
|
||||
localData.ignoredSwitches2 = new ArrayList<>();
|
||||
localData.scriptIndex = scriptIndex;
|
||||
localData.localRegAssignmentIps = new HashMap<>();
|
||||
localData.ip = 0;
|
||||
@@ -2958,7 +2961,7 @@ public class AVM2Code implements Cloneable {
|
||||
|
||||
public static int removeTraps(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, AVM2LocalData localData, AVM2GraphSource code, int addr, String path, HashMap<Integer, List<Integer>> refs) throws InterruptedException {
|
||||
HashMap<AVM2Instruction, AVM2Code.Decision> decisions = new HashMap<>();
|
||||
removeTraps(refs, false, false, localData, new TranslateStack(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path, 0);
|
||||
removeTraps(refs, false, false, localData, new TranslateStack(path), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path, 0);
|
||||
int cnt = 0;
|
||||
for (AVM2Instruction src : decisions.keySet()) {
|
||||
Decision dec = decisions.get(src);
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.InAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NextNameAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NextValueAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item;
|
||||
@@ -69,6 +70,8 @@ import com.jpexs.decompiler.graph.model.ExitItem;
|
||||
import com.jpexs.decompiler.graph.model.IfItem;
|
||||
import com.jpexs.decompiler.graph.model.LoopItem;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import com.jpexs.decompiler.graph.model.PopItem;
|
||||
import com.jpexs.decompiler.graph.model.PushItem;
|
||||
import com.jpexs.decompiler.graph.model.SwitchItem;
|
||||
import com.jpexs.decompiler.graph.model.WhileItem;
|
||||
import java.util.ArrayList;
|
||||
@@ -76,6 +79,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -124,8 +128,9 @@ public class AVM2Graph extends Graph {
|
||||
localData.localRegNames = localRegNames;
|
||||
localData.fullyQualifiedNames = fullyQualifiedNames;
|
||||
localData.parsedExceptions = new ArrayList<>();
|
||||
localData.finallyJumps = new ArrayList<>();
|
||||
localData.ignoredSwitches = new ArrayList<>();
|
||||
localData.finallyJumps = new HashMap<>();
|
||||
localData.ignoredSwitches = new HashMap<>();
|
||||
localData.ignoredSwitches2 = new ArrayList<>();
|
||||
localData.scriptIndex = scriptIndex;
|
||||
localData.localRegAssignmentIps = new HashMap<>();
|
||||
localData.ip = 0;
|
||||
@@ -159,26 +164,6 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*for(ABCException ex:body.exceptions){
|
||||
for(GraphPart p:allBlocks){
|
||||
boolean next_is_ex_start=false;
|
||||
for(GraphPart n:p.nextParts){
|
||||
if(n.start==code.adr2pos(ex.start)){
|
||||
next_is_ex_start = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(next_is_ex_start){
|
||||
for(GraphPart q:allBlocks){ //find target part
|
||||
if(q.start==code.adr2pos(ex.target)){
|
||||
p.nextParts.add(q);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,11 +172,13 @@ public class AVM2Graph extends Graph {
|
||||
|
||||
AVM2LocalData aLocalData = (AVM2LocalData) localData;
|
||||
List<ABCException> parsedExceptions = aLocalData.parsedExceptions;
|
||||
List<Integer> finallyJumps = aLocalData.finallyJumps;
|
||||
List<Integer> ignoredSwitches = aLocalData.ignoredSwitches;
|
||||
Map<Integer, List<Integer>> finallyJumps = aLocalData.finallyJumps;
|
||||
Map<Integer, Integer> ignoredSwitches = aLocalData.ignoredSwitches;
|
||||
List<Integer> ignoredSwitches2 = aLocalData.ignoredSwitches2;
|
||||
int ip = part.start;
|
||||
int addr = this.avm2code.fixAddrAfterDebugLine(this.avm2code.pos2adr(part.start));
|
||||
int maxend = -1;
|
||||
List<Integer> catchedFinallys = new ArrayList<>();
|
||||
List<ABCException> catchedExceptions = new ArrayList<>();
|
||||
for (int e = 0; e < body.exceptions.length; e++) {
|
||||
if (addr == this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
|
||||
@@ -200,11 +187,13 @@ public class AVM2Graph extends Graph {
|
||||
if (!parsedExceptions.contains(body.exceptions[e])) {
|
||||
if (((body.exceptions[e].end) > maxend)) {
|
||||
catchedExceptions.clear();
|
||||
catchedFinallys.clear();
|
||||
maxend = this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end);
|
||||
catchedExceptions.add(body.exceptions[e]);
|
||||
} else if (this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
|
||||
catchedExceptions.add(body.exceptions[e]);
|
||||
}
|
||||
catchedFinallys.add(e);
|
||||
|
||||
}
|
||||
} else if (body.exceptions[e].isFinally()) {
|
||||
@@ -233,14 +222,16 @@ public class AVM2Graph extends Graph {
|
||||
List<GraphTargetItem> finallyCommands = new ArrayList<>();
|
||||
boolean hasFinally = false;
|
||||
int returnPos = afterCatchPos;
|
||||
int finStart = -1;
|
||||
for (int e = 0; e < body.exceptions.length; e++) {
|
||||
if (body.exceptions[e].isFinally()) {
|
||||
if (addr == this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
|
||||
if (afterCatchPos + 1 == code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
|
||||
catchedFinallys.add(e);
|
||||
AVM2Instruction jmpIns = this.avm2code.code.get(code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end)));
|
||||
|
||||
if (jmpIns.definition instanceof JumpIns) {
|
||||
int finStart = code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
|
||||
finStart = code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
|
||||
|
||||
GraphPart fpart = null;
|
||||
for (GraphPart p : allParts) {
|
||||
@@ -249,6 +240,8 @@ public class AVM2Graph extends Graph {
|
||||
break;
|
||||
}
|
||||
}
|
||||
TranslateStack st = (TranslateStack) stack.clone();
|
||||
st.clear();
|
||||
int swPos = -1;
|
||||
for (int f = finStart; f < this.avm2code.code.size(); f++) {
|
||||
if (this.avm2code.code.get(f).definition instanceof LookupSwitchIns) {
|
||||
@@ -256,7 +249,7 @@ public class AVM2Graph extends Graph {
|
||||
if (swins.operands.length >= 3) {
|
||||
if (swins.operands[0] == swins.getBytes().length) {
|
||||
if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) {
|
||||
stack.push(new ExceptionAVM2Item(body.exceptions[e]));
|
||||
//st.push(new ExceptionAVM2Item(body.exceptions[e]));
|
||||
GraphPart fepart = null;
|
||||
for (GraphPart p : allParts) {
|
||||
if (p.start == f + 1) {
|
||||
@@ -280,13 +273,17 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
//ignoredSwitches.add(-1);
|
||||
//int igs_size=ignoredSwitches.size();
|
||||
List<Integer> oldFinallyJumps = new ArrayList<>(finallyJumps);
|
||||
Map<Integer, List<Integer>> oldFinallyJumps = new HashMap<>(finallyJumps);
|
||||
finallyJumps.clear();
|
||||
ignoredSwitches.add(swPos);
|
||||
finallyCommands = printGraph(localData, stack, allParts, parent, fpart, null, loops, staticOperation, path);
|
||||
ignoredSwitches.put(e, swPos);
|
||||
st.push(new PopItem(null));
|
||||
finallyCommands = printGraph(localData, st, allParts, parent, fpart, null, loops, staticOperation, path);
|
||||
//ignoredSwitches.remove(igs_size-1);
|
||||
finallyJumps.addAll(oldFinallyJumps);
|
||||
finallyJumps.add(finStart);
|
||||
finallyJumps.putAll(oldFinallyJumps);
|
||||
if (!finallyJumps.containsKey(e)) {
|
||||
finallyJumps.put(e, new ArrayList<>());
|
||||
}
|
||||
finallyJumps.get(e).add(finStart);
|
||||
hasFinally = true;
|
||||
break;
|
||||
}
|
||||
@@ -328,7 +325,9 @@ public class AVM2Graph extends Graph {
|
||||
break;
|
||||
}
|
||||
}
|
||||
stack.add(new ExceptionAVM2Item(catchedExceptions.get(e)));
|
||||
TranslateStack st2 = (TranslateStack) stack.clone();
|
||||
st2.clear();
|
||||
st2.add(new ExceptionAVM2Item(catchedExceptions.get(e)));
|
||||
AVM2LocalData localData2 = new AVM2LocalData(aLocalData);
|
||||
localData2.scopeStack = new ScopeStack();
|
||||
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
@@ -336,16 +335,18 @@ public class AVM2Graph extends Graph {
|
||||
if (retPart != null) {
|
||||
stopPart2.add(retPart);
|
||||
}
|
||||
List<GraphTargetItem> ncatchedCommands = printGraph(localData2, stack, allParts, parent, npart, stopPart2, loops, staticOperation, path);
|
||||
|
||||
List<GraphTargetItem> ncatchedCommands = printGraph(localData2, st2, allParts, parent, npart, stopPart2, loops, staticOperation, path);
|
||||
if (catchedExceptions.get(e).isFinally() && (catchedExceptions.size() > 1 || hasFinally)) {
|
||||
catchedExceptions.remove(e);
|
||||
e--;
|
||||
} else {
|
||||
catchedCommands.add(ncatchedCommands);
|
||||
if (retPart != null && avm2code.code.get(retPart.start).isExit() && !(!ncatchedCommands.isEmpty() && (ncatchedCommands.get(ncatchedCommands.size() - 1) instanceof ExitItem))) {
|
||||
avm2code.code.get(retPart.start).translate(localData, stack, ncatchedCommands, staticOperation, path);
|
||||
avm2code.code.get(retPart.start).translate(localData, st2, ncatchedCommands, staticOperation, path);
|
||||
}
|
||||
if (catchedExceptions.get(e).isFinally()) {
|
||||
//endposStartBlock = -1;
|
||||
if (!ncatchedCommands.isEmpty() && (ncatchedCommands.get(0) instanceof SetLocalAVM2Item)) {
|
||||
SetLocalAVM2Item sl = (SetLocalAVM2Item) ncatchedCommands.get(0);
|
||||
if (sl.value.getNotCoerced() instanceof ExceptionAVM2Item) {
|
||||
@@ -364,19 +365,31 @@ public class AVM2Graph extends Graph {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
stopPart2.add(nepart);
|
||||
List<GraphPart> stopPart2 = new ArrayList<>();//stopPart);
|
||||
if (nepart != null) {
|
||||
stopPart2.add(nepart);
|
||||
}
|
||||
stopPart2.addAll(catchParts);
|
||||
|
||||
if (retPart != null) {
|
||||
stopPart2.add(retPart);
|
||||
}
|
||||
List<GraphTargetItem> tryCommands = printGraph(localData, stack, allParts, parent, part, stopPart2, loops, staticOperation, path);
|
||||
TranslateStack st = (TranslateStack) stack.clone();
|
||||
st.clear();
|
||||
List<GraphTargetItem> tryCommands = printGraph(localData, st, allParts, parent, part, stopPart2, loops, staticOperation, path);
|
||||
if (retPart != null && avm2code.code.get(retPart.start).isExit() && !(!tryCommands.isEmpty() && (tryCommands.get(tryCommands.size() - 1) instanceof ExitItem))) {
|
||||
avm2code.code.get(retPart.start).translate(localData, stack, tryCommands, staticOperation, path);
|
||||
avm2code.code.get(retPart.start).translate(localData, st, tryCommands, staticOperation, path);
|
||||
}
|
||||
output.clear();
|
||||
stack.clear();
|
||||
output.add(new TryAVM2Item(tryCommands, catchedExceptions, catchedCommands, finallyCommands, finCatchName));
|
||||
finallyJumps = ((AVM2LocalData) localData).finallyJumps;
|
||||
for (int fin_e : catchedFinallys) {
|
||||
if (finallyJumps.containsKey(fin_e)) {
|
||||
finallyJumps.get(fin_e).clear();
|
||||
}
|
||||
//.remove((Integer) finStart);
|
||||
}
|
||||
ip = returnPos;
|
||||
}
|
||||
|
||||
@@ -397,7 +410,10 @@ public class AVM2Graph extends Graph {
|
||||
ret.addAll(output);
|
||||
GraphTargetItem lop = checkLoop(part, stopPart, loops);
|
||||
if (lop == null) {
|
||||
ret.addAll(printGraph(localData, stack, allParts, null, part, stopPart, loops, staticOperation, path));
|
||||
TranslateStack st = (TranslateStack) stack.clone();
|
||||
st.clear();
|
||||
|
||||
ret.addAll(printGraph(localData, st, allParts, null, part, stopPart, loops, staticOperation, path));
|
||||
} else {
|
||||
ret.add(lop);
|
||||
}
|
||||
@@ -423,7 +439,7 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((this.avm2code.code.get(part.end).definition instanceof LookupSwitchIns) && ignoredSwitches.contains(part.end)) {
|
||||
if ((this.avm2code.code.get(part.end).definition instanceof LookupSwitchIns) && (ignoredSwitches.containsValue(part.end) || ignoredSwitches2.contains(part.end))) {
|
||||
ret = new ArrayList<>();
|
||||
ret.addAll(output);
|
||||
return ret;
|
||||
@@ -444,9 +460,9 @@ public class AVM2Graph extends Graph {
|
||||
&& (this.avm2code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
|
||||
|
||||
if (stack.peek() instanceof StrictEqAVM2Item) {
|
||||
ignoredSwitches.add(part.nextParts.get(0).nextParts.get(0).end);
|
||||
ignoredSwitches2.add(part.nextParts.get(0).nextParts.get(0).end);
|
||||
} else {
|
||||
ignoredSwitches.add(part.nextParts.get(1).nextParts.get(0).end);
|
||||
ignoredSwitches2.add(part.nextParts.get(1).nextParts.get(0).end);
|
||||
}
|
||||
ret = new ArrayList<>();
|
||||
ret.addAll(output);
|
||||
@@ -494,7 +510,7 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
GraphPart numPart = part.nextParts.get(reversed ? 0 : 1);
|
||||
AVM2Instruction ins = null;
|
||||
TranslateStack sstack = new TranslateStack();
|
||||
TranslateStack sstack = new TranslateStack(path);
|
||||
do {
|
||||
for (int n = 0; n < numPart.getHeight(); n++) {
|
||||
ins = this.avm2code.code.get(numPart.getPosAt(n));
|
||||
@@ -535,7 +551,7 @@ public class AVM2Graph extends Graph {
|
||||
|
||||
GraphPart numPart = dp;
|
||||
AVM2Instruction ins = null;
|
||||
TranslateStack sstack = new TranslateStack();
|
||||
TranslateStack sstack = new TranslateStack(path);
|
||||
do {
|
||||
for (int n = 0; n < numPart.getHeight(); n++) {
|
||||
ins = this.avm2code.code.get(numPart.getPosAt(n));
|
||||
@@ -636,33 +652,34 @@ public class AVM2Graph extends Graph {
|
||||
@Override
|
||||
protected GraphPart checkPart(TranslateStack stack, BaseLocalData localData, GraphPart next, List<GraphPart> allParts) {
|
||||
AVM2LocalData aLocalData = (AVM2LocalData) localData;
|
||||
List<Integer> finallyJumps = aLocalData.finallyJumps;
|
||||
List<Integer> ignoredSwitches = aLocalData.ignoredSwitches;
|
||||
Map<Integer, List<Integer>> finallyJumps = aLocalData.finallyJumps;
|
||||
Map<Integer, Integer> ignoredSwitches = aLocalData.ignoredSwitches;
|
||||
GraphPart ret = next;
|
||||
for (int f = 0; f < finallyJumps.size(); f++) {
|
||||
int fip = finallyJumps.get(f);
|
||||
for (int f : finallyJumps.keySet()) {//int f = 0; f < finallyJumps.size(); f++) {
|
||||
int swip = ignoredSwitches.get(f);
|
||||
if (next.start == fip) {
|
||||
if (stack != null && swip != -1) {
|
||||
AVM2Instruction swIns = avm2code.code.get(swip);
|
||||
GraphTargetItem t = stack.pop();
|
||||
Double dval = EcmaScript.toNumber(t.getResult());
|
||||
int val = (int) (double) dval;
|
||||
if (swIns.definition instanceof LookupSwitchIns) {
|
||||
List<Integer> branches = swIns.getBranches(code);
|
||||
int nip = branches.get(0);
|
||||
if (val >= 0 && val < branches.size() - 1) {
|
||||
nip = branches.get(1 + val);
|
||||
}
|
||||
for (GraphPart p : allParts) {
|
||||
if (avm2code.fixIPAfterDebugLine(p.start) == avm2code.fixIPAfterDebugLine(nip)) {
|
||||
return p;
|
||||
for (int fip : finallyJumps.get(f)) {
|
||||
if (next.start == fip) {
|
||||
if (stack != null && swip != -1) {
|
||||
AVM2Instruction swIns = avm2code.code.get(swip);
|
||||
GraphTargetItem t = stack.pop();
|
||||
Double dval = EcmaScript.toNumber(t.getResult());
|
||||
int val = (int) (double) dval;
|
||||
if (swIns.definition instanceof LookupSwitchIns) {
|
||||
List<Integer> branches = swIns.getBranches(code);
|
||||
int nip = branches.get(0);
|
||||
if (val >= 0 && val < branches.size() - 1) {
|
||||
nip = branches.get(1 + val);
|
||||
}
|
||||
for (GraphPart p : allParts) {
|
||||
if (avm2code.fixIPAfterDebugLine(p.start) == avm2code.fixIPAfterDebugLine(nip)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
ret = null;
|
||||
}
|
||||
ret = null;
|
||||
}
|
||||
ret = null;
|
||||
}
|
||||
ret = null;
|
||||
}
|
||||
}
|
||||
if (ret != next) {
|
||||
@@ -678,8 +695,14 @@ public class AVM2Graph extends Graph {
|
||||
AVM2Instruction jmpIns = this.avm2code.code.get(avm2code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end)));
|
||||
if (jmpIns.definition instanceof JumpIns) {
|
||||
int finStart = avm2code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
|
||||
finallyJumps.add(finStart);
|
||||
ignoredSwitches.add(-1);
|
||||
if (!finallyJumps.containsKey(e)) {
|
||||
finallyJumps.put(e, new ArrayList<>());
|
||||
}
|
||||
finallyJumps.get(e).add(finStart);
|
||||
if (!ignoredSwitches.containsKey(e)) {
|
||||
ignoredSwitches.put(e, -1);
|
||||
}
|
||||
//ignoredSwitches.put(e, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -707,7 +730,11 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
GraphTargetItem ft = w.commands.get(pos);
|
||||
if (ft instanceof WithAVM2Item) {
|
||||
ft = w.commands.get(pos + 1);
|
||||
pos++;
|
||||
while (w.commands.get(pos) instanceof SetTypeAVM2Item) {
|
||||
pos++;
|
||||
}
|
||||
ft = w.commands.get(pos);
|
||||
if (ft instanceof IfItem) {
|
||||
IfItem ift = (IfItem) ft;
|
||||
if (ift.onTrue.size() > 0) {
|
||||
@@ -759,7 +786,7 @@ public class AVM2Graph extends Graph {
|
||||
|
||||
@Override
|
||||
protected void finalProcess(List<GraphTargetItem> list, int level, FinalProcessLocalData localData) {
|
||||
super.finalProcess(list, level, localData);
|
||||
|
||||
if (level == 0) {
|
||||
if (!list.isEmpty()) {
|
||||
if (list.get(list.size() - 1) instanceof ReturnVoidAVM2Item) {
|
||||
@@ -864,6 +891,8 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
}
|
||||
//Handle for loops at the end:
|
||||
super.finalProcess(list, level, localData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+49
-49
@@ -1,49 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class NotIns extends InstructionDefinition {
|
||||
|
||||
public NotIns() {
|
||||
super(0x96, "not", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(new NotItem(ins, v));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1 + 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class NotIns extends InstructionDefinition {
|
||||
|
||||
public NotIns() {
|
||||
super(0x96, "not", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(v.invert(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+57
-56
@@ -1,56 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
|
||||
|
||||
public IfFalseIns() {
|
||||
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new NotItem(ins, v1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
//String v1 = stack.pop().toString();
|
||||
//stack.push("(" + v1 + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
|
||||
|
||||
public IfFalseIns() {
|
||||
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
//stack.push(new NotItem(ins, v1));
|
||||
stack.push(v1.invert(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
//String v1 = stack.pop().toString();
|
||||
//stack.push("(" + v1 + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
+56
-56
@@ -1,56 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
|
||||
|
||||
public IfTrueIns() {
|
||||
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
//String v1 = stack.pop().toString();
|
||||
//stack.push("(" + v1 + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new NotItem(ins, v1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
|
||||
|
||||
public IfTrueIns() {
|
||||
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
//String v1 = stack.pop().toString();
|
||||
//stack.push("(" + v1 + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(v1.invert(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
+134
-134
@@ -1,134 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
public abstract class SetLocalTypeIns extends InstructionDefinition implements SetTypeIns {
|
||||
|
||||
public SetLocalTypeIns(int instructionCode, String instructionName, int[] operands, boolean canThrow) {
|
||||
super(instructionCode, instructionName, operands, canThrow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
int regId = getRegisterId(ins);
|
||||
GraphTargetItem value = stack.pop();
|
||||
/*if (localRegs.containsKey(regId)) {
|
||||
localRegs.put(regId, new NotCompileTimeAVM2Item(ins, value));
|
||||
} else {
|
||||
localRegs.put(regId, value);
|
||||
}*/
|
||||
localRegs.put(regId, value);
|
||||
if (!regAssignCount.containsKey(regId)) {
|
||||
regAssignCount.put(regId, 0);
|
||||
}
|
||||
regAssignCount.put(regId, regAssignCount.get(regId) + 1);
|
||||
//localRegsAssignmentIps.put(regId, ip);
|
||||
if (value instanceof NewActivationAVM2Item) {
|
||||
return;
|
||||
}
|
||||
if (value instanceof FindPropertyAVM2Item) {
|
||||
return;
|
||||
}
|
||||
if (value.getNotCoerced() instanceof IncrementAVM2Item) {
|
||||
GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
|
||||
if (inside instanceof LocalRegAVM2Item) {
|
||||
if (((LocalRegAVM2Item) inside).regIndex == regId) {
|
||||
if (stack.size() > 0) {
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostIncrementAVM2Item(ins, inside));
|
||||
} else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreIncrementAVM2Item(ins, inside));
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value.getNotCoerced() instanceof DecrementAVM2Item) {
|
||||
GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
|
||||
if (inside instanceof LocalRegAVM2Item) {
|
||||
if (((LocalRegAVM2Item) inside).regIndex == regId) {
|
||||
if (stack.size() > 0) {
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostDecrementAVM2Item(ins, inside));
|
||||
} else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreDecrementAVM2Item(ins, inside));
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if(val.startsWith("catchscope ")) return;
|
||||
//if(val.startsWith("newactivation()")) return;
|
||||
output.add(new SetLocalAVM2Item(ins, regId, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return AVM2Item.localRegName(localRegNames, getRegisterId(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public abstract int getRegisterId(AVM2Instruction ins);
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
public abstract class SetLocalTypeIns extends InstructionDefinition implements SetTypeIns {
|
||||
|
||||
public SetLocalTypeIns(int instructionCode, String instructionName, int[] operands, boolean canThrow) {
|
||||
super(instructionCode, instructionName, operands, canThrow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
int regId = getRegisterId(ins);
|
||||
GraphTargetItem value = stack.pop();
|
||||
/*if (localRegs.containsKey(regId)) {
|
||||
localRegs.put(regId, new NotCompileTimeAVM2Item(ins, value));
|
||||
} else {
|
||||
localRegs.put(regId, value);
|
||||
}*/
|
||||
localRegs.put(regId, value);
|
||||
if (!regAssignCount.containsKey(regId)) {
|
||||
regAssignCount.put(regId, 0);
|
||||
}
|
||||
regAssignCount.put(regId, regAssignCount.get(regId) + 1);
|
||||
//localRegsAssignmentIps.put(regId, ip);
|
||||
if (value.getThroughDuplicate() instanceof NewActivationAVM2Item) {
|
||||
return;
|
||||
}
|
||||
if (value instanceof FindPropertyAVM2Item) {
|
||||
return;
|
||||
}
|
||||
if (value.getNotCoerced() instanceof IncrementAVM2Item) {
|
||||
GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
|
||||
if (inside instanceof LocalRegAVM2Item) {
|
||||
if (((LocalRegAVM2Item) inside).regIndex == regId) {
|
||||
if (stack.size() > 0) {
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostIncrementAVM2Item(ins, inside));
|
||||
} else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreIncrementAVM2Item(ins, inside));
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value.getNotCoerced() instanceof DecrementAVM2Item) {
|
||||
GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
|
||||
if (inside instanceof LocalRegAVM2Item) {
|
||||
if (((LocalRegAVM2Item) inside).regIndex == regId) {
|
||||
if (stack.size() > 0) {
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostDecrementAVM2Item(ins, inside));
|
||||
} else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreDecrementAVM2Item(ins, inside));
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if(val.startsWith("catchscope ")) return;
|
||||
//if(val.startsWith("newactivation()")) return;
|
||||
output.add(new SetLocalAVM2Item(ins, regId, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return AVM2Item.localRegName(localRegNames, getRegisterId(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public abstract int getRegisterId(AVM2Instruction ins);
|
||||
}
|
||||
|
||||
+1
-3
@@ -156,9 +156,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (slotname == null) {
|
||||
System.err.println("SLOT NOT FOUND");
|
||||
}
|
||||
|
||||
output.add(new SetSlotAVM2Item(ins, obj, slotname, value));
|
||||
}
|
||||
|
||||
|
||||
+3
-7
@@ -45,13 +45,9 @@ public class PopIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
if (stack.size() > 0) {
|
||||
GraphTargetItem top = stack.pop();
|
||||
//Note: Commands like "5;" - numbers are unsupported as it collide with try..finally block decompilation. TODO: allow this somehow
|
||||
|
||||
if (/*!(top instanceof IntegerValueAVM2Item) &&*/(!(top instanceof MarkItem))) {
|
||||
output.add(top);
|
||||
}
|
||||
GraphTargetItem top = stack.pop();
|
||||
if ((!(top instanceof MarkItem))) {
|
||||
output.add(top);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+55
-54
@@ -1,54 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.stack;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PushFalseIns extends InstructionDefinition {
|
||||
|
||||
public PushFalseIns() {
|
||||
super(0x27, "pushfalse", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, AVM2ConstantPool constants, List<Object> arguments) {
|
||||
lda.operandStack.push(Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
stack.push(new BooleanAVM2Item(ins, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.stack;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.FalseItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PushFalseIns extends InstructionDefinition {
|
||||
|
||||
public PushFalseIns() {
|
||||
super(0x27, "pushfalse", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, AVM2ConstantPool constants, List<Object> arguments) {
|
||||
lda.operandStack.push(Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
stack.push(new FalseItem(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+55
-54
@@ -1,54 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.stack;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PushTrueIns extends InstructionDefinition {
|
||||
|
||||
public PushTrueIns() {
|
||||
super(0x26, "pushtrue", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, AVM2ConstantPool constants, List<Object> arguments) {
|
||||
lda.operandStack.push(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
stack.push(new BooleanAVM2Item(ins, Boolean.TRUE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.stack;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.TrueItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PushTrueIns extends InstructionDefinition {
|
||||
|
||||
public PushTrueIns() {
|
||||
super(0x26, "pushtrue", new int[]{}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, AVM2ConstantPool constants, List<Object> arguments) {
|
||||
lda.operandStack.push(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
|
||||
stack.push(new TrueItem(ins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ public class HasNextAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
collection.toString(writer, localData);
|
||||
collection.appendTo(writer, localData);
|
||||
writer.append(" hasNext ");
|
||||
return object.toString(writer, localData);
|
||||
return object.appendTo(writer, localData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-4
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -25,6 +26,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SimpleValue;
|
||||
import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
@@ -78,4 +80,5 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item {
|
||||
public boolean hasReturnValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
@@ -32,7 +33,7 @@ public class NewActivationAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
return writer.append("newactivation()");
|
||||
return writer.append("§§activation");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-5
@@ -1,25 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.graph.SimpleValue;
|
||||
|
||||
public abstract class NumberValueAVM2Item extends AVM2Item {
|
||||
public abstract class NumberValueAVM2Item extends AVM2Item implements SimpleValue {
|
||||
|
||||
public NumberValueAVM2Item(AVM2Instruction instruction) {
|
||||
super(instruction, PRECEDENCE_PRIMARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimpleValue() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assign
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
srcData.localName = slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
srcData.localName = slotName == null ? "/*UnknownSlot*/" : slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
getName(writer, localData);
|
||||
writer.append(" = ");
|
||||
return value.toString(writer, localData);
|
||||
}
|
||||
|
||||
public String getNameAsStr(LocalData localData) {
|
||||
return slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
return slotName == null ? "/*UnknownSlot*/" : slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
}
|
||||
|
||||
public GraphTextWriter getName(GraphTextWriter writer, LocalData localData) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SimpleValue;
|
||||
import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
@@ -31,7 +32,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class StringAVM2Item extends AVM2Item {
|
||||
public class StringAVM2Item extends AVM2Item implements SimpleValue {
|
||||
|
||||
public String value;
|
||||
|
||||
@@ -71,4 +72,9 @@ public class StringAVM2Item extends AVM2Item {
|
||||
public boolean hasReturnValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimpleValue() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -53,7 +54,7 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new NeqAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -48,7 +49,7 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new LtAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -48,7 +49,7 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new LeAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -48,7 +49,7 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new GtAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -48,7 +49,7 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new GeAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -54,7 +55,7 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new EqAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -56,7 +57,7 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new StrictNeqAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -49,7 +50,7 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
public GraphTargetItem invert(GraphSourceItem neqSrc) {
|
||||
return new StrictEqAVM2Item(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -57,9 +57,11 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.DupIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopScopeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushByteIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushFalseIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNullIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushScopeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushStringIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushTrueIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushUndefinedIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushWithIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.SwapIns;
|
||||
@@ -103,7 +105,6 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitFunction;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
@@ -118,6 +119,7 @@ import com.jpexs.decompiler.graph.model.CommaExpressionItem;
|
||||
import com.jpexs.decompiler.graph.model.ContinueItem;
|
||||
import com.jpexs.decompiler.graph.model.DoWhileItem;
|
||||
import com.jpexs.decompiler.graph.model.DuplicateItem;
|
||||
import com.jpexs.decompiler.graph.model.FalseItem;
|
||||
import com.jpexs.decompiler.graph.model.ForItem;
|
||||
import com.jpexs.decompiler.graph.model.IfItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
@@ -125,6 +127,7 @@ import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import com.jpexs.decompiler.graph.model.OrItem;
|
||||
import com.jpexs.decompiler.graph.model.SwitchItem;
|
||||
import com.jpexs.decompiler.graph.model.TernarOpItem;
|
||||
import com.jpexs.decompiler.graph.model.TrueItem;
|
||||
import com.jpexs.decompiler.graph.model.UnboundedTypeItem;
|
||||
import com.jpexs.decompiler.graph.model.WhileItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -161,6 +164,16 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return new AVM2Instruction(0, def, operands);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, FalseItem item) throws CompilationException {
|
||||
return GraphTargetItem.toSourceMerge(localData, this, ins(new PushFalseIns()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, TrueItem item) throws CompilationException {
|
||||
return GraphTargetItem.toSourceMerge(localData, this, ins(new PushTrueIns()));
|
||||
}
|
||||
|
||||
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, GetDescendantsAVM2Item item) throws CompilationException {
|
||||
int[] nssa = new int[item.openedNamespaces.size()];
|
||||
for (int i = 0; i < item.openedNamespaces.size(); i++) {
|
||||
|
||||
+2128
-2344
File diff suppressed because it is too large
Load Diff
+7
-5
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
*/
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
/**
|
||||
@@ -32,5 +33,6 @@ public enum SymbolGroup {
|
||||
TYPENAME,
|
||||
EOF,
|
||||
//GLOBALFUNC,
|
||||
GLOBALCONST
|
||||
GLOBALCONST,
|
||||
PREPROCESSOR
|
||||
}
|
||||
|
||||
+243
-242
@@ -1,242 +1,243 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum SymbolType {
|
||||
//Keywords
|
||||
|
||||
BREAK,
|
||||
CASE,
|
||||
CONTINUE,
|
||||
DEFAULT,
|
||||
DO,
|
||||
WHILE,
|
||||
ELSE,
|
||||
FOR,
|
||||
EACH,
|
||||
IN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
IF,
|
||||
RETURN,
|
||||
SUPER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SWITCH,
|
||||
THROW,
|
||||
TRY,
|
||||
CATCH,
|
||||
FINALLY,
|
||||
WITH,
|
||||
DYNAMIC,
|
||||
INTERNAL,
|
||||
OVERRIDE,
|
||||
PRIVATE,
|
||||
PROTECTED,
|
||||
PUBLIC,
|
||||
STATIC,
|
||||
CLASS,
|
||||
CONST,
|
||||
EXTENDS,
|
||||
FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
GET,
|
||||
IMPLEMENTS,
|
||||
INTERFACE,
|
||||
NAMESPACE,
|
||||
PACKAGE,
|
||||
SET,
|
||||
VAR,
|
||||
IMPORT,
|
||||
USE,
|
||||
FALSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NULL(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
THIS(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TRUE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//Operators
|
||||
PARENT_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
PARENT_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
CURLY_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
CURLY_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
BRACKET_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
BRACKET_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SEMICOLON,
|
||||
COMMA(GraphTargetItem.PRECEDENCE_COMMA, false),
|
||||
REST,
|
||||
DOT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
ASSIGN(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
GREATER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
LOWER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NOT(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
NEGATE(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
TERNAR(GraphTargetItem.PRECEDENCE_CONDITIONAL, true, true), /*!! ternar !!!*/
|
||||
COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL, false),/*!! ternar !!!*/
|
||||
EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
STRICT_EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
LOWER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
GREATER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
STRICT_NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
AND(GraphTargetItem.PRECEDENCE_LOGICALAND, true),
|
||||
OR(GraphTargetItem.PRECEDENCE_LOGICALOR, true),
|
||||
INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false),//OR Unary
|
||||
DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary
|
||||
PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true),
|
||||
MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), //OR Unary
|
||||
MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true),
|
||||
DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true),
|
||||
BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND, true),
|
||||
BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR, true),
|
||||
XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR, true),
|
||||
MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
AS(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
DELETE(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
IS(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NAMESPACE_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NEW(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TYPEOF(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
VOID,
|
||||
ATTRIBUTE,
|
||||
//Other
|
||||
STRING(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
COMMENT,
|
||||
//XML,
|
||||
IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
EOF,
|
||||
//TRACE,
|
||||
//GETURL,
|
||||
//GOTOANDSTOP,
|
||||
//NEXTFRAME,
|
||||
//PLAY,
|
||||
//PREVFRAME,
|
||||
//TELLTARGET,
|
||||
//STOP,
|
||||
//STOPALLSOUNDS,
|
||||
//TOGGLEHIGHQUALITY,
|
||||
//ORD,
|
||||
//CHR,
|
||||
//DUPLICATEMOVIECLIP,
|
||||
//STOPDRAG,
|
||||
//GETTIMER,
|
||||
//LOADVARIABLES,
|
||||
//LOADMOVIE,
|
||||
//GOTOANDPLAY,
|
||||
//MBORD,
|
||||
//MBCHR,
|
||||
//MBLENGTH,
|
||||
//MBSUBSTRING,
|
||||
//RANDOM,
|
||||
//REMOVEMOVIECLIP,
|
||||
//STARTDRAG,
|
||||
//SUBSTR,
|
||||
//LENGTH, //string.length
|
||||
INT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//TARGETPATH,
|
||||
NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//IFFRAMELOADED,
|
||||
INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//EVAL,
|
||||
UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//NEWLINE,
|
||||
NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//GETVERSION,
|
||||
//CALL,
|
||||
//LOADMOVIENUM,
|
||||
//LOADVARIABLESNUM,
|
||||
//PRINT,
|
||||
//PRINTNUM,
|
||||
//PRINTASBITMAP,
|
||||
//PRINTASBITMAPNUM,
|
||||
//UNLOADMOVIE,
|
||||
//UNLOADMOVIENUM,
|
||||
FINAL,
|
||||
XML_STARTTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <xxx
|
||||
XML_STARTVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <{
|
||||
XML_STARTTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // >
|
||||
XML_FINISHVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // </{
|
||||
XML_FINISHTAG(GraphTargetItem.PRECEDENCE_PRIMARY, false), // </xxx>
|
||||
XML_STARTFINISHTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // />
|
||||
XML_COMMENT(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <!-- ... -->
|
||||
XML_CDATA(GraphTargetItem.PRECEDENCE_PRIMARY, false), //<![CDATA[ ... ]]>
|
||||
XML_INSTR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <?xxx
|
||||
XML_INSTR_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // ?>
|
||||
XML_VAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {
|
||||
XML_ATTRIBUTENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa=
|
||||
XML_ATTRIBUTEVALUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), // "vvv"
|
||||
XML_TEXT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
XML_ATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}=
|
||||
XML_ATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={
|
||||
XML_INSTRATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}=
|
||||
XML_INSTRATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={
|
||||
XML_INSTRVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <?{
|
||||
FILTER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
DESCENDANTS(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NATIVE;
|
||||
|
||||
private int precedence = GraphTargetItem.NOPRECEDENCE;
|
||||
|
||||
private boolean binary = false;
|
||||
|
||||
private boolean rightAssociative = false;
|
||||
|
||||
public boolean isBinary() {
|
||||
return binary;
|
||||
}
|
||||
|
||||
public boolean isRightAssociative() {
|
||||
return rightAssociative;
|
||||
}
|
||||
|
||||
public int getPrecedence() {
|
||||
return precedence;
|
||||
}
|
||||
|
||||
private SymbolType(int precedence, boolean binary) {
|
||||
this.precedence = precedence;
|
||||
this.binary = binary;
|
||||
}
|
||||
|
||||
private SymbolType(int precedence, boolean binary, boolean rightAssociative) {
|
||||
this.precedence = precedence;
|
||||
this.binary = binary;
|
||||
this.rightAssociative = rightAssociative;
|
||||
}
|
||||
|
||||
private SymbolType() {
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum SymbolType {
|
||||
//Keywords
|
||||
|
||||
BREAK,
|
||||
CASE,
|
||||
CONTINUE,
|
||||
DEFAULT,
|
||||
DO,
|
||||
WHILE,
|
||||
ELSE,
|
||||
FOR,
|
||||
EACH,
|
||||
IN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
IF,
|
||||
RETURN,
|
||||
SUPER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SWITCH,
|
||||
THROW,
|
||||
TRY,
|
||||
CATCH,
|
||||
FINALLY,
|
||||
WITH,
|
||||
DYNAMIC,
|
||||
INTERNAL,
|
||||
OVERRIDE,
|
||||
PRIVATE,
|
||||
PROTECTED,
|
||||
PUBLIC,
|
||||
STATIC,
|
||||
CLASS,
|
||||
CONST,
|
||||
EXTENDS,
|
||||
FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
GET,
|
||||
IMPLEMENTS,
|
||||
INTERFACE,
|
||||
NAMESPACE,
|
||||
PACKAGE,
|
||||
SET,
|
||||
VAR,
|
||||
IMPORT,
|
||||
USE,
|
||||
FALSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NULL(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
THIS(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TRUE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//Operators
|
||||
PARENT_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
PARENT_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
CURLY_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
CURLY_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
BRACKET_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
BRACKET_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SEMICOLON,
|
||||
COMMA(GraphTargetItem.PRECEDENCE_COMMA, false),
|
||||
REST,
|
||||
DOT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
ASSIGN(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
GREATER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
LOWER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NOT(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
NEGATE(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
TERNAR(GraphTargetItem.PRECEDENCE_CONDITIONAL, true, true), /*!! ternar !!!*/
|
||||
COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL, false),/*!! ternar !!!*/
|
||||
EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
STRICT_EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
LOWER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
GREATER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
STRICT_NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true),
|
||||
AND(GraphTargetItem.PRECEDENCE_LOGICALAND, true),
|
||||
OR(GraphTargetItem.PRECEDENCE_LOGICALOR, true),
|
||||
INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false),//OR Unary
|
||||
DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary
|
||||
PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true),
|
||||
MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), //OR Unary
|
||||
MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true),
|
||||
DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true),
|
||||
BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND, true),
|
||||
BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR, true),
|
||||
XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR, true),
|
||||
MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true),
|
||||
ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true),
|
||||
AS(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
DELETE(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
IS(GraphTargetItem.PRECEDENCE_RELATIONAL, true),
|
||||
NAMESPACE_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NEW(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TYPEOF(GraphTargetItem.PRECEDENCE_UNARY, false),
|
||||
VOID,
|
||||
ATTRIBUTE,
|
||||
//Other
|
||||
STRING(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
COMMENT,
|
||||
//XML,
|
||||
IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
EOF,
|
||||
//TRACE,
|
||||
//GETURL,
|
||||
//GOTOANDSTOP,
|
||||
//NEXTFRAME,
|
||||
//PLAY,
|
||||
//PREVFRAME,
|
||||
//TELLTARGET,
|
||||
//STOP,
|
||||
//STOPALLSOUNDS,
|
||||
//TOGGLEHIGHQUALITY,
|
||||
//ORD,
|
||||
//CHR,
|
||||
//DUPLICATEMOVIECLIP,
|
||||
//STOPDRAG,
|
||||
//GETTIMER,
|
||||
//LOADVARIABLES,
|
||||
//LOADMOVIE,
|
||||
//GOTOANDPLAY,
|
||||
//MBORD,
|
||||
//MBCHR,
|
||||
//MBLENGTH,
|
||||
//MBSUBSTRING,
|
||||
//RANDOM,
|
||||
//REMOVEMOVIECLIP,
|
||||
//STARTDRAG,
|
||||
//SUBSTR,
|
||||
//LENGTH, //string.length
|
||||
INT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//TARGETPATH,
|
||||
NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//IFFRAMELOADED,
|
||||
INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//EVAL,
|
||||
UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//NEWLINE,
|
||||
NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
//GETVERSION,
|
||||
//CALL,
|
||||
//LOADMOVIENUM,
|
||||
//LOADVARIABLESNUM,
|
||||
//PRINT,
|
||||
//PRINTNUM,
|
||||
//PRINTASBITMAP,
|
||||
//PRINTASBITMAPNUM,
|
||||
//UNLOADMOVIE,
|
||||
//UNLOADMOVIENUM,
|
||||
FINAL,
|
||||
XML_STARTTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <xxx
|
||||
XML_STARTVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <{
|
||||
XML_STARTTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // >
|
||||
XML_FINISHVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // </{
|
||||
XML_FINISHTAG(GraphTargetItem.PRECEDENCE_PRIMARY, false), // </xxx>
|
||||
XML_STARTFINISHTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // />
|
||||
XML_COMMENT(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <!-- ... -->
|
||||
XML_CDATA(GraphTargetItem.PRECEDENCE_PRIMARY, false), //<![CDATA[ ... ]]>
|
||||
XML_INSTR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <?xxx
|
||||
XML_INSTR_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // ?>
|
||||
XML_VAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {
|
||||
XML_ATTRIBUTENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa=
|
||||
XML_ATTRIBUTEVALUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), // "vvv"
|
||||
XML_TEXT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
XML_ATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}=
|
||||
XML_ATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={
|
||||
XML_INSTRATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}=
|
||||
XML_INSTRATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={
|
||||
XML_INSTRVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // <?{
|
||||
FILTER(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
DESCENDANTS(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
NATIVE,
|
||||
PREPROCESSOR(GraphTargetItem.PRECEDENCE_PRIMARY, false);
|
||||
|
||||
private int precedence = GraphTargetItem.NOPRECEDENCE;
|
||||
|
||||
private boolean binary = false;
|
||||
|
||||
private boolean rightAssociative = false;
|
||||
|
||||
public boolean isBinary() {
|
||||
return binary;
|
||||
}
|
||||
|
||||
public boolean isRightAssociative() {
|
||||
return rightAssociative;
|
||||
}
|
||||
|
||||
public int getPrecedence() {
|
||||
return precedence;
|
||||
}
|
||||
|
||||
private SymbolType(int precedence, boolean binary) {
|
||||
this.precedence = precedence;
|
||||
this.binary = binary;
|
||||
}
|
||||
|
||||
private SymbolType(int precedence, boolean binary, boolean rightAssociative) {
|
||||
this.precedence = precedence;
|
||||
this.binary = binary;
|
||||
this.rightAssociative = rightAssociative;
|
||||
}
|
||||
|
||||
private SymbolType() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user