private bool hasIntegrity(string selection)
        {
            Stack <PairedChar> pairs = new Stack <PairedChar>();

            foreach (char ch in selection)
            {
                if (pairs.Count > 0 && pairs.Peek().IsQuote&& !pairs.Peek().IsClosedBy(ch))
                {
                    continue;
                }

                if (pairs.Count > 0 && pairs.Peek().IsClosedBy(ch))
                {
                    pairs.Pop();
                }
                else if (PairedChar.IsPairOpening(ch))
                {
                    pairs.Push(PairedChar.from(ch));
                }
                else if (PairedChar.IsPairClosing(ch))
                {
                    return(false);
                }
            }
            return(pairs.Count == 0);
        }
        public IEnumerable <int> DownFrom(int p)
        {
            Stack <PairedChar> pairs = new Stack <PairedChar>();

            for (int c = p; c < snapshot.Length; c++)
            {
                char ch = snapshot[c];

                if (pairs.Count > 0 && pairs.Peek().IsQuote&& (!pairs.Peek().IsClosedBy(ch) || (c > 0 && snapshot[c - 1] == '\\')))
                {
                    continue;
                }

                if (c > 0 && ch == '/' && snapshot[c - 1] == '/')
                {
                    c = snapshot.GetLineFromPosition(c - 1).End + 1;
                    continue;
                }
                if (ch == '}' && (pairs.Count == 2) && pairs.Peek().IsClosedBy(ch))
                {
                    pairs.Pop();
                    yield return(c);
                }
                else if (ch == '}' && (pairs.Count == 1) && pairs.Peek().IsClosedBy(ch))
                {
                    pairs.Pop();
                    yield return(c);

                    yield break;
                }
                else if (pairs.Count == 1 && (ch == ';'))
                {
                    yield return(c);
                }
                else if (pairs.Count > 0 && pairs.Peek().IsClosedBy(ch))
                {
                    pairs.Pop();
                }
                else if (PairedChar.IsPairOpening(ch))
                {
                    pairs.Push(PairedChar.from(ch));
                }
            }
            yield break;
        }
        private bool hasConstantIntegrity(string selection)
        {
            if (ConstantKeyWords.Contains(selection.Trim()))
            {
                return(true);
            }
            Stack <PairedChar> pairs   = new Stack <PairedChar>();
            char lastNonWhitespaceChar = '\0';

            foreach (char ch in selection)
            {
                if (pairs.Count > 0 && pairs.Peek().IsQuote&& !pairs.Peek().IsClosedBy(ch))
                {
                    continue;
                }

                if (pairs.Count > 0 && pairs.Peek().IsClosedBy(ch))
                {
                    pairs.Pop();
                }
                else if (PairedChar.IsPairOpening(ch))
                {
                    pairs.Push(PairedChar.from(ch));
                }
                else if (PairedChar.IsPairClosing(ch))
                {
                    return(false);
                }
                else if ((ch == '_') || (Char.IsLetter(ch) && !Char.IsDigit(lastNonWhitespaceChar)))
                {
                    return(false);
                }
                if (!Char.IsWhiteSpace(ch))
                {
                    lastNonWhitespaceChar = ch;
                }
            }
            return(pairs.Count == 0);
        }