protected void ParseStatements(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { string text1 = base.TokenString; if (base.Token == 2) { int num1 = base.GetReswordToken(text1); if (num1 == 2) { this.ParseStatement(text1, Infos, Level); } else if (num1 == 3) { this.ParseLocalVars(text1, Info, new Point(this.tokenPos, base.LineIndex)); } else { this.NextValidToken(); } } else if ((base.Token == 8) && (base.TokenString == "#region")) { this.ParseRegion(Info, Infos, Level, this.parseStatementsProc); } else if (base.Token == 0) { this.ParseLocalVars(text1, Info, new Point(this.tokenPos, base.LineIndex)); } else { this.NextValidToken(); } }
public override ISyntaxInfo FindByName(string Name, bool CaseSensitive) { ISyntaxInfo info1 = this.classes.FindByName(Name, CaseSensitive); if (info1 == null) { info1 = this.structures.FindByName(Name, CaseSensitive); } if (info1 == null) { info1 = this.interfaces.FindByName(Name, CaseSensitive); } if (info1 == null) { info1 = this.delegates.FindByName(Name, CaseSensitive); } if (info1 == null) { info1 = this.enums.FindByName(Name, CaseSensitive); } if (info1 == null) { info1 = this.fields.FindByName(Name, CaseSensitive); } if (info1 == null) { info1 = base.FindByName(Name, CaseSensitive); } return(info1); }
protected virtual void ProcessUsing(ISyntaxInfo Info, Point Position, int Level) { Point point1 = new Point(this.source.Length, base.LineIndex); Point point2 = new Point(this.currentPos, base.LineIndex); string text1 = string.Empty; if (this.GetName(ref text1, ".")) { IUsesInfo info1 = null; if (Info is ICsUnitInfo) { info1 = ((ICsUnitInfo)Info).Uses; } else if (Info is ICsNamespaceInfo) { info1 = ((ICsNamespaceInfo)Info).Uses; } if (info1 != null) { if (info1.Uses.Count == 0) { info1.StartPoint = point2; info1.Position = Position; } info1.Uses.Add(new UsesInfo(text1, Position, Level)); info1.EndPoint = point1; } } }
protected void ParseEnum(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { if (base.Token == 0) { IEnumInfo info1 = (IEnumInfo)Info; info1.Fields.Add(new CsFieldInfo(base.TokenString, info1.DataType, new Point(this.tokenPos, base.LineIndex), CsScope.Public)); while (!base.Eof) { string text1; if (base.NextValidToken(out text1) == 5) { if (text1 == ",") { return; } if (text1 == "}") { return; } } this.NextValidToken(); } } else { this.NextValidToken(); } }
private ISyntaxInfo GetClassByName(ISyntaxInfos Infos, string s) { ISyntaxInfo info1 = Infos.FindByName(s, this.CaseSensitive); if (info1 == null) { foreach (IInterfaceInfo info2 in Infos) { if (info2 is IClassInfo) { IClassInfo info3 = (IClassInfo)info2; info1 = this.GetClassByName(info3.Classes, s); if (info1 == null) { info1 = this.GetClassByName(info3.Interfaces, s); } if (info1 == null) { info1 = this.GetClassByName(info3.Structures, s); } } if (info1 != null) { return(info1); } } } return(info1); }
protected void ParseProperty(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { if (base.Token != 2) { this.NextValidToken(); } else { string text2; ICsPropInfo info1 = (ICsPropInfo)Info; string text1 = base.TokenString; if ((text2 = text1) != null) { text2 = string.IsInterned(text2); if (text2 != "get") { if (text2 == "set") { info1.PropertySet = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.PropertySet, Level, null, this.parseAccessorProc); return; } } else { info1.PropertyGet = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.PropertyGet, Level, null, this.parseAccessorProc); return; } } this.NextValidToken(); } }
protected void ParseStatements(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { string text1 = base.TokenString.ToLower(); if (base.Token == 2) { int num1 = base.GetReswordToken(text1); if ((num1 == 2) && this.IsBlockStart(text1)) { this.ParseStatement(text1, Infos, Level); } else if ((num1 == 11) && (base.TokenString.ToLower() == "dim")) { this.ParseLocalVars(text1, Info); } else { this.NextValidToken(); } } else if ((base.Token == 8) && (base.TokenString == "#region")) { this.ParseRegion(Info, Infos, Level, this.parseStatementsProc); } else { this.NextValidToken(); } }
protected virtual void ProcessSection(ISyntaxInfo Info) { if (Info is IRangeInfo) { IRangeInfo info1 = (IRangeInfo)Info; if (info1.StartPoint.Y >= 0) { this.sections.Add(info1); } this.ProcessSections(info1.Regions); this.ProcessSections(info1.Comments); } if (Info is IInterfaceInfo) { IInterfaceInfo info2 = (InterfaceInfo)Info; this.ProcessSections(info2.Methods); this.ProcessSections(info2.Properties); this.ProcessSections(info2.Events); } if (Info is IClassInfo) { IClassInfo info3 = (IClassInfo)Info; this.ProcessSections(info3.Classes); this.ProcessSections(info3.Interfaces); this.ProcessSections(info3.Structures); this.ProcessSections(info3.Enums); } if (Info is IMethodInfo) { this.ProcessSections(((IMethodInfo)Info).Statements); } else if (Info is IPropInfo) { IPropInfo info4 = (ICsPropInfo)Info; if (info4.PropertyGet != null) { this.ProcessSection(info4.PropertyGet); } if (info4.PropertySet != null) { this.ProcessSection(info4.PropertySet); } } else if (Info is IEventInfo) { IEventInfo info5 = (ICsEventInfo)Info; if (info5.EventAdd != null) { this.ProcessSection(info5.EventAdd); } if (info5.EventRemove != null) { this.ProcessSection(info5.EventRemove); } } else if (Info is IAccessorInfo) { this.ProcessSections(((IAccessorInfo)Info).Statements); } }
protected void ParseEvent(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { if (base.Token != 0) { this.NextValidToken(); } else { string text2; ICsEventInfo info1 = (ICsEventInfo)Info; string text1 = base.TokenString; if ((text2 = text1) != null) { text2 = string.IsInterned(text2); if (text2 != "add") { if (text2 == "remove") { info1.EventRemove = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.EventRemove, Level, null, this.parseAccessorProc); return; } } else { info1.EventAdd = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.EventAdd, Level, null, this.parseAccessorProc); return; } } this.NextValidToken(); } }
private void ParseLocalVars(string InfoType, ISyntaxInfo Info) { string text1 = InfoType; string text2 = InfoType; Point point1 = Point.Empty; int num1 = base.LineIndex; while (!base.Eof && (num1 == base.LineIndex)) { if (text1 == "dim") { base.NextValidToken(out text1); } bool flag1 = base.Token == 0; if (flag1) { point1 = new Point(this.tokenPos, base.LineIndex); flag1 = this.GetSimpleType(out text2); } if (!flag1) { return; } if (Info is IHasLocalVars) { LocalVarInfo info1 = new LocalVarInfo(text1, text2, point1); ((IHasLocalVars)Info).LocalVars.Add(info1); } this.SkipToSymbol(","); text1 = base.TokenString.ToLower(); } }
protected void ParseDelegate(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { string text1 = string.Empty; string text2 = string.Empty; Point point1 = new Point(this.tokenPos, base.LineIndex); if (base.IsSymbolToken("(")) { string text4; while (this.GetParamNameAndType(ref text1, ref text2, ref point1, out text4)) { ((IHasParams)Info).Params.Add(new ParamInfo(text1, text2, point1, text4)); if (base.TokenString == ")") { break; } text1 = string.Empty; text2 = string.Empty; } } if (this.GetSimpleType(out text2)) { ((ISyntaxTypeInfo)Info).DataType = text2; } }
protected bool IsInterface(ISyntaxInfo Info) { if (Info is IInterfaceInfo) { return(!(Info is IClassInfo)); } return(false); }
protected override void ProcessSection(ISyntaxInfo Info) { base.ProcessSection(Info); if (Info is ICsNamespaceInfo) { this.ProcessSection(((ICsNamespaceInfo)Info).Uses); } }
public override ISyntaxInfo FindByName(string Name, bool CaseSensitive) { ISyntaxInfo info1 = this.localVars.FindByName(Name, CaseSensitive); if (info1 != null) { return(info1); } return(base.FindByName(Name, CaseSensitive)); }
public override ISyntaxInfo FindByName(string Name, bool CaseSensitive) { ISyntaxInfo info1 = this.methodParams.FindByName(Name, CaseSensitive); if (info1 == null) { info1 = base.FindByName(Name, CaseSensitive); } return(info1); }
private void ParseLocalVars(string InfoType, ISyntaxInfo Info, Point Position) { string text1 = string.Empty; string text2 = InfoType; if ((this.GetTypeAndName(ref text1, ref text2) == CsParserType.Field) && (Info is IHasLocalVars)) { LocalVarInfo info1 = new LocalVarInfo(text1, text2, Position); ((IHasLocalVars)Info).LocalVars.Add(info1); } }
protected void ParseBlock(ISyntaxInfos Infos, ISyntaxInfo Info, int Level, ParseProc PreProcessProc, ParseProc ProcessProc) { ISyntaxInfo info1 = this.currentBlock; this.currentBlock = Info; if (PreProcessProc != null) { PreProcessProc(Info, Infos, Level + 1); } if (ProcessProc != null) { Point point1 = new Point(base.PrevPos, base.PrevLine); Point point2 = new Point(this.currentPos, base.LineIndex); bool flag1 = false; if (this.BeforeParseBlock(ref point2)) { point1 = new Point(base.PrevPos, base.PrevLine); flag1 = true; int num1 = 0; while (!base.Eof && !this.IsBlockEnd(ref num1)) { ProcessProc(Info, Infos, Level + 1); } this.AfterParseBlock(); this.NextValidToken(); } if (Info != null) { if (Info is IRangeInfo) { IRangeInfo info2 = (IRangeInfo)Info; info2.DeclarationSize = new Size(point2.X - info2.Position.X, point2.Y - info2.Position.Y); info2.StartPoint = point1; info2.EndPoint = new Point(base.PrevPos, base.PrevLine); info2.HasBlock = flag1; } else { Info.DeclarationSize = new Size(point1.X - Info.Position.X, point1.Y - Info.Position.Y); } } } if ((Infos != null) && (Info != null)) { Infos.Add(Info); } this.currentBlock = info1; }
protected void ParseRegion(ISyntaxInfo Info, ISyntaxInfos Infos, int Level, SourceParser.ParseProc Proc) { string text1 = base.Strings[base.LineIndex].Substring(this.currentPos); RegionInfo info1 = new RegionInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); base.SkipToNextLine(); if (Info is IRangeInfo) { ((IRangeInfo)Info).Regions.Add(info1); } while (!base.Eof && !this.IsRegionEnd()) { Proc(Info, Infos, Level); } info1.EndPoint = this.ValidatePosition((this.source != null) ? this.source.Length : 0, base.LineIndex); base.SkipToNextLine(); }
protected void ParseProperty(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { int num1 = 1; IPropInfo info1 = (IPropInfo)Info; string text1 = string.Empty; while (!base.Eof && !this.IsBlockEnd(ref num1)) { string text2; text1 = base.TokenString.ToLower(); if (base.Token != 2) { goto Label_00DA; } if ((text2 = text1) == null) { goto Label_00D1; } text2 = string.IsInterned(text2); if (text2 != "get") { if (text2 == "set") { goto Label_0095; } goto Label_00D1; } info1.PropertyGet = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.PropertyGet, Level, null, this.parseAccessorProc); continue; Label_0095: info1.PropertySet = new AccessorInfo(text1, new Point(this.tokenPos, base.LineIndex), Level); this.NextValidToken(); base.ParseBlock(null, info1.PropertySet, Level, null, this.parseAccessorProc); continue; Label_00D1: this.NextValidToken(); continue; Label_00DA: this.NextValidToken(); } }
private void AddCodeMembers(ISyntaxInfos Elements, IListMembers Provider) { SortedList list1 = new SortedList(new CaseInsensitiveComparer()); foreach (ISyntaxInfo info1 in Elements) { if (list1.IndexOfKey(info1.Name) < 0) { list1.Add(info1.Name, info1); } } foreach (DictionaryEntry entry1 in list1) { ISyntaxInfo info2 = (ISyntaxInfo)entry1.Value; IListMember member1 = Provider.AddMember(); member1.ImageIndex = base.UnitInfo.GetImageIndex(info2); member1.Name = info2.Name; member1.Description = info2.Description; } }
public override ISyntaxInfo FindByName(string Name, Point Position) { int num1 = Name.LastIndexOf("."); object obj1 = null; if (num1 > 0) { obj1 = this.GetObjectClass(Name.Substring(0, num1), Position); Name = Name.Substring(num1 + 1); } else { obj1 = this.GetCurrentClass(Position); } if (obj1 is IInterfaceInfo) { foreach (IMethodInfo info1 in ((IInterfaceInfo)obj1).Methods) { if ((Position.Y <= info1.StartPoint.Y) && ((Position.Y != info1.StartPoint.Y) || (Position.X <= info1.StartPoint.X))) { continue; } if ((Position.Y < info1.EndPoint.Y) || ((Position.Y == info1.EndPoint.Y) && (Position.X < info1.EndPoint.X))) { ISyntaxInfo info2 = info1.FindByName(Name, this.CaseSensitive); if (info2 != null) { return(info2); } break; } } } object obj2 = this.GetInfoByName(obj1, Name, Position); if (!(obj2 is ISyntaxInfo)) { return(null); } return((ISyntaxInfo)obj2); }
public override int GetImageIndex(ISyntaxInfo Info) { int num1 = Info.ImageIndex; if (Info is ICsScope) { CsScope scope1 = ((ICsScope)Info).Scope; if ((scope1 & CsScope.Private) != CsScope.None) { return(num1 + UnitInfo.ImageDelta); } if ((scope1 & CsScope.Protected) != CsScope.None) { return(num1 + (2 * UnitInfo.ImageDelta)); } if ((scope1 & CsScope.Public) != CsScope.None) { num1 += (3 * UnitInfo.ImageDelta); } } return(num1); }
protected void ParseDelegate(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { this.ParseParams((IDelegateInfo)Info); this.NextValidToken(); }
public int Add(ISyntaxInfo value) { return(base.Add(value)); }
public virtual int GetImageIndex(ISyntaxInfo Info) { return(Info.ImageIndex); }
protected virtual void ProcessDeclaration(CsScope Scope, CsModifier Modifiers, string InfoType, ISyntaxInfo Info, Point Position, Point AttrPt, string Attributes, int Level) { string text3; string text1 = string.Empty; string text2 = string.Empty; if ((text3 = InfoType) != null) { text3 = string.IsInterned(text3); if (text3 != "using") { char[] chArray1; if (text3 == "namespace") { if (this.GetName(ref text1, ".")) { base.ParseBlock((Info is ICsUnitInfo) ? ((ICsUnitInfo)Info).Namespaces : null, new CsNamespaceInfo(text1, Position, Level), Level, null, this.parseBlockProc); } return; } if (text3 == "interface") { if (this.GetNameAndType(out text1, out text2)) { chArray1 = new char[1] { ',' }; base.ParseBlock((Info is IClassInfo) ? ((IClassInfo)Info).Interfaces : null, new CsInterfaceInfo(text1, text2.Split(chArray1), Position, Level, Scope, AttrPt, Attributes), Level, null, this.parseBlockProc); } return; } if (text3 == "class") { if (this.GetNameAndType(out text1, out text2)) { chArray1 = new char[1] { ',' }; base.ParseBlock((Info is IClassInfo) ? ((IClassInfo)Info).Classes : null, new CsClassInfo(text1, text2.Split(chArray1), Position, Level, Scope, Modifiers, AttrPt, Attributes), Level, null, this.parseBlockProc); } return; } if (text3 == "struct") { if (this.GetNameAndType(out text1, out text2)) { chArray1 = new char[1] { ',' }; base.ParseBlock((Info is IClassInfo) ? ((IClassInfo)Info).Structures : null, new CsStructInfo(text1, text2.Split(chArray1), Position, Level, Scope, Modifiers, AttrPt, Attributes), Level, null, this.parseBlockProc); } return; } if (text3 == "delegate") { if (this.GetTypeAndName(ref text1, ref text2) == CsParserType.Method) { base.ParseBlock((Info is IClassInfo) ? ((IClassInfo)Info).Delegates : null, new CsDelegateInfo(text1, text2, Position, Scope, AttrPt, Attributes), Level, this.parseDelegateProc, null); } return; } if (text3 == "enum") { if (this.GetNameAndType(out text1, out text2)) { base.ParseBlock((Info is IClassInfo) ? ((IClassInfo)Info).Enums : null, new CsEnumInfo(text1, text2, Position, Level, Scope, Modifiers, AttrPt, Attributes), Level, null, this.parseEnumProc); } return; } if (text3 == "event") { CsParserType type1 = this.GetTypeAndName(ref text1, ref text2); ICsEventInfo info1 = new CsEventInfo(text1, text2, Position, Level, Scope, Modifiers, AttrPt, Attributes); if (type1 == CsParserType.Property) { base.ParseBlock((Info is IInterfaceInfo) ? ((IInterfaceInfo)Info).Events : null, info1, Level, null, this.parseEventProc); if (base.IsInterface(Info)) { if (info1.EventAdd != null) { info1.EventAdd.Visible = false; } if (info1.EventRemove == null) { return; } info1.EventRemove.Visible = false; } return; } if ((type1 == CsParserType.Field) && (Info is IInterfaceInfo)) { ((InterfaceInfo)Info).Events.Add(info1); } return; } } else { this.ProcessUsing(Info, Position, Level); return; } } this.NextValidToken(); }
protected void ParseAccessor(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { this.ParseStatements(Info, ((IAccessorInfo)Info).Statements, Level); }
protected void ParseBlock(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { ISyntaxInfo info1 = this.currentBlock; this.currentBlock = Info; Point point1 = new Point(-1, -1); string text1 = string.Empty; if (base.TokenString == "[") { point1 = new Point(this.tokenPos, base.LineIndex); while (base.TokenString == "[") { base.SkipBrackets("]", ref text1); } } Point point2 = new Point(this.tokenPos, base.LineIndex); string text2 = base.TokenString; if (base.Token == 8) { if (text2 == "#region") { this.ParseRegion(Info, Infos, Level, this.parseBlockProc); } else { this.NextValidToken(); } } else if (base.Token != 2) { if (base.Token == 0) { this.ParseDeclaration(CsScope.None, CsModifier.None, text2, Info, point2, point1, text1, Level); } else { this.NextValidToken(); this.currentBlock = info1; } } else { switch (((SyntaxToken)base.GetReswordToken(text2))) { case SyntaxToken.DataType: case SyntaxToken.Declaration: { this.ParseDeclaration(CsScope.None, CsModifier.None, text2, Info, point2, point1, text1, Level); return; } case SyntaxToken.Scope: case SyntaxToken.Modifier: { CsScope scope1 = CsScope.None; CsModifier modifier1 = CsModifier.None; this.GetScope(out scope1, out modifier1); if (base.IsReswordOrIdentifier(base.Token)) { this.ParseDeclaration(scope1, modifier1, base.TokenString, Info, point2, point1, text1, Level); } return; } } this.NextValidToken(); } }
private void ParseDeclaration(CsScope Scope, CsModifier Modifiers, string InfoType, ISyntaxInfo Info, Point Position, Point AttrPt, string Attributes, int Level) { if (base.GetReswordToken(InfoType) == 11) { this.ProcessDeclaration(Scope, Modifiers, InfoType, Info, Position, AttrPt, Attributes, Level); } else { string text1 = string.Empty; string text2 = InfoType; string text3 = string.Empty; switch (this.GetTypeAndName(ref text1, ref text2)) { case CsParserType.Field: { CsFieldInfo info1 = new CsFieldInfo(text1, text2, Position, Scope, AttrPt, Attributes); if (Info is IClassInfo) { ((IClassInfo)Info).Fields.Add(info1); } return; } case CsParserType.Method: { if (!base.IsInterface(Info)) { base.ParseBlock((Info is IInterfaceInfo) ? ((IInterfaceInfo)Info).Methods : null, new CsMethodInfo(text1, text2, Position, Level, Scope, Modifiers, AttrPt, Attributes), Level, this.parseDelegateProc, this.parseMethodProc); return; } base.ParseBlock(((IInterfaceInfo)Info).Methods, new CsDelegateInfo(text1, text2, Position, Scope, AttrPt, Attributes), Level, this.parseDelegateProc, null); return; } case CsParserType.Property: { ICsPropInfo info2 = new CsPropInfo(text1, text2, Position, Level, Scope, Modifiers, AttrPt, Attributes); base.ParseBlock((Info is IInterfaceInfo) ? ((IInterfaceInfo)Info).Properties : null, info2, Level, null, this.parsePropertyProc); if (base.IsInterface(Info)) { if (info2.PropertyGet != null) { info2.PropertyGet.Visible = false; } if (info2.PropertySet != null) { info2.PropertySet.Visible = false; } } return; } } } }
protected void ParseMethod(ISyntaxInfo Info, ISyntaxInfos Infos, int Level) { this.ParseStatements(Info, ((IMethodInfo)Info).Statements, Level); }