Esempio n. 1
0
        protected override void ProcessDeclaration(CsScope Scope, CsModifier Modifiers, string InfoType, ISyntaxInfo Info, Point Position, Point AttrPt, string Attributes, int Level)
        {
            string text2;
            string text1 = string.Empty;

            if ((text2 = InfoType) != null)
            {
                text2 = string.IsInterned(text2);
                if (text2 != "import")
                {
                    if (text2 == "package")
                    {
                        if (base.GetName(ref text1, "."))
                        {
                            base.ParseBlock((Info is ICsUnitInfo) ? ((ICsUnitInfo)Info).Namespaces : null, new CsNamespaceInfo(text1, Position, Level), Level, null, this.parseBlockProc);
                        }
                        return;
                    }
                }
                else
                {
                    this.ProcessUsing(Info, Position, Level);
                    return;
                }
            }
            base.ProcessDeclaration(Scope, Modifiers, InfoType, Info, Position, AttrPt, Attributes, Level);
        }
Esempio n. 2
0
        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;
                }
                }
            }
        }
Esempio n. 3
0
 protected void GetScope(out CsScope Scope, out CsModifier Modifiers)
 {
     Scope     = CsScope.None;
     Modifiers = CsModifier.None;
     while (base.Token == 2)
     {
         string      text1  = base.TokenString;
         SyntaxToken token1 = (SyntaxToken)base.GetReswordToken(text1);
         if (token1 == SyntaxToken.Scope)
         {
             Scope |= ((CsScope)Enum.Parse(typeof(CsScope), text1, true));
         }
         else
         {
             if (token1 != SyntaxToken.Modifier)
             {
                 return;
             }
             Modifiers |= ((CsModifier)Enum.Parse(typeof(CsModifier), text1, true));
         }
         this.NextValidToken();
     }
 }
Esempio n. 4
0
 public CsMethodInfo(string Name, string DataType, Point Position, int Level, CsScope Scope, CsModifier Modifiers, Point AttrPt, string Attributes) : base(Name, DataType, Position, Level, AttrPt, Attributes)
 {
     this.scope     = Scope;
     this.modifiers = Modifiers;
 }
Esempio n. 5
0
 public CsEnumInfo(string Name, string DataType, Point Position, int Level, CsScope Scope, CsModifier Modifiers) : base(Name, DataType, Position, Level)
 {
     this.scope     = Scope;
     this.modifiers = Modifiers;
 }
Esempio n. 6
0
 public CsClassInfo(string Name, string[] BaseTypes, Point Position, int Level, CsScope Scope, CsModifier Modifiers, Point AttrPt, string Attributes) : base(Name, BaseTypes, Position, Level, AttrPt, Attributes)
 {
     this.scope     = Scope;
     this.modifiers = Modifiers;
 }
Esempio n. 7
0
        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();
            }
        }
Esempio n. 8
0
        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();
        }
Esempio n. 9
0
 public CsStructInfo(string Name, string[] BaseTypes, Point Position, int Level, CsScope Scope, CsModifier Modifiers) : base(Name, BaseTypes, Position, Level)
 {
     this.scope     = Scope;
     this.modifiers = Modifiers;
 }