std.zig.tokinizer now treats string identifiers as identifiers

master
Jimmi Holst Christensen 2018-04-10 15:01:21 +02:00
parent 3b80e66507
commit aa09e7b639
2 changed files with 10 additions and 3 deletions

View File

@ -5041,3 +5041,11 @@ test "zig fmt: use" {
\\
);
}
test "zig fmt: string identifier" {
try testCanonical(
\\const @"a b" = @"c d".@"e f";
\\fn @"g h"() void {}
\\
);
}

View File

@ -78,7 +78,6 @@ pub const Token = struct {
StringLiteral: StrLitKind,
MultilineStringLiteralLine: StrLitKind,
CharLiteral,
StringIdentifier,
Eof,
Builtin,
Bang,
@ -434,7 +433,7 @@ pub const Tokenizer = struct {
State.SawAtSign => switch (c) {
'"' => {
result.id = Token.Id.StringIdentifier;
result.id = Token.Id.Identifier;
state = State.StringLiteral;
},
else => {
@ -1136,7 +1135,7 @@ test "tokenizer - string identifier and builtin fns" {
,
[]Token.Id{
Token.Id.Keyword_const,
Token.Id.StringIdentifier,
Token.Id.Identifier,
Token.Id.Equal,
Token.Id.Builtin,
Token.Id.LParen,