Exemplo n.º 1
0
 private void AnalyProcDesc()
 {
     CallDesc = new ZMethodCall();
     ArgExps  = new List <Exp>();
     foreach (var item in this.Elements)
     {
         //if (this.Elements[0].ToString().StartsWith("战场参数的绘图器"))
         //{
         //    Console.WriteLine(this.ToString());
         //}
         if (item is ExpProcNamePart)
         {
             ExpProcNamePart namePartExp = item as ExpProcNamePart;
             CallDesc.Add(namePartExp.PartName);
         }
         else if (item is ExpBracket)
         {
             ExpBracket   bracketExp   = item as ExpBracket;
             ZBracketCall zbracketDesc = bracketExp.GetCallDesc();
             CallDesc.Add(zbracketDesc);
             ArgExps.AddRange(bracketExp.GetSubExps());
         }
         else
         {
             throw new CCException();
         }
     }
 }
Exemplo n.º 2
0
        private Exp SearchSubject( )
        {
            Exp SubjectExp = Elements[0];

            if (SubjectExp is ExpProcNamePart)
            {
                return(null);
            }
            else if (SubjectExp is ExpNameValue)
            {
                return(null);
            }
            else
            {
                while (SubjectExp is ExpBracket)
                {
                    ExpBracket expBracket = SubjectExp as ExpBracket;
                    if (expBracket.Count == 1)
                    {
                        SubjectExp = expBracket.GetSubExps()[0];
                    }
                    else
                    {
                        throw new CCException();
                    }
                }
                ZMethodCall    tailDesc       = CallDesc.CreateTail();
                List <Exp>     argExps        = ListHelper.GetSubs <Exp>(ArgExps, 1);
                ExpCallSubject expCallSubject = new ExpCallSubject(this.ExpContext, SubjectExp, tailDesc, this.SrcExp, argExps);
                return(expCallSubject);
            }
        }
Exemplo n.º 3
0
        public override Exp Analy( )
        {
            TypeExp    = AnalySubExp(TypeExp) as ExpType;       //TypeExp = ArgExp.Analy();
            BracketExp = AnalySubExp(BracketExp) as ExpBracket; //BracketExp.Analy();
            if (!AnalyCorrect)
            {
                return(this);
            }

            //Type subjectType = TypeExp.RetType.SharpType;
            if (IsList())
            {
                ExpNewList newListExp = new ExpNewList(this.ExpContext, TypeExp, BracketExp);
                //newListExp.SetContext(this.ExpContext);
                return(newListExp.Analy());
            }
            else
            {
                var args = BracketExp.GetCallNormalArgs();
                //ZMethodArgCollection argCollection = new ZMethodArgCollection(args);
                newDesc      = new ZNewDesc(args);
                ZConstructor = (TypeExp.RetType as ZClassType).FindDeclaredZConstructor(newDesc);
                if (ZConstructor == null)
                {
                    ErrorE(BracketExp.Postion, "没有正确的创建过程");
                }
                else
                {
                    RetType = TypeExp.RetType;
                }
            }
            return(this);
        }
Exemplo n.º 4
0
 private void AnalyProcDesc()
 {
     ExpProcDesc = new ZCallDesc();
     for (int i = 0; i < this.Elements.Count; i++)
     {
         Exp exp = this.Elements[i];
         exp.SetContext(this.ExpContext);
         Exp subExp = exp.Analy();
         Elements[i] = subExp;
         if (subExp != null)
         {
             if (subExp is ExpProcNamePart)
             {
                 ExpProcDesc.Add((subExp as ExpProcNamePart).PartName);
             }
             else if (subExp is ExpBracket)
             {
                 ExpProcDesc.Add((subExp as ExpBracket).GetDimArgs().ToArray());
             }
             else
             {
                 ExpBracket bracket = new ExpBracket();
                 bracket.AddInnerExp(subExp);
                 ExpProcDesc.Add(bracket.GetDimArgs().ToArray());
             }
         }
     }
 }
Exemplo n.º 5
0
        public override Exp Analy( )
        {
            if (this.IsAnalyed)
            {
                return(this);
            }
            TypeExp    = (ExpTypeBase)(AnalySubExp(TypeExp));
            BracketExp = AnalySubExp(BracketExp) as ExpBracket;
            if (!AnalyCorrect)
            {
                return(this);
            }

            if (ZTypeUtil.IsListClass(TypeExp.RetType))
            {
                ExpNewList newListExp = new ExpNewList(this.ExpContext, TypeExp, BracketExp);
                IsAnalyed = true;
                return(newListExp.Analy());
            }
            else
            {
                return(AnalyNewExpOrQiangDiao());
            }
        }
Exemplo n.º 6
0
 private void InitExpNew(ExpTypeBase typeExp, ExpBracket bracketExp)
 {
     TypeExp    = typeExp;
     BracketExp = bracketExp;
 }
Exemplo n.º 7
0
 public ExpNew(ContextExp expContext, ExpTypeBase typeExp, ExpBracket bracketExp)
     : base(expContext)
 {
     InitExpNew(typeExp, bracketExp);
 }
Exemplo n.º 8
0
 public ExpNewList(ContextExp context, ExpType typeExp, ExpBracket argExp)
 {
     this.ExpContext = context;
     TypeExp         = typeExp;
     ArgExp          = argExp;
 }
Exemplo n.º 9
0
 public ExpNewList(ContextExp context, ExpTypeBase typeExp, ExpBracket argExp) : base(context)
 {
     TypeExp = typeExp;
     ArgExp  = argExp;
 }