mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-04 22:54:18 +00:00
base class for ParseException, avm2.ConstantPool renamed to AVM2ConstantPool
This commit is contained in:
@@ -37,7 +37,7 @@ import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.model.UnsupportedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.ClassActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.InterfaceActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem;
|
||||
@@ -226,12 +226,12 @@ public class Action implements GraphSourceItem {
|
||||
* @param lex FlasmLexer
|
||||
* @return String value
|
||||
* @throws IOException
|
||||
* @throws ParseException When read object is not String
|
||||
* @throws ActionParseException When read object is not String
|
||||
*/
|
||||
protected String lexString(FlasmLexer lex) throws IOException, ParseException {
|
||||
protected String lexString(FlasmLexer lex) throws IOException, ActionParseException {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_STRING) {
|
||||
throw new ParseException("String expected", lex.yyline());
|
||||
throw new ActionParseException("String expected", lex.yyline());
|
||||
}
|
||||
return (String) symb.value;
|
||||
}
|
||||
@@ -241,12 +241,12 @@ public class Action implements GraphSourceItem {
|
||||
*
|
||||
* @param lex FlasmLexer
|
||||
* @throws IOException
|
||||
* @throws ParseException When read object is not Block startServer
|
||||
* @throws ActionParseException When read object is not Block startServer
|
||||
*/
|
||||
protected void lexBlockOpen(FlasmLexer lex) throws IOException, ParseException {
|
||||
protected void lexBlockOpen(FlasmLexer lex) throws IOException, ActionParseException {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_BLOCK_START) {
|
||||
throw new ParseException("Block startServer ", lex.yyline());
|
||||
throw new ActionParseException("Block startServer ", lex.yyline());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,12 +256,12 @@ public class Action implements GraphSourceItem {
|
||||
* @param lex FlasmLexer
|
||||
* @return Identifier name
|
||||
* @throws IOException
|
||||
* @throws ParseException When read object is not Identifier
|
||||
* @throws ActionParseException When read object is not Identifier
|
||||
*/
|
||||
protected String lexIdentifier(FlasmLexer lex) throws IOException, ParseException {
|
||||
protected String lexIdentifier(FlasmLexer lex) throws IOException, ActionParseException {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_IDENTIFIER) {
|
||||
throw new ParseException("Identifier expected", lex.yyline());
|
||||
throw new ActionParseException("Identifier expected", lex.yyline());
|
||||
}
|
||||
return (String) symb.value;
|
||||
}
|
||||
@@ -272,12 +272,12 @@ public class Action implements GraphSourceItem {
|
||||
* @param lex FlasmLexer
|
||||
* @return long value
|
||||
* @throws IOException
|
||||
* @throws ParseException When read object is not long value
|
||||
* @throws ActionParseException When read object is not long value
|
||||
*/
|
||||
protected long lexLong(FlasmLexer lex) throws IOException, ParseException {
|
||||
protected long lexLong(FlasmLexer lex) throws IOException, ActionParseException {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_INTEGER) {
|
||||
throw new ParseException("Integer expected", lex.yyline());
|
||||
throw new ActionParseException("Integer expected", lex.yyline());
|
||||
}
|
||||
return (Long) symb.value;
|
||||
}
|
||||
@@ -288,12 +288,12 @@ public class Action implements GraphSourceItem {
|
||||
* @param lex FlasmLexer
|
||||
* @return boolean value
|
||||
* @throws IOException
|
||||
* @throws ParseException When read object is not boolean value
|
||||
* @throws ActionParseException When read object is not boolean value
|
||||
*/
|
||||
protected boolean lexBoolean(FlasmLexer lex) throws IOException, ParseException {
|
||||
protected boolean lexBoolean(FlasmLexer lex) throws IOException, ActionParseException {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_BOOLEAN) {
|
||||
throw new ParseException("Boolean expected", lex.yyline());
|
||||
throw new ActionParseException("Boolean expected", lex.yyline());
|
||||
}
|
||||
return (Boolean) symb.value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.flashlite;
|
||||
|
||||
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.model.StrictModeActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.StrictModeActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -37,7 +38,7 @@ public class ActionStrictMode extends Action {
|
||||
mode = sis.readUI8("mode");
|
||||
}
|
||||
|
||||
|
||||
public ActionStrictMode(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x89, 1);
|
||||
mode = (int) lexLong(lexer);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model.clauses;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
|
||||
@@ -12,17 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
*/
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser;
|
||||
|
||||
public class ParseException extends Exception {
|
||||
import com.jpexs.decompiler.flash.ParseException;
|
||||
|
||||
public long line;
|
||||
public String text;
|
||||
public class ActionParseException extends ParseException {
|
||||
|
||||
public ParseException(String text, long line) {
|
||||
super("ParseException:" + text + " on line " + line);
|
||||
this.line = line;
|
||||
this.text = text;
|
||||
public ActionParseException(String text, long line) {
|
||||
super(text, line);
|
||||
}
|
||||
}
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionStrictMode;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionStrictMode;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscatePop;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionEnd;
|
||||
@@ -135,7 +136,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public class ASMParser {
|
||||
|
||||
|
||||
public static ActionList parse(boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ActionParseException {
|
||||
ActionList list = new ActionList();
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<>();
|
||||
|
||||
@@ -165,7 +166,7 @@ public class ASMParser {
|
||||
}
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_BLOCK_END) {
|
||||
if (containers.isEmpty()) {
|
||||
if (containers.isEmpty()) {
|
||||
throw new ActionParseException("Block end without start", lexer.yyline());
|
||||
}
|
||||
GraphSourceItemContainer a = containers.peek();
|
||||
if (!a.parseDivision(address - ((Action) a).getAddress(), lexer)) {
|
||||
@@ -197,12 +198,12 @@ public class ASMParser {
|
||||
} else if ((symb.type == ASMParsedSymbol.TYPE_BLOCK_END) || (symb.type == ASMParsedSymbol.TYPE_EOF)) {
|
||||
return list;
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Label or Instruction name expected, found:" + symb.type + " " + symb.value, lexer.yyline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Action parseAction(String instructionName, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ActionParseException {
|
||||
Action a = null;
|
||||
if (instructionName.compareToIgnoreCase("GetURL") == 0) {
|
||||
a = new ActionGetURL(lexer);
|
||||
@@ -415,14 +416,14 @@ public class ASMParser {
|
||||
} else if (instructionName.compareToIgnoreCase("FFDec_DeobfuscateJump") == 0) {
|
||||
a = (new ActionDeobfuscateJump(lexer));
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Unknown instruction name :" + instructionName, lexer.yyline());
|
||||
}
|
||||
|
||||
a.updateLength(version);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
private static List<Action> parseAllActions(FlasmLexer lexer, int version) throws IOException, ActionParseException {
|
||||
List<Action> list = new ArrayList<>();
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<>();
|
||||
List<String> emptyList = new ArrayList<>();
|
||||
@@ -430,7 +431,7 @@ public class ASMParser {
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ASMParsedSymbol.TYPE_BLOCK_END) {
|
||||
if (containers.isEmpty()) {
|
||||
if (containers.isEmpty()) {
|
||||
throw new ActionParseException("Block end without start", lexer.yyline());
|
||||
}
|
||||
GraphSourceItemContainer a = containers.peek();
|
||||
if (!a.parseDivision(0, lexer)) {
|
||||
@@ -451,7 +452,7 @@ public class ASMParser {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ActionList parse(long address, boolean ignoreNops, String source, int version, boolean throwOnError) throws IOException, ActionParseException {
|
||||
FlasmLexer lexer = new FlasmLexer(new StringReader(source));
|
||||
List<Action> list = parseAllActions(lexer, version);
|
||||
|
||||
@@ -500,7 +501,7 @@ public class ASMParser {
|
||||
|
||||
if (!found) {
|
||||
if (throwOnError) {
|
||||
if (throwOnError) {
|
||||
throw new ActionParseException("TARGET NOT FOUND - identifier:" + identifier + " addr: ofs" + Helper.formatAddress(link.getAddress()), -1);
|
||||
} else {
|
||||
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, "TARGET NOT FOUND - identifier:" + identifier + " addr: ofs" + Helper.formatAddress(link.getAddress()));
|
||||
}
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
@@ -758,9 +759,9 @@ public final class FlasmLexer {
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
* @throws com.jpexs.decompiler.flash.action.parser.ActionParseException
|
||||
*/
|
||||
*/
|
||||
public ASMParsedSymbol yylex() throws java.io.IOException, ActionParseException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
|
||||
@@ -952,7 +953,7 @@ public final class FlasmLexer {
|
||||
case 42:
|
||||
break;
|
||||
case 5: {
|
||||
case 5: {
|
||||
throw new ActionParseException("Unterminated string at end of line", yyline + 1);
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
@@ -1001,7 +1002,7 @@ public final class FlasmLexer {
|
||||
case 51:
|
||||
break;
|
||||
case 14: {
|
||||
case 14: {
|
||||
throw new ActionParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1);
|
||||
}
|
||||
case 52:
|
||||
break;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
@@ -1242,7 +1242,7 @@ public final class ActionScriptLexer {
|
||||
}
|
||||
ParsedSymbol last;
|
||||
|
||||
public ParsedSymbol lex() throws java.io.IOException, ParseException {
|
||||
public ParsedSymbol lex() throws java.io.IOException, ActionParseException {
|
||||
ParsedSymbol ret = null;
|
||||
if (!pushedBack.isEmpty()) {
|
||||
ret = last = pushedBack.pop();
|
||||
@@ -1486,9 +1486,9 @@ public final class ActionScriptLexer {
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
* @throws com.jpexs.decompiler.flash.action.parser.ParseException
|
||||
* @throws com.jpexs.decompiler.flash.action.parser.ActionParseException
|
||||
*/
|
||||
public ParsedSymbol yylex() throws java.io.IOException, ParseException {
|
||||
public ParsedSymbol yylex() throws java.io.IOException, ActionParseException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
|
||||
@@ -1908,7 +1908,7 @@ public final class ActionScriptLexer {
|
||||
case 248:
|
||||
break;
|
||||
case 67: {
|
||||
throw new ParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1);
|
||||
throw new ActionParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1);
|
||||
}
|
||||
case 249:
|
||||
break;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -114,7 +115,7 @@ import com.jpexs.decompiler.flash.action.model.operations.StringLtActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.StringNeActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.SubtractActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.URShiftActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.URShiftActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool;
|
||||
@@ -166,7 +167,7 @@ public class ActionScriptParser {
|
||||
return "" + uniqLast;
|
||||
}
|
||||
|
||||
|
||||
private List<GraphTargetItem> commands(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
if (debugMode) {
|
||||
System.out.println("commands:");
|
||||
@@ -181,7 +182,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem type(List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = null;
|
||||
|
||||
ParsedSymbol s = lex();
|
||||
@@ -199,7 +200,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem memberOrCall(GraphTargetItem newcmds, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
ParsedSymbol s = lex();
|
||||
GraphTargetItem ret = newcmds;
|
||||
while (s.isType(SymbolType.DOT, SymbolType.BRACKET_OPEN, SymbolType.PARENT_OPEN)) {
|
||||
@@ -227,7 +228,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem member(GraphTargetItem obj, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = obj;
|
||||
ParsedSymbol s = lex();
|
||||
while (s.isType(SymbolType.DOT, SymbolType.BRACKET_OPEN)) {
|
||||
@@ -252,7 +253,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem variable(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = null;
|
||||
ParsedSymbol s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.IDENTIFIER, SymbolType.THIS, SymbolType.SUPER, SymbolType.STRING_OP);
|
||||
@@ -262,7 +263,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private void expected(ParsedSymbol symb, int line, Object... expected) throws IOException, ActionParseException {
|
||||
boolean found = false;
|
||||
for (Object t : expected) {
|
||||
if (symb.type == t) {
|
||||
@@ -282,17 +283,17 @@ public class ActionScriptParser {
|
||||
expStr += e;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
throw new ActionParseException("" + expStr + " expected but " + symb.type + " found", line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ParsedSymbol expectedType(Object... type) throws IOException, ActionParseException {
|
||||
ParsedSymbol symb = lex();
|
||||
expected(symb, lexer.yyline(), type);
|
||||
return symb;
|
||||
}
|
||||
|
||||
|
||||
private ParsedSymbol lex() throws IOException, ActionParseException {
|
||||
ParsedSymbol ret = lexer.lex();
|
||||
if (debugMode) {
|
||||
System.out.println(ret);
|
||||
@@ -300,7 +301,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private List<GraphTargetItem> call(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
//expected(SymbolType.PARENT_OPEN); //MUST BE HANDLED BY CALLER
|
||||
ParsedSymbol s = lex();
|
||||
@@ -315,7 +316,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private FunctionActionItem function(boolean withBody, String functionName, boolean isMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = null;
|
||||
ParsedSymbol s = null;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
@@ -351,7 +352,7 @@ public class ActionScriptParser {
|
||||
return new FunctionActionItem(null, functionName, paramNames, body, constantPool, -1, subvariables);
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem traits(boolean isInterface, GraphTargetItem nameStr, GraphTargetItem extendsStr, List<GraphTargetItem> implementsStr, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
|
||||
GraphTargetItem ret = null;
|
||||
/*for (int i = 0; i < nameStr.size() - 1; i++) {
|
||||
@@ -464,7 +465,7 @@ public class ActionScriptParser {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem expressionCommands(ParsedSymbol s, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = null;
|
||||
switch (s.type) {
|
||||
case GETVERSION:
|
||||
@@ -580,7 +581,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem command(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
LexBufferer buf = new LexBufferer();
|
||||
lexer.addListener(buf);
|
||||
GraphTargetItem ret = null;
|
||||
@@ -638,7 +639,7 @@ public class ActionScriptParser {
|
||||
variables.remove(varDel);
|
||||
ret = new DeleteActionItem(null, null, pushConst(((VariableActionItem) varDel).getVariableName()));
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Not a property", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case TRACE:
|
||||
@@ -665,7 +666,7 @@ public class ActionScriptParser {
|
||||
} else if (s.value.equals("POST")) {
|
||||
getuMethod = 2;
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
@@ -802,7 +803,7 @@ public class ActionScriptParser {
|
||||
} else if (s.value.equals("GET")) {
|
||||
lvmethod = 1;
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
@@ -1223,7 +1224,7 @@ public class ActionScriptParser {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem expression(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
return expression(false, registerVars, inFunction, inMethod, allowRemainder, variables);
|
||||
}
|
||||
|
||||
@@ -1245,7 +1246,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem expressionRemainder(GraphTargetItem expr, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem ret = null;
|
||||
ParsedSymbol s = lex();
|
||||
switch (s.type) {
|
||||
@@ -1386,18 +1387,18 @@ public class ActionScriptParser {
|
||||
} else if (expr instanceof GetMemberActionItem) {
|
||||
ret = new SetMemberActionItem(null, ((GetMemberActionItem) expr).object, ((GetMemberActionItem) expr).memberName, assigned);
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Invalid assignment", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case INCREMENT: //postincrement
|
||||
if (!(expr instanceof VariableActionItem) && !(expr instanceof GetMemberActionItem)) {
|
||||
if (!(expr instanceof VariableActionItem) && !(expr instanceof GetMemberActionItem)) {
|
||||
throw new ActionParseException("Invalid assignment", lexer.yyline());
|
||||
}
|
||||
ret = new PostIncrementActionItem(null, expr);
|
||||
break;
|
||||
case DECREMENT: //postdecrement
|
||||
if (!(expr instanceof VariableActionItem) && !(expr instanceof GetMemberActionItem)) {
|
||||
if (!(expr instanceof VariableActionItem) && !(expr instanceof GetMemberActionItem)) {
|
||||
throw new ActionParseException("Invalid assignment", lexer.yyline());
|
||||
}
|
||||
ret = new PostDecrementActionItem(null, expr);
|
||||
break;
|
||||
@@ -1466,7 +1467,7 @@ public class ActionScriptParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private int brackets(List<GraphTargetItem> ret, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
ParsedSymbol s = lex();
|
||||
int arrCnt = 0;
|
||||
if (s.type == SymbolType.BRACKET_OPEN) {
|
||||
@@ -1490,7 +1491,7 @@ public class ActionScriptParser {
|
||||
return arrCnt;
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem commaExpression(HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forInLevel, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
GraphTargetItem cmd = null;
|
||||
List<GraphTargetItem> expr = new ArrayList<>();
|
||||
ParsedSymbol s;
|
||||
@@ -1506,13 +1507,13 @@ public class ActionScriptParser {
|
||||
expr.add(expression(registerVars, inFunction, inMethod, true, variables));
|
||||
} else {
|
||||
if (!cmd.hasReturnValue()) {
|
||||
if (!cmd.hasReturnValue()) {
|
||||
throw new ActionParseException("Expression expected", lexer.yyline());
|
||||
}
|
||||
}
|
||||
return new CommaExpressionItem(null, expr);
|
||||
}
|
||||
|
||||
|
||||
private GraphTargetItem expression(boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<VariableActionItem> variables) throws IOException, ActionParseException {
|
||||
if (debugMode) {
|
||||
System.out.println("expression:");
|
||||
}
|
||||
@@ -1643,7 +1644,7 @@ public class ActionScriptParser {
|
||||
GetMemberActionItem gm = (GetMemberActionItem) varDel;
|
||||
ret = new DeleteActionItem(null, gm.object, gm.memberName);
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Not a property", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case INCREMENT:
|
||||
@@ -1676,7 +1677,7 @@ public class ActionScriptParser {
|
||||
} else if (newvar instanceof VariableActionItem) {
|
||||
ret = new NewObjectActionItem(null, new DirectValueActionItem(((VariableActionItem) newvar).getVariableName()), call(registerVars, inFunction, inMethod, variables));
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Invalid new item", lexer.yyline());
|
||||
}
|
||||
existsRemainder = true;
|
||||
break;
|
||||
@@ -1725,7 +1726,7 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private DirectValueActionItem pushConst(String s) throws IOException, ActionParseException {
|
||||
int index = constantPool.indexOf(s);
|
||||
if (index == -1) {
|
||||
constantPool.add(s);
|
||||
@@ -1736,7 +1737,7 @@ public class ActionScriptParser {
|
||||
private ActionScriptLexer lexer = null;
|
||||
private List<String> constantPool;
|
||||
|
||||
|
||||
public List<GraphTargetItem> treeFromString(String str, List<String> constantPool) throws ActionParseException, IOException {
|
||||
List<GraphTargetItem> retTree = new ArrayList<>();
|
||||
this.constantPool = constantPool;
|
||||
lexer = new ActionScriptLexer(new StringReader(str));
|
||||
@@ -1757,7 +1758,7 @@ public class ActionScriptParser {
|
||||
}
|
||||
}
|
||||
if (lexer.lex().type != SymbolType.EOF) {
|
||||
if (lexer.lex().type != SymbolType.EOF) {
|
||||
throw new ActionParseException("Parsing finished before end of the file", lexer.yyline());
|
||||
}
|
||||
return retTree;
|
||||
}
|
||||
@@ -1777,29 +1778,29 @@ public class ActionScriptParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public List<Action> actionsFromString(String s) throws ActionParseException, IOException, CompilationException {
|
||||
List<String> constantPool = new ArrayList<>();
|
||||
List<GraphTargetItem> tree = treeFromString(s, constantPool);
|
||||
return actionsFromTree(tree, constantPool);
|
||||
}
|
||||
|
||||
|
||||
private void versionRequired(ParsedSymbol s, int min) throws ActionParseException {
|
||||
versionRequired(s.value.toString(), min, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
private void versionRequired(ParsedSymbol s, int min, int max) throws ActionParseException {
|
||||
versionRequired(s.value.toString(), min, max);
|
||||
}
|
||||
|
||||
|
||||
private void versionRequired(String type, int min, int max) throws ActionParseException {
|
||||
if (min == max && swfVersion != min) {
|
||||
if (min == max && swfVersion != min) {
|
||||
throw new ActionParseException(type + " requires SWF version " + min, lexer.yyline());
|
||||
}
|
||||
if (swfVersion < min) {
|
||||
if (swfVersion < min) {
|
||||
throw new ActionParseException(type + " requires at least SWF version " + min, lexer.yyline());
|
||||
}
|
||||
if (swfVersion > max) {
|
||||
if (swfVersion > max) {
|
||||
throw new ActionParseException(type + " requires SWF version lower than " + max, lexer.yyline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.special;
|
||||
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionJump;
|
||||
import java.io.IOException;
|
||||
@@ -30,7 +31,7 @@ public class ActionDeobfuscateJump extends ActionJump {
|
||||
super(2);
|
||||
}
|
||||
|
||||
|
||||
public ActionDeobfuscateJump(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(lexer);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -24,7 +25,7 @@ import com.jpexs.decompiler.flash.action.model.GetURLActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.LoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -54,7 +55,7 @@ public class ActionGetURL extends Action {
|
||||
targetString = sis.readString("targetString");
|
||||
}
|
||||
|
||||
|
||||
public ActionGetURL(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x83, 0);
|
||||
urlString = lexString(lexer);
|
||||
targetString = lexString(lexer);
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
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.model.GotoLabelActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoLabelActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -63,7 +64,7 @@ public class ActionGoToLabel extends Action {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionGoToLabel(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x8C, -1);
|
||||
label = lexString(lexer);
|
||||
}
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
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.model.GotoFrameActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrameActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -60,7 +61,7 @@ public class ActionGotoFrame extends Action {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionGotoFrame(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x81, 0);
|
||||
frame = (int) lexLong(lexer);
|
||||
}
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
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.model.SetTargetActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.SetTargetActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -63,7 +64,7 @@ public class ActionSetTarget extends Action {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionSetTarget(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x8B, -1);
|
||||
targetName = lexString(lexer);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
@@ -24,7 +25,7 @@ import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionStore;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
@@ -74,7 +75,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionWaitForFrame(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x8A, -1);
|
||||
frame = (int) lexLong(lexer);
|
||||
skipCount = (int) lexLong(lexer);
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -30,7 +31,7 @@ import com.jpexs.decompiler.flash.action.model.PrintAsBitmapNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.PrintNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -85,7 +86,7 @@ public class ActionGetURL2 extends Action {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionGetURL2(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x9A, -1);
|
||||
loadVariablesFlag = lexBoolean(lexer);
|
||||
loadTargetFlag = lexBoolean(lexer);
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
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.model.GotoFrame2ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrame2ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -75,7 +76,7 @@ public class ActionGotoFrame2 extends Action {
|
||||
return "GotoFrame2 " + sceneBiasFlag + " " + playFlag + " " + (sceneBiasFlag ? " " + sceneBias : "");
|
||||
}
|
||||
|
||||
|
||||
public ActionGotoFrame2(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x9F, -1);
|
||||
sceneBiasFlag = lexBoolean(lexer);
|
||||
playFlag = lexBoolean(lexer);
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
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.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.graph.GraphSource;
|
||||
@@ -80,7 +81,7 @@ public class ActionIf extends Action {
|
||||
return "If loc" + ofsStr + (!jumpUsed ? " ;compileTimeIgnore" : (!ignoreUsed ? " ;compileTimeJump" : ""));
|
||||
}
|
||||
|
||||
|
||||
public ActionIf(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x9D, 2);
|
||||
identifier = lexIdentifier(lexer);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -20,7 +21,7 @@ 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.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.graph.GraphSource;
|
||||
@@ -81,7 +82,7 @@ public class ActionJump extends Action {
|
||||
return "Jump loc" + ofsStr;
|
||||
}
|
||||
|
||||
|
||||
public ActionJump(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x99, 2);
|
||||
identifier = lexIdentifier(lexer);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
@@ -187,7 +187,7 @@ public class ActionPush extends Action {
|
||||
this.values.add(value);
|
||||
}
|
||||
|
||||
public ActionPush(FlasmLexer lexer, List<String> constantPool) throws IOException, ParseException {
|
||||
public ActionPush(FlasmLexer lexer, List<String> constantPool) throws IOException, ActionParseException {
|
||||
super(0x96, 0);
|
||||
this.constantPool = constantPool;
|
||||
values = new ArrayList<>();
|
||||
@@ -217,14 +217,14 @@ public class ActionPush extends Action {
|
||||
case ASMParsedSymbol.TYPE_EOL:
|
||||
case ASMParsedSymbol.TYPE_EOF:
|
||||
if (count == 0) {
|
||||
throw new ParseException("Arguments expected", lexer.yyline());
|
||||
throw new ActionParseException("Arguments expected", lexer.yyline());
|
||||
} else {
|
||||
break loop;
|
||||
}
|
||||
case ASMParsedSymbol.TYPE_COMMENT:
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Arguments expected, " + symb.type + " " + symb.value + " found", lexer.yyline());
|
||||
throw new ActionParseException("Arguments expected, " + symb.type + " " + symb.value + " found", lexer.yyline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
@@ -23,7 +24,7 @@ import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionStore;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
@@ -91,7 +92,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
public ActionWaitForFrame2(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x8D, -1);
|
||||
skipCount = (int) lexLong(lexer);
|
||||
skipped = new ArrayList<>();
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
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.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -48,7 +49,7 @@ public class ActionConstantPool extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ActionConstantPool(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x88, 0);
|
||||
while (true) {
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -20,7 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
@@ -65,7 +66,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
codeSize = sis.readUI16("codeSize");
|
||||
}
|
||||
|
||||
|
||||
public ActionDefineFunction(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x9B, -1);
|
||||
functionName = lexString(lexer);
|
||||
int numParams = (int) lexLong(lexer);
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -27,7 +28,7 @@ import com.jpexs.decompiler.flash.action.model.PostDecrementActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.PostIncrementActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.StoreRegisterActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemPos;
|
||||
@@ -52,7 +53,7 @@ public class ActionStoreRegister extends Action implements StoreTypeAction {
|
||||
registerNumber = sis.readUI8("registerNumber");
|
||||
}
|
||||
|
||||
|
||||
public ActionStoreRegister(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x87, 0);
|
||||
registerNumber = (int) lexLong(lexer);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -20,7 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.WithActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.WithActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemContainer;
|
||||
@@ -54,7 +55,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public ActionWith(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x94, 2);
|
||||
lexBlockOpen(lexer);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -20,7 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
@@ -99,7 +100,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
codeSize = sis.readUI16("codeSize");
|
||||
}
|
||||
|
||||
|
||||
public ActionDefineFunction2(FlasmLexer lexer) throws IOException, ActionParseException {
|
||||
super(0x8E, -1);
|
||||
functionName = lexString(lexer);
|
||||
int numParams = (int) lexLong(lexer);
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -22,7 +23,7 @@ import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.TryActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.TryActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
@@ -105,7 +106,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
|
||||
public ActionTry(FlasmLexer lexer, int version) throws IOException, ActionParseException {
|
||||
super(0x8F, 0);
|
||||
this.version = version;
|
||||
|
||||
@@ -119,7 +120,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_BLOCK_START) {
|
||||
return;
|
||||
} else {
|
||||
} else {
|
||||
throw new ActionParseException("Unknown symbol after Try", lexer.yyline());
|
||||
}
|
||||
lexBlockOpen(lexer);
|
||||
}
|
||||
@@ -231,7 +232,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
} else {
|
||||
lexer.yypushback(lexer.yylength());
|
||||
}
|
||||
}
|
||||
} catch (IOException | ActionParseException ex) {
|
||||
}
|
||||
|
||||
if (finallyBlockFlag) {
|
||||
|
||||
Reference in New Issue
Block a user