use io; use fmt; export type invalid = !(uint, uint); export type error = !(invalid | io::error); export type punctuation = enum uint { LEFT_PAREN, RIGHT_PAREN, LEFT_SQUARE_BRACKET, RIGHT_SQUARE_BRACKET, LEFT_CURLY_BRACKET, RIGHT_CURLY_BRACKET, BACKSLASH, COLON, }; export type word = struct { v: str }; export type token = (punctuation | word | str); export fn strerror(err: error) const str = { static let buf: [64]u8 = [0...]; match (err) { case let err: invalid => return fmt::bsprintf(buf, "{}:{}: Invalid token found", err.0, err.1); case let err: io::error => return io::strerror(err); }; };