Exemplo n.º 1
0
        private QueryToken ReadToken()
        {
            char           ch    = this.SkipSpaces(this.curChar);
            QueryTokenType type  = QueryTokenType.Error;
            int            start = this.pos;

            switch (ch)
            {
            case '\0':
                type = QueryTokenType.None;
                break;

            case '\"':
            case '\'':
                type = this.SkipString(ch);
                if (type != QueryTokenType.Error)
                {
                    // Don't include quotes in the string token
                    return(new QueryToken(type, start + 1, this.pos - start - 2));
                }
                break;

            case '-':
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                type = this.SkipNumber(ch);
                break;

            default:
                if (QueryTokenizer.IsIdentifierStart(ch))
                {
                    type = this.SkipIdentifier();
                }
                break;
            }

            return(new QueryToken(type, start, this.pos - start));
        }
Exemplo n.º 2
0
 private static bool IsIdentifier(char ch)
 {
     return(ch == '-' || QueryTokenizer.IsIdentifierStart(ch) || char.IsDigit(ch));
 }