authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-08-28 15:56:24+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-09-03 15:05:47+03:00
log1174cb15173208ead5f2ce828ade5b7d07ce6abe
treeebc70cdd6f59c97d100a1302c898564afa9e1d08
parent6ab0ac161e02c2361b72d124423509556b9332fa
signature Commit is signed but in an unrecognized format.

stage2: fix tokenizer float bug


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/zig/tokenizer.zig+2-1
...@@ -1175,6 +1175,7 @@ pub const Tokenizer = struct {...@@ -1175,6 +1175,7 @@ pub const Tokenizer = struct {
1175 },1175 },
1176 .num_dot_dec => switch (c) {1176 .num_dot_dec => switch (c) {
1177 '.' => {1177 '.' => {
1178 result.id = .IntegerLiteral;
1178 self.index -= 1;1179 self.index -= 1;
1179 state = .start;1180 state = .start;
1180 break;1181 break;
...@@ -1183,7 +1184,6 @@ pub const Tokenizer = struct {...@@ -1183,7 +1184,6 @@ pub const Tokenizer = struct {
1183 state = .float_exponent_unsigned;1184 state = .float_exponent_unsigned;
1184 },1185 },
1185 '0'...'9' => {1186 '0'...'9' => {
1186 result.id = .FloatLiteral;
1187 state = .float_fraction_dec;1187 state = .float_fraction_dec;
1188 },1188 },
1189 else => {1189 else => {
...@@ -1769,6 +1769,7 @@ test "tokenizer - number literals decimal" {...@@ -1769,6 +1769,7 @@ test "tokenizer - number literals decimal" {
1769 testTokenize("7", &[_]Token.Id{.IntegerLiteral});1769 testTokenize("7", &[_]Token.Id{.IntegerLiteral});
1770 testTokenize("8", &[_]Token.Id{.IntegerLiteral});1770 testTokenize("8", &[_]Token.Id{.IntegerLiteral});
1771 testTokenize("9", &[_]Token.Id{.IntegerLiteral});1771 testTokenize("9", &[_]Token.Id{.IntegerLiteral});
1772 testTokenize("1..", &[_]Token.Id{ .IntegerLiteral, .Ellipsis2 });
1772 testTokenize("0a", &[_]Token.Id{ .Invalid, .Identifier });1773 testTokenize("0a", &[_]Token.Id{ .Invalid, .Identifier });
1773 testTokenize("9b", &[_]Token.Id{ .Invalid, .Identifier });1774 testTokenize("9b", &[_]Token.Id{ .Invalid, .Identifier });
1774 testTokenize("1z", &[_]Token.Id{ .Invalid, .Identifier });1775 testTokenize("1z", &[_]Token.Id{ .Invalid, .Identifier });