Format line number table attribute
This commit is contained in:
parent
41aad5e7b8
commit
5c816759bb
1 changed files with 27 additions and 1 deletions
|
|
@ -397,7 +397,20 @@ pub const AttributeInfo = union(enum) {
|
|||
try w.splatByteAll(' ', depth * indent);
|
||||
try w.print("debug_extension: {s}\n", .{ attr.debug_extension });
|
||||
},
|
||||
//.line_number_table,
|
||||
.line_number_table => |attr| {
|
||||
try w.splatByteAll(' ', depth * indent);
|
||||
_ = try w.write("line_number_table:\n");
|
||||
var line_number_indent = indent;
|
||||
for (attr.line_number_table, 0..) |*line_number, i| {
|
||||
line_number_indent += 1;
|
||||
defer line_number_indent -= 1;
|
||||
|
||||
try w.splatByteAll(' ', depth * line_number_indent);
|
||||
try w.print("{d}:\n", .{ i });
|
||||
|
||||
try line_number.indentedFormat(w, depth, line_number_indent + 1);
|
||||
}
|
||||
},
|
||||
//.local_variable_table,
|
||||
//.local_variable_type_table,
|
||||
.deprecated => {},
|
||||
|
|
@ -1068,6 +1081,19 @@ pub const LineNumberTable = struct {
|
|||
pub const LineNumber = struct {
|
||||
start_pc: u16,
|
||||
line_number: u16,
|
||||
|
||||
pub fn indentedFormat(
|
||||
self: *const LineNumber,
|
||||
w: *std.Io.Writer,
|
||||
depth: usize,
|
||||
indent: u8,
|
||||
) std.Io.Writer.Error!void {
|
||||
try w.splatByteAll(' ', depth * indent);
|
||||
try w.print("start_pc: {d}\n", .{ self.start_pc });
|
||||
|
||||
try w.splatByteAll(' ', depth * indent);
|
||||
try w.print("line_number: {d}\n", .{ self.line_number });
|
||||
}
|
||||
};
|
||||
|
||||
pub fn parse(input: *std.Io.Reader, allocator: std.mem.Allocator) ParseError!Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue