additional debug output
This commit is contained in:
parent
89a9316320
commit
ea0de2f4d2
1 changed files with 11 additions and 1 deletions
12
src/main.zig
12
src/main.zig
|
@ -333,7 +333,7 @@ fn processCommand(allocator: std.mem.Allocator, sentence: [:0]const u8, parser:
|
||||||
}
|
}
|
||||||
|
|
||||||
const object_words = tree.sentenceObject() catch |err| {
|
const object_words = tree.sentenceObject() catch |err| {
|
||||||
std.log.err("Failed to extract object: {}\n", .{err});
|
std.log.err("Failed to extract object: {}\nParse tree: {f}", .{ err, tree });
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
defer allocator.free(object_words);
|
defer allocator.free(object_words);
|
||||||
|
@ -342,6 +342,7 @@ fn processCommand(allocator: std.mem.Allocator, sentence: [:0]const u8, parser:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std.log.debug("{f}", .{tree});
|
||||||
var aw = std.Io.Writer.Allocating.init(allocator);
|
var aw = std.Io.Writer.Allocating.init(allocator);
|
||||||
defer aw.deinit();
|
defer aw.deinit();
|
||||||
const aw_writer = &aw.writer;
|
const aw_writer = &aw.writer;
|
||||||
|
@ -353,6 +354,15 @@ fn processCommand(allocator: std.mem.Allocator, sentence: [:0]const u8, parser:
|
||||||
}
|
}
|
||||||
std.log.debug("{s}]", .{aw.written()});
|
std.log.debug("{s}]", .{aw.written()});
|
||||||
|
|
||||||
|
aw.clearRetainingCapacity();
|
||||||
|
try aw_writer.writeAll("Action words: [");
|
||||||
|
first = true;
|
||||||
|
for (action_words) |word| {
|
||||||
|
try aw_writer.print("{s}\"{s}\"", .{ if (!first) ", " else "", word });
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
std.log.debug("{s}]", .{aw.written()});
|
||||||
|
|
||||||
if (parseAction(action_words)) |action| {
|
if (parseAction(action_words)) |action| {
|
||||||
if (try extractDevice(allocator, object_words, devices)) |entry| {
|
if (try extractDevice(allocator, object_words, devices)) |entry| {
|
||||||
if (builtin.is_test)
|
if (builtin.is_test)
|
||||||
|
|
Loading…
Add table
Reference in a new issue