Skip to content

Commit e1bec9f

Browse files
committed
sysgpu/shader: Detect dangling exponent char (eEpP)
1 parent 901bfd7 commit e1bec9f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/sysgpu/shader/AstGen.zig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,21 @@ fn genNumber(astgen: *AstGen, node: NodeIndex) !InstIndex {
14521452
}
14531453
// else is part of a hex literal
14541454
},
1455+
'e', 'E' => {
1456+
if (!is_hex) {
1457+
try astgen.errors.add(node_loc, "incomplete exponent", .{}, null);
1458+
return error.AnalysisFail;
1459+
} // else part of a hex literal
1460+
},
1461+
'p', 'P' => |c| {
1462+
if (!is_hex) {
1463+
try astgen.errors.add(node_loc, "hexadecimal exponent '{c}' in decimal float", .{c}, null);
1464+
return error.AnalysisFail;
1465+
}
1466+
// TODO
1467+
try astgen.errors.add(node_loc, "hexadecimal float literals not implemented", .{}, null);
1468+
return error.AnalysisFail;
1469+
},
14551470
'.' => has_dot = true,
14561471
else => {},
14571472
}

0 commit comments

Comments
 (0)