Changed AS1/2 P-code action parameters are now separated by commas, code without commas is still accepted

This commit is contained in:
Jindra Petřík
2023-10-15 08:50:51 +02:00
parent d0a69b1850
commit cca0161766
18 changed files with 1217 additions and 1209 deletions

View File

@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.ecma.Undefined;
import java.util.Stack;
%%
@@ -57,6 +58,24 @@ import com.jpexs.decompiler.flash.ecma.Undefined;
return yyline + 1;
}
private Stack<ASMParsedSymbol> pushedBack = new Stack<>();
public void pushback(ASMParsedSymbol symb) {
pushedBack.push(symb);
last = null;
}
ASMParsedSymbol last;
public ASMParsedSymbol lex() throws java.io.IOException, ActionParseException{
ASMParsedSymbol ret = null;
if (!pushedBack.isEmpty()){
ret = last = pushedBack.pop();
} else {
ret = last = yylex();
}
return ret;
}
%}
/* main character classes */
@@ -139,6 +158,9 @@ Constant= constant{PositiveNumberLiteral}
string.setLength(0);
}
"," { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_COMMA); }
/* numeric literals */
{NumberLiteral} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_INTEGER, Long.parseLong((yytext()))); }