std.zig.tokinizer now treats string identifiers as identifiers
parent
3b80e66507
commit
aa09e7b639
|
@ -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 {}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue