System.Data.ExpressionParser.ScanReserved C# (CSharp) Méthode

ScanReserved() private méthode

private ScanReserved ( ) : void
Résultat void
        private void ScanReserved()
        {
            char[] text = _text;

            if (IsAlpha(text[_pos]))
            {
                ScanName();

                Debug.Assert(_token == Tokens.Name, "Exprecing an identifier.");
                Debug.Assert(_pos > _start, "Exprecing an identifier.");

                string name = new string(text, _start, _pos - _start);
                Debug.Assert(name != null, "Make sure the arguments for Compare method are OK");


                CompareInfo comparer = CultureInfo.InvariantCulture.CompareInfo;
                // binary search reserved words
                int lo = 0;
                int hi = s_reservedwords.Length - 1;
                do
                {
                    int i = (lo + hi) / 2;
                    Debug.Assert(s_reservedwords[i]._word != null, "Make sure the arguments for Compare method are OK");
                    int c = comparer.Compare(s_reservedwords[i]._word, name, CompareOptions.IgnoreCase);

                    if (c == 0)
                    {
                        // we found the reserved word..
                        _token = s_reservedwords[i]._token;
                        _op = s_reservedwords[i]._op;
                        return;
                    }
                    if (c < 0)
                    {
                        lo = i + 1;
                    }
                    else
                    {
                        hi = i - 1;
                    }
                } while (lo <= hi);

                Debug.Assert(_token == Tokens.Name, "Exprecing an identifier.");
            }
        }