/reader.zig Secret
Last active
April 19, 2019 01:37
This file contains hidden or 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
mal/zig/reader.zig:20:20: error: values of type 'comptime_int' must be comptime known | |
const len = switch (self.input[self.curr]) { | |
'~' => if (self.input[self.curr + 1] == '@') 2 else 1, | |
^ |
This file contains hidden or 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
const len: usize = switch (self.input[self.curr]) { | |
'[', ']', '{', '}', '(', ')', '\'', '`', '^', '@' => 1, | |
'~' => if (self.input[self.curr + 1] == '@') 2 else 1, | |
'"' => blk: { | |
for (self.input[(self.curr + 1)..]) |char, i| if (char == '"') { | |
break :blk i + 1; | |
}; | |
return ReaderError.UnmatchedQuote; | |
}, | |
else => blk: { | |
for (self.input[(self.curr + 1)..]) |char, i| switch (char) { | |
' ', ',', '[', ']', '{', '}', '(', ')', '\'', '"', '`', ';' => { | |
break :blk i + 1; | |
}, | |
else => {}, | |
}; | |
break :blk self.input.len - self.curr; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment