From 7d6931a81a2576e91142106ccb21de418c6a78c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 4 Mar 2021 22:41:02 +0100 Subject: [PATCH] Fixed: #1298 AS1/2 colon syntax handling --- CHANGELOG.md | 1 + .../parser/script/ActionScript2Parser.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf09187a4..c9d1e2228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file. - #1328 AS1/2/3 direct editation - empty commands (just semicolon) - #1310 AS1/2/3 direct editation - modulo operator precedence - AS3 - escaping star import +- #1298 AS1/2 colon syntax handling ### Removed - #1631 ActiveX Flash component download in windows installer diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index 23e7b3e2b..0e1dce4d6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -1168,7 +1168,7 @@ public class ActionScript2Parser { } forExpr = expression(inFunction, inMethod, true, variables, functions, false); if (forExpr == null) { - forExpr = new TrueItem(null,null); + forExpr = new TrueItem(null, null); } expectedType(SymbolType.SEMICOLON); GraphTargetItem fcom = command(inFunction, inMethod, forinlevel, true, variables, functions); @@ -1306,7 +1306,7 @@ public class ActionScript2Parser { buf.pushAllBack(lexer); ret = expression(inFunction, inMethod, true, variables, functions, false); } - s = lex(); + s = lex(); if ((s != null) && (s.type != SymbolType.SEMICOLON)) { lexer.pushback(s); } @@ -1879,7 +1879,17 @@ public class ActionScript2Parser { expected(s2, lexer.yyline(), SymbolType.IDENTIFIER); ret = new VariableActionItem(s.value.toString() + ":" + s2.value.toString(), null, false); } else { - ret = new VariableActionItem(s.value.toString(), null, false); + String varName = s.value.toString(); + ParsedSymbol s2 = lex(); + while (s2.type == SymbolType.COLON) { + s2 = lex(); + expected(s2, lexer.yyline(), SymbolType.IDENTIFIER); + varName += ":" + s2.value.toString(); + s2 = lex(); + } + lexer.pushback(s2); + + ret = new VariableActionItem(varName, null, false); } variables.add((VariableActionItem) ret); allowMemberOrCall = true;