Sketched rough parser code construction including some SQL AST classes.
This commit is contained in:
parent
f3898599fd
commit
5b20f900fc
15 changed files with 459 additions and 4 deletions
27
core/SqlAstSelectList.cpp
Normal file
27
core/SqlAstSelectList.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "SqlAstSelectList.h"
|
||||
#include "SqlAstSelectListEntry.h"
|
||||
#include "SqlParser.h"
|
||||
|
||||
using namespace SqlAst;
|
||||
|
||||
std::shared_ptr<SqlAst::SelectList> parseSelectList(SqlParser &parser)
|
||||
{
|
||||
// parse select element
|
||||
// whats next?
|
||||
// comma -> parse an element
|
||||
// something else return and let caller figure it out
|
||||
auto ast_select_list = std::make_shared<SelectList>();
|
||||
while (1) {
|
||||
auto ast_select_elem = parseSelectListEntry(parser);
|
||||
if (ast_select_elem) {
|
||||
ast_select_list->add(ast_select_elem);
|
||||
}
|
||||
else {
|
||||
// todo error
|
||||
}
|
||||
if (!parser.expectToken(BasicTokenType::Comma)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ast_select_list;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue