Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
        private IStatementInfo ParseStatement(string Name, ISyntaxInfos Infos, int Level)
        {
            string         text1;
            IStatementInfo info1 = null;

            if ((text1 = Name) != null)
            {
                text1 = string.IsInterned(text1);
                if (text1 != "if")
                {
                    if (text1 == "select")
                    {
                        info1 = new VbCaseStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
                        this.ParseCaseStatement(info1, Infos, Level);
                        Infos.Add(info1);
                        return(info1);
                    }
                }
                else
                {
                    info1 = new VbIfStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
                    this.ParseIfElseStatement(info1, Infos, Level);
                    Infos.Add(info1);
                    return(info1);
                }
            }
            info1 = new VbStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
            base.SkipToNextLine();
            base.ParseBlock(Infos, info1, Level, null, this.parseStatementsProc);
            info1.EndPoint = new Point(base.PrevPos, base.PrevLine);
            return(info1);
        }
Beispiel #3
0
 private void ParseCaseStatement(IStatementInfo Info, ISyntaxInfos Infos, int Level)
 {
     if (this.SkipToSymbol(":"))
     {
         if (this.IsBlockStart())
         {
             base.ParseBlock(Infos, Info, Level, null, this.parseStatementsProc);
         }
         else
         {
             Info.DeclarationSize = new Size(this.currentPos - Info.Position.X, base.LineIndex - Info.Position.Y);
             Info.StartPoint      = new Point(base.PrevPos, base.PrevLine);
             int num1 = 1;
             while (!base.Eof && !this.IsBlockEnd(ref num1))
             {
                 if ((base.Token == 2) && ((base.TokenString == "case") || (base.TokenString == "default")))
                 {
                     break;
                 }
                 this.ParseStatements(Info, Infos, Level + 1);
             }
             Info.EndPoint = new Point(base.PrevPos, base.PrevLine);
             Infos.Add(Info);
         }
     }
 }
Beispiel #4
0
 protected override void ProcessSections(ISyntaxInfos Infos)
 {
     foreach (ISyntaxInfo info1 in Infos)
     {
         this.ProcessSection(info1);
     }
 }
Beispiel #5
0
 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();
     }
 }
Beispiel #6
0
        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();
            }
        }
Beispiel #7
0
        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;
            }
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
 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();
     }
 }
Beispiel #10
0
 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();
     }
 }
Beispiel #11
0
 private void ParseIfElseStatement(IStatementInfo Info, ISyntaxInfos Infos, int Level)
 {
     if ((base.Token == 2) && (base.TokenString == "else"))
     {
         this.ParseStatement(base.TokenString, Infos, Level);
         ((CsIfStatementInfo)Info).IfEndPoint = Info.EndPoint;
         Info.EndPoint = new Point(base.PrevPos, base.PrevLine);
     }
 }
Beispiel #12
0
        private IStatementInfo ParseStatement(string Name, ISyntaxInfos Infos, int Level)
        {
            string         text1;
            IStatementInfo info1 = null;

            if ((text1 = Name) != null)
            {
                text1 = string.IsInterned(text1);
                if (text1 != "if")
                {
                    if ((text1 == "case") || (text1 == "default"))
                    {
                        info1 = new CsStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
                        this.ParseCaseStatement(info1, Infos, Level);
                        return(info1);
                    }
                }
                else
                {
                    info1 = new CsIfStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
                    goto Label_0091;
                }
            }
            info1 = new CsStatementInfo(Name, new Point(this.tokenPos, base.LineIndex), Level);
Label_0091:
            this.NextValidToken();
            if (base.IsSymbolToken("("))
            {
                base.SkipBrackets(")");
            }
            if ((base.Token == 2) && (base.GetReswordToken(base.TokenString) == 2))
            {
                info1.StartPoint      = new Point(base.PrevPos, base.PrevLine);
                info1.DeclarationSize = new Size(this.tokenPos - info1.Position.X, base.LineIndex - info1.Position.Y);
                if ((Name == "else") && (base.TokenString == "if"))
                {
                    IStatementInfo info2 = this.ParseStatement(base.TokenString, Infos, Level);
                    ((CsIfStatementInfo)info2).ElseIfPoint = new Point(info1.Position.X + info1.DeclarationSize.Width, info1.Position.Y + info1.DeclarationSize.Height);
                }
                else
                {
                    this.ParseStatement(base.TokenString, Infos, Level + 1);
                }
                info1.EndPoint = new Point(base.PrevPos, base.PrevLine);
                Infos.Add(info1);
            }
            else
            {
                base.ParseBlock(Infos, info1, Level, null, this.parseStatementsProc);
            }
            if (info1 is CsIfStatementInfo)
            {
                this.ParseIfElseStatement(info1, Infos, Level);
            }
            return(info1);
        }
Beispiel #13
0
 protected virtual void ProcessSections(ISyntaxInfos Infos)
 {
     this.sections.BeginUpdate();
     try
     {
         foreach (ISyntaxInfo info1 in Infos)
         {
             this.ProcessSection(info1);
         }
     }
     finally
     {
         this.sections.EndUpdate();
     }
 }
Beispiel #14
0
        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;
        }
Beispiel #15
0
        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();
        }
Beispiel #16
0
        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();
            }
        }
Beispiel #17
0
        private void ParseIfElseStatement(IStatementInfo Info, ISyntaxInfos Infos, int Level)
        {
            int    num1  = 1;
            string text1 = string.Empty;

            base.SkipToNextLine();
            while (!base.Eof && !this.IsBlockEnd(ref num1))
            {
                if (base.Token == 2)
                {
                    string text2;
                    text1 = base.TokenString.ToLower();
                    if ((text2 = text1) != null)
                    {
                        text2 = string.IsInterned(text2);
                        if (text2 != "else")
                        {
                            if (text2 == "elseif")
                            {
                                goto Label_0070;
                            }
                        }
                        else
                        {
                            ((VbIfStatementInfo)Info).ElsePt = new Point(this.tokenPos, base.LineIndex);
                        }
                    }
                }
                goto Label_0097;
Label_0070:
                ((VbIfStatementInfo)Info).ElseIfPoints.Add(new Point(this.tokenPos, base.LineIndex));
Label_0097:
                this.ParseStatements(Info, Infos, Level + 1);
            }
            if (this.IsBlockEnd(base.TokenString))
            {
                this.NextValidToken();
            }
            this.NextValidToken();
            Info.HasBlock = true;
            Info.EndPoint = new Point(base.PrevPos, base.PrevLine);
            Infos.Add(Info);
        }
Beispiel #18
0
        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;
            }
        }
Beispiel #19
0
        private void ParseCaseStatement(IStatementInfo Info, ISyntaxInfos Infos, int Level)
        {
            int    num1  = 1;
            string text1 = string.Empty;

            base.SkipToNextLine();
            while (!base.Eof && !this.IsBlockEnd(ref num1))
            {
                if ((base.Token == 2) && (base.TokenString.ToLower() == "case"))
                {
                    ((VbCaseStatementInfo)Info).CasePoints.Add(new Point(this.tokenPos, base.LineIndex));
                }
                this.ParseStatements(Info, Infos, Level + 1);
            }
            if (this.IsBlockEnd(base.TokenString))
            {
                this.NextValidToken();
            }
            this.NextValidToken();
            Info.HasBlock = true;
            Info.EndPoint = new Point(base.PrevPos, base.PrevLine);
        }
Beispiel #20
0
        public override string GetParamText(ISyntaxInfos Params)
        {
            string text1 = string.Empty;

            foreach (IParamInfo info1 in Params)
            {
                string[] textArray1;
                if (text1 != string.Empty)
                {
                    textArray1 = new string[5] {
                        info1.Qualifier, " ", info1.Name, " As ", info1.DataType
                    };
                    text1 = text1 + "," + string.Concat(textArray1).Trim();
                    continue;
                }
                textArray1 = new string[5] {
                    info1.Qualifier, " ", info1.Name, " As ", info1.DataType
                };
                text1 = text1 + string.Concat(textArray1).Trim();
            }
            return("(" + text1 + ")");
        }
Beispiel #21
0
 protected void ParseAccessor(ISyntaxInfo Info, ISyntaxInfos Infos, int Level)
 {
     this.ParseStatements(Info, ((IAccessorInfo)Info).Statements, Level);
 }
Beispiel #22
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();
            }
        }
Beispiel #23
0
 protected void ParseDelegate(ISyntaxInfo Info, ISyntaxInfos Infos, int Level)
 {
     this.ParseParams((IDelegateInfo)Info);
     this.NextValidToken();
 }
Beispiel #24
0
 protected void ParseMethod(ISyntaxInfo Info, ISyntaxInfos Infos, int Level)
 {
     this.ParseStatements(Info, ((IMethodInfo)Info).Statements, Level);
 }