예제 #1
0
        public RustJSEnumsGenerator(GeneratorOptions generatorOptions)
        {
            idConverter = RustJSIdentifierConverter.Create();
            docWriter   = new RustDocCommentWriter(idConverter, ".");

            toPartialFileInfo = new Dictionary <TypeId, PartialEnumFileInfo?>();
            toPartialFileInfo.Add(TypeIds.BlockEncoderOptions, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "block_encoder_options.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.Code, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "code.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CodeSize, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "code_size.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.ConditionCode, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "condition_code.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CpuidFeature, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "cpuid_feature.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.DecoderOptions, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "decoder_options.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.EncodingKind, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "encoding_kind.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.FlowControl, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "flow_control.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.FormatMnemonicOptions, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "format_mnemonic_options.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.MandatoryPrefix, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "mandatory_prefix.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.MemorySize, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "memory_size.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.MemorySizeOptions, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "memory_size_options.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.Mnemonic, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "mnemonic.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.OpAccess, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "op_access.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.OpCodeOperandKind, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "op_code_operand_kind.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.OpCodeTableKind, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "op_code_table_kind.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.OpKind, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "op_kind.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.Register, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "register.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.RflagsBits, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "rflags_bits.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.RoundingControl, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "rounding_control.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.TupleType, new PartialEnumFileInfo("Enum", Path.Combine(generatorOptions.RustJSDir, "tuple_type.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
        }
예제 #2
0
        public RustJSEnumsGenerator(GeneratorContext generatorContext)
            : base(generatorContext.Types)
        {
            idConverter      = RustJSIdentifierConverter.Create();
            docWriter        = new RustDocCommentWriter(idConverter, ".");
            deprecatedWriter = new RustJSDeprecatedWriter(idConverter);

            var dirs = generatorContext.Types.Dirs;

            toPartialFileInfo = new();
            toPartialFileInfo.Add(TypeIds.BlockEncoderOptions, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("block_encoder_options.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_a, new PartialEnumFileInfo("CC_a", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_ae, new PartialEnumFileInfo("CC_ae", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_b, new PartialEnumFileInfo("CC_b", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_be, new PartialEnumFileInfo("CC_be", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_e, new PartialEnumFileInfo("CC_e", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_g, new PartialEnumFileInfo("CC_g", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_ge, new PartialEnumFileInfo("CC_ge", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_l, new PartialEnumFileInfo("CC_l", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_le, new PartialEnumFileInfo("CC_le", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_ne, new PartialEnumFileInfo("CC_ne", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_np, new PartialEnumFileInfo("CC_np", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CC_p, new PartialEnumFileInfo("CC_p", dirs.GetRustJSFilename("cc.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.Code, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("code.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CodeSize, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("code_size.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.ConditionCode, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("condition_code.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.CpuidFeature, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("cpuid_feature.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.DecoderError, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("decoder_error.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.DecoderOptions, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("decoder_options.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.EncodingKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("encoding_kind.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.FlowControl, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("flow_control.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.FormatMnemonicOptions, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("format_mnemonic_options.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.MandatoryPrefix, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mandatory_prefix.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.MemorySize, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("memory_size.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.MemorySizeOptions, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("memory_size_options.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.Mnemonic, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mnemonic.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.OpAccess, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("op_access.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.OpCodeOperandKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("op_code_operand_kind.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.MvexEHBit, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mvex_eh_bit.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.OpCodeTableKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("op_code_table_kind.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.OpKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("op_kind.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.Register, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("register.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.RepPrefixKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("rep_prefix_kind.rs"), new[] { RustConstants.AttributeCopyClone }));
            toPartialFileInfo.Add(TypeIds.RflagsBits, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("rflags_bits.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.RoundingControl, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("rounding_control.rs"), RustConstants.AttributeCopyClone));
            toPartialFileInfo.Add(TypeIds.TupleType, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("tuple_type.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.FormatterSyntax, new PartialEnumFileInfo("FormatterSyntax", dirs.GetRustJSFilename("formatter.rs")));
            toPartialFileInfo.Add(TypeIds.MvexConvFn, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mvex_cvt_fn.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.MvexRegMemConv, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mvex_rm_conv.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
            toPartialFileInfo.Add(TypeIds.MvexTupleTypeLutKind, new PartialEnumFileInfo("Enum", dirs.GetRustJSFilename("mvex_tt_lut.rs"), new[] { RustConstants.AttributeCopyClone, RustConstants.AttributeAllowNonCamelCaseTypes }));
        }
예제 #3
0
 public RustJSInstrCreateGen(GeneratorOptions generatorOptions)
 {
     idConverter           = RustJSIdentifierConverter.Create();
     rustIdConverter       = RustIdentifierConverter.Create();
     this.generatorOptions = generatorOptions;
     docWriter             = new RustDocCommentWriter(idConverter, ".");
     gen      = new Rust.InstrCreateGenImpl(idConverter, docWriter);
     genNames = new Rust.GenCreateNameArgs {
         CreatePrefix = "create",
         Register     = "Reg",
         Memory       = "Mem",
         Int32        = "I32",
         UInt32       = "U32",
         Int64        = "I64",
         UInt64       = "U64",
     };
     sb = new StringBuilder();
 }
예제 #4
0
 public RustJSInstrCreateGen(GeneratorContext generatorContext)
     : base(generatorContext.Types)
 {
     this.generatorContext = generatorContext;
     idConverter           = RustJSIdentifierConverter.Create();
     rustIdConverter       = RustIdentifierConverter.Create();
     docWriter             = new RustDocCommentWriter(idConverter, ".", ".", ".", ".");
     gen      = new Rust.InstrCreateGenImpl(genTypes, idConverter, docWriter);
     genNames = new Rust.GenCreateNameArgs {
         CreatePrefix = "create",
         Register     = "Reg",
         Memory       = "Mem",
         Int32        = "I32",
         UInt32       = "U32",
         Int64        = "I64",
         UInt64       = "U64",
     };
     sb = new StringBuilder();
 }