Skip to content

Instantly share code, notes, and snippets.

@marler8997
Last active March 17, 2021 19:23
Show Gist options
  • Save marler8997/e6797e2ba28d7eb37c2934e040693438 to your computer and use it in GitHub Desktop.
Save marler8997/e6797e2ba28d7eb37c2934e040693438 to your computer and use it in GitHub Desktop.
Infinite semantic analysis loop
| *"formatType @TypeOf(value)=", StringTree, *" fmt=", "{any}"
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", "any"
| *"formatType @TypeOf(value)=", []StringTree, *" fmt=", any
| *"formatType @TypeOf(value)=", u64, *" fmt=", d
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", u8, *" fmt=", any
| *"formatType @TypeOf(value)=", StringTree, *" fmt=", any
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", any
| *"formatType @TypeOf(value)=", []StringTree, *" fmt=", any
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", u64, *" fmt=", d
| *"formatType @TypeOf(value)=", u64, *" fmt=", d
| *"formatType @TypeOf(value)=", usize, *" fmt=", x
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", s
| *"formatType @TypeOf(value)=", u8, *" fmt=", any
| *"formatType @TypeOf(value)=", StringTree, *" fmt=", any
| *"formatType @TypeOf(value)=", u12, *" fmt=", d
| *"formatType @TypeOf(value)=", []const u8, *" fmt=", any
| *"formatType @TypeOf(value)=", []StringTree, *" fmt=", any
const std = @import("std");
pub const StringTree = struct {
str: []const u8,
children: []StringTree,
};
test {
const tree : StringTree = undefined;
std.fmt.formatType(tree, "{any}", .{}, std.io.getStdErr().writer(), 3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment