Exemplo n.º 1
0
        /// <returns>
        ///     type of
        ///     <see cref="Tup.Cobar4Net.Parser.Ast.Expression.Primary.Wildcard" />
        ///     is possible. never null
        /// </returns>
        /// <exception cref="System.SqlSyntaxErrorException">
        ///     if identifier dose not matched
        /// </exception>
        protected internal virtual Identifier Identifier()
        {
            if (lexer.Token() == MySqlToken.None)
            {
                lexer.NextToken();
            }
            Identifier id;

            switch (lexer.Token())
            {
            case MySqlToken.OpAsterisk:
            {
                lexer.NextToken();
                var wc = new Wildcard(null);
                wc.SetCacheEvalRst(cacheEvalRst);
                return(wc);
            }

            case MySqlToken.Identifier:
            {
                id = new Identifier(null, lexer.GetStringValue(), lexer.GetStringValueUppercase());
                id.SetCacheEvalRst(cacheEvalRst);
                lexer.NextToken();
                break;
            }

            default:
            {
                throw Err("expect id or * after '.'");
            }
            }
            for (; lexer.Token() == MySqlToken.PuncDot;)
            {
                switch (lexer.NextToken())
                {
                case MySqlToken.OpAsterisk:
                {
                    lexer.NextToken();
                    var wc_1 = new Wildcard(id);
                    wc_1.SetCacheEvalRst(cacheEvalRst);
                    return(wc_1);
                }

                case MySqlToken.Identifier:
                {
                    id = new Identifier(id, lexer.GetStringValue(), lexer.GetStringValueUppercase());
                    id.SetCacheEvalRst(cacheEvalRst);
                    lexer.NextToken();
                    break;
                }

                default:
                {
                    throw Err("expect id or * after '.'");
                }
                }
            }
            return(id);
        }