stage2: fix tokenizer float bug
This commit is contained in:
parent
6ab0ac161e
commit
1174cb1517
@ -1175,6 +1175,7 @@ pub const Tokenizer = struct {
|
|||||||
},
|
},
|
||||||
.num_dot_dec => switch (c) {
|
.num_dot_dec => switch (c) {
|
||||||
'.' => {
|
'.' => {
|
||||||
|
result.id = .IntegerLiteral;
|
||||||
self.index -= 1;
|
self.index -= 1;
|
||||||
state = .start;
|
state = .start;
|
||||||
break;
|
break;
|
||||||
@ -1183,7 +1184,6 @@ pub const Tokenizer = struct {
|
|||||||
state = .float_exponent_unsigned;
|
state = .float_exponent_unsigned;
|
||||||
},
|
},
|
||||||
'0'...'9' => {
|
'0'...'9' => {
|
||||||
result.id = .FloatLiteral;
|
|
||||||
state = .float_fraction_dec;
|
state = .float_fraction_dec;
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
@ -1769,6 +1769,7 @@ test "tokenizer - number literals decimal" {
|
|||||||
testTokenize("7", &[_]Token.Id{.IntegerLiteral});
|
testTokenize("7", &[_]Token.Id{.IntegerLiteral});
|
||||||
testTokenize("8", &[_]Token.Id{.IntegerLiteral});
|
testTokenize("8", &[_]Token.Id{.IntegerLiteral});
|
||||||
testTokenize("9", &[_]Token.Id{.IntegerLiteral});
|
testTokenize("9", &[_]Token.Id{.IntegerLiteral});
|
||||||
|
testTokenize("1..", &[_]Token.Id{ .IntegerLiteral, .Ellipsis2 });
|
||||||
testTokenize("0a", &[_]Token.Id{ .Invalid, .Identifier });
|
testTokenize("0a", &[_]Token.Id{ .Invalid, .Identifier });
|
||||||
testTokenize("9b", &[_]Token.Id{ .Invalid, .Identifier });
|
testTokenize("9b", &[_]Token.Id{ .Invalid, .Identifier });
|
||||||
testTokenize("1z", &[_]Token.Id{ .Invalid, .Identifier });
|
testTokenize("1z", &[_]Token.Id{ .Invalid, .Identifier });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user