Giter Site home page Giter Site logo

zig-toml's People

Contributors

abhinav avatar des-nerger avatar iacore avatar sam701 avatar spadi0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zig-toml's Issues

Parser does not respect default values

pub fn main() !void {
    var parser = toml.Parser(Watah).init(std.heap.page_allocator);
    var parsed = try parser.parseString(
        \\forsen = "abc"
    );

    std.debug.print("{s} {any}\n", .{ parsed.value.forsen, parsed.value.fdefault });
}

const Watah = struct {
    forsen: []const u8,
    fdefault: u8 = 2,
};

Even though fdefault has a default value of 2 here, the parser returns an error because it doesn't find it in the string:

> zig run src/main.zig
error: MissingRequiredField
D:\VSRepos\test\src\zig-toml\src\struct_mapping.zig:37:25: 0x7ff7eb4876a9 in intoStruct__anon_4214 (main.exe.obj)
                        return error.MissingRequiredField;
                        ^
D:\VSRepos\test\src\zig-toml\src\main.zig:98:17: 0x7ff7eb4888d8 in parseString (main.exe.obj)
                return err;
                ^
D:\VSRepos\test\src\main.zig:6:18: 0x7ff7eb488c65 in main (main.exe.obj)
    var parsed = try parser.parseString(

Can't parse HashMap

this is an example of toml

[tasks.a]
cmd = "echo 123"

[tasks.b]
cmd = "echo 123"

I need a possible way to parse this tasks, I can't predict the keys

Thank you

Unable to build the project

I tried run/building it with many different versions.
0.10.0, 0.10.1, 0.9.1 and the 3 newest 0.11.0-dev and all of them give me pretty much the same error.

With the 0.11.0-dev.1478+ce20ebb50 I get the following error when I run "zig run build.zig".

/home/toni/.local/bin/lib/std/start.zig:601:45: error: root struct of file 'build' has no member named 'main'
    switch (@typeInfo(@typeInfo(@TypeOf(root.main)).Fn.return_type.?)) {
                                        ~~~~^~~~~
/home/toni/.local/bin/lib/std/start.zig:550:12: note: called from here
    return @call(.always_inline, callMain, .{});
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/toni/.local/bin/lib/std/start.zig:500:36: note: called from here
    return initEventLoopAndCallMain();
           ~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/toni/.local/bin/lib/std/start.zig:464:17: note: called from here
    std.os.exit(@call(.always_inline, callMainWithArgs, .{ argc, argv, envp }));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.