diff --git a/trunk/lib/jsyntaxpane-0.9.5.jar b/trunk/lib/jsyntaxpane-0.9.5.jar index 9339ba0e7..e45b25bd5 100644 Binary files a/trunk/lib/jsyntaxpane-0.9.5.jar and b/trunk/lib/jsyntaxpane-0.9.5.jar differ diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java b/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java index 72a03b462..ff67e957d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java @@ -105,6 +105,38 @@ public class ConstantPool { return 0; } + public int forceGetStringId(String val){ + int id=getStringId(val); + if(id==0){ + id=addString(val); + } + return id; + } + + public int forceGetIntId(long val){ + int id=getIntId(val); + if(id==0){ + id=addInt(val); + } + return id; + } + + public int forceGetUIntId(long val){ + int id=getUIntId(val); + if(id==0){ + id=addUInt(val); + } + return id; + } + + public int forceGetDoubleId(double val){ + int id=getDoubleId(val); + if(id==0){ + id=addDouble(val); + } + return id; + } + public void dump(OutputStream os) { PrintStream output = new PrintStream(os); String s = ""; diff --git a/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java b/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java index d970b7a5c..13571fd69 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java @@ -59,6 +59,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL if (Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.bodyIndex != bi) { Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.setBodyIndex(bi, abc); Main.abcMainFrame.detailPanel.methodTraitPanel.methodBodyParamsPanel.loadFromBody(abc.bodies[bi]); + Main.abcMainFrame.detailPanel.methodTraitPanel.methodInfoPanel.load(abc.bodies[bi].method_info, abc); } for (Highlighting h : highlights) { if ((pos >= h.startPos) && (pos < h.startPos + h.len)) { diff --git a/trunk/src/com/jpexs/asdec/abc/gui/MethodBodyParamsPanel.java b/trunk/src/com/jpexs/asdec/abc/gui/MethodBodyParamsPanel.java index 2380a21cd..6845de880 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/MethodBodyParamsPanel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/MethodBodyParamsPanel.java @@ -84,12 +84,14 @@ public class MethodBodyParamsPanel extends JPanel { maxScopeDepthField.setText("" + body.max_scope_depth); } - public void save() { + public boolean save() { if (body != null) { body.max_stack = Integer.parseInt(maxStackField.getText()); body.max_regs = Integer.parseInt(localCountField.getText()); body.init_scope_depth = Integer.parseInt(initScopeDepthField.getText()); body.max_scope_depth = Integer.parseInt(maxScopeDepthField.getText()); + return true; } + return false; } } diff --git a/trunk/src/com/jpexs/asdec/abc/gui/MethodInfoPanel.java b/trunk/src/com/jpexs/asdec/abc/gui/MethodInfoPanel.java new file mode 100644 index 000000000..c8e539152 --- /dev/null +++ b/trunk/src/com/jpexs/asdec/abc/gui/MethodInfoPanel.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.methodinfo_parser.MethodInfoParser; +import com.jpexs.asdec.abc.methodinfo_parser.ParseException; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.helpers.Helper; +import java.awt.BorderLayout; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +/** + * + * @author JPEXS + */ +public class MethodInfoPanel extends JPanel { + public LineMarkedEditorPane paramEditor; + private MethodInfo methodInfo; + private ABC abc; + public MethodInfoPanel() + { + paramEditor=new LineMarkedEditorPane(); + setLayout(new BorderLayout()); + add(new JLabel("Parameters:"),BorderLayout.NORTH); + add(new JScrollPane(paramEditor), BorderLayout.CENTER); + paramEditor.setContentType("text/flasm3_methodinfo"); + } + + public void load(int methodInfoIndex,ABC abc) + { + this.abc=abc; + if(methodInfoIndex<=0) + { + paramEditor.setText(""); + } + this.methodInfo=abc.method_info[methodInfoIndex]; + int p=0; + String ret=""; + int optParPos=0; + if(methodInfo.flagHas_optional()) + { + optParPos=methodInfo.param_types.length-methodInfo.optional.length; + } + for(int ptype:methodInfo.param_types) + { + if(p>0){ + ret+=",\n"; + } + if(methodInfo.flagHas_paramnames()) + { + ret=ret+abc.constants.constant_string[methodInfo.paramNames[p]]; + }else{ + ret=ret+"param"+(p+1); + } + ret+=":"; + if(ptype==0){ + ret+="*"; + }else{ + ret+="m["+ptype+"]\""+Helper.escapeString(abc.constants.constant_multiname[ptype].toString(abc.constants))+"\""; + } + if(methodInfo.flagHas_optional()) + { + if(p>=optParPos) + { + ret+="="+methodInfo.optional[p-optParPos].toString(abc.constants); + } + } + p++; + } + if(methodInfo.flagNeed_rest()){ + ret+=",\n... rest"; + } + paramEditor.setText(ret); + } + + public boolean save() + { + try { + MethodInfoParser.parse(paramEditor.getText(), methodInfo, abc); + } catch (ParseException ex) { + JOptionPane.showMessageDialog(paramEditor, ex.text, "MethodInfo Error", JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/MethodTraitDetailPanel.java b/trunk/src/com/jpexs/asdec/abc/gui/MethodTraitDetailPanel.java index 179aac880..e27736953 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/MethodTraitDetailPanel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/MethodTraitDetailPanel.java @@ -29,23 +29,34 @@ public class MethodTraitDetailPanel extends JTabbedPane implements TraitDetail { public MethodCodePanel methodCodePanel; public MethodBodyParamsPanel methodBodyParamsPanel; + public MethodInfoPanel methodInfoPanel; public MethodTraitDetailPanel() { methodCodePanel = new MethodCodePanel(); methodBodyParamsPanel = new MethodBodyParamsPanel(); + methodInfoPanel=new MethodInfoPanel(); + addTab("MethodInfo",methodInfoPanel); addTab("MethodBody Code", methodCodePanel); - addTab("MethodBody params", new JScrollPane(methodBodyParamsPanel)); - + addTab("MethodBody params", new JScrollPane(methodBodyParamsPanel)); } public boolean save() { - if (methodCodePanel.sourceTextArea.save(Main.abcMainFrame.abc.constants)) { - methodBodyParamsPanel.save(); - int lasttrait = Main.abcMainFrame.decompiledTextArea.lastTraitIndex; - Main.abcMainFrame.decompiledTextArea.reloadClass(); - Main.abcMainFrame.decompiledTextArea.gotoTrait(lasttrait); - return true; + if(!methodInfoPanel.save()) + { + return false; } - return false; + if (!methodCodePanel.sourceTextArea.save(Main.abcMainFrame.abc.constants)) + { + return false; + } + if(!methodBodyParamsPanel.save()) + { + return false; + } + + int lasttrait = Main.abcMainFrame.decompiledTextArea.lastTraitIndex; + Main.abcMainFrame.decompiledTextArea.reloadClass(); + Main.abcMainFrame.decompiledTextArea.gotoTrait(lasttrait); + return true; } } diff --git a/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoLexer.java b/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoLexer.java new file mode 100644 index 000000000..d44941d1b --- /dev/null +++ b/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoLexer.java @@ -0,0 +1,1036 @@ +/* The following code was generated by JFlex 1.4.3 on 11.7.11 15:46 */ + +/* Method info lexer specification */ + +package com.jpexs.asdec.abc.methodinfo_parser; + + +/** + * This class is a scanner generated by + * JFlex 1.4.3 + * on 11.7.11 15:46 from the specification file + * D:/Dokumenty/Programovani/JavaSE/ASDec/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/methodinfo.flex + */ +public final class MethodInfoLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int STRING = 2; + public static final int YYINITIAL = 0; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\5\1\3\1\2\1\0\1\3\1\1\16\5\4\0\1\3\1\0"+ + "\1\42\1\0\1\4\2\0\1\56\2\0\1\45\1\37\1\44\1\7"+ + "\1\35\1\0\1\6\3\57\4\40\2\10\1\43\2\0\1\46\3\0"+ + "\4\4\1\36\6\4\1\31\1\4\1\25\1\4\1\17\12\4\1\12"+ + "\1\41\1\13\1\0\1\4\1\0\1\32\1\27\1\50\1\51\1\24"+ + "\1\55\1\53\1\4\1\21\1\4\1\52\1\33\1\11\1\14\1\20"+ + "\1\47\1\4\1\30\1\15\1\22\1\26\1\23\1\4\1\54\2\4"+ + "\1\16\1\0\1\34\1\0\41\5\2\0\4\4\4\0\1\4\2\0"+ + "\1\5\7\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0"+ + "\u013f\4\31\0\162\4\4\0\14\4\16\0\5\4\11\0\1\4\21\0"+ + "\130\5\5\0\23\5\12\0\1\4\13\0\1\4\1\0\3\4\1\0"+ + "\1\4\1\0\24\4\1\0\54\4\1\0\46\4\1\0\5\4\4\0"+ + "\202\4\1\0\4\5\3\0\105\4\1\0\46\4\2\0\2\4\6\0"+ + "\20\4\41\0\46\4\2\0\1\4\7\0\47\4\11\0\21\5\1\0"+ + "\27\5\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\4\1\0\1\4\1\0"+ + "\4\4\2\0\7\4\1\0\7\4\1\0\27\4\1\0\37\4\1\0"+ + "\1\4\1\0\4\4\2\0\7\4\1\0\47\4\1\0\23\4\16\0"+ + "\11\5\56\0\125\4\14\0\u026c\4\2\0\10\4\12\0\32\4\5\0"+ + "\113\4\3\0\3\4\17\0\15\4\1\0\4\4\3\5\13\0\22\4"+ + "\3\5\13\0\22\4\2\5\14\0\15\4\1\0\3\4\1\0\2\5"+ + "\14\0\64\4\40\5\3\0\1\4\3\0\2\4\1\5\2\0\12\5"+ + "\41\0\3\5\2\0\12\5\6\0\130\4\10\0\51\4\1\5\126\0"+ + "\35\4\3\0\14\5\4\0\14\5\12\0\12\5\36\4\2\0\5\4"+ + "\u038b\0\154\4\224\0\234\4\4\0\132\4\6\0\26\4\2\0\6\4"+ + "\2\0\46\4\2\0\6\4\2\0\10\4\1\0\1\4\1\0\1\4"+ + "\1\0\1\4\1\0\37\4\2\0\65\4\1\0\7\4\1\0\1\4"+ + "\3\0\3\4\1\0\7\4\3\0\4\4\2\0\6\4\4\0\15\4"+ + "\5\0\3\4\1\0\7\4\17\0\4\5\32\0\5\5\20\0\2\4"+ + "\23\0\1\4\13\0\4\5\6\0\6\5\1\0\1\4\15\0\1\4"+ + "\40\0\22\4\36\0\15\5\4\0\1\5\3\0\6\5\27\0\1\4"+ + "\4\0\1\4\2\0\12\4\1\0\1\4\3\0\5\4\6\0\1\4"+ + "\1\0\1\4\1\0\1\4\1\0\4\4\1\0\3\4\1\0\7\4"+ + "\3\0\3\4\5\0\5\4\26\0\44\4\u0e81\0\3\4\31\0\11\4"+ + "\6\5\1\0\5\4\2\0\5\4\4\0\126\4\2\0\2\5\2\0"+ + "\3\4\1\0\137\4\5\0\50\4\4\0\136\4\21\0\30\4\70\0"+ + "\20\4\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4\u0773\0\u2ba4\4\u215c\0"+ + "\u012e\4\2\0\73\4\225\0\7\4\14\0\5\4\5\0\1\4\1\5"+ + "\12\4\1\0\15\4\1\0\5\4\1\0\1\4\1\0\2\4\1\0"+ + "\2\4\1\0\154\4\41\0\u016b\4\22\0\100\4\2\0\66\4\50\0"+ + "\15\4\3\0\20\5\20\0\4\5\17\0\2\4\30\0\3\4\31\0"+ + "\1\4\6\0\5\4\1\0\207\4\2\0\1\5\4\0\1\4\13\0"+ + "\12\5\7\0\32\4\4\0\1\4\1\0\32\4\12\0\132\4\3\0"+ + "\6\4\2\0\6\4\2\0\6\4\2\0\3\4\3\0\2\4\3\0"+ + "\2\4\22\0\3\5\4\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\2\0\2\1\1\2\1\3\1\1\1\3\7\2\1\1"+ + "\1\4\1\5\1\6\1\7\1\10\2\2\1\11\2\12"+ + "\1\1\1\13\1\14\1\0\1\14\2\0\7\2\1\0"+ + "\3\2\1\15\1\16\1\17\1\20\1\21\1\22\1\16"+ + "\1\23\1\24\1\25\1\26\1\14\4\0\6\2\1\27"+ + "\4\2\1\16\2\0\1\30\2\2\1\31\6\2\1\32"+ + "\1\0\7\2\1\33\1\0\1\34\6\2\1\0\4\2"+ + "\1\35\1\36\1\0\1\37\1\40\2\2\1\0\1\41"+ + "\1\42\20\0\1\43"; + + private static int [] zzUnpackAction() { + int [] result = new int[134]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\60\0\140\0\220\0\300\0\360\0\u0120\0\u0150"+ + "\0\u0180\0\u01b0\0\u01e0\0\u0210\0\u0240\0\u0270\0\u02a0\0\u02d0"+ + "\0\140\0\140\0\140\0\140\0\140\0\u0300\0\u0330\0\u0360"+ + "\0\u0390\0\140\0\u03c0\0\140\0\360\0\u03f0\0\u0420\0\u0450"+ + "\0\u0480\0\u04b0\0\u04e0\0\u0510\0\u0540\0\u0570\0\u05a0\0\u05d0"+ + "\0\u0600\0\u0630\0\u0660\0\u0690\0\140\0\u06c0\0\140\0\140"+ + "\0\140\0\140\0\u06f0\0\140\0\140\0\140\0\140\0\u0720"+ + "\0\u0720\0\u0750\0\u0780\0\u07b0\0\u07e0\0\u0810\0\u0840\0\u0870"+ + "\0\u08a0\0\u08d0\0\140\0\u0900\0\u0930\0\u0960\0\u0990\0\140"+ + "\0\u09c0\0\u09f0\0\300\0\u0a20\0\u0a50\0\300\0\u0a80\0\u0ab0"+ + "\0\u0ae0\0\u0b10\0\u0b40\0\u0b70\0\140\0\u0ba0\0\u0bd0\0\u0c00"+ + "\0\u0c30\0\u0c60\0\u0c90\0\u0cc0\0\u0cf0\0\300\0\u0d20\0\300"+ + "\0\u0d50\0\u0d80\0\u0db0\0\u0de0\0\u0e10\0\u0e40\0\u0e70\0\u0ea0"+ + "\0\u0ed0\0\u0f00\0\u0f30\0\300\0\300\0\u0f60\0\300\0\300"+ + "\0\u0f90\0\u0fc0\0\u0ff0\0\300\0\300\0\u1020\0\u1050\0\u1080"+ + "\0\u10b0\0\u10e0\0\u1110\0\u1140\0\u1170\0\u11a0\0\u11d0\0\u1200"+ + "\0\u1230\0\u1260\0\u1290\0\u12c0\0\u12f0\0\140"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[134]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\3\3\1\4\1\5\1\3\1\6\1\7\1\10\1\11"+ + "\2\3\1\12\1\13\1\3\2\5\1\14\1\15\1\5"+ + "\1\16\1\5\1\17\5\5\1\3\1\20\1\5\1\3"+ + "\1\10\1\3\1\21\1\22\1\23\1\24\1\25\1\26"+ + "\5\5\1\27\1\3\1\10\1\30\1\31\1\32\36\30"+ + "\1\33\1\34\15\30\63\0\1\4\60\0\3\5\1\0"+ + "\2\5\2\0\2\5\1\0\15\5\2\0\1\5\1\0"+ + "\1\5\6\0\7\5\1\0\1\5\6\0\1\35\1\0"+ + "\1\35\13\0\1\36\10\0\1\37\1\36\1\0\1\35"+ + "\16\0\1\35\6\0\1\35\1\0\1\10\24\0\1\40"+ + "\2\0\1\10\16\0\1\10\6\0\1\10\1\0\1\10"+ + "\13\0\1\36\10\0\1\37\1\36\1\0\1\10\16\0"+ + "\1\10\4\0\3\5\1\0\2\5\1\41\1\0\2\5"+ + "\1\0\15\5\2\0\1\5\1\0\1\5\6\0\7\5"+ + "\1\0\1\5\4\0\3\5\1\0\2\5\2\0\1\5"+ + "\1\42\1\0\7\5\1\43\5\5\2\0\1\5\1\0"+ + "\1\5\6\0\7\5\1\0\1\5\4\0\3\5\1\0"+ + "\2\5\2\0\2\5\1\0\3\5\1\44\11\5\2\0"+ + "\1\5\1\0\1\5\6\0\7\5\1\0\1\5\4\0"+ + "\3\5\1\0\2\5\2\0\1\45\1\5\1\0\15\5"+ + "\2\0\1\5\1\0\1\5\6\0\7\5\1\0\1\5"+ + "\4\0\3\5\1\0\2\5\2\0\2\5\1\0\11\5"+ + "\1\46\3\5\2\0\1\5\1\0\1\5\6\0\7\5"+ + "\1\0\1\5\4\0\3\5\1\0\2\5\2\0\2\5"+ + "\1\0\15\5\2\0\1\5\1\0\1\5\6\0\5\5"+ + "\1\47\1\5\1\0\1\5\4\0\3\5\1\0\2\5"+ + "\2\0\1\50\1\5\1\0\15\5\2\0\1\5\1\0"+ + "\1\5\6\0\7\5\1\0\1\5\6\0\1\37\1\0"+ + "\1\37\24\0\1\51\2\0\1\37\16\0\1\37\4\0"+ + "\3\5\1\0\2\5\2\0\2\5\1\0\11\5\1\52"+ + "\1\5\1\53\1\5\2\0\1\5\1\0\1\5\6\0"+ + "\7\5\1\0\1\5\4\0\3\5\1\0\2\5\2\0"+ + "\2\5\1\0\13\5\1\54\1\5\2\0\1\5\1\0"+ + "\1\5\6\0\7\5\1\0\1\5\1\30\2\0\36\30"+ + "\2\0\15\30\2\0\1\32\55\0\2\55\1\0\3\55"+ + "\1\56\5\55\1\57\5\55\1\60\4\55\1\61\1\62"+ + "\7\55\1\63\1\64\1\65\12\55\1\66\1\67\1\56"+ + "\6\0\1\70\1\71\1\70\26\0\1\71\1\70\16\0"+ + "\1\70\6\0\1\37\1\0\1\37\13\0\1\36\11\0"+ + "\1\36\1\0\1\37\16\0\1\37\6\0\1\37\1\0"+ + "\1\37\27\0\1\37\16\0\1\37\6\0\1\72\1\0"+ + "\1\73\27\0\1\73\16\0\1\73\4\0\3\5\1\0"+ + "\2\5\2\0\2\5\1\74\15\5\2\0\1\5\1\0"+ + "\1\5\6\0\7\5\1\0\1\5\4\0\3\5\1\0"+ + "\2\5\2\0\2\5\1\0\14\5\1\75\2\0\1\5"+ + "\1\0\1\5\6\0\7\5\1\0\1\5\4\0\3\5"+ + "\1\0\2\5\2\0\2\5\1\0\13\5\1\76\1\5"+ + "\2\0\1\5\1\0\1\5\6\0\7\5\1\0\1\5"+ + "\4\0\3\5\1\0\2\5\2\0\2\5\1\0\3\5"+ + "\1\77\11\5\2\0\1\5\1\0\1\5\6\0\7\5"+ + "\1\0\1\5\4\0\3\5\1\0\2\5\2\0\2\5"+ + "\1\0\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\0\2\5\1\0\5\5\1\154\7\5\2\0"+ + "\1\5\1\0\1\5\6\0\7\5\1\0\1\5\4\0"+ + "\3\5\1\0\2\5\2\0\2\5\1\0\5\5\1\155"+ + "\7\5\2\0\1\5\1\0\1\5\6\0\7\5\1\0"+ + "\1\5\22\0\1\156\41\0\3\5\1\0\2\5\2\0"+ + "\2\5\1\0\14\5\1\157\2\0\1\5\1\0\1\5"+ + "\6\0\7\5\1\0\1\5\4\0\3\5\1\0\2\5"+ + "\2\0\2\5\1\0\3\5\1\160\11\5\2\0\1\5"+ + "\1\0\1\5\6\0\7\5\1\0\1\5\4\0\3\5"+ + "\1\0\2\5\2\0\2\5\1\0\5\5\1\161\7\5"+ + "\2\0\1\5\1\0\1\5\6\0\7\5\1\0\1\5"+ + "\4\0\3\5\1\0\2\5\2\0\2\5\1\0\5\5"+ + "\1\162\7\5\2\0\1\5\1\0\1\5\6\0\7\5"+ + "\1\0\1\5\21\0\1\163\42\0\3\5\1\0\2\5"+ + "\2\0\2\5\1\0\15\5\2\0\1\5\1\0\1\5"+ + "\6\0\2\5\1\164\4\5\1\0\1\5\4\0\3\5"+ + "\1\0\2\5\2\0\2\5\1\0\15\5\2\0\1\5"+ + "\1\0\1\5\6\0\2\5\1\165\4\5\1\0\1\5"+ + "\23\0\1\166\60\0\1\167\60\0\1\170\60\0\1\171"+ + "\42\0\1\172\75\0\1\173\54\0\1\174\63\0\1\175"+ + "\60\0\1\176\47\0\1\177\60\0\1\200\61\0\1\201"+ + "\63\0\1\202\61\0\1\203\60\0\1\204\60\0\1\205"+ + "\36\0\1\206\44\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[4896]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\2\0\1\11\15\1\5\11\4\1\1\11\1\1\1\11"+ + "\1\1\1\0\1\1\2\0\7\1\1\0\3\1\1\11"+ + "\1\1\4\11\1\1\4\11\1\1\4\0\6\1\1\11"+ + "\4\1\1\11\2\0\12\1\1\11\1\0\10\1\1\0"+ + "\7\1\1\0\6\1\1\0\4\1\1\0\2\1\20\0"+ + "\1\11"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[134]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + StringBuffer string = new StringBuffer(); + boolean isMultiname=false; + long multinameId=0; + + + /** + * Create an empty lexer, yyrset will be called later to reset and assign + * the reader + */ + public MethodInfoLexer() { + + } + + public int yychar() { + return yychar; + } + + public int yyline() { + return yyline+1; + } + + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public MethodInfoLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public MethodInfoLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 1768) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead-zzStartRead); + + /* translate stored positions */ + zzEndRead-= zzStartRead; + zzCurrentPos-= zzStartRead; + zzMarkedPos-= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos*2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length-zzEndRead); + + if (numRead > 0) { + zzEndRead+= numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) + zzReader.close(); + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * cannot be reused (internal buffer is discarded and lost). + * Lexical state is set to ZZ_INITIAL. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead+pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public ParsedSymbol yylex() throws java.io.IOException, ParseException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar+= zzMarkedPosL-zzStartRead; + + boolean zzR = false; + for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; + zzCurrentPosL++) { + switch (zzBufferL[zzCurrentPosL]) { + case '\u000B': + case '\u000C': + case '\u0085': + case '\u2028': + case '\u2029': + yyline++; + yycolumn = 0; + zzR = false; + break; + case '\r': + yyline++; + yycolumn = 0; + zzR = true; + break; + case '\n': + if (zzR) + zzR = false; + else { + yyline++; + yycolumn = 0; + } + break; + default: + zzR = false; + yycolumn++; + } + } + + if (zzR) { + // peek one character ahead if it is \n (if we have counted one line too much) + boolean zzPeek; + if (zzMarkedPosL < zzEndReadL) + zzPeek = zzBufferL[zzMarkedPosL] == '\n'; + else if (zzAtEOF) + zzPeek = false; + else { + boolean eof = zzRefill(); + zzEndReadL = zzEndRead; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + if (eof) + zzPeek = false; + else + zzPeek = zzBufferL[zzMarkedPosL] == '\n'; + } + if (zzPeek) yyline--; + } + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) + zzInput = zzBufferL[zzCurrentPosL++]; + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 2: + { return new ParsedSymbol(ParsedSymbol.TYPE_IDENTIFIER,yytext()); + } + case 36: break; + case 8: + { return new ParsedSymbol(ParsedSymbol.TYPE_ASSIGN); + } + case 37: break; + case 24: + { return new ParsedSymbol(ParsedSymbol.TYPE_NULL); + } + case 38: break; + case 22: + { string.append( '\'' ); + } + case 39: break; + case 3: + { return new ParsedSymbol(ParsedSymbol.TYPE_INTEGER,new Long(Long.parseLong((yytext())))); + } + case 40: break; + case 33: + { return new ParsedSymbol(ParsedSymbol.TYPE_UNDEFINED); + } + case 41: break; + case 34: + { return new ParsedSymbol(ParsedSymbol.TYPE_PROTECTED); + } + case 42: break; + case 28: + { return new ParsedSymbol(ParsedSymbol.TYPE_STATIC); + } + case 43: break; + case 9: + { string.append( yytext() ); + } + case 44: break; + case 14: + { char val = (char) Integer.parseInt(yytext().substring(1),8); + string.append( val ); + } + case 45: break; + case 29: + { return new ParsedSymbol(ParsedSymbol.TYPE_PRIVATE); + } + case 46: break; + case 5: + { return new ParsedSymbol(ParsedSymbol.TYPE_COLON); + } + case 47: break; + case 18: + { string.append( '\r' ); + } + case 48: break; + case 25: + { return new ParsedSymbol(ParsedSymbol.TYPE_TRUE); + } + case 49: break; + case 6: + { return new ParsedSymbol(ParsedSymbol.TYPE_COMMA); + } + case 50: break; + case 35: + { String s=yytext(); + long ns=Long.parseLong(s.substring(3,s.length()-2)); + return new ParsedSymbol(ParsedSymbol.TYPE_NAMESPACE,new Long(ns)); + } + case 51: break; + case 27: + { return new ParsedSymbol(ParsedSymbol.TYPE_FALSE); + } + case 52: break; + case 11: + { yybegin(YYINITIAL); + // length also includes the trailing quote + if(isMultiname){ + return new ParsedSymbol(ParsedSymbol.TYPE_MULTINAME,new Long(multinameId)); + }else{ + return new ParsedSymbol(ParsedSymbol.TYPE_STRING,string.toString()); + } + } + case 53: break; + case 17: + { string.append( '\b' ); + } + case 54: break; + case 10: + { throw new ParseException("Unterminated string at end of line",yyline+1); + } + case 55: break; + case 4: + { isMultiname=false; + yybegin(STRING); + string.setLength(0); + } + case 56: break; + case 32: + { return new ParsedSymbol(ParsedSymbol.TYPE_EXPLICIT); + } + case 57: break; + case 16: + { string.append( '\t' ); + } + case 58: break; + case 12: + { return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT,new Double(Double.parseDouble((yytext())))); + } + case 59: break; + case 31: + { return new ParsedSymbol(ParsedSymbol.TYPE_INTERNAL); + } + case 60: break; + case 23: + { return new ParsedSymbol(ParsedSymbol.TYPE_DOTS); + } + case 61: break; + case 19: + { string.append( '\\' ); + } + case 62: break; + case 7: + { return new ParsedSymbol(ParsedSymbol.TYPE_STAR); + } + case 63: break; + case 13: + { throw new ParseException("Illegal escape sequence \""+yytext()+"\"",yyline+1); + } + case 64: break; + case 30: + { return new ParsedSymbol(ParsedSymbol.TYPE_PACKAGE); + } + case 65: break; + case 26: + { isMultiname=true; + String s=yytext(); + multinameId=Long.parseLong(s.substring(2,s.length()-2)); + yybegin(STRING); + string.setLength(0); + } + case 66: break; + case 15: + { string.append( '\n' ); + } + case 67: break; + case 21: + { string.append( '\f' ); + } + case 68: break; + case 20: + { string.append( '\"' ); + } + case 69: break; + case 1: + { + } + case 70: break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return new ParsedSymbol(ParsedSymbol.TYPE_EOF); + } + } + else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoParser.java b/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoParser.java new file mode 100644 index 000000000..83b6af2c3 --- /dev/null +++ b/trunk/src/com/jpexs/asdec/abc/methodinfo_parser/MethodInfoParser.java @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2011 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.jpexs.asdec.abc.methodinfo_parser; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.ValueKind; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class MethodInfoParser { + + public static void parse(String text, MethodInfo update,ABC abc) throws ParseException { + MethodInfoLexer lexer = new MethodInfoLexer(new ByteArrayInputStream(text.getBytes())); + List paramNames=new ArrayList(); + List paramTypes=new ArrayList(); + List optionalValues=new ArrayList(); + boolean hasOptional=false; + boolean needsRest=false; + try { + ParsedSymbol symb; + symb = lexer.yylex(); + while (symb.type != ParsedSymbol.TYPE_EOF) + { + if(symb.type==ParsedSymbol.TYPE_DOTS) + { + needsRest=true; + symb = lexer.yylex(); + if(symb.type!=ParsedSymbol.TYPE_IDENTIFIER) + { + throw new ParseException("Identifier expected", lexer.yyline()); + } + symb = lexer.yylex(); + if(symb.type!=ParsedSymbol.TYPE_EOF) + { + throw new ParseException("End expected after rest params", lexer.yyline()); + } + break; + } + + if(symb.type!=ParsedSymbol.TYPE_IDENTIFIER) + { + throw new ParseException("Identifier expected", lexer.yyline()); + } + paramNames.add((String)symb.value); + symb = lexer.yylex(); + if(symb.type==ParsedSymbol.TYPE_COLON){ + ParsedSymbol symbType=lexer.yylex(); + if(symbType.type==ParsedSymbol.TYPE_STAR) + { + paramTypes.add(new Long(0)); + }else if(symbType.type==ParsedSymbol.TYPE_MULTINAME){ + paramTypes.add((Long)symbType.value); + }else{ + throw new ParseException("Multiname or * expected", lexer.yyline()); + } + ParsedSymbol symbEqual=lexer.yylex(); + if(symbEqual.type==ParsedSymbol.TYPE_ASSIGN) + { + hasOptional=true; + ParsedSymbol symbValue; + String nstype=""; + do{ + symbValue=lexer.yylex(); + if(symbValue.type>=8&&symbValue.type<=13){ + nstype=nstype+symbValue.type+":"; + } + }while(symbValue.type>=8&&symbValue.type<=13); + if((!nstype.equals(""))&&(symbValue.type!=ParsedSymbol.TYPE_NAMESPACE)) + { + throw new ParseException("Namespace expected", lexer.yyline()); + } + int id=0; + switch(symbValue.type) + { + case ParsedSymbol.TYPE_INTEGER: + optionalValues.add(new ValueKind(abc.constants.forceGetIntId((Long)symbValue.value),ValueKind.CONSTANT_Int)); + break; + case ParsedSymbol.TYPE_FLOAT: + optionalValues.add(new ValueKind(abc.constants.forceGetDoubleId((Double)symbValue.value),ValueKind.CONSTANT_Double)); + break; + case ParsedSymbol.TYPE_STRING: + optionalValues.add(new ValueKind(abc.constants.forceGetStringId((String)symbValue.value),ValueKind.CONSTANT_Utf8)); + break; + case ParsedSymbol.TYPE_TRUE: + optionalValues.add(new ValueKind(0,ValueKind.CONSTANT_True)); + break; + case ParsedSymbol.TYPE_FALSE: + optionalValues.add(new ValueKind(0,ValueKind.CONSTANT_False)); + break; + case ParsedSymbol.TYPE_NULL: + optionalValues.add(new ValueKind(0,ValueKind.CONSTANT_Null)); + break; + case ParsedSymbol.TYPE_UNDEFINED: + optionalValues.add(new ValueKind(0,ValueKind.CONSTANT_Undefined)); + break; + case ParsedSymbol.TYPE_NAMESPACE: + if(nstype.equals("9:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_PackageNamespace)); + }else + if(nstype.equals("9:10:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_PackageInternalNs)); + }else + if(nstype.equals("13:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_ProtectedNamespace)); + }else + if(nstype.equals("12:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_ExplicitNamespace)); + }else + if(nstype.equals("11:13:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_StaticProtectedNs)); + }else + if(nstype.equals("8:")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_PrivateNs)); + }else if(nstype.equals("")){ + optionalValues.add(new ValueKind((int)(long)(Long)symbValue.value,ValueKind.CONSTANT_Namespace)); + }else{ + throw new ParseException("Invalid type of namespace", lexer.yyline()); + } + break; + default: + throw new ParseException("Unexpected symbol", lexer.yyline()); + } + symb=lexer.yylex(); + if(symb.type==ParsedSymbol.TYPE_COMMA){ + + }else if(symb.type==ParsedSymbol.TYPE_EOF){ + break; + } + }else if(symbEqual.type==ParsedSymbol.TYPE_COMMA){ + if(hasOptional) + { + throw new ParseException("Parameter must have default value", lexer.yyline()); + } + }else if(symbEqual.type==ParsedSymbol.TYPE_EOF){ + if(hasOptional) + { + throw new ParseException("Parameter must have default value", lexer.yyline()); + } + break; + } else { + throw new ParseException("Unexpected symbol", lexer.yyline()); + } + }else if(symb.type==ParsedSymbol.TYPE_COMMA){ + + }else if(symb.type==ParsedSymbol.TYPE_EOF){ + break; + }else{ + throw new ParseException("Unexpected symbol", lexer.yyline()); + } + symb = lexer.yylex(); + } + } catch (IOException iex) { + } + + if(needsRest&&(!optionalValues.isEmpty())){ + throw new ParseException("Rest parameter canot be combined with default values", lexer.yyline()); + } + + update.param_types=new int[paramTypes.size()]; + for(int p=0;p { + /* whitespace */ + {WhiteSpace} { } + {Multiname}\" { + isMultiname=true; + String s=yytext(); + multinameId=Long.parseLong(s.substring(2,s.length()-2)); + yybegin(STRING); + string.setLength(0); + } + /* string literal */ + \" { + isMultiname=false; + yybegin(STRING); + string.setLength(0); + } + + + /* numeric literals */ + + {NumberLiteral} { return new ParsedSymbol(ParsedSymbol.TYPE_INTEGER,new Long(Long.parseLong((yytext())))); } + {FloatLiteral} { return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT,new Double(Double.parseDouble((yytext())))); } + + ":" {return new ParsedSymbol(ParsedSymbol.TYPE_COLON);} + "," {return new ParsedSymbol(ParsedSymbol.TYPE_COMMA);} + "..." {return new ParsedSymbol(ParsedSymbol.TYPE_DOTS);} + "*" {return new ParsedSymbol(ParsedSymbol.TYPE_STAR);} + "=" {return new ParsedSymbol(ParsedSymbol.TYPE_ASSIGN);} + + private {return new ParsedSymbol(ParsedSymbol.TYPE_PRIVATE);} + protected {return new ParsedSymbol(ParsedSymbol.TYPE_PROTECTED);} + package {return new ParsedSymbol(ParsedSymbol.TYPE_PACKAGE);} + internal {return new ParsedSymbol(ParsedSymbol.TYPE_INTERNAL);} + static {return new ParsedSymbol(ParsedSymbol.TYPE_STATIC);} + explicit {return new ParsedSymbol(ParsedSymbol.TYPE_EXPLICIT);} + {Namespace} { + String s=yytext(); + long ns=Long.parseLong(s.substring(3,s.length()-2)); + return new ParsedSymbol(ParsedSymbol.TYPE_NAMESPACE,new Long(ns)); + } + true {return new ParsedSymbol(ParsedSymbol.TYPE_TRUE);} + false {return new ParsedSymbol(ParsedSymbol.TYPE_FALSE);} + null {return new ParsedSymbol(ParsedSymbol.TYPE_NULL);} + undefined {return new ParsedSymbol(ParsedSymbol.TYPE_UNDEFINED);} +{Identifier} { + return new ParsedSymbol(ParsedSymbol.TYPE_IDENTIFIER,yytext()); } +} + + { + \" { + yybegin(YYINITIAL); + // length also includes the trailing quote + if(isMultiname){ + return new ParsedSymbol(ParsedSymbol.TYPE_MULTINAME,new Long(multinameId)); + }else{ + return new ParsedSymbol(ParsedSymbol.TYPE_STRING,string.toString()); + } + } + + {StringCharacter}+ { string.append( yytext() ); } + + /* escape sequences */ + "\\b" { string.append( '\b' ); } + "\\t" { string.append( '\t' ); } + "\\n" { string.append( '\n' ); } + "\\f" { string.append( '\f' ); } + "\\r" { string.append( '\r' ); } + "\\\"" { string.append( '\"' ); } + "\\'" { string.append( '\'' ); } + "\\\\" { string.append( '\\' ); } + \\[0-3]?{OctDigit}?{OctDigit} { char val = (char) Integer.parseInt(yytext().substring(1),8); + string.append( val ); } + + /* error cases */ + \\. { throw new ParseException("Illegal escape sequence \""+yytext()+"\"",yyline+1); } + {LineTerminator} { throw new ParseException("Unterminated string at end of line",yyline+1); } + +} + +/* error fallback */ +.|\n { } +<> { return new ParsedSymbol(ParsedSymbol.TYPE_EOF); } diff --git a/trunk/src/com/jpexs/asdec/abc/types/MethodInfo.java b/trunk/src/com/jpexs/asdec/abc/types/MethodInfo.java index bfda353d4..8dfd05050 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/MethodInfo.java +++ b/trunk/src/com/jpexs/asdec/abc/types/MethodInfo.java @@ -32,6 +32,42 @@ public class MethodInfo { public ValueKind optional[]; public int paramNames[]; + public void setFlagNeed_rest() + { + flags|=4; + } + + public void unsetFlagNeed_rest() + { + if(flagNeed_rest()){ + flags-=4; + } + } + + public void setFlagHas_optional() + { + flags|=8; + } + + public void unsetFlagHas_optional() + { + if(flagHas_optional()){ + flags-=8; + } + } + + public void setFlagHas_paramnames() + { + flags|=128; + } + + public void unsetFlagHas_paramnames() + { + if(flagHas_paramnames()){ + flags-=128; + } + } + public boolean flagNeed_arguments() { return (flags & 1) == 1; } diff --git a/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java b/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java index d88ea877d..3b3644d99 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java +++ b/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java @@ -82,34 +82,34 @@ public class ValueKind { ret = "\"" + constants.constant_string[value_index] + "\""; break; case CONSTANT_True: - ret = "True"; + ret = "true"; break; case CONSTANT_False: - ret = "False"; + ret = "false"; break; case CONSTANT_Null: - ret = "Null"; + ret = "null"; break; case CONSTANT_Undefined: - ret = "Undefined"; + ret = "undefined"; break; case CONSTANT_Namespace: - ret = "" + constants.constant_namespace[value_index].getName(constants); + ret = "ns[" +value_index+"]"; break; case CONSTANT_PackageInternalNs: - ret = "" + constants.constant_namespace[value_index].getName(constants); + ret = "package internal ns[" +value_index+"]"; break; case CONSTANT_ProtectedNamespace: - ret = "protected " + constants.constant_namespace[value_index].getName(constants); + ret = "protected ns[" +value_index+"]"; break; case CONSTANT_ExplicitNamespace: - ret = "explicit " + constants.constant_namespace[value_index].getName(constants); + ret = "explicit ns[" +value_index+"]"; break; case CONSTANT_StaticProtectedNs: - ret = "static protected " + constants.constant_namespace[value_index].getName(constants); + ret = "static protected ns[" +value_index+"]"; break; case CONSTANT_PrivateNs: - ret = "private " + constants.constant_namespace[value_index].getName(constants); + ret = "private ns[" +value_index+"]"; break; } return ret;