From 0c0953bea35d3f9c3058427c2b4b513454ea6712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 21 Nov 2021 16:33:53 +0100 Subject: [PATCH] Fixed AS1/2 - Slash syntax colon vs ternar operator collision --- CHANGELOG.md | 1 + .../parser/script/ActionScript2Parser.java | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcdb1fe5c..1edb7f80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - AS1/2 direct editation - postincrement/decrement - Reload menu disabled when do SWF selected - AS2 - Do not detect classes inside functions +- AS1/2 - Slash syntax colon vs ternar operator collision ## [14.5.2] - 2021-11-20 ### Fixed 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 6408f8f2e..755a9d0e2 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 @@ -1875,20 +1875,22 @@ public class ActionScript2Parser { ret = new NotItem(null, null, expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval)); } else { 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(); + if (s.type == SymbolType.PATH) { //only with slash syntax + 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); } - lexer.pushback(s2); /*if (Action.propertyNamesList.contains(varName)) { ret = new GetPropertyActionItem(null, null, pushConst(""), Action.propertyNamesList.indexOf(varName)); } else {*/ - ret = new VariableActionItem(varName, null, false); - variables.add((VariableActionItem) ret); + ret = new VariableActionItem(varName, null, false); + variables.add((VariableActionItem) ret); //} allowMemberOrCall = true; }