From 83360a19df3579ed174032ef61b04c7483ed3035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Mon, 24 Feb 2014 21:25:29 +0100 Subject: [PATCH] Issue #306 editing AS directly - expressions are commands too --- .../parser/script/ActionScriptParser.java | 23 +++++++++++-------- .../parser/script/VariableActionItem.java | 4 +++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index a9a4bbe07..b7861740d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -1087,9 +1087,10 @@ public class ActionScriptParser { if (isEval) { ret = var; } else { - if (mustBeCommand) { - throw new ParseException("Not a command", lexer.yyline()); - } + ret = null; //expression can be command too + /*if (mustBeCommand) { + throw new ParseException("Not a command", lexer.yyline()); + }*/ } } break; @@ -1302,17 +1303,19 @@ public class ActionScriptParser { } return null; } + if (debugMode) { + System.out.println("/command"); + } + lexer.removeListener(buf); + if (ret == null) { //can be popped expression + buf.pushAllBack(lexer); + ret = expression(registerVars, inFunction, inMethod, true, variables); + } s = lex(); if ((s != null) && (s.type != SymbolType.SEMICOLON)) { lexer.pushback(s); } - if (debugMode) { - System.out.println("/command"); - } - if (ret == null && (!mustBeCommand)) { - buf.pushAllBack(lexer); - } - lexer.removeListener(buf); + return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java index 0ae45ef45..0723d7f6f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java @@ -58,7 +58,9 @@ public class VariableActionItem extends ActionItem { public void setBoxedValue(ActionItem it) { this.it = it; - this.precedence = it.getPrecedence(); + if(it!=null){ + this.precedence = it.getPrecedence(); + } } public ActionItem getBoxedValue() {