private SqlToken ReadWord()
        {
            var l     = _chars.GetLocation();
            var chars = new List <char>();

            while (true)
            {
                var c = _chars.GetNext();
                if (!char.IsLetterOrDigit(c) && c != '_')
                {
                    _chars.PutBack(c);
                    break;
                }

                chars.Add(c);
            }

            var s = new string(chars.ToArray());

            if (Facts.IsKeyword(s))
            {
                return(new SqlToken(s.ToUpperInvariant(), SqlTokenType.Keyword, l));
            }
            return(new SqlToken(s.ToLowerInvariant(), SqlTokenType.Identifier, l));
        }
Exemple #2
0
 public static SqlToken Word(string s, Location location)
 {
     if (Facts.IsKeyword(s))
     {
         return(new SqlToken(s.ToUpperInvariant(), SqlTokenType.Keyword, location));
     }
     return(new SqlToken(s, SqlTokenType.Identifier, location));
 }