Renamed id and id_array to link and link_array
This commit is contained in:
parent
c7d7a01fa8
commit
6b1d3d7495
@ -70,13 +70,13 @@ pub const FileEngine = struct {
|
|||||||
float: f64,
|
float: f64,
|
||||||
str: []const u8,
|
str: []const u8,
|
||||||
bool_: bool,
|
bool_: bool,
|
||||||
id: UUID,
|
link: UUID,
|
||||||
datetime: DateTime,
|
datetime: DateTime,
|
||||||
int_array: std.ArrayList(i64),
|
int_array: std.ArrayList(i64),
|
||||||
str_array: std.ArrayList([]const u8),
|
str_array: std.ArrayList([]const u8),
|
||||||
float_array: std.ArrayList(f64),
|
float_array: std.ArrayList(f64),
|
||||||
bool_array: std.ArrayList(bool),
|
bool_array: std.ArrayList(bool),
|
||||||
id_array: std.ArrayList(UUID),
|
link_array: std.ArrayList(UUID),
|
||||||
datetime_array: std.ArrayList(DateTime),
|
datetime_array: std.ArrayList(DateTime),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ pub const FileEngine = struct {
|
|||||||
}
|
}
|
||||||
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
||||||
},
|
},
|
||||||
.int_array, .float_array, .bool_array, .id_array => {
|
.int_array, .float_array, .bool_array => {
|
||||||
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
||||||
token = data_toker.next();
|
token = data_toker.next();
|
||||||
while (token.tag != .r_bracket) : (token = data_toker.next()) {
|
while (token.tag != .r_bracket) : (token = data_toker.next()) {
|
||||||
@ -413,6 +413,10 @@ pub const FileEngine = struct {
|
|||||||
}
|
}
|
||||||
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.link => out_writer.writeAll("false") catch return FileEngineError.WriteError, // TODO: Get and send data
|
||||||
|
.link_array => out_writer.writeAll("false") catch return FileEngineError.WriteError, // TODO: Get and send data
|
||||||
|
|
||||||
else => out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError, //write the value as if
|
else => out_writer.writeAll(data_toker.getTokenSlice(token)) catch return FileEngineError.WriteError, //write the value as if
|
||||||
}
|
}
|
||||||
out_writer.writeAll(", ") catch return FileEngineError.WriteError;
|
out_writer.writeAll(", ") catch return FileEngineError.WriteError;
|
||||||
@ -517,7 +521,7 @@ pub const FileEngine = struct {
|
|||||||
.str => compare_value = ComparisonValue{ .str = condition.value },
|
.str => compare_value = ComparisonValue{ .str = condition.value },
|
||||||
.float => compare_value = ComparisonValue{ .float = s2t.parseFloat(condition.value) },
|
.float => compare_value = ComparisonValue{ .float = s2t.parseFloat(condition.value) },
|
||||||
.bool => compare_value = ComparisonValue{ .bool_ = s2t.parseBool(condition.value) },
|
.bool => compare_value = ComparisonValue{ .bool_ = s2t.parseBool(condition.value) },
|
||||||
.id => compare_value = ComparisonValue{ .id = UUID.parse(condition.value) catch return FileEngineError.InvalidUUID },
|
.link => compare_value = ComparisonValue{ .link = UUID.parse(condition.value) catch return FileEngineError.InvalidUUID },
|
||||||
.date => compare_value = ComparisonValue{ .datetime = s2t.parseDate(condition.value) },
|
.date => compare_value = ComparisonValue{ .datetime = s2t.parseDate(condition.value) },
|
||||||
.time => compare_value = ComparisonValue{ .datetime = s2t.parseTime(condition.value) },
|
.time => compare_value = ComparisonValue{ .datetime = s2t.parseTime(condition.value) },
|
||||||
.datetime => compare_value = ComparisonValue{ .datetime = s2t.parseDatetime(condition.value) },
|
.datetime => compare_value = ComparisonValue{ .datetime = s2t.parseDatetime(condition.value) },
|
||||||
@ -525,7 +529,7 @@ pub const FileEngine = struct {
|
|||||||
.str_array => compare_value = ComparisonValue{ .str_array = s2t.parseArrayStr(self.allocator, condition.value) },
|
.str_array => compare_value = ComparisonValue{ .str_array = s2t.parseArrayStr(self.allocator, condition.value) },
|
||||||
.float_array => compare_value = ComparisonValue{ .float_array = s2t.parseArrayFloat(self.allocator, condition.value) },
|
.float_array => compare_value = ComparisonValue{ .float_array = s2t.parseArrayFloat(self.allocator, condition.value) },
|
||||||
.bool_array => compare_value = ComparisonValue{ .bool_array = s2t.parseArrayBool(self.allocator, condition.value) },
|
.bool_array => compare_value = ComparisonValue{ .bool_array = s2t.parseArrayBool(self.allocator, condition.value) },
|
||||||
.id_array => compare_value = ComparisonValue{ .id_array = s2t.parseArrayUUID(self.allocator, condition.value) },
|
.link_array => compare_value = ComparisonValue{ .link_array = s2t.parseArrayUUID(self.allocator, condition.value) },
|
||||||
.date_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayDate(self.allocator, condition.value) },
|
.date_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayDate(self.allocator, condition.value) },
|
||||||
.time_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayTime(self.allocator, condition.value) },
|
.time_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayTime(self.allocator, condition.value) },
|
||||||
.datetime_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayDatetime(self.allocator, condition.value) },
|
.datetime_array => compare_value = ComparisonValue{ .datetime_array = s2t.parseArrayDatetime(self.allocator, condition.value) },
|
||||||
@ -534,12 +538,12 @@ pub const FileEngine = struct {
|
|||||||
switch (condition.data_type) {
|
switch (condition.data_type) {
|
||||||
.int_array => compare_value.int_array.deinit(),
|
.int_array => compare_value.int_array.deinit(),
|
||||||
.str_array => {
|
.str_array => {
|
||||||
for (compare_value.str_array.items) |value| self.allocator.free(value);
|
for (compare_value.str_array.items) |value| self.allocator.free(value); // TODO: Remove that, I should need to free them one by one as condition.value keep it in memory
|
||||||
compare_value.str_array.deinit();
|
compare_value.str_array.deinit();
|
||||||
},
|
},
|
||||||
.float_array => compare_value.float_array.deinit(),
|
.float_array => compare_value.float_array.deinit(),
|
||||||
.bool_array => compare_value.bool_array.deinit(),
|
.bool_array => compare_value.bool_array.deinit(),
|
||||||
.id_array => compare_value.id_array.deinit(),
|
.link_array => compare_value.link_array.deinit(),
|
||||||
.datetime_array => compare_value.datetime_array.deinit(),
|
.datetime_array => compare_value.datetime_array.deinit(),
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
@ -600,7 +604,7 @@ pub const FileEngine = struct {
|
|||||||
.float => compare_value.float == s2t.parseFloat(row_value),
|
.float => compare_value.float == s2t.parseFloat(row_value),
|
||||||
.str => std.mem.eql(u8, compare_value.str, row_value),
|
.str => std.mem.eql(u8, compare_value.str, row_value),
|
||||||
.bool => compare_value.bool_ == s2t.parseBool(row_value),
|
.bool => compare_value.bool_ == s2t.parseBool(row_value),
|
||||||
.id => compare_value.id.compare(uuid),
|
.link => compare_value.link.compare(uuid),
|
||||||
.date => compare_value.datetime.compareDate(s2t.parseDate(row_value)),
|
.date => compare_value.datetime.compareDate(s2t.parseDate(row_value)),
|
||||||
.time => compare_value.datetime.compareTime(s2t.parseTime(row_value)),
|
.time => compare_value.datetime.compareTime(s2t.parseTime(row_value)),
|
||||||
.datetime => compare_value.datetime.compareDatetime(s2t.parseDatetime(row_value)),
|
.datetime => compare_value.datetime.compareDatetime(s2t.parseDatetime(row_value)),
|
||||||
@ -612,6 +616,7 @@ pub const FileEngine = struct {
|
|||||||
.float => compare_value.float != s2t.parseFloat(row_value),
|
.float => compare_value.float != s2t.parseFloat(row_value),
|
||||||
.str => !std.mem.eql(u8, compare_value.str, row_value),
|
.str => !std.mem.eql(u8, compare_value.str, row_value),
|
||||||
.bool => compare_value.bool_ != s2t.parseBool(row_value),
|
.bool => compare_value.bool_ != s2t.parseBool(row_value),
|
||||||
|
.link => !compare_value.link.compare(uuid),
|
||||||
.date => !compare_value.datetime.compareDate(s2t.parseDate(row_value)),
|
.date => !compare_value.datetime.compareDate(s2t.parseDate(row_value)),
|
||||||
.time => !compare_value.datetime.compareTime(s2t.parseTime(row_value)),
|
.time => !compare_value.datetime.compareTime(s2t.parseTime(row_value)),
|
||||||
.datetime => !compare_value.datetime.compareDatetime(s2t.parseDatetime(row_value)),
|
.datetime => !compare_value.datetime.compareDatetime(s2t.parseDatetime(row_value)),
|
||||||
@ -660,8 +665,8 @@ pub const FileEngine = struct {
|
|||||||
// TODO: Do it for other array and implement in the query language
|
// TODO: Do it for other array and implement in the query language
|
||||||
switch (condition.operation) {
|
switch (condition.operation) {
|
||||||
.in => switch (condition.data_type) {
|
.in => switch (condition.data_type) {
|
||||||
.id_array => {
|
.link_array => {
|
||||||
for (compare_value.id_array.items) |elem| {
|
for (compare_value.link_array.items) |elem| {
|
||||||
if (elem.compare(uuid)) uuid_array.append(uuid) catch return FileEngineError.MemoryError;
|
if (elem.compare(uuid)) uuid_array.append(uuid) catch return FileEngineError.MemoryError;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -851,7 +856,7 @@ pub const FileEngine = struct {
|
|||||||
reader.streamUntilDelimiter(writer, '\'', null) catch return FileEngineError.StreamError;
|
reader.streamUntilDelimiter(writer, '\'', null) catch return FileEngineError.StreamError;
|
||||||
reader.streamUntilDelimiter(writer, '\'', null) catch return FileEngineError.StreamError;
|
reader.streamUntilDelimiter(writer, '\'', null) catch return FileEngineError.StreamError;
|
||||||
},
|
},
|
||||||
.int_array, .float_array, .bool_array, .id_array, .date_array, .time_array, .datetime_array => {
|
.int_array, .float_array, .bool_array, .link_array, .date_array, .time_array, .datetime_array => {
|
||||||
reader.streamUntilDelimiter(writer, ']', null) catch return FileEngineError.StreamError;
|
reader.streamUntilDelimiter(writer, ']', null) catch return FileEngineError.StreamError;
|
||||||
},
|
},
|
||||||
.str_array => {
|
.str_array => {
|
||||||
@ -878,7 +883,7 @@ pub const FileEngine = struct {
|
|||||||
.str => {
|
.str => {
|
||||||
new_writer.writeByte('\'') catch return FileEngineError.WriteError;
|
new_writer.writeByte('\'') catch return FileEngineError.WriteError;
|
||||||
},
|
},
|
||||||
.int_array, .float_array, .bool_array, .id_array, .date_array, .str_array, .time_array, .datetime_array => {
|
.int_array, .float_array, .bool_array, .link_array, .date_array, .str_array, .time_array, .datetime_array => {
|
||||||
new_writer.writeByte(']') catch return FileEngineError.WriteError;
|
new_writer.writeByte(']') catch return FileEngineError.WriteError;
|
||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
@ -887,7 +892,7 @@ pub const FileEngine = struct {
|
|||||||
|
|
||||||
if (i == number_of_member_in_struct - 1) continue;
|
if (i == number_of_member_in_struct - 1) continue;
|
||||||
switch (member_type) {
|
switch (member_type) {
|
||||||
.str, .int_array, .float_array, .bool_array, .id_array, .date_array, .str_array, .time_array, .datetime_array => {
|
.str, .int_array, .float_array, .bool_array, .link_array, .date_array, .str_array, .time_array, .datetime_array => {
|
||||||
reader.streamUntilDelimiter(writer, CSV_DELIMITER, null) catch return FileEngineError.StreamError;
|
reader.streamUntilDelimiter(writer, CSV_DELIMITER, null) catch return FileEngineError.StreamError;
|
||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
|
@ -5,7 +5,7 @@ pub const DataType = enum {
|
|||||||
float,
|
float,
|
||||||
str,
|
str,
|
||||||
bool,
|
bool,
|
||||||
id,
|
link,
|
||||||
date,
|
date,
|
||||||
time,
|
time,
|
||||||
datetime,
|
datetime,
|
||||||
@ -13,7 +13,7 @@ pub const DataType = enum {
|
|||||||
float_array,
|
float_array,
|
||||||
str_array,
|
str_array,
|
||||||
bool_array,
|
bool_array,
|
||||||
id_array,
|
link_array,
|
||||||
date_array,
|
date_array,
|
||||||
time_array,
|
time_array,
|
||||||
datetime_array,
|
datetime_array,
|
||||||
|
@ -574,7 +574,7 @@ pub const Parser = struct {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
.str, .id => switch (token.tag) {
|
.str => switch (token.tag) {
|
||||||
.string_literal => condition.value = self.toker.getTokenSlice(token),
|
.string_literal => condition.value = self.toker.getTokenSlice(token),
|
||||||
else => return printError(
|
else => return printError(
|
||||||
"Error: Expected string",
|
"Error: Expected string",
|
||||||
@ -585,6 +585,17 @@ pub const Parser = struct {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.link => switch (token.tag) {
|
||||||
|
.uuid_literal => condition.value = self.toker.getTokenSlice(token),
|
||||||
|
else => return printError(
|
||||||
|
"Error: Expected string",
|
||||||
|
ZiQlParserError.SynthaxError,
|
||||||
|
self.toker.buffer,
|
||||||
|
token.loc.start,
|
||||||
|
token.loc.end,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
.bool => switch (token.tag) {
|
.bool => switch (token.tag) {
|
||||||
.bool_literal_true, .bool_literal_false => condition.value = self.toker.getTokenSlice(token),
|
.bool_literal_true, .bool_literal_false => condition.value = self.toker.getTokenSlice(token),
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -641,7 +652,7 @@ pub const Parser = struct {
|
|||||||
condition.value = self.toker.buffer[start_index..token.loc.end];
|
condition.value = self.toker.buffer[start_index..token.loc.end];
|
||||||
},
|
},
|
||||||
|
|
||||||
.id_array => {
|
.link_array => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.uuid_literal);
|
token = try self.checkTokensInArray(.uuid_literal);
|
||||||
condition.value = self.toker.buffer[start_index..token.loc.end];
|
condition.value = self.toker.buffer[start_index..token.loc.end];
|
||||||
@ -699,7 +710,7 @@ pub const Parser = struct {
|
|||||||
// TODO: Mqke q function outside the Parser
|
// TODO: Mqke q function outside the Parser
|
||||||
switch (condition.operation) {
|
switch (condition.operation) {
|
||||||
.equal => switch (condition.data_type) {
|
.equal => switch (condition.data_type) {
|
||||||
.int, .float, .str, .bool, .id, .date, .time, .datetime => {},
|
.int, .float, .str, .bool, .link, .date, .time, .datetime => {},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
"Error: Only int, float, str, bool, date, time, datetime can be compare with =.",
|
"Error: Only int, float, str, bool, date, time, datetime can be compare with =.",
|
||||||
ZiQlParserError.ConditionError,
|
ZiQlParserError.ConditionError,
|
||||||
@ -710,7 +721,7 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
|
|
||||||
.different => switch (condition.data_type) {
|
.different => switch (condition.data_type) {
|
||||||
.int, .float, .str, .bool, .id, .date, .time, .datetime => {},
|
.int, .float, .str, .bool, .link, .date, .time, .datetime => {},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
"Error: Only int, float, str, bool, date, time, datetime can be compare with !=.",
|
"Error: Only int, float, str, bool, date, time, datetime can be compare with !=.",
|
||||||
ZiQlParserError.ConditionError,
|
ZiQlParserError.ConditionError,
|
||||||
@ -972,7 +983,7 @@ pub const Parser = struct {
|
|||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
.keyword_null => {
|
.keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -985,7 +996,7 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
.date => switch (token.tag) {
|
.date => switch (token.tag) {
|
||||||
.date_literal, .keyword_null => {
|
.date_literal, .keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -998,7 +1009,7 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
.time => switch (token.tag) {
|
.time => switch (token.tag) {
|
||||||
.time_literal, .keyword_null => {
|
.time_literal, .keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1011,7 +1022,7 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
.datetime => switch (token.tag) {
|
.datetime => switch (token.tag) {
|
||||||
.datetime_literal, .keyword_null => {
|
.datetime_literal, .keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1024,7 +1035,7 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
.str => switch (token.tag) {
|
.str => switch (token.tag) {
|
||||||
.string_literal, .keyword_null => {
|
.string_literal, .keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1035,9 +1046,9 @@ pub const Parser = struct {
|
|||||||
token.loc.end,
|
token.loc.end,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
.id => switch (token.tag) {
|
.link => switch (token.tag) {
|
||||||
.uuid_literal, .keyword_null => {
|
.uuid_literal, .keyword_null => {
|
||||||
member_map.put(member_name, self.toker.getTokenSlice(token)) catch @panic("Could not add member name and value to map in getMapOfMember");
|
member_map.put(member_name, self.toker.getTokenSlice(token)) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1048,12 +1059,11 @@ pub const Parser = struct {
|
|||||||
token.loc.end,
|
token.loc.end,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
// TODO: Maybe upgrade that to use multiple state
|
|
||||||
.int_array => switch (token.tag) {
|
.int_array => switch (token.tag) {
|
||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.int_literal);
|
token = try self.checkTokensInArray(.int_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1068,7 +1078,7 @@ pub const Parser = struct {
|
|||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.float_literal);
|
token = try self.checkTokensInArray(.float_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1099,7 +1109,7 @@ pub const Parser = struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Maybe change that as it just recreate a string that is already in the buffer
|
// Maybe change that as it just recreate a string that is already in the buffer
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1114,7 +1124,7 @@ pub const Parser = struct {
|
|||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.string_literal);
|
token = try self.checkTokensInArray(.string_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1125,11 +1135,11 @@ pub const Parser = struct {
|
|||||||
token.loc.end,
|
token.loc.end,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
.id_array => switch (token.tag) {
|
.link_array => switch (token.tag) {
|
||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.uuid_literal);
|
token = try self.checkTokensInArray(.uuid_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1144,7 +1154,7 @@ pub const Parser = struct {
|
|||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.date_literal);
|
token = try self.checkTokensInArray(.date_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1159,7 +1169,7 @@ pub const Parser = struct {
|
|||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.time_literal);
|
token = try self.checkTokensInArray(.time_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
@ -1174,7 +1184,7 @@ pub const Parser = struct {
|
|||||||
.l_bracket => {
|
.l_bracket => {
|
||||||
const start_index = token.loc.start;
|
const start_index = token.loc.start;
|
||||||
token = try self.checkTokensInArray(.datetime_literal);
|
token = try self.checkTokensInArray(.datetime_literal);
|
||||||
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch @panic("Couln't add string of array in data map");
|
member_map.put(member_name, self.toker.buffer[start_index..token.loc.end]) catch return ZipponError.MemoryError;
|
||||||
self.state = .expect_comma_OR_end;
|
self.state = .expect_comma_OR_end;
|
||||||
},
|
},
|
||||||
else => return printError(
|
else => return printError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user