-
-
Save CurtisFenner/577c28741a0d65b3ce501f495e8b6bed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>zig test src/parser.zig | |
.\src\parser.zig:648:44: error: cannot assign to constant | |
var r = try @call(.{ .modifier = .never_inline }, @This()._parseField, .{ field, &result, stream, from, &consumed, allocator }); | |
^ | |
.\src\parser.zig:642:135: note: referenced here | |
pub fn _parse(allocator: *std.mem.Allocator, stream: Stream, from: usize) error{OutOfMemory}!InternalParseUnion(Into) { | |
^ | |
.\src\parser.zig:500:51: error: cannot assign to constant | |
const result = try @call(.{ .modifier = .never_inline }, FieldType.Parser._parse, .{ allocator, stream, from }); | |
^ | |
.\src\parser.zig:493:135: note: referenced here | |
pub fn _parse(allocator: *std.mem.Allocator, stream: Stream, from: usize) error{OutOfMemory}!InternalParseUnion(Into) { | |
pub fn _parse(allocator: *std.mem.Allocator, stream: Stream, from: usize) error{OutOfMemory}!InternalParseUnion(Into) { | |
var result: Into = undefined; | |
var consumed: usize = 0; | |
// TODO: Use a bump-allocator that doesn't require recursive deallocation. | |
inline for (fields) |field| { | |
const r = try @call(.{ .modifier = .never_inline }, @This()._parseField, .{ field, &result, stream, from, &consumed, allocator }); | |
switch (r) { | |
.Success => { | |
// Continue to the next field. | |
}, | |
.Fail => { | |
return InternalParseUnion(Into){ .NoMatch = {} }; | |
}, | |
.Error => |e| { | |
return InternalParseUnion(Into){ .Error = r.Error }; | |
}, | |
} | |
} | |
// Produce the finished result, including Location annotations. | |
result.location = stream.locations[from].span(stream.locations[from + consumed - 1]); | |
return InternalParseUnion(Into){ | |
.Result = InternalParseResult(Into){ | |
.consumed = consumed, | |
.value = result, | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment