Skip to content

Commit

Permalink
Merge pull request #1 from der-teufel-programming/master
Browse files Browse the repository at this point in the history
Update to Zig 0.13
  • Loading branch information
ikskuh authored Jun 15, 2024
2 parents 2d7db68 + 6b454d0 commit 02d2608
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
zig-cache/
.zig-cache/
zig-out/
21 changes: 11 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ pub fn build(b: *std.Build) void {
const parser_toolkit = b.dependency("parser_toolkit", .{});
const args = b.dependency("args", .{});

const hyperdoc = b.addModule("hyperdoc", .{
.source_file = .{ .path = "src/hyperdoc.zig" },
.dependencies = &.{
.{ .name = "parser-toolkit", .module = parser_toolkit.module("parser-toolkit") },
const hyperdoc = b.addModule(
"hyperdoc",
.{
.root_source_file = b.path("src/hyperdoc.zig"),
},
});
);
hyperdoc.addImport("parser-toolkit", parser_toolkit.module("parser-toolkit"));

const exe = b.addExecutable(.{
.name = "hyperdoc",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});

exe.addModule("hyperdoc", hyperdoc);
exe.addModule("args", args.module("args"));
exe.root_module.addImport("hyperdoc", hyperdoc);
exe.root_module.addImport("args", args.module("args"));

b.installArtifact(exe);

Expand All @@ -36,12 +37,12 @@ pub fn build(b: *std.Build) void {
run_step.dependOn(&run_cmd.step);

const exe_tests = b.addTest(.{
.root_source_file = .{ .path = "src/testsuite.zig" },
.root_source_file = b.path("src/testsuite.zig"),
.target = target,
.optimize = optimize,
});

exe_tests.addModule("hyperdoc", hyperdoc);
exe_tests.root_module.addImport("hyperdoc", hyperdoc);

const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&b.addRunArtifact(exe_tests).step);
Expand Down
10 changes: 6 additions & 4 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

.dependencies = .{
.parser_toolkit = .{
.url = "https://github.com/MasterQ32/parser-toolkit/archive/7e7188bfaa46d0ba36d1ef31c1f368d264aa6876.tar.gz",
.hash = "12202ae562efbd6a4f12f1b10c5237329d19d1be15eec7fa1b0b02f5658500bfcbfd",
.url = "https://github.com/ikskuh/parser-toolkit/archive/9349d087a3216ebea27cc99b5b4bd8affe234816.tar.gz",
.hash = "12206f0ade18be8db985f6a688ca7ec9ffdbb95f033c8db91760b0d13cfe27618b61",
},
.args = .{
.url = "https://github.com/MasterQ32/zig-args/archive/bb2eced8ddf28114b3a1ff761c2d80b90b1a61e2.tar.gz",
.hash = "12208556082c280af264ca2a174fd04fc7a35f865bfe59e2c61f4a977bf7a65063e4",
.url = "https://github.com/ikskuh/zig-args/archive/872272205d95bdba33798c94e72c5387a31bc806.tar.gz",
.hash = "1220fe6ae56b668cc4a033282b5f227bfbb46a67ede6d84e9f9493fea9de339b5f37",
},
},

.paths = .{""},
}
6 changes: 3 additions & 3 deletions src/hyperdoc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ const Parser = struct {
}

fn accept(parser: *Parser, token_type: TokenType) !Token {
var state = parser.save();
const state = parser.save();
errdefer parser.restore(state);

var token = (try parser.core.nextToken()) orelse return error.EndOfFile;
const token = (try parser.core.nextToken()) orelse return error.EndOfFile;
if (token.type != token_type)
return error.UnexpectedToken;
return token;
Expand Down Expand Up @@ -165,7 +165,7 @@ const Parser = struct {
item,
};
fn acceptIdentifier(parser: *Parser) !Identifier {
var tok = try parser.accept(.identifier);
const tok = try parser.accept(.identifier);
return std.meta.stringToEnum(Identifier, tok.text) orelse return error.InvalidIdentifier;
}

Expand Down

0 comments on commit 02d2608

Please sign in to comment.