예제 #1
0
        public static TextSpan CreateSpanForAllLines(this IVsTextBuffer buffer)
        {
            TextSpan span = new TextSpan();

            buffer.GetLastLineIndex(out span.iEndLine, out span.iEndIndex);
            return(span);
        }
예제 #2
0
        public void FullScan()
        {
            Debug.WriteLine("FullScan");
            m_nssource.FullScanTime = System.Environment.TickCount;
            m_tkm.Clear();
            //m_fullscan=2;
            m_indent = 0;
            int lines_tot;
            int col_last;

            m_buffer.GetLastLineIndex(out lines_tot, out col_last);
            string       line_text;
            int          line_end_idx;
            IVsTextLines tlines = m_buffer as IVsTextLines;

            for (int line_loop = 0; line_loop < lines_tot; line_loop++)
            {
                tlines.GetLengthOfLine(line_loop, out line_end_idx);
                tlines.GetLineText(line_loop, 0, line_loop, line_end_idx, out line_text);
                //FullScanLine(line_text, line_loop);
                line_text             = line_text == null ? "": line_text;
                m_token_type          = TkType.None;
                m_tokenpos_start      = 0;
                m_tokenpos_start_next = 0;
                //Debug.WriteLine("FullScanLine" + linenum.ToString());
                while (m_token_type != TkType.EOL)
                {
                    TokenNextGet2(line_text);
                    m_tkm.Add(line_loop, m_tokenpos_start, m_tokenpos_start_next - 1, m_token_type, m_indent);
                }
            }

            for (uint tkloop = 0; tkloop < m_tkm.tk_tot; tkloop++)
            {
                if (m_tkm[tkloop] != null && m_tkm[tkloop].type == TkType.Other)
                {
                    //uint tkspot=tkloop;
                    for (uint tkspot = tkloop + 1; tkspot < m_tkm.tk_tot; tkspot++)
                    {
                        if (m_tkm[tkspot] == null)
                        {
                            break;
                        }
                        if (m_tkm[tkspot].type == TkType.ParenLeft)
                        {
                            m_tkm[tkloop].type = TkType.Procedure;
                            break;
                        }
                        if (m_tkm[tkspot].type == TkType.Space)
                        {
                            continue;
                        }
                        if (m_tkm[tkspot].type == TkType.Star)
                        {
                            continue;
                        }
                        break;
                    }
                }
            }
        }