summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/locations.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/locations.zig b/core/locations.zig
index 10704912..041e9692 100644
--- a/core/locations.zig
+++ b/core/locations.zig
@@ -224,9 +224,12 @@ pub fn parseRows(arena: std.mem.Allocator, text: []const u8) error{ OutOfMemory,
continue :names;
};
if (style & syntax.syn_bits != 0) return error.BadRows;
- const syn: u8 = if (std.meta.stringToEnum(syntax.Syn, name)) |known| @backingInt(known) else std.fmt.parseInt(u4, name, 10) catch return error.BadRows;
- if (syn == 0) return error.BadRows;
- style |= syn;
+ // A kind by its name or its number, one Syn has: the
+ // render takes the style's syntax bits as a Syn.
+ const syn = std.meta.stringToEnum(syntax.Syn, name) orelse
+ std.enums.fromInt(syntax.Syn, std.fmt.parseInt(u8, name, 10) catch return error.BadRows) orelse return error.BadRows;
+ if (syn == .none) return error.BadRows;
+ style |= @backingInt(syn);
}
@memset(row.colors[start..][0..n], style);
}