typo on last commit
[mono.git] / mcs / ilasm / parser / ILParser.jay
index 0ce9c42ef1af58206f7237f2c55f28f9d5cd1e8c..67c9d234af1832d42a69b145f5b1b42b584a2df6 100644 (file)
@@ -24,17 +24,32 @@ namespace Mono.ILASM {
                 private string pinvoke_mod;\r
                 private string pinvoke_meth;\r
                 private PEAPI.PInvokeAttr pinvoke_attr;\r
-                private StreamReader stream;\r
+                private ILTokenizer tokenizer;\r
                                 \r
-               public ILParser (CodeGen codegen, StreamReader stream) {\r
+               public ILParser (CodeGen codegen, ILTokenizer tokenizer)\r
+                {\r
                        this.codegen = codegen;\r
-                        this.stream = stream;\r
+                        this.tokenizer = tokenizer;\r
                }\r
 \r
                public CodeGen CodeGen {\r
                        get { return codegen; }\r
                }\r
-               \r
+\r
+                private ITypeRef GetTypeRef (ITypeRef b)\r
+                {\r
+                        ExternTypeRefInst etri = b as ExternTypeRefInst;\r
+                        ExternTypeRef etr;\r
+\r
+                        if (etri != null)\r
+                                return etri.Clone ();\r
+\r
+                        etr = b as ExternTypeRef;\r
+                        if (etr != null)\r
+                                return etr.Clone ();\r
+\r
+                        return b;\r
+                }\r
 %}\r
 \r
 %token EOF\r
@@ -437,8 +452,8 @@ vtfixup_decl                : D_VTFIXUP OPEN_BRACKET int32 CLOSE_BRACKET
                        ;\r
 \r
 vtfixup_attr           : /* EMPTY */\r
-                       | vtfixup_attr int32\r
-                       | vtfixup_attr int64\r
+                       | vtfixup_attr K_INT32\r
+                       | vtfixup_attr K_INT64\r
                        | vtfixup_attr K_FROMUNMANAGED\r
                        | vtfixup_attr K_CALLMOSTDERIVED\r
                        ;\r
@@ -609,6 +624,13 @@ class_ref          : OPEN_BRACKET slashed_name CLOSE_BRACKET slashed_name
                                 }\r
                           }\r
                        | OPEN_BRACKET D_MODULE slashed_name CLOSE_BRACKET slashed_name\r
+                          {\r
+                                if (codegen.IsThisModule ((string) $3)) {\r
+                                        $$ = new TypeRef ((string) $5, false, null);\r
+                                } else {\r
+                                        $$ = codegen.ExternTable.GetModuleTypeRef ((string) $3, (string) $5, false);\r
+                                }\r
+                          }\r
                        | slashed_name\r
                           {\r
                                 PrimitiveTypeRef prim = PrimitiveTypeRef.GetPrimitiveType ((string) $1);\r
@@ -706,50 +728,38 @@ type                      : K_CLASS class_ref
                           }\r
                        | type OPEN_BRACKET CLOSE_BRACKET\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 base_type.MakeArray ();\r
                                 $$ = base_type;\r
                           }\r
                        | type OPEN_BRACKET bounds CLOSE_BRACKET\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 ArrayList bound_list = (ArrayList) $3;\r
                                 base_type.MakeBoundArray (bound_list);\r
                                 $$ = base_type;\r
                           }\r
                        | type AMPERSAND\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 base_type.MakeManagedPointer ();\r
                                 $$ = base_type;\r
                           }\r
                        | type STAR\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 base_type.MakeUnmanagedPointer ();\r
                                 $$ = base_type;\r
                           }\r
                        | type K_PINNED\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 base_type.MakePinned ();\r
                                 $$ = base_type;\r
                           }\r
                        | type K_MODREQ OPEN_PARENS class_ref CLOSE_PARENS\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 IClassRef class_ref = (IClassRef) $4;\r
                                 base_type.MakeCustomModified (codegen,\r
                                         CustomModifier.modopt, class_ref);\r
@@ -757,15 +767,16 @@ type                      : K_CLASS class_ref
                           }\r
                        | type K_MODOPT OPEN_PARENS class_ref CLOSE_PARENS\r
                           {\r
-                                ITypeRef base_type = (ITypeRef) $1;\r
-                                if (base_type is ExternTypeRef)\r
-                                        base_type = ((ExternTypeRef) base_type).Clone ();\r
+                                ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
                                 IClassRef class_ref = (IClassRef) $4;\r
                                 base_type.MakeCustomModified (codegen,\r
                                         CustomModifier.modopt, class_ref);\r
                                 $$ = base_type;\r
                           }\r
                        | K_METHOD call_conv type STAR OPEN_PARENS sig_args CLOSE_PARENS\r
+                          {\r
+                                $$ = new MethodPointerTypeRef ((CallConv) $2, (ITypeRef) $3, (ArrayList) $6);\r
+                          }\r
                        | K_TYPEDREF\r
                           {\r
                                 $$ = new PrimitiveTypeRef (PrimitiveType.TypedRef,\r
@@ -775,6 +786,10 @@ type                       : K_CLASS class_ref
                           {\r
                                 $$ = new PrimitiveTypeRef (PrimitiveType.Char, "System.Char");\r
                           }\r
+                       | K_WCHAR\r
+                         {\r
+                               $$ = new PrimitiveTypeRef (PrimitiveType.Char, "System.Char");\r
+                         }\r
                        | K_VOID\r
                           {\r
                                 $$ = new PrimitiveTypeRef (PrimitiveType.Void, "System.Void");\r
@@ -870,6 +885,10 @@ bounds                     : bound
                        ;\r
 \r
 bound                  : /* EMPTY */\r
+                          {\r
+                                // This is shortref for no lowerbound or size\r
+                                $$ = new DictionaryEntry (TypeRef.Ellipsis, TypeRef.Ellipsis);\r
+                          }\r
                        | ELLIPSIS\r
                           {\r
                                 // No lower bound or size\r
@@ -1127,11 +1146,11 @@ field_decl              : D_FIELD repeat_opt field_attr type id at_opt init_opt
                                 if ($2 != null) {\r
                                         field_def.SetOffset ((uint) $2);\r
                                 }\r
-                                \r
+\r
                                 if ($6 != null) {\r
                                         field_def.AddDataValue ((string) $6);\r
                                 }\r
-                                \r
+\r
                                 if ($7 != null) {\r
                                         field_def.SetValue ((Constant) $7);\r
                                 }\r
@@ -1235,7 +1254,7 @@ field_init                : K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS
                           }\r
                        | K_FLOAT64 OPEN_PARENS int64 CLOSE_PARENS\r
                           {\r
-                                $$ = new DoubleConst (Convert.ToDouble (3));\r
+                                $$ = new DoubleConst (Convert.ToDouble ($3));\r
                           }\r
                        | K_INT64 OPEN_PARENS int64 CLOSE_PARENS\r
                           {\r
@@ -1253,6 +1272,10 @@ field_init               : K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS
                           {\r
                                 $$ = new CharConst (Convert.ToChar ($3));\r
                           }\r
+                       | K_WCHAR OPEN_PARENS int64 CLOSE_PARENS\r
+                         {\r
+                               $$ = new CharConst (Convert.ToChar ($3));\r
+                         }\r
                        | K_INT8 OPEN_PARENS int64 CLOSE_PARENS\r
                           {\r
                                 $$ = new IntConst (Convert.ToByte ($3));\r
@@ -1261,9 +1284,9 @@ field_init                : K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS
                           {\r
                                 $$ = new BoolConst ((bool) $3);\r
                           }\r
-                       | K_BYTEARRAY OPEN_PARENS bytes CLOSE_PARENS\r
+                       | K_BYTEARRAY bytes_list\r
                           {\r
-                                $$ = new ByteArrConst ((byte[]) $3);\r
+                                $$ = new ByteArrConst ((byte[]) $2);\r
                           }\r
                        | comp_qstring\r
                           {\r
@@ -1330,23 +1353,28 @@ dataitem                : K_CHAR STAR OPEN_PARENS comp_qstring CLOSE_PARENS
                           {\r
                                 $$ = new StringConst ((string) $4);\r
                           }\r
+                       | K_WCHAR STAR OPEN_PARENS comp_qstring CLOSE_PARENS\r
+                         {\r
+                               $$ = new StringConst ((string) $4);\r
+                         }\r
                        | AMPERSAND OPEN_PARENS id CLOSE_PARENS\r
                           {\r
                            //     DataDef def = codegen.CurrentTypeDef.GetDataDef ((string) $3);\r
                            //     $$ = new AddressConstant ((DataConstant) def.PeapiConstant);\r
                           }\r
-                       | K_BYTEARRAY ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+                       | K_BYTEARRAY ASSIGN bytes_list\r
                           {\r
-                                $$ = new ByteArrConst ((byte[]) $4);\r
+                                $$ = new ByteArrConst ((byte[]) $3);\r
                           }\r
-                       | K_BYTEARRAY OPEN_PARENS bytes CLOSE_PARENS\r
+                       | K_BYTEARRAY bytes_list\r
                           {\r
                                 // ******** THIS IS NOT IN THE SPECIFICATION ******** //\r
-                                $$ = new ByteArrConst ((byte[]) $3);\r
+                                $$ = new ByteArrConst ((byte[]) $2);\r
                           }\r
                        | K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS repeat_opt\r
                           {\r
-                                FloatConst float_const = new FloatConst ((float) $3);\r
+                                double d = (double) $3;\r
+                                FloatConst float_const = new FloatConst ((float) d);\r
 \r
                                 if ($5 != null)\r
                                         $$ = new RepeatedConstant (float_const, (int) $5);\r
@@ -1382,7 +1410,8 @@ dataitem          : K_CHAR STAR OPEN_PARENS comp_qstring CLOSE_PARENS
                           }\r
                        | K_INT16 OPEN_PARENS int32 CLOSE_PARENS repeat_opt\r
                           {\r
-                                IntConst int_const = new IntConst ((short) $3);\r
+                                int i = (int) $3;\r
+                                IntConst int_const = new IntConst ((short) i);\r
 \r
                                 if ($5 != null)\r
                                         $$ = new RepeatedConstant (int_const, (int) $5);\r
@@ -1391,7 +1420,8 @@ dataitem          : K_CHAR STAR OPEN_PARENS comp_qstring CLOSE_PARENS
                           }\r
                        | K_INT8 OPEN_PARENS int32 CLOSE_PARENS repeat_opt\r
                           {\r
-                                IntConst int_const = new IntConst ((sbyte) $3);\r
+                                int i = (int) $3;\r
+                                IntConst int_const = new IntConst ((sbyte) i);\r
 \r
                                 if ($5 != null)\r
                                         $$ = new RepeatedConstant (int_const, (int) $5);\r
@@ -1469,7 +1499,8 @@ method_head               : D_METHOD meth_attr call_conv param_attr type method_name
                                 codegen.BeginMethodDef (methdef);\r
 \r
                                 if (pinvoke_info) {\r
-                                        methdef.AddPInvokeInfo (pinvoke_attr, pinvoke_mod, pinvoke_meth);\r
+                                        ExternModule mod = codegen.ExternTable.AddModule (pinvoke_mod);\r
+                                        methdef.AddPInvokeInfo (pinvoke_attr, mod, pinvoke_meth);\r
                                         pinvoke_info = false;\r
                                 }\r
 \r
@@ -1740,6 +1771,16 @@ type_spec                : class_ref
                                 // assembly. This is not supported in the MS version of ilasm\r
                           }\r
                        | OPEN_BRACKET D_MODULE slashed_name CLOSE_BRACKET\r
+                          {\r
+                                string module = (string) $3;\r
+\r
+                                if (codegen.IsThisModule (module)) {\r
+                                    // This is not handled yet.\r
+                                } else {\r
+                                    $$ = codegen.ExternTable.GetModuleTypeRef ((string) $3, "<Module>", false);\r
+                                }\r
+\r
+                          }\r
                        | type\r
                        ;\r
 \r
@@ -1937,7 +1978,7 @@ instr                     : INSTR_NONE
                                         break;\r
                                 }\r
                           }\r
-                       | INSTR_R OPEN_PARENS bytes CLOSE_PARENS\r
+                       | INSTR_R bytes_list\r
                        | INSTR_BRTARGET int32\r
                           {\r
                                LabelInfo target = codegen.CurrentMethodDef.AddLabel ((int) $2);\r
@@ -1980,17 +2021,15 @@ instr                   : INSTR_NONE
                                 if ((MiscInstr) $1 == MiscInstr.ldstr)\r
                                         codegen.CurrentMethodDef.AddInstr (new LdstrInstr ((string) $2));\r
                           }\r
-                       | INSTR_STRING K_BYTEARRAY ASSIGN OPEN_PARENS\r
-                          bytes CLOSE_PARENS\r
+                       | INSTR_STRING K_BYTEARRAY ASSIGN bytes_list\r
                           {\r
-                                byte[] bs = (byte[]) $5;\r
+                                byte[] bs = (byte[]) $4;\r
                                 if ((MiscInstr) $1 == MiscInstr.ldstr)\r
                                         codegen.CurrentMethodDef.AddInstr (new LdstrInstr (bs));\r
                           }\r
-                       | INSTR_STRING K_BYTEARRAY OPEN_PARENS bytes\r
-                          CLOSE_PARENS\r
+                       | INSTR_STRING K_BYTEARRAY bytes_list\r
                           {\r
-                                byte[] bs = (byte[]) $4;\r
+                                byte[] bs = (byte[]) $3;\r
                                 if ((MiscInstr) $1 == MiscInstr.ldstr)\r
                                         codegen.CurrentMethodDef.AddInstr (new LdstrInstr (bs));\r
                           }\r
@@ -2226,6 +2265,9 @@ prop_attr                 : /* EMPTY */
                           {\r
                                 $$ = (FeatureAttr) $1 | FeatureAttr.Specialname;\r
                           }\r
+                        | prop_attr K_INSTANCE\r
+                          {\r
+                          }\r
                        ;\r
 \r
 prop_decls             : /* EMPTY */\r
@@ -2254,15 +2296,15 @@ customattr_decl         : D_CUSTOM custom_type
                                 $$ = new CustomAttr ((IMethodRef) $2, null);\r
                           }\r
                        | D_CUSTOM custom_type ASSIGN comp_qstring\r
-                       | D_CUSTOM custom_type ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+                       | D_CUSTOM custom_type ASSIGN bytes_list\r
                           {\r
                                 $$ = new CustomAttr ((IMethodRef) $2,\r
-                                        (byte[]) $5);\r
+                                        (byte[]) $4);\r
                           }\r
                        | D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type\r
                        | D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type ASSIGN comp_qstring\r
                        | D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type ASSIGN\r
-                         OPEN_PARENS bytes CLOSE_PARENS\r
+                         bytes_list\r
                        ;\r
                        \r
 custom_type            : call_conv type type_spec DOUBLE_COLON D_CTOR OPEN_PARENS type_list CLOSE_PARENS\r
@@ -2296,7 +2338,7 @@ custom_type               : call_conv type type_spec DOUBLE_COLON D_CTOR OPEN_PARENS type_lis
 \r
 sec_decl               : D_PERMISSION sec_action type_spec OPEN_PARENS nameval_pairs CLOSE_PARENS\r
                        | D_PERMISSION sec_action type_spec\r
-                       | D_PERMISSIONSET sec_action ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+                       | D_PERMISSIONSET sec_action ASSIGN bytes_list\r
                        ;\r
 \r
 nameval_pairs          : nameval_pair \r
@@ -2334,21 +2376,48 @@ sec_action              : K_REQUEST
                        ;\r
 \r
 module_head            : D_MODULE\r
+                          {\r
+                          }\r
                        | D_MODULE comp_name\r
+                          {\r
+                                codegen.SetModuleName ((string) $2);\r
+                          }\r
                        | D_MODULE K_EXTERN comp_name\r
+                          {\r
+                                codegen.ExternTable.AddModule ((string) $3);                         \r
+                          }\r
                        ;\r
 \r
 file_decl              : D_FILE file_attr comp_name file_entry D_HASH ASSIGN\r
-                         OPEN_PARENS bytes CLOSE_PARENS file_entry\r
+                         bytes_list file_entry\r
+                          {\r
+                                codegen.SetFileRef (new FileRef ((string) $3, (byte []) $7, (bool) $2, (bool) $8)); \r
+                          }\r
                        | D_FILE file_attr comp_name file_entry\r
+                          {\r
+                                // We need to compute the hash ourselves. :-(\r
+                                // AssemblyName an = AssemblyName.GetName ((string) $3);\r
+                          }\r
                        ;\r
 \r
 file_attr              : /* EMPTY */\r
+                          {\r
+                                $$ = true;\r
+                          }\r
                        | file_attr K_NOMETADATA\r
+                          {\r
+                                $$ = false;\r
+                          }\r
                        ;\r
 \r
 file_entry             : /* EMPTY */\r
+                          {\r
+                                $$ = false;\r
+                          }\r
                        | D_ENTRYPOINT\r
+                          {\r
+                                $$ = true;\r
+                          }\r
                        ;\r
 \r
 assembly_all           : assembly_head OPEN_BRACE assembly_decls CLOSE_BRACE\r
@@ -2370,15 +2439,34 @@ assembly_decls          : /* EMPTY */
                        | assembly_decls assembly_decl\r
                        ;\r
 \r
-assembly_decl          : D_HASH K_ALGORITHM int32\r
+assembly_decl          : D_PUBLICKEY ASSIGN bytes_list\r
+                         {\r
+                               codegen.SetAssemblyPublicKey ((byte []) $3);\r
+                         }\r
+                       | D_VER int32 COLON int32 COLON int32 COLON int32\r
+                         {\r
+                               codegen.SetAssemblyVersion ((int) $2, (int) $4, (int) $6, (int) $8);\r
+                         }\r
+                       | D_LOCALE comp_qstring\r
+                         {\r
+                               codegen.SetAssemblyLocale ((string) $2);\r
+                         }\r
+                       | D_LOCALE ASSIGN bytes_list\r
+                       | D_HASH K_ALGORITHM int32\r
+                         {\r
+                               codegen.SetAssemblyHashAlgorithm ((int) $3);\r
+                         }\r
+                       | customattr_decl\r
+                         {\r
+                               codegen.AddAssemblyCustomAttribute ((CustomAttr) $1);\r
+                         }\r
                        | sec_decl\r
-                       | asm_or_ref_decl\r
                        ;\r
 \r
-asm_or_ref_decl                : D_PUBLICKEY ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+asm_or_ref_decl                : D_PUBLICKEY ASSIGN bytes_list\r
                        | D_VER int32 COLON int32 COLON int32 COLON int32 \r
                        | D_LOCALE comp_qstring\r
-                       | D_LOCALE ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+                       | D_LOCALE ASSIGN bytes_list\r
                        | customattr_decl\r
                        ;\r
 \r
@@ -2390,14 +2478,14 @@ assemblyref_head        : D_ASSEMBLY K_EXTERN slashed_name
                                 System.Reflection.AssemblyName asmb_name = \r
                                        new System.Reflection.AssemblyName ();\r
                                asmb_name.Name = (string) $3;\r
-                               codegen.ExternTable.AddAssembly ((string) $3, asmb_name);\r
+                               codegen.BeginAssemblyRef ((string) $3, asmb_name);\r
                           }\r
                        | D_ASSEMBLY K_EXTERN slashed_name K_AS slashed_name\r
                           {\r
                                 System.Reflection.AssemblyName asmb_name = \r
                                        new System.Reflection.AssemblyName ();\r
                                asmb_name.Name = (string) $3;\r
-                               codegen.ExternTable.AddAssembly ((string) $5, asmb_name);\r
+                               codegen.BeginAssemblyRef ((string) $5, asmb_name);\r
                           }\r
                        ;\r
 \r
@@ -2405,9 +2493,32 @@ assemblyref_decls        : /* EMPTY */
                        | assemblyref_decls assemblyref_decl\r
                        ;\r
 \r
-assemblyref_decl       : D_HASH ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
-                       | asm_or_ref_decl\r
-                       | D_PUBLICKEYTOKEN ASSIGN OPEN_PARENS bytes CLOSE_PARENS\r
+assemblyref_decl       : D_VER int32 COLON int32 COLON int32 COLON int32\r
+                          {\r
+                                codegen.CurrentAssemblyRef.SetVersion ((int) $2, (int) $4, (int) $6, (int) $8);\r
+                          }\r
+                        | D_PUBLICKEY ASSIGN bytes_list\r
+                          {\r
+                                codegen.CurrentAssemblyRef.SetPublicKey ((byte []) $3);\r
+                          }\r
+                        | D_PUBLICKEYTOKEN ASSIGN bytes_list\r
+                          {\r
+                                codegen.CurrentAssemblyRef.SetPublicKeyToken ((byte []) $3);\r
+                          }\r
+                       | D_LOCALE comp_qstring\r
+                          {\r
+                                codegen.CurrentAssemblyRef.SetLocale ((string) $2);\r
+                          }\r
+                       | D_LOCALE ASSIGN bytes_list\r
+                       \r
+                        | D_HASH ASSIGN bytes_list\r
+                          {\r
+                                codegen.CurrentAssemblyRef.SetHash ((byte []) $3);\r
+                          }\r
+                        | customattr_decl\r
+                          {\r
+                                codegen.CurrentAssemblyRef.AddCustomAttribute ((CustomAttr) $1);\r
+                          }\r
                        ;\r
 \r
 exptype_all            : exptype_head OPEN_BRACE exptype_decls CLOSE_BRACE\r
@@ -2465,7 +2576,7 @@ int32                     : INT64
                           {\r
                                 long l = (long) $1;\r
                                 byte[] intb = BitConverter.GetBytes (l);\r
-                                $$ = BitConverter.ToInt32 (intb, 0);\r
+                                $$ = BitConverter.ToInt32 (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
                           }\r
                        ;\r
 \r
@@ -2477,38 +2588,39 @@ float64                 : FLOAT64
                           {\r
                                 int i = (int) $3;\r
                                 byte[] intb = BitConverter.GetBytes (i);\r
-                                $$ = (double) BitConverter.ToSingle (intb, 0);\r
+                                $$ = (double) BitConverter.ToSingle (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
                           }\r
                         | K_FLOAT32 OPEN_PARENS INT64 CLOSE_PARENS\r
                           {\r
                                 long l = (long) $3;\r
                                 byte[] intb = BitConverter.GetBytes (l);\r
-                                $$ = (double) BitConverter.ToSingle (intb, 0);\r
+                                $$ = (double) BitConverter.ToSingle (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
                           }\r
                        | K_FLOAT64 OPEN_PARENS INT64 CLOSE_PARENS\r
                           {\r
                                 byte[] intb = BitConverter.GetBytes ((long) $3);\r
-                               $$ = BitConverter.ToDouble (intb, 0);\r
+                               $$ = BitConverter.ToDouble (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
                           }\r
                         | K_FLOAT64 OPEN_PARENS INT32 CLOSE_PARENS\r
                           {\r
                                 byte[] intb = BitConverter.GetBytes ((int) $3);\r
-                                $$ = (double) BitConverter.ToSingle (intb, 0);\r
+                                $$ = (double) BitConverter.ToSingle (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
                           }\r
                        ;\r
 \r
 hexbyte                        : HEXBYTE       { }\r
-                        | INT64\r
+                       ;\r
+\r
+bytes_list              : OPEN_PARENS\r
                           {\r
-                                long l = (long) $1;\r
-                                byte b = Byte.Parse (l.ToString (), NumberStyles.HexNumber);\r
-                                $$ = b;\r
+                                tokenizer.InByteArray = true;\r
                           }\r
-                        | ID\r
+                          bytes CLOSE_PARENS\r
                           {\r
-                                $$ = Byte.Parse ((string) $1, NumberStyles.HexNumber);\r
+                                $$ = $3;\r
+                                tokenizer.InByteArray = false;\r
                           }\r
-                       ;\r
+                        ;\r
 \r
 bytes                  : /* EMPTY */   { $$ = new byte[0]; }\r
                        | hexbytes\r
@@ -2532,7 +2644,13 @@ hexbytes         : hexbyte
                        ;\r
 \r
 truefalse              : K_TRUE\r
+                          {\r
+                                $$ = true;\r
+                          }\r
                        | K_FALSE\r
+                          {\r
+                                $$ = false;\r
+                          }\r
                        ;\r
 \r
 id                     : ID\r