Skip to content
Snippets Groups Projects
Commit 44182754 authored by Thomas Blum's avatar Thomas Blum
Browse files

Make tardis parser type variable

parent 2ac3cb28
No related branches found
No related tags found
1 merge request!8Feature add copy statement
Pipeline #39210 failed
......@@ -39,9 +39,11 @@ namespace tardisParser {
const std::string Copy = "copy";
const std::string With = "with";
const std::string Format = "format";
const std::string CSV = "csv";
const std::string TBL = "tbl";
static std::set<std::string> keywordset = {Version, Select, From, Where, And, Insert, Into, Values, Update, Set, Delete, Create,
Table, Not, Null, Branch, Copy, With, Format};
Table, Not, Null, Branch, Copy, With, Format, CSV, TBL};
}
// Define all control symbols
......
......@@ -79,7 +79,7 @@ namespace tardisParser {
}
break;
case State::CopyFrom:
if (token.hasType(Type::identifier)) {
if (token.hasType(Type::literal)) {
context.copyStmt->filePath = token.value;
context.state = State::CopyPath;
} else {
......@@ -101,8 +101,11 @@ namespace tardisParser {
}
break;
case State::CopyFormat:
if (token.hasType(Type::identifier)) {
context.copyStmt->format = token.value;
if (token.equalsKeyword(Keyword::CSV)) {
context.copyStmt->format = "csv";
context.state = State::CopyType;
} else if (token.equalsKeyword(Keyword::TBL)) {
context.copyStmt->format = "tbl";
context.state = State::CopyType;
} else {
throw syntactical_error("Expected format name, found '" + token.value + "'");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment