Skip to content

Commit 6acd70b

Browse files
committed
update to latest master
1 parent ad7a94f commit 6acd70b

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

build.zig

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub fn build(b: *std.build.Builder) void {
1717
exe.setBuildMode(mode);
1818

1919
exe.addIncludePath("./include");
20-
2120
exe.linkLibC();
2221
exe.linkSystemLibrary("gmp");
2322
exe.linkSystemLibrary("mpfr");

src/account.zig

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
3131
pub fn addAmount(self: *Self, accounts: []Self, amount: *BigDecimal) void {
3232
self.amount.quantity.add(amount);
3333
if (self.parent == 0) return;
34-
std.log.info("add amount to parent {d}", .{self.parent});
3534
var parent = accounts[self.parent];
3635
parent.addAmount(accounts, amount);
3736
}

src/tokenizer.zig

+37-5
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ pub const Token = struct {
4040
};
4141

4242
pub fn debug(self: Token, source: []const u8) void {
43-
std.log.info("{s}: '{s}'", .{ self.tag, source[self.loc.start..self.loc.end] });
43+
std.log.info("{any}: '{any}'", .{ self.tag, source[self.loc.start..self.loc.end] });
4444
}
4545
};
4646

4747
pub const Tokenizer = struct {
4848
buffer: []const u8,
4949
index: usize,
50-
// FIXME: do we need this?
5150
last_newline: ?usize,
5251

5352
pub fn init(buffer: []const u8) Tokenizer {
@@ -316,13 +315,29 @@ test "transactions" {
316315
\\2020 abc
317316
\\ d:e
318317
\\ x:y
319-
, &.{ .date, .identifier, .indentation, .identifier, .indentation, .identifier });
318+
, &.{
319+
.date,
320+
.identifier,
321+
.indentation,
322+
.identifier,
323+
.indentation,
324+
.identifier,
325+
});
320326

321327
try testTokenize(
322328
\\2020 abc
323329
\\ d:e $10
324330
\\ x:y
325-
, &.{ .date, .identifier, .indentation, .identifier, .identifier, .amount, .indentation, .identifier });
331+
, &.{
332+
.date,
333+
.identifier,
334+
.indentation,
335+
.identifier,
336+
.identifier,
337+
.amount,
338+
.indentation,
339+
.identifier,
340+
});
326341
}
327342

328343
test "multiple transactions" {
@@ -335,5 +350,22 @@ test "multiple transactions" {
335350
\\ e:f $2
336351
\\ c:d
337352
;
338-
try testTokenize(source, &.{ .date, .identifier, .indentation, .identifier, .identifier, .amount, .indentation, .identifier, .date, .identifier, .indentation, .identifier, .identifier, .amount, .indentation, .identifier });
353+
try testTokenize(source, &.{
354+
.date,
355+
.identifier,
356+
.indentation,
357+
.identifier,
358+
.identifier,
359+
.amount,
360+
.indentation,
361+
.identifier,
362+
.date,
363+
.identifier,
364+
.indentation,
365+
.identifier,
366+
.identifier,
367+
.amount,
368+
.indentation,
369+
.identifier,
370+
});
339371
}

0 commit comments

Comments
 (0)