void initByAttr(CnEnDict wordDict) { var tattr = Attribute.GetCustomAttribute(MType, typeof(ZMappingAttribute)); if (tattr != null) { attr = tattr as ZMappingAttribute; ForType = attr.ForType; if (MType != typeof(事物)) { if (attr.BaseMappingType != null) { ParentMapping = new MappingGcl(attr.BaseMappingType, wordDict); } else { ParentMapping = new MappingGcl(typeof(事物), wordDict); } } } else { throw new CompileException("没有找到MappingTypeAttribute"); } }
public TktGcl(Type mtype, CnEnDict wordDict) { MType = mtype; WordDict = wordDict; classAttr = getTKTAttr(MType); if (classAttr.ParentMappingType != null) { ParentMapping = GclUtil.Load(classAttr.ParentMappingType, wordDict); } else { if (MType.BaseType != null) { ZClassAttribute attr = getTKTAttr(MType.BaseType); if (attr != null) { ParentMapping = GclUtil.Load(MType.BaseType, wordDict); } } } if (ParentMapping == null) { ParentMapping = GclUtil.Load(typeof(事物), wordDict); } }
public MappingGcl(Type mappingedType, CnEnDict wordDict) { MType = mappingedType; //ForType = GetForType(); WordDict = wordDict; initByAttr(wordDict); }
public static TKTConstructorDesc SearchConstructor(TKTConstructorDesc desc, CnEnDict WordDict, Type ForType) { TKTConstructorDesc bracket2 = desc; if (WordDict != null && desc.Bracket.IsNameValue) { List <TKTProcArg> args = new List <TKTProcArg>(); foreach (var arg in desc.Bracket.ListArgs) { string newArgName = WordDict.Get(arg.ArgName); TKTProcArg newArg = new TKTProcArg(newArgName, arg.ArgType, arg.ArgType.IsGenericType); args.Add(newArg); } bracket2 = new TKTConstructorDesc(args); } ConstructorInfo[] constructorInfoArray = ForType.GetConstructors(); foreach (ConstructorInfo ci in constructorInfoArray) { if (ci.IsPublic) { TKTConstructorDesc bracketCi = ProcDescHelper.CreateProcBracket(ci); if (bracketCi.Eq(bracket2)) { return(bracketCi); } } } return(null); }
public static IGcl Load(Type type, CnEnDict wordDict) { MappingTypeAttribute mattr = Attribute.GetCustomAttribute(type, typeof(MappingTypeAttribute)) as MappingTypeAttribute; if (mattr != null) { return(new MappingGcl(type, wordDict)); } TKTClassAttribute tcAttr = Attribute.GetCustomAttribute(type, typeof(TKTClassAttribute)) as TKTClassAttribute; if (tcAttr != null) { return(new TktGcl(type, wordDict)); } return(null); }
public TKTProcDesc Parser(CnEnDict wordDict, string code) { this.WordDict = wordDict; i = 0; desc = new TKTProcDesc(); Code = code; while (i < Code.Length) { if (ch == '(') { parseBracket(); } else { parseText(); } } return(desc); }
public void LoadRefTypes() { TKTTypes = new List <Type>(); LibWords = new Dictionary <Assembly, CnEnDict>(); foreach (Assembly asm in this.Refs) { foreach (Type type in asm.GetTypes()) { if (type.IsPublic) { TKTTypes.Add(type); if (ReflectionUtil.IsExtends(type, typeof(CnEnDict))) { CnEnDict dict = ReflectionUtil.NewInstance(type) as CnEnDict; LibWords.Add(asm, dict); } } } } }
public static IGcl Load(Type type, CnEnDict wordDict) { ZMappingAttribute mattr = Attribute.GetCustomAttribute(type, typeof(ZMappingAttribute)) as ZMappingAttribute; if (mattr != null) { return(new MappingGcl(type, wordDict)); } ZClassAttribute tcAttr = Attribute.GetCustomAttribute(type, typeof(ZClassAttribute)) as ZClassAttribute; if (tcAttr != null) { return(new TktGcl(type, wordDict)); } ExternalGcl egcl = new ExternalGcl(type, wordDict); return(egcl); }
public ExternalGcl(Type mtype, CnEnDict wordDict) { MType = mtype; WordDict = wordDict; }
public TktGcl(Type mtype, CnEnDict wordDict) { MType = mtype; WordDict = wordDict; }
public MappingGcl(Type mappingedType, CnEnDict wordDict) { MType = mappingedType; ForType = GetForType(); WordDict = wordDict; }