make parsing 0.0_e1
an error
This commit is contained in:
parent
7aac21c6f5
commit
925f710852
@ -1229,6 +1229,10 @@ void tokenize(Buf *buf, Tokenization *out) {
|
||||
break;
|
||||
}
|
||||
if (is_exponent_signifier(c, t.radix)) {
|
||||
if (t.is_trailing_underscore) {
|
||||
invalid_char_error(&t, c);
|
||||
break;
|
||||
}
|
||||
if (t.radix != 16 && t.radix != 10) {
|
||||
invalid_char_error(&t, c);
|
||||
}
|
||||
@ -1296,6 +1300,10 @@ void tokenize(Buf *buf, Tokenization *out) {
|
||||
break;
|
||||
}
|
||||
if (is_exponent_signifier(c, t.radix)) {
|
||||
if (t.is_trailing_underscore) {
|
||||
invalid_char_error(&t, c);
|
||||
break;
|
||||
}
|
||||
t.state = TokenizeStateFloatExponentUnsigned;
|
||||
t.radix = 10; // exponent is always base 10
|
||||
break;
|
||||
|
@ -485,6 +485,14 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
"tmp.zig:2:23: error: invalid character: '_'",
|
||||
});
|
||||
|
||||
cases.add("invalid underscore placement in float literal - 14",
|
||||
\\fn main() void {
|
||||
\\ var bad: f128 = 0x0.0_p1;
|
||||
\\})
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:2:27: error: invalid character: 'p'",
|
||||
});
|
||||
|
||||
cases.add("var args without c calling conv",
|
||||
\\fn foo(args: ...) void {}
|
||||
\\comptime {
|
||||
|
Loading…
x
Reference in New Issue
Block a user