Beispiel #1
0
        /// <summary>
        /// 分析代码
        /// </summary>
        public void ParseCode()
        {
            try
            {
                UCodeCut  cut;
                UCodeLine line = new UCodeLine();

                mCodeLines.Clear();
                mParser.Reset();

                GC.Collect();

                while (true)
                {
                    cut = mParser.GetNextCut();

                    if (cut.CutType == UCutType.End)
                    {
                        break;
                    }

                    line.AddCut(cut);

                    if (cut.CutType == UCutType.NewLine)
                    {
                        mCodeLines.Add(line);
                        line = new UCodeLine();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 分析指定行的代码
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public UCodeLine ParseLine(int index)
        {
            try
            {
                UCodeLine line = new UCodeLine();
                UCodeCut  cut;

                Reset();

                RowIndex    = index;
                OldRowIndex = index;

                while (true)
                {
                    cut = GetNextCut();

                    if (cut.CutType == UCutType.End)
                    {
                        break;
                    }

                    if (RowIndex != index)
                    {
                        break;
                    }

                    line.AddCut(cut);
                }

                return(line);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }