CSScriptCompilers.CCSharpParser.CSharpParser.NoteCommentsAndStrings C# (CSharp) Метод

NoteCommentsAndStrings() публичный Метод

public NoteCommentsAndStrings ( ) : void
Результат void
            void NoteCommentsAndStrings()
            {
                ArrayList quotationChars = new ArrayList();
                int startPos = -1;
                int startSLC = -1; //single line comment
                int startMLC = -1; //multiple line comment
                int searchOffset = 0;
                string endToken = "";
                string startToken = "";
                int endPos = -1;
                int lastEndPos = -1;
                do
                {
                    startSLC = code.IndexOf("//", searchOffset);
                    startMLC = code.IndexOf("/*", searchOffset);

                    if (startSLC == Math.Min(startSLC != -1 ? startSLC : Int16.MaxValue,
                        startMLC != -1 ? startMLC : Int16.MaxValue))
                    {
                        startPos = startSLC;
                        startToken = "//";
                        endToken = "\n";
                    }
                    else
                    {
                        startPos = startMLC;
                        startToken = "/*";
                        endToken = "*/";
                    }

                    if (startPos != -1)
                        endPos = code.IndexOf(endToken, startPos + startToken.Length);

                    if (startPos != -1 && endPos != -1)
                    {
                        int startCode = commentRegions.Count == 0 ? 0 : ((int[])commentRegions[commentRegions.Count - 1])[1] + 1;

                        int[] quotationIndexes = AllRawIndexOf("\"", startCode, startPos);
                        if ((quotationIndexes.Length % 2) != 0)
                        {
                            searchOffset = startPos + startToken.Length;
                            continue;
                        }

                        commentRegions.Add(new int[2] { startPos, endPos });
                        quotationChars.AddRange(quotationIndexes);

                        searchOffset = endPos + endToken.Length;
                    }
                }
                while (startPos != -1 && endPos != -1);

                if (lastEndPos != 0 && searchOffset < code.Length)
                {
                    quotationChars.AddRange(AllRawIndexOf("\"", searchOffset, code.Length));
                }

                for (int i = 0; i < quotationChars.Count; i++)
                {
                    if (i + 1 < stringRegions.Count)
                        stringRegions.Add(new int[] { (int)quotationChars[i], (int)quotationChars[i + 1] });
                    else
                        stringRegions.Add(new int[] { (int)quotationChars[i], -1 });
                    i++;
                }
            }
            int[] AllRawIndexOf(string pattern, int startIndex, int endIndex) //all raw matches