private void AnalyRight() { propertyName = RightToken.Text; if (SubjectExp.RetType is ZLEnumInfo) { Errorf(SubjectExp.Position, "约定没有属性"); return; } else if (SubjectExp.RetType is ZLClassInfo) { AnalyMember(SubjectExp.RetType as ZLClassInfo); } else if (SubjectExp.RetType is ZCClassInfo) { AnalyMember(SubjectExp.RetType as ZCClassInfo); } if (memberSymbol == null) { Errorf(SubjectExp.Position, "{0}不存在成员'{1}'", SubjectExp.ToString(), propertyName); } else if (IsNeedTempLocal()) { AnalyPropertyTempLocal(); } }
public override Exp Analy() { if (this.IsAnalyed) { return(this); } if (this.ExpContext == null) { throw new CCException(); } SubjectExp = AnalyLeft(); if (RightToken == null) { Errorf(SubjectExp.Position, "'{0}'的后面缺少属性", SubjectExp.ToString()); return(SubjectExp); } if (RightToken.IsKind(TokenKindKeyword.Each)) { var eachItemExp = AnalyEach(); Exp newExp = eachItemExp.Analy(); return(newExp); } else { AnalyRight(); } IsAnalyed = true; return(this); }
public override string ToString() { StringBuilder buf = new StringBuilder(); buf.Append(SubjectExp != null ? SubjectExp.ToString() : ""); buf.Append("的"); buf.Append(RightToken != null ? RightToken.Text : ""); return(buf.ToString()); }
private Exp AnalyLeft() { var newExp = AnalySubExp(SubjectExp); if (newExp is ExpTypeBase) { var leftTypeExp = (SubjectExp as ExpTypeBase); ZType ltype = leftTypeExp.RetType; if (ltype is ZLEnumInfo) { Errorf(SubjectExp.Position, "约定类型'{0}'取值不能用'的'", SubjectExp.ToString()); } else if (ltype is ZLClassInfo) { ExpStaticClassName escn = new ExpStaticClassName(this.ExpContext, leftTypeExp.GetMainToken(), (ltype as ZLClassInfo)); //escn.SetContextExp(this.ExpContext); newExp = escn.Analy(); } } return(newExp); //else if (LeftExp is ExpLocalVar) //{ // memberSymbol = (LeftExp as ExpLocalVar).LocalVarSymbol; //} //else if (LeftExp is ExpArg) //{ // memberSymbol = (LeftExp as ExpArg).ArgSymbol; //} //else //{ // //isNeedEmitLeft = true; // //var VarName = "LocalDStructIndex_" + LocalDStructIndex; // //ZCLocalVar localVarSymbol = new ZCLocalVar(VarName, LeftExp.RetType); // //localVarSymbol.LoacalVarIndex = this.ExpContext.ProcContext.CreateLocalVarIndex(VarName); // //this.ProcContext.AddLocalVar(localVarSymbol); // //memberSymbol = localVarSymbol; // //LocalDStructIndex++; //} }
public override string ToString() { return(string.Format("{0}第{1}", SubjectExp.ToString(), ArgExp.ToString())); }