fn checkFloat(bytes: []const u8) !void bytes: []const u8186
187
188
189
190
191
192
193
194
195
196fn checkFloat(bytes: []const u8) !void {
// Number literals must start with a digit
if (bytes.len == 0 or !std.ascii.isDigit(bytes[0])) return;
switch (parseNumberLiteral(bytes)) {
.float => {
_ = try std.fmt.parseFloat(f128, bytes);
},
else => {},
}
}
Returns an error if
parseNumberLiteralreturns.floatbutparseFloatfails. AstGen relies onparseFloatbeing unable to fail after callingparseNumberLiteral.