public TSQLSelectStatement Parse(ITSQLTokenizer tokenizer) { TSQLSelectStatement select = new TSQLSelectStatement(); TSQLSelectClause selectClause = new TSQLSelectClauseParser().Parse(tokenizer); select.Select = selectClause; select.Tokens.AddRange(selectClause.Tokens); if (tokenizer.Current.IsKeyword(TSQLKeywords.INTO)) { TSQLIntoClause intoClause = new TSQLIntoClauseParser().Parse(tokenizer); select.Into = intoClause; select.Tokens.AddRange(intoClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.FROM)) { TSQLFromClause fromClause = new TSQLFromClauseParser().Parse(tokenizer); select.From = fromClause; select.Tokens.AddRange(fromClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.WHERE)) { TSQLWhereClause whereClause = new TSQLWhereClauseParser().Parse(tokenizer); select.Where = whereClause; select.Tokens.AddRange(whereClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.GROUP)) { TSQLGroupByClause groupByClause = new TSQLGroupByClauseParser().Parse(tokenizer); select.GroupBy = groupByClause; select.Tokens.AddRange(groupByClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.HAVING)) { TSQLHavingClause havingClause = new TSQLHavingClauseParser().Parse(tokenizer); select.Having = havingClause; select.Tokens.AddRange(havingClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.ORDER)) { TSQLOrderByClause orderByClause = new TSQLOrderByClauseParser().Parse(tokenizer); select.OrderBy = orderByClause; select.Tokens.AddRange(orderByClause.Tokens); } if (tokenizer.Current.IsKeyword(TSQLKeywords.OPTION)) { TSQLOptionClause optionClause = new TSQLOptionClauseParser().Parse(tokenizer); select.Option = optionClause; select.Tokens.AddRange(optionClause.Tokens); } if ( tokenizer.Current != null && tokenizer.Current.Type == TSQLTokenType.Keyword) { tokenizer.Putback(); } return(select); }