better AS1/2 parser - properties stub

This commit is contained in:
Jindra Petk
2013-04-14 15:57:01 +02:00
parent aff763637b
commit bb0a1a49bd
3 changed files with 28 additions and 7 deletions

View File

@@ -72,8 +72,8 @@ public class Action implements GraphSourceItem {
* Names of ActionScript properties
*/
public static final String[] propertyNames = new String[]{
"_x",
"_y",
"_X",
"_Y",
"_xscale",
"_yscale",
"_currentframe",
@@ -95,6 +95,7 @@ public class Action implements GraphSourceItem {
"_xmouse",
"_ymouse"
};
public static final List<String> propertyNamesList=Arrays.asList(propertyNames);
private static Logger logger = Logger.getLogger(Action.class.getName());
/**

View File

@@ -51,7 +51,7 @@ import jsyntaxpane.DefaultSyntaxKit;
public class ActionPanel extends JPanel implements ActionListener {
private boolean debugRecompile = true;
private boolean debugRecompile = false;
public LineMarkedEditorPane editor;
public LineMarkedEditorPane decompiledEditor;
public LineMarkedEditorPane recompiledEditor;

View File

@@ -183,8 +183,15 @@ public class ActionScriptParser {
} else {
if (inMethod) {
ret.add(new ActionPush(new RegisterNumber(REGISTER_THIS)));
ret.add(pushConst(s.value.toString()));
ret.add(new ActionGetMember());
//TODO: Handle properties (?)
if (false) { //Action.propertyNamesList.contains(s.value.toString())) {
ret.add(new ActionPush((Long) (long) (int) Action.propertyNamesList.indexOf(s.value.toString())));
ret.add(new ActionGetProperty());
} else {
ret.add(pushConst(s.value.toString()));
ret.add(new ActionGetMember());
}
} else {
ret.add(s.value.toString().equals("trace") ? new ActionPush(s.value.toString()) : pushConst(s.value.toString()));
ret.add(new ActionGetVariable());
@@ -201,8 +208,14 @@ public class ActionScriptParser {
}
s = lex();
expected(s, lexer.yyline(), SymbolType.IDENTIFIER, SymbolType.THIS, SymbolType.SUPER);
ret.add(pushConst(s.value.toString()));
ret.add(new ActionGetMember());
//TODO: Handle properties (?)
if (false) {//Action.propertyNamesList.contains(s.value.toString())) {
ret.add(new ActionPush((Long) (long) (int) Action.propertyNamesList.indexOf(s.value.toString())));
ret.add(new ActionGetProperty());
} else {
ret.add(pushConst(s.value.toString()));
ret.add(new ActionGetMember());
}
s = lex();
}
lexer.pushback(s);
@@ -475,6 +488,10 @@ public class ActionScriptParser {
ret.addAll(value);
ret.add(new ActionStoreRegister(((RegisterNumber) ((ActionPush) a).values.get(0)).number));
ret.add(new ActionPop());
} else if (a instanceof ActionGetProperty) {
ret.remove(ret.size() - 1);
ret.addAll(value);
ret.add(new ActionSetProperty());
}
}
return ret;
@@ -807,6 +824,9 @@ public class ActionScriptParser {
if (at instanceof ActionGetVariable) {
ret.add(new ActionSetVariable());
}
if (at instanceof ActionGetProperty) {
ret.add(new ActionSetProperty());
}
break;
case PARENT_OPEN: //function call
List<Action> callcmds = new ArrayList<Action>();