@zigc/lib 0.16.0-test.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/c/math.zig +135 -35
- package/c/stropts.zig +17 -0
- package/c.zig +1 -0
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +3 -1
- package/compiler/aro/aro/Compilation.zig +120 -97
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +124 -50
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +336 -142
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +127 -56
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/assembly_backend/x86_64.zig +3 -4
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -0
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +193 -61
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +364 -126
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +75 -16
- package/compiler_rt/cos.zig +141 -52
- package/compiler_rt/limb64.zig +266 -0
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/sin.zig +140 -55
- package/compiler_rt/sincos.zig +279 -72
- package/compiler_rt/tan.zig +118 -47
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +855 -307
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -0
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +536 -87
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +8 -15
- package/std/Build/WebServer.zig +29 -17
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -14
- package/std/Io/Dispatch.zig +2 -0
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Threaded.zig +181 -143
- package/std/Io/Uring.zig +2 -1
- package/std/Io.zig +970 -2
- package/std/Target.zig +3 -2
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +96 -555
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/c.zig +17 -17
- package/std/compress/flate/Compress.zig +3 -3
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +14 -4
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +539 -36
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +179 -65
- package/std/enums.zig +25 -19
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/debug_allocator.zig +7 -7
- package/std/http/Client.zig +10 -6
- package/std/http.zig +11 -9
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +1 -17
- package/std/os/linux.zig +7 -2
- package/std/os/windows.zig +2 -2
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +186 -458
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +44 -7
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/Client.zig +8 -3
- package/std/zig/Parse.zig +83 -74
- package/std/zig/Server.zig +26 -0
- package/std/zig/Zir.zig +17 -0
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +107 -48
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +6 -0
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
|
@@ -34,7 +34,7 @@ pub const TokenWithExpansionLocs = struct {
|
|
|
34
34
|
expansion_locs: ?[*]Source.Location = null,
|
|
35
35
|
|
|
36
36
|
pub fn expansionSlice(tok: TokenWithExpansionLocs) []const Source.Location {
|
|
37
|
-
const locs = tok.expansion_locs orelse return
|
|
37
|
+
const locs = tok.expansion_locs orelse return &.{};
|
|
38
38
|
var i: usize = 0;
|
|
39
39
|
while (locs[i].id.index != .unused) : (i += 1) {}
|
|
40
40
|
return locs[0..i];
|
|
@@ -243,6 +243,8 @@ pub const Node = union(enum) {
|
|
|
243
243
|
builtin_choose_expr: Conditional,
|
|
244
244
|
builtin_convertvector: Convertvector,
|
|
245
245
|
builtin_shufflevector: Shufflevector,
|
|
246
|
+
builtin_va_arg_pack: VaArgPack,
|
|
247
|
+
builtin_va_arg_pack_len: VaArgPack,
|
|
246
248
|
|
|
247
249
|
/// C23 bool literal `true` / `false`
|
|
248
250
|
bool_literal: Literal,
|
|
@@ -633,6 +635,10 @@ pub const Node = union(enum) {
|
|
|
633
635
|
indexes: []const Node.Index,
|
|
634
636
|
};
|
|
635
637
|
|
|
638
|
+
pub const VaArgPack = struct {
|
|
639
|
+
builtin_tok: TokenIndex,
|
|
640
|
+
};
|
|
641
|
+
|
|
636
642
|
pub const Literal = struct {
|
|
637
643
|
literal_tok: TokenIndex,
|
|
638
644
|
qt: QualType,
|
|
@@ -1689,6 +1695,16 @@ pub const Node = union(enum) {
|
|
|
1689
1695
|
.indexes = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0..node_data[2]]),
|
|
1690
1696
|
},
|
|
1691
1697
|
},
|
|
1698
|
+
.builtin_va_arg_pack => .{
|
|
1699
|
+
.builtin_va_arg_pack = .{
|
|
1700
|
+
.builtin_tok = node_tok,
|
|
1701
|
+
},
|
|
1702
|
+
},
|
|
1703
|
+
.builtin_va_arg_pack_len => .{
|
|
1704
|
+
.builtin_va_arg_pack_len = .{
|
|
1705
|
+
.builtin_tok = node_tok,
|
|
1706
|
+
},
|
|
1707
|
+
},
|
|
1692
1708
|
.array_init_expr_two => .{
|
|
1693
1709
|
.array_init_expr = .{
|
|
1694
1710
|
.l_brace_tok = node_tok,
|
|
@@ -1797,7 +1813,9 @@ pub const Node = union(enum) {
|
|
|
1797
1813
|
.global_asm,
|
|
1798
1814
|
.generic_association_expr,
|
|
1799
1815
|
.generic_default_expr,
|
|
1816
|
+
.builtin_va_arg_pack,
|
|
1800
1817
|
=> null,
|
|
1818
|
+
.builtin_va_arg_pack_len => .int,
|
|
1801
1819
|
.builtin_types_compatible_p => .int,
|
|
1802
1820
|
else => {
|
|
1803
1821
|
// If a node is typed the type is stored in data[0].
|
|
@@ -1963,6 +1981,8 @@ pub const Node = union(enum) {
|
|
|
1963
1981
|
builtin_types_compatible_p,
|
|
1964
1982
|
builtin_convertvector,
|
|
1965
1983
|
builtin_shufflevector,
|
|
1984
|
+
builtin_va_arg_pack,
|
|
1985
|
+
builtin_va_arg_pack_len,
|
|
1966
1986
|
array_init_expr,
|
|
1967
1987
|
array_init_expr_two,
|
|
1968
1988
|
struct_init_expr,
|
|
@@ -2789,6 +2809,14 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void {
|
|
|
2789
2809
|
tree.extra.appendAssumeCapacity(@intFromEnum(builtin.rhs));
|
|
2790
2810
|
tree.extra.appendSliceAssumeCapacity(@ptrCast(builtin.indexes));
|
|
2791
2811
|
},
|
|
2812
|
+
.builtin_va_arg_pack => |builtin| {
|
|
2813
|
+
repr.tag = .builtin_va_arg_pack;
|
|
2814
|
+
repr.tok = builtin.builtin_tok;
|
|
2815
|
+
},
|
|
2816
|
+
.builtin_va_arg_pack_len => |builtin| {
|
|
2817
|
+
repr.tag = .builtin_va_arg_pack_len;
|
|
2818
|
+
repr.tok = builtin.builtin_tok;
|
|
2819
|
+
},
|
|
2792
2820
|
.array_init_expr => |init| {
|
|
2793
2821
|
repr.data[0] = @bitCast(init.container_qt);
|
|
2794
2822
|
if (init.items.len > 2) {
|
|
@@ -3000,12 +3028,12 @@ pub fn tokSlice(tree: *const Tree, tok_i: TokenIndex) []const u8 {
|
|
|
3000
3028
|
return tree.comp.locSlice(loc);
|
|
3001
3029
|
}
|
|
3002
3030
|
|
|
3003
|
-
pub fn dump(tree: *const Tree,
|
|
3031
|
+
pub fn dump(tree: *const Tree, term: std.Io.Terminal) std.Io.Terminal.SetColorError!void {
|
|
3004
3032
|
for (tree.root_decls.items) |i| {
|
|
3005
|
-
try tree.dumpNode(i, 0,
|
|
3006
|
-
try
|
|
3033
|
+
try tree.dumpNode(i, 0, term);
|
|
3034
|
+
try term.writer.writeByte('\n');
|
|
3007
3035
|
}
|
|
3008
|
-
try
|
|
3036
|
+
try term.writer.flush();
|
|
3009
3037
|
}
|
|
3010
3038
|
|
|
3011
3039
|
fn dumpFieldAttributes(tree: *const Tree, attributes: []const Attribute, level: u32, w: *std.Io.Writer) !void {
|
|
@@ -3052,25 +3080,26 @@ fn dumpNode(
|
|
|
3052
3080
|
tree: *const Tree,
|
|
3053
3081
|
node_index: Node.Index,
|
|
3054
3082
|
level: u32,
|
|
3055
|
-
|
|
3056
|
-
w: *std.Io.Writer,
|
|
3083
|
+
term: std.Io.Terminal,
|
|
3057
3084
|
) !void {
|
|
3058
3085
|
const delta = 2;
|
|
3059
3086
|
const half = delta / 2;
|
|
3060
|
-
const TYPE = std.Io.
|
|
3061
|
-
const TAG = std.Io.
|
|
3062
|
-
const IMPLICIT = std.Io.
|
|
3063
|
-
const NAME = std.Io.
|
|
3064
|
-
const LITERAL = std.Io.
|
|
3065
|
-
const ATTRIBUTE = std.Io.
|
|
3087
|
+
const TYPE = std.Io.Terminal.Color.bright_magenta;
|
|
3088
|
+
const TAG = std.Io.Terminal.Color.bright_cyan;
|
|
3089
|
+
const IMPLICIT = std.Io.Terminal.Color.bright_blue;
|
|
3090
|
+
const NAME = std.Io.Terminal.Color.bright_red;
|
|
3091
|
+
const LITERAL = std.Io.Terminal.Color.bright_green;
|
|
3092
|
+
const ATTRIBUTE = std.Io.Terminal.Color.bright_yellow;
|
|
3093
|
+
|
|
3094
|
+
const w = term.writer;
|
|
3066
3095
|
|
|
3067
3096
|
const node = node_index.get(tree);
|
|
3068
3097
|
try w.splatByteAll(' ', level);
|
|
3069
3098
|
|
|
3070
|
-
if (
|
|
3099
|
+
if (term.mode == .no_color) {
|
|
3071
3100
|
if (node.isImplicit()) try w.writeAll("implicit ");
|
|
3072
3101
|
} else {
|
|
3073
|
-
try
|
|
3102
|
+
try term.setColor(if (node.isImplicit()) IMPLICIT else TAG);
|
|
3074
3103
|
}
|
|
3075
3104
|
try w.print("{s}", .{@tagName(node)});
|
|
3076
3105
|
|
|
@@ -3078,36 +3107,36 @@ fn dumpNode(
|
|
|
3078
3107
|
try w.writeAll(": ");
|
|
3079
3108
|
switch (node) {
|
|
3080
3109
|
.cast => |cast| {
|
|
3081
|
-
try
|
|
3110
|
+
try term.setColor(.white);
|
|
3082
3111
|
try w.print("({s}) ", .{@tagName(cast.kind)});
|
|
3083
3112
|
},
|
|
3084
3113
|
else => {},
|
|
3085
3114
|
}
|
|
3086
3115
|
|
|
3087
|
-
try
|
|
3116
|
+
try term.setColor(TYPE);
|
|
3088
3117
|
try w.writeByte('\'');
|
|
3089
3118
|
try qt.dump(tree.comp, w);
|
|
3090
3119
|
try w.writeByte('\'');
|
|
3091
3120
|
}
|
|
3092
3121
|
|
|
3093
3122
|
if (tree.isLval(node_index)) {
|
|
3094
|
-
try
|
|
3123
|
+
try term.setColor(ATTRIBUTE);
|
|
3095
3124
|
try w.writeAll(" lvalue");
|
|
3096
3125
|
}
|
|
3097
3126
|
if (tree.isBitfield(node_index)) {
|
|
3098
|
-
try
|
|
3127
|
+
try term.setColor(ATTRIBUTE);
|
|
3099
3128
|
try w.writeAll(" bitfield");
|
|
3100
3129
|
}
|
|
3101
3130
|
if (node == .asm_stmt) {
|
|
3102
3131
|
const quals = node.asm_stmt.quals;
|
|
3103
|
-
try
|
|
3132
|
+
try term.setColor(ATTRIBUTE);
|
|
3104
3133
|
if (quals.@"inline") try w.writeAll(" inline");
|
|
3105
3134
|
if (quals.@"volatile") try w.writeAll(" volatile");
|
|
3106
3135
|
if (quals.goto) try w.writeAll(" goto");
|
|
3107
3136
|
}
|
|
3108
3137
|
|
|
3109
3138
|
if (tree.value_map.get(node_index)) |val| {
|
|
3110
|
-
try
|
|
3139
|
+
try term.setColor(LITERAL);
|
|
3111
3140
|
try w.writeAll(" (value: ");
|
|
3112
3141
|
if (try val.print(node_index.qt(tree), tree.comp, w)) |nested| switch (nested) {
|
|
3113
3142
|
.pointer => |ptr| {
|
|
@@ -3127,15 +3156,15 @@ fn dumpNode(
|
|
|
3127
3156
|
try w.writeByte(')');
|
|
3128
3157
|
}
|
|
3129
3158
|
if (node == .return_stmt and node.return_stmt.operand == .implicit and node.return_stmt.operand.implicit) {
|
|
3130
|
-
try
|
|
3159
|
+
try term.setColor(IMPLICIT);
|
|
3131
3160
|
try w.writeAll(" (value: 0)");
|
|
3132
3161
|
}
|
|
3133
3162
|
|
|
3134
3163
|
try w.writeAll("\n");
|
|
3135
|
-
try
|
|
3164
|
+
try term.setColor(.reset);
|
|
3136
3165
|
|
|
3137
3166
|
if (node_index.qtOrNull(tree)) |qt| {
|
|
3138
|
-
try
|
|
3167
|
+
try term.setColor(ATTRIBUTE);
|
|
3139
3168
|
var it = Attribute.Iterator.initType(qt, tree.comp);
|
|
3140
3169
|
while (it.next()) |item| {
|
|
3141
3170
|
const attr, _ = item;
|
|
@@ -3143,56 +3172,56 @@ fn dumpNode(
|
|
|
3143
3172
|
try w.print("attr: {s}", .{@tagName(attr.tag)});
|
|
3144
3173
|
try tree.dumpAttribute(attr, w);
|
|
3145
3174
|
}
|
|
3146
|
-
try
|
|
3175
|
+
try term.setColor(.reset);
|
|
3147
3176
|
}
|
|
3148
3177
|
|
|
3149
3178
|
switch (node) {
|
|
3150
3179
|
.empty_decl => {},
|
|
3151
3180
|
.global_asm => |@"asm"| {
|
|
3152
|
-
try tree.dumpNode(@"asm".asm_str, level + delta,
|
|
3181
|
+
try tree.dumpNode(@"asm".asm_str, level + delta, term);
|
|
3153
3182
|
},
|
|
3154
3183
|
.static_assert => |assert| {
|
|
3155
3184
|
try w.splatByteAll(' ', level + 1);
|
|
3156
3185
|
try w.writeAll("condition:\n");
|
|
3157
|
-
try tree.dumpNode(assert.cond, level + delta,
|
|
3186
|
+
try tree.dumpNode(assert.cond, level + delta, term);
|
|
3158
3187
|
if (assert.message) |some| {
|
|
3159
3188
|
try w.splatByteAll(' ', level + 1);
|
|
3160
3189
|
try w.writeAll("diagnostic:\n");
|
|
3161
|
-
try tree.dumpNode(some, level + delta,
|
|
3190
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3162
3191
|
}
|
|
3163
3192
|
},
|
|
3164
3193
|
.function => |function| {
|
|
3165
3194
|
try w.splatByteAll(' ', level + half);
|
|
3166
3195
|
|
|
3167
|
-
try
|
|
3196
|
+
try term.setColor(ATTRIBUTE);
|
|
3168
3197
|
if (function.static) try w.writeAll("static ");
|
|
3169
3198
|
if (function.@"inline") try w.writeAll("inline ");
|
|
3170
3199
|
|
|
3171
|
-
try
|
|
3200
|
+
try term.setColor(.reset);
|
|
3172
3201
|
try w.writeAll("name: ");
|
|
3173
|
-
try
|
|
3202
|
+
try term.setColor(NAME);
|
|
3174
3203
|
try w.print("{s}\n", .{tree.tokSlice(function.name_tok)});
|
|
3175
|
-
try
|
|
3204
|
+
try term.setColor(.reset);
|
|
3176
3205
|
|
|
3177
3206
|
if (function.body) |body| {
|
|
3178
3207
|
try w.splatByteAll(' ', level + half);
|
|
3179
3208
|
try w.writeAll("body:\n");
|
|
3180
|
-
try tree.dumpNode(body, level + delta,
|
|
3209
|
+
try tree.dumpNode(body, level + delta, term);
|
|
3181
3210
|
}
|
|
3182
3211
|
if (function.definition) |definition| {
|
|
3183
3212
|
try w.splatByteAll(' ', level + half);
|
|
3184
3213
|
try w.writeAll("definition: ");
|
|
3185
|
-
try
|
|
3214
|
+
try term.setColor(NAME);
|
|
3186
3215
|
try w.print("0x{X}\n", .{@intFromEnum(definition)});
|
|
3187
|
-
try
|
|
3216
|
+
try term.setColor(.reset);
|
|
3188
3217
|
}
|
|
3189
3218
|
},
|
|
3190
3219
|
.typedef => |typedef| {
|
|
3191
3220
|
try w.splatByteAll(' ', level + half);
|
|
3192
3221
|
try w.writeAll("name: ");
|
|
3193
|
-
try
|
|
3222
|
+
try term.setColor(NAME);
|
|
3194
3223
|
try w.print("{s}\n", .{tree.tokSlice(typedef.name_tok)});
|
|
3195
|
-
try
|
|
3224
|
+
try term.setColor(.reset);
|
|
3196
3225
|
},
|
|
3197
3226
|
.param => |param| {
|
|
3198
3227
|
try w.splatByteAll(' ', level + half);
|
|
@@ -3200,21 +3229,21 @@ fn dumpNode(
|
|
|
3200
3229
|
switch (param.storage_class) {
|
|
3201
3230
|
.auto => {},
|
|
3202
3231
|
.register => {
|
|
3203
|
-
try
|
|
3232
|
+
try term.setColor(ATTRIBUTE);
|
|
3204
3233
|
try w.writeAll("register ");
|
|
3205
|
-
try
|
|
3234
|
+
try term.setColor(.reset);
|
|
3206
3235
|
},
|
|
3207
3236
|
}
|
|
3208
3237
|
|
|
3209
3238
|
try w.writeAll("name: ");
|
|
3210
|
-
try
|
|
3239
|
+
try term.setColor(NAME);
|
|
3211
3240
|
try w.print("{s}\n", .{tree.tokSlice(param.name_tok)});
|
|
3212
|
-
try
|
|
3241
|
+
try term.setColor(.reset);
|
|
3213
3242
|
},
|
|
3214
3243
|
.variable => |variable| {
|
|
3215
3244
|
try w.splatByteAll(' ', level + half);
|
|
3216
3245
|
|
|
3217
|
-
try
|
|
3246
|
+
try term.setColor(ATTRIBUTE);
|
|
3218
3247
|
switch (variable.storage_class) {
|
|
3219
3248
|
.auto => {},
|
|
3220
3249
|
.static => try w.writeAll("static "),
|
|
@@ -3222,37 +3251,37 @@ fn dumpNode(
|
|
|
3222
3251
|
.register => try w.writeAll("register "),
|
|
3223
3252
|
}
|
|
3224
3253
|
if (variable.thread_local) try w.writeAll("thread_local ");
|
|
3225
|
-
try
|
|
3254
|
+
try term.setColor(.reset);
|
|
3226
3255
|
|
|
3227
3256
|
try w.writeAll("name: ");
|
|
3228
|
-
try
|
|
3257
|
+
try term.setColor(NAME);
|
|
3229
3258
|
try w.print("{s}\n", .{tree.tokSlice(variable.name_tok)});
|
|
3230
|
-
try
|
|
3259
|
+
try term.setColor(.reset);
|
|
3231
3260
|
|
|
3232
3261
|
if (variable.initializer) |some| {
|
|
3233
|
-
try
|
|
3262
|
+
try term.setColor(.reset);
|
|
3234
3263
|
try w.splatByteAll(' ', level + half);
|
|
3235
3264
|
try w.writeAll("init:\n");
|
|
3236
|
-
try tree.dumpNode(some, level + delta,
|
|
3265
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3237
3266
|
}
|
|
3238
3267
|
if (variable.definition) |definition| {
|
|
3239
3268
|
try w.splatByteAll(' ', level + half);
|
|
3240
3269
|
try w.writeAll("definition: ");
|
|
3241
|
-
try
|
|
3270
|
+
try term.setColor(NAME);
|
|
3242
3271
|
try w.print("0x{X}\n", .{@intFromEnum(definition)});
|
|
3243
|
-
try
|
|
3272
|
+
try term.setColor(.reset);
|
|
3244
3273
|
}
|
|
3245
3274
|
},
|
|
3246
3275
|
.enum_field => |field| {
|
|
3247
3276
|
try w.splatByteAll(' ', level + half);
|
|
3248
3277
|
try w.writeAll("name: ");
|
|
3249
|
-
try
|
|
3278
|
+
try term.setColor(NAME);
|
|
3250
3279
|
try w.print("{s}\n", .{tree.tokSlice(field.name_tok)});
|
|
3251
|
-
try
|
|
3280
|
+
try term.setColor(.reset);
|
|
3252
3281
|
if (field.init) |some| {
|
|
3253
3282
|
try w.splatByteAll(' ', level + half);
|
|
3254
3283
|
try w.writeAll("init:\n");
|
|
3255
|
-
try tree.dumpNode(some, level + delta,
|
|
3284
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3256
3285
|
}
|
|
3257
3286
|
},
|
|
3258
3287
|
.record_field => |field| {
|
|
@@ -3260,26 +3289,26 @@ fn dumpNode(
|
|
|
3260
3289
|
if (name_tok_id == .identifier or name_tok_id == .extended_identifier) {
|
|
3261
3290
|
try w.splatByteAll(' ', level + half);
|
|
3262
3291
|
try w.writeAll("name: ");
|
|
3263
|
-
try
|
|
3292
|
+
try term.setColor(NAME);
|
|
3264
3293
|
try w.print("{s}\n", .{tree.tokSlice(field.name_or_first_tok)});
|
|
3265
|
-
try
|
|
3294
|
+
try term.setColor(.reset);
|
|
3266
3295
|
}
|
|
3267
3296
|
if (field.bit_width) |some| {
|
|
3268
3297
|
try w.splatByteAll(' ', level + half);
|
|
3269
3298
|
try w.writeAll("bits:\n");
|
|
3270
|
-
try tree.dumpNode(some, level + delta,
|
|
3299
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3271
3300
|
}
|
|
3272
3301
|
},
|
|
3273
3302
|
.compound_stmt => |compound| {
|
|
3274
3303
|
for (compound.body, 0..) |stmt, i| {
|
|
3275
3304
|
if (i != 0) try w.writeByte('\n');
|
|
3276
|
-
try tree.dumpNode(stmt, level + delta,
|
|
3305
|
+
try tree.dumpNode(stmt, level + delta, term);
|
|
3277
3306
|
}
|
|
3278
3307
|
},
|
|
3279
3308
|
.enum_decl => |decl| {
|
|
3280
3309
|
for (decl.fields, 0..) |field, i| {
|
|
3281
3310
|
if (i != 0) try w.writeByte('\n');
|
|
3282
|
-
try tree.dumpNode(field, level + delta,
|
|
3311
|
+
try tree.dumpNode(field, level + delta, term);
|
|
3283
3312
|
}
|
|
3284
3313
|
},
|
|
3285
3314
|
.struct_decl, .union_decl => |decl| {
|
|
@@ -3291,7 +3320,7 @@ fn dumpNode(
|
|
|
3291
3320
|
var field_i: u32 = 0;
|
|
3292
3321
|
for (decl.fields, 0..) |field_node, i| {
|
|
3293
3322
|
if (i != 0) try w.writeByte('\n');
|
|
3294
|
-
try tree.dumpNode(field_node, level + delta,
|
|
3323
|
+
try tree.dumpNode(field_node, level + delta, term);
|
|
3295
3324
|
|
|
3296
3325
|
if (field_node.get(tree) != .record_field) continue;
|
|
3297
3326
|
if (fields.len == 0) continue;
|
|
@@ -3301,32 +3330,32 @@ fn dumpNode(
|
|
|
3301
3330
|
|
|
3302
3331
|
if (field_attributes.len == 0) continue;
|
|
3303
3332
|
|
|
3304
|
-
try
|
|
3333
|
+
try term.setColor(ATTRIBUTE);
|
|
3305
3334
|
try tree.dumpFieldAttributes(field_attributes, level + delta + half, w);
|
|
3306
|
-
try
|
|
3335
|
+
try term.setColor(.reset);
|
|
3307
3336
|
}
|
|
3308
3337
|
},
|
|
3309
3338
|
.array_init_expr, .struct_init_expr => |init| {
|
|
3310
3339
|
for (init.items, 0..) |item, i| {
|
|
3311
3340
|
if (i != 0) try w.writeByte('\n');
|
|
3312
|
-
try tree.dumpNode(item, level + delta,
|
|
3341
|
+
try tree.dumpNode(item, level + delta, term);
|
|
3313
3342
|
}
|
|
3314
3343
|
},
|
|
3315
3344
|
.union_init_expr => |init| {
|
|
3316
3345
|
try w.splatByteAll(' ', level + half);
|
|
3317
3346
|
try w.writeAll("field index: ");
|
|
3318
|
-
try
|
|
3347
|
+
try term.setColor(LITERAL);
|
|
3319
3348
|
try w.print("{d}\n", .{init.field_index});
|
|
3320
|
-
try
|
|
3349
|
+
try term.setColor(.reset);
|
|
3321
3350
|
if (init.initializer) |some| {
|
|
3322
|
-
try tree.dumpNode(some, level + delta,
|
|
3351
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3323
3352
|
}
|
|
3324
3353
|
},
|
|
3325
3354
|
.compound_literal_expr => |literal| {
|
|
3326
3355
|
if (literal.storage_class != .auto or literal.thread_local) {
|
|
3327
3356
|
try w.splatByteAll(' ', level + half - 1);
|
|
3328
3357
|
|
|
3329
|
-
try
|
|
3358
|
+
try term.setColor(ATTRIBUTE);
|
|
3330
3359
|
switch (literal.storage_class) {
|
|
3331
3360
|
.auto => {},
|
|
3332
3361
|
.static => try w.writeAll(" static"),
|
|
@@ -3334,137 +3363,138 @@ fn dumpNode(
|
|
|
3334
3363
|
}
|
|
3335
3364
|
if (literal.thread_local) try w.writeAll(" thread_local");
|
|
3336
3365
|
try w.writeByte('\n');
|
|
3337
|
-
try
|
|
3366
|
+
try term.setColor(.reset);
|
|
3338
3367
|
}
|
|
3339
3368
|
|
|
3340
|
-
try tree.dumpNode(literal.initializer, level + half,
|
|
3369
|
+
try tree.dumpNode(literal.initializer, level + half, term);
|
|
3341
3370
|
},
|
|
3342
3371
|
.labeled_stmt => |labeled| {
|
|
3343
3372
|
try w.splatByteAll(' ', level + half);
|
|
3344
3373
|
try w.writeAll("label: ");
|
|
3345
|
-
try
|
|
3374
|
+
try term.setColor(LITERAL);
|
|
3346
3375
|
try w.print("{s}\n", .{tree.tokSlice(labeled.label_tok)});
|
|
3347
3376
|
|
|
3348
|
-
try
|
|
3377
|
+
try term.setColor(.reset);
|
|
3349
3378
|
try w.splatByteAll(' ', level + half);
|
|
3350
3379
|
try w.writeAll("stmt:\n");
|
|
3351
|
-
try tree.dumpNode(labeled.body, level + delta,
|
|
3380
|
+
try tree.dumpNode(labeled.body, level + delta, term);
|
|
3352
3381
|
},
|
|
3353
3382
|
.case_stmt => |case| {
|
|
3354
3383
|
try w.splatByteAll(' ', level + half);
|
|
3355
3384
|
|
|
3356
3385
|
if (case.end) |some| {
|
|
3357
3386
|
try w.writeAll("range start:\n");
|
|
3358
|
-
try tree.dumpNode(case.start, level + delta,
|
|
3387
|
+
try tree.dumpNode(case.start, level + delta, term);
|
|
3359
3388
|
|
|
3360
3389
|
try w.splatByteAll(' ', level + half);
|
|
3361
3390
|
try w.writeAll("range end:\n");
|
|
3362
|
-
try tree.dumpNode(some, level + delta,
|
|
3391
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3363
3392
|
} else {
|
|
3364
3393
|
try w.writeAll("value:\n");
|
|
3365
|
-
try tree.dumpNode(case.start, level + delta,
|
|
3394
|
+
try tree.dumpNode(case.start, level + delta, term);
|
|
3366
3395
|
}
|
|
3367
3396
|
|
|
3368
3397
|
try w.splatByteAll(' ', level + half);
|
|
3369
3398
|
try w.writeAll("stmt:\n");
|
|
3370
|
-
try tree.dumpNode(case.body, level + delta,
|
|
3399
|
+
try tree.dumpNode(case.body, level + delta, term);
|
|
3371
3400
|
},
|
|
3372
3401
|
.default_stmt => |default| {
|
|
3373
3402
|
try w.splatByteAll(' ', level + half);
|
|
3374
3403
|
try w.writeAll("stmt:\n");
|
|
3375
|
-
try tree.dumpNode(default.body, level + delta,
|
|
3404
|
+
try tree.dumpNode(default.body, level + delta, term);
|
|
3376
3405
|
},
|
|
3377
3406
|
.binary_cond_expr, .cond_expr, .builtin_choose_expr => |conditional| {
|
|
3378
3407
|
try w.splatByteAll(' ', level + half);
|
|
3379
3408
|
try w.writeAll("cond:\n");
|
|
3380
|
-
try tree.dumpNode(conditional.cond, level + delta,
|
|
3409
|
+
try tree.dumpNode(conditional.cond, level + delta, term);
|
|
3381
3410
|
|
|
3382
3411
|
try w.splatByteAll(' ', level + half);
|
|
3383
3412
|
try w.writeAll("then:\n");
|
|
3384
|
-
try tree.dumpNode(conditional.then_expr, level + delta,
|
|
3413
|
+
try tree.dumpNode(conditional.then_expr, level + delta, term);
|
|
3385
3414
|
|
|
3386
3415
|
try w.splatByteAll(' ', level + half);
|
|
3387
3416
|
try w.writeAll("else:\n");
|
|
3388
|
-
try tree.dumpNode(conditional.else_expr, level + delta,
|
|
3417
|
+
try tree.dumpNode(conditional.else_expr, level + delta, term);
|
|
3389
3418
|
},
|
|
3390
3419
|
.builtin_types_compatible_p => |call| {
|
|
3391
3420
|
try w.splatByteAll(' ', level + half);
|
|
3392
3421
|
try w.writeAll("lhs: ");
|
|
3393
|
-
try
|
|
3422
|
+
try term.setColor(TYPE);
|
|
3394
3423
|
try call.lhs.dump(tree.comp, w);
|
|
3395
3424
|
try w.writeByte('\n');
|
|
3396
|
-
try
|
|
3425
|
+
try term.setColor(.reset);
|
|
3397
3426
|
|
|
3398
3427
|
try w.splatByteAll(' ', level + half);
|
|
3399
3428
|
try w.writeAll("rhs: ");
|
|
3400
|
-
try
|
|
3429
|
+
try term.setColor(TYPE);
|
|
3401
3430
|
try call.rhs.dump(tree.comp, w);
|
|
3402
3431
|
try w.writeByte('\n');
|
|
3403
|
-
try
|
|
3432
|
+
try term.setColor(.reset);
|
|
3404
3433
|
},
|
|
3405
3434
|
.builtin_convertvector => |convert| {
|
|
3406
3435
|
try w.splatByteAll(' ', level + half);
|
|
3407
3436
|
try w.writeAll("operand:\n");
|
|
3408
|
-
try tree.dumpNode(convert.operand, level + delta,
|
|
3437
|
+
try tree.dumpNode(convert.operand, level + delta, term);
|
|
3409
3438
|
},
|
|
3410
3439
|
.builtin_shufflevector => |shuffle| {
|
|
3411
3440
|
try w.splatByteAll(' ', level + half);
|
|
3412
3441
|
try w.writeAll("lhs:\n");
|
|
3413
|
-
try tree.dumpNode(shuffle.lhs, level + delta,
|
|
3442
|
+
try tree.dumpNode(shuffle.lhs, level + delta, term);
|
|
3414
3443
|
|
|
3415
3444
|
try w.splatByteAll(' ', level + half);
|
|
3416
3445
|
try w.writeAll("rhs:\n");
|
|
3417
|
-
try tree.dumpNode(shuffle.rhs, level + delta,
|
|
3446
|
+
try tree.dumpNode(shuffle.rhs, level + delta, term);
|
|
3418
3447
|
|
|
3419
3448
|
if (shuffle.indexes.len > 0) {
|
|
3420
3449
|
try w.splatByteAll(' ', level + half);
|
|
3421
3450
|
try w.writeAll("indexes:\n");
|
|
3422
3451
|
for (shuffle.indexes) |index| {
|
|
3423
|
-
try tree.dumpNode(index, level + delta,
|
|
3452
|
+
try tree.dumpNode(index, level + delta, term);
|
|
3424
3453
|
}
|
|
3425
3454
|
}
|
|
3426
3455
|
},
|
|
3456
|
+
.builtin_va_arg_pack, .builtin_va_arg_pack_len => {},
|
|
3427
3457
|
.if_stmt => |@"if"| {
|
|
3428
3458
|
try w.splatByteAll(' ', level + half);
|
|
3429
3459
|
try w.writeAll("cond:\n");
|
|
3430
|
-
try tree.dumpNode(@"if".cond, level + delta,
|
|
3460
|
+
try tree.dumpNode(@"if".cond, level + delta, term);
|
|
3431
3461
|
|
|
3432
3462
|
try w.splatByteAll(' ', level + half);
|
|
3433
3463
|
try w.writeAll("then:\n");
|
|
3434
|
-
try tree.dumpNode(@"if".then_body, level + delta,
|
|
3464
|
+
try tree.dumpNode(@"if".then_body, level + delta, term);
|
|
3435
3465
|
|
|
3436
3466
|
if (@"if".else_body) |some| {
|
|
3437
3467
|
try w.splatByteAll(' ', level + half);
|
|
3438
3468
|
try w.writeAll("else:\n");
|
|
3439
|
-
try tree.dumpNode(some, level + delta,
|
|
3469
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3440
3470
|
}
|
|
3441
3471
|
},
|
|
3442
3472
|
.switch_stmt => |@"switch"| {
|
|
3443
3473
|
try w.splatByteAll(' ', level + half);
|
|
3444
3474
|
try w.writeAll("cond:\n");
|
|
3445
|
-
try tree.dumpNode(@"switch".cond, level + delta,
|
|
3475
|
+
try tree.dumpNode(@"switch".cond, level + delta, term);
|
|
3446
3476
|
|
|
3447
3477
|
try w.splatByteAll(' ', level + half);
|
|
3448
3478
|
try w.writeAll("body:\n");
|
|
3449
|
-
try tree.dumpNode(@"switch".body, level + delta,
|
|
3479
|
+
try tree.dumpNode(@"switch".body, level + delta, term);
|
|
3450
3480
|
},
|
|
3451
3481
|
.while_stmt => |@"while"| {
|
|
3452
3482
|
try w.splatByteAll(' ', level + half);
|
|
3453
3483
|
try w.writeAll("cond:\n");
|
|
3454
|
-
try tree.dumpNode(@"while".cond, level + delta,
|
|
3484
|
+
try tree.dumpNode(@"while".cond, level + delta, term);
|
|
3455
3485
|
|
|
3456
3486
|
try w.splatByteAll(' ', level + half);
|
|
3457
3487
|
try w.writeAll("body:\n");
|
|
3458
|
-
try tree.dumpNode(@"while".body, level + delta,
|
|
3488
|
+
try tree.dumpNode(@"while".body, level + delta, term);
|
|
3459
3489
|
},
|
|
3460
3490
|
.do_while_stmt => |do| {
|
|
3461
3491
|
try w.splatByteAll(' ', level + half);
|
|
3462
3492
|
try w.writeAll("cond:\n");
|
|
3463
|
-
try tree.dumpNode(do.cond, level + delta,
|
|
3493
|
+
try tree.dumpNode(do.cond, level + delta, term);
|
|
3464
3494
|
|
|
3465
3495
|
try w.splatByteAll(' ', level + half);
|
|
3466
3496
|
try w.writeAll("body:\n");
|
|
3467
|
-
try tree.dumpNode(do.body, level + delta,
|
|
3497
|
+
try tree.dumpNode(do.body, level + delta, term);
|
|
3468
3498
|
},
|
|
3469
3499
|
.for_stmt => |@"for"| {
|
|
3470
3500
|
switch (@"for".init) {
|
|
@@ -3472,48 +3502,48 @@ fn dumpNode(
|
|
|
3472
3502
|
try w.splatByteAll(' ', level + half);
|
|
3473
3503
|
try w.writeAll("decl:\n");
|
|
3474
3504
|
for (decls) |decl| {
|
|
3475
|
-
try tree.dumpNode(decl, level + delta,
|
|
3505
|
+
try tree.dumpNode(decl, level + delta, term);
|
|
3476
3506
|
try w.writeByte('\n');
|
|
3477
3507
|
}
|
|
3478
3508
|
},
|
|
3479
3509
|
.expr => |expr| if (expr) |some| {
|
|
3480
3510
|
try w.splatByteAll(' ', level + half);
|
|
3481
3511
|
try w.writeAll("init:\n");
|
|
3482
|
-
try tree.dumpNode(some, level + delta,
|
|
3512
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3483
3513
|
},
|
|
3484
3514
|
}
|
|
3485
3515
|
if (@"for".cond) |some| {
|
|
3486
3516
|
try w.splatByteAll(' ', level + half);
|
|
3487
3517
|
try w.writeAll("cond:\n");
|
|
3488
|
-
try tree.dumpNode(some, level + delta,
|
|
3518
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3489
3519
|
}
|
|
3490
3520
|
if (@"for".incr) |some| {
|
|
3491
3521
|
try w.splatByteAll(' ', level + half);
|
|
3492
3522
|
try w.writeAll("incr:\n");
|
|
3493
|
-
try tree.dumpNode(some, level + delta,
|
|
3523
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3494
3524
|
}
|
|
3495
3525
|
try w.splatByteAll(' ', level + half);
|
|
3496
3526
|
try w.writeAll("body:\n");
|
|
3497
|
-
try tree.dumpNode(@"for".body, level + delta,
|
|
3527
|
+
try tree.dumpNode(@"for".body, level + delta, term);
|
|
3498
3528
|
},
|
|
3499
3529
|
.addr_of_label => |addr| {
|
|
3500
3530
|
try w.splatByteAll(' ', level + half);
|
|
3501
3531
|
try w.writeAll("label: ");
|
|
3502
|
-
try
|
|
3532
|
+
try term.setColor(LITERAL);
|
|
3503
3533
|
try w.print("{s}\n", .{tree.tokSlice(addr.label_tok)});
|
|
3504
|
-
try
|
|
3534
|
+
try term.setColor(.reset);
|
|
3505
3535
|
},
|
|
3506
3536
|
.goto_stmt => |goto| {
|
|
3507
3537
|
try w.splatByteAll(' ', level + half);
|
|
3508
3538
|
try w.writeAll("label: ");
|
|
3509
|
-
try
|
|
3539
|
+
try term.setColor(LITERAL);
|
|
3510
3540
|
try w.print("{s}\n", .{tree.tokSlice(goto.label_tok)});
|
|
3511
|
-
try
|
|
3541
|
+
try term.setColor(.reset);
|
|
3512
3542
|
},
|
|
3513
3543
|
.computed_goto_stmt => |goto| {
|
|
3514
3544
|
try w.splatByteAll(' ', level + half);
|
|
3515
3545
|
try w.writeAll("expr:\n");
|
|
3516
|
-
try tree.dumpNode(goto.expr, level + delta,
|
|
3546
|
+
try tree.dumpNode(goto.expr, level + delta, term);
|
|
3517
3547
|
},
|
|
3518
3548
|
.continue_stmt, .break_stmt, .null_stmt => {},
|
|
3519
3549
|
.return_stmt => |ret| {
|
|
@@ -3521,43 +3551,43 @@ fn dumpNode(
|
|
|
3521
3551
|
.expr => |expr| {
|
|
3522
3552
|
try w.splatByteAll(' ', level + half);
|
|
3523
3553
|
try w.writeAll("expr:\n");
|
|
3524
|
-
try tree.dumpNode(expr, level + delta,
|
|
3554
|
+
try tree.dumpNode(expr, level + delta, term);
|
|
3525
3555
|
},
|
|
3526
3556
|
.implicit => {},
|
|
3527
3557
|
.none => {},
|
|
3528
3558
|
}
|
|
3529
3559
|
},
|
|
3530
3560
|
.asm_stmt => |@"asm"| {
|
|
3531
|
-
try tree.dumpNode(@"asm".asm_str, level + delta,
|
|
3561
|
+
try tree.dumpNode(@"asm".asm_str, level + delta, term);
|
|
3532
3562
|
|
|
3533
3563
|
const write_operand = struct {
|
|
3534
3564
|
fn write_operand(
|
|
3535
|
-
_w: *std.Io.Writer,
|
|
3536
3565
|
_level: u32,
|
|
3537
|
-
|
|
3566
|
+
_term: std.Io.Terminal,
|
|
3538
3567
|
_tree: *const Tree,
|
|
3539
3568
|
operands: []const Node.AsmStmt.Operand,
|
|
3540
|
-
) std.Io.
|
|
3569
|
+
) std.Io.Terminal.SetColorError!void {
|
|
3570
|
+
const _w = _term.writer;
|
|
3541
3571
|
for (operands) |operand| {
|
|
3542
3572
|
if (operand.name != 0) {
|
|
3543
3573
|
try _w.splatByteAll(' ', _level + delta);
|
|
3544
3574
|
try _w.writeAll("asm name: ");
|
|
3545
|
-
try
|
|
3575
|
+
try _term.setColor(NAME);
|
|
3546
3576
|
try _w.writeAll(_tree.tokSlice(operand.name));
|
|
3547
3577
|
try _w.writeByte('\n');
|
|
3548
|
-
try
|
|
3578
|
+
try _term.setColor(.reset);
|
|
3549
3579
|
}
|
|
3550
3580
|
|
|
3551
3581
|
try _w.splatByteAll(' ', _level + delta);
|
|
3552
3582
|
try _w.writeAll("constraint: ");
|
|
3553
3583
|
const constraint_val = _tree.value_map.get(operand.constraint).?;
|
|
3554
|
-
try
|
|
3584
|
+
try _term.setColor(LITERAL);
|
|
3555
3585
|
_ = try constraint_val.print(operand.constraint.qt(_tree), _tree.comp, _w);
|
|
3556
3586
|
try _w.writeByte('\n');
|
|
3557
3587
|
|
|
3558
|
-
try _tree.dumpNode(operand.expr, _level + delta,
|
|
3588
|
+
try _tree.dumpNode(operand.expr, _level + delta, _term);
|
|
3559
3589
|
}
|
|
3560
|
-
try
|
|
3590
|
+
try _term.setColor(.reset);
|
|
3561
3591
|
}
|
|
3562
3592
|
}.write_operand;
|
|
3563
3593
|
|
|
@@ -3565,18 +3595,18 @@ fn dumpNode(
|
|
|
3565
3595
|
try w.splatByteAll(' ', level + half);
|
|
3566
3596
|
try w.writeAll("ouputs:\n");
|
|
3567
3597
|
|
|
3568
|
-
try write_operand(
|
|
3598
|
+
try write_operand(level, term, tree, @"asm".outputs);
|
|
3569
3599
|
}
|
|
3570
3600
|
if (@"asm".inputs.len > 0) {
|
|
3571
3601
|
try w.splatByteAll(' ', level + half);
|
|
3572
3602
|
try w.writeAll("inputs:\n");
|
|
3573
3603
|
|
|
3574
|
-
try write_operand(
|
|
3604
|
+
try write_operand(level, term, tree, @"asm".inputs);
|
|
3575
3605
|
}
|
|
3576
3606
|
if (@"asm".clobbers.len > 0) {
|
|
3577
3607
|
try w.splatByteAll(' ', level + half);
|
|
3578
3608
|
try w.writeAll("clobbers:\n");
|
|
3579
|
-
try
|
|
3609
|
+
try term.setColor(LITERAL);
|
|
3580
3610
|
for (@"asm".clobbers) |clobber| {
|
|
3581
3611
|
const clobber_val = tree.value_map.get(clobber).?;
|
|
3582
3612
|
|
|
@@ -3584,41 +3614,41 @@ fn dumpNode(
|
|
|
3584
3614
|
_ = try clobber_val.print(clobber.qt(tree), tree.comp, w);
|
|
3585
3615
|
try w.writeByte('\n');
|
|
3586
3616
|
}
|
|
3587
|
-
try
|
|
3617
|
+
try term.setColor(.reset);
|
|
3588
3618
|
}
|
|
3589
3619
|
if (@"asm".labels.len > 0) {
|
|
3590
3620
|
try w.splatByteAll(' ', level + half);
|
|
3591
3621
|
try w.writeAll("labels:\n");
|
|
3592
3622
|
for (@"asm".labels) |label| {
|
|
3593
|
-
try tree.dumpNode(label, level + delta,
|
|
3623
|
+
try tree.dumpNode(label, level + delta, term);
|
|
3594
3624
|
}
|
|
3595
3625
|
}
|
|
3596
3626
|
},
|
|
3597
3627
|
.call_expr => |call| {
|
|
3598
3628
|
try w.splatByteAll(' ', level + half);
|
|
3599
3629
|
try w.writeAll("callee:\n");
|
|
3600
|
-
try tree.dumpNode(call.callee, level + delta,
|
|
3630
|
+
try tree.dumpNode(call.callee, level + delta, term);
|
|
3601
3631
|
|
|
3602
3632
|
if (call.args.len > 0) {
|
|
3603
3633
|
try w.splatByteAll(' ', level + half);
|
|
3604
3634
|
try w.writeAll("args:\n");
|
|
3605
3635
|
for (call.args) |arg| {
|
|
3606
|
-
try tree.dumpNode(arg, level + delta,
|
|
3636
|
+
try tree.dumpNode(arg, level + delta, term);
|
|
3607
3637
|
}
|
|
3608
3638
|
}
|
|
3609
3639
|
},
|
|
3610
3640
|
.builtin_call_expr => |call| {
|
|
3611
3641
|
try w.splatByteAll(' ', level + half);
|
|
3612
3642
|
try w.writeAll("name: ");
|
|
3613
|
-
try
|
|
3643
|
+
try term.setColor(NAME);
|
|
3614
3644
|
try w.print("{s}\n", .{tree.tokSlice(call.builtin_tok)});
|
|
3615
|
-
try
|
|
3645
|
+
try term.setColor(.reset);
|
|
3616
3646
|
|
|
3617
3647
|
if (call.args.len > 0) {
|
|
3618
3648
|
try w.splatByteAll(' ', level + half);
|
|
3619
3649
|
try w.writeAll("args:\n");
|
|
3620
3650
|
for (call.args) |arg| {
|
|
3621
|
-
try tree.dumpNode(arg, level + delta,
|
|
3651
|
+
try tree.dumpNode(arg, level + delta, term);
|
|
3622
3652
|
}
|
|
3623
3653
|
}
|
|
3624
3654
|
},
|
|
@@ -3655,13 +3685,13 @@ fn dumpNode(
|
|
|
3655
3685
|
=> |bin| {
|
|
3656
3686
|
try w.splatByteAll(' ', level + 1);
|
|
3657
3687
|
try w.writeAll("lhs:\n");
|
|
3658
|
-
try tree.dumpNode(bin.lhs, level + delta,
|
|
3688
|
+
try tree.dumpNode(bin.lhs, level + delta, term);
|
|
3659
3689
|
|
|
3660
3690
|
try w.splatByteAll(' ', level + 1);
|
|
3661
3691
|
try w.writeAll("rhs:\n");
|
|
3662
|
-
try tree.dumpNode(bin.rhs, level + delta,
|
|
3692
|
+
try tree.dumpNode(bin.rhs, level + delta, term);
|
|
3663
3693
|
},
|
|
3664
|
-
.cast => |cast| try tree.dumpNode(cast.operand, level + delta,
|
|
3694
|
+
.cast => |cast| try tree.dumpNode(cast.operand, level + delta, term),
|
|
3665
3695
|
.addr_of_expr,
|
|
3666
3696
|
.deref_expr,
|
|
3667
3697
|
.plus_expr,
|
|
@@ -3680,21 +3710,21 @@ fn dumpNode(
|
|
|
3680
3710
|
=> |un| {
|
|
3681
3711
|
try w.splatByteAll(' ', level + 1);
|
|
3682
3712
|
try w.writeAll("operand:\n");
|
|
3683
|
-
try tree.dumpNode(un.operand, level + delta,
|
|
3713
|
+
try tree.dumpNode(un.operand, level + delta, term);
|
|
3684
3714
|
},
|
|
3685
3715
|
.decl_ref_expr, .enumeration_ref => |dr| {
|
|
3686
3716
|
try w.splatByteAll(' ', level + 1);
|
|
3687
3717
|
try w.writeAll("name: ");
|
|
3688
|
-
try
|
|
3718
|
+
try term.setColor(NAME);
|
|
3689
3719
|
try w.print("{s}\n", .{tree.tokSlice(dr.name_tok)});
|
|
3690
|
-
try
|
|
3720
|
+
try term.setColor(.reset);
|
|
3691
3721
|
},
|
|
3692
3722
|
.builtin_ref => |dr| {
|
|
3693
3723
|
try w.splatByteAll(' ', level + 1);
|
|
3694
3724
|
try w.writeAll("name: ");
|
|
3695
|
-
try
|
|
3725
|
+
try term.setColor(NAME);
|
|
3696
3726
|
try w.print("{s}\n", .{tree.tokSlice(dr.name_tok)});
|
|
3697
|
-
try
|
|
3727
|
+
try term.setColor(.reset);
|
|
3698
3728
|
},
|
|
3699
3729
|
.bool_literal,
|
|
3700
3730
|
.nullptr_literal,
|
|
@@ -3706,7 +3736,7 @@ fn dumpNode(
|
|
|
3706
3736
|
.member_access_expr, .member_access_ptr_expr => |access| {
|
|
3707
3737
|
try w.splatByteAll(' ', level + 1);
|
|
3708
3738
|
try w.writeAll("lhs:\n");
|
|
3709
|
-
try tree.dumpNode(access.base, level + delta,
|
|
3739
|
+
try tree.dumpNode(access.base, level + delta, term);
|
|
3710
3740
|
|
|
3711
3741
|
var base_qt = access.base.qt(tree);
|
|
3712
3742
|
if (base_qt.get(tree.comp, .pointer)) |some| base_qt = some.child;
|
|
@@ -3714,61 +3744,61 @@ fn dumpNode(
|
|
|
3714
3744
|
|
|
3715
3745
|
try w.splatByteAll(' ', level + 1);
|
|
3716
3746
|
try w.writeAll("name: ");
|
|
3717
|
-
try
|
|
3747
|
+
try term.setColor(NAME);
|
|
3718
3748
|
try w.print("{s}\n", .{fields[access.member_index].name.lookup(tree.comp)});
|
|
3719
|
-
try
|
|
3749
|
+
try term.setColor(.reset);
|
|
3720
3750
|
},
|
|
3721
3751
|
.array_access_expr => |access| {
|
|
3722
3752
|
try w.splatByteAll(' ', level + 1);
|
|
3723
3753
|
try w.writeAll("base:\n");
|
|
3724
|
-
try tree.dumpNode(access.base, level + delta,
|
|
3754
|
+
try tree.dumpNode(access.base, level + delta, term);
|
|
3725
3755
|
|
|
3726
3756
|
try w.splatByteAll(' ', level + 1);
|
|
3727
3757
|
try w.writeAll("index:\n");
|
|
3728
|
-
try tree.dumpNode(access.index, level + delta,
|
|
3758
|
+
try tree.dumpNode(access.index, level + delta, term);
|
|
3729
3759
|
},
|
|
3730
3760
|
.sizeof_expr, .alignof_expr => |type_info| {
|
|
3731
3761
|
if (type_info.expr) |some| {
|
|
3732
3762
|
try w.splatByteAll(' ', level + 1);
|
|
3733
3763
|
try w.writeAll("expr:\n");
|
|
3734
|
-
try tree.dumpNode(some, level + delta,
|
|
3764
|
+
try tree.dumpNode(some, level + delta, term);
|
|
3735
3765
|
} else {
|
|
3736
3766
|
try w.splatByteAll(' ', level + half);
|
|
3737
3767
|
try w.writeAll("operand type: ");
|
|
3738
|
-
try
|
|
3768
|
+
try term.setColor(TYPE);
|
|
3739
3769
|
try type_info.operand_qt.dump(tree.comp, w);
|
|
3740
3770
|
try w.writeByte('\n');
|
|
3741
|
-
try
|
|
3771
|
+
try term.setColor(.reset);
|
|
3742
3772
|
}
|
|
3743
3773
|
},
|
|
3744
3774
|
.generic_expr => |generic| {
|
|
3745
3775
|
try w.splatByteAll(' ', level + 1);
|
|
3746
3776
|
try w.writeAll("controlling:\n");
|
|
3747
|
-
try tree.dumpNode(generic.controlling, level + delta,
|
|
3777
|
+
try tree.dumpNode(generic.controlling, level + delta, term);
|
|
3748
3778
|
try w.splatByteAll(' ', level + 1);
|
|
3749
3779
|
try w.writeAll("chosen:\n");
|
|
3750
|
-
try tree.dumpNode(generic.chosen, level + delta,
|
|
3780
|
+
try tree.dumpNode(generic.chosen, level + delta, term);
|
|
3751
3781
|
|
|
3752
3782
|
if (generic.rest.len > 0) {
|
|
3753
3783
|
try w.splatByteAll(' ', level + 1);
|
|
3754
3784
|
try w.writeAll("rest:\n");
|
|
3755
3785
|
for (generic.rest) |expr| {
|
|
3756
|
-
try tree.dumpNode(expr, level + delta,
|
|
3786
|
+
try tree.dumpNode(expr, level + delta, term);
|
|
3757
3787
|
}
|
|
3758
3788
|
}
|
|
3759
3789
|
},
|
|
3760
3790
|
.generic_association_expr => |assoc| {
|
|
3761
|
-
try tree.dumpNode(assoc.expr, level + delta,
|
|
3791
|
+
try tree.dumpNode(assoc.expr, level + delta, term);
|
|
3762
3792
|
},
|
|
3763
3793
|
.generic_default_expr => |default| {
|
|
3764
|
-
try tree.dumpNode(default.expr, level + delta,
|
|
3794
|
+
try tree.dumpNode(default.expr, level + delta, term);
|
|
3765
3795
|
},
|
|
3766
3796
|
.array_filler_expr => |filler| {
|
|
3767
3797
|
try w.splatByteAll(' ', level + 1);
|
|
3768
3798
|
try w.writeAll("count: ");
|
|
3769
|
-
try
|
|
3799
|
+
try term.setColor(LITERAL);
|
|
3770
3800
|
try w.print("{d}\n", .{filler.count});
|
|
3771
|
-
try
|
|
3801
|
+
try term.setColor(.reset);
|
|
3772
3802
|
},
|
|
3773
3803
|
.struct_forward_decl,
|
|
3774
3804
|
.union_forward_decl,
|