示例#1
0
        public VBALine GetLineContaining(string S)
        {
            int i = Script.IndexOf(S);

            if (i == -1)
            {
                return(null);
            }

            VBALine SL = new VBALine();

            //Look backwards to see if there's a CR/LF nearby...
            int st = Script.LastIndexOf('\r', i);
            int en = Script.IndexOf('\r', i);

            if (en == -1)
            {
                en = S.Length;
            }

            SL.StartPos = st;
            SL.EndPos   = en;

            //Construct a list of tokens...
            string        Base   = Script.Substring(st, en - st);
            List <string> Tokens = SplitQuoted(Base);

            SL.Tokens = Tokens.ToArray();
            return(SL);
        }
示例#2
0
        public VBALine[] GetLinesContaining(string S)
        {
            List <VBALine> Lines = new List <VBALine>();

            int prg = 0;

            int i = Script.IndexOf(S, prg);

            while (i != -1)
            {
                VBALine SL = new VBALine();

                //Look backwards to see if there's a CR/LF nearby...
                int st = Script.LastIndexOf('\r', i);
                int en = Script.IndexOf('\r', i);
                if (en == -1)
                {
                    en = S.Length;
                }

                SL.StartPos = st;
                SL.EndPos   = en;

                //Construct a list of tokens...
                string        Base   = Script.Substring(st, en - st);
                List <string> Tokens = SplitQuoted(Base);
                SL.Tokens = Tokens.ToArray();

                for (int x = 0; x < SL.Tokens.Length; x++)
                {
                    if (SL.Tokens[x].IndexOf(S) != -1)
                    {
                        SL.TokenID = x;
                        break;
                    }
                }

                prg = en + 1;
                i   = Script.IndexOf(S, prg);
                Lines.Add(SL);
            }

            return(Lines.ToArray());
        }