mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-31 01:45:10 +00:00
AS1/2 ActionTry fix
AS1/2 Infinity
This commit is contained in:
@@ -19,11 +19,9 @@ package com.jpexs.decompiler.flash;
|
||||
import SevenZip.Compression.LZMA.Encoder;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionEquals;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetVariable;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionJump;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionSetVariable;
|
||||
import com.jpexs.decompiler.flash.action.swf4.Null;
|
||||
@@ -46,12 +44,11 @@ import com.jpexs.decompiler.flash.flv.FLVOutputStream;
|
||||
import com.jpexs.decompiler.flash.flv.FLVTAG;
|
||||
import com.jpexs.decompiler.flash.flv.VIDEODATA;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemPos;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.gui.FrameNode;
|
||||
import com.jpexs.decompiler.flash.gui.TagNode;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag;
|
||||
@@ -240,7 +237,7 @@ public class SWF {
|
||||
* @param is Stream to read SWF from
|
||||
* @throws IOException
|
||||
*/
|
||||
public SWF(InputStream is, PercentListener listener) throws IOException {
|
||||
public SWF(InputStream is, PercentListener listener) throws IOException {
|
||||
byte hdr[] = new byte[3];
|
||||
is.read(hdr);
|
||||
String shdr = new String(hdr);
|
||||
@@ -287,7 +284,7 @@ public class SWF {
|
||||
int tmpFirstByetOfFrameRate = sis.readUI8();
|
||||
frameRate = sis.readUI8();
|
||||
frameCount = sis.readUI16();
|
||||
tags = sis.readTagList(0);
|
||||
tags = sis.readTagList(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,6 +946,7 @@ public class SWF {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void getVariables(ConstantPool constantPool, List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, int lastIp, HashMap<DirectValueTreeItem, ConstantPool> variables, List<GraphSourceItem> functions, List<Integer> visited) {
|
||||
boolean debugMode = false;
|
||||
while ((ip > -1) && ip < code.size()) {
|
||||
@@ -958,11 +956,11 @@ public class SWF {
|
||||
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
|
||||
|
||||
if (debugMode) {
|
||||
System.err.println("Visit " + ip + ": ofs" +Helper.formatAddress(((Action)ins).getAddress())+":" + ((Action)ins).getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), new ArrayList<String>(), code.version,false) + " stack:" + Helper.stackToString(stack, Helper.toList(new ConstantPool())));
|
||||
System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), new ArrayList<String>(), code.version, false) + " stack:" + Helper.stackToString(stack, Helper.toList(new ConstantPool())));
|
||||
}
|
||||
if(ins.isIgnored()){
|
||||
if (ins.isIgnored()) {
|
||||
ip++;
|
||||
continue;
|
||||
}
|
||||
@@ -984,11 +982,20 @@ public class SWF {
|
||||
}
|
||||
|
||||
if (ins instanceof GraphSourceItemContainer) {
|
||||
long endAddr=((GraphSourceItemContainer)ins).getEndAddress();
|
||||
int endIp=code.adr2pos(endAddr);
|
||||
getVariables(variables, functions, new ActionGraphSource(code.getActions().subList(ip+1, endIp), code.version, new HashMap<Integer, String>(),new HashMap<String, GraphTargetItem>(),new HashMap<String, GraphTargetItem>()),0);
|
||||
((GraphSourceItemContainer)ins).translateContainer(new ArrayList<GraphTargetItem>(), stack, output, new HashMap<Integer, String>(),new HashMap<String, GraphTargetItem>(),new HashMap<String, GraphTargetItem>());
|
||||
ip=endIp;
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) ins;
|
||||
List<Long> cntSizes = cnt.getContainerSizes();
|
||||
long addr = code.pos2adr(ip + 1);
|
||||
for (Long size : cntSizes) {
|
||||
if (size == 0) {
|
||||
continue;
|
||||
}
|
||||
ip = code.adr2pos(addr);
|
||||
addr += size;
|
||||
int nextip = code.adr2pos(addr);
|
||||
getVariables(variables, functions, new ActionGraphSource(code.getActions().subList(ip, nextip), code.version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0);
|
||||
ip = nextip;
|
||||
}
|
||||
((GraphSourceItemContainer) ins).translateContainer(new ArrayList<List<GraphTargetItem>>(), stack, output, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1024,7 @@ public class SWF {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
if (ins instanceof ActionIf) {
|
||||
stack.pop();
|
||||
}
|
||||
@@ -1033,7 +1040,7 @@ public class SWF {
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
@@ -1052,29 +1059,29 @@ public class SWF {
|
||||
private HashMap<DirectValueTreeItem, ConstantPool> getVariables(HashMap<DirectValueTreeItem, ConstantPool> variables, List<GraphSourceItem> functions, ASMSource src) {
|
||||
HashMap<DirectValueTreeItem, ConstantPool> ret = new HashMap<DirectValueTreeItem, ConstantPool>();
|
||||
List<Action> actions = src.getActions(version);
|
||||
/* int ip=0;
|
||||
for(Action a:actions){
|
||||
System.out.println("ip "+ip+" "+a.getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), new ArrayList<String>(), version, false));
|
||||
ip++;
|
||||
}
|
||||
if(true)
|
||||
return ret;*/
|
||||
/* int ip=0;
|
||||
for(Action a:actions){
|
||||
System.out.println("ip "+ip+" "+a.getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), new ArrayList<String>(), version, false));
|
||||
ip++;
|
||||
}
|
||||
if(true)
|
||||
return ret;*/
|
||||
actionsMap.put(src, actions);
|
||||
List<GraphSourceItem> ss=new ArrayList<GraphSourceItem>();
|
||||
List<GraphSourceItem> ss = new ArrayList<GraphSourceItem>();
|
||||
ss.addAll(actions);
|
||||
getVariables(variables, functions, new ActionGraphSource(ss, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0);
|
||||
return ret;
|
||||
}
|
||||
private HashMap<ASMSource, List<Action>> actionsMap = new HashMap<ASMSource, List<Action>>();
|
||||
|
||||
private void getVariables(List<Object> objs,String path) {
|
||||
private void getVariables(List<Object> objs, String path) {
|
||||
for (Object o : objs) {
|
||||
if (o instanceof ASMSource) {
|
||||
informListeners("getVariables", path+"/"+o.toString());
|
||||
informListeners("getVariables", path + "/" + o.toString());
|
||||
getVariables(allVariableNames, allFunctions, (ASMSource) o);
|
||||
}
|
||||
if (o instanceof Container) {
|
||||
getVariables(((Container) o).getSubItems(),path+"/"+o.toString());
|
||||
getVariables(((Container) o).getSubItems(), path + "/" + o.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1086,7 +1093,7 @@ public class SWF {
|
||||
List<Object> objs = new ArrayList<Object>();
|
||||
int ret = 0;
|
||||
objs.addAll(tags);
|
||||
getVariables(objs,"");
|
||||
getVariables(objs, "");
|
||||
for (GraphSourceItem fun : allFunctions) {
|
||||
if (fun instanceof ActionDefineFunction) {
|
||||
ActionDefineFunction f = (ActionDefineFunction) fun;
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionEnd;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.swf3.*;
|
||||
@@ -29,6 +28,7 @@ import com.jpexs.decompiler.flash.action.swf7.*;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemPos;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
@@ -498,7 +498,7 @@ public class SWFInputStream extends InputStream {
|
||||
|
||||
private static void getConstantPool(ConstantPool cpool, List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, int lastIp, List<ConstantPool> constantPools, List<Integer> visited, int version, int endIp) {
|
||||
boolean debugMode = false;
|
||||
while (((endIp==-1)||(endIp>ip))&&(ip > -1) && ip < code.size()) {
|
||||
while (((endIp == -1) || (endIp > ip)) && (ip > -1) && ip < code.size()) {
|
||||
if (visited.contains(ip)) {
|
||||
break;
|
||||
}
|
||||
@@ -510,16 +510,26 @@ public class SWFInputStream extends InputStream {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ins instanceof GraphSourceItemContainer){
|
||||
GraphSourceItemContainer cnt=(GraphSourceItemContainer)ins;
|
||||
long endAddr=((GraphSourceItemContainer)ins).getEndAddress();
|
||||
int nendIp = code.adr2pos(endAddr);
|
||||
List localData2 = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
List<GraphTargetItem> output2=new ArrayList<GraphTargetItem>();
|
||||
getConstantPool(cpool, localData2, new Stack<GraphTargetItem>(), output2, code, ip+1, lastIp, constantPools, visited, version,nendIp);
|
||||
cnt.translateContainer(output2, stack, output,(HashMap<Integer, String>) localData.get(0),(HashMap<String, GraphTargetItem>)localData.get(1),(HashMap<String, GraphTargetItem>)localData.get(2));
|
||||
ip = nendIp;
|
||||
continue;
|
||||
if (ins instanceof GraphSourceItemContainer) {
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) ins;
|
||||
if (ins instanceof Action) {
|
||||
List<List<GraphTargetItem>> output2s = new ArrayList<List<GraphTargetItem>>();
|
||||
long endAddr = ((Action) ins).getAddress() + cnt.getHeaderSize();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
if (size == 0) {
|
||||
output2s.add(new ArrayList<GraphTargetItem>());
|
||||
continue;
|
||||
}
|
||||
List localData2 = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
List<GraphTargetItem> output2 = new ArrayList<GraphTargetItem>();
|
||||
output2s.add(output2);
|
||||
getConstantPool(cpool, localData2, new Stack<GraphTargetItem>(), output2, code, code.adr2pos(endAddr), lastIp, constantPools, visited, version, code.adr2pos(endAddr + size));
|
||||
endAddr += size;
|
||||
}
|
||||
cnt.translateContainer(output2s, stack, output, (HashMap<Integer, String>) localData.get(0), (HashMap<String, GraphTargetItem>) localData.get(1), (HashMap<String, GraphTargetItem>) localData.get(2));
|
||||
ip = code.adr2pos(endAddr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ins instanceof ActionPush) {
|
||||
if (cpool != null) {
|
||||
@@ -540,15 +550,15 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
if (debugMode) {
|
||||
String add="";
|
||||
if(ins instanceof ActionIf){
|
||||
add+=" change:"+((ActionIf)ins).getJumpOffset();
|
||||
String add = "";
|
||||
if (ins instanceof ActionIf) {
|
||||
add += " change:" + ((ActionIf) ins).getJumpOffset();
|
||||
}
|
||||
if(ins instanceof ActionJump){
|
||||
add+=" change:"+(((ActionJump)ins).getJumpOffset());
|
||||
if (ins instanceof ActionJump) {
|
||||
add += " change:" + (((ActionJump) ins).getJumpOffset());
|
||||
}
|
||||
System.err.println("getConstantPool ip " + ip + ", addr "+Helper.formatAddress(((Action)ins).getAddress())+": " + ((Action)ins).getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(), Helper.toList(cpool), version, false) +add+ " stack:" + Helper.stackToString(stack,Helper.toList(cpool)));
|
||||
if(ip==116){
|
||||
System.err.println("getConstantPool ip " + ip + ", addr " + Helper.formatAddress(((Action) ins).getAddress()) + ": " + ((Action) ins).getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), Helper.toList(cpool), version, false) + add + " stack:" + Helper.stackToString(stack, Helper.toList(cpool)));
|
||||
if (ip == 116) {
|
||||
System.err.println("kok");
|
||||
}
|
||||
}
|
||||
@@ -611,7 +621,7 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
stack.pop();
|
||||
getConstantPool(cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, ip, constantPools, visited, version,endIp);
|
||||
getConstantPool(cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, ip, constantPools, visited, version, endIp);
|
||||
} else {
|
||||
if (ins instanceof ActionIf) {
|
||||
stack.pop();
|
||||
@@ -621,7 +631,7 @@ public class SWFInputStream extends InputStream {
|
||||
for (int b : branches) {
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
getConstantPool(cpool, localData, brStack, output, code, b, ip, constantPools, visited, version,endIp);
|
||||
getConstantPool(cpool, localData, brStack, output, code, b, ip, constantPools, visited, version, endIp);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
@@ -642,7 +652,7 @@ public class SWFInputStream extends InputStream {
|
||||
List<ConstantPool> ret = new ArrayList<ConstantPool>();
|
||||
List localData = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
try {
|
||||
getConstantPool(null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, ret, new ArrayList<Integer>(), version,-1);
|
||||
getConstantPool(null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, ret, new ArrayList<Integer>(), version, -1);
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.SEVERE, "Error during getting constantpool", ex);
|
||||
}
|
||||
@@ -674,7 +684,7 @@ public class SWFInputStream extends InputStream {
|
||||
method = 2;
|
||||
goesPrev = readActionListAtPos(true, localData, stack, cpool, sis, rri, ip, retdups, ip);
|
||||
}*/
|
||||
goesPrev = readActionListAtPos(new ArrayList<GraphTargetItem>(),new HashMap<Long,List<GraphSourceItemContainer>>(),address, containerSWFOffset, false, true, localData, stack, cpool, sis, rri, ip, retdups, ip, endip);
|
||||
goesPrev = readActionListAtPos(new ArrayList<GraphTargetItem>(), new HashMap<Long, List<GraphSourceItemContainer>>(), address, containerSWFOffset, false, true, localData, stack, cpool, sis, rri, ip, retdups, ip, endip);
|
||||
|
||||
if (goesPrev) {
|
||||
} else {
|
||||
@@ -705,13 +715,13 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
|
||||
List<ConstantPool> pools = new ArrayList<ConstantPool>();
|
||||
StringBuilder br=new StringBuilder();
|
||||
for(int i=0;i<ret.size();i++){
|
||||
StringBuilder br = new StringBuilder();
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
br.append(i);
|
||||
br.append(", loc");
|
||||
br.append(Helper.formatAddress(((Action)ret.get(i)).getAddress()));
|
||||
br.append(Helper.formatAddress(((Action) ret.get(i)).getAddress()));
|
||||
br.append(": ");
|
||||
br.append(((Action)ret.get(i)).getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), cpool.constants, version, false));
|
||||
br.append(((Action) ret.get(i)).getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), cpool.constants, version, false));
|
||||
br.append("\r\n");
|
||||
}
|
||||
Helper.writeFile("test.txt", br.toString().getBytes());
|
||||
@@ -724,10 +734,10 @@ public class SWFInputStream extends InputStream {
|
||||
ActionJump aj = new ActionJump(ip);
|
||||
int skip = aj.getBytes(version).length;
|
||||
for (GraphSourceItem s : ret) {
|
||||
|
||||
if(s instanceof Action){
|
||||
Action a=(Action)s;
|
||||
a.setAddress(a.getAddress() + skip, version);
|
||||
|
||||
if (s instanceof Action) {
|
||||
Action a = (Action) s;
|
||||
a.setAddress(a.getAddress() + skip, version);
|
||||
}
|
||||
}
|
||||
ret.add(0, aj);
|
||||
@@ -743,16 +753,16 @@ public class SWFInputStream extends InputStream {
|
||||
} catch (ParseException ex) {
|
||||
Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error", ex);
|
||||
}*/
|
||||
List<Action> reta=new ArrayList<Action>();
|
||||
for(Object o:ret){
|
||||
if(o instanceof Action){
|
||||
reta.add((Action)o);
|
||||
List<Action> reta = new ArrayList<Action>();
|
||||
for (Object o : ret) {
|
||||
if (o instanceof Action) {
|
||||
reta.add((Action) o);
|
||||
}
|
||||
}
|
||||
return reta;
|
||||
}
|
||||
|
||||
private static boolean readActionListAtPos(List<GraphTargetItem> output,HashMap<Long,List<GraphSourceItemContainer>> containers,long address, long containerSWFOffset, boolean notCompileTime, boolean enableVariables, List localData, Stack<GraphTargetItem> stack, ConstantPool cpool, SWFInputStream sis, ReReadableInputStream rri, int ip, List<Action> ret, int startIp, int endip) throws IOException {
|
||||
private static boolean readActionListAtPos(List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, long address, long containerSWFOffset, boolean notCompileTime, boolean enableVariables, List localData, Stack<GraphTargetItem> stack, ConstantPool cpool, SWFInputStream sis, ReReadableInputStream rri, int ip, List<Action> ret, int startIp, int endip) throws IOException {
|
||||
boolean debugMode = false;
|
||||
boolean decideBranch = false;
|
||||
boolean retv = false;
|
||||
@@ -762,26 +772,21 @@ public class SWFInputStream extends InputStream {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int prevIp = ip;
|
||||
while (((endip == -1) || (endip > ip)) && (a = sis.readAction(rri)) != null) {
|
||||
if ((ip < ret.size()) && (!(ret.get(ip) instanceof ActionNop))) {
|
||||
if ((ip < ret.size()) && (!(ret.get(ip) instanceof ActionNop))) {
|
||||
a = ret.get(ip);
|
||||
if(a.getAddress()!=ip){
|
||||
new Exception("Jump to the middle of the instruction").printStackTrace();
|
||||
if (a.getAddress() != ip) {
|
||||
new Exception("Jump to the middle of the instruction ip " + ip + " ins " + a.getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), new ArrayList<String>(), SWF.DEFAULT_VERSION, false)).printStackTrace();
|
||||
}
|
||||
}
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(prevIp, SWF.DEFAULT_VERSION, false);
|
||||
int info = a.actionLength + 1 + ((a.actionCode > 0x80) ? 2 : 0);
|
||||
byte b[] = a.getBytes(sis.version);
|
||||
int infoCorrect = info;
|
||||
int infoCorrect = info;
|
||||
if (b.length != infoCorrect) {
|
||||
//throw new RuntimeException("Wrong length "+a.toString()+" info:"+infoCorrect+" actual:"+b.length+" datalen:"+(infoCorrect-info));
|
||||
}
|
||||
int actual = 0;
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
actual = ((GraphSourceItemContainer) a).getHeaderBytes().length;
|
||||
} else {
|
||||
actual = a.getBytes(sis.version).length;
|
||||
}
|
||||
int actual = actual = a.getBytes(sis.version).length;
|
||||
if (!(a instanceof GraphSourceItemContainer)) {
|
||||
int change = info - (rri.getPos() - ip);
|
||||
if (change > 0) {
|
||||
@@ -819,22 +824,17 @@ public class SWFInputStream extends InputStream {
|
||||
|
||||
if (debugMode) {
|
||||
//if(a instanceof ActionIf){
|
||||
String atos = a.getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(), cpool.constants, sis.version, false);
|
||||
String atos = a.getASMSource(new ArrayList<GraphSourceItem>(), new ArrayList<Long>(), cpool.constants, sis.version, false);
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
atos = a.toString();
|
||||
}
|
||||
System.err.println("readActionListAtPos ip: " + (ip - startIp) + " (0x" + Helper.formatAddress(ip - startIp) + ") " + " action(len " + a.actionLength + "): " + atos + (a.isIgnored() ? " (ignored)" : "") + " stack:" + Helper.stackToString(stack, Helper.toList(cpool)) + " " + Helper.byteArrToString(a.getBytes(SWF.DEFAULT_VERSION)));
|
||||
HashMap<String, GraphTargetItem> vars=(HashMap<String, GraphTargetItem>)localData.get(1);
|
||||
HashMap<String, GraphTargetItem> vars = (HashMap<String, GraphTargetItem>) localData.get(1);
|
||||
System.err.print("variables: ");
|
||||
for(String v:vars.keySet()){
|
||||
System.err.print("'"+v+"' = "+Highlighting.stripHilights(vars.get(v).toString(cpool))+", ");
|
||||
for (String v : vars.keySet()) {
|
||||
System.err.print("'" + v + "' = " + Highlighting.stripHilights(vars.get(v).toString(cpool)) + ", ");
|
||||
}
|
||||
System.err.println();
|
||||
//}
|
||||
if(ip - startIp==110){
|
||||
System.err.println("dd");
|
||||
//readActionListAtPos ip: 116 (0x0074) action(len 2): If loc0125 ;compileTime stack:[!(==734)] [9d 02 00 21 00]
|
||||
}
|
||||
String add = "";
|
||||
if (a instanceof ActionIf) {
|
||||
add = " change: " + ((ActionIf) a).getJumpOffset();
|
||||
@@ -952,14 +952,14 @@ public class SWFInputStream extends InputStream {
|
||||
//if(newip>=0){
|
||||
//rri.setPos(newip);
|
||||
//}
|
||||
} else if(!(a instanceof GraphSourceItemContainer)){
|
||||
} else if (!(a instanceof GraphSourceItemContainer)) {
|
||||
//return in for..in, TODO:Handle this better way
|
||||
if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueTreeItem)) {
|
||||
stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList<String>()));
|
||||
}
|
||||
if ((a instanceof ActionStoreRegister) && stack.isEmpty()) {
|
||||
stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList<String>()));
|
||||
}
|
||||
}
|
||||
a.translate(localData, stack, output);
|
||||
}
|
||||
} catch (RuntimeException ex) {
|
||||
@@ -990,24 +990,35 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
ret.set(ip + i, a);
|
||||
}
|
||||
|
||||
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
GraphSourceItemContainer cnt=(GraphSourceItemContainer)a;
|
||||
long endAddr=((GraphSourceItemContainer)a).getEndAddress();
|
||||
/*if(!containers.containsKey(endAddr)){
|
||||
containers.put(endAddr, new ArrayList<ActionContainer>());
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) a;
|
||||
if (a instanceof Action) {
|
||||
long endAddr = a.getAddress() + cnt.getHeaderSize();
|
||||
/*if(!containers.containsKey(endAddr)){
|
||||
containers.put(endAddr, new ArrayList<ActionContainer>());
|
||||
}
|
||||
containers.get(endAddr).add((ActionContainer)a);
|
||||
*/
|
||||
List<List<GraphTargetItem>> output2s = new ArrayList<List<GraphTargetItem>>();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
if (size == 0) {
|
||||
output2s.add(new ArrayList<GraphTargetItem>());
|
||||
continue;
|
||||
}
|
||||
List localData2 = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
List<GraphTargetItem> output2 = new ArrayList<GraphTargetItem>();
|
||||
readActionListAtPos(output2, containers, address, containerSWFOffset, notCompileTime, enableVariables, localData2, new Stack<GraphTargetItem>(), cpool, sis, rri, (int) endAddr, ret, startIp, (int) (endAddr + size));
|
||||
output2s.add(output2);
|
||||
endAddr += size;
|
||||
}
|
||||
cnt.translateContainer(output2s, stack, output, (HashMap<Integer, String>) localData.get(0), (HashMap<String, GraphTargetItem>) localData.get(1), (HashMap<String, GraphTargetItem>) localData.get(2));
|
||||
ip = (int) endAddr;
|
||||
prevIp = ip;
|
||||
rri.setPos(ip);
|
||||
filePos = rri.getPos();
|
||||
continue;
|
||||
}
|
||||
containers.get(endAddr).add((ActionContainer)a);
|
||||
*/
|
||||
List localData2 = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
List<GraphTargetItem> output2=new ArrayList<GraphTargetItem>();
|
||||
readActionListAtPos(output2,containers, address, containerSWFOffset, notCompileTime, enableVariables, localData2, new Stack<GraphTargetItem>(), cpool, sis, rri, ip+info, ret, startIp, (int)endAddr);
|
||||
cnt.translateContainer(output2, stack, output,(HashMap<Integer, String>) localData.get(0),(HashMap<String, GraphTargetItem>)localData.get(1),(HashMap<String, GraphTargetItem>)localData.get(2));
|
||||
ip = (int)endAddr;
|
||||
prevIp = ip;
|
||||
rri.setPos(ip);
|
||||
filePos = rri.getPos();
|
||||
continue;
|
||||
//infoCorrect += ((ActionContainer) a).getDataLength();
|
||||
}
|
||||
|
||||
@@ -1029,7 +1040,7 @@ public class SWFInputStream extends InputStream {
|
||||
aif.jumpUsed = true;
|
||||
int oldPos = rri.getPos();
|
||||
Stack<GraphTargetItem> substack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (readActionListAtPos(output,containers,address, containerSWFOffset, true, enableVariables, localData, substack, cpool, sis, rri, rri.getPos() + aif.getJumpOffset(), ret, startIp, endip)) {
|
||||
if (readActionListAtPos(output, containers, address, containerSWFOffset, true, enableVariables, localData, substack, cpool, sis, rri, rri.getPos() + aif.getJumpOffset(), ret, startIp, endip)) {
|
||||
retv = true;
|
||||
}
|
||||
rri.setPos(oldPos);
|
||||
|
||||
@@ -40,6 +40,6 @@ public class NewObjectTreeItem extends TreeItem {
|
||||
}
|
||||
params += pairs.get(n).toString(constants, localRegNames, fullyQualifiedNames);
|
||||
}
|
||||
return "\r\n" +Graph.INDENTOPEN + "\r\n" + hilight("{") + "\r\n" + params + "\r\n" + hilight("}")+"\r\n"+Graph.INDENTCLOSE + "\r\n";
|
||||
return "\r\n" + Graph.INDENTOPEN + "\r\n" + hilight("{") + "\r\n" + params + "\r\n" + hilight("}") + "\r\n" + Graph.INDENTCLOSE + "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.types.ValueKind;
|
||||
import static com.jpexs.decompiler.flash.abc.types.traits.Trait.TRAIT_CONST;
|
||||
import com.jpexs.decompiler.flash.graph.Graph;
|
||||
import static com.jpexs.decompiler.flash.graph.Graph.INDENTOPEN;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
@@ -130,36 +129,36 @@ public class TraitSlotConst extends Trait {
|
||||
String ret = modifier + getNameStr(abc, fullyQualifiedNames);
|
||||
String valueStr = getValueStr(abc, fullyQualifiedNames);
|
||||
if (valueStr != null) {
|
||||
ret+=" = ";
|
||||
int befLen=ret.length();
|
||||
ret += " = ";
|
||||
int befLen = ret.length();
|
||||
ret = ABC.IDENT_STRING + ABC.IDENT_STRING + ret;
|
||||
String valueStrParts[] = valueStr.split("\r\n");
|
||||
boolean first=true;
|
||||
boolean first = true;
|
||||
for (int i = 0; i < valueStrParts.length; i++) {
|
||||
if(valueStrParts[i].equals("")){
|
||||
if (valueStrParts[i].equals("")) {
|
||||
continue;
|
||||
}
|
||||
if(Highlighting.stripHilights(valueStrParts[i]).equals(Graph.INDENTOPEN)){
|
||||
if (Highlighting.stripHilights(valueStrParts[i]).equals(Graph.INDENTOPEN)) {
|
||||
//befLen+=ABC.IDENT_STRING.length();
|
||||
continue;
|
||||
}
|
||||
if(Highlighting.stripHilights(valueStrParts[i]).equals(Graph.INDENTCLOSE)){
|
||||
if (Highlighting.stripHilights(valueStrParts[i]).equals(Graph.INDENTCLOSE)) {
|
||||
//befLen-=ABC.IDENT_STRING.length();
|
||||
continue;
|
||||
}
|
||||
if(!first){
|
||||
ret+=ABC.IDENT_STRING + ABC.IDENT_STRING;
|
||||
for(int j=0;j<befLen;j++){
|
||||
ret+=" ";
|
||||
if (!first) {
|
||||
ret += ABC.IDENT_STRING + ABC.IDENT_STRING;
|
||||
for (int j = 0; j < befLen; j++) {
|
||||
ret += " ";
|
||||
}
|
||||
}
|
||||
ret+=valueStrParts[i];
|
||||
ret+="\r\n";
|
||||
first=false;
|
||||
ret += valueStrParts[i];
|
||||
ret += "\r\n";
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
if(ret.endsWith("\r\n")){
|
||||
ret=ret.substring(0,ret.length()-2)+";\r\n";
|
||||
}
|
||||
if (ret.endsWith("\r\n")) {
|
||||
ret = ret.substring(0, ret.length() - 2) + ";\r\n";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,16 @@ import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.*;
|
||||
import com.jpexs.decompiler.flash.action.swf5.*;
|
||||
import com.jpexs.decompiler.flash.action.swf6.ActionEnumerate2;
|
||||
import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
|
||||
import com.jpexs.decompiler.flash.action.swf7.ActionTry;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.*;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.clauses.*;
|
||||
import com.jpexs.decompiler.flash.graph.Graph;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.IfItem;
|
||||
import com.jpexs.decompiler.flash.graph.NotItem;
|
||||
@@ -377,62 +376,78 @@ public class Action implements GraphSourceItem {
|
||||
* @param hex Add hexadecimal?
|
||||
* @return ASM source as String
|
||||
*/
|
||||
public static String actionsToString(long address, List list, List<Long> importantOffsets, List<String> constantPool, int version, boolean hex, long swfPos) {
|
||||
public static String actionsToString(long address, List list, List<Long> importantOffsets, List<String> constantPool, int version, boolean hex, long swfPos) {
|
||||
String ret = "";
|
||||
long offset;
|
||||
if (importantOffsets == null) {
|
||||
//setActionsAddresses(list, 0, version);
|
||||
importantOffsets = getActionsAllRefs(list, version);
|
||||
}
|
||||
List<GraphSourceItem> srcList=new ArrayList<GraphSourceItem>();
|
||||
for(Object o:list){
|
||||
if(o instanceof Action){
|
||||
srcList.add((Action)o);
|
||||
List<GraphSourceItem> srcList = new ArrayList<GraphSourceItem>();
|
||||
for (Object o : list) {
|
||||
if (o instanceof Action) {
|
||||
srcList.add((Action) o);
|
||||
}
|
||||
}
|
||||
List<ConstantPool> cps = SWFInputStream.getConstantPool(new ActionGraphSource(srcList, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0, version);
|
||||
List<ConstantPool> cps = SWFInputStream.getConstantPool(new ActionGraphSource(srcList, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0, version);
|
||||
if (!cps.isEmpty()) {
|
||||
setConstantPool(list, cps.get(cps.size() - 1));
|
||||
}
|
||||
HashMap<Long,List<GraphSourceItemContainer>> containers=new HashMap<Long, List<GraphSourceItemContainer>>();
|
||||
HashMap<Long, List<GraphSourceItemContainer>> containers = new HashMap<Long, List<GraphSourceItemContainer>>();
|
||||
HashMap<GraphSourceItemContainer, Integer> containersPos = new HashMap<GraphSourceItemContainer, Integer>();
|
||||
offset = address;
|
||||
int pos = -1;
|
||||
for (GraphSourceItem s : srcList) {
|
||||
Action a=null;
|
||||
if(s instanceof Action){
|
||||
a=(Action)s;
|
||||
Action a = null;
|
||||
if (s instanceof Action) {
|
||||
a = (Action) s;
|
||||
}
|
||||
pos++;
|
||||
if (hex) {
|
||||
ret += "<ffdec:hex>" +/*"0x"+Helper.formatAddress(a.getFileAddress())+": "+*/ Helper.bytesToHexString((a instanceof GraphSourceItemContainer) ? ((GraphSourceItemContainer) a).getHeaderBytes() : a.getBytes(version)) + "</ffdec:hex>\r\n";
|
||||
ret += "<ffdec:hex>" +/*"0x"+Helper.formatAddress(a.getFileAddress())+": "+*/ Helper.bytesToHexString(a.getBytes(version)) + "</ffdec:hex>\r\n";
|
||||
}
|
||||
offset = a.getAddress();
|
||||
|
||||
if((!(a.ignored)) && (a instanceof GraphSourceItemContainer)){
|
||||
if(!containers.containsKey(((GraphSourceItemContainer)a).getEndAddress())){
|
||||
containers.put(((GraphSourceItemContainer)a).getEndAddress(), new ArrayList<GraphSourceItemContainer>());
|
||||
}
|
||||
containers.get(((GraphSourceItemContainer)a).getEndAddress()).add((GraphSourceItemContainer)a);
|
||||
}
|
||||
|
||||
if(containers.containsKey(offset)){
|
||||
for(int i=0;i<containers.get(offset).size();i++){
|
||||
ret+="}\r\n";
|
||||
|
||||
if ((!(a.ignored)) && (a instanceof GraphSourceItemContainer)) {
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) a;
|
||||
containersPos.put(cnt, 0);
|
||||
List<Long> sizes = cnt.getContainerSizes();
|
||||
long addr = ((Action) cnt).getAddress() + cnt.getHeaderSize();
|
||||
for (Long size : sizes) {
|
||||
addr += size;
|
||||
if (size == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!containers.containsKey(addr)) {
|
||||
containers.put(addr, new ArrayList<GraphSourceItemContainer>());
|
||||
}
|
||||
containers.get(addr).add(cnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (containers.containsKey(offset)) {
|
||||
for (int i = 0; i < containers.get(offset).size(); i++) {
|
||||
ret += "}\r\n";
|
||||
GraphSourceItemContainer cnt = containers.get(offset).get(i);
|
||||
int cntPos = containersPos.get(cnt);
|
||||
ret += cnt.getASMSourceBetween(cntPos);
|
||||
cntPos++;
|
||||
containersPos.put(cnt, cntPos);
|
||||
}
|
||||
}
|
||||
|
||||
if (importantOffsets.contains(offset)) {
|
||||
ret += "loc" + Helper.formatAddress(offset) + ":";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (a.replaceWith != null) {
|
||||
ret += Highlighting.hilighOffset("", offset) + a.replaceWith.getASMSource(list,importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
ret += Highlighting.hilighOffset("", offset) + a.replaceWith.getASMSource(list, importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
} else if (a.ignored) {
|
||||
int len = 0;
|
||||
if (pos + 1 < list.size()) {
|
||||
len = (int) (((Action)(list.get(pos + 1))).getAddress() - a.getAddress());
|
||||
len = (int) (((Action) (list.get(pos + 1))).getAddress() - a.getAddress());
|
||||
} else {
|
||||
len = a.getBytes(version).length;
|
||||
}
|
||||
@@ -441,27 +456,37 @@ public class Action implements GraphSourceItem {
|
||||
}
|
||||
} else {
|
||||
if (a.beforeInsert != null) {
|
||||
ret += a.beforeInsert.getASMSource(list,importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
ret += a.beforeInsert.getASMSource(list, importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
}
|
||||
//if (!(a instanceof ActionNop)) {
|
||||
String add="";
|
||||
if(a instanceof ActionIf){
|
||||
add = " change: "+((ActionIf)a).getJumpOffset();
|
||||
}
|
||||
if(a instanceof ActionJump){
|
||||
add = " change: "+((ActionJump)a).getJumpOffset();
|
||||
}
|
||||
add="; ofs"+Helper.formatAddress(offset)+add;
|
||||
add="";
|
||||
ret += Highlighting.hilighOffset("", offset) + a.getASMSourceReplaced(list,importantOffsets, constantPool, version, hex) + (a.ignored ? "; ignored" : "") +add + "\r\n";
|
||||
String add = "";
|
||||
if (a instanceof ActionIf) {
|
||||
add = " change: " + ((ActionIf) a).getJumpOffset();
|
||||
}
|
||||
if (a instanceof ActionJump) {
|
||||
add = " change: " + ((ActionJump) a).getJumpOffset();
|
||||
}
|
||||
add = "; ofs" + Helper.formatAddress(offset) + add;
|
||||
add = "";
|
||||
ret += Highlighting.hilighOffset("", offset) + a.getASMSourceReplaced(list, importantOffsets, constantPool, version, hex) + (a.ignored ? "; ignored" : "") + add + "\r\n";
|
||||
|
||||
//}
|
||||
if (a.afterInsert != null) {
|
||||
ret += a.afterInsert.getASMSource(list,importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
ret += a.afterInsert.getASMSource(list, importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
}
|
||||
}
|
||||
offset += a.getBytes(version).length;
|
||||
}
|
||||
if (containers.containsKey(offset)) {
|
||||
for (int i = 0; i < containers.get(offset).size(); i++) {
|
||||
ret += "}\r\n";
|
||||
GraphSourceItemContainer cnt = containers.get(offset).get(i);
|
||||
int cntPos = containersPos.get(cnt);
|
||||
ret += cnt.getASMSourceBetween(cntPos);
|
||||
cntPos++;
|
||||
containersPos.put(cnt, cntPos);
|
||||
}
|
||||
}
|
||||
if (importantOffsets.contains(offset)) {
|
||||
ret += "loc" + Helper.formatAddress(offset) + ":\r\n";
|
||||
}
|
||||
@@ -517,12 +542,12 @@ public class Action implements GraphSourceItem {
|
||||
* @return address
|
||||
*/
|
||||
public static long ip2adr(List<Action> actions, int ip, int version) {
|
||||
/* List<Action> actions=new ArrayList<Action>();
|
||||
for(GraphSourceItem s:sources){
|
||||
if(s instanceof Action){
|
||||
actions.add((Action)s);
|
||||
}
|
||||
}*/
|
||||
/* List<Action> actions=new ArrayList<Action>();
|
||||
for(GraphSourceItem s:sources){
|
||||
if(s instanceof Action){
|
||||
actions.add((Action)s);
|
||||
}
|
||||
}*/
|
||||
if (ip >= actions.size()) {
|
||||
if (actions.isEmpty()) {
|
||||
return 0;
|
||||
@@ -655,10 +680,10 @@ public class Action implements GraphSourceItem {
|
||||
}
|
||||
|
||||
public static List<GraphTargetItem> actionsPartToTree(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, Stack<GraphTargetItem> stack, List<GraphSourceItem> src, int start, int end, int version) {
|
||||
List<Action> actions=new ArrayList<Action>();
|
||||
for(GraphSourceItem s:src){
|
||||
if(s instanceof Action){
|
||||
actions.add((Action)s);
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
for (GraphSourceItem s : src) {
|
||||
if (s instanceof Action) {
|
||||
actions.add((Action) s);
|
||||
}
|
||||
}
|
||||
if (start < actions.size() && (end > 0) && (start > 0)) {
|
||||
@@ -720,17 +745,26 @@ public class Action implements GraphSourceItem {
|
||||
ip++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(action instanceof GraphSourceItemContainer){
|
||||
long endAddr=((GraphSourceItemContainer)action).getEndAddress();
|
||||
int endip=adr2ip(actions, endAddr, version);
|
||||
|
||||
if (action instanceof GraphSourceItemContainer) {
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) action;
|
||||
//List<GraphTargetItem> out=actionsPartToTree(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(),new HashMap<String, GraphTargetItem>(), new Stack<GraphTargetItem>(), src, ip+1,endip-1 , version);
|
||||
List<GraphTargetItem> out=ActionGraph.translateViaGraph(registerNames, variables, functions, src.subList(ip+1, endip), version);
|
||||
((GraphSourceItemContainer)action).translateContainer(out, stack, output, registerNames, variables, functions);
|
||||
ip=endip;
|
||||
long endAddr = action.getAddress() + cnt.getHeaderSize();
|
||||
List<List<GraphTargetItem>> outs = new ArrayList<List<GraphTargetItem>>();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
if (size == 0) {
|
||||
outs.add(new ArrayList<GraphTargetItem>());
|
||||
continue;
|
||||
}
|
||||
List<GraphTargetItem> out = ActionGraph.translateViaGraph(registerNames, variables, functions, src.subList(adr2ip(actions, endAddr, version), adr2ip(actions, endAddr + size, version)), version);
|
||||
outs.add(out);
|
||||
endAddr += size;
|
||||
}
|
||||
((GraphSourceItemContainer) action).translateContainer(outs, stack, output, registerNames, variables, functions);
|
||||
ip = adr2ip(actions, endAddr, version);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//System.out.println(" ip "+ip+" "+action);
|
||||
//return in for..in
|
||||
if ((action instanceof ActionPush) && (((ActionPush) action).values.size() == 1) && (((ActionPush) action).values.get(0) instanceof Null)) {
|
||||
@@ -758,26 +792,26 @@ public class Action implements GraphSourceItem {
|
||||
EnumerateTreeItem en = (EnumerateTreeItem) stack.peek();
|
||||
inItem = en.object;
|
||||
continue;
|
||||
} else if (action instanceof ActionTry) {
|
||||
ActionTry atry = (ActionTry) action;
|
||||
List<GraphTargetItem> tryCommands = ActionGraph.translateViaGraph(registerNames, variables, functions, atry.tryBody, version);
|
||||
TreeItem catchName;
|
||||
if (atry.catchInRegisterFlag) {
|
||||
catchName = new DirectValueTreeItem(atry, -1, new RegisterNumber(atry.catchRegister), new ArrayList<String>());
|
||||
} else {
|
||||
catchName = new DirectValueTreeItem(atry, -1, atry.catchName, new ArrayList<String>());
|
||||
}
|
||||
List<GraphTargetItem> catchExceptions = new ArrayList<GraphTargetItem>();
|
||||
catchExceptions.add(catchName);
|
||||
List<List<GraphTargetItem>> catchCommands = new ArrayList<List<GraphTargetItem>>();
|
||||
catchCommands.add(ActionGraph.translateViaGraph(registerNames, variables, functions, atry.catchBody, version));
|
||||
List<GraphTargetItem> finallyCommands = ActionGraph.translateViaGraph(registerNames, variables, functions, atry.finallyBody, version);
|
||||
output.add(new TryTreeItem(tryCommands, catchExceptions, catchCommands, finallyCommands));
|
||||
} else /*if (action instanceof ActionWith) {
|
||||
ActionWith awith = (ActionWith) action;
|
||||
List<GraphTargetItem> withCommands = ActionGraph.translateViaGraph(registerNames, variables, functions,new ArrayList<Action>() , version); //TODO:parse with actions
|
||||
output.add(new WithTreeItem(action, stack.pop(), withCommands));
|
||||
} else */if (action instanceof ActionStoreRegister) {
|
||||
} else /*if (action instanceof ActionTry) {
|
||||
ActionTry atry = (ActionTry) action;
|
||||
List<GraphTargetItem> tryCommands = ActionGraph.translateViaGraph(registerNames, variables, functions, atry.tryBody, version);
|
||||
TreeItem catchName;
|
||||
if (atry.catchInRegisterFlag) {
|
||||
catchName = new DirectValueTreeItem(atry, -1, new RegisterNumber(atry.catchRegister), new ArrayList<String>());
|
||||
} else {
|
||||
catchName = new DirectValueTreeItem(atry, -1, atry.catchName, new ArrayList<String>());
|
||||
}
|
||||
List<GraphTargetItem> catchExceptions = new ArrayList<GraphTargetItem>();
|
||||
catchExceptions.add(catchName);
|
||||
List<List<GraphTargetItem>> catchCommands = new ArrayList<List<GraphTargetItem>>();
|
||||
catchCommands.add(ActionGraph.translateViaGraph(registerNames, variables, functions, atry.catchBody, version));
|
||||
List<GraphTargetItem> finallyCommands = ActionGraph.translateViaGraph(registerNames, variables, functions, atry.finallyBody, version);
|
||||
output.add(new TryTreeItem(tryCommands, catchExceptions, catchCommands, finallyCommands));
|
||||
} else if (action instanceof ActionWith) {
|
||||
ActionWith awith = (ActionWith) action;
|
||||
List<GraphTargetItem> withCommands = ActionGraph.translateViaGraph(registerNames, variables, functions,new ArrayList<Action>() , version); //TODO:parse with actions
|
||||
output.add(new WithTreeItem(action, stack.pop(), withCommands));
|
||||
} else */ if (action instanceof ActionStoreRegister) {
|
||||
if ((ip + 1 <= end) && (actions.get(ip + 1) instanceof ActionPop)) {
|
||||
action.translate(localData, stack, output);
|
||||
stack.pop();
|
||||
@@ -1114,15 +1148,17 @@ public class Action implements GraphSourceItem {
|
||||
|
||||
public static List<Action> removeNops(long address, List<Action> actions, int version, long swfPos) {
|
||||
List<Action> ret = actions;
|
||||
if(true){
|
||||
if (true) {
|
||||
//return ret;
|
||||
}
|
||||
String s = null;
|
||||
try {
|
||||
s = Highlighting.stripHilights(Action.actionsToString(address, ret, null, version, false, swfPos));
|
||||
|
||||
ret = ASMParser.parse(address, swfPos, true, new ByteArrayInputStream(s.getBytes()), SWF.DEFAULT_VERSION);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error", ex);
|
||||
Helper.writeFile("as2.txt", s.getBytes());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1148,6 +1184,6 @@ public class Action implements GraphSourceItem {
|
||||
}
|
||||
|
||||
public String getASMSourceReplaced(List<GraphSourceItem> container, List<Long> knownAddreses, List<String> constantPool, int version, boolean hex) {
|
||||
return getASMSource(container,knownAddreses, constantPool, version, hex);
|
||||
return getASMSource(container, knownAddreses, constantPool, version, hex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ActionGraph extends Graph {
|
||||
}
|
||||
|
||||
public static List<GraphTargetItem> translateViaGraph(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List code, int version) {
|
||||
|
||||
|
||||
ActionGraph g = new ActionGraph(code, registerNames, variables, functions, version);
|
||||
List localData = new ArrayList();
|
||||
localData.add(registerNames);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
@@ -28,8 +27,6 @@ public class ActionGraphSource extends GraphSource {
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ActionGraphSource(List<GraphSourceItem> actions, int version, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
this.actions = actions;
|
||||
this.version = version;
|
||||
@@ -61,93 +58,92 @@ public class ActionGraphSource extends GraphSource {
|
||||
public List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end) {
|
||||
return (Action.actionsPartToTree(registerNames, variables, functions, stack, actions, start, end, version));
|
||||
}
|
||||
|
||||
private List<Long> posCache=null;
|
||||
private List<Long> posCache = null;
|
||||
|
||||
private void rebuildCache(){
|
||||
private void rebuildCache() {
|
||||
posCache = new ArrayList<Long>();
|
||||
for(int i=0;i<size();i++){
|
||||
for (int i = 0; i < size(); i++) {
|
||||
posCache.add(pos2adr(i));
|
||||
}
|
||||
}
|
||||
|
||||
/* public int adr2posInside(long addr){
|
||||
long lastAddr=0;
|
||||
if(addr==0){
|
||||
return 0;
|
||||
}
|
||||
for(int i=0;i<size();i++){
|
||||
long curAdr=pos2adr(i);
|
||||
if(curAdr==addr){
|
||||
return i;
|
||||
}
|
||||
if(curAdr>addr){
|
||||
System.err.println("lastAddr="+lastAddr+" addr="+addr+" curAddr="+curAdr);
|
||||
int contPos=adr2pos(lastAddr);
|
||||
System.err.println("/insadr2po");
|
||||
GraphSourceItem src=get(contPos);
|
||||
if(src instanceof ActionContainer){
|
||||
ActionContainer cnt=(ActionContainer)src;
|
||||
return new ActionGraphSource(cnt.getActions(), version, registerNames, variables, functions).adr2pos(addr);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
lastAddr=curAdr;
|
||||
}
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
/* public int adr2posInside(long addr){
|
||||
long lastAddr=0;
|
||||
if(addr==0){
|
||||
return 0;
|
||||
}
|
||||
for(int i=0;i<size();i++){
|
||||
long curAdr=pos2adr(i);
|
||||
if(curAdr==addr){
|
||||
return i;
|
||||
}
|
||||
if(curAdr>addr){
|
||||
System.err.println("lastAddr="+lastAddr+" addr="+addr+" curAddr="+curAdr);
|
||||
int contPos=adr2pos(lastAddr);
|
||||
System.err.println("/insadr2po");
|
||||
GraphSourceItem src=get(contPos);
|
||||
if(src instanceof ActionContainer){
|
||||
ActionContainer cnt=(ActionContainer)src;
|
||||
return new ActionGraphSource(cnt.getActions(), version, registerNames, variables, functions).adr2pos(addr);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
lastAddr=curAdr;
|
||||
}
|
||||
return -1;
|
||||
}*/
|
||||
@Override
|
||||
public int adr2pos(long adr) {
|
||||
if(posCache==null){
|
||||
if (posCache == null) {
|
||||
rebuildCache();
|
||||
}
|
||||
if(adr==0){
|
||||
return 0;
|
||||
}
|
||||
int ret=posCache.indexOf((Long)adr);
|
||||
if(ret==-1){
|
||||
if(!posCache.isEmpty() && (adr>posCache.get(posCache.size()-1))){
|
||||
return size();
|
||||
}
|
||||
//ret = adr2posInside(adr);
|
||||
if(ret==-1){
|
||||
Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "Address loc"+Helper.formatAddress(adr)+" not found");
|
||||
/*System.err.println("Addr loc"+Helper.formatAddress(adr)+" not found");
|
||||
int pos=0;
|
||||
for(long l:posCache){
|
||||
System.err.println("ip "+pos+" action "+get(pos).toString()+" loc"+Helper.formatAddress(l));
|
||||
pos++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
/*int pos = 0;
|
||||
long lastAddr = 0;
|
||||
for (Action a : actions) {
|
||||
lastAddr = a.getAddress();
|
||||
System.err.println("ip "+pos+" addr "+Helper.formatAddress(lastAddr));
|
||||
if (lastAddr == adr) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
if (adr > lastAddr) {
|
||||
return actions.size();
|
||||
}
|
||||
if (adr == 0) {
|
||||
return 0;
|
||||
}
|
||||
//throw new RuntimeException("Address "+Helper.formatAddress(adr)+" not found");
|
||||
return -1;*/
|
||||
int ret = posCache.indexOf((Long) adr);
|
||||
if (ret == -1) {
|
||||
if (!posCache.isEmpty() && (adr > posCache.get(posCache.size() - 1))) {
|
||||
return size();
|
||||
}
|
||||
//ret = adr2posInside(adr);
|
||||
if (ret == -1) {
|
||||
Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "Address loc" + Helper.formatAddress(adr) + " not found");
|
||||
/*System.err.println("Addr loc"+Helper.formatAddress(adr)+" not found");
|
||||
int pos=0;
|
||||
for(long l:posCache){
|
||||
System.err.println("ip "+pos+" action "+get(pos).toString()+" loc"+Helper.formatAddress(l));
|
||||
pos++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
/*int pos = 0;
|
||||
long lastAddr = 0;
|
||||
for (Action a : actions) {
|
||||
lastAddr = a.getAddress();
|
||||
System.err.println("ip "+pos+" addr "+Helper.formatAddress(lastAddr));
|
||||
if (lastAddr == adr) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
if (adr > lastAddr) {
|
||||
return actions.size();
|
||||
}
|
||||
if (adr == 0) {
|
||||
return 0;
|
||||
}
|
||||
//throw new RuntimeException("Address "+Helper.formatAddress(adr)+" not found");
|
||||
return -1;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public long pos2adr(int pos) {
|
||||
GraphSourceItem si=actions.get(pos);
|
||||
if(si instanceof Action){
|
||||
return ((Action)si) .getAddress();//Action.ip2adr(actions, pos, version);
|
||||
GraphSourceItem si = actions.get(pos);
|
||||
if (si instanceof Action) {
|
||||
return ((Action) si).getAddress();//Action.ip2adr(actions, pos, version);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -316,6 +316,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
setHex(hexButton.isSelected());
|
||||
} else if (e.getActionCommand().equals("SAVEACTION")) {
|
||||
try {
|
||||
Helper.writeFile("as.txt", editor.getText().getBytes());
|
||||
src.setActions(ASMParser.parse(0, src.getPos(), true, new ByteArrayInputStream(editor.getText().getBytes()), SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION);
|
||||
setSource(this.src);
|
||||
JOptionPane.showMessageDialog(this, "Code successfully saved");
|
||||
|
||||
@@ -19,17 +19,18 @@ package com.jpexs.decompiler.flash.action.parser;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionStrictMode;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.swf3.*;
|
||||
import com.jpexs.decompiler.flash.action.swf4.*;
|
||||
import com.jpexs.decompiler.flash.action.swf5.*;
|
||||
import com.jpexs.decompiler.flash.action.swf6.*;
|
||||
import com.jpexs.decompiler.flash.action.swf7.*;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
@@ -39,7 +40,8 @@ public class ASMParser {
|
||||
|
||||
public static List<Action> parse(long containerSWFOffset, boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ParseException {
|
||||
List<Action> list = new ArrayList<Action>();
|
||||
Stack<GraphSourceItemContainer> containers=new Stack<GraphSourceItemContainer>();
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<GraphSourceItemContainer>();
|
||||
HashMap<GraphSourceItemContainer, Integer> containerPos = new HashMap<GraphSourceItemContainer, Integer>();
|
||||
while (true) {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ParsedSymbol.TYPE_LABEL) {
|
||||
@@ -54,248 +56,253 @@ public class ASMParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(symb.type == ParsedSymbol.TYPE_BLOCK_END){
|
||||
if(containers.isEmpty()){
|
||||
} else if (symb.type == ParsedSymbol.TYPE_BLOCK_END) {
|
||||
if (containers.isEmpty()) {
|
||||
throw new ParseException("Block end without start", lexer.yyline());
|
||||
}
|
||||
GraphSourceItemContainer a=containers.pop();
|
||||
a.setEndAddress(address);
|
||||
}else if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
GraphSourceItemContainer a = containers.peek();
|
||||
int pos = containerPos.get(a);
|
||||
containerPos.put(a, pos);
|
||||
if (!a.parseDivision(pos, address, lexer)) {
|
||||
containers.pop();
|
||||
}
|
||||
} else if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
String instructionName = ((String) symb.value).toLowerCase();
|
||||
Action a =null;
|
||||
Action a = null;
|
||||
if (instructionName.equals("GetURL".toLowerCase())) {
|
||||
a=new ActionGetURL(lexer);
|
||||
a = new ActionGetURL(lexer);
|
||||
} else if (instructionName.equals("GoToLabel".toLowerCase())) {
|
||||
a=(new ActionGoToLabel(lexer));
|
||||
a = (new ActionGoToLabel(lexer));
|
||||
} else if (instructionName.equals("GotoFrame".toLowerCase())) {
|
||||
a=(new ActionGotoFrame(lexer));
|
||||
a = (new ActionGotoFrame(lexer));
|
||||
} else if (instructionName.equals("NextFrame".toLowerCase())) {
|
||||
a=(new ActionNextFrame());
|
||||
a = (new ActionNextFrame());
|
||||
} else if (instructionName.equals("Play".toLowerCase())) {
|
||||
a=(new ActionPlay());
|
||||
a = (new ActionPlay());
|
||||
} else if (instructionName.equals("PrevFrame".toLowerCase())) {
|
||||
a=(new ActionPrevFrame());
|
||||
a = (new ActionPrevFrame());
|
||||
} else if (instructionName.equals("SetTarget".toLowerCase())) {
|
||||
a=(new ActionSetTarget(lexer));
|
||||
a = (new ActionSetTarget(lexer));
|
||||
} else if (instructionName.equals("Stop".toLowerCase())) {
|
||||
a=(new ActionStop());
|
||||
a = (new ActionStop());
|
||||
} else if (instructionName.equals("StopSounds".toLowerCase())) {
|
||||
a=(new ActionStopSounds());
|
||||
a = (new ActionStopSounds());
|
||||
} else if (instructionName.equals("ToggleQuality".toLowerCase())) {
|
||||
a=(new ActionToggleQuality());
|
||||
a = (new ActionToggleQuality());
|
||||
} else if (instructionName.equals("WaitForFrame".toLowerCase())) {
|
||||
a=(new ActionWaitForFrame(lexer));
|
||||
a = (new ActionWaitForFrame(lexer));
|
||||
} else if (instructionName.equals("Add".toLowerCase())) {
|
||||
a=(new ActionAdd());
|
||||
a = (new ActionAdd());
|
||||
} else if (instructionName.equals("And".toLowerCase())) {
|
||||
a=(new ActionAnd());
|
||||
a = (new ActionAnd());
|
||||
} else if (instructionName.equals("AsciiToChar".toLowerCase())) {
|
||||
a=(new ActionAsciiToChar());
|
||||
a = (new ActionAsciiToChar());
|
||||
} else if (instructionName.equals("Call".toLowerCase())) {
|
||||
a=(new ActionCall());
|
||||
a = (new ActionCall());
|
||||
} else if (instructionName.equals("CharToAscii".toLowerCase())) {
|
||||
a=(new ActionCharToAscii());
|
||||
a = (new ActionCharToAscii());
|
||||
} else if (instructionName.equals("CloneSprite".toLowerCase())) {
|
||||
a=(new ActionCloneSprite());
|
||||
a = (new ActionCloneSprite());
|
||||
} else if (instructionName.equals("Divide".toLowerCase())) {
|
||||
a=(new ActionDivide());
|
||||
a = (new ActionDivide());
|
||||
} else if (instructionName.equals("EndDrag".toLowerCase())) {
|
||||
a=(new ActionEndDrag());
|
||||
a = (new ActionEndDrag());
|
||||
} else if (instructionName.equals("Equals".toLowerCase())) {
|
||||
a=(new ActionEquals());
|
||||
a = (new ActionEquals());
|
||||
} else if (instructionName.equals("GetProperty".toLowerCase())) {
|
||||
a=(new ActionGetProperty());
|
||||
a = (new ActionGetProperty());
|
||||
} else if (instructionName.equals("GetTime".toLowerCase())) {
|
||||
a=(new ActionGetTime());
|
||||
a = (new ActionGetTime());
|
||||
} else if (instructionName.equals("GetURL2".toLowerCase())) {
|
||||
a=(new ActionGetURL2(lexer));
|
||||
a = (new ActionGetURL2(lexer));
|
||||
} else if (instructionName.equals("GetVariable".toLowerCase())) {
|
||||
a=(new ActionGetVariable());
|
||||
a = (new ActionGetVariable());
|
||||
} else if (instructionName.equals("GotoFrame2".toLowerCase())) {
|
||||
a=(new ActionGotoFrame2(lexer));
|
||||
a = (new ActionGotoFrame2(lexer));
|
||||
} else if (instructionName.equals("If".toLowerCase())) {
|
||||
a=(new ActionIf(lexer));
|
||||
a = (new ActionIf(lexer));
|
||||
} else if (instructionName.equals("Jump".toLowerCase())) {
|
||||
a=(new ActionJump(lexer));
|
||||
a = (new ActionJump(lexer));
|
||||
} else if (instructionName.equals("Less".toLowerCase())) {
|
||||
a=(new ActionLess());
|
||||
a = (new ActionLess());
|
||||
} else if (instructionName.equals("MBAsciiToChar".toLowerCase())) {
|
||||
a=(new ActionMBAsciiToChar());
|
||||
a = (new ActionMBAsciiToChar());
|
||||
} else if (instructionName.equals("MBCharToAscii".toLowerCase())) {
|
||||
a=(new ActionMBCharToAscii());
|
||||
a = (new ActionMBCharToAscii());
|
||||
} else if (instructionName.equals("MBStringExtract".toLowerCase())) {
|
||||
a=(new ActionMBStringExtract());
|
||||
a = (new ActionMBStringExtract());
|
||||
} else if (instructionName.equals("MBStringLength".toLowerCase())) {
|
||||
a=(new ActionMBStringLength());
|
||||
a = (new ActionMBStringLength());
|
||||
} else if (instructionName.equals("Multiply".toLowerCase())) {
|
||||
a=(new ActionMultiply());
|
||||
a = (new ActionMultiply());
|
||||
} else if (instructionName.equals("Not".toLowerCase())) {
|
||||
a=(new ActionNot());
|
||||
a = (new ActionNot());
|
||||
} else if (instructionName.equals("Or".toLowerCase())) {
|
||||
a=(new ActionOr());
|
||||
a = (new ActionOr());
|
||||
} else if (instructionName.equals("Pop".toLowerCase())) {
|
||||
a=(new ActionPop());
|
||||
a = (new ActionPop());
|
||||
} else if (instructionName.equals("Push".toLowerCase())) {
|
||||
a=(new ActionPush(lexer, constantPool));
|
||||
a = (new ActionPush(lexer, constantPool));
|
||||
} else if (instructionName.equals("RandomNumber".toLowerCase())) {
|
||||
a=(new ActionRandomNumber());
|
||||
a = (new ActionRandomNumber());
|
||||
} else if (instructionName.equals("RemoveSprite".toLowerCase())) {
|
||||
a=(new ActionRemoveSprite());
|
||||
a = (new ActionRemoveSprite());
|
||||
} else if (instructionName.equals("SetProperty".toLowerCase())) {
|
||||
a=(new ActionSetProperty());
|
||||
a = (new ActionSetProperty());
|
||||
} else if (instructionName.equals("SetTarget2".toLowerCase())) {
|
||||
a=(new ActionSetTarget2());
|
||||
a = (new ActionSetTarget2());
|
||||
} else if (instructionName.equals("SetVariable".toLowerCase())) {
|
||||
a=(new ActionSetVariable());
|
||||
a = (new ActionSetVariable());
|
||||
} else if (instructionName.equals("StartDrag".toLowerCase())) {
|
||||
a=(new ActionStartDrag());
|
||||
a = (new ActionStartDrag());
|
||||
} else if (instructionName.equals("StringAdd".toLowerCase())) {
|
||||
a=(new ActionStringAdd());
|
||||
a = (new ActionStringAdd());
|
||||
} else if (instructionName.equals("StringEquals".toLowerCase())) {
|
||||
a=(new ActionStringEquals());
|
||||
a = (new ActionStringEquals());
|
||||
} else if (instructionName.equals("StringExtract".toLowerCase())) {
|
||||
a=(new ActionStringExtract());
|
||||
a = (new ActionStringExtract());
|
||||
} else if (instructionName.equals("StringLength".toLowerCase())) {
|
||||
a=(new ActionStringLength());
|
||||
a = (new ActionStringLength());
|
||||
} else if (instructionName.equals("StringLess".toLowerCase())) {
|
||||
a=(new ActionStringLess());
|
||||
a = (new ActionStringLess());
|
||||
} else if (instructionName.equals("Subtract".toLowerCase())) {
|
||||
a=(new ActionSubtract());
|
||||
a = (new ActionSubtract());
|
||||
} else if (instructionName.equals("ToInteger".toLowerCase())) {
|
||||
a=(new ActionToInteger());
|
||||
a = (new ActionToInteger());
|
||||
} else if (instructionName.equals("Trace".toLowerCase())) {
|
||||
a=(new ActionTrace());
|
||||
a = (new ActionTrace());
|
||||
} else if (instructionName.equals("WaitForFrame2".toLowerCase())) {
|
||||
a=(new ActionWaitForFrame2(lexer));
|
||||
a = (new ActionWaitForFrame2(lexer));
|
||||
} else if (instructionName.equals("Add2".toLowerCase())) {
|
||||
a=(new ActionAdd2());
|
||||
a = (new ActionAdd2());
|
||||
} else if (instructionName.equals("BitAnd".toLowerCase())) {
|
||||
a=(new ActionBitAnd());
|
||||
a = (new ActionBitAnd());
|
||||
} else if (instructionName.equals("BitLShift".toLowerCase())) {
|
||||
a=(new ActionBitLShift());
|
||||
a = (new ActionBitLShift());
|
||||
} else if (instructionName.equals("BitOr".toLowerCase())) {
|
||||
a=(new ActionBitOr());
|
||||
a = (new ActionBitOr());
|
||||
} else if (instructionName.equals("BitRShift".toLowerCase())) {
|
||||
a=(new ActionBitRShift());
|
||||
a = (new ActionBitRShift());
|
||||
} else if (instructionName.equals("BitURShift".toLowerCase())) {
|
||||
a=(new ActionBitURShift());
|
||||
a = (new ActionBitURShift());
|
||||
} else if (instructionName.equals("BitXor".toLowerCase())) {
|
||||
a=(new ActionBitXor());
|
||||
a = (new ActionBitXor());
|
||||
} else if (instructionName.equals("CallFunction".toLowerCase())) {
|
||||
a=(new ActionCallFunction());
|
||||
a = (new ActionCallFunction());
|
||||
} else if (instructionName.equals("CallMethod".toLowerCase())) {
|
||||
a=(new ActionCallMethod());
|
||||
a = (new ActionCallMethod());
|
||||
} else if (instructionName.equals("ConstantPool".toLowerCase())) {
|
||||
ActionConstantPool acp = new ActionConstantPool(lexer);
|
||||
constantPool = acp.constantPool;
|
||||
a=(acp);
|
||||
a = (acp);
|
||||
} else if (instructionName.equals("Decrement".toLowerCase())) {
|
||||
a=(new ActionDecrement());
|
||||
a = (new ActionDecrement());
|
||||
} else if (instructionName.equals("DefineFunction".toLowerCase())) {
|
||||
a=(new ActionDefineFunction(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
a = (new ActionDefineFunction(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
} else if (instructionName.equals("DefineLocal".toLowerCase())) {
|
||||
a=(new ActionDefineLocal());
|
||||
a = (new ActionDefineLocal());
|
||||
} else if (instructionName.equals("DefineLocal2".toLowerCase())) {
|
||||
a=(new ActionDefineLocal2());
|
||||
a = (new ActionDefineLocal2());
|
||||
} else if (instructionName.equals("Delete".toLowerCase())) {
|
||||
a=(new ActionDelete());
|
||||
a = (new ActionDelete());
|
||||
} else if (instructionName.equals("Delete2".toLowerCase())) {
|
||||
a=(new ActionDelete2());
|
||||
a = (new ActionDelete2());
|
||||
} else if (instructionName.equals("Enumerate".toLowerCase())) {
|
||||
a=(new ActionEnumerate());
|
||||
a = (new ActionEnumerate());
|
||||
} else if (instructionName.equals("Equals2".toLowerCase())) {
|
||||
a=(new ActionEquals2());
|
||||
a = (new ActionEquals2());
|
||||
} else if (instructionName.equals("GetMember".toLowerCase())) {
|
||||
a=(new ActionGetMember());
|
||||
a = (new ActionGetMember());
|
||||
} else if (instructionName.equals("Increment".toLowerCase())) {
|
||||
a=(new ActionIncrement());
|
||||
a = (new ActionIncrement());
|
||||
} else if (instructionName.equals("InitArray".toLowerCase())) {
|
||||
a=(new ActionInitArray());
|
||||
a = (new ActionInitArray());
|
||||
} else if (instructionName.equals("InitObject".toLowerCase())) {
|
||||
a=(new ActionInitObject());
|
||||
a = (new ActionInitObject());
|
||||
} else if (instructionName.equals("Less2".toLowerCase())) {
|
||||
a=(new ActionLess2());
|
||||
a = (new ActionLess2());
|
||||
} else if (instructionName.equals("Modulo".toLowerCase())) {
|
||||
a=(new ActionModulo());
|
||||
a = (new ActionModulo());
|
||||
} else if (instructionName.equals("NewMethod".toLowerCase())) {
|
||||
a=(new ActionNewMethod());
|
||||
a = (new ActionNewMethod());
|
||||
} else if (instructionName.equals("NewObject".toLowerCase())) {
|
||||
a=(new ActionNewObject());
|
||||
a = (new ActionNewObject());
|
||||
} else if (instructionName.equals("PushDuplicate".toLowerCase())) {
|
||||
a=(new ActionPushDuplicate());
|
||||
a = (new ActionPushDuplicate());
|
||||
} else if (instructionName.equals("Return".toLowerCase())) {
|
||||
a=(new ActionReturn());
|
||||
a = (new ActionReturn());
|
||||
} else if (instructionName.equals("SetMember".toLowerCase())) {
|
||||
a=(new ActionSetMember());
|
||||
a = (new ActionSetMember());
|
||||
} else if (instructionName.equals("StackSwap".toLowerCase())) {
|
||||
a=(new ActionStackSwap());
|
||||
a = (new ActionStackSwap());
|
||||
} else if (instructionName.equals("StoreRegister".toLowerCase())) {
|
||||
a=(new ActionStoreRegister(lexer));
|
||||
a = (new ActionStoreRegister(lexer));
|
||||
} else if (instructionName.equals("TargetPath".toLowerCase())) {
|
||||
a=(new ActionTargetPath());
|
||||
a = (new ActionTargetPath());
|
||||
} else if (instructionName.equals("ToNumber".toLowerCase())) {
|
||||
a=(new ActionToNumber());
|
||||
a = (new ActionToNumber());
|
||||
} else if (instructionName.equals("ToString".toLowerCase())) {
|
||||
a=(new ActionToString());
|
||||
a = (new ActionToString());
|
||||
} else if (instructionName.equals("TypeOf".toLowerCase())) {
|
||||
a=(new ActionTypeOf());
|
||||
a = (new ActionTypeOf());
|
||||
} else if (instructionName.equals("With".toLowerCase())) {
|
||||
a=(new ActionWith(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
a = (new ActionWith(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
} else if (instructionName.equals("Enumerate2".toLowerCase())) {
|
||||
a=(new ActionEnumerate2());
|
||||
a = (new ActionEnumerate2());
|
||||
} else if (instructionName.equals("Greater".toLowerCase())) {
|
||||
a=(new ActionGreater());
|
||||
a = (new ActionGreater());
|
||||
} else if (instructionName.equals("InstanceOf".toLowerCase())) {
|
||||
a=(new ActionInstanceOf());
|
||||
a = (new ActionInstanceOf());
|
||||
} else if (instructionName.equals("StrictEquals".toLowerCase())) {
|
||||
a=(new ActionStrictEquals());
|
||||
a = (new ActionStrictEquals());
|
||||
} else if (instructionName.equals("StringGreater".toLowerCase())) {
|
||||
a=(new ActionStringGreater());
|
||||
a = (new ActionStringGreater());
|
||||
} else if (instructionName.equals("CastOp".toLowerCase())) {
|
||||
a=(new ActionCastOp());
|
||||
a = (new ActionCastOp());
|
||||
} else if (instructionName.equals("DefineFunction2".toLowerCase())) {
|
||||
a=(new ActionDefineFunction2(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
a = (new ActionDefineFunction2(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
} else if (instructionName.equals("Extends".toLowerCase())) {
|
||||
a=(new ActionExtends());
|
||||
a = (new ActionExtends());
|
||||
} else if (instructionName.equals("ImplementsOp".toLowerCase())) {
|
||||
a=(new ActionImplementsOp());
|
||||
a = (new ActionImplementsOp());
|
||||
} else if (instructionName.equals("Throw".toLowerCase())) {
|
||||
a=(new ActionThrow());
|
||||
a = (new ActionThrow());
|
||||
} else if (instructionName.equals("Try".toLowerCase())) {
|
||||
a=(new ActionTry(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
a = (new ActionTry(containerSWFOffset + address, ignoreNops, labels, address, lexer, constantPool, version));
|
||||
} else if (instructionName.equals("FSCommand2".toLowerCase())) {
|
||||
a=(new ActionFSCommand2());
|
||||
a = (new ActionFSCommand2());
|
||||
} else if (instructionName.equals("StrictMode".toLowerCase())) {
|
||||
a=(new ActionStrictMode(lexer));
|
||||
a = (new ActionStrictMode(lexer));
|
||||
} else if (instructionName.equals("Nop".toLowerCase())) {
|
||||
if (!ignoreNops) {
|
||||
a=(new ActionNop());
|
||||
a = (new ActionNop());
|
||||
}
|
||||
}/* else if(instructionName.startsWith("ofs")) {
|
||||
continue;
|
||||
}*/ else {
|
||||
throw new ParseException("Unknown instruction name :" + instructionName, lexer.yyline());
|
||||
}
|
||||
if (a instanceof ActionNop) {
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(address, version, false);
|
||||
address += 1;
|
||||
} else if(a!=null) {
|
||||
if (a instanceof ActionNop) {
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(address, version, false);
|
||||
address += 1;
|
||||
} else if (a != null) {
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(address, version, false);
|
||||
address += a.getBytes(version).length;
|
||||
}
|
||||
if(a instanceof GraphSourceItemContainer){
|
||||
containers.push((GraphSourceItemContainer)a);
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
containers.push((GraphSourceItemContainer) a);
|
||||
containerPos.put((GraphSourceItemContainer) a, 0);
|
||||
}
|
||||
if(a!=null){
|
||||
if (a != null) {
|
||||
list.add(a);
|
||||
}
|
||||
} else if (symb.type == ParsedSymbol.TYPE_EOL) {
|
||||
} else if ((symb.type == ParsedSymbol.TYPE_BLOCK_END) || (symb.type == ParsedSymbol.TYPE_EOF)) {
|
||||
return list;
|
||||
} else {
|
||||
throw new ParseException("Label or Instruction name expected, found:" + symb.type, lexer.yyline());
|
||||
throw new ParseException("Label or Instruction name expected, found:" + symb.type + " " + symb.value, lexer.yyline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 9.3.13 17:48 */
|
||||
/* The following code was generated by JFlex 1.4.3 on 3.4.13 22:09 */
|
||||
|
||||
/* Flash assembler language lexer specification */
|
||||
package com.jpexs.decompiler.flash.action.parser;
|
||||
@@ -9,8 +9,9 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.swf4.Undefined;
|
||||
|
||||
/**
|
||||
* This class is a scanner generated by <a href="http://www.jflex.de/">JFlex</a>
|
||||
* 1.4.3 on 9.3.13 17:48 from the specification file
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3 on 3.4.13 22:09 from the
|
||||
* specification file
|
||||
* <tt>D:/Dokumenty/Programovani/JavaSE/FFDec/trunk/src/com/jpexs/decompiler/flash/action/parser/flasm.flex</tt>
|
||||
*/
|
||||
public final class FlasmLexer {
|
||||
@@ -42,92 +43,116 @@ public final class FlasmLexer {
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED =
|
||||
"\11\6\1\4\1\2\1\0\1\4\1\1\16\6\4\0\1\4\1\0"
|
||||
+ "\1\42\1\0\1\5\2\0\1\44\3\0\1\34\1\0\1\31\1\32"
|
||||
+ "\1\0\1\30\3\45\4\35\2\11\1\12\1\3\5\0\4\7\1\33"
|
||||
+ "\25\7\1\0\1\36\2\0\1\10\1\0\1\22\1\43\1\40\1\26"
|
||||
+ "\1\20\1\21\1\37\1\7\1\27\2\7\1\23\1\7\1\25\1\41"
|
||||
+ "\2\7\1\16\1\24\1\15\1\17\5\7\1\13\1\0\1\14\1\0"
|
||||
+ "\41\6\2\0\4\5\4\0\1\5\2\0\1\6\7\0\1\5\4\0"
|
||||
+ "\1\5\5\0\27\5\1\0\37\5\1\0\u013f\5\31\0\162\5\4\0"
|
||||
+ "\14\5\16\0\5\5\11\0\1\5\21\0\130\6\5\0\23\6\12\0"
|
||||
+ "\1\5\13\0\1\5\1\0\3\5\1\0\1\5\1\0\24\5\1\0"
|
||||
+ "\54\5\1\0\46\5\1\0\5\5\4\0\202\5\1\0\4\6\3\0"
|
||||
+ "\105\5\1\0\46\5\2\0\2\5\6\0\20\5\41\0\46\5\2\0"
|
||||
+ "\1\5\7\0\47\5\11\0\21\6\1\0\27\6\1\0\3\6\1\0"
|
||||
+ "\1\6\1\0\2\6\1\0\1\6\13\0\33\5\5\0\3\5\15\0"
|
||||
+ "\4\6\14\0\6\6\13\0\32\5\5\0\13\5\16\6\7\0\12\6"
|
||||
+ "\4\0\2\5\1\6\143\5\1\0\1\5\10\6\1\0\6\6\2\5"
|
||||
+ "\2\6\1\0\4\6\2\5\12\6\3\5\2\0\1\5\17\0\1\6"
|
||||
+ "\1\5\1\6\36\5\33\6\2\0\3\5\60\0\46\5\13\6\1\5"
|
||||
+ "\u014f\0\3\6\66\5\2\0\1\6\1\5\20\6\2\0\1\5\4\6"
|
||||
+ "\3\0\12\5\2\6\2\0\12\6\21\0\3\6\1\0\10\5\2\0"
|
||||
+ "\2\5\2\0\26\5\1\0\7\5\1\0\1\5\3\0\4\5\2\0"
|
||||
+ "\1\6\1\5\7\6\2\0\2\6\2\0\3\6\11\0\1\6\4\0"
|
||||
+ "\2\5\1\0\3\5\2\6\2\0\12\6\4\5\15\0\3\6\1\0"
|
||||
+ "\6\5\4\0\2\5\2\0\26\5\1\0\7\5\1\0\2\5\1\0"
|
||||
+ "\2\5\1\0\2\5\2\0\1\6\1\0\5\6\4\0\2\6\2\0"
|
||||
+ "\3\6\13\0\4\5\1\0\1\5\7\0\14\6\3\5\14\0\3\6"
|
||||
+ "\1\0\11\5\1\0\3\5\1\0\26\5\1\0\7\5\1\0\2\5"
|
||||
+ "\1\0\5\5\2\0\1\6\1\5\10\6\1\0\3\6\1\0\3\6"
|
||||
+ "\2\0\1\5\17\0\2\5\2\6\2\0\12\6\1\0\1\5\17\0"
|
||||
+ "\3\6\1\0\10\5\2\0\2\5\2\0\26\5\1\0\7\5\1\0"
|
||||
+ "\2\5\1\0\5\5\2\0\1\6\1\5\6\6\3\0\2\6\2\0"
|
||||
+ "\3\6\10\0\2\6\4\0\2\5\1\0\3\5\4\0\12\6\1\0"
|
||||
+ "\1\5\20\0\1\6\1\5\1\0\6\5\3\0\3\5\1\0\4\5"
|
||||
+ "\3\0\2\5\1\0\1\5\1\0\2\5\3\0\2\5\3\0\3\5"
|
||||
+ "\3\0\10\5\1\0\3\5\4\0\5\6\3\0\3\6\1\0\4\6"
|
||||
+ "\11\0\1\6\17\0\11\6\11\0\1\5\7\0\3\6\1\0\10\5"
|
||||
+ "\1\0\3\5\1\0\27\5\1\0\12\5\1\0\5\5\4\0\7\6"
|
||||
+ "\1\0\3\6\1\0\4\6\7\0\2\6\11\0\2\5\4\0\12\6"
|
||||
+ "\1\44\1\0\1\5\2\0\1\46\3\0\1\36\1\0\1\30\1\34"
|
||||
+ "\1\0\1\33\3\47\4\37\2\11\1\12\1\3\5\0\4\7\1\35"
|
||||
+ "\3\7\1\31\21\7\1\0\1\40\2\0\1\10\1\0\1\22\1\45"
|
||||
+ "\1\42\1\26\1\20\1\21\1\41\1\7\1\27\2\7\1\23\1\7"
|
||||
+ "\1\25\1\43\2\7\1\16\1\24\1\15\1\17\3\7\1\32\1\7"
|
||||
+ "\1\13\1\0\1\14\1\0\41\6\2\0\4\5\4\0\1\5\2\0"
|
||||
+ "\1\6\7\0\1\5\4\0\1\5\5\0\27\5\1\0\37\5\1\0"
|
||||
+ "\u01ca\5\4\0\14\5\16\0\5\5\7\0\1\5\1\0\1\5\21\0"
|
||||
+ "\160\6\5\5\1\0\2\5\2\0\4\5\10\0\1\5\1\0\3\5"
|
||||
+ "\1\0\1\5\1\0\24\5\1\0\123\5\1\0\213\5\1\0\5\6"
|
||||
+ "\2\0\236\5\11\0\46\5\2\0\1\5\7\0\47\5\11\0\55\6"
|
||||
+ "\1\0\1\6\1\0\2\6\1\0\2\6\1\0\1\6\10\0\33\5"
|
||||
+ "\5\0\3\5\15\0\4\6\7\0\1\5\4\0\13\6\5\0\53\5"
|
||||
+ "\37\6\4\0\2\5\1\6\143\5\1\0\1\5\10\6\1\0\6\6"
|
||||
+ "\2\5\2\6\1\0\4\6\2\5\12\6\3\5\2\0\1\5\17\0"
|
||||
+ "\1\6\1\5\1\6\36\5\33\6\2\0\131\5\13\6\1\5\16\0"
|
||||
+ "\12\6\41\5\11\6\2\5\4\0\1\5\5\0\26\5\4\6\1\5"
|
||||
+ "\11\6\1\5\3\6\1\5\5\6\22\0\31\5\3\6\244\0\4\6"
|
||||
+ "\66\5\3\6\1\5\22\6\1\5\7\6\12\5\2\6\2\0\12\6"
|
||||
+ "\1\0\7\5\1\0\7\5\1\0\3\6\1\0\10\5\2\0\2\5"
|
||||
+ "\2\0\26\5\1\0\7\5\1\0\1\5\3\0\4\5\2\0\1\6"
|
||||
+ "\1\5\7\6\2\0\2\6\2\0\3\6\1\5\10\0\1\6\4\0"
|
||||
+ "\2\5\1\0\3\5\2\6\2\0\12\6\4\5\7\0\1\5\5\0"
|
||||
+ "\3\6\1\0\6\5\4\0\2\5\2\0\26\5\1\0\7\5\1\0"
|
||||
+ "\2\5\1\0\2\5\1\0\2\5\2\0\1\6\1\0\5\6\4\0"
|
||||
+ "\2\6\2\0\3\6\3\0\1\6\7\0\4\5\1\0\1\5\7\0"
|
||||
+ "\14\6\3\5\1\6\13\0\3\6\1\0\11\5\1\0\3\5\1\0"
|
||||
+ "\26\5\1\0\7\5\1\0\2\5\1\0\5\5\2\0\1\6\1\5"
|
||||
+ "\10\6\1\0\3\6\1\0\3\6\2\0\1\5\17\0\2\5\2\6"
|
||||
+ "\2\0\12\6\1\0\1\5\17\0\3\6\1\0\10\5\2\0\2\5"
|
||||
+ "\2\0\26\5\1\0\7\5\1\0\2\5\1\0\5\5\2\0\1\6"
|
||||
+ "\1\5\7\6\2\0\2\6\2\0\3\6\10\0\2\6\4\0\2\5"
|
||||
+ "\1\0\3\5\2\6\2\0\12\6\1\0\1\5\20\0\1\6\1\5"
|
||||
+ "\1\0\6\5\3\0\3\5\1\0\4\5\3\0\2\5\1\0\1\5"
|
||||
+ "\1\0\2\5\3\0\2\5\3\0\3\5\3\0\14\5\4\0\5\6"
|
||||
+ "\3\0\3\6\1\0\4\6\2\0\1\5\6\0\1\6\16\0\12\6"
|
||||
+ "\11\0\1\5\7\0\3\6\1\0\10\5\1\0\3\5\1\0\27\5"
|
||||
+ "\1\0\12\5\1\0\5\5\3\0\1\5\7\6\1\0\3\6\1\0"
|
||||
+ "\4\6\7\0\2\6\1\0\2\5\6\0\2\5\2\6\2\0\12\6"
|
||||
+ "\22\0\2\6\1\0\10\5\1\0\3\5\1\0\27\5\1\0\12\5"
|
||||
+ "\1\0\5\5\2\0\1\6\1\5\7\6\1\0\3\6\1\0\4\6"
|
||||
+ "\7\0\2\6\7\0\1\5\1\0\2\5\4\0\12\6\22\0\2\6"
|
||||
+ "\1\0\10\5\1\0\3\5\1\0\27\5\1\0\20\5\4\0\6\6"
|
||||
+ "\2\0\3\6\1\0\4\6\11\0\1\6\10\0\2\5\4\0\12\6"
|
||||
+ "\22\0\2\6\1\0\22\5\3\0\30\5\1\0\11\5\1\0\1\5"
|
||||
+ "\2\0\7\5\3\0\1\6\4\0\6\6\1\0\1\6\1\0\10\6"
|
||||
+ "\22\0\2\6\15\0\60\5\1\6\2\5\7\6\4\0\10\5\10\6"
|
||||
+ "\1\0\12\6\47\0\2\5\1\0\1\5\2\0\2\5\1\0\1\5"
|
||||
+ "\2\0\1\5\6\0\4\5\1\0\7\5\1\0\3\5\1\0\1\5"
|
||||
+ "\1\0\1\5\2\0\2\5\1\0\4\5\1\6\2\5\6\6\1\0"
|
||||
+ "\2\6\1\5\2\0\5\5\1\0\1\5\1\0\6\6\2\0\12\6"
|
||||
+ "\2\0\2\5\42\0\1\5\27\0\2\6\6\0\12\6\13\0\1\6"
|
||||
+ "\1\0\1\6\1\0\1\6\4\0\2\6\10\5\1\0\42\5\6\0"
|
||||
+ "\24\6\1\0\2\6\4\5\4\0\10\6\1\0\44\6\11\0\1\6"
|
||||
+ "\71\0\42\5\1\0\5\5\1\0\2\5\1\0\7\6\3\0\4\6"
|
||||
+ "\6\0\12\6\6\0\6\5\4\6\106\0\46\5\12\0\51\5\7\0"
|
||||
+ "\132\5\5\0\104\5\5\0\122\5\6\0\7\5\1\0\77\5\1\0"
|
||||
+ "\1\5\1\0\4\5\2\0\7\5\1\0\1\5\1\0\4\5\2\0"
|
||||
+ "\47\5\1\0\1\5\1\0\4\5\2\0\37\5\1\0\1\5\1\0"
|
||||
+ "\4\5\2\0\7\5\1\0\1\5\1\0\4\5\2\0\7\5\1\0"
|
||||
+ "\7\5\1\0\27\5\1\0\37\5\1\0\1\5\1\0\4\5\2\0"
|
||||
+ "\7\5\1\0\47\5\1\0\23\5\16\0\11\6\56\0\125\5\14\0"
|
||||
+ "\u026c\5\2\0\10\5\12\0\32\5\5\0\113\5\3\0\3\5\17\0"
|
||||
+ "\7\0\2\6\7\0\1\5\1\0\2\5\2\6\2\0\12\6\1\0"
|
||||
+ "\2\5\17\0\2\6\1\0\10\5\1\0\3\5\1\0\51\5\2\0"
|
||||
+ "\1\5\7\6\1\0\3\6\1\0\4\6\1\5\10\0\1\6\10\0"
|
||||
+ "\2\5\2\6\2\0\12\6\12\0\6\5\2\0\2\6\1\0\22\5"
|
||||
+ "\3\0\30\5\1\0\11\5\1\0\1\5\2\0\7\5\3\0\1\6"
|
||||
+ "\4\0\6\6\1\0\1\6\1\0\10\6\22\0\2\6\15\0\60\5"
|
||||
+ "\1\6\2\5\7\6\4\0\10\5\10\6\1\0\12\6\47\0\2\5"
|
||||
+ "\1\0\1\5\2\0\2\5\1\0\1\5\2\0\1\5\6\0\4\5"
|
||||
+ "\1\0\7\5\1\0\3\5\1\0\1\5\1\0\1\5\2\0\2\5"
|
||||
+ "\1\0\4\5\1\6\2\5\6\6\1\0\2\6\1\5\2\0\5\5"
|
||||
+ "\1\0\1\5\1\0\6\6\2\0\12\6\2\0\2\5\42\0\1\5"
|
||||
+ "\27\0\2\6\6\0\12\6\13\0\1\6\1\0\1\6\1\0\1\6"
|
||||
+ "\4\0\2\6\10\5\1\0\44\5\4\0\24\6\1\0\2\6\5\5"
|
||||
+ "\13\6\1\0\44\6\11\0\1\6\71\0\53\5\24\6\1\5\12\6"
|
||||
+ "\6\0\6\5\4\6\4\5\3\6\1\5\3\6\2\5\7\6\3\5"
|
||||
+ "\4\6\15\5\14\6\1\5\17\6\2\0\46\5\12\0\53\5\1\0"
|
||||
+ "\1\5\3\0\u0149\5\1\0\4\5\2\0\7\5\1\0\1\5\1\0"
|
||||
+ "\4\5\2\0\51\5\1\0\4\5\2\0\41\5\1\0\4\5\2\0"
|
||||
+ "\7\5\1\0\1\5\1\0\4\5\2\0\17\5\1\0\71\5\1\0"
|
||||
+ "\4\5\2\0\103\5\2\0\3\6\40\0\20\5\20\0\125\5\14\0"
|
||||
+ "\u026c\5\2\0\21\5\1\0\32\5\5\0\113\5\3\0\3\5\17\0"
|
||||
+ "\15\5\1\0\4\5\3\6\13\0\22\5\3\6\13\0\22\5\2\6"
|
||||
+ "\14\0\15\5\1\0\3\5\1\0\2\6\14\0\64\5\40\6\3\0"
|
||||
+ "\1\5\3\0\2\5\1\6\2\0\12\6\41\0\3\6\2\0\12\6"
|
||||
+ "\6\0\130\5\10\0\51\5\1\6\126\0\35\5\3\0\14\6\4\0"
|
||||
+ "\14\6\12\0\12\6\36\5\2\0\5\5\u038b\0\154\5\224\0\234\5"
|
||||
+ "\4\0\132\5\6\0\26\5\2\0\6\5\2\0\46\5\2\0\6\5"
|
||||
+ "\2\0\10\5\1\0\1\5\1\0\1\5\1\0\1\5\1\0\37\5"
|
||||
+ "\2\0\65\5\1\0\7\5\1\0\1\5\3\0\3\5\1\0\7\5"
|
||||
+ "\3\0\4\5\2\0\6\5\4\0\15\5\5\0\3\5\1\0\7\5"
|
||||
+ "\17\0\4\6\32\0\5\6\20\0\2\5\23\0\1\5\13\0\4\6"
|
||||
+ "\6\0\6\6\1\0\1\5\15\0\1\5\40\0\22\5\36\0\15\6"
|
||||
+ "\4\0\1\6\3\0\6\6\27\0\1\5\4\0\1\5\2\0\12\5"
|
||||
+ "\1\0\1\5\3\0\5\5\6\0\1\5\1\0\1\5\1\0\1\5"
|
||||
+ "\1\0\4\5\1\0\3\5\1\0\7\5\3\0\3\5\5\0\5\5"
|
||||
+ "\26\0\44\5\u0e81\0\3\5\31\0\11\5\6\6\1\0\5\5\2\0"
|
||||
+ "\5\5\4\0\126\5\2\0\2\6\2\0\3\5\1\0\137\5\5\0"
|
||||
+ "\50\5\4\0\136\5\21\0\30\5\70\0\20\5\u0200\0\u19b6\5\112\0"
|
||||
+ "\u51a6\5\132\0\u048d\5\u0773\0\u2ba4\5\u215c\0\u012e\5\2\0\73\5\225\0"
|
||||
+ "\7\5\14\0\5\5\5\0\1\5\1\6\12\5\1\0\15\5\1\0"
|
||||
+ "\5\5\1\0\1\5\1\0\2\5\1\0\2\5\1\0\154\5\41\0"
|
||||
+ "\u016b\5\22\0\100\5\2\0\66\5\50\0\15\5\3\0\20\6\20\0"
|
||||
+ "\4\6\17\0\2\5\30\0\3\5\31\0\1\5\6\0\5\5\1\0"
|
||||
+ "\207\5\2\0\1\6\4\0\1\5\13\0\12\6\7\0\32\5\4\0"
|
||||
+ "\1\5\1\0\32\5\12\0\132\5\3\0\6\5\2\0\6\5\2\0"
|
||||
+ "\6\5\2\0\3\5\3\0\2\5\3\0\2\5\22\0\3\6\4\0";
|
||||
+ "\6\0\130\5\10\0\51\5\1\6\1\5\5\0\106\5\12\0\35\5"
|
||||
+ "\3\0\14\6\4\0\14\6\12\0\12\6\36\5\2\0\5\5\13\0"
|
||||
+ "\54\5\4\0\21\6\7\5\2\6\6\0\12\6\46\0\27\5\5\6"
|
||||
+ "\4\0\65\5\12\6\1\0\35\6\2\0\13\6\6\0\12\6\15\0"
|
||||
+ "\1\5\130\0\5\6\57\5\21\6\7\5\4\0\12\6\21\0\11\6"
|
||||
+ "\14\0\3\6\36\5\12\6\3\0\2\5\12\6\6\0\46\5\16\6"
|
||||
+ "\14\0\44\5\24\6\10\0\12\6\3\0\3\5\12\6\44\5\122\0"
|
||||
+ "\3\6\1\0\25\6\4\5\1\6\4\5\1\6\15\0\300\5\47\6"
|
||||
+ "\25\0\4\6\u0116\5\2\0\6\5\2\0\46\5\2\0\6\5\2\0"
|
||||
+ "\10\5\1\0\1\5\1\0\1\5\1\0\1\5\1\0\37\5\2\0"
|
||||
+ "\65\5\1\0\7\5\1\0\1\5\3\0\3\5\1\0\7\5\3\0"
|
||||
+ "\4\5\2\0\6\5\4\0\15\5\5\0\3\5\1\0\7\5\16\0"
|
||||
+ "\5\6\32\0\5\6\20\0\2\5\23\0\1\5\13\0\5\6\5\0"
|
||||
+ "\6\6\1\0\1\5\15\0\1\5\20\0\15\5\3\0\32\5\26\0"
|
||||
+ "\15\6\4\0\1\6\3\0\14\6\21\0\1\5\4\0\1\5\2\0"
|
||||
+ "\12\5\1\0\1\5\3\0\5\5\6\0\1\5\1\0\1\5\1\0"
|
||||
+ "\1\5\1\0\4\5\1\0\13\5\2\0\4\5\5\0\5\5\4\0"
|
||||
+ "\1\5\21\0\51\5\u0a77\0\57\5\1\0\57\5\1\0\205\5\6\0"
|
||||
+ "\4\5\3\6\16\0\46\5\12\0\66\5\11\0\1\5\17\0\1\6"
|
||||
+ "\27\5\11\0\7\5\1\0\7\5\1\0\7\5\1\0\7\5\1\0"
|
||||
+ "\7\5\1\0\7\5\1\0\7\5\1\0\7\5\1\0\40\6\57\0"
|
||||
+ "\1\5\u01d5\0\3\5\31\0\11\5\6\6\1\0\5\5\2\0\5\5"
|
||||
+ "\4\0\126\5\2\0\2\6\2\0\3\5\1\0\132\5\1\0\4\5"
|
||||
+ "\5\0\51\5\3\0\136\5\21\0\33\5\65\0\20\5\u0200\0\u19b6\5"
|
||||
+ "\112\0\u51cc\5\64\0\u048d\5\103\0\56\5\2\0\u010d\5\3\0\20\5"
|
||||
+ "\12\6\2\5\24\0\57\5\1\6\14\0\2\6\1\0\31\5\10\0"
|
||||
+ "\120\5\2\6\45\0\11\5\2\0\147\5\2\0\4\5\1\0\2\5"
|
||||
+ "\16\0\12\5\120\0\10\5\1\6\3\5\1\6\4\5\1\6\27\5"
|
||||
+ "\5\6\20\0\1\5\7\0\64\5\14\0\2\6\62\5\21\6\13\0"
|
||||
+ "\12\6\6\0\22\6\6\5\3\0\1\5\4\0\12\6\34\5\10\6"
|
||||
+ "\2\0\27\5\15\6\14\0\35\5\3\0\4\6\57\5\16\6\16\0"
|
||||
+ "\1\5\12\6\46\0\51\5\16\6\11\0\3\5\1\6\10\5\2\6"
|
||||
+ "\2\0\12\6\6\0\27\5\3\0\1\5\1\6\4\0\60\5\1\6"
|
||||
+ "\1\5\3\6\2\5\2\6\5\5\2\6\1\5\1\6\1\5\30\0"
|
||||
+ "\3\5\43\0\6\5\2\0\6\5\2\0\6\5\11\0\7\5\1\0"
|
||||
+ "\7\5\221\0\43\5\10\6\1\0\2\6\2\0\12\6\6\0\u2ba4\5"
|
||||
+ "\14\0\27\5\4\0\61\5\u2104\0\u012e\5\2\0\76\5\2\0\152\5"
|
||||
+ "\46\0\7\5\14\0\5\5\5\0\1\5\1\6\12\5\1\0\15\5"
|
||||
+ "\1\0\5\5\1\0\1\5\1\0\2\5\1\0\2\5\1\0\154\5"
|
||||
+ "\41\0\u016b\5\22\0\100\5\2\0\66\5\50\0\15\5\3\0\20\6"
|
||||
+ "\20\0\7\6\14\0\2\5\30\0\3\5\31\0\1\5\6\0\5\5"
|
||||
+ "\1\0\207\5\2\0\1\6\4\0\1\5\13\0\12\6\7\0\32\5"
|
||||
+ "\4\0\1\5\1\0\32\5\13\0\131\5\3\0\6\5\2\0\6\5"
|
||||
+ "\2\0\6\5\2\0\3\5\3\0\2\5\3\0\2\5\22\0\3\6"
|
||||
+ "\4\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
@@ -138,15 +163,17 @@ public final class FlasmLexer {
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 =
|
||||
"\3\0\3\1\1\2\1\3\1\4\2\5\1\1\1\6"
|
||||
+ "\2\7\1\10\1\11\1\12\1\13\5\11\1\12\2\1"
|
||||
+ "\1\11\1\14\1\0\1\15\1\16\1\17\1\20\1\21"
|
||||
+ "\1\22\2\23\1\24\1\25\1\26\1\27\1\0\1\30"
|
||||
+ "\5\11\1\30\2\12\1\11\1\23\1\30\1\0\6\11"
|
||||
+ "\1\31\3\11\1\32\3\11\1\33\12\11\2\34\1\35"
|
||||
+ "\2\36";
|
||||
+ "\2\7\1\10\1\11\1\12\1\13\5\11\1\1\1\11"
|
||||
+ "\1\12\1\1\1\11\1\14\1\0\1\15\1\16\1\17"
|
||||
+ "\1\20\1\21\1\22\2\23\1\24\1\25\1\26\1\27"
|
||||
+ "\1\0\1\30\5\11\1\12\1\0\1\12\1\11\1\30"
|
||||
+ "\1\11\1\23\1\30\1\0\5\11\1\0\2\11\1\31"
|
||||
+ "\3\11\1\32\1\0\4\11\1\33\1\0\4\11\1\0"
|
||||
+ "\4\11\1\0\4\11\1\0\1\30\1\11\2\34\1\35"
|
||||
+ "\1\30\2\36";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[86];
|
||||
int[] result = new int[102];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -170,20 +197,22 @@ public final class FlasmLexer {
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||
"\0\0\0\46\0\114\0\162\0\230\0\276\0\344\0\162"
|
||||
+ "\0\u010a\0\u0130\0\162\0\u0156\0\162\0\u017c\0\162\0\u01a2"
|
||||
+ "\0\u01c8\0\u01ee\0\162\0\u0214\0\u023a\0\u0260\0\u0286\0\u02ac"
|
||||
+ "\0\u02d2\0\u02f8\0\u031e\0\u0344\0\162\0\276\0\162\0\162"
|
||||
+ "\0\162\0\162\0\162\0\162\0\u036a\0\u0390\0\162\0\162"
|
||||
+ "\0\162\0\162\0\u03b6\0\u03dc\0\u0402\0\u0428\0\u044e\0\u0474"
|
||||
+ "\0\u049a\0\u02d2\0\u04c0\0\162\0\u04e6\0\162\0\u050c\0\u050c"
|
||||
+ "\0\u0532\0\u0558\0\u057e\0\u05a4\0\u05ca\0\u05f0\0\u01c8\0\u0616"
|
||||
+ "\0\u063c\0\u0662\0\u01c8\0\u0688\0\u06ae\0\u06d4\0\u01c8\0\u06fa"
|
||||
+ "\0\u0720\0\u0746\0\u076c\0\u0792\0\u07b8\0\u07de\0\u0804\0\u082a"
|
||||
+ "\0\u0850\0\u0876\0\u01c8\0\u01c8\0\u089c\0\u01c8";
|
||||
"\0\0\0\50\0\120\0\170\0\240\0\310\0\360\0\170"
|
||||
+ "\0\u0118\0\u0140\0\170\0\u0168\0\170\0\u0190\0\170\0\u01b8"
|
||||
+ "\0\u01e0\0\u0208\0\170\0\u0230\0\u0258\0\u0280\0\u02a8\0\u02d0"
|
||||
+ "\0\u02f8\0\u0320\0\u0348\0\u0370\0\u0398\0\170\0\310\0\170"
|
||||
+ "\0\170\0\170\0\170\0\170\0\170\0\u03c0\0\u03e8\0\170"
|
||||
+ "\0\170\0\170\0\170\0\u0410\0\u0438\0\u0460\0\u0488\0\u04b0"
|
||||
+ "\0\u04d8\0\u0500\0\u0528\0\u0550\0\170\0\u0578\0\u0348\0\u05a0"
|
||||
+ "\0\170\0\u05c8\0\u05c8\0\u05f0\0\u0618\0\u0640\0\u0668\0\u0690"
|
||||
+ "\0\u06b8\0\u06e0\0\u0708\0\u01e0\0\u0730\0\u0758\0\u0780\0\u01e0"
|
||||
+ "\0\u07a8\0\u07d0\0\u07f8\0\u0820\0\u0848\0\u01e0\0\u0870\0\u0898"
|
||||
+ "\0\u08c0\0\u08e8\0\u0910\0\u0938\0\u0960\0\u0988\0\u09b0\0\u09d8"
|
||||
+ "\0\u0a00\0\u0a28\0\u0a50\0\u0a78\0\u0aa0\0\u0ac8\0\u01e0\0\u0af0"
|
||||
+ "\0\u0b18\0\u01e0\0\u01e0\0\170\0\u0b40\0\u01e0";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[86];
|
||||
int[] result = new int[102];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -205,109 +234,136 @@ public final class FlasmLexer {
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\4\4\1\5\1\6\1\4\1\7\1\6\3\4\1\10"
|
||||
+ "\13\7\3\4\1\7\3\4\3\7\1\4\1\7\2\4"
|
||||
+ "\1\11\1\12\1\13\33\11\1\14\3\11\1\15\3\11"
|
||||
+ "\1\4\1\16\1\17\1\20\1\4\1\21\1\4\2\21"
|
||||
+ "\1\22\1\4\1\23\1\4\1\24\1\25\1\26\1\21"
|
||||
+ "\1\27\3\21\1\30\2\21\1\31\1\32\1\33\1\21"
|
||||
+ "\1\4\1\22\1\4\1\21\1\34\1\21\1\35\1\21"
|
||||
+ "\1\4\1\22\52\0\1\5\46\0\5\36\1\37\2\0"
|
||||
+ "\14\36\2\0\1\36\1\0\1\36\1\0\3\36\1\0"
|
||||
+ "\1\36\1\0\1\36\5\0\2\36\3\7\1\37\2\0"
|
||||
+ "\14\7\2\0\1\7\1\0\1\7\1\0\3\7\1\0"
|
||||
+ "\1\7\1\0\1\7\1\11\2\0\33\11\1\0\3\11"
|
||||
+ "\1\0\3\11\2\0\1\13\43\0\2\40\1\0\12\40"
|
||||
+ "\1\41\1\42\2\40\1\43\3\40\1\44\2\40\1\45"
|
||||
+ "\4\40\1\46\1\47\3\40\1\50\1\51\1\52\1\45"
|
||||
+ "\2\0\1\17\43\0\1\20\2\0\43\20\5\0\5\21"
|
||||
+ "\3\0\14\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\11\0\1\22\6\0\1\53"
|
||||
+ "\7\0\1\22\1\0\1\54\1\53\1\0\1\22\7\0"
|
||||
+ "\1\22\5\0\5\21\3\0\1\21\1\55\12\21\2\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\3\21\1\56\10\21\2\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\10\21\1\57\3\21\2\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\5\21\1\60\6\21\2\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\2\21\1\61\11\21\2\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\11\0\1\62\6\0\1\53\7\0\1\62\1\0"
|
||||
+ "\1\54\1\53\1\0\1\62\7\0\1\62\11\0\1\63"
|
||||
+ "\16\0\1\64\4\0\1\63\7\0\1\63\11\0\1\54"
|
||||
+ "\16\0\1\54\4\0\1\54\7\0\1\54\5\0\5\21"
|
||||
+ "\3\0\14\21\2\0\1\21\1\0\1\21\1\0\2\21"
|
||||
+ "\1\65\1\0\1\21\1\0\1\21\30\0\1\46\4\0"
|
||||
+ "\1\46\7\0\1\46\30\0\1\66\4\0\1\66\7\0"
|
||||
+ "\1\66\11\0\1\67\16\0\1\67\1\70\2\0\1\70"
|
||||
+ "\1\67\7\0\1\67\11\0\1\54\6\0\1\53\7\0"
|
||||
+ "\1\54\2\0\1\53\1\0\1\54\7\0\1\54\5\0"
|
||||
+ "\5\21\3\0\2\21\1\71\11\21\2\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\5\0"
|
||||
+ "\5\21\3\0\14\21\2\0\1\21\1\0\1\21\1\0"
|
||||
+ "\1\72\2\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\11\21\1\73\2\21\2\0\1\21\1\0\1\21"
|
||||
+ "\13\7\1\4\2\7\2\4\1\7\3\4\3\7\1\4"
|
||||
+ "\1\7\2\4\1\11\1\12\1\13\35\11\1\14\3\11"
|
||||
+ "\1\15\3\11\1\4\1\16\1\17\1\20\1\4\1\21"
|
||||
+ "\1\4\2\21\1\22\1\4\1\23\1\4\1\24\1\25"
|
||||
+ "\1\26\1\21\1\27\3\21\1\30\2\21\1\31\1\32"
|
||||
+ "\1\21\1\33\1\34\1\21\1\4\1\22\1\4\1\21"
|
||||
+ "\1\35\1\21\1\36\1\21\1\4\1\22\54\0\1\5"
|
||||
+ "\50\0\5\37\1\40\2\0\13\37\1\0\3\37\1\0"
|
||||
+ "\1\37\1\0\1\37\1\0\3\37\1\0\1\37\1\0"
|
||||
+ "\1\37\5\0\2\37\3\7\1\40\2\0\13\7\1\0"
|
||||
+ "\3\7\1\0\1\7\1\0\1\7\1\0\3\7\1\0"
|
||||
+ "\1\7\1\0\1\7\1\11\2\0\35\11\1\0\3\11"
|
||||
+ "\1\0\3\11\2\0\1\13\45\0\2\41\1\0\12\41"
|
||||
+ "\1\42\1\43\2\41\1\44\3\41\1\45\5\41\1\46"
|
||||
+ "\3\41\1\47\1\50\3\41\1\51\1\52\1\53\1\46"
|
||||
+ "\2\0\1\17\45\0\1\20\2\0\45\20\5\0\5\21"
|
||||
+ "\3\0\13\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\11\0\1\22"
|
||||
+ "\6\0\1\54\12\0\1\22\1\55\1\54\1\0\1\22"
|
||||
+ "\7\0\1\22\5\0\5\21\3\0\1\21\1\56\11\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\3\21"
|
||||
+ "\1\57\7\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\6\21\1\74\5\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\6\21\1\75\5\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\11\0\1\63"
|
||||
+ "\16\0\1\63\4\0\1\63\7\0\1\63\5\0\5\21"
|
||||
+ "\3\0\10\21\1\76\3\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\11\0\1\67"
|
||||
+ "\16\0\1\67\4\0\1\67\7\0\1\67\5\0\5\21"
|
||||
+ "\3\0\3\21\1\77\10\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\12\21\1\100\1\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\3\21\1\101\10\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\7\21\1\102\4\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\6\21\1\103\5\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\7\21\1\104\4\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\7\21\1\105\4\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\4\21\1\106\7\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\3\21\1\107\10\21\2\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\1\110\13\21\2\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\0\10\21\1\60\2\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\5\0\5\21\3\0\5\21\1\61\5\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\5\0\5\21\3\0\2\21\1\62\10\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\11\0\1\63\17\0\1\64"
|
||||
+ "\1\0\1\65\3\0\1\63\7\0\1\63\5\0\5\21"
|
||||
+ "\3\0\10\21\1\66\2\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\11\0\1\67\6\0\1\54\12\0\1\67\1\55\1\54"
|
||||
+ "\1\0\1\67\7\0\1\67\11\0\1\55\21\0\1\55"
|
||||
+ "\3\0\1\55\7\0\1\55\5\0\5\21\3\0\13\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\1\0\2\21"
|
||||
+ "\1\70\1\0\1\21\1\0\1\21\33\0\1\47\3\0"
|
||||
+ "\1\47\7\0\1\47\33\0\1\71\3\0\1\71\7\0"
|
||||
+ "\1\71\11\0\1\72\16\0\1\73\2\0\1\72\2\0"
|
||||
+ "\1\73\1\72\7\0\1\72\11\0\1\55\6\0\1\54"
|
||||
+ "\12\0\1\55\1\0\1\54\1\0\1\55\7\0\1\55"
|
||||
+ "\5\0\5\21\3\0\2\21\1\74\10\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\5\0\5\21\3\0\13\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\1\75\2\21\1\0"
|
||||
+ "\1\21\1\0\1\21\5\0\5\21\3\0\11\21\1\76"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\5\0\5\21\3\0"
|
||||
+ "\1\111\13\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\12\21"
|
||||
+ "\1\112\1\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\5\21"
|
||||
+ "\1\113\6\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\3\21"
|
||||
+ "\1\114\10\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\10\21"
|
||||
+ "\1\115\3\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\10\21"
|
||||
+ "\1\116\3\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\1\21"
|
||||
+ "\1\117\12\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\3\21"
|
||||
+ "\1\120\10\21\2\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\1\121"
|
||||
+ "\13\21\2\0\1\21\1\0\1\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\5\0\4\21\1\122\3\0\13\21"
|
||||
+ "\1\123\2\0\1\21\1\0\1\122\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\122\5\0\5\21\3\0\11\21\1\124"
|
||||
+ "\2\21\2\0\1\21\1\0\1\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\5\0\4\21\1\125\3\0\13\21"
|
||||
+ "\1\126\2\0\1\21\1\0\1\125\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\125\5\0\4\21\1\122\3\0\13\21"
|
||||
+ "\1\122\2\0\1\21\1\0\1\122\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\122\5\0\4\21\1\125\3\0\13\21"
|
||||
+ "\1\125\2\0\1\21\1\0\1\125\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\125";
|
||||
+ "\6\21\1\77\4\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\5\0"
|
||||
+ "\5\21\3\0\6\21\1\100\4\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\11\0\1\63\21\0\1\63\3\0\1\63\7\0"
|
||||
+ "\1\63\25\0\1\101\27\0\5\21\3\0\4\21\1\102"
|
||||
+ "\6\21\1\0\3\21\1\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\5\0\5\21\3\0"
|
||||
+ "\10\21\1\103\2\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\11\0"
|
||||
+ "\1\72\21\0\1\72\3\0\1\72\7\0\1\72\5\0"
|
||||
+ "\5\21\3\0\3\21\1\104\7\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\12\21\1\105\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\5\0\5\21\3\0\3\21\1\106\7\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\5\0\5\21\3\0\7\21"
|
||||
+ "\1\107\3\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\6\21\1\110\4\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\21\0\1\111\33\0\5\21\3\0\12\21\1\112\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\5\0\5\21\3\0\7\21\1\113"
|
||||
+ "\3\21\1\0\3\21\1\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\5\0\5\21\3\0"
|
||||
+ "\7\21\1\114\3\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\5\0"
|
||||
+ "\5\21\3\0\4\21\1\115\6\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\3\21\1\116\7\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\27\0\1\117\25\0\5\21\3\0"
|
||||
+ "\10\21\1\120\2\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\5\0"
|
||||
+ "\5\21\3\0\1\121\12\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\5\0\5\21\3\0\1\122\12\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\12\21\1\123\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\25\0\1\124\27\0\5\21\3\0\12\21"
|
||||
+ "\1\125\1\0\3\21\1\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\5\0\5\21\3\0"
|
||||
+ "\5\21\1\126\5\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\5\0"
|
||||
+ "\5\21\3\0\3\21\1\127\7\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\5\21\3\0\10\21\1\130\2\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\27\0\1\131\25\0\5\21\3\0"
|
||||
+ "\1\132\12\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\5\0\5\21"
|
||||
+ "\3\0\10\21\1\133\2\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\5\0\5\21\3\0\1\21\1\134\11\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\1\0\3\21\1\0\1\21"
|
||||
+ "\1\0\1\21\5\0\5\21\3\0\3\21\1\135\7\21"
|
||||
+ "\1\0\3\21\1\0\1\21\1\0\1\21\1\0\3\21"
|
||||
+ "\1\0\1\21\1\0\1\21\15\0\1\136\37\0\5\21"
|
||||
+ "\3\0\13\21\1\0\1\21\1\137\1\21\1\0\1\21"
|
||||
+ "\1\0\1\21\1\0\3\21\1\0\1\21\1\0\1\21"
|
||||
+ "\5\0\5\21\3\0\1\140\12\21\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\21\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\21\5\0\4\21\1\141\3\0\13\21\1\0\2\21"
|
||||
+ "\1\142\1\0\1\21\1\0\1\141\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\141\5\0\5\21\3\0\11\21\1\143"
|
||||
+ "\1\21\1\0\3\21\1\0\1\21\1\0\1\21\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\21\32\0\1\144\22\0"
|
||||
+ "\4\21\1\145\3\0\13\21\1\0\2\21\1\146\1\0"
|
||||
+ "\1\21\1\0\1\145\1\0\3\21\1\0\1\21\1\0"
|
||||
+ "\1\145\5\0\4\21\1\141\3\0\13\21\1\0\2\21"
|
||||
+ "\1\141\1\0\1\21\1\0\1\141\1\0\3\21\1\0"
|
||||
+ "\1\21\1\0\1\141\5\0\4\21\1\145\3\0\13\21"
|
||||
+ "\1\0\2\21\1\145\1\0\1\21\1\0\1\145\1\0"
|
||||
+ "\3\21\1\0\1\21\1\0\1\145";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[2242];
|
||||
int[] result = new int[2920];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -345,12 +401,14 @@ public final class FlasmLexer {
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\3\0\1\11\3\1\1\11\2\1\1\11\1\1\1\11"
|
||||
+ "\1\1\1\11\3\1\1\11\11\1\1\11\1\0\6\11"
|
||||
+ "\2\1\4\11\1\0\10\1\1\11\1\1\1\11\1\1"
|
||||
+ "\1\0\36\1";
|
||||
+ "\1\1\1\11\3\1\1\11\12\1\1\11\1\0\6\11"
|
||||
+ "\2\1\4\11\1\0\7\1\1\0\1\11\3\1\1\11"
|
||||
+ "\1\1\1\0\5\1\1\0\7\1\1\0\5\1\1\0"
|
||||
+ "\4\1\1\0\4\1\1\0\4\1\1\0\5\1\1\11"
|
||||
+ "\2\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[86];
|
||||
int[] result = new int[102];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -477,7 +535,7 @@ public final class FlasmLexer {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 1740) {
|
||||
while (i < 2202) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do {
|
||||
@@ -556,9 +614,9 @@ public final class FlasmLexer {
|
||||
* Resets the scanner to read from a new input stream. Does not close the
|
||||
* old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>ZZ_INITIAL</tt>.
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost). Lexical
|
||||
* state is set to <tt>ZZ_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
@@ -880,29 +938,30 @@ public final class FlasmLexer {
|
||||
}
|
||||
case 46:
|
||||
break;
|
||||
case 11: {
|
||||
yybegin(YYINITIAL);
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START);
|
||||
}
|
||||
case 47:
|
||||
break;
|
||||
case 15: {
|
||||
string.append('\t');
|
||||
}
|
||||
case 47:
|
||||
case 48:
|
||||
break;
|
||||
case 28: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_REGISTER, new RegisterNumber(Integer.parseInt(yytext().substring(8))));
|
||||
}
|
||||
case 48:
|
||||
case 49:
|
||||
break;
|
||||
case 24: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT, new Double(Double.parseDouble((yytext()))));
|
||||
}
|
||||
case 49:
|
||||
case 50:
|
||||
break;
|
||||
case 25: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN, Boolean.TRUE);
|
||||
}
|
||||
case 50:
|
||||
break;
|
||||
case 11: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START);
|
||||
}
|
||||
case 51:
|
||||
break;
|
||||
case 26: {
|
||||
|
||||
@@ -68,6 +68,7 @@ False = "false"
|
||||
Null = "null"
|
||||
Undefined = "undefined"
|
||||
|
||||
Infinity = -? "Infinity"
|
||||
|
||||
/* integer literals */
|
||||
PositiveNumberLiteral = 0 | [1-9][0-9]*
|
||||
@@ -76,7 +77,7 @@ NegativeNumberLiteral = - {PositiveNumberLiteral}
|
||||
NumberLiteral = {PositiveNumberLiteral}|{NegativeNumberLiteral}
|
||||
|
||||
/* floating point literals */
|
||||
FloatLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}?
|
||||
FloatLiteral = {Infinity} | (({FLit1}|{FLit2}|{FLit3}) {Exponent}?)
|
||||
|
||||
FLit1 = [0-9]+ \. [0-9]*
|
||||
FLit2 = \. [0-9]+
|
||||
@@ -126,7 +127,7 @@ Constant= constant{PositiveNumberLiteral}
|
||||
{FloatLiteral} { return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT,new Double(Double.parseDouble((yytext())))); }
|
||||
{LineTerminator} {yybegin(YYINITIAL); return new ParsedSymbol(ParsedSymbol.TYPE_EOL); }
|
||||
{Comment} {return new ParsedSymbol(ParsedSymbol.TYPE_COMMENT,yytext().substring(1));}
|
||||
{StartOfBlock} { return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START); }
|
||||
{StartOfBlock} { yybegin(YYINITIAL); return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START); }
|
||||
{True} {return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN,Boolean.TRUE);}
|
||||
{False} {return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN,Boolean.FALSE);}
|
||||
{Null} {return new ParsedSymbol(ParsedSymbol.TYPE_NULL,new Null());}
|
||||
|
||||
@@ -20,17 +20,12 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -52,29 +47,6 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
public List<String> constantPool;
|
||||
private long hdrSize;
|
||||
|
||||
@Override
|
||||
public long getEndAddress() {
|
||||
return getAddress()+getHeaderLength()+codeSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEndAddress(long address) {
|
||||
codeSize = (int)(address-getAddress()-getHeaderLength());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> getItems(List<GraphSourceItem> parent) {
|
||||
if(parent.isEmpty()){
|
||||
return parent;
|
||||
}
|
||||
ActionGraphSource src=new ActionGraphSource(parent, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
return parent.subList(src.adr2pos(getAddress()+getHeaderLength()),src.adr2pos(getAddress()+getHeaderLength()+codeSize));
|
||||
}
|
||||
|
||||
|
||||
public ActionDefineFunction(int actionLength, SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException {
|
||||
super(0x9B, actionLength);
|
||||
this.version = version;
|
||||
@@ -106,7 +78,8 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
//code = ASMParser.parse(containerSWFPos + getHeaderLength(), ignoreNops, labels, address + getPreLen(version), lexer, constantPool, version);
|
||||
}
|
||||
|
||||
public long getHeaderLength() {
|
||||
@Override
|
||||
public long getHeaderSize() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
@@ -126,28 +99,6 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
return baos2.toByteArray().length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getHeaderBytes() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
try {
|
||||
sos.writeString(functionName);
|
||||
sos.writeUI16(paramNames.size());
|
||||
for (String s : paramNames) {
|
||||
sos.writeString(s);
|
||||
}
|
||||
//byte codeBytes[] = Action.actionsToBytes(getActions(null), false, version);
|
||||
sos.writeUI16(codeSize);//codeBytes.length);
|
||||
sos.close();
|
||||
|
||||
|
||||
baos2.write(surroundWithAction(baos.toByteArray(), version));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return baos2.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes(int version) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
@@ -203,7 +154,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
paramStr += "\"" + Helper.escapeString(paramNames.get(i)) + "\"";
|
||||
paramStr += " ";
|
||||
}
|
||||
|
||||
|
||||
return "DefineFunction \"" + Helper.escapeString(functionName) + "\" " + paramNames.size() + " " + paramStr + " {";// + "\r\n" +Action.actionsToString(getAddress() + getHeaderLength(),getItems(container) , knownAddreses, constantPool, version, hex, getFileAddress() + hdrSize) + "}";
|
||||
}
|
||||
|
||||
@@ -217,7 +168,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
if (replacedFunctionName != null) {
|
||||
functionName = replacedFunctionName;
|
||||
}
|
||||
String ret = getASMSource(container,knownAddreses, constantPool, version, hex);
|
||||
String ret = getASMSource(container, knownAddreses, constantPool, version, hex);
|
||||
paramNames = oldParamNames;
|
||||
functionName = oldFunctionName;
|
||||
return ret;
|
||||
@@ -236,25 +187,36 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
|
||||
@Override
|
||||
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<GraphTargetItem> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames, content, constantPool, 1);
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames, content.get(0), constantPool, 1);
|
||||
//ActionGraph.translateViaGraph(regNames, variables, functions, code, version)
|
||||
stack.push(fti);
|
||||
functions.put(functionName, fti);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefineFunction";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataLength() {
|
||||
return codeSize;
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer) {
|
||||
codeSize = (int) (addr - getAddress() - getHeaderSize());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getContainerSizes() {
|
||||
List<Long> ret = new ArrayList<Long>();
|
||||
ret.add((Long) (long) codeSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSourceBetween(int pos) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,16 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.clauses.WithTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
@@ -41,27 +39,11 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
//public List<Action> actions;
|
||||
public int codeSize;
|
||||
public int version;
|
||||
|
||||
@Override
|
||||
public long getEndAddress() {
|
||||
return getAddress()+2+codeSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEndAddress(long address) {
|
||||
codeSize = (int)(address-getAddress()-2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> getItems(List<GraphSourceItem> parent) {
|
||||
if(parent.isEmpty()){
|
||||
return parent;
|
||||
}
|
||||
ActionGraphSource src=new ActionGraphSource(parent, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
return parent.subList(src.adr2pos(getAddress()+2),src.adr2pos(getAddress()+2+codeSize));
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer) {
|
||||
codeSize = (int) (addr - getAddress() - getHeaderSize());
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionWith(SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException {
|
||||
@@ -70,7 +52,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
this.version = version;
|
||||
//actions = new ArrayList<Action>();
|
||||
//actions = (new SWFInputStream(new ByteArrayInputStream(sis.readBytes(codeSize)), version)).readActionList(rri.getPos(), containerSWFOffset + getAddress() + 2, rri, codeSize);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ActionWith(long containerSWFPos, boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ParseException {
|
||||
@@ -87,21 +69,6 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getHeaderBytes() {
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
try {
|
||||
//byte codeBytes[] = Action.actionsToBytes(actions, false, version);
|
||||
sos.writeUI16(codeSize);//codeBytes.length);
|
||||
sos.close();
|
||||
baos2.write(surroundWithAction(baos.toByteArray(), version));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return baos2.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes(int version) {
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
@@ -134,13 +101,24 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataLength() {
|
||||
return codeSize;
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
output.add(new WithTreeItem(this, stack.pop(), content.get(0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<GraphTargetItem> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
output.add(new WithTreeItem(this, stack.pop(), content));
|
||||
public List<Long> getContainerSizes() {
|
||||
List<Long> ret = new ArrayList<Long>();
|
||||
ret.add((Long) (long) codeSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSourceBetween(int pos) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getHeaderSize() {
|
||||
return surroundWithAction(new byte[]{0, 0}, version).length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,17 +20,12 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionDefineFunction;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -61,29 +56,6 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
//public List<Action> code;
|
||||
private int version;
|
||||
public List<String> constantPool;
|
||||
|
||||
@Override
|
||||
public long getEndAddress() {
|
||||
return getAddress()+getHeaderLength()+codeSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEndAddress(long address) {
|
||||
codeSize = (int)(address-getAddress()-getHeaderLength());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> getItems(List<GraphSourceItem> parent) {
|
||||
if(parent.isEmpty()){
|
||||
return parent;
|
||||
}
|
||||
ActionGraphSource src=new ActionGraphSource(parent, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
return parent.subList(src.adr2pos(getAddress()+hdrSize),src.adr2pos(getAddress()+hdrSize+codeSize));
|
||||
}
|
||||
|
||||
|
||||
private long hdrSize;
|
||||
|
||||
public ActionDefineFunction2(int actionLength, SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException {
|
||||
@@ -138,7 +110,8 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
//code = ASMParser.parse(containerSWFPos + getHeaderLength(), ignoreNops, labels, address + getPreLen(version), lexer, constantPool, version);
|
||||
}
|
||||
|
||||
public long getHeaderLength() {
|
||||
@Override
|
||||
public long getHeaderSize() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
@@ -169,41 +142,6 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
return baos2.toByteArray().length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getHeaderBytes() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
try {
|
||||
sos.writeString(functionName);
|
||||
sos.writeUI16(paramNames.size());
|
||||
sos.writeUI8(registerCount);
|
||||
sos.writeUB(1, preloadParentFlag ? 1 : 0);
|
||||
sos.writeUB(1, preloadRootFlag ? 1 : 0);
|
||||
sos.writeUB(1, suppressSuperFlag ? 1 : 0);
|
||||
sos.writeUB(1, preloadSuperFlag ? 1 : 0);
|
||||
sos.writeUB(1, suppressArgumentsFlag ? 1 : 0);
|
||||
sos.writeUB(1, preloadArgumentsFlag ? 1 : 0);
|
||||
sos.writeUB(1, suppressThisFlag ? 1 : 0);
|
||||
sos.writeUB(1, preloadThisFlag ? 1 : 0);
|
||||
sos.writeUB(7, 0);
|
||||
sos.writeUB(1, preloadGlobalFlag ? 1 : 0);
|
||||
for (int i = 0; i < paramNames.size(); i++) {
|
||||
sos.writeUI8(paramRegisters.get(i));
|
||||
|
||||
sos.writeString(paramNames.get(i));
|
||||
}
|
||||
//byte codeBytes[] = Action.actionsToBytes(code, false, version);
|
||||
sos.writeUI16(codeSize);//codeBytes.length);
|
||||
sos.close();
|
||||
|
||||
|
||||
baos2.write(surroundWithAction(baos.toByteArray(), version));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return baos2.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes(int version) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
@@ -286,7 +224,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
if (replacedFunctionName != null) {
|
||||
functionName = replacedFunctionName;
|
||||
}
|
||||
String ret = getASMSource(container,knownAddreses, constantPool, version, hex);
|
||||
String ret = getASMSource(container, knownAddreses, constantPool, version, hex);
|
||||
paramNames = oldParamNames;
|
||||
functionName = oldFunctionName;
|
||||
return ret;
|
||||
@@ -343,12 +281,10 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
|
||||
@Override
|
||||
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<GraphTargetItem> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
HashMap<Integer, String> funcRegNames = (HashMap<Integer, String>) regNames.clone();
|
||||
for (int f = 0; f < paramNames.size(); f++) {
|
||||
int reg = paramRegisters.get(f);
|
||||
@@ -382,12 +318,10 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
pos++;
|
||||
}
|
||||
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames,content, constantPool, getFirstRegister());
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister());
|
||||
functions.put(functionName, fti);
|
||||
stack.push(fti);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Long> getAllRefs(int version) {
|
||||
@@ -400,7 +334,20 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataLength() {
|
||||
return codeSize;
|
||||
public List<Long> getContainerSizes() {
|
||||
List<Long> ret = new ArrayList<Long>();
|
||||
ret.add((Long) (long) codeSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer) {
|
||||
codeSize = (int) (addr - getAddress() - getHeaderSize());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSourceBetween(int pos) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,81 +22,53 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.*;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.TreeItem;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.clauses.TryTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
public class ActionTry extends Action {
|
||||
public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
|
||||
public boolean catchInRegisterFlag;
|
||||
public boolean finallyBlockFlag;
|
||||
public boolean catchBlockFlag;
|
||||
public String catchName;
|
||||
public int catchRegister;
|
||||
public List<Action> tryBody;
|
||||
public List<Action> catchBody;
|
||||
public List<Action> finallyBody;
|
||||
long tryPos;
|
||||
long catchPos;
|
||||
long finPos;
|
||||
long trySize;
|
||||
long catchSize;
|
||||
long finallySize;
|
||||
private int version;
|
||||
|
||||
public ActionTry(int actionLength, SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException {
|
||||
super(0x8F, actionLength);
|
||||
long startPos = sis.getPos();
|
||||
sis.readUB(5);
|
||||
this.version = version;
|
||||
catchInRegisterFlag = sis.readUB(1) == 1;
|
||||
finallyBlockFlag = sis.readUB(1) == 1;
|
||||
catchBlockFlag = sis.readUB(1) == 1;
|
||||
int trySize = sis.readUI16();
|
||||
int catchSize = sis.readUI16();
|
||||
int finallySize = sis.readUI16();
|
||||
trySize = sis.readUI16();
|
||||
catchSize = sis.readUI16();
|
||||
finallySize = sis.readUI16();
|
||||
if (catchInRegisterFlag) {
|
||||
catchRegister = sis.readUI8();
|
||||
} else {
|
||||
catchName = sis.readString();
|
||||
}
|
||||
tryPos = sis.getPos() - startPos;
|
||||
tryBody = sis.readActionList(rri.getPos(), getFileAddress() + tryPos, rri, trySize);
|
||||
catchPos = sis.getPos() - startPos;
|
||||
catchBody = sis.readActionList(rri.getPos(), getFileAddress() + catchPos, rri, catchSize);
|
||||
finPos = sis.getPos() - startPos;
|
||||
finallyBody = sis.readActionList(rri.getPos(), getFileAddress() + finPos, rri, finallySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAddress(long address, int version, boolean recursive) {
|
||||
super.setAddress(address, version, recursive);
|
||||
if (recursive) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
try {
|
||||
sos.writeUB(5, 0);
|
||||
sos.writeUB(1, catchInRegisterFlag ? 1 : 0);
|
||||
sos.writeUB(1, finallyBlockFlag ? 1 : 0);
|
||||
sos.writeUB(1, catchBlockFlag ? 1 : 0);
|
||||
byte tryBodyBytes[] = Action.actionsToBytes(tryBody, false, version);
|
||||
byte catchBodyBytes[] = Action.actionsToBytes(catchBody, false, version);
|
||||
byte finallyBodyBytes[] = Action.actionsToBytes(finallyBody, false, version);
|
||||
sos.writeUI16(tryBodyBytes.length);
|
||||
sos.writeUI16(catchBodyBytes.length);
|
||||
sos.writeUI16(finallyBodyBytes.length);
|
||||
if (catchInRegisterFlag) {
|
||||
sos.writeUI8(catchRegister);
|
||||
} else {
|
||||
sos.writeString(catchName);
|
||||
}
|
||||
Action.setActionsAddresses(tryBody, address + baos.toByteArray().length, version);
|
||||
sos.write(tryBodyBytes);
|
||||
Action.setActionsAddresses(catchBody, address + baos.toByteArray().length, version);
|
||||
sos.write(catchBodyBytes);
|
||||
Action.setActionsAddresses(finallyBody, address + baos.toByteArray().length, version);
|
||||
sos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,20 +80,14 @@ public class ActionTry extends Action {
|
||||
sos.writeUB(1, catchInRegisterFlag ? 1 : 0);
|
||||
sos.writeUB(1, finallyBlockFlag ? 1 : 0);
|
||||
sos.writeUB(1, catchBlockFlag ? 1 : 0);
|
||||
byte tryBodyBytes[] = Action.actionsToBytes(tryBody, false, version);
|
||||
byte catchBodyBytes[] = Action.actionsToBytes(catchBody, false, version);
|
||||
byte finallyBodyBytes[] = Action.actionsToBytes(finallyBody, false, version);
|
||||
sos.writeUI16(tryBodyBytes.length);
|
||||
sos.writeUI16(catchBodyBytes.length);
|
||||
sos.writeUI16(finallyBodyBytes.length);
|
||||
sos.writeUI16((int) trySize);
|
||||
sos.writeUI16((int) catchSize);
|
||||
sos.writeUI16((int) finallySize);
|
||||
if (catchInRegisterFlag) {
|
||||
sos.writeUI8(catchRegister);
|
||||
} else {
|
||||
sos.writeString(catchName);
|
||||
sos.writeString(catchName == null ? "" : catchName);
|
||||
}
|
||||
sos.write(tryBodyBytes);
|
||||
sos.write(catchBodyBytes);
|
||||
sos.write(finallyBodyBytes);
|
||||
sos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
@@ -130,85 +96,179 @@ public class ActionTry extends Action {
|
||||
|
||||
public ActionTry(long containerSWFPos, boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ParseException {
|
||||
super(0x8F, 0);
|
||||
lexBlockOpen(lexer);
|
||||
tryBody = ASMParser.parse(containerSWFPos/*TODO: FIX THIS!!!*/, ignoreNops, labels, address + 4 + 6, lexer, constantPool, version);
|
||||
this.version = version;
|
||||
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
catchBlockFlag = false;
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("catch")) {
|
||||
catchBlockFlag = true;
|
||||
ParsedSymbol catchedVal = lexer.yylex();
|
||||
if (catchedVal.type == ParsedSymbol.TYPE_REGISTER) {
|
||||
catchInRegisterFlag = true;
|
||||
catchRegister = ((RegisterNumber) catchedVal.value).number;
|
||||
} else if (catchedVal.type == ParsedSymbol.TYPE_STRING) {
|
||||
catchInRegisterFlag = false;
|
||||
catchName = (String) catchedVal.value;
|
||||
} else {
|
||||
throw new ParseException("Catched name or register expected", lexer.yyline());
|
||||
}
|
||||
lexBlockOpen(lexer);
|
||||
catchBody = ASMParser.parse(containerSWFPos/*TODO: FIX THIS!!!*/, ignoreNops, labels, address + 4 + 6 + Action.actionsToBytes(tryBody, false, version).length, lexer, constantPool, version);
|
||||
symb = lexer.yylex();
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("finally")) {
|
||||
finallyBlockFlag = true;
|
||||
lexBlockOpen(lexer);
|
||||
finallyBody = ASMParser.parse(containerSWFPos/*TODO: FIX THIS!!!*/, ignoreNops, labels, address + 4 + 6 + Action.actionsToBytes(tryBody, false, version).length + Action.actionsToBytes(catchBody, false, version).length, lexer, constantPool, version);
|
||||
} else {
|
||||
finallyBlockFlag = false;
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
} else {
|
||||
finallyBlockFlag = false;
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_STRING) {
|
||||
catchInRegisterFlag = false;
|
||||
catchName = (String) symb.value;
|
||||
} else if (symb.type == ParsedSymbol.TYPE_REGISTER) {
|
||||
catchRegister = (Integer) symb.value;
|
||||
catchInRegisterFlag = true;
|
||||
} else if (symb.type == ParsedSymbol.TYPE_BLOCK_START) {
|
||||
return;
|
||||
} else {
|
||||
lexer.yypushback(lexer.yylength());
|
||||
throw new ParseException("Unknown symbol after Try", lexer.yyline());
|
||||
}
|
||||
lexBlockOpen(lexer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSourceBetween(int pos) {
|
||||
String ret = "";
|
||||
if (pos == 0) {
|
||||
if (catchBlockFlag) {
|
||||
ret += "Catch";
|
||||
ret += " {\r\n";
|
||||
return ret;
|
||||
}
|
||||
if (finallyBlockFlag) {
|
||||
ret += "Finally {\r\n";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (pos == 1) {
|
||||
if (catchBlockFlag && finallyBlockFlag) {
|
||||
ret += "Finally {\r\n";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(List<GraphSourceItem> container, List<Long> knownAddreses, List<String> constantPool, int version, boolean hex) {
|
||||
String ret = "";
|
||||
ret += "Try {";
|
||||
ret += Action.actionsToString(getAddress() + tryPos, tryBody, knownAddreses, constantPool, version, hex, getFileAddress() + tryPos);
|
||||
ret += "}";
|
||||
ret += "Try ";
|
||||
if (catchBlockFlag) {
|
||||
ret += "\r\nCatch ";
|
||||
if (catchInRegisterFlag) {
|
||||
ret += "register" + catchRegister;
|
||||
} else {
|
||||
ret += "\"" + Helper.escapeString(catchName) + "\"";
|
||||
}
|
||||
ret += " {\r\n";
|
||||
ret += Action.actionsToString(getAddress() + catchPos, catchBody, knownAddreses, constantPool, version, hex, getFileAddress() + catchPos);
|
||||
ret += "}";
|
||||
}
|
||||
if (finallyBlockFlag) {
|
||||
ret += "\r\nFinally {\r\n";
|
||||
ret += Action.actionsToString(getAddress() + finPos, finallyBody, knownAddreses, constantPool, version, hex, getFileAddress() + finPos);
|
||||
ret += "}";
|
||||
ret += " ";
|
||||
}
|
||||
ret += "{";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getAllRefs(int version) {
|
||||
List<Long> ret = new ArrayList<Long>();
|
||||
ret.addAll(Action.getActionsAllRefs(tryBody, version));
|
||||
ret.addAll(Action.getActionsAllRefs(catchBody, version));
|
||||
ret.addAll(Action.getActionsAllRefs(finallyBody, version));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Action> getAllIfsOrJumps() {
|
||||
List<Action> ret = new ArrayList<Action>();
|
||||
ret.addAll(Action.getActionsAllIfsOrJumps(tryBody));
|
||||
ret.addAll(Action.getActionsAllIfsOrJumps(catchBody));
|
||||
ret.addAll(Action.getActionsAllIfsOrJumps(finallyBody));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getHeaderSize() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
try {
|
||||
sos.writeUB(5, 0);
|
||||
sos.writeUB(1, catchInRegisterFlag ? 1 : 0);
|
||||
sos.writeUB(1, finallyBlockFlag ? 1 : 0);
|
||||
sos.writeUB(1, catchBlockFlag ? 1 : 0);
|
||||
sos.writeUI16((int) trySize);
|
||||
sos.writeUI16((int) catchSize);
|
||||
sos.writeUI16((int) finallySize);
|
||||
if (catchInRegisterFlag) {
|
||||
sos.writeUI8(catchRegister);
|
||||
} else {
|
||||
sos.writeString(catchName == null ? "" : catchName);
|
||||
}
|
||||
/*sos.write(tryBodyBytes);
|
||||
sos.write(catchBodyBytes);
|
||||
sos.write(finallyBodyBytes);*/
|
||||
sos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return surroundWithAction(baos.toByteArray(), version).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getContainerSizes() {
|
||||
List<Long> ret = new ArrayList<Long>();
|
||||
ret.add(trySize);
|
||||
ret.add(catchSize);
|
||||
ret.add(finallySize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer) {
|
||||
try {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
//catchBlockFlag = false;
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("catch")) {
|
||||
trySize = addr - getAddress() - getHeaderSize();
|
||||
catchBlockFlag = true;
|
||||
lexBlockOpen(lexer);
|
||||
return true;
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("finally")) {
|
||||
if (catchBlockFlag) {
|
||||
catchSize = addr - getAddress() - getHeaderSize() - trySize;
|
||||
} else {
|
||||
trySize = addr - getAddress() - getHeaderSize();
|
||||
}
|
||||
finallyBlockFlag = true;
|
||||
lexBlockOpen(lexer);
|
||||
return true;
|
||||
} else {
|
||||
//finallyBlockFlag = false;
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
} else {
|
||||
//finallyBlockFlag = false;
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
} else {
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
if (finallyBlockFlag) {
|
||||
finallySize = addr - getAddress() - getHeaderSize() - trySize - catchSize;
|
||||
} else if (catchBlockFlag) {
|
||||
catchSize = addr - getAddress() - getHeaderSize() - trySize;
|
||||
}
|
||||
lexer.yybegin(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<List<GraphTargetItem>> contents, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
List<GraphTargetItem> tryCommands = contents.get(0);
|
||||
TreeItem catchName;
|
||||
if (catchInRegisterFlag) {
|
||||
catchName = new DirectValueTreeItem(this, -1, new RegisterNumber(this.catchRegister), new ArrayList<String>());
|
||||
} else {
|
||||
catchName = new DirectValueTreeItem(this, -1, this.catchName, new ArrayList<String>());
|
||||
}
|
||||
List<GraphTargetItem> catchExceptions = new ArrayList<GraphTargetItem>();
|
||||
if (catchBlockFlag) {
|
||||
catchExceptions.add(catchName);
|
||||
}
|
||||
List<List<GraphTargetItem>> catchCommands = new ArrayList<List<GraphTargetItem>>();
|
||||
if (catchBlockFlag) {
|
||||
catchCommands.add(contents.get(1));
|
||||
}
|
||||
List<GraphTargetItem> finallyCommands = contents.get(2);
|
||||
output.add(new TryTreeItem(tryCommands, catchExceptions, catchCommands, finallyCommands));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Try";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,30 +61,28 @@ public class DirectValueTreeItem extends TreeItem {
|
||||
if (value instanceof Boolean) {
|
||||
return ((Boolean) value) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
if (value instanceof String) {
|
||||
String s=(String) value;
|
||||
if(s.length()==1){
|
||||
String s = (String) value;
|
||||
if (s.length() == 1) {
|
||||
return s.charAt(0);
|
||||
}
|
||||
double ret=0.0;
|
||||
try{
|
||||
ret=Double.parseDouble(s);
|
||||
}catch(NumberFormatException nex){
|
||||
|
||||
double ret = 0.0;
|
||||
try {
|
||||
ret = Double.parseDouble(s);
|
||||
} catch (NumberFormatException nex) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (value instanceof ConstantIndex) {
|
||||
String s=(this.constants.get(((ConstantIndex) value).index));
|
||||
if(s.length()==1){
|
||||
String s = (this.constants.get(((ConstantIndex) value).index));
|
||||
if (s.length() == 1) {
|
||||
return s.charAt(0);
|
||||
}
|
||||
double ret=0.0;
|
||||
try{
|
||||
ret=Double.parseDouble(s);
|
||||
}catch(NumberFormatException nex){
|
||||
|
||||
double ret = 0.0;
|
||||
try {
|
||||
ret = Double.parseDouble(s);
|
||||
} catch (NumberFormatException nex) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -109,16 +107,16 @@ public class DirectValueTreeItem extends TreeItem {
|
||||
return ((Long) value) != 0;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
String s=(String) value;
|
||||
if(s.length()==1){
|
||||
return toNumber()==0;
|
||||
String s = (String) value;
|
||||
if (s.length() == 1) {
|
||||
return toNumber() == 0;
|
||||
}
|
||||
return !s.equals("");
|
||||
}
|
||||
if (value instanceof ConstantIndex) {
|
||||
String s=(this.constants.get(((ConstantIndex) value).index));
|
||||
if(s.length()==1){
|
||||
return toNumber()==0;
|
||||
String s = (this.constants.get(((ConstantIndex) value).index));
|
||||
if (s.length() == 1) {
|
||||
return toNumber() == 0;
|
||||
}
|
||||
return !s.equals("");
|
||||
}
|
||||
@@ -189,9 +187,7 @@ public class DirectValueTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null) || (computedRegValue != null && computedRegValue.isCompileTime())
|
||||
|
||||
//||(value instanceof String) || (value instanceof ConstantIndex)
|
||||
return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null) || (computedRegValue != null && computedRegValue.isCompileTime()) //||(value instanceof String) || (value instanceof ConstantIndex)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,21 +55,21 @@ public class TryTreeItem extends TreeItem implements Block {
|
||||
List localData = new ArrayList();
|
||||
localData.add(constants);
|
||||
for (GraphTargetItem ti : tryCommands) {
|
||||
ret += ti.toString(localData) + "\r\n";
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
ret += "}";
|
||||
for (int e = 0; e < catchExceptions.size(); e++) {
|
||||
ret += "\r\ncatch(" + catchExceptions.get(e).toString(localData) + ")\r\n{\r\n";
|
||||
ret += "\r\ncatch(" + catchExceptions.get(e).toStringNoQuotes(localData) + ")\r\n{\r\n";
|
||||
List<GraphTargetItem> commands = catchCommands.get(e);
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toString(localData) + "\r\n";
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
if (finallyCommands.size() > 0) {
|
||||
ret += "\r\nfinally\r\n{\r\n";
|
||||
for (GraphTargetItem ti : finallyCommands) {
|
||||
ret += ti.toString(localData) + "\r\n";
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
@@ -109,4 +109,9 @@ public class TryTreeItem extends TreeItem implements Block {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsSemicolon() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.treemodel.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -949,7 +949,7 @@ public class Graph {
|
||||
} else {
|
||||
ret.addAll(output);
|
||||
}
|
||||
GraphPart loopBodyStart = null;
|
||||
GraphPart loopBodyStart = null;
|
||||
if (reversed == loop) {
|
||||
if (expr instanceof LogicalOpItem) {
|
||||
expr = ((LogicalOpItem) expr).invert();
|
||||
@@ -957,7 +957,7 @@ public class Graph {
|
||||
expr = new NotItem(null, expr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GraphPart next = part.getNextPartPath(loopContinues);
|
||||
List<GraphTargetItem> retx = ret;
|
||||
if ((!loop) || (doWhile && (part.nextParts.size() > 1))) {
|
||||
@@ -1290,7 +1290,7 @@ public class Graph {
|
||||
GraphPart part = ret;
|
||||
while (ip < code.size()) {
|
||||
if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) {
|
||||
if(lastIp==497){
|
||||
if (lastIp == 497) {
|
||||
System.out.println("dff");
|
||||
}
|
||||
part.end = lastIp;
|
||||
@@ -1316,7 +1316,7 @@ public class Graph {
|
||||
part = gp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ip = checkIp(ip);
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
@@ -1324,11 +1324,17 @@ public class Graph {
|
||||
ip++;
|
||||
continue;
|
||||
}
|
||||
if(ins instanceof GraphSourceItemContainer){
|
||||
ip = code.adr2pos(((GraphSourceItemContainer)ins).getEndAddress());
|
||||
if (ins instanceof GraphSourceItemContainer) {
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) ins;
|
||||
if (ins instanceof Action) { //TODO: Remove dependency of AVM1
|
||||
long endAddr = ((Action) ins).getAddress() + cnt.getHeaderSize();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
endAddr += size;
|
||||
}
|
||||
ip = code.adr2pos(endAddr);
|
||||
}
|
||||
continue;
|
||||
}else
|
||||
if (ins.isExit()) {
|
||||
} else if (ins.isExit()) {
|
||||
part.end = ip;
|
||||
allBlocks.add(part);
|
||||
break;
|
||||
@@ -1341,7 +1347,7 @@ public class Graph {
|
||||
break;
|
||||
} else if (ins.isBranch()) {
|
||||
part.end = ip;
|
||||
|
||||
|
||||
allBlocks.add(part);
|
||||
List<Integer> branches = ins.getBranches(code);
|
||||
for (int i = 0; i < branches.size(); i++) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class GraphPart {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean leadsTo(GraphSource code, GraphPart part, List<GraphPart> ignored) {
|
||||
public boolean leadsTo(GraphSource code, GraphPart part, List<GraphPart> ignored) {
|
||||
return leadsTo(code, part, new ArrayList<GraphPart>(), ignored);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jpexs.decompiler.flash.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -19,9 +20,9 @@ public abstract class GraphSource {
|
||||
|
||||
public abstract List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end);
|
||||
|
||||
private void visitCode(int ip, int lastIp, HashMap<Integer, List<Integer>> refs) {
|
||||
private void visitCode(int ip, int lastIp, HashMap<Integer, List<Integer>> refs, int endIp) {
|
||||
boolean debugMode = false;
|
||||
while (ip < size()) {
|
||||
while (((endIp == -1) || (ip < endIp)) && (ip < size())) {
|
||||
refs.get(ip).add(lastIp);
|
||||
lastIp = ip;
|
||||
if (refs.get(ip).size() > 1) {
|
||||
@@ -40,15 +41,27 @@ public abstract class GraphSource {
|
||||
break;
|
||||
}
|
||||
|
||||
if(ins instanceof GraphSourceItemContainer){
|
||||
visitCode(adr2pos(((GraphSourceItemContainer)ins).getEndAddress()), ip, refs);
|
||||
if (ins instanceof GraphSourceItemContainer) {
|
||||
GraphSourceItemContainer cnt = (GraphSourceItemContainer) ins;
|
||||
if (ins instanceof Action) { //TODO: Remove dependency of AVM1
|
||||
long endAddr = ((Action) ins).getAddress() + cnt.getHeaderSize();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
if (size != 0) {
|
||||
visitCode(adr2pos(endAddr), ip, refs, adr2pos(endAddr + size));
|
||||
}
|
||||
endAddr += size;
|
||||
}
|
||||
ip = adr2pos(endAddr);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
List<Integer> branches = ins.getBranches(this);
|
||||
for (int b : branches) {
|
||||
if (b >= 0) {
|
||||
visitCode(b, ip, refs);
|
||||
visitCode(b, ip, refs, endIp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -62,11 +75,11 @@ public abstract class GraphSource {
|
||||
for (int i = 0; i < size(); i++) {
|
||||
refs.put(i, new ArrayList<Integer>());
|
||||
}
|
||||
visitCode(0, 0, refs);
|
||||
visitCode(0, 0, refs, -1);
|
||||
int pos = 0;
|
||||
for (int e : alternateEntries) {
|
||||
pos++;
|
||||
visitCode(e, -pos, refs);
|
||||
visitCode(e, -pos, refs, -1);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.jpexs.decompiler.flash.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
@@ -12,15 +11,13 @@ import java.util.Stack;
|
||||
*/
|
||||
public interface GraphSourceItemContainer {
|
||||
|
||||
public byte[] getHeaderBytes();
|
||||
public long getHeaderSize();
|
||||
|
||||
public List<GraphSourceItem> getItems(List<GraphSourceItem> parent);
|
||||
public List<Long> getContainerSizes();
|
||||
|
||||
public int getDataLength();
|
||||
|
||||
public long getEndAddress();
|
||||
|
||||
public void setEndAddress(long address);
|
||||
|
||||
public void translateContainer(List<GraphTargetItem> content,Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions);
|
||||
public String getASMSourceBetween(int pos);
|
||||
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer);
|
||||
|
||||
public void translateContainer(List<List<GraphTargetItem>> contents, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user