Skip to content

Commit f2c873c

Browse files
committed
Update to Python 3 string
1 parent 0c6a873 commit f2c873c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftSyntax/TokenKind.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public enum TokenKind {
7676
case .eof: return .zero
7777
% for token in SYNTAX_TOKENS:
7878
% if token.text:
79-
case .${token.swift_kind()}: return SourceLength(utf8Length: ${len(token.text.decode('string_escape'))})
79+
case .${token.swift_kind()}: return SourceLength(utf8Length: ${len(token.text.encode('utf-8').decode('unicode-escape'))})
8080
% else:
8181
case .${token.swift_kind()}(let text): return SourceLength(of: text)
8282
% end
@@ -168,7 +168,7 @@ extension TokenKind {
168168
% for token in SYNTAX_TOKENS:
169169
% if token.text:
170170
case .${token.swift_kind()}:
171-
let length = ${len(token.text.decode('string_escape'))}
171+
let length = ${len(token.text.encode('utf-8').decode('unicode-escape'))}
172172
return body(.init(kind: .${token.swift_kind()}, length: length))
173173
% else:
174174
case .${token.swift_kind()}(var text):

0 commit comments

Comments
 (0)