aeronavery / zig-toml Goto Github PK
View Code? Open in Web Editor NEWA TOML parser written in Zig
License: MIT License
A TOML parser written in Zig
License: MIT License
This code panics
test "float" {
var parser = try parseContents(std.testing.allocator,
\\ foo=1.234
);
defer parser.deinit();
var table = try parser.parse();
defer table.deinit();
It seems to be related to the placement of the decimal
This code does not panic
test "float" {
var parser = try parseContents(std.testing.allocator,
\\ foo=12.34
);
defer parser.deinit();
var table = try parser.parse();
defer table.deinit();
Given the test case:
test "memory cleanup" {
var table = try parseFile(std.testing.allocator, "test/basic.toml", null);
defer table.deinit();
}
note that zig build test
outputs:
Test [40/40] test.memory cleanup... [gpa] (err): memory address 0x7fb15b146000 leaked:
/opt/zigup/zig/0.11.0-dev.64+e9a12491f/files/lib/std/array_list.zig:295:72: 0x222003 in shrinkAndFree (test)
self.items = self.allocator.realloc(self.allocatedSlice(), new_len) catch |e| switch (e) {
^
/opt/zigup/zig/0.11.0-dev.64+e9a12491f/files/lib/std/io/reader.zig:78:45: 0x221954 in readAllArrayListAligned__anon_4289 (test)
array_list.shrinkAndFree(start_index);
^
/opt/zigup/zig/0.11.0-dev.64+e9a12491f/files/lib/std/fs/file.zig:951:46: 0x22141a in readToEndAllocOptions__anon_4139 (test)
self.reader().readAllArrayListAligned(alignment, &array_list, max_bytes) catch |err| switch (err) {
^
/opt/zigup/zig/0.11.0-dev.64+e9a12491f/files/lib/std/fs.zig:2076:42: 0x220df4 in readFileAllocOptions__anon_3957 (test)
return file.readToEndAllocOptions(allocator, max_bytes, stat_size, alignment, optional_sentinel);
^
/opt/zigup/zig/0.11.0-dev.64+e9a12491f/files/lib/std/fs.zig:2051:41: 0x220af6 in readFileAlloc (test)
return self.readFileAllocOptions(allocator, file_path, max_bytes, null, @alignOf(u8), null);
^
/home/paoda/dev/open/zig-toml/src/toml.zig:329:91: 0x2228d0 in initWithFile (test)
var contents = try std.fs.cwd().readFileAlloc(allocator, filename, std.math.maxInt(usize));
^
/home/paoda/dev/open/zig-toml/src/toml.zig:800:41: 0x22380f in parseFile (test)
var parser = try Parser.initWithFile(allocator, filename);
^
/home/paoda/dev/open/zig-toml/src/toml.zig:1402:30: 0x22918d in test.memory cleanup (test)
var table = try parseFile(std.testing.allocator, "test/basic.toml", null);
^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.